@player-ui/beacon-plugin 0.11.0-next.3 → 0.11.0-next.4

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.
@@ -4867,6 +4867,7 @@ var BeaconPlugin = function() {
4867
4867
  ]);
4868
4868
  return ViewInstance;
4869
4869
  }();
4870
+ var templateSymbol = Symbol("template");
4870
4871
  var TemplatePlugin = /*#__PURE__*/ function() {
4871
4872
  function TemplatePlugin(options) {
4872
4873
  _class_call_check(this, TemplatePlugin);
@@ -4937,6 +4938,9 @@ var BeaconPlugin = function() {
4937
4938
  override: false,
4938
4939
  values: values
4939
4940
  };
4941
+ if (node.placement !== void 0) {
4942
+ result[templateSymbol] = node.placement;
4943
+ }
4940
4944
  return result;
4941
4945
  }
4942
4946
  },
@@ -4950,6 +4954,40 @@ var BeaconPlugin = function() {
4950
4954
  }
4951
4955
  return node;
4952
4956
  });
4957
+ parser.hooks.onCreateASTNode.tap("template", function(node) {
4958
+ var getTemplateSymbolValue = function getTemplateSymbolValue(node2) {
4959
+ if (node2.type === "multi-node") {
4960
+ return node2[templateSymbol];
4961
+ } else if (node2.type === "template") {
4962
+ return node2.placement;
4963
+ }
4964
+ return void 0;
4965
+ };
4966
+ if (node && (node.type === "view" || node.type === "asset") && Array.isArray(node.children)) {
4967
+ node.children = node.children.sort(function(a, b) {
4968
+ var aPath = a.path.join();
4969
+ var bPath = b.path.join();
4970
+ var pathsEqual = aPath === bPath;
4971
+ if (pathsEqual) {
4972
+ var aPlacement = getTemplateSymbolValue(a.value);
4973
+ var bPlacement = getTemplateSymbolValue(b.value);
4974
+ if (aPlacement !== void 0 && bPlacement === void 0) {
4975
+ return aPlacement === "prepend" ? -1 : 1;
4976
+ } else if (bPlacement !== void 0 && aPlacement === void 0) {
4977
+ return bPlacement === "prepend" ? 1 : -1;
4978
+ } else if (aPlacement !== void 0 && bPlacement !== void 0) {
4979
+ if (aPlacement === bPlacement) {
4980
+ return 0;
4981
+ }
4982
+ return aPlacement === "prepend" ? -1 : 1;
4983
+ }
4984
+ return 0;
4985
+ }
4986
+ return aPath > bPath ? 1 : -1;
4987
+ });
4988
+ }
4989
+ return node;
4990
+ });
4953
4991
  parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
4954
4992
  if (childOptions && hasTemplateKey(childOptions.key)) {
4955
4993
  return obj.map(function(template) {
@@ -4959,7 +4997,8 @@ var BeaconPlugin = function() {
4959
4997
  depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
4960
4998
  data: template.data,
4961
4999
  template: template.value,
4962
- dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
5000
+ dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
5001
+ placement: template.placement
4963
5002
  }, template);
4964
5003
  if (!templateAST) return;
4965
5004
  if (templateAST.type === "multi-node") {