@player-ui/player 0.13.0 → 0.14.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Player.native.js +117 -115
- 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
|
@@ -1436,22 +1436,6 @@ var Player = function() {
|
|
|
1436
1436
|
}
|
|
1437
1437
|
});
|
|
1438
1438
|
};
|
|
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
1439
|
var hasSomethingToResolve = function hasSomethingToResolve(str) {
|
|
1456
1440
|
return bindingResolveLookup(str) || expressionResolveLookup(str);
|
|
1457
1441
|
};
|
|
@@ -2719,6 +2703,7 @@ var Player = function() {
|
|
|
2719
2703
|
}
|
|
2720
2704
|
};
|
|
2721
2705
|
var identifier = function() {
|
|
2706
|
+
var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
2722
2707
|
if (!isIdentifierChar(ch)) {
|
|
2723
2708
|
return;
|
|
2724
2709
|
}
|
|
@@ -2729,6 +2714,14 @@ var Player = function() {
|
|
|
2729
2714
|
}
|
|
2730
2715
|
value += ch;
|
|
2731
2716
|
}
|
|
2717
|
+
if (allowBoolValue) {
|
|
2718
|
+
if (value === "true") {
|
|
2719
|
+
return toValue(true);
|
|
2720
|
+
}
|
|
2721
|
+
if (value === "false") {
|
|
2722
|
+
return toValue(false);
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2732
2725
|
if (value) {
|
|
2733
2726
|
var maybeNumber = Number(value);
|
|
2734
2727
|
value = isNaN(maybeNumber) ? value : maybeNumber;
|
|
@@ -2777,8 +2770,9 @@ var Player = function() {
|
|
|
2777
2770
|
}
|
|
2778
2771
|
};
|
|
2779
2772
|
var simpleSegment = function() {
|
|
2773
|
+
var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
2780
2774
|
var _nestedPath, _ref;
|
|
2781
|
-
return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier();
|
|
2775
|
+
return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier(allowBoolValue);
|
|
2782
2776
|
};
|
|
2783
2777
|
var segment = function() {
|
|
2784
2778
|
var segments = [];
|
|
@@ -2793,6 +2787,7 @@ var Player = function() {
|
|
|
2793
2787
|
return toConcatenatedNode(segments);
|
|
2794
2788
|
};
|
|
2795
2789
|
var optionallyQuotedSegment = function() {
|
|
2790
|
+
var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
2796
2791
|
whitespace();
|
|
2797
2792
|
if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
|
|
2798
2793
|
var singleQuote = ch === SINGLE_QUOTE;
|
|
@@ -2801,7 +2796,7 @@ var Player = function() {
|
|
|
2801
2796
|
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
2802
2797
|
return id;
|
|
2803
2798
|
}
|
|
2804
|
-
return simpleSegment();
|
|
2799
|
+
return simpleSegment(allowBoolValue);
|
|
2805
2800
|
};
|
|
2806
2801
|
var equals = function() {
|
|
2807
2802
|
if (ch !== EQUALS) {
|
|
@@ -2821,7 +2816,7 @@ var Player = function() {
|
|
|
2821
2816
|
whitespace();
|
|
2822
2817
|
if (equals()) {
|
|
2823
2818
|
whitespace();
|
|
2824
|
-
var second = optionallyQuotedSegment();
|
|
2819
|
+
var second = optionallyQuotedSegment(true);
|
|
2825
2820
|
value = toQuery(value, second);
|
|
2826
2821
|
whitespace();
|
|
2827
2822
|
}
|
|
@@ -3012,7 +3007,7 @@ var Player = function() {
|
|
|
3012
3007
|
appendPathSegments(getValueForNode(resolvedNode));
|
|
3013
3008
|
break;
|
|
3014
3009
|
case "Value":
|
|
3015
|
-
appendPathSegments(resolvedNode.value);
|
|
3010
|
+
appendPathSegments(typeof resolvedNode.value === "boolean" ? String(resolvedNode.value) : resolvedNode.value);
|
|
3016
3011
|
break;
|
|
3017
3012
|
case "Query":
|
|
3018
3013
|
{
|
|
@@ -4919,23 +4914,8 @@ var Player = function() {
|
|
|
4919
4914
|
function Parser() {
|
|
4920
4915
|
_class_call_check(this, Parser);
|
|
4921
4916
|
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(),
|
|
4917
|
+
onParseObject: new SyncWaterfallHook(),
|
|
4918
|
+
onCreateASTNode: new SyncWaterfallHook(),
|
|
4939
4919
|
parseNode: new SyncBailHook()
|
|
4940
4920
|
};
|
|
4941
4921
|
}
|
|
@@ -5078,20 +5058,14 @@ var Player = function() {
|
|
|
5078
5058
|
function Resolver(root, options) {
|
|
5079
5059
|
_class_call_check(this, Resolver);
|
|
5080
5060
|
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()
|
|
5061
|
+
skipResolve: new SyncWaterfallHook(),
|
|
5062
|
+
beforeUpdate: new SyncHook(),
|
|
5063
|
+
afterUpdate: new SyncHook(),
|
|
5064
|
+
resolveOptions: new SyncWaterfallHook(),
|
|
5065
|
+
beforeResolve: new SyncWaterfallHook(),
|
|
5066
|
+
resolve: new SyncWaterfallHook(),
|
|
5067
|
+
afterResolve: new SyncWaterfallHook(),
|
|
5068
|
+
afterNodeUpdate: new SyncHook()
|
|
5095
5069
|
};
|
|
5096
5070
|
this.root = root;
|
|
5097
5071
|
this.options = options;
|
|
@@ -5099,6 +5073,7 @@ var Player = function() {
|
|
|
5099
5073
|
this.ASTMap = /* @__PURE__ */ new Map();
|
|
5100
5074
|
this.logger = options.logger;
|
|
5101
5075
|
this.idCache = /* @__PURE__ */ new Set();
|
|
5076
|
+
this.AsyncIdMap = /* @__PURE__ */ new Map();
|
|
5102
5077
|
}
|
|
5103
5078
|
_create_class(Resolver, [
|
|
5104
5079
|
{
|
|
@@ -5109,13 +5084,27 @@ var Player = function() {
|
|
|
5109
5084
|
},
|
|
5110
5085
|
{
|
|
5111
5086
|
key: "update",
|
|
5112
|
-
value: function update(changes) {
|
|
5087
|
+
value: function update(changes, asyncChanges) {
|
|
5088
|
+
var _this = this;
|
|
5113
5089
|
this.hooks.beforeUpdate.call(changes);
|
|
5114
5090
|
var resolveCache = /* @__PURE__ */ new Map();
|
|
5115
5091
|
this.idCache.clear();
|
|
5116
5092
|
var prevASTMap = new Map(this.ASTMap);
|
|
5117
5093
|
this.ASTMap.clear();
|
|
5118
|
-
var
|
|
5094
|
+
var prevAsyncIdMap = new Map(this.AsyncIdMap);
|
|
5095
|
+
var nextAsyncIdMap = /* @__PURE__ */ new Map();
|
|
5096
|
+
asyncChanges === null || asyncChanges === void 0 ? void 0 : asyncChanges.forEach(function(id) {
|
|
5097
|
+
var current = prevAsyncIdMap.get(id);
|
|
5098
|
+
while(current && prevASTMap.has(current)){
|
|
5099
|
+
var next = prevASTMap.get(current);
|
|
5100
|
+
if (next && _this.resolveCache.has(next)) {
|
|
5101
|
+
_this.resolveCache.delete(next);
|
|
5102
|
+
}
|
|
5103
|
+
current = current.parent;
|
|
5104
|
+
}
|
|
5105
|
+
});
|
|
5106
|
+
var updated = this.computeTree(this.root, void 0, changes, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap, nextAsyncIdMap);
|
|
5107
|
+
this.AsyncIdMap = nextAsyncIdMap;
|
|
5119
5108
|
this.resolveCache = resolveCache;
|
|
5120
5109
|
this.hooks.afterUpdate.call(updated.value);
|
|
5121
5110
|
return updated.value;
|
|
@@ -5169,9 +5158,8 @@ var Player = function() {
|
|
|
5169
5158
|
},
|
|
5170
5159
|
{
|
|
5171
5160
|
key: "computeTree",
|
|
5172
|
-
value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
|
|
5161
|
+
value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap, nextAsyncIdMap) {
|
|
5173
5162
|
var _this = this;
|
|
5174
|
-
var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
|
|
5175
5163
|
var dependencyModel = new DependencyModel(options.data.model);
|
|
5176
5164
|
dependencyModel.trackSubset("core");
|
|
5177
5165
|
var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
|
|
@@ -5190,15 +5178,6 @@ var Player = function() {
|
|
|
5190
5178
|
var previousDeps = previousResult === null || previousResult === void 0 ? void 0 : previousResult.dependencies;
|
|
5191
5179
|
var dataChanged = caresAboutDataChanges(dataChanges, previousDeps);
|
|
5192
5180
|
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
5181
|
if (previousResult && shouldUseLastValue) {
|
|
5203
5182
|
var update2 = _object_spread_props(_object_spread({}, previousResult), {
|
|
5204
5183
|
updated: false
|
|
@@ -5210,6 +5189,30 @@ var Player = function() {
|
|
|
5210
5189
|
updated: false
|
|
5211
5190
|
});
|
|
5212
5191
|
cacheUpdate.set(AST, resolvedUpdate);
|
|
5192
|
+
if (resolvedUpdate.node.type === "async" /* Async */ ) {
|
|
5193
|
+
nextAsyncIdMap.set(resolvedUpdate.node.id, resolvedUpdate.node);
|
|
5194
|
+
}
|
|
5195
|
+
var _resolvedUpdate_node_asyncNodesResolved;
|
|
5196
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5197
|
+
try {
|
|
5198
|
+
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){
|
|
5199
|
+
var key = _step.value;
|
|
5200
|
+
nextAsyncIdMap.set(key, resolvedUpdate.node);
|
|
5201
|
+
}
|
|
5202
|
+
} catch (err) {
|
|
5203
|
+
_didIteratorError = true;
|
|
5204
|
+
_iteratorError = err;
|
|
5205
|
+
} finally{
|
|
5206
|
+
try {
|
|
5207
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5208
|
+
_iterator.return();
|
|
5209
|
+
}
|
|
5210
|
+
} finally{
|
|
5211
|
+
if (_didIteratorError) {
|
|
5212
|
+
throw _iteratorError;
|
|
5213
|
+
}
|
|
5214
|
+
}
|
|
5215
|
+
}
|
|
5213
5216
|
var handleChildNode = function(childNode) {
|
|
5214
5217
|
var _prevASTMap_get;
|
|
5215
5218
|
var originalChildNode = (_prevASTMap_get = prevASTMap.get(childNode)) !== null && _prevASTMap_get !== void 0 ? _prevASTMap_get : childNode;
|
|
@@ -5232,10 +5235,37 @@ var Player = function() {
|
|
|
5232
5235
|
repopulateASTMapFromCache(previousResult, node, rawParent);
|
|
5233
5236
|
return update2;
|
|
5234
5237
|
}
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
}
|
|
5238
|
-
|
|
5238
|
+
var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
|
|
5239
|
+
parent: partiallyResolvedParent
|
|
5240
|
+
});
|
|
5241
|
+
var _this_hooks_beforeResolve_call;
|
|
5242
|
+
var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
|
|
5243
|
+
type: "empty" /* Empty */
|
|
5244
|
+
};
|
|
5245
|
+
resolvedAST.parent = partiallyResolvedParent;
|
|
5246
|
+
if (resolvedAST.type === "async" /* Async */ ) {
|
|
5247
|
+
nextAsyncIdMap.set(resolvedAST.id, resolvedAST);
|
|
5248
|
+
}
|
|
5249
|
+
var _resolvedAST_asyncNodesResolved;
|
|
5250
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5251
|
+
try {
|
|
5252
|
+
for(var _iterator = ((_resolvedAST_asyncNodesResolved = resolvedAST.asyncNodesResolved) !== null && _resolvedAST_asyncNodesResolved !== void 0 ? _resolvedAST_asyncNodesResolved : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5253
|
+
var id = _step.value;
|
|
5254
|
+
nextAsyncIdMap.set(id, resolvedAST);
|
|
5255
|
+
}
|
|
5256
|
+
} catch (err) {
|
|
5257
|
+
_didIteratorError = true;
|
|
5258
|
+
_iteratorError = err;
|
|
5259
|
+
} finally{
|
|
5260
|
+
try {
|
|
5261
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5262
|
+
_iterator.return();
|
|
5263
|
+
}
|
|
5264
|
+
} finally{
|
|
5265
|
+
if (_didIteratorError) {
|
|
5266
|
+
throw _iteratorError;
|
|
5267
|
+
}
|
|
5268
|
+
}
|
|
5239
5269
|
}
|
|
5240
5270
|
resolveOptions.node = resolvedAST;
|
|
5241
5271
|
this.ASTMap.set(resolvedAST, node);
|
|
@@ -5249,7 +5279,7 @@ var Player = function() {
|
|
|
5249
5279
|
if ("children" in resolvedAST) {
|
|
5250
5280
|
var _resolvedAST_children;
|
|
5251
5281
|
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);
|
|
5282
|
+
var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
|
|
5253
5283
|
var childTreeDeps = computedChildTree.dependencies, childNode = computedChildTree.node, childUpdated = computedChildTree.updated, childValue = computedChildTree.value;
|
|
5254
5284
|
childTreeDeps.forEach(function(binding) {
|
|
5255
5285
|
return childDependencies.add(binding);
|
|
@@ -5270,40 +5300,18 @@ var Player = function() {
|
|
|
5270
5300
|
resolvedAST.children = newChildren;
|
|
5271
5301
|
} else if (resolvedAST.type === "multi-node" /* MultiNode */ ) {
|
|
5272
5302
|
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);
|
|
5303
|
+
var rawParentToPassIn = node;
|
|
5304
|
+
resolvedAST.values = resolvedAST.values.map(function(mValue) {
|
|
5305
|
+
var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
|
|
5281
5306
|
if (mTree.value !== void 0 && mTree.value !== null) {
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
}
|
|
5285
|
-
|
|
5286
|
-
|
|
5307
|
+
mTree.dependencies.forEach(function(bindingDep) {
|
|
5308
|
+
return childDependencies.add(bindingDep);
|
|
5309
|
+
});
|
|
5310
|
+
updated = updated || mTree.updated;
|
|
5311
|
+
childValue.push(mTree.value);
|
|
5287
5312
|
}
|
|
5288
|
-
mTree.dependencies.forEach(function(bindingDep) {
|
|
5289
|
-
return childDependencies.add(bindingDep);
|
|
5290
|
-
});
|
|
5291
|
-
updated = updated || mTree.updated;
|
|
5292
5313
|
return mTree.node;
|
|
5293
5314
|
});
|
|
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
5315
|
resolved = childValue;
|
|
5308
5316
|
}
|
|
5309
5317
|
childDependencies.forEach(function(bindingDep) {
|
|
@@ -5324,7 +5332,7 @@ var Player = function() {
|
|
|
5324
5332
|
value: resolved,
|
|
5325
5333
|
dependencies: /* @__PURE__ */ new Set(_to_consumable_array(dependencyModel.getDependencies()).concat(_to_consumable_array(childDependencies)))
|
|
5326
5334
|
};
|
|
5327
|
-
this.hooks.afterNodeUpdate.call(node,
|
|
5335
|
+
this.hooks.afterNodeUpdate.call(node, rawParent, update);
|
|
5328
5336
|
cacheUpdate.set(node, update);
|
|
5329
5337
|
return update;
|
|
5330
5338
|
}
|
|
@@ -5332,15 +5340,6 @@ var Player = function() {
|
|
|
5332
5340
|
]);
|
|
5333
5341
|
return Resolver;
|
|
5334
5342
|
}();
|
|
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
5343
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/view.ts
|
|
5345
5344
|
var CrossfieldProvider = /*#__PURE__*/ function() {
|
|
5346
5345
|
function CrossfieldProvider(initialView, parser, logger) {
|
|
@@ -5409,9 +5408,11 @@ var Player = function() {
|
|
|
5409
5408
|
_create_class(ViewInstance, [
|
|
5410
5409
|
{
|
|
5411
5410
|
key: "updateAsync",
|
|
5412
|
-
value: function updateAsync() {
|
|
5411
|
+
value: function updateAsync(asyncNode) {
|
|
5413
5412
|
var _this_resolver;
|
|
5414
|
-
var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update()
|
|
5413
|
+
var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update(/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set([
|
|
5414
|
+
asyncNode
|
|
5415
|
+
]));
|
|
5415
5416
|
this.lastUpdate = update;
|
|
5416
5417
|
this.hooks.onUpdate.call(update);
|
|
5417
5418
|
}
|
|
@@ -5530,11 +5531,12 @@ var Player = function() {
|
|
|
5530
5531
|
*
|
|
5531
5532
|
* @param id - the id of async node. It should be identical for each async node
|
|
5532
5533
|
*/ function asyncNode(id) {
|
|
5533
|
-
var flatten2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
5534
|
+
var flatten2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true, onValueReceived = arguments.length > 2 ? arguments[2] : void 0;
|
|
5534
5535
|
return {
|
|
5535
5536
|
id: id,
|
|
5536
5537
|
type: "async" /* Async */ ,
|
|
5537
5538
|
flatten: flatten2,
|
|
5539
|
+
onValueReceived: onValueReceived,
|
|
5538
5540
|
value: {
|
|
5539
5541
|
type: "value" /* Value */ ,
|
|
5540
5542
|
value: {
|
|
@@ -6087,7 +6089,7 @@ var Player = function() {
|
|
|
6087
6089
|
key: "applyParser",
|
|
6088
6090
|
value: function applyParser(parser) {
|
|
6089
6091
|
parser.hooks.parseNode.tap("multi-node", function(obj, nodeType, options, childOptions) {
|
|
6090
|
-
if (childOptions
|
|
6092
|
+
if ((childOptions === void 0 || !hasTemplateKey(childOptions.key)) && Array.isArray(obj)) {
|
|
6091
6093
|
var values = obj.map(function(childVal) {
|
|
6092
6094
|
return parser.parseObject(childVal, "value" /* Value */ , options);
|
|
6093
6095
|
}).filter(function(child) {
|
|
@@ -6098,7 +6100,7 @@ var Player = function() {
|
|
|
6098
6100
|
}
|
|
6099
6101
|
var multiNode = parser.createASTNode({
|
|
6100
6102
|
type: "multi-node" /* MultiNode */ ,
|
|
6101
|
-
override: !hasTemplateValues(childOptions.parentObj, childOptions.key),
|
|
6103
|
+
override: childOptions !== void 0 && !hasTemplateValues(childOptions.parentObj, childOptions.key),
|
|
6102
6104
|
values: values
|
|
6103
6105
|
}, obj);
|
|
6104
6106
|
if (!multiNode) {
|
|
@@ -6109,7 +6111,7 @@ var Player = function() {
|
|
|
6109
6111
|
v.parent = multiNode;
|
|
6110
6112
|
});
|
|
6111
6113
|
}
|
|
6112
|
-
return [
|
|
6114
|
+
return childOptions === void 0 ? multiNode : [
|
|
6113
6115
|
{
|
|
6114
6116
|
path: _to_consumable_array(childOptions.path).concat([
|
|
6115
6117
|
childOptions.key
|