eligius 3.0.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -5
- package/dist/configuration-api.d.mts +149 -25
- package/dist/configuration-api.mjs +51 -3
- package/dist/configuration-api.mjs.map +1 -1
- package/dist/index.d.mts +438 -234
- package/dist/index.mjs +749 -282
- package/dist/index.mjs.map +1 -1
- package/dist/metadata.d.mts +135 -20
- package/dist/metadata.mjs +47 -1
- package/dist/metadata.mjs.map +1 -1
- package/jsonschema/eligius-configuration.json +53 -7
- package/package.json +4 -9
package/README.md
CHANGED
|
@@ -75,9 +75,27 @@ These settings describe the providers that are available for the different kinds
|
|
|
75
75
|
**Position Sources** (required) - drive timeline position:
|
|
76
76
|
- `RafPositionSource` - RequestAnimationFrame-based, for animation timelines
|
|
77
77
|
- `ScrollPositionSource` - Scroll-based, for scroll-driven timelines
|
|
78
|
-
- `VideoPositionSource` -
|
|
78
|
+
- `VideoPositionSource` - native HTML `<video>` element, for video and audio timelines (browser-playable media files such as MP4, WebM or MP3; no HLS/DASH player)
|
|
79
79
|
- `KeyboardStepSource` - Keyboard-driven stepping through markers or fixed steps
|
|
80
80
|
|
|
81
|
+
A media timeline names the container, the sources (in order of preference) and an optional poster:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
"mediaplayer": {
|
|
85
|
+
"positionSource": {
|
|
86
|
+
"systemName": "VideoPositionSource",
|
|
87
|
+
"selector": "#video",
|
|
88
|
+
"sources": [
|
|
89
|
+
{"src": "/intro.webm", "type": "video/webm"},
|
|
90
|
+
{"src": "/intro.mp4", "type": "video/mp4"}
|
|
91
|
+
],
|
|
92
|
+
"poster": "/intro.jpg"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The source appends a `<video class="eligius-video">` without controls to the container; size it with CSS. `init()` rejects when no source can be played, or when none becomes playable within `loadTimeout` milliseconds (default `30000`, `0` disables the limit). Since 4.0.0 there is no `options` key.
|
|
98
|
+
|
|
81
99
|
**Container Providers** (optional) - manage DOM elements where content is rendered:
|
|
82
100
|
- `DomContainerProvider` - Manages a DOM element by selector
|
|
83
101
|
|
|
@@ -273,7 +291,7 @@ Or name another class to give one timeline a different clock, for example a scro
|
|
|
273
291
|
{ "uri": "chapter-2", "type": "animation", "positionSource": { "systemName": "ScrollPositionSource", "selector": "#chapter-2" }, ... }
|
|
274
292
|
```
|
|
275
293
|
|
|
276
|
-
An override that names a different `systemName` replaces the type settings instead of merging with them, so options meant for one class never reach another. A timeline that names its own `systemName` needs no `timelineProviderSettings` entry for its type. Video timelines share one
|
|
294
|
+
An override that names a different `systemName` replaces the type settings instead of merging with them, so options meant for one class never reach another. A timeline that names its own `systemName` needs no `timelineProviderSettings` entry for its type. Video timelines share one video element unless an override changes the video settings, for example `{"positionSource": {"sources": [{"src": "/chapter-2.mp4", "type": "video/mp4"}]}}`, which gives that timeline its own video element. With the fluent API use `factory.setTimelinePositionSource('chapter-2', {...})` and `setTimelineContainerProvider`.
|
|
277
295
|
|
|
278
296
|
### event actions
|
|
279
297
|
|
|
@@ -494,7 +512,7 @@ const operationNames = Object.keys(metadata); // 'addClass', 'selectElement
|
|
|
494
512
|
const { description, properties } = metadata.addClass();
|
|
495
513
|
```
|
|
496
514
|
|
|
497
|
-
This entry is bundled separately and contains **only metadata** — it does not pull in the engine runtime (jQuery, lottie-web
|
|
515
|
+
This entry is bundled separately and contains **only metadata** — it does not pull in the engine runtime (jQuery, lottie-web). As a result it can be imported from a plain Node process **without a DOM**, unlike the main `eligius` entry, which evaluates the browser runtime (jQuery) on import and therefore requires a `window`.
|
|
498
516
|
|
|
499
517
|
Rule of thumb: use `eligius/metadata` for build-time and server-side tooling; use the main `eligius` entry to actually run the engine.
|
|
500
518
|
|
|
@@ -518,10 +536,9 @@ Peer dependencies:
|
|
|
518
536
|
|
|
519
537
|
- `jquery` (required)
|
|
520
538
|
- `lottie-web` (optional, only for `LottieController`, loaded on first use)
|
|
521
|
-
- `video.js` (optional, only for `VideoPositionSource`, loaded on first use)
|
|
522
539
|
- `@types/jquery` (optional, for TypeScript users of the main entry; also add `"DOM"` to your `lib`)
|
|
523
540
|
|
|
524
|
-
Upgrading from
|
|
541
|
+
Upgrading from 3.x? Version 4.0.0 replaces the video.js player with the native video element and removes the `options` key of `VideoPositionSource`; read the [changelog](CHANGELOG.md) first. Upgrading from 2.x? Read the 3.0.0 breaking changes too.
|
|
525
542
|
|
|
526
543
|
## development
|
|
527
544
|
|
|
@@ -1108,11 +1108,20 @@ interface ITimelineAction extends IEndableAction {
|
|
|
1108
1108
|
duration: IStrictDuration;
|
|
1109
1109
|
}
|
|
1110
1110
|
//#endregion
|
|
1111
|
-
//#region src/controllers/
|
|
1112
|
-
|
|
1111
|
+
//#region src/controllers/helper/controller-actions.d.ts
|
|
1112
|
+
/**
|
|
1113
|
+
* Helpers shared by the controllers that run configured actions in response
|
|
1114
|
+
* to an input (`DOMEventListenerController`, `KeyboardController`).
|
|
1115
|
+
*/
|
|
1116
|
+
/**
|
|
1117
|
+
* An action to run, and whether its `start` (or `end`) operations run.
|
|
1118
|
+
*/
|
|
1119
|
+
interface IControllerAction {
|
|
1113
1120
|
start: boolean;
|
|
1114
1121
|
action: IEndableAction;
|
|
1115
1122
|
}
|
|
1123
|
+
//#endregion
|
|
1124
|
+
//#region src/controllers/dom-event-listener-controller.d.ts
|
|
1116
1125
|
interface IDOMEventListenerControllerOperationData {
|
|
1117
1126
|
/**
|
|
1118
1127
|
* @dependency
|
|
@@ -1136,14 +1145,16 @@ interface IDOMEventListenerControllerOperationData {
|
|
|
1136
1145
|
* By default the `start` operations of the specified actions are executed. To execute the `end` operations instead,
|
|
1137
1146
|
* prefix the action name with `end:`.
|
|
1138
1147
|
*
|
|
1139
|
-
* The actions
|
|
1148
|
+
* The actions receive a copy of `actionOperationData` plus `eventTarget` (the event's target) and, for key events,
|
|
1149
|
+
* `eventKey` (the `KeyboardEvent.key`). They run in order, each receiving the operation data the previous one
|
|
1150
|
+
* returned. When an action fails, the
|
|
1140
1151
|
* remaining actions are skipped and the failure is reported through the eventbus's `reportError` (an error naming
|
|
1141
1152
|
* this controller, the action and the DOM event, with the original error as `cause`), or logged with
|
|
1142
1153
|
* `console.error` when the eventbus has no `reportError`.
|
|
1143
1154
|
*/
|
|
1144
1155
|
declare class DOMEventListenerController implements IController<IDOMEventListenerControllerOperationData> {
|
|
1145
1156
|
operationData?: IDOMEventListenerControllerOperationData;
|
|
1146
|
-
actionInstanceInfos?:
|
|
1157
|
+
actionInstanceInfos?: IControllerAction[];
|
|
1147
1158
|
name: string;
|
|
1148
1159
|
private _boundEventHandler;
|
|
1149
1160
|
/** The eventbus passed to attach(), used to report failing actions */
|
|
@@ -1158,27 +1169,128 @@ declare class DOMEventListenerController implements IController<IDOMEventListene
|
|
|
1158
1169
|
* DOM event, and keeps the responder's "did you mean" hint
|
|
1159
1170
|
*/
|
|
1160
1171
|
attach(eventbus: IEventbus): void;
|
|
1161
|
-
private _isStartAction;
|
|
1162
1172
|
private _eventHandler;
|
|
1163
1173
|
/**
|
|
1164
|
-
*
|
|
1165
|
-
*
|
|
1166
|
-
*
|
|
1167
|
-
* naming this controller, the action, the phase and the DOM event (see
|
|
1168
|
-
* `_reportFailure`). The operation data is never logged.
|
|
1174
|
+
* Removes only the handler this controller registered, so other handlers for
|
|
1175
|
+
* the same event on the element keep working, and resets the action
|
|
1176
|
+
* instances so a later attach registers again.
|
|
1169
1177
|
*/
|
|
1170
|
-
|
|
1178
|
+
detach(_eventbus: IEventbus): void;
|
|
1179
|
+
}
|
|
1180
|
+
//#endregion
|
|
1181
|
+
//#region src/controllers/keyboard-controller.d.ts
|
|
1182
|
+
/**
|
|
1183
|
+
* Where a {@link KeyboardController} listens:
|
|
1184
|
+
* - `'document'`: while the focus is inside the engine root, or while
|
|
1185
|
+
* nothing has focus. With several engines on a page, a press while
|
|
1186
|
+
* nothing has focus runs the actions of one engine only: the engine the
|
|
1187
|
+
* user last clicked or focused inside, otherwise the first one that bound
|
|
1188
|
+
* the key.
|
|
1189
|
+
* - `'element'`: only while the focus is inside the selected element.
|
|
1190
|
+
*/
|
|
1191
|
+
type TKeyboardControllerScope = 'document' | 'element';
|
|
1192
|
+
interface IKeyboardControllerOperationData {
|
|
1171
1193
|
/**
|
|
1172
|
-
*
|
|
1173
|
-
* application's `onHandlerError` sees it; otherwise logs it.
|
|
1194
|
+
* @dependency
|
|
1174
1195
|
*/
|
|
1175
|
-
|
|
1196
|
+
selectedElement: JQuery;
|
|
1176
1197
|
/**
|
|
1177
|
-
*
|
|
1178
|
-
*
|
|
1179
|
-
*
|
|
1198
|
+
* The keys that run the actions, in hotkeys-js syntax: comma separated
|
|
1199
|
+
* shortcuts such as `'right'`, `'shift+right'` or `'space, enter'`. Key
|
|
1200
|
+
* names are case insensitive. Accepted are the hotkeys-js names (`left`,
|
|
1201
|
+
* `up`, `right`, `down`, `space`, `enter`, `esc`, `tab`, `backspace`,
|
|
1202
|
+
* `del`, `ins`, `home`, `end`, `pageup`, `pagedown`, `f1` to `f19`,
|
|
1203
|
+
* `num_0` to `num_9`), the `KeyboardEvent.key` names of the same keys
|
|
1204
|
+
* (`ArrowLeft`, `ArrowUp`, `ArrowRight`, `ArrowDown`, `Enter`, `Escape`,
|
|
1205
|
+
* `Tab`, `Backspace`, `Delete`, `Insert`, `Home`, `End`, `PageUp`,
|
|
1206
|
+
* `PageDown`, `F1`), a single letter or digit, and the punctuation keys
|
|
1207
|
+
* `,` `.` `/` `;` `'` `[` `]` `-` `=`.
|
|
1208
|
+
* `' '` (the `KeyboardEvent.key` of the space bar) means `space`.
|
|
1209
|
+
* Modifiers: `shift`, `alt` (`option`), `ctrl` (`control`) and `meta`
|
|
1210
|
+
* (`cmd`, `command`).
|
|
1211
|
+
*
|
|
1212
|
+
* @type=ParameterType:string
|
|
1213
|
+
* @required
|
|
1214
|
+
*/
|
|
1215
|
+
keys: string;
|
|
1216
|
+
actions: string[];
|
|
1217
|
+
/**
|
|
1218
|
+
* @type=ParameterType:object
|
|
1219
|
+
*/
|
|
1220
|
+
actionOperationData?: TOperationData;
|
|
1221
|
+
/**
|
|
1222
|
+
* Defaults to `'document'`; see {@link TKeyboardControllerScope}.
|
|
1223
|
+
*/
|
|
1224
|
+
scope?: TKeyboardControllerScope;
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* This controller runs the given actions when one of the given keys is pressed.
|
|
1228
|
+
*
|
|
1229
|
+
* By default the `start` operations of the specified actions are executed. To execute the `end` operations instead,
|
|
1230
|
+
* prefix the action name with `end:`.
|
|
1231
|
+
*
|
|
1232
|
+
* The actions receive a copy of `actionOperationData` plus `eventTarget` (the focused element, or the body when
|
|
1233
|
+
* nothing has focus) and `eventKey` (the `KeyboardEvent.key`). They run in order, each receiving the operation data
|
|
1234
|
+
* the previous one returned. When an action fails, the remaining actions are skipped and the failure is reported
|
|
1235
|
+
* through the eventbus's `reportError`, or logged with `console.error` when the eventbus has no `reportError`.
|
|
1236
|
+
*
|
|
1237
|
+
* With `scope: 'document'` (the default) the keys work while the focus is inside the engine root, or while nothing
|
|
1238
|
+
* has focus. With `scope: 'element'` they only work while the focus is inside the selected element. Presses in
|
|
1239
|
+
* `input`, `select`, `textarea` and contenteditable elements are ignored, so typing keeps working. A handled press
|
|
1240
|
+
* has its default action prevented (no scrolling for arrow keys and space); a held key runs the actions once, not
|
|
1241
|
+
* again for every key repeat.
|
|
1242
|
+
*
|
|
1243
|
+
* When the keys include the play toggle hotkey of the engine (space by default), or a key that the engine's
|
|
1244
|
+
* KeyboardStepSource binds (the arrow keys, `shift+left`/`shift+right`, `home` and `end`), the controller wins: a
|
|
1245
|
+
* press it handles runs its actions and does not toggle playback or step the timeline. A press it ignores (for
|
|
1246
|
+
* example outside the selected element with `scope: 'element'`) still does.
|
|
1247
|
+
*
|
|
1248
|
+
* The keys are bound in the hotkeys-js `'all'` scope, so they work whatever scope a KeyboardStepSource sets. The
|
|
1249
|
+
* hotkeys-js global `filter` still applies. Detaching removes only this controller's handler.
|
|
1250
|
+
*
|
|
1251
|
+
* @example
|
|
1252
|
+
* ```json
|
|
1253
|
+
* {"systemName": "addControllerToElement", "operationData": {"keys": "ArrowRight", "actions": ["NextChapter"]}}
|
|
1254
|
+
* ```
|
|
1255
|
+
*/
|
|
1256
|
+
declare class KeyboardController implements IController<IKeyboardControllerOperationData> {
|
|
1257
|
+
operationData?: IKeyboardControllerOperationData;
|
|
1258
|
+
actionInstanceInfos?: IControllerAction[];
|
|
1259
|
+
name: string;
|
|
1260
|
+
private _handler;
|
|
1261
|
+
private _leaveRegistry;
|
|
1262
|
+
/** The eventbus passed to attach(), used to report failing actions */
|
|
1263
|
+
private _eventbus;
|
|
1264
|
+
/**
|
|
1265
|
+
* @param operationData - The keys, actions and scope
|
|
1266
|
+
* @throws when `keys` is empty or names a key hotkeys-js can't match, or
|
|
1267
|
+
* when `scope` is not `'document'` or `'element'`
|
|
1268
|
+
*/
|
|
1269
|
+
init(operationData: IKeyboardControllerOperationData): void;
|
|
1270
|
+
/**
|
|
1271
|
+
* Looks up the configured actions and starts listening for the keys.
|
|
1272
|
+
*
|
|
1273
|
+
* @param eventbus - The eventbus to request the actions and the engine root
|
|
1274
|
+
* from
|
|
1275
|
+
* @throws when an action name is unknown (`request-action` throws or
|
|
1276
|
+
* returns nothing); the message names the controller, the action and the
|
|
1277
|
+
* keys, and keeps the responder's "did you mean" hint
|
|
1278
|
+
*/
|
|
1279
|
+
attach(eventbus: IEventbus): void;
|
|
1280
|
+
/**
|
|
1281
|
+
* Removes only the handler this controller bound, so other bindings of the
|
|
1282
|
+
* same keys keep working, and resets the action instances so a later
|
|
1283
|
+
* attach binds again.
|
|
1180
1284
|
*/
|
|
1181
1285
|
detach(_eventbus: IEventbus): void;
|
|
1286
|
+
private _handleKey;
|
|
1287
|
+
private _trigger;
|
|
1288
|
+
private _requestEngineRoot;
|
|
1289
|
+
/**
|
|
1290
|
+
* @returns The keys with `' '` replaced by `space`
|
|
1291
|
+
* @throws when the keys are empty or name a key hotkeys-js can't match
|
|
1292
|
+
*/
|
|
1293
|
+
private _normalizeKeys;
|
|
1182
1294
|
}
|
|
1183
1295
|
//#endregion
|
|
1184
1296
|
//#region src/controllers/base-controller.d.ts
|
|
@@ -1901,7 +2013,7 @@ declare class SubtitlesController extends BaseController<ISubtitlesControllerOpe
|
|
|
1901
2013
|
init(operationData: ISubtitlesControllerOperationData): void;
|
|
1902
2014
|
}
|
|
1903
2015
|
declare namespace index_d_exports$1 {
|
|
1904
|
-
export { DOMEventListenerController, IDOMEventListenerControllerOperationData, ILabelControllerMetadata, ILottieControllerMetadata, IMutationEventPayload, IMutationObserverControllerMetadata, INavigationControllerOperationData, IProgressbarControllerOperationData, IRoutingControllerOperationData, ISubtitlesControllerOperationData, LabelController, LottieController, MutationObserverController, NavigationController, ProgressbarController, RoutingController, SubtitlesController };
|
|
2016
|
+
export { DOMEventListenerController, IDOMEventListenerControllerOperationData, IKeyboardControllerOperationData, ILabelControllerMetadata, ILottieControllerMetadata, IMutationEventPayload, IMutationObserverControllerMetadata, INavigationControllerOperationData, IProgressbarControllerOperationData, IRoutingControllerOperationData, ISubtitlesControllerOperationData, KeyboardController, LabelController, LottieController, MutationObserverController, NavigationController, ProgressbarController, RoutingController, SubtitlesController, TKeyboardControllerScope };
|
|
1905
2017
|
}
|
|
1906
2018
|
//#endregion
|
|
1907
2019
|
//#region src/operation/add-class.d.ts
|
|
@@ -4694,7 +4806,7 @@ type ITimelineFlow = Record<string, never>;
|
|
|
4694
4806
|
* Built-in position sources:
|
|
4695
4807
|
* - `RafPositionSource`: RAF-based, drives timeline by elapsed time
|
|
4696
4808
|
* - `ScrollPositionSource`: Scroll-based, drives timeline by scroll position
|
|
4697
|
-
* - `VideoPositionSource`:
|
|
4809
|
+
* - `VideoPositionSource`: native HTML video element, drives timeline by media playback
|
|
4698
4810
|
*
|
|
4699
4811
|
* @example
|
|
4700
4812
|
* ```typescript
|
|
@@ -4743,8 +4855,10 @@ interface IPositionSourceConfig {
|
|
|
4743
4855
|
*/
|
|
4744
4856
|
tickInterval?: number;
|
|
4745
4857
|
/**
|
|
4746
|
-
* Media to load (video sources), each with its URL and MIME type
|
|
4747
|
-
* `VideoPositionSource` requires a non-empty list
|
|
4858
|
+
* Media to load (video sources), each with its URL and MIME type, in order
|
|
4859
|
+
* of preference. `VideoPositionSource` requires a non-empty list of
|
|
4860
|
+
* browser-playable media files (video or audio, for example MP4, WebM or
|
|
4861
|
+
* MP3).
|
|
4748
4862
|
*/
|
|
4749
4863
|
sources?: Array<{
|
|
4750
4864
|
src: string;
|
|
@@ -4754,9 +4868,17 @@ interface IPositionSourceConfig {
|
|
|
4754
4868
|
* Optional poster image URL (video sources).
|
|
4755
4869
|
*/
|
|
4756
4870
|
poster?: string;
|
|
4871
|
+
/**
|
|
4872
|
+
* Milliseconds `VideoPositionSource` waits for a source to become playable
|
|
4873
|
+
* before `init()` rejects. `0` disables the limit.
|
|
4874
|
+
*
|
|
4875
|
+
* @default 30000
|
|
4876
|
+
*/
|
|
4877
|
+
loadTimeout?: number;
|
|
4757
4878
|
/**
|
|
4758
4879
|
* Additional configuration options passed to the position source constructor.
|
|
4759
4880
|
* Use this for custom position source implementations.
|
|
4881
|
+
* `VideoPositionSource` rejects an `options` key (removed in 4.0.0).
|
|
4760
4882
|
*/
|
|
4761
4883
|
[key: string]: unknown;
|
|
4762
4884
|
}
|
|
@@ -4941,7 +5063,7 @@ interface ITimelineConfiguration {
|
|
|
4941
5063
|
* A source that renders its own container (`VideoPositionSource`) is
|
|
4942
5064
|
* shared by every timeline of the type with the same effective settings,
|
|
4943
5065
|
* so only an override that changes the video settings creates a second
|
|
4944
|
-
*
|
|
5066
|
+
* video element. Other sources are created once per timeline, as without an
|
|
4945
5067
|
* override.
|
|
4946
5068
|
*
|
|
4947
5069
|
* @example
|
|
@@ -5178,7 +5300,7 @@ export declare class EndableActionEditor<T extends IEndableActionConfiguration =
|
|
|
5178
5300
|
* @returns
|
|
5179
5301
|
* @throws Error when `systemName` is neither a built-in nor a declared custom operation
|
|
5180
5302
|
*/
|
|
5181
|
-
addEndOperation<T extends TFluentOperationName, O extends TFluentOperationData<T>>(systemName: T, operationData: O): OperationEditor<this, TOperation<
|
|
5303
|
+
addEndOperation<T extends TFluentOperationName, O extends TFluentOperationData<T>>(systemName: T, operationData: O): OperationEditor<this, TOperation<IAddClassOperationData, Omit<IAddClassOperationData, "className">> | TOperation<IAddControllerToElementOperationData<TOperationData>> | TOperation<IAddGlobalsToOperationData, Omit<IAddGlobalsToOperationData, "globalProperties">> | TOperation<IAnimateOperationData, Omit<IAnimateOperationData, "animationEasing" | "animationProperties" | "animationDuration">> | TOperation<IAnimateWithClassOperationData, Omit<IAnimateWithClassOperationData, "removeClass" | "className" | "includeDescendants">> | TOperation<IAnnounceToScreenReaderOperationData, Omit<IAnnounceToScreenReaderOperationData, "message" | "priority">> | TOperation<TOperationData> | TOperation<IBroadcastEventOperationData, Omit<IBroadcastEventOperationData, "eventArgs" | "eventTopic" | "eventName">> | TOperation<ICalcOperationData, Omit<ICalcOperationData, "left" | "right" | "operator">> | TOperation<IClearElementOperationData> | TOperation<IClearOperationDataOperationData, Omit<IClearOperationDataOperationData, "properties">> | TOperation<IClearStorageOperationData, Omit<IClearStorageOperationData, "key" | "storageType">> | TOperation<ICompareDateOperationData, Omit<ICompareDateOperationData, "date1" | "date2">> | TOperation<IConcatenateStringsOperationData, Omit<IConcatenateStringsOperationData, "strings" | "separator">> | TOperation<ICreateElementOperationData<keyof HTMLElementTagNameMap>, Omit<RequireKeys<ICreateElementOperationData<keyof HTMLElementTagNameMap>, "template">, "elementName" | "text" | "attributes">> | TOperation<ICustomFunctionOperationData, Omit<ICustomFunctionOperationData, "systemName">> | TOperation<IEndActionOperationData, Omit<IEndActionOperationData, "actionOperationData">> | TOperation<Record<string, unknown>> | TOperation<IExtendControllerOperationData, Omit<IExtendControllerOperationData, "controllerExtension">> | TOperation<IFilterArrayOperationData, Omit<IFilterArrayOperationData, "filterProperty" | "filterValue" | "filterPredicate">> | TOperation<IFindInArrayOperationData, Omit<IFindInArrayOperationData, "findProperty" | "findValue" | "findPredicate">> | TOperation<IForEachOperationData> | TOperation<IFormatDateOperationData, Omit<IFormatDateOperationData, "format">> | TOperation<IFormatTextOperationData, Omit<IFormatTextOperationData, "transformation">> | TOperation<IGetAttributesFromElementOperationData, Omit<IGetAttributesFromElementOperationData, "attributeNames">> | TOperation<IGetControllerFromElementOperationData, Omit<IGetControllerFromElementOperationData, "controllerName">> | TOperation<IGetControllerInstanceOperationData, Omit<IGetControllerInstanceOperationData, "systemName">> | TOperation<IGetCurrentTimeOperationData, IGetCurrentTimeOperationData> | TOperation<IGetElementDimensionsOperationData, Omit<IGetElementDimensionsOperationData, "modifier">> | TOperation<IGetFocusedElementOperationData, IGetFocusedElementOperationData> | TOperation<IGetFormDataOperationData, IGetFormDataOperationData> | TOperation<IGetImportOperationData, Omit<RequireKeys<IGetImportOperationData, "importedInstance">, "systemName">> | TOperation<IGetQueryParamsOperationData, Omit<IGetQueryParamsOperationData, "defaultValues">> | TOperation<IGetScrollPositionOperationData, IGetScrollPositionOperationData> | TOperation<IGetTextContentOperationData, IGetTextContentOperationData> | TOperation<IHttpDeleteOperationData, Omit<IHttpDeleteOperationData, "url" | "headers">> | TOperation<IHttpPostOperationData, Omit<IHttpPostOperationData, "body" | "url" | "headers">> | TOperation<IHttpPutOperationData, Omit<IHttpPutOperationData, "body" | "url" | "headers">> | TOperation<IInvokeObjectMethodOperationData, Omit<IInvokeObjectMethodOperationData, "methodName" | "methodArguments">> | TOperation<IIsElementInViewportOperationData, IIsElementInViewportOperationData> | TOperation<ILoadFromStorageOperationData, Omit<ILoadFromStorageOperationData, "key" | "storageType">> | TOperation<ILoadJSONOperationData, Omit<ILoadJSONOperationData, "url" | "cache">> | TOperation<ILogOperationData, Omit<ILogOperationData, "logValue" | "logName">> | TOperation<IMapArrayOperationData, Omit<IMapArrayOperationData, "mapFunction">> | TOperation<IMathOperationData, Omit<IMathOperationData, "args" | "functionName">> | TOperation<IRemoveClassOperationData, Omit<IRemoveClassOperationData, "className">> | TOperation<IRemoveControllerFromElementOperationData, Omit<IRemoveControllerFromElementOperationData, "controllerName">> | TOperation<IRemoveElementOperationData> | TOperation<IRemovePropertiesFromOperationDataOperationData, Omit<IRemovePropertiesFromOperationDataOperationData, "propertyNames">> | TOperation<IReparentElementOperationData, Omit<IReparentElementOperationData, "newParentSelector">> | TOperation<IReplaceStringOperationData, Omit<IReplaceStringOperationData, "pattern" | "replacement">> | TOperation<IReplaceTextOperationData, Omit<IReplaceTextOperationData, "replacement" | "searchPattern">> | TOperation<IRequestActionOperationData, Omit<Required<IRequestActionOperationData>, "systemName">> | TOperation<ISaveToStorageOperationData, Omit<ISaveToStorageOperationData, "key" | "storageType" | "value">> | TOperation<IScrollToElementOperationData, Omit<IScrollToElementOperationData, "behavior" | "block" | "inline">> | TOperation<IScrollToPositionOperationData, Omit<IScrollToPositionOperationData, "behavior" | "x" | "y">> | TOperation<ISelectElementOperationData, Omit<ISelectElementOperationData, "selector" | "useSelectedElementAsRoot">> | TOperation<ISetDataOperationData, Omit<ISetDataOperationData, "properties">> | TOperation<ISetElementAttributesOperationData, Omit<ISetElementAttributesOperationData, "attributes">> | TOperation<ISetElementContentOperationData, Omit<ISetElementContentOperationData, "template" | "insertionType">> | TOperation<ISetFocusOperationData, ISetFocusOperationData> | TOperation<ISetFormValueOperationData, Omit<ISetFormValueOperationData, "value">> | TOperation<ISetGlobalDataOperationData, Omit<ISetGlobalDataOperationData, "propertyNames">> | TOperation<ISetOperationData, Omit<ISetOperationData, "properties" | "override">> | TOperation<ISetStyleOperationData, Omit<ISetStyleOperationData, "properties">> | TOperation<ISetVariableOperationData, Omit<ISetVariableOperationData, "name" | "value">> | TOperation<ISortArrayOperationData, Omit<ISortArrayOperationData, "sortProperty" | "sortOrder" | "sortComparator">> | TOperation<ISplitStringOperationData, Omit<ISplitStringOperationData, "delimiter" | "limit">> | TOperation<IStartActionOperationData, Omit<IStartActionOperationData, "actionOperationData">> | TOperation<ISubstringTextOperationData, Omit<ISubstringTextOperationData, "start" | "end">> | TOperation<IToggleClassOperationData, Omit<IToggleClassOperationData, "className">> | TOperation<IToggleElementOperationData> | TOperation<IToggleFormElementOperationData, Omit<IToggleFormElementOperationData, "enabled">> | TOperation<IValidateFormOperationData, Omit<IValidateFormOperationData, "validationRules">> | TOperation<IWaitOperationData, Omit<IWaitOperationData, "milliseconds">> | TOperation<IWhenOperationData, Omit<IWhenOperationData, "expression">>>;
|
|
5182
5304
|
/**
|
|
5183
5305
|
*
|
|
5184
5306
|
* Starts an editor for the end operation associated with the given id
|
|
@@ -5678,7 +5800,8 @@ export declare class ConfigurationFactory {
|
|
|
5678
5800
|
*
|
|
5679
5801
|
* @param name
|
|
5680
5802
|
* @param eventName the event that starts the action. Without it the action can
|
|
5681
|
-
* only be started by name (for example by a `DOMEventListenerController`
|
|
5803
|
+
* only be started by name (for example by a `DOMEventListenerController` or
|
|
5804
|
+
* `KeyboardController`).
|
|
5682
5805
|
* @param eventTopic optional topic of the event
|
|
5683
5806
|
* @returns
|
|
5684
5807
|
*
|
|
@@ -5830,7 +5953,8 @@ export declare class ActionCreatorFactory {
|
|
|
5830
5953
|
*
|
|
5831
5954
|
* @param name
|
|
5832
5955
|
* @param eventName the event that starts the action. Without it the action can
|
|
5833
|
-
* only be started by name (for example by a `DOMEventListenerController`
|
|
5956
|
+
* only be started by name (for example by a `DOMEventListenerController` or
|
|
5957
|
+
* `KeyboardController`).
|
|
5834
5958
|
* @param eventTopic optional topic of the event
|
|
5835
5959
|
* @returns
|
|
5836
5960
|
*/
|
|
@@ -2165,7 +2165,8 @@ var ActionCreatorFactory = class {
|
|
|
2165
2165
|
*
|
|
2166
2166
|
* @param name
|
|
2167
2167
|
* @param eventName the event that starts the action. Without it the action can
|
|
2168
|
-
* only be started by name (for example by a `DOMEventListenerController`
|
|
2168
|
+
* only be started by name (for example by a `DOMEventListenerController` or
|
|
2169
|
+
* `KeyboardController`).
|
|
2169
2170
|
* @param eventTopic optional topic of the event
|
|
2170
2171
|
* @returns
|
|
2171
2172
|
*/
|
|
@@ -3328,7 +3329,8 @@ var ConfigurationFactory = class ConfigurationFactory {
|
|
|
3328
3329
|
*
|
|
3329
3330
|
* @param name
|
|
3330
3331
|
* @param eventName the event that starts the action. Without it the action can
|
|
3331
|
-
* only be started by name (for example by a `DOMEventListenerController`
|
|
3332
|
+
* only be started by name (for example by a `DOMEventListenerController` or
|
|
3333
|
+
* `KeyboardController`).
|
|
3332
3334
|
* @param eventTopic optional topic of the event
|
|
3333
3335
|
* @returns
|
|
3334
3336
|
*
|
|
@@ -3517,7 +3519,9 @@ executes the given actions with the given operation data.
|
|
|
3517
3519
|
By default the \`start\` operations of the specified actions are executed. To execute the \`end\` operations instead,
|
|
3518
3520
|
prefix the action name with \`end:\`.
|
|
3519
3521
|
|
|
3520
|
-
The actions
|
|
3522
|
+
The actions receive a copy of \`actionOperationData\` plus \`eventTarget\` (the event's target) and, for key events,
|
|
3523
|
+
\`eventKey\` (the \`KeyboardEvent.key\`). They run in order, each receiving the operation data the previous one
|
|
3524
|
+
returned. When an action fails, the
|
|
3521
3525
|
remaining actions are skipped and the failure is reported through the eventbus's \`reportError\` (an error naming
|
|
3522
3526
|
this controller, the action and the DOM event, with the original error as \`cause\`), or logged with
|
|
3523
3527
|
\`console.error\` when the eventbus has no \`reportError\`.`,
|
|
@@ -3536,6 +3540,49 @@ this controller, the action and the DOM event, with the original error as \`caus
|
|
|
3536
3540
|
};
|
|
3537
3541
|
}
|
|
3538
3542
|
|
|
3543
|
+
//#endregion
|
|
3544
|
+
//#region src/controllers/metadata/keyboard-controller.ts
|
|
3545
|
+
function KeyboardController() {
|
|
3546
|
+
return {
|
|
3547
|
+
description: `This controller runs the given actions when one of the given keys is pressed.
|
|
3548
|
+
|
|
3549
|
+
By default the \`start\` operations of the specified actions are executed. To execute the \`end\` operations instead,
|
|
3550
|
+
prefix the action name with \`end:\`.
|
|
3551
|
+
|
|
3552
|
+
The actions receive a copy of \`actionOperationData\` plus \`eventTarget\` (the focused element, or the body when
|
|
3553
|
+
nothing has focus) and \`eventKey\` (the \`KeyboardEvent.key\`). They run in order, each receiving the operation data
|
|
3554
|
+
the previous one returned. When an action fails, the remaining actions are skipped and the failure is reported
|
|
3555
|
+
through the eventbus's \`reportError\`, or logged with \`console.error\` when the eventbus has no \`reportError\`.
|
|
3556
|
+
|
|
3557
|
+
With \`scope: 'document'\` (the default) the keys work while the focus is inside the engine root, or while nothing
|
|
3558
|
+
has focus. With \`scope: 'element'\` they only work while the focus is inside the selected element. Presses in
|
|
3559
|
+
\`input\`, \`select\`, \`textarea\` and contenteditable elements are ignored, so typing keeps working. A handled press
|
|
3560
|
+
has its default action prevented (no scrolling for arrow keys and space); a held key runs the actions once, not
|
|
3561
|
+
again for every key repeat.
|
|
3562
|
+
|
|
3563
|
+
When the keys include the play toggle hotkey of the engine (space by default), or a key that the engine's
|
|
3564
|
+
KeyboardStepSource binds (the arrow keys, \`shift+left\`/\`shift+right\`, \`home\` and \`end\`), the controller wins: a
|
|
3565
|
+
press it handles runs its actions and does not toggle playback or step the timeline. A press it ignores (for
|
|
3566
|
+
example outside the selected element with \`scope: 'element'\`) still does.
|
|
3567
|
+
|
|
3568
|
+
The keys are bound in the hotkeys-js \`'all'\` scope, so they work whatever scope a KeyboardStepSource sets. The
|
|
3569
|
+
hotkeys-js global \`filter\` still applies. Detaching removes only this controller's handler.`,
|
|
3570
|
+
dependentProperties: ["selectedElement"],
|
|
3571
|
+
properties: {
|
|
3572
|
+
keys: {
|
|
3573
|
+
type: "ParameterType:string",
|
|
3574
|
+
required: true
|
|
3575
|
+
},
|
|
3576
|
+
actions: {
|
|
3577
|
+
type: "ParameterType:array",
|
|
3578
|
+
itemType: "ParameterType:string"
|
|
3579
|
+
},
|
|
3580
|
+
actionOperationData: { type: "ParameterType:object" },
|
|
3581
|
+
scope: { type: [{ value: "document" }, { value: "element" }] }
|
|
3582
|
+
}
|
|
3583
|
+
};
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3539
3586
|
//#endregion
|
|
3540
3587
|
//#region src/controllers/metadata/label-controller.ts
|
|
3541
3588
|
function LabelController() {
|
|
@@ -3693,6 +3740,7 @@ Subtitle texts may contain simple inline markup. They are passed through
|
|
|
3693
3740
|
//#region src/controllers/metadata/index.ts
|
|
3694
3741
|
var metadata_exports = /* @__PURE__ */ __exportAll({
|
|
3695
3742
|
DOMEventListenerController: () => DOMEventListenerController,
|
|
3743
|
+
KeyboardController: () => KeyboardController,
|
|
3696
3744
|
LabelController: () => LabelController,
|
|
3697
3745
|
LottieController: () => LottieController,
|
|
3698
3746
|
MutationObserverController: () => MutationObserverController,
|