@player-ui/player 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.
@@ -5217,11 +5217,33 @@ var Player = function() {
5217
5217
  node.children.push(newChild);
5218
5218
  return node;
5219
5219
  }
5220
+ },
5221
+ {
5222
+ key: "updateChildrenByPath",
5223
+ value: /**
5224
+ * Updates children of a node of the same path and preserves order
5225
+ *
5226
+ * @param node - The node to update children for
5227
+ * @param pathToMatch - The path to match against child paths
5228
+ * @param mapFn - Function to transform matching children
5229
+ */ function updateChildrenByPath(node, pathToMatch, updateFn) {
5230
+ if (!node.children) return node;
5231
+ var updatedChildren = node.children.map(function(child) {
5232
+ return(// Check if paths match exactly
5233
+ child.path.join() === pathToMatch.join() ? _object_spread_props(_object_spread({}, child), {
5234
+ value: updateFn(child)
5235
+ }) : child);
5236
+ });
5237
+ return _object_spread_props(_object_spread({}, node), {
5238
+ children: updatedChildren
5239
+ });
5240
+ }
5220
5241
  }
5221
5242
  ]);
5222
5243
  return _Builder;
5223
5244
  }();
5224
5245
  // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/plugins/template.ts
5246
+ var templateSymbol = Symbol("template");
5225
5247
  var TemplatePlugin = /*#__PURE__*/ function() {
5226
5248
  function TemplatePlugin(options) {
5227
5249
  _class_call_check(this, TemplatePlugin);
@@ -5292,6 +5314,9 @@ var Player = function() {
5292
5314
  override: false,
5293
5315
  values: values
5294
5316
  };
5317
+ if (node.placement !== void 0) {
5318
+ result[templateSymbol] = node.placement;
5319
+ }
5295
5320
  return result;
5296
5321
  }
5297
5322
  },
@@ -5305,6 +5330,40 @@ var Player = function() {
5305
5330
  }
5306
5331
  return node;
5307
5332
  });
5333
+ parser.hooks.onCreateASTNode.tap("template", function(node) {
5334
+ var getTemplateSymbolValue = function getTemplateSymbolValue(node2) {
5335
+ if (node2.type === "multi-node" /* MultiNode */ ) {
5336
+ return node2[templateSymbol];
5337
+ } else if (node2.type === "template" /* Template */ ) {
5338
+ return node2.placement;
5339
+ }
5340
+ return void 0;
5341
+ };
5342
+ if (node && (node.type === "view" /* View */ || node.type === "asset" /* Asset */ ) && Array.isArray(node.children)) {
5343
+ node.children = node.children.sort(function(a, b) {
5344
+ var aPath = a.path.join();
5345
+ var bPath = b.path.join();
5346
+ var pathsEqual = aPath === bPath;
5347
+ if (pathsEqual) {
5348
+ var aPlacement = getTemplateSymbolValue(a.value);
5349
+ var bPlacement = getTemplateSymbolValue(b.value);
5350
+ if (aPlacement !== void 0 && bPlacement === void 0) {
5351
+ return aPlacement === "prepend" ? -1 : 1;
5352
+ } else if (bPlacement !== void 0 && aPlacement === void 0) {
5353
+ return bPlacement === "prepend" ? 1 : -1;
5354
+ } else if (aPlacement !== void 0 && bPlacement !== void 0) {
5355
+ if (aPlacement === bPlacement) {
5356
+ return 0;
5357
+ }
5358
+ return aPlacement === "prepend" ? -1 : 1;
5359
+ }
5360
+ return 0;
5361
+ }
5362
+ return aPath > bPath ? 1 : -1;
5363
+ });
5364
+ }
5365
+ return node;
5366
+ });
5308
5367
  parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
5309
5368
  if (childOptions && hasTemplateKey(childOptions.key)) {
5310
5369
  return obj.map(function(template) {
@@ -5314,7 +5373,8 @@ var Player = function() {
5314
5373
  depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
5315
5374
  data: template.data,
5316
5375
  template: template.value,
5317
- dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
5376
+ dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
5377
+ placement: template.placement
5318
5378
  }, template);
5319
5379
  if (!templateAST) return;
5320
5380
  if (templateAST.type === "multi-node" /* MultiNode */ ) {