@omnia/velcron 8.0.127-dev → 8.0.129-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,19 @@
1
+ export interface ActivationOptions {
2
+ lifetime?: InstanceLifetimes;
3
+ onStartup?: (type: any) => void;
4
+ createFactory?: (classType: any) => any;
5
+ onInstanceCreated?: (instance: any) => void;
6
+ onBeforeInstanceCreated?: () => void;
7
+ onDisposing?: (instance: any) => void;
8
+ }
9
+ export interface TypeDefinition extends ActivationOptions {
10
+ type: any;
11
+ }
12
+ export declare enum InstanceLifetimes {
13
+ Transient = 0,
14
+ Singleton = 1,
15
+ Scoped = 2
16
+ }
17
+ export interface IDisposable {
18
+ onDisposing: () => void;
19
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InstanceLifetimes = void 0;
4
+ var InstanceLifetimes;
5
+ (function (InstanceLifetimes) {
6
+ InstanceLifetimes[InstanceLifetimes["Transient"] = 0] = "Transient";
7
+ InstanceLifetimes[InstanceLifetimes["Singleton"] = 1] = "Singleton";
8
+ InstanceLifetimes[InstanceLifetimes["Scoped"] = 2] = "Scoped";
9
+ })(InstanceLifetimes || (exports.InstanceLifetimes = InstanceLifetimes = {}));
@@ -12,6 +12,7 @@ require("./Equals"); // ensure execute code in equals first
12
12
  * Class to create a guid
13
13
  */
14
14
  class Guid {
15
+ static { this._empty = new Guid("00000000-0000-0000-0000-000000000000"); }
15
16
  static newGuid() {
16
17
  return new Guid("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
17
18
  const r = Math.random() * 16 | 0;
@@ -57,7 +58,6 @@ class Guid {
57
58
  }
58
59
  }
59
60
  exports.Guid = Guid;
60
- Guid._empty = new Guid("00000000-0000-0000-0000-000000000000");
61
61
  // only add extension methods when running in browser, not in node.js
62
62
  if (globalThis.omnia) {
63
63
  Object.defineProperty(String.prototype["equals"], "guid", {
@@ -0,0 +1,23 @@
1
+ export interface TopicCreatedFunc<T> {
2
+ (created: IMessageBusTopicPublishSubscriber<T>): void;
3
+ }
4
+ export interface IMessageBusSubscriptionHandler {
5
+ /**
6
+ * Unsubscribe to the related subscription(s)
7
+ * and/or any subscriptions added using add method)
8
+ * */
9
+ unsubscribe(): any;
10
+ /**
11
+ * Adds another unsubscribe handler, all will be unsubscribed to if calling unsubscribe
12
+ * @param unSubscriptionHandler
13
+ */
14
+ add(unSubscriptionHandler: IMessageBusSubscriptionHandler): any;
15
+ }
16
+ export interface IMessageBusTopicSubscription<T> {
17
+ subscribe: (fn: (obj: T) => void) => IMessageBusSubscriptionHandler;
18
+ }
19
+ export interface IMessageBusTopicPublication<T> {
20
+ publish: (msg: T) => void;
21
+ }
22
+ export interface IMessageBusTopicPublishSubscriber<T> extends IMessageBusTopicSubscription<T>, IMessageBusTopicPublication<T> {
23
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HubSource = void 0;
4
4
  class HubSource {
5
+ static { this.Id = "eb4fde5f-4f3e-4c70-9893-3d9e048fda0c"; }
5
6
  }
6
7
  exports.HubSource = HubSource;
7
- HubSource.Id = "eb4fde5f-4f3e-4c70-9893-3d9e048fda0c";
@@ -17,3 +17,5 @@ export * from "./StronglyTypedId";
17
17
  export * from "./theming";
18
18
  export * from "./hub";
19
19
  export * from "./velcron";
20
+ export * from "./DependencyInjection";
21
+ export * from "./Messaging";
@@ -21,3 +21,5 @@ tslib_1.__exportStar(require("./StronglyTypedId"), exports);
21
21
  tslib_1.__exportStar(require("./theming"), exports);
22
22
  tslib_1.__exportStar(require("./hub"), exports);
23
23
  tslib_1.__exportStar(require("./velcron"), exports);
24
+ tslib_1.__exportStar(require("./DependencyInjection"), exports);
25
+ tslib_1.__exportStar(require("./Messaging"), exports);
@@ -5,31 +5,25 @@ import { TypographyValue } from "./Typography";
5
5
  export interface BoxDimensions extends Spacing {
6
6
  }
7
7
  import { TypographyBlueprint } from "./Typography";
8
- export type BlueprintType = "chrome" | "typography" | "spacing" | "component";
9
8
  export interface Blueprints {
10
- type: BlueprintType;
11
9
  name?: string;
12
10
  }
13
11
  export type BlueprintVariant = "primary" | "secondary" | "variant1" | "variant2" | "variant3";
14
12
  export type ButtonBlueprintType = "text" | "icon";
15
13
  export interface ChromeBlueprints extends Blueprints {
16
- type: "chrome";
17
14
  primary: ChromeBlueprint;
18
15
  variant1?: ChromeBlueprint;
19
16
  variant2?: ChromeBlueprint;
20
17
  variant3?: ChromeBlueprint;
21
18
  }
22
19
  export interface TypographyBlueprints extends Blueprints {
23
- type: "typography";
24
20
  primary: TypographyBlueprint;
25
21
  }
26
22
  export interface SpacingBlueprints extends Blueprints {
27
- type: "spacing";
28
23
  primary: SpacingBlueprint;
29
24
  }
30
25
  export type ButtonTypes = "primary" | "basic" | "accent1" | "warn" | "disabled" | "link";
31
26
  export interface ComponentBlueprints extends Blueprints {
32
- type: "component";
33
27
  buttons?: {
34
28
  text?: {
35
29
  primary?: ButtonBlueprint;
@@ -1,5 +1,5 @@
1
1
  import { Guid } from "../Guid";
2
- import { Blueprints, BoxDimensions } from "./Blueprints";
2
+ import { BoxDimensions, ChromeBlueprints, ComponentBlueprints, SpacingBlueprints, TypographyBlueprints } from "./Blueprints";
3
3
  export interface ColorTypeResult<resultType> {
4
4
  base: resultType;
5
5
  baseTone: resultType;
@@ -41,10 +41,12 @@ export interface ColorSchemas {
41
41
  }
42
42
  export interface ThemeDefinitionV2 {
43
43
  id: Guid;
44
- name: string;
45
- dark: boolean;
44
+ name?: string;
46
45
  colors: ColorSchemas;
47
- blueprints: Blueprints[];
46
+ typography: TypographyBlueprints;
47
+ spacing: SpacingBlueprints;
48
+ chrome: ChromeBlueprints;
49
+ components: ComponentBlueprints;
48
50
  }
49
51
  export type ColorSchemaType = keyof typeof ColorSchemaTypes;
50
52
  export declare enum ColorSchemaTypes {
@@ -1,8 +1,6 @@
1
1
  import { ColorDefinition, ColorSchema, ColorSchemaType, ColorSchemaTypes, ColorType, ColorTypes } from "./ThemeDefinitionV2";
2
- import { Blueprints, BlueprintType } from "./Blueprints";
3
2
  export declare function useThemeMethods(getThemeDefinition: () => any): {
4
3
  colorSchema: (colorSchemaType: ColorSchemaTypes | ColorSchemaType) => ColorSchema;
5
- bluePrintbyType: <TType extends Blueprints>(type: BlueprintType) => TType;
6
4
  color: (colorSchemaType: ColorSchemaTypes | ColorSchemaType, colorType: ColorTypes | ColorType) => string;
7
5
  colorDefinition: (colorSchemaType: ColorSchemaTypes | ColorSchemaType, colorType: ColorTypes | ColorType) => ColorDefinition;
8
6
  complementaryColorType: (colorType: ColorTypes | ColorType) => ColorTypes;
@@ -5,9 +5,6 @@ exports.useThemeMethods = void 0;
5
5
  const ThemeDefinitionV2_1 = require("./ThemeDefinitionV2");
6
6
  // temp change ThemeDefinitionInstance to any because fx/shared can't reference higher level fx/ux
7
7
  function useThemeMethods(getThemeDefinition) {
8
- function bluePrintbyType(type) {
9
- return getThemeDefinition().blueprints.find(x => x.type === type);
10
- }
11
8
  function colorSchema(colorSchemaType) {
12
9
  if (colorSchemaType === ThemeDefinitionV2_1.ColorSchemaTypes.primary) {
13
10
  return getThemeDefinition().colors.primary;
@@ -92,7 +89,6 @@ function useThemeMethods(getThemeDefinition) {
92
89
  }
93
90
  return {
94
91
  colorSchema,
95
- bluePrintbyType,
96
92
  color,
97
93
  colorDefinition,
98
94
  complementaryColorType,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/velcron",
3
3
  "license": "MIT",
4
- "version": "8.0.127-dev",
4
+ "version": "8.0.129-dev",
5
5
  "description": "Provide Omnia Velcron Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -9,6 +9,9 @@ const builtInHandlers = tslib_1.__importStar(require("../actions"));
9
9
  const ActionResults_1 = require("../actions/ActionResults");
10
10
  const VelcronLogger_1 = require("./VelcronLogger");
11
11
  class VelcronActions {
12
+ static { this._actionHandlers = {}; }
13
+ static { this.actionHooks = {}; }
14
+ static { this.registeredBuiltInHandlers = false; }
12
15
  static registerAction(handler) {
13
16
  const name = handler.name.toLowerCase();
14
17
  if (this._actionHandlers && this._actionHandlers[name]) {
@@ -357,7 +360,7 @@ class VelcronActions {
357
360
  return template;
358
361
  }
359
362
  static registerActionHook(actionName, handler) {
360
- VelcronActions.actionHooks ?? (VelcronActions.actionHooks = {});
363
+ VelcronActions.actionHooks ??= {};
361
364
  VelcronActions.actionHooks[actionName] = handler;
362
365
  }
363
366
  static tryTriggerBeforeActionHook(actionName, args) {
@@ -457,9 +460,6 @@ class VelcronActions {
457
460
  }
458
461
  }
459
462
  exports.VelcronActions = VelcronActions;
460
- VelcronActions._actionHandlers = {};
461
- VelcronActions.actionHooks = {};
462
- VelcronActions.registeredBuiltInHandlers = false;
463
463
  var VelcronActionParameterDataType;
464
464
  (function (VelcronActionParameterDataType) {
465
465
  VelcronActionParameterDataType[VelcronActionParameterDataType["text"] = 0] = "text";
@@ -94,6 +94,7 @@ class VelcronData {
94
94
  const evalResult = Function(...names, "\"use strict\";return " + template)(...obj);
95
95
  return evalResult;
96
96
  }
97
+ static { this.variables = {}; }
97
98
  static deleteVariables(id) {
98
99
  if (VelcronData.variables[id]) {
99
100
  delete VelcronData.variables[id];
@@ -639,4 +640,3 @@ class VelcronData {
639
640
  }
640
641
  }
641
642
  exports.VelcronData = VelcronData;
642
- VelcronData.variables = {};
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VelcronPropertyEditors = void 0;
4
4
  class VelcronPropertyEditors {
5
+ static { this.editors = {}; }
5
6
  static registerEditor(type, editor) {
6
7
  type = type.toLowerCase();
7
8
  if (!this.editors[type]) {
@@ -37,4 +38,3 @@ class VelcronPropertyEditors {
37
38
  }
38
39
  }
39
40
  exports.VelcronPropertyEditors = VelcronPropertyEditors;
40
- VelcronPropertyEditors.editors = {};
@@ -4,6 +4,8 @@ exports.VelcronRenderers = void 0;
4
4
  const VelcronData_1 = require("./VelcronData");
5
5
  const __1 = require("..");
6
6
  class VelcronRenderers {
7
+ static { this.components = {}; }
8
+ static { this.referenceResolvers = {}; }
7
9
  static registerComponent(type, component) {
8
10
  type = type.toLowerCase();
9
11
  if (!this.components[type]) {
@@ -139,5 +141,3 @@ class VelcronRenderers {
139
141
  }
140
142
  }
141
143
  exports.VelcronRenderers = VelcronRenderers;
142
- VelcronRenderers.components = {};
143
- VelcronRenderers.referenceResolvers = {};
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReactivitySystem = void 0;
4
4
  class ReactivitySystem {
5
+ static { this.makeReactive = null; }
6
+ static { this.hasReactivityProvider = false; }
5
7
  static registerProvider(fn) {
6
8
  ReactivitySystem.makeReactive = fn;
7
9
  ReactivitySystem.hasReactivityProvider = true;
8
10
  }
9
11
  }
10
12
  exports.ReactivitySystem = ReactivitySystem;
11
- ReactivitySystem.makeReactive = null;
12
- ReactivitySystem.hasReactivityProvider = false;
@@ -14,7 +14,7 @@ export declare const useVelcronColorSchemaStore: (newStateWithName?: string) =>
14
14
  currentTheme: import("@omnia/fx-models").ThemeDefinitionV2;
15
15
  };
16
16
  get: {
17
- componentBlueprints: (blueprintType: import("@omnia/fx-models").VelcronBlueprintDefintionTypes) => import("@omnia/fx-models").ComponentBlueprints;
17
+ componentBlueprints: () => void;
18
18
  colorSchema: (colorSchemaType: "info" | "error" | ColorSchemaTypes | "primary" | "secondary" | "accent1" | "accent2" | "accent3" | "neutral" | "background" | "dynamic") => ColorSchema;
19
19
  spacing: () => import("@omnia/fx-models").SpacingDefinition;
20
20
  typography: (typographyType: "title" | "text" | "navigation" | import("@omnia/fx-models").TypographyTypes, size: "xs" | "s" | "m" | "l" | "xl" | import("@omnia/fx-models").TypographySizes) => any;
@@ -1,12 +1,12 @@
1
- import { ColorSchemaType, ColorSchemaTypes, ColorType, ColorTypes, ComponentBlueprints, SpacingDefinition, ThemeDefinitionV2, TypographySize, TypographySizes, TypographyType, TypographyTypes, VelcronBlueprintDefintionTypes } 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
5
  };
6
6
  get: {
7
- componentBlueprints: (blueprintType: VelcronBlueprintDefintionTypes) => ComponentBlueprints;
7
+ componentBlueprints: () => void;
8
8
  colorSchema: (colorSchemaType: ColorSchemaTypes | ColorSchemaType) => import("..").ColorSchema;
9
- spacing: () => SpacingDefinition;
9
+ spacing: () => import("..").SpacingDefinition;
10
10
  typography: (typographyType: TypographyTypes | TypographyType, size: TypographySizes | TypographySize) => any;
11
11
  color: (colorSchemaType: ColorSchemaTypes | ColorSchemaType, colorType: ColorTypes | ColorType) => string;
12
12
  colorDefinition: (colorSchemaType: ColorSchemaTypes | ColorSchemaType, colorType: ColorTypes | ColorType) => import("..").ColorDefinition;
@@ -13,17 +13,17 @@ exports.useVelcronThemingStore = (0, _1.defineVelcronStore)("VelcronTheming", {
13
13
  },
14
14
  getters(state) {
15
15
  return {
16
- componentBlueprints: (blueprintType) => {
17
- return (0, __1.useThemeMethods)(() => state.currentTheme).bluePrintbyType("component");
16
+ componentBlueprints: () => {
17
+ state.currentTheme.components;
18
18
  },
19
19
  colorSchema: (colorSchemaType) => {
20
20
  return (0, __1.useThemeMethods)(() => state.currentTheme).colorSchema(colorSchemaType);
21
21
  },
22
22
  spacing: () => {
23
- return (0, __1.useThemeMethods)(() => state.currentTheme).bluePrintbyType("spacing").primary.inner;
23
+ return state.currentTheme.spacing.primary.inner;
24
24
  },
25
25
  typography: (typographyType, size) => {
26
- const typography = (0, __1.useThemeMethods)(() => state.currentTheme).bluePrintbyType("typography").primary;
26
+ const typography = state.currentTheme.typography.primary;
27
27
  if (typographyType === __1.TypographyTypes.text) {
28
28
  return typography.text[size];
29
29
  }