@player-ui/reference-assets-plugin 0.11.0-next.2 → 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.
- package/dist/ReferenceAssetsPlugin.native.js +61 -1
- package/dist/ReferenceAssetsPlugin.native.js.map +1 -1
- package/dist/xlr/ActionAsset.json +2 -2
- package/dist/xlr/ChatMessageAsset.json +1 -1
- package/dist/xlr/ChoiceAsset.json +5 -5
- package/dist/xlr/CollectionAsset.json +1 -1
- package/dist/xlr/ImageAsset.json +2 -2
- package/dist/xlr/InfoAsset.json +1 -1
- package/dist/xlr/InputAsset.json +2 -2
- package/dist/xlr/TextAsset.json +4 -4
- package/package.json +5 -5
|
@@ -5180,10 +5180,32 @@ var ReferenceAssetsPlugin = function() {
|
|
|
5180
5180
|
node.children.push(newChild);
|
|
5181
5181
|
return node;
|
|
5182
5182
|
}
|
|
5183
|
+
},
|
|
5184
|
+
{
|
|
5185
|
+
key: "updateChildrenByPath",
|
|
5186
|
+
value: /**
|
|
5187
|
+
* Updates children of a node of the same path and preserves order
|
|
5188
|
+
*
|
|
5189
|
+
* @param node - The node to update children for
|
|
5190
|
+
* @param pathToMatch - The path to match against child paths
|
|
5191
|
+
* @param mapFn - Function to transform matching children
|
|
5192
|
+
*/ function updateChildrenByPath(node, pathToMatch, updateFn) {
|
|
5193
|
+
if (!node.children) return node;
|
|
5194
|
+
var updatedChildren = node.children.map(function(child) {
|
|
5195
|
+
return(// Check if paths match exactly
|
|
5196
|
+
child.path.join() === pathToMatch.join() ? _object_spread_props(_object_spread({}, child), {
|
|
5197
|
+
value: updateFn(child)
|
|
5198
|
+
}) : child);
|
|
5199
|
+
});
|
|
5200
|
+
return _object_spread_props(_object_spread({}, node), {
|
|
5201
|
+
children: updatedChildren
|
|
5202
|
+
});
|
|
5203
|
+
}
|
|
5183
5204
|
}
|
|
5184
5205
|
]);
|
|
5185
5206
|
return _Builder;
|
|
5186
5207
|
}();
|
|
5208
|
+
var templateSymbol = Symbol("template");
|
|
5187
5209
|
var TemplatePlugin = /*#__PURE__*/ function() {
|
|
5188
5210
|
function TemplatePlugin(options) {
|
|
5189
5211
|
_class_call_check(this, TemplatePlugin);
|
|
@@ -5254,6 +5276,9 @@ var ReferenceAssetsPlugin = function() {
|
|
|
5254
5276
|
override: false,
|
|
5255
5277
|
values: values
|
|
5256
5278
|
};
|
|
5279
|
+
if (node.placement !== void 0) {
|
|
5280
|
+
result[templateSymbol] = node.placement;
|
|
5281
|
+
}
|
|
5257
5282
|
return result;
|
|
5258
5283
|
}
|
|
5259
5284
|
},
|
|
@@ -5267,6 +5292,40 @@ var ReferenceAssetsPlugin = function() {
|
|
|
5267
5292
|
}
|
|
5268
5293
|
return node;
|
|
5269
5294
|
});
|
|
5295
|
+
parser.hooks.onCreateASTNode.tap("template", function(node) {
|
|
5296
|
+
var getTemplateSymbolValue = function getTemplateSymbolValue(node2) {
|
|
5297
|
+
if (node2.type === "multi-node") {
|
|
5298
|
+
return node2[templateSymbol];
|
|
5299
|
+
} else if (node2.type === "template") {
|
|
5300
|
+
return node2.placement;
|
|
5301
|
+
}
|
|
5302
|
+
return void 0;
|
|
5303
|
+
};
|
|
5304
|
+
if (node && (node.type === "view" || node.type === "asset") && Array.isArray(node.children)) {
|
|
5305
|
+
node.children = node.children.sort(function(a, b) {
|
|
5306
|
+
var aPath = a.path.join();
|
|
5307
|
+
var bPath = b.path.join();
|
|
5308
|
+
var pathsEqual = aPath === bPath;
|
|
5309
|
+
if (pathsEqual) {
|
|
5310
|
+
var aPlacement = getTemplateSymbolValue(a.value);
|
|
5311
|
+
var bPlacement = getTemplateSymbolValue(b.value);
|
|
5312
|
+
if (aPlacement !== void 0 && bPlacement === void 0) {
|
|
5313
|
+
return aPlacement === "prepend" ? -1 : 1;
|
|
5314
|
+
} else if (bPlacement !== void 0 && aPlacement === void 0) {
|
|
5315
|
+
return bPlacement === "prepend" ? 1 : -1;
|
|
5316
|
+
} else if (aPlacement !== void 0 && bPlacement !== void 0) {
|
|
5317
|
+
if (aPlacement === bPlacement) {
|
|
5318
|
+
return 0;
|
|
5319
|
+
}
|
|
5320
|
+
return aPlacement === "prepend" ? -1 : 1;
|
|
5321
|
+
}
|
|
5322
|
+
return 0;
|
|
5323
|
+
}
|
|
5324
|
+
return aPath > bPath ? 1 : -1;
|
|
5325
|
+
});
|
|
5326
|
+
}
|
|
5327
|
+
return node;
|
|
5328
|
+
});
|
|
5270
5329
|
parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
|
|
5271
5330
|
if (childOptions && hasTemplateKey(childOptions.key)) {
|
|
5272
5331
|
return obj.map(function(template) {
|
|
@@ -5276,7 +5335,8 @@ var ReferenceAssetsPlugin = function() {
|
|
|
5276
5335
|
depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
|
|
5277
5336
|
data: template.data,
|
|
5278
5337
|
template: template.value,
|
|
5279
|
-
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
|
|
5338
|
+
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false,
|
|
5339
|
+
placement: template.placement
|
|
5280
5340
|
}, template);
|
|
5281
5341
|
if (!templateAST) return;
|
|
5282
5342
|
if (templateAST.type === "multi-node") {
|