@omnia/velcron 8.0.98-vnext → 8.0.100-vnext

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/actions/Date.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { IActionHandler } from "./IActionHandler";
2
2
  export declare const dateFormat: IActionHandler;
3
- export declare const dateCountDown: IActionHandler;
3
+ export declare const diff: IActionHandler;
package/actions/Date.js CHANGED
@@ -1,17 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dateCountDown = exports.dateFormat = void 0;
3
+ exports.diff = exports.dateFormat = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
6
- const duration_1 = tslib_1.__importDefault(require("dayjs/plugin/duration"));
7
- dayjs_1.default.extend(duration_1.default);
8
6
  exports.dateFormat = {
9
7
  name: "@date.format",
10
8
  action: (action, value) => {
11
9
  return Promise.resolve((0, dayjs_1.default)().format(value));
12
10
  }
13
11
  };
14
- exports.dateCountDown = {
12
+ exports.diff = {
15
13
  name: "@date.diff",
16
14
  action: (action, date, past = false) => {
17
15
  const now = (0, dayjs_1.default)();
@@ -1,4 +1,4 @@
1
- import { VelcronImageRatios } from "@omnia/fx-models";
1
+ import { TypographySize, TypographyType, VelcronImageRatios } from "@omnia/fx-models";
2
2
  export interface ResolvedPropertyEditor {
3
3
  editor: VelcronPropertyEditor;
4
4
  }
@@ -78,16 +78,43 @@ export interface VelcronMarkdownPropertyEditor extends VelcronPropertyEditor<any
78
78
  export interface VelcronImagePropertyEditor extends VelcronPropertyEditor<any> {
79
79
  type: "image";
80
80
  }
81
+ export interface VelcronState {
82
+ images?: VelcronImagesState;
83
+ styling?: VelcronStylingState;
84
+ colorSchema?: VelcronColorSchemaState;
85
+ content?: VelcronContentState;
86
+ properties?: VelcronPropertiesState;
87
+ }
88
+ export interface VelcronTextState {
89
+ text: string;
90
+ typography?: VelcronTypographyState;
91
+ }
92
+ export interface VelcronTypographyState {
93
+ type?: TypographyType;
94
+ size?: TypographySize;
95
+ toned?: boolean;
96
+ }
81
97
  export interface VelcronContentState {
82
- content: {
83
- caption?: string;
84
- main?: string;
85
- };
98
+ caption?: VelcronTextState;
99
+ main?: VelcronTextState;
100
+ title?: VelcronTextState;
101
+ summary?: VelcronTextState;
86
102
  }
87
103
  export interface VelcronPropertiesState {
88
- propertyItems: Array<any>;
104
+ user: any;
105
+ mappings: Array<any>;
106
+ }
107
+ export interface VelcronImagesState {
108
+ main?: VelcronImageState;
89
109
  }
90
110
  export interface VelcronImageState {
91
111
  url?: string;
92
112
  ratio?: VelcronImageRatios;
113
+ caption?: VelcronTextState;
114
+ }
115
+ export interface VelcronStylingState {
116
+ }
117
+ export interface VelcronColorSchemaState {
118
+ type?: string;
119
+ filled?: boolean;
93
120
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/velcron",
3
3
  "license": "MIT",
4
- "version": "8.0.98-vnext",
4
+ "version": "8.0.100-vnext",
5
5
  "description": "Provide Omnia Velcron Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,11 +1,16 @@
1
- import { ColorSchemaType } from "@omnia/fx-models";
1
+ import { ColorSchemaType, VelcronState } from "@omnia/fx-models";
2
2
  import { VelcronStateBuilderBase } from "./VelcronStateBuilderBase";
3
3
  export declare class VelcronColorSchemaStateBuilder extends VelcronStateBuilderBase {
4
4
  private colorSchema;
5
+ private filledValue;
5
6
  constructor(stateBuilder: any);
6
- add(colorSchema?: ColorSchemaType): VelcronColorSchemaStateBuilder;
7
- bind: string;
8
- protected internalBuild(): {
9
- colorSchemaType: "info" | "error" | "primary" | "secondary" | "accent1" | "accent2" | "accent3" | "neutral" | "background";
7
+ type: {
8
+ add(colorSchema?: ColorSchemaType): VelcronColorSchemaStateBuilder;
9
+ bind: string;
10
10
  };
11
+ filled: {
12
+ add(filled: boolean): VelcronColorSchemaStateBuilder;
13
+ bind: any;
14
+ };
15
+ protected internalBuild(): VelcronState;
11
16
  }
@@ -5,15 +5,27 @@ const VelcronStateBuilderBase_1 = require("./VelcronStateBuilderBase");
5
5
  class VelcronColorSchemaStateBuilder extends VelcronStateBuilderBase_1.VelcronStateBuilderBase {
6
6
  constructor(stateBuilder) {
7
7
  super(stateBuilder);
8
- this.bind = "{{colorSchemaType}}";
9
- }
10
- add(colorSchema) {
11
- this.colorSchema = colorSchema;
12
- return this;
8
+ this.type = {
9
+ add(colorSchema) {
10
+ this.colorSchema = colorSchema;
11
+ return this;
12
+ },
13
+ bind: "{{colorSchemaType.type}}"
14
+ };
15
+ this.filled = {
16
+ add(filled) {
17
+ this.filledValue = filled;
18
+ return this;
19
+ },
20
+ bind: "{{colorSchemaType.filled}}"
21
+ };
13
22
  }
14
23
  internalBuild() {
15
24
  return {
16
- colorSchemaType: this.colorSchema
25
+ colorSchema: {
26
+ type: this.colorSchema,
27
+ filled: this.filledValue
28
+ }
17
29
  };
18
30
  }
19
31
  }
@@ -1,17 +1,11 @@
1
+ import { VelcronState } from "@omnia/fx-models";
1
2
  import { VelcronStateBuilderBase } from "./VelcronStateBuilderBase";
3
+ import { VelcronTextContentBuilder } from "./VelcronTextContentBuilder";
2
4
  export declare class VelcronContentStateBuilder extends VelcronStateBuilderBase {
3
- private mainContent;
4
- private captionContent;
5
+ main: VelcronTextContentBuilder<VelcronContentStateBuilder>;
6
+ caption: VelcronTextContentBuilder<VelcronContentStateBuilder>;
7
+ title: VelcronTextContentBuilder<VelcronContentStateBuilder>;
8
+ summary: VelcronTextContentBuilder<VelcronContentStateBuilder>;
5
9
  constructor(stateBuilder: any);
6
- main: {
7
- add: (value?: string) => VelcronContentStateBuilder;
8
- bind: string;
9
- };
10
- caption: {
11
- add: (value?: string) => VelcronContentStateBuilder;
12
- bind: string;
13
- };
14
- protected internalBuild(): {
15
- content: {};
16
- };
10
+ protected internalBuild(): VelcronState;
17
11
  }
@@ -2,35 +2,53 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VelcronContentStateBuilder = void 0;
4
4
  const VelcronStateBuilderBase_1 = require("./VelcronStateBuilderBase");
5
+ const VelcronTextContentBuilder_1 = require("./VelcronTextContentBuilder");
6
+ // title?: VelcronTextState;
7
+ // summary?: VelcronTextState;
5
8
  class VelcronContentStateBuilder extends VelcronStateBuilderBase_1.VelcronStateBuilderBase {
6
9
  constructor(stateBuilder) {
7
10
  super(stateBuilder);
8
- this.main = {
9
- add: (value) => {
10
- this.mainContent = value;
11
- return this;
12
- },
13
- bind: "$state.content.main"
14
- };
15
- this.caption = {
16
- add: (value) => {
17
- this.captionContent = value;
18
- return this;
19
- },
20
- bind: "{{content.caption}}"
21
- };
11
+ this.main = new VelcronTextContentBuilder_1.VelcronTextContentBuilder(this, "content.main");
12
+ this.caption = new VelcronTextContentBuilder_1.VelcronTextContentBuilder(this, "content.caption");
13
+ this.title = new VelcronTextContentBuilder_1.VelcronTextContentBuilder(this, "content.title");
14
+ this.summary = new VelcronTextContentBuilder_1.VelcronTextContentBuilder(this, "content.summary");
22
15
  }
23
16
  internalBuild() {
24
17
  const resultValue = {};
25
18
  let hasContent = false;
26
- if (this.mainContent) {
27
- resultValue["main"] = this.mainContent;
19
+ const mainContent = this.main.internalBuild();
20
+ const captionContent = this.caption.internalBuild();
21
+ const titleContent = this.title.internalBuild();
22
+ const summaryContent = this.summary.internalBuild();
23
+ if (mainContent) {
24
+ hasContent = true;
25
+ resultValue.main = mainContent;
26
+ }
27
+ if (captionContent) {
28
28
  hasContent = true;
29
+ resultValue.caption = captionContent;
29
30
  }
30
- if (this.captionContent) {
31
- resultValue["caption"] = this.captionContent;
31
+ if (titleContent) {
32
32
  hasContent = true;
33
+ resultValue.title = titleContent;
34
+ }
35
+ if (summaryContent) {
36
+ hasContent = true;
37
+ resultValue.summary = summaryContent;
38
+ }
39
+ if (!hasContent) {
40
+ return null;
33
41
  }
42
+ // resultValue["main"] = this.mainContent;
43
+ // hasContent = true;
44
+ // }
45
+ // if(this.captionContent){
46
+ // resultValue["caption"] = this.captionContent;
47
+ // hasContent = true;
48
+ // }
49
+ // if(!hasContent){
50
+ // return null;
51
+ // }
34
52
  return {
35
53
  content: resultValue
36
54
  };
@@ -1,4 +1,4 @@
1
- import { VelcronImageRatios } from "../../models";
1
+ import { VelcronImageRatios, VelcronState } from "@omnia/fx-models";
2
2
  import { VelcronStateBuilderBase } from "./VelcronStateBuilderBase";
3
3
  export declare class VelcronImageStateBuilder extends VelcronStateBuilderBase {
4
4
  private mainImageUrl;
@@ -14,7 +14,5 @@ export declare class VelcronImageStateBuilder extends VelcronStateBuilderBase {
14
14
  bind: string;
15
15
  };
16
16
  };
17
- protected internalBuild(): {
18
- "main-image": {};
19
- };
17
+ protected internalBuild(): VelcronState;
20
18
  }
@@ -11,14 +11,14 @@ class VelcronImageStateBuilder extends VelcronStateBuilderBase_1.VelcronStateBui
11
11
  this.mainImageUrl = url;
12
12
  return this;
13
13
  },
14
- bind: "{{main-image.url}}"
14
+ bind: "{{images.main.url}}"
15
15
  },
16
16
  ratio: {
17
17
  add: (ratio) => {
18
18
  this.mainImageRatio = ratio;
19
19
  return this;
20
20
  },
21
- bind: "{{main-image.ratio}}"
21
+ bind: "{{images.main.ratio}}"
22
22
  }
23
23
  };
24
24
  }
@@ -26,16 +26,22 @@ class VelcronImageStateBuilder extends VelcronStateBuilderBase_1.VelcronStateBui
26
26
  if (!this.mainImageUrl) {
27
27
  return null;
28
28
  }
29
+ let hasContent = false;
29
30
  const resultValue = {};
30
31
  if (this.mainImageRatio) {
31
32
  resultValue["ratio"] = this.mainImageRatio;
33
+ hasContent = true;
32
34
  }
33
35
  if (this.mainImageUrl) {
34
36
  resultValue["url"] = this.mainImageUrl;
37
+ hasContent = true;
38
+ }
39
+ if (!hasContent) {
40
+ return null;
35
41
  }
36
42
  return {
37
- "main-image": {
38
- ...resultValue
43
+ images: {
44
+ main: resultValue
39
45
  }
40
46
  };
41
47
  }
@@ -1,11 +1,12 @@
1
+ import { VelcronState } from "@omnia/fx-models";
1
2
  import { VelcronStateBuilderBase } from "./VelcronStateBuilderBase";
2
3
  export declare class VelcronPropertyMappingStateBuilder extends VelcronStateBuilderBase {
3
4
  private propertyItemsValue;
4
5
  constructor(stateBuilder: any);
5
- propertyItems: {
6
+ items: {
6
7
  add: (items?: any[]) => VelcronPropertyMappingStateBuilder;
7
8
  bind: string;
8
9
  foreach: string;
9
10
  };
10
- protected internalBuild(): {};
11
+ protected internalBuild(): VelcronState;
11
12
  }
@@ -6,7 +6,7 @@ class VelcronPropertyMappingStateBuilder extends VelcronStateBuilderBase_1.Velcr
6
6
  constructor(stateBuilder) {
7
7
  super(stateBuilder);
8
8
  this.propertyItemsValue = [];
9
- this.propertyItems = {
9
+ this.items = {
10
10
  add: (items) => {
11
11
  this.propertyItemsValue = items;
12
12
  return this;
@@ -19,10 +19,17 @@ class VelcronPropertyMappingStateBuilder extends VelcronStateBuilderBase_1.Velcr
19
19
  const resultValue = {};
20
20
  let hasContent = false;
21
21
  if (this.propertyItemsValue) {
22
- resultValue.propertyItems = this.propertyItemsValue;
22
+ resultValue["mappings"] = this.propertyItemsValue;
23
23
  hasContent = true;
24
24
  }
25
- return resultValue;
25
+ if (!hasContent) {
26
+ return null;
27
+ }
28
+ return {
29
+ properties: {
30
+ mappings: resultValue
31
+ }
32
+ };
26
33
  }
27
34
  }
28
35
  exports.VelcronPropertyMappingStateBuilder = VelcronPropertyMappingStateBuilder;
@@ -1,3 +1,4 @@
1
+ import { VelcronState } from "@omnia/fx-models";
1
2
  import { VelcronColorSchemaStateBuilder } from "./VelcronColorSchemaBuilder";
2
3
  import { VelcronContentStateBuilder } from "./VelcronContentStateBuilder";
3
4
  import { VelcronImageStateBuilder } from "./VelcronImageStateBuilder";
@@ -11,5 +12,5 @@ export declare class VelcronStateBuilder {
11
12
  image(): VelcronImageStateBuilder;
12
13
  colorSchemaType(): VelcronColorSchemaStateBuilder;
13
14
  properties(): VelcronPropertyMappingStateBuilder;
14
- build(): any;
15
+ build(): VelcronState;
15
16
  }
@@ -1,8 +1,12 @@
1
1
  import { VelcronStateBuilder } from "./VelcronStateBuilder";
2
- export declare abstract class VelcronStateBuilderBase {
2
+ export declare abstract class VelcronStateBuilderStrategy {
3
+ abstract done(): any;
4
+ protected abstract internalBuild(): any;
5
+ }
6
+ export declare abstract class VelcronStateBuilderBase extends VelcronStateBuilderStrategy {
3
7
  protected stateBuilder: VelcronStateBuilder;
4
- constructor(stateBulder: VelcronStateBuilder);
8
+ constructor(stateBuilder: VelcronStateBuilder);
5
9
  done(): VelcronStateBuilder;
6
- build(): any;
10
+ build(): import("@omnia/fx-models").VelcronState;
7
11
  protected abstract internalBuild(): any;
8
12
  }
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VelcronStateBuilderBase = void 0;
4
- class VelcronStateBuilderBase {
5
- constructor(stateBulder) {
6
- this.stateBuilder = stateBulder;
3
+ exports.VelcronStateBuilderBase = exports.VelcronStateBuilderStrategy = void 0;
4
+ class VelcronStateBuilderStrategy {
5
+ }
6
+ exports.VelcronStateBuilderStrategy = VelcronStateBuilderStrategy;
7
+ class VelcronStateBuilderBase extends VelcronStateBuilderStrategy {
8
+ constructor(stateBuilder) {
9
+ super();
10
+ this.stateBuilder = stateBuilder;
7
11
  }
8
12
  done() {
9
13
  return this.stateBuilder;
@@ -0,0 +1,31 @@
1
+ import { TypographySize, TypographyType, VelcronTextState, VelcronTypographyState } from "@omnia/fx-models";
2
+ import { VelcronStateBuilderStrategy } from "./VelcronStateBuilderBase";
3
+ export declare class VelcronTextContentBuilder<TBaseBuilder> extends VelcronStateBuilderStrategy {
4
+ private _textState;
5
+ private baseBind;
6
+ private _typographyState;
7
+ private baseBuilder;
8
+ constructor(baseBuilder: TBaseBuilder, bind: string);
9
+ get typographyState(): VelcronTypographyState;
10
+ get textState(): VelcronTextState;
11
+ text: {
12
+ add: (value: string) => VelcronTextContentBuilder<TBaseBuilder>;
13
+ bind: string;
14
+ };
15
+ typography: {
16
+ type: {
17
+ add: (type: TypographyType) => VelcronTextContentBuilder<TBaseBuilder>;
18
+ bind: string;
19
+ };
20
+ size: {
21
+ add: (size: TypographySize) => VelcronTextContentBuilder<TBaseBuilder>;
22
+ bind: string;
23
+ };
24
+ toned: {
25
+ add: (toned: boolean) => VelcronTextContentBuilder<TBaseBuilder>;
26
+ bind: string;
27
+ };
28
+ };
29
+ done(): TBaseBuilder;
30
+ protected internalBuild(): VelcronTextState;
31
+ }
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VelcronTextContentBuilder = void 0;
4
+ const VelcronStateBuilderBase_1 = require("./VelcronStateBuilderBase");
5
+ // export interface VelcronTextState {
6
+ // text:string,
7
+ // typography?:{
8
+ // type?: TypographyType,
9
+ // size?:TypographySize
10
+ // toned?:boolean;
11
+ // }
12
+ // }
13
+ class VelcronTextContentBuilder extends VelcronStateBuilderBase_1.VelcronStateBuilderStrategy {
14
+ constructor(baseBuilder, bind) {
15
+ super();
16
+ this._textState = undefined;
17
+ this.baseBind = undefined;
18
+ this._typographyState = undefined;
19
+ // :VelcronTextContentBuilder<TBaseBuilder>
20
+ this.text = {
21
+ add: (value) => {
22
+ this.textState.text = value;
23
+ return this;
24
+ },
25
+ bind: `{{ ${this.baseBind}.text }}`
26
+ };
27
+ this.typography = {
28
+ type: {
29
+ add: (type) => {
30
+ this.typographyState.type = type;
31
+ return this;
32
+ },
33
+ bind: `{{ ${this.baseBind}.typography.type }}`
34
+ },
35
+ size: {
36
+ add: (size) => {
37
+ this.typographyState.size = size;
38
+ return this;
39
+ },
40
+ bind: `{{ ${this.baseBind}.typography.size }}`
41
+ },
42
+ toned: {
43
+ add: (toned) => {
44
+ this.typographyState.toned = toned;
45
+ return this;
46
+ },
47
+ bind: `{{ ${this.baseBind}.typography.toned }}`
48
+ }
49
+ };
50
+ this.baseBuilder = baseBuilder;
51
+ this.baseBind = bind;
52
+ }
53
+ get typographyState() {
54
+ if (!this._typographyState) {
55
+ this._typographyState = {};
56
+ }
57
+ return this._typographyState;
58
+ }
59
+ get textState() {
60
+ if (!this._textState) {
61
+ this._textState = {};
62
+ }
63
+ return this._textState;
64
+ }
65
+ // typography(type?: TypographyType,size?:TypographySize,toned?:boolean):VelcronTextContentBuilder<TBaseBuilder>{
66
+ // this.textState.typography = {
67
+ // type:type,
68
+ // size:size,
69
+ // toned:toned
70
+ // };
71
+ // return this;
72
+ // }
73
+ done() {
74
+ return this.baseBuilder;
75
+ }
76
+ internalBuild() {
77
+ const resultValue = {};
78
+ let hasContent = false;
79
+ // if(this.mainContent){
80
+ // resultValue["main"] = this.mainContent;
81
+ // hasContent = true;
82
+ // }
83
+ // if(this.captionContent){
84
+ // resultValue["caption"] = this.captionContent;
85
+ // hasContent = true;
86
+ // }
87
+ // if(!hasContent){
88
+ // return null;
89
+ // }
90
+ // return <VelcronState>{
91
+ // content: resultValue as VelcronContentState
92
+ // };
93
+ if (this._textState) {
94
+ hasContent = true;
95
+ resultValue.text = this._textState.text;
96
+ }
97
+ if (this._typographyState) {
98
+ hasContent = true;
99
+ resultValue.typography = this._typographyState;
100
+ }
101
+ if (!hasContent) {
102
+ return null;
103
+ }
104
+ return resultValue;
105
+ }
106
+ }
107
+ exports.VelcronTextContentBuilder = VelcronTextContentBuilder;