@player-ui/async-node-plugin 0.10.4-next.2 → 0.10.4-next.3

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.
@@ -2038,6 +2038,9 @@ var AsyncNodePlugin = function() {
2038
2038
  },
2039
2039
  AsyncNodePluginPlugin: function() {
2040
2040
  return AsyncNodePluginPlugin;
2041
+ },
2042
+ asyncTransform: function() {
2043
+ return asyncTransform;
2041
2044
  }
2042
2045
  });
2043
2046
  var InterceptionManager = /*#__PURE__*/ function() {
@@ -4324,18 +4327,18 @@ var AsyncNodePlugin = function() {
4324
4327
  ]);
4325
4328
  return ValidatorRegistry;
4326
4329
  }();
4327
- var NodeType = /* @__PURE__ */ function(NodeType2) {
4328
- NodeType2["Asset"] = "asset";
4329
- NodeType2["View"] = "view";
4330
- NodeType2["Applicability"] = "applicability";
4331
- NodeType2["Template"] = "template";
4332
- NodeType2["Value"] = "value";
4333
- NodeType2["MultiNode"] = "multi-node";
4334
- NodeType2["Switch"] = "switch";
4335
- NodeType2["Async"] = "async";
4336
- NodeType2["Unknown"] = "unknown";
4337
- NodeType2["Empty"] = "empty";
4338
- return NodeType2;
4330
+ var NodeType = /* @__PURE__ */ function(NodeType22) {
4331
+ NodeType22["Asset"] = "asset";
4332
+ NodeType22["View"] = "view";
4333
+ NodeType22["Applicability"] = "applicability";
4334
+ NodeType22["Template"] = "template";
4335
+ NodeType22["Value"] = "value";
4336
+ NodeType22["MultiNode"] = "multi-node";
4337
+ NodeType22["Switch"] = "switch";
4338
+ NodeType22["Async"] = "async";
4339
+ NodeType22["Unknown"] = "unknown";
4340
+ NodeType22["Empty"] = "empty";
4341
+ return NodeType22;
4339
4342
  }(NodeType || {});
4340
4343
  var EMPTY_NODE = {
4341
4344
  type: "empty"
@@ -4473,6 +4476,15 @@ var AsyncNodePlugin = function() {
4473
4476
  ]);
4474
4477
  return Parser;
4475
4478
  }();
