@player-ui/markdown-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.
@@ -9115,6 +9115,7 @@ var MarkdownPlugin = function() {
9115
9115
  ]);
9116
9116
  return ViewInstance;
9117
9117
  }();
9118
+ var templateSymbol = Symbol("template");
9118
9119
  var TemplatePlugin = /*#__PURE__*/ function() {
9119
9120
  function TemplatePlugin(options) {
9120
9121
  _class_call_check(this, TemplatePlugin);
@@ -9185,6 +9186,9 @@ var MarkdownPlugin = function() {
9185
9186
  override: false,
9186
9187
  values: values
9187
9188
  };
9189
+ if (node2.placement !== void 0) {
9190
+ result[templateSymbol] = node2.placement;
9191
+ }
9188
9192
  return result;
9189
9193
  }
9190
9194
  },
@@ -9198,6 +9202,40 @@ var MarkdownPlugin = function() {
9198
9202
  }
9199
9203
  return node2;
9200
9204
  });
9205
+ parser.hooks.onCreateASTNode.tap("template", function(node2) {
9206
+ var getTemplateSymbolValue = function getTemplateSymbolValue(node22) {
9207
+ if (node22.type === "multi-node") {
9208
+ return node22[templateSymbol];
9209
+ } else if (node22.type === "template") {
9210
+ return node22.placement;
9211
+ }
9212
+ return void 0;
9213
+ };
9214
+ if (node2 && (node2.type === "view" || node2.type === "asset") && Array.isArray(node2.children)) {
9215
+ node2.children = node2.children.sort(function(a, b) {
9216
+ var aPath = a.path.join();
9217
+ var bPath = b.path.join();
9218
+ var pathsEqual = aPath === bPath;
9219
+ if (pathsEqual) {
9220
+ var aPlacement = getTemplateSymbolValue(a.value);
9221
+ var bPlacement = getTemplateSymbolValue(b.value);
9222
+ if (aPlacement !== void 0 && bPlacement === void 0) {
9223
+ return aPlacement === "prepend" ? -1 : 1;
9224
+ } else if (bPlacement !== void 0 && aPlacement === void 0) {
9225
+ return bPlacement === "prepend" ? 1 : -1;
9226
+ } else if (aPlacement !== void 0 && bPlacement !== void 0) {
9227
+ if (aPlacement === bPlacement) {
9228
+ return 0;
9229
+ }
9230
+ return aPlacement === "prepend" ? -1 : 1;
9231
+ }
9232
+ return 0;
9233
+ }
9234
+ return aPath > bPath ? 1 : -1;
9235
+ });
9236
+ }
9237
+ return node2;
9238
+ });
9201
9239
  parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
9202
9240
  if (childOptions && hasTemplateKey(childOptions.key)) {
9203
9241
  return obj.map(function(template) {
@@ -9207,7 +9245,8 @@ var MarkdownPlugin = function() {
9207
9245
  depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
9208
9246
  data: template.data,
9209
9247
  template: template.value,
9210
- dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
9248
+ dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
9249
+ placement: template.placement
9211
9250
  }, template);
9212
9251
  if (!templateAST) return;
9213
9252
  if (templateAST.type === "multi-node") {