eligius 1.0.81 → 1.1.0
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.
- package/README.md +16 -7
- package/dist/action/action.d.ts +5 -1
- package/dist/action/endable-action.d.ts +1 -1
- package/dist/action/timeline-action.d.ts +1 -1
- package/dist/build/generate-importer-source-code.d.ts +1 -1
- package/dist/configuration/api/action-creator-factory.d.ts +1 -1
- package/dist/configuration/api/configuration-factory.d.ts +96 -3
- package/dist/configuration/configuration-resolver.d.ts +7 -0
- package/dist/configuration/types.d.ts +8 -0
- package/dist/controllers/event-listener-controller.d.ts +10 -3
- package/dist/controllers/label-controller.d.ts +12 -4
- package/dist/controllers/lottie-controller.d.ts +14 -8
- package/dist/controllers/navigation-controller.d.ts +13 -14
- package/dist/controllers/progressbar-controller.d.ts +9 -6
- package/dist/controllers/routing-controller.d.ts +9 -6
- package/dist/controllers/subtitles-controller.d.ts +1 -1
- package/dist/eligius-engine.d.ts +35 -7
- package/dist/eligius.cjs.development.js +5095 -3574
- package/dist/eligius.cjs.development.js.map +1 -1
- package/dist/eligius.cjs.production.min.js +1 -1
- package/dist/eligius.cjs.production.min.js.map +1 -1
- package/dist/eligius.esm.js +5073 -3572
- package/dist/eligius.esm.js.map +1 -1
- package/dist/engine-factory.d.ts +17 -0
- package/dist/eventbus/actionregistry-eventbus-listener.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/language-manager.d.ts +6 -0
- package/dist/operation/add-controller-to-element.d.ts +5 -5
- package/dist/operation/animate-with-class.d.ts +1 -1
- package/dist/operation/animate.d.ts +2 -2
- package/dist/operation/calc.d.ts +2 -2
- package/dist/operation/clear-element.d.ts +2 -1
- package/dist/operation/clear-operation-data.d.ts +1 -0
- package/dist/operation/create-element.d.ts +2 -4
- package/dist/operation/custom-function.d.ts +1 -1
- package/dist/operation/end-action.d.ts +5 -1
- package/dist/operation/end-loop.d.ts +1 -2
- package/dist/operation/end-when.d.ts +8 -0
- package/dist/operation/get-controller-from-element.d.ts +1 -1
- package/dist/operation/get-controller-instance.d.ts +3 -5
- package/dist/operation/get-element-dimensions.d.ts +2 -2
- package/dist/operation/get-query-params.d.ts +28 -0
- package/dist/operation/helper/find-matching-operation-index.d.ts +35 -0
- package/dist/operation/helper/get-property-chain-value.d.ts +24 -0
- package/dist/operation/helper/globals.d.ts +3 -0
- package/dist/operation/helper/remove-global.d.ts +1 -0
- package/dist/operation/helper/resolve-event-arguments.d.ts +2 -2
- package/dist/operation/helper/resolve-external-property-chain.d.ts +14 -0
- package/dist/operation/helper/resolve-property-chain.d.ts +23 -0
- package/dist/operation/helper/resolve-property-values.d.ts +11 -2
- package/dist/operation/index.d.ts +6 -0
- package/dist/operation/invoke-object-method.d.ts +28 -0
- package/dist/operation/load-json.d.ts +11 -3
- package/dist/operation/log.d.ts +3 -3
- package/dist/operation/math.d.ts +2 -2
- package/dist/operation/metadata/end-when.d.ts +3 -0
- package/dist/operation/metadata/get-query-params.d.ts +4 -0
- package/dist/operation/metadata/index.d.ts +6 -0
- package/dist/operation/metadata/invoke-object-method.d.ts +4 -0
- package/dist/operation/metadata/otherwise.d.ts +3 -0
- package/dist/operation/metadata/set-global-data.d.ts +4 -0
- package/dist/operation/metadata/start-loop.d.ts +2 -2
- package/dist/operation/metadata/types.d.ts +1 -1
- package/dist/operation/metadata/when.d.ts +4 -0
- package/dist/operation/otherwise.d.ts +9 -0
- package/dist/operation/remove-class.d.ts +1 -1
- package/dist/operation/remove-controller-from-element.d.ts +1 -1
- package/dist/operation/remove-element.d.ts +1 -1
- package/dist/operation/remove-properties-from-operation-data.d.ts +1 -0
- package/dist/operation/reparent-element.d.ts +2 -2
- package/dist/operation/request-action.d.ts +1 -1
- package/dist/operation/select-element.d.ts +3 -4
- package/dist/operation/set-element-attributes.d.ts +1 -1
- package/dist/operation/set-element-content.d.ts +4 -4
- package/dist/operation/set-global-data.d.ts +11 -0
- package/dist/operation/set-operation-data.d.ts +1 -1
- package/dist/operation/set-style.d.ts +4 -5
- package/dist/operation/start-action.d.ts +3 -3
- package/dist/operation/start-loop.d.ts +7 -6
- package/dist/operation/toggle-class.d.ts +10 -1
- package/dist/operation/toggle-element.d.ts +7 -1
- package/dist/operation/types.d.ts +45 -3
- package/dist/operation/wait.d.ts +3 -3
- package/dist/operation/when.d.ts +18 -0
- package/dist/timeline-event-names.d.ts +46 -2
- package/dist/timelineproviders/index.d.ts +0 -1
- package/dist/timelineproviders/media-element-timeline-provider.d.ts +20 -12
- package/dist/timelineproviders/request-animation-frame-timeline-provider.d.ts +19 -20
- package/dist/timelineproviders/types.d.ts +10 -2
- package/dist/{schema-tools/generate-operation-schemas.d.ts → tools/doc-tools/generate-readmes.d.ts} +0 -0
- package/dist/tools/schema-tools/generate-operation-schemas.d.ts +1 -0
- package/dist/{schema-tools → tools/schema-tools}/html-tag-names.d.ts +0 -0
- package/dist/types.d.ts +42 -3
- package/dist/util/guards/is-function.d.ts +1 -0
- package/dist/util/guards/is-object.d.ts +1 -0
- package/dist/util/guards/is-promise.d.ts +1 -0
- package/dist/util/guards/is-string.d.ts +1 -0
- package/package.json +18 -12
- package/dist/action/is-promise.d.ts +0 -1
- package/dist/operation/helper/extract-operation-data-argument-values.d.ts +0 -1
- package/dist/operation/helper/get-globals.d.ts +0 -1
- package/dist/operation/helper/get-nested-property-value.d.ts +0 -1
- package/dist/operation/helper/get-nested-value.d.ts +0 -1
- package/dist/timelineproviders/jwplayer-timeline-provider.d.ts +0 -42
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A Javascript engine that allows arbitrary functionality to be triggered accordin
|
|
|
4
4
|
|
|
5
5
|
The engine can be the basis for video annotations, presentation software or interactive infographics, for example.
|
|
6
6
|
|
|
7
|
-
Eligius is NOT a game or animation engine.
|
|
7
|
+
Eligius is NOT a game or animation engine, instead, it is a Story Telling Engine.
|
|
8
8
|
|
|
9
9
|
## description
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ The main concepts in Eligius are timelines, actions and operations. A timeline c
|
|
|
12
12
|
|
|
13
13
|
Actions can be called on specified points on such a timeline. An action consists of a list of start and end operations.
|
|
14
14
|
|
|
15
|
-
An operation is an atomic function. A context, for sharing data, is passed between each successive operation. Examples of operations are `select-element`, `create-element` or `add-class`. [Here is a complete list of all available operations.](https://github.com/rolandzwaga/eligius/tree/
|
|
15
|
+
An operation is an atomic function. A context, for sharing data, is passed between each successive operation. Examples of operations are `select-element`, `create-element` or `add-class`. [Here is a complete list of all available operations.](https://github.com/rolandzwaga/eligius/tree/main/src/operation)
|
|
16
16
|
By composing these atomic operations complex functionality can be achieved.
|
|
17
17
|
|
|
18
18
|
An example of an action is adding an removing an image from the stage at specific times. This action would consist of these start operations: `select-element`(to select the image parent), `create-element`(to create the img element with the required src attribute) and `set-element-contents`(to add the img element to the previously selected parent).
|
|
@@ -22,16 +22,16 @@ A more comprehensive example could be, for example, a rich subtitling system for
|
|
|
22
22
|
|
|
23
23
|
## configuration
|
|
24
24
|
|
|
25
|
-
The Eligius engine is populated by a JSON configuration. Think of this JSON as its file format. This configuration contains all of the timelines, actions, operations and other data for the engine to run. A JSON schema for this configuration can be found [here](https://github.
|
|
25
|
+
The Eligius engine is populated by a JSON configuration. Think of this JSON as its file format. This configuration contains all of the timelines, actions, operations and other data for the engine to run. A JSON schema for this configuration can be found [here](https://rolandzwaga.github.io/eligius/jsonschema/eligius-configuration.json).
|
|
26
26
|
|
|
27
27
|
This section describes the different parts of this configuration.
|
|
28
28
|
|
|
29
29
|
### systemName property
|
|
30
30
|
|
|
31
31
|
In the rest of this section the property name `systemName` will be shown often. The value of this property describes a named import.
|
|
32
|
-
Currently one resource importer is supported by default: [`EligiusResourceImporter`](https://github.
|
|
32
|
+
Currently one resource importer is supported by default: [`EligiusResourceImporter`](https://rolandzwaga.github.io/eligius/classes/EligiusResourceImporter.html).
|
|
33
33
|
However, this importer contains all of Eligius classes, function, providers, etc. So, bundling this with a presentation will bloat the bundle.
|
|
34
|
-
Eligius offers a generator function for this: [`generateImporterSourceCode`](https://github.
|
|
34
|
+
Eligius offers a generator function for this: [`generateImporterSourceCode`](https://rolandzwaga.github.io/eligius/functions/generateImporterSourceCode.html). This function is able to generate source code (Typescript) for a custom resource importer based on a given Eligius configuration. This will result in an importer that only includes the code that is referenced in the configuration.
|
|
35
35
|
|
|
36
36
|
### engine
|
|
37
37
|
|
|
@@ -64,7 +64,8 @@ The engine setting defines the engine for which this configuration is written. C
|
|
|
64
64
|
|
|
65
65
|
These settings describe the providers that are availab;e for the different kinds of timelines.
|
|
66
66
|
There are three kinds: `audio`, `video` and `animation`.
|
|
67
|
-
For `
|
|
67
|
+
For `animation` there is `RequestAnimationFrameTimelineProvider`.
|
|
68
|
+
For `audio` and `video` the `MediaElementTimelineProvider` can be used, but unfortunately that class is disabled for now.
|
|
68
69
|
|
|
69
70
|
### container selector
|
|
70
71
|
|
|
@@ -234,7 +235,7 @@ This a list of actions that can be triggered by an event broadcast. Since an eve
|
|
|
234
235
|
### labels
|
|
235
236
|
|
|
236
237
|
A list of label information that describes all of the textual content for the presentation.
|
|
237
|
-
Labels can be rendered by the [`LabelController`](https://github.
|
|
238
|
+
Labels can be rendered by the [`LabelController`](https://rolandzwaga.github.io/eligius/classes/LabelController.html). This controller listens for the appropriate language change events as well, and will change the contents of the element it controls accordingly.
|
|
238
239
|
|
|
239
240
|
```json
|
|
240
241
|
{
|
|
@@ -271,6 +272,14 @@ const engine = factory.createEngine((engineConfig as unknown) as IEngineConfigur
|
|
|
271
272
|
engine.init().then(()=> {console.log('Eligius engine ready for business');});
|
|
272
273
|
```
|
|
273
274
|
|
|
275
|
+
## Configuration API
|
|
276
|
+
|
|
277
|
+
Obviously having to type all of that JSON by hand can be a tad overwhelming and time consuming. Check out the [ConfigurationFactory](https://rolandzwaga.github.io/eligius/classes/ConfigurationFactory.html) for a strongly typed, fluent API to construct a configuration programmatically.
|
|
278
|
+
|
|
279
|
+
## Source documentation
|
|
280
|
+
|
|
281
|
+
[Check out this link for the full type docs](https://rolandzwaga.github.io/eligius/)
|
|
282
|
+
|
|
274
283
|
## installation
|
|
275
284
|
|
|
276
285
|
```sh
|
package/dist/action/action.d.ts
CHANGED
|
@@ -7,7 +7,11 @@ export declare class Action implements IAction {
|
|
|
7
7
|
startOperations: IResolvedOperation[];
|
|
8
8
|
protected eventbus: IEventbus;
|
|
9
9
|
id: string;
|
|
10
|
+
protected _contextStack: IOperationContext[];
|
|
10
11
|
constructor(name: string, startOperations: IResolvedOperation[], eventbus: IEventbus);
|
|
11
12
|
start(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
12
|
-
|
|
13
|
+
protected _initializeContextStack(): void;
|
|
14
|
+
private _pushContext;
|
|
15
|
+
private _popContext;
|
|
16
|
+
executeOperation(operations: IResolvedOperation[], operationIndex: number, resolve: (value?: any | PromiseLike<any>) => void, reject: (reason?: any) => void, previousOperationData?: TOperationData | undefined): void;
|
|
13
17
|
}
|
|
@@ -5,5 +5,5 @@ import { Action } from './action';
|
|
|
5
5
|
export declare class EndableAction extends Action {
|
|
6
6
|
endOperations: IResolvedOperation[];
|
|
7
7
|
constructor(name: string, startOperations: IResolvedOperation[], endOperations: IResolvedOperation[], eventBus: IEventbus);
|
|
8
|
-
end(initOperationData?: TOperationData): Promise<TOperationData
|
|
8
|
+
end(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
9
9
|
}
|
|
@@ -7,6 +7,6 @@ export declare class TimelineAction extends EndableAction {
|
|
|
7
7
|
duration: IStrictDuration;
|
|
8
8
|
active: boolean;
|
|
9
9
|
constructor(name: string, startOperations: IResolvedOperation[], endOperations: IResolvedOperation[], duration: IStrictDuration, eventBus: IEventbus);
|
|
10
|
-
start(initOperationData
|
|
10
|
+
start(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
11
11
|
end(initOperationData: TOperationData): Promise<TOperationData>;
|
|
12
12
|
}
|
|
@@ -4,7 +4,7 @@ export interface IAssetInfo {
|
|
|
4
4
|
extension: string;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* This function takes an Eligius engine configuration, a root path for the
|
|
7
|
+
* This function takes an Eligius engine configuration, a root path for the configuration file and an arbitrary list of asset info.
|
|
8
8
|
* The asset info determines a number of subdirectories in the root path that contain the different assets used by the presentation.
|
|
9
9
|
* I.e. html, json, etc.
|
|
10
10
|
*
|
|
@@ -4,7 +4,7 @@ import { ConfigurationFactory } from './configuration-factory';
|
|
|
4
4
|
export declare class ActionCreatorFactory {
|
|
5
5
|
private readonly configurationfactory;
|
|
6
6
|
constructor(configurationfactory: ConfigurationFactory);
|
|
7
|
-
createAction(name: string):
|
|
7
|
+
createAction(name: string): EndableActionCreator;
|
|
8
8
|
createInitAction(name: string): EndableActionCreator;
|
|
9
9
|
createEventAction(name: string): ActionCreator;
|
|
10
10
|
createTimelineAction(uri: string, name: string): TimelineActionCreator;
|
|
@@ -4,16 +4,107 @@ import { ActionCreatorFactory } from './action-creator-factory';
|
|
|
4
4
|
import { ActionEditor, EndableActionEditor, TimelineActionEditor } from './action-editor';
|
|
5
5
|
import { TimelineProvidersSettingsEditor } from './timeline-provider-settings-editor';
|
|
6
6
|
export declare type TEngineConfigurationLists = Pick<IEngineConfiguration, 'availableLanguages' | 'initActions' | 'actions' | 'eventActions' | 'timelines' | 'labels'>;
|
|
7
|
+
declare type ConfigurationFactoryExtension = (this: ConfigurationFactory, ...rest: any[]) => void;
|
|
8
|
+
/**
|
|
9
|
+
* This class offers a fluent and strongly typed DSL for creating Eligius configurations.
|
|
10
|
+
*
|
|
11
|
+
* @example Building a configuration using the factory
|
|
12
|
+
* To initialize a basic configuration to start off of:
|
|
13
|
+
* ```ts
|
|
14
|
+
* const factory = new ConfigurationFactory()
|
|
15
|
+
* .init("en-US") // Define the default language
|
|
16
|
+
* .addLanguage("en-US", "English") // Add English as a supported language
|
|
17
|
+
* .addLanguage("nl-NL", "Nederlands") // Add Dutch as a supported language
|
|
18
|
+
* .setLayoutTemplate("<div class=\"main.container\"></div>") // Add the main container for the presentation
|
|
19
|
+
* .setContainerSelector("#ct-container") // Selector for the element in the body that will contain the presentation
|
|
20
|
+
* .addTimeline( // Add a first timeline
|
|
21
|
+
* 'timeline-1', // Give it a name
|
|
22
|
+
* "animation", // This is RAF based timeline
|
|
23
|
+
* 200, // The duration of the timeline in seconds
|
|
24
|
+
* false, // The presentation does NOT play in a loop
|
|
25
|
+
* ".timeline-container" // The element within the main layout (defined by the layoutTemplate) in which the timeline will be rendered
|
|
26
|
+
* )
|
|
27
|
+
* .editTimelineProviderSettings() // Add a timeline provider
|
|
28
|
+
* .addProvider("animation") // One that provides timelines for type 'animation'
|
|
29
|
+
* .setSystemName("RequestAnimationFrameTimelineProvider") // The system name of the provider
|
|
30
|
+
* .setVendor("eligius") // Eligius is the vendor in this case
|
|
31
|
+
* .end(); // This finally returns the ConfigurationFactory instance
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* Then to add an init action:
|
|
35
|
+
* ```ts
|
|
36
|
+
* factory
|
|
37
|
+
* .createInitAction("GetUserName")
|
|
38
|
+
* .addStartOperationByType(getQueryParams, {
|
|
39
|
+
* defaultValues: { username: "guest" },
|
|
40
|
+
* })
|
|
41
|
+
* .addStartOperationByType(setGlobalData, { properties: ["queryParams"] });
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* After that, add a timeline action:
|
|
45
|
+
* ```ts
|
|
46
|
+
* factory.createTimelineAction("timeline-1", "AddIntroContainer")
|
|
47
|
+
* .addDuration(0, 10)
|
|
48
|
+
* .addStartOperationByType(selectElement, { selector: ".timeline-container" })
|
|
49
|
+
* .addStartOperationByType(setElementContent, {
|
|
50
|
+
* template: '<div class="intro-text"></div>',
|
|
51
|
+
* })
|
|
52
|
+
* .addEndOperationByType(selectElement, { selector: ".intro-text" })
|
|
53
|
+
* .addEndOperationByType(removeElement, {});
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* It also possible to extend the factory with specialized creation methods for the particular
|
|
57
|
+
* configuration you are building:
|
|
58
|
+
* ```ts
|
|
59
|
+
* function addImage(this: ConfigurationFactory, actionName: string, imageSrc: string, imageId: string) {
|
|
60
|
+
* this.createInitAction(actionName)
|
|
61
|
+
* .addStartOperationByType(selectElement, { selector: ".timeline-container" })
|
|
62
|
+
* .addStartOperationByType(createElement, { element: 'img', attributes: {src: imageSrc, imageId} })
|
|
63
|
+
* .addStartOperationByType(setElementContent, { insertionType: "append" })
|
|
64
|
+
* .addEndOperationByType(selectElement, { selector: `#${imageId}` })
|
|
65
|
+
* .addEndOperationByType(removeElement, {});
|
|
66
|
+
* }
|
|
67
|
+
*
|
|
68
|
+
* const customFactory = ConfigurationFactory.extend(factory, "addImage", addImage);
|
|
69
|
+
*
|
|
70
|
+
* customFactory.addImage("MyImageActionName", "my-image.png", "my-image-id");
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* Finally, retrieve the configuration and save it:
|
|
74
|
+
* ```ts
|
|
75
|
+
* import fs from "fs";
|
|
76
|
+
*
|
|
77
|
+
* const configuration = customFactory.getConfiguration();
|
|
78
|
+
*
|
|
79
|
+
* fs.writeFileSync("/my/path/configuration.json", JSON.stringify(configuration), {encoding:'utf-8'})
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* The `ConfigurationFactory` can also be used to edit an existing configuration. In this case, simply
|
|
83
|
+
* pass the JSON configuration to the `ConfigurationFactory`'s constructor:
|
|
84
|
+
* ```ts
|
|
85
|
+
* import myConfiguration from './my-configuration.json';
|
|
86
|
+
*
|
|
87
|
+
* const factory = new ConfigurationFactory(myConfiguration);
|
|
88
|
+
*
|
|
89
|
+
* factory.editInitAction("existingActionName")
|
|
90
|
+
* .removeEndOperation("475fd0ab-5755-4e60-8f7c-e1988a109678");
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
*/
|
|
7
94
|
export declare class ConfigurationFactory {
|
|
8
95
|
actionCreatorFactory: ActionCreatorFactory;
|
|
9
96
|
configuration: IEngineConfiguration;
|
|
10
97
|
constructor(config?: IEngineConfiguration);
|
|
98
|
+
static extend<T extends ConfigurationFactory, K extends string | number | symbol, C extends ConfigurationFactoryExtension>(factory: T, extensionMethodName: K, extensionMethod: C): T & { [k in K]: C; };
|
|
99
|
+
static extendMultiple<T extends ConfigurationFactory, C extends ConfigurationFactoryExtension, D extends {
|
|
100
|
+
[name: string]: C;
|
|
101
|
+
}>(factory: T, extensions: D): T & D;
|
|
11
102
|
init(defaultLanguage: string): this;
|
|
12
103
|
setLayoutTemplate(layoutTemplate: string): this;
|
|
13
104
|
setDefaultLanguage(defaultLanguage: string): this;
|
|
14
105
|
setContainerSelector(selector: string): this;
|
|
15
106
|
editTimelineProviderSettings(): TimelineProvidersSettingsEditor;
|
|
16
|
-
getConfiguration(callBack
|
|
107
|
+
getConfiguration(callBack?: (copy: IEngineConfiguration) => IEngineConfiguration | undefined): IEngineConfiguration;
|
|
17
108
|
addLanguage(languageCode: string, languageLabel: string): this;
|
|
18
109
|
_internalAddAction(collectionName: keyof TEngineConfigurationLists, action: IActionConfiguration): void;
|
|
19
110
|
_initializeCollection<T, K extends keyof T>(parent: T, name: K): T[K];
|
|
@@ -21,7 +112,7 @@ export declare class ConfigurationFactory {
|
|
|
21
112
|
addInitAction(action: IActionConfiguration): void;
|
|
22
113
|
addEventAction(action: IActionConfiguration): void;
|
|
23
114
|
addTimelineAction(uri: string, action: ITimelineActionConfiguration): void;
|
|
24
|
-
createAction(name: string): import("./action-creator-factory").
|
|
115
|
+
createAction(name: string): import("./action-creator-factory").EndableActionCreator<import("../types").IEndableActionConfiguration>;
|
|
25
116
|
createInitAction(name: string): import("./action-creator-factory").EndableActionCreator<import("../types").IEndableActionConfiguration>;
|
|
26
117
|
createEventAction(name: string): import("./action-creator-factory").ActionCreator<IActionConfiguration>;
|
|
27
118
|
createTimelineAction(uri: string, name: string): import("./action-creator-factory").TimelineActionCreator;
|
|
@@ -31,8 +122,10 @@ export declare class ConfigurationFactory {
|
|
|
31
122
|
_initializeLabel(id: string, labels: ILanguageLabel[]): ILanguageLabel;
|
|
32
123
|
_getLabelTranslation(labelTranslations: ILabel[], languageCode: string): ILabel;
|
|
33
124
|
addLabel(id: string, code: string, translation: string): this;
|
|
34
|
-
|
|
125
|
+
removeLabel(id: string): this;
|
|
126
|
+
editAction(id: string): EndableActionEditor<import("../types").IEndableActionConfiguration>;
|
|
35
127
|
editEventAction(id: string): ActionEditor<import("../types").IEventActionConfiguration>;
|
|
36
128
|
editInitAction(id: string): EndableActionEditor<import("../types").IEndableActionConfiguration>;
|
|
37
129
|
editTimelineAction(uri: string, id: string): TimelineActionEditor;
|
|
38
130
|
}
|
|
131
|
+
export {};
|
|
@@ -3,6 +3,13 @@ import { ActionRegistryEventbusListener } from '../eventbus';
|
|
|
3
3
|
import { IEventbus } from '../eventbus/types';
|
|
4
4
|
import { IConfigurationResolver, ISimpleResourceImporter } from '../types';
|
|
5
5
|
import { IEngineConfiguration, IResolvedEngineConfiguration } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Takes an `IEngineConfiguration` instance and return an `IResolvedEngineConfiguration`.
|
|
8
|
+
* This means all system names within the configuration will be resolved to their associated instances.
|
|
9
|
+
*
|
|
10
|
+
* If the given configuration includes event actions, then those will be registered in the given `ActionRegistryEventbusListener`.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
export declare class ConfigurationResolver implements IConfigurationResolver {
|
|
7
14
|
private importer;
|
|
8
15
|
private eventbus;
|
|
@@ -35,6 +35,14 @@ export interface IResolvedEngineConfiguration {
|
|
|
35
35
|
timelineFlow?: ITimelineFlow;
|
|
36
36
|
labels: ILanguageLabel[];
|
|
37
37
|
}
|
|
38
|
+
export interface IResolvedActionConfiguration {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
startOperations: IResolvedOperation[];
|
|
42
|
+
}
|
|
43
|
+
export interface IResolvedEndableActionConfiguration extends IResolvedActionConfiguration {
|
|
44
|
+
endOperations: IResolvedOperation[];
|
|
45
|
+
}
|
|
38
46
|
export interface ITimelineFlow {
|
|
39
47
|
}
|
|
40
48
|
export interface ITimelineProviderSettings {
|
|
@@ -13,6 +13,13 @@ export interface IEventListenerControllerOperationData {
|
|
|
13
13
|
actions: string[];
|
|
14
14
|
actionOperationData?: TOperationData;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* This controller attaches to the given selected element and adds an event listener for the specified event name that
|
|
18
|
+
* executes the given actions with the given operation data.
|
|
19
|
+
*
|
|
20
|
+
* By default the `start` operations of the specified actions are executed. To execute the `end` operations instead,
|
|
21
|
+
* prefix the action name with `end:`.
|
|
22
|
+
*/
|
|
16
23
|
export declare class EventListenerController implements IController<IEventListenerControllerOperationData> {
|
|
17
24
|
operationData?: IEventListenerControllerOperationData;
|
|
18
25
|
actionInstanceInfos?: IActionInstanceInfo[];
|
|
@@ -20,9 +27,9 @@ export declare class EventListenerController implements IController<IEventListen
|
|
|
20
27
|
constructor();
|
|
21
28
|
init(operationData: IEventListenerControllerOperationData): void;
|
|
22
29
|
attach(eventbus: IEventbus): void;
|
|
23
|
-
_isStartAction
|
|
24
|
-
_eventHandler
|
|
25
|
-
_executeAction
|
|
30
|
+
private _isStartAction;
|
|
31
|
+
private _eventHandler;
|
|
32
|
+
private _executeAction;
|
|
26
33
|
detach(_eventbus: IEventbus): void;
|
|
27
34
|
}
|
|
28
35
|
export {};
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
/// <reference types="jquery" />
|
|
2
2
|
import { IEventbus, TEventbusRemover } from '../eventbus/types';
|
|
3
|
-
import { ILabel } from '../types';
|
|
4
3
|
import { IController } from './types';
|
|
5
4
|
export interface ILabelControllerMetadata {
|
|
6
5
|
selectedElement: JQuery;
|
|
7
6
|
labelId: string;
|
|
8
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* This controller attaches to the given selected element and renders the text associated with the given label id in it.
|
|
10
|
+
*
|
|
11
|
+
* The controller also listen for the `LANGUAGE_CHANGE` event and re-renders the text with the new language after such an event.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
9
14
|
export declare class LabelController implements IController<ILabelControllerMetadata> {
|
|
10
15
|
listeners: TEventbusRemover[];
|
|
11
16
|
currentLanguage: string | null;
|
|
12
17
|
operationData: ILabelControllerMetadata | null;
|
|
13
18
|
labelData: Record<string, string>;
|
|
14
19
|
name: string;
|
|
20
|
+
requestLabelDataBound?: (labelId: string) => void;
|
|
15
21
|
init(operationData: ILabelControllerMetadata): void;
|
|
22
|
+
setLabelId(newLabelId: string): void;
|
|
16
23
|
attach(eventbus: IEventbus): void;
|
|
17
|
-
|
|
24
|
+
private _requestLabelData;
|
|
25
|
+
private _setLabel;
|
|
18
26
|
detach(_eventbus: IEventbus): void;
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
private _handleLanguageChange;
|
|
28
|
+
private _createTextDataLookup;
|
|
21
29
|
}
|
|
@@ -16,11 +16,17 @@ export interface IInnerMetadata {
|
|
|
16
16
|
export interface ILottieControllerMetadata extends IInnerMetadata {
|
|
17
17
|
url: string;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* This controller renders a [lottie-web](https://github.com/airbnb/lottie-web) animation inside the given selected element.
|
|
21
|
+
*
|
|
22
|
+
* The url may encode freeze and end positions like this: my-url/filename[freeze=10,end=21].json
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
19
25
|
export declare class LottieController implements IController<ILottieControllerMetadata> {
|
|
20
26
|
name: string;
|
|
21
|
-
currentLanguage: string
|
|
27
|
+
currentLanguage: string;
|
|
22
28
|
labelData: Record<string, Record<string, string>>;
|
|
23
|
-
|
|
29
|
+
eventbusRemovers: TEventbusRemover[];
|
|
24
30
|
animationItem: AnimationItem | null;
|
|
25
31
|
operationData: IInnerMetadata | null;
|
|
26
32
|
serializedData: string | null;
|
|
@@ -29,12 +35,12 @@ export declare class LottieController implements IController<ILottieControllerMe
|
|
|
29
35
|
endPosition: number;
|
|
30
36
|
constructor();
|
|
31
37
|
init(operationData: ILottieControllerMetadata): void;
|
|
32
|
-
|
|
38
|
+
private _parseFilename;
|
|
33
39
|
attach(eventbus: IEventbus): void;
|
|
34
40
|
detach(_eventbus: IEventbus): void;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
private _destroy;
|
|
42
|
+
private _createAnimation;
|
|
43
|
+
private _createTextDataLookup;
|
|
44
|
+
private _handleLanguageChange;
|
|
45
|
+
private _isIE;
|
|
40
46
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="jquery" />
|
|
2
2
|
import { IEventbus, TEventbusRemover } from '../eventbus/types';
|
|
3
3
|
import { TOperationData } from '../operation/types';
|
|
4
|
-
import { TResultCallback } from '../types';
|
|
5
4
|
import { LabelController } from './label-controller';
|
|
6
5
|
import { IController } from './types';
|
|
7
6
|
export interface INavigationControllerOperationData {
|
|
@@ -22,18 +21,18 @@ export declare class NavigationController implements IController<INavigationCont
|
|
|
22
21
|
constructor();
|
|
23
22
|
init(operationData: TOperationData): void;
|
|
24
23
|
attach(eventbus: IEventbus): void;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
private _initHistory;
|
|
25
|
+
private _getQueryVariable;
|
|
26
|
+
private _handleRequestCurrentNavigation;
|
|
28
27
|
detach(eventbus: IEventbus): void;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
private _pushCurrentState;
|
|
29
|
+
private _buildHtml;
|
|
30
|
+
private _addNavElement;
|
|
31
|
+
private _addClickHandler;
|
|
32
|
+
private _menuMouseupHandler;
|
|
33
|
+
private _handleNavigateVideoUrl;
|
|
34
|
+
private _highlightMenu;
|
|
35
|
+
private _handleVideoComplete;
|
|
36
|
+
private _addLabel;
|
|
37
|
+
private _buildNavigationData;
|
|
39
38
|
}
|
|
@@ -6,17 +6,20 @@ export interface IProgressbarControllerOperationData {
|
|
|
6
6
|
selectedElement: JQuery;
|
|
7
7
|
textElement: JQuery;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* This controller renders a progressbar that displays the progress of the current timeline in the given selected element.
|
|
11
|
+
*
|
|
12
|
+
* The current progress as a percentage is rendered in the given text element.
|
|
13
|
+
*/
|
|
9
14
|
export declare class ProgressbarController implements IController<IProgressbarControllerOperationData> {
|
|
10
15
|
name: string;
|
|
11
16
|
selectedElement: JQuery | null;
|
|
12
17
|
textElement: JQuery | null;
|
|
13
|
-
|
|
18
|
+
eventbusRemovers: TEventbusRemover[];
|
|
19
|
+
duration: number;
|
|
14
20
|
init(operationData: TOperationData): void;
|
|
15
21
|
attach(eventbus: IEventbus): void;
|
|
16
22
|
detach(_eventbus: IEventbus): void;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
duration: number;
|
|
20
|
-
}): void;
|
|
21
|
-
clickHandler(): void;
|
|
23
|
+
private _positionUpdateHandler;
|
|
24
|
+
private _clickHandler;
|
|
22
25
|
}
|
|
@@ -4,6 +4,9 @@ import { IController } from './types';
|
|
|
4
4
|
export interface IRoutingControllerOperationData {
|
|
5
5
|
json: any;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* This is a work in progress, do not use this yet please....
|
|
9
|
+
*/
|
|
7
10
|
export declare class RoutingController implements IController<IRoutingControllerOperationData> {
|
|
8
11
|
name: string;
|
|
9
12
|
navLookup: Record<string, any>;
|
|
@@ -14,11 +17,11 @@ export declare class RoutingController implements IController<IRoutingController
|
|
|
14
17
|
constructor();
|
|
15
18
|
init(operationData: TOperationData): void;
|
|
16
19
|
attach(eventbus: IEventbus): void;
|
|
17
|
-
|
|
20
|
+
private _handlePopstate;
|
|
18
21
|
detach(_eventbus: IEventbus): void;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
private _handleBeforeRequestVideoUrl;
|
|
23
|
+
private _getQueryVariable;
|
|
24
|
+
private _handlePushHistoryState;
|
|
25
|
+
private _pushState;
|
|
26
|
+
private _buildNavigationData;
|
|
24
27
|
}
|
|
@@ -17,7 +17,7 @@ export declare class SubtitlesController implements IController<ISubtitlesContro
|
|
|
17
17
|
internalDetach(detachMethods?: TEventbusRemover[]): void;
|
|
18
18
|
languageChangeHandler(newLanguage: string): void;
|
|
19
19
|
removeTitle(container?: JQuery): void;
|
|
20
|
-
onTimeHandler(
|
|
20
|
+
onTimeHandler(position: number): void;
|
|
21
21
|
onSeekedHandler(arg: any): void;
|
|
22
22
|
setTitle(container: JQuery, titleLanguageLookup: Record<string, string>): void;
|
|
23
23
|
createActionLookup(operationData: TOperationData, container: JQuery): Record<number, () => void>;
|
package/dist/eligius-engine.d.ts
CHANGED
|
@@ -4,9 +4,8 @@ import { LanguageManager } from './language-manager';
|
|
|
4
4
|
import { ITimelineProvider } from './timelineproviders/types';
|
|
5
5
|
import { IEligiusEngine, ITimelineProviderInfo, TimelineTypes } from './types';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* the given timeline provider and triggering the actions associated with
|
|
9
|
-
* ...
|
|
7
|
+
* This is where the magic happens. The engine is responsible for starting and stopping
|
|
8
|
+
* the given timeline provider and triggering the actions associated with the positions along the timeline.
|
|
10
9
|
*/
|
|
11
10
|
export declare class EligiusEngine implements IEligiusEngine {
|
|
12
11
|
private configuration;
|
|
@@ -19,22 +18,52 @@ export declare class EligiusEngine implements IEligiusEngine {
|
|
|
19
18
|
private _activeTimelineProvider;
|
|
20
19
|
private _lastPosition;
|
|
21
20
|
constructor(configuration: IResolvedEngineConfiguration, eventbus: IEventbus, timelineProviders: Record<TimelineTypes, ITimelineProviderInfo>, languageManager: LanguageManager);
|
|
21
|
+
/**
|
|
22
|
+
* Initializes the engine by creating the HTML layout and the first time line
|
|
23
|
+
* by executing its initActions.
|
|
24
|
+
*/
|
|
22
25
|
init(): Promise<ITimelineProvider>;
|
|
23
26
|
private _createLayoutTemplate;
|
|
24
27
|
private _initializeTimelineProvider;
|
|
28
|
+
private _onCompleteCallback;
|
|
29
|
+
private _onFirstFrameCallback;
|
|
30
|
+
private _onRestartCallback;
|
|
25
31
|
private _cleanUp;
|
|
32
|
+
/**
|
|
33
|
+
* Cleans up all the necessary parts that the engine initialized.
|
|
34
|
+
* - It ends the currently active operations and the init actions.
|
|
35
|
+
* - It removes all its eventbus listeners, handlers and interceptors.
|
|
36
|
+
* - It destroys all of its timeline providers
|
|
37
|
+
* - It empties the HTML element indicated by the containerSelector configuration property.
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
26
40
|
destroy(): Promise<void>;
|
|
27
41
|
private _addEventListener;
|
|
28
|
-
private
|
|
42
|
+
private _addEventbusListeners;
|
|
43
|
+
private seekRequest;
|
|
44
|
+
private durationRequest;
|
|
45
|
+
private containerRequest;
|
|
46
|
+
private _pauseRequest;
|
|
47
|
+
private _stopRequest;
|
|
48
|
+
private _playRequest;
|
|
49
|
+
private _toggleplay;
|
|
29
50
|
private _createTimelineLookup;
|
|
30
|
-
private
|
|
51
|
+
private _addTimelineActionStart;
|
|
52
|
+
private _addTimelineActionEnd;
|
|
31
53
|
private _initializeUriLookup;
|
|
32
54
|
private _initializeTimelinePosition;
|
|
33
55
|
private _executeActions;
|
|
34
56
|
private _handleRequestEngineRoot;
|
|
35
|
-
_handleRequestTimelineUri
|
|
57
|
+
private _handleRequestTimelineUri;
|
|
36
58
|
private _cleanUpTimeline;
|
|
37
59
|
private _executeStartActions;
|
|
60
|
+
/**
|
|
61
|
+
* Gets all of the inactive actions whose duration falls within the given timeline position.
|
|
62
|
+
*
|
|
63
|
+
* @param position the given position
|
|
64
|
+
* @param actions all of the relevant actions
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
38
67
|
private _getActionsForPosition;
|
|
39
68
|
private _getActiveActions;
|
|
40
69
|
private _executeRelevantActions;
|
|
@@ -46,7 +75,6 @@ export declare class EligiusEngine implements IEligiusEngine {
|
|
|
46
75
|
private _requestCurrentTimeline;
|
|
47
76
|
private _getTimelineActionsForUri;
|
|
48
77
|
private _onTimeHandler;
|
|
49
|
-
private _onSeekHandler;
|
|
50
78
|
private _executeActionsForPosition;
|
|
51
79
|
private _executeSeekActions;
|
|
52
80
|
}
|