eligius 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configuration-api.d.mts +107 -101
- package/dist/configuration-api.mjs +6 -6
- package/dist/configuration-api.mjs.map +1 -1
- package/dist/{engine-factory-39T5FByM.mjs → engine-factory-65BHSli8.mjs} +201 -230
- package/dist/engine-factory-65BHSli8.mjs.map +1 -0
- package/dist/index.d.mts +3 -4
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/lint.d.mts +104 -100
- package/dist/lint.mjs +56 -26
- package/dist/lint.mjs.map +1 -1
- package/dist/{locale-manager-CJy3musb.d.mts → locale-manager-DY4_d4Zv.d.mts} +120 -135
- package/dist/metadata.d.mts +101 -101
- package/dist/metadata.mjs +5 -72
- package/dist/metadata.mjs.map +1 -1
- package/dist/{rolldown-runtime-CGzGPw9x.mjs → rolldown-runtime-DTOZ5ltL.mjs} +4 -4
- package/dist/runtime.d.mts +21 -2
- package/dist/runtime.mjs +1 -1
- package/jsonschema/eligius-configuration.json +3 -0
- package/jsonschema/operations/math.json +6 -27
- package/package.json +25 -15
- package/dist/engine-factory-39T5FByM.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DTOZ5ltL.mjs";
|
|
3
3
|
import hotkeys from "hotkeys-js";
|
|
4
4
|
import $ from "jquery";
|
|
5
5
|
import { isDefined } from "ts-is-present";
|
|
@@ -1009,6 +1009,7 @@ var Action = class {
|
|
|
1009
1009
|
name;
|
|
1010
1010
|
startOperations;
|
|
1011
1011
|
eventbus;
|
|
1012
|
+
services;
|
|
1012
1013
|
id = "";
|
|
1013
1014
|
/**
|
|
1014
1015
|
* Scope stack used by {@link executeOperation} when it is called without an
|
|
@@ -1025,10 +1026,11 @@ var Action = class {
|
|
|
1025
1026
|
* again instead of deep-copying the collection on every iteration.
|
|
1026
1027
|
*/
|
|
1027
1028
|
_loopOperationData = /* @__PURE__ */ new WeakMap();
|
|
1028
|
-
constructor(name, startOperations, eventbus) {
|
|
1029
|
+
constructor(name, startOperations, eventbus, services) {
|
|
1029
1030
|
this.name = name;
|
|
1030
1031
|
this.startOperations = startOperations;
|
|
1031
1032
|
this.eventbus = eventbus;
|
|
1033
|
+
this.services = services;
|
|
1032
1034
|
}
|
|
1033
1035
|
/**
|
|
1034
1036
|
* Runs the start operations.
|
|
@@ -1071,6 +1073,7 @@ var Action = class {
|
|
|
1071
1073
|
return [{
|
|
1072
1074
|
currentIndex: -1,
|
|
1073
1075
|
eventbus: this.eventbus,
|
|
1076
|
+
services: this.services,
|
|
1074
1077
|
operations
|
|
1075
1078
|
}];
|
|
1076
1079
|
}
|
|
@@ -1092,6 +1095,9 @@ var Action = class {
|
|
|
1092
1095
|
get eventbus() {
|
|
1093
1096
|
return parentScope.eventbus;
|
|
1094
1097
|
},
|
|
1098
|
+
get services() {
|
|
1099
|
+
return parentScope.services;
|
|
1100
|
+
},
|
|
1095
1101
|
get operations() {
|
|
1096
1102
|
return parentScope.operations;
|
|
1097
1103
|
},
|
|
@@ -1237,8 +1243,8 @@ function copyConfiguredOperationData(operationData, systemName) {
|
|
|
1237
1243
|
// src/action/endable-action.ts
|
|
1238
1244
|
var EndableAction = class extends Action {
|
|
1239
1245
|
endOperations;
|
|
1240
|
-
constructor(name, startOperations, endOperations, eventBus) {
|
|
1241
|
-
super(name, startOperations, eventBus);
|
|
1246
|
+
constructor(name, startOperations, endOperations, eventBus, services) {
|
|
1247
|
+
super(name, startOperations, eventBus, services);
|
|
1242
1248
|
this.endOperations = endOperations;
|
|
1243
1249
|
}
|
|
1244
1250
|
/**
|
|
@@ -1279,8 +1285,8 @@ var TimelineAction = class extends EndableAction {
|
|
|
1279
1285
|
get active() {
|
|
1280
1286
|
return this._active;
|
|
1281
1287
|
}
|
|
1282
|
-
constructor(name, startOperations, endOperations, duration, eventBus) {
|
|
1283
|
-
super(name, startOperations, endOperations, eventBus);
|
|
1288
|
+
constructor(name, startOperations, endOperations, duration, eventBus, services) {
|
|
1289
|
+
super(name, startOperations, endOperations, eventBus, services);
|
|
1284
1290
|
this.duration = duration;
|
|
1285
1291
|
}
|
|
1286
1292
|
/**
|
|
@@ -1480,9 +1486,6 @@ var EngineEventbusAdapter = class {
|
|
|
1480
1486
|
this._registerRequest("timeline-container-request", () => {
|
|
1481
1487
|
return this._engine.container;
|
|
1482
1488
|
});
|
|
1483
|
-
this._registerRequest("request-engine-root", () => {
|
|
1484
|
-
return this._engine.engineRoot;
|
|
1485
|
-
});
|
|
1486
1489
|
this._registerRequest("timeline-request-current-timeline", () => {
|
|
1487
1490
|
return this._engine.currentTimelineUri;
|
|
1488
1491
|
});
|
|
@@ -2002,7 +2005,7 @@ function unregisterController(element, controller) {
|
|
|
2002
2005
|
const addControllerToElement$1 = function(operationData) {
|
|
2003
2006
|
const { selectedElement, controllerInstance } = operationData;
|
|
2004
2007
|
controllerInstance.init(operationData);
|
|
2005
|
-
const promise = controllerInstance.attach(this.eventbus);
|
|
2008
|
+
const promise = controllerInstance.attach(this.eventbus, this.services);
|
|
2006
2009
|
attachControllerToElement(selectedElement, controllerInstance);
|
|
2007
2010
|
if (promise) return new Promise((resolve, reject) => {
|
|
2008
2011
|
promise.then((newOperationData) => {
|
|
@@ -2964,47 +2967,27 @@ const createElement$1 = function(operationData) {
|
|
|
2964
2967
|
return operationData;
|
|
2965
2968
|
};
|
|
2966
2969
|
|
|
2967
|
-
// src/operation/helper/
|
|
2970
|
+
// src/operation/helper/lookup-named-entry.ts
|
|
2968
2971
|
/**
|
|
2969
|
-
*
|
|
2970
|
-
* `
|
|
2971
|
-
* operation when
|
|
2972
|
+
* Looks up the entry registered under `systemName` with `lookup` (one of the
|
|
2973
|
+
* engine services, such as `this.services.getAction`), and fails with an
|
|
2974
|
+
* error that names the calling operation when the lookup throws or answers
|
|
2975
|
+
* `undefined` or `null`.
|
|
2972
2976
|
*
|
|
2973
|
-
*
|
|
2974
|
-
*
|
|
2975
|
-
* hint. That message is kept and the original error becomes the `cause`.
|
|
2977
|
+
* A message thrown by the lookup (such as the importer's "did you mean"
|
|
2978
|
+
* hint) is kept, and the original error becomes the `cause`.
|
|
2976
2979
|
*
|
|
2977
|
-
* @param eventbus - The eventbus to send the request on
|
|
2978
|
-
* @param operationName - The name of the calling operation, used as the message prefix
|
|
2979
|
-
* @param systemName - The configured name to look up
|
|
2980
|
-
* @param noun - What is being looked up, for the message (for example `'function'`)
|
|
2981
|
-
* @returns The registered entry, never `undefined` or `null`
|
|
2982
|
-
* @throws Error when the lookup throws or nothing is registered under `systemName`
|
|
2983
|
-
*/
|
|
2984
|
-
function requestRegisteredEntry(eventbus, operationName, systemName, noun) {
|
|
2985
|
-
return requestNamedEntry(eventbus, "request-function", operationName, systemName, noun);
|
|
2986
|
-
}
|
|
2987
|
-
/**
|
|
2988
|
-
* Sends the request `eventName` with `systemName` as its argument, and fails
|
|
2989
|
-
* with an error that names the calling operation when the responder throws or
|
|
2990
|
-
* answers `undefined` or `null`.
|
|
2991
|
-
*
|
|
2992
|
-
* Used for the `request-function`, `request-instance` and `request-action`
|
|
2993
|
-
* lookups. A message thrown by the responder (such as the importer's "did you
|
|
2994
|
-
* mean" hint) is kept, and the original error becomes the `cause`.
|
|
2995
|
-
*
|
|
2996
|
-
* @param eventbus - The eventbus to send the request on
|
|
2997
|
-
* @param eventName - The request event, for example `'request-instance'`
|
|
2998
2980
|
* @param operationName - The name of the calling operation, used as the message prefix
|
|
2999
2981
|
* @param systemName - The configured name to look up
|
|
2982
|
+
* @param lookup - Returns the entry for a name, or throws for an unknown one
|
|
3000
2983
|
* @param noun - What is being looked up, for the message (for example `'controller'`)
|
|
3001
2984
|
* @returns The registered entry, never `undefined` or `null`
|
|
3002
2985
|
* @throws Error when the lookup throws or nothing is registered under `systemName`
|
|
3003
2986
|
*/
|
|
3004
|
-
function
|
|
2987
|
+
function lookupNamedEntry(operationName, systemName, lookup, noun) {
|
|
3005
2988
|
let entry;
|
|
3006
2989
|
try {
|
|
3007
|
-
entry =
|
|
2990
|
+
entry = lookup(systemName);
|
|
3008
2991
|
} catch (error) {
|
|
3009
2992
|
const reason = error instanceof Error ? error.message : String(error);
|
|
3010
2993
|
const what = noun ? `${noun} '${systemName}'` : `'${systemName}'`;
|
|
@@ -3027,8 +3010,8 @@ function isFunction(value) {
|
|
|
3027
3010
|
* This operation retrieves a custom function defined by the given system name
|
|
3028
3011
|
* and invokes it with the current operation data and eventbus.
|
|
3029
3012
|
*
|
|
3030
|
-
* The function is looked up with
|
|
3031
|
-
*
|
|
3013
|
+
* The function is looked up with `this.services.getImport`, which answers from
|
|
3014
|
+
* the engine's resource importer. Register the function
|
|
3032
3015
|
* with the `EligiusResourceImporter` constructor:
|
|
3033
3016
|
* `new EligiusResourceImporter({functions: {myFunction}})`.
|
|
3034
3017
|
*
|
|
@@ -3049,7 +3032,7 @@ function isFunction(value) {
|
|
|
3049
3032
|
const customFunction$1 = function(operationData) {
|
|
3050
3033
|
const { systemName } = operationData;
|
|
3051
3034
|
removeProperties(operationData, "systemName");
|
|
3052
|
-
const func =
|
|
3035
|
+
const func = lookupNamedEntry("customFunction", systemName, (name) => this.services.getImport(name), "function");
|
|
3053
3036
|
if (!isFunction(func)) throw new Error(`customFunction: systemName '${systemName}' does not resolve to a function.`);
|
|
3054
3037
|
const result = func.apply(createScopeView(this), [operationData]);
|
|
3055
3038
|
if (result !== null && isPromise(result)) return new Promise((resolve, reject) => {
|
|
@@ -3365,7 +3348,7 @@ const formatText$1 = (operationData) => {
|
|
|
3365
3348
|
case "trim":
|
|
3366
3349
|
text = text.trim();
|
|
3367
3350
|
break;
|
|
3368
|
-
default: throw new Error(`formatText: unknown transformation type "${transformation}"`);
|
|
3351
|
+
default: throw new Error(`formatText: unknown transformation type "${String(transformation)}"`);
|
|
3369
3352
|
}
|
|
3370
3353
|
operationData.formattedText = text;
|
|
3371
3354
|
removeProperties(operationData, "transformation");
|
|
@@ -3422,7 +3405,7 @@ const getControllerFromElement$1 = (operationData) => {
|
|
|
3422
3405
|
const getControllerInstance$1 = function(operationData) {
|
|
3423
3406
|
const { systemName } = operationData;
|
|
3424
3407
|
removeProperties(operationData, "systemName");
|
|
3425
|
-
operationData.controllerInstance =
|
|
3408
|
+
operationData.controllerInstance = lookupNamedEntry("getControllerInstance", systemName, (name) => this.services.createInstance(name), "controller");
|
|
3426
3409
|
return operationData;
|
|
3427
3410
|
};
|
|
3428
3411
|
|
|
@@ -3660,8 +3643,8 @@ const getFormData$1 = (operationData) => {
|
|
|
3660
3643
|
* This operation retrieves the import specified by the given `systemName` and
|
|
3661
3644
|
* assigns it to the `importedInstance` property on the current operaton date.
|
|
3662
3645
|
*
|
|
3663
|
-
* The import is looked up with
|
|
3664
|
-
*
|
|
3646
|
+
* The import is looked up with `this.services.getImport`, which answers from
|
|
3647
|
+
* the engine's resource importer. Functions, templates
|
|
3665
3648
|
* and JSON registered with the `EligiusResourceImporter` constructor
|
|
3666
3649
|
* (`new EligiusResourceImporter({json: {settings}})`) can be imported this
|
|
3667
3650
|
* way, as can every built-in operation, controller and provider export.
|
|
@@ -3676,7 +3659,7 @@ const getFormData$1 = (operationData) => {
|
|
|
3676
3659
|
const getImport$1 = function(operationData) {
|
|
3677
3660
|
const { systemName } = operationData;
|
|
3678
3661
|
delete operationData.systemName;
|
|
3679
|
-
operationData.importedInstance =
|
|
3662
|
+
operationData.importedInstance = lookupNamedEntry("getImport", systemName, (name) => this.services.getImport(name));
|
|
3680
3663
|
return operationData;
|
|
3681
3664
|
};
|
|
3682
3665
|
|
|
@@ -4425,7 +4408,7 @@ const reparentElement$1 = function(operationData) {
|
|
|
4425
4408
|
removeProperties(operationData, "newParentSelector");
|
|
4426
4409
|
if (typeof newParentSelector !== "string" || !newParentSelector.trim()) throw new Error("reparentElement: newParentSelector is required");
|
|
4427
4410
|
if (newParentSelector.trim().startsWith("<")) throw new Error("reparentElement: newParentSelector must be a selector, not HTML");
|
|
4428
|
-
const root = this.
|
|
4411
|
+
const root = this.services.getEngineRoot();
|
|
4429
4412
|
if (!root?.length) throw new Error("reparentElement: the engine root is not available");
|
|
4430
4413
|
const target = root.filter(newParentSelector).add(root.find(newParentSelector));
|
|
4431
4414
|
if (target.length === 0) throw new Error(`reparentElement: '${newParentSelector}' matched no element inside the engine root`);
|
|
@@ -4541,10 +4524,10 @@ const replaceText$1 = (operationData) => {
|
|
|
4541
4524
|
*
|
|
4542
4525
|
* @category Action
|
|
4543
4526
|
*/
|
|
4544
|
-
const requestAction$
|
|
4527
|
+
const requestAction$1 = function(operationData) {
|
|
4545
4528
|
const { systemName } = operationData;
|
|
4546
4529
|
removeProperties(operationData, "systemName");
|
|
4547
|
-
operationData.actionInstance =
|
|
4530
|
+
operationData.actionInstance = lookupNamedEntry("requestAction", systemName, (name) => this.services.getAction(name), "action");
|
|
4548
4531
|
return operationData;
|
|
4549
4532
|
};
|
|
4550
4533
|
|
|
@@ -4697,12 +4680,10 @@ const selectElement$1 = function(operationData) {
|
|
|
4697
4680
|
removeProperties(operationData, "selector", "useSelectedElementAsRoot");
|
|
4698
4681
|
if (!selector) throw new Error("selectElement: selector is either empty or not defined.");
|
|
4699
4682
|
if (useSelectedElementAsRoot && operationData.selectedElement) {
|
|
4700
|
-
|
|
4701
|
-
operationData.selectedElement = findElementBySelector(currentRoot, selector);
|
|
4683
|
+
operationData.selectedElement = findElementBySelector(operationData.selectedElement, selector);
|
|
4702
4684
|
return operationData;
|
|
4703
4685
|
}
|
|
4704
|
-
|
|
4705
|
-
if (root) operationData.selectedElement = findElementBySelector(root, selector);
|
|
4686
|
+
operationData.selectedElement = findElementBySelector(this.services.getEngineRoot(), selector);
|
|
4706
4687
|
return operationData;
|
|
4707
4688
|
};
|
|
4708
4689
|
|
|
@@ -5664,8 +5645,8 @@ function customFunction() {
|
|
|
5664
5645
|
description: `This operation retrieves a custom function defined by the given system name
|
|
5665
5646
|
and invokes it with the current operation data and eventbus.
|
|
5666
5647
|
|
|
5667
|
-
The function is looked up with
|
|
5668
|
-
|
|
5648
|
+
The function is looked up with \`this.services.getImport\`, which answers from
|
|
5649
|
+
the engine's resource importer. Register the function
|
|
5669
5650
|
with the \`EligiusResourceImporter\` constructor:
|
|
5670
5651
|
\`new EligiusResourceImporter({functions: {myFunction}})\`.
|
|
5671
5652
|
|
|
@@ -5988,8 +5969,8 @@ function getImport() {
|
|
|
5988
5969
|
description: `This operation retrieves the import specified by the given \`systemName\` and
|
|
5989
5970
|
assigns it to the \`importedInstance\` property on the current operaton date.
|
|
5990
5971
|
|
|
5991
|
-
The import is looked up with
|
|
5992
|
-
|
|
5972
|
+
The import is looked up with \`this.services.getImport\`, which answers from
|
|
5973
|
+
the engine's resource importer. Functions, templates
|
|
5993
5974
|
and JSON registered with the \`EligiusResourceImporter\` constructor
|
|
5994
5975
|
(\`new EligiusResourceImporter({json: {settings}})\`) can be imported this
|
|
5995
5976
|
way, as can every built-in operation, controller and provider export.`,
|
|
@@ -6433,7 +6414,7 @@ A string pattern replaces every occurrence and inserts the replacement literally
|
|
|
6433
6414
|
}
|
|
6434
6415
|
|
|
6435
6416
|
// src/operation/metadata/request-action.ts
|
|
6436
|
-
function requestAction
|
|
6417
|
+
function requestAction() {
|
|
6437
6418
|
return {
|
|
6438
6419
|
description: `This operation requests an action instance with the specified name and assigns it
|
|
6439
6420
|
to the \`actionInstance\` property on the current operation data.`,
|
|
@@ -7019,7 +7000,7 @@ var metadata_exports$2 = /* @__PURE__ */ __exportAll({
|
|
|
7019
7000
|
reparentElement: () => reparentElement,
|
|
7020
7001
|
replaceString: () => replaceString,
|
|
7021
7002
|
replaceText: () => replaceText,
|
|
7022
|
-
requestAction: () => requestAction
|
|
7003
|
+
requestAction: () => requestAction,
|
|
7023
7004
|
saveToStorage: () => saveToStorage,
|
|
7024
7005
|
scrollToElement: () => scrollToElement,
|
|
7025
7006
|
scrollToPosition: () => scrollToPosition,
|
|
@@ -7563,16 +7544,19 @@ function warnToConsole(warning) {
|
|
|
7563
7544
|
var ConfigurationResolver = class {
|
|
7564
7545
|
importer;
|
|
7565
7546
|
eventbus;
|
|
7547
|
+
services;
|
|
7566
7548
|
_warn;
|
|
7567
7549
|
/**
|
|
7568
7550
|
* @param importer - Resolves system names to operations, controllers and providers
|
|
7569
7551
|
* @param eventbus - The eventbus the resolved actions run on
|
|
7552
|
+
* @param services - The services of the engine the resolved actions run in
|
|
7570
7553
|
* @param options - Optional. `onWarning` receives the configuration
|
|
7571
7554
|
* warnings instead of the console.
|
|
7572
7555
|
*/
|
|
7573
|
-
constructor(importer, eventbus, options = {}) {
|
|
7556
|
+
constructor(importer, eventbus, services, options = {}) {
|
|
7574
7557
|
this.importer = importer;
|
|
7575
7558
|
this.eventbus = eventbus;
|
|
7559
|
+
this.services = services;
|
|
7576
7560
|
this._warn = options.onWarning ?? warnToConsole;
|
|
7577
7561
|
}
|
|
7578
7562
|
process(configuration, actionRegistryListener) {
|
|
@@ -7589,16 +7573,16 @@ var ConfigurationResolver = class {
|
|
|
7589
7573
|
language: configuration.language,
|
|
7590
7574
|
layoutTemplate: configuration.layoutTemplate,
|
|
7591
7575
|
availableLanguages: deepCopy(configuration.availableLanguages),
|
|
7592
|
-
actions: resolveActions(configuration.actions, this.importer, this.eventbus, "actions", this._warn),
|
|
7593
|
-
initActions: resolveActions(configuration.initActions, this.importer, this.eventbus, "initActions", this._warn),
|
|
7576
|
+
actions: resolveActions(configuration.actions, this.importer, this.eventbus, this.services, "actions", this._warn),
|
|
7577
|
+
initActions: resolveActions(configuration.initActions, this.importer, this.eventbus, this.services, "initActions", this._warn),
|
|
7594
7578
|
timelineFlow: deepCopy(configuration.timelineFlow),
|
|
7595
|
-
timelines: resolveTimelines(configuration.timelines, this.importer, this.eventbus, this._warn)
|
|
7579
|
+
timelines: resolveTimelines(configuration.timelines, this.importer, this.eventbus, this.services, this._warn)
|
|
7596
7580
|
};
|
|
7597
7581
|
assertTimelineProviderSettings(configuration, this.importer);
|
|
7598
7582
|
let eventActions = [];
|
|
7599
7583
|
if (isDefined(configuration.eventActions)) {
|
|
7600
7584
|
assertArray(configuration.eventActions, "eventActions");
|
|
7601
|
-
if (actionRegistryListener) eventActions = resolveEventActions(configuration.eventActions, this.importer, this.eventbus, this._warn);
|
|
7585
|
+
if (actionRegistryListener) eventActions = resolveEventActions(configuration.eventActions, this.importer, this.eventbus, this.services, this._warn);
|
|
7602
7586
|
}
|
|
7603
7587
|
const actionsLookup = createActionsLookup([...resolvedConfig.actions.map((action, index) => [action, `actions[${index}]`]), ...eventActions.map(({ action }, index) => [action, `eventActions[${index}]`])]);
|
|
7604
7588
|
for (const { action, eventName, eventTopic } of eventActions) actionRegistryListener?.registerAction(action, eventName, eventTopic);
|
|
@@ -7733,17 +7717,17 @@ function createActionsLookup(actions) {
|
|
|
7733
7717
|
/**
|
|
7734
7718
|
* Creates the event actions without registering them.
|
|
7735
7719
|
*/
|
|
7736
|
-
function resolveEventActions(eventActionConfigurations, importer, eventbus, warn) {
|
|
7720
|
+
function resolveEventActions(eventActionConfigurations, importer, eventbus, services, warn) {
|
|
7737
7721
|
return eventActionConfigurations.map((config, index) => resolveActionConfiguration(config, importer, `eventActions[${index}]`, warn)).map((config, index) => {
|
|
7738
7722
|
const { eventName, eventTopic } = eventActionConfigurations[index];
|
|
7739
7723
|
return {
|
|
7740
|
-
action: new Action(config.name, config.startOperations, eventbus),
|
|
7724
|
+
action: new Action(config.name, config.startOperations, eventbus, services),
|
|
7741
7725
|
eventName,
|
|
7742
7726
|
eventTopic
|
|
7743
7727
|
};
|
|
7744
7728
|
});
|
|
7745
7729
|
}
|
|
7746
|
-
function resolveTimelines(timelines, importer, eventbus, warn) {
|
|
7730
|
+
function resolveTimelines(timelines, importer, eventbus, services, warn) {
|
|
7747
7731
|
assertArray(timelines, "timelines");
|
|
7748
7732
|
return timelines.map((config, timelineIndex) => {
|
|
7749
7733
|
const path = `timelines[${timelineIndex}]`;
|
|
@@ -7752,7 +7736,7 @@ function resolveTimelines(timelines, importer, eventbus, warn) {
|
|
|
7752
7736
|
...config,
|
|
7753
7737
|
...isDefined(config.positionSource) && { positionSource: deepCopy(config.positionSource) },
|
|
7754
7738
|
...isDefined(config.containerProvider) && { containerProvider: deepCopy(config.containerProvider) },
|
|
7755
|
-
timelineActions: config.timelineActions.map((actionConfig, index) => resolveTimelineAction(importer, eventbus, actionConfig, `${path}.timelineActions[${index}]`, warn))
|
|
7739
|
+
timelineActions: config.timelineActions.map((actionConfig, index) => resolveTimelineAction(importer, eventbus, services, actionConfig, `${path}.timelineActions[${index}]`, warn))
|
|
7756
7740
|
};
|
|
7757
7741
|
});
|
|
7758
7742
|
}
|
|
@@ -7851,20 +7835,20 @@ function resolveDuration(duration, path) {
|
|
|
7851
7835
|
end
|
|
7852
7836
|
};
|
|
7853
7837
|
}
|
|
7854
|
-
function resolveTimelineAction(importer, eventbus, actionConfiguration, path, warn) {
|
|
7838
|
+
function resolveTimelineAction(importer, eventbus, services, actionConfiguration, path, warn) {
|
|
7855
7839
|
const duration = resolveDuration(actionConfiguration.duration, `${path}.duration`);
|
|
7856
7840
|
const { id, name, endOperations, startOperations } = resolveEndableActionConfiguration(actionConfiguration, importer, path, warn);
|
|
7857
|
-
const action = new TimelineAction(name, startOperations, endOperations, duration, eventbus);
|
|
7841
|
+
const action = new TimelineAction(name, startOperations, endOperations, duration, eventbus, services);
|
|
7858
7842
|
action.id = id;
|
|
7859
7843
|
return action;
|
|
7860
7844
|
}
|
|
7861
|
-
function resolveActions(actionConfigurations, importer, eventbus, path, warn) {
|
|
7845
|
+
function resolveActions(actionConfigurations, importer, eventbus, services, path, warn) {
|
|
7862
7846
|
assertArray(actionConfigurations, path);
|
|
7863
7847
|
return actionConfigurations.map((config, index) => {
|
|
7864
7848
|
return resolveEndableActionConfiguration(config, importer, `${path}[${index}]`, warn);
|
|
7865
7849
|
}).map((resolvedConfig) => {
|
|
7866
7850
|
const { name, endOperations, startOperations } = resolvedConfig;
|
|
7867
|
-
const action = new EndableAction(name, startOperations, endOperations, eventbus);
|
|
7851
|
+
const action = new EndableAction(name, startOperations, endOperations, eventbus, services);
|
|
7868
7852
|
action.id = resolvedConfig.id;
|
|
7869
7853
|
return action;
|
|
7870
7854
|
});
|
|
@@ -7949,22 +7933,21 @@ function parseActionName(actionName) {
|
|
|
7949
7933
|
* Looks up the actions by name. A name prefixed with `end:` runs the `end`
|
|
7950
7934
|
* operations of the action instead of its `start` operations.
|
|
7951
7935
|
*
|
|
7952
|
-
* @param
|
|
7936
|
+
* @param services - The engine services to look the actions up in
|
|
7953
7937
|
* @param actionNames - The action names, optionally prefixed with `end:`
|
|
7954
7938
|
* @param controllerName - The controller, named in error messages
|
|
7955
7939
|
* @param trigger - What runs the actions, named in error messages
|
|
7956
7940
|
* @returns The actions in the given order
|
|
7957
|
-
* @throws when an action name is unknown
|
|
7958
|
-
*
|
|
7959
|
-
* trigger, and keeps the responder's "did you mean" hint
|
|
7941
|
+
* @throws when an action name is unknown; the message names the controller,
|
|
7942
|
+
* the action and the trigger, and keeps the "did you mean" hint
|
|
7960
7943
|
*/
|
|
7961
|
-
function requestControllerActions(
|
|
7944
|
+
function requestControllerActions(services, actionNames, controllerName, trigger) {
|
|
7962
7945
|
return actionNames.map((actionName) => {
|
|
7963
7946
|
const [start, name] = parseActionName(actionName);
|
|
7964
7947
|
const unknown = `${controllerName}: unknown action "${name}" for ${trigger.kind} "${trigger.name}"`;
|
|
7965
7948
|
let action;
|
|
7966
7949
|
try {
|
|
7967
|
-
action =
|
|
7950
|
+
action = services.getAction(name);
|
|
7968
7951
|
} catch (error) {
|
|
7969
7952
|
const reason = error instanceof Error ? error.message : String(error);
|
|
7970
7953
|
throw new Error(`${unknown}. ${reason}`, { cause: error });
|
|
@@ -8038,16 +8021,17 @@ var DOMEventListenerController = class {
|
|
|
8038
8021
|
/**
|
|
8039
8022
|
* Looks up the configured actions and starts listening for the DOM event.
|
|
8040
8023
|
*
|
|
8041
|
-
* @param eventbus - The eventbus
|
|
8042
|
-
* @
|
|
8043
|
-
*
|
|
8044
|
-
* DOM event, and keeps the
|
|
8024
|
+
* @param eventbus - The eventbus the actions report errors on
|
|
8025
|
+
* @param services - The engine services to look the actions up in
|
|
8026
|
+
* @throws when an action name is unknown; the message names the
|
|
8027
|
+
* controller, the action and the DOM event, and keeps the "did you mean"
|
|
8028
|
+
* hint
|
|
8045
8029
|
*/
|
|
8046
|
-
attach(eventbus) {
|
|
8030
|
+
attach(eventbus, services) {
|
|
8047
8031
|
if (!this.operationData) return;
|
|
8048
8032
|
const { selectedElement, actions, eventName } = this.operationData;
|
|
8049
8033
|
if (!this.actionInstanceInfos) {
|
|
8050
|
-
this.actionInstanceInfos = requestControllerActions(
|
|
8034
|
+
this.actionInstanceInfos = requestControllerActions(services, actions, this.name, {
|
|
8051
8035
|
kind: "DOM event",
|
|
8052
8036
|
name: eventName
|
|
8053
8037
|
});
|
|
@@ -8142,19 +8126,19 @@ var KeyboardController = class {
|
|
|
8142
8126
|
/**
|
|
8143
8127
|
* Looks up the configured actions and starts listening for the keys.
|
|
8144
8128
|
*
|
|
8145
|
-
* @param eventbus - The eventbus
|
|
8146
|
-
*
|
|
8147
|
-
*
|
|
8148
|
-
*
|
|
8149
|
-
* keys, and keeps the
|
|
8129
|
+
* @param eventbus - The eventbus the actions report errors on
|
|
8130
|
+
* @param services - The engine services to look the actions and the engine
|
|
8131
|
+
* root up in
|
|
8132
|
+
* @throws when an action name is unknown; the message names the
|
|
8133
|
+
* controller, the action and the keys, and keeps the "did you mean" hint
|
|
8150
8134
|
*/
|
|
8151
|
-
attach(eventbus) {
|
|
8135
|
+
attach(eventbus, services) {
|
|
8152
8136
|
if (!this.operationData || this.actionInstanceInfos) return;
|
|
8153
8137
|
const { selectedElement, keys, actions, scope } = this.operationData;
|
|
8154
|
-
this.actionInstanceInfos = requestControllerActions(
|
|
8138
|
+
this.actionInstanceInfos = requestControllerActions(services, actions, this.name, this._trigger());
|
|
8155
8139
|
this._eventbus = eventbus;
|
|
8156
8140
|
const element = selectedElement[0];
|
|
8157
|
-
const root = this.
|
|
8141
|
+
const root = this._engineRootElement(services) ?? element;
|
|
8158
8142
|
const container = scope === "element" ? element : root;
|
|
8159
8143
|
const doc = element?.ownerDocument ?? (typeof document === "undefined" ? void 0 : document);
|
|
8160
8144
|
const participant = {
|
|
@@ -8200,8 +8184,8 @@ var KeyboardController = class {
|
|
|
8200
8184
|
name: this.operationData?.keys ?? ""
|
|
8201
8185
|
};
|
|
8202
8186
|
}
|
|
8203
|
-
|
|
8204
|
-
const root =
|
|
8187
|
+
_engineRootElement(services) {
|
|
8188
|
+
const root = services.getEngineRoot()[0];
|
|
8205
8189
|
return root && typeof root.contains === "function" ? root : void 0;
|
|
8206
8190
|
}
|
|
8207
8191
|
/**
|
|
@@ -8778,6 +8762,7 @@ var NavigationController = class extends BaseController {
|
|
|
8778
8762
|
activeNavigationPoint = null;
|
|
8779
8763
|
labelControllers = [];
|
|
8780
8764
|
eventbus = null;
|
|
8765
|
+
services = null;
|
|
8781
8766
|
container = null;
|
|
8782
8767
|
_menuElement = null;
|
|
8783
8768
|
_anchorLookup = /* @__PURE__ */ new Map();
|
|
@@ -8799,10 +8784,11 @@ var NavigationController = class extends BaseController {
|
|
|
8799
8784
|
if (typeof nav.timelineUri === "string" && !this._navByTimelineUri.has(nav.timelineUri)) this._navByTimelineUri.set(nav.timelineUri, nav);
|
|
8800
8785
|
});
|
|
8801
8786
|
}
|
|
8802
|
-
attach(eventbus) {
|
|
8787
|
+
attach(eventbus, services) {
|
|
8803
8788
|
if (!this.container) return;
|
|
8804
8789
|
this.beginAttach(eventbus);
|
|
8805
8790
|
this.eventbus = eventbus;
|
|
8791
|
+
this.services = services;
|
|
8806
8792
|
this.addListener(eventbus, "navigate-to-video-url", this._handleNavigateVideoUrl);
|
|
8807
8793
|
this.addListener(eventbus, "highlight-navigation", this._highlightMenu);
|
|
8808
8794
|
this.addListener(eventbus, "request-current-navigation", this._handleRequestCurrentNavigation);
|
|
@@ -8853,6 +8839,7 @@ var NavigationController = class extends BaseController {
|
|
|
8853
8839
|
this._anchorLookup.clear();
|
|
8854
8840
|
this._highlightedAnchor = null;
|
|
8855
8841
|
this.eventbus = null;
|
|
8842
|
+
this.services = null;
|
|
8856
8843
|
}
|
|
8857
8844
|
_pushCurrentState(position = -1) {
|
|
8858
8845
|
if (!this.activeNavigationPoint) return;
|
|
@@ -8974,13 +8961,13 @@ var NavigationController = class extends BaseController {
|
|
|
8974
8961
|
selectedElement: parentElm,
|
|
8975
8962
|
translationKey
|
|
8976
8963
|
};
|
|
8977
|
-
const
|
|
8978
|
-
if (
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8964
|
+
const { eventbus, services } = this;
|
|
8965
|
+
if (!eventbus || !services) return;
|
|
8966
|
+
const instance = services.createInstance("LabelController");
|
|
8967
|
+
instance.init(data);
|
|
8968
|
+
instance.attach(eventbus);
|
|
8969
|
+
this.labelControllers.push(instance);
|
|
8970
|
+
this.ctrlLookup[translationKey] = instance;
|
|
8984
8971
|
}
|
|
8985
8972
|
};
|
|
8986
8973
|
|
|
@@ -9575,22 +9562,6 @@ function pushHistoryState() {
|
|
|
9575
9562
|
};
|
|
9576
9563
|
}
|
|
9577
9564
|
|
|
9578
|
-
// src/eventbus/events/metadata/request-action.ts
|
|
9579
|
-
function requestAction() {
|
|
9580
|
-
return {
|
|
9581
|
-
description: `Request: request-action
|
|
9582
|
-
Answered through \`eventbus.request('request-action', actionName)\` by
|
|
9583
|
-
EngineFactory with the configured action of that name. Throws for an
|
|
9584
|
-
unknown name, with a "did you mean" hint.`,
|
|
9585
|
-
category: `Engine Request`,
|
|
9586
|
-
args: [{
|
|
9587
|
-
name: "actionName",
|
|
9588
|
-
type: "string",
|
|
9589
|
-
description: "The name of the action to request"
|
|
9590
|
-
}]
|
|
9591
|
-
};
|
|
9592
|
-
}
|
|
9593
|
-
|
|
9594
9565
|
// src/eventbus/events/metadata/request-current-language.ts
|
|
9595
9566
|
function requestCurrentLanguage() {
|
|
9596
9567
|
return {
|
|
@@ -9641,53 +9612,6 @@ function requestCurrentVideoPosition() {
|
|
|
9641
9612
|
};
|
|
9642
9613
|
}
|
|
9643
9614
|
|
|
9644
|
-
// src/eventbus/events/metadata/request-engine-root.ts
|
|
9645
|
-
function requestEngineRoot() {
|
|
9646
|
-
return {
|
|
9647
|
-
description: `Request: request-engine-root
|
|
9648
|
-
Answered through \`eventbus.request('request-engine-root')\` with the
|
|
9649
|
-
engine's root element (the container selector). From \`engine.init()\` until
|
|
9650
|
-
\`engine.destroy()\` every answer is the same jQuery instance. The engine also
|
|
9651
|
-
answers the legacy form, a broadcast whose last argument is a callback that
|
|
9652
|
-
receives the value.`,
|
|
9653
|
-
category: `Engine Request`,
|
|
9654
|
-
args: []
|
|
9655
|
-
};
|
|
9656
|
-
}
|
|
9657
|
-
|
|
9658
|
-
// src/eventbus/events/metadata/request-function.ts
|
|
9659
|
-
function requestFunction() {
|
|
9660
|
-
return {
|
|
9661
|
-
description: `Request: request-function
|
|
9662
|
-
Answered through \`eventbus.request('request-function', systemName)\` by
|
|
9663
|
-
EngineFactory with the function (such as an operation) the resource
|
|
9664
|
-
importer provides under that name. Throws for an unknown name.`,
|
|
9665
|
-
category: `Engine Request`,
|
|
9666
|
-
args: [{
|
|
9667
|
-
name: "systemName",
|
|
9668
|
-
type: "string",
|
|
9669
|
-
description: "The name of the function to request"
|
|
9670
|
-
}]
|
|
9671
|
-
};
|
|
9672
|
-
}
|
|
9673
|
-
|
|
9674
|
-
// src/eventbus/events/metadata/request-instance.ts
|
|
9675
|
-
function requestInstance() {
|
|
9676
|
-
return {
|
|
9677
|
-
description: `Request: request-instance
|
|
9678
|
-
Answered through \`eventbus.request('request-instance', systemName)\` by
|
|
9679
|
-
EngineFactory with a new instance of the class the resource importer
|
|
9680
|
-
provides under that name (a controller, for example), constructed with the
|
|
9681
|
-
eventbus. Throws for an unknown name.`,
|
|
9682
|
-
category: `Engine Request`,
|
|
9683
|
-
args: [{
|
|
9684
|
-
name: "systemName",
|
|
9685
|
-
type: "string",
|
|
9686
|
-
description: "The name of the class to instantiate"
|
|
9687
|
-
}]
|
|
9688
|
-
};
|
|
9689
|
-
}
|
|
9690
|
-
|
|
9691
9615
|
// src/eventbus/events/metadata/request-label-collection.ts
|
|
9692
9616
|
function requestLabelCollection() {
|
|
9693
9617
|
return {
|
|
@@ -10071,14 +9995,10 @@ var metadata_exports = /* @__PURE__ */ __exportAll({
|
|
|
10071
9995
|
languageChange: () => languageChange,
|
|
10072
9996
|
navigateToVideoUrl: () => navigateToVideoUrl,
|
|
10073
9997
|
pushHistoryState: () => pushHistoryState,
|
|
10074
|
-
requestAction: () => requestAction,
|
|
10075
9998
|
requestCurrentLanguage: () => requestCurrentLanguage,
|
|
10076
9999
|
requestCurrentNavigation: () => requestCurrentNavigation,
|
|
10077
10000
|
requestCurrentTimelinePosition: () => requestCurrentTimelinePosition,
|
|
10078
10001
|
requestCurrentVideoPosition: () => requestCurrentVideoPosition,
|
|
10079
|
-
requestEngineRoot: () => requestEngineRoot,
|
|
10080
|
-
requestFunction: () => requestFunction,
|
|
10081
|
-
requestInstance: () => requestInstance,
|
|
10082
10002
|
requestLabelCollection: () => requestLabelCollection,
|
|
10083
10003
|
requestLabelCollections: () => requestLabelCollections,
|
|
10084
10004
|
requestTimelineCleanup: () => requestTimelineCleanup,
|
|
@@ -10167,8 +10087,8 @@ const onceOriginals$1 = /* @__PURE__ */ new WeakMap();
|
|
|
10167
10087
|
*
|
|
10168
10088
|
* @example Request/Response pattern
|
|
10169
10089
|
* ```ts
|
|
10170
|
-
* eventbus.onRequest('request-
|
|
10171
|
-
* const
|
|
10090
|
+
* eventbus.onRequest('request-translation', (key) => translations[key]);
|
|
10091
|
+
* const label = eventbus.request<string>('request-translation', 'nav.home');
|
|
10172
10092
|
* ```
|
|
10173
10093
|
*
|
|
10174
10094
|
* Broadcasts isolate errors: a handler, listener or interceptor that throws, or
|
|
@@ -10615,7 +10535,7 @@ function createSignal() {
|
|
|
10615
10535
|
*/
|
|
10616
10536
|
function actionEnd(action) {
|
|
10617
10537
|
const { end } = action.duration;
|
|
10618
|
-
return end < 0 ?
|
|
10538
|
+
return end < 0 ? 1e400 : end;
|
|
10619
10539
|
}
|
|
10620
10540
|
/**
|
|
10621
10541
|
* Whether the action is in effect at the given position. Ranges are
|
|
@@ -10805,7 +10725,7 @@ var EligiusEngine = class EligiusEngine {
|
|
|
10805
10725
|
this.localeManager = localeManager;
|
|
10806
10726
|
this.timelineProvidersByUri = timelineProvidersByUri;
|
|
10807
10727
|
this.localesReady = localesReady;
|
|
10808
|
-
const maxCatchUp = options?.maxCatchUp ??
|
|
10728
|
+
const maxCatchUp = options?.maxCatchUp ?? 1e400;
|
|
10809
10729
|
if (typeof maxCatchUp !== "number" || !(maxCatchUp > 0)) throw new Error(`EligiusEngine: options.maxCatchUp must be a positive number of seconds, got ${String(maxCatchUp)}`);
|
|
10810
10730
|
this._maxCatchUp = maxCatchUp;
|
|
10811
10731
|
}
|
|
@@ -11311,11 +11231,11 @@ var EligiusEngine = class EligiusEngine {
|
|
|
11311
11231
|
});
|
|
11312
11232
|
this._transportPending++;
|
|
11313
11233
|
const run = idle ? invoke(task) : previous.then(task);
|
|
11314
|
-
const
|
|
11234
|
+
const settle = () => {
|
|
11315
11235
|
this._transportPending--;
|
|
11316
11236
|
release();
|
|
11317
11237
|
};
|
|
11318
|
-
run.then(
|
|
11238
|
+
run.then(settle, settle);
|
|
11319
11239
|
return run;
|
|
11320
11240
|
}
|
|
11321
11241
|
_addEventListener(eventName, eventHandler, eventTopic) {
|
|
@@ -11332,7 +11252,6 @@ var EligiusEngine = class EligiusEngine {
|
|
|
11332
11252
|
* on) and state broadcasts are owned by EngineEventbusAdapter.
|
|
11333
11253
|
*/
|
|
11334
11254
|
_addEventbusListeners() {
|
|
11335
|
-
this._addEventListener("request-engine-root", this._handleRequestEngineRoot.bind(this));
|
|
11336
11255
|
this._addEventListener("request-current-timeline-position", this._handleRequestTimelinePosition.bind(this));
|
|
11337
11256
|
this._addEventListener("request-timeline-cleanup", this._handleTimelineComplete.bind(this));
|
|
11338
11257
|
this._addEventListener("timeline-request-current-timeline", this._requestCurrentTimeline.bind(this));
|
|
@@ -11406,9 +11325,6 @@ var EligiusEngine = class EligiusEngine {
|
|
|
11406
11325
|
}, [[], []]);
|
|
11407
11326
|
return [...endMethods.sort(sortActionMethodsHighestStartPositionFirst), ...startMethods];
|
|
11408
11327
|
}
|
|
11409
|
-
_handleRequestEngineRoot(resultCallback) {
|
|
11410
|
-
resultCallback(this.engineRoot);
|
|
11411
|
-
}
|
|
11412
11328
|
_getActiveActions(allActions) {
|
|
11413
11329
|
return allActions.filter((action) => action.active).sort(sortActionsHighestStartPositionFirst);
|
|
11414
11330
|
}
|
|
@@ -13428,6 +13344,94 @@ const PARAMETER_TYPES = [
|
|
|
13428
13344
|
"ParameterType:DocumentFragment"
|
|
13429
13345
|
];
|
|
13430
13346
|
|
|
13347
|
+
// src/engine-services.ts
|
|
13348
|
+
/**
|
|
13349
|
+
* The services of one engine, created by `EngineFactory.createEngine`.
|
|
13350
|
+
*
|
|
13351
|
+
* The configuration resolver hands it to every action it creates, before the
|
|
13352
|
+
* action lookup and the engine exist; the factory supplies both once they do
|
|
13353
|
+
* ({@link setActions}, {@link setEngine}). After {@link dispose} every lookup
|
|
13354
|
+
* throws, so a destroyed engine's actions cannot reach its resources.
|
|
13355
|
+
*/
|
|
13356
|
+
var EngineServices = class {
|
|
13357
|
+
importer;
|
|
13358
|
+
eventbus;
|
|
13359
|
+
_actions;
|
|
13360
|
+
_engine;
|
|
13361
|
+
_disposed = false;
|
|
13362
|
+
/**
|
|
13363
|
+
* @param importer - Provides the registered functions, classes and data
|
|
13364
|
+
* @param eventbus - The engine's eventbus, passed to created instances
|
|
13365
|
+
*/
|
|
13366
|
+
constructor(importer, eventbus) {
|
|
13367
|
+
this.importer = importer;
|
|
13368
|
+
this.eventbus = eventbus;
|
|
13369
|
+
}
|
|
13370
|
+
/**
|
|
13371
|
+
* Supplies the resolved actions that {@link getAction} looks up.
|
|
13372
|
+
*
|
|
13373
|
+
* @param actions - The action lookup, by name
|
|
13374
|
+
*/
|
|
13375
|
+
setActions(actions) {
|
|
13376
|
+
this._actions = actions;
|
|
13377
|
+
}
|
|
13378
|
+
/**
|
|
13379
|
+
* Supplies the engine whose root {@link getEngineRoot} returns.
|
|
13380
|
+
*
|
|
13381
|
+
* @param engine - The engine these services belong to
|
|
13382
|
+
*/
|
|
13383
|
+
setEngine(engine) {
|
|
13384
|
+
this._engine = engine;
|
|
13385
|
+
}
|
|
13386
|
+
/**
|
|
13387
|
+
* Releases the actions and the engine. Every lookup throws afterwards.
|
|
13388
|
+
*/
|
|
13389
|
+
dispose() {
|
|
13390
|
+
this._disposed = true;
|
|
13391
|
+
this._actions = void 0;
|
|
13392
|
+
this._engine = void 0;
|
|
13393
|
+
}
|
|
13394
|
+
getAction(systemName) {
|
|
13395
|
+
const actions = this._require(this._actions, "the actions are");
|
|
13396
|
+
if (Object.hasOwn(actions, systemName)) return actions[systemName];
|
|
13397
|
+
throw new Error(unknownActionMessage(systemName, Object.keys(actions)));
|
|
13398
|
+
}
|
|
13399
|
+
getImport(systemName) {
|
|
13400
|
+
this._assertLive();
|
|
13401
|
+
return importSystemEntry(this.importer, systemName);
|
|
13402
|
+
}
|
|
13403
|
+
createInstance(systemName) {
|
|
13404
|
+
return new (this.getImport(systemName))(this.eventbus);
|
|
13405
|
+
}
|
|
13406
|
+
getEngineRoot() {
|
|
13407
|
+
return this._require(this._engine, "the engine is").engineRoot;
|
|
13408
|
+
}
|
|
13409
|
+
_assertLive() {
|
|
13410
|
+
if (this._disposed) throw new Error("EngineServices: the engine was destroyed");
|
|
13411
|
+
}
|
|
13412
|
+
_require(value, what) {
|
|
13413
|
+
this._assertLive();
|
|
13414
|
+
if (value === void 0) throw new Error(`EngineServices: ${what} not available yet; EngineFactory supplies it once the engine is created`);
|
|
13415
|
+
return value;
|
|
13416
|
+
}
|
|
13417
|
+
};
|
|
13418
|
+
/**
|
|
13419
|
+
* Returns the entry the importer provides under `systemName`.
|
|
13420
|
+
*
|
|
13421
|
+
* @param importer - The resource importer
|
|
13422
|
+
* @param systemName - The registered name
|
|
13423
|
+
* @returns The entry; registered JSON and templates may be `0`, `''` or `false`
|
|
13424
|
+
* @throws Error when the importer throws or provides nothing under the name
|
|
13425
|
+
*/
|
|
13426
|
+
function importSystemEntry(importer, systemName) {
|
|
13427
|
+
const entry = importer.import(systemName)?.[systemName];
|
|
13428
|
+
if (entry === void 0) throw new Error(`Failed to import '${systemName}': module does not export '${systemName}'`);
|
|
13429
|
+
return entry;
|
|
13430
|
+
}
|
|
13431
|
+
function unknownActionMessage(name, knownNames) {
|
|
13432
|
+
return `Unknown action '${name}'. ${formatDidYouMean(findClosestNames(name, knownNames)) || "Check the action name in the configuration."}`;
|
|
13433
|
+
}
|
|
13434
|
+
|
|
13431
13435
|
// src/locale/locale-loader.ts
|
|
13432
13436
|
/**
|
|
13433
13437
|
* LocaleLoader - External locale file loading with $ref resolution
|
|
@@ -13990,8 +13994,6 @@ var EngineFactory = class {
|
|
|
13990
13994
|
* An engine's destroy() removes its own; factory.destroy() the rest.
|
|
13991
13995
|
*/
|
|
13992
13996
|
_eventRemovers = /* @__PURE__ */ new Set();
|
|
13993
|
-
/** Action lookups of the live engines, oldest first */
|
|
13994
|
-
_actionLookups = /* @__PURE__ */ new Map();
|
|
13995
13997
|
/** Live engines on the shared eventbus */
|
|
13996
13998
|
_liveSharedEngines = 0;
|
|
13997
13999
|
_importer;
|
|
@@ -14009,7 +14011,6 @@ var EngineFactory = class {
|
|
|
14009
14011
|
this._windowRef = windowRef;
|
|
14010
14012
|
this._options = options;
|
|
14011
14013
|
this._sharedEventbus = options?.eventbus;
|
|
14012
|
-
if (this._sharedEventbus) this._registerResponders(this._sharedEventbus, (systemName) => this._findLiveAction(systemName), () => this._liveActionNames(), (remover) => this._eventRemovers.add(remover));
|
|
14013
14014
|
}
|
|
14014
14015
|
/**
|
|
14015
14016
|
* Destroys the factory and cleans up all registered request handlers.
|
|
@@ -14018,40 +14019,9 @@ var EngineFactory = class {
|
|
|
14018
14019
|
const removers = [...this._eventRemovers];
|
|
14019
14020
|
this._eventRemovers.clear();
|
|
14020
14021
|
removers.forEach((remove) => remove());
|
|
14021
|
-
this._actionLookups.clear();
|
|
14022
14022
|
}
|
|
14023
14023
|
_importSystemEntry(systemName) {
|
|
14024
|
-
|
|
14025
|
-
if (entry === void 0) throw new Error(`Failed to import '${systemName}': module does not export '${systemName}'`);
|
|
14026
|
-
return entry;
|
|
14027
|
-
}
|
|
14028
|
-
/**
|
|
14029
|
-
* Registers the 'request-instance', 'request-action' and
|
|
14030
|
-
* 'request-function' responders on an eventbus. Instances are constructed
|
|
14031
|
-
* with that eventbus. 'request-action' throws for an unknown action name,
|
|
14032
|
-
* with a "did you mean" hint built from `knownActions`.
|
|
14033
|
-
*/
|
|
14034
|
-
_registerResponders(eventbus, findAction, knownActions, addRemover) {
|
|
14035
|
-
addRemover(eventbus.onRequest("request-instance", (systemName) => {
|
|
14036
|
-
return new (this._importSystemEntry(systemName))(eventbus);
|
|
14037
|
-
}));
|
|
14038
|
-
addRemover(eventbus.onRequest("request-action", (systemName) => {
|
|
14039
|
-
const action = findAction(systemName);
|
|
14040
|
-
if (action) return action;
|
|
14041
|
-
throw new Error(unknownActionMessage(systemName, knownActions()));
|
|
14042
|
-
}));
|
|
14043
|
-
addRemover(eventbus.onRequest("request-function", (systemName) => this._importSystemEntry(systemName)));
|
|
14044
|
-
}
|
|
14045
|
-
_findLiveAction(systemName) {
|
|
14046
|
-
const lookups = [...this._actionLookups.values()];
|
|
14047
|
-
for (let i = lookups.length - 1; i >= 0; i--) if (Object.hasOwn(lookups[i], systemName)) return lookups[i][systemName];
|
|
14048
|
-
}
|
|
14049
|
-
_liveActionNames() {
|
|
14050
|
-
const names = /* @__PURE__ */ new Set();
|
|
14051
|
-
this._actionLookups.forEach((lookup) => {
|
|
14052
|
-
Object.keys(lookup).forEach((name) => names.add(name));
|
|
14053
|
-
});
|
|
14054
|
-
return [...names];
|
|
14024
|
+
return importSystemEntry(this._importer, systemName);
|
|
14055
14025
|
}
|
|
14056
14026
|
/**
|
|
14057
14027
|
* Creates a fully wired engine with adapters and event handlers.
|
|
@@ -14073,18 +14043,22 @@ var EngineFactory = class {
|
|
|
14073
14043
|
* `engine.destroy()`) aborts loads that are still pending, disconnects the
|
|
14074
14044
|
* adapters and removes the engine's eventbus registrations.
|
|
14075
14045
|
*
|
|
14046
|
+
* Each engine gets its own {@link EngineServices}: its actions and
|
|
14047
|
+
* operations look up actions, imports and the engine root there, never on
|
|
14048
|
+
* the eventbus, so they always resolve against their own engine.
|
|
14049
|
+
*
|
|
14076
14050
|
* @param configuration - The engine configuration
|
|
14077
|
-
* @param resolver - Optional custom configuration resolver
|
|
14078
14051
|
* @returns Engine result with engine, locale manager, eventbus, and destroy function
|
|
14079
14052
|
* @throws Error when the configuration cannot be resolved or a provider
|
|
14080
14053
|
* cannot be created
|
|
14081
14054
|
*/
|
|
14082
|
-
createEngine(configuration
|
|
14055
|
+
createEngine(configuration) {
|
|
14083
14056
|
const { systemName } = configuration.engine;
|
|
14084
14057
|
const EngineClass = this._importSystemEntry(systemName);
|
|
14085
14058
|
const ownsEventbus = !this._sharedEventbus;
|
|
14086
14059
|
const eventbus = this._sharedEventbus ?? new Eventbus();
|
|
14087
|
-
if (!ownsEventbus && this._liveSharedEngines > 0) console.warn("[EngineFactory] Creating a second live engine on a shared eventbus: requests such as request-
|
|
14060
|
+
if (!ownsEventbus && this._liveSharedEngines > 0) console.warn("[EngineFactory] Creating a second live engine on a shared eventbus: requests such as request-current-timeline-position are answered by the first engine and commands reach both. Use a factory without options.eventbus to give each engine its own eventbus.");
|
|
14061
|
+
const services = new EngineServices(this._importer, eventbus);
|
|
14088
14062
|
const engineRemovers = [];
|
|
14089
14063
|
const addEngineRemover = (remover) => {
|
|
14090
14064
|
engineRemovers.push(remover);
|
|
@@ -14107,6 +14081,7 @@ var EngineFactory = class {
|
|
|
14107
14081
|
released = true;
|
|
14108
14082
|
adapters.forEach((adapter) => adapter.disconnect());
|
|
14109
14083
|
removeEngineRegistrations();
|
|
14084
|
+
services.dispose();
|
|
14110
14085
|
liveEngineCount--;
|
|
14111
14086
|
if (!ownsEventbus) this._liveSharedEngines--;
|
|
14112
14087
|
if (liveEngineCount === 0) {
|
|
@@ -14119,20 +14094,17 @@ var EngineFactory = class {
|
|
|
14119
14094
|
let engineInputAdapter;
|
|
14120
14095
|
try {
|
|
14121
14096
|
const actionRegistryListener = configuration.eventActions?.length ? new ActionRegistryEventbusListener() : void 0;
|
|
14122
|
-
|
|
14123
|
-
|
|
14097
|
+
const [actionLookup, resolvedConfiguration] = new ConfigurationResolver(this._importer, eventbus, services).process(configuration, actionRegistryListener);
|
|
14098
|
+
services.setActions(actionLookup);
|
|
14124
14099
|
const timelineProviders = this._createTimelineProviders(resolvedConfiguration);
|
|
14125
14100
|
const timelineProvidersByUri = this.createTimelineProvidersByUri(resolvedConfiguration, timelineProviders);
|
|
14126
|
-
const lookupKey = {};
|
|
14127
|
-
this._actionLookups.set(lookupKey, actionLookup);
|
|
14128
|
-
addEngineRemover(() => this._actionLookups.delete(lookupKey));
|
|
14129
|
-
if (ownsEventbus) this._registerResponders(eventbus, (name) => Object.hasOwn(actionLookup, name) ? actionLookup[name] : void 0, () => Object.keys(actionLookup), addEngineRemover);
|
|
14130
14101
|
if (actionRegistryListener) addEngineRemover(eventbus.registerEventlistener(actionRegistryListener));
|
|
14131
14102
|
addEngineRemover(eventbus.registerInterceptor("request-timeline-uri", new RequestVideoUriInterceptor(eventbus)));
|
|
14132
14103
|
const { language, locales } = configuration;
|
|
14133
14104
|
localeManager = new LocaleManager({ defaultLocale: language });
|
|
14134
14105
|
const localesReady = this._loadLocales(localeManager, locales, localeLoads.signal);
|
|
14135
14106
|
engineInstance = new EngineClass(resolvedConfiguration, eventbus, timelineProviders, localeManager, timelineProvidersByUri, localesReady, this._options?.engineOptions);
|
|
14107
|
+
services.setEngine(engineInstance);
|
|
14136
14108
|
engineInputAdapter = new EngineInputAdapter(engineInstance, eventbus, this._windowRef, {
|
|
14137
14109
|
playToggleHotkey: this._options?.playToggleHotkey,
|
|
14138
14110
|
...this._options?.input
|
|
@@ -14152,6 +14124,7 @@ var EngineFactory = class {
|
|
|
14152
14124
|
localeLoads.abort();
|
|
14153
14125
|
adapters.forEach((adapter) => adapter.disconnect());
|
|
14154
14126
|
removeEngineRegistrations();
|
|
14127
|
+
services.dispose();
|
|
14155
14128
|
throw error;
|
|
14156
14129
|
}
|
|
14157
14130
|
liveEngineCount++;
|
|
@@ -14170,6 +14143,7 @@ var EngineFactory = class {
|
|
|
14170
14143
|
engine: engineInstance,
|
|
14171
14144
|
localeManager,
|
|
14172
14145
|
eventbus,
|
|
14146
|
+
services,
|
|
14173
14147
|
destroy: () => {
|
|
14174
14148
|
destroyPromise ??= destroyEngine();
|
|
14175
14149
|
return destroyPromise;
|
|
@@ -14402,9 +14376,6 @@ var EngineFactory = class {
|
|
|
14402
14376
|
return sharedContainers.get(key);
|
|
14403
14377
|
}
|
|
14404
14378
|
};
|
|
14405
|
-
function unknownActionMessage(name, knownNames) {
|
|
14406
|
-
return `Unknown action '${name}'. ${formatDidYouMean(findClosestNames(name, knownNames)) || "Check the action name in the configuration."}`;
|
|
14407
|
-
}
|
|
14408
14379
|
function hasIntrinsicContainer(source) {
|
|
14409
14380
|
const candidate = source;
|
|
14410
14381
|
return typeof candidate.getContainer === "function" && typeof candidate.onContainerReady === "function";
|
|
@@ -14427,5 +14398,5 @@ function representativeTimeline(timelines, type, settings) {
|
|
|
14427
14398
|
return ofType.find((t) => !overridesPositionSource(t, settings)) ?? ofType.at(0);
|
|
14428
14399
|
}
|
|
14429
14400
|
|
|
14430
|
-
export { setElementContent$1 as $, calc$1 as $t, LabelController as A, getFormData$1 as At, toggleFormElement$1 as B, filterArray$1 as Bt, metadata_exports as C, httpPut$1 as Ct, NavigationController as D, getScrollPosition$1 as Dt, ProgressbarController as E, getTextContent$1 as Et, findClosestNames as F, getControllerFromElement$1 as Ft, splitString$1 as G, customFunction$1 as Gt, toggleClass$1 as H, endWhen$1 as Ht, formatDidYouMean as I, getAttributesFromElement$1 as It, setStyle$1 as J, concatenateStrings$1 as Jt, sortArray$1 as K, createElement$1 as Kt, metadata_exports$2 as L, formatText$1 as Lt, DOMEventListenerController as M, getElementDimensions$1 as Mt, ConfigurationResolver as N, getCurrentTime$1 as Nt, MutationObserverController as O, getQueryParams$1 as Ot, metadata_exports$1 as P, getControllerInstance$1 as Pt, setFocus$1 as Q, clearElement$1 as Qt, wait$1 as R, formatDate$1 as Rt, ActionRegistryEventbusListener as S, invokeObjectMethod$1 as St, RoutingController as T, httpDelete$1 as Tt, substringText$1 as U, endForEach$1 as Ut, toggleElement$1 as V, extendController$1 as Vt, startAction$1 as W, endAction$1 as Wt, setGlobalData$1 as X, clearStorage$1 as Xt, setOperationData$1 as Y, compareDate$1 as Yt, setFormValue$1 as Z, clearOperationData$1 as Zt, EligiusEngine as _, deepCopy as _n, log$1 as _t, PARAMETER_TYPES as a, addGlobalsToOperation$1 as an, saveToStorage$1 as at, RequestVideoUriInterceptor as b, loadFromStorage$1 as bt, VideoPositionSource as c, LocaleEventbusAdapter as cn, replaceString$1 as ct, KeyboardStepSource as d, TimelineAction as dn, removeElement$1 as dt, broadcastEvent$1 as en, setElementAttributes$1 as et, BasePositionSource as f, EndableAction as fn, removeControllerFromElement$1 as ft, describeKind as g, clearGlobals as gn, mapArray$1 as gt, checkShape as h, forEach$1 as hn, math$1 as ht, LocaleLoader as i, animate$1 as in, scrollToElement$1 as it, KeyboardController as j, getFocusedElement$1 as jt, LottieController as k, getImport$1 as kt, ScrollPositionSource as l, EngineInputAdapter as ln, reparentElement$1 as lt, createImporter as m, when$1 as mn, otherwise$1 as mt, LocaleManager as n, announceToScreenReader$1 as nn, selectElement$1 as nt, SimplePlaylist as o, addControllerToElement$1 as on, requestAction$
|
|
14431
|
-
//# sourceMappingURL=engine-factory-
|
|
14401
|
+
export { setElementContent$1 as $, calc$1 as $t, LabelController as A, getFormData$1 as At, toggleFormElement$1 as B, filterArray$1 as Bt, metadata_exports as C, httpPut$1 as Ct, NavigationController as D, getScrollPosition$1 as Dt, ProgressbarController as E, getTextContent$1 as Et, findClosestNames as F, getControllerFromElement$1 as Ft, splitString$1 as G, customFunction$1 as Gt, toggleClass$1 as H, endWhen$1 as Ht, formatDidYouMean as I, getAttributesFromElement$1 as It, setStyle$1 as J, concatenateStrings$1 as Jt, sortArray$1 as K, createElement$1 as Kt, metadata_exports$2 as L, formatText$1 as Lt, DOMEventListenerController as M, getElementDimensions$1 as Mt, ConfigurationResolver as N, getCurrentTime$1 as Nt, MutationObserverController as O, getQueryParams$1 as Ot, metadata_exports$1 as P, getControllerInstance$1 as Pt, setFocus$1 as Q, clearElement$1 as Qt, wait$1 as R, formatDate$1 as Rt, ActionRegistryEventbusListener as S, invokeObjectMethod$1 as St, RoutingController as T, httpDelete$1 as Tt, substringText$1 as U, endForEach$1 as Ut, toggleElement$1 as V, extendController$1 as Vt, startAction$1 as W, endAction$1 as Wt, setGlobalData$1 as X, clearStorage$1 as Xt, setOperationData$1 as Y, compareDate$1 as Yt, setFormValue$1 as Z, clearOperationData$1 as Zt, EligiusEngine as _, deepCopy as _n, log$1 as _t, PARAMETER_TYPES as a, addGlobalsToOperation$1 as an, saveToStorage$1 as at, RequestVideoUriInterceptor as b, loadFromStorage$1 as bt, VideoPositionSource as c, LocaleEventbusAdapter as cn, replaceString$1 as ct, KeyboardStepSource as d, TimelineAction as dn, removeElement$1 as dt, broadcastEvent$1 as en, setElementAttributes$1 as et, BasePositionSource as f, EndableAction as fn, removeControllerFromElement$1 as ft, describeKind as g, clearGlobals as gn, mapArray$1 as gt, checkShape as h, forEach$1 as hn, math$1 as ht, LocaleLoader as i, animate$1 as in, scrollToElement$1 as it, KeyboardController as j, getFocusedElement$1 as jt, LottieController as k, getImport$1 as kt, ScrollPositionSource as l, EngineInputAdapter as ln, reparentElement$1 as lt, createImporter as m, when$1 as mn, otherwise$1 as mt, LocaleManager as n, announceToScreenReader$1 as nn, selectElement$1 as nt, SimplePlaylist as o, addControllerToElement$1 as on, requestAction$1 as ot, isSeekable as p, Action as pn, removeClass$1 as pt, setVariable$1 as q, continueForEach$1 as qt, isLocaleReference as r, animateWithClass$1 as rn, scrollToPosition$1 as rt, DomContainerProvider as s, addClass$1 as sn, replaceText$1 as st, EngineFactory as t, breakForEach$1 as tn, setData$1 as tt, RafPositionSource as u, EngineEventbusAdapter as un, removePropertiesFromOperationData$1 as ut, EngineActionError as v, clearJsonCache as vt, SubtitlesController as w, httpPost$1 as wt, Eventbus as x, isElementInViewport$1 as xt, TypedEventEmitter as y, loadJson$1 as yt, validateForm$1 as z, findInArray$1 as zt };
|
|
14402
|
+
//# sourceMappingURL=engine-factory-65BHSli8.mjs.map
|