@omnia/velcron 7.0.510-dev → 7.0.512-dev
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/internal-do-not-import-from-here/shared/models/index.d.ts +1 -0
- package/internal-do-not-import-from-here/shared/models/index.js +1 -0
- package/internal-do-not-import-from-here/shared/models/reactivity/DefineReactivity.d.ts +5 -0
- package/internal-do-not-import-from-here/shared/models/reactivity/DefineReactivity.js +11 -0
- package/internal-do-not-import-from-here/shared/models/reactivity/index.d.ts +1 -0
- package/internal-do-not-import-from-here/shared/models/reactivity/index.js +4 -0
- package/models/VelcronDefinitions.d.ts +2 -2
- package/package.json +1 -1
- package/parser/VelcronStyles.d.ts +1 -1
- package/parser/VelcronStyles.js +3 -3
- package/stores/VelcronStore.d.ts +9 -12
- package/stores/VelcronStore.js +34 -23
- package/stores/VelcronTheming.d.ts +14 -11
- package/stores/VelcronTheming.js +149 -55
|
@@ -16,3 +16,4 @@ tslib_1.__exportStar(require("./Realtime"), exports);
|
|
|
16
16
|
tslib_1.__exportStar(require("./OmniaSharedBootstrapData"), exports);
|
|
17
17
|
tslib_1.__exportStar(require("./StringExtensions"), exports);
|
|
18
18
|
tslib_1.__exportStar(require("./theming"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./reactivity"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReactivitySystem = void 0;
|
|
4
|
+
class ReactivitySystem {
|
|
5
|
+
static registerProvider(fn) {
|
|
6
|
+
ReactivitySystem.makeReactive = fn;
|
|
7
|
+
ReactivitySystem.hasReactivityProvider = true;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ReactivitySystem = ReactivitySystem;
|
|
11
|
+
ReactivitySystem.hasReactivityProvider = false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DefineReactivity";
|
|
@@ -2,7 +2,7 @@ import { VelcronComponentDescriptor } from "./VelcronDescriptors";
|
|
|
2
2
|
import { VelcronEvent, VelcronOnChangedEvent, VelcronOnClosedEvent, VelcronOnCloseRequestedEvent, VelcronOnLoadEvent, VelcronOnPressEvent } from "./VelcronEvents";
|
|
3
3
|
import { VelcroncomponentArrayType, VelcronPrimitiveType } from "./VelcronTypes";
|
|
4
4
|
import { AssignOperators, VelcronHorizontalAlignments, VelcronIconTypes, VelcronActionTypes, VerticalAlignments } from "./Enums";
|
|
5
|
-
import {
|
|
5
|
+
import { useVelcronThemingStore } from "..";
|
|
6
6
|
export interface ResolvedComponentRenderer {
|
|
7
7
|
component: unknown;
|
|
8
8
|
definition: VelcronDefinition;
|
|
@@ -32,7 +32,7 @@ export interface VelcronRenderContext {
|
|
|
32
32
|
id?: string;
|
|
33
33
|
rootContext: DynamicViewModel;
|
|
34
34
|
currentContext: DynamicViewModel;
|
|
35
|
-
theming?:
|
|
35
|
+
theming?: ReturnType<typeof useVelcronThemingStore>;
|
|
36
36
|
actions?: {
|
|
37
37
|
[name: string]: [];
|
|
38
38
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VelcronDefinition, VelcronRenderContext } from "../models";
|
|
2
2
|
import { VelcronUnitProvider } from "../models/VelcronUnitProvider";
|
|
3
3
|
export declare class VelcronStyles {
|
|
4
|
-
static styleProvider: (baseStyles: object, definition: VelcronDefinition, renderCtx: VelcronRenderContext) =>
|
|
4
|
+
static styleProvider: (baseStyles: object, definition: VelcronDefinition, renderCtx: VelcronRenderContext) => any;
|
|
5
5
|
static unitProvider: VelcronUnitProvider;
|
|
6
6
|
static registerStyleProvider(fn: (styleBase: object, definition: VelcronDefinition, renderCtx: VelcronRenderContext) => object | string, unitProvider: VelcronUnitProvider): void;
|
|
7
7
|
static create(definition: VelcronDefinition, renderCtx: VelcronRenderContext): object | string;
|
package/parser/VelcronStyles.js
CHANGED
|
@@ -22,10 +22,10 @@ class VelcronStyles {
|
|
|
22
22
|
else if (definition.type === VelcronConstants_1.VelcronConstants.components.text) {
|
|
23
23
|
const textDefinition = definition;
|
|
24
24
|
if (textDefinition.color) {
|
|
25
|
-
styleBase["color"] = renderCtx.theming.
|
|
25
|
+
styleBase["color"] = renderCtx.theming.get.colorFromActiveSchema(textDefinition.color);
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
|
-
styleBase["color"] = renderCtx.theming.activeColorSchema().onBase.color;
|
|
28
|
+
styleBase["color"] = renderCtx.theming.get.activeColorSchema().onBase.color;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
else if (definition.type === VelcronConstants_1.VelcronConstants.components.flexView) {
|
|
@@ -53,7 +53,7 @@ class VelcronStyles {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
if (flexViewDefinition.colorSchema && flexViewDefinition.colorSchema != "") {
|
|
56
|
-
styleBase["backgroundColor"] = renderCtx.theming.activeColorSchema().base.color;
|
|
56
|
+
styleBase["backgroundColor"] = renderCtx.theming.get.activeColorSchema().base.color;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
return VelcronStyles.styleProvider(styleBase, definition, renderCtx);
|
package/stores/VelcronStore.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
state
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
increment: (text: string) => string;
|
|
12
|
-
}
|
|
1
|
+
export declare const defineVelcronStore: <TState, TGetters, TActions>(name: string, definition: {
|
|
2
|
+
state: TState;
|
|
3
|
+
getters: (state: TState) => TGetters;
|
|
4
|
+
actions: (state: TState) => TActions;
|
|
5
|
+
}) => () => {
|
|
6
|
+
state: TState;
|
|
7
|
+
get: TGetters;
|
|
8
|
+
actions: TActions;
|
|
9
|
+
};
|
package/stores/VelcronStore.js
CHANGED
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
exports.defineVelcronStore = void 0;
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const stateMap = new Map();
|
|
6
|
+
const defineVelcronStore = (name, definition) => {
|
|
7
|
+
if (!stateMap.has(name)) {
|
|
8
|
+
stateMap.set(name, __1.ReactivitySystem.makeReactive(definition.state));
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
exports.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
10
|
+
const reactiveState = stateMap.get(name);
|
|
11
|
+
const result = () => {
|
|
12
|
+
return {
|
|
13
|
+
state: reactiveState,
|
|
14
|
+
get: definition.getters(reactiveState),
|
|
15
|
+
actions: definition.actions(reactiveState)
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
exports.defineVelcronStore = defineVelcronStore;
|
|
21
|
+
// export const testStore = defineVelcronStore({
|
|
22
|
+
// state: {
|
|
23
|
+
// hepp: ""
|
|
24
|
+
// },
|
|
25
|
+
// getters(state) {
|
|
26
|
+
// return {
|
|
27
|
+
// get hepp() { return state.hepp; }
|
|
28
|
+
// };
|
|
29
|
+
// },
|
|
30
|
+
// actions(state) {
|
|
31
|
+
// return {
|
|
32
|
+
// testMutate() {
|
|
33
|
+
// state.hepp = "hepp";
|
|
34
|
+
// }
|
|
35
|
+
// };
|
|
36
|
+
// }
|
|
37
|
+
// });
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { ColorSchema, ThemeDefinitionV2, TypographyType } from "..";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
typography: (name: string) => TypographyType;
|
|
7
|
-
activeColorSchema: () => ColorSchema;
|
|
8
|
-
getColorFromActiveSchema: (name: any) => string;
|
|
9
|
-
mutations: {
|
|
10
|
-
setActiveSchema: (name: string) => void;
|
|
11
|
-
setTheme: (newTheme: ThemeDefinitionV2) => void;
|
|
2
|
+
export declare const useVelcronThemingStore: () => {
|
|
3
|
+
state: {
|
|
4
|
+
currentTheme: ThemeDefinitionV2;
|
|
5
|
+
activeSchema: string;
|
|
12
6
|
};
|
|
13
|
-
|
|
7
|
+
get: {
|
|
8
|
+
activeColorSchema: () => ColorSchema;
|
|
9
|
+
typography: (name: string) => TypographyType;
|
|
10
|
+
colorFromActiveSchema: (name: string) => string;
|
|
11
|
+
};
|
|
12
|
+
actions: {
|
|
13
|
+
setActiveSchema(name: string): void;
|
|
14
|
+
setTheme(newTheme: ThemeDefinitionV2): void;
|
|
15
|
+
};
|
|
16
|
+
};
|
package/stores/VelcronTheming.js
CHANGED
|
@@ -1,96 +1,190 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useVelcronThemingStore = void 0;
|
|
4
4
|
const __1 = require("..");
|
|
5
5
|
const VelcronStore_1 = require("./VelcronStore");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
exports.useVelcronThemingStore = (0, VelcronStore_1.defineVelcronStore)("VelcronTheming", {
|
|
7
|
+
state: {
|
|
8
|
+
currentTheme: {},
|
|
9
|
+
activeSchema: ""
|
|
10
|
+
},
|
|
11
|
+
getters(state) {
|
|
12
|
+
const activeColorSchema = () => {
|
|
13
|
+
if (state.activeSchema === __1.ColorSchemaTypes.primary) {
|
|
14
|
+
return state.currentTheme?.primary;
|
|
14
15
|
}
|
|
15
|
-
else if (
|
|
16
|
-
return
|
|
16
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.secondary) {
|
|
17
|
+
return state.currentTheme?.secondary;
|
|
17
18
|
}
|
|
18
|
-
else if (
|
|
19
|
-
return
|
|
19
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.accent1) {
|
|
20
|
+
return state.currentTheme?.accent1;
|
|
20
21
|
}
|
|
21
|
-
else if (
|
|
22
|
-
return
|
|
22
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.accent2) {
|
|
23
|
+
return state.currentTheme?.accent2;
|
|
23
24
|
}
|
|
24
|
-
else if (
|
|
25
|
-
return
|
|
25
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.accent3) {
|
|
26
|
+
return state.currentTheme?.accent3;
|
|
26
27
|
}
|
|
27
|
-
else if (
|
|
28
|
-
return
|
|
28
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.background) {
|
|
29
|
+
return state.currentTheme?.background;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.activeColorSchema = () => {
|
|
33
|
-
if (this.activeSchemaState === __1.ColorSchemaTypes.primary) {
|
|
34
|
-
return this.currentTheme.primary;
|
|
31
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.neutral) {
|
|
32
|
+
return state.currentTheme?.neutral;
|
|
35
33
|
}
|
|
36
|
-
else if (
|
|
37
|
-
return
|
|
34
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.error) {
|
|
35
|
+
return state.currentTheme?.error;
|
|
38
36
|
}
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
return state.currentTheme?.background;
|
|
38
|
+
};
|
|
39
|
+
const typography = (name) => {
|
|
40
|
+
if (name === __1.TypographyTypes.h1) {
|
|
41
|
+
return state.currentTheme.typography.h1;
|
|
41
42
|
}
|
|
42
|
-
else if (
|
|
43
|
-
return
|
|
43
|
+
else if (name === __1.TypographyTypes.h2) {
|
|
44
|
+
return state.currentTheme.typography.h2;
|
|
44
45
|
}
|
|
45
|
-
else if (
|
|
46
|
-
return
|
|
46
|
+
else if (name === __1.TypographyTypes.h3) {
|
|
47
|
+
return state.currentTheme.typography.h3;
|
|
47
48
|
}
|
|
48
|
-
else if (
|
|
49
|
-
return
|
|
49
|
+
else if (name === __1.TypographyTypes.caption) {
|
|
50
|
+
return state.currentTheme.typography.caption;
|
|
50
51
|
}
|
|
51
|
-
else if (
|
|
52
|
-
return
|
|
52
|
+
else if (name === __1.TypographyTypes.link) {
|
|
53
|
+
return state.currentTheme.typography.link;
|
|
53
54
|
}
|
|
54
|
-
else if (
|
|
55
|
-
return
|
|
55
|
+
else if (name === __1.TypographyTypes.text) {
|
|
56
|
+
return state.currentTheme.typography.text;
|
|
56
57
|
}
|
|
57
|
-
return
|
|
58
|
+
return state.currentTheme.typography.text;
|
|
58
59
|
};
|
|
59
|
-
|
|
60
|
+
const colorFromActiveSchema = (name) => {
|
|
60
61
|
if (name === __1.ColorTypes.base) {
|
|
61
|
-
return
|
|
62
|
+
return activeColorSchema().base.color;
|
|
62
63
|
}
|
|
63
64
|
else if (name === __1.ColorTypes.baseTone) {
|
|
64
|
-
return
|
|
65
|
+
return activeColorSchema().base.colorToned;
|
|
65
66
|
}
|
|
66
67
|
else if (name === __1.ColorTypes.onBase) {
|
|
67
|
-
return
|
|
68
|
+
return activeColorSchema().onBase.color;
|
|
68
69
|
}
|
|
69
70
|
else if (name === __1.ColorTypes.onBaseTone) {
|
|
70
|
-
return
|
|
71
|
+
return activeColorSchema().onBase.colorToned;
|
|
71
72
|
}
|
|
72
73
|
else if (name === __1.ColorTypes.container) {
|
|
73
|
-
return
|
|
74
|
+
return activeColorSchema().container.color;
|
|
74
75
|
}
|
|
75
76
|
else if (name === __1.ColorTypes.containerTone) {
|
|
76
|
-
return
|
|
77
|
+
return activeColorSchema().container.colorToned;
|
|
77
78
|
}
|
|
78
79
|
else if (name === __1.ColorTypes.onContainer) {
|
|
79
|
-
return
|
|
80
|
+
return activeColorSchema().onContainer.color;
|
|
80
81
|
}
|
|
81
82
|
else if (name === __1.ColorTypes.onContainerTone) {
|
|
82
|
-
return
|
|
83
|
+
return activeColorSchema().onContainer.colorToned;
|
|
83
84
|
}
|
|
84
85
|
return name;
|
|
85
86
|
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
return {
|
|
88
|
+
activeColorSchema,
|
|
89
|
+
typography,
|
|
90
|
+
colorFromActiveSchema
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
actions(state) {
|
|
94
|
+
return {
|
|
95
|
+
setActiveSchema(name) {
|
|
96
|
+
state.activeSchema = name;
|
|
89
97
|
},
|
|
90
|
-
setTheme
|
|
91
|
-
|
|
98
|
+
setTheme(newTheme) {
|
|
99
|
+
state.currentTheme = newTheme;
|
|
92
100
|
}
|
|
93
101
|
};
|
|
94
102
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
103
|
+
});
|
|
104
|
+
// export class VelcronTheming extends VelcronStore {
|
|
105
|
+
// // public currentTheme = this.state({} as ThemeDefinitionV2);
|
|
106
|
+
// // private activeSchemaState = this.state("" as string);
|
|
107
|
+
// typography = (name: string): TypographyType => {
|
|
108
|
+
// if (name === TypographyTypes.h1) {
|
|
109
|
+
// return this.currentTheme.typography.h1;
|
|
110
|
+
// }
|
|
111
|
+
// else if (name === TypographyTypes.h2) {
|
|
112
|
+
// return this.currentTheme.typography.h2;
|
|
113
|
+
// }
|
|
114
|
+
// else if (name === TypographyTypes.h3) {
|
|
115
|
+
// return this.currentTheme.typography.h3;
|
|
116
|
+
// }
|
|
117
|
+
// else if (name === TypographyTypes.caption) {
|
|
118
|
+
// return this.currentTheme.typography.caption;
|
|
119
|
+
// }
|
|
120
|
+
// else if (name === TypographyTypes.link) {
|
|
121
|
+
// return this.currentTheme.typography.link;
|
|
122
|
+
// }
|
|
123
|
+
// else if (name === TypographyTypes.text) {
|
|
124
|
+
// return this.currentTheme.typography.text;
|
|
125
|
+
// }
|
|
126
|
+
// return this.currentTheme.typography.text;
|
|
127
|
+
// };
|
|
128
|
+
// activeColorSchema = (): ColorSchema => {
|
|
129
|
+
// if (this.activeSchemaState === ColorSchemaTypes.primary) {
|
|
130
|
+
// return this.currentTheme.primary;
|
|
131
|
+
// }
|
|
132
|
+
// else if (this.activeSchemaState === ColorSchemaTypes.secondary) {
|
|
133
|
+
// return this.currentTheme.secondary;
|
|
134
|
+
// }
|
|
135
|
+
// else if (this.activeSchemaState === ColorSchemaTypes.accent1) {
|
|
136
|
+
// return this.currentTheme.accent1;
|
|
137
|
+
// }
|
|
138
|
+
// else if (this.activeSchemaState === ColorSchemaTypes.accent2) {
|
|
139
|
+
// return this.currentTheme.accent2;
|
|
140
|
+
// }
|
|
141
|
+
// else if (this.activeSchemaState=== ColorSchemaTypes.accent3) {
|
|
142
|
+
// return this.currentTheme.accent3;
|
|
143
|
+
// }
|
|
144
|
+
// else if (this.activeSchemaState === ColorSchemaTypes.background) {
|
|
145
|
+
// return this.currentTheme.background;
|
|
146
|
+
// }
|
|
147
|
+
// else if (this.activeSchemaState === ColorSchemaTypes.neutral) {
|
|
148
|
+
// return this.currentTheme.neutral;
|
|
149
|
+
// }
|
|
150
|
+
// else if (this.activeSchemaState === ColorSchemaTypes.error) {
|
|
151
|
+
// return this.currentTheme.error;
|
|
152
|
+
// }
|
|
153
|
+
// return this.currentTheme.background;
|
|
154
|
+
// };
|
|
155
|
+
// getColorFromActiveSchema = (name):string => {
|
|
156
|
+
// if (name === ColorTypes.base) {
|
|
157
|
+
// return this.activeColorSchema().base.color;
|
|
158
|
+
// }
|
|
159
|
+
// else if (name === ColorTypes.baseTone) {
|
|
160
|
+
// return this.activeColorSchema().base.colorToned;
|
|
161
|
+
// }
|
|
162
|
+
// else if (name === ColorTypes.onBase) {
|
|
163
|
+
// return this.activeColorSchema().onBase.color;
|
|
164
|
+
// }
|
|
165
|
+
// else if (name === ColorTypes.onBaseTone) {
|
|
166
|
+
// return this.activeColorSchema().onBase.colorToned;
|
|
167
|
+
// }
|
|
168
|
+
// else if (name === ColorTypes.container) {
|
|
169
|
+
// return this.activeColorSchema().container.color;
|
|
170
|
+
// }
|
|
171
|
+
// else if (name === ColorTypes.containerTone) {
|
|
172
|
+
// return this.activeColorSchema().container.colorToned;
|
|
173
|
+
// }
|
|
174
|
+
// else if (name === ColorTypes.onContainer) {
|
|
175
|
+
// return this.activeColorSchema().onContainer.color;
|
|
176
|
+
// }
|
|
177
|
+
// else if (name === ColorTypes.onContainerTone) {
|
|
178
|
+
// return this.activeColorSchema().onContainer.colorToned;
|
|
179
|
+
// }
|
|
180
|
+
// return name;
|
|
181
|
+
// };
|
|
182
|
+
// mutations = {
|
|
183
|
+
// setActiveSchema: (name: string) => {
|
|
184
|
+
// this.activeSchemaState = name;
|
|
185
|
+
// },
|
|
186
|
+
// setTheme: (newTheme: ThemeDefinitionV2) => {
|
|
187
|
+
// this.currentTheme = newTheme;
|
|
188
|
+
// }
|
|
189
|
+
// };
|
|
190
|
+
// }
|