@tko/build.knockout 4.0.1 → 4.1.0
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 +288 -307
- package/dist/browser.js.map +4 -4
- package/dist/browser.min.js +10 -10
- package/dist/browser.min.js.map +4 -4
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +25 -18
- package/dist/common.js +0 -3
- package/dist/common.js.map +0 -7
package/dist/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @tko/build.knockout 🥊 4.0
|
|
1
|
+
// @tko/build.knockout 🥊 4.1.0 IIFE
|
|
2
2
|
"use strict";
|
|
3
3
|
var ko = (() => {
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -184,17 +184,17 @@ var ko = (() => {
|
|
|
184
184
|
}
|
|
185
185
|
var statusNotInOld = "added";
|
|
186
186
|
var statusNotInNew = "deleted";
|
|
187
|
-
function compareArrays(oldArray, newArray,
|
|
188
|
-
|
|
187
|
+
function compareArrays(oldArray, newArray, options4) {
|
|
188
|
+
options4 = typeof options4 === "boolean" ? { dontLimitMoves: options4 } : options4 || {};
|
|
189
189
|
oldArray = oldArray || [];
|
|
190
190
|
newArray = newArray || [];
|
|
191
191
|
if (oldArray.length < newArray.length) {
|
|
192
|
-
return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew,
|
|
192
|
+
return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew, options4);
|
|
193
193
|
} else {
|
|
194
|
-
return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld,
|
|
194
|
+
return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld, options4);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
function compareSmallArrayToBigArray(smlArray, bigArray, statusNotInSml, statusNotInBig,
|
|
197
|
+
function compareSmallArrayToBigArray(smlArray, bigArray, statusNotInSml, statusNotInBig, options4) {
|
|
198
198
|
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;
|
|
199
199
|
for (smlIndex = 0; smlIndex <= smlIndexMax; smlIndex++) {
|
|
200
200
|
lastRow = thisRow;
|
|
@@ -239,12 +239,12 @@ var ko = (() => {
|
|
|
239
239
|
} else {
|
|
240
240
|
--bigIndex;
|
|
241
241
|
--smlIndex;
|
|
242
|
-
if (!(
|
|
242
|
+
if (!(options4 == null ? void 0 : options4.sparse)) {
|
|
243
243
|
editScript.push({ status: "retained", value: bigArray[bigIndex] });
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
findMovesInArrayComparison(notInBig, notInSml, !
|
|
247
|
+
findMovesInArrayComparison(notInBig, notInSml, !options4.dontLimitMoves && smlIndexMax * 10);
|
|
248
248
|
return editScript.reverse();
|
|
249
249
|
}
|
|
250
250
|
|
|
@@ -301,20 +301,20 @@ var ko = (() => {
|
|
|
301
301
|
__publicField(this, "foreachHidesDestroyed", false);
|
|
302
302
|
}
|
|
303
303
|
get jQuery() {
|
|
304
|
-
var
|
|
304
|
+
var _a2;
|
|
305
305
|
if (this.disableJQueryUsage) return void 0;
|
|
306
|
-
return (
|
|
306
|
+
return (_a2 = this._jQuery) != null ? _a2 : globalThis.jQuery;
|
|
307
307
|
}
|
|
308
308
|
/**
|
|
309
309
|
* Set jQuery manuall to be used by TKO.
|
|
310
310
|
* @param jQuery If jQuery set to undefined, TKO will not use jQuery and this.disableJQueryUsage to true.
|
|
311
311
|
*/
|
|
312
|
-
set jQuery(
|
|
313
|
-
if (!
|
|
312
|
+
set jQuery(jQuery) {
|
|
313
|
+
if (!jQuery) {
|
|
314
314
|
this.disableJQueryUsage = true;
|
|
315
315
|
this._jQuery = void 0;
|
|
316
316
|
} else {
|
|
317
|
-
this._jQuery =
|
|
317
|
+
this._jQuery = jQuery;
|
|
318
318
|
this.disableJQueryUsage = false;
|
|
319
319
|
}
|
|
320
320
|
}
|
|
@@ -349,21 +349,21 @@ var ko = (() => {
|
|
|
349
349
|
};
|
|
350
350
|
var options = new Options();
|
|
351
351
|
function defineOption(name, config) {
|
|
352
|
-
var
|
|
352
|
+
var _a2;
|
|
353
353
|
let _value = config.default;
|
|
354
354
|
Object.defineProperty(options, name, {
|
|
355
355
|
get() {
|
|
356
356
|
return _value;
|
|
357
357
|
},
|
|
358
358
|
set(value2) {
|
|
359
|
-
var
|
|
359
|
+
var _a3;
|
|
360
360
|
_value = value2;
|
|
361
|
-
(
|
|
361
|
+
(_a3 = config.set) == null ? void 0 : _a3.call(config, value2);
|
|
362
362
|
},
|
|
363
363
|
enumerable: true,
|
|
364
364
|
configurable: true
|
|
365
365
|
});
|
|
366
|
-
(
|
|
366
|
+
(_a2 = config.set) == null ? void 0 : _a2.call(config, _value);
|
|
367
367
|
}
|
|
368
368
|
var options_default = options;
|
|
369
369
|
|
|
@@ -409,6 +409,11 @@ var ko = (() => {
|
|
|
409
409
|
};
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
+
// ../../packages/utils/src/compat.ts
|
|
413
|
+
function createSymbolOrString(identifier) {
|
|
414
|
+
return Symbol(identifier);
|
|
415
|
+
}
|
|
416
|
+
|
|
412
417
|
// ../../packages/utils/src/object.ts
|
|
413
418
|
function hasOwnProperty(obj, propName) {
|
|
414
419
|
return Object.prototype.hasOwnProperty.call(obj, propName);
|
|
@@ -487,74 +492,31 @@ var ko = (() => {
|
|
|
487
492
|
return isObjectLike(object) && typeof object.then === "function";
|
|
488
493
|
}
|
|
489
494
|
|
|
490
|
-
// ../../packages/utils/src/function.ts
|
|
491
|
-
function testOverwrite() {
|
|
492
|
-
try {
|
|
493
|
-
Object.defineProperty(function x() {
|
|
494
|
-
}, "length", {});
|
|
495
|
-
return true;
|
|
496
|
-
} catch (e) {
|
|
497
|
-
return false;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
var functionSupportsLengthOverwrite = testOverwrite();
|
|
501
|
-
function overwriteLengthPropertyIfSupported(fn, descriptor) {
|
|
502
|
-
if (functionSupportsLengthOverwrite) {
|
|
503
|
-
Object.defineProperty(fn, "length", descriptor);
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
495
|
// ../../packages/utils/src/string.ts
|
|
508
|
-
function stringTrim(string) {
|
|
509
|
-
return string === null || string === void 0 ? "" : string.trim ? string.trim() : string.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g, "");
|
|
510
|
-
}
|
|
511
|
-
function stringStartsWith(string, startsWith) {
|
|
512
|
-
string = string || "";
|
|
513
|
-
if (startsWith.length > string.length) {
|
|
514
|
-
return false;
|
|
515
|
-
}
|
|
516
|
-
return string.substring(0, startsWith.length) === startsWith;
|
|
517
|
-
}
|
|
518
496
|
function parseJson(jsonString) {
|
|
519
497
|
if (typeof jsonString === "string") {
|
|
520
|
-
|
|
521
|
-
if (
|
|
522
|
-
return JSON.parse(
|
|
498
|
+
const trimmed = jsonString.trim();
|
|
499
|
+
if (trimmed) {
|
|
500
|
+
return JSON.parse(trimmed);
|
|
523
501
|
}
|
|
524
502
|
}
|
|
525
503
|
return null;
|
|
526
504
|
}
|
|
527
505
|
|
|
528
|
-
// ../../packages/utils/src/symbol.ts
|
|
529
|
-
var useSymbols = typeof Symbol === "function";
|
|
530
|
-
function createSymbolOrString(identifier) {
|
|
531
|
-
return useSymbols ? Symbol(identifier) : identifier;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
506
|
// ../../packages/utils/src/css.ts
|
|
535
507
|
var cssClassNameRegex = /\S+/g;
|
|
536
508
|
function toggleDomNodeCssClass(node, classNames, shouldHaveClass) {
|
|
537
|
-
let addOrRemoveFn;
|
|
538
509
|
if (!classNames) {
|
|
539
510
|
return;
|
|
540
511
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
} else {
|
|
549
|
-
toggleObjectClassPropertyString(node, "className", classNames, shouldHaveClass);
|
|
512
|
+
const tokens = classNames.match(cssClassNameRegex);
|
|
513
|
+
if (!tokens) {
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
const method = shouldHaveClass ? "add" : "remove";
|
|
517
|
+
for (const token of tokens) {
|
|
518
|
+
node.classList[method](token);
|
|
550
519
|
}
|
|
551
|
-
}
|
|
552
|
-
function toggleObjectClassPropertyString(obj, prop, classNames, shouldHaveClass) {
|
|
553
|
-
const currentClassNames = obj[prop].match(cssClassNameRegex) || [];
|
|
554
|
-
arrayForEach(classNames.match(cssClassNameRegex), function(className) {
|
|
555
|
-
addOrRemoveItem(currentClassNames, className, shouldHaveClass);
|
|
556
|
-
});
|
|
557
|
-
obj[prop] = currentClassNames.join(" ");
|
|
558
520
|
}
|
|
559
521
|
|
|
560
522
|
// ../../packages/utils/src/dom/info.ts
|
|
@@ -632,9 +594,9 @@ var ko = (() => {
|
|
|
632
594
|
function registerEventHandler(element, eventType, handler, eventOptions = false) {
|
|
633
595
|
const wrappedHandler = catchFunctionErrors(handler);
|
|
634
596
|
const mustUseNative = Boolean(eventOptions);
|
|
635
|
-
const
|
|
636
|
-
if (!options_default.useOnlyNativeEvents && !mustUseNative &&
|
|
637
|
-
|
|
597
|
+
const jQuery = options_default.jQuery;
|
|
598
|
+
if (!options_default.useOnlyNativeEvents && !mustUseNative && jQuery) {
|
|
599
|
+
jQuery(element).on(eventType, wrappedHandler);
|
|
638
600
|
} else if (typeof element.addEventListener === "function") {
|
|
639
601
|
element.addEventListener(eventType, wrappedHandler, eventOptions);
|
|
640
602
|
} else {
|
|
@@ -651,36 +613,26 @@ var ko = (() => {
|
|
|
651
613
|
const useClickWorkaround = isClickOnCheckableElement(element, eventType);
|
|
652
614
|
if (!options_default.useOnlyNativeEvents && options_default.jQuery && !useClickWorkaround) {
|
|
653
615
|
options_default.jQuery(element).trigger(eventType);
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
true,
|
|
661
|
-
true,
|
|
662
|
-
options_default.global,
|
|
663
|
-
0,
|
|
664
|
-
0,
|
|
665
|
-
0,
|
|
666
|
-
0,
|
|
667
|
-
0,
|
|
668
|
-
false,
|
|
669
|
-
false,
|
|
670
|
-
false,
|
|
671
|
-
false,
|
|
672
|
-
0,
|
|
673
|
-
element
|
|
674
|
-
);
|
|
675
|
-
element.dispatchEvent(event);
|
|
676
|
-
} else {
|
|
677
|
-
throw new Error("The supplied element doesn't support dispatchEvent");
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
if (typeof element.dispatchEvent !== "function") {
|
|
619
|
+
if (useClickWorkaround && hasClick(element)) {
|
|
620
|
+
element.click();
|
|
621
|
+
return;
|
|
678
622
|
}
|
|
679
|
-
|
|
680
|
-
|
|
623
|
+
throw new Error("The supplied element doesn't support dispatchEvent");
|
|
624
|
+
}
|
|
625
|
+
const eventCategory = knownEventTypesByEventName[eventType] || "HTMLEvents";
|
|
626
|
+
const view = options_default.global;
|
|
627
|
+
let event;
|
|
628
|
+
if (eventCategory === "MouseEvents" && typeof MouseEvent === "function") {
|
|
629
|
+
event = new MouseEvent(eventType, { bubbles: true, cancelable: true, view, relatedTarget: element });
|
|
630
|
+
} else if (eventCategory === "UIEvents" && typeof KeyboardEvent === "function") {
|
|
631
|
+
event = new KeyboardEvent(eventType, { bubbles: true, cancelable: true, view });
|
|
681
632
|
} else {
|
|
682
|
-
|
|
633
|
+
event = new Event(eventType, { bubbles: true, cancelable: true });
|
|
683
634
|
}
|
|
635
|
+
element.dispatchEvent(event);
|
|
684
636
|
}
|
|
685
637
|
|
|
686
638
|
// ../../packages/utils/src/dom/data.ts
|
|
@@ -1037,7 +989,7 @@ var ko = (() => {
|
|
|
1037
989
|
}
|
|
1038
990
|
}
|
|
1039
991
|
function prepend(containerNode, nodeToPrepend) {
|
|
1040
|
-
var
|
|
992
|
+
var _a2;
|
|
1041
993
|
if (!isStartComment(containerNode)) {
|
|
1042
994
|
if (containerNode.firstChild) {
|
|
1043
995
|
containerNode.insertBefore(nodeToPrepend, containerNode.firstChild);
|
|
@@ -1045,11 +997,11 @@ var ko = (() => {
|
|
|
1045
997
|
containerNode.appendChild(nodeToPrepend);
|
|
1046
998
|
}
|
|
1047
999
|
} else {
|
|
1048
|
-
(
|
|
1000
|
+
(_a2 = containerNode.parentNode) == null ? void 0 : _a2.insertBefore(nodeToPrepend, containerNode.nextSibling);
|
|
1049
1001
|
}
|
|
1050
1002
|
}
|
|
1051
1003
|
function insertAfter(containerNode, nodeToInsert, insertAfterNode) {
|
|
1052
|
-
var
|
|
1004
|
+
var _a2;
|
|
1053
1005
|
if (!insertAfterNode) {
|
|
1054
1006
|
prepend(containerNode, nodeToInsert);
|
|
1055
1007
|
} else if (!isStartComment(containerNode)) {
|
|
@@ -1059,7 +1011,7 @@ var ko = (() => {
|
|
|
1059
1011
|
containerNode.appendChild(nodeToInsert);
|
|
1060
1012
|
}
|
|
1061
1013
|
} else {
|
|
1062
|
-
(
|
|
1014
|
+
(_a2 = containerNode.parentNode) == null ? void 0 : _a2.insertBefore(nodeToInsert, insertAfterNode.nextSibling);
|
|
1063
1015
|
}
|
|
1064
1016
|
}
|
|
1065
1017
|
function firstChild(node) {
|
|
@@ -1163,9 +1115,9 @@ var ko = (() => {
|
|
|
1163
1115
|
return makeArray(template.content.childNodes);
|
|
1164
1116
|
}
|
|
1165
1117
|
function jQueryHtmlParse(html2, documentContext) {
|
|
1166
|
-
const
|
|
1167
|
-
if (
|
|
1168
|
-
return
|
|
1118
|
+
const jQuery = options_default.jQuery;
|
|
1119
|
+
if (jQuery) {
|
|
1120
|
+
return jQuery.parseHTML(html2, documentContext) || [];
|
|
1169
1121
|
}
|
|
1170
1122
|
return [];
|
|
1171
1123
|
}
|
|
@@ -1201,10 +1153,10 @@ var ko = (() => {
|
|
|
1201
1153
|
if (typeof html2 !== "string") {
|
|
1202
1154
|
html2 = html2.toString();
|
|
1203
1155
|
}
|
|
1204
|
-
const
|
|
1205
|
-
if (
|
|
1156
|
+
const jQuery = options_default.jQuery;
|
|
1157
|
+
if (jQuery && !supportsTemplateTag) {
|
|
1206
1158
|
const saferHtml = validateHTMLInput(html2);
|
|
1207
|
-
|
|
1159
|
+
jQuery(node).html(saferHtml);
|
|
1208
1160
|
} else {
|
|
1209
1161
|
let parsedNodes;
|
|
1210
1162
|
if (node.ownerDocument) {
|
|
@@ -1398,9 +1350,10 @@ var ko = (() => {
|
|
|
1398
1350
|
var nextHandle = 1;
|
|
1399
1351
|
var nextIndexToProcess = 0;
|
|
1400
1352
|
var schedulerGlobal = options_default.global;
|
|
1353
|
+
var _a;
|
|
1401
1354
|
if (schedulerGlobal && typeof schedulerGlobal.queueMicrotask === "function") {
|
|
1402
1355
|
options_default.taskScheduler = (callback) => schedulerGlobal.queueMicrotask(callback);
|
|
1403
|
-
} else if (schedulerGlobal
|
|
1356
|
+
} else if ((schedulerGlobal == null ? void 0 : schedulerGlobal.MutationObserver) && schedulerGlobal.document && !((_a = schedulerGlobal.navigator) == null ? void 0 : _a.standalone)) {
|
|
1404
1357
|
options_default.taskScheduler = (function() {
|
|
1405
1358
|
let scheduledCallback = null;
|
|
1406
1359
|
let toggle = false;
|
|
@@ -1493,9 +1446,9 @@ var ko = (() => {
|
|
|
1493
1446
|
function getId() {
|
|
1494
1447
|
return ++lastId;
|
|
1495
1448
|
}
|
|
1496
|
-
function begin(
|
|
1449
|
+
function begin(options4) {
|
|
1497
1450
|
outerFrames.push(currentFrame);
|
|
1498
|
-
currentFrame =
|
|
1451
|
+
currentFrame = options4;
|
|
1499
1452
|
}
|
|
1500
1453
|
function end() {
|
|
1501
1454
|
currentFrame = outerFrames.pop();
|
|
@@ -1629,13 +1582,13 @@ var ko = (() => {
|
|
|
1629
1582
|
}
|
|
1630
1583
|
deferUpdates(target);
|
|
1631
1584
|
}
|
|
1632
|
-
function rateLimit(target,
|
|
1585
|
+
function rateLimit(target, options4) {
|
|
1633
1586
|
let timeout, method, limitFunction;
|
|
1634
|
-
if (typeof
|
|
1635
|
-
timeout =
|
|
1587
|
+
if (typeof options4 === "number") {
|
|
1588
|
+
timeout = options4;
|
|
1636
1589
|
} else {
|
|
1637
|
-
timeout =
|
|
1638
|
-
method =
|
|
1590
|
+
timeout = options4.timeout;
|
|
1591
|
+
method = options4.method;
|
|
1639
1592
|
}
|
|
1640
1593
|
target._deferUpdates = false;
|
|
1641
1594
|
limitFunction = method === "notifyWhenChangesStop" ? debounce : throttle;
|
|
@@ -1787,7 +1740,7 @@ var ko = (() => {
|
|
|
1787
1740
|
return Observable[LATEST_VALUE];
|
|
1788
1741
|
}
|
|
1789
1742
|
}
|
|
1790
|
-
|
|
1743
|
+
Object.defineProperty(Observable, "length", { value: void 0 });
|
|
1791
1744
|
Observable[LATEST_VALUE] = initialValue;
|
|
1792
1745
|
subscribable.fn.init(Observable);
|
|
1793
1746
|
Object.setPrototypeOf(Observable, observable.fn);
|
|
@@ -1917,10 +1870,10 @@ var ko = (() => {
|
|
|
1917
1870
|
|
|
1918
1871
|
// ../../packages/observable/src/observableArray.changeTracking.ts
|
|
1919
1872
|
var arrayChangeEventName = "arrayChange";
|
|
1920
|
-
function trackArrayChanges(target,
|
|
1873
|
+
function trackArrayChanges(target, options4) {
|
|
1921
1874
|
target.compareArrayOptions = {};
|
|
1922
|
-
if (
|
|
1923
|
-
extend(target.compareArrayOptions,
|
|
1875
|
+
if (options4 && typeof options4 === "object") {
|
|
1876
|
+
extend(target.compareArrayOptions, options4);
|
|
1924
1877
|
}
|
|
1925
1878
|
target.compareArrayOptions.sparse = true;
|
|
1926
1879
|
if (target.cacheDiffForKnownOperation) {
|
|
@@ -2049,9 +2002,9 @@ var ko = (() => {
|
|
|
2049
2002
|
}
|
|
2050
2003
|
const result = Object.setPrototypeOf(observable(initialValues), observableArray.fn);
|
|
2051
2004
|
trackArrayChanges(result);
|
|
2052
|
-
|
|
2053
|
-
var
|
|
2054
|
-
return (
|
|
2005
|
+
Object.defineProperty(result, "length", { get: () => {
|
|
2006
|
+
var _a2;
|
|
2007
|
+
return (_a2 = result()) == null ? void 0 : _a2.length;
|
|
2055
2008
|
} });
|
|
2056
2009
|
return result;
|
|
2057
2010
|
}
|
|
@@ -2239,19 +2192,19 @@ var ko = (() => {
|
|
|
2239
2192
|
function looseEqual(a, b) {
|
|
2240
2193
|
return a == b;
|
|
2241
2194
|
}
|
|
2242
|
-
looseEqual.precedence =
|
|
2195
|
+
looseEqual.precedence = 8;
|
|
2243
2196
|
function looseNotEqual(a, b) {
|
|
2244
2197
|
return a != b;
|
|
2245
2198
|
}
|
|
2246
|
-
looseNotEqual.precedence =
|
|
2199
|
+
looseNotEqual.precedence = 8;
|
|
2247
2200
|
function strictEqual(a, b) {
|
|
2248
2201
|
return a === b;
|
|
2249
2202
|
}
|
|
2250
|
-
strictEqual.precedence =
|
|
2203
|
+
strictEqual.precedence = 8;
|
|
2251
2204
|
function strictNotEqual(a, b) {
|
|
2252
2205
|
return a !== b;
|
|
2253
2206
|
}
|
|
2254
|
-
strictNotEqual.precedence =
|
|
2207
|
+
strictNotEqual.precedence = 8;
|
|
2255
2208
|
var operators = {
|
|
2256
2209
|
// unary
|
|
2257
2210
|
"@": unwrapOrCall,
|
|
@@ -2358,40 +2311,40 @@ var ko = (() => {
|
|
|
2358
2311
|
};
|
|
2359
2312
|
operators["@"].precedence = 21;
|
|
2360
2313
|
operators["#"].precedence = 21;
|
|
2361
|
-
operators["."].precedence =
|
|
2362
|
-
operators["["].precedence =
|
|
2363
|
-
operators["?."].precedence =
|
|
2364
|
-
operators["!"].precedence =
|
|
2365
|
-
operators["!!"].precedence =
|
|
2366
|
-
operators["++"].precedence =
|
|
2367
|
-
operators["--"].precedence =
|
|
2368
|
-
operators["&-"].precedence =
|
|
2369
|
-
operators["**"].precedence =
|
|
2370
|
-
operators["%"].precedence =
|
|
2371
|
-
operators["*"].precedence =
|
|
2372
|
-
operators["/"].precedence =
|
|
2373
|
-
operators["+"].precedence =
|
|
2374
|
-
operators["-"].precedence =
|
|
2375
|
-
operators["
|
|
2376
|
-
operators["
|
|
2377
|
-
operators["
|
|
2378
|
-
operators["
|
|
2379
|
-
operators["
|
|
2380
|
-
operators["
|
|
2381
|
-
operators["
|
|
2382
|
-
operators["
|
|
2383
|
-
operators["
|
|
2384
|
-
operators["
|
|
2385
|
-
operators["
|
|
2386
|
-
operators["&&"].precedence =
|
|
2387
|
-
operators["||"].precedence =
|
|
2388
|
-
operators["??"].precedence =
|
|
2314
|
+
operators["."].precedence = 17;
|
|
2315
|
+
operators["["].precedence = 17;
|
|
2316
|
+
operators["?."].precedence = 17;
|
|
2317
|
+
operators["!"].precedence = 14;
|
|
2318
|
+
operators["!!"].precedence = 14;
|
|
2319
|
+
operators["++"].precedence = 14;
|
|
2320
|
+
operators["--"].precedence = 14;
|
|
2321
|
+
operators["&-"].precedence = 14;
|
|
2322
|
+
operators["**"].precedence = 13;
|
|
2323
|
+
operators["%"].precedence = 12;
|
|
2324
|
+
operators["*"].precedence = 12;
|
|
2325
|
+
operators["/"].precedence = 12;
|
|
2326
|
+
operators["+"].precedence = 11;
|
|
2327
|
+
operators["-"].precedence = 11;
|
|
2328
|
+
operators["<"].precedence = 9;
|
|
2329
|
+
operators["<="].precedence = 9;
|
|
2330
|
+
operators[">"].precedence = 9;
|
|
2331
|
+
operators[">="].precedence = 9;
|
|
2332
|
+
operators["=="].precedence = 8;
|
|
2333
|
+
operators["!="].precedence = 8;
|
|
2334
|
+
operators["==="].precedence = 8;
|
|
2335
|
+
operators["!=="].precedence = 8;
|
|
2336
|
+
operators["&"].precedence = 7;
|
|
2337
|
+
operators["^"].precedence = 6;
|
|
2338
|
+
operators["|"].precedence = 5;
|
|
2339
|
+
operators["&&"].precedence = 4;
|
|
2340
|
+
operators["||"].precedence = 3;
|
|
2341
|
+
operators["??"].precedence = 3;
|
|
2389
2342
|
operators["&&"].earlyOut = (a) => !a;
|
|
2390
2343
|
operators["||"].earlyOut = (a) => a;
|
|
2391
|
-
operators["??"].earlyOut = (a) => a;
|
|
2392
|
-
operators["
|
|
2344
|
+
operators["??"].earlyOut = (a) => a !== null && a !== void 0;
|
|
2345
|
+
operators["=>"].precedence = 2;
|
|
2346
|
+
operators[","].precedence = 1;
|
|
2393
2347
|
operators["call"].precedence = 1;
|
|
2394
|
-
operators["=>"].precedence = 1;
|
|
2395
2348
|
defineOption("strictEquality", {
|
|
2396
2349
|
default: false,
|
|
2397
2350
|
set(strict) {
|
|
@@ -3027,10 +2980,10 @@ ${name} ${msg} of ${this.text}
|
|
|
3027
2980
|
throw this.createError("Bad string");
|
|
3028
2981
|
}
|
|
3029
2982
|
string() {
|
|
3030
|
-
var
|
|
2983
|
+
var _a2, _b;
|
|
3031
2984
|
const ch = this.ch;
|
|
3032
2985
|
if (ch === '"') {
|
|
3033
|
-
return (
|
|
2986
|
+
return (_a2 = this.readString('"')) == null ? void 0 : _a2.join("");
|
|
3034
2987
|
} else if (ch === "'") {
|
|
3035
2988
|
return (_b = this.readString("'")) == null ? void 0 : _b.join("");
|
|
3036
2989
|
} else if (ch === "`") {
|
|
@@ -3444,13 +3397,13 @@ ${name} ${msg} of ${this.text}
|
|
|
3444
3397
|
objectForEach(result, (name, value2) => {
|
|
3445
3398
|
if (value2 instanceof Identifier) {
|
|
3446
3399
|
Object.defineProperty(result, name, {
|
|
3447
|
-
value: function(optionalValue,
|
|
3400
|
+
value: function(optionalValue, options4) {
|
|
3448
3401
|
const currentValue = value2.get_value(void 0, context, globals, node);
|
|
3449
3402
|
if (arguments.length === 0) {
|
|
3450
3403
|
return currentValue;
|
|
3451
3404
|
}
|
|
3452
3405
|
const unchanged = optionalValue === currentValue;
|
|
3453
|
-
if (
|
|
3406
|
+
if (options4 && options4.onlyIfChanged && unchanged) {
|
|
3454
3407
|
return;
|
|
3455
3408
|
}
|
|
3456
3409
|
return value2.set_value(optionalValue, context, globals);
|
|
@@ -3538,11 +3491,12 @@ ${name} ${msg} of ${this.text}
|
|
|
3538
3491
|
var divisionLookBehind = /[\])"'A-Za-z0-9_$]+$/;
|
|
3539
3492
|
var keywordRegexLookBehind = { in: 1, return: 1, typeof: 1 };
|
|
3540
3493
|
function parseObjectLiteral(objectLiteralString) {
|
|
3541
|
-
|
|
3494
|
+
var _a2, _b;
|
|
3495
|
+
let str = String(objectLiteralString != null ? objectLiteralString : "").trim();
|
|
3542
3496
|
if (str.charCodeAt(0) === 123) str = str.slice(1, -1);
|
|
3543
3497
|
str += "\n,";
|
|
3544
3498
|
const result = new Array();
|
|
3545
|
-
let toks = str.match(bindingToken);
|
|
3499
|
+
let toks = (_a2 = str.match(bindingToken)) != null ? _a2 : [];
|
|
3546
3500
|
let key;
|
|
3547
3501
|
let values = new Array();
|
|
3548
3502
|
let depth = 0;
|
|
@@ -3568,8 +3522,8 @@ ${name} ${msg} of ${this.text}
|
|
|
3568
3522
|
} else if (c === 47 && i && tok.length > 1) {
|
|
3569
3523
|
const match = toks[i - 1].match(divisionLookBehind);
|
|
3570
3524
|
if (match && !keywordRegexLookBehind[match[0]]) {
|
|
3571
|
-
str = str.
|
|
3572
|
-
toks = str.match(bindingToken);
|
|
3525
|
+
str = str.substring(str.indexOf(tok) + 1);
|
|
3526
|
+
toks = (_b = str.match(bindingToken)) != null ? _b : [];
|
|
3573
3527
|
i = -1;
|
|
3574
3528
|
tok = "/";
|
|
3575
3529
|
}
|
|
@@ -3586,7 +3540,7 @@ ${name} ${msg} of ${this.text}
|
|
|
3586
3540
|
}
|
|
3587
3541
|
|
|
3588
3542
|
// ../../packages/computed/src/computed.ts
|
|
3589
|
-
var computedState =
|
|
3543
|
+
var computedState = /* @__PURE__ */ Symbol("_state");
|
|
3590
3544
|
var DISPOSED_STATE = {
|
|
3591
3545
|
dependencyTracking: null,
|
|
3592
3546
|
dependenciesCount: 0,
|
|
@@ -3598,19 +3552,19 @@ ${name} ${msg} of ${this.text}
|
|
|
3598
3552
|
readFunction: null,
|
|
3599
3553
|
_options: null
|
|
3600
3554
|
};
|
|
3601
|
-
function computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget,
|
|
3555
|
+
function computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget, options4) {
|
|
3602
3556
|
if (typeof evaluatorFunctionOrOptions === "object") {
|
|
3603
|
-
|
|
3557
|
+
options4 = evaluatorFunctionOrOptions;
|
|
3604
3558
|
} else {
|
|
3605
|
-
|
|
3559
|
+
options4 = options4 || {};
|
|
3606
3560
|
if (evaluatorFunctionOrOptions) {
|
|
3607
|
-
|
|
3561
|
+
options4.read = evaluatorFunctionOrOptions;
|
|
3608
3562
|
}
|
|
3609
3563
|
}
|
|
3610
|
-
if (typeof (
|
|
3564
|
+
if (typeof (options4 == null ? void 0 : options4.read) !== "function") {
|
|
3611
3565
|
throw Error("Pass a function that returns the value of the computed");
|
|
3612
3566
|
}
|
|
3613
|
-
const writeFunction =
|
|
3567
|
+
const writeFunction = options4.write;
|
|
3614
3568
|
const state = {
|
|
3615
3569
|
latestValue: void 0,
|
|
3616
3570
|
isStale: true,
|
|
@@ -3620,10 +3574,10 @@ ${name} ${msg} of ${this.text}
|
|
|
3620
3574
|
isDisposed: false,
|
|
3621
3575
|
pure: false,
|
|
3622
3576
|
isSleeping: false,
|
|
3623
|
-
readFunction:
|
|
3624
|
-
evaluatorFunctionTarget: evaluatorFunctionTarget ||
|
|
3625
|
-
disposeWhenNodeIsRemoved:
|
|
3626
|
-
disposeWhen:
|
|
3577
|
+
readFunction: options4.read,
|
|
3578
|
+
evaluatorFunctionTarget: evaluatorFunctionTarget || options4.owner,
|
|
3579
|
+
disposeWhenNodeIsRemoved: options4.disposeWhenNodeIsRemoved || null,
|
|
3580
|
+
disposeWhen: options4.disposeWhen,
|
|
3627
3581
|
domNodeDisposalCallback: null,
|
|
3628
3582
|
dependencyTracking: {},
|
|
3629
3583
|
dependenciesCount: 0,
|
|
@@ -3654,18 +3608,18 @@ ${name} ${msg} of ${this.text}
|
|
|
3654
3608
|
computedObservable.isWriteable = typeof writeFunction === "function";
|
|
3655
3609
|
subscribable.fn.init(computedObservable);
|
|
3656
3610
|
Object.setPrototypeOf(computedObservable, computed.fn);
|
|
3657
|
-
if (
|
|
3611
|
+
if (options4.pure) {
|
|
3658
3612
|
state.pure = true;
|
|
3659
3613
|
state.isSleeping = true;
|
|
3660
3614
|
extend(computedObservable, pureComputedOverrides);
|
|
3661
|
-
} else if (
|
|
3615
|
+
} else if (options4.deferEvaluation) {
|
|
3662
3616
|
extend(computedObservable, deferEvaluationOverrides);
|
|
3663
3617
|
}
|
|
3664
3618
|
if (options_default.deferUpdates) {
|
|
3665
3619
|
extenders.deferred(computedObservable, true);
|
|
3666
3620
|
}
|
|
3667
3621
|
if (options_default.debug) {
|
|
3668
|
-
computedObservable._options =
|
|
3622
|
+
computedObservable._options = options4;
|
|
3669
3623
|
}
|
|
3670
3624
|
if (state.disposeWhenNodeIsRemoved) {
|
|
3671
3625
|
state.suppressDisposalUntilDisposeWhenReturnsFalse = true;
|
|
@@ -3673,7 +3627,7 @@ ${name} ${msg} of ${this.text}
|
|
|
3673
3627
|
state.disposeWhenNodeIsRemoved = null;
|
|
3674
3628
|
}
|
|
3675
3629
|
}
|
|
3676
|
-
if (!state.isSleeping && !
|
|
3630
|
+
if (!state.isSleeping && !options4.deferEvaluation) {
|
|
3677
3631
|
;
|
|
3678
3632
|
computedObservable.evaluateImmediate();
|
|
3679
3633
|
}
|
|
@@ -4014,10 +3968,10 @@ ${name} ${msg} of ${this.text}
|
|
|
4014
3968
|
const evaluator = evaluatorFunctionOrOptions;
|
|
4015
3969
|
return computed(evaluator, evaluatorFunctionTarget, { pure: true });
|
|
4016
3970
|
} else {
|
|
4017
|
-
let
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
return computed(
|
|
3971
|
+
let options4 = evaluatorFunctionOrOptions;
|
|
3972
|
+
options4 = extend({}, options4);
|
|
3973
|
+
options4.pure = true;
|
|
3974
|
+
return computed(options4, evaluatorFunctionTarget);
|
|
4021
3975
|
}
|
|
4022
3976
|
}
|
|
4023
3977
|
|
|
@@ -4080,7 +4034,7 @@ ${name} ${msg} of ${this.text}
|
|
|
4080
4034
|
object[prop] = value2;
|
|
4081
4035
|
return true;
|
|
4082
4036
|
},
|
|
4083
|
-
deleteProperty(property) {
|
|
4037
|
+
deleteProperty(_target, property) {
|
|
4084
4038
|
delete mirror[property];
|
|
4085
4039
|
return delete object[property];
|
|
4086
4040
|
},
|
|
@@ -4142,8 +4096,8 @@ ${name} ${msg} of ${this.text}
|
|
|
4142
4096
|
}
|
|
4143
4097
|
|
|
4144
4098
|
// ../../packages/lifecycle/src/LifeCycle.ts
|
|
4145
|
-
var SUBSCRIPTIONS =
|
|
4146
|
-
var ANCHOR_NODE =
|
|
4099
|
+
var SUBSCRIPTIONS = /* @__PURE__ */ Symbol("LifeCycle Subscriptions List");
|
|
4100
|
+
var ANCHOR_NODE = /* @__PURE__ */ Symbol("LifeCycle Anchor Node");
|
|
4147
4101
|
var LifeCycle = class _LifeCycle {
|
|
4148
4102
|
// NOTE: For more advanced integration as an ES6 mixin, see e.g.:
|
|
4149
4103
|
// http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/
|
|
@@ -4192,14 +4146,14 @@ ${name} ${msg} of ${this.text}
|
|
|
4192
4146
|
*/
|
|
4193
4147
|
addEventListener(...args) {
|
|
4194
4148
|
const node = args[0].nodeType ? args.shift() : this[ANCHOR_NODE];
|
|
4195
|
-
const [type, act,
|
|
4149
|
+
const [type, act, options4] = args;
|
|
4196
4150
|
const handler = typeof act === "string" ? this[act].bind(this) : act;
|
|
4197
|
-
this.__addEventListener(node, type, handler,
|
|
4151
|
+
this.__addEventListener(node, type, handler, options4);
|
|
4198
4152
|
}
|
|
4199
|
-
__addEventListener(node, eventType, handler,
|
|
4200
|
-
node.addEventListener(eventType, handler,
|
|
4153
|
+
__addEventListener(node, eventType, handler, options4) {
|
|
4154
|
+
node.addEventListener(eventType, handler, options4);
|
|
4201
4155
|
function dispose() {
|
|
4202
|
-
node.removeEventListener(eventType, handler);
|
|
4156
|
+
node.removeEventListener(eventType, handler, options4);
|
|
4203
4157
|
}
|
|
4204
4158
|
addDisposeCallback(node, dispose);
|
|
4205
4159
|
this.addDisposable({ dispose });
|
|
@@ -4345,10 +4299,10 @@ ${name} ${msg} of ${this.text}
|
|
|
4345
4299
|
this,
|
|
4346
4300
|
dataItemAlias,
|
|
4347
4301
|
function(self, parentContext) {
|
|
4348
|
-
var
|
|
4302
|
+
var _a2;
|
|
4349
4303
|
self.$parentContext = parentContext;
|
|
4350
4304
|
self.$parent = parentContext == null ? void 0 : parentContext.$data;
|
|
4351
|
-
self.$parents = ((
|
|
4305
|
+
self.$parents = ((_a2 = parentContext == null ? void 0 : parentContext.$parents) != null ? _a2 : []).slice(0);
|
|
4352
4306
|
self.$parents.unshift(self.$parent);
|
|
4353
4307
|
if (extendCallback) {
|
|
4354
4308
|
extendCallback(self);
|
|
@@ -4934,12 +4888,12 @@ ${name} ${msg} of ${this.text}
|
|
|
4934
4888
|
}
|
|
4935
4889
|
var lastMappingResultDomDataKey = data_exports.nextKey();
|
|
4936
4890
|
var deletedItemDummyValue = data_exports.nextKey();
|
|
4937
|
-
function setDomNodeChildrenFromArrayMapping(domNode, array, mapping,
|
|
4891
|
+
function setDomNodeChildrenFromArrayMapping(domNode, array, mapping, options4, callbackAfterAddingNodes, editScript) {
|
|
4938
4892
|
array = array || [];
|
|
4939
4893
|
if (typeof array.length === "undefined") {
|
|
4940
4894
|
array = [array];
|
|
4941
4895
|
}
|
|
4942
|
-
|
|
4896
|
+
options4 = options4 || {};
|
|
4943
4897
|
const lastMappingResult = data_exports.get(domNode, lastMappingResultDomDataKey);
|
|
4944
4898
|
const isFirstExecution = !lastMappingResult;
|
|
4945
4899
|
const newMappingResult = new Array();
|
|
@@ -4986,7 +4940,7 @@ ${name} ${msg} of ${this.text}
|
|
|
4986
4940
|
const lastArray = arrayMap(lastMappingResult, function(x) {
|
|
4987
4941
|
return x.arrayEntry;
|
|
4988
4942
|
});
|
|
4989
|
-
const compareOptions = { dontLimitMoves:
|
|
4943
|
+
const compareOptions = { dontLimitMoves: options4.dontLimitMoves, sparse: true };
|
|
4990
4944
|
editScript = compareArrays(lastArray, array, compareOptions);
|
|
4991
4945
|
}
|
|
4992
4946
|
for (let i = 0, editScriptItem, movedIndex, itemIndex; editScriptItem = editScript[i]; i++) {
|
|
@@ -5004,7 +4958,7 @@ ${name} ${msg} of ${this.text}
|
|
|
5004
4958
|
mapData.dependentObservable = void 0;
|
|
5005
4959
|
}
|
|
5006
4960
|
if (fixUpContinuousNodeArray(mapData.mappedNodes, domNode).length) {
|
|
5007
|
-
if (
|
|
4961
|
+
if (options4.beforeRemove) {
|
|
5008
4962
|
newMappingResult.push(mapData);
|
|
5009
4963
|
itemsToProcess.push(mapData);
|
|
5010
4964
|
countWaitingForRemove++;
|
|
@@ -5039,8 +4993,8 @@ ${name} ${msg} of ${this.text}
|
|
|
5039
4993
|
newMappingResult["_countWaitingForRemove"] = countWaitingForRemove;
|
|
5040
4994
|
}
|
|
5041
4995
|
data_exports.set(domNode, lastMappingResultDomDataKey, newMappingResult);
|
|
5042
|
-
callCallback(
|
|
5043
|
-
arrayForEach(nodesToDelete,
|
|
4996
|
+
callCallback(options4.beforeMove, itemsForMoveCallbacks);
|
|
4997
|
+
arrayForEach(nodesToDelete, options4.beforeRemove ? cleanNode : removeNode);
|
|
5044
4998
|
for (let k = 0, nextNode = virtualElements_exports.firstChild(domNode), lastNode, node; mapData = itemsToProcess[k]; k++) {
|
|
5045
4999
|
if (!mapData.mappedNodes) {
|
|
5046
5000
|
extend(
|
|
@@ -5064,12 +5018,12 @@ ${name} ${msg} of ${this.text}
|
|
|
5064
5018
|
mapData.initialized = true;
|
|
5065
5019
|
}
|
|
5066
5020
|
}
|
|
5067
|
-
callCallback(
|
|
5021
|
+
callCallback(options4.beforeRemove, itemsForBeforeRemoveCallbacks);
|
|
5068
5022
|
for (let x = 0; x < itemsForBeforeRemoveCallbacks.length; ++x) {
|
|
5069
5023
|
itemsForBeforeRemoveCallbacks[x].arrayEntry = deletedItemDummyValue;
|
|
5070
5024
|
}
|
|
5071
|
-
callCallback(
|
|
5072
|
-
callCallback(
|
|
5025
|
+
callCallback(options4.afterMove, itemsForMoveCallbacks);
|
|
5026
|
+
callCallback(options4.afterAdd, itemsForAfterAddCallbacks);
|
|
5073
5027
|
}
|
|
5074
5028
|
|
|
5075
5029
|
// ../../packages/bind/src/DescendantBindingHandler.ts
|
|
@@ -5183,8 +5137,8 @@ ${name} ${msg} of ${this.text}
|
|
|
5183
5137
|
function templateEngine() {
|
|
5184
5138
|
}
|
|
5185
5139
|
extend(templateEngine.prototype, {
|
|
5186
|
-
renderTemplateSource(templateSource, bindingContext2,
|
|
5187
|
-
|
|
5140
|
+
renderTemplateSource(templateSource, bindingContext2, options4, templateDocument) {
|
|
5141
|
+
options4.onError("Override renderTemplateSource");
|
|
5188
5142
|
},
|
|
5189
5143
|
createJavaScriptEvaluatorBlock(script) {
|
|
5190
5144
|
options_default.onError(new Error("Override createJavaScriptEvaluatorBlock"));
|
|
@@ -5205,9 +5159,9 @@ ${name} ${msg} of ${this.text}
|
|
|
5205
5159
|
throw options_default.onError(new Error("Unknown template type: " + template), false);
|
|
5206
5160
|
}
|
|
5207
5161
|
},
|
|
5208
|
-
renderTemplate(template, bindingContext2,
|
|
5162
|
+
renderTemplate(template, bindingContext2, options4, templateDocument) {
|
|
5209
5163
|
const templateSource = this.makeTemplateSource(template, templateDocument);
|
|
5210
|
-
return this.renderTemplateSource(templateSource, bindingContext2,
|
|
5164
|
+
return this.renderTemplateSource(templateSource, bindingContext2, options4, templateDocument);
|
|
5211
5165
|
}
|
|
5212
5166
|
});
|
|
5213
5167
|
|
|
@@ -5276,12 +5230,12 @@ ${name} ${msg} of ${this.text}
|
|
|
5276
5230
|
function getFirstNodeFromPossibleArray(nodeOrNodeArray) {
|
|
5277
5231
|
return nodeOrNodeArray.nodeType ? nodeOrNodeArray : nodeOrNodeArray.length > 0 ? nodeOrNodeArray[0] : null;
|
|
5278
5232
|
}
|
|
5279
|
-
function executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext2,
|
|
5280
|
-
|
|
5233
|
+
function executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext2, options4, afterBindingCallback) {
|
|
5234
|
+
options4 = options4 || {};
|
|
5281
5235
|
const firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
|
|
5282
5236
|
const templateDocument = (firstTargetNode || template || {}).ownerDocument;
|
|
5283
|
-
const templateEngineToUse =
|
|
5284
|
-
const renderedNodesArray = templateEngineToUse.renderTemplate(template, bindingContext2,
|
|
5237
|
+
const templateEngineToUse = options4.templateEngine || _templateEngine;
|
|
5238
|
+
const renderedNodesArray = templateEngineToUse.renderTemplate(template, bindingContext2, options4, templateDocument);
|
|
5285
5239
|
if (typeof renderedNodesArray.length !== "number" || renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType !== "number") {
|
|
5286
5240
|
throw new Error("Template engine must return an array of DOM nodes");
|
|
5287
5241
|
}
|
|
@@ -5302,8 +5256,8 @@ ${name} ${msg} of ${this.text}
|
|
|
5302
5256
|
}
|
|
5303
5257
|
if (haveAddedNodesToParent) {
|
|
5304
5258
|
activateBindingsOnContinuousNodeArray(renderedNodesArray, bindingContext2, afterBindingCallback);
|
|
5305
|
-
if (
|
|
5306
|
-
dependencyDetection_exports.ignore(
|
|
5259
|
+
if (options4.afterRender) {
|
|
5260
|
+
dependencyDetection_exports.ignore(options4.afterRender, null, [renderedNodesArray, bindingContext2["$data"]]);
|
|
5307
5261
|
}
|
|
5308
5262
|
if (renderMode === "replaceChildren") {
|
|
5309
5263
|
bindingEvent.notify(targetNodeOrNodeArray, bindingEvent.childrenComplete);
|
|
@@ -5320,9 +5274,9 @@ ${name} ${msg} of ${this.text}
|
|
|
5320
5274
|
return template;
|
|
5321
5275
|
}
|
|
5322
5276
|
}
|
|
5323
|
-
function renderTemplate(template, dataOrBindingContext,
|
|
5324
|
-
|
|
5325
|
-
if ((
|
|
5277
|
+
function renderTemplate(template, dataOrBindingContext, options4, targetNodeOrNodeArray, renderMode, afterBindingCallback) {
|
|
5278
|
+
options4 = options4 || {};
|
|
5279
|
+
if ((options4.templateEngine || _templateEngine) === void 0) {
|
|
5326
5280
|
throw new Error("Set a template engine before calling renderTemplate");
|
|
5327
5281
|
}
|
|
5328
5282
|
renderMode = renderMode || "replaceChildren";
|
|
@@ -5344,7 +5298,7 @@ ${name} ${msg} of ${this.text}
|
|
|
5344
5298
|
renderMode,
|
|
5345
5299
|
templateName,
|
|
5346
5300
|
bindingContext2,
|
|
5347
|
-
|
|
5301
|
+
options4,
|
|
5348
5302
|
afterBindingCallback
|
|
5349
5303
|
);
|
|
5350
5304
|
if (renderMode === "replaceNode") {
|
|
@@ -5357,23 +5311,23 @@ ${name} ${msg} of ${this.text}
|
|
|
5357
5311
|
);
|
|
5358
5312
|
} else {
|
|
5359
5313
|
return memoization_exports.memoize(function(domNode) {
|
|
5360
|
-
renderTemplate(template, dataOrBindingContext,
|
|
5314
|
+
renderTemplate(template, dataOrBindingContext, options4, domNode, "replaceNode");
|
|
5361
5315
|
});
|
|
5362
5316
|
}
|
|
5363
5317
|
}
|
|
5364
|
-
function renderTemplateForEach(template, arrayOrObservableArray,
|
|
5318
|
+
function renderTemplateForEach(template, arrayOrObservableArray, options4, targetNode, parentBindingContext, afterBindingCallback) {
|
|
5365
5319
|
let arrayItemContext;
|
|
5366
5320
|
function executeTemplateForArrayItem(arrayValue, index) {
|
|
5367
|
-
if (
|
|
5321
|
+
if (options4.as) {
|
|
5368
5322
|
if (options_default.createChildContextWithAs) {
|
|
5369
|
-
arrayItemContext = parentBindingContext.createChildContext(arrayValue,
|
|
5323
|
+
arrayItemContext = parentBindingContext.createChildContext(arrayValue, options4.as, (context) => {
|
|
5370
5324
|
context.$index = index;
|
|
5371
5325
|
});
|
|
5372
5326
|
} else {
|
|
5373
|
-
arrayItemContext = parentBindingContext.extend({ [
|
|
5327
|
+
arrayItemContext = parentBindingContext.extend({ [options4.as]: arrayValue, $index: index });
|
|
5374
5328
|
}
|
|
5375
5329
|
} else {
|
|
5376
|
-
arrayItemContext = parentBindingContext.createChildContext(arrayValue,
|
|
5330
|
+
arrayItemContext = parentBindingContext.createChildContext(arrayValue, options4.as, (context) => {
|
|
5377
5331
|
context.$index = index;
|
|
5378
5332
|
});
|
|
5379
5333
|
}
|
|
@@ -5383,14 +5337,14 @@ ${name} ${msg} of ${this.text}
|
|
|
5383
5337
|
"ignoreTargetNode",
|
|
5384
5338
|
templateName,
|
|
5385
5339
|
arrayItemContext,
|
|
5386
|
-
|
|
5340
|
+
options4,
|
|
5387
5341
|
afterBindingCallback
|
|
5388
5342
|
);
|
|
5389
5343
|
}
|
|
5390
5344
|
const activateBindingsCallback = function(arrayValue, addedNodesArray) {
|
|
5391
5345
|
activateBindingsOnContinuousNodeArray(addedNodesArray, arrayItemContext, afterBindingCallback);
|
|
5392
|
-
if (
|
|
5393
|
-
|
|
5346
|
+
if (options4.afterRender) {
|
|
5347
|
+
options4.afterRender(addedNodesArray, arrayValue);
|
|
5394
5348
|
}
|
|
5395
5349
|
arrayItemContext = null;
|
|
5396
5350
|
};
|
|
@@ -5399,14 +5353,14 @@ ${name} ${msg} of ${this.text}
|
|
|
5399
5353
|
targetNode,
|
|
5400
5354
|
newArray,
|
|
5401
5355
|
executeTemplateForArrayItem,
|
|
5402
|
-
|
|
5356
|
+
options4,
|
|
5403
5357
|
activateBindingsCallback,
|
|
5404
5358
|
changeList
|
|
5405
5359
|
]);
|
|
5406
5360
|
bindingEvent.notify(targetNode, bindingEvent.childrenComplete);
|
|
5407
5361
|
}
|
|
5408
|
-
const shouldHideDestroyed =
|
|
5409
|
-
if (!shouldHideDestroyed && !
|
|
5362
|
+
const shouldHideDestroyed = options4.includeDestroyed === false || options_default.foreachHidesDestroyed && !options4.includeDestroyed;
|
|
5363
|
+
if (!shouldHideDestroyed && !options4.beforeRemove && isObservableArray(arrayOrObservableArray)) {
|
|
5410
5364
|
localSetDomNodeChildrenFromArrayMapping(arrayOrObservableArray.peek());
|
|
5411
5365
|
const subscription = arrayOrObservableArray.subscribe(
|
|
5412
5366
|
function(changeList) {
|
|
@@ -5482,40 +5436,40 @@ ${name} ${msg} of ${this.text}
|
|
|
5482
5436
|
const element = this.$element;
|
|
5483
5437
|
const bindingContext2 = this.$context;
|
|
5484
5438
|
const value2 = this.value;
|
|
5485
|
-
let
|
|
5439
|
+
let options4 = unwrap(value2);
|
|
5486
5440
|
let shouldDisplay = true;
|
|
5487
5441
|
let templateComputed = null;
|
|
5488
5442
|
const elseChainSatisfied = data_exports.get(element, "conditional").elseChainSatisfied;
|
|
5489
5443
|
let templateName;
|
|
5490
|
-
if (typeof
|
|
5444
|
+
if (typeof options4 === "string") {
|
|
5491
5445
|
templateName = value2;
|
|
5492
|
-
|
|
5446
|
+
options4 = {};
|
|
5493
5447
|
} else {
|
|
5494
|
-
templateName =
|
|
5495
|
-
if ("if" in
|
|
5496
|
-
shouldDisplay = unwrap(
|
|
5448
|
+
templateName = options4.name;
|
|
5449
|
+
if ("if" in options4) {
|
|
5450
|
+
shouldDisplay = unwrap(options4.if);
|
|
5497
5451
|
}
|
|
5498
|
-
if (shouldDisplay && "ifnot" in
|
|
5499
|
-
shouldDisplay = !unwrap(
|
|
5452
|
+
if (shouldDisplay && "ifnot" in options4) {
|
|
5453
|
+
shouldDisplay = !unwrap(options4.ifnot);
|
|
5500
5454
|
}
|
|
5501
5455
|
}
|
|
5502
|
-
if ("foreach" in
|
|
5503
|
-
const dataArray = shouldDisplay &&
|
|
5456
|
+
if ("foreach" in options4) {
|
|
5457
|
+
const dataArray = shouldDisplay && options4.foreach || [];
|
|
5504
5458
|
templateComputed = renderTemplateForEach(
|
|
5505
5459
|
templateName || element,
|
|
5506
5460
|
dataArray,
|
|
5507
|
-
|
|
5461
|
+
options4,
|
|
5508
5462
|
element,
|
|
5509
5463
|
bindingContext2,
|
|
5510
5464
|
this.completeBinding
|
|
5511
5465
|
);
|
|
5512
5466
|
elseChainSatisfied((unwrap(dataArray) || []).length !== 0);
|
|
5513
5467
|
} else if (shouldDisplay) {
|
|
5514
|
-
const innerBindingContext = "data" in
|
|
5468
|
+
const innerBindingContext = "data" in options4 ? bindingContext2.createStaticChildContext(options4.data, options4.as) : bindingContext2;
|
|
5515
5469
|
templateComputed = renderTemplate(
|
|
5516
5470
|
templateName || element,
|
|
5517
5471
|
innerBindingContext,
|
|
5518
|
-
|
|
5472
|
+
options4,
|
|
5519
5473
|
element,
|
|
5520
5474
|
void 0,
|
|
5521
5475
|
this.completeBinding
|
|
@@ -5551,7 +5505,7 @@ ${name} ${msg} of ${this.text}
|
|
|
5551
5505
|
}
|
|
5552
5506
|
nativeTemplateEngine.prototype = new templateEngine();
|
|
5553
5507
|
nativeTemplateEngine.prototype.constructor = nativeTemplateEngine;
|
|
5554
|
-
nativeTemplateEngine.prototype.renderTemplateSource = function(templateSource, bindingContext2,
|
|
5508
|
+
nativeTemplateEngine.prototype.renderTemplateSource = function(templateSource, bindingContext2, options4, templateDocument) {
|
|
5555
5509
|
const templateNodes = templateSource.nodes ? templateSource.nodes() : null;
|
|
5556
5510
|
if (templateNodes) {
|
|
5557
5511
|
return makeArray(templateNodes.cloneNode(true).childNodes);
|
|
@@ -5690,9 +5644,9 @@ ${name} ${msg} of ${this.text}
|
|
|
5690
5644
|
bindingEvent
|
|
5691
5645
|
};
|
|
5692
5646
|
var Builder = class {
|
|
5693
|
-
constructor({ provider: provider2, bindings: bindings6, extenders: extenders3, filters: filters2, options:
|
|
5647
|
+
constructor({ provider: provider2, bindings: bindings6, extenders: extenders3, filters: filters2, options: options4 }) {
|
|
5694
5648
|
__publicField(this, "providedProperties");
|
|
5695
|
-
Object.assign(knockout.options,
|
|
5649
|
+
Object.assign(knockout.options, options4, { filters: filters2, bindingProviderInstance: provider2 });
|
|
5696
5650
|
provider2.setGlobals(knockout.options.bindingGlobals);
|
|
5697
5651
|
if (Array.isArray(bindings6)) {
|
|
5698
5652
|
for (const bindingsObject of bindings6) {
|
|
@@ -6204,8 +6158,12 @@ ${name} ${msg} of ${this.text}
|
|
|
6204
6158
|
function possiblyGetConfigFromAmd(errorCallback, config, callback) {
|
|
6205
6159
|
if (typeof config.require === "string") {
|
|
6206
6160
|
if (window.amdRequire || window.require) {
|
|
6207
|
-
;
|
|
6208
|
-
|
|
6161
|
+
const amdRequire = window.amdRequire || window.require;
|
|
6162
|
+
amdRequire([config.require], callback, function(err) {
|
|
6163
|
+
var _a2;
|
|
6164
|
+
const details = (_a2 = err == null ? void 0 : err.message) != null ? _a2 : String(err || "");
|
|
6165
|
+
errorCallback("Failed to load AMD module: " + config.require + (details ? " \u2014 " + details : ""));
|
|
6166
|
+
});
|
|
6209
6167
|
} else {
|
|
6210
6168
|
errorCallback("Uses require, but no AMD loader is present");
|
|
6211
6169
|
}
|
|
@@ -6236,22 +6194,28 @@ ${name} ${msg} of ${this.text}
|
|
|
6236
6194
|
* 2. An array of DOM nodes
|
|
6237
6195
|
* 3. A document fragment
|
|
6238
6196
|
* 4. An AMD module (with `{require: 'some/template'}`)
|
|
6197
|
+
* If neither this nor `element` is overloaded, the component's own
|
|
6198
|
+
* children serve as its template (children-as-template mode).
|
|
6239
6199
|
* @return {mixed} One of the accepted template types for the ComponentBinding.
|
|
6240
6200
|
*/
|
|
6241
6201
|
static get template() {
|
|
6242
6202
|
if ("template" in this.prototype) {
|
|
6243
6203
|
return void 0;
|
|
6244
6204
|
}
|
|
6245
|
-
|
|
6205
|
+
const element = this.element;
|
|
6206
|
+
return element ? { element } : void 0;
|
|
6246
6207
|
}
|
|
6247
6208
|
/**
|
|
6248
|
-
*
|
|
6209
|
+
* Overload this to return:
|
|
6249
6210
|
* 1. The element ID
|
|
6250
6211
|
* 2. A DOM node itself
|
|
6251
|
-
*
|
|
6212
|
+
* Leave unset to use children-as-template mode — the component's own
|
|
6213
|
+
* instance children become its template.
|
|
6214
|
+
* @return {string|HTMLElement|undefined} the element ID, actual element,
|
|
6215
|
+
* or undefined to opt into children-as-template.
|
|
6252
6216
|
*/
|
|
6253
6217
|
static get element() {
|
|
6254
|
-
|
|
6218
|
+
return void 0;
|
|
6255
6219
|
}
|
|
6256
6220
|
/**
|
|
6257
6221
|
* @return {bool} True if the component shall load synchronously
|
|
@@ -6340,7 +6304,7 @@ ${name} ${msg} of ${this.text}
|
|
|
6340
6304
|
const tagName = tagNameLower(node);
|
|
6341
6305
|
if (src_default.isRegistered(tagName)) {
|
|
6342
6306
|
const hasDash = tagName.includes("-");
|
|
6343
|
-
const isUnknownEntity =
|
|
6307
|
+
const isUnknownEntity = Object.prototype.toString.call(node) === "[object HTMLUnknownElement]";
|
|
6344
6308
|
if (hasDash || isUnknownEntity) {
|
|
6345
6309
|
return tagName;
|
|
6346
6310
|
}
|
|
@@ -6510,7 +6474,7 @@ ${name} ${msg} of ${this.text}
|
|
|
6510
6474
|
objectForEach(value2, function(attrName, attrValue) {
|
|
6511
6475
|
attrValue = unwrap(attrValue);
|
|
6512
6476
|
const prefixLen = attrName.indexOf(":");
|
|
6513
|
-
const namespace = prefixLen > 0 && element.lookupNamespaceURI(attrName.
|
|
6477
|
+
const namespace = prefixLen > 0 && element.lookupNamespaceURI(attrName.substring(0, prefixLen));
|
|
6514
6478
|
const toRemove = attrValue === false || attrValue === null || attrValue === void 0;
|
|
6515
6479
|
if (toRemove) {
|
|
6516
6480
|
if (namespace) {
|
|
@@ -6659,10 +6623,7 @@ ${name} ${msg} of ${this.text}
|
|
|
6659
6623
|
}
|
|
6660
6624
|
const bubbleMark = allBindings.get(eventName + "Bubble") !== false;
|
|
6661
6625
|
if (bubble === false || !bubbleMark) {
|
|
6662
|
-
event.
|
|
6663
|
-
if (event.stopPropagation) {
|
|
6664
|
-
event.stopPropagation();
|
|
6665
|
-
}
|
|
6626
|
+
event.stopPropagation();
|
|
6666
6627
|
}
|
|
6667
6628
|
};
|
|
6668
6629
|
if (debounce2) {
|
|
@@ -6696,13 +6657,13 @@ ${name} ${msg} of ${this.text}
|
|
|
6696
6657
|
toggleDomNodeCssClass(element, className, shouldHaveClass);
|
|
6697
6658
|
});
|
|
6698
6659
|
} else {
|
|
6699
|
-
value2 =
|
|
6660
|
+
value2 = String(value2 != null ? value2 : "").trim();
|
|
6700
6661
|
toggleDomNodeCssClass(element, element[css.classesWrittenByBindingKey], false);
|
|
6701
6662
|
element[css.classesWrittenByBindingKey] = value2;
|
|
6702
6663
|
toggleDomNodeCssClass(element, value2, true);
|
|
6703
6664
|
}
|
|
6704
6665
|
},
|
|
6705
|
-
classesWrittenByBindingKey:
|
|
6666
|
+
classesWrittenByBindingKey: /* @__PURE__ */ Symbol("__ko__cssValue")
|
|
6706
6667
|
};
|
|
6707
6668
|
|
|
6708
6669
|
// ../../packages/binding.core/src/descendantsComplete.ts
|
|
@@ -6737,8 +6698,8 @@ ${name} ${msg} of ${this.text}
|
|
|
6737
6698
|
};
|
|
6738
6699
|
|
|
6739
6700
|
// ../../packages/binding.core/src/hasfocus.ts
|
|
6740
|
-
var hasfocusUpdatingProperty =
|
|
6741
|
-
var hasfocusLastValue =
|
|
6701
|
+
var hasfocusUpdatingProperty = /* @__PURE__ */ Symbol("__ko_hasfocusUpdating");
|
|
6702
|
+
var hasfocusLastValue = /* @__PURE__ */ Symbol("__ko_hasfocusLastValue");
|
|
6742
6703
|
var hasfocus = {
|
|
6743
6704
|
init: function(element, valueAccessor, _allBindings) {
|
|
6744
6705
|
const handleElementFocusChange = function(isFocused) {
|
|
@@ -6809,7 +6770,7 @@ ${name} ${msg} of ${this.text}
|
|
|
6809
6770
|
|
|
6810
6771
|
// ../../packages/binding.core/src/options.ts
|
|
6811
6772
|
var captionPlaceholder = {};
|
|
6812
|
-
var
|
|
6773
|
+
var options3 = {
|
|
6813
6774
|
init: function(element) {
|
|
6814
6775
|
if (tagNameLower(element) !== "select") {
|
|
6815
6776
|
throw new Error("options binding applies only to SELECT elements");
|
|
@@ -6979,7 +6940,7 @@ ${name} ${msg} of ${this.text}
|
|
|
6979
6940
|
styleValue = "";
|
|
6980
6941
|
}
|
|
6981
6942
|
if (options_default.jQuery) {
|
|
6982
|
-
jQuery(element).css(styleName, styleValue);
|
|
6943
|
+
options_default.jQuery(element).css(styleName, styleValue);
|
|
6983
6944
|
} else {
|
|
6984
6945
|
styleName = styleName.replace(/-(\w)/g, (all, letter) => letter.toUpperCase());
|
|
6985
6946
|
const previousStyle = element.style[styleName];
|
|
@@ -7031,7 +6992,6 @@ ${name} ${msg} of ${this.text}
|
|
|
7031
6992
|
var MSIE_REGEX = /MSIE ([^ ;]+)|rv:([^ )]+)/;
|
|
7032
6993
|
var operaVersion;
|
|
7033
6994
|
var safariVersion;
|
|
7034
|
-
var firefoxVersion;
|
|
7035
6995
|
var ieVersion;
|
|
7036
6996
|
var TextInput = class extends BindingHandler {
|
|
7037
6997
|
constructor(...args) {
|
|
@@ -7120,20 +7080,6 @@ ${name} ${msg} of ${this.text}
|
|
|
7120
7080
|
return ["keydown"];
|
|
7121
7081
|
}
|
|
7122
7082
|
};
|
|
7123
|
-
var TextInputLegacyFirefox = class extends TextInput {
|
|
7124
|
-
eventsIndicatingValueChange() {
|
|
7125
|
-
return [
|
|
7126
|
-
...super.eventsIndicatingSyncValueChange(),
|
|
7127
|
-
// Firefox <= 3.6 doesn't fire the 'input' event when text is filled in through autocomplete
|
|
7128
|
-
"DOMAutoComplete",
|
|
7129
|
-
// Firefox <=3.5 doesn't fire the 'input' event when text is dropped into the input.
|
|
7130
|
-
"dragdrop",
|
|
7131
|
-
// < 3.5
|
|
7132
|
-
"drop"
|
|
7133
|
-
// 3.5
|
|
7134
|
-
];
|
|
7135
|
-
}
|
|
7136
|
-
};
|
|
7137
7083
|
var w = options_default.global;
|
|
7138
7084
|
if (w.navigator) {
|
|
7139
7085
|
const parseVersion = (matches) => matches && parseFloat(matches[1]);
|
|
@@ -7142,12 +7088,11 @@ ${name} ${msg} of ${this.text}
|
|
|
7142
7088
|
if (!isChrome) {
|
|
7143
7089
|
operaVersion = w.opera && w.opera.version && parseInt(w.opera.version());
|
|
7144
7090
|
safariVersion = parseVersion(userAgent.match(/Version\/([^ ]+) Safari/));
|
|
7145
|
-
firefoxVersion = parseVersion(userAgent.match(/Firefox\/([^ ]*)/));
|
|
7146
7091
|
const ieMatch = userAgent.match(MSIE_REGEX);
|
|
7147
7092
|
ieVersion = ieMatch && (parseFloat(ieMatch[1]) || parseFloat(ieMatch[2]));
|
|
7148
7093
|
}
|
|
7149
7094
|
}
|
|
7150
|
-
var textInput = ieVersion && ieVersion <= 11 ? TextInputIE : safariVersion && safariVersion < 5 ? TextInputLegacySafari : operaVersion && operaVersion < 11 ? TextInputLegacyOpera :
|
|
7095
|
+
var textInput = ieVersion && ieVersion <= 11 ? TextInputIE : safariVersion && safariVersion < 5 ? TextInputLegacySafari : operaVersion && operaVersion < 11 ? TextInputLegacyOpera : TextInput;
|
|
7151
7096
|
|
|
7152
7097
|
// ../../packages/binding.core/src/uniqueName.ts
|
|
7153
7098
|
var uniqueName = {
|
|
@@ -7213,7 +7158,7 @@ ${name} ${msg} of ${this.text}
|
|
|
7213
7158
|
}
|
|
7214
7159
|
registerEvent(eventName) {
|
|
7215
7160
|
let handler = this.valueUpdateHandler.bind(this);
|
|
7216
|
-
if (
|
|
7161
|
+
if (eventName.startsWith("after")) {
|
|
7217
7162
|
handler = () => {
|
|
7218
7163
|
this.elementValueBeforeEvent = selectExtensions.readValue(this.$element);
|
|
7219
7164
|
safeSetTimeout(this.valueUpdateHandler.bind(this), 0);
|
|
@@ -7303,7 +7248,7 @@ ${name} ${msg} of ${this.text}
|
|
|
7303
7248
|
html,
|
|
7304
7249
|
let: let_default,
|
|
7305
7250
|
on: onHandler,
|
|
7306
|
-
options:
|
|
7251
|
+
options: options3,
|
|
7307
7252
|
selectedOptions,
|
|
7308
7253
|
style,
|
|
7309
7254
|
submit,
|
|
@@ -7519,7 +7464,7 @@ ${name} ${msg} of ${this.text}
|
|
|
7519
7464
|
};
|
|
7520
7465
|
|
|
7521
7466
|
// ../../packages/binding.foreach/src/foreach.ts
|
|
7522
|
-
var MAX_LIST_SIZE =
|
|
7467
|
+
var MAX_LIST_SIZE = Number.MAX_SAFE_INTEGER;
|
|
7523
7468
|
function isPlainObject(o) {
|
|
7524
7469
|
return !!o && typeof o === "object" && o.constructor === Object;
|
|
7525
7470
|
}
|
|
@@ -7545,10 +7490,10 @@ ${name} ${msg} of ${this.text}
|
|
|
7545
7490
|
function valueToChangeAddItem(value2, index) {
|
|
7546
7491
|
return { status: "added", value: value2, index };
|
|
7547
7492
|
}
|
|
7548
|
-
var PENDING_DELETE_INDEX_SYM =
|
|
7493
|
+
var PENDING_DELETE_INDEX_SYM = /* @__PURE__ */ Symbol("_ko_ffe_pending_delete_index");
|
|
7549
7494
|
var _ForEachBinding = class _ForEachBinding extends AsyncBindingHandler {
|
|
7550
7495
|
constructor(params) {
|
|
7551
|
-
var
|
|
7496
|
+
var _a2;
|
|
7552
7497
|
super(params);
|
|
7553
7498
|
// NOTE: valid valueAccessors include:
|
|
7554
7499
|
// []
|
|
@@ -7583,7 +7528,7 @@ ${name} ${msg} of ${this.text}
|
|
|
7583
7528
|
this.generateContext = this.createContextGenerator(this.as);
|
|
7584
7529
|
this.$indexHasBeenRequested = false;
|
|
7585
7530
|
this.templateNode = makeTemplateNode(
|
|
7586
|
-
settings.templateNode || (settings.name ? (
|
|
7531
|
+
settings.templateNode || (settings.name ? (_a2 = document.getElementById(settings.name)) == null ? void 0 : _a2.cloneNode(true) : this.$element)
|
|
7587
7532
|
);
|
|
7588
7533
|
["afterAdd", "beforeRemove", "afterQueueFlush", "beforeQueueFlush"].forEach((p) => {
|
|
7589
7534
|
this[p] = settings[p] || this.allBindings.get(p);
|
|
@@ -8021,25 +7966,45 @@ ${name} ${msg} of ${this.text}
|
|
|
8021
7966
|
|
|
8022
7967
|
// ../../packages/utils.jsx/src/jsxClean.ts
|
|
8023
7968
|
var DELAY_MS = 25;
|
|
8024
|
-
var MAX_CLEAN_AT_ONCE = 1e3;
|
|
8025
7969
|
var cleanNodeQueue = new Array();
|
|
8026
7970
|
var cleanNodeTimeoutID = null;
|
|
7971
|
+
defineOption("jsxCleanBatchSize", { default: 1e3 });
|
|
8027
7972
|
function queueCleanNode(node) {
|
|
8028
7973
|
cleanNodeQueue.push(node);
|
|
8029
|
-
|
|
7974
|
+
if (options_default.jsxCleanBatchSize === 0) {
|
|
7975
|
+
flushAll();
|
|
7976
|
+
} else {
|
|
7977
|
+
scheduleBatch();
|
|
7978
|
+
}
|
|
8030
7979
|
}
|
|
8031
|
-
function
|
|
7980
|
+
function scheduleBatch() {
|
|
8032
7981
|
if (!cleanNodeTimeoutID && cleanNodeQueue.length) {
|
|
8033
|
-
cleanNodeTimeoutID = setTimeout(
|
|
7982
|
+
cleanNodeTimeoutID = setTimeout(flushBatch, DELAY_MS);
|
|
8034
7983
|
}
|
|
8035
7984
|
}
|
|
8036
|
-
function
|
|
7985
|
+
function flushBatch() {
|
|
8037
7986
|
cleanNodeTimeoutID = null;
|
|
8038
|
-
const
|
|
7987
|
+
const batchSize = Math.trunc(options_default.jsxCleanBatchSize);
|
|
7988
|
+
if (!Number.isFinite(batchSize) || batchSize <= 0) {
|
|
7989
|
+
flushAll();
|
|
7990
|
+
return;
|
|
7991
|
+
}
|
|
7992
|
+
const nodes = cleanNodeQueue.splice(0, batchSize);
|
|
8039
7993
|
for (const node of nodes) {
|
|
8040
7994
|
cleanNode(node);
|
|
8041
7995
|
}
|
|
8042
|
-
|
|
7996
|
+
scheduleBatch();
|
|
7997
|
+
}
|
|
7998
|
+
function flushAll() {
|
|
7999
|
+
if (cleanNodeTimeoutID !== null) {
|
|
8000
|
+
clearTimeout(cleanNodeTimeoutID);
|
|
8001
|
+
cleanNodeTimeoutID = null;
|
|
8002
|
+
}
|
|
8003
|
+
while (cleanNodeQueue.length) {
|
|
8004
|
+
for (const node of cleanNodeQueue.splice(0)) {
|
|
8005
|
+
cleanNode(node);
|
|
8006
|
+
}
|
|
8007
|
+
}
|
|
8043
8008
|
}
|
|
8044
8009
|
|
|
8045
8010
|
// ../../packages/utils.jsx/src/JsxObserver.ts
|
|
@@ -8115,12 +8080,12 @@ ${name} ${msg} of ${this.text}
|
|
|
8115
8080
|
this.dispose();
|
|
8116
8081
|
}
|
|
8117
8082
|
dispose() {
|
|
8118
|
-
var
|
|
8083
|
+
var _a2;
|
|
8119
8084
|
super.dispose();
|
|
8120
8085
|
const ib = this.insertBefore;
|
|
8121
8086
|
const insertBeforeIsChild = ib && this.parentNodeTarget === ib.parentNode;
|
|
8122
8087
|
if (insertBeforeIsChild && !this.adoptedInsertBefore) {
|
|
8123
|
-
(
|
|
8088
|
+
(_a2 = this.parentNodeTarget) == null ? void 0 : _a2.removeChild(ib);
|
|
8124
8089
|
}
|
|
8125
8090
|
this.removeAllPriorNodes();
|
|
8126
8091
|
Object.assign(this, {
|
|
@@ -8171,7 +8136,7 @@ ${name} ${msg} of ${this.text}
|
|
|
8171
8136
|
this.nodeArrayOrObservableAtIndex.splice(index, 0, this.injectNode(jsx, this.lastNodeFor(index)));
|
|
8172
8137
|
}
|
|
8173
8138
|
injectNode(jsx, nextNode) {
|
|
8174
|
-
var
|
|
8139
|
+
var _a2;
|
|
8175
8140
|
let nodeArrayOrObservable;
|
|
8176
8141
|
if (isObservable(jsx)) {
|
|
8177
8142
|
const { parentNode, xmlns } = this;
|
|
@@ -8192,7 +8157,7 @@ ${name} ${msg} of ${this.text}
|
|
|
8192
8157
|
nodeArrayOrObservable = [this.anyToNode(jsx)];
|
|
8193
8158
|
}
|
|
8194
8159
|
for (const node of nodeArrayOrObservable) {
|
|
8195
|
-
(
|
|
8160
|
+
(_a2 = this.parentNodeTarget) == null ? void 0 : _a2.insertBefore(node, nextNode);
|
|
8196
8161
|
if (shouldApplyBindings && this.canApplyBindings(node)) {
|
|
8197
8162
|
applyBindings($context, node);
|
|
8198
8163
|
}
|
|
@@ -8443,6 +8408,19 @@ ${name} ${msg} of ${this.text}
|
|
|
8443
8408
|
this.originalChildNodes = makeArray(virtualElements_exports.childNodes(this.$element));
|
|
8444
8409
|
this.computed("computeApplyComponent");
|
|
8445
8410
|
}
|
|
8411
|
+
/**
|
|
8412
|
+
* True when originalChildNodes contain at least one element or a text
|
|
8413
|
+
* node with non-whitespace content. Whitespace-only children are treated
|
|
8414
|
+
* as "no children" so `<my-comp> </my-comp>` still errors.
|
|
8415
|
+
*/
|
|
8416
|
+
hasMeaningfulChildren() {
|
|
8417
|
+
return this.originalChildNodes.some(
|
|
8418
|
+
(n) => {
|
|
8419
|
+
var _a2;
|
|
8420
|
+
return n.nodeType === Node.ELEMENT_NODE || n.nodeType === Node.TEXT_NODE && ((_a2 = n.nodeValue) != null ? _a2 : "").trim().length > 0;
|
|
8421
|
+
}
|
|
8422
|
+
);
|
|
8423
|
+
}
|
|
8446
8424
|
cloneTemplateIntoElement(componentName, template, element) {
|
|
8447
8425
|
if (!template) {
|
|
8448
8426
|
throw new Error("Component '" + componentName + "' has no template");
|
|
@@ -8531,11 +8509,14 @@ ${name} ${msg} of ${this.text}
|
|
|
8531
8509
|
);
|
|
8532
8510
|
this.childBindingContext = this.makeChildBindingContext(componentViewModel);
|
|
8533
8511
|
const viewTemplate = componentViewModel && componentViewModel.template;
|
|
8534
|
-
if (!viewTemplate && !componentDefinition.template) {
|
|
8535
|
-
throw new Error("Component '" + componentName + "' has no template");
|
|
8536
|
-
}
|
|
8537
8512
|
if (!componentDefinition.template) {
|
|
8538
|
-
|
|
8513
|
+
if (viewTemplate) {
|
|
8514
|
+
this.cloneTemplateIntoElement(componentName, viewTemplate, element);
|
|
8515
|
+
} else if (!this.hasMeaningfulChildren()) {
|
|
8516
|
+
throw new Error("Component '" + componentName + "' has no template");
|
|
8517
|
+
} else {
|
|
8518
|
+
this.cloneTemplateIntoElement(componentName, this.originalChildNodes, element);
|
|
8519
|
+
}
|
|
8539
8520
|
}
|
|
8540
8521
|
if (componentViewModel instanceof LifeCycle) {
|
|
8541
8522
|
componentViewModel.anchorTo(this.$element);
|
|
@@ -8658,10 +8639,10 @@ ${name} ${msg} of ${this.text}
|
|
|
8658
8639
|
return replacement + value2.slice(-length);
|
|
8659
8640
|
case "middle": {
|
|
8660
8641
|
const leftLen = Math.ceil(length / 2);
|
|
8661
|
-
return value2.
|
|
8642
|
+
return value2.substring(0, leftLen) + replacement + value2.slice(leftLen - length);
|
|
8662
8643
|
}
|
|
8663
8644
|
default:
|
|
8664
|
-
return value2.
|
|
8645
|
+
return value2.substring(0, length) + replacement;
|
|
8665
8646
|
}
|
|
8666
8647
|
} else {
|
|
8667
8648
|
return value2;
|
|
@@ -8711,7 +8692,7 @@ ${name} ${msg} of ${this.text}
|
|
|
8711
8692
|
bindingStringPreparsers: [functionRewrite]
|
|
8712
8693
|
}
|
|
8713
8694
|
});
|
|
8714
|
-
var version = "4.0
|
|
8695
|
+
var version = "4.1.0";
|
|
8715
8696
|
var index_default = builder.create({
|
|
8716
8697
|
version,
|
|
8717
8698
|
components: src_default,
|