@vived/host 3.3.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/lib/Components/Dispatcher/UCs/DispatchThemeUC.d.ts +52 -1
  2. package/lib/Components/Dispatcher/UCs/DispatchThemeUC.js +7 -2
  3. package/lib/Components/Handler/UCs/SubmitLogHandler.js +25 -2
  4. package/lib/Components/Logger/Adapters/fatalErrorAdapter.d.ts +3 -0
  5. package/lib/Components/Logger/Adapters/fatalErrorAdapter.js +23 -0
  6. package/lib/Components/Logger/Adapters/index.d.ts +1 -0
  7. package/lib/Components/Logger/Adapters/index.js +13 -0
  8. package/lib/Components/Logger/Controllers/clickDownloadLog.d.ts +2 -0
  9. package/lib/Components/Logger/Controllers/clickDownloadLog.js +14 -0
  10. package/lib/Components/Logger/Controllers/index.d.ts +1 -0
  11. package/lib/Components/Logger/Controllers/index.js +13 -0
  12. package/lib/Components/Logger/Entities/LoggerEntity.d.ts +20 -0
  13. package/lib/Components/Logger/Entities/LoggerEntity.js +70 -0
  14. package/lib/Components/Logger/Entities/index.d.ts +1 -0
  15. package/lib/Components/Logger/Entities/index.js +13 -0
  16. package/lib/Components/Logger/Mocks/MockDownloadLogUC.d.ts +9 -0
  17. package/lib/Components/Logger/Mocks/MockDownloadLogUC.js +16 -0
  18. package/lib/Components/Logger/Mocks/MockFatalErrorPM.d.ts +8 -0
  19. package/lib/Components/Logger/Mocks/MockFatalErrorPM.js +15 -0
  20. package/lib/Components/Logger/Mocks/index.d.ts +2 -0
  21. package/lib/Components/Logger/Mocks/index.js +14 -0
  22. package/lib/Components/Logger/PMs/FatalErrorPM.d.ts +17 -0
  23. package/lib/Components/Logger/PMs/FatalErrorPM.js +18 -0
  24. package/lib/Components/Logger/PMs/index.d.ts +1 -0
  25. package/lib/Components/Logger/PMs/index.js +13 -0
  26. package/lib/Components/Logger/UCs/DownloadLogUC.d.ts +8 -0
  27. package/lib/Components/Logger/UCs/DownloadLogUC.js +36 -0
  28. package/lib/Components/Logger/UCs/index.d.ts +1 -0
  29. package/lib/Components/Logger/UCs/index.js +13 -0
  30. package/lib/Components/Logger/index.d.ts +6 -0
  31. package/lib/Components/Logger/index.js +18 -0
  32. package/lib/Components/ThemeColors/Adapter/index.d.ts +1 -0
  33. package/lib/Components/ThemeColors/Adapter/index.js +13 -0
  34. package/lib/Components/ThemeColors/Adapter/themeColorAdapter.d.ts +3 -0
  35. package/lib/Components/ThemeColors/Adapter/themeColorAdapter.js +23 -0
  36. package/lib/Components/ThemeColors/Controllers/getOnPrimaryColor.d.ts +3 -0
  37. package/lib/Components/ThemeColors/Controllers/getOnPrimaryColor.js +16 -0
  38. package/lib/Components/ThemeColors/Controllers/getOnSurfaceColor.d.ts +3 -0
  39. package/lib/Components/ThemeColors/Controllers/getOnSurfaceColor.js +16 -0
  40. package/lib/Components/ThemeColors/Controllers/getPrimaryColor.d.ts +3 -0
  41. package/lib/Components/ThemeColors/Controllers/getPrimaryColor.js +16 -0
  42. package/lib/Components/ThemeColors/Controllers/getSurfaceColor.d.ts +3 -0
  43. package/lib/Components/ThemeColors/Controllers/getSurfaceColor.js +16 -0
  44. package/lib/Components/ThemeColors/Controllers/getSurfaceContainerColor.d.ts +3 -0
  45. package/lib/Components/ThemeColors/Controllers/getSurfaceContainerColor.js +16 -0
  46. package/lib/Components/ThemeColors/Controllers/index.d.ts +5 -0
  47. package/lib/Components/ThemeColors/Controllers/index.js +17 -0
  48. package/lib/Components/ThemeColors/Data/index.d.ts +2 -0
  49. package/lib/Components/ThemeColors/Data/index.js +10 -0
  50. package/lib/Components/ThemeColors/Data/vivedDarkTheme.json +51 -0
  51. package/lib/Components/ThemeColors/Data/vivedLightTheme.json +51 -0
  52. package/lib/Components/ThemeColors/Entities/HostThemeEntity.d.ts +127 -0
  53. package/lib/Components/ThemeColors/Entities/HostThemeEntity.js +166 -0
  54. package/lib/Components/ThemeColors/Entities/index.d.ts +1 -0
  55. package/lib/Components/ThemeColors/Entities/index.js +13 -0
  56. package/lib/Components/ThemeColors/Mocks/MockThemeColorPM.d.ts +8 -0
  57. package/lib/Components/ThemeColors/Mocks/MockThemeColorPM.js +15 -0
  58. package/lib/Components/ThemeColors/Mocks/index.d.ts +1 -0
  59. package/lib/Components/ThemeColors/Mocks/index.js +13 -0
  60. package/lib/Components/ThemeColors/PM/ThemeColorsPM.d.ts +12 -0
  61. package/lib/Components/ThemeColors/PM/ThemeColorsPM.js +46 -0
  62. package/lib/Components/ThemeColors/PM/index.d.ts +1 -0
  63. package/lib/Components/ThemeColors/PM/index.js +13 -0
  64. package/lib/Components/ThemeColors/UCs/SetThemeUC.d.ts +10 -0
  65. package/lib/Components/ThemeColors/UCs/SetThemeUC.js +43 -0
  66. package/lib/Components/ThemeColors/UCs/index.d.ts +1 -0
  67. package/lib/Components/ThemeColors/UCs/index.js +13 -0
  68. package/lib/Components/ThemeColors/index.d.ts +7 -0
  69. package/lib/Components/ThemeColors/index.js +19 -0
  70. package/lib/Components/index.d.ts +2 -0
  71. package/lib/Components/index.js +2 -0
  72. package/lib/Entities/MemoizedColor.d.ts +9 -0
  73. package/lib/Entities/MemoizedColor.js +23 -0
  74. package/lib/Entities/index.d.ts +9 -9
  75. package/lib/Entities/index.js +1 -1
  76. package/lib/Utilities/addAlphaToHex.d.ts +1 -0
  77. package/lib/Utilities/addAlphaToHex.js +16 -0
  78. package/lib/Utilities/alphaToHex.d.ts +2 -0
  79. package/lib/Utilities/alphaToHex.js +21 -0
  80. package/lib/Utilities/downloadFile.d.ts +1 -0
  81. package/lib/Utilities/downloadFile.js +14 -0
  82. package/lib/Utilities/index.d.ts +3 -0
  83. package/lib/Utilities/index.js +3 -0
  84. package/lib/ValueObjects/Color.d.ts +82 -0
  85. package/lib/ValueObjects/Color.js +858 -0
  86. package/lib/ValueObjects/index.d.ts +2 -1
  87. package/lib/ValueObjects/index.js +1 -0
  88. package/package.json +1 -1
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPrimaryColor = void 0;
4
+ const ValueObjects_1 = require("../../../ValueObjects");
5
+ const Entities_1 = require("../Entities");
6
+ function getPrimaryColor(appObjects) {
7
+ const theme = Entities_1.HostThemeEntity.get(appObjects);
8
+ if (theme) {
9
+ return theme.getColorForType(Entities_1.ThemeColorType.primary);
10
+ }
11
+ else {
12
+ appObjects.submitError("getPrimaryColor", "Unable to find ThemeColors");
13
+ return ValueObjects_1.Color.RGB(0, 0, 0);
14
+ }
15
+ }
16
+ exports.getPrimaryColor = getPrimaryColor;
@@ -0,0 +1,3 @@
1
+ import { HostAppObjectRepo } from "../../../HostAppObject";
2
+ import { Color } from "../../../ValueObjects";
3
+ export declare function getSurfaceColor(appObjects: HostAppObjectRepo): Color;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSurfaceColor = void 0;
4
+ const ValueObjects_1 = require("../../../ValueObjects");
5
+ const Entities_1 = require("../Entities");
6
+ function getSurfaceColor(appObjects) {
7
+ const theme = Entities_1.HostThemeEntity.get(appObjects);
8
+ if (theme) {
9
+ return theme.getColorForType(Entities_1.ThemeColorType.surface);
10
+ }
11
+ else {
12
+ appObjects.submitError("getSurfaceColor", "Unable to find ThemeColors");
13
+ return ValueObjects_1.Color.RGB(0, 0, 0);
14
+ }
15
+ }
16
+ exports.getSurfaceColor = getSurfaceColor;
@@ -0,0 +1,3 @@
1
+ import { HostAppObjectRepo } from "../../../HostAppObject";
2
+ import { Color } from "../../../ValueObjects";
3
+ export declare function getSurfaceContainerColor(appObjects: HostAppObjectRepo): Color;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSurfaceContainerColor = void 0;
4
+ const ValueObjects_1 = require("../../../ValueObjects");
5
+ const Entities_1 = require("../Entities");
6
+ function getSurfaceContainerColor(appObjects) {
7
+ const theme = Entities_1.HostThemeEntity.get(appObjects);
8
+ if (theme) {
9
+ return theme.getColorForType(Entities_1.ThemeColorType.surfaceContainer);
10
+ }
11
+ else {
12
+ appObjects.submitError("getSurfaceColor", "Unable to find ThemeColors");
13
+ return ValueObjects_1.Color.RGB(0, 0, 0);
14
+ }
15
+ }
16
+ exports.getSurfaceContainerColor = getSurfaceContainerColor;
@@ -0,0 +1,5 @@
1
+ export * from "./getOnPrimaryColor";
2
+ export * from "./getOnSurfaceColor";
3
+ export * from "./getPrimaryColor";
4
+ export * from "./getSurfaceColor";
5
+ export * from "./getSurfaceContainerColor";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./getOnPrimaryColor"), exports);
14
+ __exportStar(require("./getOnSurfaceColor"), exports);
15
+ __exportStar(require("./getPrimaryColor"), exports);
16
+ __exportStar(require("./getSurfaceColor"), exports);
17
+ __exportStar(require("./getSurfaceContainerColor"), exports);
@@ -0,0 +1,2 @@
1
+ export { default as vivedDarkThemeData } from "./vivedDarkTheme.json";
2
+ export { default as vivedLightThemeData } from "./vivedLightTheme.json";
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.vivedLightThemeData = exports.vivedDarkThemeData = void 0;
7
+ var vivedDarkTheme_json_1 = require("./vivedDarkTheme.json");
8
+ Object.defineProperty(exports, "vivedDarkThemeData", { enumerable: true, get: function () { return __importDefault(vivedDarkTheme_json_1).default; } });
9
+ var vivedLightTheme_json_1 = require("./vivedLightTheme.json");
10
+ Object.defineProperty(exports, "vivedLightThemeData", { enumerable: true, get: function () { return __importDefault(vivedLightTheme_json_1).default; } });
@@ -0,0 +1,51 @@
1
+ {
2
+ "primary": "#7BD0FF",
3
+ "onPrimary": "#003549",
4
+ "primaryContainer": "#004C69",
5
+ "onPrimaryContainer": "#C4E7FF",
6
+ "primaryFixed": "#C4E7FF",
7
+ "onPrimaryFixed": "#001E2C",
8
+ "primaryFixedDim": "#7BD0FF",
9
+ "onPrimaryFixedVariant": "#004C69",
10
+ "secondary": "#B5C9D7",
11
+ "onSecondary": "#20333E",
12
+ "secondaryContainer": "#374955",
13
+ "onSecondaryContainer": "#D1E5F4",
14
+ "secondaryFixed": "#D1E5F4",
15
+ "onSecondaryFixed": "#0A1E28",
16
+ "secondaryFixedDim": "#B5C9D7",
17
+ "onSecondaryFixedVariant": "#374955",
18
+ "tertiary": "#CAC1E9",
19
+ "onTertiary": "#322C4C",
20
+ "tertiaryContainer": "#484264",
21
+ "onTertiaryContainer": "#E6DEFF",
22
+ "tertiaryFixed": "#E6DEFF",
23
+ "onTertiaryFixed": "#1D1736",
24
+ "tertiaryFixedDim": "#CAC1E9",
25
+ "onTertiaryFixedVariant": "#484264",
26
+ "error": "#FFB4AB",
27
+ "onError": "#690005",
28
+ "errorContainer": "#93000A",
29
+ "onErrorContainer": "#FFDAD6",
30
+ "outline": "#8B9297",
31
+ "background": "#191C1E",
32
+ "onBackground": "#E1E2E5",
33
+ "surface": "#111416",
34
+ "onSurface": "#C5C6C9",
35
+ "surfaceVariant": "#41484D",
36
+ "onSurfaceVariant": "#C0C7CD",
37
+ "inverseSurface": "#E1E2E5",
38
+ "inverseOnSurface": "#191C1E",
39
+ "inversePrimary": "#00668A",
40
+ "shadow": "#000000",
41
+ "surfaceTint": "#7BD0FF",
42
+ "outlineVariant": "#41484D",
43
+ "scrim": "#000000",
44
+ "surfaceContainerHighest": "#333537",
45
+ "surfaceContainerHigh": "#282A2C",
46
+ "surfaceContainer": "#1D2022",
47
+ "surfaceContainerLow": "#191C1E",
48
+ "surfaceContainerLowest": "#0C0F10",
49
+ "surfaceBright": "#37393C",
50
+ "surfaceDim": "#111416"
51
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "primary": "#00668A",
3
+ "onPrimary": "#FFFFFF",
4
+ "primaryContainer": "#C4E7FF",
5
+ "onPrimaryContainer": "#001E2C",
6
+ "primaryFixed": "#C4E7FF",
7
+ "onPrimaryFixed": "#001E2C",
8
+ "primaryFixedDim": "#7BD0FF",
9
+ "onPrimaryFixedVariant": "#004C69",
10
+ "secondary": "#4E616D",
11
+ "onSecondary": "#FFFFFF",
12
+ "secondaryContainer": "#D1E5F4",
13
+ "onSecondaryContainer": "#0A1E28",
14
+ "secondaryFixed": "#D1E5F4",
15
+ "onSecondaryFixed": "#0A1E28",
16
+ "secondaryFixedDim": "#B5C9D7",
17
+ "onSecondaryFixedVariant": "#374955",
18
+ "tertiary": "#605A7D",
19
+ "onTertiary": "#FFFFFF",
20
+ "tertiaryContainer": "#E6DEFF",
21
+ "onTertiaryContainer": "#1D1736",
22
+ "tertiaryFixed": "#E6DEFF",
23
+ "onTertiaryFixed": "#1D1736",
24
+ "tertiaryFixedDim": "#CAC1E9",
25
+ "onTertiaryFixedVariant": "#484264",
26
+ "error": "#BA1A1A",
27
+ "onError": "#FFFFFF",
28
+ "errorContainer": "#FFDAD6",
29
+ "onErrorContainer": "#410002",
30
+ "outline": "#71787D",
31
+ "background": "#FBFCFF",
32
+ "onBackground": "#191C1E",
33
+ "surface": "#F8F9FC",
34
+ "onSurface": "#191C1E",
35
+ "surfaceVariant": "#DCE3E9",
36
+ "onSurfaceVariant": "#41484D",
37
+ "inverseSurface": "#2E3133",
38
+ "inverseOnSurface": "#F0F1F3",
39
+ "inversePrimary": "#7BD0FF",
40
+ "shadow": "#000000",
41
+ "surfaceTint": "#00668A",
42
+ "outlineVariant": "#C0C7CD",
43
+ "scrim": "#000000",
44
+ "surfaceContainerHighest": "#E1E2E5",
45
+ "surfaceContainerHigh": "#E7E8EA",
46
+ "surfaceContainer": "#EDEEF0",
47
+ "surfaceContainerLow": "#F3F3F6",
48
+ "surfaceContainerLowest": "#FFFFFF",
49
+ "surfaceBright": "#F8F9FC",
50
+ "surfaceDim": "#D9DADC"
51
+ }
@@ -0,0 +1,127 @@
1
+ import { HostAppObject, HostAppObjectEntity, HostAppObjectRepo } from "../../../HostAppObject";
2
+ import { Color } from "../../../ValueObjects";
3
+ export declare enum ThemeColorType {
4
+ primary = "primary",
5
+ onPrimary = "onPrimary",
6
+ primaryContainer = "primaryContainer",
7
+ onPrimaryContainer = "onPrimaryContainer",
8
+ primaryFixed = "primaryFixed",
9
+ onPrimaryFixed = "onPrimaryFixed",
10
+ primaryFixedDim = "primaryFixedDim",
11
+ onPrimaryFixedVariant = "onPrimaryFixedVariant",
12
+ secondary = "secondary",
13
+ onSecondary = "onSecondary",
14
+ secondaryContainer = "secondaryContainer",
15
+ onSecondaryContainer = "onSecondaryContainer",
16
+ secondaryFixed = "secondaryFixed",
17
+ onSecondaryFixed = "onSecondaryFixed",
18
+ secondaryFixedDim = "secondaryFixedDim",
19
+ onSecondaryFixedVariant = "onSecondaryFixedVariant",
20
+ tertiary = "tertiary",
21
+ onTertiary = "onTertiary",
22
+ tertiaryContainer = "tertiaryContainer",
23
+ onTertiaryContainer = "onTertiaryContainer",
24
+ tertiaryFixed = "tertiaryFixed",
25
+ onTertiaryFixed = "onTertiaryFixed",
26
+ tertiaryFixedDim = "tertiaryFixedDim",
27
+ onTertiaryFixedVariant = "onTertiaryFixedVariant",
28
+ error = "error",
29
+ onError = "onError",
30
+ errorContainer = "errorContainer",
31
+ onErrorContainer = "onErrorContainer",
32
+ outline = "outline",
33
+ background = "background",
34
+ onBackground = "onBackground",
35
+ surface = "surface",
36
+ onSurface = "onSurface",
37
+ surfaceVariant = "surfaceVariant",
38
+ onSurfaceVariant = "onSurfaceVariant",
39
+ inverseSurface = "inverseSurface",
40
+ inverseOnSurface = "inverseOnSurface",
41
+ inversePrimary = "inversePrimary",
42
+ shadow = "shadow",
43
+ surfaceTint = "surfaceTint",
44
+ outlineVariant = "outlineVariant",
45
+ scrim = "scrim",
46
+ surfaceContainerHighest = "surfaceContainerHighest",
47
+ surfaceContainerHigh = "surfaceContainerHigh",
48
+ surfaceContainer = "surfaceContainer",
49
+ surfaceContainerLow = "surfaceContainerLow",
50
+ surfaceContainerLowest = "surfaceContainerLowest",
51
+ surfaceBright = "surfaceBright",
52
+ surfaceDim = "surfaceDim"
53
+ }
54
+ export interface ColorScheme {
55
+ primary: string;
56
+ onPrimary: string;
57
+ primaryContainer: string;
58
+ onPrimaryContainer: string;
59
+ primaryFixed: string;
60
+ onPrimaryFixed: string;
61
+ primaryFixedDim: string;
62
+ onPrimaryFixedVariant: string;
63
+ secondary: string;
64
+ onSecondary: string;
65
+ secondaryContainer: string;
66
+ onSecondaryContainer: string;
67
+ secondaryFixed: string;
68
+ onSecondaryFixed: string;
69
+ secondaryFixedDim: string;
70
+ onSecondaryFixedVariant: string;
71
+ tertiary: string;
72
+ onTertiary: string;
73
+ tertiaryContainer: string;
74
+ onTertiaryContainer: string;
75
+ tertiaryFixed: string;
76
+ onTertiaryFixed: string;
77
+ tertiaryFixedDim: string;
78
+ onTertiaryFixedVariant: string;
79
+ error: string;
80
+ onError: string;
81
+ errorContainer: string;
82
+ onErrorContainer: string;
83
+ outline: string;
84
+ background: string;
85
+ onBackground: string;
86
+ surface: string;
87
+ onSurface: string;
88
+ surfaceVariant: string;
89
+ onSurfaceVariant: string;
90
+ inverseSurface: string;
91
+ inverseOnSurface: string;
92
+ inversePrimary: string;
93
+ shadow: string;
94
+ surfaceTint: string;
95
+ outlineVariant: string;
96
+ scrim: string;
97
+ surfaceContainerHighest: string;
98
+ surfaceContainerHigh: string;
99
+ surfaceContainer: string;
100
+ surfaceContainerLow: string;
101
+ surfaceContainerLowest: string;
102
+ surfaceBright: string;
103
+ surfaceDim: string;
104
+ }
105
+ export declare abstract class HostThemeEntity extends HostAppObjectEntity {
106
+ static readonly type = "HostThemeEntity";
107
+ abstract submitScheme(name: string, scheme: ColorScheme): void;
108
+ abstract activeSchemeName: string;
109
+ abstract get activeScheme(): ColorScheme;
110
+ abstract getColorForType(type: ThemeColorType): Color;
111
+ abstract getHexForType(type: ThemeColorType): string;
112
+ static get: (appObjects: HostAppObjectRepo) => HostThemeEntity | undefined;
113
+ }
114
+ export declare function makeHostThemeEntity(appObject: HostAppObject): HostThemeEntityImp;
115
+ declare class HostThemeEntityImp extends HostThemeEntity {
116
+ private schemeLookup;
117
+ get activeScheme(): ColorScheme;
118
+ submitScheme: (name: string, scheme: ColorScheme) => void;
119
+ getHexForType(type: ThemeColorType): string;
120
+ private memoizedActiveScheme;
121
+ get activeSchemeName(): string;
122
+ set activeSchemeName(val: string);
123
+ constructor(appObject: HostAppObject);
124
+ getColorForType: (type: ThemeColorType) => Color;
125
+ }
126
+ export declare const defaultScheme: ColorScheme;
127
+ export {};
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultScheme = exports.makeHostThemeEntity = exports.HostThemeEntity = exports.ThemeColorType = void 0;
4
+ const Entities_1 = require("../../../Entities");
5
+ const HostAppObject_1 = require("../../../HostAppObject");
6
+ const ValueObjects_1 = require("../../../ValueObjects");
7
+ var ThemeColorType;
8
+ (function (ThemeColorType) {
9
+ ThemeColorType["primary"] = "primary";
10
+ ThemeColorType["onPrimary"] = "onPrimary";
11
+ ThemeColorType["primaryContainer"] = "primaryContainer";
12
+ ThemeColorType["onPrimaryContainer"] = "onPrimaryContainer";
13
+ ThemeColorType["primaryFixed"] = "primaryFixed";
14
+ ThemeColorType["onPrimaryFixed"] = "onPrimaryFixed";
15
+ ThemeColorType["primaryFixedDim"] = "primaryFixedDim";
16
+ ThemeColorType["onPrimaryFixedVariant"] = "onPrimaryFixedVariant";
17
+ ThemeColorType["secondary"] = "secondary";
18
+ ThemeColorType["onSecondary"] = "onSecondary";
19
+ ThemeColorType["secondaryContainer"] = "secondaryContainer";
20
+ ThemeColorType["onSecondaryContainer"] = "onSecondaryContainer";
21
+ ThemeColorType["secondaryFixed"] = "secondaryFixed";
22
+ ThemeColorType["onSecondaryFixed"] = "onSecondaryFixed";
23
+ ThemeColorType["secondaryFixedDim"] = "secondaryFixedDim";
24
+ ThemeColorType["onSecondaryFixedVariant"] = "onSecondaryFixedVariant";
25
+ ThemeColorType["tertiary"] = "tertiary";
26
+ ThemeColorType["onTertiary"] = "onTertiary";
27
+ ThemeColorType["tertiaryContainer"] = "tertiaryContainer";
28
+ ThemeColorType["onTertiaryContainer"] = "onTertiaryContainer";
29
+ ThemeColorType["tertiaryFixed"] = "tertiaryFixed";
30
+ ThemeColorType["onTertiaryFixed"] = "onTertiaryFixed";
31
+ ThemeColorType["tertiaryFixedDim"] = "tertiaryFixedDim";
32
+ ThemeColorType["onTertiaryFixedVariant"] = "onTertiaryFixedVariant";
33
+ ThemeColorType["error"] = "error";
34
+ ThemeColorType["onError"] = "onError";
35
+ ThemeColorType["errorContainer"] = "errorContainer";
36
+ ThemeColorType["onErrorContainer"] = "onErrorContainer";
37
+ ThemeColorType["outline"] = "outline";
38
+ ThemeColorType["background"] = "background";
39
+ ThemeColorType["onBackground"] = "onBackground";
40
+ ThemeColorType["surface"] = "surface";
41
+ ThemeColorType["onSurface"] = "onSurface";
42
+ ThemeColorType["surfaceVariant"] = "surfaceVariant";
43
+ ThemeColorType["onSurfaceVariant"] = "onSurfaceVariant";
44
+ ThemeColorType["inverseSurface"] = "inverseSurface";
45
+ ThemeColorType["inverseOnSurface"] = "inverseOnSurface";
46
+ ThemeColorType["inversePrimary"] = "inversePrimary";
47
+ ThemeColorType["shadow"] = "shadow";
48
+ ThemeColorType["surfaceTint"] = "surfaceTint";
49
+ ThemeColorType["outlineVariant"] = "outlineVariant";
50
+ ThemeColorType["scrim"] = "scrim";
51
+ ThemeColorType["surfaceContainerHighest"] = "surfaceContainerHighest";
52
+ ThemeColorType["surfaceContainerHigh"] = "surfaceContainerHigh";
53
+ ThemeColorType["surfaceContainer"] = "surfaceContainer";
54
+ ThemeColorType["surfaceContainerLow"] = "surfaceContainerLow";
55
+ ThemeColorType["surfaceContainerLowest"] = "surfaceContainerLowest";
56
+ ThemeColorType["surfaceBright"] = "surfaceBright";
57
+ ThemeColorType["surfaceDim"] = "surfaceDim";
58
+ })(ThemeColorType = exports.ThemeColorType || (exports.ThemeColorType = {}));
59
+ class HostThemeEntity extends HostAppObject_1.HostAppObjectEntity {
60
+ }
61
+ exports.HostThemeEntity = HostThemeEntity;
62
+ HostThemeEntity.type = "HostThemeEntity";
63
+ HostThemeEntity.get = (appObjects) => HostAppObject_1.getSingletonComponent(HostThemeEntity.type, appObjects);
64
+ function makeHostThemeEntity(appObject) {
65
+ return new HostThemeEntityImp(appObject);
66
+ }
67
+ exports.makeHostThemeEntity = makeHostThemeEntity;
68
+ class HostThemeEntityImp extends HostThemeEntity {
69
+ constructor(appObject) {
70
+ super(appObject, HostThemeEntity.type);
71
+ this.schemeLookup = new Map();
72
+ this.submitScheme = (name, scheme) => {
73
+ if (this.schemeLookup.has(name)) {
74
+ this.warn("Duplicate scheme name submitted. Overwriting");
75
+ }
76
+ this.schemeLookup.set(name, scheme);
77
+ if (!this.activeSchemeName) {
78
+ this.activeSchemeName = name;
79
+ }
80
+ };
81
+ this.memoizedActiveScheme = new Entities_1.MemoizedString("", this.notifyOnChange);
82
+ this.getColorForType = (type) => {
83
+ const scheme = this.schemeLookup.get(this.activeSchemeName);
84
+ if (!scheme) {
85
+ this.error("No active scheme");
86
+ return ValueObjects_1.Color.RGB(0, 0, 0);
87
+ }
88
+ const colorHex = scheme[type];
89
+ return ValueObjects_1.Color.Hex(colorHex);
90
+ };
91
+ this.appObjects.registerSingleton(this);
92
+ }
93
+ get activeScheme() {
94
+ var _a;
95
+ return (_a = this.schemeLookup.get(this.activeSchemeName)) !== null && _a !== void 0 ? _a : exports.defaultScheme;
96
+ }
97
+ getHexForType(type) {
98
+ const scheme = this.schemeLookup.get(this.activeSchemeName);
99
+ if (!scheme) {
100
+ this.error("No active scheme");
101
+ return "#000000";
102
+ }
103
+ return scheme[type];
104
+ }
105
+ get activeSchemeName() {
106
+ return this.memoizedActiveScheme.val;
107
+ }
108
+ set activeSchemeName(val) {
109
+ if (!this.schemeLookup.has(val)) {
110
+ this.warn(`Unknown theme schema: ${val}. Ignoring.`);
111
+ return;
112
+ }
113
+ this.memoizedActiveScheme.val = val;
114
+ }
115
+ }
116
+ exports.defaultScheme = {
117
+ primary: "#7BD0FF",
118
+ onPrimary: "#003549",
119
+ primaryContainer: "#004C69",
120
+ onPrimaryContainer: "#C4E7FF",
121
+ primaryFixed: "#C4E7FF",
122
+ onPrimaryFixed: "#001E2C",
123
+ primaryFixedDim: "#7BD0FF",
124
+ onPrimaryFixedVariant: "#004C69",
125
+ secondary: "#B5C9D7",
126
+ onSecondary: "#20333E",
127
+ secondaryContainer: "#374955",
128
+ onSecondaryContainer: "#D1E5F4",
129
+ secondaryFixed: "#D1E5F4",
130
+ onSecondaryFixed: "#0A1E28",
131
+ secondaryFixedDim: "#B5C9D7",
132
+ onSecondaryFixedVariant: "#374955",
133
+ tertiary: "#CAC1E9",
134
+ onTertiary: "#322C4C",
135
+ tertiaryContainer: "#484264",
136
+ onTertiaryContainer: "#E6DEFF",
137
+ tertiaryFixed: "#E6DEFF",
138
+ onTertiaryFixed: "#1D1736",
139
+ tertiaryFixedDim: "#CAC1E9",
140
+ onTertiaryFixedVariant: "#484264",
141
+ error: "#FFB4AB",
142
+ onError: "#690005",
143
+ errorContainer: "#93000A",
144
+ onErrorContainer: "#FFDAD6",
145
+ outline: "#8B9297",
146
+ background: "#191C1E",
147
+ onBackground: "#E1E2E5",
148
+ surface: "#111416",
149
+ onSurface: "#C5C6C9",
150
+ surfaceVariant: "#41484D",
151
+ onSurfaceVariant: "#C0C7CD",
152
+ inverseSurface: "#E1E2E5",
153
+ inverseOnSurface: "#191C1E",
154
+ inversePrimary: "#00668A",
155
+ shadow: "#000000",
156
+ surfaceTint: "#7BD0FF",
157
+ outlineVariant: "#41484D",
158
+ scrim: "#000000",
159
+ surfaceContainerHighest: "#333537",
160
+ surfaceContainerHigh: "#282A2C",
161
+ surfaceContainer: "#1D2022",
162
+ surfaceContainerLow: "#191C1E",
163
+ surfaceContainerLowest: "#0C0F10",
164
+ surfaceBright: "#37393C",
165
+ surfaceDim: "#111416"
166
+ };
@@ -0,0 +1 @@
1
+ export * from "./HostThemeEntity";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./HostThemeEntity"), exports);
@@ -0,0 +1,8 @@
1
+ /// <reference types="jest" />
2
+ import { HostAppObject, HostAppObjectRepo } from "../../../HostAppObject";
3
+ import { ThemeColorsPM } from "../PM";
4
+ export declare class MockThemeColorPM extends ThemeColorsPM {
5
+ vmsAreEqual: jest.Mock<any, any>;
6
+ constructor(appObject: HostAppObject);
7
+ }
8
+ export declare function makeMockThemeColorPM(appObjects: HostAppObjectRepo): MockThemeColorPM;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeMockThemeColorPM = exports.MockThemeColorPM = void 0;
4
+ const PM_1 = require("../PM");
5
+ class MockThemeColorPM extends PM_1.ThemeColorsPM {
6
+ constructor(appObject) {
7
+ super(appObject, PM_1.ThemeColorsPM.type);
8
+ this.vmsAreEqual = jest.fn();
9
+ }
10
+ }
11
+ exports.MockThemeColorPM = MockThemeColorPM;
12
+ function makeMockThemeColorPM(appObjects) {
13
+ return new MockThemeColorPM(appObjects.getOrCreate("MockThemeColorPM"));
14
+ }
15
+ exports.makeMockThemeColorPM = makeMockThemeColorPM;
@@ -0,0 +1 @@
1
+ export * from "./MockThemeColorPM";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./MockThemeColorPM"), exports);
@@ -0,0 +1,12 @@
1
+ import { HostAppObject, HostAppObjectPM, HostAppObjectRepo } from "../../../HostAppObject";
2
+ import { ColorScheme } from "../Entities/HostThemeEntity";
3
+ export interface ThemeColorsVM {
4
+ themeName: string;
5
+ scheme: ColorScheme;
6
+ }
7
+ export declare const defaultThemeColorsVM: ThemeColorsVM;
8
+ export declare abstract class ThemeColorsPM extends HostAppObjectPM<ThemeColorsVM> {
9
+ static readonly type = "ThemeColorsPM";
10
+ static get(appObjects: HostAppObjectRepo): ThemeColorsPM | undefined;
11
+ }
12
+ export declare function makeThemeColorsPM(appObject: HostAppObject): ThemeColorsPM;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeThemeColorsPM = exports.ThemeColorsPM = exports.defaultThemeColorsVM = void 0;
4
+ const HostAppObject_1 = require("../../../HostAppObject");
5
+ const HostThemeEntity_1 = require("../Entities/HostThemeEntity");
6
+ exports.defaultThemeColorsVM = {
7
+ themeName: "",
8
+ scheme: HostThemeEntity_1.defaultScheme
9
+ };
10
+ class ThemeColorsPM extends HostAppObject_1.HostAppObjectPM {
11
+ static get(appObjects) {
12
+ return HostAppObject_1.getSingletonComponent(ThemeColorsPM.type, appObjects);
13
+ }
14
+ }
15
+ exports.ThemeColorsPM = ThemeColorsPM;
16
+ ThemeColorsPM.type = "ThemeColorsPM";
17
+ function makeThemeColorsPM(appObject) {
18
+ return new ThemeColorsPMImp(appObject);
19
+ }
20
+ exports.makeThemeColorsPM = makeThemeColorsPM;
21
+ class ThemeColorsPMImp extends ThemeColorsPM {
22
+ constructor(appObject) {
23
+ super(appObject, ThemeColorsPM.type);
24
+ this.onThemeChange = () => {
25
+ if (!this.themeColors)
26
+ return;
27
+ this.doUpdateView({
28
+ themeName: this.themeColors.activeSchemeName,
29
+ scheme: this.themeColors.activeScheme
30
+ });
31
+ };
32
+ this.appObjects.registerSingleton(this);
33
+ this.themeColors = HostThemeEntity_1.HostThemeEntity.get(appObject.appObjectRepo);
34
+ if (!this.themeColors) {
35
+ this.error("Unable to find HostThemeEntity");
36
+ return;
37
+ }
38
+ else {
39
+ this.themeColors.addChangeObserver(this.onThemeChange);
40
+ this.onThemeChange();
41
+ }
42
+ }
43
+ vmsAreEqual(a, b) {
44
+ return a.themeName === b.themeName;
45
+ }
46
+ }
@@ -0,0 +1 @@
1
+ export * from "./ThemeColorsPM";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./ThemeColorsPM"), exports);
@@ -0,0 +1,10 @@
1
+ import { HostAppObject, HostAppObjectRepo, HostAppObjectUC } from "../../../HostAppObject";
2
+ export declare abstract class SetThemeUC extends HostAppObjectUC {
3
+ static type: string;
4
+ abstract lightThemeName: string;
5
+ abstract darkThemeName: string;
6
+ abstract setThemeByName(name: string): void;
7
+ abstract tryDetectTheme(): void;
8
+ static get(appObjects: HostAppObjectRepo): SetThemeUC | undefined;
9
+ }
10
+ export declare function makeSetThemeUC(appObject: HostAppObject): SetThemeUC;