@player-ui/metrics-plugin 0.8.0-next.1 → 0.8.0-next.10
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/MetricsPlugin.native.js +228 -248
- package/dist/MetricsPlugin.native.js.map +1 -1
- package/package.json +3 -3
|
@@ -1354,8 +1354,16 @@ var MetricsPlugin = function() {
|
|
|
1354
1354
|
}
|
|
1355
1355
|
return targetMap;
|
|
1356
1356
|
};
|
|
1357
|
-
var
|
|
1358
|
-
return Object.
|
|
1357
|
+
var hasTemplateValues = function hasTemplateValues(obj, localKey) {
|
|
1358
|
+
return Object.hasOwnProperty.call(obj, "template") && Array.isArray(obj === null || obj === void 0 ? void 0 : obj.template) && obj.template.length && obj.template.find(function(tmpl) {
|
|
1359
|
+
return tmpl.output === localKey;
|
|
1360
|
+
});
|
|
1361
|
+
};
|
|
1362
|
+
var hasSwitchKey = function hasSwitchKey(localKey) {
|
|
1363
|
+
return localKey === "staticSwitch" || localKey === "dynamicSwitch";
|
|
1364
|
+
};
|
|
1365
|
+
var hasTemplateKey = function hasTemplateKey(localKey) {
|
|
1366
|
+
return localKey === "template";
|
|
1359
1367
|
};
|
|
1360
1368
|
var getNodeID = function getNodeID(node) {
|
|
1361
1369
|
var _node_value;
|
|
@@ -1645,7 +1653,7 @@ var MetricsPlugin = function() {
|
|
|
1645
1653
|
exports.merge = merge;
|
|
1646
1654
|
exports.mergeDeep = mergeDeep;
|
|
1647
1655
|
exports.mergeIn = mergeIn;
|
|
1648
|
-
exports.omit =
|
|
1656
|
+
exports.omit = omit3;
|
|
1649
1657
|
exports.addDefaults = addDefaults;
|
|
1650
1658
|
exports.default = void 0;
|
|
1651
1659
|
var INVALID_ARGS = "INVALID_ARGS";
|
|
@@ -1819,7 +1827,7 @@ var MetricsPlugin = function() {
|
|
|
1819
1827
|
}
|
|
1820
1828
|
return setIn9(a, path, nextVal);
|
|
1821
1829
|
}
|
|
1822
|
-
function
|
|
1830
|
+
function omit3(obj, attrs) {
|
|
1823
1831
|
var omitList = Array.isArray(attrs) ? attrs : [
|
|
1824
1832
|
attrs
|
|
1825
1833
|
];
|
|
@@ -1905,7 +1913,7 @@ var MetricsPlugin = function() {
|
|
|
1905
1913
|
merge: merge,
|
|
1906
1914
|
mergeDeep: mergeDeep,
|
|
1907
1915
|
mergeIn: mergeIn,
|
|
1908
|
-
omit:
|
|
1916
|
+
omit: omit3,
|
|
1909
1917
|
addDefaults: addDefaults
|
|
1910
1918
|
};
|
|
1911
1919
|
var _default = timm;
|
|
@@ -2654,6 +2662,12 @@ var MetricsPlugin = function() {
|
|
|
2654
2662
|
value: function clear() {
|
|
2655
2663
|
this.store = createSortedArray();
|
|
2656
2664
|
}
|
|
2665
|
+
},
|
|
2666
|
+
{
|
|
2667
|
+
/** Check if the registry is empty*/ key: "isRegistryEmpty",
|
|
2668
|
+
value: function isRegistryEmpty() {
|
|
2669
|
+
return this.store.array.length === 0;
|
|
2670
|
+
}
|
|
2657
2671
|
}
|
|
2658
2672
|
]);
|
|
2659
2673
|
return Registry;
|
|
@@ -4360,7 +4374,6 @@ var MetricsPlugin = function() {
|
|
|
4360
4374
|
* If undefined, the original value is used.
|
|
4361
4375
|
* If null, we ignore this node all together
|
|
4362
4376
|
*/ onCreateASTNode: new SyncWaterfallHook(),
|
|
4363
|
-
determineNodeType: new SyncBailHook(),
|
|
4364
4377
|
parseNode: new SyncBailHook()
|
|
4365
4378
|
};
|
|
4366
4379
|
}
|
|
@@ -4375,21 +4388,6 @@ var MetricsPlugin = function() {
|
|
|
4375
4388
|
return viewNode;
|
|
4376
4389
|
}
|
|
4377
4390
|
},
|
|
4378
|
-
{
|
|
4379
|
-
key: "parseAsync",
|
|
4380
|
-
value: function parseAsync(obj, type, options) {
|
|
4381
|
-
var parsedAsync = this.parseObject((0, import_timm5.omit)(obj, "async"), type, options);
|
|
4382
|
-
var parsedNodeId = getNodeID(parsedAsync);
|
|
4383
|
-
if (parsedAsync !== null && parsedNodeId) {
|
|
4384
|
-
return this.createASTNode({
|
|
4385
|
-
id: parsedNodeId,
|
|
4386
|
-
type: "async",
|
|
4387
|
-
value: parsedAsync
|
|
4388
|
-
}, obj);
|
|
4389
|
-
}
|
|
4390
|
-
return null;
|
|
4391
|
-
}
|
|
4392
|
-
},
|
|
4393
4391
|
{
|
|
4394
4392
|
key: "createASTNode",
|
|
4395
4393
|
value: function createASTNode(node, value) {
|
|
@@ -4400,25 +4398,6 @@ var MetricsPlugin = function() {
|
|
|
4400
4398
|
return tapped;
|
|
4401
4399
|
}
|
|
4402
4400
|
},
|
|
4403
|
-
{
|
|
4404
|
-
/**
|
|
4405
|
-
* Checks if there are templated values in the object
|
|
4406
|
-
*
|
|
4407
|
-
* @param obj - The Parsed Object to check to see if we have a template array type for
|
|
4408
|
-
* @param localKey - The key being checked
|
|
4409
|
-
*/ key: "hasTemplateValues",
|
|
4410
|
-
value: function hasTemplateValues(obj, localKey) {
|
|
4411
|
-
return Object.hasOwnProperty.call(obj, "template") && Array.isArray(obj === null || obj === void 0 ? void 0 : obj.template) && obj.template.length && obj.template.find(function(tmpl) {
|
|
4412
|
-
return tmpl.output === localKey;
|
|
4413
|
-
});
|
|
4414
|
-
}
|
|
4415
|
-
},
|
|
4416
|
-
{
|
|
4417
|
-
key: "hasSwitchKey",
|
|
4418
|
-
value: function hasSwitchKey(localKey) {
|
|
4419
|
-
return localKey === "staticSwitch";
|
|
4420
|
-
}
|
|
4421
|
-
},
|
|
4422
4401
|
{
|
|
4423
4402
|
key: "parseObject",
|
|
4424
4403
|
value: function parseObject(obj) {
|
|
@@ -4426,12 +4405,9 @@ var MetricsPlugin = function() {
|
|
|
4426
4405
|
templateDepth: 0
|
|
4427
4406
|
};
|
|
4428
4407
|
var _this = this;
|
|
4429
|
-
var
|
|
4430
|
-
if (
|
|
4431
|
-
|
|
4432
|
-
if (parsedNode) {
|
|
4433
|
-
return parsedNode;
|
|
4434
|
-
}
|
|
4408
|
+
var parsedNode = this.hooks.parseNode.call(obj, type, options);
|
|
4409
|
+
if (parsedNode || parsedNode === null) {
|
|
4410
|
+
return parsedNode;
|
|
4435
4411
|
}
|
|
4436
4412
|
var parseLocalObject = function(currentValue, objToParse) {
|
|
4437
4413
|
var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
|
|
@@ -4461,166 +4437,42 @@ var MetricsPlugin = function() {
|
|
|
4461
4437
|
value: currentValue
|
|
4462
4438
|
};
|
|
4463
4439
|
var newValue = objEntries.reduce(function(accumulation, current) {
|
|
4464
|
-
var
|
|
4465
|
-
|
|
4466
|
-
]);
|
|
4440
|
+
var value2 = accumulation.value;
|
|
4441
|
+
var children2 = accumulation.children;
|
|
4467
4442
|
var _current = _sliced_to_array(current, 2), localKey = _current[0], localValue = _current[1];
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
]),
|
|
4477
|
-
value: assetAST
|
|
4478
|
-
}
|
|
4479
|
-
])
|
|
4480
|
-
});
|
|
4481
|
-
}
|
|
4482
|
-
} else if (_this.hooks.determineNodeType.call(localKey) === "template" && Array.isArray(localValue)) {
|
|
4483
|
-
var templateChildren = localValue.map(function(template) {
|
|
4484
|
-
var _options_templateDepth, _template_dynamic;
|
|
4485
|
-
var templateAST = _this.hooks.onCreateASTNode.call({
|
|
4486
|
-
type: "template",
|
|
4487
|
-
depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
|
|
4488
|
-
data: template.data,
|
|
4489
|
-
template: template.value,
|
|
4490
|
-
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
|
|
4491
|
-
}, template);
|
|
4492
|
-
if ((templateAST === null || templateAST === void 0 ? void 0 : templateAST.type) === "multi-node") {
|
|
4493
|
-
templateAST.values.forEach(function(v) {
|
|
4494
|
-
v.parent = templateAST;
|
|
4495
|
-
});
|
|
4496
|
-
}
|
|
4497
|
-
if (templateAST) {
|
|
4498
|
-
return {
|
|
4499
|
-
path: _to_consumable_array(path).concat([
|
|
4500
|
-
template.output
|
|
4501
|
-
]),
|
|
4502
|
-
value: templateAST
|
|
4503
|
-
};
|
|
4504
|
-
}
|
|
4505
|
-
return;
|
|
4506
|
-
}).filter(function(element) {
|
|
4507
|
-
return !!element;
|
|
4508
|
-
});
|
|
4509
|
-
return _object_spread_props(_object_spread({}, rest), {
|
|
4510
|
-
children: _to_consumable_array(children2).concat(_to_consumable_array(templateChildren))
|
|
4511
|
-
});
|
|
4512
|
-
} else if (localValue && _this.hooks.determineNodeType.call(localValue) === "switch" || _this.hasSwitchKey(localKey)) {
|
|
4513
|
-
var _localSwitch_children;
|
|
4514
|
-
var localSwitch = _this.hooks.parseNode.call(_this.hasSwitchKey(localKey) ? _define_property({}, localKey, localValue) : localValue, "value", options, "switch");
|
|
4515
|
-
if (localSwitch && localSwitch.type === "value" && ((_localSwitch_children = localSwitch.children) === null || _localSwitch_children === void 0 ? void 0 : _localSwitch_children.length) === 1 && localSwitch.value === void 0) {
|
|
4516
|
-
var firstChild = localSwitch.children[0];
|
|
4517
|
-
return _object_spread_props(_object_spread({}, rest), {
|
|
4518
|
-
children: _to_consumable_array(children2).concat([
|
|
4519
|
-
{
|
|
4520
|
-
path: _to_consumable_array(path).concat([
|
|
4521
|
-
localKey
|
|
4522
|
-
], _to_consumable_array(firstChild.path)),
|
|
4523
|
-
value: firstChild.value
|
|
4524
|
-
}
|
|
4525
|
-
])
|
|
4526
|
-
});
|
|
4527
|
-
}
|
|
4528
|
-
if (localSwitch) {
|
|
4529
|
-
return _object_spread_props(_object_spread({}, rest), {
|
|
4530
|
-
children: _to_consumable_array(children2).concat([
|
|
4531
|
-
{
|
|
4532
|
-
path: _to_consumable_array(path).concat([
|
|
4533
|
-
localKey
|
|
4534
|
-
]),
|
|
4535
|
-
value: localSwitch
|
|
4536
|
-
}
|
|
4537
|
-
])
|
|
4538
|
-
});
|
|
4539
|
-
}
|
|
4540
|
-
} else if (localValue && hasAsync(localValue)) {
|
|
4541
|
-
var localAsync = _this.parseAsync(localValue, "value", options);
|
|
4542
|
-
if (localAsync) {
|
|
4543
|
-
children2.push({
|
|
4544
|
-
path: _to_consumable_array(path).concat([
|
|
4545
|
-
localKey
|
|
4546
|
-
]),
|
|
4547
|
-
value: localAsync
|
|
4548
|
-
});
|
|
4549
|
-
}
|
|
4550
|
-
} else if (localValue && Array.isArray(localValue)) {
|
|
4551
|
-
var childValues = localValue.map(function(childVal) {
|
|
4552
|
-
return _this.parseObject(childVal, "value", options);
|
|
4553
|
-
}).filter(function(child) {
|
|
4554
|
-
return !!child;
|
|
4555
|
-
});
|
|
4556
|
-
if (childValues.length > 0) {
|
|
4557
|
-
var multiNode = _this.hooks.onCreateASTNode.call({
|
|
4558
|
-
type: "multi-node",
|
|
4559
|
-
override: !_this.hasTemplateValues(localObj, localKey),
|
|
4560
|
-
values: childValues
|
|
4561
|
-
}, localValue);
|
|
4562
|
-
if ((multiNode === null || multiNode === void 0 ? void 0 : multiNode.type) === "multi-node") {
|
|
4563
|
-
multiNode.values.forEach(function(v) {
|
|
4564
|
-
v.parent = multiNode;
|
|
4565
|
-
});
|
|
4566
|
-
}
|
|
4567
|
-
if (multiNode) {
|
|
4568
|
-
return _object_spread_props(_object_spread({}, rest), {
|
|
4569
|
-
children: _to_consumable_array(children2).concat([
|
|
4570
|
-
{
|
|
4571
|
-
path: _to_consumable_array(path).concat([
|
|
4572
|
-
localKey
|
|
4573
|
-
]),
|
|
4574
|
-
value: multiNode
|
|
4575
|
-
}
|
|
4576
|
-
])
|
|
4577
|
-
});
|
|
4578
|
-
}
|
|
4579
|
-
}
|
|
4443
|
+
var newChildren = _this.hooks.parseNode.call(localValue, "value", options, {
|
|
4444
|
+
path: path,
|
|
4445
|
+
key: localKey,
|
|
4446
|
+
parentObj: localObj
|
|
4447
|
+
});
|
|
4448
|
+
if (newChildren) {
|
|
4449
|
+
var _children2;
|
|
4450
|
+
(_children2 = children2).push.apply(_children2, _to_consumable_array(newChildren));
|
|
4580
4451
|
} else if (localValue && typeof localValue === "object") {
|
|
4581
|
-
var
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
{
|
|
4588
|
-
path: _to_consumable_array(path).concat([
|
|
4589
|
-
localKey
|
|
4590
|
-
]),
|
|
4591
|
-
value: parsedNode
|
|
4592
|
-
}
|
|
4593
|
-
])
|
|
4594
|
-
});
|
|
4595
|
-
}
|
|
4596
|
-
} else {
|
|
4597
|
-
var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
|
|
4598
|
-
localKey
|
|
4599
|
-
]));
|
|
4600
|
-
return {
|
|
4601
|
-
value: result.value,
|
|
4602
|
-
children: _to_consumable_array(children2).concat(_to_consumable_array(result.children))
|
|
4603
|
-
};
|
|
4604
|
-
}
|
|
4452
|
+
var _children21;
|
|
4453
|
+
var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
|
|
4454
|
+
localKey
|
|
4455
|
+
]));
|
|
4456
|
+
value2 = result.value;
|
|
4457
|
+
(_children21 = children2).push.apply(_children21, _to_consumable_array(result.children));
|
|
4605
4458
|
} else {
|
|
4606
|
-
|
|
4459
|
+
value2 = (0, import_timm5.setIn)(accumulation.value, _to_consumable_array(path).concat([
|
|
4607
4460
|
localKey
|
|
4608
4461
|
]), localValue);
|
|
4609
|
-
return {
|
|
4610
|
-
children: children2,
|
|
4611
|
-
value: value2
|
|
4612
|
-
};
|
|
4613
4462
|
}
|
|
4614
|
-
return
|
|
4463
|
+
return {
|
|
4464
|
+
value: value2,
|
|
4465
|
+
children: children2
|
|
4466
|
+
};
|
|
4615
4467
|
}, defaultValue);
|
|
4616
4468
|
return newValue;
|
|
4617
4469
|
};
|
|
4618
4470
|
var _parseLocalObject = parseLocalObject(void 0, obj), value = _parseLocalObject.value, children = _parseLocalObject.children;
|
|
4619
|
-
var baseAst = value === void 0 && children.length
|
|
4471
|
+
var baseAst = value === void 0 && !children.length ? void 0 : {
|
|
4620
4472
|
type: type,
|
|
4621
4473
|
value: value
|
|
4622
4474
|
};
|
|
4623
|
-
if (baseAst
|
|
4475
|
+
if (baseAst && children.length) {
|
|
4624
4476
|
var parent = baseAst;
|
|
4625
4477
|
parent.children = children;
|
|
4626
4478
|
children.forEach(function(child) {
|
|
@@ -5108,24 +4960,30 @@ var MetricsPlugin = function() {
|
|
|
5108
4960
|
}
|
|
5109
4961
|
return node;
|
|
5110
4962
|
});
|
|
5111
|
-
parser.hooks.
|
|
5112
|
-
if (
|
|
5113
|
-
return
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
4963
|
+
parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
|
|
4964
|
+
if (childOptions && hasTemplateKey(childOptions.key)) {
|
|
4965
|
+
return obj.map(function(template) {
|
|
4966
|
+
var _options_templateDepth, _template_dynamic;
|
|
4967
|
+
var templateAST = parser.createASTNode({
|
|
4968
|
+
type: "template",
|
|
4969
|
+
depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
|
|
4970
|
+
data: template.data,
|
|
4971
|
+
template: template.value,
|
|
4972
|
+
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
|
|
4973
|
+
}, template);
|
|
4974
|
+
if (!templateAST) return;
|
|
4975
|
+
if (templateAST.type === "multi-node") {
|
|
4976
|
+
templateAST.values.forEach(function(v) {
|
|
4977
|
+
v.parent = templateAST;
|
|
4978
|
+
});
|
|
4979
|
+
}
|
|
4980
|
+
return {
|
|
4981
|
+
path: _to_consumable_array(childOptions.path).concat([
|
|
4982
|
+
template.output
|
|
4983
|
+
]),
|
|
4984
|
+
value: templateAST
|
|
4985
|
+
};
|
|
4986
|
+
}).filter(Boolean);
|
|
5129
4987
|
}
|
|
5130
4988
|
});
|
|
5131
4989
|
}
|
|
@@ -5269,6 +5127,12 @@ var MetricsPlugin = function() {
|
|
|
5269
5127
|
_class_call_check(this, ApplicabilityPlugin);
|
|
5270
5128
|
}
|
|
5271
5129
|
_create_class(ApplicabilityPlugin, [
|
|
5130
|
+
{
|
|
5131
|
+
key: "isApplicability",
|
|
5132
|
+
value: function isApplicability(obj) {
|
|
5133
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, "applicability");
|
|
5134
|
+
}
|
|
5135
|
+
},
|
|
5272
5136
|
{
|
|
5273
5137
|
key: "applyResolver",
|
|
5274
5138
|
value: function applyResolver(resolver) {
|
|
@@ -5288,25 +5152,32 @@ var MetricsPlugin = function() {
|
|
|
5288
5152
|
{
|
|
5289
5153
|
key: "applyParser",
|
|
5290
5154
|
value: function applyParser(parser) {
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
}
|
|
5295
|
-
});
|
|
5296
|
-
parser.hooks.parseNode.tap("applicability", function(obj, nodeType, options, determinedNodeType) {
|
|
5297
|
-
if (determinedNodeType === "applicability") {
|
|
5155
|
+
var _this = this;
|
|
5156
|
+
parser.hooks.parseNode.tap("applicability", function(obj, nodeType, options, childOptions) {
|
|
5157
|
+
if (_this.isApplicability(obj)) {
|
|
5298
5158
|
var parsedApplicability = parser.parseObject((0, import_timm7.omit)(obj, "applicability"), nodeType, options);
|
|
5299
|
-
if (parsedApplicability
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
return
|
|
5159
|
+
if (!parsedApplicability) {
|
|
5160
|
+
return childOptions ? [] : null;
|
|
5161
|
+
}
|
|
5162
|
+
var applicabilityNode = parser.createASTNode({
|
|
5163
|
+
type: "applicability",
|
|
5164
|
+
expression: obj.applicability,
|
|
5165
|
+
value: parsedApplicability
|
|
5166
|
+
}, obj);
|
|
5167
|
+
if (!applicabilityNode) {
|
|
5168
|
+
return childOptions ? [] : null;
|
|
5309
5169
|
}
|
|
5170
|
+
if (applicabilityNode.type === "applicability") {
|
|
5171
|
+
applicabilityNode.value.parent = applicabilityNode;
|
|
5172
|
+
}
|
|
5173
|
+
return childOptions ? [
|
|
5174
|
+
{
|
|
5175
|
+
path: _to_consumable_array(childOptions.path).concat([
|
|
5176
|
+
childOptions.key
|
|
5177
|
+
]),
|
|
5178
|
+
value: applicabilityNode
|
|
5179
|
+
}
|
|
5180
|
+
] : applicabilityNode;
|
|
5310
5181
|
}
|
|
5311
5182
|
});
|
|
5312
5183
|
}
|
|
@@ -5356,6 +5227,12 @@ var MetricsPlugin = function() {
|
|
|
5356
5227
|
return EMPTY_NODE;
|
|
5357
5228
|
}
|
|
5358
5229
|
},
|
|
5230
|
+
{
|
|
5231
|
+
key: "isSwitch",
|
|
5232
|
+
value: function isSwitch(obj) {
|
|
5233
|
+
return obj && (Object.prototype.hasOwnProperty.call(obj, "dynamicSwitch") || Object.prototype.hasOwnProperty.call(obj, "staticSwitch"));
|
|
5234
|
+
}
|
|
5235
|
+
},
|
|
5359
5236
|
{
|
|
5360
5237
|
key: "applyParser",
|
|
5361
5238
|
value: function applyParser(parser) {
|
|
@@ -5366,42 +5243,56 @@ var MetricsPlugin = function() {
|
|
|
5366
5243
|
}
|
|
5367
5244
|
return node;
|
|
5368
5245
|
});
|
|
5369
|
-
parser.hooks.
|
|
5370
|
-
if (
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
if (determinedNodeType === "switch") {
|
|
5376
|
-
var dynamic = "dynamicSwitch" in obj;
|
|
5377
|
-
var switchContent = "dynamicSwitch" in obj ? obj.dynamicSwitch : obj.staticSwitch;
|
|
5378
|
-
var cases = [];
|
|
5379
|
-
switchContent.forEach(function(switchCase) {
|
|
5246
|
+
parser.hooks.parseNode.tap("switch", function(obj, _nodeType, options, childOptions) {
|
|
5247
|
+
if (_this.isSwitch(obj) || childOptions && hasSwitchKey(childOptions.key)) {
|
|
5248
|
+
var objToParse = childOptions && hasSwitchKey(childOptions.key) ? _define_property({}, childOptions.key, obj) : obj;
|
|
5249
|
+
var dynamic = "dynamicSwitch" in objToParse;
|
|
5250
|
+
var switchContent = dynamic ? objToParse.dynamicSwitch : objToParse.staticSwitch;
|
|
5251
|
+
var cases = switchContent.map(function(switchCase) {
|
|
5380
5252
|
var switchCaseExpr = switchCase.case, switchBody = _object_without_properties(switchCase, [
|
|
5381
5253
|
"case"
|
|
5382
5254
|
]);
|
|
5383
5255
|
var value = parser.parseObject(switchBody, "value", options);
|
|
5384
5256
|
if (value) {
|
|
5385
|
-
|
|
5257
|
+
return {
|
|
5386
5258
|
case: switchCaseExpr,
|
|
5387
5259
|
value: value
|
|
5388
|
-
}
|
|
5260
|
+
};
|
|
5389
5261
|
}
|
|
5390
|
-
|
|
5391
|
-
|
|
5262
|
+
return;
|
|
5263
|
+
}).filter(Boolean);
|
|
5264
|
+
var switchAST = parser.createASTNode({
|
|
5392
5265
|
type: "switch",
|
|
5393
5266
|
dynamic: dynamic,
|
|
5394
5267
|
cases: cases
|
|
5395
|
-
},
|
|
5396
|
-
if (
|
|
5268
|
+
}, objToParse);
|
|
5269
|
+
if (!switchAST || switchAST.type === "empty") {
|
|
5270
|
+
return childOptions ? [] : null;
|
|
5271
|
+
}
|
|
5272
|
+
if (switchAST.type === "switch") {
|
|
5397
5273
|
switchAST.cases.forEach(function(sCase) {
|
|
5398
5274
|
sCase.value.parent = switchAST;
|
|
5399
5275
|
});
|
|
5400
5276
|
}
|
|
5401
|
-
if (
|
|
5402
|
-
|
|
5277
|
+
if (childOptions) {
|
|
5278
|
+
var _switchAST_children;
|
|
5279
|
+
var path = _to_consumable_array(childOptions.path).concat([
|
|
5280
|
+
childOptions.key
|
|
5281
|
+
]);
|
|
5282
|
+
var value = switchAST;
|
|
5283
|
+
if (switchAST.type === "value" && ((_switchAST_children = switchAST.children) === null || _switchAST_children === void 0 ? void 0 : _switchAST_children.length) === 1 && switchAST.value === void 0) {
|
|
5284
|
+
var firstChild = switchAST.children[0];
|
|
5285
|
+
path = _to_consumable_array(path).concat(_to_consumable_array(firstChild.path));
|
|
5286
|
+
value = firstChild.value;
|
|
5287
|
+
}
|
|
5288
|
+
return [
|
|
5289
|
+
{
|
|
5290
|
+
path: path,
|
|
5291
|
+
value: value
|
|
5292
|
+
}
|
|
5293
|
+
];
|
|
5403
5294
|
}
|
|
5404
|
-
return switchAST
|
|
5295
|
+
return switchAST;
|
|
5405
5296
|
}
|
|
5406
5297
|
});
|
|
5407
5298
|
}
|
|
@@ -5428,6 +5319,93 @@ var MetricsPlugin = function() {
|
|
|
5428
5319
|
]);
|
|
5429
5320
|
return SwitchPlugin;
|
|
5430
5321
|
}();
|
|
5322
|
+
var MultiNodePlugin = /*#__PURE__*/ function() {
|
|
5323
|
+
function MultiNodePlugin() {
|
|
5324
|
+
_class_call_check(this, MultiNodePlugin);
|
|
5325
|
+
}
|
|
5326
|
+
_create_class(MultiNodePlugin, [
|
|
5327
|
+
{
|
|
5328
|
+
key: "applyParser",
|
|
5329
|
+
value: function applyParser(parser) {
|
|
5330
|
+
parser.hooks.parseNode.tap("multi-node", function(obj, nodeType, options, childOptions) {
|
|
5331
|
+
if (childOptions && !hasTemplateKey(childOptions.key) && Array.isArray(obj)) {
|
|
5332
|
+
var values = obj.map(function(childVal) {
|
|
5333
|
+
return parser.parseObject(childVal, "value", options);
|
|
5334
|
+
}).filter(function(child) {
|
|
5335
|
+
return !!child;
|
|
5336
|
+
});
|
|
5337
|
+
if (!values.length) {
|
|
5338
|
+
return [];
|
|
5339
|
+
}
|
|
5340
|
+
var multiNode = parser.createASTNode({
|
|
5341
|
+
type: "multi-node",
|
|
5342
|
+
override: !hasTemplateValues(childOptions.parentObj, childOptions.key),
|
|
5343
|
+
values: values
|
|
5344
|
+
}, obj);
|
|
5345
|
+
if (!multiNode) {
|
|
5346
|
+
return [];
|
|
5347
|
+
}
|
|
5348
|
+
if (multiNode.type === "multi-node") {
|
|
5349
|
+
multiNode.values.forEach(function(v) {
|
|
5350
|
+
v.parent = multiNode;
|
|
5351
|
+
});
|
|
5352
|
+
}
|
|
5353
|
+
return [
|
|
5354
|
+
{
|
|
5355
|
+
path: _to_consumable_array(childOptions.path).concat([
|
|
5356
|
+
childOptions.key
|
|
5357
|
+
]),
|
|
5358
|
+
value: multiNode
|
|
5359
|
+
}
|
|
5360
|
+
];
|
|
5361
|
+
}
|
|
5362
|
+
});
|
|
5363
|
+
}
|
|
5364
|
+
},
|
|
5365
|
+
{
|
|
5366
|
+
key: "apply",
|
|
5367
|
+
value: function apply(view) {
|
|
5368
|
+
view.hooks.parser.tap("multi-node", this.applyParser.bind(this));
|
|
5369
|
+
}
|
|
5370
|
+
}
|
|
5371
|
+
]);
|
|
5372
|
+
return MultiNodePlugin;
|
|
5373
|
+
}();
|
|
5374
|
+
var AssetPlugin = /*#__PURE__*/ function() {
|
|
5375
|
+
function AssetPlugin() {
|
|
5376
|
+
_class_call_check(this, AssetPlugin);
|
|
5377
|
+
}
|
|
5378
|
+
_create_class(AssetPlugin, [
|
|
5379
|
+
{
|
|
5380
|
+
key: "applyParser",
|
|
5381
|
+
value: function applyParser(parser) {
|
|
5382
|
+
parser.hooks.parseNode.tap("asset", function(obj, nodeType, options, childOptions) {
|
|
5383
|
+
if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && typeof obj === "object") {
|
|
5384
|
+
var assetAST = parser.parseObject(obj, "asset", options);
|
|
5385
|
+
if (!assetAST) {
|
|
5386
|
+
return [];
|
|
5387
|
+
}
|
|
5388
|
+
return [
|
|
5389
|
+
{
|
|
5390
|
+
path: _to_consumable_array(childOptions.path).concat([
|
|
5391
|
+
childOptions.key
|
|
5392
|
+
]),
|
|
5393
|
+
value: assetAST
|
|
5394
|
+
}
|
|
5395
|
+
];
|
|
5396
|
+
}
|
|
5397
|
+
});
|
|
5398
|
+
}
|
|
5399
|
+
},
|
|
5400
|
+
{
|
|
5401
|
+
key: "apply",
|
|
5402
|
+
value: function apply(view) {
|
|
5403
|
+
view.hooks.parser.tap("asset", this.applyParser.bind(this));
|
|
5404
|
+
}
|
|
5405
|
+
}
|
|
5406
|
+
]);
|
|
5407
|
+
return AssetPlugin;
|
|
5408
|
+
}();
|
|
5431
5409
|
var FlowInstance = /*#__PURE__*/ function() {
|
|
5432
5410
|
function FlowInstance(id, flow, options) {
|
|
5433
5411
|
_class_call_check(this, FlowInstance);
|
|
@@ -7130,12 +7108,14 @@ var MetricsPlugin = function() {
|
|
|
7130
7108
|
player.hooks.viewController.tap(this.name, function(viewController) {
|
|
7131
7109
|
viewController.hooks.view.tap(_this.name, function(view) {
|
|
7132
7110
|
var pluginOptions = toNodeResolveOptions(view.resolverOptions);
|
|
7111
|
+
new AssetPlugin().apply(view);
|
|
7133
7112
|
new SwitchPlugin(pluginOptions).apply(view);
|
|
7134
7113
|
new ApplicabilityPlugin().apply(view);
|
|
7135
7114
|
new StringResolverPlugin().apply(view);
|
|
7136
7115
|
var templatePlugin = new TemplatePlugin(pluginOptions);
|
|
7137
7116
|
templatePlugin.apply(view);
|
|
7138
7117
|
view.hooks.onTemplatePluginCreated.call(templatePlugin);
|
|
7118
|
+
new MultiNodePlugin().apply(view);
|
|
7139
7119
|
});
|
|
7140
7120
|
});
|
|
7141
7121
|
}
|