@player-ui/check-path-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.
|
@@ -4818,6 +4818,7 @@ var CheckPathPlugin = function() {
|
|
|
4818
4818
|
]);
|
|
4819
4819
|
return ViewInstance;
|
|
4820
4820
|
}();
|
|
4821
|
+
var templateSymbol = Symbol("template");
|
|
4821
4822
|
var TemplatePlugin = /*#__PURE__*/ function() {
|
|
4822
4823
|
function TemplatePlugin(options) {
|
|
4823
4824
|
_class_call_check(this, TemplatePlugin);
|
|
@@ -4888,6 +4889,9 @@ var CheckPathPlugin = function() {
|
|
|
4888
4889
|
override: false,
|
|
4889
4890
|
values: values
|
|
4890
4891
|
};
|
|
4892
|
+
if (node.placement !== void 0) {
|
|
4893
|
+
result[templateSymbol] = node.placement;
|
|
4894
|
+
}
|
|
4891
4895
|
return result;
|
|
4892
4896
|
}
|
|
4893
4897
|
},
|
|
@@ -4901,6 +4905,40 @@ var CheckPathPlugin = function() {
|
|
|
4901
4905
|
}
|
|
4902
4906
|
return node;
|
|
4903
4907
|
});
|
|
4908
|
+
parser.hooks.onCreateASTNode.tap("template", function(node) {
|
|
4909
|
+
var getTemplateSymbolValue = function getTemplateSymbolValue(node2) {
|
|
4910
|
+
if (node2.type === "multi-node") {
|
|
4911
|
+
return node2[templateSymbol];
|
|
4912
|
+
} else if (node2.type === "template") {
|
|
4913
|
+
return node2.placement;
|
|
4914
|
+
}
|
|
4915
|
+
return void 0;
|
|
4916
|
+
};
|
|
4917
|
+
if (node && (node.type === "view" || node.type === "asset") && Array.isArray(node.children)) {
|
|
4918
|
+
node.children = node.children.sort(function(a, b) {
|
|
4919
|
+
var aPath = a.path.join();
|
|
4920
|
+
var bPath = b.path.join();
|
|
4921
|
+
var pathsEqual = aPath === bPath;
|
|
4922
|
+
if (pathsEqual) {
|
|
4923
|
+
var aPlacement = getTemplateSymbolValue(a.value);
|
|
4924
|
+
var bPlacement = getTemplateSymbolValue(b.value);
|
|
4925
|
+
if (aPlacement !== void 0 && bPlacement === void 0) {
|
|
4926
|
+
return aPlacement === "prepend" ? -1 : 1;
|
|
4927
|
+
} else if (bPlacement !== void 0 && aPlacement === void 0) {
|
|
4928
|
+
return bPlacement === "prepend" ? 1 : -1;
|
|
4929
|
+
} else if (aPlacement !== void 0 && bPlacement !== void 0) {
|
|
4930
|
+
if (aPlacement === bPlacement) {
|
|
4931
|
+
return 0;
|
|
4932
|
+
}
|
|
4933
|
+
return aPlacement === "prepend" ? -1 : 1;
|
|
4934
|
+
}
|
|
4935
|
+
return 0;
|
|
4936
|
+
}
|
|
4937
|
+
return aPath > bPath ? 1 : -1;
|
|
4938
|
+
});
|
|
4939
|
+
}
|
|
4940
|
+
return node;
|
|
4941
|
+
});
|
|
4904
4942
|
parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
|
|
4905
4943
|
if (childOptions && hasTemplateKey(childOptions.key)) {
|
|
4906
4944
|
return obj.map(function(template) {
|
|
@@ -4910,7 +4948,8 @@ var CheckPathPlugin = function() {
|
|
|
4910
4948
|
depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
|
|
4911
4949
|
data: template.data,
|
|
4912
4950
|
template: template.value,
|
|
4913
|
-
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
|
|
4951
|
+
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
|
|
4952
|
+
placement: template.placement
|
|
4914
4953
|
}, template);
|
|
4915
4954
|
if (!templateAST) return;
|
|
4916
4955
|
if (templateAST.type === "multi-node") {
|