@omnia/velcron 8.0.81-vnext → 8.0.82-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.
Files changed (166) hide show
  1. package/actions/Alert.js +1 -1
  2. package/actions/Array.js +9 -2
  3. package/actions/Clone.d.ts +2 -0
  4. package/actions/Clone.js +11 -0
  5. package/actions/Date.d.ts +3 -0
  6. package/actions/Date.js +29 -0
  7. package/actions/Http.js +23 -6
  8. package/actions/IActionHandler.d.ts +1 -0
  9. package/actions/Timer.d.ts +4 -0
  10. package/actions/Timer.js +80 -0
  11. package/actions/index.d.ts +3 -0
  12. package/actions/index.js +3 -0
  13. package/index.d.ts +1 -0
  14. package/index.js +1 -0
  15. package/internal-do-not-import-from-here/shared/models/Broadcasting.js +1 -1
  16. package/internal-do-not-import-from-here/shared/models/DynamicState.d.ts +1 -0
  17. package/internal-do-not-import-from-here/shared/models/Equals.js +33 -3
  18. package/internal-do-not-import-from-here/shared/models/Future.d.ts +17 -1
  19. package/internal-do-not-import-from-here/shared/models/Future.js +26 -5
  20. package/internal-do-not-import-from-here/shared/models/Guid.d.ts +1 -0
  21. package/internal-do-not-import-from-here/shared/models/Guid.js +13 -6
  22. package/internal-do-not-import-from-here/shared/models/HttpCommon.d.ts +27 -0
  23. package/internal-do-not-import-from-here/shared/models/OmniaSharedBootstrapData.d.ts +7 -1
  24. package/internal-do-not-import-from-here/shared/models/Realtime.d.ts +1 -13
  25. package/internal-do-not-import-from-here/shared/models/Realtime.js +1 -22
  26. package/internal-do-not-import-from-here/shared/models/StronglyTypedId.d.ts +3 -0
  27. package/internal-do-not-import-from-here/shared/models/StronglyTypedId.js +2 -0
  28. package/internal-do-not-import-from-here/shared/models/Tokens.d.ts +1 -0
  29. package/internal-do-not-import-from-here/shared/models/WorkerProxyFuncs.d.ts +7 -1
  30. package/internal-do-not-import-from-here/shared/models/WorkerProxyFuncs.js +5 -1
  31. package/internal-do-not-import-from-here/shared/models/Workers.js +1 -1
  32. package/internal-do-not-import-from-here/shared/models/hub/ExternalIdentityId.d.ts +2 -0
  33. package/internal-do-not-import-from-here/shared/models/hub/ExternalIdentityId.js +2 -0
  34. package/internal-do-not-import-from-here/shared/models/hub/TempSocialReactions.d.ts +13 -0
  35. package/internal-do-not-import-from-here/shared/models/hub/TempSocialReactions.js +20 -0
  36. package/internal-do-not-import-from-here/shared/models/hub/activities/Activity.d.ts +67 -0
  37. package/internal-do-not-import-from-here/shared/models/hub/activities/Activity.js +7 -0
  38. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityChannel.d.ts +7 -0
  39. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityChannel.js +5 -0
  40. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityDefinition.d.ts +14 -0
  41. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityDefinition.js +15 -0
  42. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityFeed.d.ts +30 -0
  43. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityFeed.js +2 -0
  44. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRenderer.d.ts +15 -0
  45. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRenderer.js +5 -0
  46. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRendererLoadingReferences.d.ts +8 -0
  47. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRendererLoadingReferences.js +2 -0
  48. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivitySender.d.ts +15 -0
  49. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivitySender.js +5 -0
  50. package/internal-do-not-import-from-here/shared/models/hub/activities/IdentityActivity.d.ts +40 -0
  51. package/internal-do-not-import-from-here/shared/models/hub/activities/IdentityActivity.js +39 -0
  52. package/internal-do-not-import-from-here/shared/models/hub/activities/index.d.ts +8 -0
  53. package/internal-do-not-import-from-here/shared/models/hub/activities/index.js +11 -0
  54. package/internal-do-not-import-from-here/shared/models/hub/fileupload/FileOwnerId.d.ts +3 -0
  55. package/internal-do-not-import-from-here/shared/models/hub/fileupload/FileOwnerId.js +5 -0
  56. package/internal-do-not-import-from-here/shared/models/hub/fileupload/TemporaryFileId.d.ts +4 -0
  57. package/internal-do-not-import-from-here/shared/models/hub/fileupload/TemporaryFileId.js +5 -0
  58. package/internal-do-not-import-from-here/shared/models/hub/fileupload/index.d.ts +2 -0
  59. package/internal-do-not-import-from-here/shared/models/hub/fileupload/index.js +5 -0
  60. package/internal-do-not-import-from-here/shared/models/hub/index.d.ts +5 -0
  61. package/internal-do-not-import-from-here/shared/models/hub/index.js +8 -0
  62. package/internal-do-not-import-from-here/shared/models/hub/social/HubComment.d.ts +10 -0
  63. package/internal-do-not-import-from-here/shared/models/hub/social/HubComment.js +2 -0
  64. package/internal-do-not-import-from-here/shared/models/hub/social/HubReaction.d.ts +5 -0
  65. package/internal-do-not-import-from-here/shared/models/hub/social/HubReaction.js +2 -0
  66. package/internal-do-not-import-from-here/shared/models/hub/social/index.d.ts +2 -0
  67. package/internal-do-not-import-from-here/shared/models/hub/social/index.js +5 -0
  68. package/internal-do-not-import-from-here/shared/models/index.d.ts +5 -1
  69. package/internal-do-not-import-from-here/shared/models/index.js +5 -1
  70. package/internal-do-not-import-from-here/shared/models/theming/BlueprintDefinition.d.ts +44 -46
  71. package/internal-do-not-import-from-here/shared/models/theming/BlueprintDefinition.js +7 -13
  72. package/internal-do-not-import-from-here/shared/models/theming/ChromeDefinition.d.ts +31 -0
  73. package/internal-do-not-import-from-here/shared/models/theming/ChromeDefinition.js +2 -0
  74. package/internal-do-not-import-from-here/shared/models/theming/SharedBlueprintMethods.d.ts +2 -2
  75. package/internal-do-not-import-from-here/shared/models/theming/SharedBlueprintMethods.js +8 -7
  76. package/internal-do-not-import-from-here/shared/models/theming/SpacingSetting.d.ts +5 -4
  77. package/internal-do-not-import-from-here/shared/models/theming/SpacingSetting.js +1 -1
  78. package/internal-do-not-import-from-here/shared/models/theming/ThemeDefinitionV2.d.ts +4 -11
  79. package/internal-do-not-import-from-here/shared/models/theming/ThemeDefinitionV2.js +3 -10
  80. package/internal-do-not-import-from-here/shared/models/theming/TypographyDefinition.d.ts +8 -4
  81. package/internal-do-not-import-from-here/shared/models/theming/TypographyDefinition.js +2 -3
  82. package/internal-do-not-import-from-here/shared/models/theming/UseThemeMethods.d.ts +3 -5
  83. package/internal-do-not-import-from-here/shared/models/theming/UseThemeMethods.js +4 -33
  84. package/internal-do-not-import-from-here/shared/models/theming/index.d.ts +1 -0
  85. package/internal-do-not-import-from-here/shared/models/theming/index.js +1 -0
  86. package/internal-do-not-import-from-here/shared/models/velcron/VelcronDefinition.d.ts +87 -0
  87. package/internal-do-not-import-from-here/shared/models/velcron/VelcronDefinition.js +2 -0
  88. package/internal-do-not-import-from-here/shared/models/velcron/VelcronEvents.js +2 -0
  89. package/internal-do-not-import-from-here/shared/models/velcron/index.d.ts +2 -0
  90. package/internal-do-not-import-from-here/shared/models/velcron/index.js +5 -0
  91. package/models/ActionHooks.d.ts +12 -0
  92. package/models/ActionHooks.js +2 -0
  93. package/models/Enums.d.ts +6 -0
  94. package/models/Enums.js +14 -7
  95. package/models/VelcronDefinitions.d.ts +101 -91
  96. package/models/VelcronDefinitions.js +2 -2
  97. package/models/VelcronPropertyEditorDefinitions.d.ts +293 -17
  98. package/models/VelcronPropertyEditorDefinitions.js +116 -2
  99. package/models/VelcronTypes.d.ts +1 -1
  100. package/models/ViewModelAndContext.d.ts +1 -1
  101. package/models/index.d.ts +1 -1
  102. package/models/index.js +1 -1
  103. package/package.json +1 -1
  104. package/parser/VelcronActions.d.ts +8 -2
  105. package/parser/VelcronActions.js +24 -4
  106. package/parser/VelcronConstants.d.ts +17 -5
  107. package/parser/VelcronConstants.js +19 -7
  108. package/parser/VelcronData.d.ts +4 -3
  109. package/parser/VelcronData.js +58 -54
  110. package/parser/VelcronPropertyEditors.d.ts +9 -0
  111. package/parser/VelcronPropertyEditors.js +40 -0
  112. package/parser/VelcronRenderers.d.ts +2 -1
  113. package/parser/VelcronRenderers.js +22 -22
  114. package/parser/VelcronStyles.d.ts +2 -1
  115. package/parser/VelcronStyles.js +181 -72
  116. package/parser/index.d.ts +1 -0
  117. package/parser/index.js +1 -0
  118. package/stores/ReactivitySystem.d.ts +2 -2
  119. package/stores/ReactivitySystem.js +1 -1
  120. package/stores/VelcronColorSchema.d.ts +10 -9
  121. package/stores/VelcronTheming.d.ts +4 -3
  122. package/stores/VelcronTheming.js +15 -3
  123. package/stores/index.d.ts +0 -1
  124. package/stores/index.js +1 -1
  125. package/templatebuilder/editor/VelcronColorSchemaEditor.d.ts +9 -0
  126. package/templatebuilder/editor/VelcronColorSchemaEditor.js +28 -0
  127. package/templatebuilder/editor/VelcronContentEditor.d.ts +38 -0
  128. package/templatebuilder/editor/VelcronContentEditor.js +206 -0
  129. package/templatebuilder/editor/VelcronEditorBuilder.d.ts +16 -0
  130. package/templatebuilder/editor/VelcronEditorBuilder.js +50 -0
  131. package/templatebuilder/editor/VelcronEditorBuilder2.d.ts +15 -0
  132. package/templatebuilder/editor/VelcronEditorBuilder2.js +106 -0
  133. package/templatebuilder/editor/VelcronEditorBuilderBase.d.ts +9 -0
  134. package/templatebuilder/editor/VelcronEditorBuilderBase.js +16 -0
  135. package/templatebuilder/editor/VelcronImageEditor.d.ts +11 -0
  136. package/templatebuilder/editor/VelcronImageEditor.js +30 -0
  137. package/templatebuilder/editor/VelcronPropertyMappingEditorBuilder.d.ts +9 -0
  138. package/templatebuilder/editor/VelcronPropertyMappingEditorBuilder.js +30 -0
  139. package/templatebuilder/index.d.ts +2 -0
  140. package/templatebuilder/index.js +5 -0
  141. package/templatebuilder/state/VelcronBlockHeaderStateBuilder.d.ts +0 -0
  142. package/templatebuilder/state/VelcronBlockHeaderStateBuilder.js +38 -0
  143. package/templatebuilder/state/VelcronColorSchemaBuilder.d.ts +16 -0
  144. package/templatebuilder/state/VelcronColorSchemaBuilder.js +32 -0
  145. package/templatebuilder/state/VelcronContentStateBuilder.d.ts +11 -0
  146. package/templatebuilder/state/VelcronContentStateBuilder.js +47 -0
  147. package/templatebuilder/state/VelcronImageStateBuilder.d.ts +18 -0
  148. package/templatebuilder/state/VelcronImageStateBuilder.js +49 -0
  149. package/templatebuilder/state/VelcronPropertyMappingStateBuilder.d.ts +12 -0
  150. package/templatebuilder/state/VelcronPropertyMappingStateBuilder.js +35 -0
  151. package/templatebuilder/state/VelcronStateBuilder.d.ts +16 -0
  152. package/templatebuilder/state/VelcronStateBuilder.js +42 -0
  153. package/templatebuilder/state/VelcronStateBuilderBase.d.ts +12 -0
  154. package/templatebuilder/state/VelcronStateBuilderBase.js +19 -0
  155. package/templatebuilder/state/VelcronTextContentBuilder.d.ts +32 -0
  156. package/templatebuilder/state/VelcronTextContentBuilder.js +110 -0
  157. package/templatebuilder/useVelcronEditorBuilder.d.ts +2 -0
  158. package/templatebuilder/useVelcronEditorBuilder.js +9 -0
  159. package/templatebuilder/useVelcronTemplateBuilder.d.ts +6 -0
  160. package/templatebuilder/useVelcronTemplateBuilder.js +13 -0
  161. package/internal-do-not-import-from-here/shared/models/Bring.d.ts +0 -23
  162. package/stores/VelcronBlueprint.d.ts +0 -39
  163. package/stores/VelcronBlueprint.js +0 -55
  164. /package/internal-do-not-import-from-here/shared/models/{Bring.js → DynamicState.js} +0 -0
  165. /package/{models/VelcronEvents.js → internal-do-not-import-from-here/shared/models/HttpCommon.js} +0 -0
  166. /package/{models → internal-do-not-import-from-here/shared/models/velcron}/VelcronEvents.d.ts +0 -0
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BuiltInPropertyEditorTypes = void 0;
3
+ exports.VelcronStateBinding = exports.VelcronSpacingStateBinding = exports.VelcronColorSchemasStateBinding = exports.VelcronContentStateBinding = exports.VelcronHeaderStateBinding = exports.VelcronImagesStateBinding = exports.BuiltInPropertyEditorTypes = void 0;
4
+ // export type BuiltInPropertyEditorType = "text" | "slider" | "switch" | "alignment" | "color" | "markdown" | "icon" | "image" | "typography" | "color-schema-type" | "spacing" ;
4
5
  var BuiltInPropertyEditorTypes;
