eligius 1.1.1 → 1.1.3
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 +6 -2
- package/dist/action/action.d.ts +17 -17
- package/dist/action/endable-action.d.ts +9 -9
- package/dist/action/index.d.ts +3 -3
- package/dist/action/timeline-action.d.ts +14 -14
- package/dist/action/types.d.ts +17 -17
- package/dist/build/generate-importer-source-code.d.ts +15 -15
- package/dist/build/index.d.ts +1 -1
- package/dist/configuration/api/action-creator-factory.d.ts +31 -31
- package/dist/configuration/api/action-editor.d.ts +44 -44
- package/dist/configuration/api/configuration-factory.d.ts +135 -134
- package/dist/configuration/api/index.d.ts +7 -5
- package/dist/configuration/api/label-editor.d.ts +11 -11
- package/dist/configuration/api/name-providers.d.ts +13 -13
- package/dist/configuration/api/subtitle-converter.d.ts +11 -0
- package/dist/configuration/api/subtitle-editor.d.ts +24 -0
- package/dist/configuration/api/timeline-provider-settings-editor.d.ts +22 -22
- package/dist/configuration/configuration-resolver.d.ts +18 -18
- package/dist/configuration/types.d.ts +102 -102
- package/dist/controllers/event-listener-controller.d.ts +36 -35
- package/dist/controllers/index.d.ts +7 -7
- package/dist/controllers/label-controller.d.ts +31 -30
- package/dist/controllers/lottie-controller.d.ts +47 -46
- package/dist/controllers/metadata/event-listener-controller.d.ts +4 -4
- package/dist/controllers/metadata/index.d.ts +7 -7
- package/dist/controllers/metadata/label-controller.d.ts +4 -4
- package/dist/controllers/metadata/lottie-controller.d.ts +4 -4
- package/dist/controllers/metadata/navigation-controller.d.ts +4 -4
- package/dist/controllers/metadata/progressbar-controller.d.ts +4 -4
- package/dist/controllers/metadata/routing-controller.d.ts +4 -4
- package/dist/controllers/metadata/subtitles-controller.d.ts +4 -4
- package/dist/controllers/metadata/types.d.ts +6 -6
- package/dist/controllers/navigation-controller.d.ts +39 -38
- package/dist/controllers/progressbar-controller.d.ts +26 -25
- package/dist/controllers/routing-controller.d.ts +27 -27
- package/dist/controllers/subtitles-controller.d.ts +27 -25
- package/dist/controllers/types.d.ts +8 -8
- package/dist/diagnostics/{devtool-event-lister.d.ts → devtool-event-listener.d.ts} +7 -7
- package/dist/diagnostics/diagnostics.d.ts +5 -5
- package/dist/diagnostics/index.d.ts +3 -3
- package/dist/diagnostics/types.d.ts +28 -28
- package/dist/eligius-engine.d.ts +88 -88
- package/dist/eligius-flow-controller.d.ts +8 -8
- package/dist/engine-factory.d.ts +38 -38
- package/dist/eventbus/actionregistry-eventbus-listener.d.ts +11 -11
- package/dist/eventbus/eventbus.d.ts +18 -18
- package/dist/eventbus/index.d.ts +4 -4
- package/dist/eventbus/request-video-uri-interceptor.d.ts +6 -6
- package/dist/eventbus/types.d.ts +18 -18
- package/dist/importer/eligius-resource-importer.d.ts +9 -9
- package/dist/importer/index.d.ts +1 -1
- package/dist/index.cjs +6417 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.cjs.min.js +8 -0
- package/dist/index.cjs.min.js.map +7 -0
- package/dist/index.d.ts +22 -22
- package/dist/index.esm.js +8 -0
- package/dist/index.esm.js.map +7 -0
- package/dist/index.js +7 -8
- package/dist/language-manager.d.ts +24 -24
- package/dist/operation/add-class.d.ts +14 -13
- package/dist/operation/add-controller-to-element.d.ts +15 -14
- package/dist/operation/add-globals-to-operation.d.ts +12 -12
- package/dist/operation/animate-with-class.d.ts +17 -16
- package/dist/operation/animate.d.ts +17 -16
- package/dist/operation/broadcast-event.d.ts +13 -13
- package/dist/operation/calc.d.ts +14 -14
- package/dist/operation/clear-element.d.ts +11 -10
- package/dist/operation/clear-operation-data.d.ts +10 -10
- package/dist/operation/create-element.d.ts +18 -17
- package/dist/operation/custom-function.d.ts +12 -12
- package/dist/operation/end-action.d.ts +17 -17
- package/dist/operation/{end-loop.d.ts → end-for-each.d.ts} +8 -8
- package/dist/operation/end-when.d.ts +8 -8
- package/dist/operation/extend-controller.d.ts +10 -10
- package/dist/operation/{start-loop.d.ts → for-each.d.ts} +19 -17
- package/dist/operation/get-attributes-from-element.d.ts +21 -20
- package/dist/operation/get-controller-from-element.d.ts +16 -15
- package/dist/operation/get-controller-instance.d.ts +17 -17
- package/dist/operation/get-element-dimensions.d.ts +30 -29
- package/dist/operation/get-import.d.ts +13 -13
- package/dist/operation/get-query-params.d.ts +28 -28
- package/dist/operation/helper/attach-controller-to-element.d.ts +3 -2
- package/dist/operation/helper/deep-copy.d.ts +1 -1
- package/dist/operation/helper/find-matching-operation-index.d.ts +35 -35
- package/dist/operation/helper/get-element-data.d.ts +7 -6
- package/dist/operation/helper/get-property-chain-value.d.ts +24 -24
- package/dist/operation/helper/globals.d.ts +4 -4
- package/dist/operation/helper/internal-resolve.d.ts +2 -2
- package/dist/operation/helper/merge-operation-data.d.ts +2 -2
- package/dist/operation/helper/modify-dimensions.d.ts +20 -20
- package/dist/operation/helper/remove-event-data-from-operation-data.d.ts +2 -2
- package/dist/operation/helper/remove-global.d.ts +1 -1
- package/dist/operation/helper/resolve-event-arguments.d.ts +2 -2
- package/dist/operation/helper/resolve-external-property-chain.d.ts +14 -14
- package/dist/operation/helper/resolve-property-chain.d.ts +23 -23
- package/dist/operation/helper/resolve-property-values.d.ts +11 -11
- package/dist/operation/helper/set-global.d.ts +1 -1
- package/dist/operation/index.d.ts +46 -46
- package/dist/operation/invoke-object-method.d.ts +28 -28
- package/dist/operation/load-json.d.ts +28 -28
- package/dist/operation/log.d.ts +8 -8
- package/dist/operation/math.d.ts +12 -12
- package/dist/operation/metadata/add-class.d.ts +4 -4
- package/dist/operation/metadata/add-controller-to-element.d.ts +4 -4
- package/dist/operation/metadata/add-globals-to-operation.d.ts +4 -4
- package/dist/operation/metadata/animate-with-class.d.ts +4 -4
- package/dist/operation/metadata/animate.d.ts +4 -4
- package/dist/operation/metadata/broadcast-event.d.ts +4 -4
- package/dist/operation/metadata/calc.d.ts +4 -4
- package/dist/operation/metadata/clear-element.d.ts +4 -4
- package/dist/operation/metadata/clear-operation-data.d.ts +4 -4
- package/dist/operation/metadata/create-element.d.ts +4 -4
- package/dist/operation/metadata/custom-function.d.ts +4 -4
- package/dist/operation/metadata/end-action.d.ts +4 -4
- package/dist/operation/metadata/end-for-each.d.ts +3 -0
- package/dist/operation/metadata/end-when.d.ts +3 -3
- package/dist/operation/metadata/extend-controller.d.ts +4 -4
- package/dist/operation/metadata/for-each.d.ts +4 -0
- package/dist/operation/metadata/get-attributes-from-element.d.ts +4 -4
- package/dist/operation/metadata/get-controller-from-element.d.ts +4 -4
- package/dist/operation/metadata/get-controller-instance.d.ts +4 -4
- package/dist/operation/metadata/get-element-dimensions.d.ts +4 -4
- package/dist/operation/metadata/get-import.d.ts +4 -4
- package/dist/operation/metadata/get-query-params.d.ts +4 -4
- package/dist/operation/metadata/index.d.ts +45 -45
- package/dist/operation/metadata/invoke-object-method.d.ts +4 -4
- package/dist/operation/metadata/load-json.d.ts +4 -4
- package/dist/operation/metadata/log.d.ts +3 -3
- package/dist/operation/metadata/math.d.ts +4 -4
- package/dist/operation/metadata/otherwise.d.ts +3 -3
- package/dist/operation/metadata/remove-class.d.ts +4 -4
- package/dist/operation/metadata/remove-controller-from-element.d.ts +4 -4
- package/dist/operation/metadata/remove-element.d.ts +4 -4
- package/dist/operation/metadata/remove-properties-from-operation-data.d.ts +4 -4
- package/dist/operation/metadata/reparent-element.d.ts +4 -4
- package/dist/operation/metadata/request-action.d.ts +4 -4
- package/dist/operation/metadata/resize-action.d.ts +4 -4
- package/dist/operation/metadata/select-element.d.ts +4 -4
- package/dist/operation/metadata/set-data.d.ts +4 -4
- package/dist/operation/metadata/set-element-attributes.d.ts +4 -4
- package/dist/operation/metadata/set-element-content.d.ts +4 -4
- package/dist/operation/metadata/set-global-data.d.ts +4 -4
- package/dist/operation/metadata/set-operation-data.d.ts +4 -4
- package/dist/operation/metadata/set-style.d.ts +4 -4
- package/dist/operation/metadata/start-action.d.ts +4 -4
- package/dist/operation/metadata/toggle-class.d.ts +4 -4
- package/dist/operation/metadata/toggle-element.d.ts +4 -4
- package/dist/operation/metadata/types.d.ts +29 -29
- package/dist/operation/metadata/wait.d.ts +4 -4
- package/dist/operation/metadata/when.d.ts +4 -4
- package/dist/operation/otherwise.d.ts +9 -9
- package/dist/operation/remove-class.d.ts +14 -13
- package/dist/operation/remove-controller-from-element.d.ts +14 -13
- package/dist/operation/remove-element.d.ts +13 -12
- package/dist/operation/remove-properties-from-operation-data.d.ts +12 -12
- package/dist/operation/reparent-element.d.ts +15 -14
- package/dist/operation/request-action.d.ts +14 -14
- package/dist/operation/resize-action.d.ts +12 -12
- package/dist/operation/select-element.d.ts +19 -18
- package/dist/operation/set-data.d.ts +21 -21
- package/dist/operation/set-element-attributes.d.ts +14 -13
- package/dist/operation/set-element-content.d.ts +21 -20
- package/dist/operation/set-global-data.d.ts +11 -11
- package/dist/operation/set-operation-data.d.ts +13 -13
- package/dist/operation/set-style.d.ts +15 -14
- package/dist/operation/start-action.d.ts +17 -17
- package/dist/operation/toggle-class.d.ts +23 -22
- package/dist/operation/toggle-element.d.ts +19 -18
- package/dist/operation/types.d.ts +55 -55
- package/dist/operation/wait.d.ts +14 -14
- package/dist/operation/when.d.ts +21 -18
- package/dist/test/integration/create-language-selector.spec.d.ts +1 -0
- package/dist/test/integration/end-in-correct-order.spec.d.ts +1 -0
- package/dist/test/integration/for-each-loop.spec.d.ts +1 -0
- package/dist/test/integration/re-use-image-action.spec.d.ts +1 -0
- package/dist/test/integration/when-construction.spec.d.ts +1 -0
- package/dist/test/unit/action/action.spec.d.ts +1 -0
- package/dist/test/unit/build/generate-importer-source-code.spec.d.ts +1 -0
- package/dist/test/unit/chrono-trigger-engine.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/action-editor.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/configuration-factory.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/endable-action-editor.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/name-providers.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/subtitle-editor.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/timeline-action-editor.spec.d.ts +1 -0
- package/dist/test/unit/configuration/api/timeline-provider-settings-editor.spec.d.ts +1 -0
- package/dist/test/unit/configuration/configuration-resolver.spec.d.ts +1 -0
- package/dist/test/unit/controllers/EventListenerController.spec.d.ts +1 -0
- package/dist/test/unit/controllers/LabelController.spec.d.ts +1 -0
- package/dist/test/unit/engine-factory.spec.d.ts +1 -0
- package/dist/test/unit/eventbus/eventbus.spec.d.ts +1 -0
- package/dist/test/unit/importer/eligius-resource-importer.spec.d.ts +1 -0
- package/dist/test/unit/language-manager.spec.d.ts +1 -0
- package/dist/test/unit/operation/_operation-metadata.spec.d.ts +1 -0
- package/dist/test/unit/operation/add-class.spec.d.ts +1 -0
- package/dist/test/unit/operation/add-controller-to-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/add-globals-to-operation.spec.d.ts +1 -0
- package/dist/test/unit/operation/animate-with-class.spec.d.ts +1 -0
- package/dist/test/unit/operation/animate.spec.d.ts +1 -0
- package/dist/test/unit/operation/broadcast-event.spec.d.ts +1 -0
- package/dist/test/unit/operation/calc.spec.d.ts +1 -0
- package/dist/test/unit/operation/clear-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/clear-operation-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/create-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/custom-function.spec.d.ts +1 -0
- package/dist/test/unit/operation/end-action.spec.d.ts +1 -0
- package/dist/test/unit/operation/end-for-each.spec.d.ts +1 -0
- package/dist/test/unit/operation/end-when.spec.d.ts +1 -0
- package/dist/test/unit/operation/extend-controller.spec.d.ts +1 -0
- package/dist/test/unit/operation/for-each.spec.d.ts +1 -0
- package/dist/test/unit/operation/get-attributes-from-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/get-controller-from-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/get-controller-instance.spec.d.ts +1 -0
- package/dist/test/unit/operation/get-element-dimensions.spec.d.ts +1 -0
- package/dist/test/unit/operation/get-query-params.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/attach-controller-to-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/get-element-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/get-property-chain-value.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/globals.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/internal-resolve.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/merge-operation-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/modify-dimensions.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/remove-event-data-from-operation-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/remove-global.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/resolve-event-arguments.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/resolve-external-property-chain.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/resolve-property-values.spec.d.ts +1 -0
- package/dist/test/unit/operation/helper/set-global.spec.d.ts +1 -0
- package/dist/test/unit/operation/invoke-object-method.spec.d.ts +1 -0
- package/dist/test/unit/operation/load-json.spec.d.ts +1 -0
- package/dist/test/unit/operation/log.spec.d.ts +1 -0
- package/dist/test/unit/operation/math.spec.d.ts +1 -0
- package/dist/test/unit/operation/otherwise.spec.d.ts +1 -0
- package/dist/test/unit/operation/remove-class.spec.d.ts +1 -0
- package/dist/test/unit/operation/remove-properties-from-operation-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/reparent-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/request-action.spec.d.ts +1 -0
- package/dist/test/unit/operation/resize-action.spec.d.ts +1 -0
- package/dist/test/unit/operation/select-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/set-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/set-element-attributes.spec.d.ts +1 -0
- package/dist/test/unit/operation/set-element-content.spec.d.ts +1 -0
- package/dist/test/unit/operation/set-global-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/set-operation-data.spec.d.ts +1 -0
- package/dist/test/unit/operation/set-style.spec.d.ts +1 -0
- package/dist/test/unit/operation/start-action.spec.d.ts +1 -0
- package/dist/test/unit/operation/toggle-class.spec.d.ts +1 -0
- package/dist/test/unit/operation/toggle-element.spec.d.ts +1 -0
- package/dist/test/unit/operation/wait.spec.d.ts +1 -0
- package/dist/test/unit/operation/when.spec.d.ts +1 -0
- package/dist/test/unit/timelineproviders/request-animation-frame-timeline-provider.spec.d.ts +1 -0
- package/dist/test/unit/util/prepare-value-for-serialization.spec.d.ts +1 -0
- package/dist/timeline-event-names.d.ts +81 -81
- package/dist/timelineproviders/index.d.ts +2 -1
- package/dist/timelineproviders/request-animation-frame-timeline-provider.d.ts +40 -40
- package/dist/timelineproviders/types.d.ts +21 -20
- package/dist/timelineproviders/{media-element-timeline-provider.d.ts → video-js-timeline-provider.d.ts} +39 -42
- package/dist/tools/doc-tools/generate-readmes.d.ts +1 -1
- package/dist/tools/schema-tools/generate-operation-schemas.d.ts +1 -1
- package/dist/tools/schema-tools/html-tag-names.d.ts +1 -1
- package/dist/types.d.ts +103 -93
- package/dist/util/animation-interval.d.ts +1 -1
- package/dist/util/apply-operation.d.ts +3 -3
- package/dist/util/camel-case-to-dash.d.ts +1 -1
- package/dist/util/dash-to-camel-case.d.ts +1 -1
- package/dist/util/guards/is-function.d.ts +1 -1
- package/dist/util/guards/is-object.d.ts +1 -1
- package/dist/util/guards/is-promise.d.ts +1 -1
- package/dist/util/guards/is-string.d.ts +1 -1
- package/dist/util/prepare-value-for-serialization.d.ts +1 -1
- package/package.json +54 -68
- package/dist/eligius.cjs.development.js +0 -7279
- package/dist/eligius.cjs.development.js.map +0 -1
- package/dist/eligius.cjs.production.min.js +0 -2
- package/dist/eligius.cjs.production.min.js.map +0 -1
- package/dist/eligius.esm.js +0 -7183
- package/dist/eligius.esm.js.map +0 -1
- package/dist/operation/metadata/end-loop.d.ts +0 -3
- package/dist/operation/metadata/start-loop.d.ts +0 -4
package/README.md
CHANGED
|
@@ -15,11 +15,13 @@ Actions can be called on specified points on such a timeline. An action consists
|
|
|
15
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
|
-
An example of an action is adding
|
|
18
|
+
An example of an action is adding and removing an image from the DOM at specific times. This action would consist of these start operations: `select-element`(to select the element that will act as the image's 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).
|
|
19
19
|
The end operations would be: `select-element`(to select the parent again) and `clear-element`(to remove the img element).
|
|
20
20
|
|
|
21
21
|
A more comprehensive example could be, for example, a rich subtitling system for a videoplayer where the videoplayer acts as the timeline provider and Eligius is used to render the subtitles on top of it.
|
|
22
22
|
|
|
23
|
+
The final two puzzle pieces are the `EngineFactory` and `EligiusEngine`. The Factory will create instances of the engine and the engine orchestrates the timelines and executes the actions at the specified times.
|
|
24
|
+
|
|
23
25
|
## configuration
|
|
24
26
|
|
|
25
27
|
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).
|
|
@@ -274,7 +276,9 @@ engine.init().then(()=> {console.log('Eligius engine ready for business');});
|
|
|
274
276
|
|
|
275
277
|
## Configuration API
|
|
276
278
|
|
|
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.
|
|
279
|
+
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 and extensible API to construct a configuration programmatically.
|
|
280
|
+
|
|
281
|
+
It is encouraged to use this API to build specialized DSL's for specific presentations.
|
|
278
282
|
|
|
279
283
|
## Source documentation
|
|
280
284
|
|
package/dist/action/action.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { IResolvedOperation } from '../configuration/types';
|
|
2
|
-
import { IEventbus } from '../eventbus/types';
|
|
3
|
-
import { IOperationContext, TOperationData } from '../operation/types';
|
|
4
|
-
import { IAction } from './types';
|
|
5
|
-
export declare class Action implements IAction {
|
|
6
|
-
name: string;
|
|
7
|
-
startOperations: IResolvedOperation[];
|
|
8
|
-
protected eventbus: IEventbus;
|
|
9
|
-
id: string;
|
|
10
|
-
protected _contextStack: IOperationContext[];
|
|
11
|
-
constructor(name: string, startOperations: IResolvedOperation[], eventbus: IEventbus);
|
|
12
|
-
start(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
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;
|
|
17
|
-
}
|
|
1
|
+
import { IResolvedOperation } from '../configuration/types';
|
|
2
|
+
import { IEventbus } from '../eventbus/types';
|
|
3
|
+
import { IOperationContext, TOperationData } from '../operation/types';
|
|
4
|
+
import { IAction } from './types';
|
|
5
|
+
export declare class Action implements IAction {
|
|
6
|
+
name: string;
|
|
7
|
+
startOperations: IResolvedOperation[];
|
|
8
|
+
protected eventbus: IEventbus;
|
|
9
|
+
id: string;
|
|
10
|
+
protected _contextStack: IOperationContext[];
|
|
11
|
+
constructor(name: string, startOperations: IResolvedOperation[], eventbus: IEventbus);
|
|
12
|
+
start(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
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;
|
|
17
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IResolvedOperation } from '../configuration/types';
|
|
2
|
-
import { IEventbus } from '../eventbus/types';
|
|
3
|
-
import { TOperationData } from '../operation/types';
|
|
4
|
-
import { Action } from './action';
|
|
5
|
-
export declare class EndableAction extends Action {
|
|
6
|
-
endOperations: IResolvedOperation[];
|
|
7
|
-
constructor(name: string, startOperations: IResolvedOperation[], endOperations: IResolvedOperation[], eventBus: IEventbus);
|
|
8
|
-
end(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
9
|
-
}
|
|
1
|
+
import { IResolvedOperation } from '../configuration/types';
|
|
2
|
+
import { IEventbus } from '../eventbus/types';
|
|
3
|
+
import { TOperationData } from '../operation/types';
|
|
4
|
+
import { Action } from './action';
|
|
5
|
+
export declare class EndableAction extends Action {
|
|
6
|
+
endOperations: IResolvedOperation[];
|
|
7
|
+
constructor(name: string, startOperations: IResolvedOperation[], endOperations: IResolvedOperation[], eventBus: IEventbus);
|
|
8
|
+
end(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
9
|
+
}
|
package/dist/action/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Action } from './action';
|
|
2
|
-
export { EndableAction } from './endable-action';
|
|
3
|
-
export { TimelineAction } from './timeline-action';
|
|
1
|
+
export { Action } from './action';
|
|
2
|
+
export { EndableAction } from './endable-action';
|
|
3
|
+
export { TimelineAction } from './timeline-action';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { IResolvedOperation } from '../configuration/types';
|
|
2
|
-
import { IEventbus } from '../eventbus/types';
|
|
3
|
-
import { TOperationData } from '../operation/types';
|
|
4
|
-
import { IStrictDuration } from '../types';
|
|
5
|
-
import { EndableAction } from './endable-action';
|
|
6
|
-
import { ITimelineAction } from './types';
|
|
7
|
-
export declare class TimelineAction extends EndableAction implements ITimelineAction {
|
|
8
|
-
duration: IStrictDuration;
|
|
9
|
-
private _active;
|
|
10
|
-
get active(): boolean;
|
|
11
|
-
constructor(name: string, startOperations: IResolvedOperation[], endOperations: IResolvedOperation[], duration: IStrictDuration, eventBus: IEventbus);
|
|
12
|
-
start(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
13
|
-
end(initOperationData: TOperationData): Promise<TOperationData>;
|
|
14
|
-
}
|
|
1
|
+
import { IResolvedOperation } from '../configuration/types';
|
|
2
|
+
import { IEventbus } from '../eventbus/types';
|
|
3
|
+
import { TOperationData } from '../operation/types';
|
|
4
|
+
import { IStrictDuration } from '../types';
|
|
5
|
+
import { EndableAction } from './endable-action';
|
|
6
|
+
import { ITimelineAction } from './types';
|
|
7
|
+
export declare class TimelineAction extends EndableAction implements ITimelineAction {
|
|
8
|
+
duration: IStrictDuration;
|
|
9
|
+
private _active;
|
|
10
|
+
get active(): boolean;
|
|
11
|
+
constructor(name: string, startOperations: IResolvedOperation[], endOperations: IResolvedOperation[], duration: IStrictDuration, eventBus: IEventbus);
|
|
12
|
+
start(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
13
|
+
end(initOperationData: TOperationData): Promise<TOperationData>;
|
|
14
|
+
}
|
package/dist/action/types.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { IResolvedOperation } from '../configuration/types';
|
|
2
|
-
import { TOperationData } from '../operation/types';
|
|
3
|
-
import { IStrictDuration } from '../types';
|
|
4
|
-
export interface IAction {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
startOperations: IResolvedOperation[];
|
|
8
|
-
start(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
9
|
-
}
|
|
10
|
-
export interface IEndableAction extends IAction {
|
|
11
|
-
endOperations: IResolvedOperation[];
|
|
12
|
-
end(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
13
|
-
}
|
|
14
|
-
export interface ITimelineAction extends IEndableAction {
|
|
15
|
-
get active(): boolean;
|
|
16
|
-
duration: IStrictDuration;
|
|
17
|
-
}
|
|
1
|
+
import { IResolvedOperation } from '../configuration/types';
|
|
2
|
+
import { TOperationData } from '../operation/types';
|
|
3
|
+
import { IStrictDuration } from '../types';
|
|
4
|
+
export interface IAction {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
startOperations: IResolvedOperation[];
|
|
8
|
+
start(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
9
|
+
}
|
|
10
|
+
export interface IEndableAction extends IAction {
|
|
11
|
+
endOperations: IResolvedOperation[];
|
|
12
|
+
end(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
13
|
+
}
|
|
14
|
+
export interface ITimelineAction extends IEndableAction {
|
|
15
|
+
get active(): boolean;
|
|
16
|
+
duration: IStrictDuration;
|
|
17
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { IEngineConfiguration } from '../configuration/types';
|
|
2
|
-
export interface IAssetInfo {
|
|
3
|
-
path: string;
|
|
4
|
-
extension: string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* This function takes an Eligius engine configuration, a root path for the configuration file and an arbitrary list of asset info.
|
|
8
|
-
* The asset info determines a number of subdirectories in the root path that contain the different assets used by the presentation.
|
|
9
|
-
* I.e. html, json, etc.
|
|
10
|
-
*
|
|
11
|
-
* @param config
|
|
12
|
-
* @param configPath
|
|
13
|
-
* @param assetInfo
|
|
14
|
-
*/
|
|
15
|
-
export declare function generateImporterSourceCode(config: IEngineConfiguration, configPath: string, assetInfo: IAssetInfo[]): string;
|
|
1
|
+
import { IEngineConfiguration } from '../configuration/types';
|
|
2
|
+
export interface IAssetInfo {
|
|
3
|
+
path: string;
|
|
4
|
+
extension: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* This function takes an Eligius engine configuration, a root path for the configuration file and an arbitrary list of asset info.
|
|
8
|
+
* The asset info determines a number of subdirectories in the root path that contain the different assets used by the presentation.
|
|
9
|
+
* I.e. html, json, etc.
|
|
10
|
+
*
|
|
11
|
+
* @param config
|
|
12
|
+
* @param configPath
|
|
13
|
+
* @param assetInfo
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateImporterSourceCode(config: IEngineConfiguration, configPath: string, assetInfo: IAssetInfo[]): string;
|
package/dist/build/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { generateImporterSourceCode } from './generate-importer-source-code';
|
|
1
|
+
export { generateImporterSourceCode } from './generate-importer-source-code';
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { TOperation, TOperationData } from '../../operation/types';
|
|
2
|
-
import { ExtractDataType, IActionConfiguration, IEndableActionConfiguration, ITimelineActionConfiguration } from '../types';
|
|
3
|
-
import { ConfigurationFactory } from './configuration-factory';
|
|
4
|
-
export declare class ActionCreatorFactory {
|
|
5
|
-
private readonly configurationfactory;
|
|
6
|
-
constructor(configurationfactory: ConfigurationFactory);
|
|
7
|
-
createAction(name: string): EndableActionCreator;
|
|
8
|
-
createInitAction(name: string): EndableActionCreator;
|
|
9
|
-
createEventAction(name: string): ActionCreator;
|
|
10
|
-
createTimelineAction(uri: string, name: string): TimelineActionCreator;
|
|
11
|
-
end(): ConfigurationFactory;
|
|
12
|
-
}
|
|
13
|
-
export declare class ActionCreator<T extends IActionConfiguration = IActionConfiguration> {
|
|
14
|
-
private readonly factory;
|
|
15
|
-
actionConfig: T;
|
|
16
|
-
constructor(name: string | undefined, factory: ActionCreatorFactory);
|
|
17
|
-
getId(): string;
|
|
18
|
-
setName(name: string): this;
|
|
19
|
-
getConfiguration(callBack: (config: T) => T): this;
|
|
20
|
-
addStartOperationByType<T extends TOperation<any>>(operationClass: T, operationData: Partial<ExtractDataType<T>>): this;
|
|
21
|
-
addStartOperation(systemName: string, operationData: TOperationData): this;
|
|
22
|
-
next(): ActionCreatorFactory;
|
|
23
|
-
}
|
|
24
|
-
export declare class EndableActionCreator<T extends IEndableActionConfiguration = IEndableActionConfiguration> extends ActionCreator<T> {
|
|
25
|
-
constructor(name: string | undefined, factory: ActionCreatorFactory);
|
|
26
|
-
addEndOperationByType<T extends TOperation<any>>(operationClass: T, operationData: Partial<ExtractDataType<T>>): this;
|
|
27
|
-
addEndOperation(systemName: string, operationData: TOperationData): this;
|
|
28
|
-
}
|
|
29
|
-
export declare class TimelineActionCreator extends EndableActionCreator<ITimelineActionConfiguration> {
|
|
30
|
-
addDuration(start: number, end?: number): this;
|
|
31
|
-
}
|
|
1
|
+
import { TOperation, TOperationData } from '../../operation/types';
|
|
2
|
+
import { ExtractDataType, IActionConfiguration, IEndableActionConfiguration, ITimelineActionConfiguration } from '../types';
|
|
3
|
+
import { ConfigurationFactory } from './configuration-factory';
|
|
4
|
+
export declare class ActionCreatorFactory {
|
|
5
|
+
private readonly configurationfactory;
|
|
6
|
+
constructor(configurationfactory: ConfigurationFactory);
|
|
7
|
+
createAction(name: string): EndableActionCreator;
|
|
8
|
+
createInitAction(name: string): EndableActionCreator;
|
|
9
|
+
createEventAction(name: string): ActionCreator;
|
|
10
|
+
createTimelineAction(uri: string, name: string): TimelineActionCreator;
|
|
11
|
+
end(): ConfigurationFactory;
|
|
12
|
+
}
|
|
13
|
+
export declare class ActionCreator<T extends IActionConfiguration = IActionConfiguration> {
|
|
14
|
+
private readonly factory;
|
|
15
|
+
actionConfig: T;
|
|
16
|
+
constructor(name: string | undefined, factory: ActionCreatorFactory);
|
|
17
|
+
getId(): string;
|
|
18
|
+
setName(name: string): this;
|
|
19
|
+
getConfiguration(callBack: (config: T) => T): this;
|
|
20
|
+
addStartOperationByType<T extends TOperation<any>>(operationClass: T, operationData: Partial<ExtractDataType<T>>): this;
|
|
21
|
+
addStartOperation(systemName: string, operationData: TOperationData): this;
|
|
22
|
+
next(): ActionCreatorFactory;
|
|
23
|
+
}
|
|
24
|
+
export declare class EndableActionCreator<T extends IEndableActionConfiguration = IEndableActionConfiguration> extends ActionCreator<T> {
|
|
25
|
+
constructor(name: string | undefined, factory: ActionCreatorFactory);
|
|
26
|
+
addEndOperationByType<T extends TOperation<any>>(operationClass: T, operationData: Partial<ExtractDataType<T>>): this;
|
|
27
|
+
addEndOperation(systemName: string, operationData: TOperationData): this;
|
|
28
|
+
}
|
|
29
|
+
export declare class TimelineActionCreator extends EndableActionCreator<ITimelineActionConfiguration> {
|
|
30
|
+
addDuration(start: number, end?: number): this;
|
|
31
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import * as operations from '../../operation';
|
|
2
|
-
import { TOperation, TOperationData } from '../../operation/types';
|
|
3
|
-
import { ExtractDataType, IActionConfiguration, IEndableActionConfiguration, IOperationConfiguration, ITimelineActionConfiguration } from '../types';
|
|
4
|
-
import { ConfigurationFactory } from './configuration-factory';
|
|
5
|
-
|
|
6
|
-
export declare class ActionEditor<T extends IActionConfiguration = IActionConfiguration> {
|
|
7
|
-
protected actionConfig: T;
|
|
8
|
-
protected readonly configurationFactory: ConfigurationFactory;
|
|
9
|
-
constructor(actionConfig: T, configurationFactory: ConfigurationFactory);
|
|
10
|
-
updateConfiguration(): void;
|
|
11
|
-
getConfiguration(callBack: (config: T) => T | undefined): this;
|
|
12
|
-
setName(name: string): this;
|
|
13
|
-
getName(): string;
|
|
14
|
-
addStartOperationByType<T extends TOperation<any>>(operationClass: T, operationData: Partial<ExtractDataType<T>>): OperationEditor<this>;
|
|
15
|
-
addStartOperation(systemName: TOperationName, operationData: TOperationData, id?: string): OperationEditor<this>;
|
|
16
|
-
editStartOperation(id: string): OperationEditor<ActionEditor<T>>;
|
|
17
|
-
removeStartOperation(id: string): this;
|
|
18
|
-
moveStartOperation(id: string, direction: 'up' | 'down'): this;
|
|
19
|
-
next(): ConfigurationFactory;
|
|
20
|
-
}
|
|
21
|
-
export declare class EndableActionEditor<T extends IEndableActionConfiguration = IEndableActionConfiguration> extends ActionEditor<T> {
|
|
22
|
-
addEndOperationByType<T extends TOperation<any>>(operationClass: T, operationData: Partial<ExtractDataType<T>>): OperationEditor<this>;
|
|
23
|
-
addEndOperation(systemName: string, operationData: TOperationData): OperationEditor<this>;
|
|
24
|
-
editEndOperation(id: string): OperationEditor<this>;
|
|
25
|
-
removeEndOperation(id: string): this;
|
|
26
|
-
moveEndOperation(id: string, direction: 'up' | 'down'): this;
|
|
27
|
-
}
|
|
28
|
-
export declare class TimelineActionEditor extends EndableActionEditor<ITimelineActionConfiguration> {
|
|
29
|
-
setDuration(start: number, end?: number): this;
|
|
30
|
-
}
|
|
31
|
-
export declare class OperationEditor<T extends ActionEditor> {
|
|
32
|
-
private operationConfig;
|
|
33
|
-
private actionEditor;
|
|
34
|
-
constructor(operationConfig: IOperationConfiguration, actionEditor: T);
|
|
35
|
-
getConfiguration(callBack: (config: IOperationConfiguration) => IOperationConfiguration): this;
|
|
36
|
-
getSystemName(): string;
|
|
37
|
-
setSystemName(systemName: TOperationName): this;
|
|
38
|
-
setOperationData(operationData: TOperationData): this;
|
|
39
|
-
setOperationDataItem(key: string, value: any): this;
|
|
40
|
-
getOperationDataKeys(): string[];
|
|
41
|
-
getOperationDataValue(key: string): any;
|
|
42
|
-
next(): T;
|
|
43
|
-
}
|
|
44
|
-
export {};
|
|
1
|
+
import * as operations from '../../operation';
|
|
2
|
+
import { TOperation, TOperationData } from '../../operation/types';
|
|
3
|
+
import { ExtractDataType, IActionConfiguration, IEndableActionConfiguration, IOperationConfiguration, ITimelineActionConfiguration } from '../types';
|
|
4
|
+
import { ConfigurationFactory } from './configuration-factory';
|
|
5
|
+
type TOperationName = keyof typeof operations;
|
|
6
|
+
export declare class ActionEditor<T extends IActionConfiguration = IActionConfiguration> {
|
|
7
|
+
protected actionConfig: T;
|
|
8
|
+
protected readonly configurationFactory: ConfigurationFactory;
|
|
9
|
+
constructor(actionConfig: T, configurationFactory: ConfigurationFactory);
|
|
10
|
+
updateConfiguration(): void;
|
|
11
|
+
getConfiguration(callBack: (config: T) => T | undefined): this;
|
|
12
|
+
setName(name: string): this;
|
|
13
|
+
getName(): string;
|
|
14
|
+
addStartOperationByType<T extends TOperation<any>>(operationClass: T, operationData: Partial<ExtractDataType<T>>): OperationEditor<this>;
|
|
15
|
+
addStartOperation(systemName: TOperationName, operationData: TOperationData, id?: string): OperationEditor<this>;
|
|
16
|
+
editStartOperation(id: string): OperationEditor<ActionEditor<T>>;
|
|
17
|
+
removeStartOperation(id: string): this;
|
|
18
|
+
moveStartOperation(id: string, direction: 'up' | 'down'): this;
|
|
19
|
+
next(): ConfigurationFactory;
|
|
20
|
+
}
|
|
21
|
+
export declare class EndableActionEditor<T extends IEndableActionConfiguration = IEndableActionConfiguration> extends ActionEditor<T> {
|
|
22
|
+
addEndOperationByType<T extends TOperation<any>>(operationClass: T, operationData: Partial<ExtractDataType<T>>): OperationEditor<this>;
|
|
23
|
+
addEndOperation(systemName: string, operationData: TOperationData): OperationEditor<this>;
|
|
24
|
+
editEndOperation(id: string): OperationEditor<this>;
|
|
25
|
+
removeEndOperation(id: string): this;
|
|
26
|
+
moveEndOperation(id: string, direction: 'up' | 'down'): this;
|
|
27
|
+
}
|
|
28
|
+
export declare class TimelineActionEditor extends EndableActionEditor<ITimelineActionConfiguration> {
|
|
29
|
+
setDuration(start: number, end?: number): this;
|
|
30
|
+
}
|
|
31
|
+
export declare class OperationEditor<T extends ActionEditor> {
|
|
32
|
+
private operationConfig;
|
|
33
|
+
private actionEditor;
|
|
34
|
+
constructor(operationConfig: IOperationConfiguration, actionEditor: T);
|
|
35
|
+
getConfiguration(callBack: (config: IOperationConfiguration) => IOperationConfiguration): this;
|
|
36
|
+
getSystemName(): string;
|
|
37
|
+
setSystemName(systemName: TOperationName): this;
|
|
38
|
+
setOperationData(operationData: TOperationData): this;
|
|
39
|
+
setOperationDataItem(key: string, value: any): this;
|
|
40
|
+
getOperationDataKeys(): string[];
|
|
41
|
+
getOperationDataValue(key: string): any;
|
|
42
|
+
next(): T;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -1,134 +1,135 @@
|
|
|
1
|
-
import { TimelineTypes } from '../../types';
|
|
2
|
-
import { IActionConfiguration, IEngineConfiguration, ITimelineActionConfiguration, ITimelineConfiguration } from '../types';
|
|
3
|
-
import { ActionCreatorFactory } from './action-creator-factory';
|
|
4
|
-
import { ActionEditor, EndableActionEditor, TimelineActionEditor } from './action-editor';
|
|
5
|
-
import { LabelEditor } from './label-editor';
|
|
6
|
-
import { TimelineProvidersSettingsEditor } from './timeline-provider-settings-editor';
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* This class offers a fluent and strongly typed DSL for creating Eligius configurations.
|
|
11
|
-
*
|
|
12
|
-
* @example Building a configuration using the factory
|
|
13
|
-
* To initialize a basic configuration to start off of:
|
|
14
|
-
* ```ts
|
|
15
|
-
* const factory = new ConfigurationFactory()
|
|
16
|
-
* .init("en-US") // Define the default language
|
|
17
|
-
* .addLanguage("en-US", "English") // Add English as a supported language
|
|
18
|
-
* .addLanguage("nl-NL", "Nederlands") // Add Dutch as a supported language
|
|
19
|
-
* .setLayoutTemplate("<div class=\"main.container\"></div>") // Add the main container for the presentation
|
|
20
|
-
* .setContainerSelector("#ct-container") // Selector for the element in the body that will contain the presentation
|
|
21
|
-
* .addTimeline( // Add a first timeline
|
|
22
|
-
* 'timeline-1', // Give it a name
|
|
23
|
-
* "animation", // This is RAF based timeline
|
|
24
|
-
* 200, // The duration of the timeline in seconds
|
|
25
|
-
* false, // The presentation does NOT play in a loop
|
|
26
|
-
* ".timeline-container" // The element within the main layout (defined by the layoutTemplate) in which the timeline will be rendered
|
|
27
|
-
* )
|
|
28
|
-
* .editTimelineProviderSettings() // Add a timeline provider
|
|
29
|
-
* .addProvider("animation") // One that provides timelines for type 'animation'
|
|
30
|
-
* .setSystemName("RequestAnimationFrameTimelineProvider") // The system name of the provider
|
|
31
|
-
* .setVendor("eligius") // Eligius is the vendor in this case
|
|
32
|
-
* .end(); // This finally returns the ConfigurationFactory instance
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* Then to add an init action:
|
|
36
|
-
* ```ts
|
|
37
|
-
* factory
|
|
38
|
-
* .createInitAction("GetUserName")
|
|
39
|
-
* .addStartOperationByType(getQueryParams, {
|
|
40
|
-
* defaultValues: { username: "guest" },
|
|
41
|
-
* })
|
|
42
|
-
* .addStartOperationByType(setGlobalData, { properties: ["queryParams"] });
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* After that, add a timeline action:
|
|
46
|
-
* ```ts
|
|
47
|
-
* factory.createTimelineAction("timeline-1", "AddIntroContainer")
|
|
48
|
-
* .addDuration(0, 10)
|
|
49
|
-
* .addStartOperationByType(selectElement, { selector: ".timeline-container" })
|
|
50
|
-
* .addStartOperationByType(setElementContent, {
|
|
51
|
-
* template: '<div class="intro-text"></div>',
|
|
52
|
-
* })
|
|
53
|
-
* .addEndOperationByType(selectElement, { selector: ".intro-text" })
|
|
54
|
-
* .addEndOperationByType(removeElement, {});
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* It also possible to extend the factory with specialized creation methods for the particular
|
|
58
|
-
* configuration you are building:
|
|
59
|
-
* ```ts
|
|
60
|
-
* function addImage(this: ConfigurationFactory, actionName: string, imageSrc: string, imageId: string) {
|
|
61
|
-
* this.createInitAction(actionName)
|
|
62
|
-
* .addStartOperationByType(selectElement, { selector: ".timeline-container" })
|
|
63
|
-
* .addStartOperationByType(createElement, { element: 'img', attributes: {src: imageSrc, imageId} })
|
|
64
|
-
* .addStartOperationByType(setElementContent, { insertionType: "append" })
|
|
65
|
-
* .addEndOperationByType(selectElement, { selector: `#${imageId}` })
|
|
66
|
-
* .addEndOperationByType(removeElement, {});
|
|
67
|
-
* }
|
|
68
|
-
*
|
|
69
|
-
* const customFactory = ConfigurationFactory.extend(factory, "addImage", addImage);
|
|
70
|
-
*
|
|
71
|
-
* customFactory.addImage("MyImageActionName", "my-image.png", "my-image-id");
|
|
72
|
-
* ```
|
|
73
|
-
*
|
|
74
|
-
* Finally, retrieve the configuration and save it:
|
|
75
|
-
* ```ts
|
|
76
|
-
* import fs from "fs";
|
|
77
|
-
*
|
|
78
|
-
* const configuration = customFactory.getConfiguration();
|
|
79
|
-
*
|
|
80
|
-
* fs.writeFileSync("/my/path/configuration.json", JSON.stringify(configuration), {encoding:'utf-8'})
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
* The `ConfigurationFactory` can also be used to edit an existing configuration. In this case, simply
|
|
84
|
-
* pass the JSON configuration to the `ConfigurationFactory`'s constructor:
|
|
85
|
-
* ```ts
|
|
86
|
-
* import myConfiguration from './my-configuration.json';
|
|
87
|
-
*
|
|
88
|
-
* const factory = new ConfigurationFactory(myConfiguration);
|
|
89
|
-
*
|
|
90
|
-
* factory.editInitAction("existingActionName")
|
|
91
|
-
* .removeEndOperation("475fd0ab-5755-4e60-8f7c-e1988a109678");
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
*/
|
|
95
|
-
export declare class ConfigurationFactory {
|
|
96
|
-
actionCreatorFactory: ActionCreatorFactory;
|
|
97
|
-
configuration: IEngineConfiguration;
|
|
98
|
-
constructor(config?: IEngineConfiguration);
|
|
99
|
-
static extend<T extends ConfigurationFactory, K extends string | number | symbol, C extends ConfigurationFactoryExtension>(factory: T, extensionMethodName: K, extensionMethod: C): T & { [k in K]: C; };
|
|
100
|
-
static extendMultiple<T extends ConfigurationFactory, C extends ConfigurationFactoryExtension, D extends {
|
|
101
|
-
[name: string]: C;
|
|
102
|
-
}>(factory: T, extensions: D): T & D;
|
|
103
|
-
init(defaultLanguage:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
private
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
private
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
1
|
+
import { TimelineTypes, TLanguageCode } from '../../types';
|
|
2
|
+
import { IActionConfiguration, IEngineConfiguration, ITimelineActionConfiguration, ITimelineConfiguration } from '../types';
|
|
3
|
+
import { ActionCreatorFactory } from './action-creator-factory';
|
|
4
|
+
import { ActionEditor, EndableActionEditor, TimelineActionEditor } from './action-editor';
|
|
5
|
+
import { LabelEditor } from './label-editor';
|
|
6
|
+
import { TimelineProvidersSettingsEditor } from './timeline-provider-settings-editor';
|
|
7
|
+
export type TEngineConfigurationLists = Pick<IEngineConfiguration, 'availableLanguages' | 'initActions' | 'actions' | 'eventActions' | 'timelines' | 'labels'>;
|
|
8
|
+
type ConfigurationFactoryExtension = (this: ConfigurationFactory, ...rest: any[]) => void;
|
|
9
|
+
/**
|
|
10
|
+
* This class offers a fluent, extensible and strongly typed DSL for creating Eligius configurations.
|
|
11
|
+
*
|
|
12
|
+
* @example Building a configuration using the factory
|
|
13
|
+
* To initialize a basic configuration to start off of:
|
|
14
|
+
* ```ts
|
|
15
|
+
* const factory = new ConfigurationFactory()
|
|
16
|
+
* .init("en-US") // Define the default language
|
|
17
|
+
* .addLanguage("en-US", "English") // Add English as a supported language
|
|
18
|
+
* .addLanguage("nl-NL", "Nederlands") // Add Dutch as a supported language
|
|
19
|
+
* .setLayoutTemplate("<div class=\"main.container\"></div>") // Add the main container for the presentation
|
|
20
|
+
* .setContainerSelector("#ct-container") // Selector for the element in the body that will contain the presentation
|
|
21
|
+
* .addTimeline( // Add a first timeline
|
|
22
|
+
* 'timeline-1', // Give it a name
|
|
23
|
+
* "animation", // This is RAF based timeline
|
|
24
|
+
* 200, // The duration of the timeline in seconds
|
|
25
|
+
* false, // The presentation does NOT play in a loop
|
|
26
|
+
* ".timeline-container" // The element within the main layout (defined by the layoutTemplate) in which the timeline will be rendered
|
|
27
|
+
* )
|
|
28
|
+
* .editTimelineProviderSettings() // Add a timeline provider
|
|
29
|
+
* .addProvider("animation") // One that provides timelines for type 'animation'
|
|
30
|
+
* .setSystemName("RequestAnimationFrameTimelineProvider") // The system name of the provider
|
|
31
|
+
* .setVendor("eligius") // Eligius is the vendor in this case
|
|
32
|
+
* .end(); // This finally returns the ConfigurationFactory instance
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* Then to add an init action:
|
|
36
|
+
* ```ts
|
|
37
|
+
* factory
|
|
38
|
+
* .createInitAction("GetUserName")
|
|
39
|
+
* .addStartOperationByType(getQueryParams, {
|
|
40
|
+
* defaultValues: { username: "guest" },
|
|
41
|
+
* })
|
|
42
|
+
* .addStartOperationByType(setGlobalData, { properties: ["queryParams"] });
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* After that, add a timeline action:
|
|
46
|
+
* ```ts
|
|
47
|
+
* factory.createTimelineAction("timeline-1", "AddIntroContainer")
|
|
48
|
+
* .addDuration(0, 10)
|
|
49
|
+
* .addStartOperationByType(selectElement, { selector: ".timeline-container" })
|
|
50
|
+
* .addStartOperationByType(setElementContent, {
|
|
51
|
+
* template: '<div class="intro-text"></div>',
|
|
52
|
+
* })
|
|
53
|
+
* .addEndOperationByType(selectElement, { selector: ".intro-text" })
|
|
54
|
+
* .addEndOperationByType(removeElement, {});
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* It also possible to extend the factory with specialized creation methods for the particular
|
|
58
|
+
* configuration you are building:
|
|
59
|
+
* ```ts
|
|
60
|
+
* function addImage(this: ConfigurationFactory, actionName: string, imageSrc: string, imageId: string) {
|
|
61
|
+
* this.createInitAction(actionName)
|
|
62
|
+
* .addStartOperationByType(selectElement, { selector: ".timeline-container" })
|
|
63
|
+
* .addStartOperationByType(createElement, { element: 'img', attributes: {src: imageSrc, imageId} })
|
|
64
|
+
* .addStartOperationByType(setElementContent, { insertionType: "append" })
|
|
65
|
+
* .addEndOperationByType(selectElement, { selector: `#${imageId}` })
|
|
66
|
+
* .addEndOperationByType(removeElement, {});
|
|
67
|
+
* }
|
|
68
|
+
*
|
|
69
|
+
* const customFactory = ConfigurationFactory.extend(factory, "addImage", addImage);
|
|
70
|
+
*
|
|
71
|
+
* customFactory.addImage("MyImageActionName", "my-image.png", "my-image-id");
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* Finally, retrieve the configuration and save it:
|
|
75
|
+
* ```ts
|
|
76
|
+
* import fs from "fs";
|
|
77
|
+
*
|
|
78
|
+
* const configuration = customFactory.getConfiguration();
|
|
79
|
+
*
|
|
80
|
+
* fs.writeFileSync("/my/path/configuration.json", JSON.stringify(configuration), {encoding:'utf-8'})
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* The `ConfigurationFactory` can also be used to edit an existing configuration. In this case, simply
|
|
84
|
+
* pass the JSON configuration to the `ConfigurationFactory`'s constructor:
|
|
85
|
+
* ```ts
|
|
86
|
+
* import myConfiguration from './my-configuration.json';
|
|
87
|
+
*
|
|
88
|
+
* const factory = new ConfigurationFactory(myConfiguration);
|
|
89
|
+
*
|
|
90
|
+
* factory.editInitAction("existingActionName")
|
|
91
|
+
* .removeEndOperation("475fd0ab-5755-4e60-8f7c-e1988a109678");
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
export declare class ConfigurationFactory {
|
|
96
|
+
actionCreatorFactory: ActionCreatorFactory;
|
|
97
|
+
configuration: IEngineConfiguration;
|
|
98
|
+
constructor(config?: IEngineConfiguration);
|
|
99
|
+
static extend<T extends ConfigurationFactory, K extends string | number | symbol, C extends ConfigurationFactoryExtension>(factory: T, extensionMethodName: K, extensionMethod: C): T & { [k in K]: C; };
|
|
100
|
+
static extendMultiple<T extends ConfigurationFactory, C extends ConfigurationFactoryExtension, D extends {
|
|
101
|
+
[name: string]: C;
|
|
102
|
+
}>(factory: T, extensions: D): T & D;
|
|
103
|
+
init(defaultLanguage: TLanguageCode): this;
|
|
104
|
+
setEngine(systemName: string): this;
|
|
105
|
+
setLayoutTemplate(layoutTemplate: string): this;
|
|
106
|
+
setDefaultLanguage(defaultLanguage: string): this;
|
|
107
|
+
setContainerSelector(selector: string): this;
|
|
108
|
+
editTimelineProviderSettings(): TimelineProvidersSettingsEditor;
|
|
109
|
+
getConfiguration(callBack?: (copy: IEngineConfiguration) => IEngineConfiguration): IEngineConfiguration;
|
|
110
|
+
addLanguage(languageCode: TLanguageCode, languageLabel: string): this;
|
|
111
|
+
private _internalAddAction;
|
|
112
|
+
private _initializeCollection;
|
|
113
|
+
addAction(action: IActionConfiguration): void;
|
|
114
|
+
addInitAction(action: IActionConfiguration): void;
|
|
115
|
+
addEventAction(action: IActionConfiguration): void;
|
|
116
|
+
addTimelineAction(uri: string, action: ITimelineActionConfiguration): void;
|
|
117
|
+
createAction(name: string): import("./action-creator-factory").EndableActionCreator<import("../types").IEndableActionConfiguration>;
|
|
118
|
+
createInitAction(name: string): import("./action-creator-factory").EndableActionCreator<import("../types").IEndableActionConfiguration>;
|
|
119
|
+
createEventAction(name: string): import("./action-creator-factory").ActionCreator<IActionConfiguration>;
|
|
120
|
+
createTimelineAction(uri: string, name: string): import("./action-creator-factory").TimelineActionCreator;
|
|
121
|
+
addTimeline(uri: string, type: TimelineTypes, duration: number, loop: boolean, selector: string): this;
|
|
122
|
+
getTimeline(uri: string): ITimelineConfiguration | undefined;
|
|
123
|
+
removeTimeline(uri: string): this;
|
|
124
|
+
private _initializeLabel;
|
|
125
|
+
private _getLabelTranslation;
|
|
126
|
+
editLabel(id: string): LabelEditor;
|
|
127
|
+
addLabel(id: string, code: TLanguageCode, translation: string): this;
|
|
128
|
+
addLabels(id: string, translations: Record<TLanguageCode, string>): this;
|
|
129
|
+
removeLabel(id: string): this;
|
|
130
|
+
editAction(id: string): EndableActionEditor<import("../types").IEndableActionConfiguration>;
|
|
131
|
+
editEventAction(id: string): ActionEditor<import("../types").IEventActionConfiguration>;
|
|
132
|
+
editInitAction(id: string): EndableActionEditor<import("../types").IEndableActionConfiguration>;
|
|
133
|
+
editTimelineAction(uri: string, id: string): TimelineActionEditor;
|
|
134
|
+
}
|
|
135
|
+
export {};
|