@omnia/velcron 8.0.135-dev → 8.0.137-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.
@@ -0,0 +1,5 @@
1
+ import { EventHook } from "@omnia/fx-models";
2
+ /**
3
+ * Utility for creating event hooks on the fly
4
+ */
5
+ export declare function createVelcronEventHook<T = any>(): EventHook<T>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createVelcronEventHook = void 0;
4
+ /**
5
+ * Utility for creating event hooks on the fly
6
+ */
7
+ function createVelcronEventHook() {
8
+ const fns = [];
9
+ function off(fn) {
10
+ const index = fns.indexOf(fn);
11
+ if (index !== -1)
12
+ fns.splice(index, 1);
13
+ }
14
+ function on(fn) {
15
+ fns.push(fn);
16
+ return {
17
+ off: () => off(fn),
18
+ };
19
+ }
20
+ function trigger(param) {
21
+ fns.forEach(fn => fn(param));
22
+ }
23
+ return {
24
+ on,
25
+ off,
26
+ trigger,
27
+ };
28
+ }
29
+ exports.createVelcronEventHook = createVelcronEventHook;
@@ -0,0 +1 @@
1
+ export * from "./CreateEventHook";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./CreateEventHook"), exports);
package/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from "./stores";
5
5
  export * from "@omnia/velcron/internal-do-not-import-from-here/shared/models";
6
6
  export * from "./rules";
7
7
  export * from "./templatebuilder";
8
+ export * from "./events";
package/index.js CHANGED
@@ -8,3 +8,4 @@ tslib_1.__exportStar(require("./stores"), exports);
8
8
  tslib_1.__exportStar(require("@omnia/velcron/internal-do-not-import-from-here/shared/models"), exports);
9
9
  tslib_1.__exportStar(require("./rules"), exports);
10
10
  tslib_1.__exportStar(require("./templatebuilder"), exports);
