@player-ui/common-expressions-plugin 0.11.1 → 0.11.2-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.
|
@@ -1413,6 +1413,22 @@ var CommonExpressionsPlugin = function() {
|
|
|
1413
1413
|
}
|
|
1414
1414
|
});
|
|
1415
1415
|
};
|
|
1416
|
+
var unpackNode = function unpackNode(item) {
|
|
1417
|
+
var _item_children_, _item_children, _item_children_1, _item_children1;
|
|
1418
|
+
var unpacked = [];
|
|
1419
|
+
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" && ((_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) {
|
|
1420
|
+
var _item_children__value_children_, _item_children__value_children, _item_children_2, _item_children2;
|
|
1421
|
+
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") {
|
|
1422
|
+
var _item_children__value_children_1, _item_children__value_children1, _item_children_3, _item_children3;
|
|
1423
|
+
((_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) {
|
|
1424
|
+
unpacked.push(value);
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
} else {
|
|
1428
|
+
unpacked.push(item);
|
|
1429
|
+
}
|
|
1430
|
+
return unpacked;
|
|
1431
|
+
};
|
|
1416
1432
|
var hasSomethingToResolve = function hasSomethingToResolve(str) {
|
|
1417
1433
|
return bindingResolveLookup(str) || expressionResolveLookup(str);
|
|
1418
1434
|
};
|
|
@@ -4509,15 +4525,6 @@ var CommonExpressionsPlugin = function() {
|
|
|
4509
4525
|
]);
|
|
4510
4526
|
return Parser;
|
|
4511
4527
|
}();
|
|
4512
|
-
function unpackAndPush(item, initial) {
|
|
4513
|
-
if (item.asset.values && Array.isArray(item.asset.values)) {
|
|
4514
|
-
item.asset.values.forEach(function(i) {
|
|
4515
|
-
unpackAndPush(i, initial);
|
|
4516
|
-
});
|
|
4517
|
-
} else {
|
|
4518
|
-
initial.push(item);
|
|
4519
|
-
}
|
|
4520
|
-
}
|
|
4521
4528
|
var withContext = function(model) {
|
|
4522
4529
|
return {
|
|
4523
4530
|
get: function(binding, options) {
|
|
@@ -4640,7 +4647,7 @@ var CommonExpressionsPlugin = function() {
|
|
|
4640
4647
|
key: "computeTree",
|
|
4641
4648
|
value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
|
|
4642
4649
|
var _this = this;
|
|
4643
|
-
var _partiallyResolvedParent_parent;
|
|
4650
|
+
var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
|
|
4644
4651
|
var dependencyModel = new DependencyModel(options.data.model);
|
|
4645
4652
|
dependencyModel.trackSubset("core");
|
|
4646
4653
|
var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
|
|
@@ -4666,7 +4673,8 @@ var CommonExpressionsPlugin = function() {
|
|
|
4666
4673
|
var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
|
|
4667
4674
|
type: "empty"
|
|
4668
4675
|
};
|
|
4669
|
-
var
|
|
4676
|
+
var isNestedMultiNodeWithAsync = resolvedAST.type === "multi-node" && (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" && partiallyResolvedParent.parent.type === "value" && ((_resolvedAST_parent = resolvedAST.parent) === null || _resolvedAST_parent === void 0 ? void 0 : _resolvedAST_parent.type) === "asset" && resolvedAST.parent.value.id.includes("async");
|
|
4677
|
+
var isNestedMultiNode = resolvedAST.type === "multi-node" && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent1 = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent1 === void 0 ? void 0 : _partiallyResolvedParent_parent1.type) === "multi-node" && partiallyResolvedParent.type === "value";
|
|
4670
4678
|
if (previousResult && shouldUseLastValue) {
|
|
4671
4679
|
var update2 = _object_spread_props(_object_spread({}, previousResult), {
|
|
4672
4680
|
updated: false
|
|
@@ -4700,7 +4708,11 @@ var CommonExpressionsPlugin = function() {
|
|
|
4700
4708
|
repopulateASTMapFromCache(previousResult, node, rawParent);
|
|
4701
4709
|
return update2;
|
|
4702
4710
|
}
|
|
4703
|
-
|
|
4711
|
+
if (isNestedMultiNodeWithAsync) {
|
|
4712
|
+
resolvedAST.parent = partiallyResolvedParent.parent;
|
|
4713
|
+
} else {
|
|
4714
|
+
resolvedAST.parent = partiallyResolvedParent;
|
|
4715
|
+
}
|
|
4704
4716
|
resolveOptions.node = resolvedAST;
|
|
4705
4717
|
this.ASTMap.set(resolvedAST, node);
|
|
4706
4718
|
var resolved = this.hooks.resolve.call(void 0, resolvedAST, resolveOptions);
|
|
@@ -4735,6 +4747,11 @@ var CommonExpressionsPlugin = function() {
|
|
|
4735
4747
|
} else if (resolvedAST.type === "multi-node") {
|
|
4736
4748
|
var childValue = [];
|
|
4737
4749
|
var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
|
|
4750
|
+
var hasAsync = resolvedAST.values.map(function(value, index) {
|
|
4751
|
+
return value.type === "async" ? index : -1;
|
|
4752
|
+
}).filter(function(index) {
|
|
4753
|
+
return index !== -1;
|
|
4754
|
+
});
|
|
4738
4755
|
var newValues = resolvedAST.values.map(function(mValue) {
|
|
4739
4756
|
var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
|
|
4740
4757
|
if (mTree.value !== void 0 && mTree.value !== null) {
|
|
@@ -4750,7 +4767,19 @@ var CommonExpressionsPlugin = function() {
|
|
|
4750
4767
|
updated = updated || mTree.updated;
|
|
4751
4768
|
return mTree.node;
|
|
4752
4769
|
});
|
|
4753
|
-
|
|
4770
|
+
if (hasAsync.length > 0) {
|
|
4771
|
+
var copy = newValues;
|
|
4772
|
+
hasAsync.forEach(function(index) {
|
|
4773
|
+
var _copy;
|
|
4774
|
+
if (copy[index]) (_copy = copy).splice.apply(_copy, [
|
|
4775
|
+
index,
|
|
4776
|
+
1
|
|
4777
|
+
].concat(_to_consumable_array(unpackNode(copy[index]))));
|
|
4778
|
+
});
|
|
4779
|
+
resolvedAST.values = copy;
|
|
4780
|
+
} else {
|
|
4781
|
+
resolvedAST.values = newValues;
|
|
4782
|
+
}
|
|
4754
4783
|
resolved = childValue;
|
|
4755
4784
|
}
|
|
4756
4785
|
childDependencies.forEach(function(bindingDep) {
|
|
@@ -4779,6 +4808,15 @@ var CommonExpressionsPlugin = function() {
|
|
|
4779
4808
|
]);
|
|
4780
4809
|
return Resolver;
|
|
4781
4810
|
}();
|
|
4811
|
+
function unpackAndPush(item, initial) {
|
|
4812
|
+
if (item.asset.values && Array.isArray(item.asset.values)) {
|
|
4813
|
+
item.asset.values.forEach(function(i) {
|
|
4814
|
+
unpackAndPush(i, initial);
|
|
4815
|
+
});
|
|
4816
|
+
} else {
|
|
4817
|
+
initial.push(item);
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4782
4820
|
var CrossfieldProvider = /*#__PURE__*/ function() {
|
|
4783
4821
|
function CrossfieldProvider(initialView, parser, logger) {
|
|
4784
4822
|
_class_call_check(this, CrossfieldProvider);
|