eligius 1.0.7 → 1.0.9

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 (37) hide show
  1. package/README.md +2 -2
  2. package/dist/controllers/label-controller.d.ts +5 -2
  3. package/dist/controllers/lottie-controller.d.ts +2 -2
  4. package/dist/controllers/navigation-controller.d.ts +2 -2
  5. package/dist/controllers/progressbar-controller.d.ts +2 -2
  6. package/dist/controllers/routing-controller.d.ts +2 -2
  7. package/dist/controllers/subtitles-controller.d.ts +2 -2
  8. package/dist/diagnostics/types.d.ts +22 -2
  9. package/dist/eligius-engine.d.ts +19 -7
  10. package/dist/eligius.cjs.development.js +529 -390
  11. package/dist/eligius.cjs.development.js.map +1 -1
  12. package/dist/eligius.cjs.production.min.js +1 -1
  13. package/dist/eligius.cjs.production.min.js.map +1 -1
  14. package/dist/eligius.esm.js +527 -390
  15. package/dist/eligius.esm.js.map +1 -1
  16. package/dist/engine-factory.d.ts +5 -5
  17. package/dist/eventbus/eventbus.d.ts +5 -5
  18. package/dist/eventbus/types.d.ts +5 -5
  19. package/dist/language-manager.d.ts +4 -3
  20. package/dist/operation/calc.d.ts +1 -1
  21. package/dist/operation/create-element.d.ts +0 -1
  22. package/dist/operation/get-controller-instance.d.ts +1 -3
  23. package/dist/operation/get-query-params.d.ts +28 -0
  24. package/dist/operation/index.d.ts +2 -0
  25. package/dist/operation/invoke-object-method.d.ts +15 -0
  26. package/dist/operation/load-json.d.ts +2 -3
  27. package/dist/operation/math.d.ts +1 -1
  28. package/dist/operation/metadata/get-query-params.d.ts +4 -0
  29. package/dist/operation/metadata/index.d.ts +2 -0
  30. package/dist/operation/metadata/invoke-object-method.d.ts +4 -0
  31. package/dist/operation/metadata/types.d.ts +1 -1
  32. package/dist/operation/remove-properties-from-operation-data.d.ts +1 -0
  33. package/dist/operation/select-element.d.ts +2 -3
  34. package/dist/operation/set-style.d.ts +4 -4
  35. package/dist/operation/start-loop.d.ts +2 -3
  36. package/dist/types.d.ts +42 -3
  37. package/package.json +3 -2
@@ -1,11 +1,11 @@
1
1
  import { IEngineConfiguration } from './configuration/types';
2
2
  import { IConfigurationResolver, IEligiusEngine, IEngineFactory, IEngineFactoryOptions, ISimpleResourceImporter } from './types';
