@player-ui/player 0.13.0 → 0.14.0-next.1
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/Player.native.js +213 -239
- package/dist/Player.native.js.map +1 -1
- package/dist/cjs/index.cjs +75 -116
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +75 -116
- package/dist/index.mjs +75 -116
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/binding/__tests__/resolver.test.ts +5 -0
- package/src/binding/resolver.ts +5 -1
- package/src/binding-grammar/__tests__/parser.test.ts +0 -32
- package/src/binding-grammar/__tests__/test-utils/ast-cases.ts +31 -0
- package/src/binding-grammar/ast.ts +2 -2
- package/src/binding-grammar/custom/index.ts +17 -9
- package/src/view/__tests__/view.test.ts +61 -1
- package/src/view/builder/index.ts +6 -1
- package/src/view/parser/index.ts +45 -33
- package/src/view/parser/types.ts +5 -0
- package/src/view/plugins/__tests__/multi-node.test.ts +36 -0
- package/src/view/plugins/multi-node.ts +14 -14
- package/src/view/resolver/__tests__/index.test.ts +153 -0
- package/src/view/resolver/index.ts +109 -157
- package/src/view/view.ts +2 -2
- package/types/binding-grammar/ast.d.ts +2 -2
- package/types/view/builder/index.d.ts +1 -1
- package/types/view/parser/index.d.ts +38 -22
- package/types/view/parser/types.d.ts +4 -0
- package/types/view/resolver/index.d.ts +37 -25
- package/types/view/view.d.ts +1 -1
package/dist/Player.native.js
CHANGED
|
@@ -45,6 +45,10 @@ function _async_to_generator(fn) {
|
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
+
function _call_super(_this, derived, args) {
|
|
49
|
+
derived = _get_prototype_of(derived);
|
|
50
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
51
|
+
}
|
|
48
52
|
function _class_call_check(instance, Constructor) {
|
|
49
53
|
if (!(instance instanceof Constructor)) {
|
|
50
54
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -283,31 +287,15 @@ function _wrap_native_super(Class) {
|
|
|
283
287
|
return _wrap_native_super(Class);
|
|
284
288
|
}
|
|
285
289
|
function _is_native_reflect_construct() {
|
|
286
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
287
|
-
if (Reflect.construct.sham) return false;
|
|
288
|
-
if (typeof Proxy === "function") return true;
|
|
289
290
|
try {
|
|
290
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
return
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
function _create_super(Derived) {
|
|
297
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
298
|
-
return function _createSuperInternal() {
|
|
299
|
-
var Super = _get_prototype_of(Derived), result;
|
|
300
|
-
if (hasNativeReflectConstruct) {
|
|
301
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
302
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
303
|
-
} else {
|
|
304
|
-
result = Super.apply(this, arguments);
|
|
305
|
-
}
|
|
306
|
-
return _possible_constructor_return(this, result);
|
|
307
|
-
};
|
|
291
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
292
|
+
} catch (_) {}
|
|
293
|
+
return (_is_native_reflect_construct = function() {
|
|
294
|
+
return !!result;
|
|
295
|
+
})();
|
|
308
296
|
}
|
|
309
297
|
function _ts_generator(thisArg, body) {
|
|
310
|
-
var f, y, t,
|
|
298
|
+
var f, y, t, _ = {
|
|
311
299
|
label: 0,
|
|
312
300
|
sent: function() {
|
|
313
301
|
if (t[0] & 1) throw t[1];
|
|
@@ -315,12 +303,8 @@ function _ts_generator(thisArg, body) {
|
|
|
315
303
|
},
|
|
316
304
|
trys: [],
|
|
317
305
|
ops: []
|
|
318
|
-
};
|
|
319
|
-
return g = {
|
|
320
|
-
next: verb(0),
|
|
321
|
-
"throw": verb(1),
|
|
322
|
-
"return": verb(2)
|
|
323
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
306
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
307
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
324
308
|
return this;
|
|
325
309
|
}), g;
|
|
326
310
|
function verb(n) {
|
|
@@ -333,7 +317,7 @@ function _ts_generator(thisArg, body) {
|
|
|
333
317
|
}
|
|
334
318
|
function step(op) {
|
|
335
319
|
if (f) throw new TypeError("Generator is already executing.");
|
|
336
|
-
while(_)try {
|
|
320
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
337
321
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
338
322
|
if (y = 0, t) op = [
|
|
339
323
|
op[0] & 2,
|
|
@@ -441,7 +425,7 @@ var Player = function() {
|
|
|
441
425
|
};
|
|
442
426
|
var findInArray = function findInArray(array, key, value) {
|
|
443
427
|
return array.findIndex(function(obj) {
|
|
444
|
-
if (obj && typeof obj === "object") {
|
|
428
|
+
if (obj && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
|
|
445
429
|
return obj[key] == value;
|
|
446
430
|
}
|
|
447
431
|
return false;
|
|
@@ -540,7 +524,7 @@ var Player = function() {
|
|
|
540
524
|
return t2 === r ? l : t2;
|
|
541
525
|
};
|
|
542
526
|
var isExpressionNode = function isExpressionNode(x) {
|
|
543
|
-
return typeof x === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier;
|
|
527
|
+
return (typeof x === "undefined" ? "undefined" : _type_of(x)) === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier;
|
|
544
528
|
};
|
|
545
529
|
var throwError = function throwError(message, index) {
|
|
546
530
|
var err = new Error("".concat(message, " at character ").concat(index));
|
|
@@ -1129,7 +1113,7 @@ var Player = function() {
|
|
|
1129
1113
|
function isPromiseLike(value) {
|
|
1130
1114
|
var // Check for standard Promise constructor name
|
|
1131
1115
|
_value_constructor;
|
|
1132
|
-
return value != null && typeof value === "object" && typeof value.then === "function" && // Additional safeguards against false positives
|
|
1116
|
+
return value != null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && typeof value.then === "function" && // Additional safeguards against false positives
|
|
1133
1117
|
(_instanceof(value, Promise) || ((_value_constructor = value.constructor) === null || _value_constructor === void 0 ? void 0 : _value_constructor.name) === "Promise" || // Verify it has other Promise-like methods to reduce false positives
|
|
1134
1118
|
typeof value.catch === "function" && typeof value.finally === "function");
|
|
1135
1119
|
};
|
|
@@ -1156,7 +1140,7 @@ var Player = function() {
|
|
|
1156
1140
|
if (isExpressionNode(expr)) {
|
|
1157
1141
|
return false;
|
|
1158
1142
|
}
|
|
1159
|
-
return typeof expr === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
|
|
1143
|
+
return (typeof expr === "undefined" ? "undefined" : _type_of(expr)) === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
|
|
1160
1144
|
};
|
|
1161
1145
|
var isErrorWithLocation = function isErrorWithLocation(error) {
|
|
1162
1146
|
return error.index !== void 0 && error.description !== void 0;
|
|
@@ -1400,7 +1384,7 @@ var Player = function() {
|
|
|
1400
1384
|
if (!node) {
|
|
1401
1385
|
return;
|
|
1402
1386
|
}
|
|
1403
|
-
if ("value" in node &&
|
|
1387
|
+
if ("value" in node && _type_of(node.value) === "object" && typeof ((_node_value = node.value) === null || _node_value === void 0 ? void 0 : _node_value.id) === "string") {
|
|
1404
1388
|
return node.value.id;
|
|
1405
1389
|
}
|
|
1406
1390
|
};
|
|
@@ -1436,22 +1420,6 @@ var Player = function() {
|
|
|
1436
1420
|
}
|
|
1437
1421
|
});
|
|
1438
1422
|
};
|
|
1439
|
-
var unpackNode = function unpackNode(item) {
|
|
1440
|
-
var _item_children_, _item_children, _item_children_1, _item_children1;
|
|
1441
|
-
var unpacked = [];
|
|
1442
|
-
if ("children" in item && ((_item_children = item.children) === null || _item_children === void 0 ? void 0 : (_item_children_ = _item_children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.value.type) === "asset" /* Asset */ && ((_item_children1 = item.children) === null || _item_children1 === void 0 ? void 0 : (_item_children_1 = _item_children1[0]) === null || _item_children_1 === void 0 ? void 0 : _item_children_1.value).children) {
|
|
1443
|
-
var _item_children__value_children_, _item_children__value_children, _item_children_2, _item_children2;
|
|
1444
|
-
if (((_item_children__value_children = ((_item_children2 = item.children) === null || _item_children2 === void 0 ? void 0 : (_item_children_2 = _item_children2[0]) === null || _item_children_2 === void 0 ? void 0 : _item_children_2.value).children) === null || _item_children__value_children === void 0 ? void 0 : (_item_children__value_children_ = _item_children__value_children[0]) === null || _item_children__value_children_ === void 0 ? void 0 : _item_children__value_children_.value.type) === "multi-node" /* MultiNode */ ) {
|
|
1445
|
-
var _item_children__value_children_1, _item_children__value_children1, _item_children_3, _item_children3;
|
|
1446
|
-
((_item_children__value_children1 = ((_item_children3 = item.children) === null || _item_children3 === void 0 ? void 0 : (_item_children_3 = _item_children3[0]) === null || _item_children_3 === void 0 ? void 0 : _item_children_3.value).children) === null || _item_children__value_children1 === void 0 ? void 0 : (_item_children__value_children_1 = _item_children__value_children1[0]) === null || _item_children__value_children_1 === void 0 ? void 0 : _item_children__value_children_1.value).values.forEach(function(value) {
|
|
1447
|
-
unpacked.push(value);
|
|
1448
|
-
});
|
|
1449
|
-
}
|
|
1450
|
-
} else {
|
|
1451
|
-
unpacked.push(item);
|
|
1452
|
-
}
|
|
1453
|
-
return unpacked;
|
|
1454
|
-
};
|
|
1455
1423
|
var hasSomethingToResolve = function hasSomethingToResolve(str) {
|
|
1456
1424
|
return bindingResolveLookup(str) || expressionResolveLookup(str);
|
|
1457
1425
|
};
|
|
@@ -1567,7 +1535,7 @@ var Player = function() {
|
|
|
1567
1535
|
});
|
|
1568
1536
|
};
|
|
1569
1537
|
var __copyProps = function(to, from, except, desc) {
|
|
1570
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
1538
|
+
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
1571
1539
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1572
1540
|
try {
|
|
1573
1541
|
var _loop = function() {
|
|
@@ -1622,15 +1590,16 @@ var Player = function() {
|
|
|
1622
1590
|
exports.toError = exports.NestedError = void 0;
|
|
1623
1591
|
var NestedError4 = /*#__PURE__*/ function(Error1) {
|
|
1624
1592
|
_inherits(_NestedError, Error1);
|
|
1625
|
-
var _super = _create_super(_NestedError);
|
|
1626
1593
|
function _NestedError(message) {
|
|
1627
1594
|
for(var _len = arguments.length, innerErrors = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
1628
1595
|
innerErrors[_key - 1] = arguments[_key];
|
|
1629
1596
|
}
|
|
1630
1597
|
_class_call_check(this, _NestedError);
|
|
1631
1598
|
var _this;
|
|
1632
|
-
_this =
|
|
1633
|
-
|
|
1599
|
+
_this = _call_super(this, _NestedError, [
|
|
1600
|
+
message
|
|
1601
|
+
]);
|
|
1602
|
+
var thisErrorReport = _NestedError.getErrorReport(_this);
|
|
1634
1603
|
if (innerErrors.length === 1) {
|
|
1635
1604
|
var innerError = toError(innerErrors[0]);
|
|
1636
1605
|
_this.innerErrors = [
|
|
@@ -1766,7 +1735,7 @@ var Player = function() {
|
|
|
1766
1735
|
return out;
|
|
1767
1736
|
}
|
|
1768
1737
|
function isObject(o) {
|
|
1769
|
-
return o != null && typeof o === "object";
|
|
1738
|
+
return o != null && (typeof o === "undefined" ? "undefined" : _type_of(o)) === "object";
|
|
1770
1739
|
}
|
|
1771
1740
|
function addLast2(array, val) {
|
|
1772
1741
|
if (Array.isArray(val)) return array.concat(val);
|
|
@@ -2109,7 +2078,7 @@ var Player = function() {
|
|
|
2109
2078
|
else return 0;
|
|
2110
2079
|
}
|
|
2111
2080
|
}();
|
|
2112
|
-
if (typeof module === "object") module.exports = SortedArray2;
|
|
2081
|
+
if ((typeof module === "undefined" ? "undefined" : _type_of(module)) === "object") module.exports = SortedArray2;
|
|
2113
2082
|
if (typeof define === "function" && define.amd) define(function() {
|
|
2114
2083
|
return SortedArray2;
|
|
2115
2084
|
});
|
|
@@ -2531,10 +2500,9 @@ var Player = function() {
|
|
|
2531
2500
|
}();
|
|
2532
2501
|
var SyncHook = /*#__PURE__*/ function(Hook) {
|
|
2533
2502
|
_inherits(SyncHook, Hook);
|
|
2534
|
-
var _super = _create_super(SyncHook);
|
|
2535
2503
|
function SyncHook() {
|
|
2536
2504
|
_class_call_check(this, SyncHook);
|
|
2537
|
-
return
|
|
2505
|
+
return _call_super(this, SyncHook, arguments);
|
|
2538
2506
|
}
|
|
2539
2507
|
_create_class(SyncHook, [
|
|
2540
2508
|
{
|
|
@@ -2567,10 +2535,9 @@ var Player = function() {
|
|
|
2567
2535
|
}(Hook);
|
|
2568
2536
|
var SyncBailHook = /*#__PURE__*/ function(Hook) {
|
|
2569
2537
|
_inherits(SyncBailHook, Hook);
|
|
2570
|
-
var _super = _create_super(SyncBailHook);
|
|
2571
2538
|
function SyncBailHook() {
|
|
2572
2539
|
_class_call_check(this, SyncBailHook);
|
|
2573
|
-
return
|
|
2540
|
+
return _call_super(this, SyncBailHook, arguments);
|
|
2574
2541
|
}
|
|
2575
2542
|
_create_class(SyncBailHook, [
|
|
2576
2543
|
{
|
|
@@ -2602,10 +2569,9 @@ var Player = function() {
|
|
|
2602
2569
|
}(Hook);
|
|
2603
2570
|
var SyncWaterfallHook = /*#__PURE__*/ function(Hook) {
|
|
2604
2571
|
_inherits(SyncWaterfallHook, Hook);
|
|
2605
|
-
var _super = _create_super(SyncWaterfallHook);
|
|
2606
2572
|
function SyncWaterfallHook() {
|
|
2607
2573
|
_class_call_check(this, SyncWaterfallHook);
|
|
2608
|
-
return
|
|
2574
|
+
return _call_super(this, SyncWaterfallHook, arguments);
|
|
2609
2575
|
}
|
|
2610
2576
|
_create_class(SyncWaterfallHook, [
|
|
2611
2577
|
{
|
|
@@ -2719,6 +2685,7 @@ var Player = function() {
|
|
|
2719
2685
|
}
|
|
2720
2686
|
};
|
|
2721
2687
|
var identifier = function() {
|
|
2688
|
+
var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
2722
2689
|
if (!isIdentifierChar(ch)) {
|
|
2723
2690
|
return;
|
|
2724
2691
|
}
|
|
@@ -2729,6 +2696,14 @@ var Player = function() {
|
|
|
2729
2696
|
}
|
|
2730
2697
|
value += ch;
|
|
2731
2698
|
}
|
|
2699
|
+
if (allowBoolValue) {
|
|
2700
|
+
if (value === "true") {
|
|
2701
|
+
return toValue(true);
|
|
2702
|
+
}
|
|
2703
|
+
if (value === "false") {
|
|
2704
|
+
return toValue(false);
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2732
2707
|
if (value) {
|
|
2733
2708
|
var maybeNumber = Number(value);
|
|
2734
2709
|
value = isNaN(maybeNumber) ? value : maybeNumber;
|
|
@@ -2777,8 +2752,9 @@ var Player = function() {
|
|
|
2777
2752
|
}
|
|
2778
2753
|
};
|
|
2779
2754
|
var simpleSegment = function() {
|
|
2755
|
+
var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
2780
2756
|
var _nestedPath, _ref;
|
|
2781
|
-
return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier();
|
|
2757
|
+
return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier(allowBoolValue);
|
|
2782
2758
|
};
|
|
2783
2759
|
var segment = function() {
|
|
2784
2760
|
var segments = [];
|
|
@@ -2793,6 +2769,7 @@ var Player = function() {
|
|
|
2793
2769
|
return toConcatenatedNode(segments);
|
|
2794
2770
|
};
|
|
2795
2771
|
var optionallyQuotedSegment = function() {
|
|
2772
|
+
var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
2796
2773
|
whitespace();
|
|
2797
2774
|
if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
|
|
2798
2775
|
var singleQuote = ch === SINGLE_QUOTE;
|
|
@@ -2801,7 +2778,7 @@ var Player = function() {
|
|
|
2801
2778
|
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
2802
2779
|
return id;
|
|
2803
2780
|
}
|
|
2804
|
-
return simpleSegment();
|
|
2781
|
+
return simpleSegment(allowBoolValue);
|
|
2805
2782
|
};
|
|
2806
2783
|
var equals = function() {
|
|
2807
2784
|
if (ch !== EQUALS) {
|
|
@@ -2821,7 +2798,7 @@ var Player = function() {
|
|
|
2821
2798
|
whitespace();
|
|
2822
2799
|
if (equals()) {
|
|
2823
2800
|
whitespace();
|
|
2824
|
-
var second = optionallyQuotedSegment();
|
|
2801
|
+
var second = optionallyQuotedSegment(true);
|
|
2825
2802
|
value = toQuery(value, second);
|
|
2826
2803
|
whitespace();
|
|
2827
2804
|
}
|
|
@@ -3012,7 +2989,7 @@ var Player = function() {
|
|
|
3012
2989
|
appendPathSegments(getValueForNode(resolvedNode));
|
|
3013
2990
|
break;
|
|
3014
2991
|
case "Value":
|
|
3015
|
-
appendPathSegments(resolvedNode.value);
|
|
2992
|
+
appendPathSegments(typeof resolvedNode.value === "boolean" ? String(resolvedNode.value) : resolvedNode.value);
|
|
3016
2993
|
break;
|
|
3017
2994
|
case "Query":
|
|
3018
2995
|
{
|
|
@@ -3090,7 +3067,7 @@ var Player = function() {
|
|
|
3090
3067
|
var _this_parseCache_path;
|
|
3091
3068
|
var ast = (_this_parseCache_path = this.parseCache[path]) !== null && _this_parseCache_path !== void 0 ? _this_parseCache_path : parse(path);
|
|
3092
3069
|
this.parseCache[path] = ast;
|
|
3093
|
-
if (typeof ast !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
|
|
3070
|
+
if ((typeof ast === "undefined" ? "undefined" : _type_of(ast)) !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
|
|
3094
3071
|
var _ast_error;
|
|
3095
3072
|
throw new TypeError('Cannot normalize path "'.concat(path, '": ').concat((_ast_error = ast === null || ast === void 0 ? void 0 : ast.error) !== null && _ast_error !== void 0 ? _ast_error : "Unknown Error."));
|
|
3096
3073
|
}
|
|
@@ -3291,13 +3268,12 @@ var Player = function() {
|
|
|
3291
3268
|
}();
|
|
3292
3269
|
var DependencyMiddleware = /*#__PURE__*/ function(DependencyTracker) {
|
|
3293
3270
|
_inherits(DependencyMiddleware, DependencyTracker);
|
|
3294
|
-
var _super = _create_super(DependencyMiddleware);
|
|
3295
3271
|
function DependencyMiddleware() {
|
|
3296
3272
|
_class_call_check(this, DependencyMiddleware);
|
|
3297
3273
|
var _this;
|
|
3298
|
-
_this =
|
|
3299
|
-
_this.get = _this.get.bind(
|
|
3300
|
-
_this.set = _this.set.bind(
|
|
3274
|
+
_this = _call_super(this, DependencyMiddleware);
|
|
3275
|
+
_this.get = _this.get.bind(_this);
|
|
3276
|
+
_this.set = _this.set.bind(_this);
|
|
3301
3277
|
return _this;
|
|
3302
3278
|
}
|
|
3303
3279
|
_create_class(DependencyMiddleware, [
|
|
@@ -3332,14 +3308,13 @@ var Player = function() {
|
|
|
3332
3308
|
}(DependencyTracker);
|
|
3333
3309
|
var DependencyModel = /*#__PURE__*/ function(DependencyTracker) {
|
|
3334
3310
|
_inherits(DependencyModel, DependencyTracker);
|
|
3335
|
-
var _super = _create_super(DependencyModel);
|
|
3336
3311
|
function DependencyModel(rootModel) {
|
|
3337
3312
|
_class_call_check(this, DependencyModel);
|
|
3338
3313
|
var _this;
|
|
3339
|
-
_this =
|
|
3314
|
+
_this = _call_super(this, DependencyModel);
|
|
3340
3315
|
_this.rootModel = rootModel;
|
|
3341
|
-
_this.set = _this.set.bind(
|
|
3342
|
-
_this.get = _this.get.bind(
|
|
3316
|
+
_this.set = _this.set.bind(_this);
|
|
3317
|
+
_this.get = _this.get.bind(_this);
|
|
3343
3318
|
return _this;
|
|
3344
3319
|
}
|
|
3345
3320
|
_create_class(DependencyModel, [
|
|
@@ -3973,23 +3948,20 @@ var Player = function() {
|
|
|
3973
3948
|
* @experimental These Player APIs are in active development and may change. Use with caution
|
|
3974
3949
|
*/ key: "evaluateAsync",
|
|
3975
3950
|
value: function evaluateAsync(expr, options) {
|
|
3951
|
+
var _this = this;
|
|
3976
3952
|
if (Array.isArray(expr)) {
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
var _ref = _async_to_generator(function(exp) {
|
|
3953
|
+
return collateAwaitable(expr.map(function(exp) {
|
|
3954
|
+
return _async_to_generator(function() {
|
|
3980
3955
|
return _ts_generator(this, function(_state) {
|
|
3981
3956
|
return [
|
|
3982
3957
|
2,
|
|
3983
|
-
|
|
3958
|
+
this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
|
|
3984
3959
|
async: true
|
|
3985
3960
|
}))
|
|
3986
3961
|
];
|
|
3987
3962
|
});
|
|
3988
|
-
});
|
|
3989
|
-
|
|
3990
|
-
return _ref.apply(this, arguments);
|
|
3991
|
-
};
|
|
3992
|
-
}())).awaitableThen(function(values) {
|
|
3963
|
+
}).call(_this);
|
|
3964
|
+
})).awaitableThen(function(values) {
|
|
3993
3965
|
return values.pop();
|
|
3994
3966
|
});
|
|
3995
3967
|
} else {
|
|
@@ -4814,7 +4786,7 @@ var Player = function() {
|
|
|
4814
4786
|
for(var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4815
4787
|
len = _step.value;
|
|
4816
4788
|
tmp = len;
|
|
4817
|
-
if (tmp && typeof tmp === "object") {
|
|
4789
|
+
if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
|
|
4818
4790
|
tmp = find(bar, tmp);
|
|
4819
4791
|
if (!tmp) return false;
|
|
4820
4792
|
}
|
|
@@ -4845,7 +4817,7 @@ var Player = function() {
|
|
|
4845
4817
|
for(var _iterator1 = foo[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
4846
4818
|
len = _step1.value;
|
|
4847
4819
|
tmp = len[0];
|
|
4848
|
-
if (tmp && typeof tmp === "object") {
|
|
4820
|
+
if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
|
|
4849
4821
|
tmp = find(bar, tmp);
|
|
4850
4822
|
if (!tmp) return false;
|
|
4851
4823
|
}
|
|
@@ -4884,7 +4856,7 @@ var Player = function() {
|
|
|
4884
4856
|
}
|
|
4885
4857
|
return len === -1;
|
|
4886
4858
|
}
|
|
4887
|
-
if (!ctor || typeof foo === "object") {
|
|
4859
|
+
if (!ctor || (typeof foo === "undefined" ? "undefined" : _type_of(foo)) === "object") {
|
|
4888
4860
|
len = 0;
|
|
4889
4861
|
for(ctor in foo){
|
|
4890
4862
|
if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
|
|
@@ -4919,23 +4891,8 @@ var Player = function() {
|
|
|
4919
4891
|
function Parser() {
|
|
4920
4892
|
_class_call_check(this, Parser);
|
|
4921
4893
|
this.hooks = {
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
*
|
|
4925
|
-
* @param value - The object we're are about to parse
|
|
4926
|
-
* @returns - A new value to parse.
|
|
4927
|
-
* If undefined, the original value is used.
|
|
4928
|
-
* If null, we stop parsing this node.
|
|
4929
|
-
*/ onParseObject: new SyncWaterfallHook(),
|
|
4930
|
-
/**
|
|
4931
|
-
* A callback to interact with an AST _after_ we parse it into the AST
|
|
4932
|
-
*
|
|
4933
|
-
* @param value - The object we parsed
|
|
4934
|
-
* @param node - The AST node we generated
|
|
4935
|
-
* @returns - A new AST node to use
|
|
4936
|
-
* If undefined, the original value is used.
|
|
4937
|
-
* If null, we ignore this node all together
|
|
4938
|
-
*/ onCreateASTNode: new SyncWaterfallHook(),
|
|
4894
|
+
onParseObject: new SyncWaterfallHook(),
|
|
4895
|
+
onCreateASTNode: new SyncWaterfallHook(),
|
|
4939
4896
|
parseNode: new SyncBailHook()
|
|
4940
4897
|
};
|
|
4941
4898
|
}
|
|
@@ -4973,7 +4930,7 @@ var Player = function() {
|
|
|
4973
4930
|
}
|
|
4974
4931
|
var parseLocalObject = function(currentValue, objToParse) {
|
|
4975
4932
|
var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
|
|
4976
|
-
if (typeof objToParse !== "object" || objToParse === null) {
|
|
4933
|
+
if ((typeof objToParse === "undefined" ? "undefined" : _type_of(objToParse)) !== "object" || objToParse === null) {
|
|
4977
4934
|
return {
|
|
4978
4935
|
value: objToParse,
|
|
4979
4936
|
children: []
|
|
@@ -5010,7 +4967,7 @@ var Player = function() {
|
|
|
5010
4967
|
if (newChildren) {
|
|
5011
4968
|
var _children2;
|
|
5012
4969
|
(_children2 = children2).push.apply(_children2, _to_consumable_array(newChildren));
|
|
5013
|
-
} else if (localValue && typeof localValue === "object") {
|
|
4970
|
+
} else if (localValue && (typeof localValue === "undefined" ? "undefined" : _type_of(localValue)) === "object") {
|
|
5014
4971
|
var _children21;
|
|
5015
4972
|
var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
|
|
5016
4973
|
localKey
|
|
@@ -5078,20 +5035,14 @@ var Player = function() {
|
|
|
5078
5035
|
function Resolver(root, options) {
|
|
5079
5036
|
_class_call_check(this, Resolver);
|
|
5080
5037
|
this.hooks = {
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
*/ resolve: new SyncWaterfallHook(),
|
|
5090
|
-
/**
|
|
5091
|
-
* A hook to transform the resolved value of an AST node.
|
|
5092
|
-
* This runs _after_ all children nodes are resolved
|
|
5093
|
-
*/ afterResolve: new SyncWaterfallHook(),
|
|
5094
|
-
/** Called at the very end of a node's tree being updated */ afterNodeUpdate: new SyncHook()
|
|
5038
|
+
skipResolve: new SyncWaterfallHook(),
|
|
5039
|
+
beforeUpdate: new SyncHook(),
|
|
5040
|
+
afterUpdate: new SyncHook(),
|
|
5041
|
+
resolveOptions: new SyncWaterfallHook(),
|
|
5042
|
+
beforeResolve: new SyncWaterfallHook(),
|
|
5043
|
+
resolve: new SyncWaterfallHook(),
|
|
5044
|
+
afterResolve: new SyncWaterfallHook(),
|
|
5045
|
+
afterNodeUpdate: new SyncHook()
|
|
5095
5046
|
};
|
|
5096
5047
|
this.root = root;
|
|
5097
5048
|
this.options = options;
|
|
@@ -5099,6 +5050,7 @@ var Player = function() {
|
|
|
5099
5050
|
this.ASTMap = /* @__PURE__ */ new Map();
|
|
5100
5051
|
this.logger = options.logger;
|
|
5101
5052
|
this.idCache = /* @__PURE__ */ new Set();
|
|
5053
|
+
this.AsyncIdMap = /* @__PURE__ */ new Map();
|
|
5102
5054
|
}
|
|
5103
5055
|
_create_class(Resolver, [
|
|
5104
5056
|
{
|
|
@@ -5109,13 +5061,27 @@ var Player = function() {
|
|
|
5109
5061
|
},
|
|
5110
5062
|
{
|
|
5111
5063
|
key: "update",
|
|
5112
|
-
value: function update(changes) {
|
|
5064
|
+
value: function update(changes, asyncChanges) {
|
|
5065
|
+
var _this = this;
|
|
5113
5066
|
this.hooks.beforeUpdate.call(changes);
|
|
5114
5067
|
var resolveCache = /* @__PURE__ */ new Map();
|
|
5115
5068
|
this.idCache.clear();
|
|
5116
5069
|
var prevASTMap = new Map(this.ASTMap);
|
|
5117
5070
|
this.ASTMap.clear();
|
|
5118
|
-
var
|
|
5071
|
+
var prevAsyncIdMap = new Map(this.AsyncIdMap);
|
|
5072
|
+
var nextAsyncIdMap = /* @__PURE__ */ new Map();
|
|
5073
|
+
asyncChanges === null || asyncChanges === void 0 ? void 0 : asyncChanges.forEach(function(id) {
|
|
5074
|
+
var current = prevAsyncIdMap.get(id);
|
|
5075
|
+
while(current && prevASTMap.has(current)){
|
|
5076
|
+
var next = prevASTMap.get(current);
|
|
5077
|
+
if (next && _this.resolveCache.has(next)) {
|
|
5078
|
+
_this.resolveCache.delete(next);
|
|
5079
|
+
}
|
|
5080
|
+
current = current.parent;
|
|
5081
|
+
}
|
|
5082
|
+
});
|
|
5083
|
+
var updated = this.computeTree(this.root, void 0, changes, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap, nextAsyncIdMap);
|
|
5084
|
+
this.AsyncIdMap = nextAsyncIdMap;
|
|
5119
5085
|
this.resolveCache = resolveCache;
|
|
5120
5086
|
this.hooks.afterUpdate.call(updated.value);
|
|
5121
5087
|
return updated.value;
|
|
@@ -5160,7 +5126,7 @@ var Player = function() {
|
|
|
5160
5126
|
Object.keys(clonedNode).forEach(function(key) {
|
|
5161
5127
|
if (key === "parent") return;
|
|
5162
5128
|
var value = clonedNode[key];
|
|
5163
|
-
if (typeof value === "object" && value !== null) {
|
|
5129
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null) {
|
|
5164
5130
|
clonedNode[key] = Array.isArray(value) ? _to_consumable_array(value) : _object_spread({}, value);
|
|
5165
5131
|
}
|
|
5166
5132
|
});
|
|
@@ -5169,9 +5135,8 @@ var Player = function() {
|
|
|
5169
5135
|
},
|
|
5170
5136
|
{
|
|
5171
5137
|
key: "computeTree",
|
|
5172
|
-
value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
|
|
5138
|
+
value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap, nextAsyncIdMap) {
|
|
5173
5139
|
var _this = this;
|
|
5174
|
-
var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
|
|
5175
5140
|
var dependencyModel = new DependencyModel(options.data.model);
|
|
5176
5141
|
dependencyModel.trackSubset("core");
|
|
5177
5142
|
var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
|
|
@@ -5190,15 +5155,6 @@ var Player = function() {
|
|
|
5190
5155
|
var previousDeps = previousResult === null || previousResult === void 0 ? void 0 : previousResult.dependencies;
|
|
5191
5156
|
var dataChanged = caresAboutDataChanges(dataChanges, previousDeps);
|
|
5192
5157
|
var shouldUseLastValue = this.hooks.skipResolve.call(!dataChanged, node, resolveOptions);
|
|
5193
|
-
var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
|
|
5194
|
-
parent: partiallyResolvedParent
|
|
5195
|
-
});
|
|
5196
|
-
var _this_hooks_beforeResolve_call;
|
|
5197
|
-
var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
|
|
5198
|
-
type: "empty" /* Empty */
|
|
5199
|
-
};
|
|
5200
|
-
var isNestedMultiNodeWithAsync = resolvedAST.type === "multi-node" /* MultiNode */ && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent === void 0 ? void 0 : (_partiallyResolvedParent_parent_parent = _partiallyResolvedParent_parent.parent) === null || _partiallyResolvedParent_parent_parent === void 0 ? void 0 : _partiallyResolvedParent_parent_parent.type) === "multi-node" /* MultiNode */ && partiallyResolvedParent.parent.type === "value" /* Value */ && ((_resolvedAST_parent = resolvedAST.parent) === null || _resolvedAST_parent === void 0 ? void 0 : _resolvedAST_parent.type) === "asset" /* Asset */ && resolvedAST.parent.value.id.includes("async");
|
|
5201
|
-
var isNestedMultiNode = resolvedAST.type === "multi-node" /* MultiNode */ && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent1 = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent1 === void 0 ? void 0 : _partiallyResolvedParent_parent1.type) === "multi-node" /* MultiNode */ && partiallyResolvedParent.type === "value" /* Value */ ;
|
|
5202
5158
|
if (previousResult && shouldUseLastValue) {
|
|
5203
5159
|
var update2 = _object_spread_props(_object_spread({}, previousResult), {
|
|
5204
5160
|
updated: false
|
|
@@ -5210,6 +5166,30 @@ var Player = function() {
|
|
|
5210
5166
|
updated: false
|
|
5211
5167
|
});
|
|
5212
5168
|
cacheUpdate.set(AST, resolvedUpdate);
|
|
5169
|
+
if (resolvedUpdate.node.type === "async" /* Async */ ) {
|
|
5170
|
+
nextAsyncIdMap.set(resolvedUpdate.node.id, resolvedUpdate.node);
|
|
5171
|
+
}
|
|
5172
|
+
var _resolvedUpdate_node_asyncNodesResolved;
|
|
5173
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5174
|
+
try {
|
|
5175
|
+
for(var _iterator = ((_resolvedUpdate_node_asyncNodesResolved = resolvedUpdate.node.asyncNodesResolved) !== null && _resolvedUpdate_node_asyncNodesResolved !== void 0 ? _resolvedUpdate_node_asyncNodesResolved : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5176
|
+
var key = _step.value;
|
|
5177
|
+
nextAsyncIdMap.set(key, resolvedUpdate.node);
|
|
5178
|
+
}
|
|
5179
|
+
} catch (err) {
|
|
5180
|
+
_didIteratorError = true;
|
|
5181
|
+
_iteratorError = err;
|
|
5182
|
+
} finally{
|
|
5183
|
+
try {
|
|
5184
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5185
|
+
_iterator.return();
|
|
5186
|
+
}
|
|
5187
|
+
} finally{
|
|
5188
|
+
if (_didIteratorError) {
|
|
5189
|
+
throw _iteratorError;
|
|
5190
|
+
}
|
|
5191
|
+
}
|
|
5192
|
+
}
|
|
5213
5193
|
var handleChildNode = function(childNode) {
|
|
5214
5194
|
var _prevASTMap_get;
|
|
5215
5195
|
var originalChildNode = (_prevASTMap_get = prevASTMap.get(childNode)) !== null && _prevASTMap_get !== void 0 ? _prevASTMap_get : childNode;
|
|
@@ -5232,10 +5212,37 @@ var Player = function() {
|
|
|
5232
5212
|
repopulateASTMapFromCache(previousResult, node, rawParent);
|
|
5233
5213
|
return update2;
|
|
5234
5214
|
}
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
}
|
|
5238
|
-
|
|
5215
|
+
var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
|
|
5216
|
+
parent: partiallyResolvedParent
|
|
5217
|
+
});
|
|
5218
|
+
var _this_hooks_beforeResolve_call;
|
|
5219
|
+
var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
|
|
5220
|
+
type: "empty" /* Empty */
|
|
5221
|
+
};
|
|
5222
|
+
resolvedAST.parent = partiallyResolvedParent;
|
|
5223
|
+
if (resolvedAST.type === "async" /* Async */ ) {
|
|
5224
|
+
nextAsyncIdMap.set(resolvedAST.id, resolvedAST);
|
|
5225
|
+
}
|
|
5226
|
+
var _resolvedAST_asyncNodesResolved;
|
|
5227
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5228
|
+
try {
|
|
5229
|
+
for(var _iterator = ((_resolvedAST_asyncNodesResolved = resolvedAST.asyncNodesResolved) !== null && _resolvedAST_asyncNodesResolved !== void 0 ? _resolvedAST_asyncNodesResolved : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5230
|
+
var id = _step.value;
|
|
5231
|
+
nextAsyncIdMap.set(id, resolvedAST);
|
|
5232
|
+
}
|
|
5233
|
+
} catch (err) {
|
|
5234
|
+
_didIteratorError = true;
|
|
5235
|
+
_iteratorError = err;
|
|
5236
|
+
} finally{
|
|
5237
|
+
try {
|
|
5238
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5239
|
+
_iterator.return();
|
|
5240
|
+
}
|
|
5241
|
+
} finally{
|
|
5242
|
+
if (_didIteratorError) {
|
|
5243
|
+
throw _iteratorError;
|
|
5244
|
+
}
|
|
5245
|
+
}
|
|
5239
5246
|
}
|
|
5240
5247
|
resolveOptions.node = resolvedAST;
|
|
5241
5248
|
this.ASTMap.set(resolvedAST, node);
|
|
@@ -5249,7 +5256,7 @@ var Player = function() {
|
|
|
5249
5256
|
if ("children" in resolvedAST) {
|
|
5250
5257
|
var _resolvedAST_children;
|
|
5251
5258
|
var newChildren = (_resolvedAST_children = resolvedAST.children) === null || _resolvedAST_children === void 0 ? void 0 : _resolvedAST_children.map(function(child) {
|
|
5252
|
-
var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
|
|
5259
|
+
var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
|
|
5253
5260
|
var childTreeDeps = computedChildTree.dependencies, childNode = computedChildTree.node, childUpdated = computedChildTree.updated, childValue = computedChildTree.value;
|
|
5254
5261
|
childTreeDeps.forEach(function(binding) {
|
|
5255
5262
|
return childDependencies.add(binding);
|
|
@@ -5270,40 +5277,18 @@ var Player = function() {
|
|
|
5270
5277
|
resolvedAST.children = newChildren;
|
|
5271
5278
|
} else if (resolvedAST.type === "multi-node" /* MultiNode */ ) {
|
|
5272
5279
|
var childValue = [];
|
|
5273
|
-
var rawParentToPassIn =
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
}).filter(function(index) {
|
|
5277
|
-
return index !== -1;
|
|
5278
|
-
});
|
|
5279
|
-
var newValues = resolvedAST.values.map(function(mValue) {
|
|
5280
|
-
var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
|
|
5280
|
+
var rawParentToPassIn = node;
|
|
5281
|
+
resolvedAST.values = resolvedAST.values.map(function(mValue) {
|
|
5282
|
+
var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
|
|
5281
5283
|
if (mTree.value !== void 0 && mTree.value !== null) {
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
}
|
|
5285
|
-
|
|
5286
|
-
|
|
5284
|
+
mTree.dependencies.forEach(function(bindingDep) {
|
|
5285
|
+
return childDependencies.add(bindingDep);
|
|
5286
|
+
});
|
|
5287
|
+
updated = updated || mTree.updated;
|
|
5288
|
+
childValue.push(mTree.value);
|
|
5287
5289
|
}
|
|
5288
|
-
mTree.dependencies.forEach(function(bindingDep) {
|
|
5289
|
-
return childDependencies.add(bindingDep);
|
|
5290
|
-
});
|
|
5291
|
-
updated = updated || mTree.updated;
|
|
5292
5290
|
return mTree.node;
|
|
5293
5291
|
});
|
|
5294
|
-
if (hasAsync.length > 0) {
|
|
5295
|
-
var copy = newValues;
|
|
5296
|
-
hasAsync.forEach(function(index) {
|
|
5297
|
-
var _copy;
|
|
5298
|
-
if (copy[index]) (_copy = copy).splice.apply(_copy, [
|
|
5299
|
-
index,
|
|
5300
|
-
1
|
|
5301
|
-
].concat(_to_consumable_array(unpackNode(copy[index]))));
|
|
5302
|
-
});
|
|
5303
|
-
resolvedAST.values = copy;
|
|
5304
|
-
} else {
|
|
5305
|
-
resolvedAST.values = newValues;
|
|
5306
|
-
}
|
|
5307
5292
|
resolved = childValue;
|
|
5308
5293
|
}
|
|
5309
5294
|
childDependencies.forEach(function(bindingDep) {
|
|
@@ -5324,7 +5309,7 @@ var Player = function() {
|
|
|
5324
5309
|
value: resolved,
|
|
5325
5310
|
dependencies: /* @__PURE__ */ new Set(_to_consumable_array(dependencyModel.getDependencies()).concat(_to_consumable_array(childDependencies)))
|
|
5326
5311
|
};
|
|
5327
|
-
this.hooks.afterNodeUpdate.call(node,
|
|
5312
|
+
this.hooks.afterNodeUpdate.call(node, rawParent, update);
|
|
5328
5313
|
cacheUpdate.set(node, update);
|
|
5329
5314
|
return update;
|
|
5330
5315
|
}
|
|
@@ -5332,15 +5317,6 @@ var Player = function() {
|
|
|
5332
5317
|
]);
|
|
5333
5318
|
return Resolver;
|
|
5334
5319
|
}();
|
|
5335
|
-
function unpackAndPush(item, initial) {
|
|
5336
|
-
if (item.asset.values && Array.isArray(item.asset.values)) {
|
|
5337
|
-
item.asset.values.forEach(function(i) {
|
|
5338
|
-
unpackAndPush(i, initial);
|
|
5339
|
-
});
|
|
5340
|
-
} else {
|
|
5341
|
-
initial.push(item);
|
|
5342
|
-
}
|
|
5343
|
-
}
|
|
5344
5320
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/view.ts
|
|
5345
5321
|
var CrossfieldProvider = /*#__PURE__*/ function() {
|
|
5346
5322
|
function CrossfieldProvider(initialView, parser, logger) {
|
|
@@ -5409,9 +5385,11 @@ var Player = function() {
|
|
|
5409
5385
|
_create_class(ViewInstance, [
|
|
5410
5386
|
{
|
|
5411
5387
|
key: "updateAsync",
|
|
5412
|
-
value: function updateAsync() {
|
|
5388
|
+
value: function updateAsync(asyncNode) {
|
|
5413
5389
|
var _this_resolver;
|
|
5414
|
-
var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update()
|
|
5390
|
+
var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update(/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set([
|
|
5391
|
+
asyncNode
|
|
5392
|
+
]));
|
|
5415
5393
|
this.lastUpdate = update;
|
|
5416
5394
|
this.hooks.onUpdate.call(update);
|
|
5417
5395
|
}
|
|
@@ -5530,11 +5508,12 @@ var Player = function() {
|
|
|
5530
5508
|
*
|
|
5531
5509
|
* @param id - the id of async node. It should be identical for each async node
|
|
5532
5510
|
*/ function asyncNode(id) {
|
|
5533
|
-
var flatten2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
5511
|
+
var flatten2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true, onValueReceived = arguments.length > 2 ? arguments[2] : void 0;
|
|
5534
5512
|
return {
|
|
5535
5513
|
id: id,
|
|
5536
5514
|
type: "async" /* Async */ ,
|
|
5537
5515
|
flatten: flatten2,
|
|
5516
|
+
onValueReceived: onValueReceived,
|
|
5538
5517
|
value: {
|
|
5539
5518
|
type: "value" /* Value */ ,
|
|
5540
5519
|
value: {
|
|
@@ -5630,7 +5609,7 @@ var Player = function() {
|
|
|
5630
5609
|
for(var _iterator = templateSubstitutions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5631
5610
|
var _step_value = _step.value, expression = _step_value.expression, value = _step_value.value;
|
|
5632
5611
|
var flags = "g";
|
|
5633
|
-
if (typeof expression === "object") {
|
|
5612
|
+
if ((typeof expression === "undefined" ? "undefined" : _type_of(expression)) === "object") {
|
|
5634
5613
|
flags = "".concat(expression.flags).concat(expression.global ? "" : "g");
|
|
5635
5614
|
}
|
|
5636
5615
|
templateStr = templateStr.replace(new RegExp(expression, flags), value);
|
|
@@ -5781,7 +5760,7 @@ var Player = function() {
|
|
|
5781
5760
|
var bindingResolveLookup = createPatternMatcher("{{", "}}");
|
|
5782
5761
|
var expressionResolveLookup = createPatternMatcher("@[", "]@");
|
|
5783
5762
|
function resolveAllRefs(node, resolveOptions, propertiesToSkip) {
|
|
5784
|
-
if (node === null || node === void 0 || typeof node !== "object" && typeof node !== "string") {
|
|
5763
|
+
if (node === null || node === void 0 || (typeof node === "undefined" ? "undefined" : _type_of(node)) !== "object" && typeof node !== "string") {
|
|
5785
5764
|
return node;
|
|
5786
5765
|
}
|
|
5787
5766
|
if (typeof node === "string") {
|
|
@@ -5794,7 +5773,7 @@ var Player = function() {
|
|
|
5794
5773
|
}
|
|
5795
5774
|
var val = node[key];
|
|
5796
5775
|
var newVal = val;
|
|
5797
|
-
if (typeof val === "object") {
|
|
5776
|
+
if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
|
|
5798
5777
|
newVal = resolveAllRefs(val, resolveOptions, propertiesToSkip);
|
|
5799
5778
|
} else if (typeof val === "string") {
|
|
5800
5779
|
newVal = resolveString(val, resolveOptions);
|
|
@@ -6087,7 +6066,7 @@ var Player = function() {
|
|
|
6087
6066
|
key: "applyParser",
|
|
6088
6067
|
value: function applyParser(parser) {
|
|
6089
6068
|
parser.hooks.parseNode.tap("multi-node", function(obj, nodeType, options, childOptions) {
|
|
6090
|
-
if (childOptions
|
|
6069
|
+
if ((childOptions === void 0 || !hasTemplateKey(childOptions.key)) && Array.isArray(obj)) {
|
|
6091
6070
|
var values = obj.map(function(childVal) {
|
|
6092
6071
|
return parser.parseObject(childVal, "value" /* Value */ , options);
|
|
6093
6072
|
}).filter(function(child) {
|
|
@@ -6098,7 +6077,7 @@ var Player = function() {
|
|
|
6098
6077
|
}
|
|
6099
6078
|
var multiNode = parser.createASTNode({
|
|
6100
6079
|
type: "multi-node" /* MultiNode */ ,
|
|
6101
|
-
override: !hasTemplateValues(childOptions.parentObj, childOptions.key),
|
|
6080
|
+
override: childOptions !== void 0 && !hasTemplateValues(childOptions.parentObj, childOptions.key),
|
|
6102
6081
|
values: values
|
|
6103
6082
|
}, obj);
|
|
6104
6083
|
if (!multiNode) {
|
|
@@ -6109,7 +6088,7 @@ var Player = function() {
|
|
|
6109
6088
|
v.parent = multiNode;
|
|
6110
6089
|
});
|
|
6111
6090
|
}
|
|
6112
|
-
return [
|
|
6091
|
+
return childOptions === void 0 ? multiNode : [
|
|
6113
6092
|
{
|
|
6114
6093
|
path: _to_consumable_array(childOptions.path).concat([
|
|
6115
6094
|
childOptions.key
|
|
@@ -6140,7 +6119,7 @@ var Player = function() {
|
|
|
6140
6119
|
key: "applyParser",
|
|
6141
6120
|
value: function applyParser(parser) {
|
|
6142
6121
|
parser.hooks.parseNode.tap("asset", function(obj, nodeType, options, childOptions) {
|
|
6143
|
-
if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && typeof obj === "object") {
|
|
6122
|
+
if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
|
|
6144
6123
|
var assetAST = parser.parseObject(obj, "asset" /* Asset */ , options);
|
|
6145
6124
|
if (!assetAST) {
|
|
6146
6125
|
return [];
|
|
@@ -6348,6 +6327,7 @@ var Player = function() {
|
|
|
6348
6327
|
var import_p_defer = __toESM(require_p_defer());
|
|
6349
6328
|
var FlowInstance = /*#__PURE__*/ function() {
|
|
6350
6329
|
function FlowInstance(id, flow, options) {
|
|
6330
|
+
var _this = this;
|
|
6351
6331
|
_class_call_check(this, FlowInstance);
|
|
6352
6332
|
this.isTransitioning = false;
|
|
6353
6333
|
this.hooks = {
|
|
@@ -6364,60 +6344,55 @@ var Player = function() {
|
|
|
6364
6344
|
this.flow = flow;
|
|
6365
6345
|
this.log = options === null || options === void 0 ? void 0 : options.logger;
|
|
6366
6346
|
this.history = [];
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
var _ref = _async_to_generator(function(_oldState, nextState) {
|
|
6347
|
+
this.hooks.transition.tap("startPromise", function(_oldState, nextState) {
|
|
6348
|
+
return _async_to_generator(function() {
|
|
6370
6349
|
var newState;
|
|
6371
6350
|
return _ts_generator(this, function(_state) {
|
|
6372
6351
|
newState = nextState.value;
|
|
6373
|
-
if (
|
|
6374
|
-
|
|
6352
|
+
if (this.flowPromise && newState.state_type === "END") {
|
|
6353
|
+
this.flowPromise.resolve(newState);
|
|
6375
6354
|
}
|
|
6376
6355
|
return [
|
|
6377
6356
|
2
|
|
6378
6357
|
];
|
|
6379
6358
|
});
|
|
6380
|
-
});
|
|
6381
|
-
|
|
6382
|
-
return _ref.apply(this, arguments);
|
|
6383
|
-
};
|
|
6384
|
-
}());
|
|
6359
|
+
}).call(_this);
|
|
6360
|
+
});
|
|
6385
6361
|
}
|
|
6386
6362
|
_create_class(FlowInstance, [
|
|
6387
6363
|
{
|
|
6388
6364
|
key: "start",
|
|
6389
6365
|
value: /** Start the state machine */ function start() {
|
|
6390
|
-
var _this = this;
|
|
6391
6366
|
return _async_to_generator(function() {
|
|
6392
6367
|
var _this_log, initialState;
|
|
6393
6368
|
return _ts_generator(this, function(_state) {
|
|
6394
|
-
if (
|
|
6369
|
+
if (this.flowPromise) {
|
|
6395
6370
|
;
|
|
6396
|
-
(_this_log =
|
|
6371
|
+
(_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
|
|
6397
6372
|
return [
|
|
6398
6373
|
2,
|
|
6399
|
-
|
|
6374
|
+
this.flowPromise.promise
|
|
6400
6375
|
];
|
|
6401
6376
|
}
|
|
6402
|
-
|
|
6403
|
-
if (
|
|
6404
|
-
|
|
6377
|
+
this.flow = this.hooks.beforeStart.call(this.flow) || this.flow;
|
|
6378
|
+
if (this.flow.onStart) {
|
|
6379
|
+
this.hooks.onStart.call(this.flow.onStart);
|
|
6405
6380
|
}
|
|
6406
|
-
initialState =
|
|
6381
|
+
initialState = this.flow.startState;
|
|
6407
6382
|
if (!initialState) {
|
|
6408
6383
|
return [
|
|
6409
6384
|
2,
|
|
6410
6385
|
Promise.reject(new Error("No 'startState' defined for flow"))
|
|
6411
6386
|
];
|
|
6412
6387
|
}
|
|
6413
|
-
|
|
6414
|
-
|
|
6388
|
+
this.flowPromise = (0, import_p_defer.default)();
|
|
6389
|
+
this.pushHistory(initialState);
|
|
6415
6390
|
return [
|
|
6416
6391
|
2,
|
|
6417
|
-
|
|
6392
|
+
this.flowPromise.promise
|
|
6418
6393
|
];
|
|
6419
6394
|
});
|
|
6420
|
-
})();
|
|
6395
|
+
}).call(this);
|
|
6421
6396
|
}
|
|
6422
6397
|
},
|
|
6423
6398
|
{
|
|
@@ -6469,7 +6444,7 @@ var Player = function() {
|
|
|
6469
6444
|
throw new Error("No flow definition for: ".concat(stateName, " was found."));
|
|
6470
6445
|
}
|
|
6471
6446
|
var nextState = this.flow[stateName];
|
|
6472
|
-
if (!this.flow[stateName] || typeof nextState !== "object" || !("state_type" in nextState)) {
|
|
6447
|
+
if (!this.flow[stateName] || (typeof nextState === "undefined" ? "undefined" : _type_of(nextState)) !== "object" || !("state_type" in nextState)) {
|
|
6473
6448
|
var _this_log;
|
|
6474
6449
|
(_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.error("Flow doesn't contain any states named: ".concat(stateName));
|
|
6475
6450
|
return;
|
|
@@ -6530,30 +6505,30 @@ var Player = function() {
|
|
|
6530
6505
|
{
|
|
6531
6506
|
key: "run",
|
|
6532
6507
|
value: function run(startState) {
|
|
6533
|
-
var _this = this;
|
|
6534
6508
|
return _async_to_generator(function() {
|
|
6535
|
-
var _this_log, startFlow, flow, end, firstItem;
|
|
6509
|
+
var _this, _this_log, startFlow, flow, end, firstItem;
|
|
6536
6510
|
return _ts_generator(this, function(_state) {
|
|
6537
6511
|
switch(_state.label){
|
|
6538
6512
|
case 0:
|
|
6539
|
-
|
|
6513
|
+
_this = this;
|
|
6514
|
+
if (!Object.prototype.hasOwnProperty.call(this.navigation, startState)) {
|
|
6540
6515
|
return [
|
|
6541
6516
|
2,
|
|
6542
6517
|
Promise.reject(new Error("No flow defined for: ".concat(startState)))
|
|
6543
6518
|
];
|
|
6544
6519
|
}
|
|
6545
|
-
startFlow =
|
|
6546
|
-
if (startFlow === null || typeof startFlow !== "object") {
|
|
6520
|
+
startFlow = this.navigation[startState];
|
|
6521
|
+
if (startFlow === null || (typeof startFlow === "undefined" ? "undefined" : _type_of(startFlow)) !== "object") {
|
|
6547
6522
|
return [
|
|
6548
6523
|
2,
|
|
6549
6524
|
Promise.reject(new Error("Flow: ".concat(startState, " needs to be an object")))
|
|
6550
6525
|
];
|
|
6551
6526
|
}
|
|
6552
|
-
(_this_log =
|
|
6527
|
+
(_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
|
|
6553
6528
|
flow = new FlowInstance(startState, startFlow, {
|
|
6554
|
-
logger:
|
|
6529
|
+
logger: this.log
|
|
6555
6530
|
});
|
|
6556
|
-
|
|
6531
|
+
this.addNewFlow(flow);
|
|
6557
6532
|
flow.hooks.afterTransition.tap("flow-controller", function(flowInstance) {
|
|
6558
6533
|
var _flowInstance_currentState;
|
|
6559
6534
|
if (((_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value.state_type) === "FLOW") {
|
|
@@ -6573,10 +6548,10 @@ var Player = function() {
|
|
|
6573
6548
|
];
|
|
6574
6549
|
case 1:
|
|
6575
6550
|
end = _state.sent();
|
|
6576
|
-
|
|
6577
|
-
if (
|
|
6551
|
+
this.navStack.pop();
|
|
6552
|
+
if (this.navStack.length > 0) {
|
|
6578
6553
|
firstItem = 0;
|
|
6579
|
-
|
|
6554
|
+
this.current = this.navStack[firstItem];
|
|
6580
6555
|
}
|
|
6581
6556
|
return [
|
|
6582
6557
|
2,
|
|
@@ -6584,16 +6559,15 @@ var Player = function() {
|
|
|
6584
6559
|
];
|
|
6585
6560
|
}
|
|
6586
6561
|
});
|
|
6587
|
-
})();
|
|
6562
|
+
}).call(this);
|
|
6588
6563
|
}
|
|
6589
6564
|
},
|
|
6590
6565
|
{
|
|
6591
6566
|
key: "start",
|
|
6592
6567
|
value: function start() {
|
|
6593
|
-
var _this = this;
|
|
6594
6568
|
return _async_to_generator(function() {
|
|
6595
6569
|
return _ts_generator(this, function(_state) {
|
|
6596
|
-
if (!
|
|
6570
|
+
if (!this.navigation.BEGIN) {
|
|
6597
6571
|
return [
|
|
6598
6572
|
2,
|
|
6599
6573
|
Promise.reject(new Error("Must supply a BEGIN state"))
|
|
@@ -6601,10 +6575,10 @@ var Player = function() {
|
|
|
6601
6575
|
}
|
|
6602
6576
|
return [
|
|
6603
6577
|
2,
|
|
6604
|
-
|
|
6578
|
+
this.run(this.navigation.BEGIN)
|
|
6605
6579
|
];
|
|
6606
6580
|
});
|
|
6607
|
-
})();
|
|
6581
|
+
}).call(this);
|
|
6608
6582
|
}
|
|
6609
6583
|
}
|
|
6610
6584
|
]);
|
|
@@ -7395,7 +7369,7 @@ var Player = function() {
|
|
|
7395
7369
|
var nestedPath = _to_consumable_array(path).concat([
|
|
7396
7370
|
key
|
|
7397
7371
|
]);
|
|
7398
|
-
if (typeof val === "object") {
|
|
7372
|
+
if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
|
|
7399
7373
|
traverseObj(val, nestedPath, pairs);
|
|
7400
7374
|
} else {
|
|
7401
7375
|
pairs.set(nestedPath, val);
|
|
@@ -7436,7 +7410,7 @@ var Player = function() {
|
|
|
7436
7410
|
{
|
|
7437
7411
|
/** Add match -> value mapping to the registry */ key: "set",
|
|
7438
7412
|
value: function set(match, value) {
|
|
7439
|
-
var matcher = typeof match === "object" ? createMatcher(match) : createBasicMatcher(match);
|
|
7413
|
+
var matcher = (typeof match === "undefined" ? "undefined" : _type_of(match)) === "object" ? createMatcher(match) : createBasicMatcher(match);
|
|
7440
7414
|
this.store.insert({
|
|
7441
7415
|
key: match,
|
|
7442
7416
|
value: value,
|
|
@@ -7849,7 +7823,7 @@ var Player = function() {
|
|
|
7849
7823
|
var parentBinding = resolved.parent();
|
|
7850
7824
|
var property = resolved.key();
|
|
7851
7825
|
var parentValue = this.get(parentBinding);
|
|
7852
|
-
var existedBeforeDelete = typeof parentValue === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
|
|
7826
|
+
var existedBeforeDelete = (typeof parentValue === "undefined" ? "undefined" : _type_of(parentValue)) === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
|
|
7853
7827
|
this.getModel().delete(resolved, options);
|
|
7854
7828
|
if (existedBeforeDelete && !this.get(resolved)) {
|
|
7855
7829
|
this.trash.add(resolved);
|
|
@@ -7953,7 +7927,7 @@ var Player = function() {
|
|
|
7953
7927
|
var expressionEvaluator;
|
|
7954
7928
|
var handleEval = function(exp) {
|
|
7955
7929
|
if (exp) {
|
|
7956
|
-
if (typeof exp === "object" && "exp" in exp) {
|
|
7930
|
+
if ((typeof exp === "undefined" ? "undefined" : _type_of(exp)) === "object" && "exp" in exp) {
|
|
7957
7931
|
expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp.exp);
|
|
7958
7932
|
} else {
|
|
7959
7933
|
expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp);
|
|
@@ -8217,7 +8191,7 @@ var Player = function() {
|
|
|
8217
8191
|
flow.hooks.beforeTransition.tap("player", function(state, transitionVal) {
|
|
8218
8192
|
var computedTransitionVal = state.transitions[transitionVal] ? transitionVal : "*";
|
|
8219
8193
|
if (state.onEnd && state.transitions[computedTransitionVal]) {
|
|
8220
|
-
if (
|
|
8194
|
+
if (_type_of(state.onEnd) === "object" && "exp" in state.onEnd) {
|
|
8221
8195
|
expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd.exp);
|
|
8222
8196
|
} else {
|
|
8223
8197
|
expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd);
|
|
@@ -8376,12 +8350,12 @@ var Player = function() {
|
|
|
8376
8350
|
{
|
|
8377
8351
|
key: "start",
|
|
8378
8352
|
value: function start(payload) {
|
|
8379
|
-
var _this = this;
|
|
8380
8353
|
return _async_to_generator(function() {
|
|
8381
|
-
var _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
|
|
8354
|
+
var _this, _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
|
|
8382
8355
|
return _ts_generator(this, function(_state) {
|
|
8383
8356
|
switch(_state.label){
|
|
8384
8357
|
case 0:
|
|
8358
|
+
_this = this;
|
|
8385
8359
|
ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
|
|
8386
8360
|
maybeUpdateState = function(newState) {
|
|
8387
8361
|
if (_this.state.ref !== ref) {
|
|
@@ -8391,7 +8365,7 @@ var Player = function() {
|
|
|
8391
8365
|
_this.setState(newState);
|
|
8392
8366
|
return newState;
|
|
8393
8367
|
};
|
|
8394
|
-
|
|
8368
|
+
this.setState({
|
|
8395
8369
|
status: "not-started",
|
|
8396
8370
|
ref: ref
|
|
8397
8371
|
});
|
|
@@ -8403,8 +8377,8 @@ var Player = function() {
|
|
|
8403
8377
|
,
|
|
8404
8378
|
4
|
|
8405
8379
|
]);
|
|
8406
|
-
_this_setupFlow =
|
|
8407
|
-
|
|
8380
|
+
_this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
|
|
8381
|
+
this.setState(_object_spread({
|
|
8408
8382
|
ref: ref
|
|
8409
8383
|
}, state));
|
|
8410
8384
|
start();
|
|
@@ -8449,7 +8423,7 @@ var Player = function() {
|
|
|
8449
8423
|
];
|
|
8450
8424
|
}
|
|
8451
8425
|
});
|
|
8452
|
-
})();
|
|
8426
|
+
}).call(this);
|
|
8453
8427
|
}
|
|
8454
8428
|
}
|
|
8455
8429
|
]);
|