@tko/build.reference 4.0.0-beta1.5 → 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 +232 -8
- package/dist/browser.js.map +3 -3
- package/dist/browser.min.js +7 -7
- package/dist/browser.min.js.map +4 -4
- package/dist/common.js +1 -1
- package/dist/index.cjs +232 -8
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +5 -2
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +5 -2
- package/dist/index.mjs.map +2 -2
- package/package.json +8 -8
package/dist/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
// @tko/build.reference 🥊 4.0.0-beta1.7 IIFE
|
|
1
2
|
"use strict";
|
|
2
|
-
// @tko/build.reference 🥊 4.0.0-beta1.5 IIFE
|
|
3
3
|
var tko = (() => {
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -478,7 +478,7 @@ var tko = (() => {
|
|
|
478
478
|
nextKey: () => nextKey,
|
|
479
479
|
set: () => set
|
|
480
480
|
});
|
|
481
|
-
var datastoreTime = new Date().getTime();
|
|
481
|
+
var datastoreTime = (/* @__PURE__ */ new Date()).getTime();
|
|
482
482
|
var dataStoreKeyExpandoPropertyName = `__ko__${datastoreTime}`;
|
|
483
483
|
var dataStoreSymbol = Symbol("Knockout data");
|
|
484
484
|
var dataStore;
|
|
@@ -2098,8 +2098,10 @@ var tko = (() => {
|
|
|
2098
2098
|
return b;
|
|
2099
2099
|
}
|
|
2100
2100
|
var operators = {
|
|
2101
|
+
// unary
|
|
2101
2102
|
"@": unwrapOrCall,
|
|
2102
2103
|
"#": (a, b) => () => unwrap(b),
|
|
2104
|
+
// Convert to read-only.
|
|
2103
2105
|
"=>": LAMBDA,
|
|
2104
2106
|
"!": function not(a, b) {
|
|
2105
2107
|
return !b;
|
|
@@ -2113,9 +2115,11 @@ var tko = (() => {
|
|
|
2113
2115
|
"--": function preinc2(a, b) {
|
|
2114
2116
|
return --b;
|
|
2115
2117
|
},
|
|
2118
|
+
// exponent
|
|
2116
2119
|
"**": function exp(a, b) {
|
|
2117
2120
|
return __pow(a, b);
|
|
2118
2121
|
},
|
|
2122
|
+
// mul/div
|
|
2119
2123
|
"*": function mul(a, b) {
|
|
2120
2124
|
return a * b;
|
|
2121
2125
|
},
|
|
@@ -2125,6 +2129,7 @@ var tko = (() => {
|
|
|
2125
2129
|
"%": function mod(a, b) {
|
|
2126
2130
|
return a % b;
|
|
2127
2131
|
},
|
|
2132
|
+
// sub/add
|
|
2128
2133
|
"+": function add(a, b) {
|
|
2129
2134
|
return a + b;
|
|
2130
2135
|
},
|
|
@@ -2134,6 +2139,8 @@ var tko = (() => {
|
|
|
2134
2139
|
"&-": function neg(a, b) {
|
|
2135
2140
|
return -1 * b;
|
|
2136
2141
|
},
|
|
2142
|
+
// unary -
|
|
2143
|
+
// relational
|
|
2137
2144
|
"<": function lt(a, b) {
|
|
2138
2145
|
return a < b;
|
|
2139
2146
|
},
|
|
@@ -2146,11 +2153,14 @@ var tko = (() => {
|
|
|
2146
2153
|
">=": function ge(a, b) {
|
|
2147
2154
|
return a >= b;
|
|
2148
2155
|
},
|
|
2156
|
+
// TODO: 'in': function (a, b) { return a in b; },
|
|
2157
|
+
// TODO: 'instanceof': function (a, b) { return a instanceof b; },
|
|
2158
|
+
// equality
|
|
2149
2159
|
"==": function equal(a, b) {
|
|
2150
|
-
return a
|
|
2160
|
+
return a == b;
|
|
2151
2161
|
},
|
|
2152
2162
|
"!=": function ne(a, b) {
|
|
2153
|
-
return a
|
|
2163
|
+
return a != b;
|
|
2154
2164
|
},
|
|
2155
2165
|
"===": function sequal(a, b) {
|
|
2156
2166
|
return a === b;
|
|
@@ -2158,6 +2168,7 @@ var tko = (() => {
|
|
|
2158
2168
|
"!==": function sne(a, b) {
|
|
2159
2169
|
return a !== b;
|
|
2160
2170
|
},
|
|
2171
|
+
// bitwise
|
|
2161
2172
|
"&": function bitAnd(a, b) {
|
|
2162
2173
|
return a & b;
|
|
2163
2174
|
},
|
|
@@ -2167,6 +2178,7 @@ var tko = (() => {
|
|
|
2167
2178
|
"|": function bitOr(a, b) {
|
|
2168
2179
|
return a | b;
|
|
2169
2180
|
},
|
|
2181
|
+
// logic
|
|
2170
2182
|
"&&": function logicAnd(a, b) {
|
|
2171
2183
|
return a && b;
|
|
2172
2184
|
},
|
|
@@ -2176,6 +2188,7 @@ var tko = (() => {
|
|
|
2176
2188
|
"??": function nullishCoalesce(a, b) {
|
|
2177
2189
|
return a != null ? a : b;
|
|
2178
2190
|
},
|
|
2191
|
+
// Access
|
|
2179
2192
|
".": function member(a, b) {
|
|
2180
2193
|
return a == null ? void 0 : a[b];
|
|
2181
2194
|
},
|
|
@@ -2188,6 +2201,9 @@ var tko = (() => {
|
|
|
2188
2201
|
",": function comma(a, b) {
|
|
2189
2202
|
return b;
|
|
2190
2203
|
},
|
|
2204
|
+
// conditional/ternary
|
|
2205
|
+
// '?': ternary See Node.js
|
|
2206
|
+
// Function-Call
|
|
2191
2207
|
"call": function callOp(a, b) {
|
|
2192
2208
|
return a.apply(null, b);
|
|
2193
2209
|
}
|
|
@@ -2252,6 +2268,15 @@ var tko = (() => {
|
|
|
2252
2268
|
}
|
|
2253
2269
|
return leaf;
|
|
2254
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
|
+
*/
|
|
2255
2280
|
get_value(notused, context, globals, node) {
|
|
2256
2281
|
var node = this;
|
|
2257
2282
|
if (node.op === LAMBDA) {
|
|
@@ -2271,6 +2296,9 @@ var tko = (() => {
|
|
|
2271
2296
|
const rhv = node.get_leaf_value(node.rhs, context, globals, node);
|
|
2272
2297
|
return node.op(lhv, rhv, context, globals);
|
|
2273
2298
|
}
|
|
2299
|
+
//
|
|
2300
|
+
// Class variables.
|
|
2301
|
+
//
|
|
2274
2302
|
static get isExpressionOrIdentifierSymbol() {
|
|
2275
2303
|
return IS_EXPR_OR_IDENT;
|
|
2276
2304
|
}
|
|
@@ -2283,6 +2311,12 @@ var tko = (() => {
|
|
|
2283
2311
|
}
|
|
2284
2312
|
return item;
|
|
2285
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
|
+
*/
|
|
2286
2320
|
static create_root(nodes, debug = false) {
|
|
2287
2321
|
const out = [];
|
|
2288
2322
|
const ops = [];
|
|
@@ -2314,6 +2348,9 @@ var tko = (() => {
|
|
|
2314
2348
|
this.nodes = nodes;
|
|
2315
2349
|
this.root = Node2.create_root(nodes);
|
|
2316
2350
|
}
|
|
2351
|
+
/**
|
|
2352
|
+
* Return the value of `this` Expression instance.
|
|
2353
|
+
*/
|
|
2317
2354
|
get_value(parent, context, globals, node) {
|
|
2318
2355
|
if (!this.root) {
|
|
2319
2356
|
this.root = Node2.create_root(this.nodes);
|
|
@@ -2352,6 +2389,27 @@ var tko = (() => {
|
|
|
2352
2389
|
this.dereferences = dereferences;
|
|
2353
2390
|
this.parser = parser;
|
|
2354
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
|
+
*/
|
|
2355
2413
|
dereference(value2, $context, globals, node) {
|
|
2356
2414
|
let member2;
|
|
2357
2415
|
let refs = this.dereferences || [];
|
|
@@ -2375,6 +2433,16 @@ var tko = (() => {
|
|
|
2375
2433
|
}
|
|
2376
2434
|
return value2;
|
|
2377
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
|
+
*/
|
|
2378
2446
|
get_value(parent, context, globals, node) {
|
|
2379
2447
|
const intermediate = parent && !(parent instanceof Identifier) ? Node2.value_of(parent, context, globals, node)[this.token] : context.lookup(this.token, globals, node);
|
|
2380
2448
|
return this.dereference(intermediate, context, globals, node);
|
|
@@ -2386,6 +2454,11 @@ var tko = (() => {
|
|
|
2386
2454
|
object2[property] = value2;
|
|
2387
2455
|
}
|
|
2388
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
|
+
*/
|
|
2389
2462
|
set_value(new_value, $context, globals) {
|
|
2390
2463
|
const $data = $context.$data || {};
|
|
2391
2464
|
const refs = this.dereferences || [];
|
|
@@ -2421,6 +2494,21 @@ var tko = (() => {
|
|
|
2421
2494
|
this.assign(root, Node2.value_of(refs[i]), new_value);
|
|
2422
2495
|
}
|
|
2423
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
|
+
// }
|
|
2424
2512
|
static is_valid_start_char(ch) {
|
|
2425
2513
|
return IDStart.test(ch);
|
|
2426
2514
|
}
|
|
@@ -2514,6 +2602,9 @@ var tko = (() => {
|
|
|
2514
2602
|
}
|
|
2515
2603
|
return this.comment(ch);
|
|
2516
2604
|
}
|
|
2605
|
+
/**
|
|
2606
|
+
* Slurp any C or C++ style comments
|
|
2607
|
+
*/
|
|
2517
2608
|
comment(ch) {
|
|
2518
2609
|
if (ch !== "/") {
|
|
2519
2610
|
return ch;
|
|
@@ -2632,6 +2723,13 @@ ${name} ${msg} of
|
|
|
2632
2723
|
return number;
|
|
2633
2724
|
}
|
|
2634
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
|
+
*/
|
|
2635
2733
|
objectAddValue(object2, key, value2) {
|
|
2636
2734
|
if (value2 && value2[Node2.isExpressionOrIdentifierSymbol]) {
|
|
2637
2735
|
Object.defineProperty(object2, key, {
|
|
@@ -2689,6 +2787,11 @@ ${name} ${msg} of
|
|
|
2689
2787
|
}
|
|
2690
2788
|
this.error("Bad object");
|
|
2691
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
|
+
*/
|
|
2692
2795
|
readString(delim) {
|
|
2693
2796
|
let string = "";
|
|
2694
2797
|
let nodes = [""];
|
|
@@ -2795,6 +2898,12 @@ ${name} ${msg} of
|
|
|
2795
2898
|
return ch >= "0" && ch <= "9" ? this.number() : this.identifier();
|
|
2796
2899
|
}
|
|
2797
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
|
+
*/
|
|
2798
2907
|
operator(opts) {
|
|
2799
2908
|
let op = "";
|
|
2800
2909
|
let opFn;
|
|
@@ -2825,6 +2934,12 @@ ${name} ${msg} of
|
|
|
2825
2934
|
}
|
|
2826
2935
|
return opFn;
|
|
2827
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
|
+
*/
|
|
2828
2943
|
filter() {
|
|
2829
2944
|
let ch = this.next();
|
|
2830
2945
|
let args = [];
|
|
@@ -2850,16 +2965,32 @@ ${name} ${msg} of
|
|
|
2850
2965
|
}
|
|
2851
2966
|
ch = this.white();
|
|
2852
2967
|
}
|
|
2853
|
-
|
|
2968
|
+
function filter(value2, ignored, context, globals, node) {
|
|
2854
2969
|
var argValues = [value2];
|
|
2855
2970
|
for (var i = 0, j = args.length; i < j; ++i) {
|
|
2856
2971
|
argValues.push(Node2.value_of(args[i], context, globals, node));
|
|
2857
2972
|
}
|
|
2858
|
-
return nextFilter(options_default.filters[name].apply(context, argValues));
|
|
2859
|
-
}
|
|
2973
|
+
return nextFilter(options_default.filters[name].apply(context, argValues), ignored, context, globals, node);
|
|
2974
|
+
}
|
|
2860
2975
|
filter.precedence = 1;
|
|
2861
2976
|
return filter;
|
|
2862
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
|
+
*/
|
|
2863
2994
|
expression(filterable = false, allowMultipleValues = true) {
|
|
2864
2995
|
let op;
|
|
2865
2996
|
let nodes = [];
|
|
@@ -2929,6 +3060,13 @@ ${name} ${msg} of
|
|
|
2929
3060
|
}
|
|
2930
3061
|
return new Expression(nodes);
|
|
2931
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
|
+
*/
|
|
2932
3070
|
singleValueExpression(filterable) {
|
|
2933
3071
|
return this.expression(filterable, false);
|
|
2934
3072
|
}
|
|
@@ -2940,6 +3078,10 @@ ${name} ${msg} of
|
|
|
2940
3078
|
nodes.push(operators["?"]);
|
|
2941
3079
|
nodes.push(ternary2);
|
|
2942
3080
|
}
|
|
3081
|
+
/**
|
|
3082
|
+
* Parse the arguments to a function, returning an Array.
|
|
3083
|
+
*
|
|
3084
|
+
*/
|
|
2943
3085
|
funcArguments() {
|
|
2944
3086
|
let args = [];
|
|
2945
3087
|
let ch = this.next("(");
|
|
@@ -2958,6 +3100,9 @@ ${name} ${msg} of
|
|
|
2958
3100
|
}
|
|
2959
3101
|
this.error("Bad arguments to function");
|
|
2960
3102
|
}
|
|
3103
|
+
/**
|
|
3104
|
+
* The literal string reference `abc` in an `x.abc` expression.
|
|
3105
|
+
*/
|
|
2961
3106
|
member() {
|
|
2962
3107
|
let member2 = "";
|
|
2963
3108
|
let ch = this.white();
|
|
@@ -2972,6 +3117,12 @@ ${name} ${msg} of
|
|
|
2972
3117
|
}
|
|
2973
3118
|
return member2;
|
|
2974
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
|
+
*/
|
|
2975
3126
|
dereference() {
|
|
2976
3127
|
let member2;
|
|
2977
3128
|
let ch = this.white();
|
|
@@ -3100,6 +3251,14 @@ ${name} ${msg} of
|
|
|
3100
3251
|
}
|
|
3101
3252
|
throw new Error("Value has cannot be converted to accessor: " + value2);
|
|
3102
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
|
+
*/
|
|
3103
3262
|
convertToAccessors(result, context, globals, node) {
|
|
3104
3263
|
objectForEach(result, (name, value2) => {
|
|
3105
3264
|
if (value2 instanceof Identifier) {
|
|
@@ -3141,6 +3300,11 @@ ${name} ${msg} of
|
|
|
3141
3300
|
options_default.onError(e);
|
|
3142
3301
|
}
|
|
3143
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
|
+
*/
|
|
3144
3308
|
parse(source, context = {}, globals = {}, node) {
|
|
3145
3309
|
if (!source) {
|
|
3146
3310
|
return () => null;
|
|
@@ -3150,6 +3314,9 @@ ${name} ${msg} of
|
|
|
3150
3314
|
const bindingAccessors = this.runParse(source, parseFn);
|
|
3151
3315
|
return this.convertToAccessors(bindingAccessors, context, globals, node);
|
|
3152
3316
|
}
|
|
3317
|
+
/**
|
|
3318
|
+
* Return a function that evaluates and returns the result of the expression.
|
|
3319
|
+
*/
|
|
3153
3320
|
parseExpression(source, context = {}, globals = {}, node) {
|
|
3154
3321
|
if (!source) {
|
|
3155
3322
|
return () => "";
|
|
@@ -3164,13 +3331,24 @@ ${name} ${msg} of
|
|
|
3164
3331
|
// ../../packages/utils.parser/dist/preparse.js
|
|
3165
3332
|
var specials = ",\"'`{}()/:[\\]";
|
|
3166
3333
|
var bindingToken = RegExp([
|
|
3334
|
+
// These match strings, either with double quotes, single quotes, or backticks
|
|
3167
3335
|
'"(?:\\\\.|[^"])*"',
|
|
3168
3336
|
"'(?:\\\\.|[^'])*'",
|
|
3169
3337
|
"`(?:\\\\.|[^`])*`",
|
|
3338
|
+
// Match C style comments
|
|
3170
3339
|
"/\\*(?:[^*]|\\*+[^*/])*\\*+/",
|
|
3340
|
+
// Match C++ style comments
|
|
3171
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).
|
|
3172
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.
|
|
3173
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).
|
|
3174
3352
|
"[^\\s]"
|
|
3175
3353
|
].join("|"), "g");
|
|
3176
3354
|
var divisionLookBehind = /[\])"'A-Za-z0-9_$]+$/;
|
|
@@ -3229,6 +3407,14 @@ ${name} ${msg} of
|
|
|
3229
3407
|
return result;
|
|
3230
3408
|
}
|
|
3231
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
|
+
|
|
3232
3418
|
// ../../packages/computed/dist/computed.js
|
|
3233
3419
|
var computedState = createSymbolOrString("_state");
|
|
3234
3420
|
var DISPOSED_STATE = {
|
|
@@ -5143,6 +5329,7 @@ ${name} ${msg} of
|
|
|
5143
5329
|
unwrapObservable: unwrap
|
|
5144
5330
|
});
|
|
5145
5331
|
var knockout = {
|
|
5332
|
+
// --- Utilities ---
|
|
5146
5333
|
cleanNode,
|
|
5147
5334
|
dependencyDetection: dependencyDetection_exports,
|
|
5148
5335
|
computedContext: dependencyDetection_exports,
|
|
@@ -5155,6 +5342,7 @@ ${name} ${msg} of
|
|
|
5155
5342
|
tasks: tasks_exports,
|
|
5156
5343
|
utils,
|
|
5157
5344
|
LifeCycle,
|
|
5345
|
+
// -- Observable ---
|
|
5158
5346
|
isObservable,
|
|
5159
5347
|
isSubscribable,
|
|
5160
5348
|
isWriteableObservable,
|
|
@@ -5168,17 +5356,20 @@ ${name} ${msg} of
|
|
|
5168
5356
|
toJS,
|
|
5169
5357
|
toJSON,
|
|
5170
5358
|
proxy,
|
|
5359
|
+
// ... Computed ...
|
|
5171
5360
|
computed,
|
|
5172
5361
|
dependentObservable: computed,
|
|
5173
5362
|
isComputed,
|
|
5174
5363
|
isPureComputed,
|
|
5175
5364
|
pureComputed,
|
|
5176
5365
|
when,
|
|
5366
|
+
// --- Templates ---
|
|
5177
5367
|
nativeTemplateEngine,
|
|
5178
5368
|
renderTemplate,
|
|
5179
5369
|
setTemplateEngine,
|
|
5180
5370
|
templateEngine,
|
|
5181
5371
|
templateSources: { domElement, anonymousTemplate },
|
|
5372
|
+
// --- Binding ---
|
|
5182
5373
|
applyBindingAccessorsToNode,
|
|
5183
5374
|
applyBindings,
|
|
5184
5375
|
applyBindingsToDescendants,
|
|
@@ -5211,6 +5402,9 @@ ${name} ${msg} of
|
|
|
5211
5402
|
bindingProvider: provider
|
|
5212
5403
|
};
|
|
5213
5404
|
}
|
|
5405
|
+
/**
|
|
5406
|
+
* @return {Object} An instance of Knockout.
|
|
5407
|
+
*/
|
|
5214
5408
|
create(...additionalProperties) {
|
|
5215
5409
|
const instance = Object.assign(
|
|
5216
5410
|
{
|
|
@@ -5335,6 +5529,11 @@ ${name} ${msg} of
|
|
|
5335
5529
|
|
|
5336
5530
|
// ../../packages/provider.bindingstring/dist/BindingStringProvider.js
|
|
5337
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
|
+
*/
|
|
5338
5537
|
*processBinding(key, value2) {
|
|
5339
5538
|
const [handlerName, property] = key.split(".");
|
|
5340
5539
|
const handler2 = this.bindingHandlers.get(handlerName);
|
|
@@ -5377,6 +5576,10 @@ ${name} ${msg} of
|
|
|
5377
5576
|
get FOR_NODE_TYPES() {
|
|
5378
5577
|
return [1, 8];
|
|
5379
5578
|
}
|
|
5579
|
+
/**
|
|
5580
|
+
* Convert <ko binding='...'> into <!-- ko binding: ... -->
|
|
5581
|
+
* @param {HTMLElement} node
|
|
5582
|
+
*/
|
|
5380
5583
|
preprocessNode(node) {
|
|
5381
5584
|
if (node.tagName === "KO") {
|
|
5382
5585
|
const parent = node.parentNode;
|
|
@@ -5415,6 +5618,7 @@ ${name} ${msg} of
|
|
|
5415
5618
|
get FOR_NODE_TYPES() {
|
|
5416
5619
|
return [1];
|
|
5417
5620
|
}
|
|
5621
|
+
// document.ELEMENT_NODE
|
|
5418
5622
|
get BIND_ATTRIBUTE() {
|
|
5419
5623
|
return "data-bind";
|
|
5420
5624
|
}
|
|
@@ -5722,6 +5926,11 @@ ${name} ${msg} of
|
|
|
5722
5926
|
get FOR_NODE_TYPES() {
|
|
5723
5927
|
return [1];
|
|
5724
5928
|
}
|
|
5929
|
+
// document.ELEMENT_NODE
|
|
5930
|
+
/**
|
|
5931
|
+
* Convert <slot name='X'> to <!-- ko slot: 'X' --><!-- /ko -->
|
|
5932
|
+
* @param {HTMLElement} node
|
|
5933
|
+
*/
|
|
5725
5934
|
preprocessNode(node) {
|
|
5726
5935
|
if (node.tagName === "SLOT") {
|
|
5727
5936
|
const parent = node.parentNode;
|
|
@@ -6003,6 +6212,7 @@ ${name} ${msg} of
|
|
|
6003
6212
|
get FOR_NODE_TYPES() {
|
|
6004
6213
|
return [1];
|
|
6005
6214
|
}
|
|
6215
|
+
// document.ELEMENT_NODE
|
|
6006
6216
|
constructor(params = {}) {
|
|
6007
6217
|
super(params);
|
|
6008
6218
|
this.ATTRIBUTES_TO_SKIP = new Set(params.attributesToSkip || ["data-bind"]);
|
|
@@ -6065,6 +6275,7 @@ ${name} ${msg} of
|
|
|
6065
6275
|
get FOR_NODE_TYPES() {
|
|
6066
6276
|
return [3];
|
|
6067
6277
|
}
|
|
6278
|
+
// document.TEXT_NODE
|
|
6068
6279
|
*textToNodes(textNode) {
|
|
6069
6280
|
const parent = textNode.parentNode;
|
|
6070
6281
|
const isTextarea = parent && parent.nodeName === "TEXTAREA";
|
|
@@ -6091,6 +6302,17 @@ ${name} ${msg} of
|
|
|
6091
6302
|
}
|
|
6092
6303
|
return newNodes;
|
|
6093
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
|
+
*/
|
|
6094
6316
|
preprocessNode(node) {
|
|
6095
6317
|
return this.textInterpolation(node);
|
|
6096
6318
|
}
|
|
@@ -8112,6 +8334,8 @@ ${name} ${msg} of
|
|
|
8112
8334
|
};
|
|
8113
8335
|
|
|
8114
8336
|
// src/index.ts
|
|
8337
|
+
overloadOperator("==", (a, b) => a === b);
|
|
8338
|
+
overloadOperator("!=", (a, b) => a !== b);
|
|
8115
8339
|
var builder = new Builder({
|
|
8116
8340
|
filters,
|
|
8117
8341
|
provider: new MultiProvider({
|
|
@@ -8134,7 +8358,7 @@ ${name} ${msg} of
|
|
|
8134
8358
|
{ each: bindings4.foreach }
|
|
8135
8359
|
]
|
|
8136
8360
|
});
|
|
8137
|
-
var version = "4.0.0-beta1.
|
|
8361
|
+
var version = "4.0.0-beta1.7";
|
|
8138
8362
|
var src_default = builder.create({
|
|
8139
8363
|
jsx: {
|
|
8140
8364
|
createElement,
|