@omnia/velcron 7.0.511-dev → 7.0.513-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);
@@ -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 { useVelcronTheming } from "..";
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 useVelcronTheming;
35
+ theming?: ReturnType<typeof useVelcronThemingStore>;
36
36
  actions?: {
37
37
  [name: string]: [];
38
38
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/velcron",
3
3
  "license": "MIT",
4
- "version": "7.0.511-dev",
4
+ "version": "7.0.513-dev",
5
5
  "description": "Provide Omnia Velcron Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -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) => object | string;
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;
@@ -53,6 +53,7 @@ class VelcronStyles {
53
53
  }
54
54
  }
55
55
  if (flexViewDefinition.colorSchema && flexViewDefinition.colorSchema != "") {
56
+ const color = renderCtx.theming.get.activeColorSchema().base.color;
56
57
  styleBase["backgroundColor"] = renderCtx.theming.get.activeColorSchema().base.color;
57
58
  }
58
59
  }
@@ -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,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;
@@ -1,30 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defineVelcronStore = void 0;
4
- const __1 = require("..");
5
- const defineVelcronStore = (definition) => {
6
- definition.state = __1.ReactivitySystem.makeReactive(definition.state);
7
- return {
8
- state: definition.state,
9
- get: definition.getters(definition.state),
10
- actions: definition.actions(definition.state)
4
+ const ReactivitySystem_1 = require("./ReactivitySystem");
5
+ const stateMap = new Map();
6
+ const defineVelcronStore = (name, definition) => {
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
+ 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
- // export const testStore = defineVelcronStore({
15
- // state: {
16
- // hepp: ""
17
- // },
18
- // getters(state) {
19
- // return {
20
- // get hepp() { return state.hepp; }
21
- // };
22
- // },
23
- // actions(state) {
24
- // return {
25
- // testMutate() {
26
- // state.hepp = "hepp";
27
- // }
28
- // };
29
- // }
30
- // });
@@ -1,13 +1,13 @@
1
1
  import { ColorSchema, ThemeDefinitionV2, TypographyType } from "..";
2
- export declare const useVelcronTheming: {
2
+ export declare const useVelcronThemingStore: () => {
3
3
  state: {
4
4
  currentTheme: ThemeDefinitionV2;
5
5
  activeSchema: string;
6
6
  };
7
7
  get: {
8
- typography(name: string): TypographyType;
9
- colorFromActiveSchema(name: string): string;
10
- activeColorSchema(): ColorSchema;
8
+ activeColorSchema: () => ColorSchema;
9
+ typography: (name: string) => TypographyType;
10
+ colorFromActiveSchema: (name: string) => string;
11
11
  };
12
12
  actions: {
13
13
  setActiveSchema(name: string): void;
@@ -1,93 +1,93 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useVelcronTheming = void 0;
3
+ exports.useVelcronThemingStore = void 0;
4
4
  const __1 = require("..");
5
5
  const VelcronStore_1 = require("./VelcronStore");
6
- exports.useVelcronTheming = (0, VelcronStore_1.defineVelcronStore)({
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 local = {
13
- activeColorSchema() {
14
- if (state.activeSchema === __1.ColorSchemaTypes.primary) {
15
- return state.currentTheme?.primary;
16
- }
17
- else if (state.activeSchema === __1.ColorSchemaTypes.secondary) {
18
- return state.currentTheme?.secondary;
19
- }
20
- else if (state.activeSchema === __1.ColorSchemaTypes.accent1) {
21
- return state.currentTheme?.accent1;
22
- }
23
- else if (state.activeSchema === __1.ColorSchemaTypes.accent2) {
24
- return state.currentTheme?.accent2;
25
- }
26
- else if (state.activeSchema === __1.ColorSchemaTypes.accent3) {
27
- return state.currentTheme?.accent3;
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
- return {
42
- ...local,
43
- typography(name) {
44
- if (name === __1.TypographyTypes.h1) {
45
- return state.currentTheme.typography.h1;
46
- }
47
- else if (name === __1.TypographyTypes.h2) {
48
- return state.currentTheme.typography.h2;
49
- }
50
- else if (name === __1.TypographyTypes.h3) {
51
- return state.currentTheme.typography.h3;
52
- }
53
- else if (name === __1.TypographyTypes.caption) {
54
- return state.currentTheme.typography.caption;
55
- }
56
- else if (name === __1.TypographyTypes.link) {
57
- return state.currentTheme.typography.link;
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) {
@@ -101,90 +101,3 @@ exports.useVelcronTheming = (0, VelcronStore_1.defineVelcronStore)({
101
101
  };
102
102
  }
103
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
- // }
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);