eligius 1.5.2 → 1.5.3
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/index.d.mts +167 -164
- package/dist/index.mjs +875 -817
- package/dist/index.mjs.map +1 -1
- package/jsonschema/operation-templates/animate-with-class.json +1 -3
- package/jsonschema/operation-templates/clear-operation-data.json +1 -3
- package/jsonschema/operation-templates/clear-storage.json +1 -3
- package/jsonschema/operation-templates/concatenate-strings.json +1 -3
- package/jsonschema/operation-templates/create-element.json +1 -3
- package/jsonschema/operation-templates/filter-array.json +2 -6
- package/jsonschema/operation-templates/find-in-array.json +2 -6
- package/jsonschema/operation-templates/get-query-params.json +1 -3
- package/jsonschema/operation-templates/http-delete.json +1 -3
- package/jsonschema/operation-templates/http-post.json +1 -3
- package/jsonschema/operation-templates/http-put.json +1 -3
- package/jsonschema/operation-templates/invoke-object-method.json +1 -3
- package/jsonschema/operation-templates/load-json.json +1 -3
- package/jsonschema/operation-templates/log.json +1 -3
- package/jsonschema/operation-templates/select-element.json +1 -3
- package/jsonschema/operation-templates/set-operation-data.json +1 -3
- package/jsonschema/operation-templates/sort-array.json +2 -6
- package/jsonschema/operation-templates/split-string.json +1 -3
- package/jsonschema/operation-templates/substring-text.json +1 -3
- package/jsonschema/operation-templates/validate-form.json +1 -3
- package/jsonschema/operations/animate-with-class.json +1 -3
- package/jsonschema/operations/clear-operation-data.json +1 -3
- package/jsonschema/operations/clear-storage.json +1 -3
- package/jsonschema/operations/concatenate-strings.json +1 -3
- package/jsonschema/operations/create-element.json +1 -3
- package/jsonschema/operations/filter-array.json +2 -6
- package/jsonschema/operations/find-in-array.json +2 -6
- package/jsonschema/operations/get-query-params.json +1 -3
- package/jsonschema/operations/http-delete.json +1 -3
- package/jsonschema/operations/http-post.json +1 -3
- package/jsonschema/operations/http-put.json +1 -3
- package/jsonschema/operations/invoke-object-method.json +1 -3
- package/jsonschema/operations/load-json.json +1 -3
- package/jsonschema/operations/log.json +1 -3
- package/jsonschema/operations/select-element.json +1 -3
- package/jsonschema/operations/set-operation-data.json +1 -3
- package/jsonschema/operations/sort-array.json +2 -6
- package/jsonschema/operations/split-string.json +1 -3
- package/jsonschema/operations/substring-text.json +1 -3
- package/jsonschema/operations/validate-form.json +1 -3
- package/package.json +3 -1
package/dist/index.mjs
CHANGED
|
@@ -3533,25 +3533,6 @@ var OperationEditor = class {
|
|
|
3533
3533
|
}
|
|
3534
3534
|
};
|
|
3535
3535
|
|
|
3536
|
-
//#endregion
|
|
3537
|
-
//#region src/util/merge-if-missing.ts
|
|
3538
|
-
/**
|
|
3539
|
-
*
|
|
3540
|
-
* Merges the properties of the target object into the source object, only the properties that do not exist yet on the source.
|
|
3541
|
-
*
|
|
3542
|
-
* This function is pure, so it returns a new instance that reflects the merging of the two objects.
|
|
3543
|
-
*
|
|
3544
|
-
* The merge is shallow.
|
|
3545
|
-
*
|
|
3546
|
-
* @param target
|
|
3547
|
-
* @param source
|
|
3548
|
-
* @returns
|
|
3549
|
-
*/
|
|
3550
|
-
const mergeIfMissing = (target, source) => Object.entries(source).reduce((acc, [key, value]) => key in acc ? acc : {
|
|
3551
|
-
...acc,
|
|
3552
|
-
[key]: value
|
|
3553
|
-
}, target);
|
|
3554
|
-
|
|
3555
3536
|
//#endregion
|
|
3556
3537
|
//#region src/configuration/api/label-editor.ts
|
|
3557
3538
|
/**
|
|
@@ -3931,6 +3912,25 @@ var TimelineProviderSettingsEditor = class {
|
|
|
3931
3912
|
}
|
|
3932
3913
|
};
|
|
3933
3914
|
|
|
3915
|
+
//#endregion
|
|
3916
|
+
//#region src/util/merge-if-missing.ts
|
|
3917
|
+
/**
|
|
3918
|
+
*
|
|
3919
|
+
* Merges the properties of the target object into the source object, only the properties that do not exist yet on the source.
|
|
3920
|
+
*
|
|
3921
|
+
* This function is pure, so it returns a new instance that reflects the merging of the two objects.
|
|
3922
|
+
*
|
|
3923
|
+
* The merge is shallow.
|
|
3924
|
+
*
|
|
3925
|
+
* @param target
|
|
3926
|
+
* @param source
|
|
3927
|
+
* @returns
|
|
3928
|
+
*/
|
|
3929
|
+
const mergeIfMissing = (target, source) => Object.entries(source).reduce((acc, [key, value]) => key in acc ? acc : {
|
|
3930
|
+
...acc,
|
|
3931
|
+
[key]: value
|
|
3932
|
+
}, target);
|
|
3933
|
+
|
|
3934
3934
|
//#endregion
|
|
3935
3935
|
//#region src/configuration/api/configuration-factory.ts
|
|
3936
3936
|
/**
|
|
@@ -5288,7 +5288,11 @@ before it resolves.`,
|
|
|
5288
5288
|
type: "ParameterType:className",
|
|
5289
5289
|
required: true
|
|
5290
5290
|
},
|
|
5291
|
-
removeClass: { type:
|
|
5291
|
+
removeClass: { type: [
|
|
5292
|
+
{ value: "undefined" },
|
|
5293
|
+
{ value: "false" },
|
|
5294
|
+
{ value: "true" }
|
|
5295
|
+
] }
|
|
5292
5296
|
}
|
|
5293
5297
|
};
|
|
5294
5298
|
}
|
|
@@ -5333,7 +5337,11 @@ function announceToScreenReader$1() {
|
|
|
5333
5337
|
erased: true
|
|
5334
5338
|
},
|
|
5335
5339
|
priority: {
|
|
5336
|
-
type: [
|
|
5340
|
+
type: [
|
|
5341
|
+
{ value: "undefined" },
|
|
5342
|
+
{ value: "polite" },
|
|
5343
|
+
{ value: "assertive" }
|
|
5344
|
+
],
|
|
5337
5345
|
erased: true
|
|
5338
5346
|
}
|
|
5339
5347
|
}
|
|
@@ -5406,7 +5414,7 @@ function calc$1() {
|
|
|
5406
5414
|
erased: true
|
|
5407
5415
|
}
|
|
5408
5416
|
},
|
|
5409
|
-
outputProperties: { calculationResult: { type: "
|
|
5417
|
+
outputProperties: { calculationResult: { type: [{ value: "undefined" }, { value: "number" }] } }
|
|
5410
5418
|
};
|
|
5411
5419
|
}
|
|
5412
5420
|
|
|
@@ -5428,8 +5436,7 @@ function clearOperationData$1() {
|
|
|
5428
5436
|
Or, if the \`properties\` property is set only removes the properties defined by that list.`,
|
|
5429
5437
|
category: `Data`,
|
|
5430
5438
|
properties: { properties: {
|
|
5431
|
-
type: "
|
|
5432
|
-
itemType: "ParameterType:string",
|
|
5439
|
+
type: [{ value: "undefined" }, { value: "string[]" }],
|
|
5433
5440
|
erased: true
|
|
5434
5441
|
} }
|
|
5435
5442
|
};
|
|
@@ -5445,7 +5452,7 @@ If \`key\` is provided, removes only that key. If \`key\` is omitted, clears all
|
|
|
5445
5452
|
category: `Data`,
|
|
5446
5453
|
properties: {
|
|
5447
5454
|
key: {
|
|
5448
|
-
type: "
|
|
5455
|
+
type: [{ value: "undefined" }, { value: "string" }],
|
|
5449
5456
|
erased: true
|
|
5450
5457
|
},
|
|
5451
5458
|
storageType: {
|
|
@@ -5507,7 +5514,7 @@ function concatenateStrings$1() {
|
|
|
5507
5514
|
erased: true
|
|
5508
5515
|
},
|
|
5509
5516
|
separator: {
|
|
5510
|
-
type: "
|
|
5517
|
+
type: [{ value: "undefined" }, { value: "string" }],
|
|
5511
5518
|
erased: true
|
|
5512
5519
|
}
|
|
5513
5520
|
},
|
|
@@ -5540,7 +5547,7 @@ the instance to the \`template\` property on the current operation data.`,
|
|
|
5540
5547
|
erased: true
|
|
5541
5548
|
},
|
|
5542
5549
|
text: {
|
|
5543
|
-
type: "
|
|
5550
|
+
type: [{ value: "undefined" }, { value: "string" }],
|
|
5544
5551
|
erased: true
|
|
5545
5552
|
},
|
|
5546
5553
|
attributes: {
|
|
@@ -5633,7 +5640,7 @@ Supports two filtering modes:
|
|
|
5633
5640
|
dependentProperties: ["arrayData"],
|
|
5634
5641
|
properties: {
|
|
5635
5642
|
filterProperty: {
|
|
5636
|
-
type: "
|
|
5643
|
+
type: [{ value: "undefined" }, { value: "string" }],
|
|
5637
5644
|
erased: true
|
|
5638
5645
|
},
|
|
5639
5646
|
filterValue: {
|
|
@@ -5641,7 +5648,7 @@ Supports two filtering modes:
|
|
|
5641
5648
|
erased: true
|
|
5642
5649
|
},
|
|
5643
5650
|
filterPredicate: {
|
|
5644
|
-
type: "
|
|
5651
|
+
type: [{ value: "undefined" }, { value: "(item: any, index?: number | undefined) => boolean" }],
|
|
5645
5652
|
erased: true
|
|
5646
5653
|
}
|
|
5647
5654
|
},
|
|
@@ -5665,7 +5672,7 @@ Returns \`undefined\` for \`foundItem\` and \`-1\` for \`foundIndex\` if no matc
|
|
|
5665
5672
|
dependentProperties: ["arrayData"],
|
|
5666
5673
|
properties: {
|
|
5667
5674
|
findProperty: {
|
|
5668
|
-
type: "
|
|
5675
|
+
type: [{ value: "undefined" }, { value: "string" }],
|
|
5669
5676
|
erased: true
|
|
5670
5677
|
},
|
|
5671
5678
|
findValue: {
|
|
@@ -5673,7 +5680,7 @@ Returns \`undefined\` for \`foundItem\` and \`-1\` for \`foundIndex\` if no matc
|
|
|
5673
5680
|
erased: true
|
|
5674
5681
|
},
|
|
5675
5682
|
findPredicate: {
|
|
5676
|
-
type: "
|
|
5683
|
+
type: [{ value: "undefined" }, { value: "(item: any, index?: number | undefined) => boolean" }],
|
|
5677
5684
|
erased: true
|
|
5678
5685
|
}
|
|
5679
5686
|
},
|
|
@@ -5766,7 +5773,7 @@ function getAttributesFromElement$1() {
|
|
|
5766
5773
|
required: true,
|
|
5767
5774
|
erased: true
|
|
5768
5775
|
} },
|
|
5769
|
-
outputProperties: { attributeValues: { type: "
|
|
5776
|
+
outputProperties: { attributeValues: { type: [{ value: "undefined" }, { value: "Record<string, unknown>" }] } }
|
|
5770
5777
|
};
|
|
5771
5778
|
}
|
|
5772
5779
|
|
|
@@ -5900,10 +5907,10 @@ function getQueryParams$1() {
|
|
|
5900
5907
|
them on the returned operation data.`,
|
|
5901
5908
|
category: `Utility`,
|
|
5902
5909
|
properties: { defaultValues: {
|
|
5903
|
-
type: "
|
|
5910
|
+
type: [{ value: "undefined" }, { value: "Record<string, string>" }],
|
|
5904
5911
|
erased: true
|
|
5905
5912
|
} },
|
|
5906
|
-
outputProperties: { queryParams: { type: "
|
|
5913
|
+
outputProperties: { queryParams: { type: [{ value: "undefined" }, { value: "Record<string, string>" }] } }
|
|
5907
5914
|
};
|
|
5908
5915
|
}
|
|
5909
5916
|
|
|
@@ -5933,7 +5940,7 @@ Uses jQuery's \`.text()\` method which is XSS-safe and returns only the text con
|
|
|
5933
5940
|
without any HTML tags. Preserves whitespace and text from nested elements.`,
|
|
5934
5941
|
category: `Text`,
|
|
5935
5942
|
dependentProperties: ["selectedElement"],
|
|
5936
|
-
outputProperties: { textContent: { type: "
|
|
5943
|
+
outputProperties: { textContent: { type: [{ value: "undefined" }, { value: "string" }] } }
|
|
5937
5944
|
};
|
|
5938
5945
|
}
|
|
5939
5946
|
|
|
@@ -5950,7 +5957,7 @@ function httpDelete$1() {
|
|
|
5950
5957
|
erased: true
|
|
5951
5958
|
},
|
|
5952
5959
|
headers: {
|
|
5953
|
-
type: "
|
|
5960
|
+
type: [{ value: "undefined" }, { value: "Record<string, string>" }],
|
|
5954
5961
|
erased: true
|
|
5955
5962
|
}
|
|
5956
5963
|
},
|
|
@@ -5978,7 +5985,7 @@ function httpPost$1() {
|
|
|
5978
5985
|
erased: true
|
|
5979
5986
|
},
|
|
5980
5987
|
headers: {
|
|
5981
|
-
type: "
|
|
5988
|
+
type: [{ value: "undefined" }, { value: "Record<string, string>" }],
|
|
5982
5989
|
erased: true
|
|
5983
5990
|
}
|
|
5984
5991
|
},
|
|
@@ -6006,7 +6013,7 @@ function httpPut$1() {
|
|
|
6006
6013
|
erased: true
|
|
6007
6014
|
},
|
|
6008
6015
|
headers: {
|
|
6009
|
-
type: "
|
|
6016
|
+
type: [{ value: "undefined" }, { value: "Record<string, string>" }],
|
|
6010
6017
|
erased: true
|
|
6011
6018
|
}
|
|
6012
6019
|
},
|
|
@@ -6032,7 +6039,7 @@ and assigns the result to the \`methodResult\` operationdata property.`,
|
|
|
6032
6039
|
erased: true
|
|
6033
6040
|
},
|
|
6034
6041
|
methodArguments: {
|
|
6035
|
-
type: "
|
|
6042
|
+
type: [{ value: "undefined" }, { value: "unknown[]" }],
|
|
6036
6043
|
erased: true
|
|
6037
6044
|
}
|
|
6038
6045
|
},
|
|
@@ -6094,7 +6101,11 @@ instead of re-retrieving it from the url.`,
|
|
|
6094
6101
|
erased: true
|
|
6095
6102
|
},
|
|
6096
6103
|
cache: {
|
|
6097
|
-
type:
|
|
6104
|
+
type: [
|
|
6105
|
+
{ value: "undefined" },
|
|
6106
|
+
{ value: "false" },
|
|
6107
|
+
{ value: "true" }
|
|
6108
|
+
],
|
|
6098
6109
|
erased: true
|
|
6099
6110
|
}
|
|
6100
6111
|
},
|
|
@@ -6115,7 +6126,7 @@ it will log the current operation data, global data and scope to the console`,
|
|
|
6115
6126
|
erased: true
|
|
6116
6127
|
},
|
|
6117
6128
|
logName: {
|
|
6118
|
-
type: "
|
|
6129
|
+
type: [{ value: "undefined" }, { value: "string" }],
|
|
6119
6130
|
erased: true
|
|
6120
6131
|
}
|
|
6121
6132
|
}
|
|
@@ -6137,7 +6148,7 @@ The mapFunction receives each item and optionally its index.`,
|
|
|
6137
6148
|
required: true,
|
|
6138
6149
|
erased: true
|
|
6139
6150
|
} },
|
|
6140
|
-
outputProperties: { mappedArray: { type: "
|
|
6151
|
+
outputProperties: { mappedArray: { type: [{ value: "undefined" }, { value: "any[]" }] } }
|
|
6141
6152
|
};
|
|
6142
6153
|
}
|
|
6143
6154
|
|
|
@@ -6159,7 +6170,7 @@ function math$1() {
|
|
|
6159
6170
|
erased: true
|
|
6160
6171
|
}
|
|
6161
6172
|
},
|
|
6162
|
-
outputProperties: { mathResult: { type: "
|
|
6173
|
+
outputProperties: { mathResult: { type: [{ value: "undefined" }, { value: "number" }] } }
|
|
6163
6174
|
};
|
|
6164
6175
|
}
|
|
6165
6176
|
|
|
@@ -6350,11 +6361,16 @@ Uses the browser's \`scrollIntoView\` API with configurable behavior.`,
|
|
|
6350
6361
|
dependentProperties: ["selectedElement"],
|
|
6351
6362
|
properties: {
|
|
6352
6363
|
behavior: {
|
|
6353
|
-
type: [
|
|
6364
|
+
type: [
|
|
6365
|
+
{ value: "undefined" },
|
|
6366
|
+
{ value: "auto" },
|
|
6367
|
+
{ value: "smooth" }
|
|
6368
|
+
],
|
|
6354
6369
|
erased: true
|
|
6355
6370
|
},
|
|
6356
6371
|
block: {
|
|
6357
6372
|
type: [
|
|
6373
|
+
{ value: "undefined" },
|
|
6358
6374
|
{ value: "start" },
|
|
6359
6375
|
{ value: "center" },
|
|
6360
6376
|
{ value: "end" },
|
|
@@ -6364,6 +6380,7 @@ Uses the browser's \`scrollIntoView\` API with configurable behavior.`,
|
|
|
6364
6380
|
},
|
|
6365
6381
|
inline: {
|
|
6366
6382
|
type: [
|
|
6383
|
+
{ value: "undefined" },
|
|
6367
6384
|
{ value: "start" },
|
|
6368
6385
|
{ value: "center" },
|
|
6369
6386
|
{ value: "end" },
|
|
@@ -6395,7 +6412,11 @@ Uses the browser's \`window.scrollTo\` API with configurable behavior.`,
|
|
|
6395
6412
|
erased: true
|
|
6396
6413
|
},
|
|
6397
6414
|
behavior: {
|
|
6398
|
-
type: [
|
|
6415
|
+
type: [
|
|
6416
|
+
{ value: "undefined" },
|
|
6417
|
+
{ value: "auto" },
|
|
6418
|
+
{ value: "smooth" }
|
|
6419
|
+
],
|
|
6399
6420
|
erased: true
|
|
6400
6421
|
}
|
|
6401
6422
|
}
|
|
@@ -6419,7 +6440,11 @@ then the element will be looked for only in the descendant elements of this DOM
|
|
|
6419
6440
|
erased: true
|
|
6420
6441
|
},
|
|
6421
6442
|
useSelectedElementAsRoot: {
|
|
6422
|
-
type:
|
|
6443
|
+
type: [
|
|
6444
|
+
{ value: "undefined" },
|
|
6445
|
+
{ value: "false" },
|
|
6446
|
+
{ value: "true" }
|
|
6447
|
+
],
|
|
6423
6448
|
erased: true
|
|
6424
6449
|
}
|
|
6425
6450
|
},
|
|
@@ -6553,7 +6578,11 @@ When override is set to true the properties replace the current operation data e
|
|
|
6553
6578
|
category: `Data`,
|
|
6554
6579
|
properties: {
|
|
6555
6580
|
override: {
|
|
6556
|
-
type:
|
|
6581
|
+
type: [
|
|
6582
|
+
{ value: "undefined" },
|
|
6583
|
+
{ value: "false" },
|
|
6584
|
+
{ value: "true" }
|
|
6585
|
+
],
|
|
6557
6586
|
erased: true
|
|
6558
6587
|
},
|
|
6559
6588
|
properties: {
|
|
@@ -6617,15 +6646,19 @@ Supports three sorting modes:
|
|
|
6617
6646
|
dependentProperties: ["arrayData"],
|
|
6618
6647
|
properties: {
|
|
6619
6648
|
sortProperty: {
|
|
6620
|
-
type: "
|
|
6649
|
+
type: [{ value: "undefined" }, { value: "string" }],
|
|
6621
6650
|
erased: true
|
|
6622
6651
|
},
|
|
6623
6652
|
sortOrder: {
|
|
6624
|
-
type: [
|
|
6653
|
+
type: [
|
|
6654
|
+
{ value: "undefined" },
|
|
6655
|
+
{ value: "asc" },
|
|
6656
|
+
{ value: "desc" }
|
|
6657
|
+
],
|
|
6625
6658
|
erased: true
|
|
6626
6659
|
},
|
|
6627
6660
|
sortComparator: {
|
|
6628
|
-
type: "
|
|
6661
|
+
type: [{ value: "undefined" }, { value: "(a: any, b: any) => number" }],
|
|
6629
6662
|
erased: true
|
|
6630
6663
|
}
|
|
6631
6664
|
},
|
|
@@ -6647,7 +6680,7 @@ function splitString$1() {
|
|
|
6647
6680
|
erased: true
|
|
6648
6681
|
},
|
|
6649
6682
|
limit: {
|
|
6650
|
-
type: "
|
|
6683
|
+
type: [{ value: "undefined" }, { value: "number" }],
|
|
6651
6684
|
erased: true
|
|
6652
6685
|
}
|
|
6653
6686
|
},
|
|
@@ -6690,7 +6723,7 @@ function substringText$1() {
|
|
|
6690
6723
|
erased: true
|
|
6691
6724
|
},
|
|
6692
6725
|
end: {
|
|
6693
|
-
type: "
|
|
6726
|
+
type: [{ value: "undefined" }, { value: "number" }],
|
|
6694
6727
|
erased: true
|
|
6695
6728
|
}
|
|
6696
6729
|
},
|
|
@@ -6758,12 +6791,16 @@ custom validation rules for: required, minLength, maxLength, pattern (regex), an
|
|
|
6758
6791
|
category: `Form`,
|
|
6759
6792
|
dependentProperties: ["selectedElement"],
|
|
6760
6793
|
properties: { validationRules: {
|
|
6761
|
-
type: "
|
|
6794
|
+
type: [{ value: "undefined" }, { value: "Record<string, import(\"/home/runner/work/eligius/eligius/src/operation/validate-form\").IValidationRules>" }],
|
|
6762
6795
|
erased: true
|
|
6763
6796
|
} },
|
|
6764
6797
|
outputProperties: {
|
|
6765
6798
|
validationErrors: { type: "ParameterType:object" },
|
|
6766
|
-
isValid: { type:
|
|
6799
|
+
isValid: { type: [
|
|
6800
|
+
{ value: "undefined" },
|
|
6801
|
+
{ value: "false" },
|
|
6802
|
+
{ value: "true" }
|
|
6803
|
+
] }
|
|
6767
6804
|
}
|
|
6768
6805
|
};
|
|
6769
6806
|
}
|
|
@@ -7279,7 +7316,7 @@ The controller also listen for the \`LANGUAGE_CHANGE\` event and re-renders the
|
|
|
7279
7316
|
type: "ParameterType:labelId",
|
|
7280
7317
|
required: true
|
|
7281
7318
|
},
|
|
7282
|
-
attributeName: { type: "
|
|
7319
|
+
attributeName: { type: [{ value: "undefined" }, { value: "string" }] }
|
|
7283
7320
|
}
|
|
7284
7321
|
};
|
|
7285
7322
|
}
|
|
@@ -7314,16 +7351,37 @@ The controller follows the standard Eligius lifecycle:
|
|
|
7314
7351
|
- detach(): Disconnect the observer and clean up resources`,
|
|
7315
7352
|
dependentProperties: ["selectedElement"],
|
|
7316
7353
|
properties: {
|
|
7317
|
-
observeAttributes: { type:
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
}
|
|
7354
|
+
observeAttributes: { type: [
|
|
7355
|
+
{ value: "undefined" },
|
|
7356
|
+
{ value: "false" },
|
|
7357
|
+
{ value: "true" }
|
|
7358
|
+
] },
|
|
7359
|
+
observeChildList: { type: [
|
|
7360
|
+
{ value: "undefined" },
|
|
7361
|
+
{ value: "false" },
|
|
7362
|
+
{ value: "true" }
|
|
7363
|
+
] },
|
|
7364
|
+
observeCharacterData: { type: [
|
|
7365
|
+
{ value: "undefined" },
|
|
7366
|
+
{ value: "false" },
|
|
7367
|
+
{ value: "true" }
|
|
7368
|
+
] },
|
|
7369
|
+
observeSubtree: { type: [
|
|
7370
|
+
{ value: "undefined" },
|
|
7371
|
+
{ value: "false" },
|
|
7372
|
+
{ value: "true" }
|
|
7373
|
+
] },
|
|
7374
|
+
attributeOldValue: { type: [
|
|
7375
|
+
{ value: "undefined" },
|
|
7376
|
+
{ value: "false" },
|
|
7377
|
+
{ value: "true" }
|
|
7378
|
+
] },
|
|
7379
|
+
characterDataOldValue: { type: [
|
|
7380
|
+
{ value: "undefined" },
|
|
7381
|
+
{ value: "false" },
|
|
7382
|
+
{ value: "true" }
|
|
7383
|
+
] },
|
|
7384
|
+
attributeFilter: { type: [{ value: "undefined" }, { value: "string[]" }] }
|
|
7327
7385
|
}
|
|
7328
7386
|
};
|
|
7329
7387
|
}
|
|
@@ -7371,7 +7429,7 @@ function SubtitlesController$1() {
|
|
|
7371
7429
|
description: ``,
|
|
7372
7430
|
dependentProperties: ["selectedElement"],
|
|
7373
7431
|
properties: {
|
|
7374
|
-
language: { type: "ParameterType
|
|
7432
|
+
language: { type: "ParameterType:languagecode" },
|
|
7375
7433
|
subtitleData: { type: "ParameterType:array" }
|
|
7376
7434
|
}
|
|
7377
7435
|
};
|
|
@@ -7391,771 +7449,121 @@ var metadata_exports = /* @__PURE__ */ __export({
|
|
|
7391
7449
|
});
|
|
7392
7450
|
|
|
7393
7451
|
//#endregion
|
|
7394
|
-
//#region src/
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
this._createTimelineLookup();
|
|
7422
|
-
return this._initializeTimelineProvider();
|
|
7423
|
-
}
|
|
7424
|
-
_createLayoutTemplate() {
|
|
7425
|
-
const { containerSelector } = this.configuration;
|
|
7426
|
-
const container = $(containerSelector);
|
|
7427
|
-
if (!container || !container.length) throw new Error(`Container selector not found: ${containerSelector}`);
|
|
7428
|
-
const { layoutTemplate } = this.configuration;
|
|
7429
|
-
if (layoutTemplate?.length) container.html(layoutTemplate);
|
|
7430
|
-
else console.warn("layoutTemplate is empty, unable to create layout");
|
|
7431
|
-
}
|
|
7432
|
-
async _initializeTimelineProvider() {
|
|
7433
|
-
if (!this.configuration.timelines?.length) throw new Error("No timelines present");
|
|
7434
|
-
const firstTimeline = this.configuration.timelines[0];
|
|
7435
|
-
const providerSettings = this.timelineProviders[firstTimeline.type];
|
|
7436
|
-
if (!providerSettings) throw new Error(`No timeline provider configured for type ${firstTimeline.type}`);
|
|
7437
|
-
this._activeTimelineProvider?.destroy();
|
|
7438
|
-
this._activeTimelineProvider = providerSettings.provider;
|
|
7439
|
-
if (!this._activeTimelineProvider) throw new Error("NO ACTIVE TIMELINE PROVIDER");
|
|
7440
|
-
this._activeTimelineProvider.onTime(this._onTimeHandler.bind(this, Math.floor));
|
|
7441
|
-
this._activeTimelineProvider.onComplete(this._onCompleteCallback.bind(this));
|
|
7442
|
-
this._activeTimelineProvider.onFirstFrame(this._onFirstFrameCallback.bind(this));
|
|
7443
|
-
this._activeTimelineProvider.onRestart(this._onRestartCallback.bind(this));
|
|
7444
|
-
await this._activeTimelineProvider.init();
|
|
7445
|
-
await this._executeActions(this.configuration.initActions, "start");
|
|
7446
|
-
return this._activeTimelineProvider;
|
|
7447
|
-
}
|
|
7448
|
-
_onCompleteCallback() {
|
|
7449
|
-
this.eventbus.broadcast("timeline-complete", []);
|
|
7450
|
-
}
|
|
7451
|
-
_onFirstFrameCallback() {
|
|
7452
|
-
this.eventbus.broadcast("timeline-firstframe", []);
|
|
7453
|
-
this.eventbus.broadcast("timeline-duration", [this._activeTimelineProvider?.getDuration]);
|
|
7454
|
-
}
|
|
7455
|
-
_onRestartCallback() {
|
|
7456
|
-
this.eventbus.broadcast("timeline-restart", []);
|
|
7457
|
-
}
|
|
7458
|
-
async _cleanUp() {
|
|
7459
|
-
await this._cleanUpTimeline();
|
|
7460
|
-
await this._executeActions([...this.configuration.initActions].reverse(), "end");
|
|
7461
|
-
}
|
|
7462
|
-
/**
|
|
7463
|
-
* Cleans up all the necessary parts that the engine initialized.
|
|
7464
|
-
* - It ends the currently active operations and the init actions.
|
|
7465
|
-
* - It removes all its eventbus listeners, handlers and interceptors.
|
|
7466
|
-
* - It destroys all of its timeline providers
|
|
7467
|
-
* - It empties the HTML element indicated by the containerSelector configuration property.
|
|
7468
|
-
*
|
|
7469
|
-
*/
|
|
7470
|
-
async destroy() {
|
|
7471
|
-
await this._cleanUp();
|
|
7472
|
-
this.languageManager.destroy();
|
|
7473
|
-
this._activeTimelineProvider = void 0;
|
|
7474
|
-
this._eventbusRemovers.forEach((remover) => remover());
|
|
7475
|
-
if (this.timelineProviders) Object.values(this.timelineProviders).forEach((providerInfo) => providerInfo.provider.destroy());
|
|
7476
|
-
const { containerSelector } = this.configuration;
|
|
7477
|
-
$(containerSelector).empty();
|
|
7478
|
-
}
|
|
7479
|
-
_addEventListener(eventName, eventHandler, eventTopic) {
|
|
7480
|
-
this._eventbusRemovers.push(this.eventbus.on(eventName, eventHandler, eventTopic));
|
|
7481
|
-
}
|
|
7482
|
-
_addEventbusListeners() {
|
|
7483
|
-
this._addEventListener("request-engine-root", this._handleRequestEngineRoot.bind(this, this.configuration.containerSelector));
|
|
7484
|
-
this._addEventListener("request-timeline-uri", this._handleRequestTimelineUri.bind(this));
|
|
7485
|
-
this._addEventListener("request-current-timeline-position", this._handleRequestTimelinePosition.bind(this, Math.floor));
|
|
7486
|
-
this._addEventListener("request-timeline-cleanup", this._handleTimelineComplete.bind(this));
|
|
7487
|
-
this._addEventListener("timeline-request-current-timeline", this._requestCurrentTimeline.bind(this));
|
|
7488
|
-
this._addEventListener("timeline-play-toggle-request", this._toggleplay.bind(this));
|
|
7489
|
-
this._addEventListener("timeline-play-request", this._playRequest.bind(this));
|
|
7490
|
-
this._addEventListener("timeline-stop-request", this._stopRequest.bind(this));
|
|
7491
|
-
this._addEventListener("timeline-pause-request", this._pauseRequest.bind(this));
|
|
7492
|
-
this._addEventListener("timeline-container-request", this.containerRequest.bind(this));
|
|
7493
|
-
this._addEventListener("timeline-duration-request", this.durationRequest.bind(this));
|
|
7494
|
-
this._addEventListener("timeline-seek-request", this.seekRequest.bind(this));
|
|
7495
|
-
}
|
|
7496
|
-
async seekRequest(position) {
|
|
7497
|
-
if (!this._activeTimelineProvider) return;
|
|
7498
|
-
const seekPosition = Math.floor(position);
|
|
7499
|
-
const duration = this._activeTimelineProvider.getDuration();
|
|
7500
|
-
const currentPosition = this._activeTimelineProvider.getPosition();
|
|
7501
|
-
if (seekPosition < 0 || seekPosition > duration) return;
|
|
7502
|
-
this.eventbus.broadcast("timeline-seek", [
|
|
7503
|
-
seekPosition,
|
|
7504
|
-
currentPosition,
|
|
7505
|
-
duration
|
|
7506
|
-
]);
|
|
7507
|
-
await this._activeTimelineProvider.seek(seekPosition);
|
|
7508
|
-
await this._executeSeekActions(seekPosition);
|
|
7509
|
-
this.eventbus.broadcast("timeline-seeked", [this._activeTimelineProvider.getPosition(), duration]);
|
|
7510
|
-
this.eventbus.broadcast("timeline-time", [this._activeTimelineProvider.getPosition()]);
|
|
7511
|
-
if (this._activeTimelineProvider?.playState === "running") this._activeTimelineProvider?.start();
|
|
7512
|
-
}
|
|
7513
|
-
durationRequest(callBack) {
|
|
7514
|
-
callBack(this._activeTimelineProvider?.getDuration());
|
|
7515
|
-
}
|
|
7516
|
-
containerRequest(callBack) {
|
|
7517
|
-
callBack(this._activeTimelineProvider?.getContainer());
|
|
7518
|
-
}
|
|
7519
|
-
_pauseRequest() {
|
|
7520
|
-
if (!this._activeTimelineProvider) return;
|
|
7521
|
-
this._activeTimelineProvider.pause();
|
|
7522
|
-
this.eventbus.broadcast("timeline-pause", []);
|
|
7523
|
-
}
|
|
7524
|
-
_stopRequest() {
|
|
7525
|
-
if (!this._activeTimelineProvider) return;
|
|
7526
|
-
this._activeTimelineProvider.stop();
|
|
7527
|
-
this.eventbus.broadcast("timeline-stop", []);
|
|
7528
|
-
}
|
|
7529
|
-
_playRequest() {
|
|
7530
|
-
if (!this._activeTimelineProvider) return;
|
|
7531
|
-
this._activeTimelineProvider.start();
|
|
7532
|
-
this.eventbus.broadcast("timeline-play", []);
|
|
7533
|
-
}
|
|
7534
|
-
_toggleplay() {
|
|
7535
|
-
if (!this._activeTimelineProvider) return;
|
|
7536
|
-
if (this._activeTimelineProvider.playState === "running") this._activeTimelineProvider.pause();
|
|
7537
|
-
else this._activeTimelineProvider.start();
|
|
7538
|
-
}
|
|
7539
|
-
_createTimelineLookup() {
|
|
7540
|
-
if (!this.configuration.timelines) return;
|
|
7541
|
-
this.configuration.timelines.forEach((timelineInfo) => {
|
|
7542
|
-
this._timelineLookupCache.set(timelineInfo.uri, timelineInfo);
|
|
7543
|
-
timelineInfo.timelineActions.forEach((timelineAction) => {
|
|
7544
|
-
this._addTimelineActionStart(timelineInfo.uri, timelineAction);
|
|
7545
|
-
this._addTimelineActionEnd(timelineInfo.uri, timelineAction);
|
|
7546
|
-
});
|
|
7547
|
-
});
|
|
7548
|
-
EligiusEngine.sortTimelines(Object.values(this._timeLineActionsLookup));
|
|
7549
|
-
}
|
|
7550
|
-
static sortTimelines(timelines) {
|
|
7551
|
-
timelines.forEach((timelineActions) => {
|
|
7552
|
-
Object.keys(timelineActions).forEach((key) => {
|
|
7553
|
-
const numericKey = Number(key);
|
|
7554
|
-
timelineActions[numericKey] = EligiusEngine.sortActionsPerPosition(timelineActions[numericKey]);
|
|
7555
|
-
});
|
|
7556
|
-
});
|
|
7557
|
-
}
|
|
7558
|
-
static sortActionsPerPosition(actions) {
|
|
7559
|
-
const [startMethods, endMethods] = actions.reduce((acc, item) => {
|
|
7560
|
-
if (item.isStart) acc[0].push(item);
|
|
7561
|
-
else acc[1].push(item);
|
|
7562
|
-
return acc;
|
|
7563
|
-
}, [[], []]);
|
|
7564
|
-
return [...endMethods.sort(sortActionMethodsHighestStartPositionFirst), ...startMethods];
|
|
7565
|
-
}
|
|
7566
|
-
_addTimelineActionStart(uri, timeLineAction) {
|
|
7567
|
-
const startPosition = timeLineAction.duration.start;
|
|
7568
|
-
const timelineStartPositions = this._initializeTimelinePosition(this._initializeUriLookup(this._timeLineActionsLookup, uri), startPosition);
|
|
7569
|
-
const startMethod = timeLineAction.start.bind(timeLineAction);
|
|
7570
|
-
if (timeLineAction.id?.length) startMethod.id = timeLineAction.id;
|
|
7571
|
-
startMethod.isStart = true;
|
|
7572
|
-
timelineStartPositions.push(startMethod);
|
|
7573
|
-
}
|
|
7574
|
-
_addTimelineActionEnd(uri, timeLineAction) {
|
|
7575
|
-
let end = timeLineAction.duration.end;
|
|
7576
|
-
if (end < 0) end = timeLineAction.duration.end = Infinity;
|
|
7577
|
-
if (Number.isFinite(end)) {
|
|
7578
|
-
const timelineEndPositions = this._initializeTimelinePosition(this._timeLineActionsLookup[uri], end);
|
|
7579
|
-
const endMethod = timeLineAction.end.bind(timeLineAction);
|
|
7580
|
-
if (timeLineAction.id?.length) {
|
|
7581
|
-
endMethod.id = timeLineAction.id;
|
|
7582
|
-
endMethod.startPosition = timeLineAction.duration.start;
|
|
7583
|
-
}
|
|
7584
|
-
endMethod.isStart = false;
|
|
7585
|
-
timelineEndPositions.push(endMethod);
|
|
7586
|
-
}
|
|
7587
|
-
}
|
|
7588
|
-
_initializeUriLookup(lookup, uri) {
|
|
7589
|
-
if (!lookup[uri]) lookup[uri] = {};
|
|
7590
|
-
return lookup[uri];
|
|
7591
|
-
}
|
|
7592
|
-
_initializeTimelinePosition(lookup, position) {
|
|
7593
|
-
if (!lookup[position]) lookup[position] = [];
|
|
7594
|
-
return lookup[position];
|
|
7595
|
-
}
|
|
7596
|
-
async _executeActions(actions, methodName) {
|
|
7597
|
-
if (actions.length === 0) return;
|
|
7598
|
-
for (const action of actions) await action[methodName]();
|
|
7599
|
-
}
|
|
7600
|
-
_handleRequestEngineRoot(engineRootSelector, resultCallback) {
|
|
7601
|
-
resultCallback($(engineRootSelector));
|
|
7602
|
-
}
|
|
7603
|
-
async _handleRequestTimelineUri(uri, position = 0) {
|
|
7604
|
-
if (!this._activeTimelineProvider) return;
|
|
7605
|
-
this._activeTimelineProvider.stop();
|
|
7606
|
-
await this._cleanUpTimeline();
|
|
7607
|
-
const timelineConfig = this._timelineLookupCache.get(uri);
|
|
7608
|
-
if (!timelineConfig || !this._activeTimelineProvider || this._currentTimelineUri === timelineConfig.uri) return;
|
|
7609
|
-
this._currentTimelineUri = timelineConfig.uri;
|
|
7610
|
-
this.eventbus.broadcast("timeline-current-timeline-change", [this._currentTimelineUri]);
|
|
7611
|
-
const newProviderSettings = this.timelineProviders[timelineConfig.type];
|
|
7612
|
-
if (this._activeTimelineProvider !== newProviderSettings.provider) {
|
|
7613
|
-
this._activeTimelineProvider.destroy();
|
|
7614
|
-
this._activeTimelineProvider = newProviderSettings.provider;
|
|
7615
|
-
}
|
|
7616
|
-
this._activeTimelineProvider.loop = timelineConfig.loop;
|
|
7617
|
-
if (!this._activeTimelineProvider.loop && position > 0) this.eventbus.once("timeline-firstframe", async () => {
|
|
7618
|
-
if (!this._activeTimelineProvider) return;
|
|
7619
|
-
this._activeTimelineProvider.pause();
|
|
7620
|
-
this.eventbus.broadcast("timeline-duration", [this._activeTimelineProvider.getDuration]);
|
|
7621
|
-
await this._executeStartActions();
|
|
7622
|
-
const seekPosition = await this._activeTimelineProvider.seek(position);
|
|
7623
|
-
this.seekRequest(seekPosition);
|
|
7624
|
-
});
|
|
7625
|
-
this._activeTimelineProvider.playlistItem(uri);
|
|
7626
|
-
}
|
|
7627
|
-
_cleanUpTimeline() {
|
|
7628
|
-
return this._executeRelevantActions(this._getActiveActions, "end");
|
|
7629
|
-
}
|
|
7630
|
-
_executeStartActions() {
|
|
7631
|
-
return this._executeRelevantActions(this._getActionsForPosition.bind(this, 0), "start");
|
|
7632
|
-
}
|
|
7633
|
-
/**
|
|
7634
|
-
* Gets all of the inactive actions whose duration falls within the given timeline position.
|
|
7635
|
-
*
|
|
7636
|
-
* @param position the given position
|
|
7637
|
-
* @param actions all of the relevant actions
|
|
7638
|
-
* @returns
|
|
7639
|
-
*/
|
|
7640
|
-
_getActionsForPosition(position, actions) {
|
|
7641
|
-
return actions.filter((action) => !action.active && action.duration.start <= position && action.duration.end >= position);
|
|
7642
|
-
}
|
|
7643
|
-
_getActiveActions(allActions) {
|
|
7644
|
-
return allActions.filter((action) => action.active).sort(sortActionsHighestStartPositionFirst);
|
|
7645
|
-
}
|
|
7646
|
-
_executeRelevantActions(filter, executionType) {
|
|
7647
|
-
const timelineActions = this._getTimelineActionsForCurrentTimeline();
|
|
7648
|
-
const currentActions = filter.apply(this, [timelineActions]);
|
|
7649
|
-
return this._executeActions(currentActions, executionType);
|
|
7650
|
-
}
|
|
7651
|
-
_handleRequestTimelinePosition(floor, resultCallback) {
|
|
7652
|
-
resultCallback(floor(this._activeTimelineProvider?.getPosition() || -1));
|
|
7653
|
-
}
|
|
7654
|
-
_handleTimelineComplete() {
|
|
7655
|
-
this._cleanUpTimeline();
|
|
7656
|
-
}
|
|
7657
|
-
_getTimelineActionsForCurrentTimeline() {
|
|
7658
|
-
return this._getTimelineActionsForUri(this._currentTimelineUri);
|
|
7659
|
-
}
|
|
7660
|
-
_requestCurrentTimeline(resultCallback) {
|
|
7661
|
-
resultCallback(this._currentTimelineUri);
|
|
7662
|
-
}
|
|
7663
|
-
_getTimelineActionsForUri(uri) {
|
|
7664
|
-
return this._timelineLookupCache.get(uri)?.timelineActions ?? [];
|
|
7665
|
-
}
|
|
7666
|
-
_onTimeHandler(floor, position) {
|
|
7667
|
-
if (!Number.isNaN(position)) {
|
|
7668
|
-
const pos = floor(position);
|
|
7669
|
-
if (this._lastPosition !== pos) {
|
|
7670
|
-
this._executeActionsForPosition(pos);
|
|
7671
|
-
this.eventbus.broadcast("timeline-time", [pos]);
|
|
7452
|
+
//#region src/eventbus/events/metadata/before-request-timeline-uri.ts
|
|
7453
|
+
function beforeRequestTimelineUri() {
|
|
7454
|
+
return {
|
|
7455
|
+
description: `Event: before-request-timeline-uri`,
|
|
7456
|
+
category: `Timeline`,
|
|
7457
|
+
args: []
|
|
7458
|
+
};
|
|
7459
|
+
}
|
|
7460
|
+
|
|
7461
|
+
//#endregion
|
|
7462
|
+
//#region src/eventbus/events/metadata/before-request-video-url.ts
|
|
7463
|
+
function beforeRequestVideoUrl() {
|
|
7464
|
+
return {
|
|
7465
|
+
description: `Event: before-request-video-url`,
|
|
7466
|
+
category: `Navigation`,
|
|
7467
|
+
args: [
|
|
7468
|
+
{
|
|
7469
|
+
name: "index",
|
|
7470
|
+
type: "number"
|
|
7471
|
+
},
|
|
7472
|
+
{
|
|
7473
|
+
name: "requestedVideoPosition",
|
|
7474
|
+
type: "number"
|
|
7475
|
+
},
|
|
7476
|
+
{
|
|
7477
|
+
name: "isHistoryRequest",
|
|
7478
|
+
type: "boolean"
|
|
7672
7479
|
}
|
|
7673
|
-
|
|
7674
|
-
}
|
|
7675
|
-
|
|
7676
|
-
this._lastPosition = position;
|
|
7677
|
-
const actions = this._timeLineActionsLookup[this._currentTimelineUri];
|
|
7678
|
-
if (actions) actions[position]?.forEach((exec) => exec());
|
|
7679
|
-
}
|
|
7680
|
-
async _executeSeekActions(position) {
|
|
7681
|
-
const timelineActions = this._getTimelineActionsForCurrentTimeline();
|
|
7682
|
-
if (!timelineActions) return Promise.resolve();
|
|
7683
|
-
const currentActions = this._getActiveActions(timelineActions).filter((action) => !(action.duration.start <= position && action.duration.end >= position));
|
|
7684
|
-
const newActions = this._getActionsForPosition(position, timelineActions);
|
|
7685
|
-
await this._executeActions(currentActions, "end");
|
|
7686
|
-
return this._executeActions(newActions, "start");
|
|
7687
|
-
}
|
|
7688
|
-
};
|
|
7689
|
-
const sortActionsHighestStartPositionFirst = (a, b) => {
|
|
7690
|
-
if (b.duration.start < a.duration.start) return -1;
|
|
7691
|
-
else if (b.duration.start > a.duration.start) return 1;
|
|
7692
|
-
else return 0;
|
|
7693
|
-
};
|
|
7694
|
-
const sortActionMethodsHighestStartPositionFirst = (a, b) => {
|
|
7695
|
-
if (b.startPosition === void 0 || a.startPosition === void 0) return 0;
|
|
7696
|
-
if (b.startPosition < a.startPosition) return -1;
|
|
7697
|
-
else if (b.startPosition > a.startPosition) return 1;
|
|
7698
|
-
else return 0;
|
|
7699
|
-
};
|
|
7480
|
+
]
|
|
7481
|
+
};
|
|
7482
|
+
}
|
|
7700
7483
|
|
|
7701
7484
|
//#endregion
|
|
7702
|
-
//#region src/eventbus/
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
}
|
|
7714
|
-
handleEvent(eventName, eventTopic, args) {
|
|
7715
|
-
if (eventTopic) eventName = `${eventName}:${eventTopic}`;
|
|
7716
|
-
const actions = this._actionRegistry.get(eventName);
|
|
7717
|
-
if (actions) {
|
|
7718
|
-
const operationData = { eventArgs: args };
|
|
7719
|
-
actions.forEach((action) => {
|
|
7720
|
-
action.start(operationData);
|
|
7721
|
-
});
|
|
7722
|
-
}
|
|
7723
|
-
}
|
|
7724
|
-
};
|
|
7485
|
+
//#region src/eventbus/events/metadata/dom-mutation.ts
|
|
7486
|
+
function domMutation() {
|
|
7487
|
+
return {
|
|
7488
|
+
description: `Event: dom-mutation`,
|
|
7489
|
+
category: `Controller`,
|
|
7490
|
+
args: [{
|
|
7491
|
+
name: "payload",
|
|
7492
|
+
type: "any"
|
|
7493
|
+
}]
|
|
7494
|
+
};
|
|
7495
|
+
}
|
|
7725
7496
|
|
|
7726
7497
|
//#endregion
|
|
7727
|
-
//#region src/eventbus/
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
this.eventInterceptors = /* @__PURE__ */ new Map();
|
|
7739
|
-
}
|
|
7740
|
-
_getEventInterceptors(eventName, eventTopic) {
|
|
7741
|
-
if (eventTopic) eventName = `${eventName}:${eventTopic}`;
|
|
7742
|
-
if (!this.eventInterceptors.has(eventName)) this.eventInterceptors.set(eventName, []);
|
|
7743
|
-
return this.eventInterceptors.get(eventName);
|
|
7744
|
-
}
|
|
7745
|
-
_getEventHandlers(eventName, eventTopic) {
|
|
7746
|
-
if (eventTopic) eventName = `${eventName}:${eventTopic}`;
|
|
7747
|
-
if (!this.eventHandlers.has(eventName)) this.eventHandlers.set(eventName, []);
|
|
7748
|
-
return this.eventHandlers.get(eventName);
|
|
7749
|
-
}
|
|
7750
|
-
on(eventName, eventHandler, eventTopic) {
|
|
7751
|
-
this._getEventHandlers(eventName, eventTopic).push(eventHandler);
|
|
7752
|
-
return () => {
|
|
7753
|
-
this.off(eventName, eventHandler, eventTopic);
|
|
7754
|
-
};
|
|
7755
|
-
}
|
|
7756
|
-
once(eventName, eventHandler, eventTopic) {
|
|
7757
|
-
const eventHandlerDecorator = (...args) => {
|
|
7758
|
-
eventHandler(...args);
|
|
7759
|
-
this.off(eventName, eventHandlerDecorator, eventTopic);
|
|
7760
|
-
};
|
|
7761
|
-
this.on(eventName, eventHandlerDecorator, eventTopic);
|
|
7762
|
-
return () => {
|
|
7763
|
-
this.off(eventName, eventHandlerDecorator, eventTopic);
|
|
7764
|
-
};
|
|
7765
|
-
}
|
|
7766
|
-
off(eventName, eventHandler, eventTopic) {
|
|
7767
|
-
const handlers = this._getEventHandlers(eventName, eventTopic);
|
|
7768
|
-
if (handlers) {
|
|
7769
|
-
const idx = handlers.indexOf(eventHandler);
|
|
7770
|
-
if (idx > -1) handlers.splice(idx, 1);
|
|
7771
|
-
}
|
|
7772
|
-
}
|
|
7773
|
-
broadcast(eventName, args) {
|
|
7774
|
-
this._callHandlers(eventName, void 0, args);
|
|
7775
|
-
}
|
|
7776
|
-
broadcastForTopic(eventName, eventTopic, args) {
|
|
7777
|
-
this._callHandlers(eventName, eventTopic, args);
|
|
7778
|
-
}
|
|
7779
|
-
registerEventlistener(eventbusListener) {
|
|
7780
|
-
this.eventListeners.push(eventbusListener);
|
|
7781
|
-
return () => {
|
|
7782
|
-
const index = this.eventListeners.indexOf(eventbusListener);
|
|
7783
|
-
if (index > -1) this.eventListeners.splice(index, 1);
|
|
7784
|
-
};
|
|
7785
|
-
}
|
|
7786
|
-
registerInterceptor(eventName, interceptor, eventTopic) {
|
|
7787
|
-
const interceptors = this._getEventInterceptors(eventName, eventTopic);
|
|
7788
|
-
interceptors.push(interceptor);
|
|
7789
|
-
return () => {
|
|
7790
|
-
const index = interceptors.indexOf(interceptor);
|
|
7791
|
-
if (index > -1) interceptors.splice(index, 1);
|
|
7792
|
-
};
|
|
7793
|
-
}
|
|
7794
|
-
_callHandlers(eventName, eventTopic, args = []) {
|
|
7795
|
-
const handlers = this._getEventHandlers(eventName, eventTopic);
|
|
7796
|
-
if (handlers) {
|
|
7797
|
-
this._getEventInterceptors(eventName, eventTopic).forEach((interceptor) => {
|
|
7798
|
-
args = interceptor.intercept(args);
|
|
7799
|
-
});
|
|
7800
|
-
this.eventListeners.forEach((listener) => {
|
|
7801
|
-
listener.handleEvent(eventName, eventTopic, args);
|
|
7802
|
-
});
|
|
7803
|
-
if (args?.length) handlers.forEach((handler) => handler(...args));
|
|
7804
|
-
else handlers.forEach((handler) => handler());
|
|
7805
|
-
}
|
|
7806
|
-
}
|
|
7807
|
-
};
|
|
7498
|
+
//#region src/eventbus/events/metadata/highlight-navigation.ts
|
|
7499
|
+
function highlightNavigation() {
|
|
7500
|
+
return {
|
|
7501
|
+
description: `Event: highlight-navigation`,
|
|
7502
|
+
category: `Navigation`,
|
|
7503
|
+
args: [{
|
|
7504
|
+
name: "videoUrlIndex",
|
|
7505
|
+
type: "number"
|
|
7506
|
+
}]
|
|
7507
|
+
};
|
|
7508
|
+
}
|
|
7808
7509
|
|
|
7809
7510
|
//#endregion
|
|
7810
|
-
//#region src/eventbus/
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
};
|
|
7511
|
+
//#region src/eventbus/events/metadata/language-change.ts
|
|
7512
|
+
function languageChange() {
|
|
7513
|
+
return {
|
|
7514
|
+
description: `Event: language-change`,
|
|
7515
|
+
category: `Language Manager`,
|
|
7516
|
+
args: [{
|
|
7517
|
+
name: "language",
|
|
7518
|
+
type: "TLanguageCode"
|
|
7519
|
+
}]
|
|
7520
|
+
};
|
|
7521
|
+
}
|
|
7820
7522
|
|
|
7821
7523
|
//#endregion
|
|
7822
|
-
//#region src/eventbus/
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7524
|
+
//#region src/eventbus/events/metadata/navigate-to-video-url.ts
|
|
7525
|
+
function navigateToVideoUrl() {
|
|
7526
|
+
return {
|
|
7527
|
+
description: `Event: navigate-to-video-url`,
|
|
7528
|
+
category: `Navigation`,
|
|
7529
|
+
args: [{
|
|
7530
|
+
name: "index",
|
|
7531
|
+
type: "number"
|
|
7532
|
+
}, {
|
|
7533
|
+
name: "requestedVideoPosition",
|
|
7534
|
+
type: "number"
|
|
7535
|
+
}]
|
|
7536
|
+
};
|
|
7537
|
+
}
|
|
7828
7538
|
|
|
7829
7539
|
//#endregion
|
|
7830
|
-
//#region src/
|
|
7831
|
-
function
|
|
7832
|
-
|
|
7833
|
-
|
|
7540
|
+
//#region src/eventbus/events/metadata/push-history-state.ts
|
|
7541
|
+
function pushHistoryState() {
|
|
7542
|
+
return {
|
|
7543
|
+
description: `Event: push-history-state`,
|
|
7544
|
+
category: `Navigation`,
|
|
7545
|
+
args: [{
|
|
7546
|
+
name: "state",
|
|
7547
|
+
type: "any"
|
|
7548
|
+
}]
|
|
7549
|
+
};
|
|
7834
7550
|
}
|
|
7835
7551
|
|
|
7836
7552
|
//#endregion
|
|
7837
|
-
//#region src/
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
setGlobal("defaultLanguage", _currentLanguage);
|
|
7852
|
-
this._setRootElementLang(_currentLanguage);
|
|
7853
|
-
this._labelLookup = this._createLabelLookup(labels);
|
|
7854
|
-
this._addEventbusListeners(_eventbus);
|
|
7855
|
-
}
|
|
7856
|
-
destroy() {
|
|
7857
|
-
this._eventbusRemovers.forEach((x) => x());
|
|
7858
|
-
}
|
|
7859
|
-
_addEventbusListeners(eventbus$1) {
|
|
7860
|
-
this._eventbusRemovers.push(eventbus$1.on("request-label-collection", this._handleRequestLabelCollection.bind(this)));
|
|
7861
|
-
this._eventbusRemovers.push(eventbus$1.on("request-label-collections", this._handleRequestLabelCollections.bind(this)));
|
|
7862
|
-
this._eventbusRemovers.push(eventbus$1.on("request-current-language", this._handleRequestCurrentLanguage.bind(this)));
|
|
7863
|
-
this._eventbusRemovers.push(eventbus$1.on("language-change", this._handleLanguageChange.bind(this)));
|
|
7864
|
-
}
|
|
7865
|
-
_handleRequestCurrentLanguage(resultCallback) {
|
|
7866
|
-
resultCallback(this._currentLanguage);
|
|
7867
|
-
}
|
|
7868
|
-
_handleRequestLabelCollection(labelId, resultCallback) {
|
|
7869
|
-
resultCallback(this._labelLookup[labelId]);
|
|
7870
|
-
}
|
|
7871
|
-
_handleRequestLabelCollections(labelIds, resultCallback) {
|
|
7872
|
-
resultCallback(labelIds.map((labelId) => {
|
|
7873
|
-
return this._labelLookup[labelId];
|
|
7874
|
-
}));
|
|
7875
|
-
}
|
|
7876
|
-
_handleLanguageChange(language) {
|
|
7877
|
-
this._currentLanguage = language;
|
|
7878
|
-
this._setRootElementLang(this._currentLanguage);
|
|
7879
|
-
}
|
|
7880
|
-
_setRootElementLang(language) {
|
|
7881
|
-
const callBack = (rootSelector) => {
|
|
7882
|
-
const lang = this._extractPrimaryLanguage(language);
|
|
7883
|
-
$(rootSelector).attr("lang", lang);
|
|
7884
|
-
};
|
|
7885
|
-
this._eventbus.broadcast("request-engine-root", [callBack]);
|
|
7886
|
-
}
|
|
7887
|
-
_extractPrimaryLanguage(culture) {
|
|
7888
|
-
return culture.split("-").shift();
|
|
7889
|
-
}
|
|
7890
|
-
_createLabelLookup(labels) {
|
|
7891
|
-
return labels.reduce((acc, label) => {
|
|
7892
|
-
acc[label.id] = label.labels;
|
|
7893
|
-
return acc;
|
|
7894
|
-
}, {});
|
|
7895
|
-
}
|
|
7896
|
-
};
|
|
7897
|
-
|
|
7898
|
-
//#endregion
|
|
7899
|
-
//#region src/engine-factory.ts
|
|
7900
|
-
const hotkeys = hk.default || hk;
|
|
7901
|
-
/**
|
|
7902
|
-
* The EngineFactory is used to create and initialize an {@link IEligiusEngine} instance.
|
|
7903
|
-
*
|
|
7904
|
-
* It prepares a resolved configuration and creates the engine based on the class defined in the configuration.
|
|
7905
|
-
*
|
|
7906
|
-
* @example Loading a configuration and creating an IEligiusEngine instance
|
|
7907
|
-
* ```ts
|
|
7908
|
-
* import { IEngineConfiguration, EngineFactory, WebpackResourceImporter } from 'eligius';
|
|
7909
|
-
* import * as engineConfig from './my-eligius-config.json';
|
|
7910
|
-
*
|
|
7911
|
-
* const factory = new EngineFactory(new WebpackResourceImporter(), window);
|
|
7912
|
-
*
|
|
7913
|
-
* const engine = factory.createEngine((engineConfig as unknown) as IEngineConfiguration);
|
|
7914
|
-
*
|
|
7915
|
-
* engine.init().then(()=> {console.log('Eligius engine ready for business');});
|
|
7916
|
-
* ```
|
|
7917
|
-
*/
|
|
7918
|
-
var EngineFactory = class {
|
|
7919
|
-
_actionsLookup = {};
|
|
7920
|
-
_eventbus;
|
|
7921
|
-
_eventRemovers = [];
|
|
7922
|
-
_importer;
|
|
7923
|
-
_resizeTimeout = -1;
|
|
7924
|
-
constructor(importer, windowRef, options) {
|
|
7925
|
-
this._importer = importer;
|
|
7926
|
-
this._eventbus = options?.eventbus ?? new Eventbus();
|
|
7927
|
-
Diagnostics.active = options?.devtools ?? false;
|
|
7928
|
-
if (Diagnostics.active) this._initializeDevtools(this._eventbus);
|
|
7929
|
-
this._eventRemovers.push(this._eventbus.on("request-instance", this._requestInstanceHandler.bind(this)));
|
|
7930
|
-
this._eventRemovers.push(this._eventbus.on("request-action", this._requestActionHandler.bind(this)));
|
|
7931
|
-
this._eventRemovers.push(this._eventbus.on("request-function", this._requestFunctionHandler.bind(this)));
|
|
7932
|
-
const handleSpaceBound = this._handleSpacePress.bind(this);
|
|
7933
|
-
hotkeys("space", handleSpaceBound);
|
|
7934
|
-
this._eventRemovers.push(() => hotkeys.unbind("space", handleSpaceBound));
|
|
7935
|
-
const resizeBound = this._resizeHandler.bind(this);
|
|
7936
|
-
const jqWin = $(windowRef);
|
|
7937
|
-
jqWin.on("resize", resizeBound);
|
|
7938
|
-
this._eventRemovers.push(() => jqWin.off("resize", resizeBound));
|
|
7939
|
-
}
|
|
7940
|
-
_handleSpacePress(keyboardEvent, _hotkeysEvent) {
|
|
7941
|
-
keyboardEvent.preventDefault();
|
|
7942
|
-
this._eventbus.broadcast("timeline-play-toggle-request", []);
|
|
7943
|
-
return false;
|
|
7944
|
-
}
|
|
7945
|
-
_initializeDevtools(eventbus$1) {
|
|
7946
|
-
const diagnosticInfo = window[DEV_TOOLS_KEY];
|
|
7947
|
-
if (diagnosticInfo) {
|
|
7948
|
-
const { agent } = diagnosticInfo;
|
|
7949
|
-
this._eventRemovers.push(eventbus$1.registerEventlistener(new DevToolEventListener(agent)));
|
|
7950
|
-
this._eventRemovers.push(agent.subscribe((message) => {
|
|
7951
|
-
if (message.type === "playcontrol") switch (message.data.kind) {
|
|
7952
|
-
case "play":
|
|
7953
|
-
this._eventbus.broadcast("timeline-play-request", []);
|
|
7954
|
-
break;
|
|
7955
|
-
case "stop":
|
|
7956
|
-
this._eventbus.broadcast("timeline-stop-request", []);
|
|
7957
|
-
break;
|
|
7958
|
-
case "pause":
|
|
7959
|
-
this._eventbus.broadcast("timeline-pause-request", []);
|
|
7960
|
-
break;
|
|
7961
|
-
case "seek":
|
|
7962
|
-
this._eventbus.broadcast("timeline-seek-request", [message.data.args ?? 0]);
|
|
7963
|
-
break;
|
|
7964
|
-
}
|
|
7965
|
-
}));
|
|
7966
|
-
Diagnostics.send = (name, messageData) => {
|
|
7967
|
-
const message = prepareValueForSerialization(messageData);
|
|
7968
|
-
try {
|
|
7969
|
-
agent.postMessage(name, message);
|
|
7970
|
-
} catch (e) {
|
|
7971
|
-
console.error("postmessage failed");
|
|
7972
|
-
console.error(e);
|
|
7973
|
-
console.log("message", message);
|
|
7974
|
-
}
|
|
7975
|
-
};
|
|
7976
|
-
Diagnostics.send("eligius-diagnostics-factory", "Diagnostics initialized");
|
|
7977
|
-
} else console.warn(`${DEV_TOOLS_KEY} property not found on window, please install the Eligius Devtools extension.`);
|
|
7978
|
-
}
|
|
7979
|
-
destroy() {
|
|
7980
|
-
this._eventRemovers.forEach((x) => x());
|
|
7981
|
-
}
|
|
7982
|
-
_resizeHandler() {
|
|
7983
|
-
if (this._resizeTimeout) {
|
|
7984
|
-
clearTimeout(this._resizeTimeout);
|
|
7985
|
-
this._resizeTimeout = -1;
|
|
7986
|
-
}
|
|
7987
|
-
this._resizeTimeout = setTimeout(() => {
|
|
7988
|
-
this._eventbus.broadcast("timeline-resize", []);
|
|
7989
|
-
}, 200);
|
|
7990
|
-
}
|
|
7991
|
-
_importSystemEntryWithEventbusDependency(systemName) {
|
|
7992
|
-
return new (this._importSystemEntry(systemName))(this._eventbus);
|
|
7993
|
-
}
|
|
7994
|
-
_importSystemEntry(systemName) {
|
|
7995
|
-
return this._importer.import(systemName)[systemName];
|
|
7996
|
-
}
|
|
7997
|
-
_requestInstanceHandler(systemName, resultCallback) {
|
|
7998
|
-
resultCallback(this._importSystemEntryWithEventbusDependency(systemName));
|
|
7999
|
-
}
|
|
8000
|
-
_requestFunctionHandler(systemName, resultCallback) {
|
|
8001
|
-
resultCallback(this._importSystemEntry(systemName));
|
|
8002
|
-
}
|
|
8003
|
-
_requestActionHandler(systemName, resultCallback) {
|
|
8004
|
-
const action = this._actionsLookup[systemName];
|
|
8005
|
-
if (action) resultCallback(action);
|
|
8006
|
-
else {
|
|
8007
|
-
console.error(`Unknown action: ${systemName}`);
|
|
8008
|
-
resultCallback(null);
|
|
8009
|
-
}
|
|
8010
|
-
}
|
|
8011
|
-
createEngine(configuration, resolver) {
|
|
8012
|
-
const { systemName } = configuration.engine;
|
|
8013
|
-
const EngineClass = this._importSystemEntry(systemName);
|
|
8014
|
-
let actionRegistryListener;
|
|
8015
|
-
if (configuration.eventActions?.length) {
|
|
8016
|
-
actionRegistryListener = new ActionRegistryEventbusListener();
|
|
8017
|
-
this._eventRemovers.push(this._eventbus.registerEventlistener(actionRegistryListener));
|
|
8018
|
-
}
|
|
8019
|
-
this._eventRemovers.push(this._eventbus.registerInterceptor("request-timeline-uri", new RequestVideoUriInterceptor(this._eventbus)));
|
|
8020
|
-
resolver = resolver || new ConfigurationResolver(this._importer, this._eventbus);
|
|
8021
|
-
const [actionLookup, resolvedConfiguration] = resolver.process(configuration, actionRegistryListener);
|
|
8022
|
-
this._actionsLookup = actionLookup;
|
|
8023
|
-
const timelineProviders = this._createTimelineProviders(resolvedConfiguration);
|
|
8024
|
-
const { language, labels } = configuration;
|
|
8025
|
-
const languageManager = new LanguageManager(language, labels, this._eventbus);
|
|
8026
|
-
return new EngineClass(resolvedConfiguration, this._eventbus, timelineProviders, languageManager);
|
|
8027
|
-
}
|
|
8028
|
-
_createTimelineProviders(configuration) {
|
|
8029
|
-
const { timelineProviderSettings } = configuration;
|
|
8030
|
-
return Object.entries(timelineProviderSettings).reduce((acc, [timelineType, settings]) => {
|
|
8031
|
-
if (!settings) return acc;
|
|
8032
|
-
const TimelineProviderClass = this._importSystemEntry(settings.systemName);
|
|
8033
|
-
acc[timelineType] = {
|
|
8034
|
-
id: settings.id,
|
|
8035
|
-
vendor: settings.vendor,
|
|
8036
|
-
provider: new TimelineProviderClass(configuration)
|
|
8037
|
-
};
|
|
8038
|
-
return acc;
|
|
8039
|
-
}, {});
|
|
8040
|
-
}
|
|
8041
|
-
};
|
|
8042
|
-
|
|
8043
|
-
//#endregion
|
|
8044
|
-
//#region src/eventbus/events/metadata/before-request-timeline-uri.ts
|
|
8045
|
-
function beforeRequestTimelineUri() {
|
|
8046
|
-
return {
|
|
8047
|
-
description: `Event: before-request-timeline-uri`,
|
|
8048
|
-
category: `Timeline`,
|
|
8049
|
-
args: []
|
|
8050
|
-
};
|
|
8051
|
-
}
|
|
8052
|
-
|
|
8053
|
-
//#endregion
|
|
8054
|
-
//#region src/eventbus/events/metadata/before-request-video-url.ts
|
|
8055
|
-
function beforeRequestVideoUrl() {
|
|
8056
|
-
return {
|
|
8057
|
-
description: `Event: before-request-video-url`,
|
|
8058
|
-
category: `Navigation`,
|
|
8059
|
-
args: [
|
|
8060
|
-
{
|
|
8061
|
-
name: "index",
|
|
8062
|
-
type: "number"
|
|
8063
|
-
},
|
|
8064
|
-
{
|
|
8065
|
-
name: "requestedVideoPosition",
|
|
8066
|
-
type: "number"
|
|
8067
|
-
},
|
|
8068
|
-
{
|
|
8069
|
-
name: "isHistoryRequest",
|
|
8070
|
-
type: "boolean"
|
|
8071
|
-
}
|
|
8072
|
-
]
|
|
8073
|
-
};
|
|
8074
|
-
}
|
|
8075
|
-
|
|
8076
|
-
//#endregion
|
|
8077
|
-
//#region src/eventbus/events/metadata/dom-mutation.ts
|
|
8078
|
-
function domMutation() {
|
|
8079
|
-
return {
|
|
8080
|
-
description: `Event: dom-mutation`,
|
|
8081
|
-
category: `Controller`,
|
|
8082
|
-
args: [{
|
|
8083
|
-
name: "payload",
|
|
8084
|
-
type: "any"
|
|
8085
|
-
}]
|
|
8086
|
-
};
|
|
8087
|
-
}
|
|
8088
|
-
|
|
8089
|
-
//#endregion
|
|
8090
|
-
//#region src/eventbus/events/metadata/highlight-navigation.ts
|
|
8091
|
-
function highlightNavigation() {
|
|
8092
|
-
return {
|
|
8093
|
-
description: `Event: highlight-navigation`,
|
|
8094
|
-
category: `Navigation`,
|
|
8095
|
-
args: [{
|
|
8096
|
-
name: "videoUrlIndex",
|
|
8097
|
-
type: "number"
|
|
8098
|
-
}]
|
|
8099
|
-
};
|
|
8100
|
-
}
|
|
8101
|
-
|
|
8102
|
-
//#endregion
|
|
8103
|
-
//#region src/eventbus/events/metadata/language-change.ts
|
|
8104
|
-
function languageChange() {
|
|
8105
|
-
return {
|
|
8106
|
-
description: `Event: language-change`,
|
|
8107
|
-
category: `Language Manager`,
|
|
8108
|
-
args: [{
|
|
8109
|
-
name: "language",
|
|
8110
|
-
type: "TLanguageCode"
|
|
8111
|
-
}]
|
|
8112
|
-
};
|
|
8113
|
-
}
|
|
8114
|
-
|
|
8115
|
-
//#endregion
|
|
8116
|
-
//#region src/eventbus/events/metadata/navigate-to-video-url.ts
|
|
8117
|
-
function navigateToVideoUrl() {
|
|
8118
|
-
return {
|
|
8119
|
-
description: `Event: navigate-to-video-url`,
|
|
8120
|
-
category: `Navigation`,
|
|
8121
|
-
args: [{
|
|
8122
|
-
name: "index",
|
|
8123
|
-
type: "number"
|
|
8124
|
-
}, {
|
|
8125
|
-
name: "requestedVideoPosition",
|
|
8126
|
-
type: "number"
|
|
8127
|
-
}]
|
|
8128
|
-
};
|
|
8129
|
-
}
|
|
8130
|
-
|
|
8131
|
-
//#endregion
|
|
8132
|
-
//#region src/eventbus/events/metadata/push-history-state.ts
|
|
8133
|
-
function pushHistoryState() {
|
|
8134
|
-
return {
|
|
8135
|
-
description: `Event: push-history-state`,
|
|
8136
|
-
category: `Navigation`,
|
|
8137
|
-
args: [{
|
|
8138
|
-
name: "state",
|
|
8139
|
-
type: "any"
|
|
8140
|
-
}]
|
|
8141
|
-
};
|
|
8142
|
-
}
|
|
8143
|
-
|
|
8144
|
-
//#endregion
|
|
8145
|
-
//#region src/eventbus/events/metadata/request-action.ts
|
|
8146
|
-
function requestAction$1() {
|
|
8147
|
-
return {
|
|
8148
|
-
description: `Event: request-action`,
|
|
8149
|
-
category: `Engine Request`,
|
|
8150
|
-
args: [{
|
|
8151
|
-
name: "actionName",
|
|
8152
|
-
type: "string"
|
|
8153
|
-
}, {
|
|
8154
|
-
name: "callback",
|
|
8155
|
-
type: "(actionInstance: any) => void"
|
|
8156
|
-
}]
|
|
8157
|
-
};
|
|
8158
|
-
}
|
|
7553
|
+
//#region src/eventbus/events/metadata/request-action.ts
|
|
7554
|
+
function requestAction$1() {
|
|
7555
|
+
return {
|
|
7556
|
+
description: `Event: request-action`,
|
|
7557
|
+
category: `Engine Request`,
|
|
7558
|
+
args: [{
|
|
7559
|
+
name: "actionName",
|
|
7560
|
+
type: "string"
|
|
7561
|
+
}, {
|
|
7562
|
+
name: "callback",
|
|
7563
|
+
type: "(actionInstance: any) => void"
|
|
7564
|
+
}]
|
|
7565
|
+
};
|
|
7566
|
+
}
|
|
8159
7567
|
|
|
8160
7568
|
//#endregion
|
|
8161
7569
|
//#region src/eventbus/events/metadata/request-current-language.ts
|
|
@@ -8644,6 +8052,442 @@ var metadata_exports$1 = /* @__PURE__ */ __export({
|
|
|
8644
8052
|
videoComplete: () => videoComplete
|
|
8645
8053
|
});
|
|
8646
8054
|
|
|
8055
|
+
//#endregion
|
|
8056
|
+
//#region src/eventbus/actionregistry-eventbus-listener.ts
|
|
8057
|
+
/**
|
|
8058
|
+
* The `IEventbusListener` first registers a number of actions that are then
|
|
8059
|
+
* executed when the specified event is broadcast.
|
|
8060
|
+
*/
|
|
8061
|
+
var ActionRegistryEventbusListener = class {
|
|
8062
|
+
_actionRegistry = /* @__PURE__ */ new Map();
|
|
8063
|
+
registerAction(action, eventName, eventTopic) {
|
|
8064
|
+
if (eventTopic?.length) eventName = `${eventName}:${eventTopic}`;
|
|
8065
|
+
if (!this._actionRegistry.has(eventName)) this._actionRegistry.set(eventName, []);
|
|
8066
|
+
this._actionRegistry.get(eventName)?.push(action);
|
|
8067
|
+
}
|
|
8068
|
+
handleEvent(eventName, eventTopic, args) {
|
|
8069
|
+
if (eventTopic) eventName = `${eventName}:${eventTopic}`;
|
|
8070
|
+
const actions = this._actionRegistry.get(eventName);
|
|
8071
|
+
if (actions) {
|
|
8072
|
+
const operationData = { eventArgs: args };
|
|
8073
|
+
actions.forEach((action) => {
|
|
8074
|
+
action.start(operationData);
|
|
8075
|
+
});
|
|
8076
|
+
}
|
|
8077
|
+
}
|
|
8078
|
+
};
|
|
8079
|
+
|
|
8080
|
+
//#endregion
|
|
8081
|
+
//#region src/eventbus/eventbus.ts
|
|
8082
|
+
var Eventbus = class {
|
|
8083
|
+
eventHandlers = /* @__PURE__ */ new Map();
|
|
8084
|
+
eventInterceptors = /* @__PURE__ */ new Map();
|
|
8085
|
+
eventListeners = [];
|
|
8086
|
+
constructor() {
|
|
8087
|
+
this.clear();
|
|
8088
|
+
}
|
|
8089
|
+
clear() {
|
|
8090
|
+
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
8091
|
+
this.eventListeners = [];
|
|
8092
|
+
this.eventInterceptors = /* @__PURE__ */ new Map();
|
|
8093
|
+
}
|
|
8094
|
+
_getEventInterceptors(eventName, eventTopic) {
|
|
8095
|
+
if (eventTopic) eventName = `${eventName}:${eventTopic}`;
|
|
8096
|
+
if (!this.eventInterceptors.has(eventName)) this.eventInterceptors.set(eventName, []);
|
|
8097
|
+
return this.eventInterceptors.get(eventName);
|
|
8098
|
+
}
|
|
8099
|
+
_getEventHandlers(eventName, eventTopic) {
|
|
8100
|
+
if (eventTopic) eventName = `${eventName}:${eventTopic}`;
|
|
8101
|
+
if (!this.eventHandlers.has(eventName)) this.eventHandlers.set(eventName, []);
|
|
8102
|
+
return this.eventHandlers.get(eventName);
|
|
8103
|
+
}
|
|
8104
|
+
on(eventName, eventHandler, eventTopic) {
|
|
8105
|
+
this._getEventHandlers(eventName, eventTopic).push(eventHandler);
|
|
8106
|
+
return () => {
|
|
8107
|
+
this.off(eventName, eventHandler, eventTopic);
|
|
8108
|
+
};
|
|
8109
|
+
}
|
|
8110
|
+
once(eventName, eventHandler, eventTopic) {
|
|
8111
|
+
const eventHandlerDecorator = (...args) => {
|
|
8112
|
+
eventHandler(...args);
|
|
8113
|
+
this.off(eventName, eventHandlerDecorator, eventTopic);
|
|
8114
|
+
};
|
|
8115
|
+
this.on(eventName, eventHandlerDecorator, eventTopic);
|
|
8116
|
+
return () => {
|
|
8117
|
+
this.off(eventName, eventHandlerDecorator, eventTopic);
|
|
8118
|
+
};
|
|
8119
|
+
}
|
|
8120
|
+
off(eventName, eventHandler, eventTopic) {
|
|
8121
|
+
const handlers = this._getEventHandlers(eventName, eventTopic);
|
|
8122
|
+
if (handlers) {
|
|
8123
|
+
const idx = handlers.indexOf(eventHandler);
|
|
8124
|
+
if (idx > -1) handlers.splice(idx, 1);
|
|
8125
|
+
}
|
|
8126
|
+
}
|
|
8127
|
+
broadcast(eventName, args) {
|
|
8128
|
+
this._callHandlers(eventName, void 0, args);
|
|
8129
|
+
}
|
|
8130
|
+
broadcastForTopic(eventName, eventTopic, args) {
|
|
8131
|
+
this._callHandlers(eventName, eventTopic, args);
|
|
8132
|
+
}
|
|
8133
|
+
registerEventlistener(eventbusListener) {
|
|
8134
|
+
this.eventListeners.push(eventbusListener);
|
|
8135
|
+
return () => {
|
|
8136
|
+
const index = this.eventListeners.indexOf(eventbusListener);
|
|
8137
|
+
if (index > -1) this.eventListeners.splice(index, 1);
|
|
8138
|
+
};
|
|
8139
|
+
}
|
|
8140
|
+
registerInterceptor(eventName, interceptor, eventTopic) {
|
|
8141
|
+
const interceptors = this._getEventInterceptors(eventName, eventTopic);
|
|
8142
|
+
interceptors.push(interceptor);
|
|
8143
|
+
return () => {
|
|
8144
|
+
const index = interceptors.indexOf(interceptor);
|
|
8145
|
+
if (index > -1) interceptors.splice(index, 1);
|
|
8146
|
+
};
|
|
8147
|
+
}
|
|
8148
|
+
_callHandlers(eventName, eventTopic, args = []) {
|
|
8149
|
+
const handlers = this._getEventHandlers(eventName, eventTopic);
|
|
8150
|
+
if (handlers) {
|
|
8151
|
+
this._getEventInterceptors(eventName, eventTopic).forEach((interceptor) => {
|
|
8152
|
+
args = interceptor.intercept(args);
|
|
8153
|
+
});
|
|
8154
|
+
this.eventListeners.forEach((listener) => {
|
|
8155
|
+
listener.handleEvent(eventName, eventTopic, args);
|
|
8156
|
+
});
|
|
8157
|
+
if (args?.length) handlers.forEach((handler) => handler(...args));
|
|
8158
|
+
else handlers.forEach((handler) => handler());
|
|
8159
|
+
}
|
|
8160
|
+
}
|
|
8161
|
+
};
|
|
8162
|
+
|
|
8163
|
+
//#endregion
|
|
8164
|
+
//#region src/eventbus/request-video-uri-interceptor.ts
|
|
8165
|
+
var RequestVideoUriInterceptor = class {
|
|
8166
|
+
constructor(eventbus$1) {
|
|
8167
|
+
this.eventbus = eventbus$1;
|
|
8168
|
+
}
|
|
8169
|
+
intercept(args) {
|
|
8170
|
+
this.eventbus.broadcast("before-request-timeline-uri", args.slice());
|
|
8171
|
+
return args;
|
|
8172
|
+
}
|
|
8173
|
+
};
|
|
8174
|
+
|
|
8175
|
+
//#endregion
|
|
8176
|
+
//#region src/eventbus/index.ts
|
|
8177
|
+
var eventbus_exports = /* @__PURE__ */ __export({
|
|
8178
|
+
ActionRegistryEventbusListener: () => ActionRegistryEventbusListener,
|
|
8179
|
+
Eventbus: () => Eventbus,
|
|
8180
|
+
RequestVideoUriInterceptor: () => RequestVideoUriInterceptor
|
|
8181
|
+
});
|
|
8182
|
+
|
|
8183
|
+
//#endregion
|
|
8184
|
+
//#region src/eligius-engine.ts
|
|
8185
|
+
/**
|
|
8186
|
+
* This is where the magic happens. The engine is responsible for starting and stopping
|
|
8187
|
+
* the given timeline provider and triggering the actions associated with the positions along the timeline.
|
|
8188
|
+
*/
|
|
8189
|
+
var EligiusEngine = class EligiusEngine {
|
|
8190
|
+
_timeLineActionsLookup = {};
|
|
8191
|
+
_timelineLookupCache = /* @__PURE__ */ new Map();
|
|
8192
|
+
_eventbusRemovers = [];
|
|
8193
|
+
_currentTimelineUri = "";
|
|
8194
|
+
_activeTimelineProvider = void 0;
|
|
8195
|
+
_lastPosition = -1;
|
|
8196
|
+
constructor(configuration, eventbus$1, timelineProviders, languageManager) {
|
|
8197
|
+
this.configuration = configuration;
|
|
8198
|
+
this.eventbus = eventbus$1;
|
|
8199
|
+
this.timelineProviders = timelineProviders;
|
|
8200
|
+
this.languageManager = languageManager;
|
|
8201
|
+
}
|
|
8202
|
+
/**
|
|
8203
|
+
* Initializes the engine by creating the HTML layout and the first time line
|
|
8204
|
+
* by executing its initActions.
|
|
8205
|
+
*/
|
|
8206
|
+
init() {
|
|
8207
|
+
this._createLayoutTemplate();
|
|
8208
|
+
this._addEventbusListeners();
|
|
8209
|
+
const { timelines } = this.configuration;
|
|
8210
|
+
this._currentTimelineUri = timelines?.[0].uri ?? "";
|
|
8211
|
+
this._createTimelineLookup();
|
|
8212
|
+
return this._initializeTimelineProvider();
|
|
8213
|
+
}
|
|
8214
|
+
_createLayoutTemplate() {
|
|
8215
|
+
const { containerSelector } = this.configuration;
|
|
8216
|
+
const container = $(containerSelector);
|
|
8217
|
+
if (!container || !container.length) throw new Error(`Container selector not found: ${containerSelector}`);
|
|
8218
|
+
const { layoutTemplate } = this.configuration;
|
|
8219
|
+
if (layoutTemplate?.length) container.html(layoutTemplate);
|
|
8220
|
+
else console.warn("layoutTemplate is empty, unable to create layout");
|
|
8221
|
+
}
|
|
8222
|
+
async _initializeTimelineProvider() {
|
|
8223
|
+
if (!this.configuration.timelines?.length) throw new Error("No timelines present");
|
|
8224
|
+
const firstTimeline = this.configuration.timelines[0];
|
|
8225
|
+
const providerSettings = this.timelineProviders[firstTimeline.type];
|
|
8226
|
+
if (!providerSettings) throw new Error(`No timeline provider configured for type ${firstTimeline.type}`);
|
|
8227
|
+
this._activeTimelineProvider?.destroy();
|
|
8228
|
+
this._activeTimelineProvider = providerSettings.provider;
|
|
8229
|
+
if (!this._activeTimelineProvider) throw new Error("NO ACTIVE TIMELINE PROVIDER");
|
|
8230
|
+
this._activeTimelineProvider.onTime(this._onTimeHandler.bind(this, Math.floor));
|
|
8231
|
+
this._activeTimelineProvider.onComplete(this._onCompleteCallback.bind(this));
|
|
8232
|
+
this._activeTimelineProvider.onFirstFrame(this._onFirstFrameCallback.bind(this));
|
|
8233
|
+
this._activeTimelineProvider.onRestart(this._onRestartCallback.bind(this));
|
|
8234
|
+
await this._activeTimelineProvider.init();
|
|
8235
|
+
await this._executeActions(this.configuration.initActions, "start");
|
|
8236
|
+
return this._activeTimelineProvider;
|
|
8237
|
+
}
|
|
8238
|
+
_onCompleteCallback() {
|
|
8239
|
+
this.eventbus.broadcast("timeline-complete", []);
|
|
8240
|
+
}
|
|
8241
|
+
_onFirstFrameCallback() {
|
|
8242
|
+
this.eventbus.broadcast("timeline-firstframe", []);
|
|
8243
|
+
this.eventbus.broadcast("timeline-duration", [this._activeTimelineProvider?.getDuration]);
|
|
8244
|
+
}
|
|
8245
|
+
_onRestartCallback() {
|
|
8246
|
+
this.eventbus.broadcast("timeline-restart", []);
|
|
8247
|
+
}
|
|
8248
|
+
async _cleanUp() {
|
|
8249
|
+
await this._cleanUpTimeline();
|
|
8250
|
+
await this._executeActions([...this.configuration.initActions].reverse(), "end");
|
|
8251
|
+
}
|
|
8252
|
+
/**
|
|
8253
|
+
* Cleans up all the necessary parts that the engine initialized.
|
|
8254
|
+
* - It ends the currently active operations and the init actions.
|
|
8255
|
+
* - It removes all its eventbus listeners, handlers and interceptors.
|
|
8256
|
+
* - It destroys all of its timeline providers
|
|
8257
|
+
* - It empties the HTML element indicated by the containerSelector configuration property.
|
|
8258
|
+
*
|
|
8259
|
+
*/
|
|
8260
|
+
async destroy() {
|
|
8261
|
+
await this._cleanUp();
|
|
8262
|
+
this.languageManager.destroy();
|
|
8263
|
+
this._activeTimelineProvider = void 0;
|
|
8264
|
+
this._eventbusRemovers.forEach((remover) => remover());
|
|
8265
|
+
if (this.timelineProviders) Object.values(this.timelineProviders).forEach((providerInfo) => providerInfo.provider.destroy());
|
|
8266
|
+
const { containerSelector } = this.configuration;
|
|
8267
|
+
$(containerSelector).empty();
|
|
8268
|
+
}
|
|
8269
|
+
_addEventListener(eventName, eventHandler, eventTopic) {
|
|
8270
|
+
this._eventbusRemovers.push(this.eventbus.on(eventName, eventHandler, eventTopic));
|
|
8271
|
+
}
|
|
8272
|
+
_addEventbusListeners() {
|
|
8273
|
+
this._addEventListener("request-engine-root", this._handleRequestEngineRoot.bind(this, this.configuration.containerSelector));
|
|
8274
|
+
this._addEventListener("request-timeline-uri", this._handleRequestTimelineUri.bind(this));
|
|
8275
|
+
this._addEventListener("request-current-timeline-position", this._handleRequestTimelinePosition.bind(this, Math.floor));
|
|
8276
|
+
this._addEventListener("request-timeline-cleanup", this._handleTimelineComplete.bind(this));
|
|
8277
|
+
this._addEventListener("timeline-request-current-timeline", this._requestCurrentTimeline.bind(this));
|
|
8278
|
+
this._addEventListener("timeline-play-toggle-request", this._toggleplay.bind(this));
|
|
8279
|
+
this._addEventListener("timeline-play-request", this._playRequest.bind(this));
|
|
8280
|
+
this._addEventListener("timeline-stop-request", this._stopRequest.bind(this));
|
|
8281
|
+
this._addEventListener("timeline-pause-request", this._pauseRequest.bind(this));
|
|
8282
|
+
this._addEventListener("timeline-container-request", this.containerRequest.bind(this));
|
|
8283
|
+
this._addEventListener("timeline-duration-request", this.durationRequest.bind(this));
|
|
8284
|
+
this._addEventListener("timeline-seek-request", this.seekRequest.bind(this));
|
|
8285
|
+
}
|
|
8286
|
+
async seekRequest(position) {
|
|
8287
|
+
if (!this._activeTimelineProvider) return;
|
|
8288
|
+
const seekPosition = Math.floor(position);
|
|
8289
|
+
const duration = this._activeTimelineProvider.getDuration();
|
|
8290
|
+
const currentPosition = this._activeTimelineProvider.getPosition();
|
|
8291
|
+
if (seekPosition < 0 || seekPosition > duration) return;
|
|
8292
|
+
this.eventbus.broadcast("timeline-seek", [
|
|
8293
|
+
seekPosition,
|
|
8294
|
+
currentPosition,
|
|
8295
|
+
duration
|
|
8296
|
+
]);
|
|
8297
|
+
await this._activeTimelineProvider.seek(seekPosition);
|
|
8298
|
+
await this._executeSeekActions(seekPosition);
|
|
8299
|
+
this.eventbus.broadcast("timeline-seeked", [this._activeTimelineProvider.getPosition(), duration]);
|
|
8300
|
+
this.eventbus.broadcast("timeline-time", [this._activeTimelineProvider.getPosition()]);
|
|
8301
|
+
if (this._activeTimelineProvider?.playState === "running") this._activeTimelineProvider?.start();
|
|
8302
|
+
}
|
|
8303
|
+
durationRequest(callBack) {
|
|
8304
|
+
callBack(this._activeTimelineProvider?.getDuration());
|
|
8305
|
+
}
|
|
8306
|
+
containerRequest(callBack) {
|
|
8307
|
+
callBack(this._activeTimelineProvider?.getContainer());
|
|
8308
|
+
}
|
|
8309
|
+
_pauseRequest() {
|
|
8310
|
+
if (!this._activeTimelineProvider) return;
|
|
8311
|
+
this._activeTimelineProvider.pause();
|
|
8312
|
+
this.eventbus.broadcast("timeline-pause", []);
|
|
8313
|
+
}
|
|
8314
|
+
_stopRequest() {
|
|
8315
|
+
if (!this._activeTimelineProvider) return;
|
|
8316
|
+
this._activeTimelineProvider.stop();
|
|
8317
|
+
this.eventbus.broadcast("timeline-stop", []);
|
|
8318
|
+
}
|
|
8319
|
+
_playRequest() {
|
|
8320
|
+
if (!this._activeTimelineProvider) return;
|
|
8321
|
+
this._activeTimelineProvider.start();
|
|
8322
|
+
this.eventbus.broadcast("timeline-play", []);
|
|
8323
|
+
}
|
|
8324
|
+
_toggleplay() {
|
|
8325
|
+
if (!this._activeTimelineProvider) return;
|
|
8326
|
+
if (this._activeTimelineProvider.playState === "running") this._activeTimelineProvider.pause();
|
|
8327
|
+
else this._activeTimelineProvider.start();
|
|
8328
|
+
}
|
|
8329
|
+
_createTimelineLookup() {
|
|
8330
|
+
if (!this.configuration.timelines) return;
|
|
8331
|
+
this.configuration.timelines.forEach((timelineInfo) => {
|
|
8332
|
+
this._timelineLookupCache.set(timelineInfo.uri, timelineInfo);
|
|
8333
|
+
timelineInfo.timelineActions.forEach((timelineAction) => {
|
|
8334
|
+
this._addTimelineActionStart(timelineInfo.uri, timelineAction);
|
|
8335
|
+
this._addTimelineActionEnd(timelineInfo.uri, timelineAction);
|
|
8336
|
+
});
|
|
8337
|
+
});
|
|
8338
|
+
EligiusEngine.sortTimelines(Object.values(this._timeLineActionsLookup));
|
|
8339
|
+
}
|
|
8340
|
+
static sortTimelines(timelines) {
|
|
8341
|
+
timelines.forEach((timelineActions) => {
|
|
8342
|
+
Object.keys(timelineActions).forEach((key) => {
|
|
8343
|
+
const numericKey = Number(key);
|
|
8344
|
+
timelineActions[numericKey] = EligiusEngine.sortActionsPerPosition(timelineActions[numericKey]);
|
|
8345
|
+
});
|
|
8346
|
+
});
|
|
8347
|
+
}
|
|
8348
|
+
static sortActionsPerPosition(actions) {
|
|
8349
|
+
const [startMethods, endMethods] = actions.reduce((acc, item) => {
|
|
8350
|
+
if (item.isStart) acc[0].push(item);
|
|
8351
|
+
else acc[1].push(item);
|
|
8352
|
+
return acc;
|
|
8353
|
+
}, [[], []]);
|
|
8354
|
+
return [...endMethods.sort(sortActionMethodsHighestStartPositionFirst), ...startMethods];
|
|
8355
|
+
}
|
|
8356
|
+
_addTimelineActionStart(uri, timeLineAction) {
|
|
8357
|
+
const startPosition = timeLineAction.duration.start;
|
|
8358
|
+
const timelineStartPositions = this._initializeTimelinePosition(this._initializeUriLookup(this._timeLineActionsLookup, uri), startPosition);
|
|
8359
|
+
const startMethod = timeLineAction.start.bind(timeLineAction);
|
|
8360
|
+
if (timeLineAction.id?.length) startMethod.id = timeLineAction.id;
|
|
8361
|
+
startMethod.isStart = true;
|
|
8362
|
+
timelineStartPositions.push(startMethod);
|
|
8363
|
+
}
|
|
8364
|
+
_addTimelineActionEnd(uri, timeLineAction) {
|
|
8365
|
+
let end = timeLineAction.duration.end;
|
|
8366
|
+
if (end < 0) end = timeLineAction.duration.end = Infinity;
|
|
8367
|
+
if (Number.isFinite(end)) {
|
|
8368
|
+
const timelineEndPositions = this._initializeTimelinePosition(this._timeLineActionsLookup[uri], end);
|
|
8369
|
+
const endMethod = timeLineAction.end.bind(timeLineAction);
|
|
8370
|
+
if (timeLineAction.id?.length) {
|
|
8371
|
+
endMethod.id = timeLineAction.id;
|
|
8372
|
+
endMethod.startPosition = timeLineAction.duration.start;
|
|
8373
|
+
}
|
|
8374
|
+
endMethod.isStart = false;
|
|
8375
|
+
timelineEndPositions.push(endMethod);
|
|
8376
|
+
}
|
|
8377
|
+
}
|
|
8378
|
+
_initializeUriLookup(lookup, uri) {
|
|
8379
|
+
if (!lookup[uri]) lookup[uri] = {};
|
|
8380
|
+
return lookup[uri];
|
|
8381
|
+
}
|
|
8382
|
+
_initializeTimelinePosition(lookup, position) {
|
|
8383
|
+
if (!lookup[position]) lookup[position] = [];
|
|
8384
|
+
return lookup[position];
|
|
8385
|
+
}
|
|
8386
|
+
async _executeActions(actions, methodName) {
|
|
8387
|
+
if (actions.length === 0) return;
|
|
8388
|
+
for (const action of actions) await action[methodName]();
|
|
8389
|
+
}
|
|
8390
|
+
_handleRequestEngineRoot(engineRootSelector, resultCallback) {
|
|
8391
|
+
resultCallback($(engineRootSelector));
|
|
8392
|
+
}
|
|
8393
|
+
async _handleRequestTimelineUri(uri, position = 0) {
|
|
8394
|
+
if (!this._activeTimelineProvider) return;
|
|
8395
|
+
this._activeTimelineProvider.stop();
|
|
8396
|
+
await this._cleanUpTimeline();
|
|
8397
|
+
const timelineConfig = this._timelineLookupCache.get(uri);
|
|
8398
|
+
if (!timelineConfig || !this._activeTimelineProvider || this._currentTimelineUri === timelineConfig.uri) return;
|
|
8399
|
+
this._currentTimelineUri = timelineConfig.uri;
|
|
8400
|
+
this.eventbus.broadcast("timeline-current-timeline-change", [this._currentTimelineUri]);
|
|
8401
|
+
const newProviderSettings = this.timelineProviders[timelineConfig.type];
|
|
8402
|
+
if (this._activeTimelineProvider !== newProviderSettings.provider) {
|
|
8403
|
+
this._activeTimelineProvider.destroy();
|
|
8404
|
+
this._activeTimelineProvider = newProviderSettings.provider;
|
|
8405
|
+
}
|
|
8406
|
+
this._activeTimelineProvider.loop = timelineConfig.loop;
|
|
8407
|
+
if (!this._activeTimelineProvider.loop && position > 0) this.eventbus.once("timeline-firstframe", async () => {
|
|
8408
|
+
if (!this._activeTimelineProvider) return;
|
|
8409
|
+
this._activeTimelineProvider.pause();
|
|
8410
|
+
this.eventbus.broadcast("timeline-duration", [this._activeTimelineProvider.getDuration]);
|
|
8411
|
+
await this._executeStartActions();
|
|
8412
|
+
const seekPosition = await this._activeTimelineProvider.seek(position);
|
|
8413
|
+
this.seekRequest(seekPosition);
|
|
8414
|
+
});
|
|
8415
|
+
this._activeTimelineProvider.playlistItem(uri);
|
|
8416
|
+
}
|
|
8417
|
+
_cleanUpTimeline() {
|
|
8418
|
+
return this._executeRelevantActions(this._getActiveActions, "end");
|
|
8419
|
+
}
|
|
8420
|
+
_executeStartActions() {
|
|
8421
|
+
return this._executeRelevantActions(this._getActionsForPosition.bind(this, 0), "start");
|
|
8422
|
+
}
|
|
8423
|
+
/**
|
|
8424
|
+
* Gets all of the inactive actions whose duration falls within the given timeline position.
|
|
8425
|
+
*
|
|
8426
|
+
* @param position the given position
|
|
8427
|
+
* @param actions all of the relevant actions
|
|
8428
|
+
* @returns
|
|
8429
|
+
*/
|
|
8430
|
+
_getActionsForPosition(position, actions) {
|
|
8431
|
+
return actions.filter((action) => !action.active && action.duration.start <= position && action.duration.end >= position);
|
|
8432
|
+
}
|
|
8433
|
+
_getActiveActions(allActions) {
|
|
8434
|
+
return allActions.filter((action) => action.active).sort(sortActionsHighestStartPositionFirst);
|
|
8435
|
+
}
|
|
8436
|
+
_executeRelevantActions(filter, executionType) {
|
|
8437
|
+
const timelineActions = this._getTimelineActionsForCurrentTimeline();
|
|
8438
|
+
const currentActions = filter.apply(this, [timelineActions]);
|
|
8439
|
+
return this._executeActions(currentActions, executionType);
|
|
8440
|
+
}
|
|
8441
|
+
_handleRequestTimelinePosition(floor, resultCallback) {
|
|
8442
|
+
resultCallback(floor(this._activeTimelineProvider?.getPosition() || -1));
|
|
8443
|
+
}
|
|
8444
|
+
_handleTimelineComplete() {
|
|
8445
|
+
this._cleanUpTimeline();
|
|
8446
|
+
}
|
|
8447
|
+
_getTimelineActionsForCurrentTimeline() {
|
|
8448
|
+
return this._getTimelineActionsForUri(this._currentTimelineUri);
|
|
8449
|
+
}
|
|
8450
|
+
_requestCurrentTimeline(resultCallback) {
|
|
8451
|
+
resultCallback(this._currentTimelineUri);
|
|
8452
|
+
}
|
|
8453
|
+
_getTimelineActionsForUri(uri) {
|
|
8454
|
+
return this._timelineLookupCache.get(uri)?.timelineActions ?? [];
|
|
8455
|
+
}
|
|
8456
|
+
_onTimeHandler(floor, position) {
|
|
8457
|
+
if (!Number.isNaN(position)) {
|
|
8458
|
+
const pos = floor(position);
|
|
8459
|
+
if (this._lastPosition !== pos) {
|
|
8460
|
+
this._executeActionsForPosition(pos);
|
|
8461
|
+
this.eventbus.broadcast("timeline-time", [pos]);
|
|
8462
|
+
}
|
|
8463
|
+
}
|
|
8464
|
+
}
|
|
8465
|
+
_executeActionsForPosition(position) {
|
|
8466
|
+
this._lastPosition = position;
|
|
8467
|
+
const actions = this._timeLineActionsLookup[this._currentTimelineUri];
|
|
8468
|
+
if (actions) actions[position]?.forEach((exec) => exec());
|
|
8469
|
+
}
|
|
8470
|
+
async _executeSeekActions(position) {
|
|
8471
|
+
const timelineActions = this._getTimelineActionsForCurrentTimeline();
|
|
8472
|
+
if (!timelineActions) return Promise.resolve();
|
|
8473
|
+
const currentActions = this._getActiveActions(timelineActions).filter((action) => !(action.duration.start <= position && action.duration.end >= position));
|
|
8474
|
+
const newActions = this._getActionsForPosition(position, timelineActions);
|
|
8475
|
+
await this._executeActions(currentActions, "end");
|
|
8476
|
+
return this._executeActions(newActions, "start");
|
|
8477
|
+
}
|
|
8478
|
+
};
|
|
8479
|
+
const sortActionsHighestStartPositionFirst = (a, b) => {
|
|
8480
|
+
if (b.duration.start < a.duration.start) return -1;
|
|
8481
|
+
else if (b.duration.start > a.duration.start) return 1;
|
|
8482
|
+
else return 0;
|
|
8483
|
+
};
|
|
8484
|
+
const sortActionMethodsHighestStartPositionFirst = (a, b) => {
|
|
8485
|
+
if (b.startPosition === void 0 || a.startPosition === void 0) return 0;
|
|
8486
|
+
if (b.startPosition < a.startPosition) return -1;
|
|
8487
|
+
else if (b.startPosition > a.startPosition) return 1;
|
|
8488
|
+
else return 0;
|
|
8489
|
+
};
|
|
8490
|
+
|
|
8647
8491
|
//#endregion
|
|
8648
8492
|
//#region src/importer/eligius-resource-importer.ts
|
|
8649
8493
|
const operations = operation_exports;
|
|
@@ -8670,6 +8514,220 @@ var EligiusResourceImporter = class {
|
|
|
8670
8514
|
}
|
|
8671
8515
|
};
|
|
8672
8516
|
|
|
8517
|
+
//#endregion
|
|
8518
|
+
//#region src/operation/helper/set-global.ts
|
|
8519
|
+
function setGlobal(name, value) {
|
|
8520
|
+
const cache$2 = getGlobals();
|
|
8521
|
+
cache$2[name] = value;
|
|
8522
|
+
}
|
|
8523
|
+
|
|
8524
|
+
//#endregion
|
|
8525
|
+
//#region src/language-manager.ts
|
|
8526
|
+
/**
|
|
8527
|
+
* This class manages the labels for an {@link IEligiusEngine} instance.
|
|
8528
|
+
*
|
|
8529
|
+
* It handles the request-label-collection, request-label-collections, request-current-language and language-change events.
|
|
8530
|
+
*
|
|
8531
|
+
*/
|
|
8532
|
+
var LanguageManager = class {
|
|
8533
|
+
_labelLookup;
|
|
8534
|
+
_eventbusRemovers = [];
|
|
8535
|
+
constructor(_currentLanguage, labels, _eventbus) {
|
|
8536
|
+
this._currentLanguage = _currentLanguage;
|
|
8537
|
+
this._eventbus = _eventbus;
|
|
8538
|
+
if (!_currentLanguage) throw new Error("language ctor arg cannot have zero length");
|
|
8539
|
+
setGlobal("defaultLanguage", _currentLanguage);
|
|
8540
|
+
this._setRootElementLang(_currentLanguage);
|
|
8541
|
+
this._labelLookup = this._createLabelLookup(labels);
|
|
8542
|
+
this._addEventbusListeners(_eventbus);
|
|
8543
|
+
}
|
|
8544
|
+
destroy() {
|
|
8545
|
+
this._eventbusRemovers.forEach((x) => x());
|
|
8546
|
+
}
|
|
8547
|
+
_addEventbusListeners(eventbus$1) {
|
|
8548
|
+
this._eventbusRemovers.push(eventbus$1.on("request-label-collection", this._handleRequestLabelCollection.bind(this)));
|
|
8549
|
+
this._eventbusRemovers.push(eventbus$1.on("request-label-collections", this._handleRequestLabelCollections.bind(this)));
|
|
8550
|
+
this._eventbusRemovers.push(eventbus$1.on("request-current-language", this._handleRequestCurrentLanguage.bind(this)));
|
|
8551
|
+
this._eventbusRemovers.push(eventbus$1.on("language-change", this._handleLanguageChange.bind(this)));
|
|
8552
|
+
}
|
|
8553
|
+
_handleRequestCurrentLanguage(resultCallback) {
|
|
8554
|
+
resultCallback(this._currentLanguage);
|
|
8555
|
+
}
|
|
8556
|
+
_handleRequestLabelCollection(labelId, resultCallback) {
|
|
8557
|
+
resultCallback(this._labelLookup[labelId]);
|
|
8558
|
+
}
|
|
8559
|
+
_handleRequestLabelCollections(labelIds, resultCallback) {
|
|
8560
|
+
resultCallback(labelIds.map((labelId) => {
|
|
8561
|
+
return this._labelLookup[labelId];
|
|
8562
|
+
}));
|
|
8563
|
+
}
|
|
8564
|
+
_handleLanguageChange(language) {
|
|
8565
|
+
this._currentLanguage = language;
|
|
8566
|
+
this._setRootElementLang(this._currentLanguage);
|
|
8567
|
+
}
|
|
8568
|
+
_setRootElementLang(language) {
|
|
8569
|
+
const callBack = (rootSelector) => {
|
|
8570
|
+
const lang = this._extractPrimaryLanguage(language);
|
|
8571
|
+
$(rootSelector).attr("lang", lang);
|
|
8572
|
+
};
|
|
8573
|
+
this._eventbus.broadcast("request-engine-root", [callBack]);
|
|
8574
|
+
}
|
|
8575
|
+
_extractPrimaryLanguage(culture) {
|
|
8576
|
+
return culture.split("-").shift();
|
|
8577
|
+
}
|
|
8578
|
+
_createLabelLookup(labels) {
|
|
8579
|
+
return labels.reduce((acc, label) => {
|
|
8580
|
+
acc[label.id] = label.labels;
|
|
8581
|
+
return acc;
|
|
8582
|
+
}, {});
|
|
8583
|
+
}
|
|
8584
|
+
};
|
|
8585
|
+
|
|
8586
|
+
//#endregion
|
|
8587
|
+
//#region src/engine-factory.ts
|
|
8588
|
+
const hotkeys = hk.default || hk;
|
|
8589
|
+
/**
|
|
8590
|
+
* The EngineFactory is used to create and initialize an {@link IEligiusEngine} instance.
|
|
8591
|
+
*
|
|
8592
|
+
* It prepares a resolved configuration and creates the engine based on the class defined in the configuration.
|
|
8593
|
+
*
|
|
8594
|
+
* @example Loading a configuration and creating an IEligiusEngine instance
|
|
8595
|
+
* ```ts
|
|
8596
|
+
* import { IEngineConfiguration, EngineFactory, WebpackResourceImporter } from 'eligius';
|
|
8597
|
+
* import * as engineConfig from './my-eligius-config.json';
|
|
8598
|
+
*
|
|
8599
|
+
* const factory = new EngineFactory(new WebpackResourceImporter(), window);
|
|
8600
|
+
*
|
|
8601
|
+
* const engine = factory.createEngine((engineConfig as unknown) as IEngineConfiguration);
|
|
8602
|
+
*
|
|
8603
|
+
* engine.init().then(()=> {console.log('Eligius engine ready for business');});
|
|
8604
|
+
* ```
|
|
8605
|
+
*/
|
|
8606
|
+
var EngineFactory = class {
|
|
8607
|
+
_actionsLookup = {};
|
|
8608
|
+
_eventbus;
|
|
8609
|
+
_eventRemovers = [];
|
|
8610
|
+
_importer;
|
|
8611
|
+
_resizeTimeout = -1;
|
|
8612
|
+
constructor(importer, windowRef, options) {
|
|
8613
|
+
this._importer = importer;
|
|
8614
|
+
this._eventbus = options?.eventbus ?? new Eventbus();
|
|
8615
|
+
Diagnostics.active = options?.devtools ?? false;
|
|
8616
|
+
if (Diagnostics.active) this._initializeDevtools(this._eventbus);
|
|
8617
|
+
this._eventRemovers.push(this._eventbus.on("request-instance", this._requestInstanceHandler.bind(this)));
|
|
8618
|
+
this._eventRemovers.push(this._eventbus.on("request-action", this._requestActionHandler.bind(this)));
|
|
8619
|
+
this._eventRemovers.push(this._eventbus.on("request-function", this._requestFunctionHandler.bind(this)));
|
|
8620
|
+
const handleSpaceBound = this._handleSpacePress.bind(this);
|
|
8621
|
+
hotkeys("space", handleSpaceBound);
|
|
8622
|
+
this._eventRemovers.push(() => hotkeys.unbind("space", handleSpaceBound));
|
|
8623
|
+
const resizeBound = this._resizeHandler.bind(this);
|
|
8624
|
+
const jqWin = $(windowRef);
|
|
8625
|
+
jqWin.on("resize", resizeBound);
|
|
8626
|
+
this._eventRemovers.push(() => jqWin.off("resize", resizeBound));
|
|
8627
|
+
}
|
|
8628
|
+
_handleSpacePress(keyboardEvent, _hotkeysEvent) {
|
|
8629
|
+
keyboardEvent.preventDefault();
|
|
8630
|
+
this._eventbus.broadcast("timeline-play-toggle-request", []);
|
|
8631
|
+
return false;
|
|
8632
|
+
}
|
|
8633
|
+
_initializeDevtools(eventbus$1) {
|
|
8634
|
+
const diagnosticInfo = window[DEV_TOOLS_KEY];
|
|
8635
|
+
if (diagnosticInfo) {
|
|
8636
|
+
const { agent } = diagnosticInfo;
|
|
8637
|
+
this._eventRemovers.push(eventbus$1.registerEventlistener(new DevToolEventListener(agent)));
|
|
8638
|
+
this._eventRemovers.push(agent.subscribe((message) => {
|
|
8639
|
+
if (message.type === "playcontrol") switch (message.data.kind) {
|
|
8640
|
+
case "play":
|
|
8641
|
+
this._eventbus.broadcast("timeline-play-request", []);
|
|
8642
|
+
break;
|
|
8643
|
+
case "stop":
|
|
8644
|
+
this._eventbus.broadcast("timeline-stop-request", []);
|
|
8645
|
+
break;
|
|
8646
|
+
case "pause":
|
|
8647
|
+
this._eventbus.broadcast("timeline-pause-request", []);
|
|
8648
|
+
break;
|
|
8649
|
+
case "seek":
|
|
8650
|
+
this._eventbus.broadcast("timeline-seek-request", [message.data.args ?? 0]);
|
|
8651
|
+
break;
|
|
8652
|
+
}
|
|
8653
|
+
}));
|
|
8654
|
+
Diagnostics.send = (name, messageData) => {
|
|
8655
|
+
const message = prepareValueForSerialization(messageData);
|
|
8656
|
+
try {
|
|
8657
|
+
agent.postMessage(name, message);
|
|
8658
|
+
} catch (e) {
|
|
8659
|
+
console.error("postmessage failed");
|
|
8660
|
+
console.error(e);
|
|
8661
|
+
console.log("message", message);
|
|
8662
|
+
}
|
|
8663
|
+
};
|
|
8664
|
+
Diagnostics.send("eligius-diagnostics-factory", "Diagnostics initialized");
|
|
8665
|
+
} else console.warn(`${DEV_TOOLS_KEY} property not found on window, please install the Eligius Devtools extension.`);
|
|
8666
|
+
}
|
|
8667
|
+
destroy() {
|
|
8668
|
+
this._eventRemovers.forEach((x) => x());
|
|
8669
|
+
}
|
|
8670
|
+
_resizeHandler() {
|
|
8671
|
+
if (this._resizeTimeout) {
|
|
8672
|
+
clearTimeout(this._resizeTimeout);
|
|
8673
|
+
this._resizeTimeout = -1;
|
|
8674
|
+
}
|
|
8675
|
+
this._resizeTimeout = setTimeout(() => {
|
|
8676
|
+
this._eventbus.broadcast("timeline-resize", []);
|
|
8677
|
+
}, 200);
|
|
8678
|
+
}
|
|
8679
|
+
_importSystemEntryWithEventbusDependency(systemName) {
|
|
8680
|
+
return new (this._importSystemEntry(systemName))(this._eventbus);
|
|
8681
|
+
}
|
|
8682
|
+
_importSystemEntry(systemName) {
|
|
8683
|
+
return this._importer.import(systemName)[systemName];
|
|
8684
|
+
}
|
|
8685
|
+
_requestInstanceHandler(systemName, resultCallback) {
|
|
8686
|
+
resultCallback(this._importSystemEntryWithEventbusDependency(systemName));
|
|
8687
|
+
}
|
|
8688
|
+
_requestFunctionHandler(systemName, resultCallback) {
|
|
8689
|
+
resultCallback(this._importSystemEntry(systemName));
|
|
8690
|
+
}
|
|
8691
|
+
_requestActionHandler(systemName, resultCallback) {
|
|
8692
|
+
const action = this._actionsLookup[systemName];
|
|
8693
|
+
if (action) resultCallback(action);
|
|
8694
|
+
else {
|
|
8695
|
+
console.error(`Unknown action: ${systemName}`);
|
|
8696
|
+
resultCallback(null);
|
|
8697
|
+
}
|
|
8698
|
+
}
|
|
8699
|
+
createEngine(configuration, resolver) {
|
|
8700
|
+
const { systemName } = configuration.engine;
|
|
8701
|
+
const EngineClass = this._importSystemEntry(systemName);
|
|
8702
|
+
let actionRegistryListener;
|
|
8703
|
+
if (configuration.eventActions?.length) {
|
|
8704
|
+
actionRegistryListener = new ActionRegistryEventbusListener();
|
|
8705
|
+
this._eventRemovers.push(this._eventbus.registerEventlistener(actionRegistryListener));
|
|
8706
|
+
}
|
|
8707
|
+
this._eventRemovers.push(this._eventbus.registerInterceptor("request-timeline-uri", new RequestVideoUriInterceptor(this._eventbus)));
|
|
8708
|
+
resolver = resolver || new ConfigurationResolver(this._importer, this._eventbus);
|
|
8709
|
+
const [actionLookup, resolvedConfiguration] = resolver.process(configuration, actionRegistryListener);
|
|
8710
|
+
this._actionsLookup = actionLookup;
|
|
8711
|
+
const timelineProviders = this._createTimelineProviders(resolvedConfiguration);
|
|
8712
|
+
const { language, labels } = configuration;
|
|
8713
|
+
const languageManager = new LanguageManager(language, labels, this._eventbus);
|
|
8714
|
+
return new EngineClass(resolvedConfiguration, this._eventbus, timelineProviders, languageManager);
|
|
8715
|
+
}
|
|
8716
|
+
_createTimelineProviders(configuration) {
|
|
8717
|
+
const { timelineProviderSettings } = configuration;
|
|
8718
|
+
return Object.entries(timelineProviderSettings).reduce((acc, [timelineType, settings]) => {
|
|
8719
|
+
if (!settings) return acc;
|
|
8720
|
+
const TimelineProviderClass = this._importSystemEntry(settings.systemName);
|
|
8721
|
+
acc[timelineType] = {
|
|
8722
|
+
id: settings.id,
|
|
8723
|
+
vendor: settings.vendor,
|
|
8724
|
+
provider: new TimelineProviderClass(configuration)
|
|
8725
|
+
};
|
|
8726
|
+
return acc;
|
|
8727
|
+
}, {});
|
|
8728
|
+
}
|
|
8729
|
+
};
|
|
8730
|
+
|
|
8673
8731
|
//#endregion
|
|
8674
8732
|
export { Action, ActionCreator, ActionCreatorFactory, ActionEditor, ActionRegistryEventbusListener, ConfigurationFactory, ConfigurationResolver, ControllerNamesProvider, DEV_TOOLS_KEY, DOMEventListenerController, DevToolEventListener, Diagnostics, EligiusEngine, EligiusResourceImporter, EndableAction, EndableActionCreator, EndableActionEditor, EngineFactory, Eventbus, LabelController, LanguageManager, LottieController, MutationObserverController, NavigationController, OperationEditor, OperationMetadataProvider, OperationNamesProvider, ProgressbarController, RequestAnimationFrameTimelineProvider, RequestVideoUriInterceptor, RoutingController, SubtitleEditor, SubtitleImporter, SubtitlesController, TimeLineEventNamesProvider, TimelineAction, TimelineActionCreator, TimelineActionEditor, TimelineProviderSettingsEditor, TimelineProvidersSettingsEditor, VideoJsTimelineProvider, addClass, addControllerToElement, addGlobalsToOperation, animate, animateWithClass, announceToScreenReader, breakForEach, broadcastEvent, calc, clearElement, clearOperationData, clearStorage, compareDate, concatenateStrings, continueForEach, createElement, metadata_exports as ctrlmetadata, customFunction, endAction, endForEach, endWhen, metadata_exports$1 as eventmetadata, extendController, filterArray, findInArray, forEach, formatDate, formatText, getAttributesFromElement, getControllerFromElement, getControllerInstance, getCurrentTime, getElementDimensions, getFocusedElement, getFormData, getImport, getQueryParams, getScrollPosition, getTextContent, httpDelete, httpPost, httpPut, invokeObjectMethod, isActive, isElementInViewport, loadFromStorage, loadJson, log, mapArray, math, metadata_exports$2 as metadata, otherwise, removeClass, removeControllerFromElement, removeElement, removePropertiesFromOperationData, reparentElement, replaceString, replaceText, requestAction, saveToStorage, scrollToElement, scrollToPosition, selectElement, send, setActive, setData, setElementAttributes, setElementContent, setFocus, setFormValue, setGlobalData, setOperationData, setStyle, setVariable, sortArray, splitString, startAction, substringText, toggleClass, toggleElement, toggleFormElement, validateForm, wait, when };
|
|
8675
8733
|
//# sourceMappingURL=index.mjs.map
|