@player-ui/markdown-plugin 0.10.5--canary.609.21086 → 0.10.5--canary.614.21174
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.
|
@@ -9118,6 +9118,7 @@ var MarkdownPlugin = function() {
|
|
|
9118
9118
|
]);
|
|
9119
9119
|
return ViewInstance;
|
|
9120
9120
|
}();
|
|
9121
|
+
var templateSymbol = Symbol("template");
|
|
9121
9122
|
var TemplatePlugin = /*#__PURE__*/ function() {
|
|
9122
9123
|
function TemplatePlugin(options) {
|
|
9123
9124
|
_class_call_check(this, TemplatePlugin);
|
|
@@ -9183,11 +9184,11 @@ var MarkdownPlugin = function() {
|
|
|
9183
9184
|
values.push(parsed);
|
|
9184
9185
|
}
|
|
9185
9186
|
});
|
|
9186
|
-
var result = {
|
|
9187
|
+
var result = _define_property({
|
|
9187
9188
|
type: "multi-node",
|
|
9188
9189
|
override: false,
|
|
9189
9190
|
values: values
|
|
9190
|
-
};
|
|
9191
|
+
}, templateSymbol, node2.placement);
|
|
9191
9192
|
return result;
|
|
9192
9193
|
}
|
|
9193
9194
|
},
|
|
@@ -9201,6 +9202,38 @@ var MarkdownPlugin = function() {
|
|
|
9201
9202
|
}
|
|
9202
9203
|
return node2;
|
|
9203
9204
|
});
|
|
9205
|
+
function getTemplateSymbolValue(node2) {
|
|
9206
|
+
if (node2.type === "multi-node") {
|
|
9207
|
+
return node2[templateSymbol];
|
|
9208
|
+
} else if (node2.type === "template") {
|
|
9209
|
+
return node2.placement;
|
|
9210
|
+
}
|
|
9211
|
+
return void 0;
|
|
9212
|
+
}
|
|
9213
|
+
parser.hooks.onCreateASTNode.tap("template-sort", function(node2) {
|
|
9214
|
+
if (node2 && (node2.type === "view" || node2.type === "asset") && Array.isArray(node2.children)) {
|
|
9215
|
+
node2.children = node2.children.sort(function(a, b) {
|
|
9216
|
+
var pathsEqual = a.path.join() === b.path.join();
|
|
9217
|
+
if (pathsEqual) {
|
|
9218
|
+
var aPlacement = getTemplateSymbolValue(a.value);
|
|
9219
|
+
var bPlacement = getTemplateSymbolValue(b.value);
|
|
9220
|
+
if (aPlacement !== void 0 && bPlacement === void 0) {
|
|
9221
|
+
return aPlacement === "prepend" ? -1 : 1;
|
|
9222
|
+
} else if (bPlacement !== void 0 && aPlacement === void 0) {
|
|
9223
|
+
return bPlacement === "prepend" ? 1 : -1;
|
|
9224
|
+
} else if (aPlacement !== void 0 && bPlacement !== void 0) {
|
|
9225
|
+
if (aPlacement === bPlacement) {
|
|
9226
|
+
return 0;
|
|
9227
|
+
}
|
|
9228
|
+
return aPlacement === "prepend" ? -1 : 1;
|
|
9229
|
+
}
|
|
9230
|
+
return 0;
|
|
9231
|
+
}
|
|
9232
|
+
return 0;
|
|
9233
|
+
});
|
|
9234
|
+
}
|
|
9235
|
+
return node2;
|
|
9236
|
+
});
|
|
9204
9237
|
parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
|
|
9205
9238
|
if (childOptions && hasTemplateKey(childOptions.key)) {
|
|
9206
9239
|
return obj.map(function(template) {
|
|
@@ -9210,7 +9243,8 @@ var MarkdownPlugin = function() {
|
|
|
9210
9243
|
depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
|
|
9211
9244
|
data: template.data,
|
|
9212
9245
|
template: template.value,
|
|
9213
|
-
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
|
|
9246
|
+
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
|
|
9247
|
+
placement: template.placement
|
|
9214
9248
|
}, template);
|
|
9215
9249
|
if (!templateAST) return;
|
|
9216
9250
|
if (templateAST.type === "multi-node") {
|
|
@@ -9246,6 +9280,7 @@ var MarkdownPlugin = function() {
|
|
|
9246
9280
|
value: function apply(view) {
|
|
9247
9281
|
view.hooks.parser.tap("template", this.applyParser.bind(this));
|
|
9248
9282
|
view.hooks.resolver.tap("template", this.applyResolverHooks.bind(this));
|
|
9283
|
+
view.hooks.onTemplatePluginCreated.call(this);
|
|
9249
9284
|
}
|
|
9250
9285
|
}
|
|
9251
9286
|
]);
|