@omnia/velcron 7.0.513-dev → 7.0.514-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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/velcron",
3
3
  "license": "MIT",
4
- "version": "7.0.513-dev",
4
+ "version": "7.0.514-dev",
5
5
  "description": "Provide Omnia Velcron Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -53,7 +53,6 @@ class VelcronStyles {
53
53
  }
54
54
  }
55
55
  if (flexViewDefinition.colorSchema && flexViewDefinition.colorSchema != "") {
56
- const color = renderCtx.theming.get.activeColorSchema().base.color;
57
56
  styleBase["backgroundColor"] = renderCtx.theming.get.activeColorSchema().base.color;
58
57
  }
59
58
  }
@@ -1,9 +1,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;
1
+ export declare const defineVelcronStore: <TState extends {
2
+ state: object;
3
+ privateState?: object;
4
+ }, TGetters, TActions>(name: string, definition: {
5
+ state: () => TState;
6
+ getters: (state: TState["state"], privateState?: TState["privateState"]) => TGetters;
7
+ actions: (state: TState["state"], privateState?: TState["privateState"]) => TActions;
5
8
  }) => () => {
6
- state: TState;
9
+ state: object;
7
10
  get: TGetters;
8
11
  actions: TActions;
9
12
  };
@@ -6,13 +6,13 @@ const stateMap = new Map();
6
6
  const defineVelcronStore = (name, definition) => {
7
7
  const result = () => {
8
8
  if (!stateMap.has(name)) {
9
- stateMap.set(name, ReactivitySystem_1.ReactivitySystem.makeReactive(definition.state));
9
+ stateMap.set(name, ReactivitySystem_1.ReactivitySystem.makeReactive(definition.state()));
10
10
  }
11
11
  const reactiveState = stateMap.get(name);
12
12
  return {
13
- state: reactiveState,
14
- get: definition.getters(reactiveState),
15
- actions: definition.actions(reactiveState)
13
+ state: reactiveState.state,
14
+ get: definition.getters(reactiveState.state, reactiveState.privateState),
15
+ actions: definition.actions(reactiveState.state, reactiveState.privateState)
16
16
  };
17
17
  };
18
18
  return result;
@@ -1,11 +1,9 @@
1
1
  import { ColorSchema, ThemeDefinitionV2, TypographyType } from "..";
2
2
  export declare const useVelcronThemingStore: () => {
3
- state: {
4
- currentTheme: ThemeDefinitionV2;
5
- activeSchema: string;
6
- };
3
+ state: object;
7
4
  get: {
8
5
  activeColorSchema: () => ColorSchema;
6
+ colorSchema: (schema: string) => ColorSchema;
9
7
  typography: (name: string) => TypographyType;
10
8
  colorFromActiveSchema: (name: string) => string;
11
9
  };
@@ -3,39 +3,46 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useVelcronThemingStore = void 0;
4
4
  const __1 = require("..");
5
5
  const VelcronStore_1 = require("./VelcronStore");
6
+ let activeSchemaType = "";
6
7
  exports.useVelcronThemingStore = (0, VelcronStore_1.defineVelcronStore)("VelcronTheming", {
7
- state: {
8
- currentTheme: {},
9
- activeSchema: ""
8
+ state() {
9
+ return {
10
+ state: {
11
+ currentTheme: {}
12
+ }
13
+ };
10
14
  },
11
15
  getters(state) {
12
- const activeColorSchema = () => {
13
- if (state.activeSchema === __1.ColorSchemaTypes.primary) {
16
+ const colorSchema = (schema) => {
17
+ if (schema === __1.ColorSchemaTypes.primary) {
14
18
  return state.currentTheme?.primary;
15
19
  }
16
- else if (state.activeSchema === __1.ColorSchemaTypes.secondary) {
20
+ else if (schema === __1.ColorSchemaTypes.secondary) {
17
21
  return state.currentTheme?.secondary;
18
22
  }
19
- else if (state.activeSchema === __1.ColorSchemaTypes.accent1) {
23
+ else if (schema === __1.ColorSchemaTypes.accent1) {
20
24
  return state.currentTheme?.accent1;
21
25
  }
22
- else if (state.activeSchema === __1.ColorSchemaTypes.accent2) {
26
+ else if (schema === __1.ColorSchemaTypes.accent2) {
23
27
  return state.currentTheme?.accent2;
24
28
  }
25
- else if (state.activeSchema === __1.ColorSchemaTypes.accent3) {
29
+ else if (schema === __1.ColorSchemaTypes.accent3) {
26
30
  return state.currentTheme?.accent3;
27
31
  }
28
- else if (state.activeSchema === __1.ColorSchemaTypes.background) {
32
+ else if (schema === __1.ColorSchemaTypes.background) {
29
33
  return state.currentTheme?.background;
30
34
  }
31
- else if (state.activeSchema === __1.ColorSchemaTypes.neutral) {
35
+ else if (schema === __1.ColorSchemaTypes.neutral) {
32
36
  return state.currentTheme?.neutral;
33
37
  }
34
- else if (state.activeSchema === __1.ColorSchemaTypes.error) {
38
+ else if (schema === __1.ColorSchemaTypes.error) {
35
39
  return state.currentTheme?.error;
36
40
  }
37
41
  return state.currentTheme?.background;
38
42
  };
43
+ const activeColorSchema = () => {
44
+ return colorSchema(activeSchemaType);
45
+ };
39
46
  const typography = (name) => {
40
47
  if (name === __1.TypographyTypes.h1) {
41
48
  return state.currentTheme.typography.h1;
@@ -86,6 +93,7 @@ exports.useVelcronThemingStore = (0, VelcronStore_1.defineVelcronStore)("Velcron
86
93
  };
87
94
  return {
88
95
  activeColorSchema,
96
+ colorSchema,
89
97
  typography,
90
98
  colorFromActiveSchema
91
99
  };
@@ -93,7 +101,7 @@ exports.useVelcronThemingStore = (0, VelcronStore_1.defineVelcronStore)("Velcron
93
101
  actions(state) {
94
102
  return {
95
103
  setActiveSchema(name) {
96
- state.activeSchema = name;
104
+ activeSchemaType = name;
97
105
  },
98
106
  setTheme(newTheme) {
99
107
  state.currentTheme = newTheme;