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/dist/metadata.d.mts
CHANGED
|
@@ -1099,6 +1099,121 @@ interface ILottieHTMLRendererConfig extends ILottieBaseRendererConfig {
|
|
|
1099
1099
|
/** The renderer settings a `LottieController` accepts. */
|
|
1100
1100
|
type TLottieRendererConfig = ILottieSVGRendererConfig | ILottieCanvasRendererConfig | ILottieHTMLRendererConfig;
|
|
1101
1101
|
//#endregion
|
|
1102
|
+
//#region src/controllers/keyboard-controller.d.ts
|
|
1103
|
+
/**
|
|
1104
|
+
* Where a {@link KeyboardController} listens:
|
|
1105
|
+
* - `'document'`: while the focus is inside the engine root, or while
|
|
1106
|
+
* nothing has focus. With several engines on a page, a press while
|
|
1107
|
+
* nothing has focus runs the actions of one engine only: the engine the
|
|
1108
|
+
* user last clicked or focused inside, otherwise the first one that bound
|
|
1109
|
+
* the key.
|
|
1110
|
+
* - `'element'`: only while the focus is inside the selected element.
|
|
1111
|
+
*/
|
|
1112
|
+
type TKeyboardControllerScope = 'document' | 'element';
|
|
1113
|
+
interface IKeyboardControllerOperationData {
|
|
1114
|
+
/**
|
|
1115
|
+
* @dependency
|
|
1116
|
+
*/
|
|
1117
|
+
selectedElement: JQuery;
|
|
1118
|
+
/**
|
|
1119
|
+
* The keys that run the actions, in hotkeys-js syntax: comma separated
|
|
1120
|
+
* shortcuts such as `'right'`, `'shift+right'` or `'space, enter'`. Key
|
|
1121
|
+
* names are case insensitive. Accepted are the hotkeys-js names (`left`,
|
|
1122
|
+
* `up`, `right`, `down`, `space`, `enter`, `esc`, `tab`, `backspace`,
|
|
1123
|
+
* `del`, `ins`, `home`, `end`, `pageup`, `pagedown`, `f1` to `f19`,
|
|
1124
|
+
* `num_0` to `num_9`), the `KeyboardEvent.key` names of the same keys
|
|
1125
|
+
* (`ArrowLeft`, `ArrowUp`, `ArrowRight`, `ArrowDown`, `Enter`, `Escape`,
|
|
1126
|
+
* `Tab`, `Backspace`, `Delete`, `Insert`, `Home`, `End`, `PageUp`,
|
|
1127
|
+
* `PageDown`, `F1`), a single letter or digit, and the punctuation keys
|
|
1128
|
+
* `,` `.` `/` `;` `'` `[` `]` `-` `=`.
|
|
1129
|
+
* `' '` (the `KeyboardEvent.key` of the space bar) means `space`.
|
|
1130
|
+
* Modifiers: `shift`, `alt` (`option`), `ctrl` (`control`) and `meta`
|
|
1131
|
+
* (`cmd`, `command`).
|
|
1132
|
+
*
|
|
1133
|
+
* @type=ParameterType:string
|
|
1134
|
+
* @required
|
|
1135
|
+
*/
|
|
1136
|
+
keys: string;
|
|
1137
|
+
actions: string[];
|
|
1138
|
+
/**
|
|
1139
|
+
* @type=ParameterType:object
|
|
1140
|
+
*/
|
|
1141
|
+
actionOperationData?: TOperationData;
|
|
1142
|
+
/**
|
|
1143
|
+
* Defaults to `'document'`; see {@link TKeyboardControllerScope}.
|
|
1144
|
+
*/
|
|
1145
|
+
scope?: TKeyboardControllerScope;
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* This controller runs the given actions when one of the given keys is pressed.
|
|
1149
|
+
*
|
|
1150
|
+
* By default the `start` operations of the specified actions are executed. To execute the `end` operations instead,
|
|
1151
|
+
* prefix the action name with `end:`.
|
|
1152
|
+
*
|
|
1153
|
+
* The actions receive a copy of `actionOperationData` plus `eventTarget` (the focused element, or the body when
|
|
1154
|
+
* nothing has focus) and `eventKey` (the `KeyboardEvent.key`). They run in order, each receiving the operation data
|
|
1155
|
+
* the previous one returned. When an action fails, the remaining actions are skipped and the failure is reported
|
|
1156
|
+
* through the eventbus's `reportError`, or logged with `console.error` when the eventbus has no `reportError`.
|
|
1157
|
+
*
|
|
1158
|
+
* With `scope: 'document'` (the default) the keys work while the focus is inside the engine root, or while nothing
|
|
1159
|
+
* has focus. With `scope: 'element'` they only work while the focus is inside the selected element. Presses in
|
|
1160
|
+
* `input`, `select`, `textarea` and contenteditable elements are ignored, so typing keeps working. A handled press
|
|
1161
|
+
* has its default action prevented (no scrolling for arrow keys and space); a held key runs the actions once, not
|
|
1162
|
+
* again for every key repeat.
|
|
1163
|
+
*
|
|
1164
|
+
* When the keys include the play toggle hotkey of the engine (space by default), or a key that the engine's
|
|
1165
|
+
* KeyboardStepSource binds (the arrow keys, `shift+left`/`shift+right`, `home` and `end`), the controller wins: a
|
|
1166
|
+
* press it handles runs its actions and does not toggle playback or step the timeline. A press it ignores (for
|
|
1167
|
+
* example outside the selected element with `scope: 'element'`) still does.
|
|
1168
|
+
*
|
|
1169
|
+
* The keys are bound in the hotkeys-js `'all'` scope, so they work whatever scope a KeyboardStepSource sets. The
|
|
1170
|
+
* hotkeys-js global `filter` still applies. Detaching removes only this controller's handler.
|
|
1171
|
+
*
|
|
1172
|
+
* @example
|
|
1173
|
+
* ```json
|
|
1174
|
+
* {"systemName": "addControllerToElement", "operationData": {"keys": "ArrowRight", "actions": ["NextChapter"]}}
|
|
1175
|
+
* ```
|
|
1176
|
+
*/
|
|
1177
|
+
declare class KeyboardController$1 implements IController<IKeyboardControllerOperationData> {
|
|
1178
|
+
operationData?: IKeyboardControllerOperationData;
|
|
1179
|
+
actionInstanceInfos?: IControllerAction[];
|
|
1180
|
+
name: string;
|
|
1181
|
+
private _handler;
|
|
1182
|
+
private _leaveRegistry;
|
|
1183
|
+
/** The eventbus passed to attach(), used to report failing actions */
|
|
1184
|
+
private _eventbus;
|
|
1185
|
+
/**
|
|
1186
|
+
* @param operationData - The keys, actions and scope
|
|
1187
|
+
* @throws when `keys` is empty or names a key hotkeys-js can't match, or
|
|
1188
|
+
* when `scope` is not `'document'` or `'element'`
|
|
1189
|
+
*/
|
|
1190
|
+
init(operationData: IKeyboardControllerOperationData): void;
|
|
1191
|
+
/**
|
|
1192
|
+
* Looks up the configured actions and starts listening for the keys.
|
|
1193
|
+
*
|
|
1194
|
+
* @param eventbus - The eventbus to request the actions and the engine root
|
|
1195
|
+
* from
|
|
1196
|
+
* @throws when an action name is unknown (`request-action` throws or
|
|
1197
|
+
* returns nothing); the message names the controller, the action and the
|
|
1198
|
+
* keys, and keeps the responder's "did you mean" hint
|
|
1199
|
+
*/
|
|
1200
|
+
attach(eventbus: IEventbus): void;
|
|
1201
|
+
/**
|
|
1202
|
+
* Removes only the handler this controller bound, so other bindings of the
|
|
1203
|
+
* same keys keep working, and resets the action instances so a later
|
|
1204
|
+
* attach binds again.
|
|
1205
|
+
*/
|
|
1206
|
+
detach(_eventbus: IEventbus): void;
|
|
1207
|
+
private _handleKey;
|
|
1208
|
+
private _trigger;
|
|
1209
|
+
private _requestEngineRoot;
|
|
1210
|
+
/**
|
|
1211
|
+
* @returns The keys with `' '` replaced by `space`
|
|
1212
|
+
* @throws when the keys are empty or name a key hotkeys-js can't match
|
|
1213
|
+
*/
|
|
1214
|
+
private _normalizeKeys;
|
|
1215
|
+
}
|
|
1216
|
+
//#endregion
|
|
1102
1217
|
//#region src/controllers/base-controller.d.ts
|
|
1103
1218
|
/**
|
|
1104
1219
|
* Abstract base class for controllers providing standardized event listener management
|
|
@@ -1819,7 +1934,7 @@ declare class SubtitlesController$1 extends BaseController<ISubtitlesControllerO
|
|
|
1819
1934
|
init(operationData: ISubtitlesControllerOperationData): void;
|
|
1820
1935
|
}
|
|
1821
1936
|
declare namespace index_d_exports$3 {
|
|
1822
|
-
export { DOMEventListenerController$1 as DOMEventListenerController, IDOMEventListenerControllerOperationData, ILabelControllerMetadata, ILottieControllerMetadata, IMutationEventPayload, IMutationObserverControllerMetadata, INavigationControllerOperationData, IProgressbarControllerOperationData, IRoutingControllerOperationData, ISubtitlesControllerOperationData, LabelController$1 as LabelController, LottieController$1 as LottieController, MutationObserverController$1 as MutationObserverController, NavigationController$1 as NavigationController, ProgressbarController$1 as ProgressbarController, RoutingController$1 as RoutingController, SubtitlesController$1 as SubtitlesController };
|
|
1937
|
+
export { DOMEventListenerController$1 as DOMEventListenerController, IDOMEventListenerControllerOperationData, IKeyboardControllerOperationData, ILabelControllerMetadata, ILottieControllerMetadata, IMutationEventPayload, IMutationObserverControllerMetadata, INavigationControllerOperationData, IProgressbarControllerOperationData, IRoutingControllerOperationData, ISubtitlesControllerOperationData, KeyboardController$1 as KeyboardController, LabelController$1 as LabelController, LottieController$1 as LottieController, MutationObserverController$1 as MutationObserverController, NavigationController$1 as NavigationController, ProgressbarController$1 as ProgressbarController, RoutingController$1 as RoutingController, SubtitlesController$1 as SubtitlesController, TKeyboardControllerScope };
|
|
1823
1938
|
}
|
|
1824
1939
|
//#endregion
|
|
1825
1940
|
//#region src/operation/add-class.d.ts
|
|
@@ -3117,11 +3232,20 @@ interface IEndableAction extends IAction {
|
|
|
3117
3232
|
end(initOperationData?: TOperationData): Promise<TOperationData>;
|
|
3118
3233
|
}
|
|
3119
3234
|
//#endregion
|
|
3120
|
-
//#region src/controllers/
|
|
3121
|
-
|
|
3235
|
+
//#region src/controllers/helper/controller-actions.d.ts
|
|
3236
|
+
/**
|
|
3237
|
+
* Helpers shared by the controllers that run configured actions in response
|
|
3238
|
+
* to an input (`DOMEventListenerController`, `KeyboardController`).
|
|
3239
|
+
*/
|
|
3240
|
+
/**
|
|
3241
|
+
* An action to run, and whether its `start` (or `end`) operations run.
|
|
3242
|
+
*/
|
|
3243
|
+
interface IControllerAction {
|
|
3122
3244
|
start: boolean;
|
|
3123
3245
|
action: IEndableAction;
|
|
3124
3246
|
}
|
|
3247
|
+
//#endregion
|
|
3248
|
+
//#region src/controllers/dom-event-listener-controller.d.ts
|
|
3125
3249
|
interface IDOMEventListenerControllerOperationData {
|
|
3126
3250
|
/**
|
|
3127
3251
|
* @dependency
|
|
@@ -3145,14 +3269,16 @@ interface IDOMEventListenerControllerOperationData {
|
|
|
3145
3269
|
* By default the `start` operations of the specified actions are executed. To execute the `end` operations instead,
|
|
3146
3270
|
* prefix the action name with `end:`.
|
|
3147
3271
|
*
|
|
3148
|
-
* The actions
|
|
3272
|
+
* The actions receive a copy of `actionOperationData` plus `eventTarget` (the event's target) and, for key events,
|
|
3273
|
+
* `eventKey` (the `KeyboardEvent.key`). They run in order, each receiving the operation data the previous one
|
|
3274
|
+
* returned. When an action fails, the
|
|
3149
3275
|
* remaining actions are skipped and the failure is reported through the eventbus's `reportError` (an error naming
|
|
3150
3276
|
* this controller, the action and the DOM event, with the original error as `cause`), or logged with
|
|
3151
3277
|
* `console.error` when the eventbus has no `reportError`.
|
|
3152
3278
|
*/
|
|
3153
3279
|
declare class DOMEventListenerController$1 implements IController<IDOMEventListenerControllerOperationData> {
|
|
3154
3280
|
operationData?: IDOMEventListenerControllerOperationData;
|
|
3155
|
-
actionInstanceInfos?:
|
|
3281
|
+
actionInstanceInfos?: IControllerAction[];
|
|
3156
3282
|
name: string;
|
|
3157
3283
|
private _boundEventHandler;
|
|
3158
3284
|
/** The eventbus passed to attach(), used to report failing actions */
|
|
@@ -3167,21 +3293,7 @@ declare class DOMEventListenerController$1 implements IController<IDOMEventListe
|
|
|
3167
3293
|
* DOM event, and keeps the responder's "did you mean" hint
|
|
3168
3294
|
*/
|
|
3169
3295
|
attach(eventbus: IEventbus): void;
|
|
3170
|
-
private _isStartAction;
|
|
3171
3296
|
private _eventHandler;
|
|
3172
|
-
/**
|
|
3173
|
-
* Runs the actions one after another, merging each action's result into the
|
|
3174
|
-
* operation data for the next. A failing action stops the chain, since later
|
|
3175
|
-
* actions consume the earlier actions' output, and is reported with an error
|
|
3176
|
-
* naming this controller, the action, the phase and the DOM event (see
|
|
3177
|
-
* `_reportFailure`). The operation data is never logged.
|
|
3178
|
-
*/
|
|
3179
|
-
private _executeActions;
|
|
3180
|
-
/**
|
|
3181
|
-
* Reports through the eventbus's `reportError` when it has one, so the
|
|
3182
|
-
* application's `onHandlerError` sees it; otherwise logs it.
|
|
3183
|
-
*/
|
|
3184
|
-
private _reportFailure;
|
|
3185
3297
|
/**
|
|
3186
3298
|
* Removes only the handler this controller registered, so other handlers for
|
|
3187
3299
|
* the same event on the element keep working, and resets the action
|
|
@@ -3254,6 +3366,9 @@ export type IControllerMetadata<T> = {
|
|
|
3254
3366
|
//#region src/controllers/metadata/dom-event-listener-controller.d.ts
|
|
3255
3367
|
declare function DOMEventListenerController(): IControllerMetadata<IDOMEventListenerControllerOperationData>;
|
|
3256
3368
|
//#endregion
|
|
3369
|
+
//#region src/controllers/metadata/keyboard-controller.d.ts
|
|
3370
|
+
declare function KeyboardController(): IControllerMetadata<IKeyboardControllerOperationData>;
|
|
3371
|
+
//#endregion
|
|
3257
3372
|
//#region src/controllers/metadata/label-controller.d.ts
|
|
3258
3373
|
declare function LabelController(): IControllerMetadata<ILabelControllerMetadata>;
|
|
3259
3374
|
//#endregion
|
|
@@ -3275,7 +3390,7 @@ declare function RoutingController(): IControllerMetadata<IRoutingControllerOper
|
|
|
3275
3390
|
//#region src/controllers/metadata/subtitles-controller.d.ts
|
|
3276
3391
|
declare function SubtitlesController(): IControllerMetadata<ISubtitlesControllerOperationData>;
|
|
3277
3392
|
declare namespace index_d_exports {
|
|
3278
|
-
export { DOMEventListenerController, IControllerMetadata, LabelController, LottieController, MutationObserverController, NavigationController, ProgressbarController, RoutingController, SubtitlesController };
|
|
3393
|
+
export { DOMEventListenerController, IControllerMetadata, KeyboardController, LabelController, LottieController, MutationObserverController, NavigationController, ProgressbarController, RoutingController, SubtitlesController };
|
|
3279
3394
|
}
|
|
3280
3395
|
//#endregion
|
|
3281
3396
|
//#region src/eventbus/events/metadata/before-request-timeline-uri.d.ts
|
package/dist/metadata.mjs
CHANGED
|
@@ -10,7 +10,9 @@ executes the given actions with the given operation data.
|
|
|
10
10
|
By default the \`start\` operations of the specified actions are executed. To execute the \`end\` operations instead,
|
|
11
11
|
prefix the action name with \`end:\`.
|
|
12
12
|
|
|
13
|
-
The actions
|
|
13
|
+
The actions receive a copy of \`actionOperationData\` plus \`eventTarget\` (the event's target) and, for key events,
|
|
14
|
+
\`eventKey\` (the \`KeyboardEvent.key\`). They run in order, each receiving the operation data the previous one
|
|
15
|
+
returned. When an action fails, the
|
|
14
16
|
remaining actions are skipped and the failure is reported through the eventbus's \`reportError\` (an error naming
|
|
15
17
|
this controller, the action and the DOM event, with the original error as \`cause\`), or logged with
|
|
16
18
|
\`console.error\` when the eventbus has no \`reportError\`.`,
|
|
@@ -29,6 +31,49 @@ this controller, the action and the DOM event, with the original error as \`caus
|
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/controllers/metadata/keyboard-controller.ts
|
|
36
|
+
function KeyboardController() {
|
|
37
|
+
return {
|
|
38
|
+
description: `This controller runs the given actions when one of the given keys is pressed.
|
|
39
|
+
|
|
40
|
+
By default the \`start\` operations of the specified actions are executed. To execute the \`end\` operations instead,
|
|
41
|
+
prefix the action name with \`end:\`.
|
|
42
|
+
|
|
43
|
+
The actions receive a copy of \`actionOperationData\` plus \`eventTarget\` (the focused element, or the body when
|
|
44
|
+
nothing has focus) and \`eventKey\` (the \`KeyboardEvent.key\`). They run in order, each receiving the operation data
|
|
45
|
+
the previous one returned. When an action fails, the remaining actions are skipped and the failure is reported
|
|
46
|
+
through the eventbus's \`reportError\`, or logged with \`console.error\` when the eventbus has no \`reportError\`.
|
|
47
|
+
|
|
48
|
+
With \`scope: 'document'\` (the default) the keys work while the focus is inside the engine root, or while nothing
|
|
49
|
+
has focus. With \`scope: 'element'\` they only work while the focus is inside the selected element. Presses in
|
|
50
|
+
\`input\`, \`select\`, \`textarea\` and contenteditable elements are ignored, so typing keeps working. A handled press
|
|
51
|
+
has its default action prevented (no scrolling for arrow keys and space); a held key runs the actions once, not
|
|
52
|
+
again for every key repeat.
|
|
53
|
+
|
|
54
|
+
When the keys include the play toggle hotkey of the engine (space by default), or a key that the engine's
|
|
55
|
+
KeyboardStepSource binds (the arrow keys, \`shift+left\`/\`shift+right\`, \`home\` and \`end\`), the controller wins: a
|
|
56
|
+
press it handles runs its actions and does not toggle playback or step the timeline. A press it ignores (for
|
|
57
|
+
example outside the selected element with \`scope: 'element'\`) still does.
|
|
58
|
+
|
|
59
|
+
The keys are bound in the hotkeys-js \`'all'\` scope, so they work whatever scope a KeyboardStepSource sets. The
|
|
60
|
+
hotkeys-js global \`filter\` still applies. Detaching removes only this controller's handler.`,
|
|
61
|
+
dependentProperties: ["selectedElement"],
|
|
62
|
+
properties: {
|
|
63
|
+
keys: {
|
|
64
|
+
type: "ParameterType:string",
|
|
65
|
+
required: true
|
|
66
|
+
},
|
|
67
|
+
actions: {
|
|
68
|
+
type: "ParameterType:array",
|
|
69
|
+
itemType: "ParameterType:string"
|
|
70
|
+
},
|
|
71
|
+
actionOperationData: { type: "ParameterType:object" },
|
|
72
|
+
scope: { type: [{ value: "document" }, { value: "element" }] }
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
32
77
|
//#endregion
|
|
33
78
|
//#region src/controllers/metadata/label-controller.ts
|
|
34
79
|
function LabelController() {
|
|
@@ -186,6 +231,7 @@ Subtitle texts may contain simple inline markup. They are passed through
|
|
|
186
231
|
//#region src/controllers/metadata/index.ts
|
|
187
232
|
var metadata_exports = /* @__PURE__ */ __exportAll({
|
|
188
233
|
DOMEventListenerController: () => DOMEventListenerController,
|
|
234
|
+
KeyboardController: () => KeyboardController,
|
|
189
235
|
LabelController: () => LabelController,
|
|
190
236
|
LottieController: () => LottieController,
|
|
191
237
|
MutationObserverController: () => MutationObserverController,
|