eligius 3.0.0 → 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 +165 -26
- package/dist/configuration-api.mjs +51 -3
- package/dist/configuration-api.mjs.map +1 -1
- package/dist/index.d.mts +459 -236
- package/dist/index.mjs +800 -283
- package/dist/index.mjs.map +1 -1
- package/dist/metadata.d.mts +156 -22
- package/dist/metadata.mjs +98 -2
- 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
|
|
@@ -3190,6 +3302,21 @@ declare class DOMEventListenerController$1 implements IController<IDOMEventListe
|
|
|
3190
3302
|
detach(_eventbus: IEventbus): void;
|
|
3191
3303
|
}
|
|
3192
3304
|
//#endregion
|
|
3305
|
+
//#region src/operation/metadata/parameter-types.d.ts
|
|
3306
|
+
/**
|
|
3307
|
+
* Every parameter type the operation and controller metadata may use. The
|
|
3308
|
+
* metadata generator fails on a type name that is not in this list.
|
|
3309
|
+
*
|
|
3310
|
+
* `RegExp` and the DOM node types (`Element`, `Text`, `Comment`, `Document`,
|
|
3311
|
+
* `DocumentFragment`) are the names the generator emits for `string | RegExp`
|
|
3312
|
+
* and `string | JQuery.Node` properties.
|
|
3313
|
+
*
|
|
3314
|
+
* Kept out of `types.ts`: the generated metadata index re-exports `types.ts`
|
|
3315
|
+
* into the `metadata` namespace, whose consumers expect only metadata
|
|
3316
|
+
* functions there.
|
|
3317
|
+
*/
|
|
3318
|
+
export declare const PARAMETER_TYPES: readonly ["ParameterType:htmlElementName", "ParameterType:className", "ParameterType:selector", "ParameterType:string", "ParameterType:number", "ParameterType:object", "ParameterType:boolean", "ParameterType:array", "ParameterType:eventTopic", "ParameterType:eventName", "ParameterType:systemName", "ParameterType:actionName", "ParameterType:controllerName", "ParameterType:dimensions", "ParameterType:dimensionsModifier", "ParameterType:url", "ParameterType:htmlContent", "ParameterType:labelId", "ParameterType:ImagePath", "ParameterType:QuadrantPosition", "ParameterType:jQuery", "ParameterType:expression", "ParameterType:mathfunction", "ParameterType:cssProperties", "ParameterType:function", "ParameterType:Date", "ParameterType:languagecode", "ParameterType:RegExp", "ParameterType:Element", "ParameterType:Text", "ParameterType:Comment", "ParameterType:Document", "ParameterType:DocumentFragment"];
|
|
3319
|
+
//#endregion
|
|
3193
3320
|
//#region src/operation/metadata/types.d.ts
|
|
3194
3321
|
export type THasRequired = {
|
|
3195
3322
|
required?: boolean;
|
|
@@ -3222,7 +3349,11 @@ export interface IOperationMetadata<T> {
|
|
|
3222
3349
|
outputProperties?: TPropertiesMetadata<T>;
|
|
3223
3350
|
}
|
|
3224
3351
|
export type TParameterTypesDelimited = `${TParameterTypes}` | `${TParameterTypes}|${string}`;
|
|
3225
|
-
export type TParameterTypes =
|
|
3352
|
+
export type TParameterTypes = (typeof PARAMETER_TYPES)[number];
|
|
3353
|
+
/**
|
|
3354
|
+
* A parameter type without its `ParameterType:` prefix, e.g. `className`.
|
|
3355
|
+
*/
|
|
3356
|
+
export type TParameterTypeName = TParameterTypes extends `ParameterType:${infer Name}` ? Name : never;
|
|
3226
3357
|
export type TOperationCategory = 'DOM' | 'Controller' | 'Data' | 'Control Flow' | 'Animation' | 'Form' | 'Scroll' | 'Focus' | 'Array' | 'String' | 'Text' | 'Date' | 'HTTP' | 'Action' | 'Utility' | 'Accessibility';
|
|
3227
3358
|
//#endregion
|
|
3228
3359
|
//#region src/controllers/metadata/types.d.ts
|
|
@@ -3235,6 +3366,9 @@ export type IControllerMetadata<T> = {
|
|
|
3235
3366
|
//#region src/controllers/metadata/dom-event-listener-controller.d.ts
|
|
3236
3367
|
declare function DOMEventListenerController(): IControllerMetadata<IDOMEventListenerControllerOperationData>;
|
|
3237
3368
|
//#endregion
|
|
3369
|
+
//#region src/controllers/metadata/keyboard-controller.d.ts
|
|
3370
|
+
declare function KeyboardController(): IControllerMetadata<IKeyboardControllerOperationData>;
|
|
3371
|
+
//#endregion
|
|
3238
3372
|
//#region src/controllers/metadata/label-controller.d.ts
|
|
3239
3373
|
declare function LabelController(): IControllerMetadata<ILabelControllerMetadata>;
|
|
3240
3374
|
//#endregion
|
|
@@ -3256,7 +3390,7 @@ declare function RoutingController(): IControllerMetadata<IRoutingControllerOper
|
|
|
3256
3390
|
//#region src/controllers/metadata/subtitles-controller.d.ts
|
|
3257
3391
|
declare function SubtitlesController(): IControllerMetadata<ISubtitlesControllerOperationData>;
|
|
3258
3392
|
declare namespace index_d_exports {
|
|
3259
|
-
export { DOMEventListenerController, IControllerMetadata, LabelController, LottieController, MutationObserverController, NavigationController, ProgressbarController, RoutingController, SubtitlesController };
|
|
3393
|
+
export { DOMEventListenerController, IControllerMetadata, KeyboardController, LabelController, LottieController, MutationObserverController, NavigationController, ProgressbarController, RoutingController, SubtitlesController };
|
|
3260
3394
|
}
|
|
3261
3395
|
//#endregion
|
|
3262
3396
|
//#region src/eventbus/events/metadata/before-request-timeline-uri.d.ts
|
|
@@ -3637,7 +3771,7 @@ declare function wait(): IOperationMetadata<IWaitOperationData>;
|
|
|
3637
3771
|
//#region src/operation/metadata/when.d.ts
|
|
3638
3772
|
declare function when(): IOperationMetadata<IWhenOperationData>;
|
|
3639
3773
|
declare namespace index_d_exports$2 {
|
|
3640
|
-
export { IOperationMetadata, TArrayProperyMetadata, TComplexPropertyMetadata, TConstantParametersTypes, THasDescription, THasErased, THasRequired, TOperationCategory, TParameterTypes, TParameterTypesDelimited, TPropertiesMetadata, TPropertyMetadata, 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 };
|
|
3774
|
+
export { IOperationMetadata, TArrayProperyMetadata, TComplexPropertyMetadata, TConstantParametersTypes, THasDescription, THasErased, THasRequired, TOperationCategory, TParameterTypeName, TParameterTypes, TParameterTypesDelimited, TPropertiesMetadata, TPropertyMetadata, 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 };
|
|
3641
3775
|
}
|
|
3642
3776
|
//#endregion
|
|
3643
3777
|
export { index_d_exports as ctrlmetadata, index_d_exports$1 as eventmetadata, index_d_exports$2 as metadata };
|
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,
|
|
@@ -2749,5 +2795,55 @@ var metadata_exports$2 = /* @__PURE__ */ __exportAll({
|
|
|
2749
2795
|
});
|
|
2750
2796
|
|
|
2751
2797
|
//#endregion
|
|
2752
|
-
|
|
2798
|
+
//#region src/operation/metadata/parameter-types.ts
|
|
2799
|
+
/**
|
|
2800
|
+
* Every parameter type the operation and controller metadata may use. The
|
|
2801
|
+
* metadata generator fails on a type name that is not in this list.
|
|
2802
|
+
*
|
|
2803
|
+
* `RegExp` and the DOM node types (`Element`, `Text`, `Comment`, `Document`,
|
|
2804
|
+
* `DocumentFragment`) are the names the generator emits for `string | RegExp`
|
|
2805
|
+
* and `string | JQuery.Node` properties.
|
|
2806
|
+
*
|
|
2807
|
+
* Kept out of `types.ts`: the generated metadata index re-exports `types.ts`
|
|
2808
|
+
* into the `metadata` namespace, whose consumers expect only metadata
|
|
2809
|
+
* functions there.
|
|
2810
|
+
*/
|
|
2811
|
+
const PARAMETER_TYPES = [
|
|
2812
|
+
"ParameterType:htmlElementName",
|
|
2813
|
+
"ParameterType:className",
|
|
2814
|
+
"ParameterType:selector",
|
|
2815
|
+
"ParameterType:string",
|
|
2816
|
+
"ParameterType:number",
|
|
2817
|
+
"ParameterType:object",
|
|
2818
|
+
"ParameterType:boolean",
|
|
2819
|
+
"ParameterType:array",
|
|
2820
|
+
"ParameterType:eventTopic",
|
|
2821
|
+
"ParameterType:eventName",
|
|
2822
|
+
"ParameterType:systemName",
|
|
2823
|
+
"ParameterType:actionName",
|
|
2824
|
+
"ParameterType:controllerName",
|
|
2825
|
+
"ParameterType:dimensions",
|
|
2826
|
+
"ParameterType:dimensionsModifier",
|
|
2827
|
+
"ParameterType:url",
|
|
2828
|
+
"ParameterType:htmlContent",
|
|
2829
|
+
"ParameterType:labelId",
|
|
2830
|
+
"ParameterType:ImagePath",
|
|
2831
|
+
"ParameterType:QuadrantPosition",
|
|
2832
|
+
"ParameterType:jQuery",
|
|
2833
|
+
"ParameterType:expression",
|
|
2834
|
+
"ParameterType:mathfunction",
|
|
2835
|
+
"ParameterType:cssProperties",
|
|
2836
|
+
"ParameterType:function",
|
|
2837
|
+
"ParameterType:Date",
|
|
2838
|
+
"ParameterType:languagecode",
|
|
2839
|
+
"ParameterType:RegExp",
|
|
2840
|
+
"ParameterType:Element",
|
|
2841
|
+
"ParameterType:Text",
|
|
2842
|
+
"ParameterType:Comment",
|
|
2843
|
+
"ParameterType:Document",
|
|
2844
|
+
"ParameterType:DocumentFragment"
|
|
2845
|
+
];
|
|
2846
|
+
|
|
2847
|
+
//#endregion
|
|
2848
|
+
export { PARAMETER_TYPES, metadata_exports as ctrlmetadata, metadata_exports$1 as eventmetadata, metadata_exports$2 as metadata };
|
|
2753
2849
|
//# sourceMappingURL=metadata.mjs.map
|