@player-ui/stage-revert-data-plugin 0.11.0-next.3 → 0.11.0

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.
@@ -4783,6 +4783,7 @@ var StageRevertDataPlugin = function() {
4783
4783
  ]);
4784
4784
  return ViewInstance;
4785
4785
  }();
4786
+ var templateSymbol = Symbol("template");
4786
4787
  var TemplatePlugin = /*#__PURE__*/ function() {
4787
4788
  function TemplatePlugin(options) {
4788
4789
  _class_call_check(this, TemplatePlugin);
@@ -4853,6 +4854,9 @@ var StageRevertDataPlugin = function() {
4853
4854
  override: false,
4854
4855
  values: values
4855
4856
  };
4857
+ if (node.placement !== void 0) {
4858
+ result[templateSymbol] = node.placement;
4859
+ }
4856
4860
  return result;
4857
4861
  }
4858
4862
  },
@@ -4866,6 +4870,40 @@ var StageRevertDataPlugin = function() {
4866
4870
  }
4867
4871
  return node;
4868
4872
  });
4873
+ parser.hooks.onCreateASTNode.tap("template", function(node) {
4874
+ var getTemplateSymbolValue = function getTemplateSymbolValue(node2) {
4875
+ if (node2.type === "multi-node") {
4876
+ return node2[templateSymbol];
4877
+ } else if (node2.type === "template") {
4878
+ return node2.placement;
4879
+ }
4880
+ return void 0;
4881
+ };
4882
+ if (node && (node.type === "view" || node.type === "asset") && Array.isArray(node.children)) {
4883
+ node.children = node.children.sort(function(a, b) {
4884
+ var aPath = a.path.join();
4885
+ var bPath = b.path.join();
4886
+ var pathsEqual = aPath === bPath;
4887
+ if (pathsEqual) {
4888
+ var aPlacement = getTemplateSymbolValue(a.value);
4889
+ var bPlacement = getTemplateSymbolValue(b.value);
4890
+ if (aPlacement !== void 0 && bPlacement === void 0) {
4891
+ return aPlacement === "prepend" ? -1 : 1;
4892
+ } else if (bPlacement !== void 0 && aPlacement === void 0) {
4893
+ return bPlacement === "prepend" ? 1 : -1;
4894
+ } else if (aPlacement !== void 0 && bPlacement !== void 0) {
4895
+ if (aPlacement === bPlacement) {
4896
+ return 0;
4897
+ }
4898
+ return aPlacement === "prepend" ? -1 : 1;
4899
+ }
4900
+ return 0;
4901
+ }
4902
+ return aPath > bPath ? 1 : -1;
4903
+ });
4904
+ }
4905
+ return node;
4906
+ });
4869
4907
  parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
4870
4908
  if (childOptions && hasTemplateKey(childOptions.key)) {
4871
4909
  return obj.map(function(template) {
@@ -4875,7 +4913,8 @@ var StageRevertDataPlugin = function() {
4875
4913
  depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
4876
4914
  data: template.data,
4877
4915
  template: template.value,
4878
- dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
4916
+ dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
4917
+ placement: template.placement
4879
4918
  }, template);
4880
4919
  if (!templateAST) return;
4881
4920
  if (templateAST.type === "multi-node") {
@@ -7029,8 +7068,8 @@ var StageRevertDataPlugin = function() {
7029
7068
  ]);
7030
7069
  return DefaultViewPlugin;
7031
7070
  }();
7032
- var PLAYER_VERSION = "__VERSION__";
7033
- var COMMIT = "__GIT_COMMIT__";
7071
+ var PLAYER_VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "__VERSION__";
7072
+ var COMMIT = typeof __GIT_COMMIT__ !== "undefined" ? __GIT_COMMIT__ : "__GIT_COMMIT__";
7034
7073
  var _Player = /*#__PURE__*/ function() {
7035
7074
  function _Player2(config) {
7036
7075
  var _this = this;