@omnia/fx-models 8.0.285-dev → 8.0.287-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/Layout.d.ts CHANGED
@@ -144,10 +144,11 @@ export interface SectionSettings extends LayoutItemSettings {
144
144
  spacingBlock: SpacingValue;
145
145
  spacingColumn: SpacingValue;
146
146
  minWidthBlock: string;
147
- marginSectionLeft: SpacingValue;
148
- marginSectionRight: SpacingValue;
149
- marginSectionTop: SpacingValue;
150
- marginSectionBottom: SpacingValue;
147
+ margin?: Spacing;
148
+ marginSectionLeft?: SpacingValue;
149
+ marginSectionRight?: SpacingValue;
150
+ marginSectionTop?: SpacingValue;
151
+ marginSectionBottom?: SpacingValue;
151
152
  targetingFilterProperties: TargetingFilterProperty;
152
153
  anchorName?: string;
153
154
  titleSettings?: BlockTitleSettings;
@@ -264,10 +265,11 @@ export interface HeaderItemSettings {
264
265
  titleRenderer?: TitleRendererValue;
265
266
  }
266
267
  export interface SpacingItemSettings {
267
- paddingRight: number | SpacingValue;
268
- paddingLeft: number | SpacingValue;
269
- paddingTop: number | SpacingValue;
270
- paddingBottom: number | SpacingValue;
268
+ padding: Spacing;
269
+ paddingRight?: number | SpacingValue;
270
+ paddingLeft?: number | SpacingValue;
271
+ paddingTop?: number | SpacingValue;
272
+ paddingBottom?: number | SpacingValue;
271
273
  minHeight: string;
272
274
  }
273
275
  export interface StyleItemSettings {
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generates a short ID.
3
+ *
4
+ * @returns {string} The generated short ID.
5
+ */
6
+ export declare function shortId(): string;
@@ -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
+ }
@@ -20,3 +20,4 @@ export * from "./velcron";
20
20
  export * from "./DependencyInjection";
21
21
  export * from "./Messaging";
22
22
  export * from "./EventHook";
23
+ export * from "./ShortId";
@@ -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
- layout: SpacingDefinition;
60
- inner: SpacingDefinition;
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 { SpacingDefinition } from "./Spacing";
2
- export declare function getSpacingValueFromBlueprint(spacingValue: any, definition: SpacingDefinition): number;
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
- function getSpacingValueFromBlueprint(spacingValue, definition) {
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
- if (spacingValue.startsWith("-")) {
31
+ let strippedValue = getValueWithoutScale(spacingValue);
32
+ if (strippedValue.startsWith("-")) {
14
33
  negative = true;
15
34
  }
16
- spacingValue = spacingValue.replace("-", "");
17
- if (spacingValue === Spacing_1.SpacingTypes.xs) {
35
+ strippedValue = strippedValue.replace("-", "");
36
+ if (strippedValue === Spacing_1.SpacingTypes.xs) {
18
37
  result = definition.xs;
19
38
  }
20
- else if (spacingValue === Spacing_1.SpacingTypes.s) {
39
+ else if (strippedValue === Spacing_1.SpacingTypes.s) {
21
40
  result = definition.s;
22
41
  }
23
- else if (spacingValue === Spacing_1.SpacingTypes.m) {
42
+ else if (strippedValue === Spacing_1.SpacingTypes.m) {
24
43
  result = definition.m;
25
44
  }
26
- else if (spacingValue === Spacing_1.SpacingTypes.l) {
45
+ else if (strippedValue === Spacing_1.SpacingTypes.l) {
27
46
  result = definition.l;
28
47
  }
29
- else if (spacingValue === Spacing_1.SpacingTypes.xl) {
48
+ else if (strippedValue === Spacing_1.SpacingTypes.xl) {
30
49
  result = definition.xl;
31
50
  }
32
51
  else {
@@ -1,10 +1,11 @@
1
- export interface Spacing {
2
- scale?: "l" | "s";
1
+ export type Spacing = {
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;
@@ -13,7 +14,7 @@ export interface SpacingDefinition {
13
14
  l: number;
14
15
  xl: number;
15
16
  }
16
- export type SpacingValue = "xs" | "s" | "m" | "l" | "xl" | number;
17
+ export type SpacingValue = "xs" | "s" | "m" | "l" | "xl" | "l:xs" | "l:s" | "l:m" | "l:l" | "l:xl" | "s:xs" | "s:s" | "s:m" | "s:l" | "s:xl" | number;
17
18
  export declare enum SpacingTypes {
18
19
  xs = "xs",
19
20
  s = "s",
@@ -5,3 +5,4 @@ export * from "./Spacing";
5
5
  export * from "./SharedBlueprintMethods";
6
6
  export * from "./SharedColorMethods";
7
7
  export * from "./Blueprints";
8
+ export * from "./useSpacingScaling";
@@ -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;
@@ -26,6 +26,5 @@ export declare enum VelcronDataTypes {
26
26
  number = "number",
27
27
  boolean = "boolean",
28
28
  array = "array",
29
- componentArray = "componentArray",
30
- bind = "bind"
29
+ componentArray = "componentArray"
31
30
  }
@@ -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/fx-models/internal-do-not-import-from-here/shared/models";
2
- import { VelcroncomponentArrayType, VelcronPrimitiveType } from "./VelcronTypes";
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 | VelcroncomponentArrayType;
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>;
@@ -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 VelcroncomponentArrayType = Array<VelcronDefinition>;
5
+ export type VelcronComponentArrayType = Array<VelcronDefinition>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/fx-models",
3
3
  "license": "MIT",
4
- "version": "8.0.285-dev",
4
+ "version": "8.0.287-dev",
5
5
  "description": "Provide Omnia Fx Models Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"