@schukai/monster 4.46.6 → 4.46.8
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/CHANGELOG.md +16 -0
- package/package.json +1 -1
- package/source/components/form/select.mjs +3018 -3012
- package/source/dom/updater.mjs +53 -8
- package/source/net/webconnect.mjs +326 -287
package/source/dom/updater.mjs
CHANGED
|
@@ -72,6 +72,18 @@ const pendingDiffsSymbol = Symbol("pendingDiffs");
|
|
|
72
72
|
*/
|
|
73
73
|
const processingSymbol = Symbol("processing");
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* @private
|
|
77
|
+
* @type {symbol}
|
|
78
|
+
*/
|
|
79
|
+
const pipeCacheSymbol = Symbol("pipeCache");
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @private
|
|
83
|
+
* @type {symbol}
|
|
84
|
+
*/
|
|
85
|
+
const processingScheduledSymbol = Symbol("processingScheduled");
|
|
86
|
+
|
|
75
87
|
/**
|
|
76
88
|
* @private
|
|
77
89
|
* Performance optimization: static Set for boolean checks
|
|
@@ -137,6 +149,9 @@ class Updater extends Base {
|
|
|
137
149
|
|
|
138
150
|
this[pendingDiffsSymbol] = [];
|
|
139
151
|
this[processingSymbol] = false;
|
|
152
|
+
this[processingScheduledSymbol] = false;
|
|
153
|
+
this[pipeCacheSymbol] = new Map();
|
|
154
|
+
this[timerElementEventHandlerSymbol] = new WeakMap();
|
|
140
155
|
|
|
141
156
|
this[internalSymbol].subject.attachObserver(
|
|
142
157
|
new Observer(() => {
|
|
@@ -144,7 +159,19 @@ class Updater extends Base {
|
|
|
144
159
|
const diffResult = diff(this[internalSymbol].last, real);
|
|
145
160
|
this[internalSymbol].last = clone(real);
|
|
146
161
|
this[pendingDiffsSymbol].push(diffResult);
|
|
147
|
-
|
|
162
|
+
|
|
163
|
+
if (!this[processingScheduledSymbol]) {
|
|
164
|
+
this[processingScheduledSymbol] = true;
|
|
165
|
+
|
|
166
|
+
return new Promise((resolve) => {
|
|
167
|
+
queueMicrotask(() => {
|
|
168
|
+
this[processingScheduledSymbol] = false;
|
|
169
|
+
this.#processQueue().finally(resolve);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return Promise.resolve();
|
|
148
175
|
}),
|
|
149
176
|
);
|
|
150
177
|
}
|
|
@@ -301,6 +328,20 @@ class Updater extends Base {
|
|
|
301
328
|
this[internalSymbol].callbacks.set(name, callback);
|
|
302
329
|
return this;
|
|
303
330
|
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* @private
|
|
334
|
+
* @param {string} cmd
|
|
335
|
+
* @returns {Pipe}
|
|
336
|
+
*/
|
|
337
|
+
getPipe(cmd) {
|
|
338
|
+
let pipe = this[pipeCacheSymbol].get(cmd);
|
|
339
|
+
if (!pipe) {
|
|
340
|
+
pipe = new Pipe(cmd);
|
|
341
|
+
this[pipeCacheSymbol].set(cmd, pipe);
|
|
342
|
+
}
|
|
343
|
+
return pipe;
|
|
344
|
+
}
|
|
304
345
|
}
|
|
305
346
|
|
|
306
347
|
/**
|
|
@@ -356,22 +397,26 @@ function getControlEventHandler() {
|
|
|
356
397
|
return;
|
|
357
398
|
}
|
|
358
399
|
|
|
359
|
-
|
|
400
|
+
const switches = this[timerElementEventHandlerSymbol];
|
|
401
|
+
let dms = switches.get(element);
|
|
402
|
+
|
|
403
|
+
if (dms instanceof DeadMansSwitch) {
|
|
360
404
|
try {
|
|
361
|
-
|
|
405
|
+
dms.touch();
|
|
362
406
|
return;
|
|
363
407
|
} catch (e) {
|
|
364
|
-
delete
|
|
408
|
+
switches.delete(element);
|
|
365
409
|
}
|
|
366
410
|
}
|
|
367
411
|
|
|
368
|
-
|
|
412
|
+
dms = new DeadMansSwitch(50, () => {
|
|
369
413
|
try {
|
|
370
414
|
retrieveAndSetValue.call(this, element);
|
|
371
415
|
} catch (e) {
|
|
372
416
|
addErrorAttribute(element, e);
|
|
373
417
|
}
|
|
374
418
|
});
|
|
419
|
+
switches.set(element, dms);
|
|
375
420
|
};
|
|
376
421
|
|
|
377
422
|
return this[symbol];
|
|
@@ -653,7 +698,7 @@ function insertElement(change) {
|
|
|
653
698
|
throw new Error("pipes are not allowed when cloning a node.");
|
|
654
699
|
}
|
|
655
700
|
|
|
656
|
-
const pipe =
|
|
701
|
+
const pipe = this.getPipe(cmd);
|
|
657
702
|
this[internalSymbol].callbacks.forEach((f, n) => {
|
|
658
703
|
pipe.setCallback(n, f);
|
|
659
704
|
});
|
|
@@ -844,7 +889,7 @@ function runUpdateContent(container, parts, subject) {
|
|
|
844
889
|
const attributes = element.getAttribute(ATTRIBUTE_UPDATER_REPLACE);
|
|
845
890
|
const cmd = trimSpaces(attributes);
|
|
846
891
|
|
|
847
|
-
const pipe =
|
|
892
|
+
const pipe = this.getPipe(cmd);
|
|
848
893
|
this[internalSymbol].callbacks.forEach((f, n) => {
|
|
849
894
|
pipe.setCallback(n, f);
|
|
850
895
|
});
|
|
@@ -936,7 +981,7 @@ function runUpdateAttributes(container, parts, subject) {
|
|
|
936
981
|
const name = trimSpaces(def.substr(0, i));
|
|
937
982
|
const cmd = trimSpaces(def.substr(i));
|
|
938
983
|
|
|
939
|
-
const pipe =
|
|
984
|
+
const pipe = this.getPipe(cmd);
|
|
940
985
|
|
|
941
986
|
this[internalSymbol].callbacks.forEach((f, n) => {
|
|
942
987
|
pipe.setCallback(n, f, element);
|