refactor(ui-spacing): migrate to the new DI architecture
With this migration we also get for free that this option is now
dynamic, so changing it will automatically update the applied styles.
Bug: twpowertools:176, twpowertools:61
Change-Id: Icac4f829745a06c95439931955be6c52c7303482
diff --git a/src/entryPoints/communityConsole/contentScripts/start.ts b/src/entryPoints/communityConsole/contentScripts/start.ts
index 21ef427..355fb0b 100644
--- a/src/entryPoints/communityConsole/contentScripts/start.ts
+++ b/src/entryPoints/communityConsole/contentScripts/start.ts
@@ -1,6 +1,3 @@
-// Run legacy Javascript entry point
-import '../../../contentScripts/communityConsole/start';
-
import DependenciesProviderSingleton, {
AutoRefreshDependency,
ExtraInfoDependency,
@@ -26,6 +23,8 @@
import ThreadPageDesignWarningSetUpScript from '../../../features/threadPageDesignWarning/presentation/scripts/setUp.script';
import FlattenThreadsSetUpReplyActionHandlerScript from '../../../features/flattenThreads/presentation/scripts/setUpReplyActionHandler.script';
import FlattenThreadsReplyActionHandler from '../../../features/flattenThreads/core/replyActionHandler';
+import UiSpacingSharedStylesScript from '../../../features/uiSpacing/presentation/scripts/sharedStyles.script';
+import UiSpacingConsoleStylesScript from '../../../features/uiSpacing/presentation/scripts/consoleStyles.script';
const scriptRunner = createScriptRunner();
scriptRunner.run();
@@ -61,6 +60,8 @@
new InteropThreadPageSetupScript(),
new ThreadPageDesignWarningSetUpScript(threadPageDesignWarning),
new LoadDraftsSetupScript(optionsProvider, startupDataStorage),
+ new UiSpacingConsoleStylesScript(),
+ new UiSpacingSharedStylesScript(),
new WorkflowsImportSetUpScript(workflowsImport),
// Standalone scripts
diff --git a/src/entryPoints/twBasic/thread/start.ts b/src/entryPoints/twBasic/thread/start.ts
new file mode 100644
index 0000000..d3fa2ea
--- /dev/null
+++ b/src/entryPoints/twBasic/thread/start.ts
@@ -0,0 +1,24 @@
+// Run legacy Javascript entry point
+import '../../../contentScripts/publicThreadStart';
+
+import UiSpacingSharedStylesScript from '../../../features/uiSpacing/presentation/scripts/sharedStyles.script';
+import UiSpacingTwBasicStylesScript from '../../../features/uiSpacing/presentation/scripts/twBasicStyles.script';
+import ScriptRunner from '../../../infrastructure/presentation/scripts/ScriptRunner';
+import ScriptSorterAdapter from '../../../infrastructure/presentation/scripts/ScriptSorter.adapter';
+import { SortedScriptsProviderAdapter } from '../../../infrastructure/presentation/scripts/SortedScriptsProvider.adapter';
+
+const scriptRunner = createScriptRunner();
+scriptRunner.run();
+
+function createScriptRunner() {
+ return new ScriptRunner(
+ new SortedScriptsProviderAdapter(
+ [
+ // Individual feature scripts
+ new UiSpacingSharedStylesScript(),
+ new UiSpacingTwBasicStylesScript(),
+ ],
+ new ScriptSorterAdapter(),
+ ).getScripts(),
+ );
+}