11
+ tslib_1.__exportStar(require("./events"), exports);
@@ -0,0 +1,10 @@
1
+ export type EventHookOn<T = any> = (fn: (param: T) => void) => {
2
+ off: () => void;
3
+ };
4
+ export type EventHookOff<T = any> = (fn: (param: T) => void) => void;
5
+ export type EventHookTrigger<T = any> = (param: T) => void;
6
+ export interface EventHook<T = any> {
7
+ on: EventHookOn<T>;
8
+ off: EventHookOff<T>;
9
+ trigger: EventHookTrigger<T>;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -14,6 +14,14 @@ export declare enum ActorActivityCategory {
14
14
  snoozed = 3,
15
15
  bookmarked = 4
16
16
  }
17
+ export interface ActivitySettings {
18
+ category: ActorActivityCategory;
19
+ social: ActivitySocialSettings;
20
+ }
21
+ export interface ActivitySocialSettings {
22
+ comments: boolean;
23
+ reactions: boolean;
24
+ }
17
25
  export interface ActorActivityBase {
18
26
  activityId: ActivityId;
19
27
  status: ActorActivityStatus;
@@ -19,3 +19,4 @@ export * from "./hub";
19
19
  export * from "./velcron";
20
20
  export * from "./DependencyInjection";
21
21
  export * from "./Messaging";
22
+ export * from "./EventHook";
@@ -23,3 +23,4 @@ tslib_1.__exportStar(require("./hub"), exports);
23
23
  tslib_1.__exportStar(require("./velcron"), exports);
24
24
  tslib_1.__exportStar(require("./DependencyInjection"), exports);
25
25
  tslib_1.__exportStar(require("./Messaging"), exports);
26
+ tslib_1.__exportStar(require("./EventHook"), exports);
@@ -1,4 +1,4 @@
1
- import { Guid } from "../Guid";
1
+ import { GuidValue } from "../Guid";
2
2
  import { BoxDimensions, ComponentBlueprints, SpacingBlueprints, TypographyBlueprints } from "./Blueprints";
3
3
  export interface ColorTypeResult<resultType> {
4
4
  base: resultType;
@@ -42,7 +42,7 @@ export interface ColorSchemas extends ColorSchemasReference {
42
42
  notification: ColorSchema;
43
43
  }
44
44
  export interface BlueprintsReference {
45
- id: Guid;
45
+ id: GuidValue;
46
46
  }
47
47
  export interface ColorSchemasReference {
48
48
  primary: BlueprintsReference;
@@ -58,7 +58,7 @@ export interface ColorSchemasReference {
58
58
  notification: BlueprintsReference;
59
59
  }
60
60
  export interface ThemeDefinitionReference {
61
- id: Guid;
61
+ id: GuidValue;
62
62
  name?: string;
63
63
  colors: ColorSchemasReference;
64
64
  typography: BlueprintsReference;
@@ -71,6 +71,12 @@ export interface ThemeDefinitionV2 extends ThemeDefinitionReference {
71
71
  spacing: SpacingBlueprints;
72
72
  components: ComponentBlueprints;
73
73
  }
74
+ export interface ITemplateRegistration<TTemplateType = any> {
75
+ id: GuidValue;
76
+ template: TTemplateType;
77
+ hidden?: boolean;
78
+ custom?: boolean;
79
+ }
74
80
  export type ColorSchemaType = keyof typeof ColorSchemaTypes;
75
81
  export declare enum ColorSchemaTypes {
76
82
  primary = "primary",
@@ -1,8 +1,8 @@
1
- import { Guid } from "../Guid";
1
+ import { GuidValue } from "../Guid";
2
2
  export interface TypographyBlueprint {
3
3
  name: string;
4
4
  font?: {
5
- id: Guid;
5
+ id: GuidValue;
6
6
  family: string;
7
7
  cdn?: string;
8
8
  };
@@ -1,5 +1,5 @@
1
1
  import { DynamicState } from "../DynamicState";
2
- import { VelcronEvent, VelcronOnEditModeEvent, VelcronOnLoadEvent, VelcronOnSaveEvent } from "./VelcronEvents";
2
+ import { VelcronEvent, VelcronOnEditModeEvent, VelcronOnLoadEvent, VelcronOnSavingEvent } from "./VelcronEvents";
3
3
  /**
4
4
  * Velcron definition base
5
5
  */
@@ -73,7 +73,7 @@ export interface VelcronAppDefinition<TState extends DynamicState = DynamicState
73
73
  version?: string;
74
74
  name?: string;
75
75
  body?: Array<VelcronDefinition>;
76
- events?: VelcronOnLoadEvent & VelcronOnEditModeEvent & VelcronOnSaveEvent;
76
+ events?: VelcronOnLoadEvent & VelcronOnEditModeEvent & VelcronOnSavingEvent;
77
77
  actions?: {
78
78
  [name: string]: Array<string>;
79
79
  };
@@ -4,8 +4,8 @@ export type VelcronOnPressEvent = {
4
4
  export type VelcronOnLoadEvent = {
5
5
  onLoaded?: Array<string>;
6
6
  };
7
- export type VelcronOnSaveEvent = {
8
- onSaved?: Array<string>;
7
+ export type VelcronOnSavingEvent = {
8
+ onSaving?: Array<string>;
9
9
  };
10
10
  export type VelcronOnEditModeEvent = {
11
11
  onEditMode?: Array<string>;
@@ -1,4 +1,4 @@
1
- import { VelcronOnUpdatedEvent, VelcronOnClosedEvent, VelcronOnCloseRequestedEvent, VelcronOnPressEvent, VelcronSpacing, VelcronStyling, VelcronCustomComponentDefinition, VelcronAppDefinition, VelcronRendererResolverReference } from "@omnia/velcron/internal-do-not-import-from-here/shared/models";
1
+ import { VelcronOnUpdatedEvent, VelcronOnClosedEvent, VelcronOnCloseRequestedEvent, VelcronOnPressEvent, VelcronSpacing, VelcronStyling, VelcronCustomComponentDefinition, VelcronAppDefinition, VelcronRendererResolverReference, EventHook, Future } from "@omnia/velcron/internal-do-not-import-from-here/shared/models";
2
2
  import { VelcroncomponentArrayType, VelcronPrimitiveType } from "./VelcronTypes";
3
3
  import { AssignOperators, VelcronHorizontalAlignments, VelcronIconTypes, VelcronActionTypes, VelcronVerticalAlignments } from "./Enums";
4
4
  import { DynamicState, VelcronDefinition, useVelcronThemingStore } from "..";
@@ -61,7 +61,7 @@ export interface VelcronRenderContext {
61
61
  };
62
62
  parent?: VelcronRenderContext;
63
63
  hooks?: VelcronRenderContextHooks;
64
- eventHandlers?: VelcronRenderContextEventHandlers;
64
+ eventHandlers?: VelcronRenderContextEventHandlersInstance;
65
65
  editMode?: boolean;
66
66
  disposers: Array<() => void>;
67
67
  }
@@ -71,6 +71,9 @@ export interface VelcronRenderContextEventHandlers {
71
71
  };
72
72
  emitting?: <T>(emitter: (i: T) => T) => T;
73
73
  }
74
+ export interface VelcronRenderContextEventHandlersInstance extends VelcronRenderContextEventHandlers {
75
+ emitOnSaved: EventHook<Future<void>>;
76
+ }
74
77
  export interface VelcronRenderContextHooks {
75
78
  dialogVisibilityChanged?: ((visible: boolean) => void);
76
79
  onItemSelected?: ((item: VelcronDefinition) => void);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/velcron",
3
3
  "license": "MIT",
4
- "version": "8.0.135-dev",
4
+ "version": "8.0.137-dev",
5
5
  "description": "Provide Omnia Velcron Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -263,8 +263,7 @@ class VelcronActions {
263
263
  const params = VelcronActions.extractParameterValues(val, awAction);
264
264
  let promise = null;
265
265
  const actionName = awAction.action.substring(0, awAction.action.indexOf("(")).trim().toLowerCase();
266
- //promise = VelcronActions.runHandler(awAction, actionName, params);
267
- if (!VelcronActions._actionHandlers) {
266
+ if (!VelcronActions.registeredBuiltInHandlers) {
268
267
  Object.keys(builtInHandlers).forEach((key) => {
269
268
  const handler = builtInHandlers[key];
270
269
  if (handler && handler.name && VelcronActions._actionHandlers) {