@player-ui/player 0.8.0-next.0 → 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/Player.native.js +469 -4094
- package/dist/Player.native.js.map +1 -1
- package/dist/cjs/index.cjs +293 -407
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +291 -409
- package/dist/index.mjs +291 -409
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -8
- package/src/binding/__tests__/resolver.test.ts +4 -4
- package/src/binding-grammar/{ebnf → __tests__/ebnf}/index.ts +2 -2
- package/src/binding-grammar/__tests__/parser.test.ts +2 -2
- package/src/binding-grammar/{parsimmon → __tests__/parsimmon}/index.ts +2 -2
- package/src/binding-grammar/index.ts +0 -2
- package/src/plugins/default-view-plugin.ts +4 -0
- package/src/view/__tests__/view.immutable.test.ts +8 -1
- package/src/view/__tests__/view.test.ts +59 -1
- package/src/view/parser/__tests__/parser.test.ts +16 -1
- package/src/view/parser/index.ts +46 -262
- package/src/view/parser/utils.ts +23 -3
- package/src/view/plugins/__tests__/__snapshots__/asset.test.ts.snap +215 -0
- package/src/view/plugins/__tests__/__snapshots__/multi-node.test.ts.snap +67 -0
- package/src/view/plugins/__tests__/__snapshots__/template.test.ts.snap +56 -54
- package/src/view/plugins/__tests__/applicability.test.ts +24 -16
- package/src/view/plugins/__tests__/asset.test.ts +140 -0
- package/src/view/plugins/__tests__/multi-node.test.ts +38 -0
- package/src/view/plugins/__tests__/template.test.ts +48 -388
- package/src/view/plugins/applicability.ts +39 -23
- package/src/view/plugins/asset.ts +42 -0
- package/src/view/plugins/index.ts +3 -1
- package/src/view/plugins/multi-node.ts +73 -0
- package/src/view/plugins/switch.ts +81 -50
- package/src/view/plugins/{template-plugin.ts → template.ts} +38 -24
- package/src/view/resolver/__tests__/edgecases.test.ts +14 -1
- package/src/view/view.ts +2 -7
- package/types/binding-grammar/index.d.ts +0 -2
- package/types/view/parser/index.d.ts +6 -11
- package/types/view/parser/utils.d.ts +11 -2
- package/types/view/plugins/applicability.d.ts +1 -0
- package/types/view/plugins/asset.d.ts +8 -0
- package/types/view/plugins/index.d.ts +3 -1
- package/types/view/plugins/multi-node.d.ts +8 -0
- package/types/view/plugins/switch.d.ts +2 -1
- package/types/view/plugins/{template-plugin.d.ts → template.d.ts} +2 -2
- package/types/binding-grammar/ebnf/index.d.ts +0 -4
- package/types/binding-grammar/ebnf/types.d.ts +0 -75
- package/types/binding-grammar/parsimmon/index.d.ts +0 -4
- /package/src/binding-grammar/{ebnf → __tests__/ebnf}/binding.ebnf +0 -0
- /package/src/binding-grammar/{ebnf → __tests__/ebnf}/types.ts +0 -0
package/dist/cjs/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
var src_exports = {};
|
|
33
33
|
__export(src_exports, {
|
|
34
34
|
ApplicabilityPlugin: () => ApplicabilityPlugin,
|
|
35
|
+
AssetPlugin: () => AssetPlugin,
|
|
35
36
|
AssetTransformCorePlugin: () => AssetTransformCorePlugin,
|
|
36
37
|
BINDING_BRACKETS_REGEX: () => BINDING_BRACKETS_REGEX,
|
|
37
38
|
BindingInstance: () => BindingInstance,
|
|
@@ -51,6 +52,7 @@ __export(src_exports, {
|
|
|
51
52
|
FlowInstance: () => FlowInstance,
|
|
52
53
|
LocalModel: () => LocalModel,
|
|
53
54
|
LocalStateStore: () => LocalStateStore,
|
|
55
|
+
MultiNodePlugin: () => MultiNodePlugin,
|
|
54
56
|
NOOPDataModel: () => NOOPDataModel,
|
|
55
57
|
NOOP_MODEL: () => NOOP_MODEL,
|
|
56
58
|
NOT_STARTED_STATE: () => NOT_STARTED_STATE,
|
|
@@ -84,13 +86,15 @@ __export(src_exports, {
|
|
|
84
86
|
findNextExp: () => findNextExp,
|
|
85
87
|
getBindingSegments: () => getBindingSegments,
|
|
86
88
|
getNodeID: () => getNodeID,
|
|
87
|
-
|
|
89
|
+
hasSwitchKey: () => hasSwitchKey,
|
|
90
|
+
hasTemplateKey: () => hasTemplateKey,
|
|
91
|
+
hasTemplateValues: () => hasTemplateValues,
|
|
88
92
|
isBinding: () => isBinding,
|
|
89
93
|
isErrorWithLocation: () => isErrorWithLocation,
|
|
90
94
|
isExpressionNode: () => isExpressionNode,
|
|
91
95
|
isObjectExpression: () => isObjectExpression,
|
|
92
96
|
maybeConvertToNum: () => maybeConvertToNum,
|
|
93
|
-
parse: () =>
|
|
97
|
+
parse: () => parse2,
|
|
94
98
|
parseExpression: () => parseExpression,
|
|
95
99
|
removeBindingAndChildrenFromMap: () => removeBindingAndChildrenFromMap,
|
|
96
100
|
resolveDataRefs: () => resolveDataRefs,
|
|
@@ -119,9 +123,9 @@ var toExpression = (value) => ({
|
|
|
119
123
|
name: "Expression",
|
|
120
124
|
value
|
|
121
125
|
});
|
|
122
|
-
var toPath = (
|
|
126
|
+
var toPath = (path) => ({
|
|
123
127
|
name: "PathNode",
|
|
124
|
-
path
|
|
128
|
+
path
|
|
125
129
|
});
|
|
126
130
|
var toQuery = (key, value) => ({
|
|
127
131
|
name: "Query",
|
|
@@ -138,60 +142,6 @@ var toConcatenatedNode = (values) => {
|
|
|
138
142
|
};
|
|
139
143
|
};
|
|
140
144
|
|
|
141
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/binding-grammar/parsimmon/index.ts
|
|
142
|
-
var import_arr_flatten = __toESM(require("arr-flatten"));
|
|
143
|
-
var import_parsimmon = __toESM(require("parsimmon"));
|
|
144
|
-
var doubleQuote = import_parsimmon.default.string('"');
|
|
145
|
-
var singleQuote = import_parsimmon.default.string("'");
|
|
146
|
-
var backTick = import_parsimmon.default.string("`");
|
|
147
|
-
var identifier = import_parsimmon.default.regex(/[\w\-@]+/).desc("identifier").map(toValue);
|
|
148
|
-
var path;
|
|
149
|
-
var futurePath = import_parsimmon.default.lazy(() => path);
|
|
150
|
-
var nestedPath = futurePath.trim(import_parsimmon.default.optWhitespace).wrap(import_parsimmon.default.string("{{"), import_parsimmon.default.string("}}")).map(toPath);
|
|
151
|
-
var nestedExpression = import_parsimmon.default.regex(/[^`]*/).wrap(backTick, backTick).map(toExpression);
|
|
152
|
-
var segment = import_parsimmon.default.alt(identifier, nestedPath, nestedExpression).atLeast(1).map(import_arr_flatten.default).map(toConcatenatedNode);
|
|
153
|
-
var optionallyQuotedSegment = import_parsimmon.default.alt(
|
|
154
|
-
import_parsimmon.default.regex(/[^"]*/).wrap(doubleQuote, doubleQuote).map(toValue),
|
|
155
|
-
import_parsimmon.default.regex(/[^']*/).wrap(singleQuote, singleQuote).map(toValue),
|
|
156
|
-
segment
|
|
157
|
-
);
|
|
158
|
-
var query = import_parsimmon.default.seq(
|
|
159
|
-
optionallyQuotedSegment,
|
|
160
|
-
import_parsimmon.default.string("=").times(1, 3).trim(import_parsimmon.default.optWhitespace),
|
|
161
|
-
optionallyQuotedSegment
|
|
162
|
-
).map(([key, , value]) => toQuery(key, value));
|
|
163
|
-
var brackets = import_parsimmon.default.alt(query, optionallyQuotedSegment).trim(import_parsimmon.default.optWhitespace).wrap(import_parsimmon.default.string("["), import_parsimmon.default.string("]")).many();
|
|
164
|
-
var segmentAndBrackets = import_parsimmon.default.seqMap(segment, brackets, (s, bs) => [s, ...bs]);
|
|
165
|
-
path = import_parsimmon.default.sepBy(segmentAndBrackets, import_parsimmon.default.string(".")).map(import_arr_flatten.default);
|
|
166
|
-
|
|
167
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/binding-grammar/ebnf/index.ts
|
|
168
|
-
var import_ebnf = require("ebnf");
|
|
169
|
-
var parser = new import_ebnf.Grammars.W3C.Parser(`
|
|
170
|
-
value ::= segment_and_bracket (SEGMENT_SEPARATOR segment_and_bracket)*
|
|
171
|
-
segment ::= concatenated | expression | modelRef | identifier
|
|
172
|
-
concatenated ::= (expression | modelRef | identifier)+
|
|
173
|
-
modelRef ::= OPEN_CURL OPEN_CURL value CLOSE_CURL CLOSE_CURL
|
|
174
|
-
identifier ::= [\\w\\-@]+
|
|
175
|
-
query ::= WHITESPACE* optionally_quoted_segment WHITESPACE* EQUALS EQUALS? EQUALS? WHITESPACE* optionally_quoted_segment WHITESPACE*
|
|
176
|
-
brackets ::= OPEN_BRACKET WHITESPACE* (query | optionally_quoted_segment) WHITESPACE* CLOSE_BRACKET
|
|
177
|
-
segment_and_bracket ::= segment brackets*
|
|
178
|
-
quoted_value ::= [^"']*
|
|
179
|
-
optionally_quoted_segment ::= WHITESPACE* SINGLE_QUOTE quoted_value SINGLE_QUOTE WHITESPACE* | WHITESPACE* DOUBLE_QUOTE quoted_value DOUBLE_QUOTE WHITESPACE* | WHITESPACE* segment WHITESPACE*
|
|
180
|
-
expression_value ::= [^\`]*
|
|
181
|
-
expression ::= BACK_TICK expression_value BACK_TICK
|
|
182
|
-
|
|
183
|
-
EQUALS ::= "="
|
|
184
|
-
SEGMENT_SEPARATOR ::= "."
|
|
185
|
-
SINGLE_QUOTE ::= "'"
|
|
186
|
-
DOUBLE_QUOTE ::= '"'
|
|
187
|
-
WHITESPACE ::= " "
|
|
188
|
-
OPEN_CURL ::= "{"
|
|
189
|
-
CLOSE_CURL ::= "}"
|
|
190
|
-
OPEN_BRACKET ::= "["
|
|
191
|
-
CLOSE_BRACKET ::= "]"
|
|
192
|
-
BACK_TICK ::= "\`"
|
|
193
|
-
`);
|
|
194
|
-
|
|
195
145
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/binding-grammar/custom/index.ts
|
|
196
146
|
var SEGMENT_SEPARATOR = ".";
|
|
197
147
|
var OPEN_CURL = "{";
|
|
@@ -222,14 +172,14 @@ var isIdentifierChar = (char) => {
|
|
|
222
172
|
charCode === 125;
|
|
223
173
|
return !matches;
|
|
224
174
|
};
|
|
225
|
-
var parse = (
|
|
175
|
+
var parse = (path) => {
|
|
226
176
|
let index = 1;
|
|
227
|
-
let ch =
|
|
177
|
+
let ch = path.charAt(0);
|
|
228
178
|
const next = (expected) => {
|
|
229
179
|
if (expected && ch !== expected) {
|
|
230
180
|
throw new Error(`Expected char: ${expected} but got: ${ch}`);
|
|
231
181
|
}
|
|
232
|
-
ch =
|
|
182
|
+
ch = path.charAt(index);
|
|
233
183
|
index += 1;
|
|
234
184
|
return ch;
|
|
235
185
|
};
|
|
@@ -238,7 +188,7 @@ var parse = (path2) => {
|
|
|
238
188
|
next();
|
|
239
189
|
}
|
|
240
190
|
};
|
|
241
|
-
const
|
|
191
|
+
const identifier = () => {
|
|
242
192
|
if (!isIdentifierChar(ch)) {
|
|
243
193
|
return;
|
|
244
194
|
}
|
|
@@ -284,7 +234,7 @@ var parse = (path2) => {
|
|
|
284
234
|
return toValue(value);
|
|
285
235
|
}
|
|
286
236
|
};
|
|
287
|
-
const
|
|
237
|
+
const nestedPath = () => {
|
|
288
238
|
if (ch === OPEN_CURL) {
|
|
289
239
|
next(OPEN_CURL);
|
|
290
240
|
next(OPEN_CURL);
|
|
@@ -294,8 +244,8 @@ var parse = (path2) => {
|
|
|
294
244
|
return modelRef;
|
|
295
245
|
}
|
|
296
246
|
};
|
|
297
|
-
const simpleSegment = () =>
|
|
298
|
-
const
|
|
247
|
+
const simpleSegment = () => nestedPath() ?? expression() ?? identifier();
|
|
248
|
+
const segment = () => {
|
|
299
249
|
const segments = [];
|
|
300
250
|
let nextSegment = simpleSegment();
|
|
301
251
|
while (nextSegment !== void 0) {
|
|
@@ -307,13 +257,13 @@ var parse = (path2) => {
|
|
|
307
257
|
}
|
|
308
258
|
return toConcatenatedNode(segments);
|
|
309
259
|
};
|
|
310
|
-
const
|
|
260
|
+
const optionallyQuotedSegment = () => {
|
|
311
261
|
whitespace();
|
|
312
262
|
if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
|
|
313
|
-
const
|
|
314
|
-
next(
|
|
263
|
+
const singleQuote = ch === SINGLE_QUOTE;
|
|
264
|
+
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
315
265
|
const id = regex(/[^'"]+/);
|
|
316
|
-
next(
|
|
266
|
+
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
317
267
|
return id;
|
|
318
268
|
}
|
|
319
269
|
return simpleSegment();
|
|
@@ -331,12 +281,12 @@ var parse = (path2) => {
|
|
|
331
281
|
if (ch === OPEN_BRACKET) {
|
|
332
282
|
next(OPEN_BRACKET);
|
|
333
283
|
whitespace();
|
|
334
|
-
let value =
|
|
284
|
+
let value = optionallyQuotedSegment();
|
|
335
285
|
if (value) {
|
|
336
286
|
whitespace();
|
|
337
287
|
if (equals()) {
|
|
338
288
|
whitespace();
|
|
339
|
-
const second =
|
|
289
|
+
const second = optionallyQuotedSegment();
|
|
340
290
|
value = toQuery(value, second);
|
|
341
291
|
whitespace();
|
|
342
292
|
}
|
|
@@ -351,7 +301,7 @@ var parse = (path2) => {
|
|
|
351
301
|
};
|
|
352
302
|
const parseSegmentAndBrackets = () => {
|
|
353
303
|
const parsed = [];
|
|
354
|
-
const firstSegment =
|
|
304
|
+
const firstSegment = segment();
|
|
355
305
|
if (firstSegment) {
|
|
356
306
|
parsed.push(firstSegment);
|
|
357
307
|
let bracketSegment = parseBracket();
|
|
@@ -425,12 +375,12 @@ function findInArray(array, key, value) {
|
|
|
425
375
|
var BindingInstance = class _BindingInstance {
|
|
426
376
|
constructor(raw, factory = (rawBinding) => new _BindingInstance(rawBinding)) {
|
|
427
377
|
const split = Array.isArray(raw) ? raw : raw.split(".");
|
|
428
|
-
this.split = split.map((
|
|
429
|
-
if (typeof
|
|
430
|
-
return
|
|
378
|
+
this.split = split.map((segment) => {
|
|
379
|
+
if (typeof segment === "number") {
|
|
380
|
+
return segment;
|
|
431
381
|
}
|
|
432
|
-
const tryNum = Number(
|
|
433
|
-
return isNaN(tryNum) ?
|
|
382
|
+
const tryNum = Number(segment);
|
|
383
|
+
return isNaN(tryNum) ? segment : tryNum;
|
|
434
384
|
});
|
|
435
385
|
Object.freeze(this.split);
|
|
436
386
|
this.joined = this.split.join(".");
|
|
@@ -517,13 +467,13 @@ function resolveBindingAST(bindingPathNode, options, hooks) {
|
|
|
517
467
|
}
|
|
518
468
|
throw new Error(`Unable to resolve value for node: ${node.name}`);
|
|
519
469
|
}
|
|
520
|
-
function appendPathSegments(
|
|
521
|
-
if (typeof
|
|
522
|
-
|
|
470
|
+
function appendPathSegments(segment) {
|
|
471
|
+
if (typeof segment === "string" && segment.indexOf(".") > -1) {
|
|
472
|
+
segment.split(".").forEach((i) => {
|
|
523
473
|
context.path.push(maybeConvertToNum(i));
|
|
524
474
|
});
|
|
525
475
|
} else {
|
|
526
|
-
context.path.push(
|
|
476
|
+
context.path.push(segment);
|
|
527
477
|
}
|
|
528
478
|
}
|
|
529
479
|
function resolveNode(_node) {
|
|
@@ -594,21 +544,21 @@ var BindingParser = class {
|
|
|
594
544
|
* Takes a binding path, parses it, and returns an equivalent, normalized
|
|
595
545
|
* representation of that path.
|
|
596
546
|
*/
|
|
597
|
-
normalizePath(
|
|
598
|
-
if (!BINDING_BRACKETS_REGEX.test(
|
|
599
|
-
return { path:
|
|
547
|
+
normalizePath(path, resolveOptions) {
|
|
548
|
+
if (!BINDING_BRACKETS_REGEX.test(path) && LAZY_BINDING_REGEX.test(path) && this.hooks.skipOptimization.call(path) !== true) {
|
|
549
|
+
return { path: path.split("."), updates: void 0 };
|
|
600
550
|
}
|
|
601
|
-
const ast = this.parseCache[
|
|
602
|
-
this.parseCache[
|
|
551
|
+
const ast = this.parseCache[path] ?? parse(path);
|
|
552
|
+
this.parseCache[path] = ast;
|
|
603
553
|
if (typeof ast !== "object" || !ast?.status) {
|
|
604
554
|
throw new TypeError(
|
|
605
|
-
`Cannot normalize path "${
|
|
555
|
+
`Cannot normalize path "${path}": ${ast?.error ?? "Unknown Error."}`
|
|
606
556
|
);
|
|
607
557
|
}
|
|
608
558
|
try {
|
|
609
559
|
return resolveBindingAST(ast.path, resolveOptions, this.hooks);
|
|
610
560
|
} catch (e) {
|
|
611
|
-
throw new import_ts_nested_error2.NestedError(`Cannot resolve binding: ${
|
|
561
|
+
throw new import_ts_nested_error2.NestedError(`Cannot resolve binding: ${path}`, e);
|
|
612
562
|
}
|
|
613
563
|
}
|
|
614
564
|
getBindingForNormalizedResult(normalized) {
|
|
@@ -634,25 +584,25 @@ var BindingParser = class {
|
|
|
634
584
|
let updates = {};
|
|
635
585
|
const joined = Array.isArray(rawBinding) ? rawBinding.join(".") : String(rawBinding);
|
|
636
586
|
const normalizeConfig = {
|
|
637
|
-
getValue: (
|
|
638
|
-
const normalized2 = this.normalizePath(
|
|
587
|
+
getValue: (path) => {
|
|
588
|
+
const normalized2 = this.normalizePath(path.join("."), normalizeConfig);
|
|
639
589
|
return options.get(this.getBindingForNormalizedResult(normalized2));
|
|
640
590
|
},
|
|
641
591
|
evaluate: (exp) => {
|
|
642
592
|
return options.evaluate(exp);
|
|
643
593
|
},
|
|
644
|
-
convertToPath: (
|
|
645
|
-
if (
|
|
594
|
+
convertToPath: (path) => {
|
|
595
|
+
if (path === void 0) {
|
|
646
596
|
throw new Error(
|
|
647
597
|
"Attempted to convert undefined value to binding path"
|
|
648
598
|
);
|
|
649
599
|
}
|
|
650
|
-
if (typeof
|
|
600
|
+
if (typeof path !== "string" && typeof path !== "number" && typeof path !== "boolean") {
|
|
651
601
|
throw new Error(
|
|
652
|
-
`Attempting to convert ${typeof
|
|
602
|
+
`Attempting to convert ${typeof path} to a binding path.`
|
|
653
603
|
);
|
|
654
604
|
}
|
|
655
|
-
const normalized2 = this.normalizePath(String(
|
|
605
|
+
const normalized2 = this.normalizePath(String(path), normalizeConfig);
|
|
656
606
|
if (normalized2.updates) {
|
|
657
607
|
updates = {
|
|
658
608
|
...updates,
|
|
@@ -1486,17 +1436,17 @@ function parseExpression(expr, options) {
|
|
|
1486
1436
|
break;
|
|
1487
1437
|
}
|
|
1488
1438
|
}
|
|
1489
|
-
const
|
|
1490
|
-
if (Object.prototype.hasOwnProperty.call(literals,
|
|
1439
|
+
const identifier = expr.slice(start, index);
|
|
1440
|
+
if (Object.prototype.hasOwnProperty.call(literals, identifier)) {
|
|
1491
1441
|
return {
|
|
1492
1442
|
__id: ExpNodeOpaqueIdentifier,
|
|
1493
1443
|
type: "Literal",
|
|
1494
|
-
value: literals[
|
|
1495
|
-
raw:
|
|
1444
|
+
value: literals[identifier],
|
|
1445
|
+
raw: identifier,
|
|
1496
1446
|
location: getLocation(start)
|
|
1497
1447
|
};
|
|
1498
1448
|
}
|
|
1499
|
-
if (
|
|
1449
|
+
if (identifier === thisStr) {
|
|
1500
1450
|
return {
|
|
1501
1451
|
__id: ExpNodeOpaqueIdentifier,
|
|
1502
1452
|
type: "ThisExpression",
|
|
@@ -1506,7 +1456,7 @@ function parseExpression(expr, options) {
|
|
|
1506
1456
|
return {
|
|
1507
1457
|
__id: ExpNodeOpaqueIdentifier,
|
|
1508
1458
|
type: "Identifier",
|
|
1509
|
-
name:
|
|
1459
|
+
name: identifier,
|
|
1510
1460
|
location: getLocation(start)
|
|
1511
1461
|
};
|
|
1512
1462
|
}
|
|
@@ -2137,7 +2087,7 @@ var ProxyLogger = class {
|
|
|
2137
2087
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/schema/schema.ts
|
|
2138
2088
|
var import_tapable_ts5 = require("tapable-ts");
|
|
2139
2089
|
var identify = (val) => val;
|
|
2140
|
-
function
|
|
2090
|
+
function parse2(schema) {
|
|
2141
2091
|
const expandedPaths = /* @__PURE__ */ new Map();
|
|
2142
2092
|
if (!schema.ROOT) {
|
|
2143
2093
|
return expandedPaths;
|
|
@@ -2148,10 +2098,10 @@ function parse4(schema) {
|
|
|
2148
2098
|
if (!next) {
|
|
2149
2099
|
break;
|
|
2150
2100
|
}
|
|
2151
|
-
const { node, path
|
|
2101
|
+
const { node, path, visited } = next;
|
|
2152
2102
|
Object.entries(node).forEach(([prop, type]) => {
|
|
2153
|
-
const
|
|
2154
|
-
const nestedPathStr =
|
|
2103
|
+
const nestedPath = [...path, prop];
|
|
2104
|
+
const nestedPathStr = nestedPath.join(".");
|
|
2155
2105
|
if (expandedPaths.has(nestedPathStr)) {
|
|
2156
2106
|
throw new Error(
|
|
2157
2107
|
"Path has already been processed. There's either a loop somewhere or a bug"
|
|
@@ -2164,14 +2114,14 @@ function parse4(schema) {
|
|
|
2164
2114
|
}
|
|
2165
2115
|
expandedPaths.set(nestedPathStr, type);
|
|
2166
2116
|
if (type.isArray) {
|
|
2167
|
-
|
|
2117
|
+
nestedPath.push("[]");
|
|
2168
2118
|
}
|
|
2169
2119
|
if (type.isRecord) {
|
|
2170
|
-
|
|
2120
|
+
nestedPath.push("{}");
|
|
2171
2121
|
}
|
|
2172
2122
|
if (type.type && schema[type.type]) {
|
|
2173
2123
|
parseQueue.push({
|
|
2174
|
-
path:
|
|
2124
|
+
path: nestedPath,
|
|
2175
2125
|
node: schema[type.type],
|
|
2176
2126
|
visited: /* @__PURE__ */ new Set([...visited, type.type])
|
|
2177
2127
|
});
|
|
@@ -2189,7 +2139,7 @@ var SchemaController = class {
|
|
|
2189
2139
|
this.hooks = {
|
|
2190
2140
|
resolveTypeForBinding: new import_tapable_ts5.SyncWaterfallHook()
|
|
2191
2141
|
};
|
|
2192
|
-
this.schema = schema ?
|
|
2142
|
+
this.schema = schema ? parse2(schema) : /* @__PURE__ */ new Map();
|
|
2193
2143
|
}
|
|
2194
2144
|
addFormatters(fns) {
|
|
2195
2145
|
fns.forEach((def) => {
|
|
@@ -2558,8 +2508,14 @@ var NodeType = /* @__PURE__ */ ((NodeType2) => {
|
|
|
2558
2508
|
})(NodeType || {});
|
|
2559
2509
|
|
|
2560
2510
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/parser/utils.ts
|
|
2561
|
-
function
|
|
2562
|
-
return Object.
|
|
2511
|
+
function hasTemplateValues(obj, localKey) {
|
|
2512
|
+
return Object.hasOwnProperty.call(obj, "template") && Array.isArray(obj?.template) && obj.template.length && obj.template.find((tmpl) => tmpl.output === localKey);
|
|
2513
|
+
}
|
|
2514
|
+
function hasSwitchKey(localKey) {
|
|
2515
|
+
return localKey === "staticSwitch" || localKey === "dynamicSwitch";
|
|
2516
|
+
}
|
|
2517
|
+
function hasTemplateKey(localKey) {
|
|
2518
|
+
return localKey === "template";
|
|
2563
2519
|
}
|
|
2564
2520
|
function getNodeID(node) {
|
|
2565
2521
|
if (!node) {
|
|
@@ -2596,7 +2552,6 @@ var Parser = class {
|
|
|
2596
2552
|
* If null, we ignore this node all together
|
|
2597
2553
|
*/
|
|
2598
2554
|
onCreateASTNode: new import_tapable_ts6.SyncWaterfallHook(),
|
|
2599
|
-
determineNodeType: new import_tapable_ts6.SyncBailHook(),
|
|
2600
2555
|
parseNode: new import_tapable_ts6.SyncBailHook()
|
|
2601
2556
|
};
|
|
2602
2557
|
}
|
|
@@ -2607,21 +2562,6 @@ var Parser = class {
|
|
|
2607
2562
|
}
|
|
2608
2563
|
return viewNode;
|
|
2609
2564
|
}
|
|
2610
|
-
parseAsync(obj, type, options) {
|
|
2611
|
-
const parsedAsync = this.parseObject((0, import_timm4.omit)(obj, "async"), type, options);
|
|
2612
|
-
const parsedNodeId = getNodeID(parsedAsync);
|
|
2613
|
-
if (parsedAsync !== null && parsedNodeId) {
|
|
2614
|
-
return this.createASTNode(
|
|
2615
|
-
{
|
|
2616
|
-
id: parsedNodeId,
|
|
2617
|
-
type: "async" /* Async */,
|
|
2618
|
-
value: parsedAsync
|
|
2619
|
-
},
|
|
2620
|
-
obj
|
|
2621
|
-
);
|
|
2622
|
-
}
|
|
2623
|
-
return null;
|
|
2624
|
-
}
|
|
2625
2565
|
createASTNode(node, value) {
|
|
2626
2566
|
const tapped = this.hooks.onCreateASTNode.call(node, value);
|
|
2627
2567
|
if (tapped === void 0) {
|
|
@@ -2629,32 +2569,16 @@ var Parser = class {
|
|
|
2629
2569
|
}
|
|
2630
2570
|
return tapped;
|
|
2631
2571
|
}
|
|
2632
|
-
/**
|
|
2633
|
-
* Checks if there are templated values in the object
|
|
2634
|
-
*
|
|
2635
|
-
* @param obj - The Parsed Object to check to see if we have a template array type for
|
|
2636
|
-
* @param localKey - The key being checked
|
|
2637
|
-
*/
|
|
2638
|
-
hasTemplateValues(obj, localKey) {
|
|
2639
|
-
return Object.hasOwnProperty.call(obj, "template") && Array.isArray(obj?.template) && obj.template.length && obj.template.find((tmpl) => tmpl.output === localKey);
|
|
2640
|
-
}
|
|
2641
|
-
hasSwitchKey(localKey) {
|
|
2642
|
-
return localKey === "staticSwitch";
|
|
2643
|
-
}
|
|
2644
2572
|
parseObject(obj, type = "value" /* Value */, options = { templateDepth: 0 }) {
|
|
2645
|
-
const
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
);
|
|
2653
|
-
if (parsedNode) {
|
|
2654
|
-
return parsedNode;
|
|
2655
|
-
}
|
|
2573
|
+
const parsedNode = this.hooks.parseNode.call(
|
|
2574
|
+
obj,
|
|
2575
|
+
type,
|
|
2576
|
+
options
|
|
2577
|
+
);
|
|
2578
|
+
if (parsedNode || parsedNode === null) {
|
|
2579
|
+
return parsedNode;
|
|
2656
2580
|
}
|
|
2657
|
-
const parseLocalObject = (currentValue, objToParse,
|
|
2581
|
+
const parseLocalObject = (currentValue, objToParse, path = []) => {
|
|
2658
2582
|
if (typeof objToParse !== "object" || objToParse === null) {
|
|
2659
2583
|
return { value: objToParse, children: [] };
|
|
2660
2584
|
}
|
|
@@ -2674,182 +2598,44 @@ var Parser = class {
|
|
|
2674
2598
|
value: currentValue
|
|
2675
2599
|
};
|
|
2676
2600
|
const newValue = objEntries.reduce((accumulation, current) => {
|
|
2677
|
-
|
|
2601
|
+
let { value: value2 } = accumulation;
|
|
2602
|
+
const { children: children2 } = accumulation;
|
|
2678
2603
|
const [localKey, localValue] = current;
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
...rest,
|
|
2688
|
-
children: [
|
|
2689
|
-
...children2,
|
|
2690
|
-
{
|
|
2691
|
-
path: [...path2, "asset"],
|
|
2692
|
-
value: assetAST
|
|
2693
|
-
}
|
|
2694
|
-
]
|
|
2695
|
-
};
|
|
2696
|
-
}
|
|
2697
|
-
} else if (this.hooks.determineNodeType.call(localKey) === "template" /* Template */ && Array.isArray(localValue)) {
|
|
2698
|
-
const templateChildren = localValue.map((template) => {
|
|
2699
|
-
const templateAST = this.hooks.onCreateASTNode.call(
|
|
2700
|
-
{
|
|
2701
|
-
type: "template" /* Template */,
|
|
2702
|
-
depth: options.templateDepth ?? 0,
|
|
2703
|
-
data: template.data,
|
|
2704
|
-
template: template.value,
|
|
2705
|
-
dynamic: template.dynamic ?? false
|
|
2706
|
-
},
|
|
2707
|
-
template
|
|
2708
|
-
);
|
|
2709
|
-
if (templateAST?.type === "multi-node" /* MultiNode */) {
|
|
2710
|
-
templateAST.values.forEach((v) => {
|
|
2711
|
-
v.parent = templateAST;
|
|
2712
|
-
});
|
|
2713
|
-
}
|
|
2714
|
-
if (templateAST) {
|
|
2715
|
-
return {
|
|
2716
|
-
path: [...path2, template.output],
|
|
2717
|
-
value: templateAST
|
|
2718
|
-
};
|
|
2719
|
-
}
|
|
2720
|
-
return;
|
|
2721
|
-
}).filter((element) => !!element);
|
|
2722
|
-
return {
|
|
2723
|
-
...rest,
|
|
2724
|
-
children: [...children2, ...templateChildren]
|
|
2725
|
-
};
|
|
2726
|
-
} else if (localValue && this.hooks.determineNodeType.call(localValue) === "switch" /* Switch */ || this.hasSwitchKey(localKey)) {
|
|
2727
|
-
const localSwitch = this.hooks.parseNode.call(
|
|
2728
|
-
this.hasSwitchKey(localKey) ? { [localKey]: localValue } : localValue,
|
|
2729
|
-
"value" /* Value */,
|
|
2730
|
-
options,
|
|
2731
|
-
"switch" /* Switch */
|
|
2732
|
-
);
|
|
2733
|
-
if (localSwitch && localSwitch.type === "value" /* Value */ && localSwitch.children?.length === 1 && localSwitch.value === void 0) {
|
|
2734
|
-
const firstChild = localSwitch.children[0];
|
|
2735
|
-
return {
|
|
2736
|
-
...rest,
|
|
2737
|
-
children: [
|
|
2738
|
-
...children2,
|
|
2739
|
-
{
|
|
2740
|
-
path: [...path2, localKey, ...firstChild.path],
|
|
2741
|
-
value: firstChild.value
|
|
2742
|
-
}
|
|
2743
|
-
]
|
|
2744
|
-
};
|
|
2745
|
-
}
|
|
2746
|
-
if (localSwitch) {
|
|
2747
|
-
return {
|
|
2748
|
-
...rest,
|
|
2749
|
-
children: [
|
|
2750
|
-
...children2,
|
|
2751
|
-
{
|
|
2752
|
-
path: [...path2, localKey],
|
|
2753
|
-
value: localSwitch
|
|
2754
|
-
}
|
|
2755
|
-
]
|
|
2756
|
-
};
|
|
2757
|
-
}
|
|
2758
|
-
} else if (localValue && hasAsync(localValue)) {
|
|
2759
|
-
const localAsync = this.parseAsync(
|
|
2760
|
-
localValue,
|
|
2761
|
-
"value" /* Value */,
|
|
2762
|
-
options
|
|
2763
|
-
);
|
|
2764
|
-
if (localAsync) {
|
|
2765
|
-
children2.push({
|
|
2766
|
-
path: [...path2, localKey],
|
|
2767
|
-
value: localAsync
|
|
2768
|
-
});
|
|
2769
|
-
}
|
|
2770
|
-
} else if (localValue && Array.isArray(localValue)) {
|
|
2771
|
-
const childValues = localValue.map(
|
|
2772
|
-
(childVal) => this.parseObject(childVal, "value" /* Value */, options)
|
|
2773
|
-
).filter((child) => !!child);
|
|
2774
|
-
if (childValues.length > 0) {
|
|
2775
|
-
const multiNode = this.hooks.onCreateASTNode.call(
|
|
2776
|
-
{
|
|
2777
|
-
type: "multi-node" /* MultiNode */,
|
|
2778
|
-
override: !this.hasTemplateValues(localObj, localKey),
|
|
2779
|
-
values: childValues
|
|
2780
|
-
},
|
|
2781
|
-
localValue
|
|
2782
|
-
);
|
|
2783
|
-
if (multiNode?.type === "multi-node" /* MultiNode */) {
|
|
2784
|
-
multiNode.values.forEach((v) => {
|
|
2785
|
-
v.parent = multiNode;
|
|
2786
|
-
});
|
|
2787
|
-
}
|
|
2788
|
-
if (multiNode) {
|
|
2789
|
-
return {
|
|
2790
|
-
...rest,
|
|
2791
|
-
children: [
|
|
2792
|
-
...children2,
|
|
2793
|
-
{
|
|
2794
|
-
path: [...path2, localKey],
|
|
2795
|
-
value: multiNode
|
|
2796
|
-
}
|
|
2797
|
-
]
|
|
2798
|
-
};
|
|
2799
|
-
}
|
|
2604
|
+
const newChildren = this.hooks.parseNode.call(
|
|
2605
|
+
localValue,
|
|
2606
|
+
"value" /* Value */,
|
|
2607
|
+
options,
|
|
2608
|
+
{
|
|
2609
|
+
path,
|
|
2610
|
+
key: localKey,
|
|
2611
|
+
parentObj: localObj
|
|
2800
2612
|
}
|
|
2613
|
+
);
|
|
2614
|
+
if (newChildren) {
|
|
2615
|
+
children2.push(...newChildren);
|
|
2801
2616
|
} else if (localValue && typeof localValue === "object") {
|
|
2802
|
-
const
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
determineNodeType
|
|
2809
|
-
);
|
|
2810
|
-
if (parsedNode) {
|
|
2811
|
-
return {
|
|
2812
|
-
...rest,
|
|
2813
|
-
children: [
|
|
2814
|
-
...children2,
|
|
2815
|
-
{
|
|
2816
|
-
path: [...path2, localKey],
|
|
2817
|
-
value: parsedNode
|
|
2818
|
-
}
|
|
2819
|
-
]
|
|
2820
|
-
};
|
|
2821
|
-
}
|
|
2822
|
-
} else {
|
|
2823
|
-
const result = parseLocalObject(accumulation.value, localValue, [
|
|
2824
|
-
...path2,
|
|
2825
|
-
localKey
|
|
2826
|
-
]);
|
|
2827
|
-
return {
|
|
2828
|
-
value: result.value,
|
|
2829
|
-
children: [...children2, ...result.children]
|
|
2830
|
-
};
|
|
2831
|
-
}
|
|
2617
|
+
const result = parseLocalObject(accumulation.value, localValue, [
|
|
2618
|
+
...path,
|
|
2619
|
+
localKey
|
|
2620
|
+
]);
|
|
2621
|
+
value2 = result.value;
|
|
2622
|
+
children2.push(...result.children);
|
|
2832
2623
|
} else {
|
|
2833
|
-
|
|
2834
|
-
accumulation.value,
|
|
2835
|
-
[...path2, localKey],
|
|
2836
|
-
localValue
|
|
2837
|
-
);
|
|
2838
|
-
return {
|
|
2839
|
-
children: children2,
|
|
2840
|
-
value: value2
|
|
2841
|
-
};
|
|
2624
|
+
value2 = (0, import_timm4.setIn)(accumulation.value, [...path, localKey], localValue);
|
|
2842
2625
|
}
|
|
2843
|
-
return
|
|
2626
|
+
return {
|
|
2627
|
+
value: value2,
|
|
2628
|
+
children: children2
|
|
2629
|
+
};
|
|
2844
2630
|
}, defaultValue);
|
|
2845
2631
|
return newValue;
|
|
2846
2632
|
};
|
|
2847
2633
|
const { value, children } = parseLocalObject(void 0, obj);
|
|
2848
|
-
const baseAst = value === void 0 && children.length
|
|
2634
|
+
const baseAst = value === void 0 && !children.length ? void 0 : {
|
|
2849
2635
|
type,
|
|
2850
2636
|
value
|
|
2851
2637
|
};
|
|
2852
|
-
if (baseAst
|
|
2638
|
+
if (baseAst && children.length) {
|
|
2853
2639
|
const parent = baseAst;
|
|
2854
2640
|
parent.children = children;
|
|
2855
2641
|
children.forEach((child) => {
|
|
@@ -3204,13 +2990,13 @@ var Resolver = class {
|
|
|
3204
2990
|
|
|
3205
2991
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/view.ts
|
|
3206
2992
|
var CrossfieldProvider = class {
|
|
3207
|
-
constructor(initialView,
|
|
2993
|
+
constructor(initialView, parser, logger) {
|
|
3208
2994
|
this.allValidations = /* @__PURE__ */ new Set();
|
|
3209
2995
|
this.byBinding = /* @__PURE__ */ new Map();
|
|
3210
2996
|
this.logger = logger;
|
|
3211
|
-
this.parse(initialView,
|
|
2997
|
+
this.parse(initialView, parser);
|
|
3212
2998
|
}
|
|
3213
|
-
parse(contentView,
|
|
2999
|
+
parse(contentView, parser) {
|
|
3214
3000
|
const xfieldRefs = contentView.validation;
|
|
3215
3001
|
if (xfieldRefs === void 0) {
|
|
3216
3002
|
return;
|
|
@@ -3230,7 +3016,7 @@ var CrossfieldProvider = class {
|
|
|
3230
3016
|
this.allValidations.add(withDefaults);
|
|
3231
3017
|
const { ref } = vRef;
|
|
3232
3018
|
if (ref) {
|
|
3233
|
-
const parsed =
|
|
3019
|
+
const parsed = parser(ref);
|
|
3234
3020
|
if (this.byBinding.has(parsed)) {
|
|
3235
3021
|
this.byBinding.get(parsed)?.push(withDefaults);
|
|
3236
3022
|
} else {
|
|
@@ -3277,12 +3063,12 @@ var ViewInstance = class {
|
|
|
3277
3063
|
"templatePlugin not set for View, legacy templates may not work"
|
|
3278
3064
|
);
|
|
3279
3065
|
}
|
|
3280
|
-
const
|
|
3281
|
-
this.hooks.parser.call(
|
|
3282
|
-
this.rootNode =
|
|
3066
|
+
const parser = new Parser();
|
|
3067
|
+
this.hooks.parser.call(parser);
|
|
3068
|
+
this.rootNode = parser.parseView(this.initialView);
|
|
3283
3069
|
this.resolver = new Resolver(this.rootNode, {
|
|
3284
3070
|
...this.resolverOptions,
|
|
3285
|
-
parseNode:
|
|
3071
|
+
parseNode: parser.parseObject.bind(parser)
|
|
3286
3072
|
});
|
|
3287
3073
|
this.hooks.resolver.call(this.resolver);
|
|
3288
3074
|
}
|
|
@@ -3347,10 +3133,10 @@ var Builder = class {
|
|
|
3347
3133
|
* @param path - The path at which to add the child
|
|
3348
3134
|
* @param child - The child node
|
|
3349
3135
|
*/
|
|
3350
|
-
static addChild(node,
|
|
3136
|
+
static addChild(node, path, child) {
|
|
3351
3137
|
child.parent = node;
|
|
3352
3138
|
const newChild = {
|
|
3353
|
-
path: Array.isArray(
|
|
3139
|
+
path: Array.isArray(path) ? path : [path],
|
|
3354
3140
|
value: child
|
|
3355
3141
|
};
|
|
3356
3142
|
node.children = node.children || [];
|
|
@@ -3359,7 +3145,7 @@ var Builder = class {
|
|
|
3359
3145
|
}
|
|
3360
3146
|
};
|
|
3361
3147
|
|
|
3362
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/plugins/template
|
|
3148
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/plugins/template.ts
|
|
3363
3149
|
var import_tapable_ts9 = require("tapable-ts");
|
|
3364
3150
|
var TemplatePlugin = class {
|
|
3365
3151
|
constructor(options) {
|
|
@@ -3414,39 +3200,44 @@ var TemplatePlugin = class {
|
|
|
3414
3200
|
};
|
|
3415
3201
|
return result;
|
|
3416
3202
|
}
|
|
3417
|
-
applyParser(
|
|
3418
|
-
|
|
3203
|
+
applyParser(parser) {
|
|
3204
|
+
parser.hooks.onCreateASTNode.tap("template", (node) => {
|
|
3419
3205
|
if (node && node.type === "template" /* Template */ && !node.dynamic) {
|
|
3420
3206
|
return this.parseTemplate(
|
|
3421
|
-
|
|
3207
|
+
parser.parseObject.bind(parser),
|
|
3422
3208
|
node,
|
|
3423
3209
|
this.options
|
|
3424
3210
|
);
|
|
3425
3211
|
}
|
|
3426
3212
|
return node;
|
|
3427
3213
|
});
|
|
3428
|
-
|
|
3429
|
-
if (obj === "template") {
|
|
3430
|
-
return "template" /* Template */;
|
|
3431
|
-
}
|
|
3432
|
-
});
|
|
3433
|
-
parser2.hooks.parseNode.tap(
|
|
3214
|
+
parser.hooks.parseNode.tap(
|
|
3434
3215
|
"template",
|
|
3435
|
-
(obj, _nodeType, options,
|
|
3436
|
-
if (
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3216
|
+
(obj, _nodeType, options, childOptions) => {
|
|
3217
|
+
if (childOptions && hasTemplateKey(childOptions.key)) {
|
|
3218
|
+
return obj.map((template) => {
|
|
3219
|
+
const templateAST = parser.createASTNode(
|
|
3220
|
+
{
|
|
3221
|
+
type: "template" /* Template */,
|
|
3222
|
+
depth: options.templateDepth ?? 0,
|
|
3223
|
+
data: template.data,
|
|
3224
|
+
template: template.value,
|
|
3225
|
+
dynamic: template.dynamic ?? false
|
|
3226
|
+
},
|
|
3227
|
+
template
|
|
3228
|
+
);
|
|
3229
|
+
if (!templateAST)
|
|
3230
|
+
return;
|
|
3231
|
+
if (templateAST.type === "multi-node" /* MultiNode */) {
|
|
3232
|
+
templateAST.values.forEach((v) => {
|
|
3233
|
+
v.parent = templateAST;
|
|
3234
|
+
});
|
|
3235
|
+
}
|
|
3236
|
+
return {
|
|
3237
|
+
path: [...childOptions.path, template.output],
|
|
3238
|
+
value: templateAST
|
|
3239
|
+
};
|
|
3240
|
+
}).filter(Boolean);
|
|
3450
3241
|
}
|
|
3451
3242
|
}
|
|
3452
3243
|
);
|
|
@@ -3556,7 +3347,7 @@ var StringResolverPlugin = class {
|
|
|
3556
3347
|
propsToSkip = /* @__PURE__ */ new Set(["exp"]);
|
|
3557
3348
|
}
|
|
3558
3349
|
const nodePath = findBasePath(node, resolver);
|
|
3559
|
-
if (nodePath.length > 0 && nodePath.some((
|
|
3350
|
+
if (nodePath.length > 0 && nodePath.some((segment) => propsToSkip.has(segment.toString()))) {
|
|
3560
3351
|
return node.value;
|
|
3561
3352
|
}
|
|
3562
3353
|
return resolveAllRefs(node.value, options, propsToSkip);
|
|
@@ -3572,6 +3363,9 @@ var StringResolverPlugin = class {
|
|
|
3572
3363
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/plugins/applicability.ts
|
|
3573
3364
|
var import_timm7 = require("timm");
|
|
3574
3365
|
var ApplicabilityPlugin = class {
|
|
3366
|
+
isApplicability(obj) {
|
|
3367
|
+
return obj && Object.prototype.hasOwnProperty.call(obj, "applicability");
|
|
3368
|
+
}
|
|
3575
3369
|
applyResolver(resolver) {
|
|
3576
3370
|
resolver.hooks.beforeResolve.tap(
|
|
3577
3371
|
"applicability",
|
|
@@ -3588,35 +3382,39 @@ var ApplicabilityPlugin = class {
|
|
|
3588
3382
|
}
|
|
3589
3383
|
);
|
|
3590
3384
|
}
|
|
3591
|
-
applyParser(
|
|
3592
|
-
|
|
3593
|
-
if (Object.prototype.hasOwnProperty.call(obj, "applicability")) {
|
|
3594
|
-
return "applicability" /* Applicability */;
|
|
3595
|
-
}
|
|
3596
|
-
});
|
|
3597
|
-
parser2.hooks.parseNode.tap(
|
|
3385
|
+
applyParser(parser) {
|
|
3386
|
+
parser.hooks.parseNode.tap(
|
|
3598
3387
|
"applicability",
|
|
3599
|
-
(obj, nodeType, options,
|
|
3600
|
-
if (
|
|
3601
|
-
const parsedApplicability =
|
|
3388
|
+
(obj, nodeType, options, childOptions) => {
|
|
3389
|
+
if (this.isApplicability(obj)) {
|
|
3390
|
+
const parsedApplicability = parser.parseObject(
|
|
3602
3391
|
(0, import_timm7.omit)(obj, "applicability"),
|
|
3603
3392
|
nodeType,
|
|
3604
3393
|
options
|
|
3605
3394
|
);
|
|
3606
|
-
if (parsedApplicability
|
|
3607
|
-
|
|
3608
|
-
{
|
|
3609
|
-
type: "applicability" /* Applicability */,
|
|
3610
|
-
expression: obj.applicability,
|
|
3611
|
-
value: parsedApplicability
|
|
3612
|
-
},
|
|
3613
|
-
obj
|
|
3614
|
-
);
|
|
3615
|
-
if (applicabilityNode?.type === "applicability" /* Applicability */) {
|
|
3616
|
-
applicabilityNode.value.parent = applicabilityNode;
|
|
3617
|
-
}
|
|
3618
|
-
return applicabilityNode;
|
|
3395
|
+
if (!parsedApplicability) {
|
|
3396
|
+
return childOptions ? [] : null;
|
|
3619
3397
|
}
|
|
3398
|
+
const applicabilityNode = parser.createASTNode(
|
|
3399
|
+
{
|
|
3400
|
+
type: "applicability" /* Applicability */,
|
|
3401
|
+
expression: obj.applicability,
|
|
3402
|
+
value: parsedApplicability
|
|
3403
|
+
},
|
|
3404
|
+
obj
|
|
3405
|
+
);
|
|
3406
|
+
if (!applicabilityNode) {
|
|
3407
|
+
return childOptions ? [] : null;
|
|
3408
|
+
}
|
|
3409
|
+
if (applicabilityNode.type === "applicability" /* Applicability */) {
|
|
3410
|
+
applicabilityNode.value.parent = applicabilityNode;
|
|
3411
|
+
}
|
|
3412
|
+
return childOptions ? [
|
|
3413
|
+
{
|
|
3414
|
+
path: [...childOptions.path, childOptions.key],
|
|
3415
|
+
value: applicabilityNode
|
|
3416
|
+
}
|
|
3417
|
+
] : applicabilityNode;
|
|
3620
3418
|
}
|
|
3621
3419
|
}
|
|
3622
3420
|
);
|
|
@@ -3641,58 +3439,67 @@ var SwitchPlugin = class {
|
|
|
3641
3439
|
}
|
|
3642
3440
|
return EMPTY_NODE;
|
|
3643
3441
|
}
|
|
3644
|
-
|
|
3645
|
-
|
|
3442
|
+
isSwitch(obj) {
|
|
3443
|
+
return obj && (Object.prototype.hasOwnProperty.call(obj, "dynamicSwitch") || Object.prototype.hasOwnProperty.call(obj, "staticSwitch"));
|
|
3444
|
+
}
|
|
3445
|
+
applyParser(parser) {
|
|
3446
|
+
parser.hooks.onCreateASTNode.tap("switch", (node) => {
|
|
3646
3447
|
if (node && node.type === "switch" /* Switch */ && !node.dynamic) {
|
|
3647
3448
|
return this.resolveSwitch(node, this.options);
|
|
3648
3449
|
}
|
|
3649
3450
|
return node;
|
|
3650
3451
|
});
|
|
3651
|
-
|
|
3652
|
-
if (Object.prototype.hasOwnProperty.call(obj, "dynamicSwitch") || Object.prototype.hasOwnProperty.call(obj, "staticSwitch")) {
|
|
3653
|
-
return "switch" /* Switch */;
|
|
3654
|
-
}
|
|
3655
|
-
});
|
|
3656
|
-
parser2.hooks.parseNode.tap(
|
|
3452
|
+
parser.hooks.parseNode.tap(
|
|
3657
3453
|
"switch",
|
|
3658
|
-
(obj, _nodeType, options,
|
|
3659
|
-
if (
|
|
3660
|
-
const
|
|
3661
|
-
const
|
|
3662
|
-
const
|
|
3663
|
-
switchContent.
|
|
3454
|
+
(obj, _nodeType, options, childOptions) => {
|
|
3455
|
+
if (this.isSwitch(obj) || childOptions && hasSwitchKey(childOptions.key)) {
|
|
3456
|
+
const objToParse = childOptions && hasSwitchKey(childOptions.key) ? { [childOptions.key]: obj } : obj;
|
|
3457
|
+
const dynamic = "dynamicSwitch" in objToParse;
|
|
3458
|
+
const switchContent = dynamic ? objToParse.dynamicSwitch : objToParse.staticSwitch;
|
|
3459
|
+
const cases = switchContent.map(
|
|
3664
3460
|
(switchCase) => {
|
|
3665
3461
|
const { case: switchCaseExpr, ...switchBody } = switchCase;
|
|
3666
|
-
const value =
|
|
3462
|
+
const value = parser.parseObject(
|
|
3667
3463
|
switchBody,
|
|
3668
3464
|
"value" /* Value */,
|
|
3669
3465
|
options
|
|
3670
3466
|
);
|
|
3671
3467
|
if (value) {
|
|
3672
|
-
|
|
3468
|
+
return {
|
|
3673
3469
|
case: switchCaseExpr,
|
|
3674
3470
|
value
|
|
3675
|
-
}
|
|
3471
|
+
};
|
|
3676
3472
|
}
|
|
3473
|
+
return;
|
|
3677
3474
|
}
|
|
3678
|
-
);
|
|
3679
|
-
const switchAST =
|
|
3475
|
+
).filter(Boolean);
|
|
3476
|
+
const switchAST = parser.createASTNode(
|
|
3680
3477
|
{
|
|
3681
3478
|
type: "switch" /* Switch */,
|
|
3682
3479
|
dynamic,
|
|
3683
3480
|
cases
|
|
3684
3481
|
},
|
|
3685
|
-
|
|
3482
|
+
objToParse
|
|
3686
3483
|
);
|
|
3687
|
-
if (switchAST
|
|
3484
|
+
if (!switchAST || switchAST.type === "empty" /* Empty */) {
|
|
3485
|
+
return childOptions ? [] : null;
|
|
3486
|
+
}
|
|
3487
|
+
if (switchAST.type === "switch" /* Switch */) {
|
|
3688
3488
|
switchAST.cases.forEach((sCase) => {
|
|
3689
3489
|
sCase.value.parent = switchAST;
|
|
3690
3490
|
});
|
|
3691
3491
|
}
|
|
3692
|
-
if (
|
|
3693
|
-
|
|
3492
|
+
if (childOptions) {
|
|
3493
|
+
let path = [...childOptions.path, childOptions.key];
|
|
3494
|
+
let value = switchAST;
|
|
3495
|
+
if (switchAST.type === "value" /* Value */ && switchAST.children?.length === 1 && switchAST.value === void 0) {
|
|
3496
|
+
const firstChild = switchAST.children[0];
|
|
3497
|
+
path = [...path, ...firstChild.path];
|
|
3498
|
+
value = firstChild.value;
|
|
3499
|
+
}
|
|
3500
|
+
return [{ path, value }];
|
|
3694
3501
|
}
|
|
3695
|
-
return switchAST
|
|
3502
|
+
return switchAST;
|
|
3696
3503
|
}
|
|
3697
3504
|
}
|
|
3698
3505
|
);
|
|
@@ -3711,6 +3518,79 @@ var SwitchPlugin = class {
|
|
|
3711
3518
|
}
|
|
3712
3519
|
};
|
|
3713
3520
|
|
|
3521
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/plugins/multi-node.ts
|
|
3522
|
+
var MultiNodePlugin = class {
|
|
3523
|
+
applyParser(parser) {
|
|
3524
|
+
parser.hooks.parseNode.tap(
|
|
3525
|
+
"multi-node",
|
|
3526
|
+
(obj, nodeType, options, childOptions) => {
|
|
3527
|
+
if (childOptions && !hasTemplateKey(childOptions.key) && Array.isArray(obj)) {
|
|
3528
|
+
const values = obj.map(
|
|
3529
|
+
(childVal) => parser.parseObject(childVal, "value" /* Value */, options)
|
|
3530
|
+
).filter((child) => !!child);
|
|
3531
|
+
if (!values.length) {
|
|
3532
|
+
return [];
|
|
3533
|
+
}
|
|
3534
|
+
const multiNode = parser.createASTNode(
|
|
3535
|
+
{
|
|
3536
|
+
type: "multi-node" /* MultiNode */,
|
|
3537
|
+
override: !hasTemplateValues(
|
|
3538
|
+
childOptions.parentObj,
|
|
3539
|
+
childOptions.key
|
|
3540
|
+
),
|
|
3541
|
+
values
|
|
3542
|
+
},
|
|
3543
|
+
obj
|
|
3544
|
+
);
|
|
3545
|
+
if (!multiNode) {
|
|
3546
|
+
return [];
|
|
3547
|
+
}
|
|
3548
|
+
if (multiNode.type === "multi-node" /* MultiNode */) {
|
|
3549
|
+
multiNode.values.forEach((v) => {
|
|
3550
|
+
v.parent = multiNode;
|
|
3551
|
+
});
|
|
3552
|
+
}
|
|
3553
|
+
return [
|
|
3554
|
+
{
|
|
3555
|
+
path: [...childOptions.path, childOptions.key],
|
|
3556
|
+
value: multiNode
|
|
3557
|
+
}
|
|
3558
|
+
];
|
|
3559
|
+
}
|
|
3560
|
+
}
|
|
3561
|
+
);
|
|
3562
|
+
}
|
|
3563
|
+
apply(view) {
|
|
3564
|
+
view.hooks.parser.tap("multi-node", this.applyParser.bind(this));
|
|
3565
|
+
}
|
|
3566
|
+
};
|
|
3567
|
+
|
|
3568
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/plugins/asset.ts
|
|
3569
|
+
var AssetPlugin = class {
|
|
3570
|
+
applyParser(parser) {
|
|
3571
|
+
parser.hooks.parseNode.tap(
|
|
3572
|
+
"asset",
|
|
3573
|
+
(obj, nodeType, options, childOptions) => {
|
|
3574
|
+
if (childOptions?.key === "asset" && typeof obj === "object") {
|
|
3575
|
+
const assetAST = parser.parseObject(obj, "asset" /* Asset */, options);
|
|
3576
|
+
if (!assetAST) {
|
|
3577
|
+
return [];
|
|
3578
|
+
}
|
|
3579
|
+
return [
|
|
3580
|
+
{
|
|
3581
|
+
path: [...childOptions.path, childOptions.key],
|
|
3582
|
+
value: assetAST
|
|
3583
|
+
}
|
|
3584
|
+
];
|
|
3585
|
+
}
|
|
3586
|
+
}
|
|
3587
|
+
);
|
|
3588
|
+
}
|
|
3589
|
+
apply(view) {
|
|
3590
|
+
view.hooks.parser.tap("asset", this.applyParser.bind(this));
|
|
3591
|
+
}
|
|
3592
|
+
};
|
|
3593
|
+
|
|
3714
3594
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/player.ts
|
|
3715
3595
|
var import_timm9 = require("timm");
|
|
3716
3596
|
var import_p_defer2 = __toESM(require("p-defer"));
|
|
@@ -4570,11 +4450,11 @@ var ValidationController = class {
|
|
|
4570
4450
|
getValidationForBinding(binding) {
|
|
4571
4451
|
return this.validations.get(binding);
|
|
4572
4452
|
}
|
|
4573
|
-
forView(
|
|
4453
|
+
forView(parser) {
|
|
4574
4454
|
return {
|
|
4575
4455
|
_getValidationForBinding: (binding) => {
|
|
4576
4456
|
return this.getValidationForBinding(
|
|
4577
|
-
isBinding(binding) ? binding :
|
|
4457
|
+
isBinding(binding) ? binding : parser(binding)
|
|
4578
4458
|
);
|
|
4579
4459
|
},
|
|
4580
4460
|
getAll: () => {
|
|
@@ -4611,7 +4491,7 @@ var ValidationController = class {
|
|
|
4611
4491
|
"Section functionality should be provided by the view plugin"
|
|
4612
4492
|
);
|
|
4613
4493
|
},
|
|
4614
|
-
type: (binding) => this.schema.getType(isBinding(binding) ? binding :
|
|
4494
|
+
type: (binding) => this.schema.getType(isBinding(binding) ? binding : parser(binding))
|
|
4615
4495
|
};
|
|
4616
4496
|
}
|
|
4617
4497
|
};
|
|
@@ -5053,7 +4933,7 @@ var DataController = class {
|
|
|
5053
4933
|
};
|
|
5054
4934
|
|
|
5055
4935
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/controllers/constants/utils.ts
|
|
5056
|
-
function
|
|
4936
|
+
function flatten(obj, roots = [], sep = ".") {
|
|
5057
4937
|
return Object.keys(obj).reduce(
|
|
5058
4938
|
(memo, prop) => ({
|
|
5059
4939
|
// create a new object
|
|
@@ -5061,7 +4941,7 @@ function flatten2(obj, roots = [], sep = ".") {
|
|
|
5061
4941
|
...memo,
|
|
5062
4942
|
...Object.prototype.toString.call(obj[prop]) === "[object Object]" ? (
|
|
5063
4943
|
// keep working if value is an object
|
|
5064
|
-
|
|
4944
|
+
flatten(obj[prop], roots.concat([prop]))
|
|
5065
4945
|
) : (
|
|
5066
4946
|
// include current prop and value and prefix prop with the roots
|
|
5067
4947
|
{ [roots.concat([prop]).join(sep)]: obj[prop] }
|
|
@@ -5071,7 +4951,7 @@ function flatten2(obj, roots = [], sep = ".") {
|
|
|
5071
4951
|
);
|
|
5072
4952
|
}
|
|
5073
4953
|
function objectToBatchSet(obj) {
|
|
5074
|
-
const flattenedObj =
|
|
4954
|
+
const flattenedObj = flatten(obj);
|
|
5075
4955
|
const batchTxn = [];
|
|
5076
4956
|
Object.keys(flattenedObj).forEach((key) => {
|
|
5077
4957
|
batchTxn.push([new BindingInstance(key), flattenedObj[key]]);
|
|
@@ -5093,8 +4973,8 @@ var ConstantsController = class {
|
|
|
5093
4973
|
}
|
|
5094
4974
|
}
|
|
5095
4975
|
getConstants(key, namespace, fallback) {
|
|
5096
|
-
const
|
|
5097
|
-
return this.tempStore.get(namespace)?.get(
|
|
4976
|
+
const path = new BindingInstance(key);
|
|
4977
|
+
return this.tempStore.get(namespace)?.get(path) ?? this.store.get(namespace)?.get(path) ?? fallback;
|
|
5098
4978
|
}
|
|
5099
4979
|
setTemporaryValues(data, namespace) {
|
|
5100
4980
|
if (this.tempStore.has(namespace)) {
|
|
@@ -5200,12 +5080,14 @@ var DefaultViewPlugin = class {
|
|
|
5200
5080
|
player.hooks.viewController.tap(this.name, (viewController) => {
|
|
5201
5081
|
viewController.hooks.view.tap(this.name, (view) => {
|
|
5202
5082
|
const pluginOptions = toNodeResolveOptions(view.resolverOptions);
|
|
5083
|
+
new AssetPlugin().apply(view);
|
|
5203
5084
|
new SwitchPlugin(pluginOptions).apply(view);
|
|
5204
5085
|
new ApplicabilityPlugin().apply(view);
|
|
5205
5086
|
new StringResolverPlugin().apply(view);
|
|
5206
5087
|
const templatePlugin = new TemplatePlugin(pluginOptions);
|
|
5207
5088
|
templatePlugin.apply(view);
|
|
5208
5089
|
view.hooks.onTemplatePluginCreated.call(templatePlugin);
|
|
5090
|
+
new MultiNodePlugin().apply(view);
|
|
5209
5091
|
});
|
|
5210
5092
|
});
|
|
5211
5093
|
}
|
|
@@ -5551,6 +5433,7 @@ var Player = _Player;
|
|
|
5551
5433
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5552
5434
|
0 && (module.exports = {
|
|
5553
5435
|
ApplicabilityPlugin,
|
|
5436
|
+
AssetPlugin,
|
|
5554
5437
|
AssetTransformCorePlugin,
|
|
5555
5438
|
BINDING_BRACKETS_REGEX,
|
|
5556
5439
|
BindingInstance,
|
|
@@ -5570,6 +5453,7 @@ var Player = _Player;
|
|
|
5570
5453
|
FlowInstance,
|
|
5571
5454
|
LocalModel,
|
|
5572
5455
|
LocalStateStore,
|
|
5456
|
+
MultiNodePlugin,
|
|
5573
5457
|
NOOPDataModel,
|
|
5574
5458
|
NOOP_MODEL,
|
|
5575
5459
|
NOT_STARTED_STATE,
|
|
@@ -5603,7 +5487,9 @@ var Player = _Player;
|
|
|
5603
5487
|
findNextExp,
|
|
5604
5488
|
getBindingSegments,
|
|
5605
5489
|
getNodeID,
|
|
5606
|
-
|
|
5490
|
+
hasSwitchKey,
|
|
5491
|
+
hasTemplateKey,
|
|
5492
|
+
hasTemplateValues,
|
|
5607
5493
|
isBinding,
|
|
5608
5494
|
isErrorWithLocation,
|
|
5609
5495
|
isExpressionNode,
|