@player-ui/beacon-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.
@@ -1405,6 +1405,22 @@ var BeaconPlugin = function() {
1405
1405
  }
1406
1406
  });
1407
1407
  };
1408
+ var unpackNode = function unpackNode(item) {
1409
+ var _item_children_, _item_children, _item_children_1, _item_children1;
1410
+ var unpacked = [];
1411
+ 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) {
1412
+ var _item_children__value_children_, _item_children__value_children, _item_children_2, _item_children2;
1413
+ 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") {
1414
+ var _item_children__value_children_1, _item_children__value_children1, _item_children_3, _item_children3;
1415
+ ((_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) {
1416
+ unpacked.push(value);
1417
+ });
1418
+ }
1419
+ } else {
1420
+ unpacked.push(item);
1421
+ }
1422
+ return unpacked;
1423
+ };
1408
1424
  var hasSomethingToResolve = function hasSomethingToResolve(str) {
1409
1425
  return bindingResolveLookup(str) || expressionResolveLookup(str);
1410
1426
  };
@@ -4479,15 +4495,6 @@ var BeaconPlugin = function() {
4479
4495
  ]);
4480
4496
  return Parser;
4481
4497
  }();
4482
- function unpackAndPush(item, initial) {
4483
- if (item.asset.values && Array.isArray(item.asset.values)) {
4484
- item.asset.values.forEach(function(i) {
4485
- unpackAndPush(i, initial);
4486
- });
4487
- } else {
4488
- initial.push(item);
4489
- }
4490
- }
4491
4498
  var withContext = function(model) {
4492
4499
  return {
4493
4500
  get: function(binding, options) {
@@ -4610,7 +4617,7 @@ var BeaconPlugin = function() {
4610
4617
  key: "computeTree",
4611
4618
  value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
4612
4619
  var _this = this;
4613
- var _partiallyResolvedParent_parent;
4620
+ var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
4614
4621
  var dependencyModel = new DependencyModel(options.data.model);
4615
4622
  dependencyModel.trackSubset("core");
4616
4623
  var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
@@ -4636,7 +4643,8 @@ var BeaconPlugin = function() {
4636
4643
  var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4637
4644
  type: "empty"
4638
4645
  };
4639
- var isNestedMultiNode = resolvedAST.type === "multi-node" && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent === void 0 ? void 0 : _partiallyResolvedParent_parent.type) === "multi-node" && partiallyResolvedParent.type === "value";
4646
+ 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");
4647
+ 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";
4640
4648
  if (previousResult && shouldUseLastValue) {
4641
4649
  var update2 = _object_spread_props(_object_spread({}, previousResult), {
4642
4650
  updated: false
@@ -4670,7 +4678,11 @@ var BeaconPlugin = function() {
4670
4678
  repopulateASTMapFromCache(previousResult, node, rawParent);
4671
4679
  return update2;
4672
4680
  }
4673
- resolvedAST.parent = partiallyResolvedParent;
4681
+ if (isNestedMultiNodeWithAsync) {
4682
+ resolvedAST.parent = partiallyResolvedParent.parent;
4683
+ } else {
4684
+ resolvedAST.parent = partiallyResolvedParent;
4685
+ }
4674
4686
  resolveOptions.node = resolvedAST;
4675
4687
  this.ASTMap.set(resolvedAST, node);
4676
4688
  var resolved = this.hooks.resolve.call(void 0, resolvedAST, resolveOptions);
@@ -4705,6 +4717,11 @@ var BeaconPlugin = function() {
4705
4717
  } else if (resolvedAST.type === "multi-node") {
4706
4718
  var childValue = [];
4707
4719
  var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
4720
+ var hasAsync = resolvedAST.values.map(function(value, index) {
4721
+ return value.type === "async" ? index : -1;
4722
+ }).filter(function(index) {
4723
+ return index !== -1;
4724
+ });
4708
4725
  var newValues = resolvedAST.values.map(function(mValue) {
4709
4726
  var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
4710
4727
  if (mTree.value !== void 0 && mTree.value !== null) {
@@ -4720,7 +4737,19 @@ var BeaconPlugin = function() {
4720
4737
  updated = updated || mTree.updated;
4721
4738
  return mTree.node;
4722
4739
  });
4723
- resolvedAST.values = newValues;
4740
+ if (hasAsync.length > 0) {
4741
+ var copy = newValues;
4742
+ hasAsync.forEach(function(index) {
4743
+ var _copy;
4744
+ if (copy[index]) (_copy = copy).splice.apply(_copy, [
4745
+ index,
4746
+ 1
4747
+ ].concat(_to_consumable_array(unpackNode(copy[index]))));
4748
+ });
4749
+ resolvedAST.values = copy;
4750
+ } else {
4751
+ resolvedAST.values = newValues;
4752
+ }
4724
4753
  resolved = childValue;
4725
4754
  }
4726
4755
  childDependencies.forEach(function(bindingDep) {
@@ -4749,6 +4778,15 @@ var BeaconPlugin = function() {
4749
4778
  ]);
4750
4779
  return Resolver;
4751
4780
  }();
4781
+ function unpackAndPush(item, initial) {
4782
+ if (item.asset.values && Array.isArray(item.asset.values)) {
4783
+ item.asset.values.forEach(function(i) {
4784
+ unpackAndPush(i, initial);
4785
+ });
4786
+ } else {
4787
+ initial.push(item);
4788
+ }
4789
+ }
4752
4790
  var CrossfieldProvider = /*#__PURE__*/ function() {
4753
4791
  function CrossfieldProvider(initialView, parser, logger) {
4754
4792
  _class_call_check(this, CrossfieldProvider);