eligius 1.5.1 → 1.5.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.
Files changed (58) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +309 -311
  3. package/dist/chunk-C6wwvPpM.mjs +18 -0
  4. package/dist/index.d.mts +168 -181
  5. package/dist/index.mjs +896 -955
  6. package/dist/index.mjs.map +1 -1
  7. package/jsonschema/eligius-configuration.json +122 -122
  8. package/jsonschema/engine-config.json +21 -21
  9. package/jsonschema/mediaplayer-timeline-provider-settings.json +40 -40
  10. package/jsonschema/operation-templates/animate-with-class.json +1 -3
  11. package/jsonschema/operation-templates/break-for-each.json +1 -1
  12. package/jsonschema/operation-templates/clear-operation-data.json +1 -3
  13. package/jsonschema/operation-templates/clear-storage.json +1 -3
  14. package/jsonschema/operation-templates/concatenate-strings.json +1 -3
  15. package/jsonschema/operation-templates/continue-for-each.json +1 -1
  16. package/jsonschema/operation-templates/create-element.json +1 -3
  17. package/jsonschema/operation-templates/filter-array.json +2 -6
  18. package/jsonschema/operation-templates/find-in-array.json +2 -6
  19. package/jsonschema/operation-templates/get-query-params.json +1 -3
  20. package/jsonschema/operation-templates/http-delete.json +1 -3
  21. package/jsonschema/operation-templates/http-post.json +1 -3
  22. package/jsonschema/operation-templates/http-put.json +1 -3
  23. package/jsonschema/operation-templates/invoke-object-method.json +1 -3
  24. package/jsonschema/operation-templates/load-json.json +1 -3
  25. package/jsonschema/operation-templates/log.json +1 -3
  26. package/jsonschema/operation-templates/select-element.json +1 -3
  27. package/jsonschema/operation-templates/set-operation-data.json +1 -3
  28. package/jsonschema/operation-templates/sort-array.json +2 -6
  29. package/jsonschema/operation-templates/split-string.json +1 -3
  30. package/jsonschema/operation-templates/substring-text.json +1 -3
  31. package/jsonschema/operation-templates/validate-form.json +1 -3
  32. package/jsonschema/operations/animate-with-class.json +1 -3
  33. package/jsonschema/operations/break-for-each.json +1 -1
  34. package/jsonschema/operations/clear-operation-data.json +1 -3
  35. package/jsonschema/operations/clear-storage.json +1 -3
  36. package/jsonschema/operations/concatenate-strings.json +1 -3
  37. package/jsonschema/operations/continue-for-each.json +1 -1
  38. package/jsonschema/operations/create-element.json +1 -3
  39. package/jsonschema/operations/filter-array.json +2 -6
  40. package/jsonschema/operations/find-in-array.json +2 -6
  41. package/jsonschema/operations/get-query-params.json +1 -3
  42. package/jsonschema/operations/http-delete.json +1 -3
  43. package/jsonschema/operations/http-post.json +1 -3
  44. package/jsonschema/operations/http-put.json +1 -3
  45. package/jsonschema/operations/invoke-object-method.json +1 -3
  46. package/jsonschema/operations/load-json.json +1 -3
  47. package/jsonschema/operations/log.json +1 -3
  48. package/jsonschema/operations/select-element.json +1 -3
  49. package/jsonschema/operations/set-operation-data.json +1 -3
  50. package/jsonschema/operations/sort-array.json +2 -6
  51. package/jsonschema/operations/split-string.json +1 -3
  52. package/jsonschema/operations/substring-text.json +1 -3
  53. package/jsonschema/operations/validate-form.json +1 -3
  54. package/jsonschema/raf-timeline-provider-settings.json +29 -29
  55. package/jsonschema/timeline-provider-settings.json +16 -16
  56. package/jsonschema/timeline.json +52 -52
  57. package/package.json +13 -16
  58. package/dist/chunk-z5eko27R.mjs +0 -13
