@vived/app 4.0.0 → 4.1.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.
- package/lib/AppObject/AppObjectRepo.d.ts +2 -0
- package/lib/AppObject/AppObjectRepo.js +25 -0
- package/lib/Components/App/UC/EditSlideTextUC.d.ts +1 -0
- package/lib/Components/ThemeColors/Entities/ThemeColors.d.ts +2 -0
- package/lib/Components/ThemeColors/Entities/ThemeColors.js +56 -0
- package/lib/Components/ThemeColors/PM/ThemeColorMapPM.d.ts +11 -0
- package/lib/Components/ThemeColors/PM/ThemeColorMapPM.js +39 -0
- package/lib/Components/ThemeColors/PM/index.d.ts +1 -0
- package/lib/Components/ThemeColors/PM/index.js +13 -0
- package/lib/Components/ThemeColors/index.d.ts +1 -0
- package/lib/Components/ThemeColors/index.js +1 -0
- package/package.json +1 -1
|
@@ -12,6 +12,8 @@ export declare abstract class AppObjectRepo extends ObservableEntity {
|
|
|
12
12
|
abstract submitWarning(sender: string, message: string): void;
|
|
13
13
|
abstract submitError(sender: string, message: string): void;
|
|
14
14
|
abstract submitFatal(sender: string, message: string): void;
|
|
15
|
+
abstract registerSingleton(component: AppObjectComponent): void;
|
|
16
|
+
abstract getSingleton<T extends AppObjectComponent>(type: string): T | undefined;
|
|
15
17
|
abstract getAppObjectComponent<T extends AppObjectComponent>(appObjectID: string, type: string): T | undefined;
|
|
16
18
|
abstract getAllAppObjectsWithComponent(componentType: string): AppObject[];
|
|
17
19
|
abstract getAllComponents<T extends AppObjectComponent>(type: string): T[];
|
|
@@ -14,6 +14,7 @@ class AppObjectRepoImp extends AppObjectRepo {
|
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
16
|
this.appObjectLookup = new Map();
|
|
17
|
+
this.singletons = new Map();
|
|
17
18
|
this.onAppObjectAddedObserver = new Entities_1.ObserverList();
|
|
18
19
|
this.addAppObjectAddedObserver = (observer) => {
|
|
19
20
|
this.onAppObjectAddedObserver.add(observer);
|
|
@@ -104,4 +105,28 @@ class AppObjectRepoImp extends AppObjectRepo {
|
|
|
104
105
|
submitFatal(sender, message) {
|
|
105
106
|
console.error(`FATAL ERROR - [${sender}]: ${message}`);
|
|
106
107
|
}
|
|
108
|
+
registerSingleton(component) {
|
|
109
|
+
if (this.singletons.has(component.type)) {
|
|
110
|
+
this.submitWarning("AppObjectRepo", `Singleton for type ${component.type} already exists. Relpacing`);
|
|
111
|
+
}
|
|
112
|
+
this.singletons.set(component.type, component);
|
|
113
|
+
}
|
|
114
|
+
getSingleton(type) {
|
|
115
|
+
if (this.singletons.has(type)) {
|
|
116
|
+
return this.singletons.get(type);
|
|
117
|
+
}
|
|
118
|
+
const components = this.getAllComponents(type);
|
|
119
|
+
if (components.length === 1) {
|
|
120
|
+
this.singletons.set(components[0].type, components[0]);
|
|
121
|
+
return components[0];
|
|
122
|
+
}
|
|
123
|
+
else if (components.length === 0) {
|
|
124
|
+
this.submitWarning("AppObjectRepo", `Unable to find a singleton for ${type}`);
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
else if (components.length > 1) {
|
|
128
|
+
this.submitWarning("AppObjectRepo", `Multiple ${type} found. There should only be one if it truly a singleton. Using the first one`);
|
|
129
|
+
return components[0];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
107
132
|
}
|
|
@@ -4,6 +4,7 @@ import { AppObjectUC } from "../../../AppObject/AppObjectUC";
|
|
|
4
4
|
export declare abstract class EditSlideTextUC extends AppObjectUC {
|
|
5
5
|
static readonly type = "EditSlideTextUC";
|
|
6
6
|
abstract editSlideText(): void;
|
|
7
|
+
abstract submitCallback(text: string): void;
|
|
7
8
|
static get: (appObjects: AppObjectRepo) => EditSlideTextUC | undefined;
|
|
8
9
|
}
|
|
9
10
|
export declare function makeEditSlideTextUC(appObject: AppObject): EditSlideTextUC;
|
|
@@ -56,6 +56,7 @@ export declare abstract class ThemeColors extends AppObjectEntity {
|
|
|
56
56
|
abstract getColorForType(type: ThemeColorType): Color;
|
|
57
57
|
abstract setColorForType(type: ThemeColorType, val: Color): void;
|
|
58
58
|
abstract setColorHexForType(type: ThemeColorType, hex: string): void;
|
|
59
|
+
abstract setColorHexForSet(colorSet: Map<ThemeColorType, string>): void;
|
|
59
60
|
static get: (appObjects: AppObjectRepo) => ThemeColors | undefined;
|
|
60
61
|
}
|
|
61
62
|
export declare function makeThemeColors(appObject: AppObject): ThemeColorsImp;
|
|
@@ -65,5 +66,6 @@ declare class ThemeColorsImp extends ThemeColors {
|
|
|
65
66
|
getColorForType: (type: ThemeColorType) => Color;
|
|
66
67
|
setColorForType: (type: ThemeColorType, val: Color) => void;
|
|
67
68
|
setColorHexForType: (type: ThemeColorType, hex: string) => void;
|
|
69
|
+
setColorHexForSet(colorSet: Map<ThemeColorType, string>): void;
|
|
68
70
|
}
|
|
69
71
|
export {};
|
|
@@ -98,5 +98,61 @@ class ThemeColorsImp extends ThemeColors {
|
|
|
98
98
|
const memoizedColor = new Entities_1.MemoizedColor(ValueObjects_1.Color.RGBA(0, 0, 0, 0), this.notifyOnChange);
|
|
99
99
|
this.memoizedColorLookup.set(themeColor, memoizedColor);
|
|
100
100
|
}
|
|
101
|
+
const colorsSet = new Map();
|
|
102
|
+
colorsSet.set(ThemeColorType.primary, "#00668A");
|
|
103
|
+
colorsSet.set(ThemeColorType.onPrimary, "#FFFFFF");
|
|
104
|
+
colorsSet.set(ThemeColorType.primaryContainer, "#C4E7FF");
|
|
105
|
+
colorsSet.set(ThemeColorType.onPrimaryContainer, "#001E2C");
|
|
106
|
+
colorsSet.set(ThemeColorType.primaryFixed, "#C4E7FF");
|
|
107
|
+
colorsSet.set(ThemeColorType.onPrimaryFixed, "#001E2C");
|
|
108
|
+
colorsSet.set(ThemeColorType.primaryFixedDim, "#7BD0FF");
|
|
109
|
+
colorsSet.set(ThemeColorType.onPrimaryFixedVariant, "#004C69");
|
|
110
|
+
colorsSet.set(ThemeColorType.secondary, "#4E616D");
|
|
111
|
+
colorsSet.set(ThemeColorType.onSecondary, "#FFFFFF");
|
|
112
|
+
colorsSet.set(ThemeColorType.secondaryContainer, "#D1E5F4");
|
|
113
|
+
colorsSet.set(ThemeColorType.onSecondaryContainer, "#0A1E28");
|
|
114
|
+
colorsSet.set(ThemeColorType.secondaryFixed, "#D1E5F4");
|
|
115
|
+
colorsSet.set(ThemeColorType.onSecondaryFixed, "#0A1E28");
|
|
116
|
+
colorsSet.set(ThemeColorType.secondaryFixedDim, "#B5C9D7");
|
|
117
|
+
colorsSet.set(ThemeColorType.onSecondaryFixedVariant, "#374955");
|
|
118
|
+
colorsSet.set(ThemeColorType.tertiary, "#605A7D");
|
|
119
|
+
colorsSet.set(ThemeColorType.onTertiary, "#FFFFFF");
|
|
120
|
+
colorsSet.set(ThemeColorType.tertiaryContainer, "#E6DEFF");
|
|
121
|
+
colorsSet.set(ThemeColorType.onTertiaryContainer, "#1D1736");
|
|
122
|
+
colorsSet.set(ThemeColorType.tertiaryFixed, "#E6DEFF");
|
|
123
|
+
colorsSet.set(ThemeColorType.onTertiaryFixed, "#1D1736");
|
|
124
|
+
colorsSet.set(ThemeColorType.tertiaryFixedDim, "#CAC1E9");
|
|
125
|
+
colorsSet.set(ThemeColorType.onTertiaryFixedVariant, "#484264");
|
|
126
|
+
colorsSet.set(ThemeColorType.error, "#BA1A1A");
|
|
127
|
+
colorsSet.set(ThemeColorType.onError, "#FFFFFF");
|
|
128
|
+
colorsSet.set(ThemeColorType.errorContainer, "#FFDAD6");
|
|
129
|
+
colorsSet.set(ThemeColorType.onErrorContainer, "#410002");
|
|
130
|
+
colorsSet.set(ThemeColorType.outline, "#71787D");
|
|
131
|
+
colorsSet.set(ThemeColorType.background, "#FBFCFF");
|
|
132
|
+
colorsSet.set(ThemeColorType.onBackground, "#191C1E");
|
|
133
|
+
colorsSet.set(ThemeColorType.surface, "#F8F9FC");
|
|
134
|
+
colorsSet.set(ThemeColorType.onSurface, "#191C1E");
|
|
135
|
+
colorsSet.set(ThemeColorType.surfaceVariant, "#DCE3E9");
|
|
136
|
+
colorsSet.set(ThemeColorType.onSurfaceVariant, "#41484D");
|
|
137
|
+
colorsSet.set(ThemeColorType.inverseSurface, "#2E3133");
|
|
138
|
+
colorsSet.set(ThemeColorType.inverseOnSurface, "#F0F1F3");
|
|
139
|
+
colorsSet.set(ThemeColorType.inversePrimary, "#7BD0FF");
|
|
140
|
+
colorsSet.set(ThemeColorType.shadow, "#000000");
|
|
141
|
+
colorsSet.set(ThemeColorType.surfaceTint, "#00668A");
|
|
142
|
+
colorsSet.set(ThemeColorType.outlineVariant, "#C0C7CD");
|
|
143
|
+
colorsSet.set(ThemeColorType.scrim, "#000000");
|
|
144
|
+
colorsSet.set(ThemeColorType.surfaceContainerHighest, "#E1E2E5");
|
|
145
|
+
colorsSet.set(ThemeColorType.surfaceContainerHigh, "#E7E8EA");
|
|
146
|
+
colorsSet.set(ThemeColorType.surfaceContainer, "#EDEEF0");
|
|
147
|
+
colorsSet.set(ThemeColorType.surfaceContainerLow, "#F3F3F6");
|
|
148
|
+
colorsSet.set(ThemeColorType.surfaceContainerLowest, "#FFFFFF");
|
|
149
|
+
colorsSet.set(ThemeColorType.surfaceBright, "#F8F9FC");
|
|
150
|
+
colorsSet.set(ThemeColorType.surfaceDim, "#D9DADC");
|
|
151
|
+
this.setColorHexForSet(colorsSet);
|
|
152
|
+
}
|
|
153
|
+
setColorHexForSet(colorSet) {
|
|
154
|
+
colorSet.forEach((val, key) => {
|
|
155
|
+
this.setColorHexForType(key, val);
|
|
156
|
+
});
|
|
101
157
|
}
|
|
102
158
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Color } from "../../../ValueObjects";
|
|
2
|
+
import { AppObject, AppObjectPM } from "../../../AppObject";
|
|
3
|
+
import { ThemeColorType } from "../Entities/ThemeColors";
|
|
4
|
+
export declare class ThemeColorMapPM extends AppObjectPM<Map<ThemeColorType, Color>> {
|
|
5
|
+
static readonly type = "ThemeColorMapPM";
|
|
6
|
+
private themeColors?;
|
|
7
|
+
vmsAreEqual(a: Map<ThemeColorType, Color>, b: Map<ThemeColorType, Color>): boolean;
|
|
8
|
+
onThemeColorMapChange: () => void;
|
|
9
|
+
dispose: () => void;
|
|
10
|
+
constructor(appObject: AppObject);
|
|
11
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThemeColorMapPM = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
const ThemeColors_1 = require("../Entities/ThemeColors");
|
|
6
|
+
class ThemeColorMapPM extends AppObject_1.AppObjectPM {
|
|
7
|
+
constructor(appObject) {
|
|
8
|
+
super(appObject, ThemeColorMapPM.type);
|
|
9
|
+
this.onThemeColorMapChange = () => {
|
|
10
|
+
const colorMap = new Map();
|
|
11
|
+
for (const themeColor in ThemeColors_1.ThemeColorType) {
|
|
12
|
+
if (!this.themeColors)
|
|
13
|
+
return;
|
|
14
|
+
const castType = themeColor;
|
|
15
|
+
colorMap.set(castType, this.themeColors.getColorForType(castType));
|
|
16
|
+
}
|
|
17
|
+
this.doUpdateView(colorMap);
|
|
18
|
+
};
|
|
19
|
+
this.dispose = () => {
|
|
20
|
+
var _a;
|
|
21
|
+
super.dispose();
|
|
22
|
+
(_a = this.themeColors) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onThemeColorMapChange);
|
|
23
|
+
};
|
|
24
|
+
this.themeColors = ThemeColors_1.ThemeColors.get(appObject.appObjectRepo);
|
|
25
|
+
if (!this.themeColors) {
|
|
26
|
+
this.warn("ThemeColorMapPM is being added to an object that does not have a ThemeColors Entity");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.themeColors.addChangeObserver(this.onThemeColorMapChange);
|
|
31
|
+
this.onThemeColorMapChange();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
vmsAreEqual(a, b) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.ThemeColorMapPM = ThemeColorMapPM;
|
|
39
|
+
ThemeColorMapPM.type = "ThemeColorMapPM";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ThemeColorMapPM";
|
|
@@ -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("./ThemeColorMapPM"), exports);
|