@tko/build.reference 4.0.0-beta1.6 → 4.0.0-beta1.7
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/browser.js +253 -457
- package/dist/browser.js.map +4 -4
- package/dist/browser.min.js +10 -11
- package/dist/browser.min.js.map +4 -4
- package/dist/common.js +1 -1
- package/dist/index.cjs +253 -457
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/browser.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
// @tko/build.reference 🥊 4.0.0-beta1.7 IIFE
|
|
1
2
|
"use strict";
|
|
2
|
-
// @tko/build.reference 🥊 4.0.0-beta1.6 IIFE
|
|
3
3
|
var tko = (() => {
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __pow = Math.pow;
|
|
9
8
|
var __export = (target, all) => {
|
|
10
9
|
for (var name in all)
|
|
11
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -18,7 +17,7 @@ var tko = (() => {
|
|
|
18
17
|
}
|
|
19
18
|
return to;
|
|
20
19
|
};
|
|
21
|
-
var __toCommonJS = (
|
|
20
|
+
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
22
21
|
|
|
23
22
|
// src/index.ts
|
|
24
23
|
var src_exports = {};
|
|
@@ -264,8 +263,8 @@ var tko = (() => {
|
|
|
264
263
|
|
|
265
264
|
// ../../packages/utils/dist/ie.js
|
|
266
265
|
var ieVersion = options_default.document && function() {
|
|
267
|
-
var version2 = 3,
|
|
268
|
-
while (
|
|
266
|
+
var version2 = 3, div2 = options_default.document.createElement("div"), iElems = div2.getElementsByTagName("i");
|
|
267
|
+
while (div2.innerHTML = "<!--[if gt IE " + ++version2 + "]><i></i><![endif]-->", iElems[0]) {
|
|
269
268
|
}
|
|
270
269
|
if (!version2) {
|
|
271
270
|
const userAgent = window.navigator.userAgent;
|
|
@@ -479,7 +478,7 @@ var tko = (() => {
|
|
|
479
478
|
nextKey: () => nextKey,
|
|
480
479
|
set: () => set
|
|
481
480
|
});
|
|
482
|
-
var datastoreTime = new Date().getTime();
|
|
481
|
+
var datastoreTime = (/* @__PURE__ */ new Date()).getTime();
|
|
483
482
|
var dataStoreKeyExpandoPropertyName = `__ko__${datastoreTime}`;
|
|
484
483
|
var dataStoreSymbol = Symbol("Knockout data");
|
|
485
484
|
var dataStore;
|
|
@@ -1068,17 +1067,17 @@ var tko = (() => {
|
|
|
1068
1067
|
function simpleHtmlParse(html2, documentContext) {
|
|
1069
1068
|
documentContext || (documentContext = document);
|
|
1070
1069
|
var windowContext = documentContext["parentWindow"] || documentContext["defaultView"] || window;
|
|
1071
|
-
var tags = stringTrim(html2).toLowerCase(),
|
|
1070
|
+
var tags = stringTrim(html2).toLowerCase(), div2 = documentContext.createElement("div"), wrap = getWrap(tags), depth = wrap[0];
|
|
1072
1071
|
var markup = "ignored<div>" + wrap[1] + html2 + wrap[2] + "</div>";
|
|
1073
1072
|
if (typeof windowContext["innerShiv"] === "function") {
|
|
1074
|
-
|
|
1073
|
+
div2.appendChild(windowContext["innerShiv"](markup));
|
|
1075
1074
|
} else {
|
|
1076
|
-
|
|
1075
|
+
div2.innerHTML = markup;
|
|
1077
1076
|
}
|
|
1078
1077
|
while (depth--) {
|
|
1079
|
-
|
|
1078
|
+
div2 = div2.lastChild;
|
|
1080
1079
|
}
|
|
1081
|
-
return makeArray(
|
|
1080
|
+
return makeArray(div2.lastChild.childNodes);
|
|
1082
1081
|
}
|
|
1083
1082
|
function templateHtmlParse(html2, documentContext) {
|
|
1084
1083
|
if (!documentContext) {
|
|
@@ -1300,10 +1299,10 @@ var tko = (() => {
|
|
|
1300
1299
|
var w = options_default.global;
|
|
1301
1300
|
if (w && w.MutationObserver && !(w.navigator && w.navigator.standalone)) {
|
|
1302
1301
|
options_default.taskScheduler = function(callback) {
|
|
1303
|
-
var
|
|
1304
|
-
new w.MutationObserver(callback).observe(
|
|
1302
|
+
var div2 = w.document.createElement("div");
|
|
1303
|
+
new w.MutationObserver(callback).observe(div2, { attributes: true });
|
|
1305
1304
|
return function() {
|
|
1306
|
-
|
|
1305
|
+
div2.classList.toggle("foo");
|
|
1307
1306
|
};
|
|
1308
1307
|
}(scheduledProcess);
|
|
1309
1308
|
} else if (w && w.document && "onreadystatechange" in w.document.createElement("script")) {
|
|
@@ -2089,7 +2088,7 @@ var tko = (() => {
|
|
|
2089
2088
|
}
|
|
2090
2089
|
|
|
2091
2090
|
// ../../packages/utils.parser/dist/operators.js
|
|
2092
|
-
var
|
|
2091
|
+
var __pow = Math.pow;
|
|
2093
2092
|
function LAMBDA() {
|
|
2094
2093
|
}
|
|
2095
2094
|
function unwrapOrCall(a, b) {
|
|
@@ -2099,8 +2098,10 @@ var tko = (() => {
|
|
|
2099
2098
|
return b;
|
|
2100
2099
|
}
|
|
2101
2100
|
var operators = {
|
|
2101
|
+
// unary
|
|
2102
2102
|
"@": unwrapOrCall,
|
|
2103
2103
|
"#": (a, b) => () => unwrap(b),
|
|
2104
|
+
// Convert to read-only.
|
|
2104
2105
|
"=>": LAMBDA,
|
|
2105
2106
|
"!": function not(a, b) {
|
|
2106
2107
|
return !b;
|
|
@@ -2114,9 +2115,11 @@ var tko = (() => {
|
|
|
2114
2115
|
"--": function preinc2(a, b) {
|
|
2115
2116
|
return --b;
|
|
2116
2117
|
},
|
|
2118
|
+
// exponent
|
|
2117
2119
|
"**": function exp(a, b) {
|
|
2118
|
-
return
|
|
2120
|
+
return __pow(a, b);
|
|
2119
2121
|
},
|
|
2122
|
+
// mul/div
|
|
2120
2123
|
"*": function mul(a, b) {
|
|
2121
2124
|
return a * b;
|
|
2122
2125
|
},
|
|
@@ -2126,6 +2129,7 @@ var tko = (() => {
|
|
|
2126
2129
|
"%": function mod(a, b) {
|
|
2127
2130
|
return a % b;
|
|
2128
2131
|
},
|
|
2132
|
+
// sub/add
|
|
2129
2133
|
"+": function add(a, b) {
|
|
2130
2134
|
return a + b;
|
|
2131
2135
|
},
|
|
@@ -2135,6 +2139,8 @@ var tko = (() => {
|
|
|
2135
2139
|
"&-": function neg(a, b) {
|
|
2136
2140
|
return -1 * b;
|
|
2137
2141
|
},
|
|
2142
|
+
// unary -
|
|
2143
|
+
// relational
|
|
2138
2144
|
"<": function lt(a, b) {
|
|
2139
2145
|
return a < b;
|
|
2140
2146
|
},
|
|
@@ -2147,6 +2153,9 @@ var tko = (() => {
|
|
|
2147
2153
|
">=": function ge(a, b) {
|
|
2148
2154
|
return a >= b;
|
|
2149
2155
|
},
|
|
2156
|
+
// TODO: 'in': function (a, b) { return a in b; },
|
|
2157
|
+
// TODO: 'instanceof': function (a, b) { return a instanceof b; },
|
|
2158
|
+
// equality
|
|
2150
2159
|
"==": function equal(a, b) {
|
|
2151
2160
|
return a == b;
|
|
2152
2161
|
},
|
|
@@ -2159,6 +2168,7 @@ var tko = (() => {
|
|
|
2159
2168
|
"!==": function sne(a, b) {
|
|
2160
2169
|
return a !== b;
|
|
2161
2170
|
},
|
|
2171
|
+
// bitwise
|
|
2162
2172
|
"&": function bitAnd(a, b) {
|
|
2163
2173
|
return a & b;
|
|
2164
2174
|
},
|
|
@@ -2168,6 +2178,7 @@ var tko = (() => {
|
|
|
2168
2178
|
"|": function bitOr(a, b) {
|
|
2169
2179
|
return a | b;
|
|
2170
2180
|
},
|
|
2181
|
+
// logic
|
|
2171
2182
|
"&&": function logicAnd(a, b) {
|
|
2172
2183
|
return a && b;
|
|
2173
2184
|
},
|
|
@@ -2177,6 +2188,7 @@ var tko = (() => {
|
|
|
2177
2188
|
"??": function nullishCoalesce(a, b) {
|
|
2178
2189
|
return a != null ? a : b;
|
|
2179
2190
|
},
|
|
2191
|
+
// Access
|
|
2180
2192
|
".": function member(a, b) {
|
|
2181
2193
|
return a == null ? void 0 : a[b];
|
|
2182
2194
|
},
|
|
@@ -2189,6 +2201,9 @@ var tko = (() => {
|
|
|
2189
2201
|
",": function comma(a, b) {
|
|
2190
2202
|
return b;
|
|
2191
2203
|
},
|
|
2204
|
+
// conditional/ternary
|
|
2205
|
+
// '?': ternary See Node.js
|
|
2206
|
+
// Function-Call
|
|
2192
2207
|
"call": function callOp(a, b) {
|
|
2193
2208
|
return a.apply(null, b);
|
|
2194
2209
|
}
|
|
@@ -2253,6 +2268,15 @@ var tko = (() => {
|
|
|
2253
2268
|
}
|
|
2254
2269
|
return leaf;
|
|
2255
2270
|
}
|
|
2271
|
+
/**
|
|
2272
|
+
* Return a function that calculates and returns an expression's value
|
|
2273
|
+
* when called.
|
|
2274
|
+
* @param {array} ops The operations to perform
|
|
2275
|
+
* @return {function} The function that calculates the expression.
|
|
2276
|
+
*
|
|
2277
|
+
* Note that for a lambda, we do not evaluate the RHS expression until
|
|
2278
|
+
* the lambda is called.
|
|
2279
|
+
*/
|
|
2256
2280
|
get_value(notused, context, globals, node) {
|
|
2257
2281
|
var node = this;
|
|
2258
2282
|
if (node.op === LAMBDA) {
|
|
@@ -2272,6 +2296,9 @@ var tko = (() => {
|
|
|
2272
2296
|
const rhv = node.get_leaf_value(node.rhs, context, globals, node);
|
|
2273
2297
|
return node.op(lhv, rhv, context, globals);
|
|
2274
2298
|
}
|
|
2299
|
+
//
|
|
2300
|
+
// Class variables.
|
|
2301
|
+
//
|
|
2275
2302
|
static get isExpressionOrIdentifierSymbol() {
|
|
2276
2303
|
return IS_EXPR_OR_IDENT;
|
|
2277
2304
|
}
|
|
@@ -2284,6 +2311,12 @@ var tko = (() => {
|
|
|
2284
2311
|
}
|
|
2285
2312
|
return item;
|
|
2286
2313
|
}
|
|
2314
|
+
/**
|
|
2315
|
+
* Convert an array of nodes to an executable tree.
|
|
2316
|
+
* @return {object} An object with a `lhs`, `rhs` and `op` key, corresponding
|
|
2317
|
+
* to the left hand side, right hand side, and
|
|
2318
|
+
* operation function.
|
|
2319
|
+
*/
|
|
2287
2320
|
static create_root(nodes, debug = false) {
|
|
2288
2321
|
const out = [];
|
|
2289
2322
|
const ops = [];
|
|
@@ -2315,6 +2348,9 @@ var tko = (() => {
|
|
|
2315
2348
|
this.nodes = nodes;
|
|
2316
2349
|
this.root = Node2.create_root(nodes);
|
|
2317
2350
|
}
|
|
2351
|
+
/**
|
|
2352
|
+
* Return the value of `this` Expression instance.
|
|
2353
|
+
*/
|
|
2318
2354
|
get_value(parent, context, globals, node) {
|
|
2319
2355
|
if (!this.root) {
|
|
2320
2356
|
this.root = Node2.create_root(this.nodes);
|
|
@@ -2353,29 +2389,60 @@ var tko = (() => {
|
|
|
2353
2389
|
this.dereferences = dereferences;
|
|
2354
2390
|
this.parser = parser;
|
|
2355
2391
|
}
|
|
2392
|
+
/**
|
|
2393
|
+
* Apply all () and [] functions on the identifier to the lhs value e.g.
|
|
2394
|
+
* a()[3] has deref functions that are essentially this:
|
|
2395
|
+
* [_deref_call, _deref_this where this=3]
|
|
2396
|
+
*
|
|
2397
|
+
* @param {mixed} value Should be an object.
|
|
2398
|
+
* @return {mixed} The dereferenced value.
|
|
2399
|
+
*
|
|
2400
|
+
* [1] We want to bind any function that is a method of an object, but not
|
|
2401
|
+
* corrupt any values (e.g. computed()s). e.g. Running x.bind(obj) where
|
|
2402
|
+
* we're given `data-bind='binding: obj.x'` and x is a computed will
|
|
2403
|
+
* break the computed's `this` and it will stop working as expected.
|
|
2404
|
+
*
|
|
2405
|
+
* The test `!last_value.hasOwnProperty(member)`
|
|
2406
|
+
* distinguishes between functions on the prototype chain (prototypal
|
|
2407
|
+
* members) and value-members added directly to the object. This may
|
|
2408
|
+
* not be the canonical test for this relationship, but it succeeds
|
|
2409
|
+
* in the known test cases.
|
|
2410
|
+
*
|
|
2411
|
+
* See: `this` tests of our dereference function.
|
|
2412
|
+
*/
|
|
2356
2413
|
dereference(value2, $context, globals, node) {
|
|
2357
|
-
let
|
|
2414
|
+
let member2;
|
|
2358
2415
|
let refs = this.dereferences || [];
|
|
2359
2416
|
const $data = $context.$data || {};
|
|
2360
2417
|
let lastValue;
|
|
2361
2418
|
let i, n;
|
|
2362
2419
|
for (i = 0, n = refs.length; i < n; ++i) {
|
|
2363
|
-
|
|
2420
|
+
member2 = Node2.value_of(refs[i], $context, globals, node);
|
|
2364
2421
|
if (typeof value2 === "function" && refs[i] instanceof Arguments) {
|
|
2365
|
-
value2 = value2.apply(lastValue || $data,
|
|
2422
|
+
value2 = value2.apply(lastValue || $data, member2);
|
|
2366
2423
|
lastValue = value2;
|
|
2367
2424
|
} else if (value2 === null || value2 === void 0) {
|
|
2368
2425
|
return value2;
|
|
2369
2426
|
} else {
|
|
2370
2427
|
lastValue = value2;
|
|
2371
|
-
value2 = Node2.value_of(value2[
|
|
2428
|
+
value2 = Node2.value_of(value2[member2], $context, globals, node);
|
|
2372
2429
|
}
|
|
2373
2430
|
}
|
|
2374
|
-
if (typeof value2 === "function" && n > 0 && lastValue !== value2 && !hasOwnProperty(lastValue,
|
|
2431
|
+
if (typeof value2 === "function" && n > 0 && lastValue !== value2 && !hasOwnProperty(lastValue, member2)) {
|
|
2375
2432
|
return value2.bind(lastValue);
|
|
2376
2433
|
}
|
|
2377
2434
|
return value2;
|
|
2378
2435
|
}
|
|
2436
|
+
/**
|
|
2437
|
+
* Return the value as one would get it from the top-level i.e.
|
|
2438
|
+
* $data.token/$context.token/globals.token; this does not return intermediate
|
|
2439
|
+
* values on a chain of members i.e. $data.hello.there -- requesting the
|
|
2440
|
+
* Identifier('there').value will return $data/$context/globals.there.
|
|
2441
|
+
*
|
|
2442
|
+
* This will dereference using () or [arg] member.
|
|
2443
|
+
* @param {object | Identifier | Expression} parent
|
|
2444
|
+
* @return {mixed} Return the primitive or an accessor.
|
|
2445
|
+
*/
|
|
2379
2446
|
get_value(parent, context, globals, node) {
|
|
2380
2447
|
const intermediate = parent && !(parent instanceof Identifier) ? Node2.value_of(parent, context, globals, node)[this.token] : context.lookup(this.token, globals, node);
|
|
2381
2448
|
return this.dereference(intermediate, context, globals, node);
|
|
@@ -2387,6 +2454,11 @@ var tko = (() => {
|
|
|
2387
2454
|
object2[property] = value2;
|
|
2388
2455
|
}
|
|
2389
2456
|
}
|
|
2457
|
+
/**
|
|
2458
|
+
* Set the value of the Identifier.
|
|
2459
|
+
*
|
|
2460
|
+
* @param {Mixed} new_value The value that Identifier is to be set to.
|
|
2461
|
+
*/
|
|
2390
2462
|
set_value(new_value, $context, globals) {
|
|
2391
2463
|
const $data = $context.$data || {};
|
|
2392
2464
|
const refs = this.dereferences || [];
|
|
@@ -2422,6 +2494,21 @@ var tko = (() => {
|
|
|
2422
2494
|
this.assign(root, Node2.value_of(refs[i]), new_value);
|
|
2423
2495
|
}
|
|
2424
2496
|
}
|
|
2497
|
+
/**
|
|
2498
|
+
* Determine if a character is a valid item in an identifier.
|
|
2499
|
+
* Note that we do not check whether the first item is a number, nor do we
|
|
2500
|
+
* support unicode identifiers here.
|
|
2501
|
+
*
|
|
2502
|
+
* From: http://stackoverflow.com/a/9337047
|
|
2503
|
+
* @param {String} ch The character
|
|
2504
|
+
* @return {Boolean} True if this is a valid identifier
|
|
2505
|
+
*/
|
|
2506
|
+
// function is_identifier_char(ch) {
|
|
2507
|
+
// return (ch >= 'A' && ch <= 'Z') ||
|
|
2508
|
+
// (ch >= 'a' && ch <= 'z') ||
|
|
2509
|
+
// (ch >= '0' && ch <= 9) ||
|
|
2510
|
+
// ch === '_' || ch === '$';
|
|
2511
|
+
// }
|
|
2425
2512
|
static is_valid_start_char(ch) {
|
|
2426
2513
|
return IDStart.test(ch);
|
|
2427
2514
|
}
|
|
@@ -2515,6 +2602,9 @@ var tko = (() => {
|
|
|
2515
2602
|
}
|
|
2516
2603
|
return this.comment(ch);
|
|
2517
2604
|
}
|
|
2605
|
+
/**
|
|
2606
|
+
* Slurp any C or C++ style comments
|
|
2607
|
+
*/
|
|
2518
2608
|
comment(ch) {
|
|
2519
2609
|
if (ch !== "/") {
|
|
2520
2610
|
return ch;
|
|
@@ -2633,6 +2723,13 @@ ${name} ${msg} of
|
|
|
2633
2723
|
return number;
|
|
2634
2724
|
}
|
|
2635
2725
|
}
|
|
2726
|
+
/**
|
|
2727
|
+
* Add a property to 'object' that equals the given value.
|
|
2728
|
+
* @param {Object} object The object to add the value to.
|
|
2729
|
+
* @param {String} key object[key] is set to the given value.
|
|
2730
|
+
* @param {mixed} value The value, may be a primitive or a function. If a
|
|
2731
|
+
* function it is unwrapped as a property.
|
|
2732
|
+
*/
|
|
2636
2733
|
objectAddValue(object2, key, value2) {
|
|
2637
2734
|
if (value2 && value2[Node2.isExpressionOrIdentifierSymbol]) {
|
|
2638
2735
|
Object.defineProperty(object2, key, {
|
|
@@ -2690,6 +2787,11 @@ ${name} ${msg} of
|
|
|
2690
2787
|
}
|
|
2691
2788
|
this.error("Bad object");
|
|
2692
2789
|
}
|
|
2790
|
+
/**
|
|
2791
|
+
* Read up to delim and return the string
|
|
2792
|
+
* @param {string} delim The delimiter, either ' or "
|
|
2793
|
+
* @return {string} The string read.
|
|
2794
|
+
*/
|
|
2693
2795
|
readString(delim) {
|
|
2694
2796
|
let string = "";
|
|
2695
2797
|
let nodes = [""];
|
|
@@ -2796,6 +2898,12 @@ ${name} ${msg} of
|
|
|
2796
2898
|
return ch >= "0" && ch <= "9" ? this.number() : this.identifier();
|
|
2797
2899
|
}
|
|
2798
2900
|
}
|
|
2901
|
+
/**
|
|
2902
|
+
* Get the function for the given operator.
|
|
2903
|
+
* A `.precedence` value is added to the function, with increasing
|
|
2904
|
+
* precedence having a higher number.
|
|
2905
|
+
* @return {function} The function that performs the infix operation
|
|
2906
|
+
*/
|
|
2799
2907
|
operator(opts) {
|
|
2800
2908
|
let op = "";
|
|
2801
2909
|
let opFn;
|
|
@@ -2826,6 +2934,12 @@ ${name} ${msg} of
|
|
|
2826
2934
|
}
|
|
2827
2935
|
return opFn;
|
|
2828
2936
|
}
|
|
2937
|
+
/**
|
|
2938
|
+
* Filters
|
|
2939
|
+
* Returns what the Node interprets as an "operator".
|
|
2940
|
+
* e.g.
|
|
2941
|
+
* <span data-bind="text: name | fit:20 | uppercase"></span>
|
|
2942
|
+
*/
|
|
2829
2943
|
filter() {
|
|
2830
2944
|
let ch = this.next();
|
|
2831
2945
|
let args = [];
|
|
@@ -2861,6 +2975,22 @@ ${name} ${msg} of
|
|
|
2861
2975
|
filter.precedence = 1;
|
|
2862
2976
|
return filter;
|
|
2863
2977
|
}
|
|
2978
|
+
/**
|
|
2979
|
+
* Parse an expression – builds an operator tree, in something like
|
|
2980
|
+
* Shunting-Yard.
|
|
2981
|
+
* See: http://en.wikipedia.org/wiki/Shunting-yard_algorithm
|
|
2982
|
+
*
|
|
2983
|
+
* @param filterable - Whether the expression can include jinga-style filters.
|
|
2984
|
+
* An argument of '|' is used only by the filter() method to parse subsequent
|
|
2985
|
+
* filters.
|
|
2986
|
+
* @param allowMultipleValues - Whether multiple values separated by commas are
|
|
2987
|
+
* allowed in this expression. When true (default), this method consumes
|
|
2988
|
+
* subsequent comma-separated values.
|
|
2989
|
+
* @see {@link Parser.singleValueExpression}
|
|
2990
|
+
*
|
|
2991
|
+
* @returns a function that computes the value of the expression
|
|
2992
|
+
* when called or a primitive.
|
|
2993
|
+
*/
|
|
2864
2994
|
expression(filterable = false, allowMultipleValues = true) {
|
|
2865
2995
|
let op;
|
|
2866
2996
|
let nodes = [];
|
|
@@ -2930,17 +3060,28 @@ ${name} ${msg} of
|
|
|
2930
3060
|
}
|
|
2931
3061
|
return new Expression(nodes);
|
|
2932
3062
|
}
|
|
3063
|
+
/**
|
|
3064
|
+
* Use this method to parse expressions that can be followed by additional markup
|
|
3065
|
+
* seperated by a comma, such as in bindings strings.
|
|
3066
|
+
*
|
|
3067
|
+
* @returns an expression that cannot contain multiple values separated by commas.
|
|
3068
|
+
* @see {@link Parser.expression}
|
|
3069
|
+
*/
|
|
2933
3070
|
singleValueExpression(filterable) {
|
|
2934
3071
|
return this.expression(filterable, false);
|
|
2935
3072
|
}
|
|
2936
3073
|
ternary(nodes) {
|
|
2937
|
-
var
|
|
2938
|
-
|
|
3074
|
+
var ternary2 = new Ternary();
|
|
3075
|
+
ternary2.yes = this.singleValueExpression();
|
|
2939
3076
|
this.next(":");
|
|
2940
|
-
|
|
3077
|
+
ternary2.no = this.singleValueExpression();
|
|
2941
3078
|
nodes.push(operators["?"]);
|
|
2942
|
-
nodes.push(
|
|
3079
|
+
nodes.push(ternary2);
|
|
2943
3080
|
}
|
|
3081
|
+
/**
|
|
3082
|
+
* Parse the arguments to a function, returning an Array.
|
|
3083
|
+
*
|
|
3084
|
+
*/
|
|
2944
3085
|
funcArguments() {
|
|
2945
3086
|
let args = [];
|
|
2946
3087
|
let ch = this.next("(");
|
|
@@ -2959,32 +3100,41 @@ ${name} ${msg} of
|
|
|
2959
3100
|
}
|
|
2960
3101
|
this.error("Bad arguments to function");
|
|
2961
3102
|
}
|
|
3103
|
+
/**
|
|
3104
|
+
* The literal string reference `abc` in an `x.abc` expression.
|
|
3105
|
+
*/
|
|
2962
3106
|
member() {
|
|
2963
|
-
let
|
|
3107
|
+
let member2 = "";
|
|
2964
3108
|
let ch = this.white();
|
|
2965
3109
|
let isIdentifierChar = Identifier.is_valid_start_char;
|
|
2966
3110
|
while (ch) {
|
|
2967
3111
|
if (!isIdentifierChar(ch)) {
|
|
2968
3112
|
break;
|
|
2969
3113
|
}
|
|
2970
|
-
|
|
3114
|
+
member2 += ch;
|
|
2971
3115
|
ch = this.next();
|
|
2972
3116
|
isIdentifierChar = Identifier.is_valid_continue_char;
|
|
2973
3117
|
}
|
|
2974
|
-
return
|
|
3118
|
+
return member2;
|
|
2975
3119
|
}
|
|
3120
|
+
/**
|
|
3121
|
+
* A dereference applies to an identifer, being either a function
|
|
3122
|
+
* call "()" or a membership lookup with square brackets "[member]".
|
|
3123
|
+
* @return {fn or undefined} Dereference function to be applied to the
|
|
3124
|
+
* Identifier
|
|
3125
|
+
*/
|
|
2976
3126
|
dereference() {
|
|
2977
|
-
let
|
|
3127
|
+
let member2;
|
|
2978
3128
|
let ch = this.white();
|
|
2979
3129
|
while (ch) {
|
|
2980
3130
|
if (ch === "(") {
|
|
2981
3131
|
return this.funcArguments();
|
|
2982
3132
|
} else if (ch === "[") {
|
|
2983
3133
|
this.next("[");
|
|
2984
|
-
|
|
3134
|
+
member2 = this.expression();
|
|
2985
3135
|
this.white();
|
|
2986
3136
|
this.next("]");
|
|
2987
|
-
return
|
|
3137
|
+
return member2;
|
|
2988
3138
|
} else if (ch === ".") {
|
|
2989
3139
|
this.next(".");
|
|
2990
3140
|
return this.member();
|
|
@@ -3101,6 +3251,14 @@ ${name} ${msg} of
|
|
|
3101
3251
|
}
|
|
3102
3252
|
throw new Error("Value has cannot be converted to accessor: " + value2);
|
|
3103
3253
|
}
|
|
3254
|
+
/**
|
|
3255
|
+
* Convert result[name] from a value to a function (i.e. `valueAccessor()`)
|
|
3256
|
+
* @param {object} result [Map of top-level names to values]
|
|
3257
|
+
* @return {object} [Map of top-level names to functions]
|
|
3258
|
+
*
|
|
3259
|
+
* Accessors may be one of (below) constAccessor, identifierAccessor,
|
|
3260
|
+
* expressionAccessor, or nodeAccessor.
|
|
3261
|
+
*/
|
|
3104
3262
|
convertToAccessors(result, context, globals, node) {
|
|
3105
3263
|
objectForEach(result, (name, value2) => {
|
|
3106
3264
|
if (value2 instanceof Identifier) {
|
|
@@ -3142,6 +3300,11 @@ ${name} ${msg} of
|
|
|
3142
3300
|
options_default.onError(e);
|
|
3143
3301
|
}
|
|
3144
3302
|
}
|
|
3303
|
+
/**
|
|
3304
|
+
* Get the bindings as name: accessor()
|
|
3305
|
+
* @param {string} source The binding string to parse.
|
|
3306
|
+
* @return {object} Map of name to accessor function.
|
|
3307
|
+
*/
|
|
3145
3308
|
parse(source, context = {}, globals = {}, node) {
|
|
3146
3309
|
if (!source) {
|
|
3147
3310
|
return () => null;
|
|
@@ -3151,6 +3314,9 @@ ${name} ${msg} of
|
|
|
3151
3314
|
const bindingAccessors = this.runParse(source, parseFn);
|
|
3152
3315
|
return this.convertToAccessors(bindingAccessors, context, globals, node);
|
|
3153
3316
|
}
|
|
3317
|
+
/**
|
|
3318
|
+
* Return a function that evaluates and returns the result of the expression.
|
|
3319
|
+
*/
|
|
3154
3320
|
parseExpression(source, context = {}, globals = {}, node) {
|
|
3155
3321
|
if (!source) {
|
|
3156
3322
|
return () => "";
|
|
@@ -3165,13 +3331,24 @@ ${name} ${msg} of
|
|
|
3165
3331
|
// ../../packages/utils.parser/dist/preparse.js
|
|
3166
3332
|
var specials = ",\"'`{}()/:[\\]";
|
|
3167
3333
|
var bindingToken = RegExp([
|
|
3334
|
+
// These match strings, either with double quotes, single quotes, or backticks
|
|
3168
3335
|
'"(?:\\\\.|[^"])*"',
|
|
3169
3336
|
"'(?:\\\\.|[^'])*'",
|
|
3170
3337
|
"`(?:\\\\.|[^`])*`",
|
|
3338
|
+
// Match C style comments
|
|
3171
3339
|
"/\\*(?:[^*]|\\*+[^*/])*\\*+/",
|
|
3340
|
+
// Match C++ style comments
|
|
3172
3341
|
"//.*\n",
|
|
3342
|
+
// Match a regular expression (text enclosed by slashes), but will also match sets of divisions
|
|
3343
|
+
// as a regular expression (this is handled by the parsing loop below).
|
|
3173
3344
|
"/(?:\\\\.|[^/])+/\\w*",
|
|
3345
|
+
// Match text (at least two characters) that does not contain any of the above special characters,
|
|
3346
|
+
// although some of the special characters are allowed to start it (all but the colon and comma).
|
|
3347
|
+
// The text can contain spaces, but leading or trailing spaces are skipped.
|
|
3174
3348
|
"[^\\s:,/][^" + specials + "]*[^\\s" + specials + "]",
|
|
3349
|
+
// Match any non-space character not matched already. This will match colons and commas, since they're
|
|
3350
|
+
// not matched by "everyThingElse", but will also match any other single character that wasn't already
|
|
3351
|
+
// matched (for example: in "a: 1, b: 2", each of the non-space characters will be matched by oneNotSpace).
|
|
3175
3352
|
"[^\\s]"
|
|
3176
3353
|
].join("|"), "g");
|
|
3177
3354
|
var divisionLookBehind = /[\])"'A-Za-z0-9_$]+$/;
|
|
@@ -3230,6 +3407,14 @@ ${name} ${msg} of
|
|
|
3230
3407
|
return result;
|
|
3231
3408
|
}
|
|
3232
3409
|
|
|
3410
|
+
// ../../packages/utils.parser/dist/index.js
|
|
3411
|
+
function overloadOperator(op, fn, precedence) {
|
|
3412
|
+
operators[op] = fn;
|
|
3413
|
+
if (Number.isInteger(precedence)) {
|
|
3414
|
+
operators[op].precedence = precedence;
|
|
3415
|
+
}
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3233
3418
|
// ../../packages/computed/dist/computed.js
|
|
3234
3419
|
var computedState = createSymbolOrString("_state");
|
|
3235
3420
|
var DISPOSED_STATE = {
|
|
@@ -5144,6 +5329,7 @@ ${name} ${msg} of
|
|
|
5144
5329
|
unwrapObservable: unwrap
|
|
5145
5330
|
});
|
|
5146
5331
|
var knockout = {
|
|
5332
|
+
// --- Utilities ---
|
|
5147
5333
|
cleanNode,
|
|
5148
5334
|
dependencyDetection: dependencyDetection_exports,
|
|
5149
5335
|
computedContext: dependencyDetection_exports,
|
|
@@ -5156,6 +5342,7 @@ ${name} ${msg} of
|
|
|
5156
5342
|
tasks: tasks_exports,
|
|
5157
5343
|
utils,
|
|
5158
5344
|
LifeCycle,
|
|
5345
|
+
// -- Observable ---
|
|
5159
5346
|
isObservable,
|
|
5160
5347
|
isSubscribable,
|
|
5161
5348
|
isWriteableObservable,
|
|
@@ -5169,17 +5356,20 @@ ${name} ${msg} of
|
|
|
5169
5356
|
toJS,
|
|
5170
5357
|
toJSON,
|
|
5171
5358
|
proxy,
|
|
5359
|
+
// ... Computed ...
|
|
5172
5360
|
computed,
|
|
5173
5361
|
dependentObservable: computed,
|
|
5174
5362
|
isComputed,
|
|
5175
5363
|
isPureComputed,
|
|
5176
5364
|
pureComputed,
|
|
5177
5365
|
when,
|
|
5366
|
+
// --- Templates ---
|
|
5178
5367
|
nativeTemplateEngine,
|
|
5179
5368
|
renderTemplate,
|
|
5180
5369
|
setTemplateEngine,
|
|
5181
5370
|
templateEngine,
|
|
5182
5371
|
templateSources: { domElement, anonymousTemplate },
|
|
5372
|
+
// --- Binding ---
|
|
5183
5373
|
applyBindingAccessorsToNode,
|
|
5184
5374
|
applyBindings,
|
|
5185
5375
|
applyBindingsToDescendants,
|
|
@@ -5212,6 +5402,9 @@ ${name} ${msg} of
|
|
|
5212
5402
|
bindingProvider: provider
|
|
5213
5403
|
};
|
|
5214
5404
|
}
|
|
5405
|
+
/**
|
|
5406
|
+
* @return {Object} An instance of Knockout.
|
|
5407
|
+
*/
|
|
5215
5408
|
create(...additionalProperties) {
|
|
5216
5409
|
const instance = Object.assign(
|
|
5217
5410
|
{
|
|
@@ -5336,6 +5529,11 @@ ${name} ${msg} of
|
|
|
5336
5529
|
|
|
5337
5530
|
// ../../packages/provider.bindingstring/dist/BindingStringProvider.js
|
|
5338
5531
|
var BindingStringProvider = class extends Provider {
|
|
5532
|
+
/** Call bindingHandler.preprocess on each respective binding string.
|
|
5533
|
+
*
|
|
5534
|
+
* The `preprocess` property of bindingHandler must be a static
|
|
5535
|
+
* function (i.e. on the object or constructor).
|
|
5536
|
+
*/
|
|
5339
5537
|
*processBinding(key, value2) {
|
|
5340
5538
|
const [handlerName, property] = key.split(".");
|
|
5341
5539
|
const handler2 = this.bindingHandlers.get(handlerName);
|
|
@@ -5378,6 +5576,10 @@ ${name} ${msg} of
|
|
|
5378
5576
|
get FOR_NODE_TYPES() {
|
|
5379
5577
|
return [1, 8];
|
|
5380
5578
|
}
|
|
5579
|
+
/**
|
|
5580
|
+
* Convert <ko binding='...'> into <!-- ko binding: ... -->
|
|
5581
|
+
* @param {HTMLElement} node
|
|
5582
|
+
*/
|
|
5381
5583
|
preprocessNode(node) {
|
|
5382
5584
|
if (node.tagName === "KO") {
|
|
5383
5585
|
const parent = node.parentNode;
|
|
@@ -5416,6 +5618,7 @@ ${name} ${msg} of
|
|
|
5416
5618
|
get FOR_NODE_TYPES() {
|
|
5417
5619
|
return [1];
|
|
5418
5620
|
}
|
|
5621
|
+
// document.ELEMENT_NODE
|
|
5419
5622
|
get BIND_ATTRIBUTE() {
|
|
5420
5623
|
return "data-bind";
|
|
5421
5624
|
}
|
|
@@ -5723,6 +5926,11 @@ ${name} ${msg} of
|
|
|
5723
5926
|
get FOR_NODE_TYPES() {
|
|
5724
5927
|
return [1];
|
|
5725
5928
|
}
|
|
5929
|
+
// document.ELEMENT_NODE
|
|
5930
|
+
/**
|
|
5931
|
+
* Convert <slot name='X'> to <!-- ko slot: 'X' --><!-- /ko -->
|
|
5932
|
+
* @param {HTMLElement} node
|
|
5933
|
+
*/
|
|
5726
5934
|
preprocessNode(node) {
|
|
5727
5935
|
if (node.tagName === "SLOT") {
|
|
5728
5936
|
const parent = node.parentNode;
|
|
@@ -6004,6 +6212,7 @@ ${name} ${msg} of
|
|
|
6004
6212
|
get FOR_NODE_TYPES() {
|
|
6005
6213
|
return [1];
|
|
6006
6214
|
}
|
|
6215
|
+
// document.ELEMENT_NODE
|
|
6007
6216
|
constructor(params = {}) {
|
|
6008
6217
|
super(params);
|
|
6009
6218
|
this.ATTRIBUTES_TO_SKIP = new Set(params.attributesToSkip || ["data-bind"]);
|
|
@@ -6066,6 +6275,7 @@ ${name} ${msg} of
|
|
|
6066
6275
|
get FOR_NODE_TYPES() {
|
|
6067
6276
|
return [3];
|
|
6068
6277
|
}
|
|
6278
|
+
// document.TEXT_NODE
|
|
6069
6279
|
*textToNodes(textNode) {
|
|
6070
6280
|
const parent = textNode.parentNode;
|
|
6071
6281
|
const isTextarea = parent && parent.nodeName === "TEXTAREA";
|
|
@@ -6092,6 +6302,17 @@ ${name} ${msg} of
|
|
|
6092
6302
|
}
|
|
6093
6303
|
return newNodes;
|
|
6094
6304
|
}
|
|
6305
|
+
/**
|
|
6306
|
+
* We convert as follows:
|
|
6307
|
+
*
|
|
6308
|
+
* {{# ... }} into <!-- ko ... -->
|
|
6309
|
+
* {{/ ... }} into <!-- /ko -->
|
|
6310
|
+
* {{# ... /}} into <!-- ko ... --><!-- /ko -->
|
|
6311
|
+
* {{ ... }} into <!-- ko text: ... --><!-- /ko -->
|
|
6312
|
+
* {{{ ... }}} into <!-- ko html: ... --><!-- /ko -->
|
|
6313
|
+
*
|
|
6314
|
+
* VirtualProvider can then pick up and do the actual binding.
|
|
6315
|
+
*/
|
|
6095
6316
|
preprocessNode(node) {
|
|
6096
6317
|
return this.textInterpolation(node);
|
|
6097
6318
|
}
|
|
@@ -8112,431 +8333,6 @@ ${name} ${msg} of
|
|
|
8112
8333
|
return (+unwrap(value2)).toLocaleString();
|
|
8113
8334
|
};
|
|
8114
8335
|
|
|
8115
|
-
// ../../packages/utils.parser/src/operators.ts
|
|
8116
|
-
function LAMBDA2() {
|
|
8117
|
-
}
|
|
8118
|
-
function unwrapOrCall2(a, b) {
|
|
8119
|
-
while (typeof b === "function") {
|
|
8120
|
-
b = b();
|
|
8121
|
-
}
|
|
8122
|
-
return b;
|
|
8123
|
-
}
|
|
8124
|
-
var operators2 = {
|
|
8125
|
-
"@": unwrapOrCall2,
|
|
8126
|
-
"#": (a, b) => () => unwrap(b),
|
|
8127
|
-
"=>": LAMBDA2,
|
|
8128
|
-
"!": function not2(a, b) {
|
|
8129
|
-
return !b;
|
|
8130
|
-
},
|
|
8131
|
-
"!!": function notnot2(a, b) {
|
|
8132
|
-
return !!b;
|
|
8133
|
-
},
|
|
8134
|
-
"++": function preinc3(a, b) {
|
|
8135
|
-
return ++b;
|
|
8136
|
-
},
|
|
8137
|
-
"--": function preinc4(a, b) {
|
|
8138
|
-
return --b;
|
|
8139
|
-
},
|
|
8140
|
-
"**": function exp2(a, b) {
|
|
8141
|
-
return __pow(a, b);
|
|
8142
|
-
},
|
|
8143
|
-
"*": function mul2(a, b) {
|
|
8144
|
-
return a * b;
|
|
8145
|
-
},
|
|
8146
|
-
"/": function div2(a, b) {
|
|
8147
|
-
return a / b;
|
|
8148
|
-
},
|
|
8149
|
-
"%": function mod2(a, b) {
|
|
8150
|
-
return a % b;
|
|
8151
|
-
},
|
|
8152
|
-
"+": function add2(a, b) {
|
|
8153
|
-
return a + b;
|
|
8154
|
-
},
|
|
8155
|
-
"-": function sub2(a, b) {
|
|
8156
|
-
return (a || 0) - (b || 0);
|
|
8157
|
-
},
|
|
8158
|
-
"&-": function neg2(a, b) {
|
|
8159
|
-
return -1 * b;
|
|
8160
|
-
},
|
|
8161
|
-
"<": function lt2(a, b) {
|
|
8162
|
-
return a < b;
|
|
8163
|
-
},
|
|
8164
|
-
"<=": function le2(a, b) {
|
|
8165
|
-
return a <= b;
|
|
8166
|
-
},
|
|
8167
|
-
">": function gt2(a, b) {
|
|
8168
|
-
return a > b;
|
|
8169
|
-
},
|
|
8170
|
-
">=": function ge2(a, b) {
|
|
8171
|
-
return a >= b;
|
|
8172
|
-
},
|
|
8173
|
-
"==": function equal2(a, b) {
|
|
8174
|
-
return a == b;
|
|
8175
|
-
},
|
|
8176
|
-
"!=": function ne2(a, b) {
|
|
8177
|
-
return a != b;
|
|
8178
|
-
},
|
|
8179
|
-
"===": function sequal2(a, b) {
|
|
8180
|
-
return a === b;
|
|
8181
|
-
},
|
|
8182
|
-
"!==": function sne2(a, b) {
|
|
8183
|
-
return a !== b;
|
|
8184
|
-
},
|
|
8185
|
-
"&": function bitAnd2(a, b) {
|
|
8186
|
-
return a & b;
|
|
8187
|
-
},
|
|
8188
|
-
"^": function xor2(a, b) {
|
|
8189
|
-
return a ^ b;
|
|
8190
|
-
},
|
|
8191
|
-
"|": function bitOr2(a, b) {
|
|
8192
|
-
return a | b;
|
|
8193
|
-
},
|
|
8194
|
-
"&&": function logicAnd2(a, b) {
|
|
8195
|
-
return a && b;
|
|
8196
|
-
},
|
|
8197
|
-
"||": function logicOr2(a, b) {
|
|
8198
|
-
return a || b;
|
|
8199
|
-
},
|
|
8200
|
-
"??": function nullishCoalesce2(a, b) {
|
|
8201
|
-
return a != null ? a : b;
|
|
8202
|
-
},
|
|
8203
|
-
".": function member2(a, b) {
|
|
8204
|
-
return a == null ? void 0 : a[b];
|
|
8205
|
-
},
|
|
8206
|
-
"?.": function omember2(a, b) {
|
|
8207
|
-
return a == null ? void 0 : a[b];
|
|
8208
|
-
},
|
|
8209
|
-
"[": function bmember2(a, b) {
|
|
8210
|
-
return a == null ? void 0 : a[b];
|
|
8211
|
-
},
|
|
8212
|
-
",": function comma2(a, b) {
|
|
8213
|
-
return b;
|
|
8214
|
-
},
|
|
8215
|
-
"call": function callOp2(a, b) {
|
|
8216
|
-
return a.apply(null, b);
|
|
8217
|
-
}
|
|
8218
|
-
};
|
|
8219
|
-
operators2["@"].precedence = 21;
|
|
8220
|
-
operators2["#"].precedence = 21;
|
|
8221
|
-
operators2["."].precedence = 19;
|
|
8222
|
-
operators2["["].precedence = 19;
|
|
8223
|
-
operators2["?."].precedence = 19;
|
|
8224
|
-
operators2["!"].precedence = 16;
|
|
8225
|
-
operators2["!!"].precedence = 16;
|
|
8226
|
-
operators2["++"].precedence = 16;
|
|
8227
|
-
operators2["--"].precedence = 16;
|
|
8228
|
-
operators2["&-"].precedence = 16;
|
|
8229
|
-
operators2["**"].precedent = 15;
|
|
8230
|
-
operators2["%"].precedence = 14;
|
|
8231
|
-
operators2["*"].precedence = 14;
|
|
8232
|
-
operators2["/"].precedence = 14;
|
|
8233
|
-
operators2["+"].precedence = 13;
|
|
8234
|
-
operators2["-"].precedence = 13;
|
|
8235
|
-
operators2["|"].precedence = 12;
|
|
8236
|
-
operators2["^"].precedence = 11;
|
|
8237
|
-
operators2["&"].precedence = 10;
|
|
8238
|
-
operators2["<"].precedence = 11;
|
|
8239
|
-
operators2["<="].precedence = 11;
|
|
8240
|
-
operators2[">"].precedence = 11;
|
|
8241
|
-
operators2[">="].precedence = 11;
|
|
8242
|
-
operators2["=="].precedence = 10;
|
|
8243
|
-
operators2["!="].precedence = 10;
|
|
8244
|
-
operators2["==="].precedence = 10;
|
|
8245
|
-
operators2["!=="].precedence = 10;
|
|
8246
|
-
operators2["&&"].precedence = 6;
|
|
8247
|
-
operators2["||"].precedence = 5;
|
|
8248
|
-
operators2["??"].precedence = 5;
|
|
8249
|
-
operators2["&&"].earlyOut = (a) => !a;
|
|
8250
|
-
operators2["||"].earlyOut = (a) => a;
|
|
8251
|
-
operators2["??"].earlyOut = (a) => a;
|
|
8252
|
-
operators2[","].precedence = 2;
|
|
8253
|
-
operators2["call"].precedence = 1;
|
|
8254
|
-
operators2["=>"].precedence = 1;
|
|
8255
|
-
|
|
8256
|
-
// ../../packages/utils.parser/src/Node.ts
|
|
8257
|
-
var IS_EXPR_OR_IDENT2 = Symbol("Node - Is Expression Or Identifier");
|
|
8258
|
-
var Node3 = class {
|
|
8259
|
-
constructor(lhs, op, rhs) {
|
|
8260
|
-
this.lhs = lhs;
|
|
8261
|
-
this.op = op;
|
|
8262
|
-
this.rhs = rhs;
|
|
8263
|
-
}
|
|
8264
|
-
static get operators() {
|
|
8265
|
-
return operators2;
|
|
8266
|
-
}
|
|
8267
|
-
get_leaf_value(leaf, context, globals, node) {
|
|
8268
|
-
if (typeof leaf === "function") {
|
|
8269
|
-
return unwrap(leaf());
|
|
8270
|
-
}
|
|
8271
|
-
if (typeof leaf !== "object" || leaf === null) {
|
|
8272
|
-
return leaf;
|
|
8273
|
-
}
|
|
8274
|
-
if (leaf[Node3.isExpressionOrIdentifierSymbol]) {
|
|
8275
|
-
return unwrap(leaf.get_value(void 0, context, globals, node));
|
|
8276
|
-
}
|
|
8277
|
-
return leaf;
|
|
8278
|
-
}
|
|
8279
|
-
get_value(notused, context, globals, node) {
|
|
8280
|
-
var node = this;
|
|
8281
|
-
if (node.op === LAMBDA2) {
|
|
8282
|
-
return (...args) => {
|
|
8283
|
-
let lambdaContext = context;
|
|
8284
|
-
if (node.lhs) {
|
|
8285
|
-
lambdaContext = node.lhs.extendContext(context, args);
|
|
8286
|
-
}
|
|
8287
|
-
return node.get_leaf_value(node.rhs, lambdaContext, globals, node);
|
|
8288
|
-
};
|
|
8289
|
-
}
|
|
8290
|
-
const lhv = node.get_leaf_value(node.lhs, context, globals, node);
|
|
8291
|
-
const earlyOut = node.op.earlyOut;
|
|
8292
|
-
if (earlyOut && earlyOut(lhv)) {
|
|
8293
|
-
return lhv;
|
|
8294
|
-
}
|
|
8295
|
-
const rhv = node.get_leaf_value(node.rhs, context, globals, node);
|
|
8296
|
-
return node.op(lhv, rhv, context, globals);
|
|
8297
|
-
}
|
|
8298
|
-
static get isExpressionOrIdentifierSymbol() {
|
|
8299
|
-
return IS_EXPR_OR_IDENT2;
|
|
8300
|
-
}
|
|
8301
|
-
get [IS_EXPR_OR_IDENT2]() {
|
|
8302
|
-
return true;
|
|
8303
|
-
}
|
|
8304
|
-
static value_of(item, context, globals, node) {
|
|
8305
|
-
if (item && item[Node3.isExpressionOrIdentifierSymbol]) {
|
|
8306
|
-
return item.get_value(item, context, globals, node);
|
|
8307
|
-
}
|
|
8308
|
-
return item;
|
|
8309
|
-
}
|
|
8310
|
-
static create_root(nodes, debug = false) {
|
|
8311
|
-
const out = [];
|
|
8312
|
-
const ops = [];
|
|
8313
|
-
for (let i = 0; i < nodes.length; i += 2) {
|
|
8314
|
-
out.push(nodes[i]);
|
|
8315
|
-
const op = nodes[i + 1];
|
|
8316
|
-
const prec = (op == null ? void 0 : op.precedence) || 0;
|
|
8317
|
-
while (ops.length && prec <= ops[ops.length - 1].precedence) {
|
|
8318
|
-
const rhs = out.pop();
|
|
8319
|
-
const lhs = out.pop();
|
|
8320
|
-
out.push(new Node3(lhs, ops.pop(), rhs));
|
|
8321
|
-
}
|
|
8322
|
-
ops.push(op);
|
|
8323
|
-
}
|
|
8324
|
-
if (out.length !== 1) {
|
|
8325
|
-
throw new Error(`unexpected nodes remain in shunting yard output stack: ${out}`);
|
|
8326
|
-
}
|
|
8327
|
-
return out[0];
|
|
8328
|
-
}
|
|
8329
|
-
};
|
|
8330
|
-
operators2["?"] = function ternary2(a, b, context, globals, node) {
|
|
8331
|
-
return Node3.value_of(a ? b.yes : b.no, context, globals, node);
|
|
8332
|
-
};
|
|
8333
|
-
operators2["?"].precedence = 4;
|
|
8334
|
-
|
|
8335
|
-
// ../../packages/utils.parser/src/Expression.ts
|
|
8336
|
-
var Expression3 = class {
|
|
8337
|
-
constructor(nodes) {
|
|
8338
|
-
this.nodes = nodes;
|
|
8339
|
-
this.root = Node3.create_root(nodes);
|
|
8340
|
-
}
|
|
8341
|
-
get_value(parent, context, globals, node) {
|
|
8342
|
-
if (!this.root) {
|
|
8343
|
-
this.root = Node3.create_root(this.nodes);
|
|
8344
|
-
}
|
|
8345
|
-
return this.root.get_value(parent, context, globals, node);
|
|
8346
|
-
}
|
|
8347
|
-
};
|
|
8348
|
-
Expression3.prototype[Node3.isExpressionOrIdentifierSymbol] = true;
|
|
8349
|
-
|
|
8350
|
-
// ../../packages/utils.parser/src/Arguments.ts
|
|
8351
|
-
var Arguments2 = class {
|
|
8352
|
-
constructor(parser, args) {
|
|
8353
|
-
this.parser = parser;
|
|
8354
|
-
this.args = args;
|
|
8355
|
-
}
|
|
8356
|
-
get_value(parent, context, globals, node) {
|
|
8357
|
-
var deReffedArgs = [];
|
|
8358
|
-
for (var i = 0, j = this.args.length; i < j; ++i) {
|
|
8359
|
-
deReffedArgs.push(Node3.value_of(this.args[i], context, globals, node));
|
|
8360
|
-
}
|
|
8361
|
-
return deReffedArgs;
|
|
8362
|
-
}
|
|
8363
|
-
get [Node3.isExpressionOrIdentifierSymbol]() {
|
|
8364
|
-
return true;
|
|
8365
|
-
}
|
|
8366
|
-
};
|
|
8367
|
-
|
|
8368
|
-
// ../../packages/utils.parser/src/identifierExpressions.ts
|
|
8369
|
-
var IDStart2 = /[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/;
|
|
8370
|
-
var IDContinue2 = /[\$0-9A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/;
|
|
8371
|
-
|
|
8372
|
-
// ../../packages/utils.parser/src/Identifier.ts
|
|
8373
|
-
var Identifier2 = class {
|
|
8374
|
-
constructor(parser, token, dereferences) {
|
|
8375
|
-
this.token = token;
|
|
8376
|
-
this.dereferences = dereferences;
|
|
8377
|
-
this.parser = parser;
|
|
8378
|
-
}
|
|
8379
|
-
dereference(value2, $context, globals, node) {
|
|
8380
|
-
let member3;
|
|
8381
|
-
let refs = this.dereferences || [];
|
|
8382
|
-
const $data = $context.$data || {};
|
|
8383
|
-
let lastValue;
|
|
8384
|
-
let i, n;
|
|
8385
|
-
for (i = 0, n = refs.length; i < n; ++i) {
|
|
8386
|
-
member3 = Node3.value_of(refs[i], $context, globals, node);
|
|
8387
|
-
if (typeof value2 === "function" && refs[i] instanceof Arguments2) {
|
|
8388
|
-
value2 = value2.apply(lastValue || $data, member3);
|
|
8389
|
-
lastValue = value2;
|
|
8390
|
-
} else if (value2 === null || value2 === void 0) {
|
|
8391
|
-
return value2;
|
|
8392
|
-
} else {
|
|
8393
|
-
lastValue = value2;
|
|
8394
|
-
value2 = Node3.value_of(value2[member3], $context, globals, node);
|
|
8395
|
-
}
|
|
8396
|
-
}
|
|
8397
|
-
if (typeof value2 === "function" && n > 0 && lastValue !== value2 && !hasOwnProperty(lastValue, member3)) {
|
|
8398
|
-
return value2.bind(lastValue);
|
|
8399
|
-
}
|
|
8400
|
-
return value2;
|
|
8401
|
-
}
|
|
8402
|
-
get_value(parent, context, globals, node) {
|
|
8403
|
-
const intermediate = parent && !(parent instanceof Identifier2) ? Node3.value_of(parent, context, globals, node)[this.token] : context.lookup(this.token, globals, node);
|
|
8404
|
-
return this.dereference(intermediate, context, globals, node);
|
|
8405
|
-
}
|
|
8406
|
-
assign(object2, property, value2) {
|
|
8407
|
-
if (isWriteableObservable(object2[property])) {
|
|
8408
|
-
object2[property](value2);
|
|
8409
|
-
} else if (!isObservable(object2[property])) {
|
|
8410
|
-
object2[property] = value2;
|
|
8411
|
-
}
|
|
8412
|
-
}
|
|
8413
|
-
set_value(new_value, $context, globals) {
|
|
8414
|
-
const $data = $context.$data || {};
|
|
8415
|
-
const refs = this.dereferences || [];
|
|
8416
|
-
let leaf = this.token;
|
|
8417
|
-
let i, n, root;
|
|
8418
|
-
if (isObjectLike($data) && leaf in $data) {
|
|
8419
|
-
root = $data;
|
|
8420
|
-
} else if (leaf in $context) {
|
|
8421
|
-
root = $context;
|
|
8422
|
-
} else if (leaf in globals) {
|
|
8423
|
-
root = globals;
|
|
8424
|
-
} else {
|
|
8425
|
-
throw new Error("Identifier::set_value -- The property '" + leaf + "' does not exist on the $data, $context, or globals.");
|
|
8426
|
-
}
|
|
8427
|
-
n = refs.length;
|
|
8428
|
-
if (n === 0) {
|
|
8429
|
-
this.assign(root, leaf, new_value);
|
|
8430
|
-
return;
|
|
8431
|
-
}
|
|
8432
|
-
root = root[leaf];
|
|
8433
|
-
for (i = 0; i < n - 1; ++i) {
|
|
8434
|
-
leaf = refs[i];
|
|
8435
|
-
if (leaf instanceof Arguments2) {
|
|
8436
|
-
root = root();
|
|
8437
|
-
} else {
|
|
8438
|
-
root = root[Node3.value_of(leaf)];
|
|
8439
|
-
}
|
|
8440
|
-
}
|
|
8441
|
-
if (refs[i] === true) {
|
|
8442
|
-
throw new Error("Cannot assign a value to a function.");
|
|
8443
|
-
}
|
|
8444
|
-
if (refs[i]) {
|
|
8445
|
-
this.assign(root, Node3.value_of(refs[i]), new_value);
|
|
8446
|
-
}
|
|
8447
|
-
}
|
|
8448
|
-
static is_valid_start_char(ch) {
|
|
8449
|
-
return IDStart2.test(ch);
|
|
8450
|
-
}
|
|
8451
|
-
static is_valid_continue_char(ch) {
|
|
8452
|
-
return IDContinue2.test(ch);
|
|
8453
|
-
}
|
|
8454
|
-
get [Node3.isExpressionOrIdentifierSymbol]() {
|
|
8455
|
-
return true;
|
|
8456
|
-
}
|
|
8457
|
-
};
|
|
8458
|
-
|
|
8459
|
-
// ../../packages/utils.parser/src/Parameters.ts
|
|
8460
|
-
var Parameters2 = class {
|
|
8461
|
-
constructor(parser, node) {
|
|
8462
|
-
if (node instanceof Expression3) {
|
|
8463
|
-
node = node.root;
|
|
8464
|
-
}
|
|
8465
|
-
try {
|
|
8466
|
-
this.names = Parameters2.nodeTreeToNames(node);
|
|
8467
|
-
} catch (e) {
|
|
8468
|
-
parser.error(e);
|
|
8469
|
-
}
|
|
8470
|
-
}
|
|
8471
|
-
extendContext(context, args) {
|
|
8472
|
-
if (!this.names) {
|
|
8473
|
-
return context;
|
|
8474
|
-
} else {
|
|
8475
|
-
const newValues = {};
|
|
8476
|
-
this.names.forEach((name, index) => {
|
|
8477
|
-
newValues[name] = args[index];
|
|
8478
|
-
});
|
|
8479
|
-
return context.extend(newValues);
|
|
8480
|
-
}
|
|
8481
|
-
}
|
|
8482
|
-
get [Node3.isExpressionOrIdentifierSymbol]() {
|
|
8483
|
-
return true;
|
|
8484
|
-
}
|
|
8485
|
-
static nodeTreeToNames(node) {
|
|
8486
|
-
const names = [];
|
|
8487
|
-
while (node) {
|
|
8488
|
-
if (node instanceof Identifier2) {
|
|
8489
|
-
names.push(node.token);
|
|
8490
|
-
node = null;
|
|
8491
|
-
} else if (this.isCommaNode(node)) {
|
|
8492
|
-
names.push(node.rhs.token);
|
|
8493
|
-
node = node.lhs;
|
|
8494
|
-
} else {
|
|
8495
|
-
throw new Error(`only simple identifiers allowed in lambda parameter list but found ${JSON.stringify(node, null, 2)}`);
|
|
8496
|
-
}
|
|
8497
|
-
}
|
|
8498
|
-
names.reverse();
|
|
8499
|
-
return names;
|
|
8500
|
-
}
|
|
8501
|
-
static isCommaNode(node) {
|
|
8502
|
-
return node instanceof Node3 && node.op === operators2[","] && node.rhs instanceof Identifier2;
|
|
8503
|
-
}
|
|
8504
|
-
};
|
|
8505
|
-
|
|
8506
|
-
// ../../packages/utils.parser/src/Ternary.ts
|
|
8507
|
-
var Ternary2 = class {
|
|
8508
|
-
constructor(yes, no) {
|
|
8509
|
-
Object.assign(this, { yes, no });
|
|
8510
|
-
}
|
|
8511
|
-
get_value() {
|
|
8512
|
-
return this;
|
|
8513
|
-
}
|
|
8514
|
-
get [Node3.isExpressionOrIdentifierSymbol]() {
|
|
8515
|
-
return true;
|
|
8516
|
-
}
|
|
8517
|
-
};
|
|
8518
|
-
|
|
8519
|
-
// ../../packages/utils.parser/src/preparse.ts
|
|
8520
|
-
var specials2 = ",\"'`{}()/:[\\]";
|
|
8521
|
-
var bindingToken2 = RegExp([
|
|
8522
|
-
'"(?:\\\\.|[^"])*"',
|
|
8523
|
-
"'(?:\\\\.|[^'])*'",
|
|
8524
|
-
"`(?:\\\\.|[^`])*`",
|
|
8525
|
-
"/\\*(?:[^*]|\\*+[^*/])*\\*+/",
|
|
8526
|
-
"//.*\n",
|
|
8527
|
-
"/(?:\\\\.|[^/])+/\\w*",
|
|
8528
|
-
"[^\\s:,/][^" + specials2 + "]*[^\\s" + specials2 + "]",
|
|
8529
|
-
"[^\\s]"
|
|
8530
|
-
].join("|"), "g");
|
|
8531
|
-
|
|
8532
|
-
// ../../packages/utils.parser/src/index.ts
|
|
8533
|
-
function overloadOperator(op, fn, precedence) {
|
|
8534
|
-
operators2[op] = fn;
|
|
8535
|
-
if (Number.isInteger(precedence)) {
|
|
8536
|
-
operators2[op].precedence = precedence;
|
|
8537
|
-
}
|
|
8538
|
-
}
|
|
8539
|
-
|
|
8540
8336
|
// src/index.ts
|
|
8541
8337
|
overloadOperator("==", (a, b) => a === b);
|
|
8542
8338
|
overloadOperator("!=", (a, b) => a !== b);
|
|
@@ -8562,7 +8358,7 @@ ${name} ${msg} of
|
|
|
8562
8358
|
{ each: bindings4.foreach }
|
|
8563
8359
|
]
|
|
8564
8360
|
});
|
|
8565
|
-
var version = "4.0.0-beta1.
|
|
8361
|
+
var version = "4.0.0-beta1.7";
|
|
8566
8362
|
var src_default = builder.create({
|
|
8567
8363
|
jsx: {
|
|
8568
8364
|
createElement,
|