package/README.md CHANGED
@@ -1,311 +1,309 @@
1
- # Eligius
2
-
3
- A Javascript engine that allows arbitrary functionality to be triggered according to a given timeline provider. A timeline provider can be a video, an audio file, a request animation frame loop, etc.
4
-
5
- The engine can be the basis for video annotations, presentation software or interactive infographics, for example.
6
-
7
- Eligius is NOT a game or animation engine, instead, it is a Story Telling Engine.
8
-
9
- ## Eligian
10
-
11
- Eligius is also the runtime for the [Eligian](https://github.com/rolandzwaga/eligian) language.
12
-
13
- ## description
14
-
15
- The main concepts in Eligius are timelines, actions and operations. A timeline can be played, paused, stopped and scrubbed through.
16
-
17
- Actions can be called on specified points on such a timeline. An action consists of a list of start and end operations.
18
-
19
- 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)
20
- By composing these atomic operations complex functionality can be achieved.
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: `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).
23
- The end operations would be: `select-element`(to select the parent again) and `clear-element`(to remove the img element).
24
-
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
-
27
- 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.
28
-
29
- ## configuration
30
-
31
- 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).
32
-
33
- This section describes the different parts of this configuration.
34
-
35
- ### systemName property
36
-
37
- 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).
39
- However, this importer contains all of Eligius classes, function, providers, etc. So, bundling this with a presentation will bloat the bundle.
40
- Eligius offers a generator function for this: [`generateImporterSourceCode`](https://rolandzwaga.github.io/eligius/functions/generateImporterSourceCode.html). This function is able to generate source code (Typescript) for a custom resource importer based on a given Eligius configuration. This will result in an importer that only includes the code that is referenced in the configuration.
41
-
42
- ### engine
43
-
44
- The engine setting defines the engine for which this configuration is written. Currently there is only one option here, but this might change in the future. The engine block could, for example, also contain a version number.
45
-
46
- ```json
47
- {
48
- ...
49
- "engine": {
50
- "systemName": "EligiusEngine"
51
- }
52
- ...
53
- }
54
- ```
55
-
56
- ### timeline provider settings
57
-
58
- ```json
59
- {
60
- ...
61
- "timelineProviderSettings": {
62
- "animation": {
63
- "vendor": "eligius",
64
- "systemName": "RequestAnimationFrameTimelineProvider"
65
- }
66
- }
67
- ...
68
- }
69
- ```
70
-
71
- These settings describe the providers that are availab;e for the different kinds of timelines.
72
- There are three kinds: `audio`, `video` and `animation`.
73
- For `animation` there is `RequestAnimationFrameTimelineProvider`.
74
- For `audio` and `video` the `MediaElementTimelineProvider` can be used, but unfortunately that class is disabled for now.
75
-
76
- ### container selector
77
-
78
- This is a jQuery selector that points to the root element where the engine will render its output.
79
-
80
- ```json
81
- {
82
- ...
83
- "containerSelector": "#some-element-id"
84
- ...
85
- }
86
- ```
87
-
88
- ### available languages
89
-
90
- Eligius aims to be fully multi lingual. This setting describes the different languages that are used within the current presentation.
91
-
92
- ```json
93
- {
94
- ...
95
- "availableLanguages": [
96
- {
97
- "code": "en-US",
98
- "label": "English"
99
- },
100
- {
101
- "code": "nl-NL",
102
- "label": "Nederlands"
103
- }
104
- ]
105
- ...
106
- }
107
- ```
108
-
109
- ### language
110
-
111
- This defines the default language, the value needs to equal one of the `code` values in the `availableLanguages` properties.
112
-
113
- ```json
114
- {
115
- ...
116
- "language": "en-US"
117
- ...
118
- }
119
- ```
120
-
121
- ### layout template
122
-
123
- This can contain a string representing a block of HTML that will be rendered into the element defined by container selector. This HTML should contain the main (or initial) layout for the presentation.
124
-
125
- ```json
126
- {
127
- ...
128
- "layoutTemplate": "<div class=\"some-class\"><section><header>My header</header></section><div class=\"main\"></div></div>"
129
- ...
130
- }
131
- ```
132
-
133
- ### init actions
134
-
135
- The actions defined in this array will be executed during initialisation and tear down of the engine. During initialisation the start operations are executed and during tear down the end operations.
136
- Use these, for example, to load data, render global UI, etc.
137
-
138
- ```json
139
- {
140
- ...
141
- "initActions": [
142
- ...
143
- {
144
- "name": "some name",
145
- "startOperations": [
146
- ...
147
- {
148
- "systemName": "selectElement",
149
- "operationData": {
150
- "selector": "#main-title"
151
- }
152
- }
153
- ...
154
- ],
155
- "endOperations": [...]
156
- }
157
- ...
158
- ]
159
- ...
160
- }
161
- ```
162
-
163
- ### actions
164
-
165
- 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.
166
-
167
- ```json
168
- {
169
- ...
170
- "actions": [
171
- ...
172
- {
173
- "name": "some name",
174
- "startOperations": [
175
- ...
176
- {
177
- "systemName": "selectElement",
178
- "operationData": {
179
- "selector": "#main-title"
180
- }
181
- }
182
- ...
183
- ],
184
- }
185
- ...
186
- ]
187
- ...
188
- }
189
- ```
190
-
191
- ### timelines
192
-
193
- 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.
194
-
195
- ```json
196
- {
197
- ...
198
- "timelines": [
199
- "type": "animation",
200
- "uri": "animation-01",
201
- "duration": 45,
202
- "loop": true,
203
- "selector": ".timeline-div",
204
- "timelineActions": [
205
- ...
206
- {
207
- "name": "ShowSomething",
208
- "duration": {
209
- "start": 7,
210
- "end": 32
211
- },
212
- "startOperations": [...],
213
- "endOperations": [...],
214
- }
215
- ...
216
- ]
217
- ]
218
- ...
219
- }
220
- ```
221
-
222
- ### event actions
223
-
224
- This a list of actions that can be triggered by an event broadcast. Since an event doesn't have a tear down phase, these actions can only have a list of start operations.
225
-
226
- ```json
227
- {
228
- ...
229
- "eventActions": [
230
- ...
231
- {
232
- "name": "some name",
233
- "startOperations": [...],
234
- }
235
- ...
236
- ]
237
- ...
238
- }
239
- ```
240
-
241
- ### labels
242
-
243
- A list of label information that describes all of the textual content for the presentation.
244
- 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.
245
-
246
- ```json
247
- {
248
- "labels": [
249
- {
250
- "id": "mainTitle",
251
- "labels": [
252
- {
253
- "code": "en-US",
254
- "label": "This is the main title"
255
- },
256
- {
257
- "code": "nl-NL",
258
- "label": "Dit is de hoofdtitel"
259
- }
260
- ]
261
- }
262
- ]
263
- }
264
- ```
265
-
266
- ## Running the engine
267
-
268
- Running the engine is a matter of loading the configuration and feeding it to an engine instance.
269
-
270
- ```javascript
271
- import { IEngineConfiguration, EngineFactory, EligiusResourceImporter } from 'eligius';
272
- import * as engineConfig from './my-eligius-config.json';
273
-
274
- const factory = new EngineFactory(new EligiusResourceImporter(), window);
275
-
276
- const engine = factory.createEngine((engineConfig as unknown) as IEngineConfiguration);
277
-
278
- await engine.init();
279
-
280
- console.log('Eligius engine ready for business');
281
- ```
282
-
283
- ## Configuration API
284
-
285
- 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.
286
-
287
- It is encouraged to use this API to build specialized DSL's for specific presentations.
288
-
289
- Also, there is the [Eligian](https://github.com/rolandzwaga/eligian) project that aims to become an actual programming language for the Eligius runtime.
290
-
291
- ## Source documentation
292
-
293
- [Check out this link for the full type docs](https://rolandzwaga.github.io/eligius/)
294
-
295
- ## installation
296
-
297
- ```sh
298
- npm install eligius
299
- ```
300
-
301
- or
302
-
303
- ```sh
304
- yarn add eligius
305
- ```
306
-
307
- ## development
308
-
309
- - run `npm install`
310
- - Use `npm run test` to run the unit tests (tests use Vitest)
311
- - Use `npm run build` to create a production library bundle
1
+ # Eligius
2
+
3
+ A Javascript engine that allows arbitrary functionality to be triggered according to a given timeline provider. A timeline provider can be a video, an audio file, a request animation frame loop, etc.
4
+
5
+ The engine can be the basis for video annotations, presentation software or interactive infographics, for example.
6
+
7
+ Eligius is NOT a game or animation engine, instead, it is a Story Telling Engine.
8
+
9
+ ## Eligian
10
+
11
+ Eligius is also the runtime for the [Eligian](https://github.com/rolandzwaga/eligian) language.
12
+
13
+ ## description
14
+
15
+ The main concepts in Eligius are timelines, actions and operations. A timeline can be played, paused, stopped and scrubbed through.
16
+
17
+ Actions can be called on specified points on such a timeline. An action consists of a list of start and end operations.
18
+
19
+ 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)
20
+ By composing these atomic operations complex functionality can be achieved.
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: `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).
23
+ The end operations would be: `select-element`(to select the parent again) and `clear-element`(to remove the img element).
24
+
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
+
27
+ 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.
28
+
29
+ ## configuration
30
+
31
+ 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).
32
+
33
+ This section describes the different parts of this configuration.
34
+
35
+ ### systemName property
36
+
37
+ 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).
39
+
40
+ ### engine
41
+
42
+ The engine setting defines the engine for which this configuration is written. Currently there is only one option here, but this might change in the future. The engine block could, for example, also contain a version number.
43
+
44
+ ```json
45
+ {
46
+ ...
47
+ "engine": {
48
+ "systemName": "EligiusEngine"
49
+ }
50
+ ...
51
+ }
52
+ ```
53
+
54
+ ### timeline provider settings
55
+
56
+ ```json
57
+ {
58
+ ...
59
+ "timelineProviderSettings": {
60
+ "animation": {
61
+ "vendor": "eligius",
62
+ "systemName": "RequestAnimationFrameTimelineProvider"
63
+ }
64
+ }
65
+ ...
66
+ }
67
+ ```
68
+
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.
73
+
74
+ ### container selector
75
+
76
+ This is a jQuery selector that points to the root element where the engine will render its output.
77
+
78
+ ```json
79
+ {
80
+ ...
81
+ "containerSelector": "#some-element-id"
82
+ ...
83
+ }
84
+ ```
85
+
86
+ ### available languages
87
+
88
+ Eligius aims to be fully multi lingual. This setting describes the different languages that are used within the current presentation.
89
+
90
+ ```json
91
+ {
92
+ ...
93
+ "availableLanguages": [
94
+ {
95
+ "code": "en-US",
96
+ "label": "English"
97
+ },
98
+ {
99
+ "code": "nl-NL",
100
+ "label": "Nederlands"
101
+ }
102
+ ]
103
+ ...
104
+ }
105
+ ```
106
+
107
+ ### language
108
+
109
+ This defines the default language, the value needs to equal one of the `code` values in the `availableLanguages` properties.
110
+
111
+ ```json
112
+ {
113
+ ...
114
+ "language": "en-US"
115
+ ...
116
+ }
117
+ ```
118
+
119
+ ### layout template
120
+
121
+ This can contain a string representing a block of HTML that will be rendered into the element defined by container selector. This HTML should contain the main (or initial) layout for the presentation.
122
+
123
+ ```json
124
+ {
125
+ ...
126
+ "layoutTemplate": "<div class=\"some-class\"><section><header>My header</header></section><div class=\"main\"></div></div>"
127
+ ...
128
+ }
129
+ ```
130
+
131
+ ### init actions
132
+
133
+ The actions defined in this array will be executed during initialisation and tear down of the engine. During initialisation the start operations are executed and during tear down the end operations.
134
+ Use these, for example, to load data, render global UI, etc.
135
+
136
+ ```json
137
+ {
138
+ ...
139
+ "initActions": [
140
+ ...
141
+ {
142
+ "name": "some name",
143
+ "startOperations": [
144
+ ...
145
+ {
146
+ "systemName": "selectElement",
147
+ "operationData": {
148
+ "selector": "#main-title"
149
+ }
150
+ }
151
+ ...
152
+ ],
153
+ "endOperations": [...]
154
+ }
155
+ ...
156
+ ]
157
+ ...
158
+ }
159
+ ```
160
+
161
+ ### actions
162
+
163
+ 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.
164
+
165
+ ```json
166
+ {
167
+ ...
168
+ "actions": [
169
+ ...
170
+ {
171
+ "name": "some name",
172
+ "startOperations": [
173
+ ...
174
+ {
175
+ "systemName": "selectElement",
176
+ "operationData": {
177
+ "selector": "#main-title"
178
+ }
179
+ }
180
+ ...
181
+ ],
182
+ }
183
+ ...
184
+ ]
185
+ ...
186
+ }
187
+ ```
188
+
189
+ ### timelines
190
+
191
+ 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
+
193
+ ```json
194
+ {
195
+ ...
196
+ "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
+ ]
215
+ ]
216
+ ...
217
+ }
218
+ ```
219
+
220
+ ### event actions
221
+
222
+ This a list of actions that can be triggered by an event broadcast. Since an event doesn't have a tear down phase, these actions can only have a list of start operations.
223
+
224
+ ```json
225
+ {
226
+ ...
227
+ "eventActions": [
228
+ ...
229
+ {
230
+ "name": "some name",
231
+ "startOperations": [...],
232
+ }
233
+ ...
234
+ ]
235
+ ...
236
+ }
237
+ ```
238
+
239
+ ### labels
240
+
241
+ A list of label information that describes all of the textual content for the presentation.
242
+ 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.
243
+
244
+ ```json
245
+ {
246
+ "labels": [
247
+ {
248
+ "id": "mainTitle",
249
+ "labels": [
250
+ {
251
+ "code": "en-US",
252
+ "label": "This is the main title"
253
+ },
254
+ {
255
+ "code": "nl-NL",
256
+ "label": "Dit is de hoofdtitel"
257
+ }
258
+ ]
259
+ }
260
+ ]
261
+ }
262
+ ```
263
+
264
+ ## Running the engine
265
+
266
+ Running the engine is a matter of loading the configuration and feeding it to an engine instance.
267
+
268
+ ```javascript
269
+ import { IEngineConfiguration, EngineFactory, EligiusResourceImporter } from 'eligius';
270
+ import * as engineConfig from './my-eligius-config.json';
271
+
272
+ const factory = new EngineFactory(new EligiusResourceImporter(), window);
273
+
274
+ const engine = factory.createEngine((engineConfig as unknown) as IEngineConfiguration);
275
+
276
+ await engine.init();
277
+
278
+ console.log('Eligius engine ready for business');
279
+ ```
280
+
281
+ ## Configuration API
282
+
283
+ 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.
284
+
285
+ It is encouraged to use this API to build specialized DSL's for specific presentations.
286
+
287
+ Also, there is the [Eligian](https://github.com/rolandzwaga/eligian) project that aims to become an actual programming language for the Eligius runtime.
288
+
289
+ ## Source documentation
290
+
291
+ [Check out this link for the full type docs](https://rolandzwaga.github.io/eligius/)
292
+
293
+ ## installation
294
+
295
+ ```sh
296
+ npm install eligius
297
+ ```
298
+
299
+ or
300
+
301
+ ```sh
302
+ yarn add eligius
303
+ ```
304
+
305
+ ## development
306
+
307
+ - run `npm install`
308
+ - Use `npm run test` to run the unit tests (tests use Vitest)
309
+ - Use `npm run build` to create a production library bundle
@@ -0,0 +1,18 @@
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (all, symbols) => {
4
+ let target = {};
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ }
11
+ if (symbols) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return target;
15
+ };
16
+
17
+ //#endregion
18
+ export { __export as t };