@player-ui/player 0.8.0-next.0 → 0.8.0-next.1
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 +130 -3749
- package/dist/Player.native.js.map +1 -1
- package/dist/cjs/index.cjs +100 -154
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +100 -154
- package/dist/index.mjs +100 -154
- 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/types/binding-grammar/index.d.ts +0 -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/index.mjs
CHANGED
|
@@ -20,9 +20,9 @@ var toExpression = (value) => ({
|
|
|
20
20
|
name: "Expression",
|
|
21
21
|
value
|
|
22
22
|
});
|
|
23
|
-
var toPath = (
|
|
23
|
+
var toPath = (path) => ({
|
|
24
24
|
name: "PathNode",
|
|
25
|
-
path
|
|
25
|
+
path
|
|
26
26
|
});
|
|
27
27
|
var toQuery = (key, value) => ({
|
|
28
28
|
name: "Query",
|
|
@@ -39,60 +39,6 @@ var toConcatenatedNode = (values) => {
|
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/binding-grammar/parsimmon/index.ts
|
|
43
|
-
import flatten from "arr-flatten";
|
|
44
|
-
import P from "parsimmon";
|
|
45
|
-
var doubleQuote = P.string('"');
|
|
46
|
-
var singleQuote = P.string("'");
|
|
47
|
-
var backTick = P.string("`");
|
|
48
|
-
var identifier = P.regex(/[\w\-@]+/).desc("identifier").map(toValue);
|
|
49
|
-
var path;
|
|
50
|
-
var futurePath = P.lazy(() => path);
|
|
51
|
-
var nestedPath = futurePath.trim(P.optWhitespace).wrap(P.string("{{"), P.string("}}")).map(toPath);
|
|
52
|
-
var nestedExpression = P.regex(/[^`]*/).wrap(backTick, backTick).map(toExpression);
|
|
53
|
-
var segment = P.alt(identifier, nestedPath, nestedExpression).atLeast(1).map(flatten).map(toConcatenatedNode);
|
|
54
|
-
var optionallyQuotedSegment = P.alt(
|
|
55
|
-
P.regex(/[^"]*/).wrap(doubleQuote, doubleQuote).map(toValue),
|
|
56
|
-
P.regex(/[^']*/).wrap(singleQuote, singleQuote).map(toValue),
|
|
57
|
-
segment
|
|
58
|
-
);
|
|
59
|
-
var query = P.seq(
|
|
60
|
-
optionallyQuotedSegment,
|
|
61
|
-
P.string("=").times(1, 3).trim(P.optWhitespace),
|
|
62
|
-
optionallyQuotedSegment
|
|
63
|
-
).map(([key, , value]) => toQuery(key, value));
|
|
64
|
-
var brackets = P.alt(query, optionallyQuotedSegment).trim(P.optWhitespace).wrap(P.string("["), P.string("]")).many();
|
|
65
|
-
var segmentAndBrackets = P.seqMap(segment, brackets, (s, bs) => [s, ...bs]);
|
|
66
|
-
path = P.sepBy(segmentAndBrackets, P.string(".")).map(flatten);
|
|
67
|
-
|
|
68
|
-
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/binding-grammar/ebnf/index.ts
|
|
69
|
-
import { Grammars } from "ebnf";
|
|
70
|
-
var parser = new Grammars.W3C.Parser(`
|
|
71
|
-
value ::= segment_and_bracket (SEGMENT_SEPARATOR segment_and_bracket)*
|
|
72
|
-
segment ::= concatenated | expression | modelRef | identifier
|
|
73
|
-
concatenated ::= (expression | modelRef | identifier)+
|
|
74
|
-
modelRef ::= OPEN_CURL OPEN_CURL value CLOSE_CURL CLOSE_CURL
|
|
75
|
-
identifier ::= [\\w\\-@]+
|
|
76
|
-
query ::= WHITESPACE* optionally_quoted_segment WHITESPACE* EQUALS EQUALS? EQUALS? WHITESPACE* optionally_quoted_segment WHITESPACE*
|
|
77
|
-
brackets ::= OPEN_BRACKET WHITESPACE* (query | optionally_quoted_segment) WHITESPACE* CLOSE_BRACKET
|
|
78
|
-
segment_and_bracket ::= segment brackets*
|
|
79
|
-
quoted_value ::= [^"']*
|
|
80
|
-
optionally_quoted_segment ::= WHITESPACE* SINGLE_QUOTE quoted_value SINGLE_QUOTE WHITESPACE* | WHITESPACE* DOUBLE_QUOTE quoted_value DOUBLE_QUOTE WHITESPACE* | WHITESPACE* segment WHITESPACE*
|
|
81
|
-
expression_value ::= [^\`]*
|
|
82
|
-
expression ::= BACK_TICK expression_value BACK_TICK
|
|
83
|
-
|
|
84
|
-
EQUALS ::= "="
|
|
85
|
-
SEGMENT_SEPARATOR ::= "."
|
|
86
|
-
SINGLE_QUOTE ::= "'"
|
|
87
|
-
DOUBLE_QUOTE ::= '"'
|
|
88
|
-
WHITESPACE ::= " "
|
|
89
|
-
OPEN_CURL ::= "{"
|
|
90
|
-
CLOSE_CURL ::= "}"
|
|
91
|
-
OPEN_BRACKET ::= "["
|
|
92
|
-
CLOSE_BRACKET ::= "]"
|
|
93
|
-
BACK_TICK ::= "\`"
|
|
94
|
-
`);
|
|
95
|
-
|
|
96
42
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/binding-grammar/custom/index.ts
|
|
97
43
|
var SEGMENT_SEPARATOR = ".";
|
|
98
44
|
var OPEN_CURL = "{";
|
|
@@ -123,14 +69,14 @@ var isIdentifierChar = (char) => {
|
|
|
123
69
|
charCode === 125;
|
|
124
70
|
return !matches;
|
|
125
71
|
};
|
|
126
|
-
var parse = (
|
|
72
|
+
var parse = (path) => {
|
|
127
73
|
let index = 1;
|
|
128
|
-
let ch =
|
|
74
|
+
let ch = path.charAt(0);
|
|
129
75
|
const next = (expected) => {
|
|
130
76
|
if (expected && ch !== expected) {
|
|
131
77
|
throw new Error(`Expected char: ${expected} but got: ${ch}`);
|
|
132
78
|
}
|
|
133
|
-
ch =
|
|
79
|
+
ch = path.charAt(index);
|
|
134
80
|
index += 1;
|
|
135
81
|
return ch;
|
|
136
82
|
};
|
|
@@ -139,7 +85,7 @@ var parse = (path2) => {
|
|
|
139
85
|
next();
|
|
140
86
|
}
|
|
141
87
|
};
|
|
142
|
-
const
|
|
88
|
+
const identifier = () => {
|
|
143
89
|
if (!isIdentifierChar(ch)) {
|
|
144
90
|
return;
|
|
145
91
|
}
|
|
@@ -185,7 +131,7 @@ var parse = (path2) => {
|
|
|
185
131
|
return toValue(value);
|
|
186
132
|
}
|
|
187
133
|
};
|
|
188
|
-
const
|
|
134
|
+
const nestedPath = () => {
|
|
189
135
|
if (ch === OPEN_CURL) {
|
|
190
136
|
next(OPEN_CURL);
|
|
191
137
|
next(OPEN_CURL);
|
|
@@ -195,8 +141,8 @@ var parse = (path2) => {
|
|
|
195
141
|
return modelRef;
|
|
196
142
|
}
|
|
197
143
|
};
|
|
198
|
-
const simpleSegment = () =>
|
|
199
|
-
const
|
|
144
|
+
const simpleSegment = () => nestedPath() ?? expression() ?? identifier();
|
|
145
|
+
const segment = () => {
|
|
200
146
|
const segments = [];
|
|
201
147
|
let nextSegment = simpleSegment();
|
|
202
148
|
while (nextSegment !== void 0) {
|
|
@@ -208,13 +154,13 @@ var parse = (path2) => {
|
|
|
208
154
|
}
|
|
209
155
|
return toConcatenatedNode(segments);
|
|
210
156
|
};
|
|
211
|
-
const
|
|
157
|
+
const optionallyQuotedSegment = () => {
|
|
212
158
|
whitespace();
|
|
213
159
|
if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
|
|
214
|
-
const
|
|
215
|
-
next(
|
|
160
|
+
const singleQuote = ch === SINGLE_QUOTE;
|
|
161
|
+
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
216
162
|
const id = regex(/[^'"]+/);
|
|
217
|
-
next(
|
|
163
|
+
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
218
164
|
return id;
|
|
219
165
|
}
|
|
220
166
|
return simpleSegment();
|
|
@@ -232,12 +178,12 @@ var parse = (path2) => {
|
|
|
232
178
|
if (ch === OPEN_BRACKET) {
|
|
233
179
|
next(OPEN_BRACKET);
|
|
234
180
|
whitespace();
|
|
235
|
-
let value =
|
|
181
|
+
let value = optionallyQuotedSegment();
|
|
236
182
|
if (value) {
|
|
237
183
|
whitespace();
|
|
238
184
|
if (equals()) {
|
|
239
185
|
whitespace();
|
|
240
|
-
const second =
|
|
186
|
+
const second = optionallyQuotedSegment();
|
|
241
187
|
value = toQuery(value, second);
|
|
242
188
|
whitespace();
|
|
243
189
|
}
|
|
@@ -252,7 +198,7 @@ var parse = (path2) => {
|
|
|
252
198
|
};
|
|
253
199
|
const parseSegmentAndBrackets = () => {
|
|
254
200
|
const parsed = [];
|
|
255
|
-
const firstSegment =
|
|
201
|
+
const firstSegment = segment();
|
|
256
202
|
if (firstSegment) {
|
|
257
203
|
parsed.push(firstSegment);
|
|
258
204
|
let bracketSegment = parseBracket();
|
|
@@ -326,12 +272,12 @@ function findInArray(array, key, value) {
|
|
|
326
272
|
var BindingInstance = class _BindingInstance {
|
|
327
273
|
constructor(raw, factory = (rawBinding) => new _BindingInstance(rawBinding)) {
|
|
328
274
|
const split = Array.isArray(raw) ? raw : raw.split(".");
|
|
329
|
-
this.split = split.map((
|
|
330
|
-
if (typeof
|
|
331
|
-
return
|
|
275
|
+
this.split = split.map((segment) => {
|
|
276
|
+
if (typeof segment === "number") {
|
|
277
|
+
return segment;
|
|
332
278
|
}
|
|
333
|
-
const tryNum = Number(
|
|
334
|
-
return isNaN(tryNum) ?
|
|
279
|
+
const tryNum = Number(segment);
|
|
280
|
+
return isNaN(tryNum) ? segment : tryNum;
|
|
335
281
|
});
|
|
336
282
|
Object.freeze(this.split);
|
|
337
283
|
this.joined = this.split.join(".");
|
|
@@ -418,13 +364,13 @@ function resolveBindingAST(bindingPathNode, options, hooks) {
|
|
|
418
364
|
}
|
|
419
365
|
throw new Error(`Unable to resolve value for node: ${node.name}`);
|
|
420
366
|
}
|
|
421
|
-
function appendPathSegments(
|
|
422
|
-
if (typeof
|
|
423
|
-
|
|
367
|
+
function appendPathSegments(segment) {
|
|
368
|
+
if (typeof segment === "string" && segment.indexOf(".") > -1) {
|
|
369
|
+
segment.split(".").forEach((i) => {
|
|
424
370
|
context.path.push(maybeConvertToNum(i));
|
|
425
371
|
});
|
|
426
372
|
} else {
|
|
427
|
-
context.path.push(
|
|
373
|
+
context.path.push(segment);
|
|
428
374
|
}
|
|
429
375
|
}
|
|
430
376
|
function resolveNode(_node) {
|
|
@@ -495,21 +441,21 @@ var BindingParser = class {
|
|
|
495
441
|
* Takes a binding path, parses it, and returns an equivalent, normalized
|
|
496
442
|
* representation of that path.
|
|
497
443
|
*/
|
|
498
|
-
normalizePath(
|
|
499
|
-
if (!BINDING_BRACKETS_REGEX.test(
|
|
500
|
-
return { path:
|
|
444
|
+
normalizePath(path, resolveOptions) {
|
|
445
|
+
if (!BINDING_BRACKETS_REGEX.test(path) && LAZY_BINDING_REGEX.test(path) && this.hooks.skipOptimization.call(path) !== true) {
|
|
446
|
+
return { path: path.split("."), updates: void 0 };
|
|
501
447
|
}
|
|
502
|
-
const ast = this.parseCache[
|
|
503
|
-
this.parseCache[
|
|
448
|
+
const ast = this.parseCache[path] ?? parse(path);
|
|
449
|
+
this.parseCache[path] = ast;
|
|
504
450
|
if (typeof ast !== "object" || !ast?.status) {
|
|
505
451
|
throw new TypeError(
|
|
506
|
-
`Cannot normalize path "${
|
|
452
|
+
`Cannot normalize path "${path}": ${ast?.error ?? "Unknown Error."}`
|
|
507
453
|
);
|
|
508
454
|
}
|
|
509
455
|
try {
|
|
510
456
|
return resolveBindingAST(ast.path, resolveOptions, this.hooks);
|
|
511
457
|
} catch (e) {
|
|
512
|
-
throw new NestedError2(`Cannot resolve binding: ${
|
|
458
|
+
throw new NestedError2(`Cannot resolve binding: ${path}`, e);
|
|
513
459
|
}
|
|
514
460
|
}
|
|
515
461
|
getBindingForNormalizedResult(normalized) {
|
|
@@ -535,25 +481,25 @@ var BindingParser = class {
|
|
|
535
481
|
let updates = {};
|
|
536
482
|
const joined = Array.isArray(rawBinding) ? rawBinding.join(".") : String(rawBinding);
|
|
537
483
|
const normalizeConfig = {
|
|
538
|
-
getValue: (
|
|
539
|
-
const normalized2 = this.normalizePath(
|
|
484
|
+
getValue: (path) => {
|
|
485
|
+
const normalized2 = this.normalizePath(path.join("."), normalizeConfig);
|
|
540
486
|
return options.get(this.getBindingForNormalizedResult(normalized2));
|
|
541
487
|
},
|
|
542
488
|
evaluate: (exp) => {
|
|
543
489
|
return options.evaluate(exp);
|
|
544
490
|
},
|
|
545
|
-
convertToPath: (
|
|
546
|
-
if (
|
|
491
|
+
convertToPath: (path) => {
|
|
492
|
+
if (path === void 0) {
|
|
547
493
|
throw new Error(
|
|
548
494
|
"Attempted to convert undefined value to binding path"
|
|
549
495
|
);
|
|
550
496
|
}
|
|
551
|
-
if (typeof
|
|
497
|
+
if (typeof path !== "string" && typeof path !== "number" && typeof path !== "boolean") {
|
|
552
498
|
throw new Error(
|
|
553
|
-
`Attempting to convert ${typeof
|
|
499
|
+
`Attempting to convert ${typeof path} to a binding path.`
|
|
554
500
|
);
|
|
555
501
|
}
|
|
556
|
-
const normalized2 = this.normalizePath(String(
|
|
502
|
+
const normalized2 = this.normalizePath(String(path), normalizeConfig);
|
|
557
503
|
if (normalized2.updates) {
|
|
558
504
|
updates = {
|
|
559
505
|
...updates,
|
|
@@ -1387,17 +1333,17 @@ function parseExpression(expr, options) {
|
|
|
1387
1333
|
break;
|
|
1388
1334
|
}
|
|
1389
1335
|
}
|
|
1390
|
-
const
|
|
1391
|
-
if (Object.prototype.hasOwnProperty.call(literals,
|
|
1336
|
+
const identifier = expr.slice(start, index);
|
|
1337
|
+
if (Object.prototype.hasOwnProperty.call(literals, identifier)) {
|
|
1392
1338
|
return {
|
|
1393
1339
|
__id: ExpNodeOpaqueIdentifier,
|
|
1394
1340
|
type: "Literal",
|
|
1395
|
-
value: literals[
|
|
1396
|
-
raw:
|
|
1341
|
+
value: literals[identifier],
|
|
1342
|
+
raw: identifier,
|
|
1397
1343
|
location: getLocation(start)
|
|
1398
1344
|
};
|
|
1399
1345
|
}
|
|
1400
|
-
if (
|
|
1346
|
+
if (identifier === thisStr) {
|
|
1401
1347
|
return {
|
|
1402
1348
|
__id: ExpNodeOpaqueIdentifier,
|
|
1403
1349
|
type: "ThisExpression",
|
|
@@ -1407,7 +1353,7 @@ function parseExpression(expr, options) {
|
|
|
1407
1353
|
return {
|
|
1408
1354
|
__id: ExpNodeOpaqueIdentifier,
|
|
1409
1355
|
type: "Identifier",
|
|
1410
|
-
name:
|
|
1356
|
+
name: identifier,
|
|
1411
1357
|
location: getLocation(start)
|
|
1412
1358
|
};
|
|
1413
1359
|
}
|
|
@@ -2038,7 +1984,7 @@ var ProxyLogger = class {
|
|
|
2038
1984
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/schema/schema.ts
|
|
2039
1985
|
import { SyncWaterfallHook as SyncWaterfallHook3 } from "tapable-ts";
|
|
2040
1986
|
var identify = (val) => val;
|
|
2041
|
-
function
|
|
1987
|
+
function parse2(schema) {
|
|
2042
1988
|
const expandedPaths = /* @__PURE__ */ new Map();
|
|
2043
1989
|
if (!schema.ROOT) {
|
|
2044
1990
|
return expandedPaths;
|
|
@@ -2049,10 +1995,10 @@ function parse4(schema) {
|
|
|
2049
1995
|
if (!next) {
|
|
2050
1996
|
break;
|
|
2051
1997
|
}
|
|
2052
|
-
const { node, path
|
|
1998
|
+
const { node, path, visited } = next;
|
|
2053
1999
|
Object.entries(node).forEach(([prop, type]) => {
|
|
2054
|
-
const
|
|
2055
|
-
const nestedPathStr =
|
|
2000
|
+
const nestedPath = [...path, prop];
|
|
2001
|
+
const nestedPathStr = nestedPath.join(".");
|
|
2056
2002
|
if (expandedPaths.has(nestedPathStr)) {
|
|
2057
2003
|
throw new Error(
|
|
2058
2004
|
"Path has already been processed. There's either a loop somewhere or a bug"
|
|
@@ -2065,14 +2011,14 @@ function parse4(schema) {
|
|
|
2065
2011
|
}
|
|
2066
2012
|
expandedPaths.set(nestedPathStr, type);
|
|
2067
2013
|
if (type.isArray) {
|
|
2068
|
-
|
|
2014
|
+
nestedPath.push("[]");
|
|
2069
2015
|
}
|
|
2070
2016
|
if (type.isRecord) {
|
|
2071
|
-
|
|
2017
|
+
nestedPath.push("{}");
|
|
2072
2018
|
}
|
|
2073
2019
|
if (type.type && schema[type.type]) {
|
|
2074
2020
|
parseQueue.push({
|
|
2075
|
-
path:
|
|
2021
|
+
path: nestedPath,
|
|
2076
2022
|
node: schema[type.type],
|
|
2077
2023
|
visited: /* @__PURE__ */ new Set([...visited, type.type])
|
|
2078
2024
|
});
|
|
@@ -2090,7 +2036,7 @@ var SchemaController = class {
|
|
|
2090
2036
|
this.hooks = {
|
|
2091
2037
|
resolveTypeForBinding: new SyncWaterfallHook3()
|
|
2092
2038
|
};
|
|
2093
|
-
this.schema = schema ?
|
|
2039
|
+
this.schema = schema ? parse2(schema) : /* @__PURE__ */ new Map();
|
|
2094
2040
|
}
|
|
2095
2041
|
addFormatters(fns) {
|
|
2096
2042
|
fns.forEach((def) => {
|
|
@@ -2555,7 +2501,7 @@ var Parser = class {
|
|
|
2555
2501
|
return parsedNode;
|
|
2556
2502
|
}
|
|
2557
2503
|
}
|
|
2558
|
-
const parseLocalObject = (currentValue, objToParse,
|
|
2504
|
+
const parseLocalObject = (currentValue, objToParse, path = []) => {
|
|
2559
2505
|
if (typeof objToParse !== "object" || objToParse === null) {
|
|
2560
2506
|
return { value: objToParse, children: [] };
|
|
2561
2507
|
}
|
|
@@ -2589,7 +2535,7 @@ var Parser = class {
|
|
|
2589
2535
|
children: [
|
|
2590
2536
|
...children2,
|
|
2591
2537
|
{
|
|
2592
|
-
path: [...
|
|
2538
|
+
path: [...path, "asset"],
|
|
2593
2539
|
value: assetAST
|
|
2594
2540
|
}
|
|
2595
2541
|
]
|
|
@@ -2614,7 +2560,7 @@ var Parser = class {
|
|
|
2614
2560
|
}
|
|
2615
2561
|
if (templateAST) {
|
|
2616
2562
|
return {
|
|
2617
|
-
path: [...
|
|
2563
|
+
path: [...path, template.output],
|
|
2618
2564
|
value: templateAST
|
|
2619
2565
|
};
|
|
2620
2566
|
}
|
|
@@ -2638,7 +2584,7 @@ var Parser = class {
|
|
|
2638
2584
|
children: [
|
|
2639
2585
|
...children2,
|
|
2640
2586
|
{
|
|
2641
|
-
path: [...
|
|
2587
|
+
path: [...path, localKey, ...firstChild.path],
|
|
2642
2588
|
value: firstChild.value
|
|
2643
2589
|
}
|
|
2644
2590
|
]
|
|
@@ -2650,7 +2596,7 @@ var Parser = class {
|
|
|
2650
2596
|
children: [
|
|
2651
2597
|
...children2,
|
|
2652
2598
|
{
|
|
2653
|
-
path: [...
|
|
2599
|
+
path: [...path, localKey],
|
|
2654
2600
|
value: localSwitch
|
|
2655
2601
|
}
|
|
2656
2602
|
]
|
|
@@ -2664,7 +2610,7 @@ var Parser = class {
|
|
|
2664
2610
|
);
|
|
2665
2611
|
if (localAsync) {
|
|
2666
2612
|
children2.push({
|
|
2667
|
-
path: [...
|
|
2613
|
+
path: [...path, localKey],
|
|
2668
2614
|
value: localAsync
|
|
2669
2615
|
});
|
|
2670
2616
|
}
|
|
@@ -2692,7 +2638,7 @@ var Parser = class {
|
|
|
2692
2638
|
children: [
|
|
2693
2639
|
...children2,
|
|
2694
2640
|
{
|
|
2695
|
-
path: [...
|
|
2641
|
+
path: [...path, localKey],
|
|
2696
2642
|
value: multiNode
|
|
2697
2643
|
}
|
|
2698
2644
|
]
|
|
@@ -2714,7 +2660,7 @@ var Parser = class {
|
|
|
2714
2660
|
children: [
|
|
2715
2661
|
...children2,
|
|
2716
2662
|
{
|
|
2717
|
-
path: [...
|
|
2663
|
+
path: [...path, localKey],
|
|
2718
2664
|
value: parsedNode
|
|
2719
2665
|
}
|
|
2720
2666
|
]
|
|
@@ -2722,7 +2668,7 @@ var Parser = class {
|
|
|
2722
2668
|
}
|
|
2723
2669
|
} else {
|
|
2724
2670
|
const result = parseLocalObject(accumulation.value, localValue, [
|
|
2725
|
-
...
|
|
2671
|
+
...path,
|
|
2726
2672
|
localKey
|
|
2727
2673
|
]);
|
|
2728
2674
|
return {
|
|
@@ -2733,7 +2679,7 @@ var Parser = class {
|
|
|
2733
2679
|
} else {
|
|
2734
2680
|
const value2 = setIn4(
|
|
2735
2681
|
accumulation.value,
|
|
2736
|
-
[...
|
|
2682
|
+
[...path, localKey],
|
|
2737
2683
|
localValue
|
|
2738
2684
|
);
|
|
2739
2685
|
return {
|
|
@@ -3105,13 +3051,13 @@ var Resolver = class {
|
|
|
3105
3051
|
|
|
3106
3052
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/view.ts
|
|
3107
3053
|
var CrossfieldProvider = class {
|
|
3108
|
-
constructor(initialView,
|
|
3054
|
+
constructor(initialView, parser, logger) {
|
|
3109
3055
|
this.allValidations = /* @__PURE__ */ new Set();
|
|
3110
3056
|
this.byBinding = /* @__PURE__ */ new Map();
|
|
3111
3057
|
this.logger = logger;
|
|
3112
|
-
this.parse(initialView,
|
|
3058
|
+
this.parse(initialView, parser);
|
|
3113
3059
|
}
|
|
3114
|
-
parse(contentView,
|
|
3060
|
+
parse(contentView, parser) {
|
|
3115
3061
|
const xfieldRefs = contentView.validation;
|
|
3116
3062
|
if (xfieldRefs === void 0) {
|
|
3117
3063
|
return;
|
|
@@ -3131,7 +3077,7 @@ var CrossfieldProvider = class {
|
|
|
3131
3077
|
this.allValidations.add(withDefaults);
|
|
3132
3078
|
const { ref } = vRef;
|
|
3133
3079
|
if (ref) {
|
|
3134
|
-
const parsed =
|
|
3080
|
+
const parsed = parser(ref);
|
|
3135
3081
|
if (this.byBinding.has(parsed)) {
|
|
3136
3082
|
this.byBinding.get(parsed)?.push(withDefaults);
|
|
3137
3083
|
} else {
|
|
@@ -3178,12 +3124,12 @@ var ViewInstance = class {
|
|
|
3178
3124
|
"templatePlugin not set for View, legacy templates may not work"
|
|
3179
3125
|
);
|
|
3180
3126
|
}
|
|
3181
|
-
const
|
|
3182
|
-
this.hooks.parser.call(
|
|
3183
|
-
this.rootNode =
|
|
3127
|
+
const parser = new Parser();
|
|
3128
|
+
this.hooks.parser.call(parser);
|
|
3129
|
+
this.rootNode = parser.parseView(this.initialView);
|
|
3184
3130
|
this.resolver = new Resolver(this.rootNode, {
|
|
3185
3131
|
...this.resolverOptions,
|
|
3186
|
-
parseNode:
|
|
3132
|
+
parseNode: parser.parseObject.bind(parser)
|
|
3187
3133
|
});
|
|
3188
3134
|
this.hooks.resolver.call(this.resolver);
|
|
3189
3135
|
}
|
|
@@ -3248,10 +3194,10 @@ var Builder = class {
|
|
|
3248
3194
|
* @param path - The path at which to add the child
|
|
3249
3195
|
* @param child - The child node
|
|
3250
3196
|
*/
|
|
3251
|
-
static addChild(node,
|
|
3197
|
+
static addChild(node, path, child) {
|
|
3252
3198
|
child.parent = node;
|
|
3253
3199
|
const newChild = {
|
|
3254
|
-
path: Array.isArray(
|
|
3200
|
+
path: Array.isArray(path) ? path : [path],
|
|
3255
3201
|
value: child
|
|
3256
3202
|
};
|
|
3257
3203
|
node.children = node.children || [];
|
|
@@ -3315,27 +3261,27 @@ var TemplatePlugin = class {
|
|
|
3315
3261
|
};
|
|
3316
3262
|
return result;
|
|
3317
3263
|
}
|
|
3318
|
-
applyParser(
|
|
3319
|
-
|
|
3264
|
+
applyParser(parser) {
|
|
3265
|
+
parser.hooks.onCreateASTNode.tap("template", (node) => {
|
|
3320
3266
|
if (node && node.type === "template" /* Template */ && !node.dynamic) {
|
|
3321
3267
|
return this.parseTemplate(
|
|
3322
|
-
|
|
3268
|
+
parser.parseObject.bind(parser),
|
|
3323
3269
|
node,
|
|
3324
3270
|
this.options
|
|
3325
3271
|
);
|
|
3326
3272
|
}
|
|
3327
3273
|
return node;
|
|
3328
3274
|
});
|
|
3329
|
-
|
|
3275
|
+
parser.hooks.determineNodeType.tap("template", (obj) => {
|
|
3330
3276
|
if (obj === "template") {
|
|
3331
3277
|
return "template" /* Template */;
|
|
3332
3278
|
}
|
|
3333
3279
|
});
|
|
3334
|
-
|
|
3280
|
+
parser.hooks.parseNode.tap(
|
|
3335
3281
|
"template",
|
|
3336
3282
|
(obj, _nodeType, options, determinedNodeType) => {
|
|
3337
3283
|
if (determinedNodeType === "template" /* Template */) {
|
|
3338
|
-
const templateNode =
|
|
3284
|
+
const templateNode = parser.createASTNode(
|
|
3339
3285
|
{
|
|
3340
3286
|
type: "template" /* Template */,
|
|
3341
3287
|
depth: options.templateDepth ?? 0,
|
|
@@ -3457,7 +3403,7 @@ var StringResolverPlugin = class {
|
|
|
3457
3403
|
propsToSkip = /* @__PURE__ */ new Set(["exp"]);
|
|
3458
3404
|
}
|
|
3459
3405
|
const nodePath = findBasePath(node, resolver);
|
|
3460
|
-
if (nodePath.length > 0 && nodePath.some((
|
|
3406
|
+
if (nodePath.length > 0 && nodePath.some((segment) => propsToSkip.has(segment.toString()))) {
|
|
3461
3407
|
return node.value;
|
|
3462
3408
|
}
|
|
3463
3409
|
return resolveAllRefs(node.value, options, propsToSkip);
|
|
@@ -3489,23 +3435,23 @@ var ApplicabilityPlugin = class {
|
|
|
3489
3435
|
}
|
|
3490
3436
|
);
|
|
3491
3437
|
}
|
|
3492
|
-
applyParser(
|
|
3493
|
-
|
|
3438
|
+
applyParser(parser) {
|
|
3439
|
+
parser.hooks.determineNodeType.tap("applicability", (obj) => {
|
|
3494
3440
|
if (Object.prototype.hasOwnProperty.call(obj, "applicability")) {
|
|
3495
3441
|
return "applicability" /* Applicability */;
|
|
3496
3442
|
}
|
|
3497
3443
|
});
|
|
3498
|
-
|
|
3444
|
+
parser.hooks.parseNode.tap(
|
|
3499
3445
|
"applicability",
|
|
3500
3446
|
(obj, nodeType, options, determinedNodeType) => {
|
|
3501
3447
|
if (determinedNodeType === "applicability" /* Applicability */) {
|
|
3502
|
-
const parsedApplicability =
|
|
3448
|
+
const parsedApplicability = parser.parseObject(
|
|
3503
3449
|
omit3(obj, "applicability"),
|
|
3504
3450
|
nodeType,
|
|
3505
3451
|
options
|
|
3506
3452
|
);
|
|
3507
3453
|
if (parsedApplicability !== null) {
|
|
3508
|
-
const applicabilityNode =
|
|
3454
|
+
const applicabilityNode = parser.createASTNode(
|
|
3509
3455
|
{
|
|
3510
3456
|
type: "applicability" /* Applicability */,
|
|
3511
3457
|
expression: obj.applicability,
|
|
@@ -3542,19 +3488,19 @@ var SwitchPlugin = class {
|
|
|
3542
3488
|
}
|
|
3543
3489
|
return EMPTY_NODE;
|
|
3544
3490
|
}
|
|
3545
|
-
applyParser(
|
|
3546
|
-
|
|
3491
|
+
applyParser(parser) {
|
|
3492
|
+
parser.hooks.onCreateASTNode.tap("switch", (node) => {
|
|
3547
3493
|
if (node && node.type === "switch" /* Switch */ && !node.dynamic) {
|
|
3548
3494
|
return this.resolveSwitch(node, this.options);
|
|
3549
3495
|
}
|
|
3550
3496
|
return node;
|
|
3551
3497
|
});
|
|
3552
|
-
|
|
3498
|
+
parser.hooks.determineNodeType.tap("switch", (obj) => {
|
|
3553
3499
|
if (Object.prototype.hasOwnProperty.call(obj, "dynamicSwitch") || Object.prototype.hasOwnProperty.call(obj, "staticSwitch")) {
|
|
3554
3500
|
return "switch" /* Switch */;
|
|
3555
3501
|
}
|
|
3556
3502
|
});
|
|
3557
|
-
|
|
3503
|
+
parser.hooks.parseNode.tap(
|
|
3558
3504
|
"switch",
|
|
3559
3505
|
(obj, _nodeType, options, determinedNodeType) => {
|
|
3560
3506
|
if (determinedNodeType === "switch" /* Switch */) {
|
|
@@ -3564,7 +3510,7 @@ var SwitchPlugin = class {
|
|
|
3564
3510
|
switchContent.forEach(
|
|
3565
3511
|
(switchCase) => {
|
|
3566
3512
|
const { case: switchCaseExpr, ...switchBody } = switchCase;
|
|
3567
|
-
const value =
|
|
3513
|
+
const value = parser.parseObject(
|
|
3568
3514
|
switchBody,
|
|
3569
3515
|
"value" /* Value */,
|
|
3570
3516
|
options
|
|
@@ -3577,7 +3523,7 @@ var SwitchPlugin = class {
|
|
|
3577
3523
|
}
|
|
3578
3524
|
}
|
|
3579
3525
|
);
|
|
3580
|
-
const switchAST =
|
|
3526
|
+
const switchAST = parser.hooks.onCreateASTNode.call(
|
|
3581
3527
|
{
|
|
3582
3528
|
type: "switch" /* Switch */,
|
|
3583
3529
|
dynamic,
|
|
@@ -4471,11 +4417,11 @@ var ValidationController = class {
|
|
|
4471
4417
|
getValidationForBinding(binding) {
|
|
4472
4418
|
return this.validations.get(binding);
|
|
4473
4419
|
}
|
|
4474
|
-
forView(
|
|
4420
|
+
forView(parser) {
|
|
4475
4421
|
return {
|
|
4476
4422
|
_getValidationForBinding: (binding) => {
|
|
4477
4423
|
return this.getValidationForBinding(
|
|
4478
|
-
isBinding(binding) ? binding :
|
|
4424
|
+
isBinding(binding) ? binding : parser(binding)
|
|
4479
4425
|
);
|
|
4480
4426
|
},
|
|
4481
4427
|
getAll: () => {
|
|
@@ -4512,7 +4458,7 @@ var ValidationController = class {
|
|
|
4512
4458
|
"Section functionality should be provided by the view plugin"
|
|
4513
4459
|
);
|
|
4514
4460
|
},
|
|
4515
|
-
type: (binding) => this.schema.getType(isBinding(binding) ? binding :
|
|
4461
|
+
type: (binding) => this.schema.getType(isBinding(binding) ? binding : parser(binding))
|
|
4516
4462
|
};
|
|
4517
4463
|
}
|
|
4518
4464
|
};
|
|
@@ -4954,7 +4900,7 @@ var DataController = class {
|
|
|
4954
4900
|
};
|
|
4955
4901
|
|
|
4956
4902
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/controllers/constants/utils.ts
|
|
4957
|
-
function
|
|
4903
|
+
function flatten(obj, roots = [], sep = ".") {
|
|
4958
4904
|
return Object.keys(obj).reduce(
|
|
4959
4905
|
(memo, prop) => ({
|
|
4960
4906
|
// create a new object
|
|
@@ -4962,7 +4908,7 @@ function flatten2(obj, roots = [], sep = ".") {
|
|
|
4962
4908
|
...memo,
|
|
4963
4909
|
...Object.prototype.toString.call(obj[prop]) === "[object Object]" ? (
|
|
4964
4910
|
// keep working if value is an object
|
|
4965
|
-
|
|
4911
|
+
flatten(obj[prop], roots.concat([prop]))
|
|
4966
4912
|
) : (
|
|
4967
4913
|
// include current prop and value and prefix prop with the roots
|
|
4968
4914
|
{ [roots.concat([prop]).join(sep)]: obj[prop] }
|
|
@@ -4972,7 +4918,7 @@ function flatten2(obj, roots = [], sep = ".") {
|
|
|
4972
4918
|
);
|
|
4973
4919
|
}
|
|
4974
4920
|
function objectToBatchSet(obj) {
|
|
4975
|
-
const flattenedObj =
|
|
4921
|
+
const flattenedObj = flatten(obj);
|
|
4976
4922
|
const batchTxn = [];
|
|
4977
4923
|
Object.keys(flattenedObj).forEach((key) => {
|
|
4978
4924
|
batchTxn.push([new BindingInstance(key), flattenedObj[key]]);
|
|
@@ -4994,8 +4940,8 @@ var ConstantsController = class {
|
|
|
4994
4940
|
}
|
|
4995
4941
|
}
|
|
4996
4942
|
getConstants(key, namespace, fallback) {
|
|
4997
|
-
const
|
|
4998
|
-
return this.tempStore.get(namespace)?.get(
|
|
4943
|
+
const path = new BindingInstance(key);
|
|
4944
|
+
return this.tempStore.get(namespace)?.get(path) ?? this.store.get(namespace)?.get(path) ?? fallback;
|
|
4999
4945
|
}
|
|
5000
4946
|
setTemporaryValues(data, namespace) {
|
|
5001
4947
|
if (this.tempStore.has(namespace)) {
|
|
@@ -5509,7 +5455,7 @@ export {
|
|
|
5509
5455
|
isExpressionNode,
|
|
5510
5456
|
isObjectExpression,
|
|
5511
5457
|
maybeConvertToNum,
|
|
5512
|
-
|
|
5458
|
+
parse2 as parse,
|
|
5513
5459
|
parseExpression,
|
|
5514
5460
|
removeBindingAndChildrenFromMap,
|
|
5515
5461
|
resolveDataRefs,
|