@omnia/velcron 7.0.511-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.
|
@@ -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?: typeof
|
|
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/stores/VelcronStore.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const defineVelcronStore: <TState, TGetters, TActions>(definition: {
|
|
1
|
+
export declare const defineVelcronStore: <TState, TGetters, TActions>(name: string, definition: {
|
|
2
2
|
state: TState;
|
|
3
3
|
getters: (state: TState) => TGetters;
|
|
4
4
|
actions: (state: TState) => TActions;
|
|
5
|
-
}) => {
|
|
5
|
+
}) => () => {
|
|
6
6
|
state: TState;
|
|
7
7
|
get: TGetters;
|
|
8
8
|
actions: TActions;
|
package/stores/VelcronStore.js
CHANGED
|
@@ -2,13 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defineVelcronStore = void 0;
|
|
4
4
|
const __1 = require("..");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
const stateMap = new Map();
|
|
6
|
+
const defineVelcronStore = (name, definition) => {
|
|
7
|
+
if (!stateMap.has(name)) {
|
|
8
|
+
stateMap.set(name, __1.ReactivitySystem.makeReactive(definition.state));
|
|
9
|
+
}
|
|
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
|
+
};
|
|
11
17
|
};
|
|
18
|
+
return result;
|
|
12
19
|
};
|
|
13
20
|
exports.defineVelcronStore = defineVelcronStore;
|
|
14
21
|
// export const testStore = defineVelcronStore({
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ColorSchema, ThemeDefinitionV2, TypographyType } from "..";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const useVelcronThemingStore: () => {
|
|
3
3
|
state: {
|
|
4
4
|
currentTheme: ThemeDefinitionV2;
|
|
5
5
|
activeSchema: string;
|
|
6
6
|
};
|
|
7
7
|
get: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
activeColorSchema: () => ColorSchema;
|
|
9
|
+
typography: (name: string) => TypographyType;
|
|
10
|
+
colorFromActiveSchema: (name: string) => string;
|
|
11
11
|
};
|
|
12
12
|
actions: {
|
|
13
13
|
setActiveSchema(name: string): void;
|
package/stores/VelcronTheming.js
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
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
|
-
exports.
|
|
6
|
+
exports.useVelcronThemingStore = (0, VelcronStore_1.defineVelcronStore)("VelcronTheming", {
|
|
7
7
|
state: {
|
|
8
8
|
currentTheme: {},
|
|
9
9
|
activeSchema: ""
|
|
10
10
|
},
|
|
11
11
|
getters(state) {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
else if (state.activeSchema === __1.ColorSchemaTypes.background) {
|
|
30
|
-
return state.currentTheme?.background;
|
|
31
|
-
}
|
|
32
|
-
else if (state.activeSchema === __1.ColorSchemaTypes.neutral) {
|
|
33
|
-
return state.currentTheme?.neutral;
|
|
34
|
-
}
|
|
35
|
-
else if (state.activeSchema === __1.ColorSchemaTypes.error) {
|
|
36
|
-
return state.currentTheme?.error;
|
|
37
|
-
}
|
|
12
|
+
const activeColorSchema = () => {
|
|
13
|
+
if (state.activeSchema === __1.ColorSchemaTypes.primary) {
|
|
14
|
+
return state.currentTheme?.primary;
|
|
15
|
+
}
|
|
16
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.secondary) {
|
|
17
|
+
return state.currentTheme?.secondary;
|
|
18
|
+
}
|
|
19
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.accent1) {
|
|
20
|
+
return state.currentTheme?.accent1;
|
|
21
|
+
}
|
|
22
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.accent2) {
|
|
23
|
+
return state.currentTheme?.accent2;
|
|
24
|
+
}
|
|
25
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.accent3) {
|
|
26
|
+
return state.currentTheme?.accent3;
|
|
27
|
+
}
|
|
28
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.background) {
|
|
38
29
|
return state.currentTheme?.background;
|
|
39
30
|
}
|
|
31
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.neutral) {
|
|
32
|
+
return state.currentTheme?.neutral;
|
|
33
|
+
}
|
|
34
|
+
else if (state.activeSchema === __1.ColorSchemaTypes.error) {
|
|
35
|
+
return state.currentTheme?.error;
|
|
36
|
+
}
|
|
37
|
+
return state.currentTheme?.background;
|
|
40
38
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
else if (name === __1.TypographyTypes.text) {
|
|
60
|
-
return state.currentTheme.typography.text;
|
|
61
|
-
}
|
|
39
|
+
const typography = (name) => {
|
|
40
|
+
if (name === __1.TypographyTypes.h1) {
|
|
41
|
+
return state.currentTheme.typography.h1;
|
|
42
|
+
}
|
|
43
|
+
else if (name === __1.TypographyTypes.h2) {
|
|
44
|
+
return state.currentTheme.typography.h2;
|
|
45
|
+
}
|
|
46
|
+
else if (name === __1.TypographyTypes.h3) {
|
|
47
|
+
return state.currentTheme.typography.h3;
|
|
48
|
+
}
|
|
49
|
+
else if (name === __1.TypographyTypes.caption) {
|
|
50
|
+
return state.currentTheme.typography.caption;
|
|
51
|
+
}
|
|
52
|
+
else if (name === __1.TypographyTypes.link) {
|
|
53
|
+
return state.currentTheme.typography.link;
|
|
54
|
+
}
|
|
55
|
+
else if (name === __1.TypographyTypes.text) {
|
|
62
56
|
return state.currentTheme.typography.text;
|
|
63
|
-
},
|
|
64
|
-
colorFromActiveSchema(name) {
|
|
65
|
-
if (name === __1.ColorTypes.base) {
|
|
66
|
-
return local.activeColorSchema().base.color;
|
|
67
|
-
}
|
|
68
|
-
else if (name === __1.ColorTypes.baseTone) {
|
|
69
|
-
return local.activeColorSchema().base.colorToned;
|
|
70
|
-
}
|
|
71
|
-
else if (name === __1.ColorTypes.onBase) {
|
|
72
|
-
return local.activeColorSchema().onBase.color;
|
|
73
|
-
}
|
|
74
|
-
else if (name === __1.ColorTypes.onBaseTone) {
|
|
75
|
-
return local.activeColorSchema().onBase.colorToned;
|
|
76
|
-
}
|
|
77
|
-
else if (name === __1.ColorTypes.container) {
|
|
78
|
-
return local.activeColorSchema().container.color;
|
|
79
|
-
}
|
|
80
|
-
else if (name === __1.ColorTypes.containerTone) {
|
|
81
|
-
return local.activeColorSchema().container.colorToned;
|
|
82
|
-
}
|
|
83
|
-
else if (name === __1.ColorTypes.onContainer) {
|
|
84
|
-
return local.activeColorSchema().onContainer.color;
|
|
85
|
-
}
|
|
86
|
-
else if (name === __1.ColorTypes.onContainerTone) {
|
|
87
|
-
return local.activeColorSchema().onContainer.colorToned;
|
|
88
|
-
}
|
|
89
|
-
return name;
|
|
90
57
|
}
|
|
58
|
+
return state.currentTheme.typography.text;
|
|
59
|
+
};
|
|
60
|
+
const colorFromActiveSchema = (name) => {
|
|
61
|
+
if (name === __1.ColorTypes.base) {
|
|
62
|
+
return activeColorSchema().base.color;
|
|
63
|
+
}
|
|
64
|
+
else if (name === __1.ColorTypes.baseTone) {
|
|
65
|
+
return activeColorSchema().base.colorToned;
|
|
66
|
+
}
|
|
67
|
+
else if (name === __1.ColorTypes.onBase) {
|
|
68
|
+
return activeColorSchema().onBase.color;
|
|
69
|
+
}
|
|
70
|
+
else if (name === __1.ColorTypes.onBaseTone) {
|
|
71
|
+
return activeColorSchema().onBase.colorToned;
|
|
72
|
+
}
|
|
73
|
+
else if (name === __1.ColorTypes.container) {
|
|
74
|
+
return activeColorSchema().container.color;
|
|
75
|
+
}
|
|
76
|
+
else if (name === __1.ColorTypes.containerTone) {
|
|
77
|
+
return activeColorSchema().container.colorToned;
|
|
78
|
+
}
|
|
79
|
+
else if (name === __1.ColorTypes.onContainer) {
|
|
80
|
+
return activeColorSchema().onContainer.color;
|
|
81
|
+
}
|
|
82
|
+
else if (name === __1.ColorTypes.onContainerTone) {
|
|
83
|
+
return activeColorSchema().onContainer.colorToned;
|
|
84
|
+
}
|
|
85
|
+
return name;
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
activeColorSchema,
|
|
89
|
+
typography,
|
|
90
|
+
colorFromActiveSchema
|
|
91
91
|
};
|
|
92
92
|
},
|
|
93
93
|
actions(state) {
|