eligius 4.1.0 → 4.3.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/dist/configuration-api.d.mts +127 -101
- package/dist/configuration-api.mjs +6 -6
- package/dist/configuration-api.mjs.map +1 -1
- package/dist/{engine-factory-BHDMlt6g.mjs → engine-factory-65BHSli8.mjs} +235 -237
- package/dist/engine-factory-65BHSli8.mjs.map +1 -0
- package/dist/index.d.mts +2 -3
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/lint.d.mts +125 -101
- package/dist/lint.mjs +63 -27
- package/dist/lint.mjs.map +1 -1
- package/dist/{locale-manager-CNZ2kj0g.d.mts → locale-manager-DY4_d4Zv.d.mts} +142 -136
- package/dist/metadata.d.mts +122 -102
- package/dist/metadata.mjs +7 -73
- package/dist/metadata.mjs.map +1 -1
- package/dist/{rolldown-runtime-CGzGPw9x.mjs → rolldown-runtime-DTOZ5ltL.mjs} +4 -4
- package/dist/runtime.d.mts +21 -2
- package/dist/runtime.mjs +1 -1
- package/jsonschema/eligius-configuration.json +3 -0
- package/jsonschema/operations/math.json +6 -27
- package/package.json +25 -15
- package/dist/engine-factory-BHDMlt6g.mjs.map +0 -1
package/dist/lint.d.mts
CHANGED
|
@@ -12,6 +12,21 @@ declare namespace JQuery {
|
|
|
12
12
|
type Duration = number | 'fast' | 'slow';
|
|
13
13
|
type Node = Element | Text | Comment | Document | DocumentFragment;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* DOM-free configuration linter (`eligius/lint`).
|
|
17
|
+
*
|
|
18
|
+
* `lintConfiguration` runs the real `ConfigurationResolver` with stand-ins
|
|
19
|
+
* for the operations, controllers and timeline providers, so every error the
|
|
20
|
+
* engine would throw at `createEngine` time is found at build time, with the
|
|
21
|
+
* same message and JSON path. It then checks every operation list for
|
|
22
|
+
* control-flow blocks that do not nest, missing required properties, invalid
|
|
23
|
+
* `when` expressions, forbidden property chains, unknown `requestAction`
|
|
24
|
+
* names and data that nothing provides.
|
|
25
|
+
*
|
|
26
|
+
* This entry never imports the operation or controller implementations, so
|
|
27
|
+
* it works in plain Node without jquery or lottie-web: build steps, editors
|
|
28
|
+
* and the Eligian compiler can run it.
|
|
29
|
+
*/
|
|
15
30
|
/**
|
|
16
31
|
* Event: before-request-timeline-uri
|
|
17
32
|
*
|
|
@@ -62,10 +77,65 @@ interface EngineCommandErrorEvent {
|
|
|
62
77
|
name: 'engine-command-error';
|
|
63
78
|
args: [command: string, error: unknown];
|
|
64
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Engine internals that actions, operations and controllers look up by name.
|
|
82
|
+
*
|
|
83
|
+
* Every engine has its own services object. Operations reach it as
|
|
84
|
+
* `this.services` (see `IOperationScope`), controllers receive it in
|
|
85
|
+
* `attach(eventbus, services)`. Because it belongs to one engine, a lookup
|
|
86
|
+
* always answers for that engine, also when several engines share an
|
|
87
|
+
* eventbus.
|
|
88
|
+
*/
|
|
89
|
+
interface IEngineServices {
|
|
90
|
+
/**
|
|
91
|
+
* Returns the configured action (from `actions` or `eventActions`) with
|
|
92
|
+
* this name.
|
|
93
|
+
*
|
|
94
|
+
* @param systemName - The action name
|
|
95
|
+
* @returns The action
|
|
96
|
+
* @throws Error for an unknown name, with a "did you mean" hint
|
|
97
|
+
*/
|
|
98
|
+
getAction(systemName: string): IAction;
|
|
99
|
+
/**
|
|
100
|
+
* Returns what the resource importer provides under this name: a custom
|
|
101
|
+
* function, registered JSON or template, or any built-in export.
|
|
102
|
+
*
|
|
103
|
+
* @param systemName - The registered name
|
|
104
|
+
* @returns The registered entry; registered JSON may be `0`, `''` or `false`
|
|
105
|
+
* @throws Error when nothing is registered under the name (the importer's
|
|
106
|
+
* "did you mean" hint is kept)
|
|
107
|
+
*/
|
|
108
|
+
getImport(systemName: string): unknown;
|
|
109
|
+
/**
|
|
110
|
+
* Creates a new instance of the class the resource importer provides under
|
|
111
|
+
* this name (a controller, for example), constructed with the engine's
|
|
112
|
+
* eventbus.
|
|
113
|
+
*
|
|
114
|
+
* @param systemName - The registered class name
|
|
115
|
+
* @returns The new instance
|
|
116
|
+
* @throws Error when nothing is registered under the name, or when it is not
|
|
117
|
+
* a class
|
|
118
|
+
*/
|
|
119
|
+
createInstance<T = unknown>(systemName: string): T;
|
|
120
|
+
/**
|
|
121
|
+
* Returns the engine's root element (its container selector). From
|
|
122
|
+
* `engine.init()` until `engine.destroy()` this is the same jQuery instance.
|
|
123
|
+
*
|
|
124
|
+
* @returns The engine root
|
|
125
|
+
*/
|
|
126
|
+
getEngineRoot(): JQuery<HTMLElement>;
|
|
127
|
+
}
|
|
65
128
|
interface IController<T extends TOperationData> {
|
|
66
129
|
name: string;
|
|
67
130
|
init(operationData: T): void;
|
|
68
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Starts the controller.
|
|
133
|
+
*
|
|
134
|
+
* @param eventbus - The engine's eventbus
|
|
135
|
+
* @param services - The engine's services, for looking up actions, classes
|
|
136
|
+
* and the engine root
|
|
137
|
+
*/
|
|
138
|
+
attach(eventbus: IEventbus, services: IEngineServices): Promise<any> | void;
|
|
69
139
|
detach(eventbus: IEventbus): void;
|
|
70
140
|
}
|
|
71
141
|
/** A start and end frame. Mirrors lottie-web's `AnimationSegment`. */
|
|
@@ -268,9 +338,28 @@ interface IEngineActionError extends Error {
|
|
|
268
338
|
readonly operationSystemName?: string;
|
|
269
339
|
/** Index of the failing operation in its operation list, when known */
|
|
270
340
|
readonly operationIndex?: number;
|
|
341
|
+
/**
|
|
342
|
+
* The operations between the failing action and the failing operation,
|
|
343
|
+
* outermost first, when known. Entry 0 is an operation of the failing
|
|
344
|
+
* action itself: for a failure inside a called action it is the
|
|
345
|
+
* `startAction` or `endAction` that called it. Each further entry is an
|
|
346
|
+
* operation of the action the previous entry started. The last entry is the
|
|
347
|
+
* failing operation, the same as `operationSystemName` and
|
|
348
|
+
* `operationIndex`. A direct failure has one entry.
|
|
349
|
+
*/
|
|
350
|
+
readonly operationPath?: readonly IOperationPathEntry[];
|
|
271
351
|
/** The original error */
|
|
272
352
|
readonly cause: unknown;
|
|
273
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* One operation on {@link IEngineActionError.operationPath}.
|
|
356
|
+
*/
|
|
357
|
+
interface IOperationPathEntry {
|
|
358
|
+
/** System name of the operation */
|
|
359
|
+
readonly systemName: string;
|
|
360
|
+
/** Its index in the operation list of its action */
|
|
361
|
+
readonly index: number;
|
|
362
|
+
}
|
|
274
363
|
/**
|
|
275
364
|
* A configuration problem that does not stop the resolver, reported through
|
|
276
365
|
* {@link IConfigurationResolverOptions.onWarning}.
|
|
@@ -320,7 +409,8 @@ type RequireKeys<T, K extends keyof T> = { [P in K]-?: T[P]; };
|
|
|
320
409
|
* Event: engine-error
|
|
321
410
|
* Broadcast when a timeline action that the engine started or ended on its
|
|
322
411
|
* own fails. The error names the action, the phase (start or end) and, when
|
|
323
|
-
* known, the failing operation
|
|
412
|
+
* known, the failing operation (`operationSystemName`, `operationIndex`) and
|
|
413
|
+
* the path to it through called actions (`operationPath`, outermost first).
|
|
324
414
|
* @param error - The error, with the original error as its `cause`
|
|
325
415
|
* @category Engine
|
|
326
416
|
*/
|
|
@@ -367,20 +457,6 @@ interface PushHistoryStateEvent {
|
|
|
367
457
|
name: 'push-history-state';
|
|
368
458
|
args: [state: any];
|
|
369
459
|
}
|
|
370
|
-
/**
|
|
371
|
-
* Request: request-action
|
|
372
|
-
* Answered through `eventbus.request('request-action', actionName)` by
|
|
373
|
-
* EngineFactory with the configured action of that name. Throws for an
|
|
374
|
-
* unknown name, with a "did you mean" hint.
|
|
375
|
-
* @param actionName - The name of the action to request
|
|
376
|
-
* @returns The action
|
|
377
|
-
* @category Engine Request
|
|
378
|
-
*/
|
|
379
|
-
interface RequestActionEvent {
|
|
380
|
-
name: 'request-action';
|
|
381
|
-
args: [actionName: string];
|
|
382
|
-
returns: IAction;
|
|
383
|
-
}
|
|
384
460
|
/**
|
|
385
461
|
* Request: request-current-language
|
|
386
462
|
* Answered through `eventbus.request('request-current-language')` by
|
|
@@ -427,50 +503,6 @@ interface RequestCurrentVideoPositionEvent {
|
|
|
427
503
|
name: 'request-current-video-position';
|
|
428
504
|
args: [callback: (position: number) => void];
|
|
429
505
|
}
|
|
430
|
-
/**
|
|
431
|
-
* Request: request-engine-root
|
|
432
|
-
* Answered through `eventbus.request('request-engine-root')` with the
|
|
433
|
-
* engine's root element (the container selector). From `engine.init()` until
|
|
434
|
-
* `engine.destroy()` every answer is the same jQuery instance. The engine also
|
|
435
|
-
* answers the legacy form, a broadcast whose last argument is a callback that
|
|
436
|
-
* receives the value.
|
|
437
|
-
* @returns The engine root element
|
|
438
|
-
* @category Engine Request
|
|
439
|
-
*/
|
|
440
|
-
interface RequestEngineRootEvent {
|
|
441
|
-
name: 'request-engine-root';
|
|
442
|
-
args: [];
|
|
443
|
-
returns: JQuery<HTMLElement>;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Request: request-function
|
|
447
|
-
* Answered through `eventbus.request('request-function', systemName)` by
|
|
448
|
-
* EngineFactory with the function (such as an operation) the resource
|
|
449
|
-
* importer provides under that name. Throws for an unknown name.
|
|
450
|
-
* @param systemName - The name of the function to request
|
|
451
|
-
* @returns The function
|
|
452
|
-
* @category Engine Request
|
|
453
|
-
*/
|
|
454
|
-
interface RequestFunctionEvent {
|
|
455
|
-
name: 'request-function';
|
|
456
|
-
args: [systemName: string];
|
|
457
|
-
returns: unknown;
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* Request: request-instance
|
|
461
|
-
* Answered through `eventbus.request('request-instance', systemName)` by
|
|
462
|
-
* EngineFactory with a new instance of the class the resource importer
|
|
463
|
-
* provides under that name (a controller, for example), constructed with the
|
|
464
|
-
* eventbus. Throws for an unknown name.
|
|
465
|
-
* @param systemName - The name of the class to instantiate
|
|
466
|
-
* @returns The new instance
|
|
467
|
-
* @category Engine Request
|
|
468
|
-
*/
|
|
469
|
-
interface RequestInstanceEvent {
|
|
470
|
-
name: 'request-instance';
|
|
471
|
-
args: [systemName: string];
|
|
472
|
-
returns: unknown;
|
|
473
|
-
}
|
|
474
506
|
/**
|
|
475
507
|
* Event: request-label-collection
|
|
476
508
|
* @param language - The language code
|
|
@@ -757,7 +789,7 @@ interface VideoCompleteEvent {
|
|
|
757
789
|
name: 'video-complete';
|
|
758
790
|
args: [index: number];
|
|
759
791
|
}
|
|
760
|
-
type AllEvents = BeforeRequestTimelineUriEvent | BeforeRequestVideoUrlEvent | DomMutationEvent | EngineCommandErrorEvent | EngineErrorEvent | HighlightNavigationEvent | LanguageChangeEvent | NavigateToVideoUrlEvent | PushHistoryStateEvent |
|
|
792
|
+
type AllEvents = BeforeRequestTimelineUriEvent | BeforeRequestVideoUrlEvent | DomMutationEvent | EngineCommandErrorEvent | EngineErrorEvent | HighlightNavigationEvent | LanguageChangeEvent | NavigateToVideoUrlEvent | PushHistoryStateEvent | RequestCurrentLanguageEvent | RequestCurrentNavigationEvent | RequestCurrentTimelinePositionEvent | RequestCurrentVideoPositionEvent | RequestLabelCollectionEvent | RequestLabelCollectionsEvent | RequestTimelineCleanupEvent | RequestTimelineUriEvent | RequestTranslationEvent | RequestVideoCleanupEvent | RequestVideoUrlEvent | CompleteEvent | ContainerRequestEvent | CurrentTimelineChangeEvent | DurationRequestEvent | DurationEvent | FirstFrameEvent | PauseRequestEvent | PauseEvent | PlayRequestEvent | PlayToggleRequestEvent | PlayEvent | RequestCurrentTimelineEvent | ResizeRequestEvent | ResizeEvent | RestartEvent | SeekRequestEvent | SeekEvent | SeekedEvent | StopRequestEvent | StopEvent | TimeEvent | VideoCompleteEvent;
|
|
761
793
|
type EventMap = { [K in AllEvents as K['name']]: K extends {
|
|
762
794
|
returns: infer R;
|
|
763
795
|
} ? [...K['args'], callback?: (result: R) => void] : K['args']; };
|
|
@@ -774,10 +806,6 @@ type EventName = keyof EventMap;
|
|
|
774
806
|
* The untyped string overloads remain for custom request names.
|
|
775
807
|
*/
|
|
776
808
|
interface RequestMap {
|
|
777
|
-
'request-action': {
|
|
778
|
-
args: RequestActionEvent['args'];
|
|
779
|
-
returns: RequestActionEvent['returns'];
|
|
780
|
-
};
|
|
781
809
|
'request-current-language': {
|
|
782
810
|
args: RequestCurrentLanguageEvent['args'];
|
|
783
811
|
returns: RequestCurrentLanguageEvent['returns'];
|
|
@@ -786,18 +814,6 @@ interface RequestMap {
|
|
|
786
814
|
args: RequestCurrentTimelinePositionEvent['args'];
|
|
787
815
|
returns: RequestCurrentTimelinePositionEvent['returns'];
|
|
788
816
|
};
|
|
789
|
-
'request-engine-root': {
|
|
790
|
-
args: RequestEngineRootEvent['args'];
|
|
791
|
-
returns: RequestEngineRootEvent['returns'];
|
|
792
|
-
};
|
|
793
|
-
'request-function': {
|
|
794
|
-
args: RequestFunctionEvent['args'];
|
|
795
|
-
returns: RequestFunctionEvent['returns'];
|
|
796
|
-
};
|
|
797
|
-
'request-instance': {
|
|
798
|
-
args: RequestInstanceEvent['args'];
|
|
799
|
-
returns: RequestInstanceEvent['returns'];
|
|
800
|
-
};
|
|
801
817
|
'request-translation': {
|
|
802
818
|
args: RequestTranslationEvent['args'];
|
|
803
819
|
returns: RequestTranslationEvent['returns'];
|
|
@@ -979,6 +995,11 @@ interface IOperationScope {
|
|
|
979
995
|
* The eventbus instance shared amongst actions and operations
|
|
980
996
|
*/
|
|
981
997
|
eventbus: IEventbus;
|
|
998
|
+
/**
|
|
999
|
+
* The services of the engine this operation runs in: looks up actions,
|
|
1000
|
+
* registered imports and classes, and the engine root
|
|
1001
|
+
*/
|
|
1002
|
+
services: IEngineServices;
|
|
982
1003
|
/**
|
|
983
1004
|
* The list of operations that is currently being executed
|
|
984
1005
|
*/
|
|
@@ -1073,12 +1094,13 @@ declare class DOMEventListenerController implements IController<IDOMEventListene
|
|
|
1073
1094
|
/**
|
|
1074
1095
|
* Looks up the configured actions and starts listening for the DOM event.
|
|
1075
1096
|
*
|
|
1076
|
-
* @param eventbus - The eventbus
|
|
1077
|
-
* @
|
|
1078
|
-
*
|
|
1079
|
-
* DOM event, and keeps the
|
|
1097
|
+
* @param eventbus - The eventbus the actions report errors on
|
|
1098
|
+
* @param services - The engine services to look the actions up in
|
|
1099
|
+
* @throws when an action name is unknown; the message names the
|
|
1100
|
+
* controller, the action and the DOM event, and keeps the "did you mean"
|
|
1101
|
+
* hint
|
|
1080
1102
|
*/
|
|
1081
|
-
attach(eventbus: IEventbus): void;
|
|
1103
|
+
attach(eventbus: IEventbus, services: IEngineServices): void;
|
|
1082
1104
|
private _eventHandler;
|
|
1083
1105
|
/**
|
|
1084
1106
|
* Removes only the handler this controller registered, so other handlers for
|
|
@@ -1178,13 +1200,13 @@ declare class KeyboardController implements IController<IKeyboardControllerOpera
|
|
|
1178
1200
|
/**
|
|
1179
1201
|
* Looks up the configured actions and starts listening for the keys.
|
|
1180
1202
|
*
|
|
1181
|
-
* @param eventbus - The eventbus
|
|
1182
|
-
*
|
|
1183
|
-
*
|
|
1184
|
-
*
|
|
1185
|
-
* keys, and keeps the
|
|
1203
|
+
* @param eventbus - The eventbus the actions report errors on
|
|
1204
|
+
* @param services - The engine services to look the actions and the engine
|
|
1205
|
+
* root up in
|
|
1206
|
+
* @throws when an action name is unknown; the message names the
|
|
1207
|
+
* controller, the action and the keys, and keeps the "did you mean" hint
|
|
1186
1208
|
*/
|
|
1187
|
-
attach(eventbus: IEventbus): void;
|
|
1209
|
+
attach(eventbus: IEventbus, services: IEngineServices): void;
|
|
1188
1210
|
/**
|
|
1189
1211
|
* Removes only the handler this controller bound, so other bindings of the
|
|
1190
1212
|
* same keys keep working, and resets the action instances so a later
|
|
@@ -1193,7 +1215,7 @@ declare class KeyboardController implements IController<IKeyboardControllerOpera
|
|
|
1193
1215
|
detach(_eventbus: IEventbus): void;
|
|
1194
1216
|
private _handleKey;
|
|
1195
1217
|
private _trigger;
|
|
1196
|
-
private
|
|
1218
|
+
private _engineRootElement;
|
|
1197
1219
|
/**
|
|
1198
1220
|
* @returns The keys with `' '` replaced by `space`
|
|
1199
1221
|
* @throws when the keys are empty or name a key hotkeys-js can't match
|
|
@@ -1262,7 +1284,7 @@ declare abstract class BaseController<T extends TOperationData> implements ICont
|
|
|
1262
1284
|
*/
|
|
1263
1285
|
detach(_eventbus: IEventbus): void;
|
|
1264
1286
|
abstract init(operationData: T): void;
|
|
1265
|
-
abstract attach(eventbus: IEventbus): Promise<any> | void;
|
|
1287
|
+
abstract attach(eventbus: IEventbus, services: IEngineServices): Promise<any> | void;
|
|
1266
1288
|
}
|
|
1267
1289
|
interface ILabelControllerMetadata {
|
|
1268
1290
|
/**
|
|
@@ -1628,9 +1650,10 @@ declare class NavigationController extends BaseController<INavigationControllerO
|
|
|
1628
1650
|
navLookup: Record<string, any>;
|
|
1629
1651
|
navVidIdLookup: Record<string, any>;
|
|
1630
1652
|
ctrlLookup: Record<string, LabelController>;
|
|
1631
|
-
activeNavigationPoint: any
|
|
1653
|
+
activeNavigationPoint: any;
|
|
1632
1654
|
labelControllers: LabelController[];
|
|
1633
1655
|
eventbus: IEventbus | null;
|
|
1656
|
+
services: IEngineServices | null;
|
|
1634
1657
|
container: JQuery | null;
|
|
1635
1658
|
private _menuElement;
|
|
1636
1659
|
private _anchorLookup;
|
|
@@ -1641,7 +1664,7 @@ declare class NavigationController extends BaseController<INavigationControllerO
|
|
|
1641
1664
|
* navigation id in roots, nextId or children
|
|
1642
1665
|
*/
|
|
1643
1666
|
init(operationData: INavigationControllerOperationData): void;
|
|
1644
|
-
attach(eventbus: IEventbus): void;
|
|
1667
|
+
attach(eventbus: IEventbus, services: IEngineServices): void;
|
|
1645
1668
|
/**
|
|
1646
1669
|
* Sets the active navigation point and the menu highlight from the URL hash,
|
|
1647
1670
|
* falling back to the item with videoUrlIndex 0 when the hash is missing or
|
|
@@ -2353,8 +2376,8 @@ interface ICustomFunctionOperationData {
|
|
|
2353
2376
|
* This operation retrieves a custom function defined by the given system name
|
|
2354
2377
|
* and invokes it with the current operation data and eventbus.
|
|
2355
2378
|
*
|
|
2356
|
-
* The function is looked up with
|
|
2357
|
-
*
|
|
2379
|
+
* The function is looked up with `this.services.getImport`, which answers from
|
|
2380
|
+
* the engine's resource importer. Register the function
|
|
2358
2381
|
* with the `EligiusResourceImporter` constructor:
|
|
2359
2382
|
* `new EligiusResourceImporter({functions: {myFunction}})`.
|
|
2360
2383
|
*
|
|
@@ -2514,7 +2537,7 @@ interface IFindInArrayOperationData {
|
|
|
2514
2537
|
/**
|
|
2515
2538
|
* @output
|
|
2516
2539
|
*/
|
|
2517
|
-
foundItem?: any
|
|
2540
|
+
foundItem?: any;
|
|
2518
2541
|
/**
|
|
2519
2542
|
* @output
|
|
2520
2543
|
*/
|
|
@@ -2865,8 +2888,8 @@ interface IGetImportOperationData {
|
|
|
2865
2888
|
* This operation retrieves the import specified by the given `systemName` and
|
|
2866
2889
|
* assigns it to the `importedInstance` property on the current operaton date.
|
|
2867
2890
|
*
|
|
2868
|
-
* The import is looked up with
|
|
2869
|
-
*
|
|
2891
|
+
* The import is looked up with `this.services.getImport`, which answers from
|
|
2892
|
+
* the engine's resource importer. Functions, templates
|
|
2870
2893
|
* and JSON registered with the `EligiusResourceImporter` constructor
|
|
2871
2894
|
* (`new EligiusResourceImporter({json: {settings}})`) can be imported this
|
|
2872
2895
|
* way, as can every built-in operation, controller and provider export.
|
|
@@ -3344,14 +3367,16 @@ interface IMapArrayOperationData {
|
|
|
3344
3367
|
*/
|
|
3345
3368
|
declare const mapArray: TOperation<IMapArrayOperationData, Omit<IMapArrayOperationData, 'mapFunction'>>;
|
|
3346
3369
|
type MathFunctionKeys = { [K in keyof Math]: Math[K] extends ((...args: any) => any) ? K : never; }[keyof Math];
|
|
3347
|
-
type MathNonFunctionKeys = { [K in keyof Math]: Math[K] extends ((...args: any) => any) ? never : K; }[keyof Math];
|
|
3348
3370
|
interface IMathOperationData {
|
|
3349
3371
|
/**
|
|
3372
|
+
* Numbers, property chains, or names of Math constants
|
|
3373
|
+
* ({@link MathNonFunctionKeys}).
|
|
3374
|
+
*
|
|
3350
3375
|
* @type=ParameterType:array
|
|
3351
3376
|
* @required
|
|
3352
3377
|
* @erased
|
|
3353
3378
|
*/
|
|
3354
|
-
args: (number | string
|
|
3379
|
+
args: (number | string)[];
|
|
3355
3380
|
/**
|
|
3356
3381
|
* @type=ParameterType:mathfunction
|
|
3357
3382
|
* @required
|
|
@@ -5001,5 +5026,4 @@ interface IFlowControlProblem {
|
|
|
5001
5026
|
* @returns The problems in list order, empty when the blocks are well formed
|
|
5002
5027
|
*/
|
|
5003
5028
|
export declare function findFlowControlProblems(systemNames: readonly string[]): IFlowControlProblem[];
|
|
5004
|
-
export type { Controllers, ExtractOperationDataType, GetControllerByName, GetOperationByName, IActionConfiguration, IConfigurationResolverOptions, IConfigurationWarning, IContainerProviderConfig, IEndableActionConfiguration, IEngineConfiguration, IEngineInfo, IEventActionConfiguration, IFlowControlProblem, ILabel, ILintDiagnostic, ILintOptions, IOperationConfiguration, IPlaylistConfig, IPositionSourceConfig, IResolvedActionConfiguration, IResolvedEndableActionConfiguration, IResolvedEngineConfiguration, IResolvedOperation, IResolvedTimelineConfiguration, ITimelineActionConfiguration, ITimelineConfiguration, ITimelineFlow, ITimelineProviderSettings, Operations, TControllerName, TControllerType, TLanguageCode, TLintSeverity, TOperationName, TOperationType, TTimelineProviderSettings, TimelineTypes };
|
|
5005
|
-
//# sourceMappingURL=lint.d.mts.map
|
|
5029
|
+
export type { Controllers, ExtractOperationDataType, GetControllerByName, GetOperationByName, IActionConfiguration, IConfigurationResolverOptions, IConfigurationWarning, IContainerProviderConfig, IEndableActionConfiguration, IEngineConfiguration, IEngineInfo, IEventActionConfiguration, IFlowControlProblem, ILabel, ILintDiagnostic, ILintOptions, IOperationConfiguration, IPlaylistConfig, IPositionSourceConfig, IResolvedActionConfiguration, IResolvedEndableActionConfiguration, IResolvedEngineConfiguration, IResolvedOperation, IResolvedTimelineConfiguration, ITimelineActionConfiguration, ITimelineConfiguration, ITimelineFlow, ITimelineProviderSettings, Operations, TControllerName, TControllerType, TLanguageCode, TLintSeverity, TOperationName, TOperationType, TTimelineProviderSettings, TimelineTypes };
|
package/dist/lint.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DTOZ5ltL.mjs";
|
|
3
3
|
import { isDefined } from "ts-is-present";
|
|
4
4
|
|
|
5
5
|
// src/operation/helper/flow-control-names.ts
|
|
@@ -559,6 +559,7 @@ var Action = class {
|
|
|
559
559
|
name;
|
|
560
560
|
startOperations;
|
|
561
561
|
eventbus;
|
|
562
|
+
services;
|
|
562
563
|
id = "";
|
|
563
564
|
/**
|
|
564
565
|
* Scope stack used by {@link executeOperation} when it is called without an
|
|
@@ -575,10 +576,11 @@ var Action = class {
|
|
|
575
576
|
* again instead of deep-copying the collection on every iteration.
|
|
576
577
|
*/
|
|
577
578
|
_loopOperationData = /* @__PURE__ */ new WeakMap();
|
|
578
|
-
constructor(name, startOperations, eventbus) {
|
|
579
|
+
constructor(name, startOperations, eventbus, services) {
|
|
579
580
|
this.name = name;
|
|
580
581
|
this.startOperations = startOperations;
|
|
581
582
|
this.eventbus = eventbus;
|
|
583
|
+
this.services = services;
|
|
582
584
|
}
|
|
583
585
|
/**
|
|
584
586
|
* Runs the start operations.
|
|
@@ -621,6 +623,7 @@ var Action = class {
|
|
|
621
623
|
return [{
|
|
622
624
|
currentIndex: -1,
|
|
623
625
|
eventbus: this.eventbus,
|
|
626
|
+
services: this.services,
|
|
624
627
|
operations
|
|
625
628
|
}];
|
|
626
629
|
}
|
|
@@ -642,6 +645,9 @@ var Action = class {
|
|
|
642
645
|
get eventbus() {
|
|
643
646
|
return parentScope.eventbus;
|
|
644
647
|
},
|
|
648
|
+
get services() {
|
|
649
|
+
return parentScope.services;
|
|
650
|
+
},
|
|
645
651
|
get operations() {
|
|
646
652
|
return parentScope.operations;
|
|
647
653
|
},
|
|
@@ -705,7 +711,9 @@ var Action = class {
|
|
|
705
711
|
};
|
|
706
712
|
/**
|
|
707
713
|
* Adds the failing operation's system name and index to an error, unless an
|
|
708
|
-
* inner action already did (the innermost operation is the most specific)
|
|
714
|
+
* inner action already did (the innermost operation is the most specific),
|
|
715
|
+
* and prepends the operation to the error's path, so that every action frame
|
|
716
|
+
* the error passes through adds exactly one entry, outermost first.
|
|
709
717
|
* Non-Error values are wrapped in an Error that keeps their message.
|
|
710
718
|
*/
|
|
711
719
|
function withOperationContext(error, operation, index) {
|
|
@@ -714,6 +722,10 @@ function withOperationContext(error, operation, index) {
|
|
|
714
722
|
annotated.operationSystemName = operation.systemName;
|
|
715
723
|
annotated.operationIndex = index;
|
|
716
724
|
}
|
|
725
|
+
annotated.operationPath = [{
|
|
726
|
+
systemName: operation.systemName,
|
|
727
|
+
index
|
|
728
|
+
}, ...annotated.operationPath ?? []];
|
|
717
729
|
return annotated;
|
|
718
730
|
}
|
|
719
731
|
const emptyOperationData = Object.freeze({});
|
|
@@ -781,8 +793,8 @@ function copyConfiguredOperationData(operationData, systemName) {
|
|
|
781
793
|
// src/action/endable-action.ts
|
|
782
794
|
var EndableAction = class extends Action {
|
|
783
795
|
endOperations;
|
|
784
|
-
constructor(name, startOperations, endOperations, eventBus) {
|
|
785
|
-
super(name, startOperations, eventBus);
|
|
796
|
+
constructor(name, startOperations, endOperations, eventBus, services) {
|
|
797
|
+
super(name, startOperations, eventBus, services);
|
|
786
798
|
this.endOperations = endOperations;
|
|
787
799
|
}
|
|
788
800
|
/**
|
|
@@ -823,8 +835,8 @@ var TimelineAction = class extends EndableAction {
|
|
|
823
835
|
get active() {
|
|
824
836
|
return this._active;
|
|
825
837
|
}
|
|
826
|
-
constructor(name, startOperations, endOperations, duration, eventBus) {
|
|
827
|
-
super(name, startOperations, endOperations, eventBus);
|
|
838
|
+
constructor(name, startOperations, endOperations, duration, eventBus, services) {
|
|
839
|
+
super(name, startOperations, endOperations, eventBus, services);
|
|
828
840
|
this.duration = duration;
|
|
829
841
|
}
|
|
830
842
|
/**
|
|
@@ -1207,16 +1219,19 @@ function warnToConsole(warning) {
|
|
|
1207
1219
|
var ConfigurationResolver = class {
|
|
1208
1220
|
importer;
|
|
1209
1221
|
eventbus;
|
|
1222
|
+
services;
|
|
1210
1223
|
_warn;
|
|
1211
1224
|
/**
|
|
1212
1225
|
* @param importer - Resolves system names to operations, controllers and providers
|
|
1213
1226
|
* @param eventbus - The eventbus the resolved actions run on
|
|
1227
|
+
* @param services - The services of the engine the resolved actions run in
|
|
1214
1228
|
* @param options - Optional. `onWarning` receives the configuration
|
|
1215
1229
|
* warnings instead of the console.
|
|
1216
1230
|
*/
|
|
1217
|
-
constructor(importer, eventbus, options = {}) {
|
|
1231
|
+
constructor(importer, eventbus, services, options = {}) {
|
|
1218
1232
|
this.importer = importer;
|
|
1219
1233
|
this.eventbus = eventbus;
|
|
1234
|
+
this.services = services;
|
|
1220
1235
|
this._warn = options.onWarning ?? warnToConsole;
|
|
1221
1236
|
}
|
|
1222
1237
|
process(configuration, actionRegistryListener) {
|
|
@@ -1233,16 +1248,16 @@ var ConfigurationResolver = class {
|
|
|
1233
1248
|
language: configuration.language,
|
|
1234
1249
|
layoutTemplate: configuration.layoutTemplate,
|
|
1235
1250
|
availableLanguages: deepCopy(configuration.availableLanguages),
|
|
1236
|
-
actions: resolveActions(configuration.actions, this.importer, this.eventbus, "actions", this._warn),
|
|
1237
|
-
initActions: resolveActions(configuration.initActions, this.importer, this.eventbus, "initActions", this._warn),
|
|
1251
|
+
actions: resolveActions(configuration.actions, this.importer, this.eventbus, this.services, "actions", this._warn),
|
|
1252
|
+
initActions: resolveActions(configuration.initActions, this.importer, this.eventbus, this.services, "initActions", this._warn),
|
|
1238
1253
|
timelineFlow: deepCopy(configuration.timelineFlow),
|
|
1239
|
-
timelines: resolveTimelines(configuration.timelines, this.importer, this.eventbus, this._warn)
|
|
1254
|
+
timelines: resolveTimelines(configuration.timelines, this.importer, this.eventbus, this.services, this._warn)
|
|
1240
1255
|
};
|
|
1241
1256
|
assertTimelineProviderSettings(configuration, this.importer);
|
|
1242
1257
|
let eventActions = [];
|
|
1243
1258
|
if (isDefined(configuration.eventActions)) {
|
|
1244
1259
|
assertArray(configuration.eventActions, "eventActions");
|
|
1245
|
-
if (actionRegistryListener) eventActions = resolveEventActions(configuration.eventActions, this.importer, this.eventbus, this._warn);
|
|
1260
|
+
if (actionRegistryListener) eventActions = resolveEventActions(configuration.eventActions, this.importer, this.eventbus, this.services, this._warn);
|
|
1246
1261
|
}
|
|
1247
1262
|
const actionsLookup = createActionsLookup([...resolvedConfig.actions.map((action, index) => [action, `actions[${index}]`]), ...eventActions.map(({ action }, index) => [action, `eventActions[${index}]`])]);
|
|
1248
1263
|
for (const { action, eventName, eventTopic } of eventActions) actionRegistryListener?.registerAction(action, eventName, eventTopic);
|
|
@@ -1377,17 +1392,17 @@ function createActionsLookup(actions) {
|
|
|
1377
1392
|
/**
|
|
1378
1393
|
* Creates the event actions without registering them.
|
|
1379
1394
|
*/
|
|
1380
|
-
function resolveEventActions(eventActionConfigurations, importer, eventbus, warn) {
|
|
1395
|
+
function resolveEventActions(eventActionConfigurations, importer, eventbus, services, warn) {
|
|
1381
1396
|
return eventActionConfigurations.map((config, index) => resolveActionConfiguration(config, importer, `eventActions[${index}]`, warn)).map((config, index) => {
|
|
1382
1397
|
const { eventName, eventTopic } = eventActionConfigurations[index];
|
|
1383
1398
|
return {
|
|
1384
|
-
action: new Action(config.name, config.startOperations, eventbus),
|
|
1399
|
+
action: new Action(config.name, config.startOperations, eventbus, services),
|
|
1385
1400
|
eventName,
|
|
1386
1401
|
eventTopic
|
|
1387
1402
|
};
|
|
1388
1403
|
});
|
|
1389
1404
|
}
|
|
1390
|
-
function resolveTimelines(timelines, importer, eventbus, warn) {
|
|
1405
|
+
function resolveTimelines(timelines, importer, eventbus, services, warn) {
|
|
1391
1406
|
assertArray(timelines, "timelines");
|
|
1392
1407
|
return timelines.map((config, timelineIndex) => {
|
|
1393
1408
|
const path = `timelines[${timelineIndex}]`;
|
|
@@ -1396,7 +1411,7 @@ function resolveTimelines(timelines, importer, eventbus, warn) {
|
|
|
1396
1411
|
...config,
|
|
1397
1412
|
...isDefined(config.positionSource) && { positionSource: deepCopy(config.positionSource) },
|
|
1398
1413
|
...isDefined(config.containerProvider) && { containerProvider: deepCopy(config.containerProvider) },
|
|
1399
|
-
timelineActions: config.timelineActions.map((actionConfig, index) => resolveTimelineAction(importer, eventbus, actionConfig, `${path}.timelineActions[${index}]`, warn))
|
|
1414
|
+
timelineActions: config.timelineActions.map((actionConfig, index) => resolveTimelineAction(importer, eventbus, services, actionConfig, `${path}.timelineActions[${index}]`, warn))
|
|
1400
1415
|
};
|
|
1401
1416
|
});
|
|
1402
1417
|
}
|
|
@@ -1495,20 +1510,20 @@ function resolveDuration(duration, path) {
|
|
|
1495
1510
|
end
|
|
1496
1511
|
};
|
|
1497
1512
|
}
|
|
1498
|
-
function resolveTimelineAction(importer, eventbus, actionConfiguration, path, warn) {
|
|
1513
|
+
function resolveTimelineAction(importer, eventbus, services, actionConfiguration, path, warn) {
|
|
1499
1514
|
const duration = resolveDuration(actionConfiguration.duration, `${path}.duration`);
|
|
1500
1515
|
const { id, name, endOperations, startOperations } = resolveEndableActionConfiguration(actionConfiguration, importer, path, warn);
|
|
1501
|
-
const action = new TimelineAction(name, startOperations, endOperations, duration, eventbus);
|
|
1516
|
+
const action = new TimelineAction(name, startOperations, endOperations, duration, eventbus, services);
|
|
1502
1517
|
action.id = id;
|
|
1503
1518
|
return action;
|
|
1504
1519
|
}
|
|
1505
|
-
function resolveActions(actionConfigurations, importer, eventbus, path, warn) {
|
|
1520
|
+
function resolveActions(actionConfigurations, importer, eventbus, services, path, warn) {
|
|
1506
1521
|
assertArray(actionConfigurations, path);
|
|
1507
1522
|
return actionConfigurations.map((config, index) => {
|
|
1508
1523
|
return resolveEndableActionConfiguration(config, importer, `${path}[${index}]`, warn);
|
|
1509
1524
|
}).map((resolvedConfig) => {
|
|
1510
1525
|
const { name, endOperations, startOperations } = resolvedConfig;
|
|
1511
|
-
const action = new EndableAction(name, startOperations, endOperations, eventbus);
|
|
1526
|
+
const action = new EndableAction(name, startOperations, endOperations, eventbus, services);
|
|
1512
1527
|
action.id = resolvedConfig.id;
|
|
1513
1528
|
return action;
|
|
1514
1529
|
});
|
|
@@ -1637,8 +1652,8 @@ const onceOriginals = /* @__PURE__ */ new WeakMap();
|
|
|
1637
1652
|
*
|
|
1638
1653
|
* @example Request/Response pattern
|
|
1639
1654
|
* ```ts
|
|
1640
|
-
* eventbus.onRequest('request-
|
|
1641
|
-
* const
|
|
1655
|
+
* eventbus.onRequest('request-translation', (key) => translations[key]);
|
|
1656
|
+
* const label = eventbus.request<string>('request-translation', 'nav.home');
|
|
1642
1657
|
* ```
|
|
1643
1658
|
*
|
|
1644
1659
|
* Broadcasts isolate errors: a handler, listener or interceptor that throws, or
|
|
@@ -1841,6 +1856,27 @@ var Eventbus = class {
|
|
|
1841
1856
|
}
|
|
1842
1857
|
};
|
|
1843
1858
|
|
|
1859
|
+
// src/engine-services.ts
|
|
1860
|
+
/**
|
|
1861
|
+
* Creates services for a context that has no engine, such as linting or a
|
|
1862
|
+
* scope made by `createDefaultScope`. Every lookup throws an error naming
|
|
1863
|
+
* that context.
|
|
1864
|
+
*
|
|
1865
|
+
* @param context - Who created the services, for the error message
|
|
1866
|
+
* @returns Services whose every lookup throws
|
|
1867
|
+
*/
|
|
1868
|
+
function createUnavailableServices(context) {
|
|
1869
|
+
const unavailable = () => {
|
|
1870
|
+
throw new Error(`${context}: engine services are not available here (no engine)`);
|
|
1871
|
+
};
|
|
1872
|
+
return {
|
|
1873
|
+
getAction: unavailable,
|
|
1874
|
+
getImport: unavailable,
|
|
1875
|
+
createInstance: unavailable,
|
|
1876
|
+
getEngineRoot: unavailable
|
|
1877
|
+
};
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1844
1880
|
// src/controllers/metadata/dom-event-listener-controller.ts
|
|
1845
1881
|
function DOMEventListenerController() {
|
|
1846
1882
|
return {
|
|
@@ -2427,8 +2463,8 @@ function customFunction() {
|
|
|
2427
2463
|
description: `This operation retrieves a custom function defined by the given system name
|
|
2428
2464
|
and invokes it with the current operation data and eventbus.
|
|
2429
2465
|
|
|
2430
|
-
The function is looked up with
|
|
2431
|
-
|
|
2466
|
+
The function is looked up with \`this.services.getImport\`, which answers from
|
|
2467
|
+
the engine's resource importer. Register the function
|
|
2432
2468
|
with the \`EligiusResourceImporter\` constructor:
|
|
2433
2469
|
\`new EligiusResourceImporter({functions: {myFunction}})\`.
|
|
2434
2470
|
|
|
@@ -2751,8 +2787,8 @@ function getImport() {
|
|
|
2751
2787
|
description: `This operation retrieves the import specified by the given \`systemName\` and
|
|
2752
2788
|
assigns it to the \`importedInstance\` property on the current operaton date.
|
|
2753
2789
|
|
|
2754
|
-
The import is looked up with
|
|
2755
|
-
|
|
2790
|
+
The import is looked up with \`this.services.getImport\`, which answers from
|
|
2791
|
+
the engine's resource importer. Functions, templates
|
|
2756
2792
|
and JSON registered with the \`EligiusResourceImporter\` constructor
|
|
2757
2793
|
(\`new EligiusResourceImporter({json: {settings}})\`) can be imported this
|
|
2758
2794
|
way, as can every built-in operation, controller and provider export.`,
|
|
@@ -4308,7 +4344,7 @@ function lintConfiguration(configuration, options = {}) {
|
|
|
4308
4344
|
const diagnostics = [];
|
|
4309
4345
|
const copy = deepCopy(configuration);
|
|
4310
4346
|
const importer = createLintImporter(options, collectPlaceholderNames(copy));
|
|
4311
|
-
const resolver = new ConfigurationResolver(importer, new Eventbus(), { onWarning: () => {} });
|
|
4347
|
+
const resolver = new ConfigurationResolver(importer, new Eventbus(), createUnavailableServices("lintConfiguration"), { onWarning: () => {} });
|
|
4312
4348
|
try {
|
|
4313
4349
|
resolver.process(copy, new ActionRegistryEventbusListener());
|
|
4314
4350
|
} catch (error) {
|