@player-ui/async-node-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.
@@ -4965,10 +4965,32 @@ var AsyncNodePlugin = function() {
4965
4965
  node.children.push(newChild);
4966
4966
  return node;
4967
4967
  }
4968
+ },
4969
+ {
4970
+ key: "updateChildrenByPath",
4971
+ value: /**
4972
+ * Updates children of a node of the same path and preserves order
4973
+ *
4974
+ * @param node - The node to update children for
4975
+ * @param pathToMatch - The path to match against child paths
4976
+ * @param mapFn - Function to transform matching children
4977
+ */ function updateChildrenByPath(node, pathToMatch, updateFn) {
4978
+ if (!node.children) return node;
4979
+ var updatedChildren = node.children.map(function(child) {
4980
+ return(// Check if paths match exactly
4981
+ child.path.join() === pathToMatch.join() ? _object_spread_props(_object_spread({}, child), {
4982
+ value: updateFn(child)
4983
+ }) : child);
4984
+ });
4985
+ return _object_spread_props(_object_spread({}, node), {
4986
+ children: updatedChildren
4987
+ });
4988
+ }
4968
4989
  }
4969
4990
  ]);
4970
4991
  return _Builder;
4971
4992
  }();
4993
+ var templateSymbol = Symbol("template");
4972
4994
  var TemplatePlugin = /*#__PURE__*/ function() {
4973
4995
  function TemplatePlugin(options) {
4974
4996
  _class_call_check(this, TemplatePlugin);
@@ -5039,6 +5061,9 @@ var AsyncNodePlugin = function() {
5039
5061
  override: false,
5040
5062
  values: values
5041
5063
  };
5064
+ if (node.placement !== void 0) {
5065
+ result[templateSymbol] = node.placement;
5066
+ }
5042
5067
  return result;
5043
5068
  }
5044
5069
  },
@@ -5052,6 +5077,40 @@ var AsyncNodePlugin = function() {
5052
5077
  }
5053
5078
  return node;
5054
5079
  });
5080
+ parser.hooks.onCreateASTNode.tap("template", function(node) {
5081
+ var getTemplateSymbolValue = function getTemplateSymbolValue(node2) {
5082
+ if (node2.type === "multi-node") {
5083
+ return node2[templateSymbol];
5084
+ } else if (node2.type === "template") {
5085
+ return node2.placement;
5086
+ }
5087
+ return void 0;
5088
+ };
5089
+ if (node && (node.type === "view" || node.type === "asset") && Array.isArray(node.children)) {
5090
+ node.children = node.children.sort(function(a, b) {
5091
+ var aPath = a.path.join();
5092
+ var bPath = b.path.join();
5093
+ var pathsEqual = aPath === bPath;
5094
+ if (pathsEqual) {
5095
+ var aPlacement = getTemplateSymbolValue(a.value);
5096
+ var bPlacement = getTemplateSymbolValue(b.value);
5097
+ if (aPlacement !== void 0 && bPlacement === void 0) {
5098
+ return aPlacement === "prepend" ? -1 : 1;
5099
+ } else if (bPlacement !== void 0 && aPlacement === void 0) {
5100
+ return bPlacement === "prepend" ? 1 : -1;
5101
+ } else if (aPlacement !== void 0 && bPlacement !== void 0) {
5102
+ if (aPlacement === bPlacement) {
5103
+ return 0;
5104
+ }
5105
+ return aPlacement === "prepend" ? -1 : 1;
5106
+ }
5107
+ return 0;
5108
+ }
5109
+ return aPath > bPath ? 1 : -1;
5110
+ });
5111
+ }
5112
+ return node;
5113
+ });
5055
5114
  parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
5056
5115
  if (childOptions && hasTemplateKey(childOptions.key)) {
5057
5116
  return obj.map(function(template) {
@@ -5061,7 +5120,8 @@ var AsyncNodePlugin = function() {
5061
5120
  depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
5062
5121
  data: template.data,
5063
5122
  template: template.value,
5064
- dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
5123
+ dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
5124
+ placement: template.placement
5065
5125
  }, template);
5066
5126
  if (!templateAST) return;
5067
5127
  if (templateAST.type === "multi-node") {
@@ -7215,8 +7275,8 @@ var AsyncNodePlugin = function() {
7215
7275
  ]);
7216
7276
  return DefaultViewPlugin;
7217
7277
  }();
7218
- var PLAYER_VERSION = "__VERSION__";
7219
- var COMMIT = "__GIT_COMMIT__";
7278
+ var PLAYER_VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "__VERSION__";
7279
+ var COMMIT = typeof __GIT_COMMIT__ !== "undefined" ? __GIT_COMMIT__ : "__GIT_COMMIT__";
7220
7280
  var _Player = /*#__PURE__*/ function() {
7221
7281
  function _Player2(config) {
7222
7282
  var _this = this;