3
3
  export declare class EngineFactory implements IEngineFactory {
4
- private resizeTimeout;
5
- private actionsLookup;
6
- private importer;
7
- private eventbus;
8
- private _handleSpaceBound;
4
+ private _actionsLookup;
5
+ private _eventbus;
6
+ private _eventRemovers;
7
+ private _importer;
8
+ private _resizeTimeout;
9
9
  constructor(importer: ISimpleResourceImporter, windowRef: Window, options?: IEngineFactoryOptions);
10
10
  private _handleSpacePress;
11
11
  private _initializeDevtools;
@@ -1,4 +1,4 @@
1
- import { IEventbus, IEventbusInterceptor, IEventbusListener, TEventHandler, TEventHandlerRemover } from './types';
1
+ import { IEventbus, IEventbusInterceptor, IEventbusListener, TEventbusRemover, TEventHandler } from './types';
2
2
  export declare class Eventbus implements IEventbus {
3
3
  private eventHandlers;
4
4
  private eventInterceptors;
@@ -7,12 +7,12 @@ export declare class Eventbus implements IEventbus {
7
7
  clear(): void;
8
8
  _getEventInterceptors(eventName: string, eventTopic?: string): IEventbusInterceptor[];
9
9
  _getEventHandlers(eventName: string, eventTopic?: string): TEventHandler[];
10
- on(eventName: string, eventHandler: TEventHandler, eventTopic?: string): TEventHandlerRemover;
11
- once(eventName: string, eventHandler: TEventHandler, eventTopic?: string): void;
10
+ on(eventName: string, eventHandler: TEventHandler, eventTopic?: string): TEventbusRemover;
11
+ once(eventName: string, eventHandler: TEventHandler, eventTopic?: string): TEventbusRemover;
12
12
  off(eventName: string, eventHandler: TEventHandler, eventTopic?: string): void;
13
13
  broadcast(eventName: string, args: any[]): void;
14
14
  broadcastForTopic(eventName: string, eventTopic: string, args: any[]): void;
15
- registerEventlistener(eventbusListener: IEventbusListener): void;
16
- registerInterceptor(eventName: string, interceptor: IEventbusInterceptor, eventTopic?: string): void;
15
+ registerEventlistener(eventbusListener: IEventbusListener): TEventbusRemover;
16
+ registerInterceptor(eventName: string, interceptor: IEventbusInterceptor, eventTopic?: string): TEventbusRemover;
17
17
  _callHandlers(eventName: string, eventTopic: string | undefined, args?: any): void;
18
18
  }
@@ -1,14 +1,14 @@
1
1
  export declare type TEventHandler = (...args: any[]) => void;
2
- export declare type TEventHandlerRemover = () => void;
2
+ export declare type TEventbusRemover = () => void;
3
3
  export interface IEventbus {
4
4
  clear(): void;
5
- on(eventName: string, eventHandler: TEventHandler, eventTopic?: string): TEventHandlerRemover;
5
+ on(eventName: string, eventHandler: TEventHandler, eventTopic?: string): TEventbusRemover;
6
6
  off(eventName: string, eventHandler: TEventHandler, eventTopic?: string): void;
7
- once(eventName: string, eventHandler: TEventHandler, eventTopic?: string): void;
7
+ once(eventName: string, eventHandler: TEventHandler, eventTopic?: string): TEventbusRemover;
8
8
  broadcast(eventName: string, args?: any[]): void;
9
9
  broadcastForTopic(eventName: string, eventTopic: string, args?: any[]): void;
10
- registerEventlistener(eventbusListener: IEventbusListener): void;
11
- registerInterceptor(eventName: string, interceptor: IEventbusInterceptor, eventTopic?: string): void;
10
+ registerEventlistener(eventbusListener: IEventbusListener): TEventbusRemover;
11
+ registerInterceptor(eventName: string, interceptor: IEventbusInterceptor, eventTopic?: string): TEventbusRemover;
12
12
  }
13
13
  export interface IEventbusListener {
14
14
  handleEvent(eventName: string, eventTopic: string | undefined, args: any[]): void;
@@ -1,11 +1,12 @@
1
1
  import { IEventbus } from './eventbus/types';
2
- import { ILanguageLabel, TResultCallback } from './types';
2
+ import { ILabel, ILanguageLabel, TResultCallback } from './types';
3
3
  export declare class LanguageManager {
4
4
  private _currentLanguage;
5
5
  private _eventbus;
6
6
  private _labelLookup;
7
- private _eventbusListeners;
7
+ private _eventbusRemovers;
8
8
  constructor(_currentLanguage: string, labels: ILanguageLabel[], _eventbus: IEventbus);
9
+ destroy(): void;
9
10
  _addEventbusListeners(eventbus: IEventbus): void;
10
11
  _handleRequestCurrentLanguage(resultCallback: TResultCallback): void;
11
12
  _handleRequestLabelCollection(labelId: string, resultCallback: TResultCallback): void;
@@ -13,5 +14,5 @@ export declare class LanguageManager {
13
14
  _handleLanguageChange(language: string): void;
14
15
  _setRootElementLang(language: string): void;
15
16
  _extractLanguageFromCulture(culture: string): string;
16
- _createLabelLookup(labels: ILanguageLabel[]): void;
17
+ _createLabelLookup(labels: ILanguageLabel[]): Record<string, ILabel[]>;
17
18
  }
@@ -4,7 +4,7 @@ export interface ICalcOperationData {
4
4
  left: string | number;
5
5
  right: string | number;
6
6
  operator: TCalculationOperator;
7
- propertyName?: string;
7
+ calculationResult?: number;
8
8
  }
9
9
  /**
10
10
  * This operation calculates the given left and right hand sides using the specified operator.
@@ -5,7 +5,6 @@ export interface ICreateElementOperationData<T extends TTagNames> {
5
5
  elementName: T;
6
6
  text?: string;
7
7
  attributes?: Partial<HTMLElementTagNameMap[T]>;
8
- propertyName?: string;
9
8
  template?: JQuery;
10
9
  }
11
10
  /**
@@ -4,13 +4,11 @@ import { TOperation } from './types';
4
4
  declare type TSystemName = keyof typeof controllers;
5
5
  export interface IGetControllerInstanceOperationData {
6
6
  systemName: TSystemName;
7
- propertyName?: string;
8
7
  controllerInstance?: IController<unknown>;
9
8
  }
10
9
  /**
11
10
  * This operation retrieves an instance of the given controller name.
12
- * It assigns this instance to the property on the current operation data
13
- * defined by the propertyName property which defaults to 'controllerInstance'.
11
+ * It assigns this instance to the `controllerInstance` property on the current operation data
14
12
  *
15
13
  * @param operationData
16
14
  * @returns
@@ -0,0 +1,28 @@
1
+ import { TOperation } from './types';
2
+ export interface IGetQueryParamsOperationData {
3
+ /**
4
+ * The query params will be added as property/values to this object.
5
+ * So, the query string `?foo=bar&bar=foo` will result in:
6
+ * ```json
7
+ * {
8
+ * foo: "bar",
9
+ * bar: "foo"
10
+ * }
11
+ * ```
12
+ * This object will be assigned to the `queryParams` property.
13
+ */
14
+ queryParams?: Record<string, string>;
15
+ /**
16
+ * The properties on this object will be assigned to the queryParams result
17
+ * when the given property name is not part of the query string.
18
+ */
19
+ defaultValues?: Record<string, string>;
20
+ }
21
+ /**
22
+ * This operation retrieves the current query parameters from the browser's address bar and places
23
+ * them on the returned operation data.
24
+ *
25
+ * @param operationData
26
+ * @returns
27
+ */
28
+ export declare const getQueryParams: TOperation<IGetQueryParamsOperationData>;
@@ -15,6 +15,8 @@ export { getControllerFromElement } from './get-controller-from-element';
15
15
  export { getControllerInstance } from './get-controller-instance';
16
16
  export { getElementDimensions } from './get-element-dimensions';
17
17
  export { getImport } from './get-import';
18
+ export { getQueryParams } from './get-query-params';
19
+ export { invokeObjectMethod } from './invoke-object-method';
18
20
  export { loadJSON } from './load-json';
19
21
  export { log } from './log';
20
22
  export { math } from './math';
@@ -0,0 +1,15 @@
1
+ import { TOperation } from './types';
2
+ export interface IInvokeObjectMethodOperationData {
3
+ instance: any;
4
+ methodName: string;
5
+ methodArguments?: any[];
6
+ methodResult?: any;
7
+ }
8
+ /**
9
+ * This operation invokes the specified method on the given object with the optional specified arguments
10
+ * and assigns the result to the `methodResult` property.
11
+ *
12
+ * @param operationData
13
+ * @returns
14
+ */
15
+ export declare const invokeObjectMethod: TOperation<IInvokeObjectMethodOperationData>;
@@ -2,14 +2,13 @@ import { TOperation } from './types';
2
2
  export interface ILoadJSONOperationData {
3
3
  url: string;
4
4
  cache: boolean;
5
- propertyName?: string;
6
5
  json?: any;
7
6
  }
8
7
  export declare const clearCache: () => void;
9
8
  export declare const addToCache: (key: string, value: any) => void;
10
9
  /**
11
- * This operation loads a JSON file from the specified url and assigns it to the specified
12
- * property name on the current operation data. The property name defaults to 'json'.
10
+ * This operation loads a JSON file from the specified url and assigns it to the json
11
+ * property on the current operation data.
13
12
  *
14
13
  * If the cache property is set to true and a cached value already exists, this is assigned
15
14
  * instead of re-retrieving it from the url.
@@ -2,7 +2,7 @@ import { TOperation } from './types';
2
2
  export interface IMathOperationData {
3
3
  args: (number | string | keyof Math)[];
4
4
  functionName: keyof Math;
5
- propertyName?: string;
5
+ mathResult?: number;
6
6
  }
7
7
  /**
8
8
  * This operation performs the given math function of the specified arguments.
@@ -0,0 +1,4 @@
1
+ import { IGetQueryParamsOperationData } from '../get-query-params';
2
+ import { IOperationMetadata } from './types';
3
+ declare function getQueryParams(): IOperationMetadata<IGetQueryParamsOperationData>;
4
+ export default getQueryParams;
@@ -15,6 +15,8 @@ export { default as getControllerFromElement } from './get-controller-from-eleme
15
15
  export { default as getControllerInstance } from './get-controller-instance';
16
16
  export { default as getElementDimensions } from './get-element-dimensions';
17
17
  export { default as getImport } from './get-import';
18
+ export { default as getQueryParams } from './get-query-params';
19
+ export { default as invokeObjectMethod } from './invoke-object-method';
18
20
  export { default as loadJSON } from './load-json';
19
21
  export { default as log } from './log';
20
22
  export { default as math } from './math';
@@ -0,0 +1,4 @@
1
+ import { IInvokeObjectMethodOperationData } from '../invoke-object-method';
2
+ import { IOperationMetadata } from './types';
3
+ declare function invokeObjectMethod(): IOperationMetadata<IInvokeObjectMethodOperationData>;
4
+ export default invokeObjectMethod;
@@ -26,4 +26,4 @@ export interface IOperationMetadata<T> {
26
26
  properties?: TPropertiesMetadata<T>;
27
27
  outputProperties?: TPropertiesMetadata<T>;
28
28
  }
29
- export declare type TParameterTypes = 'ParameterType:htmlElementName' | 'ParameterType:className' | 'ParameterType:selector' | 'ParameterType:string' | 'ParameterType:integer' | 'ParameterType:object' | 'ParameterType:boolean' | 'ParameterType:array' | 'ParameterType:eventTopic' | 'ParameterType:eventName' | 'ParameterType:systemName' | 'ParameterType:actionName' | 'ParameterType:controllerName' | 'ParameterType:dimensions' | 'ParameterType:dimensionsModifier' | 'ParameterType:url' | 'ParameterType:htmlContent' | 'ParameterType:labelId' | 'ParameterType:ImagePath' | 'ParameterType:QuadrantPosition';
29
+ export declare type TParameterTypes = 'ParameterType:htmlElementName' | 'ParameterType:className' | 'ParameterType:selector' | 'ParameterType:string' | 'ParameterType:number' | 'ParameterType:object' | 'ParameterType:boolean' | 'ParameterType:array' | 'ParameterType:eventTopic' | 'ParameterType:eventName' | 'ParameterType:systemName' | 'ParameterType:actionName' | 'ParameterType:controllerName' | 'ParameterType:dimensions' | 'ParameterType:dimensionsModifier' | 'ParameterType:url' | 'ParameterType:htmlContent' | 'ParameterType:labelId' | 'ParameterType:ImagePath' | 'ParameterType:QuadrantPosition' | 'ParameterType:jQuery';
@@ -4,6 +4,7 @@ export interface IRemovePropertiesFromOperationDataOperationData {
4
4
  }
5
5
  /**
6
6
  * This operation removes the given list of properties from the current operation data.
7
+ * It will also omit the property 'propertyNames' from the result.
7
8
  *
8
9
  * @param operationData
9
10
  * @returns
@@ -2,7 +2,6 @@
2
2
  import { TOperation } from './types';
3
3
  export interface ISelectElementOperationData {
4
4
  selector: string;
5
- propertyName?: string;
6
5
  useSelectedElementAsRoot?: boolean;
7
6
  selectedElement?: JQuery;
8
7
  }
@@ -10,8 +9,8 @@ export interface ISelectElementOperationData {
10
9
  * This operation selects one or more elements using the specified selector.
11
10
  *
12
11
  * If useSelectedElementAsRoot is set to true and a valid DOM element is assigned
13
- * to the current operation data defined by the given property name (defaults to 'selectedElement')
14
- * then the element will be looked for only in the child elements of this DOM element.
12
+ * to the current operation data's `selectedElement` property
13
+ * then the element will be looked for only in the descendant elements of this DOM element.
15
14
  *
16
15
  * @param operationData
17
16
  * @returns
@@ -1,13 +1,13 @@
1
+ /// <reference types="jquery" />
1
2
  import { TOperation } from './types';
2
3
  export interface ISetStyleOperationData {
3
- properties: any;
4
- propertyName?: string;
4
+ properties: Record<string, unknown>;
5
+ selectedElement: JQuery;
5
6
  }
6
7
  /**
7
8
  * This operation assigns the specified CSS style properties to the
8
9
  * specified selected element. The selected element is assigned to
9
- * the property defined by the propertyName property which defaults
10
- * to 'selectedElement'.
10
+ * the `selectedElement` property.
11
11
  *
12
12
  * @param operationData
13
13
  * @returns
@@ -1,14 +1,13 @@
1
1
  import { TOperation } from './types';
2
2
  export declare type TStartLoopOperationData = {
3
3
  collection: any[] | string;
4
- propertyName?: string;
4
+ currentItem: any;
5
5
  };
6
6
  /**
7
7
  * This operation starts a loop using the given collection.
8
8
  *
9
9
  * Each iteration the current item from the specified collection is
10
- * assigned to the property on the current operation data specified
11
- * by the propertyName property which defaults to 'currentItem'.
10
+ * assigned to the `currentItem` property on the current operation data.
12
11
  *
13
12
  * @param operationData
14
13
  * @returns
package/dist/types.d.ts CHANGED
@@ -2,20 +2,49 @@ import { IAction } from './action/types';
2
2
  import { IEngineConfiguration, IResolvedEngineConfiguration } from './configuration/types';
3
3
  import { IEventbus, IEventbusListener } from './eventbus/types';
4
4
  import { ITimelineProvider } from './timelineproviders/types';
5
+ export declare type KeysOfType<T, U, B = false> = {
6
+ [P in keyof T]: B extends true ? T[P] extends U ? U extends T[P] ? P : never : never : T[P] extends U ? P : never;
7
+ }[keyof T];
8
+ /**
9
+ * Describes an object that is capable of processing the given configuration and constructing an IEligiusEngine
10
+ * based on this configuration.
11
+ */
5
12
  export interface IEngineFactory {
13
+ /**
14
+ * Returns a fully configured IEligiusEngine instance.
15
+ *
16
+ * @param engineConfig The given configuration
17
+ * @param resolver An optional resolver to process the given IEngineConfiguration. When not provided the IEngineFactory is expected to create their own instance.
18
+ */
6
19
  createEngine(engineConfig: IEngineConfiguration, resolver?: IConfigurationResolver): IEligiusEngine;
7
20
  }
8
21
  export interface IEngineFactoryOptions {
9
22
  eventbus?: IEventbus;
10
23
  devtools?: boolean;
11
24
  }
25
+ /**
26
+ * Describes an object that is play one or more timelines, defined by a given set of ITimelineProviders.
27
+ */
12
28
  export interface IEligiusEngine {
29
+ /**
30
+ * Do the preparations needed in order to run the given timelines.
31
+ */
13
32
  init(): Promise<ITimelineProvider>;
33
+ /**
34
+ * Do the necessary cleanup before discarding this instance.
35
+ */
14
36
  destroy(): Promise<void>;
15
37
  }
38
+ /**
39
+ * Describes an object that acts as a registry for imported resources.
40
+ */
16
41
  export interface ISimpleResourceImporter {
17
42
  import(name: string): Record<string, any>;
18
43
  }
44
+ /**
45
+ * Describes an object that acts as a registry for imported resources and
46
+ * is able to return all of the registered operation, controller and provider names.
47
+ */
19
48
  export interface IResourceImporter extends ISimpleResourceImporter {
20
49
  getOperationNames(): string[];
21
50
  getControllerNames(): string[];
@@ -25,15 +54,25 @@ export interface IConfigurationResolver {
25
54
  process(configuration: IEngineConfiguration, actionRegistryListener?: IEventbusListener): [Record<string, IAction>, IResolvedEngineConfiguration];
26
55
  }
27
56
  export declare type TResultCallback = (result: any) => void;
57
+ /**
58
+ * Describes a duration of time expressed in a start and an optional end range with a one second interval.
59
+ */
28
60
  export interface IDuration {
29
61
  start: number;
30
62
  end?: number;
31
63
  }
32
- export interface IStrictDuration {
33
- start: number;
34
- end: number;
64
+ /**
65
+ * Describes a duration of time expressed in a start and an end range with a one second interval.
66
+ */
67
+ export interface IStrictDuration extends Required<IDuration> {
35
68
  }
69
+ /**
70
+ * Describes the different kinds of timeline providers.
71
+ */
36
72
  export declare type TimelineTypes = 'animation' | 'mediaplayer';
73
+ /**
74
+ *
75
+ */
37
76
  export interface ITimelineProviderInfo {
38
77
  id: string;
39
78
  vendor: string;
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
- "version": "1.0.7",
2
+ "version": "1.0.9",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
+ "homepage": "https://rolandzwaga.github.io/eligius/",
5
6
  "module": "dist/eligius.esm.js",
6
7
  "typings": "dist/index.d.ts",
7
8
  "files": [
@@ -30,7 +31,7 @@
30
31
  "trailingComma": "es5"
31
32
  },
32
33
  "name": "eligius",
33
- "author": "rolandzwaga",
34
+ "author": "Roland Zwaga <rbzwaga@gmail.com>",
34
35
  "size-limit": [
35
36
  {
36
37
  "path": "dist/eligius.cjs.production.min.js",