eligius 4.0.0 → 4.1.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.
@@ -0,0 +1,5005 @@
1
+ /**
2
+ * Structural stand-in for jQuery's `JQuery` type, so these declarations do not
3
+ * depend on @types/jquery. Module scoped: it shadows the global `JQuery` only
4
+ * inside this file.
5
+ */
6
+ interface JQuery<TElement = HTMLElement> extends Iterable<TElement> {
7
+ readonly jquery: string;
8
+ readonly length: number;
9
+ [index: number]: TElement;
10
+ }
11
+ declare namespace JQuery {
12
+ type Duration = number | 'fast' | 'slow';
13
+ type Node = Element | Text | Comment | Document | DocumentFragment;
14
+ }
15
+ /**
16
+ * Event: before-request-timeline-uri
17
+ *
18
+ * Broadcast by `RequestVideoUriInterceptor` just before a
19
+ * `request-timeline-uri` event is handled, with the same arguments.
20
+ *
21
+ * @param uri - The timeline URI that is about to be loaded
22
+ * @param position - Optional start position (defaults to 0)
23
+ * @category Timeline
24
+ */
25
+ interface BeforeRequestTimelineUriEvent {
26
+ name: 'before-request-timeline-uri';
27
+ args: [uri: string, position?: number];
28
+ }
29
+ /**
30
+ * Event: before-request-video-url
31
+ * @param index - The video URL index
32
+ * @param requestedVideoPosition - Optional video position to seek to
33
+ * @param isHistoryRequest - Flag indicating if this is a history request
34
+ * @deprecated Legacy video navigation event; the engine does not handle it. Use a navigation entry with
35
+ * `timelineUri` (broadcast as `request-timeline-uri`) and the timeline events instead.
36
+ * @category Navigation
37
+ */
38
+ interface BeforeRequestVideoUrlEvent {
39
+ name: 'before-request-video-url';
40
+ args: [index: number, requestedVideoPosition?: number, isHistoryRequest?: boolean];
41
+ }
42
+ /**
43
+ * Event: dom-mutation
44
+ * @param payload - Mutation observer payload
45
+ * @category Controller
46
+ */
47
+ interface DomMutationEvent {
48
+ name: 'dom-mutation';
49
+ args: [payload: any];
50
+ }
51
+ /**
52
+ * Event: engine-command-error
53
+ * Broadcast by EngineEventbusAdapter when an engine command that an eventbus
54
+ * event triggered fails, for example `engine.start()` after a
55
+ * `timeline-play-request` when the browser blocks autoplay. The failure is
56
+ * also logged with `console.error`.
57
+ * @param command - The engine method that failed: `'start'`, `'stop'`, `'seek'` or `'switchTimeline'`
58
+ * @param error - The value the engine's promise rejected with
59
+ * @category Engine
60
+ */
61
+ interface EngineCommandErrorEvent {
62
+ name: 'engine-command-error';
63
+ args: [command: string, error: unknown];
64
+ }
65
+ interface IController<T extends TOperationData> {
66
+ name: string;
67
+ init(operationData: T): void;
68
+ attach(eventbus: IEventbus): Promise<any> | void;
69
+ detach(eventbus: IEventbus): void;
70
+ }
71
+ /** A start and end frame. Mirrors lottie-web's `AnimationSegment`. */
72
+ type TLottieAnimationSegment = [number, number];
73
+ /** Playback direction: forward or backward. Mirrors lottie-web's `AnimationDirection`. */
74
+ type TLottieAnimationDirection = 1 | -1;
75
+ /** The events a lottie animation emits. Mirrors lottie-web's `AnimationEventName`. */
76
+ type TLottieAnimationEventName = 'drawnFrame' | 'enterFrame' | 'loopComplete' | 'complete' | 'segmentStart' | 'destroy' | 'config_ready' | 'data_ready' | 'DOMLoaded' | 'error' | 'data_failed' | 'loaded_images';
77
+ /** Mirrors lottie-web's `AnimationEventCallback`. */
78
+ type TLottieAnimationEventCallback<T = any> = (args: T) => void;
79
+ /** Payload of the `complete` event. Mirrors lottie-web's `BMCompleteEvent`. */
80
+ interface ILottieCompleteEvent {
81
+ direction: number;
82
+ type: 'complete';
83
+ }
84
+ /** Payload of the `loopComplete` event. Mirrors lottie-web's `BMCompleteLoopEvent`. */
85
+ interface ILottieCompleteLoopEvent {
86
+ currentLoop: number;
87
+ direction: number;
88
+ totalLoops: number;
89
+ type: 'loopComplete';
90
+ }
91
+ /** Payload of the `destroy` event. Mirrors lottie-web's `BMDestroyEvent`. */
92
+ interface ILottieDestroyEvent {
93
+ type: 'destroy';
94
+ }
95
+ /** Payload of the `enterFrame` and `drawnFrame` events. Mirrors lottie-web's `BMEnterFrameEvent`. */
96
+ interface ILottieEnterFrameEvent {
97
+ /** The current time in frames. */
98
+ currentTime: number;
99
+ direction: number;
100
+ /** The total number of frames. */
101
+ totalTime: number;
102
+ type: 'enterFrame';
103
+ }
104
+ /** Payload of the `segmentStart` event. Mirrors lottie-web's `BMSegmentStartEvent`. */
105
+ interface ILottieSegmentStartEvent {
106
+ firstFrame: number;
107
+ totalFrames: number;
108
+ type: 'segmentStart';
109
+ }
110
+ /** The payload of each lottie animation event. Mirrors lottie-web's `AnimationEvents`. */
111
+ interface ILottieAnimationEvents {
112
+ DOMLoaded: undefined;
113
+ complete: ILottieCompleteEvent;
114
+ config_ready: undefined;
115
+ data_failed: undefined;
116
+ data_ready: undefined;
117
+ destroy: ILottieDestroyEvent;
118
+ drawnFrame: ILottieEnterFrameEvent;
119
+ enterFrame: ILottieEnterFrameEvent;
120
+ error: undefined;
121
+ loaded_images: undefined;
122
+ loopComplete: ILottieCompleteLoopEvent;
123
+ segmentStart: ILottieSegmentStartEvent;
124
+ }
125
+ /**
126
+ * A loaded lottie animation, as created by `LottieController`. Mirrors
127
+ * lottie-web's `AnimationItem`.
128
+ */
129
+ interface ILottieAnimationItem {
130
+ name: string;
131
+ isLoaded: boolean;
132
+ currentFrame: number;
133
+ currentRawFrame: number;
134
+ firstFrame: number;
135
+ totalFrames: number;
136
+ frameRate: number;
137
+ frameMult: number;
138
+ playSpeed: number;
139
+ playDirection: number;
140
+ playCount: number;
141
+ isPaused: boolean;
142
+ autoplay: boolean;
143
+ loop: boolean | number;
144
+ renderer: any;
145
+ animationID: string;
146
+ assetsPath: string;
147
+ timeCompleted: number;
148
+ segmentPos: number;
149
+ isSubframeEnabled: boolean;
150
+ segments: TLottieAnimationSegment | TLottieAnimationSegment[];
151
+ play(name?: string): void;
152
+ stop(name?: string): void;
153
+ togglePause(name?: string): void;
154
+ destroy(name?: string): void;
155
+ pause(name?: string): void;
156
+ goToAndStop(value: number | string, isFrame?: boolean, name?: string): void;
157
+ goToAndPlay(value: number | string, isFrame?: boolean, name?: string): void;
158
+ includeLayers(data: any): void;
159
+ setSegment(init: number, end: number): void;
160
+ resetSegments(forceFlag: boolean): void;
161
+ hide(): void;
162
+ show(): void;
163
+ resize(width?: number, height?: number): void;
164
+ setSpeed(speed: number): void;
165
+ setDirection(direction: TLottieAnimationDirection): void;
166
+ setLoop(isLooping: boolean): void;
167
+ playSegments(segments: TLottieAnimationSegment | TLottieAnimationSegment[], forceFlag?: boolean): void;
168
+ setSubframe(useSubFrames: boolean): void;
169
+ getDuration(inFrames?: boolean): number;
170
+ triggerEvent<T extends TLottieAnimationEventName>(name: T, args: ILottieAnimationEvents[T]): void;
171
+ addEventListener<T extends TLottieAnimationEventName>(name: T, callback: TLottieAnimationEventCallback<ILottieAnimationEvents[T]>): () => void;
172
+ removeEventListener<T extends TLottieAnimationEventName>(name: T, callback?: TLottieAnimationEventCallback<ILottieAnimationEvents[T]>): void;
173
+ }
174
+ /** Mirrors lottie-web's `FilterSizeConfig`. */
175
+ interface ILottieFilterSizeConfig {
176
+ width: string;
177
+ height: string;
178
+ x: string;
179
+ y: string;
180
+ }
181
+ /** Settings shared by all renderers. Mirrors lottie-web's `BaseRendererConfig`. */
182
+ interface ILottieBaseRendererConfig {
183
+ imagePreserveAspectRatio?: string;
184
+ className?: string;
185
+ }
186
+ /** SVG renderer settings. Mirrors lottie-web's `SVGRendererConfig`. */
187
+ interface ILottieSVGRendererConfig extends ILottieBaseRendererConfig {
188
+ title?: string;
189
+ description?: string;
190
+ preserveAspectRatio?: string;
191
+ progressiveLoad?: boolean;
192
+ hideOnTransparent?: boolean;
193
+ viewBoxOnly?: boolean;
194
+ viewBoxSize?: string;
195
+ focusable?: boolean;
196
+ filterSize?: ILottieFilterSizeConfig;
197
+ }
198
+ /** Canvas renderer settings. Mirrors lottie-web's `CanvasRendererConfig`. */
199
+ interface ILottieCanvasRendererConfig extends ILottieBaseRendererConfig {
200
+ clearCanvas?: boolean;
201
+ context?: CanvasRenderingContext2D;
202
+ progressiveLoad?: boolean;
203
+ preserveAspectRatio?: string;
204
+ dpr?: number;
205
+ }
206
+ /** HTML renderer settings. Mirrors lottie-web's `HTMLRendererConfig`. */
207
+ interface ILottieHTMLRendererConfig extends ILottieBaseRendererConfig {
208
+ hideOnTransparent?: boolean;
209
+ }
210
+ /** The renderer settings a `LottieController` accepts. */
211
+ type TLottieRendererConfig = ILottieSVGRendererConfig | ILottieCanvasRendererConfig | ILottieHTMLRendererConfig;
212
+ /**
213
+ * Locale Types
214
+ * Feature: 005-rosetta-locale-manager
215
+ *
216
+ * These types define the public API for the locale management system.
217
+ */
218
+ /**
219
+ * IETF language tag format (e.g., 'en-US', 'nl-NL')
220
+ */
221
+ type TLanguageCode = `${Lowercase<string>}-${Uppercase<string>}`;
222
+ /**
223
+ * Recursive interface for nested translation data.
224
+ * Compatible with rosetta's expected format.
225
+ * Uses interface to support recursive definition.
226
+ */
227
+ interface TLocaleData {
228
+ [key: string]: string | ((params: Record<string, unknown>) => string) | TLocaleData;
229
+ }
230
+ /**
231
+ * External locale file reference using JSON Reference syntax.
232
+ * The loader resolves these to TLocaleData at initialization.
233
+ */
234
+ interface ILocaleReference {
235
+ /** URL or relative path to JSON locale file */
236
+ $ref: string;
237
+ }
238
+ /**
239
+ * A single locale entry can be inline data or an external reference.
240
+ */
241
+ type TLocaleEntry = TLocaleData | ILocaleReference;
242
+ /**
243
+ * Top-level configuration object for all locales.
244
+ * Keys are language codes, values are inline data or external references.
245
+ */
246
+ interface ILocalesConfiguration {
247
+ [locale: TLanguageCode]: TLocaleEntry;
248
+ }
249
+ /**
250
+ * The phase of an action in which an error occurred.
251
+ */
252
+ type TActionPhase = 'start' | 'end';
253
+ /**
254
+ * Error reported through the engine's `error` event (and the `engine-error`
255
+ * eventbus event) when a timeline action dispatched by the engine fails.
256
+ *
257
+ * The message names the action, the phase and, when the original error
258
+ * carries it, the operation, followed by the original message.
259
+ */
260
+ interface IEngineActionError extends Error {
261
+ /** Name of the failing action */
262
+ readonly actionName: string;
263
+ /** Id of the failing action */
264
+ readonly actionId: string;
265
+ /** Whether the start or the end operations failed */
266
+ readonly phase: TActionPhase;
267
+ /** System name of the failing operation, when known */
268
+ readonly operationSystemName?: string;
269
+ /** Index of the failing operation in its operation list, when known */
270
+ readonly operationIndex?: number;
271
+ /** The original error */
272
+ readonly cause: unknown;
273
+ }
274
+ /**
275
+ * A configuration problem that does not stop the resolver, reported through
276
+ * {@link IConfigurationResolverOptions.onWarning}.
277
+ */
278
+ interface IConfigurationWarning {
279
+ /** JSON path of the offending value, for example `actions[0].startOperations[2].systemName` */
280
+ path: string;
281
+ /** What is wrong and what happens at runtime */
282
+ message: string;
283
+ }
284
+ /**
285
+ * Options for the `ConfigurationResolver` constructor.
286
+ */
287
+ interface IConfigurationResolverOptions {
288
+ /**
289
+ * Receives every configuration warning. Without it, warnings are written
290
+ * with `console.warn`.
291
+ */
292
+ onWarning?: (warning: IConfigurationWarning) => void;
293
+ }
294
+ /**
295
+ * Describes a duration of time expressed in a start and an optional end range with a one second interval.
296
+ */
297
+ interface IDuration {
298
+ start: number;
299
+ end?: number;
300
+ }
301
+ /**
302
+ * Describes a duration of time expressed in a start and an end range with a one second interval.
303
+ */
304
+ interface IStrictDuration extends Required<IDuration> {}
305
+ /**
306
+ * Describes the different kinds of timeline providers.
307
+ */
308
+ type TimelineTypes = 'animation' | 'mediaplayer';
309
+ interface ISubtitleCollection {
310
+ languageCode: TLanguageCode;
311
+ titles: ISubtitle[];
312
+ }
313
+ interface ISubtitle {
314
+ id: string;
315
+ duration: IStrictDuration;
316
+ text: string;
317
+ }
318
+ type RequireKeys<T, K extends keyof T> = { [P in K]-?: T[P]; };
319
+ /**
320
+ * Event: engine-error
321
+ * Broadcast when a timeline action that the engine started or ended on its
322
+ * own fails. The error names the action, the phase (start or end) and, when
323
+ * known, the failing operation.
324
+ * @param error - The error, with the original error as its `cause`
325
+ * @category Engine
326
+ */
327
+ interface EngineErrorEvent {
328
+ name: 'engine-error';
329
+ args: [error: IEngineActionError];
330
+ }
331
+ /**
332
+ * Event: highlight-navigation
333
+ * @param videoUrlIndex - The index of the video URL to highlight
334
+ * @category Navigation
335
+ */
336
+ interface HighlightNavigationEvent {
337
+ name: 'highlight-navigation';
338
+ args: [videoUrlIndex: number];
339
+ }
340
+ /**
341
+ * Event: language-change
342
+ * @param language - The new language code
343
+ * @category Language Manager
344
+ */
345
+ interface LanguageChangeEvent {
346
+ name: 'language-change';
347
+ args: [language: TLanguageCode];
348
+ }
349
+ /**
350
+ * Event: navigate-to-video-url
351
+ * @param index - The video URL index to navigate to
352
+ * @param requestedVideoPosition - Optional video position to seek to
353
+ * @deprecated Legacy video navigation event; the engine does not handle it. Use a navigation entry with
354
+ * `timelineUri` (broadcast as `request-timeline-uri`) and the timeline events instead.
355
+ * @category Navigation
356
+ */
357
+ interface NavigateToVideoUrlEvent {
358
+ name: 'navigate-to-video-url';
359
+ args: [index: number, requestedVideoPosition?: number];
360
+ }
361
+ /**
362
+ * Event: push-history-state
363
+ * @param state - The history state to push
364
+ * @category Navigation
365
+ */
366
+ interface PushHistoryStateEvent {
367
+ name: 'push-history-state';
368
+ args: [state: any];
369
+ }
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
+ /**
385
+ * Request: request-current-language
386
+ * Answered through `eventbus.request('request-current-language')` by
387
+ * LocaleEventbusAdapter with the active locale.
388
+ * @returns The current language code
389
+ * @category Engine Request
390
+ */
391
+ interface RequestCurrentLanguageEvent {
392
+ name: 'request-current-language';
393
+ args: [];
394
+ returns: TLanguageCode;
395
+ }
396
+ /**
397
+ * Event: request-current-navigation
398
+ * @param callback - Callback that receives the current navigation data
399
+ * @category Navigation
400
+ */
401
+ interface RequestCurrentNavigationEvent {
402
+ name: 'request-current-navigation';
403
+ args: [callback: (navigation: any) => void];
404
+ }
405
+ /**
406
+ * Request: request-current-timeline-position
407
+ * Answered through `eventbus.request('request-current-timeline-position')` by
408
+ * EngineEventbusAdapter with the position of the current timeline. The engine
409
+ * also answers the legacy form, a broadcast whose last argument is a
410
+ * callback that receives the value.
411
+ * @returns The current position in seconds
412
+ * @category Engine Request
413
+ */
414
+ interface RequestCurrentTimelinePositionEvent {
415
+ name: 'request-current-timeline-position';
416
+ args: [];
417
+ returns: number;
418
+ }
419
+ /**
420
+ * Event: request-current-video-position
421
+ * @param callback - Callback that receives the current video position
422
+ * @deprecated Legacy video navigation event; the engine does not handle it. Use a navigation entry with
423
+ * `timelineUri` (broadcast as `request-timeline-uri`) and the timeline events instead.
424
+ * @category Navigation
425
+ */
426
+ interface RequestCurrentVideoPositionEvent {
427
+ name: 'request-current-video-position';
428
+ args: [callback: (position: number) => void];
429
+ }
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
+ /**
475
+ * Event: request-label-collection
476
+ * @param language - The language code
477
+ * @param callback - Callback that receives the label collection
478
+ * @deprecated Legacy label event; the engine does not handle it. Labels moved to the locale manager in
479
+ * 2.2.0: use `request-translation` (or LabelController with a `translationKey`) instead.
480
+ * @category Engine Request
481
+ */
482
+ interface RequestLabelCollectionEvent {
483
+ name: 'request-label-collection';
484
+ args: [language: string, callback: (collection: any) => void];
485
+ }
486
+ /**
487
+ * Event: request-label-collections
488
+ * @param labelIds - Array of label IDs to retrieve
489
+ * @param callback - Callback that receives the label collections
490
+ * @deprecated Legacy label event; the engine does not handle it. Labels moved to the locale manager in
491
+ * 2.2.0: use `request-translation` (or LabelController with a `translationKey`) instead.
492
+ * @category Engine Request
493
+ */
494
+ interface RequestLabelCollectionsEvent {
495
+ name: 'request-label-collections';
496
+ args: [labelIds: string[], callback: (collections: any) => void];
497
+ }
498
+ /**
499
+ * Event: request-timeline-cleanup
500
+ * @category Engine Request
501
+ */
502
+ interface RequestTimelineCleanupEvent {
503
+ name: 'request-timeline-cleanup';
504
+ args: [];
505
+ }
506
+ /**
507
+ * Event: request-timeline-uri
508
+ * @param uri - The timeline URI to load
509
+ * @param position - Optional start position (defaults to 0)
510
+ * @category Engine Request
511
+ */
512
+ interface RequestTimelineUriEvent {
513
+ name: 'request-timeline-uri';
514
+ args: [uri: string, position?: number];
515
+ }
516
+ /**
517
+ * Request: request-translation
518
+ * Answered through `eventbus.request('request-translation', key, params)` by
519
+ * LocaleEventbusAdapter with the translation for the key in the active
520
+ * locale, see `ILocaleManager.t`.
521
+ * @param key - Dot-notation translation key, or its segments
522
+ * @param params - Optional values for the placeholders in the translation
523
+ * @returns The translated text
524
+ * @category Engine Request
525
+ */
526
+ interface RequestTranslationEvent {
527
+ name: 'request-translation';
528
+ args: [key: string | string[], params?: Record<string, unknown>];
529
+ returns: string;
530
+ }
531
+ /**
532
+ * Event: request-video-cleanup
533
+ * @deprecated Legacy video navigation event; the engine does not handle it. Use a navigation entry with
534
+ * `timelineUri` (broadcast as `request-timeline-uri`) and the timeline events instead.
535
+ * @category Navigation
536
+ */
537
+ interface RequestVideoCleanupEvent {
538
+ name: 'request-video-cleanup';
539
+ args: [];
540
+ }
541
+ /**
542
+ * Event: request-video-url
543
+ * @param videoUrlIndex - The index of the video URL
544
+ * @param requestedVideoPosition - Optional video position to seek to
545
+ * @param fromRouting - Optional flag indicating if request came from routing
546
+ * @deprecated Legacy video navigation event; the engine does not handle it. Use a navigation entry with
547
+ * `timelineUri` (broadcast as `request-timeline-uri`) and the timeline events instead.
548
+ * @category Navigation
549
+ */
550
+ interface RequestVideoUrlEvent {
551
+ name: 'request-video-url';
552
+ args: [videoUrlIndex: number, requestedVideoPosition?: number, fromRouting?: boolean];
553
+ }
554
+ /**
555
+ * Event: timeline-complete
556
+ * @category Timeline
557
+ */
558
+ interface CompleteEvent {
559
+ name: 'timeline-complete';
560
+ args: [];
561
+ }
562
+ /**
563
+ * Request: timeline-container-request
564
+ * Answered through `eventbus.request('timeline-container-request')` by
565
+ * EngineEventbusAdapter with the DOM container of the current timeline. The
566
+ * engine also answers the legacy form, a broadcast whose last argument is a
567
+ * callback that receives the value.
568
+ * @returns The container element, or undefined when there is none
569
+ * @category Timeline
570
+ */
571
+ interface ContainerRequestEvent {
572
+ name: 'timeline-container-request';
573
+ args: [];
574
+ returns: JQuery<HTMLElement> | undefined;
575
+ }
576
+ /**
577
+ * Event: timeline-current-timeline-change
578
+ * @param timelineUri - The URI of the new current timeline
579
+ * @category Timeline
580
+ */
581
+ interface CurrentTimelineChangeEvent {
582
+ name: 'timeline-current-timeline-change';
583
+ args: [timelineUri: string];
584
+ }
585
+ /**
586
+ * Request: timeline-duration-request
587
+ * Answered through `eventbus.request('timeline-duration-request')` by
588
+ * EngineEventbusAdapter with the duration of the current timeline. The engine
589
+ * also answers the legacy form, a broadcast whose last argument is a
590
+ * callback that receives the value.
591
+ * @returns The duration in seconds, or undefined when it is not known yet
592
+ * @category Timeline
593
+ */
594
+ interface DurationRequestEvent {
595
+ name: 'timeline-duration-request';
596
+ args: [];
597
+ returns: number | undefined;
598
+ }
599
+ /**
600
+ * Event: timeline-duration
601
+ * @param getDuration - Function that returns the timeline duration
602
+ * @category Timeline
603
+ */
604
+ interface DurationEvent {
605
+ name: 'timeline-duration';
606
+ args: [getDuration: (() => number) | undefined];
607
+ }
608
+ /**
609
+ * Event: timeline-firstframe
610
+ * @category Timeline
611
+ */
612
+ interface FirstFrameEvent {
613
+ name: 'timeline-firstframe';
614
+ args: [];
615
+ }
616
+ /**
617
+ * Event: timeline-pause-request
618
+ * @category Timeline
619
+ */
620
+ interface PauseRequestEvent {
621
+ name: 'timeline-pause-request';
622
+ args: [];
623
+ }
624
+ /**
625
+ * Event: timeline-pause
626
+ * @category Timeline
627
+ */
628
+ interface PauseEvent {
629
+ name: 'timeline-pause';
630
+ args: [];
631
+ }
632
+ /**
633
+ * Event: timeline-play-request
634
+ * @category Timeline
635
+ */
636
+ interface PlayRequestEvent {
637
+ name: 'timeline-play-request';
638
+ args: [];
639
+ }
640
+ /**
641
+ * Event: timeline-play-toggle-request
642
+ * @category Timeline
643
+ */
644
+ interface PlayToggleRequestEvent {
645
+ name: 'timeline-play-toggle-request';
646
+ args: [];
647
+ }
648
+ /**
649
+ * Event: timeline-play
650
+ * @category Timeline
651
+ */
652
+ interface PlayEvent {
653
+ name: 'timeline-play';
654
+ args: [];
655
+ }
656
+ /**
657
+ * Request: timeline-request-current-timeline
658
+ * Answered through `eventbus.request('timeline-request-current-timeline')` by
659
+ * EngineEventbusAdapter with the URI of the current timeline. The engine also
660
+ * answers the legacy form, a broadcast whose last argument is a callback that
661
+ * receives the value.
662
+ * @returns The current timeline URI
663
+ * @category Engine Request
664
+ */
665
+ interface RequestCurrentTimelineEvent {
666
+ name: 'timeline-request-current-timeline';
667
+ args: [];
668
+ returns: string;
669
+ }
670
+ /**
671
+ * Event: timeline-resize-request
672
+ * @category Timeline
673
+ */
674
+ interface ResizeRequestEvent {
675
+ name: 'timeline-resize-request';
676
+ args: [];
677
+ }
678
+ /**
679
+ * Event: timeline-resize
680
+ * @category Timeline
681
+ */
682
+ interface ResizeEvent {
683
+ name: 'timeline-resize';
684
+ args: [];
685
+ }
686
+ /**
687
+ * Event: timeline-restart
688
+ * @category Timeline
689
+ */
690
+ interface RestartEvent {
691
+ name: 'timeline-restart';
692
+ args: [];
693
+ }
694
+ /**
695
+ * Event: timeline-seek-request
696
+ * @param position - The timeline position to seek to
697
+ * @category Timeline
698
+ */
699
+ interface SeekRequestEvent {
700
+ name: 'timeline-seek-request';
701
+ args: [position: number];
702
+ }
703
+ /**
704
+ * Event: timeline-seek
705
+ * @param seekPosition - The position to seek to
706
+ * @param currentPosition - The current position
707
+ * @param duration - The timeline duration
708
+ * @category Timeline
709
+ */
710
+ interface SeekEvent {
711
+ name: 'timeline-seek';
712
+ args: [seekPosition: number, currentPosition: number, duration: number];
713
+ }
714
+ /**
715
+ * Event: timeline-seeked
716
+ * @param position - The new timeline position after seeking
717
+ * @param duration - The timeline duration
718
+ * @category Timeline
719
+ */
720
+ interface SeekedEvent {
721
+ name: 'timeline-seeked';
722
+ args: [position: number, duration: number];
723
+ }
724
+ /**
725
+ * Event: timeline-stop-request
726
+ * @category Timeline
727
+ */
728
+ interface StopRequestEvent {
729
+ name: 'timeline-stop-request';
730
+ args: [];
731
+ }
732
+ /**
733
+ * Event: timeline-stop
734
+ * @category Timeline
735
+ */
736
+ interface StopEvent {
737
+ name: 'timeline-stop';
738
+ args: [];
739
+ }
740
+ /**
741
+ * Event: timeline-time
742
+ * @param position - The current timeline position
743
+ * @category Timeline
744
+ */
745
+ interface TimeEvent {
746
+ name: 'timeline-time';
747
+ args: [position: number];
748
+ }
749
+ /**
750
+ * Event: video-complete
751
+ * @param index - The video URL index that completed
752
+ * @deprecated Legacy video navigation event; the engine does not handle it. Use a navigation entry with
753
+ * `timelineUri` (broadcast as `request-timeline-uri`) and the timeline events instead.
754
+ * @category Navigation
755
+ */
756
+ interface VideoCompleteEvent {
757
+ name: 'video-complete';
758
+ args: [index: number];
759
+ }
760
+ type AllEvents = BeforeRequestTimelineUriEvent | BeforeRequestVideoUrlEvent | DomMutationEvent | EngineCommandErrorEvent | EngineErrorEvent | HighlightNavigationEvent | LanguageChangeEvent | NavigateToVideoUrlEvent | PushHistoryStateEvent | RequestActionEvent | RequestCurrentLanguageEvent | RequestCurrentNavigationEvent | RequestCurrentTimelinePositionEvent | RequestCurrentVideoPositionEvent | RequestEngineRootEvent | RequestFunctionEvent | RequestInstanceEvent | 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
+ type EventMap = { [K in AllEvents as K['name']]: K extends {
762
+ returns: infer R;
763
+ } ? [...K['args'], callback?: (result: R) => void] : K['args']; };
764
+ type EventName = keyof EventMap;
765
+ /**
766
+ * The request/response queries that Eligius itself answers through
767
+ * `IEventbus.onRequest`, with the arguments each takes and the value it
768
+ * returns. Generated from the event interfaces in `src/eventbus/events`
769
+ * that declare a `returns` property.
770
+ *
771
+ * Querying one of these names with `IEventbus.request` (without an
772
+ * explicit type argument) types the response, and registering a
773
+ * responder for one with `IEventbus.onRequest` checks the signature.
774
+ * The untyped string overloads remain for custom request names.
775
+ */
776
+ interface RequestMap {
777
+ 'request-action': {
778
+ args: RequestActionEvent['args'];
779
+ returns: RequestActionEvent['returns'];
780
+ };
781
+ 'request-current-language': {
782
+ args: RequestCurrentLanguageEvent['args'];
783
+ returns: RequestCurrentLanguageEvent['returns'];
784
+ };
785
+ 'request-current-timeline-position': {
786
+ args: RequestCurrentTimelinePositionEvent['args'];
787
+ returns: RequestCurrentTimelinePositionEvent['returns'];
788
+ };
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
+ 'request-translation': {
802
+ args: RequestTranslationEvent['args'];
803
+ returns: RequestTranslationEvent['returns'];
804
+ };
805
+ 'timeline-container-request': {
806
+ args: ContainerRequestEvent['args'];
807
+ returns: ContainerRequestEvent['returns'];
808
+ };
809
+ 'timeline-duration-request': {
810
+ args: DurationRequestEvent['args'];
811
+ returns: DurationRequestEvent['returns'];
812
+ };
813
+ 'timeline-request-current-timeline': {
814
+ args: RequestCurrentTimelineEvent['args'];
815
+ returns: RequestCurrentTimelineEvent['returns'];
816
+ };
817
+ }
818
+ type TEventbusRemover = () => void;
819
+ type TRequestResponder<T = unknown> = (...args: any[]) => T;
820
+ /**
821
+ * Names of the request/response queries declared in {@link RequestMap}.
822
+ */
823
+ type RequestName = keyof RequestMap;
824
+ /**
825
+ * Responder signature for a request declared in {@link RequestMap}.
826
+ */
827
+ type TTypedRequestResponder<K extends RequestName> = (...args: RequestMap[K]['args']) => RequestMap[K]['returns'];
828
+ /**
829
+ * Describes who reports an error through {@link IEventbus.reportError}.
830
+ */
831
+ interface IEventbusErrorReport {
832
+ /** The reporting component, such as `'DOMEventListenerController'`. */
833
+ source: string;
834
+ /** The eventbus event being handled when the error occurred, if any. */
835
+ eventName?: string;
836
+ }
837
+ interface IEventbus {
838
+ clear(): void;
839
+ on<E extends EventName>(eventName: E, eventHandler: (...args: EventMap[E]) => void, eventTopic?: string): TEventbusRemover;
840
+ /**
841
+ * Removes one registration of the handler. A handler registered with
842
+ * {@link IEventbus.once} can be removed by passing the original function;
843
+ * an exact `on()` registration of the same function is removed first.
844
+ *
845
+ * @param eventName - The event name
846
+ * @param eventHandler - The handler that was registered
847
+ * @param eventTopic - The topic it was registered for, if any
848
+ */
849
+ off<E extends EventName>(eventName: E, eventHandler: (...args: EventMap[E]) => void, eventTopic?: string): void;
850
+ once<E extends EventName>(eventName: E, eventHandler: (...args: EventMap[E]) => void, eventTopic?: string): TEventbusRemover;
851
+ /**
852
+ * Broadcast an event to its interceptors, the eventbus listeners and its
853
+ * handlers, in that order.
854
+ *
855
+ * Errors are isolated: a handler, listener or interceptor that throws (or
856
+ * returns a promise that rejects) is reported through `console.error` and
857
+ * the `onHandlerError` option, and the remaining ones still run. A failing
858
+ * interceptor leaves the arguments as they were before it ran. This method
859
+ * never throws because of them.
860
+ *
861
+ * @param eventName - The event name
862
+ * @param args - The event arguments
863
+ */
864
+ broadcast<E extends EventName>(eventName: E, args: EventMap[E]): void;
865
+ /**
866
+ * Broadcast an event for a specific topic. Errors are isolated the same way
867
+ * as in {@link IEventbus.broadcast}.
868
+ *
869
+ * @param eventName - The event name
870
+ * @param eventTopic - The topic to target
871
+ * @param args - The event arguments
872
+ */
873
+ broadcastForTopic<E extends EventName>(eventName: E, eventTopic: string, args: EventMap[E]): void;
874
+ /**
875
+ * Register a responder for synchronous request/response queries.
876
+ * Only the first registered responder for an event will be called.
877
+ *
878
+ * For a name declared in {@link RequestMap} the responder's arguments and
879
+ * return value are type checked.
880
+ *
881
+ * @param eventName - The request event name
882
+ * @param responder - Function that returns the response value
883
+ * @param eventTopic - Optional topic for topic-specific responders
884
+ * @returns Function to unregister the responder
885
+ */
886
+ onRequest<K extends RequestName>(eventName: K, responder: TTypedRequestResponder<K>, eventTopic?: string): TEventbusRemover;
887
+ onRequest<T>(eventName: string, responder: TRequestResponder<T>, eventTopic?: string): TEventbusRemover;
888
+ /**
889
+ * Send a synchronous request and get an immediate response.
890
+ * Returns undefined if no responder is registered.
891
+ *
892
+ * For a name declared in {@link RequestMap}, called without an explicit
893
+ * type argument, the response is typed from the map.
894
+ *
895
+ * Unlike a broadcast, an error thrown by the responder is not caught: it
896
+ * propagates to the caller, which needs the response and has no other way
897
+ * to tell a failure from an `undefined` answer.
898
+ *
899
+ * @param eventName - The request event name
900
+ * @param args - Arguments to pass to the responder
901
+ * @returns The response value, or undefined if no responder
902
+ * @throws Whatever the responder throws
903
+ */
904
+ request<K extends RequestName>(eventName: K, ...args: RequestMap[K]['args']): RequestMap[K]['returns'] | undefined;
905
+ request<T>(eventName: string, ...args: unknown[]): T | undefined;
906
+ /**
907
+ * Send a synchronous request for a specific topic.
908
+ * Returns undefined if no responder is registered for that topic.
909
+ * Errors thrown by the responder propagate to the caller, as in
910
+ * {@link IEventbus.request}.
911
+ *
912
+ * @param eventName - The request event name
913
+ * @param eventTopic - The topic to target
914
+ * @param args - Arguments to pass to the responder
915
+ * @returns The response value, or undefined if no responder
916
+ * @throws Whatever the responder throws
917
+ */
918
+ requestForTopic<K extends RequestName>(eventName: K, eventTopic: string, ...args: RequestMap[K]['args']): RequestMap[K]['returns'] | undefined;
919
+ requestForTopic<T>(eventName: string, eventTopic: string, ...args: unknown[]): T | undefined;
920
+ /**
921
+ * Reports an error that a component caught and does not rethrow, such as
922
+ * an action that failed in a controller's DOM event handler. It goes the
923
+ * same way as a failing broadcast handler: `console.error` naming the
924
+ * source, then the `onHandlerError` option with source `'reported'`. It
925
+ * never throws.
926
+ *
927
+ * Optional, so existing `IEventbus` implementations still type check; the
928
+ * built-in {@link Eventbus} implements it. Callers fall back to
929
+ * `console.error` when it is missing.
930
+ *
931
+ * @param error - The caught error
932
+ * @param context - The reporting component and, if any, the eventbus event
933
+ * it was handling
934
+ */
935
+ reportError?(error: unknown, context: IEventbusErrorReport): void;
936
+ registerEventlistener(eventbusListener: IEventbusListener): TEventbusRemover;
937
+ registerInterceptor(eventName: string, interceptor: IEventbusInterceptor, eventTopic?: string): TEventbusRemover;
938
+ }
939
+ interface IEventbusListener {
940
+ /**
941
+ * Called for every broadcast event.
942
+ *
943
+ * May return a promise; the Eventbus does not await it, but reports a
944
+ * rejection the same way as a thrown error.
945
+ */
946
+ handleEvent(eventName: string, eventTopic: string | undefined, args: any[]): void | Promise<unknown>;
947
+ }
948
+ interface IEventbusInterceptor {
949
+ intercept(eventArgs: any[]): any[];
950
+ }
951
+ type TOperationData = Record<string, any>;
952
+ type TOperationResult<T = TOperationData> = Promise<T> | T;
953
+ interface IOperationScope {
954
+ /**
955
+ * When inside a loop, this is the current iteration of said loop
956
+ */
957
+ loopIndex?: number;
958
+ /**
959
+ * The number of iterations for the current loop
960
+ */
961
+ loopLength?: number;
962
+ /**
963
+ * The start index of the loop within the total number of operations
964
+ */
965
+ loopStartIndex?: number;
966
+ /**
967
+ * The end index of the loop within the total number of operations
968
+ */
969
+ loopEndIndex?: number;
970
+ /**
971
+ * Set this index to change the current item in the main operations loop
972
+ */
973
+ newIndex?: number;
974
+ /**
975
+ * The current index with in the main operations loop
976
+ */
977
+ currentIndex: number;
978
+ /**
979
+ * The eventbus instance shared amongst actions and operations
980
+ */
981
+ eventbus: IEventbus;
982
+ /**
983
+ * The list of operations that is currently being executed
984
+ */
985
+ operations: IResolvedOperation[];
986
+ /**
987
+ * The result of the last when evaluation, if any
988
+ */
989
+ whenEvaluation?: boolean;
990
+ /**
991
+ *
992
+ */
993
+ owner?: any;
994
+ /**
995
+ *
996
+ */
997
+ currentItem?: any;
998
+ /**
999
+ *
1000
+ */
1001
+ parent?: IOperationScope;
1002
+ /**
1003
+ *
1004
+ */
1005
+ variables?: Record<string, unknown>;
1006
+ }
1007
+ type TOperation<T extends TOperationData = TOperationData, RT = T> = (this: IOperationScope, operationData: T) => TOperationResult<RT>;
1008
+ type ExtractOperationData<T extends TOperation<TOperationData>> = T extends TOperation<infer K> ? K : never;
1009
+ type ExtractReturnedOperationData<T extends TOperation<TOperationData, TOperationData>> = T extends TOperation<any, infer K> ? unknown extends K ? ExtractOperationData<T> : K : never;
1010
+ interface IAction {
1011
+ id: string;
1012
+ name: string;
1013
+ startOperations: IResolvedOperation[];
1014
+ start(initOperationData?: TOperationData): Promise<TOperationData>;
1015
+ }
1016
+ interface IEndableAction extends IAction {
1017
+ endOperations: IResolvedOperation[];
1018
+ end(initOperationData?: TOperationData): Promise<TOperationData>;
1019
+ }
1020
+ interface ITimelineAction extends IEndableAction {
1021
+ get active(): boolean;
1022
+ duration: IStrictDuration;
1023
+ }
1024
+ /**
1025
+ * Helpers shared by the controllers that run configured actions in response
1026
+ * to an input (`DOMEventListenerController`, `KeyboardController`).
1027
+ */
1028
+ /**
1029
+ * An action to run, and whether its `start` (or `end`) operations run.
1030
+ */
1031
+ interface IControllerAction {
1032
+ start: boolean;
1033
+ action: IEndableAction;
1034
+ }
1035
+ interface IDOMEventListenerControllerOperationData {
1036
+ /**
1037
+ * @dependency
1038
+ */
1039
+ selectedElement: JQuery;
1040
+ /**
1041
+ * @type=ParameterType:eventName
1042
+ * @required
1043
+ */
1044
+ eventName: string;
1045
+ actions: string[];
1046
+ /**
1047
+ * @type=ParameterType:object
1048
+ */
1049
+ actionOperationData?: TOperationData;
1050
+ }
1051
+ /**
1052
+ * This controller attaches to the given selected element and adds a DOM event listener for the specified event name that
1053
+ * executes the given actions with the given operation data.
1054
+ *
1055
+ * By default the `start` operations of the specified actions are executed. To execute the `end` operations instead,
1056
+ * prefix the action name with `end:`.
1057
+ *
1058
+ * The actions receive a copy of `actionOperationData` plus `eventTarget` (the event's target) and, for key events,
1059
+ * `eventKey` (the `KeyboardEvent.key`). They run in order, each receiving the operation data the previous one
1060
+ * returned. When an action fails, the
1061
+ * remaining actions are skipped and the failure is reported through the eventbus's `reportError` (an error naming
1062
+ * this controller, the action and the DOM event, with the original error as `cause`), or logged with
1063
+ * `console.error` when the eventbus has no `reportError`.
1064
+ */
1065
+ declare class DOMEventListenerController implements IController<IDOMEventListenerControllerOperationData> {
1066
+ operationData?: IDOMEventListenerControllerOperationData;
1067
+ actionInstanceInfos?: IControllerAction[];
1068
+ name: string;
1069
+ private _boundEventHandler;
1070
+ /** The eventbus passed to attach(), used to report failing actions */
1071
+ private _eventbus;
1072
+ init(operationData: IDOMEventListenerControllerOperationData): void;
1073
+ /**
1074
+ * Looks up the configured actions and starts listening for the DOM event.
1075
+ *
1076
+ * @param eventbus - The eventbus to request the actions from
1077
+ * @throws when an action name is unknown (`request-action` throws or
1078
+ * returns nothing); the message names the controller, the action and the
1079
+ * DOM event, and keeps the responder's "did you mean" hint
1080
+ */
1081
+ attach(eventbus: IEventbus): void;
1082
+ private _eventHandler;
1083
+ /**
1084
+ * Removes only the handler this controller registered, so other handlers for
1085
+ * the same event on the element keep working, and resets the action
1086
+ * instances so a later attach registers again.
1087
+ */
1088
+ detach(_eventbus: IEventbus): void;
1089
+ }
1090
+ /**
1091
+ * Where a {@link KeyboardController} listens:
1092
+ * - `'document'`: while the focus is inside the engine root, or while
1093
+ * nothing has focus. With several engines on a page, a press while
1094
+ * nothing has focus runs the actions of one engine only: the engine the
1095
+ * user last clicked or focused inside, otherwise the first one that bound
1096
+ * the key.
1097
+ * - `'element'`: only while the focus is inside the selected element.
1098
+ */
1099
+ type TKeyboardControllerScope = 'document' | 'element';
1100
+ interface IKeyboardControllerOperationData {
1101
+ /**
1102
+ * @dependency
1103
+ */
1104
+ selectedElement: JQuery;
1105
+ /**
1106
+ * The keys that run the actions, in hotkeys-js syntax: comma separated
1107
+ * shortcuts such as `'right'`, `'shift+right'` or `'space, enter'`. Key
1108
+ * names are case insensitive. Accepted are the hotkeys-js names (`left`,
1109
+ * `up`, `right`, `down`, `space`, `enter`, `esc`, `tab`, `backspace`,
1110
+ * `del`, `ins`, `home`, `end`, `pageup`, `pagedown`, `f1` to `f19`,
1111
+ * `num_0` to `num_9`), the `KeyboardEvent.key` names of the same keys
1112
+ * (`ArrowLeft`, `ArrowUp`, `ArrowRight`, `ArrowDown`, `Enter`, `Escape`,
1113
+ * `Tab`, `Backspace`, `Delete`, `Insert`, `Home`, `End`, `PageUp`,
1114
+ * `PageDown`, `F1`), a single letter or digit, and the punctuation keys
1115
+ * `,` `.` `/` `;` `'` `[` `]` `-` `=`.
1116
+ * `' '` (the `KeyboardEvent.key` of the space bar) means `space`.
1117
+ * Modifiers: `shift`, `alt` (`option`), `ctrl` (`control`) and `meta`
1118
+ * (`cmd`, `command`).
1119
+ *
1120
+ * @type=ParameterType:string
1121
+ * @required
1122
+ */
1123
+ keys: string;
1124
+ actions: string[];
1125
+ /**
1126
+ * @type=ParameterType:object
1127
+ */
1128
+ actionOperationData?: TOperationData;
1129
+ /**
1130
+ * Defaults to `'document'`; see {@link TKeyboardControllerScope}.
1131
+ */
1132
+ scope?: TKeyboardControllerScope;
1133
+ }
1134
+ /**
1135
+ * This controller runs the given actions when one of the given keys is pressed.
1136
+ *
1137
+ * By default the `start` operations of the specified actions are executed. To execute the `end` operations instead,
1138
+ * prefix the action name with `end:`.
1139
+ *
1140
+ * The actions receive a copy of `actionOperationData` plus `eventTarget` (the focused element, or the body when
1141
+ * nothing has focus) and `eventKey` (the `KeyboardEvent.key`). They run in order, each receiving the operation data
1142
+ * the previous one returned. When an action fails, the remaining actions are skipped and the failure is reported
1143
+ * through the eventbus's `reportError`, or logged with `console.error` when the eventbus has no `reportError`.
1144
+ *
1145
+ * With `scope: 'document'` (the default) the keys work while the focus is inside the engine root, or while nothing
1146
+ * has focus. With `scope: 'element'` they only work while the focus is inside the selected element. Presses in
1147
+ * `input`, `select`, `textarea` and contenteditable elements are ignored, so typing keeps working. A handled press
1148
+ * has its default action prevented (no scrolling for arrow keys and space); a held key runs the actions once, not
1149
+ * again for every key repeat.
1150
+ *
1151
+ * When the keys include the play toggle hotkey of the engine (space by default), or a key that the engine's
1152
+ * KeyboardStepSource binds (the arrow keys, `shift+left`/`shift+right`, `home` and `end`), the controller wins: a
1153
+ * press it handles runs its actions and does not toggle playback or step the timeline. A press it ignores (for
1154
+ * example outside the selected element with `scope: 'element'`) still does.
1155
+ *
1156
+ * The keys are bound in the hotkeys-js `'all'` scope, so they work whatever scope a KeyboardStepSource sets. The
1157
+ * hotkeys-js global `filter` still applies. Detaching removes only this controller's handler.
1158
+ *
1159
+ * @example
1160
+ * ```json
1161
+ * {"systemName": "addControllerToElement", "operationData": {"keys": "ArrowRight", "actions": ["NextChapter"]}}
1162
+ * ```
1163
+ */
1164
+ declare class KeyboardController implements IController<IKeyboardControllerOperationData> {
1165
+ operationData?: IKeyboardControllerOperationData;
1166
+ actionInstanceInfos?: IControllerAction[];
1167
+ name: string;
1168
+ private _handler;
1169
+ private _leaveRegistry;
1170
+ /** The eventbus passed to attach(), used to report failing actions */
1171
+ private _eventbus;
1172
+ /**
1173
+ * @param operationData - The keys, actions and scope
1174
+ * @throws when `keys` is empty or names a key hotkeys-js can't match, or
1175
+ * when `scope` is not `'document'` or `'element'`
1176
+ */
1177
+ init(operationData: IKeyboardControllerOperationData): void;
1178
+ /**
1179
+ * Looks up the configured actions and starts listening for the keys.
1180
+ *
1181
+ * @param eventbus - The eventbus to request the actions and the engine root
1182
+ * from
1183
+ * @throws when an action name is unknown (`request-action` throws or
1184
+ * returns nothing); the message names the controller, the action and the
1185
+ * keys, and keeps the responder's "did you mean" hint
1186
+ */
1187
+ attach(eventbus: IEventbus): void;
1188
+ /**
1189
+ * Removes only the handler this controller bound, so other bindings of the
1190
+ * same keys keep working, and resets the action instances so a later
1191
+ * attach binds again.
1192
+ */
1193
+ detach(_eventbus: IEventbus): void;
1194
+ private _handleKey;
1195
+ private _trigger;
1196
+ private _requestEngineRoot;
1197
+ /**
1198
+ * @returns The keys with `' '` replaced by `space`
1199
+ * @throws when the keys are empty or name a key hotkeys-js can't match
1200
+ */
1201
+ private _normalizeKeys;
1202
+ }
1203
+ /**
1204
+ * Abstract base class for controllers providing standardized event listener management
1205
+ *
1206
+ * Benefits:
1207
+ * - Eliminates boilerplate event listener tracking code
1208
+ * - Automatic binding of event handlers to controller instance
1209
+ * - Handler arguments are type checked against the event's argument tuple
1210
+ * - Centralized cleanup preventing memory leaks
1211
+ * - An attached-state guard, so a second attach never duplicates listeners
1212
+ *
1213
+ * @example
1214
+ * ```typescript
1215
+ * class MyController extends BaseController<IMyOperationData> {
1216
+ * name = 'MyController';
1217
+ *
1218
+ * init(operationData: IMyOperationData): void {
1219
+ * this.operationData = operationData;
1220
+ * }
1221
+ *
1222
+ * attach(eventbus: IEventbus): void {
1223
+ * this.beginAttach(eventbus);
1224
+ * this.addListener(eventbus, 'timeline-time', this.handleTime);
1225
+ * // Handler automatically bound, cleanup tracked
1226
+ * }
1227
+ *
1228
+ * private handleTime(position: number): void {
1229
+ * // 'this' context preserved
1230
+ * }
1231
+ * }
1232
+ * ```
1233
+ */
1234
+ declare abstract class BaseController<T extends TOperationData> implements IController<T> {
1235
+ operationData: T | null;
1236
+ abstract name: string;
1237
+ protected eventListeners: TEventbusRemover[];
1238
+ /** True between {@link BaseController.beginAttach} and the next detach. */
1239
+ protected isAttached: boolean;
1240
+ /**
1241
+ * Register event listener with automatic binding and cleanup tracking
1242
+ *
1243
+ * @param eventbus - The eventbus to register with
1244
+ * @param eventName - Name of the event to listen for
1245
+ * @param handler - Event handler function (will be bound to this controller).
1246
+ * Its parameters must match the event's argument tuple.
1247
+ */
1248
+ protected addListener<E extends EventName>(eventbus: IEventbus, eventName: E, handler: (this: this, ...args: EventMap[E]) => void): void;
1249
+ /**
1250
+ * Call at the start of `attach`. When the controller is still attached, it
1251
+ * is detached first, so attaching twice replaces the previous attachment
1252
+ * instead of registering every listener (and any DOM it builds) twice.
1253
+ *
1254
+ * @param eventbus - The eventbus passed to `attach`
1255
+ */
1256
+ protected beginAttach(eventbus: IEventbus): void;
1257
+ /**
1258
+ * Clean up all tracked event listeners
1259
+ * Prevents memory leaks by removing all registered handlers
1260
+ *
1261
+ * @param _eventbus - The eventbus (ignored, included for IController compatibility)
1262
+ */
1263
+ detach(_eventbus: IEventbus): void;
1264
+ abstract init(operationData: T): void;
1265
+ abstract attach(eventbus: IEventbus): Promise<any> | void;
1266
+ }
1267
+ interface ILabelControllerMetadata {
1268
+ /**
1269
+ * @dependency
1270
+ */
1271
+ selectedElement: JQuery;
1272
+ /**
1273
+ * Translation key for rosetta-based locale system.
1274
+ * Example: 'nav.home', 'buttons.submit'
1275
+ * @required
1276
+ */
1277
+ translationKey: string;
1278
+ /**
1279
+ * By default the label is added to the inner HTML of the `selectedElement`,
1280
+ * after sanitizing: inline formatting such as `<br>`, `<strong>`, `<em>`
1281
+ * and links is kept, scripts, event handlers and other markup are removed.
1282
+ * If this property is set, the label is written as plain text to the
1283
+ * specified attribute of the `selectedElement` instead. Event handler
1284
+ * attributes (`on*`) and `srcdoc` are rejected, and URL attributes such as
1285
+ * `href` and `src` are only set when the translation is a safe URL.
1286
+ */
1287
+ attributeName?: string;
1288
+ }
1289
+ /**
1290
+ * This controller attaches to the given selected element and renders the text
1291
+ * associated with the given translation key.
1292
+ *
1293
+ * Translations may contain simple inline markup. They are passed through
1294
+ * `sanitizeHtml` before insertion, so `<br>`, `<strong>`, `<em>`,
1295
+ * `<span>` and http(s)/mailto/relative links render, while scripts, event
1296
+ * handlers, `javascript:` URLs, images, iframes and SVG are removed.
1297
+ *
1298
+ * The controller listens for the `language-change` event and re-renders the text
1299
+ * with the new language after such an event.
1300
+ *
1301
+ * Uses the rosetta-based locale system via `request-translation` event.
1302
+ */
1303
+ declare class LabelController extends BaseController<ILabelControllerMetadata> {
1304
+ name: string;
1305
+ private _eventbus;
1306
+ /**
1307
+ * @throws Error when `attributeName` is an event handler attribute
1308
+ * (`on*`) or `srcdoc`.
1309
+ */
1310
+ init(operationData: ILabelControllerMetadata): void;
1311
+ /**
1312
+ * Sets the translation key and re-renders the label.
1313
+ */
1314
+ setTranslationKey(newKey: string): void;
1315
+ attach(eventbus: IEventbus): void;
1316
+ private _setLabel;
1317
+ private _applyText;
1318
+ detach(eventbus: IEventbus): void;
1319
+ private _handleLanguageChange;
1320
+ }
1321
+ interface IInnerMetadata {
1322
+ /**
1323
+ * @dependency
1324
+ */
1325
+ selectedElement: JQuery;
1326
+ /**
1327
+ * @type=ParameterType:string
1328
+ */
1329
+ renderer: TLottieRendererConfig;
1330
+ loop: boolean;
1331
+ autoplay: boolean;
1332
+ /**
1333
+ * The lottie animation data. Give either this or `json`; `json` wins when
1334
+ * both are set.
1335
+ *
1336
+ * @type=ParameterType:object
1337
+ */
1338
+ animationData: any;
1339
+ /**
1340
+ * The lottie animation data. Give either this or `animationData`.
1341
+ */
1342
+ json: any;
1343
+ /**
1344
+ * @type=ParameterType:array
1345
+ * @itemType=ParameterType:labelId
1346
+ */
1347
+ labelIds: string[];
1348
+ viewBox: string;
1349
+ /**
1350
+ * @deprecated Ignored: the fallback targeted Internet Explorer and legacy
1351
+ * Edge, which are no longer supported. Will be removed in the next major
1352
+ * version.
1353
+ */
1354
+ iefallback: any;
1355
+ }
1356
+ interface ILottieControllerMetadata extends IInnerMetadata {
1357
+ /**
1358
+ * The animation file name. It is not loaded; it is only read for freeze and
1359
+ * end markers, like `my-url/filename[freeze=10,end=21].json`.
1360
+ *
1361
+ * @type=ParameterType:url
1362
+ */
1363
+ url?: string;
1364
+ }
1365
+ /**
1366
+ * This controller renders a [lottie-web](https://github.com/airbnb/lottie-web) animation inside the given selected element.
1367
+ *
1368
+ * The url may encode freeze and end positions like this: my-url/filename[freeze=10,end=21].json
1369
+ *
1370
+ * lottie-web is an optional peer dependency. It is loaded with a dynamic
1371
+ * `import()` the first time a LottieController attaches, so applications that
1372
+ * never use this controller do not need it installed.
1373
+ */
1374
+ declare class LottieController extends BaseController<ILottieControllerMetadata> {
1375
+ name: string;
1376
+ currentLanguage: TLanguageCode;
1377
+ /**
1378
+ * @deprecated Label collections come from a `request-label-collections`
1379
+ * responder, which nothing in Eligius provides since the labels array was
1380
+ * removed in 2.2.0. Use translation keys as label ids instead; they resolve
1381
+ * through `request-translation`. Will be removed in the next major version.
1382
+ */
1383
+ labelData: Record<string, Record<string, string>>;
1384
+ animationItem: ILottieAnimationItem | null;
1385
+ serializedData: string | null;
1386
+ /**
1387
+ * @deprecated Never used: see `iefallback`. Will be removed in the next
1388
+ * major version.
1389
+ */
1390
+ serializedIEData: string | null;
1391
+ freezePosition: number;
1392
+ endPosition: number;
1393
+ private _eventbus;
1394
+ private _lottie;
1395
+ /** Incremented by detach() so an attach still loading lottie-web gives up */
1396
+ private _attachGeneration;
1397
+ /**
1398
+ * @throws when neither `json` nor `animationData` is given
1399
+ */
1400
+ init(operationData: ILottieControllerMetadata): void;
1401
+ private _parseFilename;
1402
+ /**
1403
+ * Loads lottie-web (on first use), registers the language listener when
1404
+ * label ids are configured and creates the animation.
1405
+ *
1406
+ * If detach() is called before lottie-web has loaded, the attach is
1407
+ * abandoned: no listeners are registered and no animation is created.
1408
+ *
1409
+ * @param eventbus - The eventbus to request labels and language from
1410
+ * @returns a promise that resolves once the animation has been created
1411
+ * @throws when the optional peer dependency lottie-web cannot be loaded
1412
+ */
1413
+ attach(eventbus: IEventbus): Promise<void>;
1414
+ /**
1415
+ * Removes the listeners and releases the lottie animation.
1416
+ *
1417
+ * When the url configured a freeze position and the animation does not loop,
1418
+ * the animation first plays out from the freeze position to the end position
1419
+ * (or its natural end) and is destroyed when it completes. Otherwise it is
1420
+ * destroyed immediately, since a looping animation never completes.
1421
+ */
1422
+ detach(eventbus: IEventbus): void;
1423
+ private _createAnimation;
1424
+ private _createTextDataLookup;
1425
+ /**
1426
+ * Resolves the text for a label id in the current language. Label collections
1427
+ * take precedence; otherwise the label id is looked up as a translation key
1428
+ * through the locale manager (`request-translation`).
1429
+ *
1430
+ * @returns the text, or undefined when no text is available
1431
+ */
1432
+ private _resolveLabel;
1433
+ /**
1434
+ * Rebuilds the animation with the texts of the new language and moves it to
1435
+ * the frame the old one was at, playing or paused as before, so a language
1436
+ * switch does not restart it. Frames are counted from the start of the
1437
+ * current segment, which for the freeze segment is frame 0.
1438
+ */
1439
+ private _handleLanguageChange;
1440
+ }
1441
+ /**
1442
+ * Metadata configuration for MutationObserverController
1443
+ *
1444
+ * Configures what types of DOM mutations to observe and how to observe them.
1445
+ */
1446
+ interface IMutationObserverControllerMetadata {
1447
+ /**
1448
+ * jQuery-wrapped DOM element to observe for mutations
1449
+ * @dependency
1450
+ * @required
1451
+ */
1452
+ selectedElement: JQuery;
1453
+ /**
1454
+ * Observe changes to element attributes
1455
+ * @optional
1456
+ * @default true
1457
+ */
1458
+ observeAttributes?: boolean;
1459
+ /**
1460
+ * Observe additions and removals of child nodes
1461
+ * @optional
1462
+ * @default true
1463
+ */
1464
+ observeChildList?: boolean;
1465
+ /**
1466
+ * Observe changes to text content (character data)
1467
+ * @optional
1468
+ * @default true
1469
+ */
1470
+ observeCharacterData?: boolean;
1471
+ /**
1472
+ * Observe mutations in the entire subtree (all descendants)
1473
+ * @optional
1474
+ * @default false
1475
+ */
1476
+ observeSubtree?: boolean;
1477
+ /**
1478
+ * Record the previous value of attributes that change
1479
+ * Requires observeAttributes to be true
1480
+ * @optional
1481
+ * @default false
1482
+ */
1483
+ attributeOldValue?: boolean;
1484
+ /**
1485
+ * Record the previous value of text content that changes
1486
+ * Requires observeCharacterData to be true
1487
+ * @optional
1488
+ * @default false
1489
+ */
1490
+ characterDataOldValue?: boolean;
1491
+ /**
1492
+ * Array of specific attribute local names to observe
1493
+ * If omitted, all attribute changes are observed when observeAttributes is true
1494
+ * @optional
1495
+ */
1496
+ attributeFilter?: string[];
1497
+ }
1498
+ /**
1499
+ * Mutation event payload broadcasted through Eligius eventbus
1500
+ */
1501
+ interface IMutationEventPayload {
1502
+ /**
1503
+ * Array of mutation records from the MutationObserver callback
1504
+ */
1505
+ mutations: MutationRecord[];
1506
+ /**
1507
+ * Reference to the observed element (native DOM node)
1508
+ */
1509
+ target: Element;
1510
+ /**
1511
+ * Timestamp when the mutations were detected
1512
+ */
1513
+ timestamp: number;
1514
+ }
1515
+ /**
1516
+ * Controller that observes DOM mutations on a selected element and broadcasts events.
1517
+ *
1518
+ * This controller creates a MutationObserver to monitor DOM changes (attributes, child nodes,
1519
+ * text content) on a specified element. All detected mutations are broadcasted through the
1520
+ * Eligius eventbus, enabling reactive behavior in response to DOM changes.
1521
+ *
1522
+ * The controller follows the standard Eligius lifecycle:
1523
+ * - init(): Store configuration metadata
1524
+ * - attach(): Create and start the MutationObserver
1525
+ * - detach(): Disconnect the observer and clean up resources
1526
+ *
1527
+ * @example
1528
+ * ```typescript
1529
+ * // JSON configuration
1530
+ * {
1531
+ * "systemName": "addControllerToElement",
1532
+ * "operationData": {
1533
+ * "controllerName": "MutationObserverController",
1534
+ * "observeAttributes": true,
1535
+ * "observeChildList": true,
1536
+ * "observeCharacterData": false
1537
+ * }
1538
+ * }
1539
+ *
1540
+ * // Listen for mutations
1541
+ * eventbus.on('dom-mutation', (payload: IMutationEventPayload) => {
1542
+ * console.log('Mutations detected:', payload.mutations);
1543
+ * });
1544
+ * ```
1545
+ */
1546
+ declare class MutationObserverController extends BaseController<IMutationObserverControllerMetadata> {
1547
+ name: string;
1548
+ private observer;
1549
+ /**
1550
+ * Initialize the controller with configuration metadata.
1551
+ *
1552
+ * @param operationData - Configuration for observation behavior
1553
+ * @throws when the options would make `MutationObserver.observe` throw:
1554
+ * nothing to observe, or an attribute or character data option without the
1555
+ * matching observe flag
1556
+ */
1557
+ init(operationData: IMutationObserverControllerMetadata): void;
1558
+ /**
1559
+ * Attach the controller and start observing mutations.
1560
+ * Creates MutationObserver instance and begins monitoring the target element.
1561
+ * Attaching again replaces the previous observer.
1562
+ *
1563
+ * @param eventbus - Eligius eventbus for broadcasting mutation events
1564
+ */
1565
+ attach(eventbus: IEventbus): void;
1566
+ /**
1567
+ * Detach the controller and stop observing mutations.
1568
+ * Disconnects MutationObserver and cleans up resources.
1569
+ *
1570
+ * @param eventbus - Eligius eventbus (used by BaseController for cleanup)
1571
+ */
1572
+ detach(eventbus: IEventbus): void;
1573
+ /**
1574
+ * Build MutationObserverInit options from controller metadata.
1575
+ * Applies default values for optional configuration properties, and leaves
1576
+ * out `attributeFilter` when it is not configured.
1577
+ *
1578
+ * @returns MutationObserverInit options object
1579
+ * @throws when the combination of options is invalid
1580
+ * @private
1581
+ */
1582
+ private _buildObserverOptions;
1583
+ /**
1584
+ * Handle mutations detected by the MutationObserver.
1585
+ * Broadcasts mutation events through the eventbus with mutation details.
1586
+ *
1587
+ * @param eventbus - Eligius eventbus for broadcasting
1588
+ * @param target - The observed element
1589
+ * @param mutations - Array of mutation records from observer callback
1590
+ * @private
1591
+ */
1592
+ private _handleMutations;
1593
+ }
1594
+ interface INavigationControllerOperationData {
1595
+ /**
1596
+ * @dependency
1597
+ */
1598
+ selectedElement: JQuery;
1599
+ /**
1600
+ * The navigation json: `{navigationData: [...], roots: [...]}`. Each entry
1601
+ * has an `id`, a `labelId`, a `videoUrlIndex` and optionally `visible`,
1602
+ * `children` (ids), `nextId`, `autoNext` and `timelineUri`. Give an entry a
1603
+ * `timelineUri` to let the engine switch to that timeline when the entry is
1604
+ * activated.
1605
+ *
1606
+ * @required
1607
+ */
1608
+ json: any;
1609
+ }
1610
+ /**
1611
+ * Renders a navigation menu in the selected element and keeps it in sync with
1612
+ * the active navigation entry.
1613
+ *
1614
+ * Activating a menu item (click, Enter or Space) navigates to its entry:
1615
+ * - an entry with a `timelineUri` broadcasts `request-timeline-uri`
1616
+ * [timelineUri, position], which the engine handles by switching timelines;
1617
+ * - an entry without one broadcasts the legacy `request-video-url`
1618
+ * [videoUrlIndex, position], which the engine does not handle.
1619
+ *
1620
+ * With `autoNext`, the next entry is started when the active entry's timeline
1621
+ * completes (`timeline-complete`) or, for legacy entries, on `video-complete`.
1622
+ * When the engine switches to a timeline that an entry names
1623
+ * (`timeline-current-timeline-change`), that entry becomes the active one.
1624
+ */
1625
+ declare class NavigationController extends BaseController<INavigationControllerOperationData> {
1626
+ name: string;
1627
+ navigation: any[];
1628
+ navLookup: Record<string, any>;
1629
+ navVidIdLookup: Record<string, any>;
1630
+ ctrlLookup: Record<string, LabelController>;
1631
+ activeNavigationPoint: any | null;
1632
+ labelControllers: LabelController[];
1633
+ eventbus: IEventbus | null;
1634
+ container: JQuery | null;
1635
+ private _menuElement;
1636
+ private _anchorLookup;
1637
+ private _highlightedAnchor;
1638
+ private _navByTimelineUri;
1639
+ /**
1640
+ * @throws when the json has no navigationData array or names an unknown
1641
+ * navigation id in roots, nextId or children
1642
+ */
1643
+ init(operationData: INavigationControllerOperationData): void;
1644
+ attach(eventbus: IEventbus): void;
1645
+ /**
1646
+ * Sets the active navigation point and the menu highlight from the URL hash,
1647
+ * falling back to the item with videoUrlIndex 0 when the hash is missing or
1648
+ * names an unknown navigation id.
1649
+ */
1650
+ private _initHistory;
1651
+ private _getQueryVariable;
1652
+ private _handleRequestCurrentNavigation;
1653
+ detach(eventbus: IEventbus): void;
1654
+ private _pushCurrentState;
1655
+ private _buildHtml;
1656
+ /**
1657
+ * Renders an entry and its children. `ancestors` holds the entries on the
1658
+ * current path, so a children list that refers back to an ancestor cannot
1659
+ * recurse forever.
1660
+ */
1661
+ private _addNavElement;
1662
+ /**
1663
+ * Activates the entry on click, which the browser also fires for Enter on a
1664
+ * focused link and for the default action of assistive technology, and on
1665
+ * Space, which links do not handle natively. Only one of click and mouseup
1666
+ * may be bound, since a mouse click fires both.
1667
+ */
1668
+ private _addActivationHandlers;
1669
+ private _handleNavigateVideoUrl;
1670
+ /**
1671
+ * Highlights the entry, requests its content, makes it the active entry and
1672
+ * pushes a history state for it.
1673
+ */
1674
+ private _navigateTo;
1675
+ private _highlightMenu;
1676
+ private _highlightNav;
1677
+ /**
1678
+ * Legacy completion event for entries driven by `request-video-url`.
1679
+ */
1680
+ private _handleVideoComplete;
1681
+ /**
1682
+ * Starts the next entry when the active entry's timeline completes. Legacy
1683
+ * entries without a `timelineUri` are left to `video-complete`, so a host
1684
+ * that bridges both events does not navigate twice.
1685
+ */
1686
+ private _handleTimelineComplete;
1687
+ /**
1688
+ * Keeps the active entry and the highlight in sync when the engine switches
1689
+ * timelines, whoever asked for the switch.
1690
+ */
1691
+ private _handleTimelineChange;
1692
+ private _addLabel;
1693
+ }
1694
+ interface IProgressbarControllerOperationData {
1695
+ /**
1696
+ * @dependency
1697
+ */
1698
+ selectedElement: JQuery;
1699
+ /**
1700
+ * @dependency
1701
+ */
1702
+ textElement: JQuery;
1703
+ }
1704
+ /**
1705
+ * This controller renders a progressbar that displays the progress of the current timeline in the given selected element.
1706
+ *
1707
+ * The current progress as a percentage is rendered in the given text element.
1708
+ */
1709
+ declare class ProgressbarController extends BaseController<IProgressbarControllerOperationData> {
1710
+ name: string;
1711
+ selectedElement: JQuery | null;
1712
+ textElement: JQuery | null;
1713
+ duration: number;
1714
+ private _eventbus;
1715
+ /** The inline pointer-events value attach() replaced, restored on detach */
1716
+ private _previousPointerEvents;
1717
+ /** The last width and text written, so unchanged values are not rewritten */
1718
+ private _renderedWidth;
1719
+ private _renderedText;
1720
+ init(operationData: IProgressbarControllerOperationData): void;
1721
+ attach(eventbus: IEventbus): void;
1722
+ detach(eventbus: IEventbus): void;
1723
+ /**
1724
+ * Requests the duration of the active timeline.
1725
+ */
1726
+ private _refreshDuration;
1727
+ /**
1728
+ * Stores the duration the engine reports when a timeline starts, which
1729
+ * changes when the engine switches timelines.
1730
+ */
1731
+ private _durationHandler;
1732
+ private _positionUpdateHandler;
1733
+ private _clickHandler;
1734
+ }
1735
+ interface IRoutingControllerOperationData {
1736
+ /**
1737
+ * The navigation json, in the same format as NavigationController's. Give
1738
+ * an entry a `timelineUri` to let the engine switch to that timeline on
1739
+ * back/forward navigation.
1740
+ *
1741
+ * @required
1742
+ */
1743
+ json: any;
1744
+ }
1745
+ /**
1746
+ * Keeps the browser history in sync with the navigation entries: each entry
1747
+ * gets a `#/<id>/<position>` URL, and back/forward navigation requests the
1748
+ * entry in the URL.
1749
+ *
1750
+ * Requests go to the engine as `request-timeline-uri` for entries with a
1751
+ * `timelineUri`, and as the legacy `request-video-url` otherwise. Before the
1752
+ * engine switches timelines (`before-request-timeline-uri`, or the legacy
1753
+ * `before-request-video-url`), the current entry is saved with its position.
1754
+ *
1755
+ * This is a work in progress, do not use this yet please....
1756
+ */
1757
+ declare class RoutingController extends BaseController<IRoutingControllerOperationData> {
1758
+ name: string;
1759
+ navLookup: Record<string, any>;
1760
+ navVidIdLookup: Record<string, any>;
1761
+ navigation: any;
1762
+ eventbus: IEventbus | null;
1763
+ private _popstateHandler;
1764
+ /** True while this controller requests an entry from the history */
1765
+ private _isHistoryRequest;
1766
+ /**
1767
+ * @throws when the json has no navigationData array or names an unknown
1768
+ * navigation id in roots, nextId or children
1769
+ */
1770
+ init(operationData: IRoutingControllerOperationData): void;
1771
+ attach(eventbus: IEventbus): void;
1772
+ /**
1773
+ * Requests the entry in the URL. A null state comes from a hash change (an
1774
+ * in-page link, an edited URL, or the entry before this controller added
1775
+ * state), so the URL is read. A state object without a navigation id belongs
1776
+ * to the host page and is ignored.
1777
+ */
1778
+ private _handlePopstate;
1779
+ /**
1780
+ * Requests an entry without saving the current one: the history already
1781
+ * has it.
1782
+ */
1783
+ private _requestFromHistory;
1784
+ /**
1785
+ * Looks up a navigation entry by id (own properties only), falling back to
1786
+ * the first navigation entry for a missing or unknown id.
1787
+ */
1788
+ private _findNavigation;
1789
+ /**
1790
+ * @returns the position as a finite, non-negative number, or 0
1791
+ */
1792
+ private _parsePosition;
1793
+ detach(eventbus: IEventbus): void;
1794
+ private _handleBeforeRequestVideoUrl;
1795
+ /**
1796
+ * The interceptor passes on the `request-timeline-uri` arguments, which
1797
+ * have no history flag; requests this controller makes itself are skipped
1798
+ * through `_isHistoryRequest`.
1799
+ */
1800
+ private _handleBeforeRequestTimelineUri;
1801
+ private _saveCurrentNavigation;
1802
+ private _getQueryVariable;
1803
+ private _handlePushHistoryState;
1804
+ private _pushState;
1805
+ /**
1806
+ * A missing or negative position means "where the timeline is now": the
1807
+ * engine position minus a short rewind. When nothing reports a position,
1808
+ * the position is left out of the URL and the state.
1809
+ */
1810
+ private _resolveStatePosition;
1811
+ }
1812
+ interface ISubtitlesControllerOperationData {
1813
+ /**
1814
+ * @dependency
1815
+ */
1816
+ selectedElement: JQuery;
1817
+ /**
1818
+ * The language to fall back to when the eventbus cannot tell the current
1819
+ * language (`request-current-language`).
1820
+ *
1821
+ * @type=ParameterType:languagecode
1822
+ */
1823
+ language: TLanguageCode;
1824
+ /**
1825
+ * One collection per language. Titles are matched by index across the
1826
+ * languages, so every collection needs the same number of titles.
1827
+ *
1828
+ * @type=ParameterType:array
1829
+ * @itemType=ParameterType:object
1830
+ */
1831
+ subtitleData: ISubtitleCollection[];
1832
+ }
1833
+ /**
1834
+ * This controller shows the subtitle whose duration contains the current
1835
+ * timeline position in the selected element, in the current language, and
1836
+ * re-renders it after a `language-change` event.
1837
+ *
1838
+ * The starting language is the locale's current language
1839
+ * (`request-current-language`); the configured `language` is only used when
1840
+ * nothing answers that request.
1841
+ *
1842
+ * Subtitle texts may contain simple inline markup. They are passed through
1843
+ * `sanitizeHtml` before insertion, so `<br>`, `<i>`, `<em>`,
1844
+ * `<strong>` and `<span>` render, while scripts, event handlers,
1845
+ * `javascript:` URLs, images, iframes and SVG are removed.
1846
+ */
1847
+ declare class SubtitlesController extends BaseController<ISubtitlesControllerOperationData> {
1848
+ /**
1849
+ * @deprecated Subtitles are looked up by range, not by exact position; this
1850
+ * lookup is no longer read and will be removed in the next major version.
1851
+ */
1852
+ actionLookup: Record<string, any>;
1853
+ currentLanguage: TLanguageCode | null;
1854
+ lastFunc: (() => void) | null;
1855
+ name: string;
1856
+ /**
1857
+ * @deprecated No longer read; will be removed in the next major version.
1858
+ */
1859
+ subtitleDurations: IStrictDuration[] | null;
1860
+ private _titleRanges;
1861
+ /** True when no two ranges overlap, so the ranges are sorted by start */
1862
+ private _rangesDisjoint;
1863
+ /** Index of the last range a position was found in (or just after) */
1864
+ private _lastRangeIndex;
1865
+ private _configuredLanguage;
1866
+ attach(eventbus: IEventbus): void;
1867
+ /**
1868
+ * Stops listening and removes the subtitle this controller is showing, since
1869
+ * no later time event would remove it.
1870
+ */
1871
+ detach(eventbus: IEventbus): void;
1872
+ languageChangeHandler(newLanguage: TLanguageCode): void;
1873
+ removeTitle(container?: JQuery): void;
1874
+ /**
1875
+ * Shows the subtitle whose range contains the given position, or removes the
1876
+ * current subtitle when no range contains it.
1877
+ *
1878
+ * Positions arrive as fractional seconds, so the lookup is range based
1879
+ * (`start <= position < end`) rather than an exact key match.
1880
+ */
1881
+ onTimeHandler(position: number): void;
1882
+ onSeekedHandler(position: number, _duration: number): void;
1883
+ /**
1884
+ * Playback almost always stays in the last range, moves into the gap after
1885
+ * it or into the next range, so those are checked first; other positions
1886
+ * (after a seek) are found with a binary search. Overlapping ranges fall
1887
+ * back to a linear search in configuration order, where the first range
1888
+ * containing the position wins.
1889
+ */
1890
+ private _findTitleFunc;
1891
+ setTitle(container: JQuery, titleLanguageLookup: Record<string, string>): void;
1892
+ /**
1893
+ * Builds the subtitle ranges. Missing or empty subtitle data means there are
1894
+ * no subtitles.
1895
+ *
1896
+ * @returns the deprecated position lookup
1897
+ * @throws when a subtitle collection has no titles array, or a different
1898
+ * number of titles than the first collection
1899
+ */
1900
+ createActionLookup(operationData: ISubtitlesControllerOperationData, container: JQuery): Record<number, () => void>;
1901
+ private _validateSubtitleData;
1902
+ /**
1903
+ * @throws when the subtitle data is ragged (see createActionLookup)
1904
+ */
1905
+ init(operationData: ISubtitlesControllerOperationData): void;
1906
+ }
1907
+ declare namespace index_d_exports$1 {
1908
+ export { DOMEventListenerController, IDOMEventListenerControllerOperationData, IKeyboardControllerOperationData, ILabelControllerMetadata, ILottieControllerMetadata, IMutationEventPayload, IMutationObserverControllerMetadata, INavigationControllerOperationData, IProgressbarControllerOperationData, IRoutingControllerOperationData, ISubtitlesControllerOperationData, KeyboardController, LabelController, LottieController, MutationObserverController, NavigationController, ProgressbarController, RoutingController, SubtitlesController, TKeyboardControllerScope };
1909
+ }
1910
+ interface IAddClassOperationData {
1911
+ /**
1912
+ * @dependency
1913
+ */
1914
+ selectedElement: JQuery;
1915
+ /**
1916
+ * @type=ParameterType:className
1917
+ * @required
1918
+ * @erased
1919
+ */
1920
+ className: string;
1921
+ }
1922
+ /**
1923
+ * This operation adds the specified class name to the specified selected element.
1924
+ *
1925
+ * @category DOM
1926
+ */
1927
+ declare const addClass: TOperation<IAddClassOperationData, Omit<IAddClassOperationData, 'className'>>;
1928
+ type IAddControllerToElementOperationData<T extends TOperationData = TOperationData> = {
1929
+ /**
1930
+ * @dependency
1931
+ */
1932
+ selectedElement: JQuery;
1933
+ /**
1934
+ * @dependency
1935
+ */
1936
+ controllerInstance: IController<T>;
1937
+ } & T;
1938
+ /**
1939
+ * This operation adds the specified controller instance to the given selected element.
1940
+ *
1941
+ * The controller is registered on the element only once `init` and a synchronous `attach`
1942
+ * have succeeded. When `attach` returns a promise, the controller is registered before
1943
+ * that promise settles (so detaching the element can still reach it) and is removed from
1944
+ * the element again when the promise rejects.
1945
+ *
1946
+ * @throws When the controller's `init` or `attach` throws, or the promise returned by `attach` rejects.
1947
+ *
1948
+ * @category Controller
1949
+ */
1950
+ declare const addControllerToElement: TOperation<IAddControllerToElementOperationData>;
1951
+ interface IAddGlobalsToOperationData {
1952
+ /**
1953
+ * The names of the global properties that will be copied onto the current operation data
1954
+ *
1955
+ * @required
1956
+ * @erased
1957
+ */
1958
+ globalProperties: string[];
1959
+ }
1960
+ /**
1961
+ * This operation adds the specified global property names to the current operation data.
1962
+ * It finally removes the `globalProperties` property from the current operation data.
1963
+ *
1964
+ * Plain data is copied, so changing it does not change the global store. jQuery objects, DOM
1965
+ * nodes, functions and class instances (such as controllers) are added by reference.
1966
+ *
1967
+ * @throws When a name is `__proto__`, `prototype` or `constructor`.
1968
+ *
1969
+ * @category Data
1970
+ */
1971
+ declare const addGlobalsToOperation: TOperation<IAddGlobalsToOperationData, Omit<IAddGlobalsToOperationData, 'globalProperties'>>;
1972
+ interface IAnimateOperationData {
1973
+ /**
1974
+ * @type=ParameterType:string
1975
+ * @erased
1976
+ */
1977
+ animationEasing?: string;
1978
+ /**
1979
+ * @dependency
1980
+ */
1981
+ selectedElement: JQuery;
1982
+ /**
1983
+ * @required
1984
+ * @erased
1985
+ */
1986
+ animationProperties: Record<string, unknown>;
1987
+ /**
1988
+ * @type=ParameterType:number
1989
+ * @required
1990
+ * @erased
1991
+ */
1992
+ animationDuration: JQuery.Duration;
1993
+ }
1994
+ /**
1995
+ * This operation animates the specified selected element with the given [jQuery animation](https://api.jquery.com/animate/) properties, duration and easing.
1996
+ * It resolves after the animation completes, or immediately when the selected element set is empty.
1997
+ *
1998
+ * @param operationData
1999
+ * @returns
2000
+ *
2001
+ * @category Animation
2002
+ */
2003
+ declare const animate: TOperation<IAnimateOperationData, Omit<IAnimateOperationData, 'animationEasing' | 'animationProperties' | 'animationDuration'>>;
2004
+ interface IAnimateWithClassOperationData {
2005
+ /**
2006
+ * @dependency
2007
+ */
2008
+ selectedElement: JQuery;
2009
+ /**
2010
+ * @type=ParameterType:className
2011
+ * @required
2012
+ * @erased
2013
+ */
2014
+ className: string;
2015
+ /**
2016
+ * When true (the default), the class is removed again after the animation ends
2017
+ *
2018
+ * @erased
2019
+ */
2020
+ removeClass?: boolean;
2021
+ /**
2022
+ * When true, the operation resolves on the first `animationend` event from the selected
2023
+ * element or any of its descendants. Use this for a class that only animates descendants.
2024
+ * When false (the default), only animations on the selected elements themselves are awaited.
2025
+ *
2026
+ * @erased
2027
+ */
2028
+ includeDescendants?: boolean;
2029
+ }
2030
+ /**
2031
+ * This operation adds the specified class name to the specified selected element and assumes that this
2032
+ * class triggers an animation on the selected element. It then waits for this animation to complete
2033
+ * before it resolves.
2034
+ *
2035
+ * The class must put the animation on the selected element itself: `animationend` events that bubble up
2036
+ * from descendants are ignored, and with several selected elements the operation waits for all of them.
2037
+ * Set `includeDescendants` to true for a class that only animates descendants; the operation then resolves
2038
+ * on the first `animationend` from the element or its subtree.
2039
+ *
2040
+ * The operation resolves immediately when the selection is empty, or when the class gives none of the
2041
+ * selected elements a CSS animation (for example under `prefers-reduced-motion: reduce`). When an
2042
+ * `animationend` event never arrives, for example because the element was hidden or removed while
2043
+ * animating, it resolves shortly after the longest computed animation should have ended. An infinite
2044
+ * animation is waited for until it is ended by an `animationend` event.
2045
+ *
2046
+ * @category Animation
2047
+ */
2048
+ declare const animateWithClass: TOperation<IAnimateWithClassOperationData, Omit<IAnimateWithClassOperationData, 'className' | 'removeClass' | 'includeDescendants'>>;
2049
+ interface IAnnounceToScreenReaderOperationData {
2050
+ /**
2051
+ * @required
2052
+ * @erased
2053
+ */
2054
+ message: string;
2055
+ /**
2056
+ * @optional
2057
+ * @erased
2058
+ */
2059
+ priority?: 'polite' | 'assertive';
2060
+ }
2061
+ /**
2062
+ * Announces a message to screen readers using an ARIA live region.
2063
+ *
2064
+ * The live region (`#aria-live-region`) is created empty on first use. The region is emptied
2065
+ * and the message is written 100 milliseconds later, so that a new region
2066
+ * and a message repeated verbatim are both announced. The message is removed again after 5 seconds.
2067
+ * A newer announcement replaces a pending one.
2068
+ *
2069
+ * The operation returns at once and does not wait for the message to be written.
2070
+ *
2071
+ * @throws When the message is empty.
2072
+ *
2073
+ * @category Accessibility
2074
+ */
2075
+ declare const announceToScreenReader: TOperation<IAnnounceToScreenReaderOperationData, Omit<IAnnounceToScreenReaderOperationData, 'message' | 'priority'>>;
2076
+ /**
2077
+ *
2078
+ * This operation should only be used within a loop, so between a {@link forEach} and {@link endForEach}
2079
+ * operation. This operation immediately moves to the loop end index, effectively stopping the loop.
2080
+ *
2081
+ * It can be placed inside a `when`/`otherwise`/`endWhen` block within the loop, to break conditionally.
2082
+ *
2083
+ * @category Control Flow
2084
+ */
2085
+ declare const breakForEach: TOperation<TOperationData>;
2086
+ interface IBroadcastEventOperationData {
2087
+ /**
2088
+ * @required
2089
+ * @erased
2090
+ */
2091
+ eventArgs: unknown[];
2092
+ /**
2093
+ * @type=ParameterType:eventTopic
2094
+ * @erased
2095
+ */
2096
+ eventTopic?: string;
2097
+ /**
2098
+ * @type=ParameterType:eventName
2099
+ * @required
2100
+ * @erased
2101
+ */
2102
+ eventName: string;
2103
+ }
2104
+ /**
2105
+ * This operation broadcasts the given event through the eventbus, along with the
2106
+ * event arguments and optional event topic.
2107
+ *
2108
+ * @category Utility
2109
+ */
2110
+ declare const broadcastEvent: TOperation<IBroadcastEventOperationData, Omit<IBroadcastEventOperationData, 'eventArgs' | 'eventTopic' | 'eventName'>>;
2111
+ type TCalculationOperator = '+' | '-' | '*' | '/' | '%' | '**';
2112
+ interface ICalcOperationData {
2113
+ /**
2114
+ * The left operand
2115
+ * @type=ParameterType:number
2116
+ * @required
2117
+ * @erased
2118
+ */
2119
+ left: string | number;
2120
+ /**
2121
+ * The right operand
2122
+ * @type=ParameterType:number
2123
+ * @required
2124
+ * @erased
2125
+ */
2126
+ right: string | number;
2127
+ /**
2128
+ * @required
2129
+ * @erased
2130
+ */
2131
+ operator: TCalculationOperator;
2132
+ /**
2133
+ * @output
2134
+ */
2135
+ calculationResult?: number;
2136
+ }
2137
+ /**
2138
+ * This operation calculates the given left and right hand operands using the specified operator.
2139
+ *
2140
+ * `left`, `right` and `operator` may be property chains (`$operationdata.`, `$globaldata.`,
2141
+ * `$scope.`). Only these three inputs are resolved; the rest of the operation data is left as
2142
+ * it is.
2143
+ *
2144
+ * @param operationData
2145
+ * @throws When the operator is not one of + - * / % **.
2146
+ *
2147
+ * @category Utility
2148
+ */
2149
+ declare const calc: TOperation<ICalcOperationData, Omit<ICalcOperationData, 'left' | 'right' | 'operator'>>;
2150
+ interface IClearElementOperationData {
2151
+ /**
2152
+ * @dependency
2153
+ */
2154
+ selectedElement: JQuery;
2155
+ }
2156
+ /**
2157
+ * This operation removes all of the children from the given selected element.
2158
+ *
2159
+ * Controllers attached to the removed children or their descendants (by `addControllerToElement`)
2160
+ * are detached first. Controllers on the selected element itself stay attached.
2161
+ *
2162
+ * @throws AggregateError When one or more controller `detach()` calls throw. The element is cleared anyway.
2163
+ *
2164
+ * @category DOM
2165
+ */
2166
+ declare const clearElement: TOperation<IClearElementOperationData>;
2167
+ interface IClearOperationDataOperationData {
2168
+ /**
2169
+ * @erased
2170
+ */
2171
+ properties?: string[];
2172
+ }
2173
+ /**
2174
+ * This operation removes all of the properties on the current operation date.
2175
+ * Or, if the `properties` property is set only removes the properties defined by that list.
2176
+ *
2177
+ * @category Data
2178
+ */
2179
+ declare const clearOperationData: TOperation<IClearOperationDataOperationData, Omit<IClearOperationDataOperationData, 'properties'>>;
2180
+ type StorageType$2 = 'local' | 'session';
2181
+ interface IClearStorageOperationData {
2182
+ /**
2183
+ * @optional
2184
+ * @erased
2185
+ */
2186
+ key?: string;
2187
+ /**
2188
+ * @required
2189
+ * @erased
2190
+ */
2191
+ storageType: StorageType$2;
2192
+ }
2193
+ /**
2194
+ * Clears data from browser storage (localStorage or sessionStorage).
2195
+ *
2196
+ * If `key` is provided, removes only that key. If `key` is omitted, clears all storage.
2197
+ * A `key` that is present but empty, blank or not a string is rejected, so a value resolved
2198
+ * from missing data never wipes the whole storage.
2199
+ *
2200
+ * @throws When `key` is present but is not a non-empty string.
2201
+ *
2202
+ * @returns Operation data with storage properties erased
2203
+ *
2204
+ * @example
2205
+ * ```typescript
2206
+ * // Clear specific key
2207
+ * const result = clearStorage({
2208
+ * key: 'user-settings',
2209
+ * storageType: 'local'
2210
+ * });
2211
+ * ```
2212
+ *
2213
+ * @example
2214
+ * ```typescript
2215
+ * // Clear all localStorage
2216
+ * const result = clearStorage({
2217
+ * storageType: 'local'
2218
+ * });
2219
+ * ```
2220
+ *
2221
+ * @category Data
2222
+ */
2223
+ declare const clearStorage: TOperation<IClearStorageOperationData, Omit<IClearStorageOperationData, 'key' | 'storageType'>>;
2224
+ interface ICompareDateOperationData {
2225
+ /**
2226
+ * @required
2227
+ * @erased
2228
+ */
2229
+ date1: Date | string | number;
2230
+ /**
2231
+ * @required
2232
+ * @erased
2233
+ */
2234
+ date2: Date | string | number;
2235
+ /**
2236
+ * @output
2237
+ */
2238
+ comparison?: number;
2239
+ /**
2240
+ * @output
2241
+ */
2242
+ isEqual?: boolean;
2243
+ /**
2244
+ * @output
2245
+ */
2246
+ isBefore?: boolean;
2247
+ /**
2248
+ * @output
2249
+ */
2250
+ isAfter?: boolean;
2251
+ }
2252
+ /**
2253
+ * Compares two dates.
2254
+ * comparison: -1 (before), 0 (equal), 1 (after)
2255
+ *
2256
+ * @category Date
2257
+ */
2258
+ declare const compareDate: TOperation<ICompareDateOperationData, Omit<ICompareDateOperationData, 'date1' | 'date2'>>;
2259
+ interface IConcatenateStringsOperationData {
2260
+ /**
2261
+ * @required
2262
+ * @erased
2263
+ */
2264
+ strings: string[];
2265
+ /**
2266
+ * @optional
2267
+ * @erased
2268
+ */
2269
+ separator?: string;
2270
+ /**
2271
+ * @output
2272
+ */
2273
+ result?: string;
2274
+ }
2275
+ /**
2276
+ * Concatenates multiple strings with an optional separator.
2277
+ *
2278
+ * @returns Operation data with `result` containing the concatenated string
2279
+ *
2280
+ * @example
2281
+ * ```typescript
2282
+ * const result = concatenateStrings({
2283
+ * strings: ['Hello', 'World'],
2284
+ * separator: ' '
2285
+ * });
2286
+ * // result.result = "Hello World"
2287
+ * ```
2288
+ *
2289
+ * @category String
2290
+ */
2291
+ declare const concatenateStrings: TOperation<IConcatenateStringsOperationData, Omit<IConcatenateStringsOperationData, 'strings' | 'separator'>>;
2292
+ /**
2293
+ *
2294
+ * This operation should only be used within a loop, so between a {@link forEach} and {@link endForEach}
2295
+ * operation. This operation immediately moves to the next loop index, effectively canceling the rest
2296
+ * of the operations in the current iteration.
2297
+ *
2298
+ * It can be placed inside a `when`/`otherwise`/`endWhen` block within the loop, to continue conditionally.
2299
+ *
2300
+ * @category Control Flow
2301
+ */
2302
+ declare const continueForEach: TOperation<TOperationData>;
2303
+ type TTagNames = keyof HTMLElementTagNameMap;
2304
+ interface ICreateElementOperationData<T extends TTagNames> {
2305
+ /**
2306
+ * @type=ParameterType:htmlElementName
2307
+ * @required
2308
+ * @erased
2309
+ */
2310
+ elementName: T;
2311
+ /**
2312
+ * @erased
2313
+ */
2314
+ text?: string;
2315
+ /**
2316
+ * @type=ParameterType:object
2317
+ * @erased
2318
+ */
2319
+ attributes?: Partial<HTMLElementTagNameMap[T]>;
2320
+ /**
2321
+ * @type=ParameterType:object
2322
+ * @output
2323
+ */
2324
+ template?: JQuery;
2325
+ }
2326
+ /**
2327
+ * This operation creates the DOM element described by the given elementName and attributes and assigns
2328
+ * the instance to the `template` property on the current operation data.
2329
+ *
2330
+ * The element is built with DOM APIs: attribute values are set with `.attr()` and `text` is set as
2331
+ * text content, so neither is parsed as HTML.
2332
+ *
2333
+ * Values may be resolved from user data, so nothing that runs script is created: `script`
2334
+ * elements, event handler (`on*`) and `srcdoc` attributes, and `javascript:` or `vbscript:`
2335
+ * URLs in URL attributes such as `href`, `src` and `formaction` are refused.
2336
+ *
2337
+ * @param operationData
2338
+ * @returns
2339
+ * @throws When `elementName` is not a valid element name or is `script`, or when an attribute
2340
+ * is refused (see above). The message names the operation.
2341
+ * @category DOM
2342
+ */
2343
+ declare const createElement: TOperation<ICreateElementOperationData<TTagNames>, Omit<RequireKeys<ICreateElementOperationData<TTagNames>, 'template'>, 'elementName' | 'text' | 'attributes'>>;
2344
+ interface ICustomFunctionOperationData {
2345
+ /**
2346
+ * @type=ParameterType:systemName
2347
+ * @erased
2348
+ * @required
2349
+ */
2350
+ systemName: string;
2351
+ }
2352
+ /**
2353
+ * This operation retrieves a custom function defined by the given system name
2354
+ * and invokes it with the current operation data and eventbus.
2355
+ *
2356
+ * The function is looked up with the `request-function` event, which the
2357
+ * `EngineFactory` answers from its resource importer. Register the function
2358
+ * with the `EligiusResourceImporter` constructor:
2359
+ * `new EligiusResourceImporter({functions: {myFunction}})`.
2360
+ *
2361
+ * The function is called with the current operation data as its argument, and with `this`
2362
+ * set to a view of the operation scope. Reading a property from `this` returns it from the
2363
+ * innermost scope that has it, so inside a `when` block in a loop `this.currentItem`,
2364
+ * `this.loopIndex` and `this.variables` return the loop's and the action's values, the same
2365
+ * as `$scope.` chains. Assigning to `this` (for example `this.newIndex`) writes to the scope the
2366
+ * operation runs in.
2367
+ *
2368
+ * @param operationData
2369
+ * @throws Error naming the operation and the `systemName` when nothing is
2370
+ * registered under that name (with the closest registered names when the
2371
+ * importer can suggest them), or when the registered value is not a function.
2372
+ *
2373
+ * @category Utility
2374
+ */
2375
+ declare const customFunction: TOperation<ICustomFunctionOperationData, Omit<ICustomFunctionOperationData, 'systemName'>>;
2376
+ interface IEndActionOperationData {
2377
+ /**
2378
+ * @dependency
2379
+ */
2380
+ actionInstance: IEndableAction;
2381
+ /**
2382
+ * @type=ParameterType:object
2383
+ * @erased
2384
+ */
2385
+ actionOperationData?: Record<string, unknown>;
2386
+ }
2387
+ /**
2388
+ * This operation invokes the {@link EndableAction}.end method on the specified action instance.
2389
+ *
2390
+ * The action receives its own copy of the current operation data merged with the action
2391
+ * operation data. Whatever the action's end operations add, change or remove in that copy stays
2392
+ * with the action: once it has completed, this operation continues with the operation data it
2393
+ * had before, without the `actionOperationData` property.
2394
+ *
2395
+ * @category Action
2396
+ */
2397
+ declare const endAction: TOperation<IEndActionOperationData, Omit<IEndActionOperationData, 'actionOperationData'>>;
2398
+ /**
2399
+ * This operation checks if the current loop should end or start the next iteration.
2400
+ *
2401
+ * @category Control Flow
2402
+ */
2403
+ declare const endForEach: TOperation<TOperationData>;
2404
+ /**
2405
+ * This operation cleans up after the {@link when}/{@link otherwise}/{@link endWhen} control flow ends.
2406
+ *
2407
+ * @category Control Flow
2408
+ */
2409
+ declare const endWhen: TOperation<Record<string, unknown>>;
2410
+ /**
2411
+ * This operation extends the specified controller instance with the specified extension.
2412
+ */
2413
+ interface IExtendControllerOperationData {
2414
+ /**
2415
+ * @dependency
2416
+ */
2417
+ controllerInstance: IController<TOperationData>;
2418
+ /**
2419
+ * @erased
2420
+ * @required
2421
+ */
2422
+ controllerExtension: Record<PropertyKey, unknown>;
2423
+ }
2424
+ /**
2425
+ * Extends the current controller with given extension.
2426
+ *
2427
+ * The extension's own properties are copied onto the controller instance.
2428
+ *
2429
+ * @throws When the extension has a `__proto__`, `prototype` or `constructor` key, which would
2430
+ * replace the controller's prototype or shadow its class.
2431
+ *
2432
+ * @category Controller
2433
+ */
2434
+ declare const extendController: TOperation<IExtendControllerOperationData, Omit<IExtendControllerOperationData, 'controllerExtension'>>;
2435
+ interface IFilterArrayOperationData {
2436
+ /**
2437
+ * @dependency
2438
+ */
2439
+ arrayData: any[];
2440
+ /**
2441
+ * @optional
2442
+ * @erased
2443
+ */
2444
+ filterProperty?: string;
2445
+ /**
2446
+ * @optional
2447
+ * @erased
2448
+ */
2449
+ filterValue?: any;
2450
+ /**
2451
+ * @optional
2452
+ * @erased
2453
+ */
2454
+ filterPredicate?: (item: any, index?: number) => boolean;
2455
+ /**
2456
+ * @output
2457
+ */
2458
+ filteredArray?: any[];
2459
+ }
2460
+ /**
2461
+ * Filters an array based on property equality or custom predicate function.
2462
+ *
2463
+ * Operates on arrayData passed from previous operations.
2464
+ * Supports two filtering modes:
2465
+ * 1. Property equality: `filterProperty` and `filterValue` to filter by property match
2466
+ * 2. Custom predicate: `filterPredicate` function for complex filtering logic
2467
+ *
2468
+ * @returns Operation data with `filteredArray` containing filtered results
2469
+ *
2470
+ * @example
2471
+ * ```typescript
2472
+ * // Filter by property equality
2473
+ * const result = filterArray({
2474
+ * arrayData: [{name: 'Alice', age: 25}, {name: 'Bob', age: 30}],
2475
+ * filterProperty: 'age',
2476
+ * filterValue: 25
2477
+ * });
2478
+ * // result.filteredArray = [{name: 'Alice', age: 25}]
2479
+ * ```
2480
+ *
2481
+ * @example
2482
+ * ```typescript
2483
+ * // Filter with custom predicate
2484
+ * const result = filterArray({
2485
+ * arrayData: [1, 2, 3, 4, 5],
2486
+ * filterPredicate: (item) => item % 2 === 0
2487
+ * });
2488
+ * // result.filteredArray = [2, 4]
2489
+ * ```
2490
+ *
2491
+ * @category Array
2492
+ */
2493
+ declare const filterArray: TOperation<IFilterArrayOperationData, Omit<IFilterArrayOperationData, 'filterProperty' | 'filterValue' | 'filterPredicate'>>;
2494
+ interface IFindInArrayOperationData {
2495
+ /**
2496
+ * @dependency
2497
+ */
2498
+ arrayData: any[];
2499
+ /**
2500
+ * @optional
2501
+ * @erased
2502
+ */
2503
+ findProperty?: string;
2504
+ /**
2505
+ * @optional
2506
+ * @erased
2507
+ */
2508
+ findValue?: any;
2509
+ /**
2510
+ * @optional
2511
+ * @erased
2512
+ */
2513
+ findPredicate?: (item: any, index?: number) => boolean;
2514
+ /**
2515
+ * @output
2516
+ */
2517
+ foundItem?: any | undefined;
2518
+ /**
2519
+ * @output
2520
+ */
2521
+ foundIndex?: number;
2522
+ }
2523
+ /**
2524
+ * Finds the first element in an array matching criteria.
2525
+ *
2526
+ * Operates on arrayData passed from previous operations.
2527
+ * Supports two search modes:
2528
+ * 1. Property equality: `findProperty` and `findValue` to find by property match
2529
+ * 2. Custom predicate: `findPredicate` function for complex search logic
2530
+ *
2531
+ * Returns `undefined` for `foundItem` and `-1` for `foundIndex` if no match found.
2532
+ *
2533
+ * @returns Operation data with `foundItem` (the matching element) and `foundIndex` (its position)
2534
+ *
2535
+ * @example
2536
+ * ```typescript
2537
+ * // Find by property equality
2538
+ * const result = findInArray({
2539
+ * arrayData: [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}],
2540
+ * findProperty: 'id',
2541
+ * findValue: 2
2542
+ * });
2543
+ * // result.foundItem = {id: 2, name: 'Bob'}
2544
+ * // result.foundIndex = 1
2545
+ * ```
2546
+ *
2547
+ * @example
2548
+ * ```typescript
2549
+ * // Find with custom predicate
2550
+ * const result = findInArray({
2551
+ * arrayData: [10, 25, 30, 45],
2552
+ * findPredicate: (item) => item > 30
2553
+ * });
2554
+ * // result.foundItem = 45
2555
+ * // result.foundIndex = 3
2556
+ * ```
2557
+ *
2558
+ * @category Array
2559
+ */
2560
+ declare const findInArray: TOperation<IFindInArrayOperationData, Omit<IFindInArrayOperationData, 'findProperty' | 'findValue' | 'findPredicate'>>;
2561
+ interface IForEachOperationData {
2562
+ /**
2563
+ * @type=ParameterType:array|ParameterType:string
2564
+ * @required
2565
+ */
2566
+ collection: unknown[] | string;
2567
+ }
2568
+ /**
2569
+ * This operation iterates over the given collection.
2570
+ *
2571
+ * Each iteration the current item from the specified collection is
2572
+ * assigned to the {@link IOperationScope.currentItem|currentItem} property on the {@link IOperationScope|operation scope}.
2573
+ *
2574
+ * At the start of the loop, the associated {@link endForEach} operation is determined and when
2575
+ * the last iteration is completed the flow control is set to the index of that operation.
2576
+ *
2577
+ * The {@link continueForEach|continue} and {@link breakForEach|break} operations can be used to control the
2578
+ * loop iterations.
2579
+ *
2580
+ * The collection is resolved once, when the loop starts, and the loop iterates over a snapshot
2581
+ * of it. Changing, replacing or removing the source collection inside the loop body does not
2582
+ * change the items or the number of iterations of the running loop.
2583
+ *
2584
+ * @category Control Flow
2585
+ */
2586
+ declare const forEach: TOperation<IForEachOperationData>;
2587
+ interface IFormatDateOperationData {
2588
+ /**
2589
+ * @dependency
2590
+ */
2591
+ date: Date | string | number;
2592
+ /**
2593
+ * @required
2594
+ * @erased
2595
+ */
2596
+ format: string;
2597
+ /**
2598
+ * @output
2599
+ */
2600
+ formattedDate?: string;
2601
+ }
2602
+ /**
2603
+ * Formats a date with a simple token pattern, in the local time zone.
2604
+ *
2605
+ * Supported tokens (every occurrence is replaced, other characters are kept as is):
2606
+ * - `YYYY`: four digit year
2607
+ * - `MM`: month, 01-12
2608
+ * - `DD`: day of the month, 01-31
2609
+ * - `HH`: hours, 00-23
2610
+ * - `mm`: minutes, 00-59
2611
+ * - `ss`: seconds, 00-59
2612
+ *
2613
+ * @throws When the date is missing or invalid.
2614
+ *
2615
+ * @example
2616
+ * ```typescript
2617
+ * formatDate({date: new Date(2024, 0, 5, 14, 5), format: 'HH:mm-HH:mm DD/MM/YYYY'});
2618
+ * // formattedDate = "14:05-14:05 05/01/2024"
2619
+ * ```
2620
+ *
2621
+ * @category Date
2622
+ */
2623
+ declare const formatDate: TOperation<IFormatDateOperationData, Omit<IFormatDateOperationData, 'format'>>;
2624
+ type TextTransformation = 'uppercase' | 'lowercase' | 'capitalize' | 'titlecase' | 'trim';
2625
+ interface IFormatTextOperationData {
2626
+ /**
2627
+ * @dependency
2628
+ */
2629
+ textContent: string;
2630
+ /**
2631
+ * @required
2632
+ * @erased
2633
+ */
2634
+ transformation: TextTransformation;
2635
+ /**
2636
+ * @output
2637
+ */
2638
+ formattedText?: string;
2639
+ }
2640
+ /**
2641
+ * Transforms text using format operations: uppercase, lowercase, capitalize, titlecase, or trim.
2642
+ *
2643
+ * Operates on textContent passed from previous operations (e.g., getTextContent).
2644
+ *
2645
+ * Transformations:
2646
+ * - `uppercase`: Convert all characters to uppercase
2647
+ * - `lowercase`: Convert all characters to lowercase
2648
+ * - `capitalize`: Capitalize only the first letter
2649
+ * - `titlecase`: Capitalize first letter of each word
2650
+ * - `trim`: Remove leading and trailing whitespace
2651
+ *
2652
+ * @returns Operation data with `formattedText` containing the transformed text
2653
+ *
2654
+ * @example
2655
+ * ```typescript
2656
+ * // Convert to uppercase
2657
+ * const result = formatText({
2658
+ * textContent: 'hello',
2659
+ * transformation: 'uppercase'
2660
+ * });
2661
+ * // result.formattedText = "HELLO"
2662
+ * ```
2663
+ *
2664
+ * @example
2665
+ * ```typescript
2666
+ * // Title case
2667
+ * const result = formatText({
2668
+ * textContent: 'hello world',
2669
+ * transformation: 'titlecase'
2670
+ * });
2671
+ * // result.formattedText = "Hello World"
2672
+ * ```
2673
+ *
2674
+ * @category Text
2675
+ */
2676
+ declare const formatText: TOperation<IFormatTextOperationData, Omit<IFormatTextOperationData, 'transformation'>>;
2677
+ interface IGetAttributesFromElementOperationData {
2678
+ /**
2679
+ * The HTML element whose attributes will be retrieved
2680
+ * @dependency
2681
+ */
2682
+ selectedElement: JQuery;
2683
+ /**
2684
+ * The specified attribute names that will be retrieved
2685
+ * @required
2686
+ * @erased
2687
+ */
2688
+ attributeNames: string[];
2689
+ /**
2690
+ * The retrieved attributes
2691
+ * @output
2692
+ */
2693
+ attributeValues?: Record<string, unknown>;
2694
+ }
2695
+ /**
2696
+ * This operation retrieves the values for the specified attribute names from the given selected element.
2697
+ *
2698
+ * @category DOM
2699
+ */
2700
+ declare const getAttributesFromElement: TOperation<IGetAttributesFromElementOperationData, Omit<IGetAttributesFromElementOperationData, 'attributeNames'>>;
2701
+ interface IGetControllerFromElementOperationData {
2702
+ /**
2703
+ * @dependency
2704
+ */
2705
+ selectedElement: JQuery;
2706
+ /**
2707
+ * @type=ParameterType:controllerName
2708
+ * @required
2709
+ * @erased
2710
+ */
2711
+ controllerName: string;
2712
+ /**
2713
+ * @type=ParameterType:object
2714
+ * @output
2715
+ */
2716
+ controllerInstance?: IController<any>;
2717
+ }
2718
+ /**
2719
+ * This operation retrieves the controller instance with the specified name that is assigned to the given selected element.
2720
+ *
2721
+ * @param operationData
2722
+ * @returns
2723
+ *
2724
+ * @category Controller
2725
+ */
2726
+ declare const getControllerFromElement: TOperation<IGetControllerFromElementOperationData, Omit<IGetControllerFromElementOperationData, 'controllerName'>>;
2727
+ type TSystemName = keyof typeof index_d_exports$1;
2728
+ interface IGetControllerInstanceOperationData {
2729
+ /**
2730
+ * The name of a built-in controller, or of a controller registered on the
2731
+ * `EligiusResourceImporter`.
2732
+ *
2733
+ * @type=ParameterType:controllerName
2734
+ * @required
2735
+ * @erased
2736
+ */
2737
+ systemName: TSystemName | (string & {});
2738
+ /**
2739
+ * @type=ParameterType:object
2740
+ * @output
2741
+ */
2742
+ controllerInstance?: IController<TOperationData>;
2743
+ }
2744
+ /**
2745
+ * This operation retrieves an instance of the given controller name.
2746
+ * It assigns this instance to the `controllerInstance` property on the current operation data
2747
+ *
2748
+ * @throws Error naming getControllerInstance and the `systemName` when no controller is
2749
+ * registered under that name, or when creating it fails (for example because the name
2750
+ * belongs to something that is not a controller class). The importer's "did you mean"
2751
+ * hint is kept in the message and the original error is the `cause`.
2752
+ *
2753
+ * @category Controller
2754
+ */
2755
+ declare const getControllerInstance: TOperation<IGetControllerInstanceOperationData, Omit<IGetControllerInstanceOperationData, 'systemName'>>;
2756
+ interface IGetCurrentTimeOperationData {
2757
+ /**
2758
+ * @output
2759
+ */
2760
+ timestamp?: number;
2761
+ /**
2762
+ * @output
2763
+ */
2764
+ date?: Date;
2765
+ }
2766
+ /**
2767
+ * Gets the current time as timestamp and Date object.
2768
+ *
2769
+ * @category Date
2770
+ */
2771
+ declare const getCurrentTime: TOperation<IGetCurrentTimeOperationData, IGetCurrentTimeOperationData>;
2772
+ interface IGetElementDimensionsOperationData {
2773
+ /**
2774
+ * @dependency
2775
+ */
2776
+ selectedElement: JQuery;
2777
+ /**
2778
+ * @type=ParameterType:dimensionsModifier
2779
+ * @erased
2780
+ */
2781
+ modifier?: string;
2782
+ /**
2783
+ * @type=ParameterType:object
2784
+ * @output
2785
+ */
2786
+ dimensions?: {
2787
+ width?: number;
2788
+ height?: number;
2789
+ };
2790
+ }
2791
+ /**
2792
+ * This operation calculates the width and height of the given selected element.
2793
+ * It assigns this struct to the dimensions property on the current operation data.
2794
+ * Optionally the width and height can be modified using the given modifier string.
2795
+ *
2796
+ * The modifier string is formatted in the following way:
2797
+ *
2798
+ * <operator><amount><optional-side><optional-precentage>|<ratio-definition>
2799
+ *
2800
+ * Where the ratio modifier is formatted in the following way:
2801
+ * <side>[ar=<ratio-left>-<ratio-right>]
2802
+ *
2803
+ * For example, this modifier '+100h|w[ar=8-1]' will modifiy the dimensions like this:
2804
+ * it will add a value of 100 to the height and modify the width by a ratio of 8 to 1 relative to the height.
2805
+ *
2806
+ * @category DOM
2807
+ */
2808
+ declare const getElementDimensions: TOperation<IGetElementDimensionsOperationData, Omit<IGetElementDimensionsOperationData, 'modifier'>>;
2809
+ interface IGetFocusedElementOperationData {
2810
+ /**
2811
+ * @type=ParameterType:jQuery
2812
+ * @output
2813
+ */
2814
+ focusedElement?: JQuery;
2815
+ }
2816
+ /**
2817
+ * Gets the currently focused element.
2818
+ *
2819
+ * @category Focus
2820
+ */
2821
+ declare const getFocusedElement: TOperation<IGetFocusedElementOperationData, IGetFocusedElementOperationData>;
2822
+ interface IGetFormDataOperationData {
2823
+ /**
2824
+ * @dependency
2825
+ */
2826
+ selectedElement: JQuery;
2827
+ /**
2828
+ * @output
2829
+ * @type=ParameterType:object
2830
+ */
2831
+ formData?: Record<string, any>;
2832
+ }
2833
+ /**
2834
+ * Extracts all input, select, and textarea values from form element into operation data.
2835
+ *
2836
+ * This operation reads form field values and returns them as an object with field names as keys.
2837
+ * Only processes form elements that are enabled and not hidden. Handles checkboxes, radio buttons,
2838
+ * select elements, textareas, and text inputs.
2839
+ *
2840
+ * @returns Operation data with `formData` object containing field values
2841
+ *
2842
+ * @example
2843
+ * ```typescript
2844
+ * // Given a form with fields: name="John", email="john@example.com"
2845
+ * const result = getFormData({selectedElement: $form});
2846
+ * // Returns: {selectedElement: $form, formData: {name: "John", email: "john@example.com"}}
2847
+ * ```
2848
+ *
2849
+ * @category Form
2850
+ */
2851
+ declare const getFormData: TOperation<IGetFormDataOperationData, IGetFormDataOperationData>;
2852
+ interface IGetImportOperationData {
2853
+ /**
2854
+ * @type=ParameterType:systemName
2855
+ * @required
2856
+ * @erased
2857
+ */
2858
+ systemName: string;
2859
+ /**
2860
+ * @output
2861
+ */
2862
+ importedInstance?: unknown;
2863
+ }
2864
+ /**
2865
+ * This operation retrieves the import specified by the given `systemName` and
2866
+ * assigns it to the `importedInstance` property on the current operaton date.
2867
+ *
2868
+ * The import is looked up with the `request-function` event, which the
2869
+ * `EngineFactory` answers from its resource importer. Functions, templates
2870
+ * and JSON registered with the `EligiusResourceImporter` constructor
2871
+ * (`new EligiusResourceImporter({json: {settings}})`) can be imported this
2872
+ * way, as can every built-in operation, controller and provider export.
2873
+ *
2874
+ * @param operationData
2875
+ * @throws Error naming the operation and the `systemName` when nothing is
2876
+ * registered under that name (with the closest registered names when the
2877
+ * importer can suggest them).
2878
+ *
2879
+ * @category Utility
2880
+ */
2881
+ declare const getImport: TOperation<IGetImportOperationData, Omit<RequireKeys<IGetImportOperationData, 'importedInstance'>, 'systemName'>>;
2882
+ interface IGetQueryParamsOperationData {
2883
+ /**
2884
+ * The query params will be added as property/values to this object.
2885
+ * So, the query string `?foo=bar&bar=foo` will result in:
2886
+ * ```json
2887
+ * {
2888
+ * foo: "bar",
2889
+ * bar: "foo"
2890
+ * }
2891
+ * ```
2892
+ * This object will be assigned to the `queryParams` property.
2893
+ * @output
2894
+ */
2895
+ queryParams?: Record<string, string>;
2896
+ /**
2897
+ * The properties on this object will be assigned to the queryParams result
2898
+ * when the given property name is not part of the query string.
2899
+ *
2900
+ * @erased
2901
+ *
2902
+ */
2903
+ defaultValues?: Record<string, string>;
2904
+ }
2905
+ /**
2906
+ * This operation retrieves the current query parameters from the browser's address bar and places
2907
+ * them on the returned operation data.
2908
+ *
2909
+ * @category Utility
2910
+ */
2911
+ declare const getQueryParams: TOperation<IGetQueryParamsOperationData, Omit<IGetQueryParamsOperationData, 'defaultValues'>>;
2912
+ interface IGetScrollPositionOperationData {
2913
+ /**
2914
+ * @output
2915
+ */
2916
+ scrollX?: number;
2917
+ /**
2918
+ * @output
2919
+ */
2920
+ scrollY?: number;
2921
+ }
2922
+ /**
2923
+ * Gets the current scroll position of the viewport.
2924
+ *
2925
+ * Returns x (horizontal) and y (vertical) scroll positions in pixels.
2926
+ * Uses cross-browser compatible methods to retrieve scroll position.
2927
+ *
2928
+ * @returns Operation data with `scrollX` and `scrollY` values
2929
+ *
2930
+ * @example
2931
+ * ```typescript
2932
+ * // Get current scroll position
2933
+ * const result = getScrollPosition({});
2934
+ * // result.scrollX = 150
2935
+ * // result.scrollY = 400
2936
+ * ```
2937
+ *
2938
+ * @category Scroll
2939
+ */
2940
+ declare const getScrollPosition: TOperation<IGetScrollPositionOperationData, IGetScrollPositionOperationData>;
2941
+ interface IGetTextContentOperationData {
2942
+ /**
2943
+ * @dependency
2944
+ */
2945
+ selectedElement: JQuery;
2946
+ /**
2947
+ * @output
2948
+ */
2949
+ textContent?: string;
2950
+ }
2951
+ /**
2952
+ * Extracts text content from element, stripping all HTML markup.
2953
+ *
2954
+ * Uses jQuery's `.text()` method which is XSS-safe and returns only the text content
2955
+ * without any HTML tags. Preserves whitespace and text from nested elements.
2956
+ *
2957
+ * @returns Operation data with `textContent` containing the extracted plain text
2958
+ *
2959
+ * @example
2960
+ * ```typescript
2961
+ * // Extract text from element with HTML
2962
+ * const result = getTextContent({selectedElement: $div});
2963
+ * // Given: <div>Hello <strong>World</strong>!</div>
2964
+ * // Returns: {textContent: "Hello World!"}
2965
+ * ```
2966
+ *
2967
+ * @category Text
2968
+ */
2969
+ declare const getTextContent: TOperation<IGetTextContentOperationData, IGetTextContentOperationData>;
2970
+ interface IHttpDeleteOperationData {
2971
+ /**
2972
+ * @required
2973
+ * @erased
2974
+ */
2975
+ url: string;
2976
+ /**
2977
+ * @optional
2978
+ * @erased
2979
+ */
2980
+ headers?: Record<string, string>;
2981
+ /**
2982
+ * @output
2983
+ */
2984
+ response?: any;
2985
+ /**
2986
+ * @output
2987
+ */
2988
+ status?: number;
2989
+ }
2990
+ /**
2991
+ * Performs an HTTP DELETE request to the specified URL.
2992
+ *
2993
+ * @returns Operation data with `response` (parsed JSON, or `null` for non-JSON and empty bodies)
2994
+ * and `status` (HTTP status code)
2995
+ * @throws When the request fails, the server responds with an error status, or a JSON body is invalid.
2996
+ *
2997
+ * @example
2998
+ * ```typescript
2999
+ * const result = await httpDelete({
3000
+ * url: 'https://api.example.com/users/123',
3001
+ * headers: { 'Authorization': 'Bearer token' }
3002
+ * });
3003
+ * // result.response = {} or null
3004
+ * // result.status = 204
3005
+ * ```
3006
+ *
3007
+ * @category HTTP
3008
+ */
3009
+ declare const httpDelete: TOperation<IHttpDeleteOperationData, Omit<IHttpDeleteOperationData, 'url' | 'headers'>>;
3010
+ interface IHttpPostOperationData {
3011
+ /**
3012
+ * @required
3013
+ * @erased
3014
+ */
3015
+ url: string;
3016
+ /**
3017
+ * @optional
3018
+ * @erased
3019
+ */
3020
+ body?: any;
3021
+ /**
3022
+ * @optional
3023
+ * @erased
3024
+ */
3025
+ headers?: Record<string, string>;
3026
+ /**
3027
+ * @output
3028
+ */
3029
+ response?: any;
3030
+ /**
3031
+ * @output
3032
+ */
3033
+ status?: number;
3034
+ }
3035
+ /**
3036
+ * Performs an HTTP POST request to the specified URL.
3037
+ *
3038
+ * The body is sent as JSON with `Content-Type: application/json`, unless the caller's headers set
3039
+ * another content type (header names are case-insensitive). With a non-JSON content type, a string
3040
+ * body is sent as is; other bodies are still JSON encoded.
3041
+ *
3042
+ * @returns Operation data with `response` (parsed JSON, or `null` for 204 No Content and empty bodies)
3043
+ * and `status` (HTTP status code)
3044
+ * @throws When the request fails, the server responds with an error status, or the body is not valid JSON.
3045
+ *
3046
+ * @example
3047
+ * ```typescript
3048
+ * const result = await httpPost({
3049
+ * url: 'https://api.example.com/users',
3050
+ * body: { name: 'John', email: 'john@example.com' },
3051
+ * headers: { 'Content-Type': 'application/json' }
3052
+ * });
3053
+ * // result.response = { id: 123, name: 'John', ... }
3054
+ * // result.status = 201
3055
+ * ```
3056
+ *
3057
+ * @category HTTP
3058
+ */
3059
+ declare const httpPost: TOperation<IHttpPostOperationData, Omit<IHttpPostOperationData, 'url' | 'body' | 'headers'>>;
3060
+ interface IHttpPutOperationData {
3061
+ /**
3062
+ * @required
3063
+ * @erased
3064
+ */
3065
+ url: string;
3066
+ /**
3067
+ * @optional
3068
+ * @erased
3069
+ */
3070
+ body?: any;
3071
+ /**
3072
+ * @optional
3073
+ * @erased
3074
+ */
3075
+ headers?: Record<string, string>;
3076
+ /**
3077
+ * @output
3078
+ */
3079
+ response?: any;
3080
+ /**
3081
+ * @output
3082
+ */
3083
+ status?: number;
3084
+ }
3085
+ /**
3086
+ * Performs an HTTP PUT request to the specified URL.
3087
+ *
3088
+ * The body is sent as JSON with `Content-Type: application/json`, unless the caller's headers set
3089
+ * another content type (header names are case-insensitive). With a non-JSON content type, a string
3090
+ * body is sent as is; other bodies are still JSON encoded.
3091
+ *
3092
+ * @returns Operation data with `response` (parsed JSON, or `null` for 204 No Content and empty bodies)
3093
+ * and `status` (HTTP status code)
3094
+ * @throws When the request fails, the server responds with an error status, or the body is not valid JSON.
3095
+ *
3096
+ * @example
3097
+ * ```typescript
3098
+ * const result = await httpPut({
3099
+ * url: 'https://api.example.com/users/123',
3100
+ * body: { name: 'John Updated', email: 'john.new@example.com' },
3101
+ * headers: { 'Content-Type': 'application/json' }
3102
+ * });
3103
+ * // result.response = { id: 123, name: 'John Updated', ... }
3104
+ * // result.status = 200
3105
+ * ```
3106
+ *
3107
+ * @category HTTP
3108
+ */
3109
+ declare const httpPut: TOperation<IHttpPutOperationData, Omit<IHttpPutOperationData, 'url' | 'body' | 'headers'>>;
3110
+ interface IInvokeObjectMethodOperationData {
3111
+ /**
3112
+ *
3113
+ * The given object instance
3114
+ * @dependency
3115
+ *
3116
+ */
3117
+ instance: any;
3118
+ /**
3119
+ * The method name on the given object that will be invoked
3120
+ * @required
3121
+ * @erased
3122
+ */
3123
+ methodName: string;
3124
+ /**
3125
+ * Arguments that will be passed to the specified method
3126
+ * @erased
3127
+ */
3128
+ methodArguments?: unknown[];
3129
+ /**
3130
+ * If any, the results of the method invocation are assigned to the property
3131
+ * @output
3132
+ */
3133
+ methodResult?: unknown;
3134
+ }
3135
+ /**
3136
+ * This operation invokes the specified method on the given object with the given optional arguments
3137
+ * and assigns the result to the `methodResult` operationdata property. When the method returns a
3138
+ * promise, the operation waits for it and assigns the resolved value.
3139
+ *
3140
+ * The operation only calls application code: methods of controllers, of other instances of
3141
+ * application classes, and of plain objects. It refuses, and throws for:
3142
+ * - an `instance` that is a function, the global object (`window`), a document, a DOM node,
3143
+ * a jQuery object, or any other built-in or host object (arrays, maps, promises, `location`,
3144
+ * storage, ...);
3145
+ * - a method that is a built-in (native) function, such as `eval`, `Function`, `setTimeout`,
3146
+ * `setInterval`, `document.write`, `Reflect.apply` or a bound function, or a jQuery function;
3147
+ * - the method names `constructor`, `__proto__` and `prototype`;
3148
+ * - arguments that are such functions.
3149
+ *
3150
+ * These checks stop configuration from reaching the platform's code-executing functions through
3151
+ * this operation. They cannot vouch for what an application method does with its arguments, so
3152
+ * only expose methods that are safe to call with configured data.
3153
+ *
3154
+ * @param operationData
3155
+ * @throws When `instance` is missing or refused, when the method name or the method is refused,
3156
+ * or when the member is not a function. The message names the operation.
3157
+ *
3158
+ * @category Utility
3159
+ */
3160
+ declare const invokeObjectMethod: TOperation<IInvokeObjectMethodOperationData, Omit<IInvokeObjectMethodOperationData, 'methodName' | 'methodArguments'>>;
3161
+ interface IIsElementInViewportOperationData {
3162
+ /**
3163
+ * @dependency
3164
+ */
3165
+ selectedElement: JQuery;
3166
+ /**
3167
+ * @output
3168
+ */
3169
+ isInViewport?: boolean;
3170
+ }
3171
+ /**
3172
+ * Checks if an element is currently visible within the viewport.
3173
+ *
3174
+ * Uses `getBoundingClientRect()` to determine if the element is within the viewport boundaries.
3175
+ *
3176
+ * @returns Operation data with `isInViewport` boolean indicating visibility
3177
+ *
3178
+ * @example
3179
+ * ```typescript
3180
+ * // Check if element is in view
3181
+ * const result = isElementInViewport({
3182
+ * selectedElement: $targetElement
3183
+ * });
3184
+ * // result.isInViewport = true or false
3185
+ * ```
3186
+ *
3187
+ * @category DOM
3188
+ */
3189
+ declare const isElementInViewport: TOperation<IIsElementInViewportOperationData, IIsElementInViewportOperationData>;
3190
+ type StorageType$1 = 'local' | 'session';
3191
+ interface ILoadFromStorageOperationData {
3192
+ /**
3193
+ * @required
3194
+ * @erased
3195
+ */
3196
+ key: string;
3197
+ /**
3198
+ * @required
3199
+ * @erased
3200
+ */
3201
+ storageType: StorageType$1;
3202
+ /**
3203
+ * @output
3204
+ */
3205
+ loadedValue?: any;
3206
+ }
3207
+ /**
3208
+ * Loads data from browser storage (localStorage or sessionStorage).
3209
+ *
3210
+ * Deserializes the stored JSON value. Returns `null` if key doesn't exist.
3211
+ * When `storageType` is omitted, localStorage is used.
3212
+ *
3213
+ * @returns Operation data with `loadedValue` containing the deserialized data
3214
+ * @throws When the key is empty, storageType is not 'local' or 'session', or the stored value is not valid JSON.
3215
+ *
3216
+ * @example
3217
+ * ```typescript
3218
+ * // Load user settings from localStorage
3219
+ * const result = loadFromStorage({
3220
+ * key: 'user-settings',
3221
+ * storageType: 'local'
3222
+ * });
3223
+ * // result.loadedValue = { theme: 'dark', language: 'en' }
3224
+ * ```
3225
+ *
3226
+ * @example
3227
+ * ```typescript
3228
+ * // Load session data
3229
+ * const result = loadFromStorage({
3230
+ * key: 'session-id',
3231
+ * storageType: 'session'
3232
+ * });
3233
+ * // result.loadedValue = 'abc123' or null if not found
3234
+ * ```
3235
+ *
3236
+ * @category Data
3237
+ */
3238
+ declare const loadFromStorage: TOperation<ILoadFromStorageOperationData, Omit<ILoadFromStorageOperationData, 'key' | 'storageType'>>;
3239
+ interface ILoadJSONOperationData {
3240
+ /**
3241
+ * The URL where the JSON will be retrieved from
3242
+ * @required
3243
+ * @erased
3244
+ */
3245
+ url: string;
3246
+ /**
3247
+ * If true, the results will be added to the cache and any subsequent call will use this cache
3248
+ * @erased
3249
+ */
3250
+ cache?: boolean;
3251
+ /**
3252
+ * The JSON retrieved from the given URL
3253
+ * @output
3254
+ */
3255
+ json?: any;
3256
+ }
3257
+ /**
3258
+ * This operation loads a JSON file from the specified url and assigns it to the json
3259
+ * property on the current operation data.
3260
+ *
3261
+ * If the cache property is set to true and a cached value already exists, a copy of it is assigned
3262
+ * instead of re-retrieving it from the url. Mutating the returned json never changes the cache.
3263
+ *
3264
+ * The cache is shared by every engine. It is emptied when the last live engine created by
3265
+ * `EngineFactory` is destroyed; call {@link clearJsonCache} to empty it earlier.
3266
+ *
3267
+ * @throws When the url is empty, the request fails, the server responds with an error status, or the body is not valid JSON.
3268
+ *
3269
+ * @category Utility
3270
+ */
3271
+ declare const loadJson: TOperation<ILoadJSONOperationData, Omit<ILoadJSONOperationData, 'url' | 'cache'>>;
3272
+ interface ILogOperationData {
3273
+ /**
3274
+ * @type=ParameterType:object|ParameterType:string|ParameterType:number|ParameterType:boolean|ParameterType:array
3275
+ * @erased
3276
+ */
3277
+ logValue?: any;
3278
+ /**
3279
+ * @erased
3280
+ */
3281
+ logName?: string;
3282
+ }
3283
+ /**
3284
+ * This operation logs the specified value, or, when no logValue property has been assigned
3285
+ * it will log the current operation data, global data and scope to the console
3286
+ *
3287
+ * @category Utility
3288
+ */
3289
+ declare const log: TOperation<ILogOperationData, Omit<ILogOperationData, 'logValue' | 'logName'>>;
3290
+ interface IMapArrayOperationData {
3291
+ /**
3292
+ * @dependency
3293
+ */
3294
+ arrayData: any[];
3295
+ /**
3296
+ * @required
3297
+ * @erased
3298
+ */
3299
+ mapFunction: (item: any, index?: number) => any;
3300
+ /**
3301
+ * @output
3302
+ */
3303
+ mappedArray?: any[];
3304
+ }
3305
+ /**
3306
+ * Transforms each element of an array using a mapping function.
3307
+ *
3308
+ * Operates on arrayData passed from previous operations.
3309
+ * The mapFunction receives each item and optionally its index.
3310
+ *
3311
+ * @returns Operation data with `mappedArray` containing transformed elements
3312
+ *
3313
+ * @example
3314
+ * ```typescript
3315
+ * // Double each number
3316
+ * const result = mapArray({
3317
+ * arrayData: [1, 2, 3, 4],
3318
+ * mapFunction: (item) => item * 2
3319
+ * });
3320
+ * // result.mappedArray = [2, 4, 6, 8]
3321
+ * ```
3322
+ *
3323
+ * @example
3324
+ * ```typescript
3325
+ * // Extract property from objects
3326
+ * const result = mapArray({
3327
+ * arrayData: [{name: 'Alice', age: 25}, {name: 'Bob', age: 30}],
3328
+ * mapFunction: (item) => item.name
3329
+ * });
3330
+ * // result.mappedArray = ['Alice', 'Bob']
3331
+ * ```
3332
+ *
3333
+ * @example
3334
+ * ```typescript
3335
+ * // Use index in transformation
3336
+ * const result = mapArray({
3337
+ * arrayData: ['a', 'b', 'c'],
3338
+ * mapFunction: (item, index) => `${index}-${item}`
3339
+ * });
3340
+ * // result.mappedArray = ['0-a', '1-b', '2-c']
3341
+ * ```
3342
+ *
3343
+ * @category Array
3344
+ */
3345
+ declare const mapArray: TOperation<IMapArrayOperationData, Omit<IMapArrayOperationData, 'mapFunction'>>;
3346
+ 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
+ interface IMathOperationData {
3349
+ /**
3350
+ * @type=ParameterType:array
3351
+ * @required
3352
+ * @erased
3353
+ */
3354
+ args: (number | string | MathNonFunctionKeys)[];
3355
+ /**
3356
+ * @type=ParameterType:mathfunction
3357
+ * @required
3358
+ * @erased
3359
+ */
3360
+ functionName: MathFunctionKeys;
3361
+ /**
3362
+ * @output
3363
+ */
3364
+ mathResult?: number;
3365
+ }
3366
+ /**
3367
+ * This operation performs the given math function with the specified arguments.
3368
+ *
3369
+ * `args` and `functionName` may contain property chains (`$operationdata.`, `$globaldata.`,
3370
+ * `$scope.`). Only these two inputs are resolved; the rest of the operation data is left as it
3371
+ * is. Arguments that name a Math constant (such as `'PI'`) are replaced by its value.
3372
+ *
3373
+ * @throws When `functionName` is not a function of `Math`, or `args` is not an array.
3374
+ *
3375
+ * @category Utility
3376
+ */
3377
+ declare const math: TOperation<IMathOperationData, Omit<IMathOperationData, 'args' | 'functionName'>>;
3378
+ /**
3379
+ * If the preceeding {@link when} operation evaluates to `true` subsequent operations will
3380
+ * be skipped until an {@link endWhen} operation is encountered.
3381
+ *
3382
+ * @category Control Flow
3383
+ */
3384
+ declare const otherwise: TOperation<Record<string, unknown>>;
3385
+ interface IRemoveClassOperationData {
3386
+ /**
3387
+ * @dependency
3388
+ */
3389
+ selectedElement: JQuery;
3390
+ /**
3391
+ * @type=ParameterType:className
3392
+ * @required
3393
+ * @erased
3394
+ */
3395
+ className: string;
3396
+ }
3397
+ /**
3398
+ * This operation removes the spcified class name from the given selected element.
3399
+ *
3400
+ * @param operationData
3401
+ * @returns
3402
+ * @category DOM
3403
+ */
3404
+ declare const removeClass: TOperation<IRemoveClassOperationData, Omit<IRemoveClassOperationData, 'className'>>;
3405
+ interface IRemoveControllerFromElementOperationData {
3406
+ /**
3407
+ * @dependency
3408
+ */
3409
+ selectedElement: JQuery;
3410
+ /**
3411
+ * @type=ParameterType:controllerName
3412
+ * @required
3413
+ * @erased
3414
+ */
3415
+ controllerName: string;
3416
+ }
3417
+ /**
3418
+ * This operation removes the controller with the specified name from the given selected element.
3419
+ *
3420
+ * @param operationData
3421
+ * @returns
3422
+ *
3423
+ * @category Controller
3424
+ */
3425
+ declare const removeControllerFromElement: TOperation<IRemoveControllerFromElementOperationData, Omit<IRemoveControllerFromElementOperationData, 'controllerName'>>;
3426
+ interface IRemoveElementOperationData {
3427
+ /**
3428
+ * @dependency
3429
+ */
3430
+ selectedElement: JQuery;
3431
+ }
3432
+ /**
3433
+ * This operation removes the given selected element from the DOM.
3434
+ *
3435
+ * Controllers attached to the element or its descendants (by `addControllerToElement`) are
3436
+ * detached first, so their eventbus and window listeners do not outlive the element.
3437
+ *
3438
+ * @throws AggregateError When one or more controller `detach()` calls throw. The element is removed anyway.
3439
+ *
3440
+ * @category DOM
3441
+ */
3442
+ declare const removeElement: TOperation<IRemoveElementOperationData>;
3443
+ interface IRemovePropertiesFromOperationDataOperationData {
3444
+ /**
3445
+ * @required
3446
+ * @erased
3447
+ */
3448
+ propertyNames: string[];
3449
+ }
3450
+ /**
3451
+ * This operation removes the given list of properties from the current operation data.
3452
+ * It will also remove the property `propertyNames` from the result.
3453
+ *
3454
+ * @category Data
3455
+ */
3456
+ declare const removePropertiesFromOperationData: TOperation<IRemovePropertiesFromOperationDataOperationData, Omit<IRemovePropertiesFromOperationDataOperationData, 'propertyNames'>>;
3457
+ interface IReparentElementOperationData {
3458
+ /**
3459
+ * @dependency
3460
+ */
3461
+ selectedElement: JQuery;
3462
+ /**
3463
+ * @type=ParameterType:selector
3464
+ * @required
3465
+ * @erased
3466
+ */
3467
+ newParentSelector: string;
3468
+ }
3469
+ /**
3470
+ * This operation moves the given selected element to the new parent that is defined
3471
+ * by the specified `newParentSelector`. jQuery data, event handlers and attached controllers
3472
+ * are preserved.
3473
+ *
3474
+ * The selector is resolved inside the engine root (the root itself included), the same way
3475
+ * `selectElement` resolves its selector, and must match exactly one element. HTML strings are
3476
+ * not accepted.
3477
+ *
3478
+ * @param operationData
3479
+ * @returns
3480
+ * @throws When the selector is empty or HTML, when the engine root is not available, or when the
3481
+ * selector matches no element or more than one element.
3482
+ *
3483
+ * @category DOM
3484
+ */
3485
+ declare const reparentElement: TOperation<IReparentElementOperationData, Omit<IReparentElementOperationData, 'newParentSelector'>>;
3486
+ interface IReplaceStringOperationData {
3487
+ /**
3488
+ * @dependency
3489
+ */
3490
+ textContent: string;
3491
+ /**
3492
+ * @required
3493
+ * @erased
3494
+ */
3495
+ pattern: string | RegExp;
3496
+ /**
3497
+ * @required
3498
+ * @erased
3499
+ */
3500
+ replacement: string;
3501
+ /**
3502
+ * @output
3503
+ */
3504
+ result?: string;
3505
+ }
3506
+ /**
3507
+ * Replaces occurrences of a pattern in a string (alias for replaceText for string context).
3508
+ *
3509
+ * Like replaceText, a string pattern replaces every occurrence and inserts the replacement
3510
+ * literally (`$&`, `$1` and similar are not expanded). A RegExp pattern follows
3511
+ * `String.prototype.replace`: only a global RegExp replaces every match, and `$` patterns
3512
+ * in the replacement are expanded. Unlike replaceText, the result is written to `result`
3513
+ * and `textContent` is left unchanged.
3514
+ *
3515
+ * @returns Operation data with `result` containing the replaced string
3516
+ * @throws When textContent is missing or the string pattern is empty.
3517
+ *
3518
+ * @example
3519
+ * ```typescript
3520
+ * const result = replaceString({
3521
+ * textContent: 'a-b-c',
3522
+ * pattern: '-',
3523
+ * replacement: '+'
3524
+ * });
3525
+ * // result.result = "a+b+c"
3526
+ * ```
3527
+ *
3528
+ * @category String
3529
+ */
3530
+ declare const replaceString: TOperation<IReplaceStringOperationData, Omit<IReplaceStringOperationData, 'pattern' | 'replacement'>>;
3531
+ interface IReplaceTextOperationData {
3532
+ /**
3533
+ * @dependency
3534
+ */
3535
+ textContent: string;
3536
+ /**
3537
+ * @required
3538
+ * @erased
3539
+ */
3540
+ searchPattern: string | RegExp;
3541
+ /**
3542
+ * @required
3543
+ * @erased
3544
+ */
3545
+ replacement: string;
3546
+ /**
3547
+ * @output
3548
+ */
3549
+ replacementCount?: number;
3550
+ }
3551
+ /**
3552
+ * Finds and replaces text using literal string or regex pattern.
3553
+ *
3554
+ * Operates on textContent passed from previous operations (e.g., getTextContent).
3555
+ * Supports regex patterns with global flag for multiple replacements.
3556
+ * Updates textContent with replaced text and sets replacementCount.
3557
+ *
3558
+ * A string pattern replaces every occurrence and inserts the replacement literally.
3559
+ *
3560
+ * @returns Operation data with updated `textContent` and `replacementCount` indicating number of replacements made
3561
+ * @throws When textContent is missing or the string searchPattern is empty.
3562
+ *
3563
+ * @example
3564
+ * ```typescript
3565
+ * // Replace placeholder with value
3566
+ * const result = replaceText({
3567
+ * textContent: 'Hello {{name}}',
3568
+ * searchPattern: '{{name}}',
3569
+ * replacement: 'John'
3570
+ * });
3571
+ * // result.textContent = "Hello John"
3572
+ * // result.replacementCount = 1
3573
+ * ```
3574
+ *
3575
+ * @example
3576
+ * ```typescript
3577
+ * // Replace with regex pattern
3578
+ * const result = replaceText({
3579
+ * textContent: 'Test 123 and 456',
3580
+ * searchPattern: /\d+/g,
3581
+ * replacement: 'NUM'
3582
+ * });
3583
+ * // result.textContent = "Test NUM and NUM"
3584
+ * // result.replacementCount = 2
3585
+ * ```
3586
+ *
3587
+ * @category Text
3588
+ */
3589
+ declare const replaceText: TOperation<IReplaceTextOperationData, Omit<IReplaceTextOperationData, 'searchPattern' | 'replacement'>>;
3590
+ interface IRequestActionOperationData {
3591
+ /**
3592
+ * @type=ParameterType:actionName
3593
+ * @required
3594
+ * @erased
3595
+ */
3596
+ systemName: string;
3597
+ /**
3598
+ * @type=ParameterType:object
3599
+ * @output
3600
+ */
3601
+ actionInstance?: IAction;
3602
+ }
3603
+ /**
3604
+ * This operation requests an action instance with the specified name and assigns it
3605
+ * to the `actionInstance` property on the current operation data.
3606
+ *
3607
+ * @throws Error naming requestAction and the `systemName` when no action with that
3608
+ * name exists, so the misspelled name is reported here instead of by a later
3609
+ * `startAction` or `endAction`.
3610
+ *
3611
+ * @category Action
3612
+ */
3613
+ declare const requestAction: TOperation<IRequestActionOperationData, Omit<Required<IRequestActionOperationData>, 'systemName'>>;
3614
+ type StorageType = 'local' | 'session';
3615
+ interface ISaveToStorageOperationData {
3616
+ /**
3617
+ * @required
3618
+ * @erased
3619
+ */
3620
+ key: string;
3621
+ /**
3622
+ * @required
3623
+ * @erased
3624
+ */
3625
+ value: any;
3626
+ /**
3627
+ * @required
3628
+ * @erased
3629
+ */
3630
+ storageType: StorageType;
3631
+ }
3632
+ /**
3633
+ * Saves data to browser storage (localStorage or sessionStorage).
3634
+ *
3635
+ * Serializes the value as JSON before storing. Supports any JSON-serializable data type.
3636
+ * Use `null` to store an empty value; `undefined` cannot be stored as JSON and is rejected.
3637
+ * When `storageType` is omitted, localStorage is used.
3638
+ *
3639
+ * @returns Operation data with storage properties erased
3640
+ * @throws When the key is empty, the value is undefined, or storageType is not 'local' or 'session'.
3641
+ *
3642
+ * @example
3643
+ * ```typescript
3644
+ * // Save user settings to localStorage
3645
+ * const result = saveToStorage({
3646
+ * key: 'user-settings',
3647
+ * value: { theme: 'dark', language: 'en' },
3648
+ * storageType: 'local'
3649
+ * });
3650
+ * ```
3651
+ *
3652
+ * @example
3653
+ * ```typescript
3654
+ * // Save session data
3655
+ * const result = saveToStorage({
3656
+ * key: 'session-id',
3657
+ * value: 'abc123',
3658
+ * storageType: 'session'
3659
+ * });
3660
+ * ```
3661
+ *
3662
+ * @category Data
3663
+ */
3664
+ declare const saveToStorage: TOperation<ISaveToStorageOperationData, Omit<ISaveToStorageOperationData, 'key' | 'value' | 'storageType'>>;
3665
+ type ScrollBehavior$1 = 'auto' | 'smooth';
3666
+ type ScrollLogicalPosition = 'start' | 'center' | 'end' | 'nearest';
3667
+ interface IScrollToElementOperationData {
3668
+ /**
3669
+ * @dependency
3670
+ */
3671
+ selectedElement: JQuery;
3672
+ /**
3673
+ * @optional
3674
+ * @erased
3675
+ */
3676
+ behavior?: ScrollBehavior$1;
3677
+ /**
3678
+ * @optional
3679
+ * @erased
3680
+ */
3681
+ block?: ScrollLogicalPosition;
3682
+ /**
3683
+ * @optional
3684
+ * @erased
3685
+ */
3686
+ inline?: ScrollLogicalPosition;
3687
+ }
3688
+ /**
3689
+ * Scrolls the viewport to bring the selected element into view.
3690
+ *
3691
+ * Uses the browser's `scrollIntoView` API with configurable behavior.
3692
+ *
3693
+ * @returns Operation data with scroll properties erased
3694
+ *
3695
+ * @example
3696
+ * ```typescript
3697
+ * // Smooth scroll to element at top of viewport
3698
+ * const result = scrollToElement({
3699
+ * selectedElement: $targetElement,
3700
+ * behavior: 'smooth',
3701
+ * block: 'start'
3702
+ * });
3703
+ * ```
3704
+ *
3705
+ * @example
3706
+ * ```typescript
3707
+ * // Center element in viewport
3708
+ * const result = scrollToElement({
3709
+ * selectedElement: $targetElement,
3710
+ * behavior: 'smooth',
3711
+ * block: 'center'
3712
+ * });
3713
+ * ```
3714
+ *
3715
+ * @category Scroll
3716
+ */
3717
+ declare const scrollToElement: TOperation<IScrollToElementOperationData, Omit<IScrollToElementOperationData, 'behavior' | 'block' | 'inline'>>;
3718
+ type ScrollBehavior = 'auto' | 'smooth';
3719
+ interface IScrollToPositionOperationData {
3720
+ /**
3721
+ * @required
3722
+ * @erased
3723
+ */
3724
+ x: number;
3725
+ /**
3726
+ * @required
3727
+ * @erased
3728
+ */
3729
+ y: number;
3730
+ /**
3731
+ * @optional
3732
+ * @erased
3733
+ */
3734
+ behavior?: ScrollBehavior;
3735
+ }
3736
+ /**
3737
+ * Scrolls the viewport to a specific x,y coordinate position.
3738
+ *
3739
+ * Uses the browser's `window.scrollTo` API with configurable behavior.
3740
+ *
3741
+ * @returns Operation data with scroll properties erased
3742
+ *
3743
+ * @example
3744
+ * ```typescript
3745
+ * // Smooth scroll to position
3746
+ * const result = scrollToPosition({
3747
+ * x: 0,
3748
+ * y: 500,
3749
+ * behavior: 'smooth'
3750
+ * });
3751
+ * ```
3752
+ *
3753
+ * @example
3754
+ * ```typescript
3755
+ * // Instant scroll to top
3756
+ * const result = scrollToPosition({
3757
+ * x: 0,
3758
+ * y: 0
3759
+ * });
3760
+ * ```
3761
+ *
3762
+ * @category Scroll
3763
+ */
3764
+ declare const scrollToPosition: TOperation<IScrollToPositionOperationData, Omit<IScrollToPositionOperationData, 'x' | 'y' | 'behavior'>>;
3765
+ interface ISelectElementOperationData {
3766
+ /**
3767
+ * @type=ParameterType:selector
3768
+ * @required
3769
+ * @erased
3770
+ */
3771
+ selector: string;
3772
+ /**
3773
+ * @erased
3774
+ */
3775
+ useSelectedElementAsRoot?: boolean;
3776
+ /**
3777
+ * @type=ParameterType:object
3778
+ * @output
3779
+ */
3780
+ selectedElement?: JQuery;
3781
+ }
3782
+ /**
3783
+ * This operation selects one or more elements using the specified selector.
3784
+ *
3785
+ * If `useSelectedElementAsRoot` is set to true and a valid DOM element is assigned
3786
+ * to the current operation data's `selectedElement` property
3787
+ * then the element will be looked for only in the descendant elements of this DOM element.
3788
+ *
3789
+ * @category DOM
3790
+ */
3791
+ declare const selectElement: TOperation<ISelectElementOperationData, Omit<ISelectElementOperationData, 'selector' | 'useSelectedElementAsRoot'>>;
3792
+ type TDataTarget = `$scope.${string}` | `$operationdata.${string}` | `$globaldata.${string}`;
3793
+ interface ISetDataOperationData {
3794
+ /**
3795
+ * @required
3796
+ * @erased
3797
+ */
3798
+ properties: Record<TDataTarget, any>;
3799
+ }
3800
+ /**
3801
+ * This operation assigns the specified properties to the specified data targets.
3802
+ *
3803
+ * @example The various ways of assigning data
3804
+ * ```ts
3805
+ * setData({
3806
+ * '$operationdata.foo': '$scope.currentItem', // $scope.currentItem will be assigned to $operationdata.foo
3807
+ * '$globaldata.foo': '$scope.currentItem', // $scope.currentItem will be assigned to $globaldata.foo
3808
+ * '$scope.newIndex': 100, // The constant 100 will be assigned to $scope.newIndex
3809
+ * })
3810
+ * ```
3811
+ *
3812
+ * A `$scope` target with a property chain, such as `$scope.variables.total`, is written to the
3813
+ * nearest scope that declares the chain's first property, the same scope a `$scope` read
3814
+ * resolves from. Inside a `when` or `forEach` block this updates the action's variables.
3815
+ *
3816
+ * @throws When a target is not `$scope`, `$operationdata` or `$globaldata`, when it contains a
3817
+ * forbidden segment, or when the part before the written property does not resolve to an object.
3818
+ *
3819
+ * @category Data
3820
+ */
3821
+ declare const setData: TOperation<ISetDataOperationData, Omit<ISetDataOperationData, 'properties'>>;
3822
+ interface ISetElementAttributesOperationData {
3823
+ /**
3824
+ * @required
3825
+ * @erased
3826
+ */
3827
+ attributes: Record<string, unknown>;
3828
+ /**
3829
+ * @dependency
3830
+ */
3831
+ selectedElement: JQuery;
3832
+ }
3833
+ /**
3834
+ * This operation sets the specified set of attributes on the given selected element.
3835
+ *
3836
+ * Event handler (`on*`) and `srcdoc` attributes, and `javascript:` or `vbscript:` URLs in URL
3837
+ * attributes such as `href`, `src` and `formaction`, are refused, the same as in `createElement`.
3838
+ *
3839
+ * @throws When an attribute is refused. No attribute is set then.
3840
+ *
3841
+ * @category DOM
3842
+ */
3843
+ declare const setElementAttributes: TOperation<ISetElementAttributesOperationData, Omit<ISetElementAttributesOperationData, 'attributes'>>;
3844
+ interface ISetElementContentOperationData {
3845
+ /**
3846
+ * @dependency
3847
+ */
3848
+ selectedElement: JQuery;
3849
+ /**
3850
+ * @erased
3851
+ */
3852
+ template: string | JQuery.Node;
3853
+ /**
3854
+ * overwite = the contents of the selected element are replaced by the given template
3855
+ *
3856
+ * append = the new content will be inserted after the current content
3857
+ *
3858
+ * prepend = the new content will be inserted before the current content
3859
+ *
3860
+ * Defaults to overwrite.
3861
+ *
3862
+ * @erased
3863
+ */
3864
+ insertionType?: 'overwrite' | 'append' | 'prepend';
3865
+ }
3866
+ /**
3867
+ * This operation sets the specified content defined by the value assigned to the template property
3868
+ * to the given selected element.
3869
+ *
3870
+ * When the `insertionType` is set to `overwrite` the contents of the selected element are replaced
3871
+ * by the given template.
3872
+ * When set to `append` the new content will be inserted after the current content.
3873
+ * When set to `prepend` the new content will be inserted before the current content.
3874
+ *
3875
+ * With `overwrite`, controllers attached to the replaced content (by `addControllerToElement`) are
3876
+ * detached first. Controllers on the selected element itself stay attached.
3877
+ *
3878
+ * The template is inserted as HTML: a string template is parsed by jQuery, which also runs the
3879
+ * scripts and inline event handlers it contains. Only use string templates from the configuration
3880
+ * or the resource importer; build content from user data with `createElement`, whose `text` is
3881
+ * never parsed as HTML.
3882
+ *
3883
+ * @throws AggregateError When one or more controller `detach()` calls throw. The content is replaced anyway.
3884
+ * @throws When `insertionType` is not `overwrite`, `append` or `prepend`. Nothing is changed.
3885
+ *
3886
+ * @category DOM
3887
+ */
3888
+ declare const setElementContent: TOperation<ISetElementContentOperationData, Omit<ISetElementContentOperationData, 'template' | 'insertionType'>>;
3889
+ interface ISetFocusOperationData {
3890
+ /**
3891
+ * @dependency
3892
+ */
3893
+ selectedElement: JQuery;
3894
+ }
3895
+ /**
3896
+ * Sets focus to the selected element.
3897
+ *
3898
+ * @category Focus
3899
+ */
3900
+ declare const setFocus: TOperation<ISetFocusOperationData, ISetFocusOperationData>;
3901
+ interface ISetFormValueOperationData {
3902
+ /**
3903
+ * @dependency
3904
+ */
3905
+ selectedElement: JQuery;
3906
+ /**
3907
+ * @required
3908
+ * @erased
3909
+ */
3910
+ value: string | number | boolean;
3911
+ }
3912
+ /**
3913
+ * Sets the value of an input, select, or textarea element.
3914
+ *
3915
+ * Handles different input types appropriately:
3916
+ * - Text inputs, textareas, selects: sets value directly
3917
+ * - Checkboxes: sets checked property for boolean values
3918
+ * - Radio buttons: sets checked property for boolean values
3919
+ * - Number inputs: converts to string
3920
+ *
3921
+ * @example
3922
+ * ```typescript
3923
+ * // Set text input value
3924
+ * const result = setFormValue({selectedElement: $input, value: 'test@example.com'});
3925
+ * // Element value is now 'test@example.com'
3926
+ * ```
3927
+ *
3928
+ * @example
3929
+ * ```typescript
3930
+ * // Set checkbox checked state
3931
+ * const result = setFormValue({selectedElement: $checkbox, value: true});
3932
+ * // Checkbox is now checked
3933
+ * ```
3934
+ *
3935
+ * @category Form
3936
+ */
3937
+ declare const setFormValue: TOperation<ISetFormValueOperationData, Omit<ISetFormValueOperationData, 'value'>>;
3938
+ interface ISetGlobalDataOperationData {
3939
+ /**
3940
+ * @required
3941
+ * @erased
3942
+ */
3943
+ propertyNames: string[];
3944
+ }
3945
+ /**
3946
+ * This operation copies the specified properties from the operationData to the global data.
3947
+ *
3948
+ * Plain data is stored as a deep copy, so changing the operation data afterwards does not change
3949
+ * the global data. jQuery objects, DOM nodes, functions and class instances (such as controllers)
3950
+ * are stored by reference.
3951
+ *
3952
+ * @throws When a property name is `__proto__`, `prototype` or `constructor`.
3953
+ *
3954
+ * @category Data
3955
+ */
3956
+ declare const setGlobalData: TOperation<ISetGlobalDataOperationData, Omit<ISetGlobalDataOperationData, 'propertyNames'>>;
3957
+ interface ISetOperationData {
3958
+ /**
3959
+ * If set to true, the plucked properties replace the current operation data.
3960
+ * @erased
3961
+ */
3962
+ override?: boolean;
3963
+ /**
3964
+ * @required
3965
+ * @erased
3966
+ */
3967
+ properties: Record<string, any>;
3968
+ }
3969
+ /**
3970
+ * This operation assigns the specified properties to the current operation data.
3971
+ * When override is set to true the properties replace the current operation data entirely.
3972
+ *
3973
+ * @category Data
3974
+ */
3975
+ declare const setOperationData: TOperation<ISetOperationData, Omit<ISetOperationData, 'override' | 'properties'>>;
3976
+ interface ISetStyleOperationData {
3977
+ /**
3978
+ * @type=ParameterType:cssProperties
3979
+ * @required
3980
+ * @erased
3981
+ */
3982
+ properties: Record<string, any>;
3983
+ /**
3984
+ * @dependency
3985
+ */
3986
+ selectedElement: JQuery;
3987
+ }
3988
+ /**
3989
+ * This operation assigns the specified CSS style properties to the
3990
+ * given selected element.
3991
+ *
3992
+ * @category DOM
3993
+ */
3994
+ declare const setStyle: TOperation<ISetStyleOperationData, Omit<ISetStyleOperationData, 'properties'>>;
3995
+ interface ISetVariableOperationData {
3996
+ /**
3997
+ * @required
3998
+ * @erased
3999
+ */
4000
+ name: string;
4001
+ /**
4002
+ * @type=ParameterType:object|ParameterType:string|ParameterType:number|ParameterType:boolean|ParameterType:array
4003
+ * @required
4004
+ * @erased
4005
+ */
4006
+ value: any;
4007
+ }
4008
+ /**
4009
+ * This operation sets a variable with the specified name on the scope with the specified value.
4010
+ *
4011
+ * Variables belong to the action: a variable set inside a `when` or `forEach` block is the
4012
+ * same variable outside it, so it keeps its value after `endWhen` or `endForEach`, and
4013
+ * variables set before the block can be read and changed inside it. Read variables with
4014
+ * `$scope.variables.<name>`.
4015
+ *
4016
+ * @throws When the name is `__proto__`, `prototype` or `constructor`.
4017
+ *
4018
+ * @category Data
4019
+ */
4020
+ declare const setVariable: TOperation<ISetVariableOperationData, Omit<ISetVariableOperationData, 'name' | 'value'>>;
4021
+ type SortOrder = 'asc' | 'desc';
4022
+ interface ISortArrayOperationData {
4023
+ /**
4024
+ * @dependency
4025
+ */
4026
+ arrayData: any[];
4027
+ /**
4028
+ * @optional
4029
+ * @erased
4030
+ */
4031
+ sortProperty?: string;
4032
+ /**
4033
+ * @optional
4034
+ * @erased
4035
+ */
4036
+ sortOrder?: SortOrder;
4037
+ /**
4038
+ * @optional
4039
+ * @erased
4040
+ */
4041
+ sortComparator?: (a: any, b: any) => number;
4042
+ /**
4043
+ * @output
4044
+ */
4045
+ sortedArray?: any[];
4046
+ }
4047
+ /**
4048
+ * Sorts an array by property, natural order, or custom comparator function.
4049
+ *
4050
+ * Operates on arrayData passed from previous operations.
4051
+ * Supports three sorting modes:
4052
+ * 1. Property sort: `sortProperty` and `sortOrder` to sort objects by property
4053
+ * 2. Natural sort: `sortOrder` alone for primitive arrays
4054
+ * 3. Custom comparator: `sortComparator` function for complex sorting logic
4055
+ *
4056
+ * @returns Operation data with `sortedArray` containing sorted results
4057
+ *
4058
+ * @example
4059
+ * ```typescript
4060
+ * // Sort objects by property
4061
+ * const result = sortArray({
4062
+ * arrayData: [{name: 'Bob', age: 30}, {name: 'Alice', age: 25}],
4063
+ * sortProperty: 'age',
4064
+ * sortOrder: 'asc'
4065
+ * });
4066
+ * // result.sortedArray = [{name: 'Alice', age: 25}, {name: 'Bob', age: 30}]
4067
+ * ```
4068
+ *
4069
+ * @example
4070
+ * ```typescript
4071
+ * // Sort primitives
4072
+ * const result = sortArray({
4073
+ * arrayData: [5, 2, 8, 1],
4074
+ * sortOrder: 'desc'
4075
+ * });
4076
+ * // result.sortedArray = [8, 5, 2, 1]
4077
+ * ```
4078
+ *
4079
+ * @example
4080
+ * ```typescript
4081
+ * // Custom comparator
4082
+ * const result = sortArray({
4083
+ * arrayData: ['apple', 'Banana', 'cherry'],
4084
+ * sortComparator: (a, b) => a.toLowerCase().localeCompare(b.toLowerCase())
4085
+ * });
4086
+ * ```
4087
+ *
4088
+ * @category Array
4089
+ */
4090
+ declare const sortArray: TOperation<ISortArrayOperationData, Omit<ISortArrayOperationData, 'sortProperty' | 'sortOrder' | 'sortComparator'>>;
4091
+ interface ISplitStringOperationData {
4092
+ /**
4093
+ * @dependency
4094
+ */
4095
+ textContent: string;
4096
+ /**
4097
+ * @required
4098
+ * @erased
4099
+ */
4100
+ delimiter: string | RegExp;
4101
+ /**
4102
+ * @optional
4103
+ * @erased
4104
+ */
4105
+ limit?: number;
4106
+ /**
4107
+ * @output
4108
+ */
4109
+ resultArray?: string[];
4110
+ }
4111
+ /**
4112
+ * Splits a string into an array by delimiter (string or regex).
4113
+ *
4114
+ * @returns Operation data with `resultArray` containing the split strings
4115
+ *
4116
+ * @example
4117
+ * ```typescript
4118
+ * const result = splitString({
4119
+ * textContent: 'apple,banana,cherry',
4120
+ * delimiter: ','
4121
+ * });
4122
+ * // result.resultArray = ['apple', 'banana', 'cherry']
4123
+ * ```
4124
+ *
4125
+ * @category String
4126
+ */
4127
+ declare const splitString: TOperation<ISplitStringOperationData, Omit<ISplitStringOperationData, 'delimiter' | 'limit'>>;
4128
+ interface IStartActionOperationData {
4129
+ /**
4130
+ * @dependency
4131
+ */
4132
+ actionInstance: IAction;
4133
+ /**
4134
+ * @type=ParameterType:object
4135
+ * @erased
4136
+ */
4137
+ actionOperationData?: TOperationData;
4138
+ }
4139
+ /**
4140
+ * This operation starts the specified action instance using the given action operation data.
4141
+ *
4142
+ * The action receives its own copy of the current operation data merged with the action
4143
+ * operation data. Whatever the action's operations add, change or remove in that copy stays
4144
+ * with the action: once it has completed, this operation continues with the operation data it
4145
+ * had before, plus `actionInstance`, without the `actionOperationData` property.
4146
+ *
4147
+ * @category Action
4148
+ */
4149
+ declare const startAction: TOperation<IStartActionOperationData, Omit<IStartActionOperationData, 'actionOperationData'>>;
4150
+ interface ISubstringTextOperationData {
4151
+ /**
4152
+ * @dependency
4153
+ */
4154
+ textContent: string;
4155
+ /**
4156
+ * @required
4157
+ * @erased
4158
+ */
4159
+ start: number;
4160
+ /**
4161
+ * @optional
4162
+ * @erased
4163
+ */
4164
+ end?: number;
4165
+ /**
4166
+ * @output
4167
+ */
4168
+ substring?: string;
4169
+ }
4170
+ /**
4171
+ * Extracts a substring from text between start and end indices.
4172
+ *
4173
+ * @returns Operation data with `substring` containing the extracted text
4174
+ *
4175
+ * @example
4176
+ * ```typescript
4177
+ * const result = substringText({
4178
+ * textContent: 'Hello World',
4179
+ * start: 0,
4180
+ * end: 5
4181
+ * });
4182
+ * // result.substring = "Hello"
4183
+ * ```
4184
+ *
4185
+ * @category Text
4186
+ */
4187
+ declare const substringText: TOperation<ISubstringTextOperationData, Omit<ISubstringTextOperationData, 'start' | 'end'>>;
4188
+ interface IToggleClassOperationData {
4189
+ /**
4190
+ * The element on which the class will be toggled
4191
+ * @dependency
4192
+ */
4193
+ selectedElement: JQuery;
4194
+ /**
4195
+ * The class that will be toggled
4196
+ * @type=ParameterType:className
4197
+ * @required
4198
+ * @erased
4199
+ */
4200
+ className: string;
4201
+ }
4202
+ /**
4203
+ * This operation toggles the specfied class name on the given selected element.
4204
+ *
4205
+ * Meaning, if the specified class name exists on the given element it will be removed,
4206
+ * otherwise it will be added.
4207
+ *
4208
+ * @category DOM
4209
+ */
4210
+ declare const toggleClass: TOperation<IToggleClassOperationData, Omit<IToggleClassOperationData, 'className'>>;
4211
+ interface IToggleElementOperationData {
4212
+ /**
4213
+ * The element whose visibility will be toggled
4214
+ * @dependency
4215
+ */
4216
+ selectedElement: JQuery;
4217
+ }
4218
+ /**
4219
+ * This operation toggles the visibility of the given selected element.
4220
+ *
4221
+ * Meaning, if the element is hidden, it will be made visible, otherwise
4222
+ * it will be hidden.
4223
+ *
4224
+ * @category DOM
4225
+ */
4226
+ declare const toggleElement: TOperation<IToggleElementOperationData>;
4227
+ interface IToggleFormElementOperationData {
4228
+ /**
4229
+ * @dependency
4230
+ */
4231
+ selectedElement: JQuery;
4232
+ /**
4233
+ * @required
4234
+ * @erased
4235
+ */
4236
+ enabled: boolean;
4237
+ }
4238
+ /**
4239
+ * Enables or disables form input elements (inputs, selects, textareas, buttons).
4240
+ *
4241
+ * Sets the `disabled` property on the element. When `enabled` is true, removes the disabled
4242
+ * attribute; when false, adds the disabled attribute.
4243
+ *
4244
+ * @example
4245
+ * ```typescript
4246
+ * // Disable an input field
4247
+ * toggleFormElement({selectedElement: $input, enabled: false});
4248
+ * // Input is now disabled
4249
+ * ```
4250
+ *
4251
+ * @example
4252
+ * ```typescript
4253
+ * // Enable a previously disabled button
4254
+ * toggleFormElement({selectedElement: $button, enabled: true});
4255
+ * // Button is now enabled
4256
+ * ```
4257
+ *
4258
+ * @category Form
4259
+ */
4260
+ declare const toggleFormElement: TOperation<IToggleFormElementOperationData, Omit<IToggleFormElementOperationData, 'enabled'>>;
4261
+ interface IValidationRules {
4262
+ required?: boolean;
4263
+ minLength?: number;
4264
+ maxLength?: number;
4265
+ pattern?: string | RegExp;
4266
+ email?: boolean;
4267
+ }
4268
+ interface IValidateFormOperationData {
4269
+ /**
4270
+ * @dependency
4271
+ */
4272
+ selectedElement: JQuery;
4273
+ /**
4274
+ * @erased
4275
+ */
4276
+ validationRules?: Record<string, IValidationRules>;
4277
+ /**
4278
+ * @output
4279
+ * @type=ParameterType:object
4280
+ */
4281
+ validationErrors?: Record<string, string>;
4282
+ /**
4283
+ * @output
4284
+ */
4285
+ isValid?: boolean;
4286
+ }
4287
+ /**
4288
+ * Validates form fields against HTML5 validation and custom rules.
4289
+ *
4290
+ * Uses HTML5 validation API (checkValidity()) for native validation, and supports
4291
+ * custom validation rules for: required, minLength, maxLength, pattern (regex), and email format.
4292
+ *
4293
+ * Checkboxes and radio buttons are validated once per name: `required` passes when at least one
4294
+ * of them is checked, and the string rules do not apply to them. For a `<select multiple>`,
4295
+ * `required`, `minLength` and `maxLength` count the selected options, and `pattern` and `email`
4296
+ * apply to each selected value.
4297
+ *
4298
+ * @returns Operation data with `validationErrors` object (field names → error messages) and `isValid` boolean
4299
+ *
4300
+ * @example
4301
+ * ```typescript
4302
+ * // Validate with HTML5 validation
4303
+ * const result = validateForm({selectedElement: $form});
4304
+ * // Returns: {isValid: true, validationErrors: {}}
4305
+ * ```
4306
+ *
4307
+ * @example
4308
+ * ```typescript
4309
+ * // Validate with custom rules
4310
+ * const result = validateForm({
4311
+ * selectedElement: $form,
4312
+ * validationRules: {
4313
+ * password: { required: true, minLength: 8 },
4314
+ * email: { email: true }
4315
+ * }
4316
+ * });
4317
+ * // Returns: {isValid: false, validationErrors: {password: "Must be at least 8 characters"}}
4318
+ * ```
4319
+ *
4320
+ * @category Form
4321
+ */
4322
+ declare const validateForm: TOperation<IValidateFormOperationData, Omit<IValidateFormOperationData, 'validationRules'>>;
4323
+ interface IWaitOperationData {
4324
+ /**
4325
+ * The amount of milliseconds the operation will wait for.
4326
+ * @required
4327
+ * @erased
4328
+ */
4329
+ milliseconds: number;
4330
+ }
4331
+ /**
4332
+ * This operation waits for the specified amount of milliseconds.
4333
+ *
4334
+ * @category Utility
4335
+ */
4336
+ declare const wait: TOperation<IWaitOperationData, Omit<IWaitOperationData, 'milliseconds'>>;
4337
+ /**
4338
+ * A condition expression, see {@link when} for the grammar.
4339
+ */
4340
+ type TExpression = string;
4341
+ interface IWhenOperationData {
4342
+ /**
4343
+ * @type=ParameterType:expression
4344
+ * @required
4345
+ * @erased
4346
+ */
4347
+ expression: TExpression;
4348
+ }
4349
+ /**
4350
+ * When the given expression evaluates to false, subsequent operations will be skipped
4351
+ * until an {@link endWhen} or {@link otherwise} operation is encountered.
4352
+ *
4353
+ * Practically, this means an `if` or `if`/`else` statement control flow implementation in a list of operations.
4354
+ *
4355
+ * The expression is passed in as a formatted string. An operand can be one of:
4356
+ *
4357
+ * 'constant': for a constant string (operators and parentheses inside the quotes are text)
4358
+ * 100: for a constant number (the whole operand must be numeric, `10px` is invalid)
4359
+ * true, false, null: for a boolean or null constant
4360
+ * $operationData.foo: for an operation data value
4361
+ * $globaldata.foo: for a global data value
4362
+ * $scope.loopIndex: for a scope value
4363
+ * $scope.variables.foo: for a variable set with `setVariable`
4364
+ *
4365
+ * Any other operand is an error, so a misspelled chain prefix fails instead of being compared
4366
+ * as a string.
4367
+ *
4368
+ * Operands are combined with these operators, from highest to lowest precedence:
4369
+ *
4370
+ * `!`: negation
4371
+ * `==`, `!=`, `>`, `<`, `>=`, `<=`: comparison (`==` and `!=` compare strictly, without type
4372
+ * conversion; comparisons do not chain, so write `0<$scope.loopIndex && $scope.loopIndex<5`)
4373
+ * `&&`: and
4374
+ * `||`: or
4375
+ *
4376
+ * Parentheses group. A bare operand is true when its value is truthy, so `'false'` and `'0'`
4377
+ * are true and `0`, `''`, `null` and a missing value are false. `!`, `&&` and `||` always
4378
+ * produce `true` or `false`. `!` binds tighter than a comparison: `!$operationdata.a==1`
4379
+ * compares `!$operationdata.a` with 1, write `!($operationdata.a==1)` to negate the comparison.
4380
+ * `&&` and `||` short-circuit: when the left side decides the result, the right side is not
4381
+ * resolved, so `$operationdata.user && $operationdata.user.name=='John'` does not fail when
4382
+ * `user` is missing.
4383
+ *
4384
+ * Arithmetic (`+`, `-`, `*`, `/`) is not supported: `-` is a valid character in a property
4385
+ * chain, so `$operationdata.a-1` would be ambiguous. Nothing in the expression is executed as
4386
+ * code, and property chains are resolved with the usual prototype-pollution and global-object
4387
+ * guards.
4388
+ *
4389
+ * @example
4390
+ * $scope.variables.foo=='bar'
4391
+ * @example
4392
+ * $operationdata.isValid==true
4393
+ * @example
4394
+ * $globalData.foo>$scope.variables.bar
4395
+ * @example
4396
+ * $operationData.foo!=100
4397
+ * @example
4398
+ * $scope.variables.position>=10 && $scope.variables.position<12
4399
+ * @example
4400
+ * ($scope.variables.answered && $scope.variables.score>=5) || $scope.variables.skipped
4401
+ * @example
4402
+ * !$operationdata.isHidden
4403
+ * @example
4404
+ * $operationdata.label=='a && b' || $operationdata.label=='(none)'
4405
+ *
4406
+ * @param operationData
4407
+ * @returns
4408
+ * @throws When the expression is not a string or is empty, an operand is not one of the forms
4409
+ * above, a string is not closed, an operator is unknown or misplaced, or parentheses do not
4410
+ * balance. The message names the problem, its 0-based position and the expression, for example
4411
+ * `when: unexpected ')' at position 4 in expression '1==1)'.`
4412
+ *
4413
+ * @category Control Flow
4414
+ */
4415
+ declare const when: TOperation<IWhenOperationData, Omit<IWhenOperationData, 'expression'>>;
4416
+ declare namespace index_d_exports {
4417
+ export { ExtractOperationData, ExtractReturnedOperationData, IAddClassOperationData, IAddControllerToElementOperationData, IAnimateOperationData, IAnimateWithClassOperationData, IAnnounceToScreenReaderOperationData, IBroadcastEventOperationData, ICalcOperationData, IClearElementOperationData, IClearOperationDataOperationData, IClearStorageOperationData, ICompareDateOperationData, IConcatenateStringsOperationData, ICreateElementOperationData, ICustomFunctionOperationData, IEndActionOperationData, IExtendControllerOperationData, IFilterArrayOperationData, IFindInArrayOperationData, IForEachOperationData, IFormatDateOperationData, IFormatTextOperationData, IGetAttributesFromElementOperationData, IGetControllerFromElementOperationData, IGetControllerInstanceOperationData, IGetCurrentTimeOperationData, IGetElementDimensionsOperationData, IGetFocusedElementOperationData, IGetFormDataOperationData, IGetImportOperationData, IGetQueryParamsOperationData, IGetScrollPositionOperationData, IGetTextContentOperationData, IHttpDeleteOperationData, IHttpPostOperationData, IHttpPutOperationData, IInvokeObjectMethodOperationData, IIsElementInViewportOperationData, ILoadFromStorageOperationData, ILoadJSONOperationData, ILogOperationData, IMapArrayOperationData, IMathOperationData, IOperationScope, IRemoveClassOperationData, IRemoveControllerFromElementOperationData, IRemoveElementOperationData, IRemovePropertiesFromOperationDataOperationData, IReparentElementOperationData, IReplaceStringOperationData, IReplaceTextOperationData, IRequestActionOperationData, ISaveToStorageOperationData, IScrollToElementOperationData, IScrollToPositionOperationData, ISelectElementOperationData, ISetDataOperationData, ISetElementAttributesOperationData, ISetElementContentOperationData, ISetFocusOperationData, ISetFormValueOperationData, ISetGlobalDataOperationData, ISetOperationData, ISetStyleOperationData, ISetVariableOperationData, ISortArrayOperationData, ISplitStringOperationData, IStartActionOperationData, ISubstringTextOperationData, IToggleClassOperationData, IToggleElementOperationData, IToggleFormElementOperationData, IValidateFormOperationData, IWaitOperationData, IWhenOperationData, StorageType$2 as StorageType, TOperation, TOperationData, TOperationResult, addClass, addControllerToElement, addGlobalsToOperation, animate, animateWithClass, announceToScreenReader, breakForEach, broadcastEvent, calc, clearElement, clearOperationData, clearStorage, compareDate, concatenateStrings, continueForEach, createElement, customFunction, endAction, endForEach, endWhen, extendController, filterArray, findInArray, forEach, formatDate, formatText, getAttributesFromElement, getControllerFromElement, getControllerInstance, getCurrentTime, getElementDimensions, getFocusedElement, getFormData, getImport, getQueryParams, getScrollPosition, getTextContent, httpDelete, httpPost, httpPut, invokeObjectMethod, isElementInViewport, loadFromStorage, loadJson, log, mapArray, math, otherwise, removeClass, removeControllerFromElement, removeElement, removePropertiesFromOperationData, reparentElement, replaceString, replaceText, requestAction, saveToStorage, scrollToElement, scrollToPosition, selectElement, setData, setElementAttributes, setElementContent, setFocus, setFormValue, setGlobalData, setOperationData, setStyle, setVariable, sortArray, splitString, startAction, substringText, toggleClass, toggleElement, toggleFormElement, validateForm, wait, when };
4418
+ }
4419
+ /**
4420
+ * Represents a language option for the available languages list.
4421
+ * Used for UI elements like language selection dropdowns.
4422
+ */
4423
+ interface ILabel {
4424
+ id: string;
4425
+ languageCode: TLanguageCode;
4426
+ label: string;
4427
+ }
4428
+ type Controllers = typeof index_d_exports$1;
4429
+ type TControllerName = keyof Controllers;
4430
+ type TControllerType = Controllers[TControllerName];
4431
+ type GetControllerByName<T extends TControllerName> = Controllers[T];
4432
+ type Operations = typeof index_d_exports;
4433
+ type TOperationName = keyof Operations;
4434
+ type TOperationType = Operations[TOperationName];
4435
+ type GetOperationByName<T extends TOperationName> = Operations[T];
4436
+ type ExtractOperationDataType<P> = P extends TOperation<infer T, any> ? T : never;
4437
+ /**
4438
+ * Engine identification information.
4439
+ */
4440
+ interface IEngineInfo {
4441
+ /** Name of the engine system to use */
4442
+ systemName: string;
4443
+ }
4444
+ /**
4445
+ * Provider settings indexed by timeline type.
4446
+ * Allows different configurations for 'animation' vs 'mediaplayer' timelines.
4447
+ * A single timeline can override them with its own `positionSource` and
4448
+ * `containerProvider` (see {@link ITimelineConfiguration.positionSource}).
4449
+ */
4450
+ type TTimelineProviderSettings = Partial<Record<TimelineTypes, ITimelineProviderSettings>>;
4451
+ /**
4452
+ * Root configuration for the Eligius timeline engine.
4453
+ *
4454
+ * This is the main configuration object passed to `EngineFactory.createEngine()`.
4455
+ * It defines all aspects of the engine: timelines, actions, language settings, and more.
4456
+ *
4457
+ * @example
4458
+ * ```typescript
4459
+ * const config: IEngineConfiguration = {
4460
+ * id: '123e4567-e89b-12d3-a456-426614174000',
4461
+ * engine: { systemName: 'EligiusEngine' },
4462
+ * containerSelector: '#eligius-container',
4463
+ * cssFiles: ['styles/main.css'],
4464
+ * language: 'en-US',
4465
+ * layoutTemplate: '<div class="container"></div>',
4466
+ * availableLanguages: [{ id: 'en', languageCode: 'en-US', label: 'English' }],
4467
+ * initActions: [],
4468
+ * actions: [],
4469
+ * timelines: []
4470
+ * };
4471
+ * ```
4472
+ */
4473
+ interface IEngineConfiguration {
4474
+ /** Unique identifier for the configuration (UUID format) */
4475
+ id: string;
4476
+ /** Engine identification info */
4477
+ engine: IEngineInfo;
4478
+ /** Optional settings for timeline providers by type */
4479
+ timelineProviderSettings?: TTimelineProviderSettings;
4480
+ /** CSS selector for the main container element */
4481
+ containerSelector: string;
4482
+ /** Array of CSS file paths to load */
4483
+ cssFiles: string[];
4484
+ /** Default language code (IETF language tag) */
4485
+ language: TLanguageCode;
4486
+ /** HTML template for the layout (inline HTML or template reference) */
4487
+ layoutTemplate: string;
4488
+ /** List of available languages for the application */
4489
+ availableLanguages: ILabel[];
4490
+ /** Actions to execute during engine initialization */
4491
+ initActions: IEndableActionConfiguration[];
4492
+ /** Reusable action templates */
4493
+ actions: IEndableActionConfiguration[];
4494
+ /** Optional actions triggered by events */
4495
+ eventActions?: IEventActionConfiguration[];
4496
+ /** Timeline configurations */
4497
+ timelines: ITimelineConfiguration[];
4498
+ /** Optional timeline flow configuration for navigation between timelines */
4499
+ timelineFlow?: ITimelineFlow;
4500
+ /** Locale configuration for rosetta-based translations */
4501
+ locales?: ILocalesConfiguration;
4502
+ }
4503
+ interface IResolvedEngineConfiguration {
4504
+ id: string;
4505
+ engine: IEngineInfo;
4506
+ timelineProviderSettings: TTimelineProviderSettings;
4507
+ containerSelector: string;
4508
+ cssFiles: string[];
4509
+ language: TLanguageCode;
4510
+ layoutTemplate: string;
4511
+ availableLanguages: ILabel[];
4512
+ initActions: IEndableAction[];
4513
+ actions: IEndableAction[];
4514
+ timelines: IResolvedTimelineConfiguration[];
4515
+ timelineFlow?: ITimelineFlow;
4516
+ }
4517
+ interface IResolvedActionConfiguration {
4518
+ id: string;
4519
+ name: string;
4520
+ startOperations: IResolvedOperation[];
4521
+ }
4522
+ interface IResolvedEndableActionConfiguration extends IResolvedActionConfiguration {
4523
+ endOperations: IResolvedOperation[];
4524
+ }
4525
+ /**
4526
+ * Configuration for timeline flow navigation.
4527
+ *
4528
+ * Defines how timelines connect and transition between each other.
4529
+ * Currently a placeholder type for future implementation.
4530
+ */
4531
+ type ITimelineFlow = Record<string, never>;
4532
+ /**
4533
+ * Configuration for a position source.
4534
+ *
4535
+ * Position sources drive timeline position. They are resolved dynamically
4536
+ * via the resource importer using the `systemName` property.
4537
+ *
4538
+ * Built-in position sources:
4539
+ * - `RafPositionSource`: RAF-based, drives timeline by elapsed time
4540
+ * - `ScrollPositionSource`: Scroll-based, drives timeline by scroll position
4541
+ * - `VideoPositionSource`: native HTML video element, drives timeline by media playback
4542
+ *
4543
+ * @example
4544
+ * ```typescript
4545
+ * // RAF-based position source
4546
+ * const rafConfig: IPositionSourceConfig = {
4547
+ * systemName: 'RafPositionSource',
4548
+ * tickInterval: 100,
4549
+ * };
4550
+ *
4551
+ * // Scroll-based position source
4552
+ * const scrollConfig: IPositionSourceConfig = {
4553
+ * systemName: 'ScrollPositionSource',
4554
+ * selector: '.scroll-container',
4555
+ * };
4556
+ *
4557
+ * // Video-based position source
4558
+ * const videoConfig: IPositionSourceConfig = {
4559
+ * systemName: 'VideoPositionSource',
4560
+ * selector: '#video-player',
4561
+ * sources: [{src: '/intro.mp4', type: 'video/mp4'}],
4562
+ * poster: '/poster.jpg',
4563
+ * };
4564
+ * ```
4565
+ */
4566
+ interface IPositionSourceConfig {
4567
+ /**
4568
+ * Name of the position source class to instantiate.
4569
+ * Resolved via the resource importer.
4570
+ *
4571
+ * Built-in options: 'RafPositionSource', 'ScrollPositionSource', 'VideoPositionSource'
4572
+ */
4573
+ systemName: string;
4574
+ /**
4575
+ * CSS selector for sources that need a DOM element (scroll, video).
4576
+ */
4577
+ selector?: string;
4578
+ /**
4579
+ * Interval between position updates in milliseconds (RAF sources).
4580
+ *
4581
+ * The default of 100 ms matches the 0.1 second precision at which actions
4582
+ * are keyed. A larger interval emits fewer position updates (less work per
4583
+ * second), but actions then start and end up to one interval late. Earlier
4584
+ * releases defaulted to 1000.
4585
+ *
4586
+ * @default 100
4587
+ */
4588
+ tickInterval?: number;
4589
+ /**
4590
+ * Media to load (video sources), each with its URL and MIME type, in order
4591
+ * of preference. `VideoPositionSource` requires a non-empty list of
4592
+ * browser-playable media files (video or audio, for example MP4, WebM or
4593
+ * MP3).
4594
+ */
4595
+ sources?: Array<{
4596
+ src: string;
4597
+ type: string;
4598
+ }>;
4599
+ /**
4600
+ * Optional poster image URL (video sources).
4601
+ */
4602
+ poster?: string;
4603
+ /**
4604
+ * Milliseconds `VideoPositionSource` waits for a source to become playable
4605
+ * before `init()` rejects. `0` disables the limit.
4606
+ *
4607
+ * @default 30000
4608
+ */
4609
+ loadTimeout?: number;
4610
+ /**
4611
+ * Additional configuration options passed to the position source constructor.
4612
+ * Use this for custom position source implementations.
4613
+ * `VideoPositionSource` rejects an `options` key (removed in 4.0.0).
4614
+ */
4615
+ [key: string]: unknown;
4616
+ }
4617
+ /**
4618
+ * Configuration for a container provider.
4619
+ *
4620
+ * Container providers manage DOM elements where timeline content is rendered.
4621
+ * They are resolved dynamically via the resource importer using `systemName`.
4622
+ *
4623
+ * Built-in container providers:
4624
+ * - `DomContainerProvider`: Manages a DOM element by selector
4625
+ *
4626
+ * @example
4627
+ * ```typescript
4628
+ * const config: IContainerProviderConfig = {
4629
+ * systemName: 'DomContainerProvider',
4630
+ * selector: '#render-area',
4631
+ * };
4632
+ * ```
4633
+ */
4634
+ interface IContainerProviderConfig {
4635
+ /**
4636
+ * Name of the container provider class to instantiate.
4637
+ * Resolved via the resource importer.
4638
+ *
4639
+ * Built-in options: 'DomContainerProvider'
4640
+ */
4641
+ systemName: string;
4642
+ /** CSS selector for the container element */
4643
+ selector: string;
4644
+ /**
4645
+ * Additional configuration options passed to the container provider constructor.
4646
+ * Use this for custom container provider implementations.
4647
+ */
4648
+ [key: string]: unknown;
4649
+ }
4650
+ /**
4651
+ * Configuration for a playlist.
4652
+ *
4653
+ * Playlists manage collections of items (e.g., video chapters) that can be
4654
+ * selected and navigated. They are resolved dynamically via the resource
4655
+ * importer using `systemName`.
4656
+ *
4657
+ * Built-in playlists:
4658
+ * - `SimplePlaylist`: Basic playlist with array of items
4659
+ *
4660
+ * @typeParam TItem - The type of items in the playlist
4661
+ *
4662
+ * @example
4663
+ * ```typescript
4664
+ * const config: IPlaylistConfig = {
4665
+ * systemName: 'SimplePlaylist',
4666
+ * items: [{ uri: '/video1.mp4' }, { uri: '/video2.mp4' }],
4667
+ * identifierKey: 'uri',
4668
+ * };
4669
+ * ```
4670
+ */
4671
+ interface IPlaylistConfig<TItem = unknown> {
4672
+ /**
4673
+ * Name of the playlist class to instantiate.
4674
+ * Resolved via the resource importer.
4675
+ *
4676
+ * Built-in options: 'SimplePlaylist'
4677
+ */
4678
+ systemName: string;
4679
+ /** The items in the playlist */
4680
+ items: TItem[];
4681
+ /**
4682
+ * Property key used to identify items.
4683
+ * Used when selecting items by identifier (e.g., 'uri', 'id', 'chapterId').
4684
+ */
4685
+ identifierKey: string;
4686
+ /**
4687
+ * Additional configuration options passed to the playlist constructor.
4688
+ * Use this for custom playlist implementations.
4689
+ */
4690
+ [key: string]: unknown;
4691
+ }
4692
+ /**
4693
+ * Settings for a timeline provider.
4694
+ *
4695
+ * Timeline providers are assembled from decomposed components:
4696
+ * - Position source: drives timeline position (required)
4697
+ * - Container provider: manages render container (optional)
4698
+ * - Playlist: manages multi-item navigation (optional)
4699
+ *
4700
+ * All components are resolved dynamically via the resource importer using
4701
+ * the `systemName` property, allowing custom implementations.
4702
+ *
4703
+ * @example
4704
+ * ```typescript
4705
+ * const settings: ITimelineProviderSettings = {
4706
+ * positionSource: { systemName: 'RafPositionSource', tickInterval: 100 },
4707
+ * container: { systemName: 'DomContainerProvider', selector: '#render-area' },
4708
+ * };
4709
+ * ```
4710
+ */
4711
+ interface ITimelineProviderSettings {
4712
+ /** Configuration for the position source */
4713
+ positionSource: IPositionSourceConfig;
4714
+ /** Optional container provider configuration */
4715
+ container?: IContainerProviderConfig;
4716
+ /** Optional playlist configuration */
4717
+ playlist?: IPlaylistConfig;
4718
+ }
4719
+ interface IResolvedTimelineConfiguration {
4720
+ id: string;
4721
+ uri: string;
4722
+ type: TimelineTypes;
4723
+ duration: number;
4724
+ loop: boolean;
4725
+ selector: string;
4726
+ timelineActions: ITimelineAction[];
4727
+ /**
4728
+ * Optional container selector for the timeline.
4729
+ * Defaults to the timeline selector if not specified.
4730
+ */
4731
+ container?: string;
4732
+ /** See {@link ITimelineConfiguration.positionSource} */
4733
+ positionSource?: Partial<IPositionSourceConfig>;
4734
+ /** See {@link ITimelineConfiguration.containerProvider} */
4735
+ containerProvider?: Partial<IContainerProviderConfig>;
4736
+ }
4737
+ /**
4738
+ * Configuration for a single timeline.
4739
+ *
4740
+ * A timeline represents a time-based sequence of actions that can be played,
4741
+ * paused, and seeked. Multiple timelines can exist in a configuration.
4742
+ *
4743
+ * @example
4744
+ * ```typescript
4745
+ * const timeline: ITimelineConfiguration = {
4746
+ * id: 'main-timeline',
4747
+ * uri: 'timeline://main',
4748
+ * type: 'animation',
4749
+ * duration: 60,
4750
+ * loop: false,
4751
+ * selector: '#timeline-container',
4752
+ * timelineActions: []
4753
+ * };
4754
+ * ```
4755
+ */
4756
+ interface ITimelineConfiguration {
4757
+ /** Unique identifier for the timeline */
4758
+ id: string;
4759
+ /** URI for timeline identification and switching */
4760
+ uri: string;
4761
+ /**
4762
+ * Timeline type: 'animation' or 'mediaplayer'. Selects the provider
4763
+ * settings in `timelineProviderSettings`, which `positionSource` and
4764
+ * `containerProvider` can override for this timeline.
4765
+ */
4766
+ type: TimelineTypes;
4767
+ /** Duration in seconds */
4768
+ duration: number;
4769
+ /** Whether the timeline should loop when complete */
4770
+ loop: boolean;
4771
+ /** CSS selector for the timeline's target element */
4772
+ selector: string;
4773
+ /** Actions to execute at specific timeline positions */
4774
+ timelineActions: ITimelineActionConfiguration[];
4775
+ /**
4776
+ * Optional container selector for the timeline.
4777
+ * Defaults to the timeline selector if not specified.
4778
+ * Used by position sources that don't have an intrinsic container.
4779
+ */
4780
+ container?: string;
4781
+ /**
4782
+ * Optional position source settings for this timeline only, merged over
4783
+ * `timelineProviderSettings[type].positionSource`.
4784
+ *
4785
+ * - Leave out `systemName` (or repeat the type's) to change single
4786
+ * settings, for example only the `selector` of a scroll timeline. The
4787
+ * other settings of the type still apply.
4788
+ * - Name a different `systemName` to give this timeline another kind of
4789
+ * source, for example a `ScrollPositionSource` chapter in a
4790
+ * configuration whose animation timelines use `RafPositionSource`. The
4791
+ * type's position source settings are then not used, and when every
4792
+ * timeline of a type does this, the type needs no
4793
+ * `timelineProviderSettings` entry.
4794
+ *
4795
+ * A source that renders its own container (`VideoPositionSource`) is
4796
+ * shared by every timeline of the type with the same effective settings,
4797
+ * so only an override that changes the video settings creates a second
4798
+ * video element. Other sources are created once per timeline, as without an
4799
+ * override.
4800
+ *
4801
+ * @example
4802
+ * ```json
4803
+ * {"positionSource": {"systemName": "ScrollPositionSource", "selector": "#chapter-2"}}
4804
+ * ```
4805
+ */
4806
+ positionSource?: Partial<IPositionSourceConfig>;
4807
+ /**
4808
+ * Optional container provider settings for this timeline only, merged over
4809
+ * `timelineProviderSettings[type].container` by the same rules as
4810
+ * `positionSource`. Timelines with the same effective settings share
4811
+ * one container provider.
4812
+ */
4813
+ containerProvider?: Partial<IContainerProviderConfig>;
4814
+ }
4815
+ /**
4816
+ * Configuration for an operation within an action.
4817
+ *
4818
+ * Operations are atomic functions that perform specific tasks
4819
+ * (DOM manipulation, data operations, etc.).
4820
+ *
4821
+ * @typeParam T - The operation data type
4822
+ */
4823
+ interface IOperationConfiguration<T extends TOperationData> {
4824
+ /** Unique identifier for the operation */
4825
+ id: string;
4826
+ /** Name of the operation to execute (e.g., 'selectElement', 'animateWithClass') */
4827
+ systemName: string;
4828
+ /** Optional data passed to the operation */
4829
+ operationData?: T;
4830
+ }
4831
+ /**
4832
+ * Base configuration for an action.
4833
+ *
4834
+ * Actions are named sequences of operations that execute together.
4835
+ */
4836
+ interface IActionConfiguration {
4837
+ /** Unique identifier for the action */
4838
+ id: string;
4839
+ /** Human-readable name for the action */
4840
+ name: string;
4841
+ /** Operations to execute when the action starts */
4842
+ startOperations: IOperationConfiguration<TOperationData>[];
4843
+ }
4844
+ /**
4845
+ * Configuration for an action that has both start and end operations.
4846
+ *
4847
+ * Endable actions execute startOperations when triggered and
4848
+ * endOperations when completed or reversed.
4849
+ */
4850
+ interface IEndableActionConfiguration extends IActionConfiguration {
4851
+ /** Operations to execute when the action ends */
4852
+ endOperations: IOperationConfiguration<TOperationData>[];
4853
+ }
4854
+ /**
4855
+ * Configuration for a timeline-bound action with duration.
4856
+ *
4857
+ * Timeline actions execute at specific time ranges within a timeline.
4858
+ */
4859
+ interface ITimelineActionConfiguration extends IEndableActionConfiguration {
4860
+ /** Time range when this action is active (start/end in seconds) */
4861
+ duration: IDuration;
4862
+ }
4863
+ /**
4864
+ * Configuration for an event-triggered action.
4865
+ *
4866
+ * Event actions execute in response to eventbus events.
4867
+ */
4868
+ interface IEventActionConfiguration extends IActionConfiguration {
4869
+ /** Name of the event that triggers this action */
4870
+ eventName: string;
4871
+ /** Optional event topic for filtering (defaults to global topic) */
4872
+ eventTopic?: string;
4873
+ }
4874
+ interface IResolvedOperation {
4875
+ id: string;
4876
+ systemName: string;
4877
+ operationData: TOperationData;
4878
+ instance: TOperation<any>;
4879
+ }
4880
+ /**
4881
+ * `error` for a configuration that fails at runtime for certain, `warning`
4882
+ * for one that is likely wrong.
4883
+ */
4884
+ type TLintSeverity = 'error' | 'warning';
4885
+ /**
4886
+ * One problem found by `lintConfiguration`.
4887
+ */
4888
+ interface ILintDiagnostic {
4889
+ /**
4890
+ * The rule, `E...` for errors and `W...` for warnings. `E001` is an error
4891
+ * the `ConfigurationResolver` throws, with its message unchanged.
4892
+ */
4893
+ code: string;
4894
+ severity: TLintSeverity;
4895
+ /**
4896
+ * JSON path of the offending value, in the resolver's notation, for example
4897
+ * `timelines[0].timelineActions[2].startOperations[1].operationData.selector`.
4898
+ * Empty when the problem concerns the whole configuration.
4899
+ */
4900
+ path: string;
4901
+ /** What is wrong and, where known, what to do instead */
4902
+ message: string;
4903
+ }
4904
+ /**
4905
+ * Tells `lintConfiguration` about the resources the host registers with its
4906
+ * resource importer, so that their names are accepted and misspellings are
4907
+ * reported against the complete lists.
4908
+ */
4909
+ interface ILintOptions {
4910
+ /** System names of custom operations (registered or passed to `createImporter`) */
4911
+ customOperations?: readonly string[];
4912
+ /** Class names of custom controllers */
4913
+ customControllers?: readonly string[];
4914
+ /** Class names of custom position sources, container providers and playlists */
4915
+ customProviders?: readonly string[];
4916
+ /** Names of custom functions (`customFunction` targets) */
4917
+ customFunctions?: readonly string[];
4918
+ /**
4919
+ * The templates `template:` placeholders may name, as a map of name to
4920
+ * template or as a list of names. When left out, every `template:` name is
4921
+ * accepted.
4922
+ */
4923
+ templates?: Readonly<Record<string, string>> | readonly string[];
4924
+ /**
4925
+ * The JSON values `json:` placeholders may name, as a map of name to value
4926
+ * or as a list of names. When left out, every `json:` name is accepted.
4927
+ */
4928
+ json?: Readonly<Record<string, unknown>> | readonly string[];
4929
+ }
4930
+ /**
4931
+ * Checks a configuration without a DOM and without running it, and returns
4932
+ * what the engine would reject or what is likely wrong.
4933
+ *
4934
+ * The real `ConfigurationResolver` runs first, with a stand-in for every
4935
+ * operation, controller and timeline provider, so every error it throws at
4936
+ * `createEngine` time is reported here with the same message and JSON path
4937
+ * (code `E001`). The structural and data-flow rules then run over every
4938
+ * operation list:
4939
+ *
4940
+ * - `E101` control-flow blocks that are not balanced or do not nest
4941
+ * - `E111` a required property that nothing provides (`W111` when the list
4942
+ * starts with caller-owned data)
4943
+ * - `E120` a literal outside its allowed values
4944
+ * - `E130`, `E131` a `when` expression that does not parse, an unknown operand
4945
+ * - `E140` a property chain with a forbidden segment
4946
+ * - `E141` a `__proto__` key in operation data
4947
+ * - `E160` an unrecognized `setData` target, `W160` a reserved scope field
4948
+ * - `E310` a `requestAction` name that no action has
4949
+ * - `W110` a dependency on an earlier operation that no earlier operation provides
4950
+ * - `W150` a property chain in a field the operation does not resolve
4951
+ * - `W151` an `$operationdata` read of a property that nothing provides
4952
+ *
4953
+ * Errors are certain: the engine throws, or the operation fails when it
4954
+ * runs. Warnings are likely mistakes. Data-flow warnings are only reported
4955
+ * for the operation lists that start with empty data (timeline actions and
4956
+ * init actions), and never after an operation whose effect on the data is
4957
+ * not described (a custom operation, `customFunction`, `startAction`).
4958
+ *
4959
+ * The configuration is not changed.
4960
+ *
4961
+ * @param configuration - The configuration to check
4962
+ * @param options - The custom resources the host registers, so their names
4963
+ * are accepted
4964
+ * @returns The diagnostics, resolver errors first, then in document order.
4965
+ * Empty when nothing was found.
4966
+ *
4967
+ * @example
4968
+ * ```ts
4969
+ * import {lintConfiguration} from 'eligius/lint';
4970
+ *
4971
+ * const diagnostics = lintConfiguration(configuration, {
4972
+ * customOperations: ['trackEvent'],
4973
+ * });
4974
+ * for (const {severity, code, path, message} of diagnostics) {
4975
+ * console.log(`${severity} ${code} at ${path}: ${message}`);
4976
+ * }
4977
+ * ```
4978
+ */
4979
+ export declare function lintConfiguration(configuration: IEngineConfiguration, options?: ILintOptions): ILintDiagnostic[];
4980
+ /**
4981
+ * A control-flow block that is not well formed, found by
4982
+ * {@link findFlowControlProblems}.
4983
+ */
4984
+ interface IFlowControlProblem {
4985
+ /** The index, in the operation list, of the operation the problem is reported at */
4986
+ index: number;
4987
+ /** What is wrong, naming the operations and their indices */
4988
+ message: string;
4989
+ }
4990
+ /**
4991
+ * Checks that the `when`/`otherwise`/`endWhen` and `forEach`/`endForEach`
4992
+ * blocks of an operation list are balanced and nested, and that
4993
+ * `breakForEach` and `continueForEach` sit inside a `forEach`.
4994
+ *
4995
+ * The interpreter does not check this. An `endWhen` that closes a `forEach`,
4996
+ * or an `endWhen` without a `when`, pops the wrong scope at runtime, and the
4997
+ * action then fails with a TypeError on the next operation, or runs with the
4998
+ * wrong scope. A block that is never closed runs to the end of the list.
4999
+ *
5000
+ * @param systemNames The system names of the operations, in order
5001
+ * @returns The problems in list order, empty when the blocks are well formed
5002
+ */
5003
+ 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