@player-ui/check-path-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.
@@ -1661,7 +1661,7 @@ var CheckPathPlugin = function() {
1661
1661
  });
1662
1662
  exports.clone = clone2;
1663
1663
  exports.addLast = addLast2;
1664
- exports.addFirst = addFirst;
1664
+ exports.addFirst = addFirst2;
1665
1665
  exports.removeLast = removeLast;
1666
1666
  exports.removeFirst = removeFirst;
1667
1667
  exports.insert = insert;
@@ -1711,7 +1711,7 @@ var CheckPathPlugin = function() {
1711
1711
  val
1712
1712
  ]);
1713
1713
  }
1714
- function addFirst(array, val) {
1714
+ function addFirst2(array, val) {
1715
1715
  if (Array.isArray(val)) return val.concat(array);
1716
1716
  return [
1717
1717
  val
@@ -1921,7 +1921,7 @@ var CheckPathPlugin = function() {
1921
1921
  var timm = {
1922
1922
  clone: clone2,
1923
1923
  addLast: addLast2,
1924
- addFirst: addFirst,
1924
+ addFirst: addFirst2,
1925
1925
  removeLast: removeLast,
1926
1926
  removeFirst: removeFirst,
1927
1927
  insert: insert,
@@ -4641,9 +4641,18 @@ var CheckPathPlugin = function() {
4641
4641
  return childDependencies.add(binding);
4642
4642
  });
4643
4643
  if (childValue) {
4644
+ if (childNode.type === "template") {
4645
+ if (childNode.placement === "append") {
4646
+ var arr = (0, import_timm4.addLast)(dlv_es_default(resolved, child.path, []), childValue);
4647
+ resolved = (0, import_timm4.setIn)(resolved, child.path, arr);
4648
+ } else if (childNode.placement === "prepend") {
4649
+ var arr1 = (0, import_timm4.addFirst)(dlv_es_default(resolved, child.path, []), childValue);
4650
+ resolved = (0, import_timm4.setIn)(resolved, child.path, arr1);
4651
+ }
4652
+ }
4644
4653
  if (childNode.type === "multi-node" && !childNode.override) {
4645
- var arr = (0, import_timm4.addLast)(dlv_es_default(resolved, child.path, []), childValue);
4646
- resolved = (0, import_timm4.setIn)(resolved, child.path, arr);
4654
+ var arr2 = (0, import_timm4.addLast)(dlv_es_default(resolved, child.path, []), childValue);
4655
+ resolved = (0, import_timm4.setIn)(resolved, child.path, arr2);
4647
4656
  } else {
4648
4657
  resolved = (0, import_timm4.setIn)(resolved, child.path, childValue);
4649
4658
  }
@@ -4821,6 +4830,7 @@ var CheckPathPlugin = function() {
4821
4830
  ]);
4822
4831
  return ViewInstance;
4823
4832
  }();
4833
+ var templateSymbol = Symbol("template");
4824
4834
  var TemplatePlugin = /*#__PURE__*/ function() {
4825
4835
  function TemplatePlugin(options) {
4826
4836
  _class_call_check(this, TemplatePlugin);
@@ -4886,11 +4896,11 @@ var CheckPathPlugin = function() {
4886
4896
  values.push(parsed);
4887
4897
  }
4888
4898
  });
4889
- var result = {
4899
+ var result = _define_property({
4890
4900
  type: "multi-node",
4891
4901
  override: false,
4892
4902
  values: values
4893
- };
4903
+ }, templateSymbol, node.placement);
4894
4904
  return result;
4895
4905
  }
4896
4906
  },
@@ -4904,6 +4914,38 @@ var CheckPathPlugin = function() {
4904
4914
  }
4905
4915
  return node;
4906
4916
  });
4917
+ function getTemplateSymbolValue(node) {
4918
+ if (node.type === "multi-node") {
4919
+ return node[templateSymbol];
4920
+ } else if (node.type === "template") {
4921
+ return node.placement;
4922
+ }
4923
+ return void 0;
4924
+ }
4925
+ parser.hooks.onCreateASTNode.tap("template", function(node) {
4926
+ if (node && (node.type === "view" || node.type === "asset") && Array.isArray(node.children)) {
4927
+ node.children = node.children.sort(function(a, b) {
4928
+ var pathsEqual = a.path.join() === b.path.join();
4929
+ if (pathsEqual) {
4930
+ var aPlacement = getTemplateSymbolValue(a.value);
4931
+ var bPlacement = getTemplateSymbolValue(b.value);
4932
+ if (aPlacement !== void 0 && bPlacement === void 0) {
4933
+ return aPlacement === "prepend" ? -1 : 1;
4934
+ } else if (bPlacement !== void 0 && aPlacement === void 0) {
4935
+ return bPlacement === "prepend" ? 1 : -1;
4936
+ } else if (aPlacement !== void 0 && bPlacement !== void 0) {
4937
+ if (aPlacement === bPlacement) {
4938
+ return 0;
4939
+ }
4940
+ return aPlacement === "prepend" ? -1 : 1;
4941
+ }
4942
+ return 0;
4943
+ }
4944
+ return 0;
4945
+ });
4946
+ }
4947
+ return node;
4948
+ });
4907
4949
  parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
4908
4950
  if (childOptions && hasTemplateKey(childOptions.key)) {
4909
4951
  return obj.map(function(template) {
@@ -4913,7 +4955,8 @@ var CheckPathPlugin = function() {
4913
4955
  depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
4914
4956
  data: template.data,
4915
4957
  template: template.value,
4916
- dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
4958
+ dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
4959
+ placement: template.placement
4917
4960
  }, template);
4918
4961
  if (!templateAST) return;
4919
4962
  if (templateAST.type === "multi-node") {