@player-ui/player 0.8.0-next.0 → 0.8.0-next.2
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/cjs/index.cjs
CHANGED
|
@@ -90,7 +90,7 @@ __export(src_exports, {
|
|
|
90
90
|
isExpressionNode: () => isExpressionNode,
|
|
91
91
|
isObjectExpression: () => isObjectExpression,
|
|
92
92
|
maybeConvertToNum: () => maybeConvertToNum,
|
|
93
|
-
parse: () =>
|
|
93
|
+
parse: () => parse2,
|
|
94
94
|
parseExpression: () => parseExpression,
|
|
95
95
|
removeBindingAndChildrenFromMap: () => removeBindingAndChildrenFromMap,
|
|
96
96
|
resolveDataRefs: () => resolveDataRefs,
|
|
@@ -119,9 +119,9 @@ var toExpression = (value) => ({
|
|
|
119
119
|
name: "Expression",
|
|
120
120
|
value
|
|
121
121
|
});
|
|
122
|
-
var toPath = (
|
|
122
|
+
var toPath = (path) => ({
|
|
123
123
|
name: "PathNode",
|
|
124
|
-
path
|
|
124
|
+
path
|
|
125
125
|
});
|
|
126
126
|
var toQuery = (key, value) => ({
|
|
127
127
|
name: "Query",
|
|
@@ -138,60 +138,6 @@ var toConcatenatedNode = (values) => {
|
|
|
138
138
|
};
|
|
139
139
|
};
|
|
140
140
|
|
|
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
141
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/binding-grammar/custom/index.ts
|
|
196
142
|
var SEGMENT_SEPARATOR = ".";
|
|
197
143
|
var OPEN_CURL = "{";
|
|
@@ -222,14 +168,14 @@ var isIdentifierChar = (char) => {
|
|
|
222
168
|
charCode === 125;
|
|
223
169
|
return !matches;
|
|
224
170
|
};
|
|
225
|
-
var parse = (
|
|
171
|
+
var parse = (path) => {
|
|
226
172
|
let index = 1;
|
|
227
|
-
let ch =
|
|
173
|
+
let ch = path.charAt(0);
|
|
228
174
|
const next = (expected) => {
|
|
229
175
|
if (expected && ch !== expected) {
|
|
230
176
|
throw new Error(`Expected char: ${expected} but got: ${ch}`);
|
|
231
177
|
}
|
|
232
|
-
ch =
|
|
178
|
+
ch = path.charAt(index);
|
|
233
179
|
index += 1;
|
|
234
180
|
return ch;
|
|
235
181
|
};
|
|
@@ -238,7 +184,7 @@ var parse = (path2) => {
|
|
|
238
184
|
next();
|
|
239
185
|
}
|
|
240
186
|
};
|
|
241
|
-
const
|
|
187
|
+
const identifier = () => {
|
|
242
188
|
if (!isIdentifierChar(ch)) {
|
|
243
189
|
return;
|
|
244
190
|
}
|
|
@@ -284,7 +230,7 @@ var parse = (path2) => {
|
|
|
284
230
|
return toValue(value);
|
|
285
231
|
}
|
|
286
232
|
};
|
|
287
|
-
const
|
|
233
|
+
const nestedPath = () => {
|
|
288
234
|
if (ch === OPEN_CURL) {
|
|
289
235
|
next(OPEN_CURL);
|
|
290
236
|
next(OPEN_CURL);
|
|
@@ -294,8 +240,8 @@ var parse = (path2) => {
|
|
|
294
240
|
return modelRef;
|
|
295
241
|
}
|
|
296
242
|
};
|
|
297
|
-
const simpleSegment = () =>
|
|
298
|
-
const
|
|
243
|
+
const simpleSegment = () => nestedPath() ?? expression() ?? identifier();
|
|
244
|
+
const segment = () => {
|
|
299
245
|
const segments = [];
|
|
300
246
|
let nextSegment = simpleSegment();
|
|
301
247
|
while (nextSegment !== void 0) {
|
|
@@ -307,13 +253,13 @@ var parse = (path2) => {
|
|
|
307
253
|
}
|
|
308
254
|
return toConcatenatedNode(segments);
|
|
309
255
|
};
|
|
310
|
-
const
|
|
256
|
+
const optionallyQuotedSegment = () => {
|
|
311
257
|
whitespace();
|
|
312
258
|
if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
|
|
313
|
-
const
|
|
314
|
-
next(
|
|
259
|
+
const singleQuote = ch === SINGLE_QUOTE;
|
|
260
|
+
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
315
261
|
const id = regex(/[^'"]+/);
|
|
316
|
-
next(
|
|
262
|
+
next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
|
|
317
263
|
return id;
|
|
318
264
|
}
|
|
319
265
|
return simpleSegment();
|
|
@@ -331,12 +277,12 @@ var parse = (path2) => {
|
|
|
331
277
|
if (ch === OPEN_BRACKET) {
|
|
332
278
|
next(OPEN_BRACKET);
|
|
333
279
|
whitespace();
|
|
334
|
-
let value =
|
|
280
|
+
let value = optionallyQuotedSegment();
|
|
335
281
|
if (value) {
|
|
336
282
|
whitespace();
|
|
337
283
|
if (equals()) {
|
|
338
284
|
whitespace();
|
|
339
|
-
const second =
|
|
285
|
+
const second = optionallyQuotedSegment();
|
|
340
286
|
value = toQuery(value, second);
|
|
341
287
|
whitespace();
|
|
342
288
|
}
|
|
@@ -351,7 +297,7 @@ var parse = (path2) => {
|
|
|
351
297
|
};
|
|
352
298
|
const parseSegmentAndBrackets = () => {
|
|
353
299
|
const parsed = [];
|
|
354
|
-
const firstSegment =
|
|
300
|
+
const firstSegment = segment();
|
|
355
301
|
if (firstSegment) {
|
|
356
302
|
parsed.push(firstSegment);
|
|
357
303
|
let bracketSegment = parseBracket();
|
|
@@ -425,12 +371,12 @@ function findInArray(array, key, value) {
|
|
|
425
371
|
var BindingInstance = class _BindingInstance {
|
|
426
372
|
constructor(raw, factory = (rawBinding) => new _BindingInstance(rawBinding)) {
|
|
427
373
|
const split = Array.isArray(raw) ? raw : raw.split(".");
|
|
428
|
-
this.split = split.map((
|
|
429
|
-
if (typeof
|
|
430
|
-
return
|
|
374
|
+
this.split = split.map((segment) => {
|
|
375
|
+
if (typeof segment === "number") {
|
|
376
|
+
return segment;
|
|
431
377
|
}
|
|
432
|
-
const tryNum = Number(
|
|
433
|
-
return isNaN(tryNum) ?
|
|
378
|
+
const tryNum = Number(segment);
|
|
379
|
+
return isNaN(tryNum) ? segment : tryNum;
|
|
434
380
|
});
|
|
435
381
|
Object.freeze(this.split);
|
|
436
382
|
this.joined = this.split.join(".");
|
|
@@ -517,13 +463,13 @@ function resolveBindingAST(bindingPathNode, options, hooks) {
|
|
|
517
463
|
}
|
|
518
464
|
throw new Error(`Unable to resolve value for node: ${node.name}`);
|
|
519
465
|
}
|
|
520
|
-
function appendPathSegments(
|
|
521
|
-
if (typeof
|
|
522
|
-
|
|
466
|
+
function appendPathSegments(segment) {
|
|
467
|
+
if (typeof segment === "string" && segment.indexOf(".") > -1) {
|
|
468
|
+
segment.split(".").forEach((i) => {
|
|
523
469
|
context.path.push(maybeConvertToNum(i));
|
|
524
470
|
});
|
|
525
471
|
} else {
|
|
526
|
-
context.path.push(
|
|
472
|
+
context.path.push(segment);
|
|
527
473
|
}
|
|
528
474
|
}
|
|
529
475
|
function resolveNode(_node) {
|
|
@@ -594,21 +540,21 @@ var BindingParser = class {
|
|
|
594
540
|
* Takes a binding path, parses it, and returns an equivalent, normalized
|
|
595
541
|
* representation of that path.
|
|
596
542
|
*/
|
|
597
|
-
normalizePath(
|
|
598
|
-
if (!BINDING_BRACKETS_REGEX.test(
|
|
599
|
-
return { path:
|
|
543
|
+
normalizePath(path, resolveOptions) {
|
|
544
|
+
if (!BINDING_BRACKETS_REGEX.test(path) && LAZY_BINDING_REGEX.test(path) && this.hooks.skipOptimization.call(path) !== true) {
|
|
545
|
+
return { path: path.split("."), updates: void 0 };
|
|
600
546
|
}
|
|
601
|
-
const ast = this.parseCache[
|
|
602
|
-
this.parseCache[
|
|
547
|
+
const ast = this.parseCache[path] ?? parse(path);
|
|
548
|
+
this.parseCache[path] = ast;
|
|
603
549
|
if (typeof ast !== "object" || !ast?.status) {
|
|
604
550
|
throw new TypeError(
|
|
605
|
-
`Cannot normalize path "${
|
|
551
|
+
`Cannot normalize path "${path}": ${ast?.error ?? "Unknown Error."}`
|
|
606
552
|
);
|
|
607
553
|
}
|
|
608
554
|
try {
|
|
609
555
|
return resolveBindingAST(ast.path, resolveOptions, this.hooks);
|
|
610
556
|
} catch (e) {
|
|
611
|
-
throw new import_ts_nested_error2.NestedError(`Cannot resolve binding: ${
|
|
557
|
+
throw new import_ts_nested_error2.NestedError(`Cannot resolve binding: ${path}`, e);
|
|
612
558
|
}
|
|
613
559
|
}
|
|
614
560
|
getBindingForNormalizedResult(normalized) {
|
|
@@ -634,25 +580,25 @@ var BindingParser = class {
|
|
|
634
580
|
let updates = {};
|
|
635
581
|
const joined = Array.isArray(rawBinding) ? rawBinding.join(".") : String(rawBinding);
|
|
636
582
|
const normalizeConfig = {
|
|
637
|
-
getValue: (
|
|
638
|
-
const normalized2 = this.normalizePath(
|
|
583
|
+
getValue: (path) => {
|
|
584
|
+
const normalized2 = this.normalizePath(path.join("."), normalizeConfig);
|
|
639
585
|
return options.get(this.getBindingForNormalizedResult(normalized2));
|
|
640
586
|
},
|
|
641
587
|
evaluate: (exp) => {
|
|
642
588
|
return options.evaluate(exp);
|
|
643
589
|
},
|
|
644
|
-
convertToPath: (
|
|
645
|
-
if (
|
|
590
|
+
convertToPath: (path) => {
|
|
591
|
+
if (path === void 0) {
|
|
646
592
|
throw new Error(
|
|
647
593
|
"Attempted to convert undefined value to binding path"
|
|
648
594
|
);
|
|
649
595
|
}
|
|
650
|
-
if (typeof
|
|
596
|
+
if (typeof path !== "string" && typeof path !== "number" && typeof path !== "boolean") {
|
|
651
597
|
throw new Error(
|
|
652
|
-
`Attempting to convert ${typeof
|
|
598
|
+
`Attempting to convert ${typeof path} to a binding path.`
|
|
653
599
|
);
|
|
654
600
|
}
|
|
655
|
-
const normalized2 = this.normalizePath(String(
|
|
601
|
+
const normalized2 = this.normalizePath(String(path), normalizeConfig);
|
|
656
602
|
if (normalized2.updates) {
|
|
657
603
|
updates = {
|
|
658
604
|
...updates,
|
|
@@ -1486,17 +1432,17 @@ function parseExpression(expr, options) {
|
|
|
1486
1432
|
break;
|
|
1487
1433
|
}
|
|
1488
1434
|
}
|
|
1489
|
-
const
|
|
1490
|
-
if (Object.prototype.hasOwnProperty.call(literals,
|
|
1435
|
+
const identifier = expr.slice(start, index);
|
|
1436
|
+
if (Object.prototype.hasOwnProperty.call(literals, identifier)) {
|
|
1491
1437
|
return {
|
|
1492
1438
|
__id: ExpNodeOpaqueIdentifier,
|
|
1493
1439
|
type: "Literal",
|
|
1494
|
-
value: literals[
|
|
1495
|
-
raw:
|
|
1440
|
+
value: literals[identifier],
|
|
1441
|
+
raw: identifier,
|
|
1496
1442
|
location: getLocation(start)
|
|
1497
1443
|
};
|
|
1498
1444
|
}
|
|
1499
|
-
if (
|
|
1445
|
+
if (identifier === thisStr) {
|
|
1500
1446
|
return {
|
|
1501
1447
|
__id: ExpNodeOpaqueIdentifier,
|
|
1502
1448
|
type: "ThisExpression",
|
|
@@ -1506,7 +1452,7 @@ function parseExpression(expr, options) {
|
|
|
1506
1452
|
return {
|
|
1507
1453
|
__id: ExpNodeOpaqueIdentifier,
|
|
1508
1454
|
type: "Identifier",
|
|
1509
|
-
name:
|
|
1455
|
+
name: identifier,
|
|
1510
1456
|
location: getLocation(start)
|
|
1511
1457
|
};
|
|
1512
1458
|
}
|
|
@@ -2137,7 +2083,7 @@ var ProxyLogger = class {
|
|
|
2137
2083
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/schema/schema.ts
|
|
2138
2084
|
var import_tapable_ts5 = require("tapable-ts");
|
|
2139
2085
|
var identify = (val) => val;
|
|
2140
|
-
function
|
|
2086
|
+
function parse2(schema) {
|
|
2141
2087
|
const expandedPaths = /* @__PURE__ */ new Map();
|
|
2142
2088
|
if (!schema.ROOT) {
|
|
2143
2089
|
return expandedPaths;
|
|
@@ -2148,10 +2094,10 @@ function parse4(schema) {
|
|
|
2148
2094
|
if (!next) {
|
|
2149
2095
|
break;
|
|
2150
2096
|
}
|
|
2151
|
-
const { node, path
|
|
2097
|
+
const { node, path, visited } = next;
|
|
2152
2098
|
Object.entries(node).forEach(([prop, type]) => {
|
|
2153
|
-
const
|
|
2154
|
-
const nestedPathStr =
|
|
2099
|
+
const nestedPath = [...path, prop];
|
|
2100
|
+
const nestedPathStr = nestedPath.join(".");
|
|
2155
2101
|
if (expandedPaths.has(nestedPathStr)) {
|
|
2156
2102
|
throw new Error(
|
|
2157
2103
|
"Path has already been processed. There's either a loop somewhere or a bug"
|
|
@@ -2164,14 +2110,14 @@ function parse4(schema) {
|
|
|
2164
2110
|
}
|
|
2165
2111
|
expandedPaths.set(nestedPathStr, type);
|
|
2166
2112
|
if (type.isArray) {
|
|
2167
|
-
|
|
2113
|
+
nestedPath.push("[]");
|
|
2168
2114
|
}
|
|
2169
2115
|
if (type.isRecord) {
|
|
2170
|
-
|
|
2116
|
+
nestedPath.push("{}");
|
|
2171
2117
|
}
|
|
2172
2118
|
if (type.type && schema[type.type]) {
|
|
2173
2119
|
parseQueue.push({
|
|
2174
|
-
path:
|
|
2120
|
+
path: nestedPath,
|
|
2175
2121
|
node: schema[type.type],
|
|
2176
2122
|
visited: /* @__PURE__ */ new Set([...visited, type.type])
|
|
2177
2123
|
});
|
|
@@ -2189,7 +2135,7 @@ var SchemaController = class {
|
|
|
2189
2135
|
this.hooks = {
|
|
2190
2136
|
resolveTypeForBinding: new import_tapable_ts5.SyncWaterfallHook()
|
|
2191
2137
|
};
|
|
2192
|
-
this.schema = schema ?
|
|
2138
|
+
this.schema = schema ? parse2(schema) : /* @__PURE__ */ new Map();
|
|
2193
2139
|
}
|
|
2194
2140
|
addFormatters(fns) {
|
|
2195
2141
|
fns.forEach((def) => {
|
|
@@ -2654,7 +2600,7 @@ var Parser = class {
|
|
|
2654
2600
|
return parsedNode;
|
|
2655
2601
|
}
|
|
2656
2602
|
}
|
|
2657
|
-
const parseLocalObject = (currentValue, objToParse,
|
|
2603
|
+
const parseLocalObject = (currentValue, objToParse, path = []) => {
|
|
2658
2604
|
if (typeof objToParse !== "object" || objToParse === null) {
|
|
2659
2605
|
return { value: objToParse, children: [] };
|
|
2660
2606
|
}
|
|
@@ -2688,7 +2634,7 @@ var Parser = class {
|
|
|
2688
2634
|
children: [
|
|
2689
2635
|
...children2,
|
|
2690
2636
|
{
|
|
2691
|
-
path: [...
|
|
2637
|
+
path: [...path, "asset"],
|
|
2692
2638
|
value: assetAST
|
|
2693
2639
|
}
|
|
2694
2640
|
]
|
|
@@ -2713,7 +2659,7 @@ var Parser = class {
|
|
|
2713
2659
|
}
|
|
2714
2660
|
if (templateAST) {
|
|
2715
2661
|
return {
|
|
2716
|
-
path: [...
|
|
2662
|
+
path: [...path, template.output],
|
|
2717
2663
|
value: templateAST
|
|
2718
2664
|
};
|
|
2719
2665
|
}
|
|
@@ -2737,7 +2683,7 @@ var Parser = class {
|
|
|
2737
2683
|
children: [
|
|
2738
2684
|
...children2,
|
|
2739
2685
|
{
|
|
2740
|
-
path: [...
|
|
2686
|
+
path: [...path, localKey, ...firstChild.path],
|
|
2741
2687
|
value: firstChild.value
|
|
2742
2688
|
}
|
|
2743
2689
|
]
|
|
@@ -2749,7 +2695,7 @@ var Parser = class {
|
|
|
2749
2695
|
children: [
|
|
2750
2696
|
...children2,
|
|
2751
2697
|
{
|
|
2752
|
-
path: [...
|
|
2698
|
+
path: [...path, localKey],
|
|
2753
2699
|
value: localSwitch
|
|
2754
2700
|
}
|
|
2755
2701
|
]
|
|
@@ -2763,7 +2709,7 @@ var Parser = class {
|
|
|
2763
2709
|
);
|
|
2764
2710
|
if (localAsync) {
|
|
2765
2711
|
children2.push({
|
|
2766
|
-
path: [...
|
|
2712
|
+
path: [...path, localKey],
|
|
2767
2713
|
value: localAsync
|
|
2768
2714
|
});
|
|
2769
2715
|
}
|
|
@@ -2791,7 +2737,7 @@ var Parser = class {
|
|
|
2791
2737
|
children: [
|
|
2792
2738
|
...children2,
|
|
2793
2739
|
{
|
|
2794
|
-
path: [...
|
|
2740
|
+
path: [...path, localKey],
|
|
2795
2741
|
value: multiNode
|
|
2796
2742
|
}
|
|
2797
2743
|
]
|
|
@@ -2813,7 +2759,7 @@ var Parser = class {
|
|
|
2813
2759
|
children: [
|
|
2814
2760
|
...children2,
|
|
2815
2761
|
{
|
|
2816
|
-
path: [...
|
|
2762
|
+
path: [...path, localKey],
|
|
2817
2763
|
value: parsedNode
|
|
2818
2764
|
}
|
|
2819
2765
|
]
|
|
@@ -2821,7 +2767,7 @@ var Parser = class {
|
|
|
2821
2767
|
}
|
|
2822
2768
|
} else {
|
|
2823
2769
|
const result = parseLocalObject(accumulation.value, localValue, [
|
|
2824
|
-
...
|
|
2770
|
+
...path,
|
|
2825
2771
|
localKey
|
|
2826
2772
|
]);
|
|
2827
2773
|
return {
|
|
@@ -2832,7 +2778,7 @@ var Parser = class {
|
|
|
2832
2778
|
} else {
|
|
2833
2779
|
const value2 = (0, import_timm4.setIn)(
|
|
2834
2780
|
accumulation.value,
|
|
2835
|
-
[...
|
|
2781
|
+
[...path, localKey],
|
|
2836
2782
|
localValue
|
|
2837
2783
|
);
|
|
2838
2784
|
return {
|
|
@@ -3204,13 +3150,13 @@ var Resolver = class {
|
|
|
3204
3150
|
|
|
3205
3151
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/view/view.ts
|
|
3206
3152
|
var CrossfieldProvider = class {
|
|
3207
|
-
constructor(initialView,
|
|
3153
|
+
constructor(initialView, parser, logger) {
|
|
3208
3154
|
this.allValidations = /* @__PURE__ */ new Set();
|
|
3209
3155
|
this.byBinding = /* @__PURE__ */ new Map();
|
|
3210
3156
|
this.logger = logger;
|
|
3211
|
-
this.parse(initialView,
|
|
3157
|
+
this.parse(initialView, parser);
|
|
3212
3158
|
}
|
|
3213
|
-
parse(contentView,
|
|
3159
|
+
parse(contentView, parser) {
|
|
3214
3160
|
const xfieldRefs = contentView.validation;
|
|
3215
3161
|
if (xfieldRefs === void 0) {
|
|
3216
3162
|
return;
|
|
@@ -3230,7 +3176,7 @@ var CrossfieldProvider = class {
|
|
|
3230
3176
|
this.allValidations.add(withDefaults);
|
|
3231
3177
|
const { ref } = vRef;
|
|
3232
3178
|
if (ref) {
|
|
3233
|
-
const parsed =
|
|
3179
|
+
const parsed = parser(ref);
|
|
3234
3180
|
if (this.byBinding.has(parsed)) {
|
|
3235
3181
|
this.byBinding.get(parsed)?.push(withDefaults);
|
|
3236
3182
|
} else {
|
|
@@ -3277,12 +3223,12 @@ var ViewInstance = class {
|
|
|
3277
3223
|
"templatePlugin not set for View, legacy templates may not work"
|
|
3278
3224
|
);
|
|
3279
3225
|
}
|
|
3280
|
-
const
|
|
3281
|
-
this.hooks.parser.call(
|
|
3282
|
-
this.rootNode =
|
|
3226
|
+
const parser = new Parser();
|
|
3227
|
+
this.hooks.parser.call(parser);
|
|
3228
|
+
this.rootNode = parser.parseView(this.initialView);
|
|
3283
3229
|
this.resolver = new Resolver(this.rootNode, {
|
|
3284
3230
|
...this.resolverOptions,
|
|
3285
|
-
parseNode:
|
|
3231
|
+
parseNode: parser.parseObject.bind(parser)
|
|
3286
3232
|
});
|
|
3287
3233
|
this.hooks.resolver.call(this.resolver);
|
|
3288
3234
|
}
|
|
@@ -3347,10 +3293,10 @@ var Builder = class {
|
|
|
3347
3293
|
* @param path - The path at which to add the child
|
|
3348
3294
|
* @param child - The child node
|
|
3349
3295
|
*/
|
|
3350
|
-
static addChild(node,
|
|
3296
|
+
static addChild(node, path, child) {
|
|
3351
3297
|
child.parent = node;
|
|
3352
3298
|
const newChild = {
|
|
3353
|
-
path: Array.isArray(
|
|
3299
|
+
path: Array.isArray(path) ? path : [path],
|
|
3354
3300
|
value: child
|
|
3355
3301
|
};
|
|
3356
3302
|
node.children = node.children || [];
|
|
@@ -3414,27 +3360,27 @@ var TemplatePlugin = class {
|
|
|
3414
3360
|
};
|
|
3415
3361
|
return result;
|
|
3416
3362
|
}
|
|
3417
|
-
applyParser(
|
|
3418
|
-
|
|
3363
|
+
applyParser(parser) {
|
|
3364
|
+
parser.hooks.onCreateASTNode.tap("template", (node) => {
|
|
3419
3365
|
if (node && node.type === "template" /* Template */ && !node.dynamic) {
|
|
3420
3366
|
return this.parseTemplate(
|
|
3421
|
-
|
|
3367
|
+
parser.parseObject.bind(parser),
|
|
3422
3368
|
node,
|
|
3423
3369
|
this.options
|
|
3424
3370
|
);
|
|
3425
3371
|
}
|
|
3426
3372
|
return node;
|
|
3427
3373
|
});
|
|
3428
|
-
|
|
3374
|
+
parser.hooks.determineNodeType.tap("template", (obj) => {
|
|
3429
3375
|
if (obj === "template") {
|
|
3430
3376
|
return "template" /* Template */;
|
|
3431
3377
|
}
|
|
3432
3378
|
});
|
|
3433
|
-
|
|
3379
|
+
parser.hooks.parseNode.tap(
|
|
3434
3380
|
"template",
|
|
3435
3381
|
(obj, _nodeType, options, determinedNodeType) => {
|
|
3436
3382
|
if (determinedNodeType === "template" /* Template */) {
|
|
3437
|
-
const templateNode =
|
|
3383
|
+
const templateNode = parser.createASTNode(
|
|
3438
3384
|
{
|
|
3439
3385
|
type: "template" /* Template */,
|
|
3440
3386
|
depth: options.templateDepth ?? 0,
|
|
@@ -3556,7 +3502,7 @@ var StringResolverPlugin = class {
|
|
|
3556
3502
|
propsToSkip = /* @__PURE__ */ new Set(["exp"]);
|
|
3557
3503
|
}
|
|
3558
3504
|
const nodePath = findBasePath(node, resolver);
|
|
3559
|
-
if (nodePath.length > 0 && nodePath.some((
|
|
3505
|
+
if (nodePath.length > 0 && nodePath.some((segment) => propsToSkip.has(segment.toString()))) {
|
|
3560
3506
|
return node.value;
|
|
3561
3507
|
}
|
|
3562
3508
|
return resolveAllRefs(node.value, options, propsToSkip);
|
|
@@ -3588,23 +3534,23 @@ var ApplicabilityPlugin = class {
|
|
|
3588
3534
|
}
|
|
3589
3535
|
);
|
|
3590
3536
|
}
|
|
3591
|
-
applyParser(
|
|
3592
|
-
|
|
3537
|
+
applyParser(parser) {
|
|
3538
|
+
parser.hooks.determineNodeType.tap("applicability", (obj) => {
|
|
3593
3539
|
if (Object.prototype.hasOwnProperty.call(obj, "applicability")) {
|
|
3594
3540
|
return "applicability" /* Applicability */;
|
|
3595
3541
|
}
|
|
3596
3542
|
});
|
|
3597
|
-
|
|
3543
|
+
parser.hooks.parseNode.tap(
|
|
3598
3544
|
"applicability",
|
|
3599
3545
|
(obj, nodeType, options, determinedNodeType) => {
|
|
3600
3546
|
if (determinedNodeType === "applicability" /* Applicability */) {
|
|
3601
|
-
const parsedApplicability =
|
|
3547
|
+
const parsedApplicability = parser.parseObject(
|
|
3602
3548
|
(0, import_timm7.omit)(obj, "applicability"),
|
|
3603
3549
|
nodeType,
|
|
3604
3550
|
options
|
|
3605
3551
|
);
|
|
3606
3552
|
if (parsedApplicability !== null) {
|
|
3607
|
-
const applicabilityNode =
|
|
3553
|
+
const applicabilityNode = parser.createASTNode(
|
|
3608
3554
|
{
|
|
3609
3555
|
type: "applicability" /* Applicability */,
|
|
3610
3556
|
expression: obj.applicability,
|
|
@@ -3641,19 +3587,19 @@ var SwitchPlugin = class {
|
|
|
3641
3587
|
}
|
|
3642
3588
|
return EMPTY_NODE;
|
|
3643
3589
|
}
|
|
3644
|
-
applyParser(
|
|
3645
|
-
|
|
3590
|
+
applyParser(parser) {
|
|
3591
|
+
parser.hooks.onCreateASTNode.tap("switch", (node) => {
|
|
3646
3592
|
if (node && node.type === "switch" /* Switch */ && !node.dynamic) {
|
|
3647
3593
|
return this.resolveSwitch(node, this.options);
|
|
3648
3594
|
}
|
|
3649
3595
|
return node;
|
|
3650
3596
|
});
|
|
3651
|
-
|
|
3597
|
+
parser.hooks.determineNodeType.tap("switch", (obj) => {
|
|
3652
3598
|
if (Object.prototype.hasOwnProperty.call(obj, "dynamicSwitch") || Object.prototype.hasOwnProperty.call(obj, "staticSwitch")) {
|
|
3653
3599
|
return "switch" /* Switch */;
|
|
3654
3600
|
}
|
|
3655
3601
|
});
|
|
3656
|
-
|
|
3602
|
+
parser.hooks.parseNode.tap(
|
|
3657
3603
|
"switch",
|
|
3658
3604
|
(obj, _nodeType, options, determinedNodeType) => {
|
|
3659
3605
|
if (determinedNodeType === "switch" /* Switch */) {
|
|
@@ -3663,7 +3609,7 @@ var SwitchPlugin = class {
|
|
|
3663
3609
|
switchContent.forEach(
|
|
3664
3610
|
(switchCase) => {
|
|
3665
3611
|
const { case: switchCaseExpr, ...switchBody } = switchCase;
|
|
3666
|
-
const value =
|
|
3612
|
+
const value = parser.parseObject(
|
|
3667
3613
|
switchBody,
|
|
3668
3614
|
"value" /* Value */,
|
|
3669
3615
|
options
|
|
@@ -3676,7 +3622,7 @@ var SwitchPlugin = class {
|
|
|
3676
3622
|
}
|
|
3677
3623
|
}
|
|
3678
3624
|
);
|
|
3679
|
-
const switchAST =
|
|
3625
|
+
const switchAST = parser.hooks.onCreateASTNode.call(
|
|
3680
3626
|
{
|
|
3681
3627
|
type: "switch" /* Switch */,
|
|
3682
3628
|
dynamic,
|
|
@@ -4570,11 +4516,11 @@ var ValidationController = class {
|
|
|
4570
4516
|
getValidationForBinding(binding) {
|
|
4571
4517
|
return this.validations.get(binding);
|
|
4572
4518
|
}
|
|
4573
|
-
forView(
|
|
4519
|
+
forView(parser) {
|
|
4574
4520
|
return {
|
|
4575
4521
|
_getValidationForBinding: (binding) => {
|
|
4576
4522
|
return this.getValidationForBinding(
|
|
4577
|
-
isBinding(binding) ? binding :
|
|
4523
|
+
isBinding(binding) ? binding : parser(binding)
|
|
4578
4524
|
);
|
|
4579
4525
|
},
|
|
4580
4526
|
getAll: () => {
|
|
@@ -4611,7 +4557,7 @@ var ValidationController = class {
|
|
|
4611
4557
|
"Section functionality should be provided by the view plugin"
|
|
4612
4558
|
);
|
|
4613
4559
|
},
|
|
4614
|
-
type: (binding) => this.schema.getType(isBinding(binding) ? binding :
|
|
4560
|
+
type: (binding) => this.schema.getType(isBinding(binding) ? binding : parser(binding))
|
|
4615
4561
|
};
|
|
4616
4562
|
}
|
|
4617
4563
|
};
|
|
@@ -5053,7 +4999,7 @@ var DataController = class {
|
|
|
5053
4999
|
};
|
|
5054
5000
|
|
|
5055
5001
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/controllers/constants/utils.ts
|
|
5056
|
-
function
|
|
5002
|
+
function flatten(obj, roots = [], sep = ".") {
|
|
5057
5003
|
return Object.keys(obj).reduce(
|
|
5058
5004
|
(memo, prop) => ({
|
|
5059
5005
|
// create a new object
|
|
@@ -5061,7 +5007,7 @@ function flatten2(obj, roots = [], sep = ".") {
|
|
|
5061
5007
|
...memo,
|
|
5062
5008
|
...Object.prototype.toString.call(obj[prop]) === "[object Object]" ? (
|
|
5063
5009
|
// keep working if value is an object
|
|
5064
|
-
|
|
5010
|
+
flatten(obj[prop], roots.concat([prop]))
|
|
5065
5011
|
) : (
|
|
5066
5012
|
// include current prop and value and prefix prop with the roots
|
|
5067
5013
|
{ [roots.concat([prop]).join(sep)]: obj[prop] }
|
|
@@ -5071,7 +5017,7 @@ function flatten2(obj, roots = [], sep = ".") {
|
|
|
5071
5017
|
);
|
|
5072
5018
|
}
|
|
5073
5019
|
function objectToBatchSet(obj) {
|
|
5074
|
-
const flattenedObj =
|
|
5020
|
+
const flattenedObj = flatten(obj);
|
|
5075
5021
|
const batchTxn = [];
|
|
5076
5022
|
Object.keys(flattenedObj).forEach((key) => {
|
|
5077
5023
|
batchTxn.push([new BindingInstance(key), flattenedObj[key]]);
|
|
@@ -5093,8 +5039,8 @@ var ConstantsController = class {
|
|
|
5093
5039
|
}
|
|
5094
5040
|
}
|
|
5095
5041
|
getConstants(key, namespace, fallback) {
|
|
5096
|
-
const
|
|
5097
|
-
return this.tempStore.get(namespace)?.get(
|
|
5042
|
+
const path = new BindingInstance(key);
|
|
5043
|
+
return this.tempStore.get(namespace)?.get(path) ?? this.store.get(namespace)?.get(path) ?? fallback;
|
|
5098
5044
|
}
|
|
5099
5045
|
setTemporaryValues(data, namespace) {
|
|
5100
5046
|
if (this.tempStore.has(namespace)) {
|