5
6
  (function (BuiltInPropertyEditorTypes) {
6
7
  BuiltInPropertyEditorTypes["text"] = "text";
@@ -11,4 +12,117 @@ var BuiltInPropertyEditorTypes;
11
12
  BuiltInPropertyEditorTypes["markdown"] = "markdown";
12
13
  BuiltInPropertyEditorTypes["icon"] = "icon";
13
14
  BuiltInPropertyEditorTypes["image"] = "image";
14
- })(BuiltInPropertyEditorTypes = exports.BuiltInPropertyEditorTypes || (exports.BuiltInPropertyEditorTypes = {}));
15
+ BuiltInPropertyEditorTypes["typography"] = "typography";
16
+ BuiltInPropertyEditorTypes["spacing"] = "spacing";
17
+ BuiltInPropertyEditorTypes["color-schema-type"] = "color-schema-type";
18
+ })(BuiltInPropertyEditorTypes || (exports.BuiltInPropertyEditorTypes = BuiltInPropertyEditorTypes = {}));
19
+ exports.VelcronImagesStateBinding = {
20
+ main: {
21
+ editor: "{{images.main.url}}",
22
+ url: "{{images.main.url}}",
23
+ ratio: "{{images.main.ratio}}",
24
+ caption: "{{images.main.caption}}",
25
+ width: "{{images.main.width}}",
26
+ height: "{{images.main.height}}",
27
+ },
28
+ alt1: {
29
+ editor: "{{images.alt1.url}}",
30
+ url: "{{images.alt1.url}}",
31
+ ratio: "{{images.alt1.ratio}}",
32
+ caption: "{{images.alt1.caption}}",
33
+ width: "{{images.alt1.width}}",
34
+ height: "{{images.alt1.height}}",
35
+ },
36
+ alt2: {
37
+ editor: "{{images.alt2.url}}",
38
+ url: "{{images.alt2.url}}",
39
+ ratio: "{{images.alt2.ratio}}",
40
+ caption: "{{images.alt2.caption}}",
41
+ width: "{{images.alt2.width}}",
42
+ height: "{{images.alt2.height}}",
43
+ },
44
+ };
45
+ exports.VelcronHeaderStateBinding = {
46
+ title: {
47
+ text: "{{header.title.text}}",
48
+ placeholder: "{{header.title.placeholder}}",
49
+ typography: {
50
+ editor: "header.title.typography",
51
+ type: "{{header.title.typography.type}}",
52
+ size: "{{header.title.typography.size}}",
53
+ toned: "{{header.title.typography.toned}}",
54
+ }
55
+ },
56
+ icon: "{{header.icon}}"
57
+ };
58
+ exports.VelcronContentStateBinding = {
59
+ title: {
60
+ text: "{{content.title.text}}",
61
+ placeholder: "{{content.title.placeholder}}",
62
+ typography: {
63
+ editor: "content.title.typography",
64
+ type: "{{content.title.typography.type}}",
65
+ size: "{{content.title.typography.size}}",
66
+ toned: "{{content.title.typography.toned}}",
67
+ }
68
+ },
69
+ main: {
70
+ text: "{{content.main.text}}",
71
+ placeholder: "{{content.main.placeholder}}",
72
+ typography: {
73
+ editor: "content.main.typography",
74
+ type: "{{content.main.typography.type}}",
75
+ size: "{{content.main.typography.size}}",
76
+ toned: "{{content.main.typography.toned}}",
77
+ }
78
+ },
79
+ caption: {
80
+ text: "{{content.caption.text}}",
81
+ placeholder: "{{content.caption.placeholder}}",
82
+ typography: {
83
+ editor: "content.caption.typography",
84
+ type: "{{content.caption.typography.type}}",
85
+ size: "{{content.caption.typography.size}}",
86
+ toned: "{{content.caption.typography.toned}}",
87
+ }
88
+ },
89
+ summary: {
90
+ text: "{{content.summary.text}}",
91
+ placeholder: "{{content.summary.placeholder}}",
92
+ typography: {
93
+ editor: "content.summary.typography",
94
+ type: "{{content.summary.typography.type}}",
95
+ size: "{{content.summary.typography.size}}",
96
+ toned: "{{content.summary.typography.toned}}",
97
+ }
98
+ },
99
+ };
100
+ exports.VelcronColorSchemasStateBinding = {
101
+ main: {
102
+ type: "{{colorSchemas.main.type}}",
103
+ filled: "{{colorSchemas.main.filled}}"
104
+ }
105
+ };
106
+ exports.VelcronSpacingStateBinding = {
107
+ chrome: {
108
+ "top": "{{spacing.chrome.top}}",
109
+ "right": "{{spacing.chrome.right}}",
110
+ "bottom": "{{spacing.chrome.bottom}}",
111
+ "left": "{{spacing.chrome.left}}",
112
+ }
113
+ };
114
+ // export interface VelcronSpacingState {
115
+ // chrome?: VelcronDimensionState
116
+ // }
117
+ // export interface VelcronDimensionState {
118
+ // margin?: VelcronSpacing;
119
+ // padding?: VelcronSpacing;
120
+ // }
121
+ exports.VelcronStateBinding = {
122
+ colorSchemas: exports.VelcronColorSchemasStateBinding,
123
+ images: exports.VelcronImagesStateBinding,
124
+ content: exports.VelcronContentStateBinding,
125
+ header: exports.VelcronHeaderStateBinding,
126
+ spacing: exports.VelcronSpacingStateBinding
127
+ //properties?:VelcronPropertiesState,
128
+ };
@@ -1,4 +1,4 @@
1
- import { VelcronDefinition } from "./VelcronDefinitions";
1
+ 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;
@@ -1,4 +1,4 @@
1
- import { VelcronAppDefinition } from "./VelcronDefinitions";
1
+ import { VelcronAppDefinition } from "@omnia/fx-models";
2
2
  export interface AppJson {
3
3
  app: VelcronAppDefinition;
4
4
  }
