eligius 2.3.2 → 3.0.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 +158 -33
- package/dist/configuration-api.d.mts +6095 -0
- package/dist/configuration-api.mjs +3876 -0
- package/dist/configuration-api.mjs.map +1 -0
- package/dist/index.d.mts +4075 -1392
- package/dist/index.mjs +10421 -4820
- package/dist/index.mjs.map +1 -1
- package/dist/metadata.d.mts +1040 -281
- package/dist/metadata.mjs +541 -277
- package/dist/metadata.mjs.map +1 -1
- package/dist/{chunk-w6R9maHv.mjs → rolldown-runtime-BOlb2svz.mjs} +1 -0
- package/jsonschema/eligius-configuration.json +120 -9
- package/jsonschema/operations/add-class.json +2 -7
- package/jsonschema/operations/add-controller-to-element.json +4 -3
- package/jsonschema/operations/add-globals-to-operation.json +40 -0
- package/jsonschema/operations/animate-with-class.json +8 -8
- package/jsonschema/operations/animate.json +10 -9
- package/jsonschema/operations/announce-to-screen-reader.json +2 -2
- package/jsonschema/operations/break-for-each.json +27 -0
- package/jsonschema/operations/broadcast-event.json +2 -2
- package/jsonschema/operations/calc.json +16 -3
- package/jsonschema/operations/clear-element.json +5 -14
- package/jsonschema/operations/clear-operation-data.json +3 -4
- package/jsonschema/operations/clear-storage.json +48 -0
- package/jsonschema/operations/compare-date.json +2 -2
- package/jsonschema/operations/concatenate-strings.json +2 -2
- package/jsonschema/operations/continue-for-each.json +27 -0
- package/jsonschema/operations/create-element.json +21 -5
- package/jsonschema/operations/custom-function.json +2 -2
- package/jsonschema/operations/end-action.json +5 -13
- package/jsonschema/operations/end-for-each.json +27 -0
- package/jsonschema/operations/end-when.json +27 -0
- package/jsonschema/operations/extend-controller.json +9 -7
- package/jsonschema/operations/filter-array.json +4 -12
- package/jsonschema/operations/find-in-array.json +4 -12
- package/jsonschema/operations/for-each.json +2 -3
- package/jsonschema/operations/format-date.json +2 -17
- package/jsonschema/operations/format-text.json +15 -7
- package/jsonschema/operations/get-attributes-from-element.json +9 -8
- package/jsonschema/operations/get-controller-from-element.json +2 -7
- package/jsonschema/operations/get-controller-instance.json +18 -5
- package/jsonschema/operations/get-current-time.json +3 -4
- package/jsonschema/operations/get-element-dimensions.json +4 -12
- package/jsonschema/operations/get-focused-element.json +3 -4
- package/jsonschema/operations/get-form-data.json +4 -12
- package/jsonschema/operations/get-import.json +2 -2
- package/jsonschema/operations/get-query-params.json +12 -5
- package/jsonschema/operations/get-scroll-position.json +3 -4
- package/jsonschema/operations/get-text-content.json +4 -12
- package/jsonschema/operations/http-delete.json +11 -3
- package/jsonschema/operations/http-post.json +11 -3
- package/jsonschema/operations/http-put.json +11 -3
- package/jsonschema/operations/invoke-object-method.json +2 -6
- package/jsonschema/operations/is-element-in-viewport.json +4 -12
- package/jsonschema/operations/load-from-storage.json +12 -3
- package/jsonschema/operations/load-json.json +5 -5
- package/jsonschema/operations/log.json +4 -7
- package/jsonschema/operations/map-array.json +2 -7
- package/jsonschema/operations/math.json +18 -3
- package/jsonschema/operations/otherwise.json +27 -0
- package/jsonschema/operations/remove-class.json +2 -7
- package/jsonschema/operations/remove-controller-from-element.json +2 -7
- package/jsonschema/operations/remove-element.json +5 -14
- package/jsonschema/operations/remove-properties-from-operation-data.json +2 -2
- package/jsonschema/operations/reparent-element.json +2 -7
- package/jsonschema/operations/replace-string.json +2 -6
- package/jsonschema/operations/replace-text.json +2 -6
- package/jsonschema/operations/request-action.json +2 -2
- package/jsonschema/operations/save-to-storage.json +12 -3
- package/jsonschema/operations/scroll-to-element.json +23 -13
- package/jsonschema/operations/scroll-to-position.json +12 -3
- package/jsonschema/operations/select-element.json +2 -2
- package/jsonschema/operations/set-data.json +8 -3
- package/jsonschema/operations/set-element-attributes.json +10 -9
- package/jsonschema/operations/set-element-content.json +5 -15
- package/jsonschema/operations/set-focus.json +5 -14
- package/jsonschema/operations/set-form-value.json +2 -7
- package/jsonschema/operations/set-global-data.json +2 -2
- package/jsonschema/operations/{set.json → set-operation-data.json} +12 -7
- package/jsonschema/operations/set-style.json +3 -8
- package/jsonschema/operations/set-variable.json +3 -5
- package/jsonschema/operations/sort-array.json +14 -13
- package/jsonschema/operations/split-string.json +2 -6
- package/jsonschema/operations/start-action.json +4 -12
- package/jsonschema/operations/substring-text.json +2 -6
- package/jsonschema/operations/toggle-class.json +2 -7
- package/jsonschema/operations/toggle-element.json +5 -14
- package/jsonschema/operations/toggle-form-element.json +2 -7
- package/jsonschema/operations/validate-form.json +41 -13
- package/jsonschema/operations/wait.json +2 -2
- package/jsonschema/operations/when.json +2 -2
- package/package.json +49 -24
package/README.md
CHANGED
|
@@ -16,11 +16,11 @@ The main concepts in Eligius are timelines, actions and operations. A timeline c
|
|
|
16
16
|
|
|
17
17
|
Actions can be called on specified points on such a timeline. An action consists of a list of start and end operations.
|
|
18
18
|
|
|
19
|
-
An operation is an atomic function. A context, for sharing data, is passed between each successive operation. Examples of operations are `
|
|
19
|
+
An operation is an atomic function. A context, for sharing data, is passed between each successive operation. Examples of operations are `selectElement`, `createElement` or `addClass`. [Here is a complete list of all available operations.](https://github.com/rolandzwaga/eligius/tree/main/src/operation)
|
|
20
20
|
By composing these atomic operations complex functionality can be achieved.
|
|
21
21
|
|
|
22
|
-
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: `
|
|
23
|
-
The end operations would be: `
|
|
22
|
+
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: `selectElement` (to select the element that will act as the image's parent), `createElement` (to create the img element with the required src attribute) and `setElementContent` (to add the img element to the previously selected parent).
|
|
23
|
+
The end operations would be: `selectElement` (to select the parent again) and `clearElement` (to remove the img element).
|
|
24
24
|
|
|
25
25
|
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.
|
|
26
26
|
|
|
@@ -32,10 +32,12 @@ The Eligius engine is populated by a JSON configuration. Think of this JSON as i
|
|
|
32
32
|
|
|
33
33
|
This section describes the different parts of this configuration.
|
|
34
34
|
|
|
35
|
+
Every configuration, action, operation and timeline needs a unique `id`; the examples below leave them out for brevity. Invalid configurations fail when the engine is created, with an error that names the JSON path.
|
|
36
|
+
|
|
35
37
|
### systemName property
|
|
36
38
|
|
|
37
39
|
In the rest of this section the property name `systemName` will be shown often. The value of this property describes a named import.
|
|
38
|
-
Currently one resource importer is supported by default: [`EligiusResourceImporter`](https://rolandzwaga.github.io/eligius/classes/EligiusResourceImporter.html).
|
|
40
|
+
Currently one resource importer is supported by default: [`EligiusResourceImporter`](https://rolandzwaga.github.io/eligius/classes/EligiusResourceImporter.html). It can also serve your own operations, functions, controllers, templates and JSON, see [Extending Eligius](#extending-eligius).
|
|
39
41
|
|
|
40
42
|
### engine
|
|
41
43
|
|
|
@@ -68,12 +70,13 @@ The engine setting defines the engine for which this configuration is written. C
|
|
|
68
70
|
}
|
|
69
71
|
```
|
|
70
72
|
|
|
71
|
-
These settings describe the providers that are available for the different kinds of timelines. The `tickInterval` property controls the precision of timeline positions - a value of `100` (milliseconds) enables 0.1 second precision, allowing fractional positions like `1.3` or `5.7`. Timeline providers are assembled from decomposed components:
|
|
73
|
+
These settings describe the providers that are available for the different kinds of timelines (`animation` or `mediaplayer`); every timeline type in use needs an entry. The `tickInterval` property controls the precision of timeline positions - a value of `100` (milliseconds, the default) enables 0.1 second precision, allowing fractional positions like `1.3` or `5.7`. Timeline providers are assembled from decomposed components:
|
|
72
74
|
|
|
73
75
|
**Position Sources** (required) - drive timeline position:
|
|
74
76
|
- `RafPositionSource` - RequestAnimationFrame-based, for animation timelines
|
|
75
77
|
- `ScrollPositionSource` - Scroll-based, for scroll-driven timelines
|
|
76
|
-
- `VideoPositionSource` - Video.js-based, for video timelines (requires video.js
|
|
78
|
+
- `VideoPositionSource` - Video.js-based, for video timelines (requires the optional video.js peer dependency, loaded on first use)
|
|
79
|
+
- `KeyboardStepSource` - Keyboard-driven stepping through markers or fixed steps
|
|
77
80
|
|
|
78
81
|
**Container Providers** (optional) - manage DOM elements where content is rendered:
|
|
79
82
|
- `DomContainerProvider` - Manages a DOM element by selector
|
|
@@ -125,11 +128,13 @@ Eligius aims to be fully multi lingual. This setting describes the different lan
|
|
|
125
128
|
...
|
|
126
129
|
"availableLanguages": [
|
|
127
130
|
{
|
|
128
|
-
"
|
|
131
|
+
"id": "lang-en",
|
|
132
|
+
"languageCode": "en-US",
|
|
129
133
|
"label": "English"
|
|
130
134
|
},
|
|
131
135
|
{
|
|
132
|
-
"
|
|
136
|
+
"id": "lang-nl",
|
|
137
|
+
"languageCode": "nl-NL",
|
|
133
138
|
"label": "Nederlands"
|
|
134
139
|
}
|
|
135
140
|
]
|
|
@@ -139,7 +144,7 @@ Eligius aims to be fully multi lingual. This setting describes the different lan
|
|
|
139
144
|
|
|
140
145
|
### language
|
|
141
146
|
|
|
142
|
-
This defines the default language, the value needs to equal one of the `
|
|
147
|
+
This defines the default language, the value needs to equal one of the `languageCode` values in the `availableLanguages` properties.
|
|
143
148
|
|
|
144
149
|
```json
|
|
145
150
|
{
|
|
@@ -193,7 +198,7 @@ Use these, for example, to load data, render global UI, etc.
|
|
|
193
198
|
|
|
194
199
|
### actions
|
|
195
200
|
|
|
196
|
-
This is a list of actions that are not directly associated with initialisation, tear down or time line positions. These can be executed from within another action.
|
|
201
|
+
This is a list of actions that are not directly associated with initialisation, tear down or time line positions. These can be executed from within another action with the `startAction` and `endAction` operations, and can have `endOperations` as well.
|
|
197
202
|
|
|
198
203
|
```json
|
|
199
204
|
{
|
|
@@ -254,9 +259,25 @@ Timeline positions support fractional values (e.g., `1.3`, `5.7`) when using a `
|
|
|
254
259
|
}
|
|
255
260
|
```
|
|
256
261
|
|
|
262
|
+
#### Per-timeline position sources
|
|
263
|
+
|
|
264
|
+
A timeline can override the settings of its type with `positionSource` (and `containerProvider`). Leave out `systemName` to change single settings, for example a different scroll container for one chapter:
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{ "uri": "chapter-2", "type": "animation", "positionSource": { "selector": "#chapter-2" }, ... }
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Or name another class to give one timeline a different clock, for example a scroll-driven chapter next to RAF-driven animation timelines:
|
|
271
|
+
|
|
272
|
+
```json
|
|
273
|
+
{ "uri": "chapter-2", "type": "animation", "positionSource": { "systemName": "ScrollPositionSource", "selector": "#chapter-2" }, ... }
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
An override that names a different `systemName` replaces the type settings instead of merging with them, so options meant for one class never reach another. A timeline that names its own `systemName` needs no `timelineProviderSettings` entry for its type. Video timelines share one player unless an override changes the video settings, for example `{"positionSource": {"sources": [{"src": "/chapter-2.mp4", "type": "video/mp4"}]}}`, which gives that timeline its own player. With the fluent API use `factory.setTimelinePositionSource('chapter-2', {...})` and `setTimelineContainerProvider`.
|
|
277
|
+
|
|
257
278
|
### event actions
|
|
258
279
|
|
|
259
|
-
This a list of actions that
|
|
280
|
+
This a list of actions that are triggered by an eventbus broadcast of `eventName` (optionally limited to `eventTopic`). Since an event doesn't have a tear down phase, these actions can only have a list of start operations.
|
|
260
281
|
|
|
261
282
|
```json
|
|
262
283
|
{
|
|
@@ -265,7 +286,8 @@ This a list of actions that can be triggered by an event broadcast. Since an eve
|
|
|
265
286
|
...
|
|
266
287
|
{
|
|
267
288
|
"name": "some name",
|
|
268
|
-
"
|
|
289
|
+
"eventName": "show-help",
|
|
290
|
+
"startOperations": [...]
|
|
269
291
|
}
|
|
270
292
|
...
|
|
271
293
|
]
|
|
@@ -273,31 +295,30 @@ This a list of actions that can be triggered by an event broadcast. Since an eve
|
|
|
273
295
|
}
|
|
274
296
|
```
|
|
275
297
|
|
|
276
|
-
###
|
|
298
|
+
### locales
|
|
277
299
|
|
|
278
|
-
|
|
279
|
-
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.
|
|
300
|
+
The textual content of the presentation, per language code. Translations can be nested and are looked up with dot-notation keys; `{{name}}` placeholders are filled from parameters. A language can also point to an external JSON file with `$ref`, which is loaded when the engine is created.
|
|
280
301
|
|
|
281
302
|
```json
|
|
282
303
|
{
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
"
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
"code": "nl-NL",
|
|
293
|
-
"label": "Dit is de hoofdtitel"
|
|
294
|
-
}
|
|
295
|
-
]
|
|
296
|
-
}
|
|
297
|
-
]
|
|
304
|
+
...
|
|
305
|
+
"locales": {
|
|
306
|
+
"en-US": {
|
|
307
|
+
"nav": {"home": "Home"},
|
|
308
|
+
"greeting": "Hello, {{name}}!"
|
|
309
|
+
},
|
|
310
|
+
"nl-NL": {"$ref": "./locales/nl-NL.json"}
|
|
311
|
+
}
|
|
312
|
+
...
|
|
298
313
|
}
|
|
299
314
|
```
|
|
300
315
|
|
|
316
|
+
Translations are rendered by the [`LabelController`](https://rolandzwaga.github.io/eligius/classes/LabelController.html), attached with the `addControllerToElement` operation and a `translationKey` such as `"nav.home"`. The controller follows language changes and updates the element it controls. Translation text is sanitized before it is inserted into the DOM. The `labels` array of earlier versions was removed in 2.2.0; see the [changelog](CHANGELOG.md) for the migration.
|
|
317
|
+
|
|
318
|
+
### Security
|
|
319
|
+
|
|
320
|
+
Configurations cannot run arbitrary code: operations, functions and controllers are looked up by name in the resource importer, and property chains cannot reach `window` or object prototypes. Translations and subtitles are sanitized, and `createElement`/`setElementAttributes` refuse event-handler attributes and `javascript:` URLs. `setElementContent` string templates are inserted as HTML, so build those from configuration only, never from user input.
|
|
321
|
+
|
|
301
322
|
## Running the engine
|
|
302
323
|
|
|
303
324
|
Running the engine is a matter of loading the configuration and feeding it to an engine instance.
|
|
@@ -308,7 +329,7 @@ import * as engineConfig from './my-eligius-config.json';
|
|
|
308
329
|
|
|
309
330
|
const factory = new EngineFactory(new EligiusResourceImporter(), window);
|
|
310
331
|
|
|
311
|
-
// createEngine returns { engine,
|
|
332
|
+
// createEngine returns { engine, localeManager, eventbus, destroy }
|
|
312
333
|
const { engine, destroy } = factory.createEngine((engineConfig as unknown) as IEngineConfiguration);
|
|
313
334
|
|
|
314
335
|
await engine.init();
|
|
@@ -319,6 +340,20 @@ console.log('Eligius engine ready for business');
|
|
|
319
340
|
await destroy();
|
|
320
341
|
```
|
|
321
342
|
|
|
343
|
+
Each engine created by the factory gets its own eventbus, returned as `eventbus`. To let several engines talk over one bus, pass it to the factory: `new EngineFactory(importer, window, {eventbus})`.
|
|
344
|
+
|
|
345
|
+
### Input bindings
|
|
346
|
+
|
|
347
|
+
By default the space key toggles playback and a window resize broadcasts `timeline-resize`. Configure this per factory:
|
|
348
|
+
|
|
349
|
+
```ts
|
|
350
|
+
new EngineFactory(new EligiusResourceImporter(), window, {
|
|
351
|
+
input: {playToggle: 'k', scope: 'engineRoot', resize: false},
|
|
352
|
+
});
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
`playToggle` takes a hotkeys-js key (`'space'`, `'ctrl+p, command+p'`) or `false`. `scope: 'engineRoot'` reacts only while the focus is inside the engine root, which suits embedded widgets. With the default `scope: 'document'` a press while nothing has focus also counts; when several engines share a page, that press toggles only the engine you last clicked or focused (otherwise the first one created). Buttons, links and form fields always keep the key. `playToggleHotkey` is deprecated in favour of `input.playToggle`.
|
|
356
|
+
|
|
322
357
|
### Subscribing to Engine Events
|
|
323
358
|
|
|
324
359
|
The engine exposes a type-safe event API:
|
|
@@ -332,6 +367,7 @@ const unsubscribe = engine.on('time', (position) => {
|
|
|
332
367
|
engine.on('start', () => console.log('Playback started'));
|
|
333
368
|
engine.on('pause', () => console.log('Playback paused'));
|
|
334
369
|
engine.on('timelineComplete', () => console.log('Timeline finished'));
|
|
370
|
+
engine.on('error', error => console.error(error.message)); // EngineActionError: which action, phase and operation failed
|
|
335
371
|
|
|
336
372
|
// Unsubscribe when done
|
|
337
373
|
unsubscribe();
|
|
@@ -366,8 +402,87 @@ Obviously having to type all of that JSON by hand can be a tad overwhelming and
|
|
|
366
402
|
|
|
367
403
|
It is encouraged to use this API to build specialized DSL's for specific presentations.
|
|
368
404
|
|
|
405
|
+
Build tools that generate configurations in plain Node, without a DOM, can import the factory from the `eligius/configuration-api` entry: `import {ConfigurationFactory} from 'eligius/configuration-api';`. The `...ByType` methods need the main `eligius` entry; use the name-based methods there.
|
|
406
|
+
|
|
369
407
|
Also, there is the [Eligian](https://github.com/rolandzwaga/eligian) project that aims to become an actual programming language for the Eligius runtime.
|
|
370
408
|
|
|
409
|
+
## Extending Eligius
|
|
410
|
+
|
|
411
|
+
Most presentations need a little application specific code: an analytics call, a store update, a chart. Register it with the `EligiusResourceImporter` constructor instead of writing a resource importer of your own:
|
|
412
|
+
|
|
413
|
+
| Registration | Used by |
|
|
414
|
+
|---|---|
|
|
415
|
+
| `operations` | an operation `systemName` in any action |
|
|
416
|
+
| `functions` | the `customFunction` operation (`{systemName: 'myFunction'}`) |
|
|
417
|
+
| `controllers` | the `getControllerInstance` and `addControllerToElement` operations |
|
|
418
|
+
| `templates` | `"template:<name>"` placeholders anywhere in the configuration |
|
|
419
|
+
| `json` | `"json:<name>"` placeholders (the configuration receives a copy) |
|
|
420
|
+
|
|
421
|
+
`getImport` can retrieve any registered resource. A registered name that clashes with a built-in name (for example a custom `selectElement`) throws, unless you pass `override: true`. Operations and functions must be functions, not classes; controllers must be classes that implement `IController`. Misspelled names fail with a "did you mean" hint that includes the registered names.
|
|
422
|
+
|
|
423
|
+
A complete example: a custom `trackEvent` operation and a custom `formatPrice` function, authored with the fluent API and run by the engine.
|
|
424
|
+
|
|
425
|
+
```typescript
|
|
426
|
+
import {
|
|
427
|
+
ConfigurationFactory,
|
|
428
|
+
EligiusResourceImporter,
|
|
429
|
+
EngineFactory,
|
|
430
|
+
type TOperation,
|
|
431
|
+
} from 'eligius';
|
|
432
|
+
|
|
433
|
+
// 1. A custom operation: receives the operation data, returns it for the next operation
|
|
434
|
+
interface ITrackEventOperationData {
|
|
435
|
+
category: string;
|
|
436
|
+
settings: {endpoint: string};
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
const trackEvent: TOperation<ITrackEventOperationData> = function (operationData) {
|
|
440
|
+
navigator.sendBeacon(operationData.settings.endpoint, operationData.category);
|
|
441
|
+
return operationData;
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
// 2. A custom function for customFunction: `this` is the operation scope
|
|
445
|
+
function formatPrice(operationData: {amount: number; price?: string}) {
|
|
446
|
+
operationData.price = `EUR ${operationData.amount.toFixed(2)}`;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// 3. Author the configuration. The fluent API checks operation names, so declare the
|
|
450
|
+
// custom operation name (only the name: this also works in 'eligius/configuration-api')
|
|
451
|
+
const factory = new ConfigurationFactory(undefined, {customOperations: ['trackEvent']});
|
|
452
|
+
factory
|
|
453
|
+
.init('en-US')
|
|
454
|
+
.setContainerSelector('#app')
|
|
455
|
+
.setLayoutTemplate('template:layout')
|
|
456
|
+
.addTimeline('main', 'animation', 30, false, '#stage')
|
|
457
|
+
.editTimelineProviderSettings()
|
|
458
|
+
.addProvider('animation', 'RafPositionSource')
|
|
459
|
+
.setContainer('#stage');
|
|
460
|
+
|
|
461
|
+
factory
|
|
462
|
+
.createTimelineAction('main', 'Intro')
|
|
463
|
+
.addDuration(0, 5)
|
|
464
|
+
.addStartOperation('trackEvent', {category: 'intro', settings: 'json:analytics'})
|
|
465
|
+
.addStartOperation('customFunction', {systemName: 'formatPrice', amount: 9.5})
|
|
466
|
+
.next()
|
|
467
|
+
.end();
|
|
468
|
+
|
|
469
|
+
const configuration = factory.getConfiguration();
|
|
470
|
+
|
|
471
|
+
// 4. Register the implementations and run the engine
|
|
472
|
+
const importer = new EligiusResourceImporter({
|
|
473
|
+
operations: {trackEvent},
|
|
474
|
+
functions: {formatPrice},
|
|
475
|
+
templates: {layout: '<div id="stage"></div>'},
|
|
476
|
+
json: {analytics: {endpoint: '/analytics'}},
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
const {engine, destroy} = new EngineFactory(importer, window).createEngine(configuration);
|
|
480
|
+
await engine.init();
|
|
481
|
+
await engine.start();
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
Custom operations have no generated metadata, so the JSON schema and the fluent API do not type or validate their operation data; only their names are checked. Custom position sources, container providers and playlists cannot be registered this way: pass your own `IResourceImporter` to the `EngineFactory` and delegate the other names to an `EligiusResourceImporter`.
|
|
485
|
+
|
|
371
486
|
## Metadata import (`eligius/metadata`)
|
|
372
487
|
|
|
373
488
|
Tooling that only needs to *inspect* Eligius's operation, controller and event **metadata** — code generators, DSL compilers, completion providers, documentation tools — can import it from the dedicated `eligius/metadata` entry point:
|
|
@@ -399,8 +514,18 @@ or
|
|
|
399
514
|
yarn add eligius
|
|
400
515
|
```
|
|
401
516
|
|
|
517
|
+
Peer dependencies:
|
|
518
|
+
|
|
519
|
+
- `jquery` (required)
|
|
520
|
+
- `lottie-web` (optional, only for `LottieController`, loaded on first use)
|
|
521
|
+
- `video.js` (optional, only for `VideoPositionSource`, loaded on first use)
|
|
522
|
+
- `@types/jquery` (optional, for TypeScript users of the main entry; also add `"DOM"` to your `lib`)
|
|
523
|
+
|
|
524
|
+
Upgrading from 2.x? Version 3.0.0 has breaking changes; read the [changelog](CHANGELOG.md) first.
|
|
525
|
+
|
|
402
526
|
## development
|
|
403
527
|
|
|
404
528
|
- run `npm install`
|
|
405
|
-
- Use `npm run
|
|
406
|
-
- Use `npm run
|
|
529
|
+
- Use `npm test -- --run` to run the unit tests (tests use Vitest)
|
|
530
|
+
- Use `npm run typecheck` and `npm run lint` before committing
|
|
531
|
+
- Use `npm run build` to create a production library bundle, then `npm run check:types` to verify the published type declarations
|