@player-ui/async-node-plugin 0.10.5--canary.613.21050 → 0.10.5--canary.614.21122

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.
@@ -1639,7 +1639,7 @@ var AsyncNodePlugin = function() {
1639
1639
  });
1640
1640
  exports.clone = clone2;
1641
1641
  exports.addLast = addLast2;
1642
- exports.addFirst = addFirst;
1642
+ exports.addFirst = addFirst2;
1643
1643
  exports.removeLast = removeLast;
1644
1644
  exports.removeFirst = removeFirst;
1645
1645
  exports.insert = insert;
@@ -1689,7 +1689,7 @@ var AsyncNodePlugin = function() {
1689
1689
  val
1690
1690
  ]);
1691
1691
  }
1692
- function addFirst(array, val) {
1692
+ function addFirst2(array, val) {
1693
1693
  if (Array.isArray(val)) return val.concat(array);
1694
1694
  return [
1695
1695
  val
@@ -1899,7 +1899,7 @@ var AsyncNodePlugin = function() {
1899
1899
  var timm = {
1900
1900
  clone: clone2,
1901
1901
  addLast: addLast2,
1902
- addFirst: addFirst,
1902
+ addFirst: addFirst2,
1903
1903
  removeLast: removeLast,
1904
1904
  removeFirst: removeFirst,
1905
1905
  insert: insert,
@@ -4686,9 +4686,18 @@ var AsyncNodePlugin = function() {
4686
4686
  return childDependencies.add(binding);
4687
4687
  });
4688
4688
  if (childValue) {
4689
+ if (childNode.type === "template") {
4690
+ if (childNode.placement === "append") {
4691
+ var arr = (0, import_timm4.addLast)(dlv_es_default(resolved, child.path, []), childValue);
4692
+ resolved = (0, import_timm4.setIn)(resolved, child.path, arr);
4693
+ } else if (childNode.placement === "prepend") {
4694
+ var arr1 = (0, import_timm4.addFirst)(dlv_es_default(resolved, child.path, []), childValue);
4695
+ resolved = (0, import_timm4.setIn)(resolved, child.path, arr1);
4696
+ }
4697
+ }
4689
4698
  if (childNode.type === "multi-node" && !childNode.override) {
4690
- var arr = (0, import_timm4.addLast)(dlv_es_default(resolved, child.path, []), childValue);
4691
- resolved = (0, import_timm4.setIn)(resolved, child.path, arr);
4699
+ var arr2 = (0, import_timm4.addLast)(dlv_es_default(resolved, child.path, []), childValue);
4700
+ resolved = (0, import_timm4.setIn)(resolved, child.path, arr2);
4692
4701
  } else {
4693
4702
  resolved = (0, import_timm4.setIn)(resolved, child.path, childValue);
4694
4703
  }
@@ -4972,6 +4981,7 @@ var AsyncNodePlugin = function() {
4972
4981
  ]);
4973
4982
  return _Builder;
4974
4983
  }();
4984
+ var templateSymbol = Symbol("template");
4975
4985
  var TemplatePlugin = /*#__PURE__*/ function() {
4976
4986
  function TemplatePlugin(options) {
4977
4987
  _class_call_check(this, TemplatePlugin);
@@ -5037,11 +5047,11 @@ var AsyncNodePlugin = function() {
5037
5047
  values.push(parsed);
5038
5048
  }
5039
5049
  });
5040
- var result = {
5050
+ var result = _define_property({
5041
5051
  type: "multi-node",
5042
5052
  override: false,
5043
5053
  values: values
5044
- };
5054
+ }, templateSymbol, node.placement);
5045
5055
  return result;
5046
5056
  }
5047
5057
  },
@@ -5055,6 +5065,38 @@ var AsyncNodePlugin = function() {
5055
5065
  }
5056
5066
  return node;
5057
5067
  });
5068
+ function getTemplateSymbolValue(node) {
5069
+ if (node.type === "multi-node") {
5070
+ return node[templateSymbol];
5071
+ } else if (node.type === "template") {
5072
+ return node.placement;
5073
+ }
5074
+ return void 0;
5075
+ }
5076
+ parser.hooks.onCreateASTNode.tap("template", function(node) {
5077
+ if (node && (node.type === "view" || node.type === "asset") && Array.isArray(node.children)) {
5078
+ node.children = node.children.sort(function(a, b) {
5079
+ var pathsEqual = a.path.join() === b.path.join();
5080
+ if (pathsEqual) {
5081
+ var aPlacement = getTemplateSymbolValue(a.value);
5082
+ var bPlacement = getTemplateSymbolValue(b.value);
5083
+ if (aPlacement !== void 0 && bPlacement === void 0) {
5084
+ return aPlacement === "prepend" ? -1 : 1;
5085
+ } else if (bPlacement !== void 0 && aPlacement === void 0) {
5086
+ return bPlacement === "prepend" ? 1 : -1;
5087
+ } else if (aPlacement !== void 0 && bPlacement !== void 0) {
5088
+ if (aPlacement === bPlacement) {
5089
+ return 0;
5090
+ }
5091
+ return aPlacement === "prepend" ? -1 : 1;
5092
+ }
5093
+ return 0;
5094
+ }
5095
+ return 0;
5096
+ });
5097
+ }
5098
+ return node;
5099
+ });
5058
5100
  parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
5059
5101
  if (childOptions && hasTemplateKey(childOptions.key)) {
5060
5102
  return obj.map(function(template) {
@@ -5064,7 +5106,8 @@ var AsyncNodePlugin = function() {
5064
5106
  depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
5065
5107
  data: template.data,
5066
5108
  template: template.value,
5067
- dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
5109
+ dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
5110
+ placement: template.placement
5068
5111
  }, template);
5069
5112
  if (!templateAST) return;
5070
5113
  if (templateAST.type === "multi-node") {