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/voodoo.full.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Voodoo.js v0.
|
|
2
|
+
* Voodoo.js v0.13.0
|
|
3
3
|
* JavaScript feels like magic.
|
|
4
4
|
* (c) 2026 Voodoo.js contributors. MIT License.
|
|
5
5
|
*/
|
|
@@ -31,10 +31,12 @@ var Voodoo = (() => {
|
|
|
31
31
|
// src/reactivity/index.ts
|
|
32
32
|
var reactivity_exports = {};
|
|
33
33
|
__export(reactivity_exports, {
|
|
34
|
+
ArrayOp: () => ArrayOp,
|
|
34
35
|
EffectScope: () => EffectScope,
|
|
35
36
|
ITERATE_KEY: () => ITERATE_KEY,
|
|
36
37
|
ReactiveEffect: () => ReactiveEffect,
|
|
37
38
|
TriggerType: () => TriggerType,
|
|
39
|
+
arrayVersion: () => arrayVersion,
|
|
38
40
|
computed: () => computed,
|
|
39
41
|
effect: () => effect,
|
|
40
42
|
effectScope: () => effectScope,
|
|
@@ -47,6 +49,7 @@ var Voodoo = (() => {
|
|
|
47
49
|
isReactive: () => isReactive,
|
|
48
50
|
isRef: () => isRef,
|
|
49
51
|
markRaw: () => markRaw,
|
|
52
|
+
mutationsSince: () => mutationsSince,
|
|
50
53
|
nextTick: () => nextTick,
|
|
51
54
|
pauseTracking: () => pauseTracking,
|
|
52
55
|
queueJob: () => queueJob,
|
|
@@ -210,7 +213,9 @@ var Voodoo = (() => {
|
|
|
210
213
|
if (!isArr) add(depsMap.get(ITERATE_KEY));
|
|
211
214
|
else if (isIntegerKey(key)) add(depsMap.get("length"));
|
|
212
215
|
} else if (type === "delete" /* DELETE */) {
|
|
213
|
-
|
|
216
|
+
add(depsMap.get(ITERATE_KEY));
|
|
217
|
+
} else if (isArr && isIntegerKey(key)) {
|
|
218
|
+
add(depsMap.get(ITERATE_KEY));
|
|
214
219
|
} else if (isArr && key === "length") {
|
|
215
220
|
const newLen = Number(_newValue);
|
|
216
221
|
depsMap.forEach((dep, k) => {
|
|
@@ -223,12 +228,61 @@ var Voodoo = (() => {
|
|
|
223
228
|
else queueJob(e);
|
|
224
229
|
}
|
|
225
230
|
}
|
|
231
|
+
function triggerArrayRange(target, from) {
|
|
232
|
+
const depsMap = targetMap.get(target);
|
|
233
|
+
if (!depsMap) return;
|
|
234
|
+
const effects = /* @__PURE__ */ new Set();
|
|
235
|
+
const add = (dep) => {
|
|
236
|
+
if (!dep) return;
|
|
237
|
+
for (const e of dep) if (e !== activeEffect) effects.add(e);
|
|
238
|
+
};
|
|
239
|
+
add(depsMap.get("length"));
|
|
240
|
+
add(depsMap.get(ITERATE_KEY));
|
|
241
|
+
if (from >= 0) {
|
|
242
|
+
depsMap.forEach((dep, k) => {
|
|
243
|
+
if (typeof k === "string" && isIntegerKey(k) && Number(k) >= from) add(dep);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
for (const e of effects) {
|
|
247
|
+
if (e.scheduler) e.scheduler();
|
|
248
|
+
else queueJob(e);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function record(target, type, index, removed, added) {
|
|
252
|
+
let log = mutationLogs.get(target);
|
|
253
|
+
if (!log) mutationLogs.set(target, log = { version: 0, ops: [] });
|
|
254
|
+
log.version++;
|
|
255
|
+
if (type === 3 /* RESET */) {
|
|
256
|
+
log.ops.length = 0;
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
log.ops.push({ type, index, removed, added });
|
|
260
|
+
if (log.ops.length > LOG_LIMIT) log.ops.shift();
|
|
261
|
+
}
|
|
262
|
+
function arrayVersion(target) {
|
|
263
|
+
const log = mutationLogs.get(target);
|
|
264
|
+
return log ? log.version : 0;
|
|
265
|
+
}
|
|
266
|
+
function mutationsSince(target, since) {
|
|
267
|
+
const log = mutationLogs.get(target);
|
|
268
|
+
if (!log) return since === 0 ? NO_MUTATIONS : null;
|
|
269
|
+
if (since > log.version) return null;
|
|
270
|
+
const missing = log.version - since;
|
|
271
|
+
if (missing === 0) return NO_MUTATIONS;
|
|
272
|
+
if (missing > log.ops.length) return null;
|
|
273
|
+
return log.ops.slice(log.ops.length - missing);
|
|
274
|
+
}
|
|
226
275
|
function isIntegerKey(key) {
|
|
227
276
|
return typeof key === "string" && key !== "NaN" && key[0] !== "-" && String(parseInt(key, 10)) === key;
|
|
228
277
|
}
|
|
229
278
|
function isObject(val) {
|
|
230
279
|
return val !== null && typeof val === "object";
|
|
231
280
|
}
|
|
281
|
+
function spliceStart(raw, length) {
|
|
282
|
+
const n2 = Math.trunc(Number(raw)) || 0;
|
|
283
|
+
if (n2 < 0) return Math.max(length + n2, 0);
|
|
284
|
+
return Math.min(n2, length);
|
|
285
|
+
}
|
|
232
286
|
function canObserve(value) {
|
|
233
287
|
if (!isObject(value)) return false;
|
|
234
288
|
if (value[SKIP]) return false;
|
|
@@ -238,6 +292,23 @@ var Voodoo = (() => {
|
|
|
238
292
|
if (NON_REACTIVE.has(tag)) return false;
|
|
239
293
|
return tag === "Object" || tag === "Array" || tag === "Map" || tag === "Set";
|
|
240
294
|
}
|
|
295
|
+
function recordDirectWrite(target, key, lengthBefore, hadKey, oldValue, value) {
|
|
296
|
+
if (key === "length") {
|
|
297
|
+
const next = target.length;
|
|
298
|
+
if (next < lengthBefore) record(target, 1 /* SPLICE */, next, lengthBefore - next, 0);
|
|
299
|
+
else if (next > lengthBefore) record(target, 3 /* RESET */, 0, 0, 0);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (!isIntegerKey(key)) return;
|
|
303
|
+
const index = Number(key);
|
|
304
|
+
if (hadKey) {
|
|
305
|
+
if (hasChanged(value, oldValue)) record(target, 2 /* SET */, index, 1, 1);
|
|
306
|
+
} else if (index === lengthBefore) {
|
|
307
|
+
record(target, 1 /* SPLICE */, index, 0, 1);
|
|
308
|
+
} else {
|
|
309
|
+
record(target, 3 /* RESET */, 0, 0, 0);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
241
312
|
function markRaw(value) {
|
|
242
313
|
Object.defineProperty(value, SKIP, { value: true, enumerable: false, configurable: true });
|
|
243
314
|
return value;
|
|
@@ -360,7 +431,7 @@ var Voodoo = (() => {
|
|
|
360
431
|
else for (const key of Object.keys(value)) traverse(value[key], seen);
|
|
361
432
|
return value;
|
|
362
433
|
}
|
|
363
|
-
var resolvedPromise, queue, postQueue, isFlushing, isFlushPending, flushPromise, RECURSION_LIMIT, errorHandler, activeEffect, shouldTrack, trackStack, effectId, ReactiveEffect, activeScope, EffectScope, ITERATE_KEY, targetMap, TriggerType, RAW, IS_REACTIVE, SKIP, reactiveMap, arrayInstrumentations, NON_REACTIVE, baseHandlers, collectionHandlers, RefImpl, ComputedRefImpl;
|
|
434
|
+
var resolvedPromise, queue, postQueue, isFlushing, isFlushPending, flushPromise, RECURSION_LIMIT, errorHandler, activeEffect, shouldTrack, trackStack, effectId, ReactiveEffect, activeScope, EffectScope, ITERATE_KEY, targetMap, TriggerType, ArrayOp, LOG_LIMIT, mutationLogs, NO_MUTATIONS, RAW, IS_REACTIVE, SKIP, reactiveMap, arrayInstrumentations, NON_REACTIVE, baseHandlers, collectionHandlers, RefImpl, ComputedRefImpl;
|
|
364
435
|
var init_reactivity = __esm({
|
|
365
436
|
"src/reactivity/index.ts"() {
|
|
366
437
|
"use strict";
|
|
@@ -490,6 +561,15 @@ var Voodoo = (() => {
|
|
|
490
561
|
TriggerType2["CLEAR"] = "clear";
|
|
491
562
|
return TriggerType2;
|
|
492
563
|
})(TriggerType || {});
|
|
564
|
+
ArrayOp = /* @__PURE__ */ ((ArrayOp2) => {
|
|
565
|
+
ArrayOp2[ArrayOp2["SPLICE"] = 1] = "SPLICE";
|
|
566
|
+
ArrayOp2[ArrayOp2["SET"] = 2] = "SET";
|
|
567
|
+
ArrayOp2[ArrayOp2["RESET"] = 3] = "RESET";
|
|
568
|
+
return ArrayOp2;
|
|
569
|
+
})(ArrayOp || {});
|
|
570
|
+
LOG_LIMIT = 32;
|
|
571
|
+
mutationLogs = /* @__PURE__ */ new WeakMap();
|
|
572
|
+
NO_MUTATIONS = [];
|
|
493
573
|
RAW = /* @__PURE__ */ Symbol("voodoo:raw");
|
|
494
574
|
IS_REACTIVE = /* @__PURE__ */ Symbol("voodoo:isReactive");
|
|
495
575
|
SKIP = /* @__PURE__ */ Symbol("voodoo:skip");
|
|
@@ -507,14 +587,61 @@ var Voodoo = (() => {
|
|
|
507
587
|
return res;
|
|
508
588
|
};
|
|
509
589
|
}
|
|
510
|
-
for (const key of ["push", "pop", "shift", "unshift", "splice"]) {
|
|
590
|
+
for (const key of ["push", "pop", "shift", "unshift", "splice", "reverse", "sort"]) {
|
|
511
591
|
inst[key] = function(...args) {
|
|
592
|
+
const raw = toRaw(this);
|
|
593
|
+
const before = raw.length;
|
|
594
|
+
for (let i = 0; i < args.length; i++) args[i] = toRaw(args[i]);
|
|
512
595
|
pauseTracking();
|
|
596
|
+
let result;
|
|
513
597
|
try {
|
|
514
|
-
|
|
598
|
+
result = raw[key].apply(raw, args);
|
|
515
599
|
} finally {
|
|
516
600
|
resetTracking();
|
|
517
601
|
}
|
|
602
|
+
const after = raw.length;
|
|
603
|
+
let from = -1;
|
|
604
|
+
if (key === "push") {
|
|
605
|
+
if (args.length) {
|
|
606
|
+
record(raw, 1 /* SPLICE */, before, 0, args.length);
|
|
607
|
+
from = before;
|
|
608
|
+
}
|
|
609
|
+
} else if (key === "unshift") {
|
|
610
|
+
if (args.length) {
|
|
611
|
+
record(raw, 1 /* SPLICE */, 0, 0, args.length);
|
|
612
|
+
from = 0;
|
|
613
|
+
}
|
|
614
|
+
} else if (key === "pop") {
|
|
615
|
+
if (before > 0) {
|
|
616
|
+
record(raw, 1 /* SPLICE */, after, 1, 0);
|
|
617
|
+
from = after;
|
|
618
|
+
}
|
|
619
|
+
} else if (key === "shift") {
|
|
620
|
+
if (before > 0) {
|
|
621
|
+
record(raw, 1 /* SPLICE */, 0, 1, 0);
|
|
622
|
+
from = 0;
|
|
623
|
+
}
|
|
624
|
+
} else if (key === "splice") {
|
|
625
|
+
const removed = result.length;
|
|
626
|
+
const added = args.length > 2 ? args.length - 2 : 0;
|
|
627
|
+
if (removed || added) {
|
|
628
|
+
record(raw, 1 /* SPLICE */, spliceStart(args[0], before), removed, added);
|
|
629
|
+
from = spliceStart(args[0], before);
|
|
630
|
+
}
|
|
631
|
+
} else {
|
|
632
|
+
if (before > 1) {
|
|
633
|
+
record(raw, 3 /* RESET */, 0, before, after);
|
|
634
|
+
from = 0;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
if (from >= 0) triggerArrayRange(raw, from);
|
|
638
|
+
if (key === "pop" || key === "shift") return isObject(result) ? reactive(result) : result;
|
|
639
|
+
if (key === "splice") {
|
|
640
|
+
const out = result;
|
|
641
|
+
for (let i = 0; i < out.length; i++) if (isObject(out[i])) out[i] = reactive(out[i]);
|
|
642
|
+
return out;
|
|
643
|
+
}
|
|
644
|
+
return key === "reverse" || key === "sort" ? this : result;
|
|
518
645
|
};
|
|
519
646
|
}
|
|
520
647
|
return inst;
|
|
@@ -556,8 +683,11 @@ var Voodoo = (() => {
|
|
|
556
683
|
return true;
|
|
557
684
|
}
|
|
558
685
|
const hadKey = Array.isArray(target) && isIntegerKey(key) ? Number(key) < target.length : Object.prototype.hasOwnProperty.call(target, key);
|
|
686
|
+
const isArr = Array.isArray(target);
|
|
687
|
+
const arrayLength = isArr ? target.length : 0;
|
|
559
688
|
const result = Reflect.set(target, key, value, receiver);
|
|
560
689
|
if (target === toRaw(receiver)) {
|
|
690
|
+
if (isArr) recordDirectWrite(target, key, arrayLength, hadKey, oldValue, value);
|
|
561
691
|
if (!hadKey) trigger(target, "add" /* ADD */, key, value);
|
|
562
692
|
else if (hasChanged(value, oldValue)) trigger(target, "set" /* SET */, key, value);
|
|
563
693
|
}
|
|
@@ -566,7 +696,10 @@ var Voodoo = (() => {
|
|
|
566
696
|
deleteProperty(target, key) {
|
|
567
697
|
const hadKey = Object.prototype.hasOwnProperty.call(target, key);
|
|
568
698
|
const result = Reflect.deleteProperty(target, key);
|
|
569
|
-
if (result && hadKey)
|
|
699
|
+
if (result && hadKey) {
|
|
700
|
+
if (Array.isArray(target)) record(target, 3 /* RESET */, 0, 0, 0);
|
|
701
|
+
trigger(target, "delete" /* DELETE */, key);
|
|
702
|
+
}
|
|
570
703
|
return result;
|
|
571
704
|
},
|
|
572
705
|
has(target, key) {
|
|
@@ -5729,6 +5862,35 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
5729
5862
|
// src/directives/core.ts
|
|
5730
5863
|
init_reactivity();
|
|
5731
5864
|
init_registry();
|
|
5865
|
+
|
|
5866
|
+
// src/runtime/metrics.ts
|
|
5867
|
+
function blank() {
|
|
5868
|
+
return {
|
|
5869
|
+
on: false,
|
|
5870
|
+
itemsVisited: 0,
|
|
5871
|
+
keyEvaluations: 0,
|
|
5872
|
+
prefixScanned: 0,
|
|
5873
|
+
suffixScanned: 0,
|
|
5874
|
+
middleReconciled: 0,
|
|
5875
|
+
scopeAllocations: 0,
|
|
5876
|
+
proxyWrites: 0,
|
|
5877
|
+
arrayAllocations: 0,
|
|
5878
|
+
keyMapLookups: 0,
|
|
5879
|
+
domCreates: 0,
|
|
5880
|
+
domRemoves: 0,
|
|
5881
|
+
domMoves: 0,
|
|
5882
|
+
domInserts: 0,
|
|
5883
|
+
lisRuns: 0,
|
|
5884
|
+
lisElements: 0,
|
|
5885
|
+
paths: {}
|
|
5886
|
+
};
|
|
5887
|
+
}
|
|
5888
|
+
var metrics = /* @__PURE__ */ blank();
|
|
5889
|
+
function countPath(name) {
|
|
5890
|
+
metrics.paths[name] = (metrics.paths[name] || 0) + 1;
|
|
5891
|
+
}
|
|
5892
|
+
|
|
5893
|
+
// src/directives/core.ts
|
|
5732
5894
|
function setValue(expression, scope, value) {
|
|
5733
5895
|
try {
|
|
5734
5896
|
const target = parse(expression);
|
|
@@ -5874,7 +6036,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
5874
6036
|
},
|
|
5875
6037
|
{ priority: PRIORITY.IF, terminal: true }
|
|
5876
6038
|
);
|
|
5877
|
-
function renderTemplate(source, anchor, scope
|
|
6039
|
+
function renderTemplate(source, anchor, scope) {
|
|
5878
6040
|
const parent = anchor.parentNode;
|
|
5879
6041
|
if (!parent) return [];
|
|
5880
6042
|
const nodes = [];
|
|
@@ -5891,21 +6053,64 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
5891
6053
|
}
|
|
5892
6054
|
} else {
|
|
5893
6055
|
const clone2 = source.cloneNode(true);
|
|
6056
|
+
if (metrics.on) metrics.domCreates++;
|
|
5894
6057
|
nodes.push(clone2);
|
|
5895
6058
|
markNodeScope(clone2, scope);
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
batch.pending.push([clone2, scope]);
|
|
5899
|
-
} else {
|
|
5900
|
-
parent.insertBefore(clone2, anchor);
|
|
5901
|
-
walk(clone2, scope);
|
|
5902
|
-
}
|
|
6059
|
+
parent.insertBefore(clone2, anchor);
|
|
6060
|
+
walk(clone2, scope);
|
|
5903
6061
|
}
|
|
5904
6062
|
return nodes;
|
|
5905
6063
|
}
|
|
5906
6064
|
defineDirective("else-if", () => void 0, { priority: PRIORITY.IF, terminal: true });
|
|
5907
6065
|
defineDirective("else", () => void 0, { priority: PRIORITY.IF, terminal: true });
|
|
5908
6066
|
var FOR_PATTERN = /^\s*\(?\s*([^)]*?)\s*\)?\s+(?:in|of)\s+(.+?)\s*$/;
|
|
6067
|
+
var KEY_PATH = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/;
|
|
6068
|
+
var NO_BLOCKS = [];
|
|
6069
|
+
function sameStored(stored, incoming) {
|
|
6070
|
+
if (stored === incoming) return true;
|
|
6071
|
+
return incoming !== null && typeof incoming === "object" && stored === toRaw(incoming);
|
|
6072
|
+
}
|
|
6073
|
+
function sameKey(a, b) {
|
|
6074
|
+
return a === b || a !== a && b !== b;
|
|
6075
|
+
}
|
|
6076
|
+
function longestIncreasing(arr) {
|
|
6077
|
+
const length = arr.length;
|
|
6078
|
+
const previous = new Int32Array(length);
|
|
6079
|
+
const tails = [];
|
|
6080
|
+
for (let i = 0; i < length; i++) {
|
|
6081
|
+
const value = arr[i];
|
|
6082
|
+
if (value === 0) continue;
|
|
6083
|
+
if (tails.length === 0) {
|
|
6084
|
+
tails.push(i);
|
|
6085
|
+
continue;
|
|
6086
|
+
}
|
|
6087
|
+
const last = tails[tails.length - 1];
|
|
6088
|
+
if (arr[last] < value) {
|
|
6089
|
+
previous[i] = last;
|
|
6090
|
+
tails.push(i);
|
|
6091
|
+
continue;
|
|
6092
|
+
}
|
|
6093
|
+
let low = 0;
|
|
6094
|
+
let high = tails.length - 1;
|
|
6095
|
+
while (low < high) {
|
|
6096
|
+
const mid = low + high >> 1;
|
|
6097
|
+
if (arr[tails[mid]] < value) low = mid + 1;
|
|
6098
|
+
else high = mid;
|
|
6099
|
+
}
|
|
6100
|
+
if (value < arr[tails[low]]) {
|
|
6101
|
+
if (low > 0) previous[i] = tails[low - 1];
|
|
6102
|
+
tails[low] = i;
|
|
6103
|
+
}
|
|
6104
|
+
}
|
|
6105
|
+
let cursor = tails.length;
|
|
6106
|
+
const out = new Int32Array(cursor);
|
|
6107
|
+
let node = tails[cursor - 1];
|
|
6108
|
+
while (cursor-- > 0) {
|
|
6109
|
+
out[cursor] = node;
|
|
6110
|
+
node = previous[node];
|
|
6111
|
+
}
|
|
6112
|
+
return out;
|
|
6113
|
+
}
|
|
5909
6114
|
defineDirective(
|
|
5910
6115
|
"for",
|
|
5911
6116
|
({ el, scope, expression, effect: effect2 }) => {
|
|
@@ -5931,78 +6136,361 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
5931
6136
|
template.removeAttribute(`${p2}bind:key`);
|
|
5932
6137
|
template.removeAttribute(`${p2}key`);
|
|
5933
6138
|
removeQuietly(el);
|
|
6139
|
+
const isTemplateRow = template.tagName === "TEMPLATE";
|
|
6140
|
+
let keyIsItem = false;
|
|
6141
|
+
let keyIsIndex = false;
|
|
6142
|
+
let keyProp = null;
|
|
6143
|
+
let keyPath = null;
|
|
6144
|
+
if (keyExpression && KEY_PATH.test(keyExpression)) {
|
|
6145
|
+
const parts = keyExpression.split(".");
|
|
6146
|
+
if (parts[0] === itemAlias) {
|
|
6147
|
+
if (parts.length === 1) keyIsItem = true;
|
|
6148
|
+
else if (parts.length === 2) keyProp = parts[1];
|
|
6149
|
+
else keyPath = parts.slice(1);
|
|
6150
|
+
} else if (indexAlias && parts.length === 1 && parts[0] === indexAlias) {
|
|
6151
|
+
keyIsIndex = true;
|
|
6152
|
+
}
|
|
6153
|
+
}
|
|
5934
6154
|
let blocks = [];
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
6155
|
+
let rows = [];
|
|
6156
|
+
let entries = null;
|
|
6157
|
+
let count = 0;
|
|
6158
|
+
let keyScope = null;
|
|
6159
|
+
let lastSource = null;
|
|
6160
|
+
let lastVersion = 0;
|
|
6161
|
+
const pending2 = [];
|
|
6162
|
+
const pendingRuns = [];
|
|
6163
|
+
const varsAt = (i) => {
|
|
6164
|
+
if (entries) return entries[i];
|
|
6165
|
+
const vars = { [itemAlias]: rows[i] };
|
|
6166
|
+
if (indexAlias) vars[indexAlias] = i;
|
|
6167
|
+
return vars;
|
|
6168
|
+
};
|
|
6169
|
+
const keyAt = (i) => {
|
|
6170
|
+
if (metrics.on) metrics.keyEvaluations++;
|
|
6171
|
+
if (keyIsIndex) return i;
|
|
6172
|
+
if (!keyExpression) {
|
|
6173
|
+
return i;
|
|
6174
|
+
}
|
|
6175
|
+
const item = entries ? entries[i][itemAlias] : rows[i];
|
|
6176
|
+
if (keyIsItem) return item;
|
|
6177
|
+
if (keyProp !== null) return item == null ? void 0 : item[keyProp];
|
|
6178
|
+
if (keyPath !== null) {
|
|
6179
|
+
let value = item;
|
|
6180
|
+
for (let d2 = 0; d2 < keyPath.length; d2++) {
|
|
6181
|
+
if (value == null) return void 0;
|
|
6182
|
+
value = value[keyPath[d2]];
|
|
6183
|
+
}
|
|
6184
|
+
return value;
|
|
6185
|
+
}
|
|
6186
|
+
if (!keyScope) keyScope = scope.child({});
|
|
6187
|
+
keyScope.data = varsAt(i);
|
|
6188
|
+
return evaluateIn(keyExpression, keyScope, ":key");
|
|
6189
|
+
};
|
|
6190
|
+
const syncData = (block2, i) => {
|
|
6191
|
+
const raw = toRaw(block2.data);
|
|
6192
|
+
if (entries) {
|
|
6193
|
+
const vars = entries[i];
|
|
6194
|
+
for (const name in vars) {
|
|
6195
|
+
if (!sameStored(raw[name], vars[name])) {
|
|
6196
|
+
if (metrics.on) metrics.proxyWrites++;
|
|
6197
|
+
block2.data[name] = vars[name];
|
|
6198
|
+
}
|
|
5940
6199
|
}
|
|
6200
|
+
return;
|
|
6201
|
+
}
|
|
6202
|
+
const item = rows[i];
|
|
6203
|
+
if (!sameStored(raw[itemAlias], item)) {
|
|
6204
|
+
if (metrics.on) metrics.proxyWrites++;
|
|
6205
|
+
block2.data[itemAlias] = item;
|
|
6206
|
+
}
|
|
6207
|
+
if (indexAlias !== void 0 && raw[indexAlias] !== i) {
|
|
6208
|
+
if (metrics.on) metrics.proxyWrites++;
|
|
6209
|
+
block2.data[indexAlias] = i;
|
|
6210
|
+
}
|
|
6211
|
+
};
|
|
6212
|
+
const buildRange = (from, to, before, out) => {
|
|
6213
|
+
if (from >= to) return;
|
|
6214
|
+
const parent = anchor.parentNode;
|
|
6215
|
+
if (!parent) return;
|
|
6216
|
+
pendingRuns.push(pending2.length);
|
|
6217
|
+
if (isTemplateRow) {
|
|
6218
|
+
for (let i = from; i < to; i++) {
|
|
6219
|
+
const childScope = scope.reactiveChild(varsAt(i));
|
|
6220
|
+
if (metrics.on) {
|
|
6221
|
+
metrics.scopeAllocations++;
|
|
6222
|
+
metrics.itemsVisited++;
|
|
6223
|
+
}
|
|
6224
|
+
const nodes = renderTemplate(template, before, childScope);
|
|
6225
|
+
out.push({ key: keyAt(i), scope: childScope, nodes, data: childScope.data });
|
|
6226
|
+
}
|
|
6227
|
+
return;
|
|
6228
|
+
}
|
|
6229
|
+
const fragment = document.createDocumentFragment();
|
|
6230
|
+
for (let i = from; i < to; i++) {
|
|
6231
|
+
const childScope = scope.reactiveChild(varsAt(i));
|
|
6232
|
+
const clone2 = template.cloneNode(true);
|
|
6233
|
+
markNodeScope(clone2, childScope);
|
|
6234
|
+
fragment.appendChild(clone2);
|
|
6235
|
+
pending2.push([clone2, childScope]);
|
|
6236
|
+
out.push({ key: keyAt(i), scope: childScope, nodes: [clone2], data: childScope.data });
|
|
6237
|
+
if (metrics.on) {
|
|
6238
|
+
metrics.scopeAllocations++;
|
|
6239
|
+
metrics.domCreates++;
|
|
6240
|
+
metrics.itemsVisited++;
|
|
6241
|
+
}
|
|
6242
|
+
}
|
|
6243
|
+
if (metrics.on) metrics.domInserts++;
|
|
6244
|
+
parent.insertBefore(fragment, before);
|
|
6245
|
+
};
|
|
6246
|
+
const destroyBlock = (block2) => {
|
|
6247
|
+
const nodes = block2.nodes;
|
|
6248
|
+
for (let j = 0; j < nodes.length; j++) {
|
|
6249
|
+
if (metrics.on) metrics.domRemoves++;
|
|
6250
|
+
destroy(nodes[j]);
|
|
6251
|
+
nodes[j].remove();
|
|
6252
|
+
}
|
|
6253
|
+
};
|
|
6254
|
+
const moveBlock = (block2, before) => {
|
|
6255
|
+
const parent = anchor.parentNode;
|
|
6256
|
+
if (!parent) return;
|
|
6257
|
+
const nodes = block2.nodes;
|
|
6258
|
+
if (nodes[nodes.length - 1].nextSibling === before) return;
|
|
6259
|
+
for (let j = 0; j < nodes.length; j++) {
|
|
6260
|
+
if (metrics.on) metrics.domMoves++;
|
|
6261
|
+
parent.insertBefore(nodes[j], before);
|
|
6262
|
+
}
|
|
6263
|
+
};
|
|
6264
|
+
const nodeAfter = (oldIndex) => oldIndex < blocks.length ? blocks[oldIndex].nodes[0] : anchor;
|
|
6265
|
+
const spliceBlocks = (index, remove, added) => {
|
|
6266
|
+
const addCount = added.length;
|
|
6267
|
+
if (remove === 0 && addCount === 0) return;
|
|
6268
|
+
if (blocks.length === 0) {
|
|
6269
|
+
blocks = added;
|
|
6270
|
+
return;
|
|
6271
|
+
}
|
|
6272
|
+
if (addCount === 0) {
|
|
6273
|
+
blocks.splice(index, remove);
|
|
6274
|
+
return;
|
|
6275
|
+
}
|
|
6276
|
+
if (addCount <= 1024) {
|
|
6277
|
+
blocks.splice(index, remove, ...added);
|
|
6278
|
+
return;
|
|
6279
|
+
}
|
|
6280
|
+
const out = new Array(blocks.length - remove + addCount);
|
|
6281
|
+
let w = 0;
|
|
6282
|
+
for (let k = 0; k < index; k++) out[w++] = blocks[k];
|
|
6283
|
+
for (let k = 0; k < addCount; k++) out[w++] = added[k];
|
|
6284
|
+
for (let k = index + remove; k < blocks.length; k++) out[w++] = blocks[k];
|
|
6285
|
+
blocks = out;
|
|
6286
|
+
};
|
|
6287
|
+
const flushPending = () => {
|
|
6288
|
+
for (let r2 = pendingRuns.length - 1; r2 >= 0; r2--) {
|
|
6289
|
+
const start2 = pendingRuns[r2];
|
|
6290
|
+
const end = r2 + 1 < pendingRuns.length ? pendingRuns[r2 + 1] : pending2.length;
|
|
6291
|
+
for (let k = start2; k < end; k++) walk(pending2[k][0], pending2[k][1]);
|
|
6292
|
+
}
|
|
6293
|
+
pending2.length = 0;
|
|
6294
|
+
pendingRuns.length = 0;
|
|
6295
|
+
};
|
|
6296
|
+
let lo = 0;
|
|
6297
|
+
let oldHi = 0;
|
|
6298
|
+
let newHi = 0;
|
|
6299
|
+
const regionFromMutations = (source) => {
|
|
6300
|
+
const ops = mutationsSince(source, lastVersion);
|
|
6301
|
+
if (!ops) return false;
|
|
6302
|
+
const oldLen = blocks.length;
|
|
6303
|
+
lo = 0;
|
|
6304
|
+
oldHi = 0;
|
|
6305
|
+
newHi = 0;
|
|
6306
|
+
let current2 = oldLen;
|
|
6307
|
+
for (let k = 0; k < ops.length; k++) {
|
|
6308
|
+
const op = ops[k];
|
|
6309
|
+
const index = op.index;
|
|
6310
|
+
const removed = op.type === 2 /* SET */ ? 1 : op.removed;
|
|
6311
|
+
const added = op.type === 2 /* SET */ ? 1 : op.added;
|
|
6312
|
+
const end = index + removed;
|
|
6313
|
+
if (k === 0) {
|
|
6314
|
+
lo = index;
|
|
6315
|
+
oldHi = end;
|
|
6316
|
+
newHi = index + added;
|
|
6317
|
+
} else if (end <= newHi) {
|
|
6318
|
+
if (index < lo) lo = index;
|
|
6319
|
+
newHi += added - removed;
|
|
6320
|
+
} else {
|
|
6321
|
+
if (index < lo) lo = index;
|
|
6322
|
+
oldHi = end - newHi + oldHi;
|
|
6323
|
+
newHi = index + added;
|
|
6324
|
+
}
|
|
6325
|
+
if (oldHi < lo) oldHi = lo;
|
|
6326
|
+
if (newHi < lo) newHi = lo;
|
|
6327
|
+
current2 += added - removed;
|
|
6328
|
+
}
|
|
6329
|
+
if (current2 !== count) return false;
|
|
6330
|
+
if (lo > oldHi || lo > newHi) return false;
|
|
6331
|
+
if (oldHi > oldLen || newHi > count) return false;
|
|
6332
|
+
if (metrics.on) countPath(ops.length === 0 ? "unchanged" : "mutation");
|
|
6333
|
+
if (indexAlias !== void 0 && oldHi - newHi !== 0) {
|
|
6334
|
+
for (let i = newHi; i < count; i++) syncData(blocks[i - newHi + oldHi], i);
|
|
6335
|
+
}
|
|
6336
|
+
return true;
|
|
6337
|
+
};
|
|
6338
|
+
const regionFromScan = () => {
|
|
6339
|
+
const oldLen = blocks.length;
|
|
6340
|
+
const newLen = count;
|
|
6341
|
+
let i = 0;
|
|
6342
|
+
const shared = oldLen < newLen ? oldLen : newLen;
|
|
6343
|
+
while (i < shared) {
|
|
6344
|
+
const block2 = blocks[i];
|
|
6345
|
+
if (!sameKey(block2.key, keyAt(i))) break;
|
|
6346
|
+
syncData(block2, i);
|
|
6347
|
+
i++;
|
|
6348
|
+
}
|
|
6349
|
+
if (metrics.on) {
|
|
6350
|
+
metrics.prefixScanned += i;
|
|
6351
|
+
metrics.itemsVisited += i;
|
|
6352
|
+
}
|
|
6353
|
+
let oe = oldLen - 1;
|
|
6354
|
+
let ne = newLen - 1;
|
|
6355
|
+
while (oe >= i && ne >= i) {
|
|
6356
|
+
const block2 = blocks[oe];
|
|
6357
|
+
if (!sameKey(block2.key, keyAt(ne))) break;
|
|
6358
|
+
syncData(block2, ne);
|
|
6359
|
+
oe--;
|
|
6360
|
+
ne--;
|
|
6361
|
+
}
|
|
6362
|
+
if (metrics.on) {
|
|
6363
|
+
const scanned = oldLen - 1 - oe;
|
|
6364
|
+
metrics.suffixScanned += scanned;
|
|
6365
|
+
metrics.itemsVisited += scanned;
|
|
6366
|
+
countPath("scan");
|
|
5941
6367
|
}
|
|
6368
|
+
lo = i;
|
|
6369
|
+
oldHi = oe + 1;
|
|
6370
|
+
newHi = ne + 1;
|
|
6371
|
+
};
|
|
6372
|
+
const reconcileRegion = () => {
|
|
6373
|
+
const toPatch = newHi - lo;
|
|
6374
|
+
if (lo >= oldHi) {
|
|
6375
|
+
if (toPatch > 0) {
|
|
6376
|
+
const created = [];
|
|
6377
|
+
buildRange(lo, newHi, nodeAfter(lo), created);
|
|
6378
|
+
spliceBlocks(lo, 0, created);
|
|
6379
|
+
}
|
|
6380
|
+
return;
|
|
6381
|
+
}
|
|
6382
|
+
if (toPatch === 0) {
|
|
6383
|
+
if (metrics.on) metrics.itemsVisited += oldHi - lo;
|
|
6384
|
+
for (let j = lo; j < oldHi; j++) destroyBlock(blocks[j]);
|
|
6385
|
+
spliceBlocks(lo, oldHi - lo, NO_BLOCKS);
|
|
6386
|
+
return;
|
|
6387
|
+
}
|
|
6388
|
+
if (metrics.on) {
|
|
6389
|
+
metrics.arrayAllocations += 3;
|
|
6390
|
+
metrics.middleReconciled += toPatch;
|
|
6391
|
+
metrics.itemsVisited += toPatch + (oldHi - lo);
|
|
6392
|
+
}
|
|
6393
|
+
const keyToNew = /* @__PURE__ */ new Map();
|
|
6394
|
+
for (let n2 = lo; n2 < newHi; n2++) {
|
|
6395
|
+
const key = keyAt(n2);
|
|
6396
|
+
if (keyExpression && keyToNew.has(key)) warnDuplicateKey(el, key, expression);
|
|
6397
|
+
keyToNew.set(key, n2);
|
|
6398
|
+
}
|
|
6399
|
+
const oldOfNew = new Int32Array(toPatch);
|
|
6400
|
+
const reused = new Array(toPatch);
|
|
6401
|
+
let matched = 0;
|
|
6402
|
+
let moved = false;
|
|
6403
|
+
let highestSoFar = 0;
|
|
6404
|
+
for (let o = lo; o < oldHi; o++) {
|
|
6405
|
+
const block2 = blocks[o];
|
|
6406
|
+
if (metrics.on) metrics.keyMapLookups++;
|
|
6407
|
+
const target = matched >= toPatch ? void 0 : keyToNew.get(block2.key);
|
|
6408
|
+
if (target === void 0 || reused[target - lo] !== void 0) {
|
|
6409
|
+
destroyBlock(block2);
|
|
6410
|
+
continue;
|
|
6411
|
+
}
|
|
6412
|
+
oldOfNew[target - lo] = o + 1;
|
|
6413
|
+
reused[target - lo] = block2;
|
|
6414
|
+
if (target >= highestSoFar) highestSoFar = target;
|
|
6415
|
+
else moved = true;
|
|
6416
|
+
syncData(block2, target);
|
|
6417
|
+
matched++;
|
|
6418
|
+
}
|
|
6419
|
+
const stay = moved ? longestIncreasing(oldOfNew) : null;
|
|
6420
|
+
if (metrics.on && moved) {
|
|
6421
|
+
metrics.lisRuns++;
|
|
6422
|
+
metrics.lisElements += toPatch;
|
|
6423
|
+
}
|
|
6424
|
+
let s = stay ? stay.length - 1 : -1;
|
|
6425
|
+
const region = new Array(toPatch);
|
|
6426
|
+
let before = nodeAfter(oldHi);
|
|
6427
|
+
let runEnd = -1;
|
|
6428
|
+
for (let n2 = toPatch - 1; n2 >= 0; n2--) {
|
|
6429
|
+
const newIndex = lo + n2;
|
|
6430
|
+
const block2 = reused[n2];
|
|
6431
|
+
if (block2 === void 0) {
|
|
6432
|
+
if (runEnd < 0) runEnd = newIndex + 1;
|
|
6433
|
+
continue;
|
|
6434
|
+
}
|
|
6435
|
+
if (runEnd >= 0) {
|
|
6436
|
+
const created = [];
|
|
6437
|
+
buildRange(newIndex + 1, runEnd, before, created);
|
|
6438
|
+
for (let c2 = 0; c2 < created.length; c2++) region[n2 + 1 + c2] = created[c2];
|
|
6439
|
+
if (created.length) before = created[0].nodes[0];
|
|
6440
|
+
runEnd = -1;
|
|
6441
|
+
}
|
|
6442
|
+
region[n2] = block2;
|
|
6443
|
+
if (moved && (s < 0 || n2 !== stay[s])) moveBlock(block2, before);
|
|
6444
|
+
else if (moved) s--;
|
|
6445
|
+
before = block2.nodes[0];
|
|
6446
|
+
}
|
|
6447
|
+
if (runEnd >= 0) {
|
|
6448
|
+
const created = [];
|
|
6449
|
+
buildRange(lo, runEnd, before, created);
|
|
6450
|
+
for (let c2 = 0; c2 < created.length; c2++) region[c2] = created[c2];
|
|
6451
|
+
}
|
|
6452
|
+
spliceBlocks(lo, oldHi - lo, region);
|
|
6453
|
+
};
|
|
6454
|
+
const clearAll = () => {
|
|
6455
|
+
for (const block2 of blocks) destroyBlock(block2);
|
|
5942
6456
|
blocks = [];
|
|
6457
|
+
lastSource = null;
|
|
6458
|
+
lastVersion = 0;
|
|
5943
6459
|
};
|
|
5944
6460
|
addCleanup(anchor, clearAll);
|
|
5945
6461
|
effect2(() => {
|
|
5946
|
-
var _a3, _b, _c;
|
|
5947
6462
|
const source = evaluateIn(sourceExpression, scope, "v-for");
|
|
5948
|
-
const
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
if (keyExpression && used.has(key)) warnDuplicateKey(el, key, expression);
|
|
5960
|
-
const existing = previous.get(key);
|
|
5961
|
-
if (existing && !used.has(key)) {
|
|
5962
|
-
used.add(key);
|
|
5963
|
-
for (const [name, value] of Object.entries(vars)) existing.data[name] = value;
|
|
5964
|
-
next.push(existing);
|
|
5965
|
-
return;
|
|
5966
|
-
}
|
|
5967
|
-
const childScope = scope.reactiveChild(vars);
|
|
5968
|
-
const nodes = renderTemplate(template, anchor, childScope, batch);
|
|
5969
|
-
used.add(key);
|
|
5970
|
-
next.push({ key, scope: childScope, nodes, data: childScope.data });
|
|
5971
|
-
});
|
|
5972
|
-
if (batch.fragment.firstChild) (_a3 = anchor.parentNode) == null ? void 0 : _a3.insertBefore(batch.fragment, anchor);
|
|
5973
|
-
for (const [node, rowScope] of batch.pending) walk(node, rowScope);
|
|
5974
|
-
const reused = new Set(next);
|
|
5975
|
-
for (const block2 of blocks) {
|
|
5976
|
-
if (used.has(block2.key) && reused.has(block2)) continue;
|
|
5977
|
-
for (const node of block2.nodes) {
|
|
5978
|
-
destroy(node);
|
|
5979
|
-
node.remove();
|
|
6463
|
+
const raw = toRaw(source);
|
|
6464
|
+
let fromMutations = false;
|
|
6465
|
+
if (Array.isArray(raw)) {
|
|
6466
|
+
track(raw, "length");
|
|
6467
|
+
track(raw, ITERATE_KEY);
|
|
6468
|
+
rows = raw;
|
|
6469
|
+
entries = null;
|
|
6470
|
+
count = raw.length;
|
|
6471
|
+
const version3 = arrayVersion(raw);
|
|
6472
|
+
if (raw === lastSource && keyExpression && !keyIsIndex) {
|
|
6473
|
+
fromMutations = regionFromMutations(raw);
|
|
5980
6474
|
}
|
|
6475
|
+
lastSource = raw;
|
|
6476
|
+
lastVersion = version3;
|
|
6477
|
+
} else {
|
|
6478
|
+
entries = normalizeSource(source, itemAlias, indexAlias, thirdAlias);
|
|
6479
|
+
rows = entries;
|
|
6480
|
+
count = entries.length;
|
|
6481
|
+
lastSource = null;
|
|
6482
|
+
lastVersion = 0;
|
|
6483
|
+
if (metrics.on) metrics.arrayAllocations += count + 1;
|
|
5981
6484
|
}
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
const last = block2.nodes[block2.nodes.length - 1];
|
|
5986
|
-
if (last && last.nextSibling !== cursor) {
|
|
5987
|
-
for (const node of block2.nodes) (_b = anchor.parentNode) == null ? void 0 : _b.insertBefore(node, cursor);
|
|
5988
|
-
}
|
|
5989
|
-
cursor = (_c = block2.nodes[0]) != null ? _c : cursor;
|
|
5990
|
-
}
|
|
5991
|
-
blocks = next;
|
|
6485
|
+
if (!fromMutations) regionFromScan();
|
|
6486
|
+
reconcileRegion();
|
|
6487
|
+
flushPending();
|
|
5992
6488
|
});
|
|
5993
6489
|
},
|
|
5994
6490
|
{ priority: PRIORITY.FOR, terminal: true }
|
|
5995
6491
|
);
|
|
5996
6492
|
function normalizeSource(source, itemAlias, indexAlias, thirdAlias) {
|
|
5997
6493
|
const out = [];
|
|
5998
|
-
if (Array.isArray(source)) {
|
|
5999
|
-
source.forEach((item, index) => {
|
|
6000
|
-
const vars = { [itemAlias]: item };
|
|
6001
|
-
if (indexAlias) vars[indexAlias] = index;
|
|
6002
|
-
out.push(vars);
|
|
6003
|
-
});
|
|
6004
|
-
return out;
|
|
6005
|
-
}
|
|
6006
6494
|
if (typeof source === "number") {
|
|
6007
6495
|
for (let i = 1; i <= source; i++) {
|
|
6008
6496
|
const vars = { [itemAlias]: i };
|
|
@@ -7148,7 +7636,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
7148
7636
|
Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
|
|
7149
7637
|
return rootScope.data;
|
|
7150
7638
|
}
|
|
7151
|
-
var version2 = "0.
|
|
7639
|
+
var version2 = "0.13.0";
|
|
7152
7640
|
var core = {
|
|
7153
7641
|
// Utilities first: Voodoo's own names can override.
|
|
7154
7642
|
...utils_exports,
|
|
@@ -8409,7 +8897,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
8409
8897
|
}, 0);
|
|
8410
8898
|
}
|
|
8411
8899
|
}
|
|
8412
|
-
function compileRoute(pattern,
|
|
8900
|
+
function compileRoute(pattern, record2) {
|
|
8413
8901
|
const clean = pattern === "*" ? "*" : normalizePath(pattern);
|
|
8414
8902
|
const raw = clean === "*" ? ["*"] : clean.split("/").filter(Boolean);
|
|
8415
8903
|
const segments = [];
|
|
@@ -8430,7 +8918,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
8430
8918
|
segments.push({ type: "static", value: piece, optional: false });
|
|
8431
8919
|
score += 4;
|
|
8432
8920
|
}
|
|
8433
|
-
return { pattern: clean, segments, score, record };
|
|
8921
|
+
return { pattern: clean, segments, score, record: record2 };
|
|
8434
8922
|
}
|
|
8435
8923
|
function matchSegments(segments, parts) {
|
|
8436
8924
|
const params = {};
|
|
@@ -8516,16 +9004,16 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
8516
9004
|
route.name = location2.name;
|
|
8517
9005
|
route.meta = location2.meta;
|
|
8518
9006
|
route.matched = location2.matched;
|
|
8519
|
-
const
|
|
8520
|
-
if ((
|
|
8521
|
-
document.title = settings2.titleTemplate.includes("%s") ? settings2.titleTemplate.replace("%s",
|
|
9007
|
+
const record2 = findRecord(location2.matched);
|
|
9008
|
+
if ((record2 == null ? void 0 : record2.title) && typeof document !== "undefined") {
|
|
9009
|
+
document.title = settings2.titleTemplate.includes("%s") ? settings2.titleTemplate.replace("%s", record2.title) : record2.title;
|
|
8522
9010
|
}
|
|
8523
9011
|
}
|
|
8524
9012
|
async function runGuards(to, from) {
|
|
8525
|
-
const
|
|
8526
|
-
if (
|
|
8527
|
-
if (
|
|
8528
|
-
const verdict = await
|
|
9013
|
+
const record2 = findRecord(to.matched);
|
|
9014
|
+
if (record2 == null ? void 0 : record2.redirect) return record2.redirect;
|
|
9015
|
+
if (record2 == null ? void 0 : record2.beforeEnter) {
|
|
9016
|
+
const verdict = await record2.beforeEnter(to, from);
|
|
8529
9017
|
if (verdict === false) return false;
|
|
8530
9018
|
if (typeof verdict === "string") return verdict;
|
|
8531
9019
|
}
|
|
@@ -8691,8 +9179,8 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
8691
9179
|
if (destination.hash) scheduleScroll(destination, from, null);
|
|
8692
9180
|
(_a2 = settings2.afterEach) == null ? void 0 : _a2.call(settings2, snapshot(), from);
|
|
8693
9181
|
}
|
|
8694
|
-
function addRoute(pattern,
|
|
8695
|
-
const compiledRoute = compileRoute(pattern,
|
|
9182
|
+
function addRoute(pattern, record2) {
|
|
9183
|
+
const compiledRoute = compileRoute(pattern, record2);
|
|
8696
9184
|
const index = compiled.findIndex((item) => item.pattern === compiledRoute.pattern);
|
|
8697
9185
|
if (index > -1) compiled.splice(index, 1, compiledRoute);
|
|
8698
9186
|
else compiled.push(compiledRoute);
|
|
@@ -8721,8 +9209,8 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
8721
9209
|
settings2.titleTemplate = (_h = options.titleTemplate) != null ? _h : "%s";
|
|
8722
9210
|
settings2.scrollBehavior = (_i = options.scrollBehavior) != null ? _i : null;
|
|
8723
9211
|
compiled.length = 0;
|
|
8724
|
-
for (const [pattern,
|
|
8725
|
-
compiled.push(compileRoute(pattern,
|
|
9212
|
+
for (const [pattern, record2] of Object.entries((_j = options.routes) != null ? _j : {})) {
|
|
9213
|
+
compiled.push(compileRoute(pattern, record2));
|
|
8726
9214
|
}
|
|
8727
9215
|
configured = true;
|
|
8728
9216
|
startListening();
|
|
@@ -8784,11 +9272,11 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
8784
9272
|
for (const child of Array.from(el.childNodes)) destroy(child);
|
|
8785
9273
|
el.textContent = "";
|
|
8786
9274
|
};
|
|
8787
|
-
const mount = (
|
|
9275
|
+
const mount = (record2, html) => {
|
|
8788
9276
|
unmount();
|
|
8789
|
-
if (
|
|
9277
|
+
if (record2 == null ? void 0 : record2.component) {
|
|
8790
9278
|
const host = document.createElement("div");
|
|
8791
|
-
host.setAttribute(`${config.prefix}component`,
|
|
9279
|
+
host.setAttribute(`${config.prefix}component`, record2.component);
|
|
8792
9280
|
host.className = "v-router-page";
|
|
8793
9281
|
el.appendChild(host);
|
|
8794
9282
|
walk(host, scope);
|
|
@@ -8797,28 +9285,28 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
8797
9285
|
el.innerHTML = html != null ? html : fallbackHtml;
|
|
8798
9286
|
for (const child of Array.from(el.childNodes)) walk(child, scope);
|
|
8799
9287
|
};
|
|
8800
|
-
const render3 = async (
|
|
9288
|
+
const render3 = async (record2, current2) => {
|
|
8801
9289
|
let html = null;
|
|
8802
|
-
if (
|
|
9290
|
+
if (record2 == null ? void 0 : record2.view) {
|
|
8803
9291
|
el.classList.add("v-router-loading");
|
|
8804
9292
|
try {
|
|
8805
|
-
html = await loadView(
|
|
9293
|
+
html = await loadView(record2.view);
|
|
8806
9294
|
} catch (err) {
|
|
8807
|
-
handleError(err, `v-router-view loading "${
|
|
9295
|
+
handleError(err, `v-router-view loading "${record2.view}"`);
|
|
8808
9296
|
html = "";
|
|
8809
9297
|
} finally {
|
|
8810
9298
|
el.classList.remove("v-router-loading");
|
|
8811
9299
|
}
|
|
8812
9300
|
if (current2 !== token) return;
|
|
8813
9301
|
}
|
|
8814
|
-
if (useTransition) viewTransition(() => mount(
|
|
8815
|
-
else mount(
|
|
9302
|
+
if (useTransition) viewTransition(() => mount(record2, html));
|
|
9303
|
+
else mount(record2, html);
|
|
8816
9304
|
};
|
|
8817
9305
|
effect2(() => {
|
|
8818
9306
|
const matched = route.matched;
|
|
8819
9307
|
void paramsSignature(route.params);
|
|
8820
|
-
const
|
|
8821
|
-
void render3(
|
|
9308
|
+
const record2 = findRecord(matched);
|
|
9309
|
+
void render3(record2, ++token);
|
|
8822
9310
|
});
|
|
8823
9311
|
cleanup(() => {
|
|
8824
9312
|
token++;
|
|
@@ -13567,7 +14055,7 @@ form.v-loading [type="submit"],form.v-loading button[disabled]{opacity:.6}
|
|
|
13567
14055
|
restoring = false;
|
|
13568
14056
|
});
|
|
13569
14057
|
}
|
|
13570
|
-
const
|
|
14058
|
+
const record2 = debounce(() => {
|
|
13571
14059
|
if (restoring) return;
|
|
13572
14060
|
const current2 = JSON.stringify(serializable(scope.data));
|
|
13573
14061
|
if (current2 === JSON.stringify(snapshots[position])) return;
|
|
@@ -13577,12 +14065,12 @@ form.v-loading [type="submit"],form.v-loading button[disabled]{opacity:.6}
|
|
|
13577
14065
|
position = snapshots.length - 1;
|
|
13578
14066
|
sync();
|
|
13579
14067
|
}, parseDuration((_a2 = el.getAttribute("v-history-debounce")) != null ? _a2 : void 0, 300));
|
|
13580
|
-
const stopWatching = watch(scope.data, () =>
|
|
14068
|
+
const stopWatching = watch(scope.data, () => record2(), { deep: true });
|
|
13581
14069
|
controllers.set(el, controller);
|
|
13582
14070
|
scope.set("$history", controller);
|
|
13583
14071
|
cleanup(() => {
|
|
13584
14072
|
stopWatching();
|
|
13585
|
-
|
|
14073
|
+
record2.cancel();
|
|
13586
14074
|
controllers.delete(el);
|
|
13587
14075
|
});
|
|
13588
14076
|
},
|
|
@@ -20047,7 +20535,7 @@ textarea.v-dialog-input{min-height:96px;resize:vertical}
|
|
|
20047
20535
|
var flashTimers = /* @__PURE__ */ new Map();
|
|
20048
20536
|
var outlined = [];
|
|
20049
20537
|
var requestStarts = /* @__PURE__ */ new WeakMap();
|
|
20050
|
-
var
|
|
20538
|
+
var metrics2 = {
|
|
20051
20539
|
effects: 0,
|
|
20052
20540
|
mutations: 0,
|
|
20053
20541
|
effectsPerSecond: 0,
|
|
@@ -20466,7 +20954,7 @@ textarea.v-dialog-input{min-height:96px;resize:vertical}
|
|
|
20466
20954
|
const original = item.fn;
|
|
20467
20955
|
patchedEffects.set(item, original);
|
|
20468
20956
|
item.fn = () => {
|
|
20469
|
-
|
|
20957
|
+
metrics2.effects++;
|
|
20470
20958
|
flash(owner);
|
|
20471
20959
|
return original();
|
|
20472
20960
|
};
|
|
@@ -20916,20 +21404,20 @@ textarea.v-dialog-input{min-height:96px;resize:vertical}
|
|
|
20916
21404
|
function renderPerformanceTab() {
|
|
20917
21405
|
const frag = document.createDocumentFragment();
|
|
20918
21406
|
const updates = h("div", "v-xray-metric");
|
|
20919
|
-
updates.appendChild(h("span", "v-xray-metric-value", String(
|
|
21407
|
+
updates.appendChild(h("span", "v-xray-metric-value", String(metrics2.updatesPerSecond)));
|
|
20920
21408
|
updates.appendChild(h("span", void 0, "DOM updates per second"));
|
|
20921
21409
|
frag.appendChild(updates);
|
|
20922
21410
|
const effects = h("div", "v-xray-metric");
|
|
20923
|
-
effects.appendChild(h("span", "v-xray-metric-value", String(
|
|
21411
|
+
effects.appendChild(h("span", "v-xray-metric-value", String(metrics2.effectsPerSecond)));
|
|
20924
21412
|
effects.appendChild(h("span", void 0, "reactive effects triggered per second"));
|
|
20925
21413
|
frag.appendChild(effects);
|
|
20926
21414
|
const total = h("div", "v-xray-metric");
|
|
20927
|
-
total.appendChild(h("span", "v-xray-metric-value", String(
|
|
21415
|
+
total.appendChild(h("span", "v-xray-metric-value", String(metrics2.effects)));
|
|
20928
21416
|
total.appendChild(h("span", void 0, "effects triggered since x-ray was enabled"));
|
|
20929
21417
|
frag.appendChild(total);
|
|
20930
21418
|
const chart = h("div", "v-xray-chart");
|
|
20931
|
-
const peak = Math.max(1, ...
|
|
20932
|
-
for (const item of
|
|
21419
|
+
const peak = Math.max(1, ...metrics2.history.map((item) => Math.max(item.effects, item.updates)));
|
|
21420
|
+
for (const item of metrics2.history) {
|
|
20933
21421
|
const bar = h("div", "v-xray-bar");
|
|
20934
21422
|
const value = Math.max(item.effects, item.updates);
|
|
20935
21423
|
bar.style.height = `${Math.max(2, Math.round(value / peak * 46))}px`;
|
|
@@ -21172,14 +21660,14 @@ textarea.v-dialog-input{min-height:96px;resize:vertical}
|
|
|
21172
21660
|
function observeMutations() {
|
|
21173
21661
|
observer3 = new MutationObserver((records) => {
|
|
21174
21662
|
let structural = false;
|
|
21175
|
-
for (const
|
|
21176
|
-
const target =
|
|
21663
|
+
for (const record2 of records) {
|
|
21664
|
+
const target = record2.target;
|
|
21177
21665
|
if (isXrayNode(target)) continue;
|
|
21178
|
-
if (
|
|
21666
|
+
if (record2.type === "attributes" && record2.attributeName === "class" && target.nodeType === 1 && flashing.has(target)) {
|
|
21179
21667
|
continue;
|
|
21180
21668
|
}
|
|
21181
|
-
|
|
21182
|
-
if (
|
|
21669
|
+
metrics2.mutations++;
|
|
21670
|
+
if (record2.type === "childList" && record2.addedNodes.length) structural = true;
|
|
21183
21671
|
}
|
|
21184
21672
|
if (structural && !scanTimer) {
|
|
21185
21673
|
scanTimer = window.setTimeout(() => {
|
|
@@ -21197,15 +21685,15 @@ textarea.v-dialog-input{min-height:96px;resize:vertical}
|
|
|
21197
21685
|
}
|
|
21198
21686
|
function startTimers() {
|
|
21199
21687
|
metricsTimer = window.setInterval(() => {
|
|
21200
|
-
|
|
21201
|
-
|
|
21202
|
-
lastEffectCount =
|
|
21203
|
-
lastMutationCount =
|
|
21204
|
-
|
|
21205
|
-
effects:
|
|
21206
|
-
updates:
|
|
21688
|
+
metrics2.effectsPerSecond = metrics2.effects - lastEffectCount;
|
|
21689
|
+
metrics2.updatesPerSecond = metrics2.mutations - lastMutationCount;
|
|
21690
|
+
lastEffectCount = metrics2.effects;
|
|
21691
|
+
lastMutationCount = metrics2.mutations;
|
|
21692
|
+
metrics2.history.push({
|
|
21693
|
+
effects: metrics2.effectsPerSecond,
|
|
21694
|
+
updates: metrics2.updatesPerSecond
|
|
21207
21695
|
});
|
|
21208
|
-
if (
|
|
21696
|
+
if (metrics2.history.length > 40) metrics2.history.shift();
|
|
21209
21697
|
if (activeTab === "desempenho") renderActiveTab();
|
|
21210
21698
|
}, 1e3);
|
|
21211
21699
|
refreshTimer = window.setInterval(() => {
|
|
@@ -21224,11 +21712,11 @@ textarea.v-dialog-input{min-height:96px;resize:vertical}
|
|
|
21224
21712
|
injectStyle("xray", XRAY_CSS);
|
|
21225
21713
|
refs = buildPanel();
|
|
21226
21714
|
activeTab = activeTab || "estado";
|
|
21227
|
-
|
|
21228
|
-
|
|
21715
|
+
metrics2.effects = 0;
|
|
21716
|
+
metrics2.mutations = 0;
|
|
21229
21717
|
lastEffectCount = 0;
|
|
21230
21718
|
lastMutationCount = 0;
|
|
21231
|
-
|
|
21719
|
+
metrics2.history.length = 0;
|
|
21232
21720
|
scanDocument();
|
|
21233
21721
|
listenEvents();
|
|
21234
21722
|
listenNetwork();
|