@omnia/velcron 7.0.498-dev → 7.0.500-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/index.d.ts +2 -0
- package/index.js +2 -0
- package/models/Enums.d.ts +4 -2
- package/models/Enums.js +3 -1
- package/models/VelcronDefinitions.d.ts +18 -10
- package/models/VelcronDescriptors.d.ts +1 -0
- package/package.json +1 -1
- package/parser/VelcronConstants.d.ts +1 -1
- package/parser/VelcronConstants.js +1 -1
- package/parser/VelcronData.d.ts +1 -1
- package/parser/VelcronData.js +8 -5
- package/parser/VelcronStyles.d.ts +16 -5
- package/parser/VelcronStyles.js +104 -81
- package/stores/VelcronStore.d.ts +12 -0
- package/stores/VelcronStore.js +26 -0
- package/stores/index.d.ts +1 -0
- package/stores/index.js +4 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -4,3 +4,5 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
tslib_1.__exportStar(require("./models"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./parser"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./actions"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./stores"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("../../../shared/models"), exports);
|
package/models/Enums.d.ts
CHANGED
|
@@ -38,8 +38,10 @@ export declare enum VelcronDescriptorTypes {
|
|
|
38
38
|
}
|
|
39
39
|
export declare enum VelcronComponentPropertyEditors {
|
|
40
40
|
text = 0,
|
|
41
|
-
|
|
42
|
-
slider = 2
|
|
41
|
+
colorSchemaPicker = 1,
|
|
42
|
+
slider = 2,
|
|
43
|
+
colorPicker = 3,
|
|
44
|
+
typographyPicker = 4
|
|
43
45
|
}
|
|
44
46
|
export declare enum VelcronDataTypes {
|
|
45
47
|
unknown = "unknown",
|
package/models/Enums.js
CHANGED
|
@@ -49,8 +49,10 @@ var VelcronDescriptorTypes;
|
|
|
49
49
|
var VelcronComponentPropertyEditors;
|
|
50
50
|
(function (VelcronComponentPropertyEditors) {
|
|
51
51
|
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["text"] = 0] = "text";
|
|
52
|
-
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["
|
|
52
|
+
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["colorSchemaPicker"] = 1] = "colorSchemaPicker";
|
|
53
53
|
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["slider"] = 2] = "slider";
|
|
54
|
+
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["colorPicker"] = 3] = "colorPicker";
|
|
55
|
+
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["typographyPicker"] = 4] = "typographyPicker";
|
|
54
56
|
})(VelcronComponentPropertyEditors = exports.VelcronComponentPropertyEditors || (exports.VelcronComponentPropertyEditors = {}));
|
|
55
57
|
var VelcronDataTypes;
|
|
56
58
|
(function (VelcronDataTypes) {
|
|
@@ -18,12 +18,13 @@ export interface BuiltInComponentRenderers {
|
|
|
18
18
|
"WebView": any;
|
|
19
19
|
"CustomComponent": any;
|
|
20
20
|
"Dialog": any;
|
|
21
|
-
"
|
|
21
|
+
"FlexView": any;
|
|
22
22
|
"Icon": any;
|
|
23
23
|
}
|
|
24
24
|
export type DynamicViewModel = object;
|
|
25
25
|
export interface OnItemRenderedHookResult {
|
|
26
|
-
cssClass:
|
|
26
|
+
cssClass: string;
|
|
27
|
+
containerRenderer?: VelcronContainerRenderer;
|
|
27
28
|
}
|
|
28
29
|
export interface VelcronRenderContext {
|
|
29
30
|
id?: string;
|
|
@@ -47,6 +48,11 @@ export interface VelcronRenderContextHooks {
|
|
|
47
48
|
onItemSelected?: ((item: VelcronDefinition) => void);
|
|
48
49
|
onItemRendered?: ((item: VelcronDefinition) => OnItemRenderedHookResult);
|
|
49
50
|
}
|
|
51
|
+
export interface VelcronContainerRenderer {
|
|
52
|
+
definition: VelcronDefinition;
|
|
53
|
+
renderContext: VelcronRenderContext;
|
|
54
|
+
component: JSX.Element;
|
|
55
|
+
}
|
|
50
56
|
export interface VelcronAction extends VelcronRenderContext {
|
|
51
57
|
type: VelcronActionTypes;
|
|
52
58
|
}
|
|
@@ -149,7 +155,7 @@ export interface VelcronTextDefinition extends VelcronDefinition {
|
|
|
149
155
|
type: "Text";
|
|
150
156
|
text: string;
|
|
151
157
|
color?: string;
|
|
152
|
-
|
|
158
|
+
typography?: string;
|
|
153
159
|
events?: VelcronOnPressEvent;
|
|
154
160
|
}
|
|
155
161
|
export interface VelcronImageDefinition extends VelcronDefinition {
|
|
@@ -160,7 +166,9 @@ export interface VelcronImageDefinition extends VelcronDefinition {
|
|
|
160
166
|
export interface VelcronButtonDefinition extends VelcronDefinition {
|
|
161
167
|
type: "Button";
|
|
162
168
|
text: string;
|
|
163
|
-
|
|
169
|
+
color: string;
|
|
170
|
+
icon?: VelcronIcon;
|
|
171
|
+
disabled?: boolean;
|
|
164
172
|
events?: VelcronOnPressEvent;
|
|
165
173
|
}
|
|
166
174
|
export interface VelcronTextInputDefinition extends VelcronDefinition {
|
|
@@ -191,15 +199,15 @@ export interface VelcronIconDefinition extends VelcronDefinition {
|
|
|
191
199
|
size?: number;
|
|
192
200
|
events?: VelcronOnPressEvent;
|
|
193
201
|
}
|
|
194
|
-
export interface
|
|
195
|
-
type: "
|
|
196
|
-
|
|
197
|
-
columnStyle?: object;
|
|
198
|
-
}
|
|
199
|
-
export interface VelcronSectionColumn extends VelcronDefinition {
|
|
202
|
+
export interface VelcronFlexViewDefinition extends VelcronDefinition {
|
|
203
|
+
type: "FlexView";
|
|
204
|
+
column?: boolean;
|
|
200
205
|
body: Array<VelcronDefinition>;
|
|
206
|
+
columnStyle?: object;
|
|
201
207
|
horizontalAlignment?: VelcronHorizontalAlignments;
|
|
202
208
|
verticalAlignment?: VerticalAlignments;
|
|
209
|
+
grow?: number;
|
|
210
|
+
colorSchema?: string;
|
|
203
211
|
width?: "auto" | "stretch" | number | string;
|
|
204
212
|
}
|
|
205
213
|
export interface VelcronSectionColumnWidth {
|
|
@@ -24,6 +24,7 @@ export interface VelcronComponentPropertyDescriptor {
|
|
|
24
24
|
editor?: VelcronComponentPropertyEditors;
|
|
25
25
|
required?: boolean;
|
|
26
26
|
defaultValue?: VelcronPrimitiveType | VelcroncomponentArrayType;
|
|
27
|
+
disableRemovePropertyOnEmptyOrFalse?: boolean;
|
|
27
28
|
}
|
|
28
29
|
export interface VelcronComponentArrayPropertyDescriptor extends VelcronComponentPropertyDescriptor {
|
|
29
30
|
type: VelcronDataTypes.componentArray;
|
package/package.json
CHANGED
package/parser/VelcronData.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare class VelcronData {
|
|
|
28
28
|
static getOrSetObjectByPathUsingRenderContext<T>(renderContext: VelcronRenderContext, path: string, value?: any): T;
|
|
29
29
|
static getTokens(template: any): string[];
|
|
30
30
|
static ensureEventId(event: string): string;
|
|
31
|
-
static ensureKeys(ui: VelcronDefinition | VelcronAppDefinition): void;
|
|
31
|
+
static ensureKeys(ui: VelcronDefinition | VelcronAppDefinition, generateNewKeys?: boolean): void;
|
|
32
32
|
static removeKeys(ui: VelcronDefinition | VelcronAppDefinition): void;
|
|
33
33
|
static generateId(): string;
|
|
34
34
|
static createDeferredPromise<T>(): DeferredPromise<T>;
|
package/parser/VelcronData.js
CHANGED
|
@@ -367,6 +367,9 @@ class VelcronData {
|
|
|
367
367
|
return result;
|
|
368
368
|
}
|
|
369
369
|
static evaluateBoolean(template, renderContext) {
|
|
370
|
+
if (VelcronData.isUndefined(template)) {
|
|
371
|
+
return false;
|
|
372
|
+
}
|
|
370
373
|
if (VelcronData.isBoolean(template)) {
|
|
371
374
|
return template;
|
|
372
375
|
}
|
|
@@ -418,7 +421,7 @@ class VelcronData {
|
|
|
418
421
|
return !isNaN(value);
|
|
419
422
|
}
|
|
420
423
|
static isUndefined(value) {
|
|
421
|
-
return typeof value === undefined;
|
|
424
|
+
return typeof value === "undefined";
|
|
422
425
|
}
|
|
423
426
|
static isArray(obj) {
|
|
424
427
|
return Array.isArray(obj);
|
|
@@ -553,8 +556,8 @@ class VelcronData {
|
|
|
553
556
|
event :
|
|
554
557
|
VelcronConstants_1.VelcronConstants.events.idTokenStart + VelcronData.generateId() + VelcronConstants_1.VelcronConstants.events.idTokenEnd + " " + event;
|
|
555
558
|
}
|
|
556
|
-
static ensureKeys(ui) {
|
|
557
|
-
if (!ui.key) {
|
|
559
|
+
static ensureKeys(ui, generateNewKeys = false) {
|
|
560
|
+
if (!ui.key || generateNewKeys) {
|
|
558
561
|
ui.key = VelcronData.generateId();
|
|
559
562
|
}
|
|
560
563
|
if (ui.events) {
|
|
@@ -569,10 +572,10 @@ class VelcronData {
|
|
|
569
572
|
Object.keys(ui).forEach((key) => {
|
|
570
573
|
if (Array.isArray(ui[key])) {
|
|
571
574
|
ui[key].forEach((item) => {
|
|
572
|
-
if (!item.key) {
|
|
575
|
+
if (!item.key || generateNewKeys) {
|
|
573
576
|
item.key = VelcronData.generateId();
|
|
574
577
|
}
|
|
575
|
-
VelcronData.ensureKeys(item);
|
|
578
|
+
VelcronData.ensureKeys(item, generateNewKeys);
|
|
576
579
|
});
|
|
577
580
|
}
|
|
578
581
|
});
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import { VelcronDefinition,
|
|
1
|
+
import { VelcronDefinition, VelcronRenderContext } from "../models";
|
|
2
|
+
export declare enum VelcronSizeUnits {
|
|
3
|
+
Pixels = 1,
|
|
4
|
+
Numbers = 2
|
|
5
|
+
}
|
|
6
|
+
export interface VelcronStyleSettings {
|
|
7
|
+
sizeUnit: VelcronSizeUnits;
|
|
8
|
+
}
|
|
2
9
|
export declare class VelcronStyles {
|
|
3
|
-
static
|
|
10
|
+
private static styleSettings;
|
|
11
|
+
static create(definition: VelcronDefinition, renderCtx: VelcronRenderContext): any;
|
|
12
|
+
private static createStylesForText;
|
|
13
|
+
private static createStylesForImage;
|
|
14
|
+
private static createStylesForFlexbox;
|
|
15
|
+
private static createStylesForLayoutColumnComponent;
|
|
4
16
|
private static dataBindStyles;
|
|
5
|
-
static
|
|
6
|
-
static
|
|
7
|
-
static layoutColumnComponent(layoutDef: VelcronSectionDefinition, columnDef: VelcronSectionColumn, renderCtx: VelcronRenderContext): object;
|
|
17
|
+
private static setUnitForValue;
|
|
18
|
+
private static setup;
|
|
8
19
|
}
|
package/parser/VelcronStyles.js
CHANGED
|
@@ -1,121 +1,144 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VelcronStyles = void 0;
|
|
3
|
+
exports.VelcronStyles = exports.VelcronSizeUnits = void 0;
|
|
4
4
|
const VelcronData_1 = require("./VelcronData");
|
|
5
5
|
const models_1 = require("../models");
|
|
6
6
|
const VelcronConstants_1 = require("./VelcronConstants");
|
|
7
|
+
var VelcronSizeUnits;
|
|
8
|
+
(function (VelcronSizeUnits) {
|
|
9
|
+
VelcronSizeUnits[VelcronSizeUnits["Pixels"] = 1] = "Pixels";
|
|
10
|
+
VelcronSizeUnits[VelcronSizeUnits["Numbers"] = 2] = "Numbers";
|
|
11
|
+
})(VelcronSizeUnits = exports.VelcronSizeUnits || (exports.VelcronSizeUnits = {}));
|
|
7
12
|
class VelcronStyles {
|
|
8
|
-
static
|
|
9
|
-
const bliblu = ";";
|
|
13
|
+
static create(definition, renderCtx) {
|
|
10
14
|
let result = { ...definition.style };
|
|
11
|
-
// let result = {
|
|
12
|
-
// //Margin
|
|
13
|
-
// margin: definition?.style?.margin,
|
|
14
|
-
// marginTop: definition?.style?.marginTop,
|
|
15
|
-
// marginRight: definition?.style?.marginRight,
|
|
16
|
-
// marginBottom: definition?.style?.marginBottom,
|
|
17
|
-
// marginLeft: definition?.style?.marginLeft,
|
|
18
|
-
// //Padding
|
|
19
|
-
// padding: definition?.style?.padding,
|
|
20
|
-
// paddingTop: definition?.style?.paddingTop,
|
|
21
|
-
// paddingRight: definition?.style?.paddingRight,
|
|
22
|
-
// paddingBottom: definition?.style?.paddingBottom,
|
|
23
|
-
// paddingLeft: definition?.style?.paddingLeft,
|
|
24
|
-
// height: definition.style?.height,
|
|
25
|
-
// width: definition.style?.width
|
|
26
|
-
// }
|
|
27
15
|
if (definition.type === VelcronConstants_1.VelcronConstants.components.image) {
|
|
28
|
-
|
|
29
|
-
if (!result.width) {
|
|
30
|
-
result.width = "100%";
|
|
31
|
-
}
|
|
32
|
-
if (!result.height) {
|
|
33
|
-
result.height = 400;
|
|
34
|
-
}
|
|
16
|
+
result = this.createStylesForImage(definition, result);
|
|
35
17
|
}
|
|
36
18
|
else if (definition.type === VelcronConstants_1.VelcronConstants.components.text) {
|
|
37
|
-
|
|
38
|
-
if (textDef.color) {
|
|
39
|
-
result["color"] = textDef.color;
|
|
40
|
-
}
|
|
41
|
-
if (textDef.size) {
|
|
42
|
-
result["fontSize"] = textDef.size + "px";
|
|
43
|
-
}
|
|
19
|
+
result = this.createStylesForText(definition, result);
|
|
44
20
|
}
|
|
21
|
+
else if (definition.type === VelcronConstants_1.VelcronConstants.components.flexView) {
|
|
22
|
+
//result = this.createStylesForSection(definition as VelcronFlexBoxDefinition, result);
|
|
23
|
+
result = this.createStylesForFlexbox(definition, result);
|
|
24
|
+
}
|
|
25
|
+
// else if (definition.type === VelcronConstants.components.flexPanel) {
|
|
26
|
+
// result = this.createStylesForColumn(definition as VelcronFlexBoxDefinition, result);
|
|
27
|
+
// }
|
|
45
28
|
if (renderCtx) {
|
|
46
29
|
result = VelcronStyles.dataBindStyles(result, renderCtx);
|
|
47
30
|
}
|
|
48
31
|
return result;
|
|
49
32
|
}
|
|
50
|
-
static
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
33
|
+
static createStylesForText(textDefinition, styles) {
|
|
34
|
+
// const themeStore = useInject(ThemeStore);
|
|
35
|
+
// if (textDefinition.color && textDefinition.color != "") {
|
|
36
|
+
// styles["color"] = themeStore.getters.getColor(textDefinition.color);
|
|
37
|
+
// }
|
|
38
|
+
// else {
|
|
39
|
+
// styles["color"] = themeStore.getters.activeSchema().onBase.color;
|
|
40
|
+
// }
|
|
41
|
+
// const typography = themeStore.getters.typography(textDefinition.typography);
|
|
42
|
+
// styles["fontSize"] = this.setUnitForValue(typography.large.size);
|
|
43
|
+
// styles["font-weight"] = typography.large.weight;
|
|
44
|
+
// styles["line-height"] = this.setUnitForValue(typography.large.lineHeight);
|
|
57
45
|
return styles;
|
|
58
46
|
}
|
|
59
|
-
static
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
static createStylesForImage(imageDef, styles) {
|
|
48
|
+
if (!styles.width) {
|
|
49
|
+
styles.width = this.setUnitForValue(200);
|
|
50
|
+
}
|
|
51
|
+
if (!styles.height) {
|
|
52
|
+
styles.height = this.setUnitForValue(400);
|
|
53
|
+
}
|
|
54
|
+
styles.flex = "0 0 auto!important";
|
|
55
|
+
return styles;
|
|
66
56
|
}
|
|
67
|
-
static
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
// private static createStylesForSection(sectionDef: VelcronFlexBoxDefinition, styles: any) {
|
|
58
|
+
// styles.display = "flex";
|
|
59
|
+
// styles.width = "100%";
|
|
60
|
+
// styles["flex-direction"] = sectionDef.column ? "column" : "row";
|
|
61
|
+
// return styles;
|
|
62
|
+
// }
|
|
63
|
+
static createStylesForFlexbox(flexViewDefinition, styles) {
|
|
64
|
+
const flexGrow = flexViewDefinition.grow ? flexViewDefinition.grow : 1;
|
|
65
|
+
const flextShrink = flexGrow;
|
|
66
|
+
styles.display = "flex";
|
|
67
|
+
styles.flex = flexGrow;
|
|
68
|
+
styles["max-width"] = "100%";
|
|
69
|
+
styles["flex-direction"] = flexViewDefinition.column ? "column" : "row";
|
|
71
70
|
//Auto
|
|
72
|
-
if (
|
|
73
|
-
|
|
71
|
+
if (flexViewDefinition.width && flexViewDefinition.width === models_1.VelcronSectionColumnWidthTypes.auto) {
|
|
72
|
+
styles["flex"] = `${flexGrow} ${flextShrink} auto`;
|
|
74
73
|
}
|
|
75
74
|
//Pixels
|
|
76
|
-
else if (
|
|
77
|
-
width["flex"] =
|
|
75
|
+
else if (flexViewDefinition.width && VelcronData_1.VelcronData.isString(flexViewDefinition.width) && flexViewDefinition.width.endsWith("px")) {
|
|
76
|
+
//width["flex"] = `${flexGrow} ${flextShrink} ${columnDef.width}`;
|
|
77
|
+
styles["max-width"] = this.setUnitForValue(flexViewDefinition.width);
|
|
78
78
|
}
|
|
79
79
|
//Percentage
|
|
80
|
-
else if (
|
|
81
|
-
|
|
80
|
+
else if (flexViewDefinition.width && (isNaN(flexViewDefinition.width) === false)) {
|
|
81
|
+
styles["flex"] = `${flexGrow} ${flextShrink} ${flexViewDefinition.width}%`;
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
};
|
|
89
|
-
if (columnDef.horizontalAlignment && columnDef.horizontalAlignment !== models_1.VelcronHorizontalAlignments.left) {
|
|
83
|
+
// if (columnDef.horizontalAlignment && columnDef.horizontalAlignment !== VelcronHorizontalAlignments.left) {
|
|
84
|
+
// //Need to add this to make horizontalAlignment work for child div
|
|
85
|
+
// result["flex-direction"] = "column";
|
|
86
|
+
// }
|
|
87
|
+
if (flexViewDefinition.horizontalAlignment) {
|
|
90
88
|
//Need to add this to make horizontalAlignment work for child div
|
|
91
|
-
|
|
89
|
+
styles["justify-content"] = flexViewDefinition.horizontalAlignment;
|
|
92
90
|
}
|
|
93
|
-
if (
|
|
94
|
-
if (
|
|
95
|
-
result["flex-direction"] = "column";
|
|
96
|
-
|
|
91
|
+
if (flexViewDefinition.verticalAlignment) {
|
|
92
|
+
if (flexViewDefinition.verticalAlignment === models_1.VerticalAlignments.center) {
|
|
93
|
+
//result["flex-direction"] = "column";
|
|
94
|
+
styles["align-items"] = "center";
|
|
97
95
|
}
|
|
98
|
-
else if (
|
|
99
|
-
result["flex-direction"] = "column";
|
|
100
|
-
|
|
96
|
+
else if (flexViewDefinition.verticalAlignment === models_1.VerticalAlignments.bottom) {
|
|
97
|
+
//result["flex-direction"] = "column";
|
|
98
|
+
styles["align-items"] = "flex-end";
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
// if (flexViewDefinition.colorSchema && flexViewDefinition.colorSchema != "") {
|
|
102
|
+
// const themeStore = useInject(ThemeStore);
|
|
103
|
+
// styles["background-color"] = themeStore.getters.activeSchema().base.color;
|
|
104
|
+
// }
|
|
105
|
+
//Color
|
|
106
|
+
//if(flexViewDefinition.co)
|
|
107
|
+
//const { theming } = useTheme();
|
|
108
|
+
return styles;
|
|
105
109
|
}
|
|
106
|
-
static
|
|
107
|
-
|
|
108
|
-
"display": "flex",
|
|
109
|
-
};
|
|
110
|
+
static createStylesForLayoutColumnComponent(layoutDef, columnDef, styles) {
|
|
111
|
+
styles.display = "flex";
|
|
110
112
|
if (columnDef.horizontalAlignment) {
|
|
111
113
|
if (columnDef.horizontalAlignment === models_1.VelcronHorizontalAlignments.center) {
|
|
112
|
-
|
|
114
|
+
styles["justify-content"] = "center";
|
|
113
115
|
}
|
|
114
116
|
else if (columnDef.horizontalAlignment === models_1.VelcronHorizontalAlignments.right) {
|
|
115
|
-
|
|
117
|
+
styles["justify-content"] = "flex-end";
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
|
-
return
|
|
120
|
+
return styles;
|
|
121
|
+
}
|
|
122
|
+
static dataBindStyles(styles, renderCtx) {
|
|
123
|
+
Object.keys(styles).forEach((key) => {
|
|
124
|
+
const style = styles[key];
|
|
125
|
+
if (style && VelcronData_1.VelcronData.isString(style)) {
|
|
126
|
+
styles[key] = VelcronData_1.VelcronData.dataBind(renderCtx, style);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
return styles;
|
|
130
|
+
}
|
|
131
|
+
static setUnitForValue(value) {
|
|
132
|
+
if (this.styleSettings.sizeUnit === VelcronSizeUnits.Pixels) {
|
|
133
|
+
return value + "px";
|
|
134
|
+
}
|
|
135
|
+
return value;
|
|
136
|
+
}
|
|
137
|
+
static setup(settings) {
|
|
138
|
+
this.styleSettings = settings;
|
|
119
139
|
}
|
|
120
140
|
}
|
|
121
141
|
exports.VelcronStyles = VelcronStyles;
|
|
142
|
+
VelcronStyles.styleSettings = {
|
|
143
|
+
sizeUnit: VelcronSizeUnits.Pixels
|
|
144
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class VelcronStore {
|
|
2
|
+
static makeReactive: (obj: any) => unknown;
|
|
3
|
+
static reactivityCreator(fn: (obj: any) => unknown): void;
|
|
4
|
+
state<T>(obj: T): T;
|
|
5
|
+
mutation(fn: () => void): void;
|
|
6
|
+
}
|
|
7
|
+
export declare class TestStore extends VelcronStore {
|
|
8
|
+
test: {
|
|
9
|
+
title: string;
|
|
10
|
+
};
|
|
11
|
+
increment: (text: string) => string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestStore = exports.VelcronStore = void 0;
|
|
4
|
+
class VelcronStore {
|
|
5
|
+
static reactivityCreator(fn) {
|
|
6
|
+
VelcronStore.makeReactive = fn;
|
|
7
|
+
}
|
|
8
|
+
state(obj) {
|
|
9
|
+
if (!VelcronStore.makeReactive) {
|
|
10
|
+
throw new Error("Reactivity creator not set");
|
|
11
|
+
}
|
|
12
|
+
return VelcronStore.makeReactive(obj);
|
|
13
|
+
}
|
|
14
|
+
mutation(fn) {
|
|
15
|
+
fn();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.VelcronStore = VelcronStore;
|
|
19
|
+
class TestStore extends VelcronStore {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.test = this.state({ title: "Hello" });
|
|
23
|
+
this.increment = (text) => this.test.title = text;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.TestStore = TestStore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./VelcronStore";
|
package/stores/index.js
ADDED