@player-ui/common-types-plugin 0.11.0-next.2 → 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.
@@ -4897,6 +4897,7 @@ var CommonTypesPlugin = function() {
4897
4897
  ]);
4898
4898
  return ViewInstance;
4899
4899
  }();
4900
+ var templateSymbol = Symbol("template");
4900
4901
  var TemplatePlugin = /*#__PURE__*/ function() {
4901
4902
  function TemplatePlugin(options) {
4902
4903
  _class_call_check(this, TemplatePlugin);
@@ -4967,6 +4968,9 @@ var CommonTypesPlugin = function() {
4967
4968
  override: false,
4968
4969
  values: values
4969
4970
  };
4971
+ if (node.placement !== void 0) {
4972
+ result[templateSymbol] = node.placement;
4973
+ }
4970
4974
  return result;
4971
4975
  }
4972
4976
  },
@@ -4980,6 +4984,40 @@ var CommonTypesPlugin = function() {
4980
4984
  }
4981
4985
  return node;
4982
4986
  });
4987
+ parser.hooks.onCreateASTNode.tap("template", function(node) {
4988
+ var getTemplateSymbolValue = function getTemplateSymbolValue(node2) {
4989
+ if (node2.type === "multi-node") {
4990
+ return node2[templateSymbol];
4991
+ } else if (node2.type === "template") {
4992
+ return node2.placement;
4993
+ }
4994
+ return void 0;
4995
+ };
4996
+ if (node && (node.type === "view" || node.type === "asset") && Array.isArray(node.children)) {
4997
+ node.children = node.children.sort(function(a, b) {
4998
+ var aPath = a.path.join();
4999
+ var bPath = b.path.join();
5000
+ var pathsEqual = aPath === bPath;
5001
+ if (pathsEqual) {
5002
+ var aPlacement = getTemplateSymbolValue(a.value);
5003
+ var bPlacement = getTemplateSymbolValue(b.value);
5004
+ if (aPlacement !== void 0 && bPlacement === void 0) {
5005
+ return aPlacement === "prepend" ? -1 : 1;
5006
+ } else if (bPlacement !== void 0 && aPlacement === void 0) {
5007
+ return bPlacement === "prepend" ? 1 : -1;
5008
+ } else if (aPlacement !== void 0 && bPlacement !== void 0) {
5009
+ if (aPlacement === bPlacement) {
5010
+ return 0;
5011
+ }
5012
+ return aPlacement === "prepend" ? -1 : 1;
5013
+ }
5014
+ return 0;
5015
+ }
5016
+ return aPath > bPath ? 1 : -1;
5017
+ });
5018
+ }
5019
+ return node;
5020
+ });
4983
5021
  parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
4984
5022
  if (childOptions && hasTemplateKey(childOptions.key)) {
4985
5023
  return obj.map(function(template) {
@@ -4989,7 +5027,8 @@ var CommonTypesPlugin = function() {
4989
5027
  depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
4990
5028
  data: template.data,
4991
5029
  template: template.value,
4992
- dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
5030
+ dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
5031
+ placement: template.placement
4993
5032
  }, template);
4994
5033
  if (!templateAST) return;
4995
5034
  if (templateAST.type === "multi-node") {