@omnia/velcron 8.0.162-dev → 8.0.164-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/internal-do-not-import-from-here/shared/models/theming/ThemeDefinitionV2.d.ts +4 -3
- package/internal-do-not-import-from-here/shared/models/velcron/VelcronDefinition.d.ts +6 -4
- package/models/Enums.d.ts +3 -16
- package/models/Enums.js +2 -20
- package/models/VelcronDefinitions.d.ts +8 -9
- package/models/VelcronPropertyEditorDefinitions.d.ts +27 -211
- package/models/VelcronPropertyEditorDefinitions.js +0 -87
- package/models/VelcronState.d.ts +186 -0
- package/models/VelcronState.js +102 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +1 -0
- package/package.json +1 -1
- package/parser/VelcronData.d.ts +8 -7
- package/parser/VelcronData.js +32 -13
- package/parser/VelcronStyles.js +5 -5
- package/rules/IsEditMode.js +1 -1
- package/stores/VelcronColorSchema.d.ts +1 -1
- package/templatebuilder/VelcronEditorBuilder.d.ts +18 -0
- package/templatebuilder/{editor/VelcronEditorBuilder2.js → VelcronEditorBuilder.js} +46 -10
- package/templatebuilder/{editor → old/editor}/VelcronColorSchemaEditor.d.ts +2 -2
- package/templatebuilder/{editor → old/editor}/VelcronContentEditor.d.ts +2 -2
- package/templatebuilder/{editor → old/editor}/VelcronContentEditor.js +12 -12
- package/templatebuilder/{editor → old/editor}/VelcronEditorBuilder.d.ts +2 -2
- package/templatebuilder/{editor → old/editor}/VelcronEditorBuilderBase.d.ts +3 -3
- package/templatebuilder/{editor → old/editor}/VelcronImageEditor.d.ts +2 -2
- package/templatebuilder/{editor → old/editor}/VelcronImageEditor.js +1 -1
- package/templatebuilder/{editor → old/editor}/VelcronPropertyMappingEditorBuilder.d.ts +2 -2
- package/templatebuilder/{editor → old/editor}/VelcronPropertyMappingEditorBuilder.js +1 -1
- package/templatebuilder/useVelcronEditorBuilder.d.ts +2 -2
- package/templatebuilder/useVelcronEditorBuilder.js +2 -2
- package/templatebuilder/useVelcronTemplateBuilder.d.ts +3 -3
- package/templatebuilder/useVelcronTemplateBuilder.js +5 -5
- package/templatebuilder/editor/VelcronEditorBuilder2.d.ts +0 -15
- /package/templatebuilder/{editor → old/editor}/VelcronColorSchemaEditor.js +0 -0
- /package/templatebuilder/{editor → old/editor}/VelcronEditorBuilder.js +0 -0
- /package/templatebuilder/{editor → old/editor}/VelcronEditorBuilderBase.js +0 -0
- /package/templatebuilder/{state → old/state}/VelcronBlockHeaderStateBuilder.d.ts +0 -0
- /package/templatebuilder/{state → old/state}/VelcronBlockHeaderStateBuilder.js +0 -0
- /package/templatebuilder/{state → old/state}/VelcronColorSchemaBuilder.d.ts +0 -0
- /package/templatebuilder/{state → old/state}/VelcronColorSchemaBuilder.js +0 -0
- /package/templatebuilder/{state → old/state}/VelcronContentStateBuilder.d.ts +0 -0
- /package/templatebuilder/{state → old/state}/VelcronContentStateBuilder.js +0 -0
- /package/templatebuilder/{state → old/state}/VelcronImageStateBuilder.d.ts +0 -0
- /package/templatebuilder/{state → old/state}/VelcronImageStateBuilder.js +0 -0
- /package/templatebuilder/{state → old/state}/VelcronPropertyMappingStateBuilder.d.ts +0 -0
- /package/templatebuilder/{state → old/state}/VelcronPropertyMappingStateBuilder.js +0 -0
- /package/templatebuilder/{state → old/state}/VelcronStateBuilder.d.ts +0 -0
- /package/templatebuilder/{state → old/state}/VelcronStateBuilder.js +0 -0
- /package/templatebuilder/{state → old/state}/VelcronStateBuilderBase.d.ts +0 -0
- /package/templatebuilder/{state → old/state}/VelcronStateBuilderBase.js +0 -0
- /package/templatebuilder/{state → old/state}/VelcronTextContentBuilder.d.ts +0 -0
- /package/templatebuilder/{state → old/state}/VelcronTextContentBuilder.js +0 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { BackgroundDefinition, ContainerBlueprint, ContainerVariant, TextBlueprint, TypographySize, TypographyType, VelcronSpacing } from "@omnia/velcron/internal-do-not-import-from-here/shared/models";
|
|
2
|
+
import { VelcronImageRatios } from "./VelcronDefinitions";
|
|
3
|
+
export interface VelcronState {
|
|
4
|
+
images?: VelcronImagesState;
|
|
5
|
+
container?: {
|
|
6
|
+
colorSchemaType?: string;
|
|
7
|
+
spacing?: VelcronSpacing;
|
|
8
|
+
blueprint?: ContainerBlueprint | ContainerVariant;
|
|
9
|
+
background?: BackgroundDefinition;
|
|
10
|
+
};
|
|
11
|
+
grid?: VelcronGridState;
|
|
12
|
+
colorSchemas?: VelcronColorSchemasState;
|
|
13
|
+
content?: VelcronContentState;
|
|
14
|
+
header?: VelcronHeaderState;
|
|
15
|
+
properties?: VelcronPropertiesState;
|
|
16
|
+
spacing?: VelcronSpacingState;
|
|
17
|
+
}
|
|
18
|
+
export interface VelcronGridState {
|
|
19
|
+
columnWidth?: number;
|
|
20
|
+
columns?: Array<object>;
|
|
21
|
+
gap?: string | number;
|
|
22
|
+
}
|
|
23
|
+
export interface VelcronSpacingState {
|
|
24
|
+
container?: VelcronSpacing;
|
|
25
|
+
}
|
|
26
|
+
export interface VelcronHeaderState {
|
|
27
|
+
title?: VelcronTextState;
|
|
28
|
+
icon?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface VelcronTextState {
|
|
31
|
+
text?: string;
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
typography?: VelcronTypographyState;
|
|
34
|
+
}
|
|
35
|
+
export interface VelcronTypographyState {
|
|
36
|
+
type?: TypographyType;
|
|
37
|
+
size?: TypographySize;
|
|
38
|
+
toned?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface VelcronContentState {
|
|
41
|
+
caption?: VelcronTextState;
|
|
42
|
+
main?: VelcronTextState;
|
|
43
|
+
title?: VelcronTextState;
|
|
44
|
+
summary?: VelcronTextState;
|
|
45
|
+
}
|
|
46
|
+
export interface VelcronPropertiesState {
|
|
47
|
+
user: any;
|
|
48
|
+
mappings: Array<any>;
|
|
49
|
+
}
|
|
50
|
+
export interface VelcronImagesState {
|
|
51
|
+
main?: VelcronImageState;
|
|
52
|
+
alt1?: VelcronImageState;
|
|
53
|
+
alt2?: VelcronImageState;
|
|
54
|
+
}
|
|
55
|
+
export interface VelcronImageState {
|
|
56
|
+
url?: string;
|
|
57
|
+
ratio?: VelcronImageRatios;
|
|
58
|
+
caption?: VelcronTextState;
|
|
59
|
+
width?: number;
|
|
60
|
+
height?: number;
|
|
61
|
+
}
|
|
62
|
+
export interface VelcronStylingState {
|
|
63
|
+
}
|
|
64
|
+
export interface VelcronColorSchemasState {
|
|
65
|
+
main: string;
|
|
66
|
+
}
|
|
67
|
+
export declare const VelcronImagesStateBinding: {
|
|
68
|
+
main: {
|
|
69
|
+
editor: string;
|
|
70
|
+
url: string;
|
|
71
|
+
ratio: string;
|
|
72
|
+
caption: string;
|
|
73
|
+
width: string;
|
|
74
|
+
height: string;
|
|
75
|
+
};
|
|
76
|
+
alt1: {
|
|
77
|
+
editor: string;
|
|
78
|
+
url: string;
|
|
79
|
+
ratio: string;
|
|
80
|
+
caption: string;
|
|
81
|
+
width: string;
|
|
82
|
+
height: string;
|
|
83
|
+
};
|
|
84
|
+
alt2: {
|
|
85
|
+
editor: string;
|
|
86
|
+
url: string;
|
|
87
|
+
ratio: string;
|
|
88
|
+
caption: string;
|
|
89
|
+
width: string;
|
|
90
|
+
height: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
export declare const VelcronStateMapping: {
|
|
94
|
+
grid: {
|
|
95
|
+
columns: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export declare const VelcronStateBinding: {
|
|
99
|
+
colorSchemas: {
|
|
100
|
+
main_depricated: {
|
|
101
|
+
value: string;
|
|
102
|
+
type: string;
|
|
103
|
+
filled: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
container: {
|
|
107
|
+
colorSchemaType: string;
|
|
108
|
+
spacing: string;
|
|
109
|
+
blueprint: string;
|
|
110
|
+
background: {
|
|
111
|
+
value: string;
|
|
112
|
+
media: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
images: {
|
|
116
|
+
main: {
|
|
117
|
+
editor: string;
|
|
118
|
+
url: string;
|
|
119
|
+
ratio: string;
|
|
120
|
+
caption: string;
|
|
121
|
+
width: string;
|
|
122
|
+
height: string;
|
|
123
|
+
};
|
|
124
|
+
alt1: {
|
|
125
|
+
editor: string;
|
|
126
|
+
url: string;
|
|
127
|
+
ratio: string;
|
|
128
|
+
caption: string;
|
|
129
|
+
width: string;
|
|
130
|
+
height: string;
|
|
131
|
+
};
|
|
132
|
+
alt2: {
|
|
133
|
+
editor: string;
|
|
134
|
+
url: string;
|
|
135
|
+
ratio: string;
|
|
136
|
+
caption: string;
|
|
137
|
+
width: string;
|
|
138
|
+
height: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
content: {
|
|
142
|
+
title: {
|
|
143
|
+
text: string;
|
|
144
|
+
placeholder: string;
|
|
145
|
+
blueprint: import("@omnia/velcron/internal-do-not-import-from-here/shared/models").VelcronBindableProp<TextBlueprint>;
|
|
146
|
+
};
|
|
147
|
+
main: {
|
|
148
|
+
text: string;
|
|
149
|
+
placeholder: string;
|
|
150
|
+
blueprint: import("@omnia/velcron/internal-do-not-import-from-here/shared/models").VelcronBindableProp<TextBlueprint>;
|
|
151
|
+
};
|
|
152
|
+
caption: {
|
|
153
|
+
text: string;
|
|
154
|
+
placeholder: string;
|
|
155
|
+
blueprint: import("@omnia/velcron/internal-do-not-import-from-here/shared/models").VelcronBindableProp<TextBlueprint>;
|
|
156
|
+
};
|
|
157
|
+
summary: {
|
|
158
|
+
text: string;
|
|
159
|
+
placeholder: string;
|
|
160
|
+
blueprint: import("@omnia/velcron/internal-do-not-import-from-here/shared/models").VelcronBindableProp<TextBlueprint>;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
grid: {
|
|
164
|
+
value: string;
|
|
165
|
+
columnWidth: string;
|
|
166
|
+
columns: string;
|
|
167
|
+
gap: string;
|
|
168
|
+
};
|
|
169
|
+
header: {
|
|
170
|
+
title: {
|
|
171
|
+
text: string;
|
|
172
|
+
placeholder: string;
|
|
173
|
+
blueprint: import("@omnia/velcron/internal-do-not-import-from-here/shared/models").VelcronBindableProp<TextBlueprint>;
|
|
174
|
+
};
|
|
175
|
+
icon: string;
|
|
176
|
+
};
|
|
177
|
+
spacing: {
|
|
178
|
+
container: {
|
|
179
|
+
value: string;
|
|
180
|
+
top: string;
|
|
181
|
+
right: string;
|
|
182
|
+
bottom: string;
|
|
183
|
+
left: string;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronStateBinding = exports.VelcronStateMapping = exports.VelcronImagesStateBinding = void 0;
|
|
4
|
+
const models_1 = require("@omnia/velcron/internal-do-not-import-from-here/shared/models");
|
|
5
|
+
exports.VelcronImagesStateBinding = {
|
|
6
|
+
main: {
|
|
7
|
+
editor: "{{images.main.url}}",
|
|
8
|
+
url: "{{images.main.url}}",
|
|
9
|
+
ratio: "{{images.main.ratio}}",
|
|
10
|
+
caption: "{{images.main.caption}}",
|
|
11
|
+
width: "{{images.main.width}}",
|
|
12
|
+
height: "{{images.main.height}}",
|
|
13
|
+
},
|
|
14
|
+
alt1: {
|
|
15
|
+
editor: "{{images.alt1.url}}",
|
|
16
|
+
url: "{{images.alt1.url}}",
|
|
17
|
+
ratio: "{{images.alt1.ratio}}",
|
|
18
|
+
caption: "{{images.alt1.caption}}",
|
|
19
|
+
width: "{{images.alt1.width}}",
|
|
20
|
+
height: "{{images.alt1.height}}",
|
|
21
|
+
},
|
|
22
|
+
alt2: {
|
|
23
|
+
editor: "{{images.alt2.url}}",
|
|
24
|
+
url: "{{images.alt2.url}}",
|
|
25
|
+
ratio: "{{images.alt2.ratio}}",
|
|
26
|
+
caption: "{{images.alt2.caption}}",
|
|
27
|
+
width: "{{images.alt2.width}}",
|
|
28
|
+
height: "{{images.alt2.height}}",
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const VelcronContentStateBinding = {
|
|
32
|
+
title: {
|
|
33
|
+
text: (0, models_1.velcronBind)("content.title.text"),
|
|
34
|
+
placeholder: (0, models_1.velcronBind)("content.title.placeholder"),
|
|
35
|
+
blueprint: (0, models_1.velcronBind)("content.title.blueprint")
|
|
36
|
+
},
|
|
37
|
+
main: {
|
|
38
|
+
text: (0, models_1.velcronBind)("content.main.text"),
|
|
39
|
+
placeholder: (0, models_1.velcronBind)("content.main.placeholder"),
|
|
40
|
+
blueprint: (0, models_1.velcronBind)("content.main.blueprint")
|
|
41
|
+
},
|
|
42
|
+
caption: {
|
|
43
|
+
text: (0, models_1.velcronBind)("content.caption.text"),
|
|
44
|
+
placeholder: (0, models_1.velcronBind)("content.caption.placeholder"),
|
|
45
|
+
blueprint: (0, models_1.velcronBind)("content.caption.blueprint")
|
|
46
|
+
},
|
|
47
|
+
summary: {
|
|
48
|
+
text: (0, models_1.velcronBind)("content.summary.text"),
|
|
49
|
+
placeholder: (0, models_1.velcronBind)("content.summary.placeholder"),
|
|
50
|
+
blueprint: (0, models_1.velcronBind)("content.summary.blueprint")
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
exports.VelcronStateMapping = {
|
|
54
|
+
grid: {
|
|
55
|
+
columns: "grid.columns",
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
exports.VelcronStateBinding = {
|
|
59
|
+
colorSchemas: {
|
|
60
|
+
main_depricated: {
|
|
61
|
+
value: (0, models_1.velcronBind)("colorSchemas.main"),
|
|
62
|
+
type: (0, models_1.velcronBind)("colorSchemas.main.type"),
|
|
63
|
+
filled: (0, models_1.velcronBind)("colorSchemas.main.filled")
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
container: {
|
|
67
|
+
colorSchemaType: (0, models_1.velcronBind)("$state.container.colorSchemaType"),
|
|
68
|
+
spacing: (0, models_1.velcronBind)("$state.container.spacing"),
|
|
69
|
+
blueprint: (0, models_1.velcronBind)("$state.container.blueprint"),
|
|
70
|
+
background: {
|
|
71
|
+
value: (0, models_1.velcronBind)("$state.container.background"),
|
|
72
|
+
media: (0, models_1.velcronBind)("$state.container.background.media")
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
images: exports.VelcronImagesStateBinding,
|
|
76
|
+
content: VelcronContentStateBinding,
|
|
77
|
+
grid: {
|
|
78
|
+
value: (0, models_1.velcronBind)("$state.grid"),
|
|
79
|
+
columnWidth: (0, models_1.velcronBind)("$state.grid.columnWidth"),
|
|
80
|
+
columns: (0, models_1.velcronBind)("$state.grid.columns"),
|
|
81
|
+
gap: (0, models_1.velcronBind)("$state.grid.gap"),
|
|
82
|
+
//rows:velcronBind("grid.rows"),
|
|
83
|
+
},
|
|
84
|
+
header: {
|
|
85
|
+
title: {
|
|
86
|
+
text: (0, models_1.velcronBind)("$state.header.title.text"),
|
|
87
|
+
placeholder: (0, models_1.velcronBind)("$state.header.title.placeholder"),
|
|
88
|
+
blueprint: (0, models_1.velcronBind)("$state.content.title.blueprint")
|
|
89
|
+
},
|
|
90
|
+
icon: (0, models_1.velcronBind)("$state.header.icon")
|
|
91
|
+
},
|
|
92
|
+
spacing: {
|
|
93
|
+
container: {
|
|
94
|
+
value: (0, models_1.velcronBind)("$state.spacing.chrome"),
|
|
95
|
+
top: (0, models_1.velcronBind)("{{spacing.chrome.top}}"),
|
|
96
|
+
right: (0, models_1.velcronBind)("{{spacing.chrome.right}}"),
|
|
97
|
+
bottom: (0, models_1.velcronBind)("{{spacing.chrome.bottom}}"),
|
|
98
|
+
left: (0, models_1.velcronBind)("{{spacing.chrome.left}}"),
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//properties?:VelcronPropertiesState,
|
|
102
|
+
};
|
package/models/index.d.ts
CHANGED
package/models/index.js
CHANGED
|
@@ -8,3 +8,4 @@ tslib_1.__exportStar(require("./Enums"), exports);
|
|
|
8
8
|
tslib_1.__exportStar(require("./VelcronUnitProvider"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./VelcronPropertyEditorDefinitions"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./ActionHooks"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./VelcronState"), exports);
|
package/package.json
CHANGED
package/parser/VelcronData.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { VelcronRenderContext } from "../models";
|
|
1
|
+
import { VelcronRenderContext, VelcronDataTypes } from "../models";
|
|
2
2
|
import { VelcronAppDefinition, VelcronBindableProp, VelcronDefinition } from "..";
|
|
3
3
|
export interface ParseResult<T> {
|
|
4
4
|
is: boolean;
|
|
5
5
|
value: T;
|
|
6
6
|
}
|
|
7
7
|
export declare class VelcronData {
|
|
8
|
-
static dataBind<T = string>(renderContext: VelcronRenderContext,
|
|
9
|
-
static
|
|
8
|
+
static dataBind<T = string>(renderContext: VelcronRenderContext, bindTo: VelcronBindableProp<any>): T;
|
|
9
|
+
static isBindable<T = string>(bindable: VelcronBindableProp<T>): boolean;
|
|
10
10
|
static getBindPath(text: string): string;
|
|
11
11
|
static addCtxToVariableNames(template: string, skipIfNameStartsWith?: string, skipIfNameMatches?: Array<string>, overridePrefixWhenNameMatches?: {
|
|
12
12
|
[name: string]: string;
|
|
@@ -20,12 +20,13 @@ export declare class VelcronData {
|
|
|
20
20
|
static evaluateArray(template: string, renderContext: VelcronRenderContext): Array<any> | null;
|
|
21
21
|
static evaluateBoolean(template: string | Boolean, renderContext: VelcronRenderContext): boolean | null;
|
|
22
22
|
static tryParseBoolean(bool: any): ParseResult<boolean | null>;
|
|
23
|
-
static isString(text: any):
|
|
24
|
-
static isBoolean(value: any): boolean;
|
|
25
|
-
static isNumber(value: any):
|
|
23
|
+
static isString(text: any): text is string;
|
|
24
|
+
static isBoolean(value: any): value is boolean;
|
|
25
|
+
static isNumber(value: any): value is number;
|
|
26
26
|
static isUndefined(value: any): boolean;
|
|
27
27
|
static isArray(obj: any): obj is ExtendArray;
|
|
28
|
-
static isObject(value: any):
|
|
28
|
+
static isObject(value: any): value is object;
|
|
29
|
+
static getDataType(value: any): VelcronDataTypes;
|
|
29
30
|
static extendObject(obj: any): any;
|
|
30
31
|
static propertyPathExists(obj: object, path: string): boolean;
|
|
31
32
|
static getOrSetObjectByPath<T>(object: Object, path: string, value?: any): T | null;
|
package/parser/VelcronData.js
CHANGED
|
@@ -6,35 +6,38 @@ const VelcronConstants_1 = require("./VelcronConstants");
|
|
|
6
6
|
const VelcronLogger_1 = require("./VelcronLogger");
|
|
7
7
|
const TextValue_1 = require("./TextValue");
|
|
8
8
|
class VelcronData {
|
|
9
|
-
static dataBind(renderContext,
|
|
10
|
-
if (!VelcronData.isString(
|
|
11
|
-
return
|
|
9
|
+
static dataBind(renderContext, bindTo) {
|
|
10
|
+
if (!VelcronData.isString(bindTo)) {
|
|
11
|
+
return bindTo;
|
|
12
12
|
}
|
|
13
13
|
//Bound to one state property and supports 2 way data binding > $bind: $state.title
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
return VelcronData.getOrSet(renderContext,
|
|
14
|
+
if (bindTo.startsWith(VelcronConstants_1.VelcronConstants.state.bindToken)) {
|
|
15
|
+
bindTo = bindTo.substring(VelcronConstants_1.VelcronConstants.state.bindToken.length).trim();
|
|
16
|
+
return VelcronData.getOrSet(renderContext, bindTo);
|
|
17
17
|
}
|
|
18
18
|
//Built-in context tokens
|
|
19
|
-
if (
|
|
19
|
+
if (bindTo === VelcronConstants_1.VelcronConstants.context.editModeToken) {
|
|
20
20
|
return renderContext.$editmode;
|
|
21
21
|
}
|
|
22
|
-
else if (
|
|
22
|
+
else if (bindTo === VelcronConstants_1.VelcronConstants.context.activeToken) {
|
|
23
23
|
return renderContext.$active;
|
|
24
24
|
}
|
|
25
25
|
//String interpolation > {{ $state.title }} and {{ $state.description }}
|
|
26
|
-
const tokens = this.getTokens(
|
|
26
|
+
const tokens = this.getTokens(bindTo, false);
|
|
27
27
|
tokens.forEach((token) => {
|
|
28
28
|
let data = this.getOrSet(renderContext, token.replace(/\s*{{\s*|\s*}}\s*/g, ""));
|
|
29
29
|
if (data instanceof TextValue_1.TextValue) {
|
|
30
30
|
data = data.value;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
bindTo = bindTo.replace(token, data);
|
|
33
33
|
});
|
|
34
|
-
return
|
|
34
|
+
return bindTo;
|
|
35
35
|
}
|
|
36
|
-
static
|
|
37
|
-
|
|
36
|
+
static isBindable(bindable) {
|
|
37
|
+
if (!VelcronData.isString(bindable)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return bindable?.startsWith(VelcronConstants_1.VelcronConstants.state.bindToken);
|
|
38
41
|
}
|
|
39
42
|
static getBindPath(text) {
|
|
40
43
|
return text?.substring(VelcronConstants_1.VelcronConstants.state.bindToken.length).trim();
|
|
@@ -461,6 +464,22 @@ class VelcronData {
|
|
|
461
464
|
!Array.isArray(value) &&
|
|
462
465
|
value !== null;
|
|
463
466
|
}
|
|
467
|
+
static getDataType(value) {
|
|
468
|
+
if (value === null)
|
|
469
|
+
return models_1.VelcronDataTypes.unknown;
|
|
470
|
+
else if (Array.isArray(value))
|
|
471
|
+
return models_1.VelcronDataTypes.array;
|
|
472
|
+
else if (VelcronData.isObject(value))
|
|
473
|
+
return models_1.VelcronDataTypes.object;
|
|
474
|
+
else if (VelcronData.isString(value))
|
|
475
|
+
return models_1.VelcronDataTypes.text;
|
|
476
|
+
else if (VelcronData.isNumber(value))
|
|
477
|
+
return models_1.VelcronDataTypes.number;
|
|
478
|
+
else if (VelcronData.isBoolean(value))
|
|
479
|
+
return models_1.VelcronDataTypes.boolean;
|
|
480
|
+
else
|
|
481
|
+
return models_1.VelcronDataTypes.unknown;
|
|
482
|
+
}
|
|
464
483
|
static extendObject(obj) {
|
|
465
484
|
//Give objects some powerups
|
|
466
485
|
if (VelcronData.isUndefined(obj)) {
|
package/parser/VelcronStyles.js
CHANGED
|
@@ -157,16 +157,16 @@ class VelcronStyles {
|
|
|
157
157
|
}
|
|
158
158
|
else if (definition.type === VelcronConstants_1.VelcronConstants.components.row) {
|
|
159
159
|
const flexDefinition = definition;
|
|
160
|
+
const spacing = renderCtx.theming.get.spacing();
|
|
160
161
|
let alignX = null;
|
|
161
162
|
let alignY = null;
|
|
162
|
-
const gapX = flexDefinition.gapX ? flexDefinition.gapX : flexDefinition.gapY;
|
|
163
|
-
const gapY = flexDefinition.gapY ? flexDefinition.gapY :
|
|
163
|
+
const gapX = flexDefinition.gapX || flexDefinition?.gapX?.toString() === "0" ? (0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.gapX), spacing) : (0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.gapY), spacing);
|
|
164
|
+
const gapY = flexDefinition.gapY || flexDefinition?.gapY?.toString() === "0" ? (0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.gapY), spacing) : gapX;
|
|
164
165
|
const width = VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.width);
|
|
165
166
|
const minWidth = VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.minWidth);
|
|
166
167
|
const height = VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.height);
|
|
167
168
|
const minHeight = VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.minHeight);
|
|
168
169
|
if (flexDefinition.absolute) {
|
|
169
|
-
const spacing = renderCtx.theming.get.spacing();
|
|
170
170
|
styleBase["position"] = "absolute";
|
|
171
171
|
/**Use margin to position the element since flex does not support absolute positioning */
|
|
172
172
|
styleBase["marginTop"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.absolute.top), spacing));
|
|
@@ -200,8 +200,8 @@ class VelcronStyles {
|
|
|
200
200
|
styleBase["flexWrap"] = flexDefinition.wrap ? "wrap" : null;
|
|
201
201
|
styleBase["justifyContent"] = alignX;
|
|
202
202
|
styleBase["alignItems"] = alignY;
|
|
203
|
-
styleBase["rowGap"] = gapY;
|
|
204
|
-
styleBase["columnGap"] = gapX;
|
|
203
|
+
styleBase["rowGap"] = this.unitProvider.formatDimension(gapY);
|
|
204
|
+
styleBase["columnGap"] = this.unitProvider.formatDimension(gapX);
|
|
205
205
|
styleBase["flexBasis"] = flexDefinition.height ? this.unitProvider.formatDimension(height) : undefined;
|
|
206
206
|
styleBase["width"] = this.unitProvider.formatDimension(width);
|
|
207
207
|
styleBase["maxWidth"] = this.unitProvider.formatDimension(width);
|
package/rules/IsEditMode.js
CHANGED
|
@@ -22,7 +22,7 @@ const parser_1 = require("../parser");
|
|
|
22
22
|
*/
|
|
23
23
|
function isEditMode(definition, bindableProp, renderContext) {
|
|
24
24
|
//A bind property must exist for the definition to be editable
|
|
25
|
-
if (parser_1.VelcronData.
|
|
25
|
+
if (parser_1.VelcronData.isBindable(definition[bindableProp]) === false) {
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
let result = false;
|
|
@@ -8,7 +8,7 @@ export declare const useVelcronColorSchemaStore: (newStateWithName?: string) =>
|
|
|
8
8
|
onContainer: ColorDefinition;
|
|
9
9
|
isContainer: boolean;
|
|
10
10
|
name: string;
|
|
11
|
-
colorSchemaType: "primary" | "secondary" | ColorSchemaTypes | "accent1" | "accent2" | "accent3" | "neutral" | "warning" | "notification" | "
|
|
11
|
+
colorSchemaType: "background" | "primary" | "secondary" | ColorSchemaTypes | "accent1" | "accent2" | "accent3" | "neutral" | "warning" | "notification" | "error" | "info" | "dynamic";
|
|
12
12
|
id: import("@omnia/fx-models").GuidValue;
|
|
13
13
|
};
|
|
14
14
|
get: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TypographyType, VelcronEditor, VelcronTypographyEditorSettings } from "@omnia/fx-models";
|
|
2
|
+
export declare class VelcronEditorBuilder {
|
|
3
|
+
private editors;
|
|
4
|
+
private formatStateMapping;
|
|
5
|
+
add(): {
|
|
6
|
+
blueprintEditor: (name: string, stateMapping: string, type: "container") => VelcronEditorBuilder;
|
|
7
|
+
spacingEditor: (name: string, stateMapping: string, individualSelection?: boolean) => VelcronEditorBuilder;
|
|
8
|
+
imageEditor: (name: string, stateMapping: string) => VelcronEditorBuilder;
|
|
9
|
+
colorSchemaEditor: (name: string, stateMapping: string) => VelcronEditorBuilder;
|
|
10
|
+
markdownEditor: (name: string, stateMapping: string, placeholder?: string) => VelcronEditorBuilder;
|
|
11
|
+
textEditor: (name: string, stateMapping: string, typographyType: TypographyType, placeholder?: string) => VelcronEditorBuilder;
|
|
12
|
+
blockHeaderEditor: () => VelcronEditorBuilder;
|
|
13
|
+
typographyEditor: (stateMapping: string, settings: VelcronTypographyEditorSettings) => VelcronEditorBuilder;
|
|
14
|
+
backgroundEditor: (name: string, stateMapping: string, type: "image" | "video") => VelcronEditorBuilder;
|
|
15
|
+
gridEditor: (name: string, stateMapping: string) => VelcronEditorBuilder;
|
|
16
|
+
};
|
|
17
|
+
build(): VelcronEditor<any>[];
|
|
18
|
+
}
|
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.VelcronEditorBuilder = void 0;
|
|
4
|
+
const parser_1 = require("../parser");
|
|
5
|
+
class VelcronEditorBuilder {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.editors = [];
|
|
7
8
|
}
|
|
8
9
|
formatStateMapping(stateMapping) {
|
|
9
|
-
return stateMapping
|
|
10
|
+
return stateMapping
|
|
11
|
+
.replace(parser_1.VelcronConstants.properties.tokenStart, "")
|
|
12
|
+
.replace(parser_1.VelcronConstants.properties.tokenEnd, "")
|
|
13
|
+
.replace(parser_1.VelcronConstants.state.bindToken, "")
|
|
14
|
+
.replace(parser_1.VelcronConstants.state.stateRootToken + ".", "")
|
|
15
|
+
.trim();
|
|
10
16
|
}
|
|
11
17
|
add() {
|
|
12
18
|
return {
|
|
19
|
+
blueprintEditor: (name, stateMapping, type) => {
|
|
20
|
+
this.editors.push({
|
|
21
|
+
name: name,
|
|
22
|
+
type: "blueprint",
|
|
23
|
+
state: this.formatStateMapping(stateMapping),
|
|
24
|
+
settings: {
|
|
25
|
+
type: type
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return this;
|
|
29
|
+
},
|
|
13
30
|
spacingEditor: (name, stateMapping, individualSelection) => {
|
|
14
31
|
this.editors.push({
|
|
15
32
|
name: name,
|
|
16
33
|
type: "spacing",
|
|
17
|
-
|
|
34
|
+
state: this.formatStateMapping(stateMapping),
|
|
18
35
|
settings: {
|
|
19
36
|
individualSelection: individualSelection
|
|
20
37
|
}
|
|
@@ -25,7 +42,7 @@ class VelcronEditorBuilder2 {
|
|
|
25
42
|
this.editors.push({
|
|
26
43
|
name: name,
|
|
27
44
|
type: "image",
|
|
28
|
-
|
|
45
|
+
state: this.formatStateMapping(stateMapping),
|
|
29
46
|
});
|
|
30
47
|
return this;
|
|
31
48
|
},
|
|
@@ -33,7 +50,7 @@ class VelcronEditorBuilder2 {
|
|
|
33
50
|
this.editors.push({
|
|
34
51
|
name: name,
|
|
35
52
|
type: "color-schema-type",
|
|
36
|
-
|
|
53
|
+
state: this.formatStateMapping(stateMapping),
|
|
37
54
|
});
|
|
38
55
|
return this;
|
|
39
56
|
},
|
|
@@ -41,7 +58,7 @@ class VelcronEditorBuilder2 {
|
|
|
41
58
|
this.editors.push({
|
|
42
59
|
name: name,
|
|
43
60
|
type: "markdown",
|
|
44
|
-
|
|
61
|
+
state: this.formatStateMapping(stateMapping),
|
|
45
62
|
settings: {
|
|
46
63
|
placeholder: placeholder
|
|
47
64
|
}
|
|
@@ -52,7 +69,7 @@ class VelcronEditorBuilder2 {
|
|
|
52
69
|
this.editors.push({
|
|
53
70
|
name: name,
|
|
54
71
|
type: "text",
|
|
55
|
-
|
|
72
|
+
state: this.formatStateMapping(stateMapping),
|
|
56
73
|
settings: {
|
|
57
74
|
type: typographyType,
|
|
58
75
|
placeholder: placeholder
|
|
@@ -75,12 +92,31 @@ class VelcronEditorBuilder2 {
|
|
|
75
92
|
this.editors.push({
|
|
76
93
|
name: "Typography",
|
|
77
94
|
type: "typography",
|
|
78
|
-
|
|
95
|
+
state: stateMapping,
|
|
79
96
|
settings: settings ? settings : {
|
|
80
97
|
type: "text"
|
|
81
98
|
}
|
|
82
99
|
});
|
|
83
100
|
return this;
|
|
101
|
+
},
|
|
102
|
+
backgroundEditor: (name, stateMapping, type) => {
|
|
103
|
+
this.editors.push({
|
|
104
|
+
name: name,
|
|
105
|
+
type: "background",
|
|
106
|
+
state: this.formatStateMapping(stateMapping),
|
|
107
|
+
settings: {
|
|
108
|
+
type: type
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return this;
|
|
112
|
+
},
|
|
113
|
+
gridEditor: (name, stateMapping) => {
|
|
114
|
+
this.editors.push({
|
|
115
|
+
name: name,
|
|
116
|
+
type: "grid",
|
|
117
|
+
state: this.formatStateMapping(stateMapping),
|
|
118
|
+
});
|
|
119
|
+
return this;
|
|
84
120
|
}
|
|
85
121
|
};
|
|
86
122
|
}
|
|
@@ -102,4 +138,4 @@ class VelcronEditorBuilder2 {
|
|
|
102
138
|
// return result;
|
|
103
139
|
}
|
|
104
140
|
}
|
|
105
|
-
exports.
|
|
141
|
+
exports.VelcronEditorBuilder = VelcronEditorBuilder;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VelcronEditor } from "@omnia/fx-models";
|
|
2
2
|
import { VelcronEditorBuilder } from "./VelcronEditorBuilder";
|
|
3
3
|
import { VelcronEditorBuilderBase } from "./VelcronEditorBuilderBase";
|
|
4
4
|
export declare class VelcronColorSchemaEditorBuilder extends VelcronEditorBuilderBase {
|
|
5
5
|
private editor;
|
|
6
6
|
constructor(builder: any);
|
|
7
7
|
add(): VelcronEditorBuilder;
|
|
8
|
-
protected internalBuild():
|
|
8
|
+
protected internalBuild(): VelcronEditor<any>[];
|
|
9
9
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VelcronEditor } from "@omnia/fx-models";
|
|
2
2
|
import { VelcronEditorBuilderBase } from "./VelcronEditorBuilderBase";
|
|
3
3
|
export declare class VelcronContentEditorBuilder extends VelcronEditorBuilderBase {
|
|
4
4
|
private mainEditor;
|
|
@@ -34,5 +34,5 @@ export declare class VelcronContentEditorBuilder extends VelcronEditorBuilderBas
|
|
|
34
34
|
addPropertyMappingEditor: (title?: string) => VelcronContentEditorBuilder;
|
|
35
35
|
addTypographyEditor: (title?: string, type?: "text" | "title") => VelcronContentEditorBuilder;
|
|
36
36
|
};
|
|
37
|
-
protected internalBuild():
|
|
37
|
+
protected internalBuild(): VelcronEditor<any>[];
|
|
38
38
|
}
|