@player-ui/markdown-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.
|
@@ -1354,8 +1354,16 @@ var MarkdownPlugin = 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(node2) {
|
|
1361
1369
|
var _node2_value;
|
|
@@ -5964,7 +5972,7 @@ var MarkdownPlugin = function() {
|
|
|
5964
5972
|
exports.merge = merge;
|
|
5965
5973
|
exports.mergeDeep = mergeDeep;
|
|
5966
5974
|
exports.mergeIn = mergeIn;
|
|
5967
|
-
exports.omit =
|
|
5975
|
+
exports.omit = omit3;
|
|
5968
5976
|
exports.addDefaults = addDefaults;
|
|
5969
5977
|
exports.default = void 0;
|
|
5970
5978
|
var INVALID_ARGS = "INVALID_ARGS";
|
|
@@ -6138,7 +6146,7 @@ var MarkdownPlugin = function() {
|
|
|
6138
6146
|
}
|
|
6139
6147
|
return setIn8(a, path, nextVal);
|
|
6140
6148
|
}
|
|
6141
|
-
function
|
|
6149
|
+
function omit3(obj, attrs) {
|
|
6142
6150
|
var omitList = Array.isArray(attrs) ? attrs : [
|
|
6143
6151
|
attrs
|
|
6144
6152
|
];
|
|
@@ -6224,7 +6232,7 @@ var MarkdownPlugin = function() {
|
|
|
6224
6232
|
merge: merge,
|
|
6225
6233
|
mergeDeep: mergeDeep,
|
|
6226
6234
|
mergeIn: mergeIn,
|
|
6227
|
-
omit:
|
|
6235
|
+
omit: omit3,
|
|
6228
6236
|
addDefaults: addDefaults
|
|
6229
6237
|
};
|
|
6230
6238
|
var _default = timm;
|
|
@@ -6877,6 +6885,12 @@ var MarkdownPlugin = function() {
|
|
|
6877
6885
|
value: function clear() {
|
|
6878
6886
|
this.store = createSortedArray();
|
|
6879
6887
|
}
|
|
6888
|
+
},
|
|
6889
|
+
{
|
|
6890
|
+
/** Check if the registry is empty*/ key: "isRegistryEmpty",
|
|
6891
|
+
value: function isRegistryEmpty() {
|
|
6892
|
+
return this.store.array.length === 0;
|
|
6893
|
+
}
|
|
6880
6894
|
}
|
|
6881
6895
|
]);
|
|
6882
6896
|
return Registry;
|
|
@@ -8596,7 +8610,6 @@ var MarkdownPlugin = function() {
|
|
|
8596
8610
|
* If undefined, the original value is used.
|
|
8597
8611
|
* If null, we ignore this node all together
|
|
8598
8612
|
*/ onCreateASTNode: new SyncWaterfallHook(),
|
|
8599
|
-
determineNodeType: new SyncBailHook(),
|
|
8600
8613
|
parseNode: new SyncBailHook()
|
|
8601
8614
|
};
|
|
8602
8615
|
}
|
|
@@ -8611,21 +8624,6 @@ var MarkdownPlugin = function() {
|
|
|
8611
8624
|
return viewNode;
|
|
8612
8625
|
}
|
|
8613
8626
|
},
|
|
8614
|
-
{
|
|
8615
|
-
key: "parseAsync",
|
|
8616
|
-
value: function parseAsync(obj, type, options) {
|
|
8617
|
-
var parsedAsync = this.parseObject((0, import_timm5.omit)(obj, "async"), type, options);
|
|
8618
|
-
var parsedNodeId = getNodeID(parsedAsync);
|
|
8619
|
-
if (parsedAsync !== null && parsedNodeId) {
|
|
8620
|
-
return this.createASTNode({
|
|
8621
|
-
id: parsedNodeId,
|
|
8622
|
-
type: "async",
|
|
8623
|
-
value: parsedAsync
|
|
8624
|
-
}, obj);
|
|
8625
|
-
}
|
|
8626
|
-
return null;
|
|
8627
|
-
}
|
|
8628
|
-
},
|
|
8629
8627
|
{
|
|
8630
8628
|
key: "createASTNode",
|
|
8631
8629
|
value: function createASTNode(node2, value) {
|
|
@@ -8636,25 +8634,6 @@ var MarkdownPlugin = function() {
|
|
|
8636
8634
|
return tapped;
|
|
8637
8635
|
}
|
|
8638
8636
|
},
|
|
8639
|
-
{
|
|
8640
|
-
/**
|
|
8641
|
-
* Checks if there are templated values in the object
|
|
8642
|
-
*
|
|
8643
|
-
* @param obj - The Parsed Object to check to see if we have a template array type for
|
|
8644
|
-
* @param localKey - The key being checked
|
|
8645
|
-
*/ key: "hasTemplateValues",
|
|
8646
|
-
value: function hasTemplateValues(obj, localKey) {
|
|
8647
|
-
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) {
|
|
8648
|
-
return tmpl.output === localKey;
|
|
8649
|
-
});
|
|
8650
|
-
}
|
|
8651
|
-
},
|
|
8652
|
-
{
|
|
8653
|
-
key: "hasSwitchKey",
|
|
8654
|
-
value: function hasSwitchKey(localKey) {
|
|
8655
|
-
return localKey === "staticSwitch";
|
|
8656
|
-
}
|
|
8657
|
-
},
|
|
8658
8637
|
{
|
|
8659
8638
|
key: "parseObject",
|
|
8660
8639
|
value: function parseObject(obj) {
|
|
@@ -8662,12 +8641,9 @@ var MarkdownPlugin = function() {
|
|
|
8662
8641
|
templateDepth: 0
|
|
8663
8642
|
};
|
|
8664
8643
|
var _this = this;
|
|
8665
|
-
var
|
|
8666
|
-
if (
|
|
8667
|
-
|
|
8668
|
-
if (parsedNode) {
|
|
8669
|
-
return parsedNode;
|
|
8670
|
-
}
|
|
8644
|
+
var parsedNode = this.hooks.parseNode.call(obj, type, options);
|
|
8645
|
+
if (parsedNode || parsedNode === null) {
|
|
8646
|
+
return parsedNode;
|
|
8671
8647
|
}
|
|
8672
8648
|
var parseLocalObject = function(currentValue, objToParse) {
|
|
8673
8649
|
var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
|
|
@@ -8697,166 +8673,42 @@ var MarkdownPlugin = function() {
|
|
|
8697
8673
|
value: currentValue
|
|
8698
8674
|
};
|
|
8699
8675
|
var newValue = objEntries.reduce(function(accumulation, current) {
|
|
8700
|
-
var
|
|
8701
|
-
|
|
8702
|
-
]);
|
|
8676
|
+
var value2 = accumulation.value;
|
|
8677
|
+
var children2 = accumulation.children;
|
|
8703
8678
|
var _current = _sliced_to_array(current, 2), localKey = _current[0], localValue = _current[1];
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
]),
|
|
8713
|
-
value: assetAST
|
|
8714
|
-
}
|
|
8715
|
-
])
|
|
8716
|
-
});
|
|
8717
|
-
}
|
|
8718
|
-
} else if (_this.hooks.determineNodeType.call(localKey) === "template" && Array.isArray(localValue)) {
|
|
8719
|
-
var templateChildren = localValue.map(function(template) {
|
|
8720
|
-
var _options_templateDepth, _template_dynamic;
|
|
8721
|
-
var templateAST = _this.hooks.onCreateASTNode.call({
|
|
8722
|
-
type: "template",
|
|
8723
|
-
depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
|
|
8724
|
-
data: template.data,
|
|
8725
|
-
template: template.value,
|
|
8726
|
-
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
|
|
8727
|
-
}, template);
|
|
8728
|
-
if ((templateAST === null || templateAST === void 0 ? void 0 : templateAST.type) === "multi-node") {
|
|
8729
|
-
templateAST.values.forEach(function(v) {
|
|
8730
|
-
v.parent = templateAST;
|
|
8731
|
-
});
|
|
8732
|
-
}
|
|
8733
|
-
if (templateAST) {
|
|
8734
|
-
return {
|
|
8735
|
-
path: _to_consumable_array(path).concat([
|
|
8736
|
-
template.output
|
|
8737
|
-
]),
|
|
8738
|
-
value: templateAST
|
|
8739
|
-
};
|
|
8740
|
-
}
|
|
8741
|
-
return;
|
|
8742
|
-
}).filter(function(element) {
|
|
8743
|
-
return !!element;
|
|
8744
|
-
});
|
|
8745
|
-
return _object_spread_props(_object_spread({}, rest), {
|
|
8746
|
-
children: _to_consumable_array(children2).concat(_to_consumable_array(templateChildren))
|
|
8747
|
-
});
|
|
8748
|
-
} else if (localValue && _this.hooks.determineNodeType.call(localValue) === "switch" || _this.hasSwitchKey(localKey)) {
|
|
8749
|
-
var _localSwitch_children;
|
|
8750
|
-
var localSwitch = _this.hooks.parseNode.call(_this.hasSwitchKey(localKey) ? _define_property({}, localKey, localValue) : localValue, "value", options, "switch");
|
|
8751
|
-
if (localSwitch && localSwitch.type === "value" && ((_localSwitch_children = localSwitch.children) === null || _localSwitch_children === void 0 ? void 0 : _localSwitch_children.length) === 1 && localSwitch.value === void 0) {
|
|
8752
|
-
var firstChild = localSwitch.children[0];
|
|
8753
|
-
return _object_spread_props(_object_spread({}, rest), {
|
|
8754
|
-
children: _to_consumable_array(children2).concat([
|
|
8755
|
-
{
|
|
8756
|
-
path: _to_consumable_array(path).concat([
|
|
8757
|
-
localKey
|
|
8758
|
-
], _to_consumable_array(firstChild.path)),
|
|
8759
|
-
value: firstChild.value
|
|
8760
|
-
}
|
|
8761
|
-
])
|
|
8762
|
-
});
|
|
8763
|
-
}
|
|
8764
|
-
if (localSwitch) {
|
|
8765
|
-
return _object_spread_props(_object_spread({}, rest), {
|
|
8766
|
-
children: _to_consumable_array(children2).concat([
|
|
8767
|
-
{
|
|
8768
|
-
path: _to_consumable_array(path).concat([
|
|
8769
|
-
localKey
|
|
8770
|
-
]),
|
|
8771
|
-
value: localSwitch
|
|
8772
|
-
}
|
|
8773
|
-
])
|
|
8774
|
-
});
|
|
8775
|
-
}
|
|
8776
|
-
} else if (localValue && hasAsync(localValue)) {
|
|
8777
|
-
var localAsync = _this.parseAsync(localValue, "value", options);
|
|
8778
|
-
if (localAsync) {
|
|
8779
|
-
children2.push({
|
|
8780
|
-
path: _to_consumable_array(path).concat([
|
|
8781
|
-
localKey
|
|
8782
|
-
]),
|
|
8783
|
-
value: localAsync
|
|
8784
|
-
});
|
|
8785
|
-
}
|
|
8786
|
-
} else if (localValue && Array.isArray(localValue)) {
|
|
8787
|
-
var childValues = localValue.map(function(childVal) {
|
|
8788
|
-
return _this.parseObject(childVal, "value", options);
|
|
8789
|
-
}).filter(function(child) {
|
|
8790
|
-
return !!child;
|
|
8791
|
-
});
|
|
8792
|
-
if (childValues.length > 0) {
|
|
8793
|
-
var multiNode = _this.hooks.onCreateASTNode.call({
|
|
8794
|
-
type: "multi-node",
|
|
8795
|
-
override: !_this.hasTemplateValues(localObj, localKey),
|
|
8796
|
-
values: childValues
|
|
8797
|
-
}, localValue);
|
|
8798
|
-
if ((multiNode === null || multiNode === void 0 ? void 0 : multiNode.type) === "multi-node") {
|
|
8799
|
-
multiNode.values.forEach(function(v) {
|
|
8800
|
-
v.parent = multiNode;
|
|
8801
|
-
});
|
|
8802
|
-
}
|
|
8803
|
-
if (multiNode) {
|
|
8804
|
-
return _object_spread_props(_object_spread({}, rest), {
|
|
8805
|
-
children: _to_consumable_array(children2).concat([
|
|
8806
|
-
{
|
|
8807
|
-
path: _to_consumable_array(path).concat([
|
|
8808
|
-
localKey
|
|
8809
|
-
]),
|
|
8810
|
-
value: multiNode
|
|
8811
|
-
}
|
|
8812
|
-
])
|
|
8813
|
-
});
|
|
8814
|
-
}
|
|
8815
|
-
}
|
|
8679
|
+
var newChildren = _this.hooks.parseNode.call(localValue, "value", options, {
|
|
8680
|
+
path: path,
|
|
8681
|
+
key: localKey,
|
|
8682
|
+
parentObj: localObj
|
|
8683
|
+
});
|
|
8684
|
+
if (newChildren) {
|
|
8685
|
+
var _children2;
|
|
8686
|
+
(_children2 = children2).push.apply(_children2, _to_consumable_array(newChildren));
|
|
8816
8687
|
} else if (localValue && typeof localValue === "object") {
|
|
8817
|
-
var
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
{
|
|
8824
|
-
path: _to_consumable_array(path).concat([
|
|
8825
|
-
localKey
|
|
8826
|
-
]),
|
|
8827
|
-
value: parsedNode
|
|
8828
|
-
}
|
|
8829
|
-
])
|
|
8830
|
-
});
|
|
8831
|
-
}
|
|
8832
|
-
} else {
|
|
8833
|
-
var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
|
|
8834
|
-
localKey
|
|
8835
|
-
]));
|
|
8836
|
-
return {
|
|
8837
|
-
value: result.value,
|
|
8838
|
-
children: _to_consumable_array(children2).concat(_to_consumable_array(result.children))
|
|
8839
|
-
};
|
|
8840
|
-
}
|
|
8688
|
+
var _children21;
|
|
8689
|
+
var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
|
|
8690
|
+
localKey
|
|
8691
|
+
]));
|
|
8692
|
+
value2 = result.value;
|
|
8693
|
+
(_children21 = children2).push.apply(_children21, _to_consumable_array(result.children));
|
|
8841
8694
|
} else {
|
|
8842
|
-
|
|
8695
|
+
value2 = (0, import_timm5.setIn)(accumulation.value, _to_consumable_array(path).concat([
|
|
8843
8696
|
localKey
|
|
8844
8697
|
]), localValue);
|
|
8845
|
-
return {
|
|
8846
|
-
children: children2,
|
|
8847
|
-
value: value2
|
|
8848
|
-
};
|
|
8849
8698
|
}
|
|
8850
|
-
return
|
|
8699
|
+
return {
|
|
8700
|
+
value: value2,
|
|
8701
|
+
children: children2
|
|
8702
|
+
};
|
|
8851
8703
|
}, defaultValue);
|
|
8852
8704
|
return newValue;
|
|
8853
8705
|
};
|
|
8854
8706
|
var _parseLocalObject = parseLocalObject(void 0, obj), value = _parseLocalObject.value, children = _parseLocalObject.children;
|
|
8855
|
-
var baseAst = value === void 0 && children.length
|
|
8707
|
+
var baseAst = value === void 0 && !children.length ? void 0 : {
|
|
8856
8708
|
type: type,
|
|
8857
8709
|
value: value
|
|
8858
8710
|
};
|
|
8859
|
-
if (baseAst
|
|
8711
|
+
if (baseAst && children.length) {
|
|
8860
8712
|
var parent = baseAst;
|
|
8861
8713
|
parent.children = children;
|
|
8862
8714
|
children.forEach(function(child) {
|
|
@@ -9344,24 +9196,30 @@ var MarkdownPlugin = function() {
|
|
|
9344
9196
|
}
|
|
9345
9197
|
return node2;
|
|
9346
9198
|
});
|
|
9347
|
-
parser.hooks.
|
|
9348
|
-
if (
|
|
9349
|
-
return
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9199
|
+
parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
|
|
9200
|
+
if (childOptions && hasTemplateKey(childOptions.key)) {
|
|
9201
|
+
return obj.map(function(template) {
|
|
9202
|
+
var _options_templateDepth, _template_dynamic;
|
|
9203
|
+
var templateAST = parser.createASTNode({
|
|
9204
|
+
type: "template",
|
|
9205
|
+
depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
|
|
9206
|
+
data: template.data,
|
|
9207
|
+
template: template.value,
|
|
9208
|
+
dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
|
|
9209
|
+
}, template);
|
|
9210
|
+
if (!templateAST) return;
|
|
9211
|
+
if (templateAST.type === "multi-node") {
|
|
9212
|
+
templateAST.values.forEach(function(v) {
|
|
9213
|
+
v.parent = templateAST;
|
|
9214
|
+
});
|
|
9215
|
+
}
|
|
9216
|
+
return {
|
|
9217
|
+
path: _to_consumable_array(childOptions.path).concat([
|
|
9218
|
+
template.output
|
|
9219
|
+
]),
|
|
9220
|
+
value: templateAST
|
|
9221
|
+
};
|
|
9222
|
+
}).filter(Boolean);
|
|
9365
9223
|
}
|
|
9366
9224
|
});
|
|
9367
9225
|
}
|
|
@@ -9505,6 +9363,12 @@ var MarkdownPlugin = function() {
|
|
|
9505
9363
|
_class_call_check(this, ApplicabilityPlugin);
|
|
9506
9364
|
}
|
|
9507
9365
|
_create_class(ApplicabilityPlugin, [
|
|
9366
|
+
{
|
|
9367
|
+
key: "isApplicability",
|
|
9368
|
+
value: function isApplicability(obj) {
|
|
9369
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, "applicability");
|
|
9370
|
+
}
|
|
9371
|
+
},
|
|
9508
9372
|
{
|
|
9509
9373
|
key: "applyResolver",
|
|
9510
9374
|
value: function applyResolver(resolver2) {
|
|
@@ -9524,25 +9388,32 @@ var MarkdownPlugin = function() {
|
|
|
9524
9388
|
{
|
|
9525
9389
|
key: "applyParser",
|
|
9526
9390
|
value: function applyParser(parser) {
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
}
|
|
9531
|
-
});
|
|
9532
|
-
parser.hooks.parseNode.tap("applicability", function(obj, nodeType, options, determinedNodeType) {
|
|
9533
|
-
if (determinedNodeType === "applicability") {
|
|
9391
|
+
var _this = this;
|
|
9392
|
+
parser.hooks.parseNode.tap("applicability", function(obj, nodeType, options, childOptions) {
|
|
9393
|
+
if (_this.isApplicability(obj)) {
|
|
9534
9394
|
var parsedApplicability = parser.parseObject((0, import_timm7.omit)(obj, "applicability"), nodeType, options);
|
|
9535
|
-
if (parsedApplicability
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
return
|
|
9395
|
+
if (!parsedApplicability) {
|
|
9396
|
+
return childOptions ? [] : null;
|
|
9397
|
+
}
|
|
9398
|
+
var applicabilityNode = parser.createASTNode({
|
|
9399
|
+
type: "applicability",
|
|
9400
|
+
expression: obj.applicability,
|
|
9401
|
+
value: parsedApplicability
|
|
9402
|
+
}, obj);
|
|
9403
|
+
if (!applicabilityNode) {
|
|
9404
|
+
return childOptions ? [] : null;
|
|
9545
9405
|
}
|
|
9406
|
+
if (applicabilityNode.type === "applicability") {
|
|
9407
|
+
applicabilityNode.value.parent = applicabilityNode;
|
|
9408
|
+
}
|
|
9409
|
+
return childOptions ? [
|
|
9410
|
+
{
|
|
9411
|
+
path: _to_consumable_array(childOptions.path).concat([
|
|
9412
|
+
childOptions.key
|
|
9413
|
+
]),
|
|
9414
|
+
value: applicabilityNode
|
|
9415
|
+
}
|
|
9416
|
+
] : applicabilityNode;
|
|
9546
9417
|
}
|
|
9547
9418
|
});
|
|
9548
9419
|
}
|
|
@@ -9592,6 +9463,12 @@ var MarkdownPlugin = function() {
|
|
|
9592
9463
|
return EMPTY_NODE;
|
|
9593
9464
|
}
|
|
9594
9465
|
},
|
|
9466
|
+
{
|
|
9467
|
+
key: "isSwitch",
|
|
9468
|
+
value: function isSwitch(obj) {
|
|
9469
|
+
return obj && (Object.prototype.hasOwnProperty.call(obj, "dynamicSwitch") || Object.prototype.hasOwnProperty.call(obj, "staticSwitch"));
|
|
9470
|
+
}
|
|
9471
|
+
},
|
|
9595
9472
|
{
|
|
9596
9473
|
key: "applyParser",
|
|
9597
9474
|
value: function applyParser(parser) {
|
|
@@ -9602,42 +9479,56 @@ var MarkdownPlugin = function() {
|
|
|
9602
9479
|
}
|
|
9603
9480
|
return node2;
|
|
9604
9481
|
});
|
|
9605
|
-
parser.hooks.
|
|
9606
|
-
if (
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
if (determinedNodeType === "switch") {
|
|
9612
|
-
var dynamic = "dynamicSwitch" in obj;
|
|
9613
|
-
var switchContent = "dynamicSwitch" in obj ? obj.dynamicSwitch : obj.staticSwitch;
|
|
9614
|
-
var cases = [];
|
|
9615
|
-
switchContent.forEach(function(switchCase) {
|
|
9482
|
+
parser.hooks.parseNode.tap("switch", function(obj, _nodeType, options, childOptions) {
|
|
9483
|
+
if (_this.isSwitch(obj) || childOptions && hasSwitchKey(childOptions.key)) {
|
|
9484
|
+
var objToParse = childOptions && hasSwitchKey(childOptions.key) ? _define_property({}, childOptions.key, obj) : obj;
|
|
9485
|
+
var dynamic = "dynamicSwitch" in objToParse;
|
|
9486
|
+
var switchContent = dynamic ? objToParse.dynamicSwitch : objToParse.staticSwitch;
|
|
9487
|
+
var cases = switchContent.map(function(switchCase) {
|
|
9616
9488
|
var switchCaseExpr = switchCase.case, switchBody = _object_without_properties(switchCase, [
|
|
9617
9489
|
"case"
|
|
9618
9490
|
]);
|
|
9619
9491
|
var value = parser.parseObject(switchBody, "value", options);
|
|
9620
9492
|
if (value) {
|
|
9621
|
-
|
|
9493
|
+
return {
|
|
9622
9494
|
case: switchCaseExpr,
|
|
9623
9495
|
value: value
|
|
9624
|
-
}
|
|
9496
|
+
};
|
|
9625
9497
|
}
|
|
9626
|
-
|
|
9627
|
-
|
|
9498
|
+
return;
|
|
9499
|
+
}).filter(Boolean);
|
|
9500
|
+
var switchAST = parser.createASTNode({
|
|
9628
9501
|
type: "switch",
|
|
9629
9502
|
dynamic: dynamic,
|
|
9630
9503
|
cases: cases
|
|
9631
|
-
},
|
|
9632
|
-
if (
|
|
9504
|
+
}, objToParse);
|
|
9505
|
+
if (!switchAST || switchAST.type === "empty") {
|
|
9506
|
+
return childOptions ? [] : null;
|
|
9507
|
+
}
|
|
9508
|
+
if (switchAST.type === "switch") {
|
|
9633
9509
|
switchAST.cases.forEach(function(sCase) {
|
|
9634
9510
|
sCase.value.parent = switchAST;
|
|
9635
9511
|
});
|
|
9636
9512
|
}
|
|
9637
|
-
if (
|
|
9638
|
-
|
|
9513
|
+
if (childOptions) {
|
|
9514
|
+
var _switchAST_children;
|
|
9515
|
+
var path = _to_consumable_array(childOptions.path).concat([
|
|
9516
|
+
childOptions.key
|
|
9517
|
+
]);
|
|
9518
|
+
var value = switchAST;
|
|
9519
|
+
if (switchAST.type === "value" && ((_switchAST_children = switchAST.children) === null || _switchAST_children === void 0 ? void 0 : _switchAST_children.length) === 1 && switchAST.value === void 0) {
|
|
9520
|
+
var firstChild = switchAST.children[0];
|
|
9521
|
+
path = _to_consumable_array(path).concat(_to_consumable_array(firstChild.path));
|
|
9522
|
+
value = firstChild.value;
|
|
9523
|
+
}
|
|
9524
|
+
return [
|
|
9525
|
+
{
|
|
9526
|
+
path: path,
|
|
9527
|
+
value: value
|
|
9528
|
+
}
|
|
9529
|
+
];
|
|
9639
9530
|
}
|
|
9640
|
-
return switchAST
|
|
9531
|
+
return switchAST;
|
|
9641
9532
|
}
|
|
9642
9533
|
});
|
|
9643
9534
|
}
|
|
@@ -9664,6 +9555,93 @@ var MarkdownPlugin = function() {
|
|
|
9664
9555
|
]);
|
|
9665
9556
|
return SwitchPlugin;
|
|
9666
9557
|
}();
|
|
9558
|
+
var MultiNodePlugin = /*#__PURE__*/ function() {
|
|
9559
|
+
function MultiNodePlugin() {
|
|
9560
|
+
_class_call_check(this, MultiNodePlugin);
|
|
9561
|
+
}
|
|
9562
|
+
_create_class(MultiNodePlugin, [
|
|
9563
|
+
{
|
|
9564
|
+
key: "applyParser",
|
|
9565
|
+
value: function applyParser(parser) {
|
|
9566
|
+
parser.hooks.parseNode.tap("multi-node", function(obj, nodeType, options, childOptions) {
|
|
9567
|
+
if (childOptions && !hasTemplateKey(childOptions.key) && Array.isArray(obj)) {
|
|
9568
|
+
var values = obj.map(function(childVal) {
|
|
9569
|
+
return parser.parseObject(childVal, "value", options);
|
|
9570
|
+
}).filter(function(child) {
|
|
9571
|
+
return !!child;
|
|
9572
|
+
});
|
|
9573
|
+
if (!values.length) {
|
|
9574
|
+
return [];
|
|
9575
|
+
}
|
|
9576
|
+
var multiNode = parser.createASTNode({
|
|
9577
|
+
type: "multi-node",
|
|
9578
|
+
override: !hasTemplateValues(childOptions.parentObj, childOptions.key),
|
|
9579
|
+
values: values
|
|
9580
|
+
}, obj);
|
|
9581
|
+
if (!multiNode) {
|
|
9582
|
+
return [];
|
|
9583
|
+
}
|
|
9584
|
+
if (multiNode.type === "multi-node") {
|
|
9585
|
+
multiNode.values.forEach(function(v) {
|
|
9586
|
+
v.parent = multiNode;
|
|
9587
|
+
});
|
|
9588
|
+
}
|
|
9589
|
+
return [
|
|
9590
|
+
{
|
|
9591
|
+
path: _to_consumable_array(childOptions.path).concat([
|
|
9592
|
+
childOptions.key
|
|
9593
|
+
]),
|
|
9594
|
+
value: multiNode
|
|
9595
|
+
}
|
|
9596
|
+
];
|
|
9597
|
+
}
|
|
9598
|
+
});
|
|
9599
|
+
}
|
|
9600
|
+
},
|
|
9601
|
+
{
|
|
9602
|
+
key: "apply",
|
|
9603
|
+
value: function apply(view) {
|
|
9604
|
+
view.hooks.parser.tap("multi-node", this.applyParser.bind(this));
|
|
9605
|
+
}
|
|
9606
|
+
}
|
|
9607
|
+
]);
|
|
9608
|
+
return MultiNodePlugin;
|
|
9609
|
+
}();
|
|
9610
|
+
var AssetPlugin = /*#__PURE__*/ function() {
|
|
9611
|
+
function AssetPlugin() {
|
|
9612
|
+
_class_call_check(this, AssetPlugin);
|
|
9613
|
+
}
|
|
9614
|
+
_create_class(AssetPlugin, [
|
|
9615
|
+
{
|
|
9616
|
+
key: "applyParser",
|
|
9617
|
+
value: function applyParser(parser) {
|
|
9618
|
+
parser.hooks.parseNode.tap("asset", function(obj, nodeType, options, childOptions) {
|
|
9619
|
+
if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && typeof obj === "object") {
|
|
9620
|
+
var assetAST = parser.parseObject(obj, "asset", options);
|
|
9621
|
+
if (!assetAST) {
|
|
9622
|
+
return [];
|
|
9623
|
+
}
|
|
9624
|
+
return [
|
|
9625
|
+
{
|
|
9626
|
+
path: _to_consumable_array(childOptions.path).concat([
|
|
9627
|
+
childOptions.key
|
|
9628
|
+
]),
|
|
9629
|
+
value: assetAST
|
|
9630
|
+
}
|
|
9631
|
+
];
|
|
9632
|
+
}
|
|
9633
|
+
});
|
|
9634
|
+
}
|
|
9635
|
+
},
|
|
9636
|
+
{
|
|
9637
|
+
key: "apply",
|
|
9638
|
+
value: function apply(view) {
|
|
9639
|
+
view.hooks.parser.tap("asset", this.applyParser.bind(this));
|
|
9640
|
+
}
|
|
9641
|
+
}
|
|
9642
|
+
]);
|
|
9643
|
+
return AssetPlugin;
|
|
9644
|
+
}();
|
|
9667
9645
|
var FlowInstance = /*#__PURE__*/ function() {
|
|
9668
9646
|
function FlowInstance(id, flow3, options) {
|
|
9669
9647
|
_class_call_check(this, FlowInstance);
|
|
@@ -11366,12 +11344,14 @@ var MarkdownPlugin = function() {
|
|
|
11366
11344
|
player.hooks.viewController.tap(this.name, function(viewController) {
|
|
11367
11345
|
viewController.hooks.view.tap(_this.name, function(view) {
|
|
11368
11346
|
var pluginOptions = toNodeResolveOptions(view.resolverOptions);
|
|
11347
|
+
new AssetPlugin().apply(view);
|
|
11369
11348
|
new SwitchPlugin(pluginOptions).apply(view);
|
|
11370
11349
|
new ApplicabilityPlugin().apply(view);
|
|
11371
11350
|
new StringResolverPlugin().apply(view);
|
|
11372
11351
|
var templatePlugin = new TemplatePlugin(pluginOptions);
|
|
11373
11352
|
templatePlugin.apply(view);
|
|
11374
11353
|
view.hooks.onTemplatePluginCreated.call(templatePlugin);
|
|
11354
|
+
new MultiNodePlugin().apply(view);
|
|
11375
11355
|
});
|
|
11376
11356
|
});
|
|
11377
11357
|
}
|