@tko/provider.multi 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MultiProvider.js +4 -1
- package/dist/MultiProvider.js.map +1 -1
- package/dist/index.cjs +11 -1336
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +8 -13
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @tko/provider.multi 🥊 4.0.
|
|
1
|
+
// @tko/provider.multi 🥊 4.0.1 CommonJS
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -8,6 +8,7 @@ var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__P
|
|
|
8
8
|
var __typeError = (msg) => {
|
|
9
9
|
throw TypeError(msg);
|
|
10
10
|
};
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
12
|
var __export = (target, all) => {
|
|
12
13
|
for (var name in all)
|
|
13
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -21,6 +22,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
21
22
|
return to;
|
|
22
23
|
};
|
|
23
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
26
|
var __await = function(promise, isYieldStar) {
|
|
25
27
|
this[0] = promise;
|
|
26
28
|
this[1] = isYieldStar;
|
|
@@ -61,1350 +63,23 @@ __export(index_exports, {
|
|
|
61
63
|
});
|
|
62
64
|
module.exports = __toCommonJS(index_exports);
|
|
63
65
|
|
|
64
|
-
// ../utils/dist/array.js
|
|
65
|
-
var { isArray } = Array;
|
|
66
|
-
function arrayForEach(array, action, actionOwner) {
|
|
67
|
-
if (arguments.length > 2) {
|
|
68
|
-
action = action.bind(actionOwner);
|
|
69
|
-
}
|
|
70
|
-
for (let i = 0, j = array.length; i < j; ++i) {
|
|
71
|
-
action(array[i], i, array);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function arrayIndexOf(array, item) {
|
|
75
|
-
return (isArray(array) ? array : [...array]).indexOf(item);
|
|
76
|
-
}
|
|
77
|
-
function arrayRemoveItem(array, itemToRemove) {
|
|
78
|
-
const index = arrayIndexOf(array, itemToRemove);
|
|
79
|
-
if (index > 0) {
|
|
80
|
-
array.splice(index, 1);
|
|
81
|
-
} else if (index === 0) {
|
|
82
|
-
array.shift();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function findMovesInArrayComparison(left, right, limitFailedCompares) {
|
|
86
|
-
if (left.length && right.length) {
|
|
87
|
-
let failedCompares, l, r, leftItem, rightItem;
|
|
88
|
-
for (failedCompares = l = 0; (!limitFailedCompares || failedCompares < limitFailedCompares) && (leftItem = left[l]); ++l) {
|
|
89
|
-
for (r = 0; rightItem = right[r]; ++r) {
|
|
90
|
-
if (leftItem.value === rightItem.value) {
|
|
91
|
-
leftItem.moved = rightItem.index;
|
|
92
|
-
rightItem.moved = leftItem.index;
|
|
93
|
-
right.splice(r, 1);
|
|
94
|
-
failedCompares = r = 0;
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
failedCompares += r;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
var statusNotInOld = "added";
|
|
103
|
-
var statusNotInNew = "deleted";
|
|
104
|
-
function compareArrays(oldArray, newArray, options2) {
|
|
105
|
-
options2 = typeof options2 === "boolean" ? { dontLimitMoves: options2 } : options2 || {};
|
|
106
|
-
oldArray = oldArray || [];
|
|
107
|
-
newArray = newArray || [];
|
|
108
|
-
if (oldArray.length < newArray.length) {
|
|
109
|
-
return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew, options2);
|
|
110
|
-
} else {
|
|
111
|
-
return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld, options2);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function compareSmallArrayToBigArray(smlArray, bigArray, statusNotInSml, statusNotInBig, options2) {
|
|
115
|
-
let myMin = Math.min, myMax = Math.max, editDistanceMatrix = new Array(), smlIndex, smlIndexMax = smlArray.length, bigIndex, bigIndexMax = bigArray.length, compareRange = bigIndexMax - smlIndexMax || 1, maxDistance = smlIndexMax + bigIndexMax + 1, thisRow, lastRow, bigIndexMaxForRow, bigIndexMinForRow;
|
|
116
|
-
for (smlIndex = 0; smlIndex <= smlIndexMax; smlIndex++) {
|
|
117
|
-
lastRow = thisRow;
|
|
118
|
-
editDistanceMatrix.push(thisRow = new Array());
|
|
119
|
-
bigIndexMaxForRow = myMin(bigIndexMax, smlIndex + compareRange);
|
|
120
|
-
bigIndexMinForRow = myMax(0, smlIndex - 1);
|
|
121
|
-
for (bigIndex = bigIndexMinForRow; bigIndex <= bigIndexMaxForRow; bigIndex++) {
|
|
122
|
-
if (!bigIndex) {
|
|
123
|
-
thisRow[bigIndex] = smlIndex + 1;
|
|
124
|
-
} else if (!smlIndex) {
|
|
125
|
-
thisRow[bigIndex] = bigIndex + 1;
|
|
126
|
-
} else if (smlArray[smlIndex - 1] === bigArray[bigIndex - 1]) {
|
|
127
|
-
thisRow[bigIndex] = lastRow[bigIndex - 1];
|
|
128
|
-
} else {
|
|
129
|
-
const northDistance = lastRow[bigIndex] || maxDistance;
|
|
130
|
-
const westDistance = thisRow[bigIndex - 1] || maxDistance;
|
|
131
|
-
thisRow[bigIndex] = myMin(northDistance, westDistance) + 1;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
let editScript = new Array(), meMinusOne, notInSml = new Array(), notInBig = new Array();
|
|
136
|
-
for (smlIndex = smlIndexMax, bigIndex = bigIndexMax; smlIndex || bigIndex; ) {
|
|
137
|
-
meMinusOne = editDistanceMatrix[smlIndex][bigIndex] - 1;
|
|
138
|
-
if (bigIndex && meMinusOne === editDistanceMatrix[smlIndex][bigIndex - 1]) {
|
|
139
|
-
notInSml.push(
|
|
140
|
-
editScript[editScript.length] = {
|
|
141
|
-
// added
|
|
142
|
-
status: statusNotInSml,
|
|
143
|
-
value: bigArray[--bigIndex],
|
|
144
|
-
index: bigIndex
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
} else if (smlIndex && meMinusOne === editDistanceMatrix[smlIndex - 1][bigIndex]) {
|
|
148
|
-
notInBig.push(
|
|
149
|
-
editScript[editScript.length] = {
|
|
150
|
-
// deleted
|
|
151
|
-
status: statusNotInBig,
|
|
152
|
-
value: smlArray[--smlIndex],
|
|
153
|
-
index: smlIndex
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
} else {
|
|
157
|
-
--bigIndex;
|
|
158
|
-
--smlIndex;
|
|
159
|
-
if (!(options2 == null ? void 0 : options2.sparse)) {
|
|
160
|
-
editScript.push({ status: "retained", value: bigArray[bigIndex] });
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
findMovesInArrayComparison(notInBig, notInSml, !options2.dontLimitMoves && smlIndexMax * 10);
|
|
165
|
-
return editScript.reverse();
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// ../utils/dist/options.js
|
|
169
|
-
var Options = class {
|
|
170
|
-
constructor() {
|
|
171
|
-
this.bindingStringPreparsers = [];
|
|
172
|
-
this.knockoutInstance = null;
|
|
173
|
-
this.deferUpdates = false;
|
|
174
|
-
this.useOnlyNativeEvents = true;
|
|
175
|
-
this.useTemplateTag = true;
|
|
176
|
-
this.protoProperty = "__ko_proto__";
|
|
177
|
-
this.defaultBindingAttribute = "data-bind";
|
|
178
|
-
this.allowVirtualElements = true;
|
|
179
|
-
this.bindingGlobals = /* @__PURE__ */ Object.create(null);
|
|
180
|
-
this.createChildContextWithAs = false;
|
|
181
|
-
this.disableJQueryUsage = false;
|
|
182
|
-
this.Promise = globalThis.Promise;
|
|
183
|
-
this.taskScheduler = null;
|
|
184
|
-
this.debug = false;
|
|
185
|
-
this.templateSizeLimit = 4096;
|
|
186
|
-
this.allowScriptTagsInTemplates = false;
|
|
187
|
-
this._sanitizeWarningLogged = false;
|
|
188
|
-
this.global = globalThis;
|
|
189
|
-
this.document = globalThis.document;
|
|
190
|
-
this.filters = {};
|
|
191
|
-
this.includeDestroyed = false;
|
|
192
|
-
this.foreachHidesDestroyed = false;
|
|
193
|
-
}
|
|
194
|
-
get jQuery() {
|
|
195
|
-
var _a;
|
|
196
|
-
if (this.disableJQueryUsage) return;
|
|
197
|
-
return (_a = this._jQuery) != null ? _a : globalThis.jQuery;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Set jQuery manuall to be used by TKO.
|
|
201
|
-
* @param jQuery If jQuery set to undefined, TKO will not use jQuery and this.disableJQueryUsage to true.
|
|
202
|
-
*/
|
|
203
|
-
set jQuery(jQuery) {
|
|
204
|
-
if (!jQuery) {
|
|
205
|
-
this.disableJQueryUsage = true;
|
|
206
|
-
this._jQuery = void 0;
|
|
207
|
-
} else {
|
|
208
|
-
this._jQuery = jQuery;
|
|
209
|
-
this.disableJQueryUsage = false;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Sanitize HTML templates before parsing them. Default is a no-op.
|
|
214
|
-
* Please configure something like DOMPurify or validator.js for your environment.
|
|
215
|
-
* @param html HTML string to be sanitized
|
|
216
|
-
* @returns Sanitized HTML string
|
|
217
|
-
*/
|
|
218
|
-
sanitizeHtmlTemplate(html) {
|
|
219
|
-
if (!this._sanitizeWarningLogged) {
|
|
220
|
-
console.warn(
|
|
221
|
-
"WARNING -- You don't have a HTML sanitizer configured. Please configure options.sanitizeHtmlTemplate to avoid XSS vulnerabilities."
|
|
222
|
-
);
|
|
223
|
-
this._sanitizeWarningLogged = true;
|
|
224
|
-
}
|
|
225
|
-
return html;
|
|
226
|
-
}
|
|
227
|
-
onError(e, throws = true) {
|
|
228
|
-
if (throws) throw e;
|
|
229
|
-
return e;
|
|
230
|
-
}
|
|
231
|
-
set(name, value) {
|
|
232
|
-
this[name] = value;
|
|
233
|
-
}
|
|
234
|
-
// Overload getBindingHandler to have a custom lookup function.
|
|
235
|
-
getBindingHandler(key) {
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
238
|
-
cleanExternalData(node, callback) {
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
var options = new Options();
|
|
242
|
-
var options_default = options;
|
|
243
|
-
|
|
244
|
-
// ../utils/dist/error.js
|
|
245
|
-
function catchFunctionErrors(delegate) {
|
|
246
|
-
if (!options_default.onError) {
|
|
247
|
-
return delegate;
|
|
248
|
-
}
|
|
249
|
-
return (...args) => {
|
|
250
|
-
try {
|
|
251
|
-
return delegate(...args);
|
|
252
|
-
} catch (err) {
|
|
253
|
-
options_default.onError(err);
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
function deferError(error) {
|
|
258
|
-
safeSetTimeout(function() {
|
|
259
|
-
throw error;
|
|
260
|
-
}, 0);
|
|
261
|
-
}
|
|
262
|
-
function safeSetTimeout(handler, timeout) {
|
|
263
|
-
return setTimeout(catchFunctionErrors(handler), timeout);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// ../utils/dist/async.js
|
|
267
|
-
function throttle(callback, timeout) {
|
|
268
|
-
let timeoutInstance;
|
|
269
|
-
return function(...args) {
|
|
270
|
-
if (!timeoutInstance) {
|
|
271
|
-
timeoutInstance = safeSetTimeout(function() {
|
|
272
|
-
timeoutInstance = void 0;
|
|
273
|
-
callback(...args);
|
|
274
|
-
}, timeout);
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
function debounce(callback, timeout) {
|
|
279
|
-
let timeoutInstance;
|
|
280
|
-
return function(...args) {
|
|
281
|
-
clearTimeout(timeoutInstance);
|
|
282
|
-
timeoutInstance = safeSetTimeout(() => callback(...args), timeout);
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// ../utils/dist/object.js
|
|
287
|
-
function hasOwnProperty(obj, propName) {
|
|
288
|
-
return Object.prototype.hasOwnProperty.call(obj, propName);
|
|
289
|
-
}
|
|
290
|
-
function extend(target, source) {
|
|
291
|
-
if (source) {
|
|
292
|
-
for (const prop of Object.keys(source)) {
|
|
293
|
-
if (hasOwnProperty(source, prop)) {
|
|
294
|
-
;
|
|
295
|
-
target[prop] = source[prop];
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return target;
|
|
300
|
-
}
|
|
301
|
-
function objectForEach(obj, action) {
|
|
302
|
-
for (const prop in obj) {
|
|
303
|
-
if (hasOwnProperty(obj, prop)) {
|
|
304
|
-
action(prop, obj[prop]);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
function objectMap(source, mapping, thisArg) {
|
|
309
|
-
if (!source) {
|
|
310
|
-
return source;
|
|
311
|
-
}
|
|
312
|
-
if (arguments.length > 2) {
|
|
313
|
-
mapping = mapping.bind(thisArg);
|
|
314
|
-
}
|
|
315
|
-
const target = {};
|
|
316
|
-
for (const prop in source) {
|
|
317
|
-
if (hasOwnProperty(source, prop)) {
|
|
318
|
-
target[prop] = mapping(source[prop], prop, source);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return target;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// ../utils/dist/function.js
|
|
325
|
-
function testOverwrite() {
|
|
326
|
-
try {
|
|
327
|
-
Object.defineProperty(function x() {
|
|
328
|
-
}, "length", {});
|
|
329
|
-
return true;
|
|
330
|
-
} catch (e) {
|
|
331
|
-
return false;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
var functionSupportsLengthOverwrite = testOverwrite();
|
|
335
|
-
function overwriteLengthPropertyIfSupported(fn, descriptor) {
|
|
336
|
-
if (functionSupportsLengthOverwrite) {
|
|
337
|
-
Object.defineProperty(fn, "length", descriptor);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
// ../utils/dist/dom/info.js
|
|
342
|
-
function tagNameLower(element) {
|
|
343
|
-
return element && element.tagName && element.tagName.toLowerCase();
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// ../utils/dist/dom/event.js
|
|
347
|
-
var knownEvents = {};
|
|
348
|
-
var knownEventTypesByEventName = {};
|
|
349
|
-
knownEvents["UIEvents"] = ["keyup", "keydown", "keypress"];
|
|
350
|
-
knownEvents["MouseEvents"] = [
|
|
351
|
-
"click",
|
|
352
|
-
"dblclick",
|
|
353
|
-
"mousedown",
|
|
354
|
-
"mouseup",
|
|
355
|
-
"mousemove",
|
|
356
|
-
"mouseover",
|
|
357
|
-
"mouseout",
|
|
358
|
-
"mouseenter",
|
|
359
|
-
"mouseleave"
|
|
360
|
-
];
|
|
361
|
-
objectForEach(knownEvents, function(eventType, knownEventsForType) {
|
|
362
|
-
if (knownEventsForType.length) {
|
|
363
|
-
for (let i = 0, j = knownEventsForType.length; i < j; i++) {
|
|
364
|
-
knownEventTypesByEventName[knownEventsForType[i]] = eventType;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
// ../utils/dist/dom/data.js
|
|
370
|
-
var datastoreTime = (/* @__PURE__ */ new Date()).getTime();
|
|
371
|
-
var dataStoreKeyExpandoPropertyName = `__ko__${datastoreTime}`;
|
|
372
|
-
var dataStoreSymbol = /* @__PURE__ */ Symbol("Knockout data");
|
|
373
|
-
var uniqueId = 0;
|
|
374
|
-
function isSafeKey(key) {
|
|
375
|
-
return key !== "__proto__" && key !== "constructor" && key !== "prototype";
|
|
376
|
-
}
|
|
377
|
-
function getDataForNode(node, createIfNotFound) {
|
|
378
|
-
let dataForNode = node[dataStoreSymbol];
|
|
379
|
-
if (!dataForNode && createIfNotFound) {
|
|
380
|
-
dataForNode = node[dataStoreSymbol] = {};
|
|
381
|
-
}
|
|
382
|
-
return dataForNode;
|
|
383
|
-
}
|
|
384
|
-
function nextKey() {
|
|
385
|
-
return uniqueId++ + dataStoreKeyExpandoPropertyName;
|
|
386
|
-
}
|
|
387
|
-
function get(node, key) {
|
|
388
|
-
if (!isSafeKey(key)) throw new Error("Unsafe key for DOM data: " + key);
|
|
389
|
-
const dataForNode = getDataForNode(node, false);
|
|
390
|
-
return dataForNode && dataForNode[key];
|
|
391
|
-
}
|
|
392
|
-
function set(node, key, value) {
|
|
393
|
-
if (!isSafeKey(key)) throw new Error("Unsafe key for DOM data: " + key);
|
|
394
|
-
const dataForNode = getDataForNode(
|
|
395
|
-
node,
|
|
396
|
-
value !== void 0
|
|
397
|
-
/* createIfNotFound */
|
|
398
|
-
);
|
|
399
|
-
if (dataForNode) {
|
|
400
|
-
dataForNode[key] = value;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
// ../utils/dist/dom/disposal.js
|
|
405
|
-
var domDataKey = nextKey();
|
|
406
|
-
function getDisposeCallbacksCollection(node, createIfNotFound) {
|
|
407
|
-
let allDisposeCallbacks = get(node, domDataKey);
|
|
408
|
-
if (allDisposeCallbacks === void 0 && createIfNotFound) {
|
|
409
|
-
allDisposeCallbacks = new Array();
|
|
410
|
-
set(node, domDataKey, allDisposeCallbacks);
|
|
411
|
-
}
|
|
412
|
-
return allDisposeCallbacks;
|
|
413
|
-
}
|
|
414
|
-
function destroyCallbacksCollection(node) {
|
|
415
|
-
set(node, domDataKey, void 0);
|
|
416
|
-
}
|
|
417
|
-
function addDisposeCallback(node, callback) {
|
|
418
|
-
if (typeof callback !== "function") {
|
|
419
|
-
throw new Error("Callback must be a function");
|
|
420
|
-
}
|
|
421
|
-
getDisposeCallbacksCollection(node, true).push(callback);
|
|
422
|
-
}
|
|
423
|
-
function removeDisposeCallback(node, callback) {
|
|
424
|
-
const callbacksCollection = getDisposeCallbacksCollection(node, false);
|
|
425
|
-
if (callbacksCollection) {
|
|
426
|
-
arrayRemoveItem(callbacksCollection, callback);
|
|
427
|
-
if (callbacksCollection.length === 0) {
|
|
428
|
-
destroyCallbacksCollection(node);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
var otherNodeCleanerFunctions = new Array();
|
|
433
|
-
function cleanjQueryData(node) {
|
|
434
|
-
const jQueryCleanNodeFn = options_default.jQuery ? options_default.jQuery.cleanData : null;
|
|
435
|
-
if (jQueryCleanNodeFn) {
|
|
436
|
-
jQueryCleanNodeFn([node]);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
otherNodeCleanerFunctions.push(cleanjQueryData);
|
|
440
|
-
|
|
441
|
-
// ../utils/dist/dom/html.js
|
|
442
|
-
var supportsTemplateTag = options_default.useTemplateTag && options_default.document && "content" in options_default.document.createElement("template");
|
|
443
|
-
|
|
444
|
-
// ../utils/dist/dom/selectExtensions.js
|
|
445
|
-
var hasDomDataExpandoProperty = /* @__PURE__ */ Symbol("Knockout selectExtensions hasDomDataProperty");
|
|
446
|
-
var selectExtensions = {
|
|
447
|
-
optionValueDomDataKey: nextKey(),
|
|
448
|
-
readValue: function(element) {
|
|
449
|
-
switch (tagNameLower(element)) {
|
|
450
|
-
case "option": {
|
|
451
|
-
if (element[hasDomDataExpandoProperty] === true) {
|
|
452
|
-
return get(element, selectExtensions.optionValueDomDataKey);
|
|
453
|
-
}
|
|
454
|
-
return element.value;
|
|
455
|
-
}
|
|
456
|
-
case "select": {
|
|
457
|
-
const selectElement = element;
|
|
458
|
-
return selectElement.selectedIndex >= 0 ? selectExtensions.readValue(selectElement.options[selectElement.selectedIndex]) : void 0;
|
|
459
|
-
}
|
|
460
|
-
default:
|
|
461
|
-
return element.value;
|
|
462
|
-
}
|
|
463
|
-
},
|
|
464
|
-
writeValue: function(element, value, allowUnset) {
|
|
465
|
-
switch (tagNameLower(element)) {
|
|
466
|
-
case "option":
|
|
467
|
-
if (typeof value === "string") {
|
|
468
|
-
set(element, selectExtensions.optionValueDomDataKey, void 0);
|
|
469
|
-
if (hasDomDataExpandoProperty in element) {
|
|
470
|
-
delete element[hasDomDataExpandoProperty];
|
|
471
|
-
}
|
|
472
|
-
;
|
|
473
|
-
element.value = value;
|
|
474
|
-
} else {
|
|
475
|
-
const el = element;
|
|
476
|
-
set(element, selectExtensions.optionValueDomDataKey, value);
|
|
477
|
-
el[hasDomDataExpandoProperty] = true;
|
|
478
|
-
el.value = typeof value === "number" ? value : "";
|
|
479
|
-
}
|
|
480
|
-
break;
|
|
481
|
-
case "select":
|
|
482
|
-
{
|
|
483
|
-
if (value === "" || value === null) {
|
|
484
|
-
value = void 0;
|
|
485
|
-
}
|
|
486
|
-
let selection = -1;
|
|
487
|
-
const selectElement = element;
|
|
488
|
-
for (let i = 0, n = selectElement.options.length, optionValue; i < n; ++i) {
|
|
489
|
-
optionValue = selectExtensions.readValue(selectElement.options[i]);
|
|
490
|
-
const strictEqual = optionValue === value;
|
|
491
|
-
const blankEqual = optionValue === "" && value === void 0;
|
|
492
|
-
const numericEqual = typeof value === "number" && Number(optionValue) === value;
|
|
493
|
-
if (strictEqual || blankEqual || numericEqual) {
|
|
494
|
-
selection = i;
|
|
495
|
-
break;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
if (allowUnset || selection >= 0 || value === void 0 && selectElement.size > 1) {
|
|
499
|
-
selectElement.selectedIndex = selection;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
break;
|
|
503
|
-
default:
|
|
504
|
-
if (value === null || value === void 0) {
|
|
505
|
-
value = "";
|
|
506
|
-
}
|
|
507
|
-
;
|
|
508
|
-
element.value = value;
|
|
509
|
-
break;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
};
|
|
513
|
-
|
|
514
|
-
// ../utils/dist/tasks.js
|
|
515
|
-
var tasks_exports = {};
|
|
516
|
-
__export(tasks_exports, {
|
|
517
|
-
cancel: () => cancel,
|
|
518
|
-
resetForTesting: () => resetForTesting,
|
|
519
|
-
runEarly: () => processTasks,
|
|
520
|
-
schedule: () => schedule
|
|
521
|
-
});
|
|
522
|
-
var taskQueue = new Array();
|
|
523
|
-
var taskQueueLength = 0;
|
|
524
|
-
var nextHandle = 1;
|
|
525
|
-
var nextIndexToProcess = 0;
|
|
526
|
-
var w = options_default.global;
|
|
527
|
-
if (w && w.MutationObserver && !(w.navigator && w.navigator.standalone)) {
|
|
528
|
-
options_default.taskScheduler = (function(callback) {
|
|
529
|
-
const div = w.document.createElement("div");
|
|
530
|
-
new w.MutationObserver(callback).observe(div, { attributes: true });
|
|
531
|
-
return function() {
|
|
532
|
-
div.classList.toggle("foo");
|
|
533
|
-
};
|
|
534
|
-
})(scheduledProcess);
|
|
535
|
-
} else {
|
|
536
|
-
options_default.taskScheduler = function(callback) {
|
|
537
|
-
setTimeout(callback, 0);
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
function processTasks() {
|
|
541
|
-
if (taskQueueLength) {
|
|
542
|
-
let mark = taskQueueLength, countMarks = 0;
|
|
543
|
-
for (let task; nextIndexToProcess < taskQueueLength; ) {
|
|
544
|
-
if (task = taskQueue[nextIndexToProcess++]) {
|
|
545
|
-
if (nextIndexToProcess > mark) {
|
|
546
|
-
if (++countMarks >= 5e3) {
|
|
547
|
-
nextIndexToProcess = taskQueueLength;
|
|
548
|
-
deferError(Error("'Too much recursion' after processing " + countMarks + " task groups."));
|
|
549
|
-
break;
|
|
550
|
-
}
|
|
551
|
-
mark = taskQueueLength;
|
|
552
|
-
}
|
|
553
|
-
try {
|
|
554
|
-
task();
|
|
555
|
-
} catch (ex) {
|
|
556
|
-
deferError(ex);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
function scheduledProcess() {
|
|
563
|
-
processTasks();
|
|
564
|
-
nextIndexToProcess = taskQueueLength = taskQueue.length = 0;
|
|
565
|
-
}
|
|
566
|
-
function scheduleTaskProcessing() {
|
|
567
|
-
options_default.taskScheduler(scheduledProcess);
|
|
568
|
-
}
|
|
569
|
-
function schedule(func) {
|
|
570
|
-
if (!taskQueueLength) {
|
|
571
|
-
scheduleTaskProcessing();
|
|
572
|
-
}
|
|
573
|
-
taskQueue[taskQueueLength++] = func;
|
|
574
|
-
return nextHandle++;
|
|
575
|
-
}
|
|
576
|
-
function cancel(handle) {
|
|
577
|
-
const index = handle - (nextHandle - taskQueueLength);
|
|
578
|
-
if (index >= nextIndexToProcess && index < taskQueueLength) {
|
|
579
|
-
taskQueue[index] = null;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
function resetForTesting() {
|
|
583
|
-
const length = taskQueueLength - nextIndexToProcess;
|
|
584
|
-
nextIndexToProcess = taskQueueLength = taskQueue.length = 0;
|
|
585
|
-
return length;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
// ../observable/dist/dependencyDetection.js
|
|
589
|
-
var dependencyDetection_exports = {};
|
|
590
|
-
__export(dependencyDetection_exports, {
|
|
591
|
-
begin: () => begin,
|
|
592
|
-
end: () => end,
|
|
593
|
-
getDependencies: () => getDependencies,
|
|
594
|
-
getDependenciesCount: () => getDependenciesCount,
|
|
595
|
-
ignore: () => ignore,
|
|
596
|
-
ignoreDependencies: () => ignore,
|
|
597
|
-
isInitial: () => isInitial,
|
|
598
|
-
registerDependency: () => registerDependency
|
|
599
|
-
});
|
|
600
|
-
|
|
601
|
-
// ../observable/dist/subscribableSymbol.js
|
|
602
|
-
var SUBSCRIBABLE_SYM = /* @__PURE__ */ Symbol("Knockout Subscribable");
|
|
603
|
-
function isSubscribable(instance) {
|
|
604
|
-
return instance && instance[SUBSCRIBABLE_SYM] || false;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
// ../observable/dist/dependencyDetection.js
|
|
608
|
-
var outerFrames = new Array();
|
|
609
|
-
var currentFrame;
|
|
610
|
-
var lastId = 0;
|
|
611
|
-
function getId() {
|
|
612
|
-
return ++lastId;
|
|
613
|
-
}
|
|
614
|
-
function begin(options2) {
|
|
615
|
-
outerFrames.push(currentFrame);
|
|
616
|
-
currentFrame = options2;
|
|
617
|
-
}
|
|
618
|
-
function end() {
|
|
619
|
-
currentFrame = outerFrames.pop();
|
|
620
|
-
}
|
|
621
|
-
function registerDependency(subscribable2) {
|
|
622
|
-
if (currentFrame) {
|
|
623
|
-
if (!isSubscribable(subscribable2)) {
|
|
624
|
-
throw new Error("Only subscribable things can act as dependencies");
|
|
625
|
-
}
|
|
626
|
-
currentFrame.callback.call(
|
|
627
|
-
currentFrame.callbackTarget,
|
|
628
|
-
subscribable2,
|
|
629
|
-
subscribable2._id || (subscribable2._id = getId())
|
|
630
|
-
);
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
function ignore(callback, callbackTarget, callbackArgs) {
|
|
634
|
-
try {
|
|
635
|
-
begin();
|
|
636
|
-
return callback.apply(callbackTarget, callbackArgs || []);
|
|
637
|
-
} finally {
|
|
638
|
-
end();
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
function getDependenciesCount() {
|
|
642
|
-
if (currentFrame) {
|
|
643
|
-
return currentFrame.computed.getDependenciesCount();
|
|
644
|
-
}
|
|
645
|
-
return void 0;
|
|
646
|
-
}
|
|
647
|
-
function getDependencies() {
|
|
648
|
-
if (currentFrame) {
|
|
649
|
-
return currentFrame.computed.getDependencies();
|
|
650
|
-
}
|
|
651
|
-
return void 0;
|
|
652
|
-
}
|
|
653
|
-
function isInitial() {
|
|
654
|
-
if (currentFrame) {
|
|
655
|
-
return currentFrame.isInitial;
|
|
656
|
-
}
|
|
657
|
-
return void 0;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
// ../observable/dist/defer.js
|
|
661
|
-
function deferUpdates(target) {
|
|
662
|
-
if (target._deferUpdates) {
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
target._deferUpdates = true;
|
|
666
|
-
target.limit(function(callback) {
|
|
667
|
-
let handle;
|
|
668
|
-
let ignoreUpdates = false;
|
|
669
|
-
return function() {
|
|
670
|
-
if (!ignoreUpdates) {
|
|
671
|
-
tasks_exports.cancel(handle);
|
|
672
|
-
handle = tasks_exports.schedule(callback);
|
|
673
|
-
try {
|
|
674
|
-
ignoreUpdates = true;
|
|
675
|
-
target.notifySubscribers(void 0, "dirty");
|
|
676
|
-
} finally {
|
|
677
|
-
ignoreUpdates = false;
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
|
-
});
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
// ../observable/dist/Subscription.js
|
|
685
|
-
var Subscription = class {
|
|
686
|
-
constructor(target, observer, disposeCallback) {
|
|
687
|
-
this._target = target;
|
|
688
|
-
this._callback = observer.next;
|
|
689
|
-
this._disposeCallback = disposeCallback;
|
|
690
|
-
this._isDisposed = false;
|
|
691
|
-
this._domNodeDisposalCallback = null;
|
|
692
|
-
}
|
|
693
|
-
dispose() {
|
|
694
|
-
if (this._domNodeDisposalCallback) {
|
|
695
|
-
removeDisposeCallback(this._node, this._domNodeDisposalCallback);
|
|
696
|
-
}
|
|
697
|
-
this._isDisposed = true;
|
|
698
|
-
this._disposeCallback();
|
|
699
|
-
}
|
|
700
|
-
disposeWhenNodeIsRemoved(node) {
|
|
701
|
-
this._node = node;
|
|
702
|
-
addDisposeCallback(node, this._domNodeDisposalCallback = this.dispose.bind(this));
|
|
703
|
-
}
|
|
704
|
-
// TC39 Observable API
|
|
705
|
-
unsubscribe() {
|
|
706
|
-
this.dispose();
|
|
707
|
-
}
|
|
708
|
-
get closed() {
|
|
709
|
-
return this._isDisposed;
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
|
|
713
|
-
// ../observable/dist/extenders.js
|
|
714
|
-
var primitiveTypes = { undefined: 1, boolean: 1, number: 1, string: 1 };
|
|
715
|
-
function valuesArePrimitiveAndEqual(a, b) {
|
|
716
|
-
const oldValueIsPrimitive = a === null || typeof a in primitiveTypes;
|
|
717
|
-
return oldValueIsPrimitive ? a === b : false;
|
|
718
|
-
}
|
|
719
|
-
function applyExtenders(requestedExtenders) {
|
|
720
|
-
let target = this;
|
|
721
|
-
if (requestedExtenders) {
|
|
722
|
-
objectForEach(requestedExtenders, function(key, value) {
|
|
723
|
-
const extenderHandler = extenders[key];
|
|
724
|
-
if (typeof extenderHandler === "function") {
|
|
725
|
-
target = extenderHandler(target, value) || target;
|
|
726
|
-
} else {
|
|
727
|
-
options_default.onError(new Error("Extender not found: " + key));
|
|
728
|
-
}
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
return target;
|
|
732
|
-
}
|
|
733
|
-
function notify(target, notifyWhen) {
|
|
734
|
-
target.equalityComparer = notifyWhen == "always" ? null : valuesArePrimitiveAndEqual;
|
|
735
|
-
}
|
|
736
|
-
function deferred(target, option) {
|
|
737
|
-
if (option !== true) {
|
|
738
|
-
throw new Error(
|
|
739
|
-
"The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled."
|
|
740
|
-
);
|
|
741
|
-
}
|
|
742
|
-
deferUpdates(target);
|
|
743
|
-
}
|
|
744
|
-
function rateLimit(target, options2) {
|
|
745
|
-
let timeout, method, limitFunction;
|
|
746
|
-
if (typeof options2 === "number") {
|
|
747
|
-
timeout = options2;
|
|
748
|
-
} else {
|
|
749
|
-
timeout = options2.timeout;
|
|
750
|
-
method = options2.method;
|
|
751
|
-
}
|
|
752
|
-
target._deferUpdates = false;
|
|
753
|
-
limitFunction = method === "notifyWhenChangesStop" ? debounce : throttle;
|
|
754
|
-
target.limit(function(callback) {
|
|
755
|
-
return limitFunction(callback, timeout);
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
var extenders = { notify, deferred, rateLimit };
|
|
759
|
-
|
|
760
|
-
// ../observable/dist/subscribable.js
|
|
761
|
-
var LATEST_VALUE = /* @__PURE__ */ Symbol("Knockout latest value");
|
|
762
|
-
if (!Symbol.observable) {
|
|
763
|
-
Symbol.observable = /* @__PURE__ */ Symbol.for("@tko/Symbol.observable");
|
|
764
|
-
}
|
|
765
|
-
var subscribable = function subscribableFactory() {
|
|
766
|
-
Object.setPrototypeOf(this, ko_subscribable_fn);
|
|
767
|
-
ko_subscribable_fn.init(this);
|
|
768
|
-
};
|
|
769
|
-
var defaultEvent = "change";
|
|
770
|
-
var ko_subscribable_fn = {
|
|
771
|
-
[SUBSCRIBABLE_SYM]: true,
|
|
772
|
-
[Symbol.observable]() {
|
|
773
|
-
return this;
|
|
774
|
-
},
|
|
775
|
-
init(instance) {
|
|
776
|
-
instance._subscriptions = { change: [] };
|
|
777
|
-
instance._versionNumber = 1;
|
|
778
|
-
},
|
|
779
|
-
subscribe(callback, callbackTarget, event) {
|
|
780
|
-
const isTC39Callback = typeof callback === "object" && callback.next;
|
|
781
|
-
event = event || defaultEvent;
|
|
782
|
-
const observer = isTC39Callback ? callback : { next: callbackTarget ? callback.bind(callbackTarget) : callback };
|
|
783
|
-
const subscriptionInstance = new Subscription(this, observer, () => {
|
|
784
|
-
arrayRemoveItem(this._subscriptions[event], subscriptionInstance);
|
|
785
|
-
if (this.afterSubscriptionRemove) {
|
|
786
|
-
this.afterSubscriptionRemove(event);
|
|
787
|
-
}
|
|
788
|
-
});
|
|
789
|
-
if (this.beforeSubscriptionAdd) {
|
|
790
|
-
this.beforeSubscriptionAdd(event);
|
|
791
|
-
}
|
|
792
|
-
if (!this._subscriptions[event]) {
|
|
793
|
-
this._subscriptions[event] = new Array();
|
|
794
|
-
}
|
|
795
|
-
this._subscriptions[event].push(subscriptionInstance);
|
|
796
|
-
if (isTC39Callback && LATEST_VALUE in this) {
|
|
797
|
-
observer.next(this[LATEST_VALUE]);
|
|
798
|
-
}
|
|
799
|
-
return subscriptionInstance;
|
|
800
|
-
},
|
|
801
|
-
notifySubscribers(valueToNotify, event) {
|
|
802
|
-
event = event || defaultEvent;
|
|
803
|
-
if (event === defaultEvent) {
|
|
804
|
-
this.updateVersion();
|
|
805
|
-
}
|
|
806
|
-
if (this.hasSubscriptionsForEvent(event)) {
|
|
807
|
-
const subs = event === defaultEvent && this._changeSubscriptions || [...this._subscriptions[event]];
|
|
808
|
-
try {
|
|
809
|
-
begin();
|
|
810
|
-
for (let i = 0, subscriptionInstance; subscriptionInstance = subs[i]; ++i) {
|
|
811
|
-
if (!subscriptionInstance._isDisposed) {
|
|
812
|
-
subscriptionInstance._callback(valueToNotify);
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
} finally {
|
|
816
|
-
end();
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
},
|
|
820
|
-
getVersion() {
|
|
821
|
-
return this._versionNumber;
|
|
822
|
-
},
|
|
823
|
-
hasChanged(versionToCheck) {
|
|
824
|
-
return this.getVersion() !== versionToCheck;
|
|
825
|
-
},
|
|
826
|
-
updateVersion() {
|
|
827
|
-
++this._versionNumber;
|
|
828
|
-
},
|
|
829
|
-
hasSubscriptionsForEvent(event) {
|
|
830
|
-
return this._subscriptions[event] && this._subscriptions[event].length;
|
|
831
|
-
},
|
|
832
|
-
getSubscriptionsCount(event) {
|
|
833
|
-
if (event) {
|
|
834
|
-
return this._subscriptions[event] && this._subscriptions[event].length || 0;
|
|
835
|
-
} else {
|
|
836
|
-
let total = 0;
|
|
837
|
-
objectForEach(this._subscriptions, function(eventName, subscriptions) {
|
|
838
|
-
if (eventName !== "dirty") {
|
|
839
|
-
total += subscriptions.length;
|
|
840
|
-
}
|
|
841
|
-
});
|
|
842
|
-
return total;
|
|
843
|
-
}
|
|
844
|
-
},
|
|
845
|
-
isDifferent(oldValue, newValue) {
|
|
846
|
-
return !this.equalityComparer || !this.equalityComparer(oldValue, newValue);
|
|
847
|
-
},
|
|
848
|
-
once(cb) {
|
|
849
|
-
const subs = this.subscribe((nv) => {
|
|
850
|
-
subs.dispose();
|
|
851
|
-
cb(nv);
|
|
852
|
-
});
|
|
853
|
-
},
|
|
854
|
-
when(test, returnValue) {
|
|
855
|
-
const current = this.peek();
|
|
856
|
-
const givenRv = arguments.length > 1;
|
|
857
|
-
const testFn = typeof test === "function" ? test : (v) => v === test;
|
|
858
|
-
if (testFn(current)) {
|
|
859
|
-
return options_default.Promise.resolve(givenRv ? returnValue : current);
|
|
860
|
-
}
|
|
861
|
-
return new options_default.Promise((resolve, reject) => {
|
|
862
|
-
const subs = this.subscribe((newValue) => {
|
|
863
|
-
if (testFn(newValue)) {
|
|
864
|
-
subs.dispose();
|
|
865
|
-
resolve(givenRv ? returnValue : newValue);
|
|
866
|
-
}
|
|
867
|
-
});
|
|
868
|
-
});
|
|
869
|
-
},
|
|
870
|
-
yet(test, ...args) {
|
|
871
|
-
const testFn = typeof test === "function" ? test : (v) => v === test;
|
|
872
|
-
const negated = (v) => !testFn(v);
|
|
873
|
-
return this.when(negated, ...args);
|
|
874
|
-
},
|
|
875
|
-
next() {
|
|
876
|
-
return new Promise((resolve) => this.once(resolve));
|
|
877
|
-
},
|
|
878
|
-
toString() {
|
|
879
|
-
return "[object Object]";
|
|
880
|
-
},
|
|
881
|
-
extend: applyExtenders
|
|
882
|
-
};
|
|
883
|
-
Object.setPrototypeOf(ko_subscribable_fn, Function.prototype);
|
|
884
|
-
subscribable.fn = ko_subscribable_fn;
|
|
885
|
-
|
|
886
|
-
// ../observable/dist/observable.js
|
|
887
|
-
function observable(initialValue) {
|
|
888
|
-
function Observable() {
|
|
889
|
-
if (arguments.length > 0) {
|
|
890
|
-
if (Observable.isDifferent(Observable[LATEST_VALUE], arguments[0])) {
|
|
891
|
-
;
|
|
892
|
-
Observable.valueWillMutate();
|
|
893
|
-
Observable[LATEST_VALUE] = arguments[0];
|
|
894
|
-
Observable.valueHasMutated();
|
|
895
|
-
}
|
|
896
|
-
return this;
|
|
897
|
-
} else {
|
|
898
|
-
registerDependency(Observable);
|
|
899
|
-
return Observable[LATEST_VALUE];
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
overwriteLengthPropertyIfSupported(Observable, { value: void 0 });
|
|
903
|
-
Observable[LATEST_VALUE] = initialValue;
|
|
904
|
-
subscribable.fn.init(Observable);
|
|
905
|
-
Object.setPrototypeOf(Observable, observable.fn);
|
|
906
|
-
if (options_default.deferUpdates) {
|
|
907
|
-
deferUpdates(Observable);
|
|
908
|
-
}
|
|
909
|
-
return Observable;
|
|
910
|
-
}
|
|
911
|
-
observable.fn = {
|
|
912
|
-
/**
|
|
913
|
-
* Compares two values for equality.
|
|
914
|
-
* @param a The first value.
|
|
915
|
-
* @param b The second value.
|
|
916
|
-
* @returns True if the values are equal, otherwise false.
|
|
917
|
-
*/
|
|
918
|
-
equalityComparer: valuesArePrimitiveAndEqual,
|
|
919
|
-
/**
|
|
920
|
-
* Returns the current value of the observable without creating a dependency.
|
|
921
|
-
* @returns The current value.
|
|
922
|
-
*/
|
|
923
|
-
peek() {
|
|
924
|
-
return this[LATEST_VALUE];
|
|
925
|
-
},
|
|
926
|
-
/**
|
|
927
|
-
* Notifies subscribers that the value has changed.
|
|
928
|
-
*/
|
|
929
|
-
valueHasMutated() {
|
|
930
|
-
this.notifySubscribers(this[LATEST_VALUE], "spectate");
|
|
931
|
-
this.notifySubscribers(this[LATEST_VALUE]);
|
|
932
|
-
},
|
|
933
|
-
/**
|
|
934
|
-
* Notifies subscribers that the value is about to change.
|
|
935
|
-
*/
|
|
936
|
-
valueWillMutate() {
|
|
937
|
-
this.notifySubscribers(this[LATEST_VALUE], "beforeChange");
|
|
938
|
-
},
|
|
939
|
-
/**
|
|
940
|
-
* Modifies the value of the observable using a function.
|
|
941
|
-
* @param fn The function to modify the value.
|
|
942
|
-
* @param peek Whether to use the current value without creating a dependency.
|
|
943
|
-
* @returns The modified observable.
|
|
944
|
-
*/
|
|
945
|
-
modify(fn, peek2 = true) {
|
|
946
|
-
this(fn(peek2 ? this.peek() : this()));
|
|
947
|
-
},
|
|
948
|
-
// Some observables may not always be writeable, notably computeds.
|
|
949
|
-
isWriteable: true
|
|
950
|
-
};
|
|
951
|
-
function limitNotifySubscribers(value, event) {
|
|
952
|
-
if (!event || event === defaultEvent) {
|
|
953
|
-
this._limitChange(value);
|
|
954
|
-
} else if (event === "beforeChange") {
|
|
955
|
-
this._limitBeforeChange(value);
|
|
956
|
-
} else {
|
|
957
|
-
this._origNotifySubscribers(value, event);
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
subscribable.fn.limit = function limit(limitFunction) {
|
|
961
|
-
const self = this;
|
|
962
|
-
const selfIsObservable = isObservable(self);
|
|
963
|
-
const beforeChange = "beforeChange";
|
|
964
|
-
let ignoreBeforeChange, notifyNextChange, previousValue, pendingValue, didUpdate;
|
|
965
|
-
if (!self._origNotifySubscribers) {
|
|
966
|
-
self._origNotifySubscribers = self.notifySubscribers;
|
|
967
|
-
self.notifySubscribers = limitNotifySubscribers;
|
|
968
|
-
}
|
|
969
|
-
const finish = limitFunction(function() {
|
|
970
|
-
self._notificationIsPending = false;
|
|
971
|
-
if (selfIsObservable && pendingValue === self) {
|
|
972
|
-
pendingValue = self._evalIfChanged ? self._evalIfChanged() : self();
|
|
973
|
-
}
|
|
974
|
-
const shouldNotify = notifyNextChange || didUpdate && self.isDifferent(previousValue, pendingValue);
|
|
975
|
-
self._notifyNextChange = didUpdate = ignoreBeforeChange = false;
|
|
976
|
-
if (shouldNotify) {
|
|
977
|
-
self._origNotifySubscribers(previousValue = pendingValue);
|
|
978
|
-
}
|
|
979
|
-
});
|
|
980
|
-
Object.assign(self, {
|
|
981
|
-
_limitChange(value, isDirty) {
|
|
982
|
-
if (!isDirty || !self._notificationIsPending) {
|
|
983
|
-
didUpdate = !isDirty;
|
|
984
|
-
}
|
|
985
|
-
self._changeSubscriptions = [...self._subscriptions[defaultEvent]];
|
|
986
|
-
self._notificationIsPending = ignoreBeforeChange = true;
|
|
987
|
-
pendingValue = value;
|
|
988
|
-
finish();
|
|
989
|
-
},
|
|
990
|
-
_limitBeforeChange(value) {
|
|
991
|
-
if (!ignoreBeforeChange) {
|
|
992
|
-
previousValue = value;
|
|
993
|
-
self._origNotifySubscribers(value, beforeChange);
|
|
994
|
-
}
|
|
995
|
-
},
|
|
996
|
-
_notifyNextChangeIfValueIsDifferent() {
|
|
997
|
-
if (self.isDifferent(previousValue, self.peek(
|
|
998
|
-
true
|
|
999
|
-
/* evaluate */
|
|
1000
|
-
))) {
|
|
1001
|
-
notifyNextChange = true;
|
|
1002
|
-
}
|
|
1003
|
-
},
|
|
1004
|
-
_recordUpdate() {
|
|
1005
|
-
didUpdate = true;
|
|
1006
|
-
}
|
|
1007
|
-
});
|
|
1008
|
-
};
|
|
1009
|
-
Object.setPrototypeOf(observable.fn, subscribable.fn);
|
|
1010
|
-
var protoProperty = observable.protoProperty = options_default.protoProperty;
|
|
1011
|
-
observable.fn[protoProperty] = observable;
|
|
1012
|
-
observable.observablePrototypes = /* @__PURE__ */ new Set([observable]);
|
|
1013
|
-
function isObservable(instance) {
|
|
1014
|
-
const proto = typeof instance === "function" && instance[protoProperty];
|
|
1015
|
-
if (proto && !observable.observablePrototypes.has(proto)) {
|
|
1016
|
-
throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");
|
|
1017
|
-
}
|
|
1018
|
-
return !!proto;
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
// ../observable/dist/observableArray.changeTracking.js
|
|
1022
|
-
var arrayChangeEventName = "arrayChange";
|
|
1023
|
-
function trackArrayChanges(target, options2) {
|
|
1024
|
-
target.compareArrayOptions = {};
|
|
1025
|
-
if (options2 && typeof options2 === "object") {
|
|
1026
|
-
extend(target.compareArrayOptions, options2);
|
|
1027
|
-
}
|
|
1028
|
-
target.compareArrayOptions.sparse = true;
|
|
1029
|
-
if (target.cacheDiffForKnownOperation) {
|
|
1030
|
-
return;
|
|
1031
|
-
}
|
|
1032
|
-
let trackingChanges = false;
|
|
1033
|
-
let cachedDiff = null;
|
|
1034
|
-
let arrayChangeSubscription;
|
|
1035
|
-
let pendingNotifications = 0;
|
|
1036
|
-
let underlyingNotifySubscribersFunction;
|
|
1037
|
-
const underlyingBeforeSubscriptionAddFunction = target.beforeSubscriptionAdd;
|
|
1038
|
-
const underlyingAfterSubscriptionRemoveFunction = target.afterSubscriptionRemove;
|
|
1039
|
-
target.beforeSubscriptionAdd = function(event) {
|
|
1040
|
-
if (underlyingBeforeSubscriptionAddFunction) {
|
|
1041
|
-
underlyingBeforeSubscriptionAddFunction.call(target, event);
|
|
1042
|
-
}
|
|
1043
|
-
if (event === arrayChangeEventName) {
|
|
1044
|
-
trackChanges();
|
|
1045
|
-
}
|
|
1046
|
-
};
|
|
1047
|
-
target.afterSubscriptionRemove = function(event) {
|
|
1048
|
-
if (underlyingAfterSubscriptionRemoveFunction) {
|
|
1049
|
-
underlyingAfterSubscriptionRemoveFunction.call(target, event);
|
|
1050
|
-
}
|
|
1051
|
-
if (event === arrayChangeEventName && !target.hasSubscriptionsForEvent(arrayChangeEventName)) {
|
|
1052
|
-
if (underlyingNotifySubscribersFunction) {
|
|
1053
|
-
target.notifySubscribers = underlyingNotifySubscribersFunction;
|
|
1054
|
-
underlyingNotifySubscribersFunction = void 0;
|
|
1055
|
-
}
|
|
1056
|
-
if (arrayChangeSubscription) {
|
|
1057
|
-
arrayChangeSubscription.dispose();
|
|
1058
|
-
}
|
|
1059
|
-
arrayChangeSubscription = null;
|
|
1060
|
-
trackingChanges = false;
|
|
1061
|
-
}
|
|
1062
|
-
};
|
|
1063
|
-
function trackChanges() {
|
|
1064
|
-
if (trackingChanges) {
|
|
1065
|
-
return;
|
|
1066
|
-
}
|
|
1067
|
-
trackingChanges = true;
|
|
1068
|
-
underlyingNotifySubscribersFunction = target["notifySubscribers"];
|
|
1069
|
-
target.notifySubscribers = function(valueToNotify, event) {
|
|
1070
|
-
if (!event || event === defaultEvent) {
|
|
1071
|
-
++pendingNotifications;
|
|
1072
|
-
}
|
|
1073
|
-
return underlyingNotifySubscribersFunction.apply(this, arguments);
|
|
1074
|
-
};
|
|
1075
|
-
let previousContents = new Array().concat(target.peek() === void 0 ? [] : target.peek());
|
|
1076
|
-
cachedDiff = null;
|
|
1077
|
-
arrayChangeSubscription = target.subscribe(function(currentContents) {
|
|
1078
|
-
let changes;
|
|
1079
|
-
currentContents = new Array().concat(currentContents || []);
|
|
1080
|
-
if (target.hasSubscriptionsForEvent(arrayChangeEventName)) {
|
|
1081
|
-
changes = getChanges(previousContents, currentContents);
|
|
1082
|
-
}
|
|
1083
|
-
previousContents = currentContents;
|
|
1084
|
-
cachedDiff = null;
|
|
1085
|
-
pendingNotifications = 0;
|
|
1086
|
-
if (changes && changes.length) {
|
|
1087
|
-
target.notifySubscribers(changes, arrayChangeEventName);
|
|
1088
|
-
}
|
|
1089
|
-
});
|
|
1090
|
-
}
|
|
1091
|
-
function getChanges(previousContents, currentContents) {
|
|
1092
|
-
if (!cachedDiff || pendingNotifications > 1) {
|
|
1093
|
-
cachedDiff = trackArrayChanges.compareArrays(previousContents, currentContents, target.compareArrayOptions);
|
|
1094
|
-
}
|
|
1095
|
-
return cachedDiff;
|
|
1096
|
-
}
|
|
1097
|
-
target.cacheDiffForKnownOperation = function(rawArray, operationName, args) {
|
|
1098
|
-
if (!trackingChanges || pendingNotifications) {
|
|
1099
|
-
return;
|
|
1100
|
-
}
|
|
1101
|
-
let diff = new Array(), arrayLength = rawArray.length, argsLength = args.length, offset = 0;
|
|
1102
|
-
function pushDiff(status, value, index) {
|
|
1103
|
-
return diff[diff.length] = { status, value, index };
|
|
1104
|
-
}
|
|
1105
|
-
switch (operationName) {
|
|
1106
|
-
case "push":
|
|
1107
|
-
offset = arrayLength;
|
|
1108
|
-
case "unshift":
|
|
1109
|
-
for (let index = 0; index < argsLength; index++) {
|
|
1110
|
-
pushDiff("added", args[index], offset + index);
|
|
1111
|
-
}
|
|
1112
|
-
break;
|
|
1113
|
-
case "pop":
|
|
1114
|
-
offset = arrayLength - 1;
|
|
1115
|
-
case "shift":
|
|
1116
|
-
if (arrayLength) {
|
|
1117
|
-
pushDiff("deleted", rawArray[offset], offset);
|
|
1118
|
-
}
|
|
1119
|
-
break;
|
|
1120
|
-
case "splice":
|
|
1121
|
-
{
|
|
1122
|
-
const startIndex = Math.min(Math.max(0, args[0] < 0 ? arrayLength + args[0] : args[0]), arrayLength), endDeleteIndex = argsLength === 1 ? arrayLength : Math.min(startIndex + (args[1] || 0), arrayLength), endAddIndex = startIndex + argsLength - 2, endIndex = Math.max(endDeleteIndex, endAddIndex), additions = new Array(), deletions = new Array();
|
|
1123
|
-
for (let index = startIndex, argsIndex = 2; index < endIndex; ++index, ++argsIndex) {
|
|
1124
|
-
if (index < endDeleteIndex) {
|
|
1125
|
-
deletions.push(pushDiff("deleted", rawArray[index], index));
|
|
1126
|
-
}
|
|
1127
|
-
if (index < endAddIndex) {
|
|
1128
|
-
additions.push(pushDiff("added", args[argsIndex], index));
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
findMovesInArrayComparison(deletions, additions);
|
|
1132
|
-
}
|
|
1133
|
-
break;
|
|
1134
|
-
default:
|
|
1135
|
-
return;
|
|
1136
|
-
}
|
|
1137
|
-
cachedDiff = diff;
|
|
1138
|
-
};
|
|
1139
|
-
}
|
|
1140
|
-
trackArrayChanges.compareArrays = compareArrays;
|
|
1141
|
-
extenders.trackArrayChanges = trackArrayChanges;
|
|
1142
|
-
|
|
1143
|
-
// ../observable/dist/observableArray.js
|
|
1144
|
-
function observableArray(initialValues) {
|
|
1145
|
-
initialValues = initialValues || [];
|
|
1146
|
-
if (typeof initialValues !== "object" || !("length" in initialValues)) {
|
|
1147
|
-
throw new Error(
|
|
1148
|
-
"The argument passed when initializing an observable array must be an array, or null, or undefined."
|
|
1149
|
-
);
|
|
1150
|
-
}
|
|
1151
|
-
const result = Object.setPrototypeOf(observable(initialValues), observableArray.fn);
|
|
1152
|
-
trackArrayChanges(result);
|
|
1153
|
-
overwriteLengthPropertyIfSupported(result, { get: () => {
|
|
1154
|
-
var _a;
|
|
1155
|
-
return (_a = result()) == null ? void 0 : _a.length;
|
|
1156
|
-
} });
|
|
1157
|
-
return result;
|
|
1158
|
-
}
|
|
1159
|
-
observableArray.fn = {
|
|
1160
|
-
remove(valueOrPredicate) {
|
|
1161
|
-
const underlyingArray = this.peek();
|
|
1162
|
-
const removedValues = new Array();
|
|
1163
|
-
const predicate = typeof valueOrPredicate === "function" && !isObservable(valueOrPredicate) ? valueOrPredicate : function(value) {
|
|
1164
|
-
return value === valueOrPredicate;
|
|
1165
|
-
};
|
|
1166
|
-
for (let i = 0; i < underlyingArray.length; i++) {
|
|
1167
|
-
const value = underlyingArray[i];
|
|
1168
|
-
if (predicate(value)) {
|
|
1169
|
-
if (removedValues.length === 0) {
|
|
1170
|
-
this.valueWillMutate();
|
|
1171
|
-
}
|
|
1172
|
-
if (underlyingArray[i] !== value) {
|
|
1173
|
-
throw Error("Array modified during remove; cannot remove item");
|
|
1174
|
-
}
|
|
1175
|
-
removedValues.push(value);
|
|
1176
|
-
underlyingArray.splice(i, 1);
|
|
1177
|
-
i--;
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
if (removedValues.length) {
|
|
1181
|
-
this.valueHasMutated();
|
|
1182
|
-
}
|
|
1183
|
-
return removedValues;
|
|
1184
|
-
},
|
|
1185
|
-
removeAll(arrayOfValues) {
|
|
1186
|
-
if (arrayOfValues === void 0) {
|
|
1187
|
-
const underlyingArray = this.peek();
|
|
1188
|
-
const allValues = underlyingArray.slice(0);
|
|
1189
|
-
this.valueWillMutate();
|
|
1190
|
-
underlyingArray.splice(0, underlyingArray.length);
|
|
1191
|
-
this.valueHasMutated();
|
|
1192
|
-
return allValues;
|
|
1193
|
-
}
|
|
1194
|
-
if (!arrayOfValues) {
|
|
1195
|
-
return [];
|
|
1196
|
-
}
|
|
1197
|
-
return this["remove"](function(value) {
|
|
1198
|
-
return arrayIndexOf(arrayOfValues, value) >= 0;
|
|
1199
|
-
});
|
|
1200
|
-
},
|
|
1201
|
-
destroy(valueOrPredicate) {
|
|
1202
|
-
const underlyingArray = this.peek();
|
|
1203
|
-
const predicate = typeof valueOrPredicate === "function" && !isObservable(valueOrPredicate) ? valueOrPredicate : function(value) {
|
|
1204
|
-
return value === valueOrPredicate;
|
|
1205
|
-
};
|
|
1206
|
-
this.valueWillMutate();
|
|
1207
|
-
for (let i = underlyingArray.length - 1; i >= 0; i--) {
|
|
1208
|
-
const value = underlyingArray[i];
|
|
1209
|
-
if (predicate(value)) {
|
|
1210
|
-
value["_destroy"] = true;
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
this.valueHasMutated();
|
|
1214
|
-
},
|
|
1215
|
-
destroyAll(arrayOfValues) {
|
|
1216
|
-
if (arrayOfValues === void 0) {
|
|
1217
|
-
return this.destroy(function() {
|
|
1218
|
-
return true;
|
|
1219
|
-
});
|
|
1220
|
-
}
|
|
1221
|
-
if (!arrayOfValues) {
|
|
1222
|
-
return [];
|
|
1223
|
-
}
|
|
1224
|
-
return this.destroy(function(value) {
|
|
1225
|
-
return arrayIndexOf(arrayOfValues, value) >= 0;
|
|
1226
|
-
});
|
|
1227
|
-
},
|
|
1228
|
-
indexOf(item) {
|
|
1229
|
-
return arrayIndexOf(this(), item);
|
|
1230
|
-
},
|
|
1231
|
-
replace(oldItem, newItem) {
|
|
1232
|
-
const index = this.indexOf(oldItem);
|
|
1233
|
-
if (index >= 0) {
|
|
1234
|
-
this.valueWillMutate();
|
|
1235
|
-
this.peek()[index] = newItem;
|
|
1236
|
-
this.valueHasMutated();
|
|
1237
|
-
}
|
|
1238
|
-
},
|
|
1239
|
-
sorted(compareFn) {
|
|
1240
|
-
return [...this()].sort(compareFn);
|
|
1241
|
-
},
|
|
1242
|
-
reversed() {
|
|
1243
|
-
return [...this()].reverse();
|
|
1244
|
-
},
|
|
1245
|
-
[Symbol.iterator]: function* () {
|
|
1246
|
-
yield* __yieldStar(this());
|
|
1247
|
-
}
|
|
1248
|
-
};
|
|
1249
|
-
Object.setPrototypeOf(observableArray.fn, observable.fn);
|
|
1250
|
-
arrayForEach(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function(methodName) {
|
|
1251
|
-
observableArray.fn[methodName] = function() {
|
|
1252
|
-
const underlyingArray = this.peek();
|
|
1253
|
-
this.valueWillMutate();
|
|
1254
|
-
this.cacheDiffForKnownOperation(underlyingArray, methodName, arguments);
|
|
1255
|
-
const methodCallResult = underlyingArray[methodName].apply(underlyingArray, arguments);
|
|
1256
|
-
this.valueHasMutated();
|
|
1257
|
-
return methodCallResult === underlyingArray ? this : methodCallResult;
|
|
1258
|
-
};
|
|
1259
|
-
});
|
|
1260
|
-
arrayForEach(["slice"], function(methodName) {
|
|
1261
|
-
observableArray.fn[methodName] = function() {
|
|
1262
|
-
const underlyingArray = this();
|
|
1263
|
-
return underlyingArray[methodName].apply(underlyingArray, arguments);
|
|
1264
|
-
};
|
|
1265
|
-
});
|
|
1266
|
-
observableArray.trackArrayChanges = trackArrayChanges;
|
|
1267
|
-
|
|
1268
|
-
// ../provider/dist/BindingHandlerObject.js
|
|
1269
|
-
var BindingHandlerObject = class {
|
|
1270
|
-
set(nameOrObject, value) {
|
|
1271
|
-
if (typeof nameOrObject === "string") {
|
|
1272
|
-
this[nameOrObject] = value;
|
|
1273
|
-
} else if (typeof nameOrObject === "object") {
|
|
1274
|
-
if (value !== void 0) {
|
|
1275
|
-
options_default.onError(
|
|
1276
|
-
new Error(
|
|
1277
|
-
"Given extraneous `value` parameter (first param should be a string, but it was an object)." + nameOrObject
|
|
1278
|
-
)
|
|
1279
|
-
);
|
|
1280
|
-
}
|
|
1281
|
-
Object.assign(this, nameOrObject);
|
|
1282
|
-
} else {
|
|
1283
|
-
options_default.onError(new Error("Given a bad binding handler type: " + nameOrObject));
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
/**
|
|
1287
|
-
* The handler may have a `.` in it, e.g. `attr.title`, in which case the
|
|
1288
|
-
* handler is `attr`. Otherwise it's the name given
|
|
1289
|
-
*/
|
|
1290
|
-
get(nameOrDotted) {
|
|
1291
|
-
const [name] = nameOrDotted.split(".");
|
|
1292
|
-
return this[name];
|
|
1293
|
-
}
|
|
1294
|
-
};
|
|
1295
|
-
|
|
1296
|
-
// ../provider/dist/Provider.js
|
|
1297
|
-
var Provider = class _Provider {
|
|
1298
|
-
constructor(params) {
|
|
1299
|
-
if (this.constructor === _Provider) {
|
|
1300
|
-
throw new Error("Provider is an abstract base class.");
|
|
1301
|
-
}
|
|
1302
|
-
if (!("FOR_NODE_TYPES" in this)) {
|
|
1303
|
-
throw new Error("Providers must have FOR_NODE_TYPES property");
|
|
1304
|
-
}
|
|
1305
|
-
this.bindingHandlers = (params == null ? void 0 : params.bindingHandlers) || new BindingHandlerObject();
|
|
1306
|
-
this.globals = (params == null ? void 0 : params.globals) || {};
|
|
1307
|
-
}
|
|
1308
|
-
get FOR_NODE_TYPES() {
|
|
1309
|
-
throw new Error("Providers must override FOR_NODE_TYPES property");
|
|
1310
|
-
}
|
|
1311
|
-
setGlobals(globals) {
|
|
1312
|
-
this.globals = globals;
|
|
1313
|
-
}
|
|
1314
|
-
get preemptive() {
|
|
1315
|
-
return false;
|
|
1316
|
-
}
|
|
1317
|
-
nodeHasBindings(node, context) {
|
|
1318
|
-
return false;
|
|
1319
|
-
}
|
|
1320
|
-
getBindingAccessors(node, context) {
|
|
1321
|
-
return /* @__PURE__ */ Object.create(null);
|
|
1322
|
-
}
|
|
1323
|
-
/**
|
|
1324
|
-
* Preprocess a given node.
|
|
1325
|
-
* @param {Node} node
|
|
1326
|
-
* @returns {[Node]|null}
|
|
1327
|
-
*/
|
|
1328
|
-
preprocessNode(node) {
|
|
1329
|
-
return [node];
|
|
1330
|
-
}
|
|
1331
|
-
postProcess() {
|
|
1332
|
-
}
|
|
1333
|
-
/** For legacy binding provider assignments to
|
|
1334
|
-
* ko.bindingProvider.instance = ... */
|
|
1335
|
-
get instance() {
|
|
1336
|
-
return this._overloadInstance || this;
|
|
1337
|
-
}
|
|
1338
|
-
set instance(provider) {
|
|
1339
|
-
if (!provider || provider === this) {
|
|
1340
|
-
this._overloadInstance = void 0;
|
|
1341
|
-
} else {
|
|
1342
|
-
this._overloadInstance = new LegacyProvider(provider, this);
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
// Given a function that returns bindings, create and return a new object that contains
|
|
1346
|
-
// binding value-accessors functions. Each accessor function calls the original function
|
|
1347
|
-
// so that it always gets the latest value and all dependencies are captured. This is used
|
|
1348
|
-
// by ko.applyBindingsToNode and getBindingsAndMakeAccessors.
|
|
1349
|
-
makeAccessorsFromFunction(callback) {
|
|
1350
|
-
return objectMap(dependencyDetection_exports.ignore(callback), (value, key) => () => callback()[key]);
|
|
1351
|
-
}
|
|
1352
|
-
// Returns the valueAccessor function for a binding value
|
|
1353
|
-
makeValueAccessor(value) {
|
|
1354
|
-
return () => value;
|
|
1355
|
-
}
|
|
1356
|
-
// Given a bindings function or object, create and return a new object that contains
|
|
1357
|
-
// binding value-accessors functions. This is used by ko.applyBindingsToNode.
|
|
1358
|
-
makeBindingAccessors(bindings, context, node) {
|
|
1359
|
-
if (typeof bindings === "function") {
|
|
1360
|
-
return this.makeAccessorsFromFunction(bindings.bind(null, context, node));
|
|
1361
|
-
} else {
|
|
1362
|
-
return objectMap(bindings, this.makeValueAccessor);
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
};
|
|
1366
|
-
var LegacyProvider = class extends Provider {
|
|
1367
|
-
get FOR_NODE_TYPES() {
|
|
1368
|
-
return [Node.ELEMENT_NODE, Node.TEXT_NODE, Node.COMMENT_NODE];
|
|
1369
|
-
}
|
|
1370
|
-
constructor(providerObject, parentProvider) {
|
|
1371
|
-
super();
|
|
1372
|
-
Object.assign(this, { providerObject });
|
|
1373
|
-
this.bindingHandlers = providerObject.bindingHandlers || parentProvider.bindingHandlers;
|
|
1374
|
-
}
|
|
1375
|
-
// This function is used if the binding provider doesn't include a getBindingAccessors function.
|
|
1376
|
-
// It must be called with 'this' set to the provider instance.
|
|
1377
|
-
getBindingsAndMakeAccessors(node, context) {
|
|
1378
|
-
const bindingsFn = this.providerObject.getBindings.bind(this.providerObject, node, context);
|
|
1379
|
-
return this.makeAccessorsFromFunction(bindingsFn);
|
|
1380
|
-
}
|
|
1381
|
-
getBindingAccessors(node, context) {
|
|
1382
|
-
return this.providerObject.getBindingAccessors ? this.providerObject.getBindingAccessors(node, context) : this.getBindingsAndMakeAccessors(node, context);
|
|
1383
|
-
}
|
|
1384
|
-
nodeHasBindings(node) {
|
|
1385
|
-
return this.providerObject.nodeHasBindings(node);
|
|
1386
|
-
}
|
|
1387
|
-
preprocessNode(node) {
|
|
1388
|
-
if (this.providerObject.preprocessNode) {
|
|
1389
|
-
return this.providerObject.preprocessNode(node);
|
|
1390
|
-
}
|
|
1391
|
-
return null;
|
|
1392
|
-
}
|
|
1393
|
-
};
|
|
1394
|
-
|
|
1395
66
|
// src/MultiProvider.ts
|
|
1396
|
-
var
|
|
1397
|
-
|
|
1398
|
-
return this.nodeTypes;
|
|
1399
|
-
}
|
|
67
|
+
var import_provider = require("@tko/provider");
|
|
68
|
+
var MultiProvider = class extends import_provider.Provider {
|
|
1400
69
|
constructor(params) {
|
|
1401
70
|
super(params);
|
|
71
|
+
__publicField(this, "nodeTypes");
|
|
72
|
+
__publicField(this, "nodeTypeMap");
|
|
73
|
+
__publicField(this, "providers");
|
|
1402
74
|
const providers = (params == null ? void 0 : params.providers) || [];
|
|
1403
75
|
this.nodeTypeMap = {};
|
|
1404
76
|
this.nodeTypes = [];
|
|
1405
77
|
this.providers = [];
|
|
1406
78
|
providers.forEach((p) => this.addProvider(p));
|
|
1407
79
|
}
|
|
80
|
+
get FOR_NODE_TYPES() {
|
|
81
|
+
return this.nodeTypes;
|
|
82
|
+
}
|
|
1408
83
|
setGlobals(globals) {
|
|
1409
84
|
;
|
|
1410
85
|
[this, ...this.providers].forEach((p) => p.globals = globals);
|