eligius 1.5.2 → 2.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.
Files changed (45) hide show
  1. package/README.md +107 -25
  2. package/dist/index.d.mts +1882 -396
  3. package/dist/index.mjs +2618 -1442
  4. package/dist/index.mjs.map +1 -1
  5. package/jsonschema/operation-templates/animate-with-class.json +1 -3
  6. package/jsonschema/operation-templates/clear-operation-data.json +1 -3
  7. package/jsonschema/operation-templates/clear-storage.json +1 -3
  8. package/jsonschema/operation-templates/concatenate-strings.json +1 -3
  9. package/jsonschema/operation-templates/create-element.json +1 -3
  10. package/jsonschema/operation-templates/filter-array.json +2 -6
  11. package/jsonschema/operation-templates/find-in-array.json +2 -6
  12. package/jsonschema/operation-templates/get-query-params.json +1 -3
  13. package/jsonschema/operation-templates/http-delete.json +1 -3
  14. package/jsonschema/operation-templates/http-post.json +1 -3
  15. package/jsonschema/operation-templates/http-put.json +1 -3
  16. package/jsonschema/operation-templates/invoke-object-method.json +1 -3
  17. package/jsonschema/operation-templates/load-json.json +1 -3
  18. package/jsonschema/operation-templates/log.json +1 -3
  19. package/jsonschema/operation-templates/select-element.json +1 -3
  20. package/jsonschema/operation-templates/set-operation-data.json +1 -3
  21. package/jsonschema/operation-templates/sort-array.json +2 -6
  22. package/jsonschema/operation-templates/split-string.json +1 -3
  23. package/jsonschema/operation-templates/substring-text.json +1 -3
  24. package/jsonschema/operation-templates/validate-form.json +1 -3
  25. package/jsonschema/operations/animate-with-class.json +1 -3
  26. package/jsonschema/operations/clear-operation-data.json +1 -3
  27. package/jsonschema/operations/clear-storage.json +1 -3
  28. package/jsonschema/operations/concatenate-strings.json +1 -3
  29. package/jsonschema/operations/create-element.json +1 -3
  30. package/jsonschema/operations/filter-array.json +2 -6
  31. package/jsonschema/operations/find-in-array.json +2 -6
  32. package/jsonschema/operations/get-query-params.json +1 -3
  33. package/jsonschema/operations/http-delete.json +1 -3
  34. package/jsonschema/operations/http-post.json +1 -3
  35. package/jsonschema/operations/http-put.json +1 -3
  36. package/jsonschema/operations/invoke-object-method.json +1 -3
  37. package/jsonschema/operations/load-json.json +1 -3
  38. package/jsonschema/operations/log.json +1 -3
  39. package/jsonschema/operations/select-element.json +1 -3
  40. package/jsonschema/operations/set-operation-data.json +1 -3
  41. package/jsonschema/operations/sort-array.json +2 -6
  42. package/jsonschema/operations/split-string.json +1 -3
  43. package/jsonschema/operations/substring-text.json +1 -3
  44. package/jsonschema/operations/validate-form.json +1 -3
  45. package/package.json +8 -7
package/README.md CHANGED
@@ -58,18 +58,51 @@ The engine setting defines the engine for which this configuration is written. C
58
58
  ...
59
59
  "timelineProviderSettings": {
60
60
  "animation": {
61
- "vendor": "eligius",
62
- "systemName": "RequestAnimationFrameTimelineProvider"
61
+ "positionSource": {
62
+ "systemName": "RafPositionSource",
63
+ "tickInterval": 100
64
+ }
63
65
  }
64
66
  }
65
67
  ...
66
68
  }
