voodoojs 0.12.4 → 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.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-XGZ7SXD3.js → chunk-2LGAXVD7.js} +4 -4
  3. package/dist/{chunk-XIMSOXWF.js → chunk-4IJE5BWY.js} +5 -5
  4. package/dist/{chunk-FAWOJTRM.js → chunk-FMDHZ5GI.js} +139 -9
  5. package/dist/{chunk-OHISQWSW.js → chunk-GE4JWATC.js} +5 -5
  6. package/dist/{chunk-2GSZT3CX.js → chunk-H2NGDLMD.js} +363 -76
  7. package/dist/{chunk-AR6WDY7K.js → chunk-IBIZ6OUI.js} +4 -4
  8. package/dist/{chunk-7XRFOONN.js → chunk-IJQ2PFXU.js} +3 -3
  9. package/dist/{chunk-ELIX2DRQ.js → chunk-JBUNTP7F.js} +19 -7
  10. package/dist/{chunk-NKQGUWVF.js → chunk-MV73OSCS.js} +4 -4
  11. package/dist/{chunk-3MPIJH5X.js → chunk-OIH4BR2H.js} +6 -6
  12. package/dist/{chunk-FNTYILLW.js → chunk-TEVCUTTC.js} +3 -3
  13. package/dist/essential.cjs +508 -74
  14. package/dist/essential.d.cts +1 -1
  15. package/dist/essential.d.ts +1 -1
  16. package/dist/essential.js +10 -10
  17. package/dist/gpu.cjs +7 -1
  18. package/dist/gpu.js +10 -10
  19. package/dist/http.cjs +1 -1
  20. package/dist/http.js +5 -5
  21. package/dist/index.cjs +556 -122
  22. package/dist/index.d.cts +2 -2
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.js +20 -20
  25. package/dist/reactivity.cjs +138 -5
  26. package/dist/reactivity.d.cts +32 -1
  27. package/dist/reactivity.d.ts +32 -1
  28. package/dist/reactivity.js +2 -2
  29. package/dist/socket.cjs +115 -5
  30. package/dist/socket.d.cts +1 -1
  31. package/dist/socket.d.ts +1 -1
  32. package/dist/socket.js +9 -9
  33. package/dist/style-E22XVZ33.js +5 -0
  34. package/dist/utils.cjs +1 -1
  35. package/dist/utils.js +2 -2
  36. package/dist/voodoo.core.js +572 -72
  37. package/dist/voodoo.core.min.js +17 -17
  38. package/dist/voodoo.full.js +621 -121
  39. package/dist/voodoo.full.min.js +62 -62
  40. package/dist/voodoo.js +575 -75
  41. package/dist/voodoo.min.js +26 -26
  42. package/package.json +1 -1
  43. package/dist/style-DA6RFLKO.js +0 -5
  44. package/dist/{query-XooOh4vB.d.cts → query-D_BGQw8m.d.cts} +28 -28
  45. package/dist/{query-DzHfm8Kg.d.ts → query-Dl6Urlwd.d.ts} +28 -28
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.12.4
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
- if (!isArr) add(depsMap.get(ITERATE_KEY));
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
- return toRaw(this)[key].apply(this, args);
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) trigger(target2, "delete" /* DELETE */, key);
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) {
@@ -2487,8 +2620,15 @@ function getEffectScopes(node) {
2487
2620
  return nodeEffectScopes.get(node) ?? [];
2488
2621
  }
2489
2622
  var ignoredRemovals = /* @__PURE__ */ new WeakSet();
2623
+ var detachedTemplates = /* @__PURE__ */ new WeakMap();
2490
2624
  function removeQuietly(node) {
2491
2625
  ignoredRemovals.add(node);
2626
+ const parent = node.parentNode;
2627
+ if (parent) {
2628
+ let kept = detachedTemplates.get(parent);
2629
+ if (!kept) detachedTemplates.set(parent, kept = /* @__PURE__ */ new Set());
2630
+ kept.add(node);
2631
+ }
2492
2632
  node.remove();
2493
2633
  }
2494
2634
  function addCleanup(node, fn) {
@@ -2504,6 +2644,11 @@ function destroy(node) {
2504
2644
  }
2505
2645
  for (let i = children.length - 1; i >= 0; i--) destroy(children[i]);
2506
2646
  }
2647
+ const detached = detachedTemplates.get(node);
2648
+ if (detached) {
2649
+ detachedTemplates.delete(node);
2650
+ for (const template of detached) destroy(template);
2651
+ }
2507
2652
  const list = nodeCleanups.get(node);
2508
2653
  if (list) {
2509
2654
  nodeCleanups.delete(node);
@@ -5637,6 +5782,8 @@ function viewTransition(update) {
5637
5782
  // src/directives/core.ts
5638
5783
  init_reactivity();
5639
5784
  init_registry();
5785
+
5786
+ // src/directives/core.ts
5640
5787
  function setValue(expression, scope, value) {
5641
5788
  try {
5642
5789
  const target2 = parse(expression);
@@ -5781,7 +5928,7 @@ defineDirective(
5781
5928
  },
5782
5929
  { priority: exports.PRIORITY.IF, terminal: true }
5783
5930
  );
5784
- function renderTemplate(source, anchor, scope, batch) {
5931
+ function renderTemplate(source, anchor, scope) {
5785
5932
  const parent = anchor.parentNode;
5786
5933
  if (!parent) return [];
5787
5934
  const nodes = [];
@@ -5800,19 +5947,61 @@ function renderTemplate(source, anchor, scope, batch) {
5800
5947
  const clone2 = source.cloneNode(true);
5801
5948
  nodes.push(clone2);
5802
5949
  markNodeScope(clone2, scope);
5803
- if (batch) {
5804
- batch.fragment.appendChild(clone2);
5805
- batch.pending.push([clone2, scope]);
5806
- } else {
5807
- parent.insertBefore(clone2, anchor);
5808
- walk(clone2, scope);
5809
- }
5950
+ parent.insertBefore(clone2, anchor);
5951
+ walk(clone2, scope);
5810
5952
  }
5811
5953
  return nodes;
5812
5954
  }
5813
5955
  defineDirective("else-if", () => void 0, { priority: exports.PRIORITY.IF, terminal: true });
5814
5956
  defineDirective("else", () => void 0, { priority: exports.PRIORITY.IF, terminal: true });
5815
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
+ }
5816
6005
  defineDirective(
5817
6006
  "for",
5818
6007
  ({ el, scope, expression, effect: effect3 }) => {
@@ -5837,77 +6026,322 @@ defineDirective(
5837
6026
  template.removeAttribute(`${p2}bind:key`);
5838
6027
  template.removeAttribute(`${p2}key`);
5839
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
+ }
5840
6044
  let blocks = [];
5841
- const clearAll = () => {
5842
- for (const block2 of blocks) {
5843
- for (const node of block2.nodes) {
5844
- destroy(node);
5845
- node.remove();
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
+ }
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;
5846
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--;
5847
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);
5848
6308
  blocks = [];
6309
+ lastSource = null;
6310
+ lastVersion = 0;
5849
6311
  };
5850
6312
  addCleanup(anchor, clearAll);
5851
6313
  effect3(() => {
5852
6314
  const source = evaluateIn(sourceExpression, scope, "v-for");
5853
- const entries = normalizeSource(source, itemAlias, indexAlias, thirdAlias);
5854
- const previous = /* @__PURE__ */ new Map();
5855
- for (const block2 of blocks) previous.set(block2.key, block2);
5856
- const next = [];
5857
- const used = /* @__PURE__ */ new Set();
5858
- const batch = {
5859
- fragment: document.createDocumentFragment(),
5860
- pending: []
5861
- };
5862
- entries.forEach((vars, index) => {
5863
- const key = keyExpression ? evaluateIn(keyExpression, scope.child(vars), ":key") : `__index_${index}`;
5864
- if (keyExpression && used.has(key)) warnDuplicateKey(el, key, expression);
5865
- const existing = previous.get(key);
5866
- if (existing && !used.has(key)) {
5867
- used.add(key);
5868
- for (const [name, value] of Object.entries(vars)) existing.data[name] = value;
5869
- next.push(existing);
5870
- return;
5871
- }
5872
- const childScope = scope.reactiveChild(vars);
5873
- const nodes = renderTemplate(template, anchor, childScope, batch);
5874
- used.add(key);
5875
- next.push({ key, scope: childScope, nodes, data: childScope.data });
5876
- });
5877
- if (batch.fragment.firstChild) anchor.parentNode?.insertBefore(batch.fragment, anchor);
5878
- for (const [node, rowScope] of batch.pending) walk(node, rowScope);
5879
- const reused = new Set(next);
5880
- for (const block2 of blocks) {
5881
- if (used.has(block2.key) && reused.has(block2)) continue;
5882
- for (const node of block2.nodes) {
5883
- destroy(node);
5884
- 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);
5885
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;
5886
6335
  }
5887
- let cursor = anchor;
5888
- for (let i = next.length - 1; i >= 0; i--) {
5889
- const block2 = next[i];
5890
- const last = block2.nodes[block2.nodes.length - 1];
5891
- if (last && last.nextSibling !== cursor) {
5892
- for (const node of block2.nodes) anchor.parentNode?.insertBefore(node, cursor);
5893
- }
5894
- cursor = block2.nodes[0] ?? cursor;
5895
- }
5896
- blocks = next;
6336
+ if (!fromMutations) regionFromScan();
6337
+ reconcileRegion();
6338
+ flushPending();
5897
6339
  });
5898
6340
  },
5899
6341
  { priority: exports.PRIORITY.FOR, terminal: true }
5900
6342
  );
5901
6343
  function normalizeSource(source, itemAlias, indexAlias, thirdAlias) {
5902
6344
  const out = [];
5903
- if (Array.isArray(source)) {
5904
- source.forEach((item, index) => {
5905
- const vars = { [itemAlias]: item };
5906
- if (indexAlias) vars[indexAlias] = index;
5907
- out.push(vars);
5908
- });
5909
- return out;
5910
- }
5911
6345
  if (typeof source === "number") {
5912
6346
  for (let i = 1; i <= source; i++) {
5913
6347
  const vars = { [itemAlias]: i };
@@ -7030,7 +7464,7 @@ function data(values) {
7030
7464
  Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
7031
7465
  return rootScope.data;
7032
7466
  }
7033
- var version2 = "0.12.4";
7467
+ var version2 = "0.13.0";
7034
7468
  var core = {
7035
7469
  // Utilities first: Voodoo's own names can override.
7036
7470
  ...utils_exports,
@@ -8273,7 +8707,7 @@ function writeUrl(state2, url2, replace) {
8273
8707
  }, 0);
8274
8708
  }
8275
8709
  }
8276
- function compileRoute(pattern, record) {
8710
+ function compileRoute(pattern, record2) {
8277
8711
  const clean = pattern === "*" ? "*" : normalizePath(pattern);
8278
8712
  const raw = clean === "*" ? ["*"] : clean.split("/").filter(Boolean);
8279
8713
  const segments = [];
@@ -8294,7 +8728,7 @@ function compileRoute(pattern, record) {
8294
8728
  segments.push({ type: "static", value: piece, optional: false });
8295
8729
  score += 4;
8296
8730
  }
8297
- return { pattern: clean, segments, score, record };
8731
+ return { pattern: clean, segments, score, record: record2 };
8298
8732
  }
8299
8733
  function matchSegments(segments, parts) {
8300
8734
  const params = {};
@@ -8378,16 +8812,16 @@ function applyLocation(location2) {
8378
8812
  route.name = location2.name;
8379
8813
  route.meta = location2.meta;
8380
8814
  route.matched = location2.matched;
8381
- const record = findRecord(location2.matched);
8382
- if (record?.title && typeof document !== "undefined") {
8383
- document.title = settings2.titleTemplate.includes("%s") ? settings2.titleTemplate.replace("%s", record.title) : record.title;
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;
8384
8818
  }
8385
8819
  }
8386
8820
  async function runGuards(to, from) {
8387
- const record = findRecord(to.matched);
8388
- if (record?.redirect) return record.redirect;
8389
- if (record?.beforeEnter) {
8390
- const verdict = await record.beforeEnter(to, from);
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);
8391
8825
  if (verdict === false) return false;
8392
8826
  if (typeof verdict === "string") return verdict;
8393
8827
  }
@@ -8549,8 +8983,8 @@ async function enterInitialRoute() {
8549
8983
  if (destination.hash) scheduleScroll(destination, from, null);
8550
8984
  settings2.afterEach?.(snapshot(), from);
8551
8985
  }
8552
- function addRoute(pattern, record) {
8553
- const compiledRoute = compileRoute(pattern, record);
8986
+ function addRoute(pattern, record2) {
8987
+ const compiledRoute = compileRoute(pattern, record2);
8554
8988
  const index = compiled.findIndex((item) => item.pattern === compiledRoute.pattern);
8555
8989
  if (index > -1) compiled.splice(index, 1, compiledRoute);
8556
8990
  else compiled.push(compiledRoute);
@@ -8578,8 +9012,8 @@ function configureRouter(options) {
8578
9012
  settings2.titleTemplate = options.titleTemplate ?? "%s";
8579
9013
  settings2.scrollBehavior = options.scrollBehavior ?? null;
8580
9014
  compiled.length = 0;
8581
- for (const [pattern, record] of Object.entries(options.routes ?? {})) {
8582
- compiled.push(compileRoute(pattern, record));
9015
+ for (const [pattern, record2] of Object.entries(options.routes ?? {})) {
9016
+ compiled.push(compileRoute(pattern, record2));
8583
9017
  }
8584
9018
  configured = true;
8585
9019
  startListening();
@@ -8641,11 +9075,11 @@ defineDirective(
8641
9075
  for (const child of Array.from(el.childNodes)) destroy(child);
8642
9076
  el.textContent = "";
8643
9077
  };
8644
- const mount = (record, html) => {
9078
+ const mount = (record2, html) => {
8645
9079
  unmount();
8646
- if (record?.component) {
9080
+ if (record2?.component) {
8647
9081
  const host = document.createElement("div");
8648
- host.setAttribute(`${exports.config.prefix}component`, record.component);
9082
+ host.setAttribute(`${exports.config.prefix}component`, record2.component);
8649
9083
  host.className = "v-router-page";
8650
9084
  el.appendChild(host);
8651
9085
  walk(host, scope);
@@ -8654,28 +9088,28 @@ defineDirective(
8654
9088
  el.innerHTML = html ?? fallbackHtml;
8655
9089
  for (const child of Array.from(el.childNodes)) walk(child, scope);
8656
9090
  };
8657
- const render3 = async (record, current2) => {
9091
+ const render3 = async (record2, current2) => {
8658
9092
  let html = null;
8659
- if (record?.view) {
9093
+ if (record2?.view) {
8660
9094
  el.classList.add("v-router-loading");
8661
9095
  try {
8662
- html = await loadView(record.view);
9096
+ html = await loadView(record2.view);
8663
9097
  } catch (err) {
8664
- handleError(err, `v-router-view loading "${record.view}"`);
9098
+ handleError(err, `v-router-view loading "${record2.view}"`);
8665
9099
  html = "";
8666
9100
  } finally {
8667
9101
  el.classList.remove("v-router-loading");
8668
9102
  }
8669
9103
  if (current2 !== token) return;
8670
9104
  }
8671
- if (useTransition) viewTransition(() => mount(record, html));
8672
- else mount(record, html);
9105
+ if (useTransition) viewTransition(() => mount(record2, html));
9106
+ else mount(record2, html);
8673
9107
  };
8674
9108
  effect3(() => {
8675
9109
  const matched = route.matched;
8676
9110
  void paramsSignature(route.params);
8677
- const record = findRecord(matched);
8678
- void render3(record, ++token);
9111
+ const record2 = findRecord(matched);
9112
+ void render3(record2, ++token);
8679
9113
  });
8680
9114
  cleanup(() => {
8681
9115
  token++;
@@ -13349,7 +13783,7 @@ defineDirective(
13349
13783
  restoring = false;
13350
13784
  });
13351
13785
  }
13352
- const record = debounce(() => {
13786
+ const record2 = debounce(() => {
13353
13787
  if (restoring) return;
13354
13788
  const current2 = JSON.stringify(serializable(scope.data));
13355
13789
  if (current2 === JSON.stringify(snapshots[position])) return;
@@ -13359,12 +13793,12 @@ defineDirective(
13359
13793
  position = snapshots.length - 1;
13360
13794
  sync();
13361
13795
  }, parseDuration(el.getAttribute("v-history-debounce") ?? void 0, 300));
13362
- const stopWatching = watch(scope.data, () => record(), { deep: true });
13796
+ const stopWatching = watch(scope.data, () => record2(), { deep: true });
13363
13797
  controllers.set(el, controller);
13364
13798
  scope.set("$history", controller);
13365
13799
  cleanup(() => {
13366
13800
  stopWatching();
13367
- record.cancel();
13801
+ record2.cancel();
13368
13802
  controllers.delete(el);
13369
13803
  });
13370
13804
  },
@@ -19728,7 +20162,7 @@ var flashing = /* @__PURE__ */ new Set();
19728
20162
  var flashTimers = /* @__PURE__ */ new Map();
19729
20163
  var outlined = [];
19730
20164
  var requestStarts = /* @__PURE__ */ new WeakMap();
19731
- var metrics = {
20165
+ var metrics2 = {
19732
20166
  effects: 0,
19733
20167
  mutations: 0,
19734
20168
  effectsPerSecond: 0,
@@ -20145,7 +20579,7 @@ function instrument(node, owner) {
20145
20579
  const original = item.fn;
20146
20580
  patchedEffects.set(item, original);
20147
20581
  item.fn = () => {
20148
- metrics.effects++;
20582
+ metrics2.effects++;
20149
20583
  flash(owner);
20150
20584
  return original();
20151
20585
  };
@@ -20592,20 +21026,20 @@ function renderNetworkTab() {
20592
21026
  function renderPerformanceTab() {
20593
21027
  const frag = document.createDocumentFragment();
20594
21028
  const updates = h("div", "v-xray-metric");
20595
- updates.appendChild(h("span", "v-xray-metric-value", String(metrics.updatesPerSecond)));
21029
+ updates.appendChild(h("span", "v-xray-metric-value", String(metrics2.updatesPerSecond)));
20596
21030
  updates.appendChild(h("span", void 0, "DOM updates per second"));
20597
21031
  frag.appendChild(updates);
20598
21032
  const effects = h("div", "v-xray-metric");
20599
- effects.appendChild(h("span", "v-xray-metric-value", String(metrics.effectsPerSecond)));
21033
+ effects.appendChild(h("span", "v-xray-metric-value", String(metrics2.effectsPerSecond)));
20600
21034
  effects.appendChild(h("span", void 0, "reactive effects triggered per second"));
20601
21035
  frag.appendChild(effects);
20602
21036
  const total = h("div", "v-xray-metric");
20603
- total.appendChild(h("span", "v-xray-metric-value", String(metrics.effects)));
21037
+ total.appendChild(h("span", "v-xray-metric-value", String(metrics2.effects)));
20604
21038
  total.appendChild(h("span", void 0, "effects triggered since x-ray was enabled"));
20605
21039
  frag.appendChild(total);
20606
21040
  const chart = h("div", "v-xray-chart");
20607
- const peak = Math.max(1, ...metrics.history.map((item) => Math.max(item.effects, item.updates)));
20608
- for (const item of metrics.history) {
21041
+ const peak = Math.max(1, ...metrics2.history.map((item) => Math.max(item.effects, item.updates)));
21042
+ for (const item of metrics2.history) {
20609
21043
  const bar = h("div", "v-xray-bar");
20610
21044
  const value = Math.max(item.effects, item.updates);
20611
21045
  bar.style.height = `${Math.max(2, Math.round(value / peak * 46))}px`;
@@ -20844,14 +21278,14 @@ var observer3 = null;
20844
21278
  function observeMutations() {
20845
21279
  observer3 = new MutationObserver((records) => {
20846
21280
  let structural = false;
20847
- for (const record of records) {
20848
- const target2 = record.target;
21281
+ for (const record2 of records) {
21282
+ const target2 = record2.target;
20849
21283
  if (isXrayNode(target2)) continue;
20850
- if (record.type === "attributes" && record.attributeName === "class" && target2.nodeType === 1 && flashing.has(target2)) {
21284
+ if (record2.type === "attributes" && record2.attributeName === "class" && target2.nodeType === 1 && flashing.has(target2)) {
20851
21285
  continue;
20852
21286
  }
20853
- metrics.mutations++;
20854
- if (record.type === "childList" && record.addedNodes.length) structural = true;
21287
+ metrics2.mutations++;
21288
+ if (record2.type === "childList" && record2.addedNodes.length) structural = true;
20855
21289
  }
20856
21290
  if (structural && !scanTimer) {
20857
21291
  scanTimer = window.setTimeout(() => {
@@ -20869,15 +21303,15 @@ function observeMutations() {
20869
21303
  }
20870
21304
  function startTimers() {
20871
21305
  metricsTimer = window.setInterval(() => {
20872
- metrics.effectsPerSecond = metrics.effects - lastEffectCount;
20873
- metrics.updatesPerSecond = metrics.mutations - lastMutationCount;
20874
- lastEffectCount = metrics.effects;
20875
- lastMutationCount = metrics.mutations;
20876
- metrics.history.push({
20877
- effects: metrics.effectsPerSecond,
20878
- updates: metrics.updatesPerSecond
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
20879
21313
  });
20880
- if (metrics.history.length > 40) metrics.history.shift();
21314
+ if (metrics2.history.length > 40) metrics2.history.shift();
20881
21315
  if (activeTab === "desempenho") renderActiveTab();
20882
21316
  }, 1e3);
20883
21317
  refreshTimer = window.setInterval(() => {
@@ -20896,11 +21330,11 @@ function enableXray() {
20896
21330
  injectStyle("xray", XRAY_CSS);
20897
21331
  refs = buildPanel();
20898
21332
  activeTab = activeTab || "estado";
20899
- metrics.effects = 0;
20900
- metrics.mutations = 0;
21333
+ metrics2.effects = 0;
21334
+ metrics2.mutations = 0;
20901
21335
  lastEffectCount = 0;
20902
21336
  lastMutationCount = 0;
20903
- metrics.history.length = 0;
21337
+ metrics2.history.length = 0;
20904
21338
  scanDocument();
20905
21339
  listenEvents();
20906
21340
  listenNetwork();
@@ -22954,12 +23388,12 @@ function flattenValue(value, components2) {
22954
23388
  return out;
22955
23389
  }
22956
23390
  if (value && typeof value === "object") {
22957
- const record = value;
23391
+ const record2 = value;
22958
23392
  const keys = ["x", "y", "z", "w"];
22959
23393
  const alt = ["r", "g", "b", "a"];
22960
23394
  const out = [];
22961
23395
  for (let i = 0; i < components2; i++) {
22962
- const found = record[keys[i]] ?? record[alt[i]];
23396
+ const found = record2[keys[i]] ?? record2[alt[i]];
22963
23397
  if (typeof found === "number") out.push(found);
22964
23398
  }
22965
23399
  return out;