@player-ui/async-node-plugin 0.12.0--canary.642.22862 → 0.12.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.
@@ -1405,6 +1405,22 @@ var AsyncNodePlugin = 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
  };
@@ -4475,15 +4491,6 @@ var AsyncNodePlugin = function() {
4475
4491
  ]);
4476
4492
  return Parser;
4477
4493
  }();
4478
- function unpackAndPush(item, initial) {
4479
- if (item.asset.values && Array.isArray(item.asset.values)) {
4480
- item.asset.values.forEach(function(i) {
4481
- unpackAndPush(i, initial);
4482
- });
4483
- } else {
4484
- initial.push(item);
4485
- }
4486
- }
4487
4494
  var withContext = function(model) {
4488
4495
  return {
4489
4496
  get: function(binding, options) {
@@ -4606,7 +4613,7 @@ var AsyncNodePlugin = function() {
4606
4613
  key: "computeTree",
4607
4614
  value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
4608
4615
  var _this = this;
4609
- var _partiallyResolvedParent_parent;
4616
+ var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
4610
4617
  var dependencyModel = new DependencyModel(options.data.model);
4611
4618
  dependencyModel.trackSubset("core");
4612
4619
  var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
@@ -4632,7 +4639,8 @@ var AsyncNodePlugin = function() {
4632
4639
  var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4633
4640
  type: "empty"
4634
4641
  };
4635
- 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";
4642
+ 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");
4643
+ 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";
4636
4644
  if (previousResult && shouldUseLastValue) {
4637
4645
  var update2 = _object_spread_props(_object_spread({}, previousResult), {
4638
4646
  updated: false
@@ -4666,7 +4674,11 @@ var AsyncNodePlugin = function() {
4666
4674
  repopulateASTMapFromCache(previousResult, node, rawParent);
4667
4675
  return update2;
4668
4676
  }
4669
- resolvedAST.parent = partiallyResolvedParent;
4677
+ if (isNestedMultiNodeWithAsync) {
4678
+ resolvedAST.parent = partiallyResolvedParent.parent;
4679
+ } else {
4680
+ resolvedAST.parent = partiallyResolvedParent;
4681
+ }
4670
4682
  resolveOptions.node = resolvedAST;
4671
4683
  this.ASTMap.set(resolvedAST, node);
4672
4684
  var resolved = this.hooks.resolve.call(void 0, resolvedAST, resolveOptions);
@@ -4701,6 +4713,11 @@ var AsyncNodePlugin = function() {
4701
4713
  } else if (resolvedAST.type === "multi-node") {
4702
4714
  var childValue = [];
4703
4715
  var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
4716
+ var hasAsync = resolvedAST.values.map(function(value, index) {
4717
+ return value.type === "async" ? index : -1;
4718
+ }).filter(function(index) {
4719
+ return index !== -1;
4720
+ });
4704
4721
  var newValues = resolvedAST.values.map(function(mValue) {
4705
4722
  var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
4706
4723
  if (mTree.value !== void 0 && mTree.value !== null) {
@@ -4716,7 +4733,19 @@ var AsyncNodePlugin = function() {
4716
4733
  updated = updated || mTree.updated;
4717
4734
  return mTree.node;
4718
4735
  });
4719
- resolvedAST.values = newValues;
4736
+ if (hasAsync.length > 0) {
4737
+ var copy = newValues;
4738
+ hasAsync.forEach(function(index) {
4739
+ var _copy;
4740
+ if (copy[index]) (_copy = copy).splice.apply(_copy, [
4741
+ index,
4742
+ 1
4743
+ ].concat(_to_consumable_array(unpackNode(copy[index]))));
4744
+ });
4745
+ resolvedAST.values = copy;
4746
+ } else {
4747
+ resolvedAST.values = newValues;
4748
+ }
4720
4749
  resolved = childValue;
4721
4750
  }
4722
4751
  childDependencies.forEach(function(bindingDep) {
@@ -4745,6 +4774,15 @@ var AsyncNodePlugin = function() {
4745
4774
  ]);
4746
4775
  return Resolver;
4747
4776
  }();
4777
+ function unpackAndPush(item, initial) {
4778
+ if (item.asset.values && Array.isArray(item.asset.values)) {
4779
+ item.asset.values.forEach(function(i) {
4780
+ unpackAndPush(i, initial);
4781
+ });
4782
+ } else {
4783
+ initial.push(item);
4784
+ }
4785
+ }
4748
4786
  var CrossfieldProvider = /*#__PURE__*/ function() {
4749
4787
  function CrossfieldProvider(initialView, parser, logger) {
4750
4788
  _class_call_check(this, CrossfieldProvider);
@@ -7275,8 +7313,8 @@ var AsyncNodePlugin = function() {
7275
7313
  ]);
7276
7314
  return DefaultViewPlugin;
7277
7315
  }();
7278
- var PLAYER_VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "__VERSION__";
7279
- var COMMIT = typeof __GIT_COMMIT__ !== "undefined" ? __GIT_COMMIT__ : "__GIT_COMMIT__";
7316
+ var PLAYER_VERSION = "__VERSION__";
7317
+ var COMMIT = "__GIT_COMMIT__";
7280
7318
  var _Player = /*#__PURE__*/ function() {
7281
7319
  function _Player2(config) {
7282
7320
  var _this = this;