67
69
  ```
68
70
 
69
- These settings describe the providers that are availab;e for the different kinds of timelines.
70
- There are three kinds: `audio`, `video` and `animation`.
71
- For `animation` there is `RequestAnimationFrameTimelineProvider`.
72
- For `audio` and `video` the `MediaElementTimelineProvider` can be used, but unfortunately that class is disabled for now.
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:
72
+
73
+ **Position Sources** (required) - drive timeline position:
74
+ - `RafPositionSource` - RequestAnimationFrame-based, for animation timelines
75
+ - `ScrollPositionSource` - Scroll-based, for scroll-driven timelines
76
+ - `VideoPositionSource` - Video.js-based, for video timelines (requires video.js as a peer dependency)
77
+
78
+ **Container Providers** (optional) - manage DOM elements where content is rendered:
79
+ - `DomContainerProvider` - Manages a DOM element by selector
80
+
81
+ **Playlists** (optional) - manage multi-item navigation:
82
+ - `SimplePlaylist` - Basic playlist with array of items
83
+
84
+ Example with all components:
85
+ ```json
86
+ {
87
+ "timelineProviderSettings": {
88
+ "animation": {
89
+ "positionSource": {
90
+ "systemName": "RafPositionSource",
91
+ "tickInterval": 100
92
+ },
93
+ "container": {
94
+ "systemName": "DomContainerProvider",
95
+ "selector": "#render-area"
96
+ },
97
+ "playlist": {
98
+ "systemName": "SimplePlaylist",
99
+ "items": [{ "uri": "/video1.mp4" }, { "uri": "/video2.mp4" }],
100
+ "identifierKey": "uri"
101
+ }
102
+ }
103
+ }
104
+ }
105
+ ```
73
106
 
74
107
  ### container selector
75
108
 
@@ -190,28 +223,32 @@ This is a list of actions that are not directly associated with initialisation,
190
223
 
191
224
  This block defines a list of timelines with its associated actions. This part of the configuration contains the brunt of a presentation since this defines all of the actions that are triggered along each timeline position.
192
225
 
226
+ Timeline positions support fractional values (e.g., `1.3`, `5.7`) when using a `tickInterval` of `100` (0.1 second precision).
227
+
193
228
  ```json
194
229
  {
195
230
  ...
196
231
  "timelines": [
197
- "type": "animation",
198
- "uri": "animation-01",
199
- "duration": 45,
200
- "loop": true,
201
- "selector": ".timeline-div",
202
- "timelineActions": [
203
- ...
204
- {
205
- "name": "ShowSomething",
206
- "duration": {
207
- "start": 7,
208
- "end": 32
209
- },
210
- "startOperations": [...],
211
- "endOperations": [...],
212
- }
213
- ...
214
- ]
232
+ {
233
+ "type": "animation",
234
+ "uri": "animation-01",
235
+ "duration": 45.5,
236
+ "loop": true,
237
+ "selector": ".timeline-div",
238
+ "timelineActions": [
239
+ ...
240
+ {
241
+ "name": "ShowSomething",
242
+ "duration": {
243
+ "start": 1.3,
244
+ "end": 3.7
245
+ },
246
+ "startOperations": [...],
247
+ "endOperations": [...]
248
+ }
249
+ ...
250
+ ]
251
+ }
215
252
  ]
216
253
  ...
217
254
  }
@@ -271,11 +308,56 @@ import * as engineConfig from './my-eligius-config.json';
271
308
 
272
309
  const factory = new EngineFactory(new EligiusResourceImporter(), window);
273
310
 
274
- const engine = factory.createEngine((engineConfig as unknown) as IEngineConfiguration);
311
+ // createEngine returns { engine, languageManager, eventbus, destroy }
312
+ const { engine, destroy } = factory.createEngine((engineConfig as unknown) as IEngineConfiguration);
275
313
 
276
314
  await engine.init();
277
315
 
278
316
  console.log('Eligius engine ready for business');
317
+
318
+ // When done, clean up everything
319
+ await destroy();
320
+ ```
321
+
322
+ ### Subscribing to Engine Events
323
+
324
+ The engine exposes a type-safe event API:
325
+
326
+ ```javascript
327
+ // Subscribe to engine events directly
328
+ const unsubscribe = engine.on('time', (position) => {
329
+ console.log('Current position:', position); // e.g., 5.3, 5.4, 5.5...
330
+ });
331
+
332
+ engine.on('start', () => console.log('Playback started'));
333
+ engine.on('pause', () => console.log('Playback paused'));
334
+ engine.on('timelineComplete', () => console.log('Timeline finished'));
335
+
336
+ // Unsubscribe when done
337
+ unsubscribe();
338
+ ```
339
+
340
+ ### Engine Properties
341
+
342
+ The engine exposes read-only properties:
343
+
344
+ ```javascript
345
+ engine.position // Current timeline position in seconds (supports fractional values like 5.3)
346
+ engine.duration // Timeline duration (number | undefined)
347
+ engine.playState // 'stopped' | 'playing' | 'paused'
348
+ engine.currentTimelineUri // Current timeline URI (string)
349
+ engine.container // Timeline container element (JQuery)
350
+ engine.engineRoot // Engine root element (JQuery)
351
+ ```
352
+
353
+ ### Engine Playback Control
354
+
355
+ ```javascript
356
+ await engine.start(); // Start playback
357
+ engine.pause(); // Pause playback
358
+ engine.stop(); // Stop and reset to beginning
359
+ await engine.seek(10.5); // Seek to position (seconds, supports fractional values)
360
+ await engine.switchTimeline('timeline-uri', 5.3); // Switch timeline, optionally at position
279
361
  ```
280
362
 
281
363
  ## Configuration API