@omnia/velcron 7.0.512-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.
@@ -12,4 +12,3 @@ export * from "./Realtime";
12
12
  export * from "./OmniaSharedBootstrapData";
13
13
  export * from "./StringExtensions";
14
14
  export * from "./theming";
15
- export * from "./reactivity";
@@ -16,4 +16,3 @@ 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);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/velcron",
3
3
  "license": "MIT",
4
- "version": "7.0.512-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"
@@ -8,4 +8,5 @@ class ReactivitySystem {
8
8
  }
9
9
  }
10
10
  exports.ReactivitySystem = ReactivitySystem;
11
+ ReactivitySystem.makeReactive = null;
11
12
  ReactivitySystem.hasReactivityProvider = false;
@@ -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
  };
@@ -1,37 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defineVelcronStore = void 0;
4
- const __1 = require("..");
4
+ const ReactivitySystem_1 = require("./ReactivitySystem");
5
5
  const stateMap = new Map();
6
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
7
  const result = () => {
8
+ if (!stateMap.has(name)) {
9
+ stateMap.set(name, ReactivitySystem_1.ReactivitySystem.makeReactive(definition.state()));
10
+ }
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;
19
19
  };
20
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,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;
@@ -101,90 +109,3 @@ exports.useVelcronThemingStore = (0, VelcronStore_1.defineVelcronStore)("Velcron
101
109
  };
102
110
  }
103
111
  });
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
- // }
package/stores/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./VelcronStore";
2
2
  export * from "./VelcronTheming";
3
+ export * from "./ReactivitySystem";
package/stores/index.js CHANGED
@@ -3,3 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./VelcronStore"), exports);
5
5
  tslib_1.__exportStar(require("./VelcronTheming"), exports);
6
+ tslib_1.__exportStar(require("./ReactivitySystem"), exports);
@@ -1 +0,0 @@
1
- export * from "./DefineReactivity";
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./DefineReactivity"), exports);