4479
+ function unpackAndPush(item, initial) {
4480
+ if (Array.isArray(item)) {
4481
+ item.forEach(function(i) {
4482
+ unpackAndPush(i, initial);
4483
+ });
4484
+ } else {
4485
+ initial.push(item);
4486
+ }
4487
+ }
4476
4488
  var withContext = function(model) {
4477
4489
  return {
4478
4490
  get: function(binding, options) {
@@ -4693,7 +4705,13 @@ var AsyncNodePlugin = function() {
4693
4705
  var newValues = resolvedAST.values.map(function(mValue) {
4694
4706
  var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
4695
4707
  if (mTree.value !== void 0 && mTree.value !== null) {
4696
- childValue.push(mTree.value);
4708
+ if (mValue.type === "async" && mValue.flatten && mTree.value.asset && Array.isArray(mTree.value.asset.values)) {
4709
+ mTree.value.asset.values.forEach(function(v) {
4710
+ unpackAndPush(v, childValue);
4711
+ });
4712
+ } else {
4713
+ childValue.push(mTree.value);
4714
+ }
4697
4715
  }
4698
4716
  mTree.dependencies.forEach(function(bindingDep) {
4699
4717
  return childDependencies.add(bindingDep);
@@ -4848,6 +4866,112 @@ var AsyncNodePlugin = function() {
4848
4866
  ]);
4849
4867
  return ViewInstance;
4850
4868
  }();
4869
+ var Builder = /*#__PURE__*/ function() {
4870
+ function _Builder() {
4871
+ _class_call_check(this, _Builder);
4872
+ }
4873
+ _create_class(_Builder, null, [
4874
+ {
4875
+ key: "asset",
4876
+ value: /**
4877
+ * Creates an asset node
4878
+ *
4879
+ * @param value - the value to put in the asset node
4880
+ */ function asset(value) {
4881
+ return {
4882
+ type: "asset",
4883
+ value: value
4884
+ };
4885
+ }
4886
+ },
4887
+ {
4888
+ key: "assetWrapper",
4889
+ value: function assetWrapper(value) {
4890
+ var valueNode = _Builder.value();
4891
+ _Builder.addChild(valueNode, "asset", value);
4892
+ return valueNode;
4893
+ }
4894
+ },
4895
+ {
4896
+ key: "value",
4897
+ value: /**
4898
+ * Creates a value node
4899
+ *
4900
+ * @param v - The object to put in the value node
4901
+ */ function value(v) {
4902
+ return {
4903
+ type: "value",
4904
+ value: v
4905
+ };
4906
+ }
4907
+ },
4908
+ {
4909
+ key: "multiNode",
4910
+ value: /**
4911
+ * Creates a multiNode and associates the multiNode as the parent
4912
+ * of all the value nodes
4913
+ *
4914
+ * @param values - the value, applicability or async nodes to put in the multinode
4915
+ */ function multiNode() {
4916
+ for(var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++){
4917
+ values[_key] = arguments[_key];
4918
+ }
4919
+ var m = {
4920
+ type: "multi-node",
4921
+ override: true,
4922
+ values: values
4923
+ };
4924
+ values.forEach(function(v) {
4925
+ v.parent = m;
4926
+ });
4927
+ return m;
4928
+ }
4929
+ },
4930
+ {
4931
+ key: "asyncNode",
4932
+ value: /**
4933
+ * Creates an async node
4934
+ *
4935
+ * @param id - the id of async node. It should be identical for each async node
4936
+ */ function asyncNode(id) {
4937
+ var flatten2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
4938
+ return {
4939
+ id: id,
4940
+ type: "async",
4941
+ flatten: flatten2,
4942
+ value: {
4943
+ type: "value",
4944
+ value: {
4945
+ id: id
4946
+ }
4947
+ }
4948
+ };
4949
+ }
4950
+ },
4951
+ {
4952
+ key: "addChild",
4953
+ value: /**
4954
+ * Adds a child node to a node
4955
+ *
4956
+ * @param node - The node to add a child to
4957
+ * @param path - The path at which to add the child
4958
+ * @param child - The child node
4959
+ */ function addChild(node, path, child) {
4960
+ child.parent = node;
4961
+ var newChild = {
4962
+ path: Array.isArray(path) ? path : [
4963
+ path
4964
+ ],
4965
+ value: child
4966
+ };
4967
+ node.children = node.children || [];
4968
+ node.children.push(newChild);
4969
+ return node;
4970
+ }
4971
+ }
4972
+ ]);
4973
+ return _Builder;
4974
+ }();
4851
4975
  var TemplatePlugin = /*#__PURE__*/ function() {
4852
4976
  function TemplatePlugin(options) {
4853
4977
  _class_call_check(this, TemplatePlugin);
@@ -7485,6 +7609,28 @@ var AsyncNodePlugin = function() {
7485
7609
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/index.ts
7486
7610
  var import_queue_microtask2 = __toESM(require_queue_microtask());
7487
7611
  var import_timm10 = __toESM(require_timm());
7612
+ // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/transform.ts
7613
+ var asyncTransform = function(assetId, wrapperAssetType, asset, flatten2) {
7614
+ var id = "async-" + assetId;
7615
+ var asyncNode = Builder.asyncNode(id, flatten2);
7616
+ var multiNode;
7617
+ var assetNode;
7618
+ if (asset) {
7619
+ assetNode = Builder.assetWrapper(asset);
7620
+ multiNode = Builder.multiNode(assetNode, asyncNode);
7621
+ } else {
7622
+ multiNode = Builder.multiNode(asyncNode);
7623
+ }
7624
+ var wrapperAsset = Builder.asset({
7625
+ id: wrapperAssetType + "-" + id,
7626
+ type: wrapperAssetType
7627
+ });
7628
+ Builder.addChild(wrapperAsset, [
7629
+ "values"
7630
+ ], multiNode);
7631
+ return wrapperAsset;
7632
+ };
7633
+ // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/index.ts
7488
7634
  var AsyncNodePlugin = /*#__PURE__*/ function() {
7489
7635
  function AsyncNodePlugin(options) {
7490
7636
  var _this = this;