package/models/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from "./VelcronDefinitions";
2
2
  export * from "./ViewModelAndContext";
3
- export * from "./VelcronEvents";
4
3
  export * from "./VelcronTypes";
5
4
  export * from "./Enums";
6
5
  export * from "./VelcronUnitProvider";
7
6
  export * from "./VelcronPropertyEditorDefinitions";
7
+ export * from "./ActionHooks";
package/models/index.js CHANGED
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./VelcronDefinitions"), exports);
5
5
  tslib_1.__exportStar(require("./ViewModelAndContext"), exports);
6
- tslib_1.__exportStar(require("./VelcronEvents"), exports);
7
6
  tslib_1.__exportStar(require("./VelcronTypes"), exports);
8
7
  tslib_1.__exportStar(require("./Enums"), exports);
9
8
  tslib_1.__exportStar(require("./VelcronUnitProvider"), exports);
10
9
  tslib_1.__exportStar(require("./VelcronPropertyEditorDefinitions"), exports);
10
+ tslib_1.__exportStar(require("./ActionHooks"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/velcron",
3
3
  "license": "MIT",
4
- "version": "8.0.81-vnext",
4
+ "version": "8.0.82-dev",
5
5
  "description": "Provide Omnia Velcron Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,13 +1,16 @@
1
- import { VelcronAction, VelcronActionWithAutoAwait, VelcronRenderContext, DeferredPromise } from "../models";
1
+ import { VelcronAction, VelcronActionWithAutoAwait, VelcronRenderContext, DeferredPromise, VelcronActionHooks } from "../models";
2
2
  import { IActionHandler } from "../actions";
3
3
  export declare class VelcronActions {
4
4
  static _actionHandlers: {
5
5
  [name: string]: IActionHandler;
6
6
  } | null;
7
+ static actionHooks: {
8
+ [name: string]: VelcronActionHooks;
9
+ };
7
10
  static registerAction(name: string, handler: IActionHandler): void;
8
11
  static parseAndExecuteActions(templates: Array<string>, renderContext: VelcronRenderContext, customActionContext?: VelcronCustomActionExecutionContext): void;
9
12
  static parseFunction(target: {
10
- [name: string]: [];
13
+ [name: string]: Array<string>;
11
14
  }, template: string, renderContext: VelcronRenderContext, params: Array<VelcronActionParameterValue>, foundCb: (name: string, params: {}) => void): void;
12
15
  static getActionFromTemplate(partialTemplate: string, eventId: string, renderContext: VelcronRenderContext, customActionContext?: VelcronCustomActionExecutionContext): VelcronAction;
13
16
  static valueIsAction(value: string): boolean;
@@ -15,6 +18,9 @@ export declare class VelcronActions {
15
18
  static executeAction(awAction: VelcronActionWithAutoAwait, callback: (continueExecution: boolean) => void): void;
16
19
  static dataBindComputed(renderContext: VelcronRenderContext, template: string): string;
17
20
  static parseAndExecuteComputed(renderContext: VelcronRenderContext, template: string): string;
21
+ static registerActionHook<TBefore, TAfter>(actionName: string, handler: VelcronActionHooks<TBefore, TAfter>): void;
22
+ static tryTriggerBeforeActionHook<T>(actionName: string, args: T): T;
23
+ static tryTriggerAfterActionHook<T>(actionName: string, args: T): T;
18
24
  private static extractParameterValues;
19
25
  }
20
26
  interface VelcronActionParameterValue {
@@ -271,6 +271,9 @@ class VelcronActions {
271
271
  if (VelcronActions._actionHandlers[actionName]) {
272
272
  //Built in handler
273
273
  promise = VelcronActions._actionHandlers[actionName].action(awAction, ...paramValues);
274
+ if (VelcronActions._actionHandlers[actionName].dispose) {
275
+ awAction.disposers.push(VelcronActions._actionHandlers[actionName].dispose(awAction));
276
+ }
274
277
  }
275
278
  else {
276
279
  //Custom handler
@@ -331,7 +334,7 @@ class VelcronActions {
331
334
  return text;
332
335
  }
333
336
  static parseAndExecuteComputed(renderContext, template) {
334
- VelcronData_1.VelcronData.getTokens(template).forEach(token => {
337
+ VelcronData_1.VelcronData.getTokens(template, false).forEach(token => {
335
338
  const paramValues = [];
336
339
  VelcronActions.parseFunction(renderContext.computed, token, renderContext, paramValues, (acName, params) => {
337
340
  const funcContent = renderContext.computed[acName];
@@ -348,6 +351,22 @@ class VelcronActions {
348
351
  });
349
352
  return template;
350
353
  }
354
+ static registerActionHook(actionName, handler) {
355
+ VelcronActions.actionHooks ?? (VelcronActions.actionHooks = {});
356
+ VelcronActions.actionHooks[actionName] = handler;
357
+ }
358
+ static tryTriggerBeforeActionHook(actionName, args) {
359
+ if (VelcronActions.actionHooks && VelcronActions.actionHooks[actionName] && VelcronActions.actionHooks[actionName].beforeHandler) {
360
+ return VelcronActions.actionHooks[actionName].beforeHandler(args);
361
+ }
362
+ return args;
363
+ }
364
+ static tryTriggerAfterActionHook(actionName, args) {
365
+ if (VelcronActions.actionHooks && VelcronActions.actionHooks[actionName] && VelcronActions.actionHooks[actionName].afterHandler) {
366
+ return VelcronActions.actionHooks[actionName].afterHandler(args);
367
+ }
368
+ return args;
369
+ }
351
370
  static extractParameterValues(template, action) {
352
371
  const params = [];
353
372
  let hasMoreParams = true;
@@ -414,7 +433,7 @@ class VelcronActions {
414
433
  }
415
434
  else {
416
435
  //Try get it from ViewModel
417
- castedValue = VelcronData_1.VelcronData.getOrSetObjectByPathUsingRenderContext(action, castedValue);
436
+ castedValue = VelcronData_1.VelcronData.getOrSet(action, castedValue);
418
437
  }
419
438
  }
420
439
  params.push({ dataType: dataType, value: castedValue });
@@ -432,12 +451,13 @@ class VelcronActions {
432
451
  return params;
433
452
  }
434
453
  }
435
- VelcronActions._actionHandlers = null;
436
454
  exports.VelcronActions = VelcronActions;
455
+ VelcronActions._actionHandlers = null;
456
+ VelcronActions.actionHooks = {};
437
457
  var VelcronActionParameterDataType;
438
458
  (function (VelcronActionParameterDataType) {
439
459
  VelcronActionParameterDataType[VelcronActionParameterDataType["text"] = 0] = "text";
440
460
  VelcronActionParameterDataType[VelcronActionParameterDataType["number"] = 1] = "number";
441
461
  VelcronActionParameterDataType[VelcronActionParameterDataType["boolean"] = 2] = "boolean";
442
462
  VelcronActionParameterDataType[VelcronActionParameterDataType["pointer"] = 3] = "pointer";
443
- })(VelcronActionParameterDataType = exports.VelcronActionParameterDataType || (exports.VelcronActionParameterDataType = {}));
463
+ })(VelcronActionParameterDataType || (exports.VelcronActionParameterDataType = VelcronActionParameterDataType = {}));
@@ -1,18 +1,26 @@
1
1
  export declare const VelcronConstants: {
2
2
  components: {
3
- appDefinition: string;
4
- view: string;
3
+ velcron: string;
4
+ flex: string;
5
+ row: string;
6
+ column: string;
5
7
  card: string;
6
8
  text: string;
7
9
  image: string;
10
+ video: string;
8
11
  button: string;
9
- textInput: string;
10
- progress: string;
11
- webView: string;
12
+ "text-input": string;
13
+ "progress-circle": string;
14
+ "web-view": string;
15
+ "custom-component": string;
12
16
  dialog: string;
13
17
  icon: string;
14
18
  chip: string;
15
19
  markdown: string;
20
+ slot: string;
21
+ property: string;
22
+ checkbox: string;
23
+ reference: string;
16
24
  };
17
25
  events: {
18
26
  idTokenStart: string;
@@ -25,5 +33,9 @@ export declare const VelcronConstants: {
25
33
  properties: {
26
34
  tokenStart: string;
27
35
  tokenEnd: string;
36
+ propsToken: string;
37
+ };
38
+ context: {
39
+ thisToken: string;
28
40
  };
29
41
  };
@@ -3,19 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VelcronConstants = void 0;
4
4
  exports.VelcronConstants = {
5
5
  components: {
6
- appDefinition: "velcron",
7
- view: "view",
6
+ velcron: "velcron",
7
+ flex: "flex",
8
+ row: "row",
9
+ column: "column",
8
10
  card: "card",
9
11
  text: "text",
10
12
  image: "image",
13
+ video: "video",
11
14
  button: "button",
12
- textInput: "text-input",
13
- progress: "progress",
14
- webView: "web-view",
15
+ "text-input": "text-input",
16
+ "progress-circle": "progress-circle",
17
+ "web-view": "web-view",
18
+ "custom-component": "custom-component",
15
19
  dialog: "dialog",
16
20
  icon: "icon",
17
21
  chip: "chip",
18
22
  markdown: "markdown",
23
+ slot: "slot",
24
+ property: "property",
25
+ checkbox: "checkbox",
26
+ reference: "reference"
19
27
  },
20
28
  events: {
21
29
  idTokenStart: "$ev{",
@@ -26,7 +34,11 @@ exports.VelcronConstants = {
26
34
  stateRootToken: "$state"
27
35
  },
28
36
  properties: {
29
- tokenStart: "${",
30
- tokenEnd: "}"
37
+ tokenStart: "{{",
38
+ tokenEnd: "}}",
39
+ propsToken: "$props"
40
+ },
41
+ context: {
42
+ thisToken: "$this"
31
43
  }
32
44
  };
@@ -1,4 +1,5 @@
1
- import { VelcronAppDefinition, VelcronDefinition, VelcronRenderContext, DeferredPromise, VelcronBindableProp } from "../models";
1
+ import { VelcronRenderContext, DeferredPromise, VelcronBindableProp } from "../models";
2
+ import { VelcronAppDefinition, VelcronDefinition } from "..";
2
3
  export interface ParseResult<T> {
3
4
  is: boolean;
4
5
  value: T;
@@ -25,8 +26,8 @@ export declare class VelcronData {
25
26
  static isObject(value: any): boolean;
26
27
  static extendObject(obj: any): any;
27
28
  static getOrSetObjectByPath<T>(object: Object, path: string, value?: any): T | null;
28
- static getOrSetObjectByPathUsingRenderContext<T>(renderContext: VelcronRenderContext, path: string, value?: any): T;
29
- static getTokens(template: any): string[];
29
+ static getOrSet<T>(renderContext: VelcronRenderContext, path: string, value?: any): T;
30
+ static getTokens(template: any, removeBrackets: boolean): string[];
30
31
  static ensureEventId(event: string): string;
31
32
  static ensureKeys(ui: VelcronDefinition | VelcronAppDefinition, generateNewKeys?: boolean): void;
32
33
  static removeKeys(ui: VelcronDefinition | VelcronAppDefinition): void;
@@ -10,10 +10,9 @@ class VelcronData {
10
10
  if (!VelcronData.isString(text)) {
11
11
  return text;
12
12
  }
13
- const tokens = this.getTokens(text);
14
- tokens.forEach((name) => {
15
- let data = this.getOrSetObjectByPathUsingRenderContext(renderContext, name);
16
- const token = VelcronConstants_1.VelcronConstants.properties.tokenStart + name + VelcronConstants_1.VelcronConstants.properties.tokenEnd;
13
+ const tokens = this.getTokens(text, false);
14
+ tokens.forEach((token) => {
15
+ let data = this.getOrSet(renderContext, token.replace(/\s*{{\s*|\s*}}\s*/g, ""));
17
16
  if (data instanceof TextValue_1.TextValue) {
18
17
  data = data.value;
19
18
  }
@@ -71,11 +70,11 @@ class VelcronData {
71
70
  let propertiesToEval = {};
72
71
  if (renderContext.properties) {
73
72
  //Custom component properties evaluation
74
- propertiesToEval = {};
75
- Object.keys(renderContext.properties).forEach((key) => {
76
- propertiesToEval[key] = "properties";
77
- });
78
- names.push("properties");
73
+ // propertiesToEval = {};
74
+ // Object.keys(renderContext.properties).forEach((key) => {
75
+ // propertiesToEval[key] = VelcronConstants.properties.propsToken;
76
+ // });
77
+ names.push(VelcronConstants_1.VelcronConstants.properties.propsToken);
79
78
  obj.push(renderContext.properties);
80
79
  }
81
80
  else if (overrideNamesMatching) {
@@ -85,7 +84,8 @@ class VelcronData {
85
84
  "null",
86
85
  "return"
87
86
  ];
88
- template = VelcronData.addCtxToVariableNames(template, undefined, reservedWords, propertiesToEval);
87
+ const skipName = "$props";
88
+ template = VelcronData.addCtxToVariableNames(template, skipName, reservedWords, propertiesToEval);
89
89
  names.push("rootCtx");
90
90
  names.push("currentCtx");
91
91
  obj.push(renderContext.rootContext);
@@ -224,7 +224,7 @@ class VelcronData {
224
224
  }
225
225
  else {
226
226
  //Try get value from rootContext or currentContext
227
- value = VelcronData.getOrSetObjectByPathUsingRenderContext(renderContext, value);
227
+ value = VelcronData.getOrSet(renderContext, value);
228
228
  }
229
229
  }
230
230
  }
@@ -244,7 +244,7 @@ class VelcronData {
244
244
  runEvaluation = true;
245
245
  }
246
246
  }
247
- const existingVal = VelcronData.getOrSetObjectByPathUsingRenderContext(renderContext, path);
247
+ const existingVal = VelcronData.getOrSet(renderContext, path);
248
248
  if (assignOperator === models_1.AssignOperators.equals || assignOperator === models_1.AssignOperators.equalsExclamation) {
249
249
  //debugger;
250
250
  if (typeof existingVal === "boolean" && typeof value !== "boolean") {
@@ -275,7 +275,7 @@ class VelcronData {
275
275
  else if (assignOperator && VelcronData.isString(value)) {
276
276
  //Value is assignment from renderContext
277
277
  // "$state.title = title" or "$state.title = $state.anotherTitle"
278
- if (value === "this") {
278
+ if (value === "$this") {
279
279
  // $state.currentItem = this (this means currentContext)
280
280
  value = renderContext.currentContext;
281
281
  }
@@ -286,7 +286,10 @@ class VelcronData {
286
286
  }
287
287
  else {
288
288
  //try get value from render context
289
- value = VelcronData.getOrSetObjectByPathUsingRenderContext(renderContext, value);
289
+ const localVal = VelcronData.getOrSet(renderContext, value);
290
+ if (localVal !== undefined && localVal !== null) {
291
+ value = localVal;
292
+ }
290
293
  }
291
294
  }
292
295
  }
@@ -492,7 +495,7 @@ class VelcronData {
492
495
  }
493
496
  return object;
494
497
  }
495
- static getOrSetObjectByPathUsingRenderContext(renderContext, path, value = undefined) {
498
+ static getOrSet(renderContext, path, value = undefined) {
496
499
  let result;
497
500
  if (VelcronData.isUndefined(path)) {
498
501
  return result;
@@ -508,52 +511,53 @@ class VelcronData {
508
511
  variables[renderContext.id].hasOwnProperty(path)) {
509
512
  result = variables[renderContext.id][path];
510
513
  }
514
+ else if (path.startsWith(VelcronConstants_1.VelcronConstants.properties.propsToken + ".")) {
515
+ //props in a custom component $props.
516
+ path = path.substring(VelcronConstants_1.VelcronConstants.properties.propsToken.length + 1);
517
+ const propObj = VelcronData.getOrSetObjectByPath(renderContext.properties, path);
518
+ if (VelcronData.isString(propObj)) {
519
+ const propString = propObj;
520
+ path = VelcronData.dataBind(renderContext, propString);
521
+ result = path;
522
+ }
523
+ result = propObj;
524
+ }
525
+ else if (path === VelcronConstants_1.VelcronConstants.context.thisToken) {
526
+ //Eg foreach loop and binding to the whole object in binding use $this
527
+ result = renderContext.currentContext;
528
+ }
511
529
  else {
512
- let pathIsPropertyValue = false;
513
- if (renderContext.properties?.hasOwnProperty(path)) {
514
- pathIsPropertyValue = true;
515
- const propObj = renderContext.properties[path];
516
- if (VelcronData.isString(propObj)) {
517
- const propString = propObj;
518
- path = VelcronData.dataBind(renderContext, propString);
519
- }
520
- result = propObj;
530
+ const tokens = VelcronData.getTokens(path, true);
531
+ if (tokens.length > 0) {
532
+ path = tokens[0];
521
533
  }
522
- if (!result || VelcronData.isString(result)) {
523
- const tokens = VelcronData.getTokens(path);
524
- if (tokens.length > 0) {
525
- path = tokens[0];
526
- }
527
- let object = null;
528
- if (path.startsWith(`${VelcronConstants_1.VelcronConstants.state.stateRootToken}.`) || path === VelcronConstants_1.VelcronConstants.state.stateRootToken) {
529
- //Fetch from the data object
530
- object = renderContext.rootContext;
531
- path = path.substring(6);
532
- }
533
- else {
534
- //Fetch from current ctx
535
- object = renderContext.currentContext;
536
- }
537
- if (VelcronData.isObject(object)) {
538
- result = VelcronData.getOrSetObjectByPath(object, path, value);
539
- }
540
- else {
541
- //For example if you bind to Array of ["string"] the currentContext is only a string so we just return the object without mapping path
542
- result = object;
543
- }
544
- if (typeof result === "undefined" && pathIsPropertyValue) {
545
- result = path;
546
- }
534
+ let object = null;
535
+ if (path.startsWith(`${VelcronConstants_1.VelcronConstants.state.stateRootToken}.`) || path === VelcronConstants_1.VelcronConstants.state.stateRootToken) {
536
+ //Fetch from the data object
537
+ object = renderContext.rootContext;
538
+ path = path.substring(6);
539
+ }
540
+ else {
541
+ //Fetch from current ctx
542
+ object = renderContext.currentContext;
543
+ }
544
+ if (VelcronData.isObject(object)) {
545
+ result = VelcronData.getOrSetObjectByPath(object, path, value);
546
+ }
547
+ else {
548
+ //For example if you bind to Array of ["string"] the currentContext is only a string so we just return the object without mapping path
549
+ result = object;
547
550
  }
548
551
  }
549
552
  return result;
550
553
  }
551
- static getTokens(template) {
554
+ static getTokens(template, removeBrackets) {
552
555
  const tokens = [];
553
556
  if (template) {
554
- template.replace(/(\${).+?(?=\})/g, (tokenWithVar, token) => {
555
- tokens.push(tokenWithVar.substring(2));
556
- return token;
557
+ template.replace(removeBrackets ? /{{\s*(.+?)\s*}}/g : /(\{{.+?\}})/g, (foundToken, token) => {
558
+ const tokenWithVar = removeBrackets ? token : foundToken;
559
+ tokens.push(tokenWithVar);
560
+ return tokenWithVar;
557
561
  });
558
562
  }
559
563
  return tokens;
@@ -634,5 +638,5 @@ class VelcronData {
634
638
  return { promise, reject, resolve };
635
639
  }
636
640
  }
637
- VelcronData.variables = {};
638
641
  exports.VelcronData = VelcronData;
642
+ VelcronData.variables = {};
@@ -0,0 +1,9 @@
1
+ import { BuiltInPropertyEditors, ResolvedPropertyEditor } from "../models";
2
+ export declare class VelcronPropertyEditors {
3
+ private static editors;
4
+ static registerEditor(type: string, editor: any): void;
5
+ static hasEditors(): boolean;
6
+ static hasEditor(type: string): any;
7
+ static registerEditors(editors: BuiltInPropertyEditors): void;
8
+ static getEditor(editor: string): ResolvedPropertyEditor;
9
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VelcronPropertyEditors = void 0;
4
+ class VelcronPropertyEditors {
5
+ static registerEditor(type, editor) {
6
+ type = type.toLowerCase();
7
+ if (!this.editors[type]) {
8
+ this.editors[type] = editor;
9
+ }
10
+ else {
11
+ throw `Velcron Property Editor of type ${type} is already registered`;
12
+ }
13
+ }
14
+ static hasEditors() {
15
+ return Object.keys(this.editors).length > 0;
16
+ }
17
+ static hasEditor(type) {
18
+ type = type.toLowerCase();
19
+ return this.editors[type];
20
+ }
21
+ static registerEditors(editors) {
22
+ Object.keys(editors).forEach((key) => {
23
+ this.registerEditor(key, editors[key]);
24
+ });
25
+ }
26
+ static getEditor(editor) {
27
+ let result;
28
+ if (this.editors[editor.toLowerCase()]) {
29
+ result = {
30
+ editor: this.editors[editor.toLowerCase()],
31
+ };
32
+ }
33
+ else {
34
+ throw "Cant find property editor";
35
+ }
36
+ return result;
37
+ }
38
+ }
39
+ exports.VelcronPropertyEditors = VelcronPropertyEditors;
40
+ VelcronPropertyEditors.editors = {};
@@ -1,4 +1,5 @@
1
- import { BuiltInComponentRenderers, DynamicState, ResolvedComponentRenderer, VelcronDefinition, VelcronRenderContext } from "../models";
1
+ import { BuiltInComponentRenderers, ResolvedComponentRenderer, VelcronRenderContext } from "../models";
2
+ import { DynamicState, VelcronDefinition } from "..";
2
3
  export declare class VelcronRenderers {
3
4
  private static components;
4
5
  static registerComponent(type: string, component: any): void;