@omnia/velcron 8.0.134-dev → 8.0.136-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,26 +1,25 @@
1
- import { BackgroundDefinition, ColorSchemaType, ColorValue, FillDefinition } from "./ThemeDefinitionV2";
1
+ import { BackgroundDefinition, BlueprintsReference, ColorSchemaType, ColorValue, FillDefinition } from "./ThemeDefinitionV2";
2
2
  import { SpacingDefinition, Spacing } from "./Spacing";
3
3
  import { TypographyValue } from "./Typography";
4
4
  export interface BoxDimensions extends Spacing {
5
5
  }
6
6
  import { TypographyBlueprint } from "./Typography";
7
- import { Guid, GuidValue, VelcronAppDefinition } from "@omnia/fx-models";
7
+ import { GuidValue, VelcronAppDefinition } from "@omnia/fx-models";
8
8
  export interface Blueprints {
9
- id: Guid;
10
9
  name?: string;
11
10
  }
12
11
  export type BlueprintVariant = "primary" | "secondary" | "variant1" | "variant2" | "variant3";
13
12
  export type ButtonBlueprintType = "text" | "icon";
14
- export interface ChromeBlueprints extends Blueprints {
13
+ export interface ChromeBlueprints extends Blueprints, BlueprintsReference {
15
14
  primary: ChromeBlueprint;
16
15
  variant1?: ChromeBlueprint;
17
16
  variant2?: ChromeBlueprint;
18
17
  variant3?: ChromeBlueprint;
19
18
  }
20
- export interface TypographyBlueprints extends Blueprints {
19
+ export interface TypographyBlueprints extends Blueprints, BlueprintsReference {
21
20
  primary: TypographyBlueprint;
22
21
  }
23
- export interface SpacingBlueprints extends Blueprints {
22
+ export interface SpacingBlueprints extends Blueprints, BlueprintsReference {
24
23
  primary: SpacingBlueprint;
25
24
  }
26
25
  export interface ChromeBlueprint {
@@ -36,37 +35,9 @@ export interface ChromeBlueprint {
36
35
  };
37
36
  }
38
37
  export type ButtonTypes = "primary" | "basic" | "accent1" | "warn" | "link" | "variant1" | "variant2" | "variant3" | "variant4";
39
- export interface ComponentBlueprints extends Blueprints {
40
- buttons?: {
41
- text?: {
42
- primary?: ButtonBlueprint;
43
- basic?: ButtonBlueprint;
44
- accent1?: ButtonBlueprint;
45
- warn?: ButtonBlueprint;
46
- link?: ButtonBlueprint;
47
- variant1?: ButtonBlueprint;
48
- variant2?: ButtonBlueprint;
49
- variant3?: ButtonBlueprint;
50
- variant4?: ButtonBlueprint;
51
- };
52
- icon?: {
53
- primary?: ButtonBlueprint;
54
- basic?: ButtonBlueprint;
55
- accent1?: ButtonBlueprint;
56
- warn?: ButtonBlueprint;
57
- link?: ButtonBlueprint;
58
- variant1?: ButtonBlueprint;
59
- variant2?: ButtonBlueprint;
60
- variant3?: ButtonBlueprint;
61
- variant4?: ButtonBlueprint;
62
- };
63
- };
64
- tabs?: {
65
- primary?: TabsBlueprint;
66
- variant1?: TabsBlueprint;
67
- variant2?: TabsBlueprint;
68
- variant3?: TabsBlueprint;
69
- };
38
+ export interface ComponentBlueprints extends Blueprints, BlueprintsReference {
39
+ buttons?: ButtonBlueprints;
40
+ tabs?: TabsBlueprints;
70
41
  blocks?: ChromeBlueprints;
71
42
  }
72
43
  export interface SpacingBlueprint {
@@ -87,20 +58,47 @@ export interface Blueprint {
87
58
  type: VelcronBlueprintDefintionType | WebBlueprintItemDefintionType;
88
59
  }
89
60
  export interface SearchBoxBlueprint extends Blueprint {
90
- type: "searchbox";
91
61
  borderRadius?: BoxDimensions;
92
62
  variant?: "outlined" | "solo" | "regular" | "plain" | "underlined";
93
63
  }
94
64
  export interface ButtonBlueprint extends Blueprint {
95
- type: "button";
96
65
  padding?: Spacing;
97
66
  background?: BackgroundDefinition;
98
67
  alterCase?: boolean;
99
68
  text?: TextBlueprint;
100
69
  icon?: IconBlueprint;
101
70
  }
71
+ export interface ButtonBlueprints extends Blueprints {
72
+ text: {
73
+ primary?: ButtonBlueprint;
74
+ basic?: ButtonBlueprint;
75
+ accent1?: ButtonBlueprint;
76
+ warn?: ButtonBlueprint;
77
+ link?: ButtonBlueprint;
78
+ variant1?: ButtonBlueprint;
79
+ variant2?: ButtonBlueprint;
80
+ variant3?: ButtonBlueprint;
81
+ variant4?: ButtonBlueprint;
82
+ };
83
+ icon: {
84
+ primary?: ButtonBlueprint;
85
+ basic?: ButtonBlueprint;
86
+ accent1?: ButtonBlueprint;
87
+ warn?: ButtonBlueprint;
88
+ link?: ButtonBlueprint;
89
+ variant1?: ButtonBlueprint;
90
+ variant2?: ButtonBlueprint;
91
+ variant3?: ButtonBlueprint;
92
+ variant4?: ButtonBlueprint;
93
+ };
94
+ }
95
+ export interface TabsBlueprints extends Blueprints {
96
+ primary?: TabsBlueprint;
97
+ variant1?: TabsBlueprint;
98
+ variant2?: TabsBlueprint;
99
+ variant3?: TabsBlueprint;
100
+ }
102
101
  export interface TabsBlueprint extends Blueprint {
103
- type: "tab";
104
102
  background?: BackgroundDefinition;
105
103
  padding?: Spacing;
106
104
  margin?: Spacing;
@@ -125,12 +123,10 @@ export interface TabsBlueprint extends Blueprint {
125
123
  };
126
124
  }
127
125
  export interface TextBlueprint extends Blueprint {
128
- type: "text";
129
126
  color?: FillDefinition;
130
127
  typography?: TypographyValue;
131
128
  }
132
129
  export interface IconBlueprint extends Blueprint {
133
- type: "icon";
134
130
  color?: FillDefinition;
135
131
  size?: number;
136
132
  }
@@ -1,5 +1,5 @@
1
1
  import { Guid } from "../Guid";
2
- import { BoxDimensions } from "./Blueprints";
2
+ import { BoxDimensions, ComponentBlueprints, SpacingBlueprints, TypographyBlueprints } from "./Blueprints";
3
3
  export interface ColorTypeResult<resultType> {
4
4
  base: resultType;
5
5
  baseTone: resultType;
@@ -21,14 +21,14 @@ export interface ColorStyles {
21
21
  color: object | string;
22
22
  all: object | string;
23
23
  }
24
- export interface ColorSchema {
24
+ export interface ColorSchema extends BlueprintsReference {
25
25
  name: string;
26
26
  base: ColorDefinition;
27
27
  onBase: ColorDefinition;
28
28
  container: ColorDefinition;
29
29
  onContainer: ColorDefinition;
30
30
  }
31
- export interface ColorSchemas {
31
+ export interface ColorSchemas extends ColorSchemasReference {
32
32
  primary: ColorSchema;
33
33
  secondary: ColorSchema;
34
34
  accent1: ColorSchema;
@@ -41,13 +41,41 @@ export interface ColorSchemas {
41
41
  warning: ColorSchema;
42
42
  notification: ColorSchema;
43
43
  }
44
- export interface ThemeDefinitionV2 {
44
+ export interface BlueprintsReference {
45
+ id: Guid;
46
+ }
47
+ export interface ColorSchemasReference {
48
+ primary: BlueprintsReference;
49
+ secondary: BlueprintsReference;
50
+ accent1: BlueprintsReference;
51
+ accent2: BlueprintsReference;
52
+ accent3: BlueprintsReference;
53
+ neutral: BlueprintsReference;
54
+ background: BlueprintsReference;
55
+ error: BlueprintsReference;
56
+ info: BlueprintsReference;
57
+ warning: BlueprintsReference;
58
+ notification: BlueprintsReference;
59
+ }
60
+ export interface ThemeDefinitionReference {
45
61
  id: Guid;
46
62
  name?: string;
63
+ colors: ColorSchemasReference;
64
+ typography: BlueprintsReference;
65
+ spacing: BlueprintsReference;
66
+ components: BlueprintsReference;
67
+ }
68
+ export interface ThemeDefinitionV2 extends ThemeDefinitionReference {
47
69
  colors: ColorSchemas;
48
- typographyId: Guid;
49
- spacingId: Guid;
50
- componentId: Guid;
70
+ typography: TypographyBlueprints;
71
+ spacing: SpacingBlueprints;
72
+ components: ComponentBlueprints;
73
+ }
74
+ export interface ITemplateRegistration<TTemplateType = any> {
75
+ id: Guid;
76
+ template: TTemplateType;
77
+ hidden?: boolean;
78
+ custom?: boolean;
51
79
  }
52
80
  export type ColorSchemaType = keyof typeof ColorSchemaTypes;
53
81
  export declare enum ColorSchemaTypes {
@@ -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.134-dev",
4
+ "version": "8.0.136-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) {
@@ -12,9 +12,6 @@ export declare const useVelcronColorSchemaStore: (newStateWithName?: string) =>
12
12
  themeStore: {
13
13
  state: {
14
14
  currentTheme: import("@omnia/fx-models").ThemeDefinitionV2;
15
- components: import("@omnia/fx-models").ComponentBlueprints;
16
- spacing: import("@omnia/fx-models").SpacingBlueprints;
17
- typography: import("@omnia/fx-models").TypographyBlueprints;
18
15
  };
19
16
  get: {
20
17
  componentBlueprints: () => void;
@@ -1,10 +1,7 @@
1
- import { ColorSchemaType, ColorSchemaTypes, ColorType, ColorTypes, ComponentBlueprints, SpacingBlueprints, ThemeDefinitionV2, TypographyBlueprints, TypographySize, TypographySizes, TypographyType, TypographyTypes } from "..";
1
+ import { ColorSchemaType, ColorSchemaTypes, ColorType, ColorTypes, ThemeDefinitionV2, TypographySize, TypographySizes, TypographyType, TypographyTypes } from "..";
2
2
  export declare const useVelcronThemingStore: (newStateWithName?: string) => {
3
3
  state: {
4
4
  currentTheme: ThemeDefinitionV2;
5
- components: ComponentBlueprints;
6
- spacing: SpacingBlueprints;
7
- typography: TypographyBlueprints;
8
5
  };
9
6
  get: {
10
7
  componentBlueprints: () => void;
@@ -8,25 +8,22 @@ exports.useVelcronThemingStore = (0, _1.defineVelcronStore)("VelcronTheming", {
8
8
  return {
9
9
  state: {
10
10
  currentTheme: {},
11
- components: {},
12
- spacing: {},
13
- typography: {},
14
11
  }
15
12
  };
16
13
  },
17
14
  getters(state) {
18
15
  return {
19
16
  componentBlueprints: () => {
20
- state.components;
17
+ state.currentTheme.components;
21
18
  },
22
19
  colorSchema: (colorSchemaType) => {
23
20
  return (0, __1.useThemeMethods)(() => state.currentTheme).colorSchema(colorSchemaType);
24
21
  },
25
22
  spacing: () => {
26
- return state.spacing.primary.inner;
23
+ return state.currentTheme.spacing.primary.inner;
27
24
  },
28
25
  typography: (typographyType, size) => {
29
- const typography = state.typography.primary;
26
+ const typography = state.currentTheme.typography.primary;
30
27
  if (typographyType === __1.TypographyTypes.text) {
31
28
  return typography.text[size];
32
29
  }