@player-ui/async-node-plugin 0.10.5--canary.630.22572 → 0.10.5--canary.642.22635
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.
|
@@ -4965,32 +4965,10 @@ var AsyncNodePlugin = function() {
|
|
|
4965
4965
|
node.children.push(newChild);
|
|
4966
4966
|
return node;
|
|
4967
4967
|
}
|
|
4968
|
-
},
|
|
4969
|
-
{
|
|
4970
|
-
key: "updateChildrenByPath",
|
|
4971
|
-
value: /**
|
|
4972
|
-
* Updates children of a node of the same path and preserves order
|
|
4973
|
-
*
|
|
4974
|
-
* @param node - The node to update children for
|
|
4975
|
-
* @param pathToMatch - The path to match against child paths
|
|
4976
|
-
* @param mapFn - Function to transform matching children
|
|
4977
|
-
*/ function updateChildrenByPath(node, pathToMatch, updateFn) {
|
|
4978
|
-
if (!node.children) return node;
|
|
4979
|
-
var updatedChildren = node.children.map(function(child) {
|
|
4980
|
-
return(// Check if paths match exactly
|
|
4981
|
-
child.path.join() === pathToMatch.join() ? _object_spread_props(_object_spread({}, child), {
|
|
4982
|
-
value: updateFn(child)
|
|
4983
|
-
}) : child);
|
|
4984
|
-
});
|
|
4985
|
-
return _object_spread_props(_object_spread({}, node), {
|
|
4986
|
-
children: updatedChildren
|
|
4987
|
-
});
|
|
4988
|
-
}
|
|
4989
4968
|
}
|
|
4990
4969
|
]);
|
|
4991
4970
|
return _Builder;
|
|
4992
4971
|
}();
|
|
4993
|
-
var templateSymbol = Symbol("template");
|
|
4994
4972
|
var TemplatePlugin = /*#__PURE__*/ function() {
|
|
4995
4973
|
function TemplatePlugin(options) {
|
|
4996
4974
|
_class_call_check(this, TemplatePlugin);
|
|
@@ -5061,9 +5039,6 @@ var AsyncNodePlugin = function() {
|
|
|
5061
5039
|
override: false,
|
|
5062
5040
|
values: values
|
|
5063
5041
|
};
|
|
5064
|
-
if (node.placement !== void 0) {
|
|
5065
|
-
result[templateSymbol] = node.placement;
|
|
5066
|
-
}
|
|
5067
5042
|
return result;
|
|
5068
5043
|
}
|
|
5069
5044
|
},
|
|
@@ -5077,40 +5052,6 @@ var AsyncNodePlugin = function() {
|
|
|
5077
5052
|
}
|
|
5078
5053
|
return node;
|
|
5079
5054
|
});
|
|
5080
|
-
parser.hooks.onCreateASTNode.tap("template", function(node) {
|
|
5081
|
-
var getTemplateSymbolValue = function getTemplateSymbolValue(node2) {
|
|
5082
|
-
if (node2.type === "multi-node") {
|
|
5083
|
-
return node2[templateSymbol];
|
|
5084
|
-
} else if (node2.type === "template") {
|
|
5085
|
-
return node2.placement;
|
|
5086
|
-
}
|
|
5087
|
-
return void 0;
|
|
5088
|
-
};
|
|
5089
|
-
if (node && (node.type === "view" || node.type === "asset") && Array.isArray(node.children)) {
|
|
5090
|
-
node.children = node.children.sort(function(a, b) {
|
|
5091
|
-
var aPath = a.path.join();
|
|
5092
|
-
var bPath = b.path.join();
|
|
5093
|
-
var pathsEqual = aPath === bPath;
|
|
5094
|
-
if (pathsEqual) {
|
|
5095
|
-
var aPlacement = getTemplateSymbolValue(a.value);
|
|
5096
|
-
var bPlacement = getTemplateSymbolValue(b.value);
|
|
5097
|
-
if (aPlacement !== void 0 && bPlacement === void 0) {
|
|
5098
|
-
return aPlacement === "prepend" ? -1 : 1;
|
|
5099
|
-
} else if (bPlacement !== void 0 && aPlacement === void 0) {
|
|
5100
|
-
return bPlacement === "prepend" ? 1 : -1;
|
|
5101
|
-
} else if (aPlacement !== void 0 && bPlacement !== void 0) {
|
|
5102
|
-
if (aPlacement === bPlacement) {
|
|
5103
|
-
return 0;
|
|
5104
|
-
}
|
|
5105
|
-
return aPlacement === "prepend" ? -1 : 1;
|
|
5106
|
-
}
|
|
5107
|
-
return 0;
|
|
5108
|
-
}
|
|
5109
|
-
return aPath > bPath ? 1 : -1;
|
|
5110
|
-
});
|
|
5111
|
-
}
|
|
5112
|
-
return node;
|
|
5113
|
-
});
|
|
5114
5055
|
parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
|
|
5115
5056
|
if (childOptions && hasTemplateKey(childOptions.key)) {
|
|
5116
5057
|
return obj.map(function(template) {
|
|
@@ -5120,8 +5061,7 @@ var AsyncNodePlugin = function() {
|
|
|
5120
5061
|
depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
|
|
5121
5062
|
data: template.data,
|
|
5122
5063
|
template: template.value,
|
|
5123
|
-
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
|
|
5124
|
-
placement: template.placement
|
|
5064
|
+
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
|
|
5125
5065
|
}, template);
|
|
5126
5066
|
if (!templateAST) return;
|
|
5127
5067
|
if (templateAST.type === "multi-node") {
|