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/features/uiSpacing/presentation/scripts/consoleStyles.script.ts b/src/features/uiSpacing/presentation/scripts/consoleStyles.script.ts
new file mode 100644
index 0000000..6ba12c4
--- /dev/null
+++ b/src/features/uiSpacing/presentation/scripts/consoleStyles.script.ts
@@ -0,0 +1,13 @@
+import StylesheetScript from '../../../../common/architecture/scripts/stylesheet/StylesheetScript';
+import UiSpacingSharedStylesScript from './sharedStyles.script';
+
+export default class UiSpacingConsoleStylesScript extends StylesheetScript {
+ stylesheet = 'css/ui_spacing/console.css';
+
+ runAfter = [UiSpacingSharedStylesScript];
+ page: never;
+
+ async shouldBeInjected(): Promise<boolean> {
+ return await this.optionsProvider.isEnabled('uispacing');
+ }
+}
diff --git a/src/features/uiSpacing/presentation/scripts/sharedStyles.script.ts b/src/features/uiSpacing/presentation/scripts/sharedStyles.script.ts
new file mode 100644
index 0000000..e2caafc
--- /dev/null
+++ b/src/features/uiSpacing/presentation/scripts/sharedStyles.script.ts
@@ -0,0 +1,10 @@
+import StylesheetScript from '../../../../common/architecture/scripts/stylesheet/StylesheetScript';
+
+export default class UiSpacingSharedStylesScript extends StylesheetScript {
+ stylesheet = 'css/ui_spacing/shared.css';
+ page: never;
+
+ async shouldBeInjected(): Promise<boolean> {
+ return await this.optionsProvider.isEnabled('uispacing');
+ }
+}
diff --git a/src/features/uiSpacing/presentation/scripts/twBasicStyles.script.ts b/src/features/uiSpacing/presentation/scripts/twBasicStyles.script.ts
new file mode 100644
index 0000000..20e6dc9
--- /dev/null
+++ b/src/features/uiSpacing/presentation/scripts/twBasicStyles.script.ts
@@ -0,0 +1,13 @@
+import StylesheetScript from '../../../../common/architecture/scripts/stylesheet/StylesheetScript';
+import UiSpacingSharedStylesScript from './sharedStyles.script';
+
+export default class UiSpacingTwBasicStylesScript extends StylesheetScript {
+ stylesheet = 'css/ui_spacing/twbasic.css';
+
+ runAfter = [UiSpacingSharedStylesScript];
+ page: never;
+
+ async shouldBeInjected(): Promise<boolean> {
+ return await this.optionsProvider.isEnabled('uispacing');
+ }
+}