voodoojs 0.12.5 → 0.13.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/README.md +1 -1
- package/dist/{chunk-D45ZEXUO.js → chunk-2LGAXVD7.js} +4 -4
- package/dist/{chunk-L3JNHLTI.js → chunk-4IJE5BWY.js} +5 -5
- package/dist/{chunk-PPT7RDKJ.js → chunk-FMDHZ5GI.js} +139 -9
- package/dist/{chunk-JB72AX7G.js → chunk-GE4JWATC.js} +5 -5
- package/dist/{chunk-TUXGS7XW.js → chunk-H2NGDLMD.js} +363 -76
- package/dist/{chunk-YH3IDF6L.js → chunk-IBIZ6OUI.js} +4 -4
- package/dist/{chunk-PO6REBDJ.js → chunk-IJQ2PFXU.js} +3 -3
- package/dist/{chunk-6QFKV444.js → chunk-JBUNTP7F.js} +7 -7
- package/dist/{chunk-IWHK6Y32.js → chunk-MV73OSCS.js} +4 -4
- package/dist/{chunk-X3FZPWI6.js → chunk-OIH4BR2H.js} +6 -6
- package/dist/{chunk-OH6FIDTW.js → chunk-TEVCUTTC.js} +3 -3
- package/dist/essential.cjs +496 -74
- package/dist/essential.js +10 -10
- package/dist/gpu.cjs +1 -1
- package/dist/gpu.js +10 -10
- package/dist/http.cjs +1 -1
- package/dist/http.js +5 -5
- package/dist/index.cjs +544 -122
- package/dist/index.js +20 -20
- package/dist/reactivity.cjs +138 -5
- package/dist/reactivity.d.cts +32 -1
- package/dist/reactivity.d.ts +32 -1
- package/dist/reactivity.js +2 -2
- package/dist/socket.cjs +115 -5
- package/dist/socket.d.cts +1 -1
- package/dist/socket.d.ts +1 -1
- package/dist/socket.js +9 -9
- package/dist/style-E22XVZ33.js +5 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/voodoo.core.js +560 -72
- package/dist/voodoo.core.min.js +17 -17
- package/dist/voodoo.full.js +609 -121
- package/dist/voodoo.full.min.js +62 -62
- package/dist/voodoo.js +563 -75
- package/dist/voodoo.min.js +26 -26
- package/package.json +1 -1
- package/dist/style-YWBYOE6T.js +0 -5
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Voodoo.js v0.
|
|
6
|
+
* Voodoo.js v0.13.0
|
|
7
7
|
* JavaScript feels like magic.
|
|
8
8
|
* (c) 2026 Voodoo.js contributors. MIT License.
|
|
9
9
|
*/
|
|
@@ -22,10 +22,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
22
22
|
// src/reactivity/index.ts
|
|
23
23
|
var reactivity_exports = {};
|
|
24
24
|
__export(reactivity_exports, {
|
|
25
|
+
ArrayOp: () => ArrayOp,
|
|
25
26
|
EffectScope: () => exports.EffectScope,
|
|
26
27
|
ITERATE_KEY: () => ITERATE_KEY,
|
|
27
28
|
ReactiveEffect: () => ReactiveEffect,
|
|
28
29
|
TriggerType: () => TriggerType,
|
|
30
|
+
arrayVersion: () => arrayVersion,
|
|
29
31
|
computed: () => computed,
|
|
30
32
|
effect: () => effect,
|
|
31
33
|
effectScope: () => effectScope,
|
|
@@ -38,6 +40,7 @@ __export(reactivity_exports, {
|
|
|
38
40
|
isReactive: () => isReactive,
|
|
39
41
|
isRef: () => isRef,
|
|
40
42
|
markRaw: () => markRaw,
|
|
43
|
+
mutationsSince: () => mutationsSince,
|
|
41
44
|
nextTick: () => nextTick,
|
|
42
45
|
pauseTracking: () => pauseTracking,
|
|
43
46
|
queueJob: () => queueJob,
|
|
@@ -200,7 +203,9 @@ function trigger(target2, type, key, _newValue) {
|
|
|
200
203
|
if (!isArr) add(depsMap.get(ITERATE_KEY));
|
|
201
204
|
else if (isIntegerKey(key)) add(depsMap.get("length"));
|
|
202
205
|
} else if (type === "delete" /* DELETE */) {
|
|
203
|
-
|
|
206
|
+
add(depsMap.get(ITERATE_KEY));
|
|
207
|
+
} else if (isArr && isIntegerKey(key)) {
|
|
208
|
+
add(depsMap.get(ITERATE_KEY));
|
|
204
209
|
} else if (isArr && key === "length") {
|
|
205
210
|
const newLen = Number(_newValue);
|
|
206
211
|
depsMap.forEach((dep, k) => {
|
|
@@ -213,12 +218,61 @@ function trigger(target2, type, key, _newValue) {
|
|
|
213
218
|
else queueJob(e);
|
|
214
219
|
}
|
|
215
220
|
}
|
|
221
|
+
function triggerArrayRange(target2, from) {
|
|
222
|
+
const depsMap = targetMap.get(target2);
|
|
223
|
+
if (!depsMap) return;
|
|
224
|
+
const effects = /* @__PURE__ */ new Set();
|
|
225
|
+
const add = (dep) => {
|
|
226
|
+
if (!dep) return;
|
|
227
|
+
for (const e of dep) if (e !== activeEffect) effects.add(e);
|
|
228
|
+
};
|
|
229
|
+
add(depsMap.get("length"));
|
|
230
|
+
add(depsMap.get(ITERATE_KEY));
|
|
231
|
+
if (from >= 0) {
|
|
232
|
+
depsMap.forEach((dep, k) => {
|
|
233
|
+
if (typeof k === "string" && isIntegerKey(k) && Number(k) >= from) add(dep);
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
for (const e of effects) {
|
|
237
|
+
if (e.scheduler) e.scheduler();
|
|
238
|
+
else queueJob(e);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function record(target2, type, index, removed, added) {
|
|
242
|
+
let log = mutationLogs.get(target2);
|
|
243
|
+
if (!log) mutationLogs.set(target2, log = { version: 0, ops: [] });
|
|
244
|
+
log.version++;
|
|
245
|
+
if (type === 3 /* RESET */) {
|
|
246
|
+
log.ops.length = 0;
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
log.ops.push({ type, index, removed, added });
|
|
250
|
+
if (log.ops.length > LOG_LIMIT) log.ops.shift();
|
|
251
|
+
}
|
|
252
|
+
function arrayVersion(target2) {
|
|
253
|
+
const log = mutationLogs.get(target2);
|
|
254
|
+
return log ? log.version : 0;
|
|
255
|
+
}
|
|
256
|
+
function mutationsSince(target2, since) {
|
|
257
|
+
const log = mutationLogs.get(target2);
|
|
258
|
+
if (!log) return since === 0 ? NO_MUTATIONS : null;
|
|
259
|
+
if (since > log.version) return null;
|
|
260
|
+
const missing = log.version - since;
|
|
261
|
+
if (missing === 0) return NO_MUTATIONS;
|
|
262
|
+
if (missing > log.ops.length) return null;
|
|
263
|
+
return log.ops.slice(log.ops.length - missing);
|
|
264
|
+
}
|
|
216
265
|
function isIntegerKey(key) {
|
|
217
266
|
return typeof key === "string" && key !== "NaN" && key[0] !== "-" && String(parseInt(key, 10)) === key;
|
|
218
267
|
}
|
|
219
268
|
function isObject(val) {
|
|
220
269
|
return val !== null && typeof val === "object";
|
|
221
270
|
}
|
|
271
|
+
function spliceStart(raw, length) {
|
|
272
|
+
const n2 = Math.trunc(Number(raw)) || 0;
|
|
273
|
+
if (n2 < 0) return Math.max(length + n2, 0);
|
|
274
|
+
return Math.min(n2, length);
|
|
275
|
+
}
|
|
222
276
|
function canObserve(value) {
|
|
223
277
|
if (!isObject(value)) return false;
|
|
224
278
|
if (value[SKIP]) return false;
|
|
@@ -228,6 +282,23 @@ function canObserve(value) {
|
|
|
228
282
|
if (NON_REACTIVE.has(tag)) return false;
|
|
229
283
|
return tag === "Object" || tag === "Array" || tag === "Map" || tag === "Set";
|
|
230
284
|
}
|
|
285
|
+
function recordDirectWrite(target2, key, lengthBefore, hadKey, oldValue, value) {
|
|
286
|
+
if (key === "length") {
|
|
287
|
+
const next = target2.length;
|
|
288
|
+
if (next < lengthBefore) record(target2, 1 /* SPLICE */, next, lengthBefore - next, 0);
|
|
289
|
+
else if (next > lengthBefore) record(target2, 3 /* RESET */, 0, 0, 0);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (!isIntegerKey(key)) return;
|
|
293
|
+
const index = Number(key);
|
|
294
|
+
if (hadKey) {
|
|
295
|
+
if (hasChanged(value, oldValue)) record(target2, 2 /* SET */, index, 1, 1);
|
|
296
|
+
} else if (index === lengthBefore) {
|
|
297
|
+
record(target2, 1 /* SPLICE */, index, 0, 1);
|
|
298
|
+
} else {
|
|
299
|
+
record(target2, 3 /* RESET */, 0, 0, 0);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
231
302
|
function markRaw(value) {
|
|
232
303
|
Object.defineProperty(value, SKIP, { value: true, enumerable: false, configurable: true });
|
|
233
304
|
return value;
|
|
@@ -350,7 +421,7 @@ function traverse(value, seen = /* @__PURE__ */ new Set()) {
|
|
|
350
421
|
else for (const key of Object.keys(value)) traverse(value[key], seen);
|
|
351
422
|
return value;
|
|
352
423
|
}
|
|
353
|
-
var resolvedPromise, queue, postQueue, isFlushing, isFlushPending, flushPromise, RECURSION_LIMIT, errorHandler, activeEffect, shouldTrack, trackStack, effectId, ReactiveEffect, activeScope; exports.EffectScope = void 0; var ITERATE_KEY, targetMap, TriggerType, RAW, IS_REACTIVE, SKIP, reactiveMap, arrayInstrumentations, NON_REACTIVE, baseHandlers, collectionHandlers, RefImpl, ComputedRefImpl;
|
|
424
|
+
var resolvedPromise, queue, postQueue, isFlushing, isFlushPending, flushPromise, RECURSION_LIMIT, errorHandler, activeEffect, shouldTrack, trackStack, effectId, ReactiveEffect, activeScope; exports.EffectScope = void 0; var ITERATE_KEY, targetMap, TriggerType, ArrayOp, LOG_LIMIT, mutationLogs, NO_MUTATIONS, RAW, IS_REACTIVE, SKIP, reactiveMap, arrayInstrumentations, NON_REACTIVE, baseHandlers, collectionHandlers, RefImpl, ComputedRefImpl;
|
|
354
425
|
var init_reactivity = __esm({
|
|
355
426
|
"src/reactivity/index.ts"() {
|
|
356
427
|
resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
@@ -477,6 +548,15 @@ var init_reactivity = __esm({
|
|
|
477
548
|
TriggerType2["CLEAR"] = "clear";
|
|
478
549
|
return TriggerType2;
|
|
479
550
|
})(TriggerType || {});
|
|
551
|
+
ArrayOp = /* @__PURE__ */ ((ArrayOp2) => {
|
|
552
|
+
ArrayOp2[ArrayOp2["SPLICE"] = 1] = "SPLICE";
|
|
553
|
+
ArrayOp2[ArrayOp2["SET"] = 2] = "SET";
|
|
554
|
+
ArrayOp2[ArrayOp2["RESET"] = 3] = "RESET";
|
|
555
|
+
return ArrayOp2;
|
|
556
|
+
})(ArrayOp || {});
|
|
557
|
+
LOG_LIMIT = 32;
|
|
558
|
+
mutationLogs = /* @__PURE__ */ new WeakMap();
|
|
559
|
+
NO_MUTATIONS = [];
|
|
480
560
|
RAW = /* @__PURE__ */ Symbol("voodoo:raw");
|
|
481
561
|
IS_REACTIVE = /* @__PURE__ */ Symbol("voodoo:isReactive");
|
|
482
562
|
SKIP = /* @__PURE__ */ Symbol("voodoo:skip");
|
|
@@ -494,14 +574,61 @@ var init_reactivity = __esm({
|
|
|
494
574
|
return res;
|
|
495
575
|
};
|
|
496
576
|
}
|
|
497
|
-
for (const key of ["push", "pop", "shift", "unshift", "splice"]) {
|
|
577
|
+
for (const key of ["push", "pop", "shift", "unshift", "splice", "reverse", "sort"]) {
|
|
498
578
|
inst[key] = function(...args) {
|
|
579
|
+
const raw = toRaw(this);
|
|
580
|
+
const before = raw.length;
|
|
581
|
+
for (let i = 0; i < args.length; i++) args[i] = toRaw(args[i]);
|
|
499
582
|
pauseTracking();
|
|
583
|
+
let result;
|
|
500
584
|
try {
|
|
501
|
-
|
|
585
|
+
result = raw[key].apply(raw, args);
|
|
502
586
|
} finally {
|
|
503
587
|
resetTracking();
|
|
504
588
|
}
|
|
589
|
+
const after = raw.length;
|
|
590
|
+
let from = -1;
|
|
591
|
+
if (key === "push") {
|
|
592
|
+
if (args.length) {
|
|
593
|
+
record(raw, 1 /* SPLICE */, before, 0, args.length);
|
|
594
|
+
from = before;
|
|
595
|
+
}
|
|
596
|
+
} else if (key === "unshift") {
|
|
597
|
+
if (args.length) {
|
|
598
|
+
record(raw, 1 /* SPLICE */, 0, 0, args.length);
|
|
599
|
+
from = 0;
|
|
600
|
+
}
|
|
601
|
+
} else if (key === "pop") {
|
|
602
|
+
if (before > 0) {
|
|
603
|
+
record(raw, 1 /* SPLICE */, after, 1, 0);
|
|
604
|
+
from = after;
|
|
605
|
+
}
|
|
606
|
+
} else if (key === "shift") {
|
|
607
|
+
if (before > 0) {
|
|
608
|
+
record(raw, 1 /* SPLICE */, 0, 1, 0);
|
|
609
|
+
from = 0;
|
|
610
|
+
}
|
|
611
|
+
} else if (key === "splice") {
|
|
612
|
+
const removed = result.length;
|
|
613
|
+
const added = args.length > 2 ? args.length - 2 : 0;
|
|
614
|
+
if (removed || added) {
|
|
615
|
+
record(raw, 1 /* SPLICE */, spliceStart(args[0], before), removed, added);
|
|
616
|
+
from = spliceStart(args[0], before);
|
|
617
|
+
}
|
|
618
|
+
} else {
|
|
619
|
+
if (before > 1) {
|
|
620
|
+
record(raw, 3 /* RESET */, 0, before, after);
|
|
621
|
+
from = 0;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
if (from >= 0) triggerArrayRange(raw, from);
|
|
625
|
+
if (key === "pop" || key === "shift") return isObject(result) ? reactive(result) : result;
|
|
626
|
+
if (key === "splice") {
|
|
627
|
+
const out = result;
|
|
628
|
+
for (let i = 0; i < out.length; i++) if (isObject(out[i])) out[i] = reactive(out[i]);
|
|
629
|
+
return out;
|
|
630
|
+
}
|
|
631
|
+
return key === "reverse" || key === "sort" ? this : result;
|
|
505
632
|
};
|
|
506
633
|
}
|
|
507
634
|
return inst;
|
|
@@ -543,8 +670,11 @@ var init_reactivity = __esm({
|
|
|
543
670
|
return true;
|
|
544
671
|
}
|
|
545
672
|
const hadKey = Array.isArray(target2) && isIntegerKey(key) ? Number(key) < target2.length : Object.prototype.hasOwnProperty.call(target2, key);
|
|
673
|
+
const isArr = Array.isArray(target2);
|
|
674
|
+
const arrayLength = isArr ? target2.length : 0;
|
|
546
675
|
const result = Reflect.set(target2, key, value, receiver);
|
|
547
676
|
if (target2 === toRaw(receiver)) {
|
|
677
|
+
if (isArr) recordDirectWrite(target2, key, arrayLength, hadKey, oldValue, value);
|
|
548
678
|
if (!hadKey) trigger(target2, "add" /* ADD */, key, value);
|
|
549
679
|
else if (hasChanged(value, oldValue)) trigger(target2, "set" /* SET */, key, value);
|
|
550
680
|
}
|
|
@@ -553,7 +683,10 @@ var init_reactivity = __esm({
|
|
|
553
683
|
deleteProperty(target2, key) {
|
|
554
684
|
const hadKey = Object.prototype.hasOwnProperty.call(target2, key);
|
|
555
685
|
const result = Reflect.deleteProperty(target2, key);
|
|
556
|
-
if (result && hadKey)
|
|
686
|
+
if (result && hadKey) {
|
|
687
|
+
if (Array.isArray(target2)) record(target2, 3 /* RESET */, 0, 0, 0);
|
|
688
|
+
trigger(target2, "delete" /* DELETE */, key);
|
|
689
|
+
}
|
|
557
690
|
return result;
|
|
558
691
|
},
|
|
559
692
|
has(target2, key) {
|
|
@@ -5649,6 +5782,8 @@ function viewTransition(update) {
|
|
|
5649
5782
|
// src/directives/core.ts
|
|
5650
5783
|
init_reactivity();
|
|
5651
5784
|
init_registry();
|
|
5785
|
+
|
|
5786
|
+
// src/directives/core.ts
|
|
5652
5787
|
function setValue(expression, scope, value) {
|
|
5653
5788
|
try {
|
|
5654
5789
|
const target2 = parse(expression);
|
|
@@ -5793,7 +5928,7 @@ defineDirective(
|
|
|
5793
5928
|
},
|
|
5794
5929
|
{ priority: exports.PRIORITY.IF, terminal: true }
|
|
5795
5930
|
);
|
|
5796
|
-
function renderTemplate(source, anchor, scope
|
|
5931
|
+
function renderTemplate(source, anchor, scope) {
|
|
5797
5932
|
const parent = anchor.parentNode;
|
|
5798
5933
|
if (!parent) return [];
|
|
5799
5934
|
const nodes = [];
|
|
@@ -5812,19 +5947,61 @@ function renderTemplate(source, anchor, scope, batch) {
|
|
|
5812
5947
|
const clone2 = source.cloneNode(true);
|
|
5813
5948
|
nodes.push(clone2);
|
|
5814
5949
|
markNodeScope(clone2, scope);
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
batch.pending.push([clone2, scope]);
|
|
5818
|
-
} else {
|
|
5819
|
-
parent.insertBefore(clone2, anchor);
|
|
5820
|
-
walk(clone2, scope);
|
|
5821
|
-
}
|
|
5950
|
+
parent.insertBefore(clone2, anchor);
|
|
5951
|
+
walk(clone2, scope);
|
|
5822
5952
|
}
|
|
5823
5953
|
return nodes;
|
|
5824
5954
|
}
|
|
5825
5955
|
defineDirective("else-if", () => void 0, { priority: exports.PRIORITY.IF, terminal: true });
|
|
5826
5956
|
defineDirective("else", () => void 0, { priority: exports.PRIORITY.IF, terminal: true });
|
|
5827
5957
|
var FOR_PATTERN = /^\s*\(?\s*([^)]*?)\s*\)?\s+(?:in|of)\s+(.+?)\s*$/;
|
|
5958
|
+
var KEY_PATH = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/;
|
|
5959
|
+
var NO_BLOCKS = [];
|
|
5960
|
+
function sameStored(stored, incoming) {
|
|
5961
|
+
if (stored === incoming) return true;
|
|
5962
|
+
return incoming !== null && typeof incoming === "object" && stored === toRaw(incoming);
|
|
5963
|
+
}
|
|
5964
|
+
function sameKey(a, b) {
|
|
5965
|
+
return a === b || a !== a && b !== b;
|
|
5966
|
+
}
|
|
5967
|
+
function longestIncreasing(arr) {
|
|
5968
|
+
const length = arr.length;
|
|
5969
|
+
const previous = new Int32Array(length);
|
|
5970
|
+
const tails = [];
|
|
5971
|
+
for (let i = 0; i < length; i++) {
|
|
5972
|
+
const value = arr[i];
|
|
5973
|
+
if (value === 0) continue;
|
|
5974
|
+
if (tails.length === 0) {
|
|
5975
|
+
tails.push(i);
|
|
5976
|
+
continue;
|
|
5977
|
+
}
|
|
5978
|
+
const last = tails[tails.length - 1];
|
|
5979
|
+
if (arr[last] < value) {
|
|
5980
|
+
previous[i] = last;
|
|
5981
|
+
tails.push(i);
|
|
5982
|
+
continue;
|
|
5983
|
+
}
|
|
5984
|
+
let low = 0;
|
|
5985
|
+
let high = tails.length - 1;
|
|
5986
|
+
while (low < high) {
|
|
5987
|
+
const mid = low + high >> 1;
|
|
5988
|
+
if (arr[tails[mid]] < value) low = mid + 1;
|
|
5989
|
+
else high = mid;
|
|
5990
|
+
}
|
|
5991
|
+
if (value < arr[tails[low]]) {
|
|
5992
|
+
if (low > 0) previous[i] = tails[low - 1];
|
|
5993
|
+
tails[low] = i;
|
|
5994
|
+
}
|
|
5995
|
+
}
|
|
5996
|
+
let cursor = tails.length;
|
|
5997
|
+
const out = new Int32Array(cursor);
|
|
5998
|
+
let node = tails[cursor - 1];
|
|
5999
|
+
while (cursor-- > 0) {
|
|
6000
|
+
out[cursor] = node;
|
|
6001
|
+
node = previous[node];
|
|
6002
|
+
}
|
|
6003
|
+
return out;
|
|
6004
|
+
}
|
|
5828
6005
|
defineDirective(
|
|
5829
6006
|
"for",
|
|
5830
6007
|
({ el, scope, expression, effect: effect3 }) => {
|
|
@@ -5849,77 +6026,322 @@ defineDirective(
|
|
|
5849
6026
|
template.removeAttribute(`${p2}bind:key`);
|
|
5850
6027
|
template.removeAttribute(`${p2}key`);
|
|
5851
6028
|
removeQuietly(el);
|
|
6029
|
+
const isTemplateRow = template.tagName === "TEMPLATE";
|
|
6030
|
+
let keyIsItem = false;
|
|
6031
|
+
let keyIsIndex = false;
|
|
6032
|
+
let keyProp = null;
|
|
6033
|
+
let keyPath = null;
|
|
6034
|
+
if (keyExpression && KEY_PATH.test(keyExpression)) {
|
|
6035
|
+
const parts = keyExpression.split(".");
|
|
6036
|
+
if (parts[0] === itemAlias) {
|
|
6037
|
+
if (parts.length === 1) keyIsItem = true;
|
|
6038
|
+
else if (parts.length === 2) keyProp = parts[1];
|
|
6039
|
+
else keyPath = parts.slice(1);
|
|
6040
|
+
} else if (indexAlias && parts.length === 1 && parts[0] === indexAlias) {
|
|
6041
|
+
keyIsIndex = true;
|
|
6042
|
+
}
|
|
6043
|
+
}
|
|
5852
6044
|
let blocks = [];
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
6045
|
+
let rows = [];
|
|
6046
|
+
let entries = null;
|
|
6047
|
+
let count = 0;
|
|
6048
|
+
let keyScope = null;
|
|
6049
|
+
let lastSource = null;
|
|
6050
|
+
let lastVersion = 0;
|
|
6051
|
+
const pending2 = [];
|
|
6052
|
+
const pendingRuns = [];
|
|
6053
|
+
const varsAt = (i) => {
|
|
6054
|
+
if (entries) return entries[i];
|
|
6055
|
+
const vars = { [itemAlias]: rows[i] };
|
|
6056
|
+
if (indexAlias) vars[indexAlias] = i;
|
|
6057
|
+
return vars;
|
|
6058
|
+
};
|
|
6059
|
+
const keyAt = (i) => {
|
|
6060
|
+
if (keyIsIndex) return i;
|
|
6061
|
+
if (!keyExpression) {
|
|
6062
|
+
return i;
|
|
6063
|
+
}
|
|
6064
|
+
const item = entries ? entries[i][itemAlias] : rows[i];
|
|
6065
|
+
if (keyIsItem) return item;
|
|
6066
|
+
if (keyProp !== null) return item == null ? void 0 : item[keyProp];
|
|
6067
|
+
if (keyPath !== null) {
|
|
6068
|
+
let value = item;
|
|
6069
|
+
for (let d2 = 0; d2 < keyPath.length; d2++) {
|
|
6070
|
+
if (value == null) return void 0;
|
|
6071
|
+
value = value[keyPath[d2]];
|
|
6072
|
+
}
|
|
6073
|
+
return value;
|
|
6074
|
+
}
|
|
6075
|
+
if (!keyScope) keyScope = scope.child({});
|
|
6076
|
+
keyScope.data = varsAt(i);
|
|
6077
|
+
return evaluateIn(keyExpression, keyScope, ":key");
|
|
6078
|
+
};
|
|
6079
|
+
const syncData = (block2, i) => {
|
|
6080
|
+
const raw = toRaw(block2.data);
|
|
6081
|
+
if (entries) {
|
|
6082
|
+
const vars = entries[i];
|
|
6083
|
+
for (const name in vars) {
|
|
6084
|
+
if (!sameStored(raw[name], vars[name])) {
|
|
6085
|
+
block2.data[name] = vars[name];
|
|
6086
|
+
}
|
|
5858
6087
|
}
|
|
6088
|
+
return;
|
|
6089
|
+
}
|
|
6090
|
+
const item = rows[i];
|
|
6091
|
+
if (!sameStored(raw[itemAlias], item)) {
|
|
6092
|
+
block2.data[itemAlias] = item;
|
|
6093
|
+
}
|
|
6094
|
+
if (indexAlias !== void 0 && raw[indexAlias] !== i) {
|
|
6095
|
+
block2.data[indexAlias] = i;
|
|
6096
|
+
}
|
|
6097
|
+
};
|
|
6098
|
+
const buildRange = (from, to, before, out) => {
|
|
6099
|
+
if (from >= to) return;
|
|
6100
|
+
const parent = anchor.parentNode;
|
|
6101
|
+
if (!parent) return;
|
|
6102
|
+
pendingRuns.push(pending2.length);
|
|
6103
|
+
if (isTemplateRow) {
|
|
6104
|
+
for (let i = from; i < to; i++) {
|
|
6105
|
+
const childScope = scope.reactiveChild(varsAt(i));
|
|
6106
|
+
const nodes = renderTemplate(template, before, childScope);
|
|
6107
|
+
out.push({ key: keyAt(i), scope: childScope, nodes, data: childScope.data });
|
|
6108
|
+
}
|
|
6109
|
+
return;
|
|
6110
|
+
}
|
|
6111
|
+
const fragment = document.createDocumentFragment();
|
|
6112
|
+
for (let i = from; i < to; i++) {
|
|
6113
|
+
const childScope = scope.reactiveChild(varsAt(i));
|
|
6114
|
+
const clone2 = template.cloneNode(true);
|
|
6115
|
+
markNodeScope(clone2, childScope);
|
|
6116
|
+
fragment.appendChild(clone2);
|
|
6117
|
+
pending2.push([clone2, childScope]);
|
|
6118
|
+
out.push({ key: keyAt(i), scope: childScope, nodes: [clone2], data: childScope.data });
|
|
6119
|
+
}
|
|
6120
|
+
parent.insertBefore(fragment, before);
|
|
6121
|
+
};
|
|
6122
|
+
const destroyBlock = (block2) => {
|
|
6123
|
+
const nodes = block2.nodes;
|
|
6124
|
+
for (let j = 0; j < nodes.length; j++) {
|
|
6125
|
+
destroy(nodes[j]);
|
|
6126
|
+
nodes[j].remove();
|
|
6127
|
+
}
|
|
6128
|
+
};
|
|
6129
|
+
const moveBlock = (block2, before) => {
|
|
6130
|
+
const parent = anchor.parentNode;
|
|
6131
|
+
if (!parent) return;
|
|
6132
|
+
const nodes = block2.nodes;
|
|
6133
|
+
if (nodes[nodes.length - 1].nextSibling === before) return;
|
|
6134
|
+
for (let j = 0; j < nodes.length; j++) {
|
|
6135
|
+
parent.insertBefore(nodes[j], before);
|
|
6136
|
+
}
|
|
6137
|
+
};
|
|
6138
|
+
const nodeAfter = (oldIndex) => oldIndex < blocks.length ? blocks[oldIndex].nodes[0] : anchor;
|
|
6139
|
+
const spliceBlocks = (index, remove, added) => {
|
|
6140
|
+
const addCount = added.length;
|
|
6141
|
+
if (remove === 0 && addCount === 0) return;
|
|
6142
|
+
if (blocks.length === 0) {
|
|
6143
|
+
blocks = added;
|
|
6144
|
+
return;
|
|
6145
|
+
}
|
|
6146
|
+
if (addCount === 0) {
|
|
6147
|
+
blocks.splice(index, remove);
|
|
6148
|
+
return;
|
|
6149
|
+
}
|
|
6150
|
+
if (addCount <= 1024) {
|
|
6151
|
+
blocks.splice(index, remove, ...added);
|
|
6152
|
+
return;
|
|
6153
|
+
}
|
|
6154
|
+
const out = new Array(blocks.length - remove + addCount);
|
|
6155
|
+
let w = 0;
|
|
6156
|
+
for (let k = 0; k < index; k++) out[w++] = blocks[k];
|
|
6157
|
+
for (let k = 0; k < addCount; k++) out[w++] = added[k];
|
|
6158
|
+
for (let k = index + remove; k < blocks.length; k++) out[w++] = blocks[k];
|
|
6159
|
+
blocks = out;
|
|
6160
|
+
};
|
|
6161
|
+
const flushPending = () => {
|
|
6162
|
+
for (let r2 = pendingRuns.length - 1; r2 >= 0; r2--) {
|
|
6163
|
+
const start2 = pendingRuns[r2];
|
|
6164
|
+
const end = r2 + 1 < pendingRuns.length ? pendingRuns[r2 + 1] : pending2.length;
|
|
6165
|
+
for (let k = start2; k < end; k++) walk(pending2[k][0], pending2[k][1]);
|
|
6166
|
+
}
|
|
6167
|
+
pending2.length = 0;
|
|
6168
|
+
pendingRuns.length = 0;
|
|
6169
|
+
};
|
|
6170
|
+
let lo = 0;
|
|
6171
|
+
let oldHi = 0;
|
|
6172
|
+
let newHi = 0;
|
|
6173
|
+
const regionFromMutations = (source) => {
|
|
6174
|
+
const ops = mutationsSince(source, lastVersion);
|
|
6175
|
+
if (!ops) return false;
|
|
6176
|
+
const oldLen = blocks.length;
|
|
6177
|
+
lo = 0;
|
|
6178
|
+
oldHi = 0;
|
|
6179
|
+
newHi = 0;
|
|
6180
|
+
let current2 = oldLen;
|
|
6181
|
+
for (let k = 0; k < ops.length; k++) {
|
|
6182
|
+
const op = ops[k];
|
|
6183
|
+
const index = op.index;
|
|
6184
|
+
const removed = op.type === 2 /* SET */ ? 1 : op.removed;
|
|
6185
|
+
const added = op.type === 2 /* SET */ ? 1 : op.added;
|
|
6186
|
+
const end = index + removed;
|
|
6187
|
+
if (k === 0) {
|
|
6188
|
+
lo = index;
|
|
6189
|
+
oldHi = end;
|
|
6190
|
+
newHi = index + added;
|
|
6191
|
+
} else if (end <= newHi) {
|
|
6192
|
+
if (index < lo) lo = index;
|
|
6193
|
+
newHi += added - removed;
|
|
6194
|
+
} else {
|
|
6195
|
+
if (index < lo) lo = index;
|
|
6196
|
+
oldHi = end - newHi + oldHi;
|
|
6197
|
+
newHi = index + added;
|
|
6198
|
+
}
|
|
6199
|
+
if (oldHi < lo) oldHi = lo;
|
|
6200
|
+
if (newHi < lo) newHi = lo;
|
|
6201
|
+
current2 += added - removed;
|
|
6202
|
+
}
|
|
6203
|
+
if (current2 !== count) return false;
|
|
6204
|
+
if (lo > oldHi || lo > newHi) return false;
|
|
6205
|
+
if (oldHi > oldLen || newHi > count) return false;
|
|
6206
|
+
if (indexAlias !== void 0 && oldHi - newHi !== 0) {
|
|
6207
|
+
for (let i = newHi; i < count; i++) syncData(blocks[i - newHi + oldHi], i);
|
|
6208
|
+
}
|
|
6209
|
+
return true;
|
|
6210
|
+
};
|
|
6211
|
+
const regionFromScan = () => {
|
|
6212
|
+
const oldLen = blocks.length;
|
|
6213
|
+
const newLen = count;
|
|
6214
|
+
let i = 0;
|
|
6215
|
+
const shared2 = oldLen < newLen ? oldLen : newLen;
|
|
6216
|
+
while (i < shared2) {
|
|
6217
|
+
const block2 = blocks[i];
|
|
6218
|
+
if (!sameKey(block2.key, keyAt(i))) break;
|
|
6219
|
+
syncData(block2, i);
|
|
6220
|
+
i++;
|
|
6221
|
+
}
|
|
6222
|
+
let oe = oldLen - 1;
|
|
6223
|
+
let ne = newLen - 1;
|
|
6224
|
+
while (oe >= i && ne >= i) {
|
|
6225
|
+
const block2 = blocks[oe];
|
|
6226
|
+
if (!sameKey(block2.key, keyAt(ne))) break;
|
|
6227
|
+
syncData(block2, ne);
|
|
6228
|
+
oe--;
|
|
6229
|
+
ne--;
|
|
5859
6230
|
}
|
|
6231
|
+
lo = i;
|
|
6232
|
+
oldHi = oe + 1;
|
|
6233
|
+
newHi = ne + 1;
|
|
6234
|
+
};
|
|
6235
|
+
const reconcileRegion = () => {
|
|
6236
|
+
const toPatch = newHi - lo;
|
|
6237
|
+
if (lo >= oldHi) {
|
|
6238
|
+
if (toPatch > 0) {
|
|
6239
|
+
const created = [];
|
|
6240
|
+
buildRange(lo, newHi, nodeAfter(lo), created);
|
|
6241
|
+
spliceBlocks(lo, 0, created);
|
|
6242
|
+
}
|
|
6243
|
+
return;
|
|
6244
|
+
}
|
|
6245
|
+
if (toPatch === 0) {
|
|
6246
|
+
for (let j = lo; j < oldHi; j++) destroyBlock(blocks[j]);
|
|
6247
|
+
spliceBlocks(lo, oldHi - lo, NO_BLOCKS);
|
|
6248
|
+
return;
|
|
6249
|
+
}
|
|
6250
|
+
const keyToNew = /* @__PURE__ */ new Map();
|
|
6251
|
+
for (let n2 = lo; n2 < newHi; n2++) {
|
|
6252
|
+
const key = keyAt(n2);
|
|
6253
|
+
if (keyExpression && keyToNew.has(key)) warnDuplicateKey(el, key, expression);
|
|
6254
|
+
keyToNew.set(key, n2);
|
|
6255
|
+
}
|
|
6256
|
+
const oldOfNew = new Int32Array(toPatch);
|
|
6257
|
+
const reused = new Array(toPatch);
|
|
6258
|
+
let matched = 0;
|
|
6259
|
+
let moved = false;
|
|
6260
|
+
let highestSoFar = 0;
|
|
6261
|
+
for (let o = lo; o < oldHi; o++) {
|
|
6262
|
+
const block2 = blocks[o];
|
|
6263
|
+
const target2 = matched >= toPatch ? void 0 : keyToNew.get(block2.key);
|
|
6264
|
+
if (target2 === void 0 || reused[target2 - lo] !== void 0) {
|
|
6265
|
+
destroyBlock(block2);
|
|
6266
|
+
continue;
|
|
6267
|
+
}
|
|
6268
|
+
oldOfNew[target2 - lo] = o + 1;
|
|
6269
|
+
reused[target2 - lo] = block2;
|
|
6270
|
+
if (target2 >= highestSoFar) highestSoFar = target2;
|
|
6271
|
+
else moved = true;
|
|
6272
|
+
syncData(block2, target2);
|
|
6273
|
+
matched++;
|
|
6274
|
+
}
|
|
6275
|
+
const stay = moved ? longestIncreasing(oldOfNew) : null;
|
|
6276
|
+
let s = stay ? stay.length - 1 : -1;
|
|
6277
|
+
const region = new Array(toPatch);
|
|
6278
|
+
let before = nodeAfter(oldHi);
|
|
6279
|
+
let runEnd = -1;
|
|
6280
|
+
for (let n2 = toPatch - 1; n2 >= 0; n2--) {
|
|
6281
|
+
const newIndex = lo + n2;
|
|
6282
|
+
const block2 = reused[n2];
|
|
6283
|
+
if (block2 === void 0) {
|
|
6284
|
+
if (runEnd < 0) runEnd = newIndex + 1;
|
|
6285
|
+
continue;
|
|
6286
|
+
}
|
|
6287
|
+
if (runEnd >= 0) {
|
|
6288
|
+
const created = [];
|
|
6289
|
+
buildRange(newIndex + 1, runEnd, before, created);
|
|
6290
|
+
for (let c2 = 0; c2 < created.length; c2++) region[n2 + 1 + c2] = created[c2];
|
|
6291
|
+
if (created.length) before = created[0].nodes[0];
|
|
6292
|
+
runEnd = -1;
|
|
6293
|
+
}
|
|
6294
|
+
region[n2] = block2;
|
|
6295
|
+
if (moved && (s < 0 || n2 !== stay[s])) moveBlock(block2, before);
|
|
6296
|
+
else if (moved) s--;
|
|
6297
|
+
before = block2.nodes[0];
|
|
6298
|
+
}
|
|
6299
|
+
if (runEnd >= 0) {
|
|
6300
|
+
const created = [];
|
|
6301
|
+
buildRange(lo, runEnd, before, created);
|
|
6302
|
+
for (let c2 = 0; c2 < created.length; c2++) region[c2] = created[c2];
|
|
6303
|
+
}
|
|
6304
|
+
spliceBlocks(lo, oldHi - lo, region);
|
|
6305
|
+
};
|
|
6306
|
+
const clearAll = () => {
|
|
6307
|
+
for (const block2 of blocks) destroyBlock(block2);
|
|
5860
6308
|
blocks = [];
|
|
6309
|
+
lastSource = null;
|
|
6310
|
+
lastVersion = 0;
|
|
5861
6311
|
};
|
|
5862
6312
|
addCleanup(anchor, clearAll);
|
|
5863
6313
|
effect3(() => {
|
|
5864
6314
|
const source = evaluateIn(sourceExpression, scope, "v-for");
|
|
5865
|
-
const
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
if (keyExpression && used.has(key)) warnDuplicateKey(el, key, expression);
|
|
5877
|
-
const existing = previous.get(key);
|
|
5878
|
-
if (existing && !used.has(key)) {
|
|
5879
|
-
used.add(key);
|
|
5880
|
-
for (const [name, value] of Object.entries(vars)) existing.data[name] = value;
|
|
5881
|
-
next.push(existing);
|
|
5882
|
-
return;
|
|
5883
|
-
}
|
|
5884
|
-
const childScope = scope.reactiveChild(vars);
|
|
5885
|
-
const nodes = renderTemplate(template, anchor, childScope, batch);
|
|
5886
|
-
used.add(key);
|
|
5887
|
-
next.push({ key, scope: childScope, nodes, data: childScope.data });
|
|
5888
|
-
});
|
|
5889
|
-
if (batch.fragment.firstChild) anchor.parentNode?.insertBefore(batch.fragment, anchor);
|
|
5890
|
-
for (const [node, rowScope] of batch.pending) walk(node, rowScope);
|
|
5891
|
-
const reused = new Set(next);
|
|
5892
|
-
for (const block2 of blocks) {
|
|
5893
|
-
if (used.has(block2.key) && reused.has(block2)) continue;
|
|
5894
|
-
for (const node of block2.nodes) {
|
|
5895
|
-
destroy(node);
|
|
5896
|
-
node.remove();
|
|
6315
|
+
const raw = toRaw(source);
|
|
6316
|
+
let fromMutations = false;
|
|
6317
|
+
if (Array.isArray(raw)) {
|
|
6318
|
+
track(raw, "length");
|
|
6319
|
+
track(raw, ITERATE_KEY);
|
|
6320
|
+
rows = raw;
|
|
6321
|
+
entries = null;
|
|
6322
|
+
count = raw.length;
|
|
6323
|
+
const version3 = arrayVersion(raw);
|
|
6324
|
+
if (raw === lastSource && keyExpression && !keyIsIndex) {
|
|
6325
|
+
fromMutations = regionFromMutations(raw);
|
|
5897
6326
|
}
|
|
6327
|
+
lastSource = raw;
|
|
6328
|
+
lastVersion = version3;
|
|
6329
|
+
} else {
|
|
6330
|
+
entries = normalizeSource(source, itemAlias, indexAlias, thirdAlias);
|
|
6331
|
+
rows = entries;
|
|
6332
|
+
count = entries.length;
|
|
6333
|
+
lastSource = null;
|
|
6334
|
+
lastVersion = 0;
|
|
5898
6335
|
}
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
const last = block2.nodes[block2.nodes.length - 1];
|
|
5903
|
-
if (last && last.nextSibling !== cursor) {
|
|
5904
|
-
for (const node of block2.nodes) anchor.parentNode?.insertBefore(node, cursor);
|
|
5905
|
-
}
|
|
5906
|
-
cursor = block2.nodes[0] ?? cursor;
|
|
5907
|
-
}
|
|
5908
|
-
blocks = next;
|
|
6336
|
+
if (!fromMutations) regionFromScan();
|
|
6337
|
+
reconcileRegion();
|
|
6338
|
+
flushPending();
|
|
5909
6339
|
});
|
|
5910
6340
|
},
|
|
5911
6341
|
{ priority: exports.PRIORITY.FOR, terminal: true }
|
|
5912
6342
|
);
|
|
5913
6343
|
function normalizeSource(source, itemAlias, indexAlias, thirdAlias) {
|
|
5914
6344
|
const out = [];
|
|
5915
|
-
if (Array.isArray(source)) {
|
|
5916
|
-
source.forEach((item, index) => {
|
|
5917
|
-
const vars = { [itemAlias]: item };
|
|
5918
|
-
if (indexAlias) vars[indexAlias] = index;
|
|
5919
|
-
out.push(vars);
|
|
5920
|
-
});
|
|
5921
|
-
return out;
|
|
5922
|
-
}
|
|
5923
6345
|
if (typeof source === "number") {
|
|
5924
6346
|
for (let i = 1; i <= source; i++) {
|
|
5925
6347
|
const vars = { [itemAlias]: i };
|
|
@@ -7042,7 +7464,7 @@ function data(values) {
|
|
|
7042
7464
|
Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
|
|
7043
7465
|
return rootScope.data;
|
|
7044
7466
|
}
|
|
7045
|
-
var version2 = "0.
|
|
7467
|
+
var version2 = "0.13.0";
|
|
7046
7468
|
var core = {
|
|
7047
7469
|
// Utilities first: Voodoo's own names can override.
|
|
7048
7470
|
...utils_exports,
|
|
@@ -8285,7 +8707,7 @@ function writeUrl(state2, url2, replace) {
|
|
|
8285
8707
|
}, 0);
|
|
8286
8708
|
}
|
|
8287
8709
|
}
|
|
8288
|
-
function compileRoute(pattern,
|
|
8710
|
+
function compileRoute(pattern, record2) {
|
|
8289
8711
|
const clean = pattern === "*" ? "*" : normalizePath(pattern);
|
|
8290
8712
|
const raw = clean === "*" ? ["*"] : clean.split("/").filter(Boolean);
|
|
8291
8713
|
const segments = [];
|
|
@@ -8306,7 +8728,7 @@ function compileRoute(pattern, record) {
|
|
|
8306
8728
|
segments.push({ type: "static", value: piece, optional: false });
|
|
8307
8729
|
score += 4;
|
|
8308
8730
|
}
|
|
8309
|
-
return { pattern: clean, segments, score, record };
|
|
8731
|
+
return { pattern: clean, segments, score, record: record2 };
|
|
8310
8732
|
}
|
|
8311
8733
|
function matchSegments(segments, parts) {
|
|
8312
8734
|
const params = {};
|
|
@@ -8390,16 +8812,16 @@ function applyLocation(location2) {
|
|
|
8390
8812
|
route.name = location2.name;
|
|
8391
8813
|
route.meta = location2.meta;
|
|
8392
8814
|
route.matched = location2.matched;
|
|
8393
|
-
const
|
|
8394
|
-
if (
|
|
8395
|
-
document.title = settings2.titleTemplate.includes("%s") ? settings2.titleTemplate.replace("%s",
|
|
8815
|
+
const record2 = findRecord(location2.matched);
|
|
8816
|
+
if (record2?.title && typeof document !== "undefined") {
|
|
8817
|
+
document.title = settings2.titleTemplate.includes("%s") ? settings2.titleTemplate.replace("%s", record2.title) : record2.title;
|
|
8396
8818
|
}
|
|
8397
8819
|
}
|
|
8398
8820
|
async function runGuards(to, from) {
|
|
8399
|
-
const
|
|
8400
|
-
if (
|
|
8401
|
-
if (
|
|
8402
|
-
const verdict = await
|
|
8821
|
+
const record2 = findRecord(to.matched);
|
|
8822
|
+
if (record2?.redirect) return record2.redirect;
|
|
8823
|
+
if (record2?.beforeEnter) {
|
|
8824
|
+
const verdict = await record2.beforeEnter(to, from);
|
|
8403
8825
|
if (verdict === false) return false;
|
|
8404
8826
|
if (typeof verdict === "string") return verdict;
|
|
8405
8827
|
}
|
|
@@ -8561,8 +8983,8 @@ async function enterInitialRoute() {
|
|
|
8561
8983
|
if (destination.hash) scheduleScroll(destination, from, null);
|
|
8562
8984
|
settings2.afterEach?.(snapshot(), from);
|
|
8563
8985
|
}
|
|
8564
|
-
function addRoute(pattern,
|
|
8565
|
-
const compiledRoute = compileRoute(pattern,
|
|
8986
|
+
function addRoute(pattern, record2) {
|
|
8987
|
+
const compiledRoute = compileRoute(pattern, record2);
|
|
8566
8988
|
const index = compiled.findIndex((item) => item.pattern === compiledRoute.pattern);
|
|
8567
8989
|
if (index > -1) compiled.splice(index, 1, compiledRoute);
|
|
8568
8990
|
else compiled.push(compiledRoute);
|
|
@@ -8590,8 +9012,8 @@ function configureRouter(options) {
|
|
|
8590
9012
|
settings2.titleTemplate = options.titleTemplate ?? "%s";
|
|
8591
9013
|
settings2.scrollBehavior = options.scrollBehavior ?? null;
|
|
8592
9014
|
compiled.length = 0;
|
|
8593
|
-
for (const [pattern,
|
|
8594
|
-
compiled.push(compileRoute(pattern,
|
|
9015
|
+
for (const [pattern, record2] of Object.entries(options.routes ?? {})) {
|
|
9016
|
+
compiled.push(compileRoute(pattern, record2));
|
|
8595
9017
|
}
|
|
8596
9018
|
configured = true;
|
|
8597
9019
|
startListening();
|
|
@@ -8653,11 +9075,11 @@ defineDirective(
|
|
|
8653
9075
|
for (const child of Array.from(el.childNodes)) destroy(child);
|
|
8654
9076
|
el.textContent = "";
|
|
8655
9077
|
};
|
|
8656
|
-
const mount = (
|
|
9078
|
+
const mount = (record2, html) => {
|
|
8657
9079
|
unmount();
|
|
8658
|
-
if (
|
|
9080
|
+
if (record2?.component) {
|
|
8659
9081
|
const host = document.createElement("div");
|
|
8660
|
-
host.setAttribute(`${exports.config.prefix}component`,
|
|
9082
|
+
host.setAttribute(`${exports.config.prefix}component`, record2.component);
|
|
8661
9083
|
host.className = "v-router-page";
|
|
8662
9084
|
el.appendChild(host);
|
|
8663
9085
|
walk(host, scope);
|
|
@@ -8666,28 +9088,28 @@ defineDirective(
|
|
|
8666
9088
|
el.innerHTML = html ?? fallbackHtml;
|
|
8667
9089
|
for (const child of Array.from(el.childNodes)) walk(child, scope);
|
|
8668
9090
|
};
|
|
8669
|
-
const render3 = async (
|
|
9091
|
+
const render3 = async (record2, current2) => {
|
|
8670
9092
|
let html = null;
|
|
8671
|
-
if (
|
|
9093
|
+
if (record2?.view) {
|
|
8672
9094
|
el.classList.add("v-router-loading");
|
|
8673
9095
|
try {
|
|
8674
|
-
html = await loadView(
|
|
9096
|
+
html = await loadView(record2.view);
|
|
8675
9097
|
} catch (err) {
|
|
8676
|
-
handleError(err, `v-router-view loading "${
|
|
9098
|
+
handleError(err, `v-router-view loading "${record2.view}"`);
|
|
8677
9099
|
html = "";
|
|
8678
9100
|
} finally {
|
|
8679
9101
|
el.classList.remove("v-router-loading");
|
|
8680
9102
|
}
|
|
8681
9103
|
if (current2 !== token) return;
|
|
8682
9104
|
}
|
|
8683
|
-
if (useTransition) viewTransition(() => mount(
|
|
8684
|
-
else mount(
|
|
9105
|
+
if (useTransition) viewTransition(() => mount(record2, html));
|
|
9106
|
+
else mount(record2, html);
|
|
8685
9107
|
};
|
|
8686
9108
|
effect3(() => {
|
|
8687
9109
|
const matched = route.matched;
|
|
8688
9110
|
void paramsSignature(route.params);
|
|
8689
|
-
const
|
|
8690
|
-
void render3(
|
|
9111
|
+
const record2 = findRecord(matched);
|
|
9112
|
+
void render3(record2, ++token);
|
|
8691
9113
|
});
|
|
8692
9114
|
cleanup(() => {
|
|
8693
9115
|
token++;
|
|
@@ -13361,7 +13783,7 @@ defineDirective(
|
|
|
13361
13783
|
restoring = false;
|
|
13362
13784
|
});
|
|
13363
13785
|
}
|
|
13364
|
-
const
|
|
13786
|
+
const record2 = debounce(() => {
|
|
13365
13787
|
if (restoring) return;
|
|
13366
13788
|
const current2 = JSON.stringify(serializable(scope.data));
|
|
13367
13789
|
if (current2 === JSON.stringify(snapshots[position])) return;
|
|
@@ -13371,12 +13793,12 @@ defineDirective(
|
|
|
13371
13793
|
position = snapshots.length - 1;
|
|
13372
13794
|
sync();
|
|
13373
13795
|
}, parseDuration(el.getAttribute("v-history-debounce") ?? void 0, 300));
|
|
13374
|
-
const stopWatching = watch(scope.data, () =>
|
|
13796
|
+
const stopWatching = watch(scope.data, () => record2(), { deep: true });
|
|
13375
13797
|
controllers.set(el, controller);
|
|
13376
13798
|
scope.set("$history", controller);
|
|
13377
13799
|
cleanup(() => {
|
|
13378
13800
|
stopWatching();
|
|
13379
|
-
|
|
13801
|
+
record2.cancel();
|
|
13380
13802
|
controllers.delete(el);
|
|
13381
13803
|
});
|
|
13382
13804
|
},
|
|
@@ -19740,7 +20162,7 @@ var flashing = /* @__PURE__ */ new Set();
|
|
|
19740
20162
|
var flashTimers = /* @__PURE__ */ new Map();
|
|
19741
20163
|
var outlined = [];
|
|
19742
20164
|
var requestStarts = /* @__PURE__ */ new WeakMap();
|
|
19743
|
-
var
|
|
20165
|
+
var metrics2 = {
|
|
19744
20166
|
effects: 0,
|
|
19745
20167
|
mutations: 0,
|
|
19746
20168
|
effectsPerSecond: 0,
|
|
@@ -20157,7 +20579,7 @@ function instrument(node, owner) {
|
|
|
20157
20579
|
const original = item.fn;
|
|
20158
20580
|
patchedEffects.set(item, original);
|
|
20159
20581
|
item.fn = () => {
|
|
20160
|
-
|
|
20582
|
+
metrics2.effects++;
|
|
20161
20583
|
flash(owner);
|
|
20162
20584
|
return original();
|
|
20163
20585
|
};
|
|
@@ -20604,20 +21026,20 @@ function renderNetworkTab() {
|
|
|
20604
21026
|
function renderPerformanceTab() {
|
|
20605
21027
|
const frag = document.createDocumentFragment();
|
|
20606
21028
|
const updates = h("div", "v-xray-metric");
|
|
20607
|
-
updates.appendChild(h("span", "v-xray-metric-value", String(
|
|
21029
|
+
updates.appendChild(h("span", "v-xray-metric-value", String(metrics2.updatesPerSecond)));
|
|
20608
21030
|
updates.appendChild(h("span", void 0, "DOM updates per second"));
|
|
20609
21031
|
frag.appendChild(updates);
|
|
20610
21032
|
const effects = h("div", "v-xray-metric");
|
|
20611
|
-
effects.appendChild(h("span", "v-xray-metric-value", String(
|
|
21033
|
+
effects.appendChild(h("span", "v-xray-metric-value", String(metrics2.effectsPerSecond)));
|
|
20612
21034
|
effects.appendChild(h("span", void 0, "reactive effects triggered per second"));
|
|
20613
21035
|
frag.appendChild(effects);
|
|
20614
21036
|
const total = h("div", "v-xray-metric");
|
|
20615
|
-
total.appendChild(h("span", "v-xray-metric-value", String(
|
|
21037
|
+
total.appendChild(h("span", "v-xray-metric-value", String(metrics2.effects)));
|
|
20616
21038
|
total.appendChild(h("span", void 0, "effects triggered since x-ray was enabled"));
|
|
20617
21039
|
frag.appendChild(total);
|
|
20618
21040
|
const chart = h("div", "v-xray-chart");
|
|
20619
|
-
const peak = Math.max(1, ...
|
|
20620
|
-
for (const item of
|
|
21041
|
+
const peak = Math.max(1, ...metrics2.history.map((item) => Math.max(item.effects, item.updates)));
|
|
21042
|
+
for (const item of metrics2.history) {
|
|
20621
21043
|
const bar = h("div", "v-xray-bar");
|
|
20622
21044
|
const value = Math.max(item.effects, item.updates);
|
|
20623
21045
|
bar.style.height = `${Math.max(2, Math.round(value / peak * 46))}px`;
|
|
@@ -20856,14 +21278,14 @@ var observer3 = null;
|
|
|
20856
21278
|
function observeMutations() {
|
|
20857
21279
|
observer3 = new MutationObserver((records) => {
|
|
20858
21280
|
let structural = false;
|
|
20859
|
-
for (const
|
|
20860
|
-
const target2 =
|
|
21281
|
+
for (const record2 of records) {
|
|
21282
|
+
const target2 = record2.target;
|
|
20861
21283
|
if (isXrayNode(target2)) continue;
|
|
20862
|
-
if (
|
|
21284
|
+
if (record2.type === "attributes" && record2.attributeName === "class" && target2.nodeType === 1 && flashing.has(target2)) {
|
|
20863
21285
|
continue;
|
|
20864
21286
|
}
|
|
20865
|
-
|
|
20866
|
-
if (
|
|
21287
|
+
metrics2.mutations++;
|
|
21288
|
+
if (record2.type === "childList" && record2.addedNodes.length) structural = true;
|
|
20867
21289
|
}
|
|
20868
21290
|
if (structural && !scanTimer) {
|
|
20869
21291
|
scanTimer = window.setTimeout(() => {
|
|
@@ -20881,15 +21303,15 @@ function observeMutations() {
|
|
|
20881
21303
|
}
|
|
20882
21304
|
function startTimers() {
|
|
20883
21305
|
metricsTimer = window.setInterval(() => {
|
|
20884
|
-
|
|
20885
|
-
|
|
20886
|
-
lastEffectCount =
|
|
20887
|
-
lastMutationCount =
|
|
20888
|
-
|
|
20889
|
-
effects:
|
|
20890
|
-
updates:
|
|
21306
|
+
metrics2.effectsPerSecond = metrics2.effects - lastEffectCount;
|
|
21307
|
+
metrics2.updatesPerSecond = metrics2.mutations - lastMutationCount;
|
|
21308
|
+
lastEffectCount = metrics2.effects;
|
|
21309
|
+
lastMutationCount = metrics2.mutations;
|
|
21310
|
+
metrics2.history.push({
|
|
21311
|
+
effects: metrics2.effectsPerSecond,
|
|
21312
|
+
updates: metrics2.updatesPerSecond
|
|
20891
21313
|
});
|
|
20892
|
-
if (
|
|
21314
|
+
if (metrics2.history.length > 40) metrics2.history.shift();
|
|
20893
21315
|
if (activeTab === "desempenho") renderActiveTab();
|
|
20894
21316
|
}, 1e3);
|
|
20895
21317
|
refreshTimer = window.setInterval(() => {
|
|
@@ -20908,11 +21330,11 @@ function enableXray() {
|
|
|
20908
21330
|
injectStyle("xray", XRAY_CSS);
|
|
20909
21331
|
refs = buildPanel();
|
|
20910
21332
|
activeTab = activeTab || "estado";
|
|
20911
|
-
|
|
20912
|
-
|
|
21333
|
+
metrics2.effects = 0;
|
|
21334
|
+
metrics2.mutations = 0;
|
|
20913
21335
|
lastEffectCount = 0;
|
|
20914
21336
|
lastMutationCount = 0;
|
|
20915
|
-
|
|
21337
|
+
metrics2.history.length = 0;
|
|
20916
21338
|
scanDocument();
|
|
20917
21339
|
listenEvents();
|
|
20918
21340
|
listenNetwork();
|
|
@@ -22966,12 +23388,12 @@ function flattenValue(value, components2) {
|
|
|
22966
23388
|
return out;
|
|
22967
23389
|
}
|
|
22968
23390
|
if (value && typeof value === "object") {
|
|
22969
|
-
const
|
|
23391
|
+
const record2 = value;
|
|
22970
23392
|
const keys = ["x", "y", "z", "w"];
|
|
22971
23393
|
const alt = ["r", "g", "b", "a"];
|
|
22972
23394
|
const out = [];
|
|
22973
23395
|
for (let i = 0; i < components2; i++) {
|
|
22974
|
-
const found =
|
|
23396
|
+
const found = record2[keys[i]] ?? record2[alt[i]];
|
|
22975
23397
|
if (typeof found === "number") out.push(found);
|
|
22976
23398
|
}
|
|
22977
23399
|
return out;
|