@omnia/velcron 8.0.459-dev → 8.0.461-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/SharedUtils.d.ts +9 -0
- package/internal-do-not-import-from-here/shared/models/SharedUtils.js +20 -0
- package/internal-do-not-import-from-here/shared/models/theme/Blueprints.d.ts +17 -6
- package/models/VelcronDefinitions.d.ts +1 -2
- package/package.json +1 -1
- package/parser/VelcronRenderers.js +0 -1
- package/parser/VelcronStyles.js +5 -5
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
export declare class Utils {
|
|
2
|
+
private static _timeboxTimer;
|
|
2
3
|
/**
|
|
3
4
|
* Determine whether the argument is an array.
|
|
4
5
|
*
|
|
5
6
|
* @param obj Object to test whether or not it is an array.
|
|
6
7
|
*/
|
|
7
8
|
static isArray(obj: any): obj is Array<any>;
|
|
9
|
+
/**
|
|
10
|
+
* Check if array is null or undefined or empty
|
|
11
|
+
*/
|
|
12
|
+
static isArrayNullOrEmpty(obj: any): boolean;
|
|
8
13
|
/**
|
|
9
14
|
* Check if is type of a function
|
|
10
15
|
* @param obj Object to test whether or not it is an function.
|
|
@@ -26,4 +31,8 @@ export declare class Utils {
|
|
|
26
31
|
static isString(target: any): target is string;
|
|
27
32
|
static isNumber(target: any): target is number;
|
|
28
33
|
static clone<T extends I, I>(obj: I): T;
|
|
34
|
+
/**
|
|
35
|
+
* Set a timer with an ID. If timebox is called again with the same ID before the timer has triggered, don't do anything. Otherwise, set a new timer with that ID.
|
|
36
|
+
*/
|
|
37
|
+
static timebox(id: string, callback: () => any, ms: number): void;
|
|
29
38
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Utils = void 0;
|
|
4
4
|
class Utils {
|
|
5
|
+
static { this._timeboxTimer = {}; }
|
|
5
6
|
/**
|
|
6
7
|
* Determine whether the argument is an array.
|
|
7
8
|
*
|
|
@@ -10,6 +11,14 @@ class Utils {
|
|
|
10
11
|
static isArray(obj) {
|
|
11
12
|
return Array.isArray(obj);
|
|
12
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Check if array is null or undefined or empty
|
|
16
|
+
*/
|
|
17
|
+
static isArrayNullOrEmpty(obj) {
|
|
18
|
+
if (!Utils.isArray(obj))
|
|
19
|
+
return true;
|
|
20
|
+
return (obj == null || obj == undefined || obj.length == 0);
|
|
21
|
+
}
|
|
13
22
|
/**
|
|
14
23
|
* Check if is type of a function
|
|
15
24
|
* @param obj Object to test whether or not it is an function.
|
|
@@ -57,5 +66,16 @@ class Utils {
|
|
|
57
66
|
static clone(obj) {
|
|
58
67
|
return JSON.parse(JSON.stringify(obj));
|
|
59
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Set a timer with an ID. If timebox is called again with the same ID before the timer has triggered, don't do anything. Otherwise, set a new timer with that ID.
|
|
71
|
+
*/
|
|
72
|
+
static timebox(id, callback, ms) {
|
|
73
|
+
if (!Utils._timeboxTimer[id]) {
|
|
74
|
+
Utils._timeboxTimer[id] = setTimeout(() => {
|
|
75
|
+
Utils._timeboxTimer[id] = null;
|
|
76
|
+
callback();
|
|
77
|
+
}, ms);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
60
80
|
}
|
|
61
81
|
exports.Utils = Utils;
|
|
@@ -4,6 +4,7 @@ import { TypographyFontDefinition, TextStyleValue } from "./Typography";
|
|
|
4
4
|
import { ThemeBase } from "./ThemeBase";
|
|
5
5
|
import { VelcronRendererResolverReference } from "../velcron";
|
|
6
6
|
import { TextAlignment } from "../Enums";
|
|
7
|
+
import { HorizontalAlignments, VerticalAlignments } from "@omnia/fx-models";
|
|
7
8
|
export interface BlueprintStrategy {
|
|
8
9
|
buttons: {
|
|
9
10
|
primary: ButtonBlueprint;
|
|
@@ -31,21 +32,28 @@ export interface VariantBlueprints<T> extends Blueprints {
|
|
|
31
32
|
variant7?: T;
|
|
32
33
|
variant8?: T;
|
|
33
34
|
}
|
|
34
|
-
export interface
|
|
35
|
+
export interface HeaderIconBlueprint {
|
|
35
36
|
blueprint?: IconBlueprint;
|
|
36
37
|
background?: BackgroundDefinition;
|
|
37
|
-
|
|
38
|
+
alignX?: HorizontalAlignments;
|
|
39
|
+
alignY?: VerticalAlignments;
|
|
40
|
+
backgroundHeight?: number;
|
|
41
|
+
margin?: Spacing;
|
|
38
42
|
}
|
|
39
43
|
export interface HeaderBlueprint extends Blueprint {
|
|
40
44
|
/**velcron */
|
|
41
45
|
renderer?: VelcronRendererResolverReference;
|
|
46
|
+
iconMargin?: SpacingValue;
|
|
47
|
+
noIcon?: boolean;
|
|
42
48
|
state?: any;
|
|
43
49
|
/**Settings */
|
|
44
50
|
background?: BackgroundDefinition;
|
|
45
51
|
textAlign?: TextAlignment;
|
|
46
|
-
|
|
52
|
+
upperCase?: boolean;
|
|
53
|
+
padding?: Spacing;
|
|
54
|
+
margin?: Spacing;
|
|
47
55
|
text?: TextBlueprint;
|
|
48
|
-
|
|
56
|
+
icon?: HeaderIconBlueprint;
|
|
49
57
|
}
|
|
50
58
|
export interface HeaderBlueprints extends Blueprints, VariantBlueprints<HeaderBlueprint>, BlueprintsReference {
|
|
51
59
|
primary?: HeaderBlueprint;
|
|
@@ -113,13 +121,16 @@ export interface ButtonBlueprintVariant {
|
|
|
113
121
|
category: ButtonBlueprintType;
|
|
114
122
|
}
|
|
115
123
|
export interface ButtonBlueprint extends Blueprint {
|
|
116
|
-
|
|
117
|
-
|
|
124
|
+
padding?: Spacing;
|
|
125
|
+
iconMargin?: SpacingValue;
|
|
118
126
|
height?: number;
|
|
119
127
|
background?: BackgroundDefinition;
|
|
120
128
|
alterCase?: boolean;
|
|
121
129
|
text?: TextBlueprint;
|
|
122
130
|
icon?: IconBlueprint;
|
|
131
|
+
iconPosition?: HorizontalAlignments;
|
|
132
|
+
iconBackground?: BackgroundDefinition;
|
|
133
|
+
iconBackgroundHeight?: number;
|
|
123
134
|
viewTemplate?: VelcronRendererResolverReference;
|
|
124
135
|
}
|
|
125
136
|
export interface ButtonBlueprints extends Blueprints {
|
|
@@ -5,7 +5,7 @@ import { DynamicState, VelcronDefinition, VelcronEffects } from "..";
|
|
|
5
5
|
import { guid, PropertyConfiguration, PropertyValue, PropertyDefinition, PropertySetupBase } from "@omnia/velcron/internal-do-not-import-from-here/shared/models";
|
|
6
6
|
import { Properties } from "csstype";
|
|
7
7
|
import type { AnimationOptionsWithOverrides, InViewOptions, VariantDefinition, Variants } from "motion";
|
|
8
|
-
import { useColorSchemaStore
|
|
8
|
+
import { useColorSchemaStore } from "internal/fx/ux/mobile";
|
|
9
9
|
export interface ResolvedComponentRenderer {
|
|
10
10
|
component: unknown;
|
|
11
11
|
definition: VelcronDefinition;
|
|
@@ -83,7 +83,6 @@ export interface VelcronRenderContext {
|
|
|
83
83
|
id?: string;
|
|
84
84
|
rootContext: DynamicState;
|
|
85
85
|
currentContext: DynamicState;
|
|
86
|
-
theming?: ReturnType<typeof useThemeStore>;
|
|
87
86
|
colors?: ReturnType<typeof useColorSchemaStore>;
|
|
88
87
|
actions?: {
|
|
89
88
|
[name: string]: Array<string>;
|
package/package.json
CHANGED
|
@@ -92,7 +92,6 @@ class VelcronRenderers {
|
|
|
92
92
|
hooks: currentRenderCtx.hooks,
|
|
93
93
|
computed: currentRenderCtx.computed,
|
|
94
94
|
colors: currentRenderCtx.colors,
|
|
95
|
-
theming: currentRenderCtx.theming,
|
|
96
95
|
$editmode: currentRenderCtx.$editmode,
|
|
97
96
|
$display: currentRenderCtx.$display,
|
|
98
97
|
$active: currentRenderCtx.$active,
|
package/parser/VelcronStyles.js
CHANGED
|
@@ -109,7 +109,7 @@ class VelcronStyles {
|
|
|
109
109
|
/** Generic styling */
|
|
110
110
|
if (definition.margin) {
|
|
111
111
|
const margin = VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, definition.margin);
|
|
112
|
-
const spacing = renderCtx.
|
|
112
|
+
const spacing = renderCtx.colors.get.themeStore.get.spacing();
|
|
113
113
|
if (typeof margin === "object") {
|
|
114
114
|
styleBase.marginTop = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, margin.top), spacing, margin.scale));
|
|
115
115
|
styleBase.marginRight = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, margin.right), spacing, margin.scale));
|
|
@@ -126,7 +126,7 @@ class VelcronStyles {
|
|
|
126
126
|
}
|
|
127
127
|
if (definition.padding) {
|
|
128
128
|
const padding = VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, definition.padding);
|
|
129
|
-
const spacing = renderCtx.
|
|
129
|
+
const spacing = renderCtx.colors.get.themeStore.get.spacing();
|
|
130
130
|
if (typeof padding === "object") {
|
|
131
131
|
styleBase.paddingTop = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, padding.top), spacing, padding.scale));
|
|
132
132
|
styleBase.paddingRight = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, padding.right), spacing, padding.scale));
|
|
@@ -192,7 +192,7 @@ class VelcronStyles {
|
|
|
192
192
|
}
|
|
193
193
|
if (definition.type === VelcronConstants_1.VelcronConstants.components.row) {
|
|
194
194
|
const flexDefinition = definition;
|
|
195
|
-
const spacingBlueprint = renderCtx.
|
|
195
|
+
const spacingBlueprint = renderCtx.colors.get.themeStore.get.spacing();
|
|
196
196
|
const gapX = flexDefinition.gapX || flexDefinition?.gapX?.toString() === "0"
|
|
197
197
|
? __1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, flexDefinition.gapX), spacingBlueprint)
|
|
198
198
|
: __1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, flexDefinition.gapY), spacingBlueprint);
|
|
@@ -225,7 +225,7 @@ class VelcronStyles {
|
|
|
225
225
|
alignY = "stretch";
|
|
226
226
|
}
|
|
227
227
|
if (flexDefinition.position) {
|
|
228
|
-
const spacing = renderCtx.
|
|
228
|
+
const spacing = renderCtx.colors.get.themeStore.get.spacing();
|
|
229
229
|
this.applySpacingStyles(flexDefinition.position, renderCtx, styleBase, spacing, "", (pos) => (styleBase.position = VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, pos.type)), {
|
|
230
230
|
position: "type",
|
|
231
231
|
});
|
|
@@ -274,7 +274,7 @@ class VelcronStyles {
|
|
|
274
274
|
this.insertBackgroundColor(styleBase, flexDefinition, renderCtx);
|
|
275
275
|
}
|
|
276
276
|
if (definition.type === VelcronConstants_1.VelcronConstants.components.grid) {
|
|
277
|
-
const spacingBlueprint = renderCtx.
|
|
277
|
+
const spacingBlueprint = renderCtx.colors.get.themeStore.get.spacing();
|
|
278
278
|
const gridDefinition = definition;
|
|
279
279
|
const columns = VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, gridDefinition.columns);
|
|
280
280
|
const minWidth = VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, gridDefinition.minColumnWidth);
|