eligius 1.5.3 → 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.
- package/README.md +107 -25
- package/dist/index.d.mts +1716 -233
- package/dist/index.mjs +1852 -734
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -9
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
|
-
|
|
62
|
-
|
|
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
|
|
70
|
-
|
|
71
|
-
|
|
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:
|
|
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
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
"
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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
|
-
|
|
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
|