@player-ui/async-node-plugin 0.10.5-next.2 → 0.11.0--canary.614.21244
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.
|
@@ -4972,6 +4972,7 @@ var AsyncNodePlugin = function() {
|
|
|
4972
4972
|
]);
|
|
4973
4973
|
return _Builder;
|
|
4974
4974
|
}();
|
|
4975
|
+
var templateSymbol = Symbol("template");
|
|
4975
4976
|
var TemplatePlugin = /*#__PURE__*/ function() {
|
|
4976
4977
|
function TemplatePlugin(options) {
|
|
4977
4978
|
_class_call_check(this, TemplatePlugin);
|
|
@@ -5042,6 +5043,9 @@ var AsyncNodePlugin = function() {
|
|
|
5042
5043
|
override: false,
|
|
5043
5044
|
values: values
|
|
5044
5045
|
};
|
|
5046
|
+
if (node.placement !== void 0) {
|
|
5047
|
+
result[templateSymbol] = node.placement;
|
|
5048
|
+
}
|
|
5045
5049
|
return result;
|
|
5046
5050
|
}
|
|
5047
5051
|
},
|
|
@@ -5055,6 +5059,38 @@ var AsyncNodePlugin = function() {
|
|
|
5055
5059
|
}
|
|
5056
5060
|
return node;
|
|
5057
5061
|
});
|
|
5062
|
+
function getTemplateSymbolValue(node) {
|
|
5063
|
+
if (node.type === "multi-node") {
|
|
5064
|
+
return node[templateSymbol];
|
|
5065
|
+
} else if (node.type === "template") {
|
|
5066
|
+
return node.placement;
|
|
5067
|
+
}
|
|
5068
|
+
return void 0;
|
|
5069
|
+
}
|
|
5070
|
+
parser.hooks.onCreateASTNode.tap("template-sort", function(node) {
|
|
5071
|
+
if (node && (node.type === "view" || node.type === "asset") && Array.isArray(node.children)) {
|
|
5072
|
+
node.children = node.children.sort(function(a, b) {
|
|
5073
|
+
var pathsEqual = a.path.join() === b.path.join();
|
|
5074
|
+
if (pathsEqual) {
|
|
5075
|
+
var aPlacement = getTemplateSymbolValue(a.value);
|
|
5076
|
+
var bPlacement = getTemplateSymbolValue(b.value);
|
|
5077
|
+
if (aPlacement !== void 0 && bPlacement === void 0) {
|
|
5078
|
+
return aPlacement === "prepend" ? -1 : 1;
|
|
5079
|
+
} else if (bPlacement !== void 0 && aPlacement === void 0) {
|
|
5080
|
+
return bPlacement === "prepend" ? 1 : -1;
|
|
5081
|
+
} else if (aPlacement !== void 0 && bPlacement !== void 0) {
|
|
5082
|
+
if (aPlacement === bPlacement) {
|
|
5083
|
+
return 0;
|
|
5084
|
+
}
|
|
5085
|
+
return aPlacement === "prepend" ? -1 : 1;
|
|
5086
|
+
}
|
|
5087
|
+
return 0;
|
|
5088
|
+
}
|
|
5089
|
+
return 0;
|
|
5090
|
+
});
|
|
5091
|
+
}
|
|
5092
|
+
return node;
|
|
5093
|
+
});
|
|
5058
5094
|
parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
|
|
5059
5095
|
if (childOptions && hasTemplateKey(childOptions.key)) {
|
|
5060
5096
|
return obj.map(function(template) {
|
|
@@ -5064,7 +5100,8 @@ var AsyncNodePlugin = function() {
|
|
|
5064
5100
|
depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
|
|
5065
5101
|
data: template.data,
|
|
5066
5102
|
template: template.value,
|
|
5067
|
-
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
|
|
5103
|
+
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
|
|
5104
|
+
placement: template.placement
|
|
5068
5105
|
}, template);
|
|
5069
5106
|
if (!templateAST) return;
|
|
5070
5107
|
if (templateAST.type === "multi-node") {
|
|
@@ -5100,6 +5137,7 @@ var AsyncNodePlugin = function() {
|
|
|
5100
5137
|
value: function apply(view) {
|
|
5101
5138
|
view.hooks.parser.tap("template", this.applyParser.bind(this));
|
|
5102
5139
|
view.hooks.resolver.tap("template", this.applyResolverHooks.bind(this));
|
|
5140
|
+
view.hooks.onTemplatePluginCreated.call(this);
|
|
5103
5141
|
}
|
|
5104
5142
|
}
|
|
5105
5143
|
]);
|