@omnia/velcron 8.0.286-dev → 8.0.288-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/ShortId.d.ts +6 -0
- package/internal-do-not-import-from-here/shared/models/ShortId.js +12 -0
- package/internal-do-not-import-from-here/shared/models/index.d.ts +1 -0
- package/internal-do-not-import-from-here/shared/models/index.js +1 -0
- package/internal-do-not-import-from-here/shared/models/theming/Blueprints.d.ts +2 -3
- package/internal-do-not-import-from-here/shared/models/theming/SharedBlueprintMethods.d.ts +3 -2
- package/internal-do-not-import-from-here/shared/models/theming/SharedBlueprintMethods.js +27 -8
- package/internal-do-not-import-from-here/shared/models/theming/Spacing.d.ts +2 -1
- package/internal-do-not-import-from-here/shared/models/theming/index.d.ts +1 -0
- package/internal-do-not-import-from-here/shared/models/theming/index.js +1 -0
- package/internal-do-not-import-from-here/shared/models/theming/useSpacingScaling.d.ts +15 -0
- package/internal-do-not-import-from-here/shared/models/theming/useSpacingScaling.js +88 -0
- package/internal-do-not-import-from-here/shared/models/velcron/VelcronDefinition.d.ts +2 -2
- package/models/Enums.d.ts +1 -2
- package/models/Enums.js +0 -2
- package/models/VelcronDefinitions.d.ts +3 -2
- package/models/VelcronTypes.d.ts +1 -1
- package/package.json +1 -1
- package/parser/VelcronData.d.ts +1 -0
- package/parser/VelcronData.js +3 -0
- package/parser/VelcronRenderers.d.ts +4 -4
- package/parser/VelcronRenderers.js +6 -6
- package/parser/VelcronStyles.d.ts +17 -3
- package/parser/VelcronStyles.js +25 -16
- package/stores/VelcronTheming.d.ts +2 -2
- package/stores/VelcronTheming.js +2 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shortId = shortId;
|
|
4
|
+
const Guid_1 = require("./Guid");
|
|
5
|
+
/**
|
|
6
|
+
* Generates a short ID.
|
|
7
|
+
*
|
|
8
|
+
* @returns {string} The generated short ID.
|
|
9
|
+
*/
|
|
10
|
+
function shortId() {
|
|
11
|
+
return (0, Guid_1.guid)().replace("-", "").substring(0, 8);
|
|
12
|
+
}
|
|
@@ -24,3 +24,4 @@ tslib_1.__exportStar(require("./velcron"), exports);
|
|
|
24
24
|
tslib_1.__exportStar(require("./DependencyInjection"), exports);
|
|
25
25
|
tslib_1.__exportStar(require("./Messaging"), exports);
|
|
26
26
|
tslib_1.__exportStar(require("./EventHook"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./ShortId"), exports);
|
|
@@ -56,10 +56,9 @@ export interface ComponentBlueprints extends Blueprints, BlueprintsReference {
|
|
|
56
56
|
containers?: ContainerBlueprints;
|
|
57
57
|
}
|
|
58
58
|
export interface SpacingBlueprint {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
l: SpacingDefinition;
|
|
60
|
+
s: SpacingDefinition;
|
|
61
61
|
}
|
|
62
|
-
export type SpacingBlueprintTypes = "inner" | "layout";
|
|
63
62
|
export type WebBlueprintItemDefintionType = "button" | "searchbox" | "text" | "icon" | "tab";
|
|
64
63
|
export declare enum WebBlueprintItemDefintionTypes {
|
|
65
64
|
button = "button",
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { SpacingBlueprint } from "./Blueprints";
|
|
2
|
+
import { SpacingScale } from "./Spacing";
|
|
3
|
+
export declare function getSpacingValueFromBlueprint(spacingValue: any, blueprint: SpacingBlueprint, scale?: SpacingScale): number;
|
|
@@ -3,30 +3,49 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.getSpacingValueFromBlueprint = getSpacingValueFromBlueprint;
|
|
5
5
|
const Spacing_1 = require("./Spacing");
|
|
6
|
-
|
|
6
|
+
const useSpacingScaling_1 = require("./useSpacingScaling");
|
|
7
|
+
const spacingScaling = (0, useSpacingScaling_1.useSpacingScaling)();
|
|
8
|
+
function getValueWithoutScale(value) {
|
|
9
|
+
if (!value) {
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
if (typeof value === "number") {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
if (value.indexOf(":") === -1) {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
return value.split(":")[1];
|
|
19
|
+
}
|
|
20
|
+
function getSpacingValueFromBlueprint(spacingValue, blueprint, scale) {
|
|
7
21
|
if (!spacingValue) {
|
|
8
22
|
return 0;
|
|
9
23
|
}
|
|
24
|
+
if (!scale) {
|
|
25
|
+
scale = spacingScaling.get.scale(spacingValue);
|
|
26
|
+
}
|
|
27
|
+
const definition = scale === "l" ? blueprint.l : blueprint.s;
|
|
10
28
|
let negative = false;
|
|
11
29
|
let result = spacingValue;
|
|
12
30
|
if (isNaN(spacingValue) && definition) {
|
|
13
|
-
|
|
31
|
+
let strippedValue = getValueWithoutScale(spacingValue);
|
|
32
|
+
if (strippedValue.startsWith("-")) {
|
|
14
33
|
negative = true;
|
|
15
34
|
}
|
|
16
|
-
|
|
17
|
-
if (
|
|
35
|
+
strippedValue = strippedValue.replace("-", "");
|
|
36
|
+
if (strippedValue === Spacing_1.SpacingTypes.xs) {
|
|
18
37
|
result = definition.xs;
|
|
19
38
|
}
|
|
20
|
-
else if (
|
|
39
|
+
else if (strippedValue === Spacing_1.SpacingTypes.s) {
|
|
21
40
|
result = definition.s;
|
|
22
41
|
}
|
|
23
|
-
else if (
|
|
42
|
+
else if (strippedValue === Spacing_1.SpacingTypes.m) {
|
|
24
43
|
result = definition.m;
|
|
25
44
|
}
|
|
26
|
-
else if (
|
|
45
|
+
else if (strippedValue === Spacing_1.SpacingTypes.l) {
|
|
27
46
|
result = definition.l;
|
|
28
47
|
}
|
|
29
|
-
else if (
|
|
48
|
+
else if (strippedValue === Spacing_1.SpacingTypes.xl) {
|
|
30
49
|
result = definition.xl;
|
|
31
50
|
}
|
|
32
51
|
else {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export type Spacing = {
|
|
2
|
-
scale?:
|
|
2
|
+
scale?: SpacingScale;
|
|
3
3
|
top?: SpacingValue;
|
|
4
4
|
right?: SpacingValue;
|
|
5
5
|
bottom?: SpacingValue;
|
|
6
6
|
left?: SpacingValue;
|
|
7
7
|
};
|
|
8
|
+
export type SpacingScale = "l" | "s";
|
|
8
9
|
export interface SpacingDefinition {
|
|
9
10
|
name: string;
|
|
10
11
|
xs: number;
|
|
@@ -9,3 +9,4 @@ tslib_1.__exportStar(require("./Spacing"), exports);
|
|
|
9
9
|
tslib_1.__exportStar(require("./SharedBlueprintMethods"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./SharedColorMethods"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./Blueprints"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./useSpacingScaling"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Spacing, SpacingScale, SpacingValue } from "@omnia/fx-models";
|
|
2
|
+
export declare function useSpacingScaling(): {
|
|
3
|
+
get: {
|
|
4
|
+
valueWithoutScale: (value: SpacingValue) => string | number;
|
|
5
|
+
scaleFromValue: (value: SpacingValue) => SpacingScale;
|
|
6
|
+
scale: (value: Spacing | SpacingValue) => SpacingScale;
|
|
7
|
+
};
|
|
8
|
+
add: {
|
|
9
|
+
scaleToValue: (value: SpacingValue, scale: SpacingScale) => string | number;
|
|
10
|
+
fallBackScale: (value: SpacingValue, scale: SpacingScale) => string | number;
|
|
11
|
+
};
|
|
12
|
+
has: {
|
|
13
|
+
scaling: (value: SpacingValue) => boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSpacingScaling = useSpacingScaling;
|
|
4
|
+
function useSpacingScaling() {
|
|
5
|
+
function getValueWithoutScale(value) {
|
|
6
|
+
if (!value) {
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
if (typeof value === "number") {
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
if (!value.indexOf) {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
if (value.indexOf(":") === -1) {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
return value.split(":")[1];
|
|
19
|
+
}
|
|
20
|
+
function getScaleFromValue(value) {
|
|
21
|
+
if (!value) {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
if (typeof value === "number") {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
if (value.indexOf(":") === -1) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return value.split(":")[0];
|
|
31
|
+
}
|
|
32
|
+
function addScaleToValue(value, scale) {
|
|
33
|
+
if (!scale) {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
if (!value) {
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
if (typeof value === "number") {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
if (value.indexOf(":") > -1) {
|
|
43
|
+
return `${scale}:${value.split(":")[1]}`;
|
|
44
|
+
}
|
|
45
|
+
return `${scale}:${value}`;
|
|
46
|
+
}
|
|
47
|
+
function hasScaling(value) {
|
|
48
|
+
if (!value) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (typeof value === "number") {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
if (value.indexOf(":") > -1) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
function getScale(value) {
|
|
60
|
+
if (!value) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
if (typeof value === "object") {
|
|
64
|
+
return value.scale;
|
|
65
|
+
}
|
|
66
|
+
return getScaleFromValue(value);
|
|
67
|
+
}
|
|
68
|
+
function setScaleIfEmpty(value, scale) {
|
|
69
|
+
if (hasScaling(value)) {
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
return addScaleToValue(value, scale);
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
get: {
|
|
76
|
+
valueWithoutScale: getValueWithoutScale,
|
|
77
|
+
scaleFromValue: getScaleFromValue,
|
|
78
|
+
scale: getScale
|
|
79
|
+
},
|
|
80
|
+
add: {
|
|
81
|
+
scaleToValue: addScaleToValue,
|
|
82
|
+
fallBackScale: setScaleIfEmpty
|
|
83
|
+
},
|
|
84
|
+
has: {
|
|
85
|
+
scaling: hasScaling
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -25,17 +25,17 @@ export interface VelcronDefinition extends VelcronDefinitionBase, VelcronDimensi
|
|
|
25
25
|
if?: string;
|
|
26
26
|
events?: VelcronEvent;
|
|
27
27
|
}
|
|
28
|
+
export type VelcronSpacingScale = "l" | "s";
|
|
28
29
|
export interface VelcronSpacing {
|
|
30
|
+
scale?: VelcronSpacingScale;
|
|
29
31
|
top?: number | string;
|
|
30
32
|
right?: number | string;
|
|
31
33
|
bottom?: number | string;
|
|
32
34
|
left?: number | string;
|
|
33
35
|
}
|
|
34
|
-
export type VelcronSpacingTypes = "inner" | "layout";
|
|
35
36
|
interface VelcronDimensionStyling {
|
|
36
37
|
margin?: VelcronSpacing;
|
|
37
38
|
padding?: VelcronSpacing;
|
|
38
|
-
spacingType?: VelcronSpacingTypes;
|
|
39
39
|
}
|
|
40
40
|
export interface VelcronStyling {
|
|
41
41
|
margin?: string;
|
package/models/Enums.d.ts
CHANGED
package/models/Enums.js
CHANGED
|
@@ -32,6 +32,4 @@ var VelcronDataTypes;
|
|
|
32
32
|
VelcronDataTypes["boolean"] = "boolean";
|
|
33
33
|
VelcronDataTypes["array"] = "array";
|
|
34
34
|
VelcronDataTypes["componentArray"] = "componentArray";
|
|
35
|
-
//Depricated????
|
|
36
|
-
VelcronDataTypes["bind"] = "bind";
|
|
37
35
|
})(VelcronDataTypes || (exports.VelcronDataTypes = VelcronDataTypes = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VelcronOnUpdatedEvent, VelcronOnClosedEvent, VelcronOnCloseRequestedEvent, VelcronOnPressEvent, VelcronSpacing, VelcronStyling, VelcronCustomComponentDefinition, VelcronAppDefinition, VelcronRendererResolverReference, EventHook, Future, TextBlueprint, VelcronBindableProp, VelcronEditor, ContainerBlueprint, BackgroundDefinition, ContainerVariant, IconBlueprint, ButtonBlueprint } from "@omnia/velcron/internal-do-not-import-from-here/shared/models";
|
|
2
|
-
import {
|
|
2
|
+
import { VelcronComponentArrayType, VelcronPrimitiveType } from "./VelcronTypes";
|
|
3
3
|
import { AssignOperators, VelcronHorizontalAlignments, VelcronIconTypes, VelcronActionTypes, VelcronVerticalAlignments } from "./Enums";
|
|
4
4
|
import { DynamicState, VelcronDefinition, VelcronEffects, useVelcronThemingStore } from "..";
|
|
5
5
|
import { guid, PropertyConfiguration, PropertyValue, PropertyDefinition, PropertySetupBase } from "@omnia/fx/models";
|
|
@@ -65,7 +65,7 @@ export interface VelcronRenderContext {
|
|
|
65
65
|
};
|
|
66
66
|
components?: Array<VelcronCustomComponentDefinition>;
|
|
67
67
|
properties?: {
|
|
68
|
-
[name: string]: VelcronPrimitiveType |
|
|
68
|
+
[name: string]: VelcronPrimitiveType | VelcronComponentArrayType;
|
|
69
69
|
};
|
|
70
70
|
computed?: {
|
|
71
71
|
[name: string]: Array<string>;
|
|
@@ -314,6 +314,7 @@ export interface VelcronLottieDefinition extends VelcronDefinition {
|
|
|
314
314
|
export interface VelcronSlidePanelDefinition extends VelcronDefinition {
|
|
315
315
|
type: "slide-panel";
|
|
316
316
|
slidesPerView?: VelcronBindableProp<number>;
|
|
317
|
+
delay?: VelcronBindableProp<number>;
|
|
317
318
|
pagination?: VelcronBindableProp<boolean>;
|
|
318
319
|
navigation?: VelcronBindableProp<boolean>;
|
|
319
320
|
scrollbar?: VelcronBindableProp<boolean>;
|
package/models/VelcronTypes.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { VelcronDefinition } from "@omnia/fx-models";
|
|
|
2
2
|
export type VelcronPrimitiveType = string | number | boolean;
|
|
3
3
|
export type VelcronArrayType<T> = Array<T>;
|
|
4
4
|
export type VelcronObjectType<T extends Object> = T;
|
|
5
|
-
export type
|
|
5
|
+
export type VelcronComponentArrayType = Array<VelcronDefinition>;
|
package/package.json
CHANGED
package/parser/VelcronData.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare class VelcronData {
|
|
|
26
26
|
static isUndefined(value: any): value is undefined;
|
|
27
27
|
static isArray(obj: any): obj is ExtendArray;
|
|
28
28
|
static isObject(value: any): value is object;
|
|
29
|
+
static hasValue(value: any): boolean;
|
|
29
30
|
static getDataType(value: any): VelcronDataTypes;
|
|
30
31
|
static extendObject(obj: any): any;
|
|
31
32
|
static propertyPathExists(obj: object, path: string): boolean;
|
package/parser/VelcronData.js
CHANGED
|
@@ -477,6 +477,9 @@ class VelcronData {
|
|
|
477
477
|
!Array.isArray(value) &&
|
|
478
478
|
value !== null;
|
|
479
479
|
}
|
|
480
|
+
static hasValue(value) {
|
|
481
|
+
return value !== undefined && value !== null;
|
|
482
|
+
}
|
|
480
483
|
static getDataType(value) {
|
|
481
484
|
if (value === null)
|
|
482
485
|
return models_1.VelcronDataTypes.unknown;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuiltInComponentRenderers, ResolvedComponentRenderer, VelcronRenderContext } from "../models";
|
|
2
|
-
import { DynamicState, VelcronDefinition, VelcronRendererResolverReference } from "..";
|
|
2
|
+
import { DynamicState, VelcronDefinition, VelcronRendererResolverReference, VelcronResolverId } from "..";
|
|
3
3
|
export declare class VelcronRenderers {
|
|
4
4
|
private static components;
|
|
5
5
|
private static referenceResolvers;
|
|
@@ -8,9 +8,9 @@ export declare class VelcronRenderers {
|
|
|
8
8
|
static hasComponent(type: string): any;
|
|
9
9
|
static registerComponents(components: BuiltInComponentRenderers): void;
|
|
10
10
|
static getComponent(definition: VelcronDefinition, renderContext: VelcronRenderContext): ResolvedComponentRenderer;
|
|
11
|
-
static registerReferenceResolver(
|
|
12
|
-
static getReferenceResolver(
|
|
13
|
-
static hasReferenceResolver(
|
|
11
|
+
static registerReferenceResolver(resolverId: VelcronResolverId, resolverFunction: (reference: VelcronRendererResolverReference) => Promise<VelcronDefinition>): void;
|
|
12
|
+
static getReferenceResolver(resolverId: VelcronResolverId): (reference: VelcronRendererResolverReference) => Promise<VelcronDefinition>;
|
|
13
|
+
static hasReferenceResolver(resolverId: VelcronResolverId): boolean;
|
|
14
14
|
static definitionContainsCustomColorSchema(definition: VelcronDefinition): boolean;
|
|
15
15
|
static createNewRendererContext(currentRenderCtx: VelcronRenderContext, definition: VelcronDefinition, newViewModel?: DynamicState): VelcronRenderContext;
|
|
16
16
|
static ensureRenderContext(rendererInfo: ResolvedComponentRenderer, definition: VelcronDefinition, currentRenderCtx: VelcronRenderContext, newViewModel?: DynamicState): VelcronRenderContext;
|
|
@@ -67,14 +67,14 @@ class VelcronRenderers {
|
|
|
67
67
|
}
|
|
68
68
|
return result;
|
|
69
69
|
}
|
|
70
|
-
static registerReferenceResolver(
|
|
71
|
-
this.referenceResolvers[
|
|
70
|
+
static registerReferenceResolver(resolverId, resolverFunction) {
|
|
71
|
+
this.referenceResolvers[resolverId] = resolverFunction;
|
|
72
72
|
}
|
|
73
|
-
static getReferenceResolver(
|
|
74
|
-
return this.referenceResolvers[
|
|
73
|
+
static getReferenceResolver(resolverId) {
|
|
74
|
+
return this.referenceResolvers[resolverId];
|
|
75
75
|
}
|
|
76
|
-
static hasReferenceResolver(
|
|
77
|
-
return this.referenceResolvers[
|
|
76
|
+
static hasReferenceResolver(resolverId) {
|
|
77
|
+
return this.referenceResolvers[resolverId] ? true : false;
|
|
78
78
|
}
|
|
79
79
|
static definitionContainsCustomColorSchema(definition) {
|
|
80
80
|
return definition.colorSchemaType && definition.colorSchemaType !== "";
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { VelcronBorder, VelcronColorStyling, VelcronDefinitionHasEffects, VelcronDefinitionHasOverflow, VelcronDimensions, VelcronEffects, VelcronRenderContext } from "../models";
|
|
2
2
|
import { VelcronUnitProvider } from "../models/VelcronUnitProvider";
|
|
3
|
-
import {
|
|
3
|
+
import { SpacingBlueprint, VelcronBindableProp, VelcronDefinition } from "..";
|
|
4
4
|
export declare class VelcronStyles {
|
|
5
5
|
static styleProvider: (baseStyles: object, definition: VelcronDefinition, renderCtx: VelcronRenderContext) => any;
|
|
6
6
|
static effectsProvider: (effects: VelcronEffects, renderCtx: VelcronRenderContext) => VelcronEffects;
|
|
7
7
|
static unitProvider: VelcronUnitProvider;
|
|
8
|
+
spacingScaling: {
|
|
9
|
+
get: {
|
|
10
|
+
valueWithoutScale: (value: import("..").SpacingValue) => string | number;
|
|
11
|
+
scaleFromValue: (value: import("..").SpacingValue) => import("..").SpacingScale;
|
|
12
|
+
scale: (value: import("..").Spacing | import("..").SpacingValue) => import("..").SpacingScale;
|
|
13
|
+
};
|
|
14
|
+
add: {
|
|
15
|
+
scaleToValue: (value: import("..").SpacingValue, scale: import("..").SpacingScale) => string | number;
|
|
16
|
+
fallBackScale: (value: import("..").SpacingValue, scale: import("..").SpacingScale) => string | number;
|
|
17
|
+
};
|
|
18
|
+
has: {
|
|
19
|
+
scaling: (value: import("..").SpacingValue) => boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
8
22
|
static registerStyleProvider(fn: (styleBase: object, definition: VelcronDefinition, renderCtx: VelcronRenderContext) => object | string, unitProvider: VelcronUnitProvider): void;
|
|
9
23
|
static registerEffectsProvider(fn: (effects: VelcronEffects, renderCtx: VelcronRenderContext) => VelcronEffects): void;
|
|
10
24
|
static applyEffects(definition: VelcronDefinitionHasEffects, renderCtx: VelcronRenderContext, applyTo: (effects: VelcronEffects) => any): any;
|
|
@@ -12,8 +26,8 @@ export declare class VelcronStyles {
|
|
|
12
26
|
static insertBorderRadiusStyles(styleBase: any, settings: VelcronDimensions): void;
|
|
13
27
|
static insertBorderStyles(styleBase: any, borderSettings: VelcronBorder, renderCtx: VelcronRenderContext): void;
|
|
14
28
|
static create(definition: VelcronDefinition, renderCtx: VelcronRenderContext): object | string;
|
|
15
|
-
static applySpacingDimension(value: string | number, spacing:
|
|
29
|
+
static applySpacingDimension(value: string | number, spacing: SpacingBlueprint): string | number;
|
|
16
30
|
static applyOverflow(definition: VelcronDefinitionHasOverflow, renderCtx: VelcronRenderContext, styleBase: any): void;
|
|
17
|
-
static applySpacingStyles<T>(spacing: VelcronBindableProp<T>, renderCtx: VelcronRenderContext, styleBase: any, spacingDef:
|
|
31
|
+
static applySpacingStyles<T>(spacing: VelcronBindableProp<T>, renderCtx: VelcronRenderContext, styleBase: any, spacingDef: SpacingBlueprint, styleType: string, objectIsDatabound?: (obj: T) => void, additionalPropsToDataBind?: object): void;
|
|
18
32
|
static dataBindStyles(styles: object, renderCtx: VelcronRenderContext): object;
|
|
19
33
|
}
|
package/parser/VelcronStyles.js
CHANGED
|
@@ -5,6 +5,9 @@ const VelcronData_1 = require("./VelcronData");
|
|
|
5
5
|
const VelcronConstants_1 = require("./VelcronConstants");
|
|
6
6
|
const __1 = require("..");
|
|
7
7
|
class VelcronStyles {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.spacingScaling = (0, __1.useSpacingScaling)();
|
|
10
|
+
}
|
|
8
11
|
static registerStyleProvider(fn, unitProvider) {
|
|
9
12
|
VelcronStyles.styleProvider = fn;
|
|
10
13
|
VelcronStyles.unitProvider = unitProvider;
|
|
@@ -95,15 +98,16 @@ class VelcronStyles {
|
|
|
95
98
|
const styleBase = { ...definition.style };
|
|
96
99
|
/**Generic styling */
|
|
97
100
|
if (definition.margin) {
|
|
98
|
-
const spacing = renderCtx.theming.get.spacing(definition);
|
|
99
101
|
const margin = VelcronData_1.VelcronData.dataBind(renderCtx, definition.margin);
|
|
102
|
+
const spacing = renderCtx.theming.get.spacing();
|
|
100
103
|
if (typeof margin === "object") {
|
|
101
|
-
styleBase["marginTop"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, margin.top), spacing));
|
|
102
|
-
styleBase["marginRight"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, margin.right), spacing));
|
|
103
|
-
styleBase["marginBottom"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, margin.bottom), spacing));
|
|
104
|
-
styleBase["marginLeft"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, margin.left), spacing));
|
|
104
|
+
styleBase["marginTop"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, margin.top), spacing, margin.scale));
|
|
105
|
+
styleBase["marginRight"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, margin.right), spacing, margin.scale));
|
|
106
|
+
styleBase["marginBottom"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, margin.bottom), spacing, margin.scale));
|
|
107
|
+
styleBase["marginLeft"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, margin.left), spacing, margin.scale));
|
|
105
108
|
}
|
|
106
109
|
else {
|
|
110
|
+
//const spacing = renderCtx.theming.get.spacing(VelcronStyles.spacingScaling.get.scaleFromValue(margin));
|
|
107
111
|
const value = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, margin), spacing));
|
|
108
112
|
styleBase["marginTop"] = value;
|
|
109
113
|
styleBase["marginRight"] = value;
|
|
@@ -112,16 +116,13 @@ class VelcronStyles {
|
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
if (definition.padding) {
|
|
115
|
-
const spacing = renderCtx.theming.get.spacing(definition);
|
|
116
119
|
const padding = VelcronData_1.VelcronData.dataBind(renderCtx, definition.padding);
|
|
117
|
-
|
|
118
|
-
// VelcronData.getOrSetObjectByPathUsingRenderContext(renderCtx, definition.padding);
|
|
119
|
-
//const padding = VelcronData.dataBind(renderCtx, definition.padding) as any as VelcronDimensions;
|
|
120
|
+
const spacing = renderCtx.theming.get.spacing();
|
|
120
121
|
if (typeof padding === "object") {
|
|
121
|
-
styleBase["paddingTop"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, padding.top), spacing));
|
|
122
|
-
styleBase["paddingRight"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, padding.right), spacing));
|
|
123
|
-
styleBase["paddingBottom"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, padding.bottom), spacing));
|
|
124
|
-
styleBase["paddingLeft"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, padding.left), spacing));
|
|
122
|
+
styleBase["paddingTop"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, padding.top), spacing, padding.scale));
|
|
123
|
+
styleBase["paddingRight"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, padding.right), spacing, padding.scale));
|
|
124
|
+
styleBase["paddingBottom"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, padding.bottom), spacing, padding.scale));
|
|
125
|
+
styleBase["paddingLeft"] = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, padding.left), spacing, padding.scale));
|
|
125
126
|
}
|
|
126
127
|
else {
|
|
127
128
|
const value = this.unitProvider.formatDimension((0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, padding), spacing));
|
|
@@ -184,17 +185,25 @@ class VelcronStyles {
|
|
|
184
185
|
}
|
|
185
186
|
else if (definition.type === VelcronConstants_1.VelcronConstants.components.row) {
|
|
186
187
|
const flexDefinition = definition;
|
|
187
|
-
const
|
|
188
|
+
const spacingBlueprint = renderCtx.theming.get.spacing();
|
|
188
189
|
let alignX = null;
|
|
189
190
|
let alignY = null;
|
|
191
|
+
if (flexDefinition.gapX) {
|
|
192
|
+
//debugger;
|
|
193
|
+
}
|
|
190
194
|
//const testing = getSpacingValueFromBlueprint(VelcronData.dataBind(renderCtx, flexDefinition.gapX), spacing);
|
|
191
|
-
const gapX = flexDefinition.gapX || flexDefinition?.gapX?.toString() === "0" ?
|
|
192
|
-
|
|
195
|
+
const gapX = flexDefinition.gapX || flexDefinition?.gapX?.toString() === "0" ?
|
|
196
|
+
(0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.gapX), spacingBlueprint) :
|
|
197
|
+
(0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.gapY), spacingBlueprint);
|
|
198
|
+
const gapY = flexDefinition.gapY || flexDefinition?.gapY?.toString() === "0" ?
|
|
199
|
+
(0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.gapY), spacingBlueprint) :
|
|
200
|
+
gapX;
|
|
193
201
|
const width = VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.width);
|
|
194
202
|
const minWidth = VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.minWidth);
|
|
195
203
|
const height = VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.height);
|
|
196
204
|
const minHeight = VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.minHeight);
|
|
197
205
|
if (flexDefinition.position) {
|
|
206
|
+
const spacing = renderCtx.theming.get.spacing();
|
|
198
207
|
this.applySpacingStyles(flexDefinition.position, renderCtx, styleBase, spacing, "", (pos) => styleBase["position"] = pos.type, {
|
|
199
208
|
"position": "type"
|
|
200
209
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColorSchemaType, ColorSchemaTypes, ColorType, ColorTypes, ContainerBlueprint, ContainerVariant, ThemeDefinitionV2, TypographySize, TypographySizes, TypographyType, TypographyTypes
|
|
1
|
+
import { ColorSchemaType, ColorSchemaTypes, ColorType, ColorTypes, ContainerBlueprint, ContainerVariant, ThemeDefinitionV2, TypographySize, TypographySizes, TypographyType, TypographyTypes } from "..";
|
|
2
2
|
export declare const useVelcronThemingStore: (newStateWithName?: string) => {
|
|
3
3
|
state: {
|
|
4
4
|
currentTheme: ThemeDefinitionV2;
|
|
@@ -7,7 +7,7 @@ export declare const useVelcronThemingStore: (newStateWithName?: string) => {
|
|
|
7
7
|
componentBlueprints: () => void;
|
|
8
8
|
containerBlueprint: (type: ContainerVariant | ContainerBlueprint | string) => any;
|
|
9
9
|
colorSchema: (colorSchemaType: ColorSchemaTypes | ColorSchemaType) => import("..").ColorSchema;
|
|
10
|
-
spacing: (
|
|
10
|
+
spacing: () => import("..").SpacingBlueprint;
|
|
11
11
|
typography: (typographyType: TypographyTypes | TypographyType, size: TypographySizes | TypographySize) => any;
|
|
12
12
|
color: (colorSchemaType: ColorSchemaTypes | ColorSchemaType, colorType: ColorTypes | ColorType) => string;
|
|
13
13
|
colorDefinition: (colorSchemaType: ColorSchemaTypes | ColorSchemaType, colorType: ColorTypes | ColorType) => import("..").ColorDefinition;
|
package/stores/VelcronTheming.js
CHANGED
|
@@ -22,10 +22,8 @@ exports.useVelcronThemingStore = (0, _1.defineVelcronStore)("VelcronTheming", {
|
|
|
22
22
|
colorSchema: (colorSchemaType) => {
|
|
23
23
|
return (0, __1.useThemeMethods)(() => state.currentTheme).colorSchema(colorSchemaType);
|
|
24
24
|
},
|
|
25
|
-
spacing: (
|
|
26
|
-
return
|
|
27
|
-
state.currentTheme.spacing.primary.layout :
|
|
28
|
-
state.currentTheme.spacing.primary.inner;
|
|
25
|
+
spacing: () => {
|
|
26
|
+
return state.currentTheme.spacing.primary;
|
|
29
27
|
},
|
|
30
28
|
typography: (typographyType, size) => {
|
|
31
29
|
const typography = state.currentTheme.typography.primary;
|