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.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { core, sound, hotkey, palette, registerMask, unmask, applyMask, masks, mask, clearErrors, showFieldError, showFormErrors, messages, serializeForm, validate, validator, dialog, prompt, confirm, alert, modal, VoodooCollection, fromHtml, ready2, query, viewTransition, defineComponent, storage, ensurePalette, instances, storeNames, allStores } from './chunk-
|
|
2
|
-
export { VoodooCollection, alert, allStores, applyMask, cache, clearErrors, clipboard, confirm, cookie, createApp, createResource, defineComponent, dialog, ready as documentReady, enter, fadeIn, fadeOut, fromHtml, hotkey, installHooks, instances, leave, mask, masks, modal, mountComponent, network, palette, prompt, query, ready2 as ready, registerMask, removeStore, createResource as resource, screen, serializeForm, session, showFormErrors, slideDown, slideUp, sound, efeitos as soundEffects, storage, store, storeNames, theme, toast, unmask, url, useContext, useEffect, useMemo, useRef, useState, validate, validator, viewTransition, whenElement, whenReady } from './chunk-
|
|
3
|
-
export { gpu, reflectWgsl } from './chunk-
|
|
4
|
-
import { http } from './chunk-
|
|
5
|
-
export { HttpError, http, request } from './chunk-
|
|
6
|
-
import { devtoolsBus } from './chunk-
|
|
7
|
-
export { createSocket, devtoolsBus, socket, socketSupported } from './chunk-
|
|
8
|
-
import { magic, markSkipChildren, onStart, rootScope, findScope, destroy, readAttr, evaluate, parse, Scope, getScope, walk, unwrap, addCleanup, hadDirectives, collectDirectives, getEffectScopes, evaluateIn } from './chunk-
|
|
9
|
-
export { Scope, VoodooRuntimeError, VoodooSyntaxError, addCleanup, allowedGlobals, clearParseCache, destroy, evaluate, findScope, getScope, hook, hooks, magic, magics, parse, refresh, rootScope, start, stringify, tokenize, walk } from './chunk-
|
|
10
|
-
import { reactive, warn, handleError, effect, queuePostFlush, nextTick } from './chunk-
|
|
11
|
-
export { EffectScope, computed, effect, effectScope, flushSync, isReactive, markRaw, nextTick, reactive, ref, shallowRef, stop, toRaw, unref, watch, watchEffect } from './chunk-
|
|
12
|
-
import { warnAlias } from './chunk-
|
|
13
|
-
import { parseDuration, formatNumber, formatCurrency, formatDate, relativeTime, device, setFormatDefaults, uid, merge, escapeHtml, truncate, get, titleCase } from './chunk-
|
|
14
|
-
export { capitalize, chunk, clone, debounce, device, escapeHtml, formatCurrency, formatDate, formatFileSize, formatNumber, formatPercent, get, groupBy, isBrowser, matchesMedia, memoize, merge, once, parseDuration, random, relativeTime, sample, set, setFormatDefaults, sleep, slugify, sortBy, stripTags, throttle, titleCase, truncate, uid, unique, uuid } from './chunk-
|
|
15
|
-
import { ensureTokens, injectStyle } from './chunk-
|
|
16
|
-
export { ensureTokens, injectStyle } from './chunk-
|
|
17
|
-
import { defineDirective, PRIORITY, config } from './chunk-
|
|
18
|
-
export { PRIORITY, config, defineDirective } from './chunk-
|
|
19
|
-
import './chunk-
|
|
1
|
+
import { core, sound, hotkey, palette, registerMask, unmask, applyMask, masks, mask, clearErrors, showFieldError, showFormErrors, messages, serializeForm, validate, validator, dialog, prompt, confirm, alert, modal, VoodooCollection, fromHtml, ready2, query, viewTransition, defineComponent, storage, ensurePalette, instances, storeNames, allStores } from './chunk-H2NGDLMD.js';
|
|
2
|
+
export { VoodooCollection, alert, allStores, applyMask, cache, clearErrors, clipboard, confirm, cookie, createApp, createResource, defineComponent, dialog, ready as documentReady, enter, fadeIn, fadeOut, fromHtml, hotkey, installHooks, instances, leave, mask, masks, modal, mountComponent, network, palette, prompt, query, ready2 as ready, registerMask, removeStore, createResource as resource, screen, serializeForm, session, showFormErrors, slideDown, slideUp, sound, efeitos as soundEffects, storage, store, storeNames, theme, toast, unmask, url, useContext, useEffect, useMemo, useRef, useState, validate, validator, viewTransition, whenElement, whenReady } from './chunk-H2NGDLMD.js';
|
|
3
|
+
export { gpu, reflectWgsl } from './chunk-GE4JWATC.js';
|
|
4
|
+
import { http } from './chunk-OIH4BR2H.js';
|
|
5
|
+
export { HttpError, http, request } from './chunk-OIH4BR2H.js';
|
|
6
|
+
import { devtoolsBus } from './chunk-4IJE5BWY.js';
|
|
7
|
+
export { createSocket, devtoolsBus, socket, socketSupported } from './chunk-4IJE5BWY.js';
|
|
8
|
+
import { magic, markSkipChildren, onStart, rootScope, findScope, destroy, readAttr, evaluate, parse, Scope, getScope, walk, unwrap, addCleanup, hadDirectives, collectDirectives, getEffectScopes, evaluateIn } from './chunk-JBUNTP7F.js';
|
|
9
|
+
export { Scope, VoodooRuntimeError, VoodooSyntaxError, addCleanup, allowedGlobals, clearParseCache, destroy, evaluate, findScope, getScope, hook, hooks, magic, magics, parse, refresh, rootScope, start, stringify, tokenize, walk } from './chunk-JBUNTP7F.js';
|
|
10
|
+
import { reactive, warn, handleError, effect, queuePostFlush, nextTick } from './chunk-FMDHZ5GI.js';
|
|
11
|
+
export { EffectScope, computed, effect, effectScope, flushSync, isReactive, markRaw, nextTick, reactive, ref, shallowRef, stop, toRaw, unref, watch, watchEffect } from './chunk-FMDHZ5GI.js';
|
|
12
|
+
import { warnAlias } from './chunk-IBIZ6OUI.js';
|
|
13
|
+
import { parseDuration, formatNumber, formatCurrency, formatDate, relativeTime, device, setFormatDefaults, uid, merge, escapeHtml, truncate, get, titleCase } from './chunk-2LGAXVD7.js';
|
|
14
|
+
export { capitalize, chunk, clone, debounce, device, escapeHtml, formatCurrency, formatDate, formatFileSize, formatNumber, formatPercent, get, groupBy, isBrowser, matchesMedia, memoize, merge, once, parseDuration, random, relativeTime, sample, set, setFormatDefaults, sleep, slugify, sortBy, stripTags, throttle, titleCase, truncate, uid, unique, uuid } from './chunk-2LGAXVD7.js';
|
|
15
|
+
import { ensureTokens, injectStyle } from './chunk-MV73OSCS.js';
|
|
16
|
+
export { ensureTokens, injectStyle } from './chunk-MV73OSCS.js';
|
|
17
|
+
import { defineDirective, PRIORITY, config } from './chunk-TEVCUTTC.js';
|
|
18
|
+
export { PRIORITY, config, defineDirective } from './chunk-TEVCUTTC.js';
|
|
19
|
+
import './chunk-IJQ2PFXU.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Voodoo.js v0.
|
|
22
|
+
* Voodoo.js v0.13.0
|
|
23
23
|
* JavaScript feels like magic.
|
|
24
24
|
* (c) 2026 Voodoo.js contributors. MIT License.
|
|
25
25
|
*/
|
package/dist/reactivity.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Voodoo.js v0.
|
|
4
|
+
* Voodoo.js v0.13.0
|
|
5
5
|
* JavaScript feels like magic.
|
|
6
6
|
* (c) 2026 Voodoo.js contributors. MIT License.
|
|
7
7
|
*/
|
|
@@ -280,7 +280,9 @@ function trigger(target, type, key, _newValue) {
|
|
|
280
280
|
if (!isArr) add(depsMap.get(ITERATE_KEY));
|
|
281
281
|
else if (isIntegerKey(key)) add(depsMap.get("length"));
|
|
282
282
|
} else if (type === "delete" /* DELETE */) {
|
|
283
|
-
|
|
283
|
+
add(depsMap.get(ITERATE_KEY));
|
|
284
|
+
} else if (isArr && isIntegerKey(key)) {
|
|
285
|
+
add(depsMap.get(ITERATE_KEY));
|
|
284
286
|
} else if (isArr && key === "length") {
|
|
285
287
|
const newLen = Number(_newValue);
|
|
286
288
|
depsMap.forEach((dep, k) => {
|
|
@@ -293,6 +295,59 @@ function trigger(target, type, key, _newValue) {
|
|
|
293
295
|
else queueJob(e);
|
|
294
296
|
}
|
|
295
297
|
}
|
|
298
|
+
function triggerArrayRange(target, from) {
|
|
299
|
+
const depsMap = targetMap.get(target);
|
|
300
|
+
if (!depsMap) return;
|
|
301
|
+
const effects = /* @__PURE__ */ new Set();
|
|
302
|
+
const add = (dep) => {
|
|
303
|
+
if (!dep) return;
|
|
304
|
+
for (const e of dep) if (e !== activeEffect) effects.add(e);
|
|
305
|
+
};
|
|
306
|
+
add(depsMap.get("length"));
|
|
307
|
+
add(depsMap.get(ITERATE_KEY));
|
|
308
|
+
if (from >= 0) {
|
|
309
|
+
depsMap.forEach((dep, k) => {
|
|
310
|
+
if (typeof k === "string" && isIntegerKey(k) && Number(k) >= from) add(dep);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
for (const e of effects) {
|
|
314
|
+
if (e.scheduler) e.scheduler();
|
|
315
|
+
else queueJob(e);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
var ArrayOp = /* @__PURE__ */ ((ArrayOp2) => {
|
|
319
|
+
ArrayOp2[ArrayOp2["SPLICE"] = 1] = "SPLICE";
|
|
320
|
+
ArrayOp2[ArrayOp2["SET"] = 2] = "SET";
|
|
321
|
+
ArrayOp2[ArrayOp2["RESET"] = 3] = "RESET";
|
|
322
|
+
return ArrayOp2;
|
|
323
|
+
})(ArrayOp || {});
|
|
324
|
+
var LOG_LIMIT = 32;
|
|
325
|
+
var mutationLogs = /* @__PURE__ */ new WeakMap();
|
|
326
|
+
function record(target, type, index, removed, added) {
|
|
327
|
+
let log = mutationLogs.get(target);
|
|
328
|
+
if (!log) mutationLogs.set(target, log = { version: 0, ops: [] });
|
|
329
|
+
log.version++;
|
|
330
|
+
if (type === 3 /* RESET */) {
|
|
331
|
+
log.ops.length = 0;
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
log.ops.push({ type, index, removed, added });
|
|
335
|
+
if (log.ops.length > LOG_LIMIT) log.ops.shift();
|
|
336
|
+
}
|
|
337
|
+
var NO_MUTATIONS = [];
|
|
338
|
+
function arrayVersion(target) {
|
|
339
|
+
const log = mutationLogs.get(target);
|
|
340
|
+
return log ? log.version : 0;
|
|
341
|
+
}
|
|
342
|
+
function mutationsSince(target, since) {
|
|
343
|
+
const log = mutationLogs.get(target);
|
|
344
|
+
if (!log) return since === 0 ? NO_MUTATIONS : null;
|
|
345
|
+
if (since > log.version) return null;
|
|
346
|
+
const missing = log.version - since;
|
|
347
|
+
if (missing === 0) return NO_MUTATIONS;
|
|
348
|
+
if (missing > log.ops.length) return null;
|
|
349
|
+
return log.ops.slice(log.ops.length - missing);
|
|
350
|
+
}
|
|
296
351
|
function isIntegerKey(key) {
|
|
297
352
|
return typeof key === "string" && key !== "NaN" && key[0] !== "-" && String(parseInt(key, 10)) === key;
|
|
298
353
|
}
|
|
@@ -313,14 +368,61 @@ var arrayInstrumentations = /* @__PURE__ */ (() => {
|
|
|
313
368
|
return res;
|
|
314
369
|
};
|
|
315
370
|
}
|
|
316
|
-
for (const key of ["push", "pop", "shift", "unshift", "splice"]) {
|
|
371
|
+
for (const key of ["push", "pop", "shift", "unshift", "splice", "reverse", "sort"]) {
|
|
317
372
|
inst[key] = function(...args) {
|
|
373
|
+
const raw = toRaw(this);
|
|
374
|
+
const before = raw.length;
|
|
375
|
+
for (let i = 0; i < args.length; i++) args[i] = toRaw(args[i]);
|
|
318
376
|
pauseTracking();
|
|
377
|
+
let result;
|
|
319
378
|
try {
|
|
320
|
-
|
|
379
|
+
result = raw[key].apply(raw, args);
|
|
321
380
|
} finally {
|
|
322
381
|
resetTracking();
|
|
323
382
|
}
|
|
383
|
+
const after = raw.length;
|
|
384
|
+
let from = -1;
|
|
385
|
+
if (key === "push") {
|
|
386
|
+
if (args.length) {
|
|
387
|
+
record(raw, 1 /* SPLICE */, before, 0, args.length);
|
|
388
|
+
from = before;
|
|
389
|
+
}
|
|
390
|
+
} else if (key === "unshift") {
|
|
391
|
+
if (args.length) {
|
|
392
|
+
record(raw, 1 /* SPLICE */, 0, 0, args.length);
|
|
393
|
+
from = 0;
|
|
394
|
+
}
|
|
395
|
+
} else if (key === "pop") {
|
|
396
|
+
if (before > 0) {
|
|
397
|
+
record(raw, 1 /* SPLICE */, after, 1, 0);
|
|
398
|
+
from = after;
|
|
399
|
+
}
|
|
400
|
+
} else if (key === "shift") {
|
|
401
|
+
if (before > 0) {
|
|
402
|
+
record(raw, 1 /* SPLICE */, 0, 1, 0);
|
|
403
|
+
from = 0;
|
|
404
|
+
}
|
|
405
|
+
} else if (key === "splice") {
|
|
406
|
+
const removed = result.length;
|
|
407
|
+
const added = args.length > 2 ? args.length - 2 : 0;
|
|
408
|
+
if (removed || added) {
|
|
409
|
+
record(raw, 1 /* SPLICE */, spliceStart(args[0], before), removed, added);
|
|
410
|
+
from = spliceStart(args[0], before);
|
|
411
|
+
}
|
|
412
|
+
} else {
|
|
413
|
+
if (before > 1) {
|
|
414
|
+
record(raw, 3 /* RESET */, 0, before, after);
|
|
415
|
+
from = 0;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (from >= 0) triggerArrayRange(raw, from);
|
|
419
|
+
if (key === "pop" || key === "shift") return isObject(result) ? reactive(result) : result;
|
|
420
|
+
if (key === "splice") {
|
|
421
|
+
const out = result;
|
|
422
|
+
for (let i = 0; i < out.length; i++) if (isObject(out[i])) out[i] = reactive(out[i]);
|
|
423
|
+
return out;
|
|
424
|
+
}
|
|
425
|
+
return key === "reverse" || key === "sort" ? this : result;
|
|
324
426
|
};
|
|
325
427
|
}
|
|
326
428
|
return inst;
|
|
@@ -328,6 +430,11 @@ var arrayInstrumentations = /* @__PURE__ */ (() => {
|
|
|
328
430
|
function isObject(val) {
|
|
329
431
|
return val !== null && typeof val === "object";
|
|
330
432
|
}
|
|
433
|
+
function spliceStart(raw, length) {
|
|
434
|
+
const n = Math.trunc(Number(raw)) || 0;
|
|
435
|
+
if (n < 0) return Math.max(length + n, 0);
|
|
436
|
+
return Math.min(n, length);
|
|
437
|
+
}
|
|
331
438
|
var NON_REACTIVE = /* @__PURE__ */ new Set([
|
|
332
439
|
"Date",
|
|
333
440
|
"RegExp",
|
|
@@ -351,6 +458,23 @@ function canObserve(value) {
|
|
|
351
458
|
if (NON_REACTIVE.has(tag)) return false;
|
|
352
459
|
return tag === "Object" || tag === "Array" || tag === "Map" || tag === "Set";
|
|
353
460
|
}
|
|
461
|
+
function recordDirectWrite(target, key, lengthBefore, hadKey, oldValue, value) {
|
|
462
|
+
if (key === "length") {
|
|
463
|
+
const next = target.length;
|
|
464
|
+
if (next < lengthBefore) record(target, 1 /* SPLICE */, next, lengthBefore - next, 0);
|
|
465
|
+
else if (next > lengthBefore) record(target, 3 /* RESET */, 0, 0, 0);
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (!isIntegerKey(key)) return;
|
|
469
|
+
const index = Number(key);
|
|
470
|
+
if (hadKey) {
|
|
471
|
+
if (hasChanged(value, oldValue)) record(target, 2 /* SET */, index, 1, 1);
|
|
472
|
+
} else if (index === lengthBefore) {
|
|
473
|
+
record(target, 1 /* SPLICE */, index, 0, 1);
|
|
474
|
+
} else {
|
|
475
|
+
record(target, 3 /* RESET */, 0, 0, 0);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
354
478
|
function markRaw(value) {
|
|
355
479
|
Object.defineProperty(value, SKIP, { value: true, enumerable: false, configurable: true });
|
|
356
480
|
return value;
|
|
@@ -399,8 +523,11 @@ var baseHandlers = {
|
|
|
399
523
|
return true;
|
|
400
524
|
}
|
|
401
525
|
const hadKey = Array.isArray(target) && isIntegerKey(key) ? Number(key) < target.length : Object.prototype.hasOwnProperty.call(target, key);
|
|
526
|
+
const isArr = Array.isArray(target);
|
|
527
|
+
const arrayLength = isArr ? target.length : 0;
|
|
402
528
|
const result = Reflect.set(target, key, value, receiver);
|
|
403
529
|
if (target === toRaw(receiver)) {
|
|
530
|
+
if (isArr) recordDirectWrite(target, key, arrayLength, hadKey, oldValue, value);
|
|
404
531
|
if (!hadKey) trigger(target, "add" /* ADD */, key, value);
|
|
405
532
|
else if (hasChanged(value, oldValue)) trigger(target, "set" /* SET */, key, value);
|
|
406
533
|
}
|
|
@@ -409,7 +536,10 @@ var baseHandlers = {
|
|
|
409
536
|
deleteProperty(target, key) {
|
|
410
537
|
const hadKey = Object.prototype.hasOwnProperty.call(target, key);
|
|
411
538
|
const result = Reflect.deleteProperty(target, key);
|
|
412
|
-
if (result && hadKey)
|
|
539
|
+
if (result && hadKey) {
|
|
540
|
+
if (Array.isArray(target)) record(target, 3 /* RESET */, 0, 0, 0);
|
|
541
|
+
trigger(target, "delete" /* DELETE */, key);
|
|
542
|
+
}
|
|
413
543
|
return result;
|
|
414
544
|
},
|
|
415
545
|
has(target, key) {
|
|
@@ -639,10 +769,12 @@ function traverse(value, seen = /* @__PURE__ */ new Set()) {
|
|
|
639
769
|
return value;
|
|
640
770
|
}
|
|
641
771
|
|
|
772
|
+
exports.ArrayOp = ArrayOp;
|
|
642
773
|
exports.EffectScope = EffectScope;
|
|
643
774
|
exports.ITERATE_KEY = ITERATE_KEY;
|
|
644
775
|
exports.ReactiveEffect = ReactiveEffect;
|
|
645
776
|
exports.TriggerType = TriggerType;
|
|
777
|
+
exports.arrayVersion = arrayVersion;
|
|
646
778
|
exports.computed = computed;
|
|
647
779
|
exports.effect = effect;
|
|
648
780
|
exports.effectScope = effectScope;
|
|
@@ -655,6 +787,7 @@ exports.hasChanged = hasChanged;
|
|
|
655
787
|
exports.isReactive = isReactive;
|
|
656
788
|
exports.isRef = isRef;
|
|
657
789
|
exports.markRaw = markRaw;
|
|
790
|
+
exports.mutationsSince = mutationsSince;
|
|
658
791
|
exports.nextTick = nextTick;
|
|
659
792
|
exports.pauseTracking = pauseTracking;
|
|
660
793
|
exports.queueJob = queueJob;
|
package/dist/reactivity.d.cts
CHANGED
|
@@ -131,6 +131,37 @@ declare const enum TriggerType {
|
|
|
131
131
|
CLEAR = "clear"
|
|
132
132
|
}
|
|
133
133
|
declare function trigger(target: object, type: TriggerType, key?: PropertyKey, _newValue?: unknown): void;
|
|
134
|
+
/**
|
|
135
|
+
* What happened to an array, in the words of the call that did it.
|
|
136
|
+
*
|
|
137
|
+
* A reconciler handed a new array has to work out what changed by comparing it
|
|
138
|
+
* against the old one, which costs one key read per row however clever it is.
|
|
139
|
+
* A reconciler told "one row was removed at 5000" does not: the mutation
|
|
140
|
+
* already carries the answer. This log is how the caller's knowledge survives
|
|
141
|
+
* the trip to the effect that re-renders the list.
|
|
142
|
+
*/
|
|
143
|
+
declare const enum ArrayOp {
|
|
144
|
+
/** `removed` elements at `index` gave way to `added` new ones. */
|
|
145
|
+
SPLICE = 1,
|
|
146
|
+
/** The element at `index` was replaced, without shifting anything. */
|
|
147
|
+
SET = 2,
|
|
148
|
+
/** Something happened that no range can describe. History is unusable. */
|
|
149
|
+
RESET = 3
|
|
150
|
+
}
|
|
151
|
+
interface ArrayMutation {
|
|
152
|
+
type: ArrayOp;
|
|
153
|
+
index: number;
|
|
154
|
+
removed: number;
|
|
155
|
+
added: number;
|
|
156
|
+
}
|
|
157
|
+
/** Mutations recorded for an array so far. `0` when it has never been mutated. */
|
|
158
|
+
declare function arrayVersion(target: object): number;
|
|
159
|
+
/**
|
|
160
|
+
* What happened to `target` since version `since`, oldest first, or `null`
|
|
161
|
+
* when the log cannot answer — the history was truncated, or something
|
|
162
|
+
* unrepresentable happened. `null` means "compare the lists yourself".
|
|
163
|
+
*/
|
|
164
|
+
declare function mutationsSince(target: object, since: number): ArrayMutation[] | null;
|
|
134
165
|
/** Marks an object so it is never turned into a reactive proxy. */
|
|
135
166
|
declare function markRaw<T extends object>(value: T): T;
|
|
136
167
|
/** Returns the original object behind a reactive proxy. */
|
|
@@ -185,4 +216,4 @@ declare function watch<T>(source: WatchSource<T>, cb: WatchCallback<T>, options?
|
|
|
185
216
|
/** Executes the effect immediately and re-executes when dependencies change. */
|
|
186
217
|
declare function watchEffect(fn: (onInvalidate: (c: () => void) => void) => void): WatchStopHandle;
|
|
187
218
|
|
|
188
|
-
export { type ComputedRef, type Dep, type EffectOptions, type EffectRunner, type EffectScheduler, EffectScope, ITERATE_KEY, ReactiveEffect, type Ref, TriggerType, type WatchCallback, type WatchOptions, type WatchSource, type WatchStopHandle, computed, effect, effectScope, enableTracking, flushSync, getActiveEffect, getActiveScope, handleError, hasChanged, isReactive, isRef, markRaw, nextTick, pauseTracking, queueJob, queuePostFlush, reactive, ref, resetTracking, setErrorHandler, shallowRef, stop, toRaw, track, trigger, unref, warn, watch, watchEffect };
|
|
219
|
+
export { type ArrayMutation, ArrayOp, type ComputedRef, type Dep, type EffectOptions, type EffectRunner, type EffectScheduler, EffectScope, ITERATE_KEY, ReactiveEffect, type Ref, TriggerType, type WatchCallback, type WatchOptions, type WatchSource, type WatchStopHandle, arrayVersion, computed, effect, effectScope, enableTracking, flushSync, getActiveEffect, getActiveScope, handleError, hasChanged, isReactive, isRef, markRaw, mutationsSince, nextTick, pauseTracking, queueJob, queuePostFlush, reactive, ref, resetTracking, setErrorHandler, shallowRef, stop, toRaw, track, trigger, unref, warn, watch, watchEffect };
|
package/dist/reactivity.d.ts
CHANGED
|
@@ -131,6 +131,37 @@ declare const enum TriggerType {
|
|
|
131
131
|
CLEAR = "clear"
|
|
132
132
|
}
|
|
133
133
|
declare function trigger(target: object, type: TriggerType, key?: PropertyKey, _newValue?: unknown): void;
|
|
134
|
+
/**
|
|
135
|
+
* What happened to an array, in the words of the call that did it.
|
|
136
|
+
*
|
|
137
|
+
* A reconciler handed a new array has to work out what changed by comparing it
|
|
138
|
+
* against the old one, which costs one key read per row however clever it is.
|
|
139
|
+
* A reconciler told "one row was removed at 5000" does not: the mutation
|
|
140
|
+
* already carries the answer. This log is how the caller's knowledge survives
|
|
141
|
+
* the trip to the effect that re-renders the list.
|
|
142
|
+
*/
|
|
143
|
+
declare const enum ArrayOp {
|
|
144
|
+
/** `removed` elements at `index` gave way to `added` new ones. */
|
|
145
|
+
SPLICE = 1,
|
|
146
|
+
/** The element at `index` was replaced, without shifting anything. */
|
|
147
|
+
SET = 2,
|
|
148
|
+
/** Something happened that no range can describe. History is unusable. */
|
|
149
|
+
RESET = 3
|
|
150
|
+
}
|
|
151
|
+
interface ArrayMutation {
|
|
152
|
+
type: ArrayOp;
|
|
153
|
+
index: number;
|
|
154
|
+
removed: number;
|
|
155
|
+
added: number;
|
|
156
|
+
}
|
|
157
|
+
/** Mutations recorded for an array so far. `0` when it has never been mutated. */
|
|
158
|
+
declare function arrayVersion(target: object): number;
|
|
159
|
+
/**
|
|
160
|
+
* What happened to `target` since version `since`, oldest first, or `null`
|
|
161
|
+
* when the log cannot answer — the history was truncated, or something
|
|
162
|
+
* unrepresentable happened. `null` means "compare the lists yourself".
|
|
163
|
+
*/
|
|
164
|
+
declare function mutationsSince(target: object, since: number): ArrayMutation[] | null;
|
|
134
165
|
/** Marks an object so it is never turned into a reactive proxy. */
|
|
135
166
|
declare function markRaw<T extends object>(value: T): T;
|
|
136
167
|
/** Returns the original object behind a reactive proxy. */
|
|
@@ -185,4 +216,4 @@ declare function watch<T>(source: WatchSource<T>, cb: WatchCallback<T>, options?
|
|
|
185
216
|
/** Executes the effect immediately and re-executes when dependencies change. */
|
|
186
217
|
declare function watchEffect(fn: (onInvalidate: (c: () => void) => void) => void): WatchStopHandle;
|
|
187
218
|
|
|
188
|
-
export { type ComputedRef, type Dep, type EffectOptions, type EffectRunner, type EffectScheduler, EffectScope, ITERATE_KEY, ReactiveEffect, type Ref, TriggerType, type WatchCallback, type WatchOptions, type WatchSource, type WatchStopHandle, computed, effect, effectScope, enableTracking, flushSync, getActiveEffect, getActiveScope, handleError, hasChanged, isReactive, isRef, markRaw, nextTick, pauseTracking, queueJob, queuePostFlush, reactive, ref, resetTracking, setErrorHandler, shallowRef, stop, toRaw, track, trigger, unref, warn, watch, watchEffect };
|
|
219
|
+
export { type ArrayMutation, ArrayOp, type ComputedRef, type Dep, type EffectOptions, type EffectRunner, type EffectScheduler, EffectScope, ITERATE_KEY, ReactiveEffect, type Ref, TriggerType, type WatchCallback, type WatchOptions, type WatchSource, type WatchStopHandle, arrayVersion, computed, effect, effectScope, enableTracking, flushSync, getActiveEffect, getActiveScope, handleError, hasChanged, isReactive, isRef, markRaw, mutationsSince, nextTick, pauseTracking, queueJob, queuePostFlush, reactive, ref, resetTracking, setErrorHandler, shallowRef, stop, toRaw, track, trigger, unref, warn, watch, watchEffect };
|
package/dist/reactivity.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { EffectScope, ITERATE_KEY, ReactiveEffect, TriggerType, computed, effect, effectScope, enableTracking, flushSync, getActiveEffect, getActiveScope, handleError, hasChanged, isReactive, isRef, markRaw, nextTick, pauseTracking, queueJob, queuePostFlush, reactive, ref, resetTracking, setErrorHandler, shallowRef, stop, toRaw, track, trigger, unref, warn, watch, watchEffect } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { ArrayOp, EffectScope, ITERATE_KEY, ReactiveEffect, TriggerType, arrayVersion, computed, effect, effectScope, enableTracking, flushSync, getActiveEffect, getActiveScope, handleError, hasChanged, isReactive, isRef, markRaw, mutationsSince, nextTick, pauseTracking, queueJob, queuePostFlush, reactive, ref, resetTracking, setErrorHandler, shallowRef, stop, toRaw, track, trigger, unref, warn, watch, watchEffect } from './chunk-FMDHZ5GI.js';
|
|
2
|
+
import './chunk-IJQ2PFXU.js';
|
|
3
3
|
//# sourceMappingURL=reactivity.js.map
|
|
4
4
|
//# sourceMappingURL=reactivity.js.map
|
package/dist/socket.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
|
*/
|
|
@@ -137,7 +137,9 @@ function trigger(target2, type, key, _newValue) {
|
|
|
137
137
|
if (!isArr) add(depsMap.get(ITERATE_KEY));
|
|
138
138
|
else if (isIntegerKey(key)) add(depsMap.get("length"));
|
|
139
139
|
} else if (type === "delete" /* DELETE */) {
|
|
140
|
-
|
|
140
|
+
add(depsMap.get(ITERATE_KEY));
|
|
141
|
+
} else if (isArr && isIntegerKey(key)) {
|
|
142
|
+
add(depsMap.get(ITERATE_KEY));
|
|
141
143
|
} else if (isArr && key === "length") {
|
|
142
144
|
const newLen = Number(_newValue);
|
|
143
145
|
depsMap.forEach((dep, k) => {
|
|
@@ -150,6 +152,39 @@ function trigger(target2, type, key, _newValue) {
|
|
|
150
152
|
else queueJob(e);
|
|
151
153
|
}
|
|
152
154
|
}
|
|
155
|
+
function triggerArrayRange(target2, from) {
|
|
156
|
+
const depsMap = targetMap.get(target2);
|
|
157
|
+
if (!depsMap) return;
|
|
158
|
+
const effects = /* @__PURE__ */ new Set();
|
|
159
|
+
const add = (dep) => {
|
|
160
|
+
if (!dep) return;
|
|
161
|
+
for (const e of dep) if (e !== activeEffect) effects.add(e);
|
|
162
|
+
};
|
|
163
|
+
add(depsMap.get("length"));
|
|
164
|
+
add(depsMap.get(ITERATE_KEY));
|
|
165
|
+
if (from >= 0) {
|
|
166
|
+
depsMap.forEach((dep, k) => {
|
|
167
|
+
if (typeof k === "string" && isIntegerKey(k) && Number(k) >= from) add(dep);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
for (const e of effects) {
|
|
171
|
+
if (e.scheduler) e.scheduler();
|
|
172
|
+
else queueJob(e);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
var LOG_LIMIT = 32;
|
|
176
|
+
var mutationLogs = /* @__PURE__ */ new WeakMap();
|
|
177
|
+
function record(target2, type, index, removed, added) {
|
|
178
|
+
let log = mutationLogs.get(target2);
|
|
179
|
+
if (!log) mutationLogs.set(target2, log = { version: 0, ops: [] });
|
|
180
|
+
log.version++;
|
|
181
|
+
if (type === 3 /* RESET */) {
|
|
182
|
+
log.ops.length = 0;
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
log.ops.push({ type, index, removed, added });
|
|
186
|
+
if (log.ops.length > LOG_LIMIT) log.ops.shift();
|
|
187
|
+
}
|
|
153
188
|
function isIntegerKey(key) {
|
|
154
189
|
return typeof key === "string" && key !== "NaN" && key[0] !== "-" && String(parseInt(key, 10)) === key;
|
|
155
190
|
}
|
|
@@ -170,14 +205,61 @@ var arrayInstrumentations = /* @__PURE__ */ (() => {
|
|
|
170
205
|
return res;
|
|
171
206
|
};
|
|
172
207
|
}
|
|
173
|
-
for (const key of ["push", "pop", "shift", "unshift", "splice"]) {
|
|
208
|
+
for (const key of ["push", "pop", "shift", "unshift", "splice", "reverse", "sort"]) {
|
|
174
209
|
inst[key] = function(...args) {
|
|
210
|
+
const raw = toRaw(this);
|
|
211
|
+
const before = raw.length;
|
|
212
|
+
for (let i = 0; i < args.length; i++) args[i] = toRaw(args[i]);
|
|
175
213
|
pauseTracking();
|
|
214
|
+
let result;
|
|
176
215
|
try {
|
|
177
|
-
|
|
216
|
+
result = raw[key].apply(raw, args);
|
|
178
217
|
} finally {
|
|
179
218
|
resetTracking();
|
|
180
219
|
}
|
|
220
|
+
const after = raw.length;
|
|
221
|
+
let from = -1;
|
|
222
|
+
if (key === "push") {
|
|
223
|
+
if (args.length) {
|
|
224
|
+
record(raw, 1 /* SPLICE */, before, 0, args.length);
|
|
225
|
+
from = before;
|
|
226
|
+
}
|
|
227
|
+
} else if (key === "unshift") {
|
|
228
|
+
if (args.length) {
|
|
229
|
+
record(raw, 1 /* SPLICE */, 0, 0, args.length);
|
|
230
|
+
from = 0;
|
|
231
|
+
}
|
|
232
|
+
} else if (key === "pop") {
|
|
233
|
+
if (before > 0) {
|
|
234
|
+
record(raw, 1 /* SPLICE */, after, 1, 0);
|
|
235
|
+
from = after;
|
|
236
|
+
}
|
|
237
|
+
} else if (key === "shift") {
|
|
238
|
+
if (before > 0) {
|
|
239
|
+
record(raw, 1 /* SPLICE */, 0, 1, 0);
|
|
240
|
+
from = 0;
|
|
241
|
+
}
|
|
242
|
+
} else if (key === "splice") {
|
|
243
|
+
const removed = result.length;
|
|
244
|
+
const added = args.length > 2 ? args.length - 2 : 0;
|
|
245
|
+
if (removed || added) {
|
|
246
|
+
record(raw, 1 /* SPLICE */, spliceStart(args[0], before), removed, added);
|
|
247
|
+
from = spliceStart(args[0], before);
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
if (before > 1) {
|
|
251
|
+
record(raw, 3 /* RESET */, 0, before, after);
|
|
252
|
+
from = 0;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (from >= 0) triggerArrayRange(raw, from);
|
|
256
|
+
if (key === "pop" || key === "shift") return isObject(result) ? reactive(result) : result;
|
|
257
|
+
if (key === "splice") {
|
|
258
|
+
const out = result;
|
|
259
|
+
for (let i = 0; i < out.length; i++) if (isObject(out[i])) out[i] = reactive(out[i]);
|
|
260
|
+
return out;
|
|
261
|
+
}
|
|
262
|
+
return key === "reverse" || key === "sort" ? this : result;
|
|
181
263
|
};
|
|
182
264
|
}
|
|
183
265
|
return inst;
|
|
@@ -185,6 +267,11 @@ var arrayInstrumentations = /* @__PURE__ */ (() => {
|
|
|
185
267
|
function isObject(val) {
|
|
186
268
|
return val !== null && typeof val === "object";
|
|
187
269
|
}
|
|
270
|
+
function spliceStart(raw, length) {
|
|
271
|
+
const n = Math.trunc(Number(raw)) || 0;
|
|
272
|
+
if (n < 0) return Math.max(length + n, 0);
|
|
273
|
+
return Math.min(n, length);
|
|
274
|
+
}
|
|
188
275
|
var NON_REACTIVE = /* @__PURE__ */ new Set([
|
|
189
276
|
"Date",
|
|
190
277
|
"RegExp",
|
|
@@ -208,6 +295,23 @@ function canObserve(value) {
|
|
|
208
295
|
if (NON_REACTIVE.has(tag)) return false;
|
|
209
296
|
return tag === "Object" || tag === "Array" || tag === "Map" || tag === "Set";
|
|
210
297
|
}
|
|
298
|
+
function recordDirectWrite(target2, key, lengthBefore, hadKey, oldValue, value) {
|
|
299
|
+
if (key === "length") {
|
|
300
|
+
const next = target2.length;
|
|
301
|
+
if (next < lengthBefore) record(target2, 1 /* SPLICE */, next, lengthBefore - next, 0);
|
|
302
|
+
else if (next > lengthBefore) record(target2, 3 /* RESET */, 0, 0, 0);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
if (!isIntegerKey(key)) return;
|
|
306
|
+
const index = Number(key);
|
|
307
|
+
if (hadKey) {
|
|
308
|
+
if (hasChanged(value, oldValue)) record(target2, 2 /* SET */, index, 1, 1);
|
|
309
|
+
} else if (index === lengthBefore) {
|
|
310
|
+
record(target2, 1 /* SPLICE */, index, 0, 1);
|
|
311
|
+
} else {
|
|
312
|
+
record(target2, 3 /* RESET */, 0, 0, 0);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
211
315
|
function toRaw(observed) {
|
|
212
316
|
const raw = observed && observed[RAW];
|
|
213
317
|
return raw ? toRaw(raw) : observed;
|
|
@@ -252,8 +356,11 @@ var baseHandlers = {
|
|
|
252
356
|
return true;
|
|
253
357
|
}
|
|
254
358
|
const hadKey = Array.isArray(target2) && isIntegerKey(key) ? Number(key) < target2.length : Object.prototype.hasOwnProperty.call(target2, key);
|
|
359
|
+
const isArr = Array.isArray(target2);
|
|
360
|
+
const arrayLength = isArr ? target2.length : 0;
|
|
255
361
|
const result = Reflect.set(target2, key, value, receiver);
|
|
256
362
|
if (target2 === toRaw(receiver)) {
|
|
363
|
+
if (isArr) recordDirectWrite(target2, key, arrayLength, hadKey, oldValue, value);
|
|
257
364
|
if (!hadKey) trigger(target2, "add" /* ADD */, key, value);
|
|
258
365
|
else if (hasChanged(value, oldValue)) trigger(target2, "set" /* SET */, key, value);
|
|
259
366
|
}
|
|
@@ -262,7 +369,10 @@ var baseHandlers = {
|
|
|
262
369
|
deleteProperty(target2, key) {
|
|
263
370
|
const hadKey = Object.prototype.hasOwnProperty.call(target2, key);
|
|
264
371
|
const result = Reflect.deleteProperty(target2, key);
|
|
265
|
-
if (result && hadKey)
|
|
372
|
+
if (result && hadKey) {
|
|
373
|
+
if (Array.isArray(target2)) record(target2, 3 /* RESET */, 0, 0, 0);
|
|
374
|
+
trigger(target2, "delete" /* DELETE */, key);
|
|
375
|
+
}
|
|
266
376
|
return result;
|
|
267
377
|
},
|
|
268
378
|
has(target2, key) {
|
package/dist/socket.d.cts
CHANGED
|
@@ -134,7 +134,7 @@ declare function engineURL(base: string, path?: string): string;
|
|
|
134
134
|
* WebSocket pay for WebSocket; those not using it keep the file the same size as before.
|
|
135
135
|
*
|
|
136
136
|
* ```html
|
|
137
|
-
* <script src="https://cdn.jsdelivr.net/npm/voodoojs/dist/voodoo.min.js" defer></script>
|
|
137
|
+
* <script src="https://cdn.jsdelivr.net/npm/voodoojs@0.12.5/dist/voodoo.full.min.js" defer></script>
|
|
138
138
|
* <script type="module">
|
|
139
139
|
* import 'https://cdn.jsdelivr.net/npm/voodoojs/dist/socket.js'
|
|
140
140
|
* </script>
|
package/dist/socket.d.ts
CHANGED
|
@@ -134,7 +134,7 @@ declare function engineURL(base: string, path?: string): string;
|
|
|
134
134
|
* WebSocket pay for WebSocket; those not using it keep the file the same size as before.
|
|
135
135
|
*
|
|
136
136
|
* ```html
|
|
137
|
-
* <script src="https://cdn.jsdelivr.net/npm/voodoojs/dist/voodoo.min.js" defer></script>
|
|
137
|
+
* <script src="https://cdn.jsdelivr.net/npm/voodoojs@0.12.5/dist/voodoo.full.min.js" defer></script>
|
|
138
138
|
* <script type="module">
|
|
139
139
|
* import 'https://cdn.jsdelivr.net/npm/voodoojs/dist/socket.js'
|
|
140
140
|
* </script>
|
package/dist/socket.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { socketSupported, createSocket, socket } from './chunk-
|
|
2
|
-
export { ENGINE, SIO, createSocket, decodeEngine, decodeSocketIo, encodeSocketIo, engineURL, resolveSocketURL, socket, socketSupported } from './chunk-
|
|
3
|
-
import { evaluateIn, readAttr } from './chunk-
|
|
4
|
-
import { reactive } from './chunk-
|
|
5
|
-
import { warnAlias } from './chunk-
|
|
6
|
-
import { parseDuration } from './chunk-
|
|
7
|
-
import { defineDirective, PRIORITY, config } from './chunk-
|
|
8
|
-
import './chunk-
|
|
1
|
+
import { socketSupported, createSocket, socket } from './chunk-4IJE5BWY.js';
|
|
2
|
+
export { ENGINE, SIO, createSocket, decodeEngine, decodeSocketIo, encodeSocketIo, engineURL, resolveSocketURL, socket, socketSupported } from './chunk-4IJE5BWY.js';
|
|
3
|
+
import { evaluateIn, readAttr } from './chunk-JBUNTP7F.js';
|
|
4
|
+
import { reactive } from './chunk-FMDHZ5GI.js';
|
|
5
|
+
import { warnAlias } from './chunk-IBIZ6OUI.js';
|
|
6
|
+
import { parseDuration } from './chunk-2LGAXVD7.js';
|
|
7
|
+
import { defineDirective, PRIORITY, config } from './chunk-TEVCUTTC.js';
|
|
8
|
+
import './chunk-IJQ2PFXU.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Voodoo.js v0.
|
|
11
|
+
* Voodoo.js v0.13.0
|
|
12
12
|
* JavaScript feels like magic.
|
|
13
13
|
* (c) 2026 Voodoo.js contributors. MIT License.
|
|
14
14
|
*/
|
package/dist/utils.cjs
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { capitalize, chunk, clone, debounce, device, escapeHtml, formatCurrency, formatDate, formatFileSize, formatNumber, formatPercent, get, groupBy, isBrowser, matchesMedia, memoize, merge, once, parseDuration, random, relativeTime, sample, set, setFormatDefaults, sleep, slugify, sortBy, stripTags, throttle, titleCase, truncate, uid, unique, uuid } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { capitalize, chunk, clone, debounce, device, escapeHtml, formatCurrency, formatDate, formatFileSize, formatNumber, formatPercent, get, groupBy, isBrowser, matchesMedia, memoize, merge, once, parseDuration, random, relativeTime, sample, set, setFormatDefaults, sleep, slugify, sortBy, stripTags, throttle, titleCase, truncate, uid, unique, uuid } from './chunk-2LGAXVD7.js';
|
|
2
|
+
import './chunk-IJQ2PFXU.js';
|
|
3
3
|
//# sourceMappingURL=utils.js.map
|
|
4
4
|
//# sourceMappingURL=utils.js.map
|