voodoojs 0.11.2 → 0.12.1
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-H2ZUEQWV.js → chunk-4M4ZXHNY.js} +84 -19
- package/dist/{chunk-UV5PMS7P.js → chunk-72PMUUMT.js} +4 -4
- package/dist/{chunk-KQYSJHZR.js → chunk-AFMCDNYS.js} +5 -5
- package/dist/{chunk-DJJB35SR.js → chunk-D7675IJG.js} +6 -6
- package/dist/{chunk-IS3DR2KY.js → chunk-GXPNWCGE.js} +3 -3
- package/dist/{chunk-DCE5WIGA.js → chunk-HNM3CTBD.js} +5 -5
- package/dist/{chunk-IGZSDZKU.js → chunk-KN7NAKBL.js} +4 -4
- package/dist/{chunk-WJP3YGUI.js → chunk-LLNDLLKV.js} +4 -4
- package/dist/{chunk-V3O3WOZH.js → chunk-NP66JM2P.js} +4 -4
- package/dist/{chunk-AH2VXDZD.js → chunk-RDHYPGH6.js} +187 -18
- package/dist/{chunk-NFDXVIII.js → chunk-T5ION5NG.js} +3 -3
- package/dist/essential.cjs +263 -25
- package/dist/essential.d.cts +1 -1
- package/dist/essential.d.ts +1 -1
- 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 +273 -27
- package/dist/index.d.cts +88 -4
- package/dist/index.d.ts +88 -4
- package/dist/index.js +20 -20
- package/dist/{query-Cf-7iibE.d.ts → query-DzHfm8Kg.d.ts} +40 -29
- package/dist/{query-DiQAS73Q.d.cts → query-XooOh4vB.d.cts} +40 -29
- package/dist/reactivity.cjs +1 -1
- package/dist/reactivity.js +2 -2
- package/dist/socket.cjs +1 -1
- package/dist/socket.js +9 -9
- package/dist/style-GR4X6O7I.js +5 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/voodoo.core.js +242 -24
- package/dist/voodoo.core.min.js +17 -17
- package/dist/voodoo.full.js +266 -27
- package/dist/voodoo.full.min.js +57 -53
- package/dist/voodoo.js +264 -25
- package/dist/voodoo.min.js +29 -25
- package/package.json +1 -1
- package/dist/style-4X62SABN.js +0 -5
package/dist/essential.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.12.1
|
|
7
7
|
* JavaScript feels like magic.
|
|
8
8
|
* (c) 2026 Voodoo.js contributors. MIT License.
|
|
9
9
|
*/
|
|
@@ -2237,6 +2237,10 @@ var magics = /* @__PURE__ */ new Map();
|
|
|
2237
2237
|
function magic(name, getter) {
|
|
2238
2238
|
magics.set(name.startsWith("$") ? name : `$${name}`, getter);
|
|
2239
2239
|
}
|
|
2240
|
+
var hooks = /* @__PURE__ */ new Map();
|
|
2241
|
+
function hook(name, getter) {
|
|
2242
|
+
hooks.set(name, getter);
|
|
2243
|
+
}
|
|
2240
2244
|
var Scope = class _Scope {
|
|
2241
2245
|
// Assignment order matches the order the fields were declared in before, so
|
|
2242
2246
|
// the properties are created in the same sequence they always were.
|
|
@@ -2292,7 +2296,10 @@ var Scope = class _Scope {
|
|
|
2292
2296
|
s = s.parent;
|
|
2293
2297
|
}
|
|
2294
2298
|
if (name.charCodeAt(0) === 36 && magics.has(name)) {
|
|
2295
|
-
return this.magicContainer(name);
|
|
2299
|
+
return this.magicContainer(name, magics);
|
|
2300
|
+
}
|
|
2301
|
+
if (hooks.has(name)) {
|
|
2302
|
+
return this.magicContainer(name, hooks);
|
|
2296
2303
|
}
|
|
2297
2304
|
return void 0;
|
|
2298
2305
|
}
|
|
@@ -2321,11 +2328,11 @@ var Scope = class _Scope {
|
|
|
2321
2328
|
reactiveChild(vars, el = null) {
|
|
2322
2329
|
return new _Scope(reactive(vars), this, el ?? this.el);
|
|
2323
2330
|
}
|
|
2324
|
-
magicContainer(name) {
|
|
2331
|
+
magicContainer(name, registry) {
|
|
2325
2332
|
if (!this.magicCache) this.magicCache = /* @__PURE__ */ new Map();
|
|
2326
2333
|
const cached = this.magicCache.get(name);
|
|
2327
2334
|
if (cached) return cached;
|
|
2328
|
-
const getter =
|
|
2335
|
+
const getter = registry.get(name);
|
|
2329
2336
|
const scope = this;
|
|
2330
2337
|
const container2 = {};
|
|
2331
2338
|
Object.defineProperty(container2, name, {
|
|
@@ -2714,7 +2721,16 @@ function runDirective(el, attr2, scope) {
|
|
|
2714
2721
|
},
|
|
2715
2722
|
effect(fn) {
|
|
2716
2723
|
const owner = ownerScope();
|
|
2717
|
-
|
|
2724
|
+
const hosted = () => {
|
|
2725
|
+
const previous = hookHost;
|
|
2726
|
+
hookHost = el;
|
|
2727
|
+
try {
|
|
2728
|
+
fn();
|
|
2729
|
+
} finally {
|
|
2730
|
+
hookHost = previous;
|
|
2731
|
+
}
|
|
2732
|
+
};
|
|
2733
|
+
owner.run(() => effect(hosted, { scope: owner }));
|
|
2718
2734
|
},
|
|
2719
2735
|
cleanup(fn) {
|
|
2720
2736
|
addCleanup(el, fn);
|
|
@@ -2762,6 +2778,56 @@ function walk(node, scope) {
|
|
|
2762
2778
|
return;
|
|
2763
2779
|
}
|
|
2764
2780
|
initialized.add(el);
|
|
2781
|
+
const previousHost = hookHost;
|
|
2782
|
+
hookHost = el;
|
|
2783
|
+
try {
|
|
2784
|
+
walkElementDirectives(el, attrs, tagComponent, current2);
|
|
2785
|
+
} finally {
|
|
2786
|
+
hookHost = previousHost;
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
var hookHost = null;
|
|
2790
|
+
function currentHookHost() {
|
|
2791
|
+
return hookHost;
|
|
2792
|
+
}
|
|
2793
|
+
function createDataScope(expression, parent, el) {
|
|
2794
|
+
let ast = null;
|
|
2795
|
+
try {
|
|
2796
|
+
ast = parse(expression);
|
|
2797
|
+
} catch {
|
|
2798
|
+
ast = null;
|
|
2799
|
+
}
|
|
2800
|
+
const plain = ast && ast.t === "obj" && ast.props.every(
|
|
2801
|
+
(p2) => !p2.spread && !p2.keyExpr
|
|
2802
|
+
);
|
|
2803
|
+
if (!plain) {
|
|
2804
|
+
const raw = evaluateIn(expression, parent, "v-data");
|
|
2805
|
+
return parent.reactiveChild(raw && typeof raw === "object" ? raw : {}, el);
|
|
2806
|
+
}
|
|
2807
|
+
const scope = parent.reactiveChild({}, el);
|
|
2808
|
+
const props = ast.props;
|
|
2809
|
+
for (const prop of props) {
|
|
2810
|
+
if (prop.key === null) continue;
|
|
2811
|
+
try {
|
|
2812
|
+
if (prop.getter) {
|
|
2813
|
+
const compute = evaluate(prop.value, scope);
|
|
2814
|
+
Object.defineProperty(scope.data, prop.key, {
|
|
2815
|
+
enumerable: true,
|
|
2816
|
+
configurable: true,
|
|
2817
|
+
get: () => compute.call(scope.data)
|
|
2818
|
+
});
|
|
2819
|
+
} else {
|
|
2820
|
+
scope.data[prop.key] = evaluate(prop.value, scope);
|
|
2821
|
+
}
|
|
2822
|
+
} catch (err) {
|
|
2823
|
+
if (inDevelopment()) warnInvalidExpression(el, expression, expression, err);
|
|
2824
|
+
else handleError(err, "v-data");
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
return scope;
|
|
2828
|
+
}
|
|
2829
|
+
function walkElementDirectives(el, attrs, tagComponent, scope) {
|
|
2830
|
+
let current2 = scope;
|
|
2765
2831
|
for (const attr2 of attrs) {
|
|
2766
2832
|
const def = directives.get(attr2.name);
|
|
2767
2833
|
if (def?.terminal) {
|
|
@@ -2781,11 +2847,10 @@ function walk(node, scope) {
|
|
|
2781
2847
|
nodeScopes.set(el, current2);
|
|
2782
2848
|
}
|
|
2783
2849
|
} else if (dataAttr || componentAttr) {
|
|
2784
|
-
|
|
2785
|
-
current2 = current2.reactiveChild(raw && typeof raw === "object" ? raw : {}, el);
|
|
2850
|
+
current2 = createDataScope(dataAttr ? dataAttr.expression || "{}" : "{}", current2, el);
|
|
2786
2851
|
nodeScopes.set(el, current2);
|
|
2787
2852
|
}
|
|
2788
|
-
const attributeScope = mountedComponent ?
|
|
2853
|
+
const attributeScope = mountedComponent ? scope : current2;
|
|
2789
2854
|
for (const attr2 of attrs) {
|
|
2790
2855
|
if (attr2.name === "data" || attr2.name === "component") continue;
|
|
2791
2856
|
runDirective(el, attr2, attributeScope);
|
|
@@ -2941,9 +3006,9 @@ var started = false;
|
|
|
2941
3006
|
var observer = null;
|
|
2942
3007
|
var startHooks = [];
|
|
2943
3008
|
function runPhase(target, after) {
|
|
2944
|
-
for (const
|
|
3009
|
+
for (const hook2 of startHooks) {
|
|
2945
3010
|
try {
|
|
2946
|
-
|
|
3011
|
+
hook2(target, after);
|
|
2947
3012
|
} catch (error) {
|
|
2948
3013
|
console.error("[Voodoo] a start hook failed", error);
|
|
2949
3014
|
}
|
|
@@ -3321,10 +3386,10 @@ var LIFECYCLE = /* @__PURE__ */ new Set([
|
|
|
3321
3386
|
"destroyed"
|
|
3322
3387
|
]);
|
|
3323
3388
|
function callHook(def, instance, name) {
|
|
3324
|
-
const
|
|
3325
|
-
if (typeof
|
|
3389
|
+
const hook2 = def[name];
|
|
3390
|
+
if (typeof hook2 !== "function") return;
|
|
3326
3391
|
try {
|
|
3327
|
-
|
|
3392
|
+
hook2.call(instance);
|
|
3328
3393
|
} catch (err) {
|
|
3329
3394
|
handleError(err, `hook ${name}`);
|
|
3330
3395
|
}
|
|
@@ -4761,6 +4826,7 @@ var toast = Object.assign(
|
|
|
4761
4826
|
);
|
|
4762
4827
|
|
|
4763
4828
|
// src/storage/index.ts
|
|
4829
|
+
init_reactivity();
|
|
4764
4830
|
function createStorage(getStore, prefix = "") {
|
|
4765
4831
|
const full = (key) => prefix + key;
|
|
4766
4832
|
return {
|
|
@@ -4930,21 +4996,28 @@ var cache2 = {
|
|
|
4930
4996
|
};
|
|
4931
4997
|
var THEME_KEY = "voodoo:theme";
|
|
4932
4998
|
var picked = null;
|
|
4999
|
+
var revision = ref(0);
|
|
4933
5000
|
var theme = {
|
|
4934
5001
|
/** Theme chosen by the user, or `system` when never set. */
|
|
4935
5002
|
get current() {
|
|
5003
|
+
void revision.value;
|
|
4936
5004
|
return storage.get(THEME_KEY) ?? picked ?? "system";
|
|
4937
5005
|
},
|
|
4938
5006
|
/** Theme effectively applied, resolving `system`. */
|
|
4939
5007
|
get resolved() {
|
|
4940
5008
|
const value = this.current;
|
|
4941
5009
|
if (value !== "system") return value;
|
|
5010
|
+
if (typeof document !== "undefined") {
|
|
5011
|
+
const authored = document.documentElement.getAttribute("data-theme");
|
|
5012
|
+
if (authored === "light" || authored === "dark") return authored;
|
|
5013
|
+
}
|
|
4942
5014
|
if (typeof matchMedia === "undefined") return "light";
|
|
4943
5015
|
return matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
4944
5016
|
},
|
|
4945
5017
|
set(value) {
|
|
4946
5018
|
picked = value;
|
|
4947
5019
|
storage.set(THEME_KEY, value);
|
|
5020
|
+
revision.value++;
|
|
4948
5021
|
this.apply();
|
|
4949
5022
|
},
|
|
4950
5023
|
toggle() {
|
|
@@ -4978,8 +5051,17 @@ var theme = {
|
|
|
4978
5051
|
init() {
|
|
4979
5052
|
if (typeof document === "undefined") return;
|
|
4980
5053
|
this.apply();
|
|
5054
|
+
if (typeof MutationObserver !== "undefined") {
|
|
5055
|
+
new MutationObserver(() => {
|
|
5056
|
+
revision.value++;
|
|
5057
|
+
}).observe(document.documentElement, {
|
|
5058
|
+
attributes: true,
|
|
5059
|
+
attributeFilter: ["data-theme"]
|
|
5060
|
+
});
|
|
5061
|
+
}
|
|
4981
5062
|
if (typeof matchMedia === "undefined") return;
|
|
4982
5063
|
matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
5064
|
+
revision.value++;
|
|
4983
5065
|
if (this.current === "system") this.apply();
|
|
4984
5066
|
});
|
|
4985
5067
|
}
|
|
@@ -5112,6 +5194,140 @@ function installMagics() {
|
|
|
5112
5194
|
);
|
|
5113
5195
|
}
|
|
5114
5196
|
|
|
5197
|
+
// src/hooks/index.ts
|
|
5198
|
+
init_reactivity();
|
|
5199
|
+
var tables = /* @__PURE__ */ new WeakMap();
|
|
5200
|
+
function tableFor(scope) {
|
|
5201
|
+
const host = currentHookHost() ?? scope.el ?? scope;
|
|
5202
|
+
let table = tables.get(host);
|
|
5203
|
+
if (!table) {
|
|
5204
|
+
table = { slots: [], index: 0, scheduled: false, bound: false };
|
|
5205
|
+
tables.set(host, table);
|
|
5206
|
+
}
|
|
5207
|
+
const el = currentHookHost() ?? scope.el;
|
|
5208
|
+
if (!table.bound && el) {
|
|
5209
|
+
table.bound = true;
|
|
5210
|
+
const owned = table;
|
|
5211
|
+
addCleanup(el, () => {
|
|
5212
|
+
for (const slot of owned.slots) {
|
|
5213
|
+
if (slot.dispose) slot.dispose();
|
|
5214
|
+
if (slot.runner) stop(slot.runner);
|
|
5215
|
+
}
|
|
5216
|
+
owned.slots.length = 0;
|
|
5217
|
+
});
|
|
5218
|
+
}
|
|
5219
|
+
if (!table.scheduled) {
|
|
5220
|
+
table.scheduled = true;
|
|
5221
|
+
const pending = table;
|
|
5222
|
+
queueMicrotask(() => {
|
|
5223
|
+
pending.index = 0;
|
|
5224
|
+
pending.scheduled = false;
|
|
5225
|
+
});
|
|
5226
|
+
}
|
|
5227
|
+
return table;
|
|
5228
|
+
}
|
|
5229
|
+
function nextSlot(scope, kind) {
|
|
5230
|
+
const table = tableFor(scope);
|
|
5231
|
+
const at = table.index++;
|
|
5232
|
+
let slot = table.slots[at];
|
|
5233
|
+
if (!slot || slot.kind !== kind) {
|
|
5234
|
+
if (slot) {
|
|
5235
|
+
if (slot.dispose) slot.dispose();
|
|
5236
|
+
if (slot.runner) stop(slot.runner);
|
|
5237
|
+
}
|
|
5238
|
+
slot = { kind, deps: null, value: void 0 };
|
|
5239
|
+
table.slots[at] = slot;
|
|
5240
|
+
}
|
|
5241
|
+
return slot;
|
|
5242
|
+
}
|
|
5243
|
+
function depsChanged(previous, next) {
|
|
5244
|
+
if (!previous || !next) return true;
|
|
5245
|
+
if (previous.length !== next.length) return true;
|
|
5246
|
+
for (let i = 0; i < next.length; i++) {
|
|
5247
|
+
if (!Object.is(previous[i], next[i])) return true;
|
|
5248
|
+
}
|
|
5249
|
+
return false;
|
|
5250
|
+
}
|
|
5251
|
+
function normalizeDeps(deps) {
|
|
5252
|
+
return Array.isArray(deps) ? deps.slice() : null;
|
|
5253
|
+
}
|
|
5254
|
+
function useState(scope, initial) {
|
|
5255
|
+
const slot = nextSlot(scope, "state");
|
|
5256
|
+
if (slot.value === void 0) slot.value = ref(initial);
|
|
5257
|
+
return slot.value;
|
|
5258
|
+
}
|
|
5259
|
+
function useEffect(scope, fn, deps) {
|
|
5260
|
+
const slot = nextSlot(scope, "effect");
|
|
5261
|
+
const next = normalizeDeps(deps);
|
|
5262
|
+
const runCleanup = () => {
|
|
5263
|
+
if (slot.dispose) {
|
|
5264
|
+
const dispose = slot.dispose;
|
|
5265
|
+
slot.dispose = void 0;
|
|
5266
|
+
dispose();
|
|
5267
|
+
}
|
|
5268
|
+
};
|
|
5269
|
+
if (next) {
|
|
5270
|
+
const first = slot.deps === null && !slot.runner;
|
|
5271
|
+
if (first || depsChanged(slot.deps, next)) {
|
|
5272
|
+
slot.deps = next;
|
|
5273
|
+
runCleanup();
|
|
5274
|
+
const result = fn();
|
|
5275
|
+
if (typeof result === "function") slot.dispose = result;
|
|
5276
|
+
}
|
|
5277
|
+
return;
|
|
5278
|
+
}
|
|
5279
|
+
if (slot.runner) return;
|
|
5280
|
+
slot.deps = null;
|
|
5281
|
+
slot.runner = effect(() => {
|
|
5282
|
+
runCleanup();
|
|
5283
|
+
const result = fn();
|
|
5284
|
+
if (typeof result === "function") slot.dispose = result;
|
|
5285
|
+
});
|
|
5286
|
+
}
|
|
5287
|
+
function useMemo(scope, fn, deps) {
|
|
5288
|
+
const slot = nextSlot(scope, "memo");
|
|
5289
|
+
const next = normalizeDeps(deps);
|
|
5290
|
+
if (!next) {
|
|
5291
|
+
if (!slot.value) slot.value = computed(fn);
|
|
5292
|
+
return slot.value;
|
|
5293
|
+
}
|
|
5294
|
+
if (!slot.value) {
|
|
5295
|
+
slot.value = ref(fn());
|
|
5296
|
+
slot.deps = next;
|
|
5297
|
+
} else if (depsChanged(slot.deps, next)) {
|
|
5298
|
+
slot.deps = next;
|
|
5299
|
+
slot.value.value = fn();
|
|
5300
|
+
}
|
|
5301
|
+
return slot.value;
|
|
5302
|
+
}
|
|
5303
|
+
function useRef(scope, initial) {
|
|
5304
|
+
const slot = nextSlot(scope, "ref");
|
|
5305
|
+
if (!slot.value) slot.value = markRaw({ current: initial });
|
|
5306
|
+
return slot.value;
|
|
5307
|
+
}
|
|
5308
|
+
function useContext(name, initial) {
|
|
5309
|
+
if (initial !== void 0 && !(name in allStores)) {
|
|
5310
|
+
store(name, initial);
|
|
5311
|
+
}
|
|
5312
|
+
return allStores[name];
|
|
5313
|
+
}
|
|
5314
|
+
function installHooks() {
|
|
5315
|
+
hook("useState", (scope) => (initial) => useState(scope, initial));
|
|
5316
|
+
hook(
|
|
5317
|
+
"useEffect",
|
|
5318
|
+
(scope) => (fn, deps) => useEffect(scope, fn, deps)
|
|
5319
|
+
);
|
|
5320
|
+
hook(
|
|
5321
|
+
"useMemo",
|
|
5322
|
+
(scope) => (fn, deps) => useMemo(scope, fn, deps)
|
|
5323
|
+
);
|
|
5324
|
+
hook("useRef", (scope) => (initial) => useRef(scope, initial));
|
|
5325
|
+
hook(
|
|
5326
|
+
"useContext",
|
|
5327
|
+
() => (name, initial) => useContext(name, initial)
|
|
5328
|
+
);
|
|
5329
|
+
}
|
|
5330
|
+
|
|
5115
5331
|
// src/http/resource.ts
|
|
5116
5332
|
init_reactivity();
|
|
5117
5333
|
function pick(value, path) {
|
|
@@ -6694,6 +6910,7 @@ setComponentMounter(mountComponent);
|
|
|
6694
6910
|
setScopeMarker(markNodeScope);
|
|
6695
6911
|
setDirectiveRegistrar(directive);
|
|
6696
6912
|
installMagics();
|
|
6913
|
+
installHooks();
|
|
6697
6914
|
var eventBus = /* @__PURE__ */ new Map();
|
|
6698
6915
|
function on(name, handler) {
|
|
6699
6916
|
let set2 = eventBus.get(name);
|
|
@@ -6727,7 +6944,7 @@ function off(name, handler) {
|
|
|
6727
6944
|
eventBus.get(name)?.delete(handler);
|
|
6728
6945
|
}
|
|
6729
6946
|
function directive(name, definition) {
|
|
6730
|
-
const
|
|
6947
|
+
const hooks2 = typeof definition === "function" ? { mounted: definition, updated: definition } : definition;
|
|
6731
6948
|
defineDirective(
|
|
6732
6949
|
name,
|
|
6733
6950
|
(ctx) => {
|
|
@@ -6743,36 +6960,36 @@ function directive(name, definition) {
|
|
|
6743
6960
|
scope: ctx.scope,
|
|
6744
6961
|
instance: ctx.scope.owner?.component ?? null
|
|
6745
6962
|
});
|
|
6746
|
-
const initial =
|
|
6747
|
-
|
|
6748
|
-
|
|
6963
|
+
const initial = hooks2.raw ? ctx.expression : ctx.evaluate();
|
|
6964
|
+
hooks2.created?.(ctx.el, makeBinding(initial));
|
|
6965
|
+
hooks2.beforeMount?.(ctx.el, makeBinding(initial));
|
|
6749
6966
|
ctx.effect(() => {
|
|
6750
|
-
const value =
|
|
6967
|
+
const value = hooks2.raw ? ctx.expression : ctx.evaluate();
|
|
6751
6968
|
if (!mounted) {
|
|
6752
6969
|
mounted = true;
|
|
6753
6970
|
oldValue = value;
|
|
6754
|
-
|
|
6971
|
+
hooks2.mounted?.(ctx.el, makeBinding(value));
|
|
6755
6972
|
return;
|
|
6756
6973
|
}
|
|
6757
6974
|
if (value === oldValue) return;
|
|
6758
6975
|
const binding = makeBinding(value);
|
|
6759
|
-
|
|
6976
|
+
hooks2.updated?.(ctx.el, binding);
|
|
6760
6977
|
oldValue = value;
|
|
6761
6978
|
});
|
|
6762
6979
|
ctx.cleanup(() => {
|
|
6763
6980
|
const binding = makeBinding(oldValue);
|
|
6764
|
-
|
|
6765
|
-
|
|
6981
|
+
hooks2.beforeUnmount?.(ctx.el, binding);
|
|
6982
|
+
hooks2.unmounted?.(ctx.el, binding);
|
|
6766
6983
|
});
|
|
6767
6984
|
},
|
|
6768
|
-
{ priority:
|
|
6985
|
+
{ priority: hooks2.priority ?? PRIORITY.DEFAULT, terminal: hooks2.terminal ?? false }
|
|
6769
6986
|
);
|
|
6770
6987
|
}
|
|
6771
6988
|
function data(values) {
|
|
6772
6989
|
Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
|
|
6773
6990
|
return rootScope.data;
|
|
6774
6991
|
}
|
|
6775
|
-
var version2 = "0.
|
|
6992
|
+
var version2 = "0.12.1";
|
|
6776
6993
|
var core = {
|
|
6777
6994
|
// Utilities first: Voodoo's own names can override.
|
|
6778
6995
|
...utils_exports,
|
|
@@ -12205,12 +12422,15 @@ magic("$history", (scope) => scope.el ? findController(scope.el) : null);
|
|
|
12205
12422
|
|
|
12206
12423
|
// src/sound/index.ts
|
|
12207
12424
|
init_registry();
|
|
12425
|
+
init_reactivity();
|
|
12426
|
+
init_style();
|
|
12208
12427
|
var audioContext = null;
|
|
12209
12428
|
var masterVolume = 0.35;
|
|
12210
12429
|
var isMuted = false;
|
|
12211
12430
|
var hasLoadedPreference = false;
|
|
12212
12431
|
var VOLUME_KEY = "voodoo:sound:volume";
|
|
12213
12432
|
var MUTE_KEY = "voodoo:sound:muted";
|
|
12433
|
+
var muteRevision = ref(0);
|
|
12214
12434
|
function loadPreference() {
|
|
12215
12435
|
if (hasLoadedPreference) return;
|
|
12216
12436
|
hasLoadedPreference = true;
|
|
@@ -12522,6 +12742,7 @@ var sound = {
|
|
|
12522
12742
|
loadPreference();
|
|
12523
12743
|
isMuted = value;
|
|
12524
12744
|
storage.set(MUTE_KEY, isMuted);
|
|
12745
|
+
muteRevision.value++;
|
|
12525
12746
|
},
|
|
12526
12747
|
/** Unmutes sound. */
|
|
12527
12748
|
unmute() {
|
|
@@ -12533,8 +12754,18 @@ var sound = {
|
|
|
12533
12754
|
this.mute(!isMuted);
|
|
12534
12755
|
return isMuted;
|
|
12535
12756
|
},
|
|
12536
|
-
/**
|
|
12757
|
+
/**
|
|
12758
|
+
* `true` when muted.
|
|
12759
|
+
*
|
|
12760
|
+
* Reads a revision ref first, so that an expression asking whether sound is
|
|
12761
|
+
* muted actually re-runs when it changes. The state lives in a module
|
|
12762
|
+
* variable and in localStorage, both invisible to the Proxy, so
|
|
12763
|
+
* `v-show="$sound.muted"` used to render once and then never move: a page had
|
|
12764
|
+
* no way to show whether it was muted, which made the mute button look like
|
|
12765
|
+
* it did nothing at all.
|
|
12766
|
+
*/
|
|
12537
12767
|
get muted() {
|
|
12768
|
+
void muteRevision.value;
|
|
12538
12769
|
loadPreference();
|
|
12539
12770
|
return isMuted;
|
|
12540
12771
|
},
|
|
@@ -12584,11 +12815,18 @@ defineDirective("sound", ({ el, arg, expression, modifiers, scope, cleanup, eval
|
|
|
12584
12815
|
el.addEventListener(event, play);
|
|
12585
12816
|
cleanup(() => el.removeEventListener(event, play));
|
|
12586
12817
|
});
|
|
12818
|
+
var MUTE_CSS = `
|
|
12819
|
+
.v-muted{opacity:.55}
|
|
12820
|
+
.v-muted::after{content:" \\1F507";font-size:.9em}
|
|
12821
|
+
.v-mute-on::after{content:" \\1F50A";font-size:.9em}
|
|
12822
|
+
`;
|
|
12587
12823
|
defineDirective("mute", ({ el, cleanup }) => {
|
|
12824
|
+
injectStyle("mute", MUTE_CSS);
|
|
12588
12825
|
const sync = () => {
|
|
12589
12826
|
const isMuted2 = sound.muted;
|
|
12590
12827
|
el.setAttribute("aria-pressed", String(isMuted2));
|
|
12591
12828
|
el.classList.toggle("v-muted", isMuted2);
|
|
12829
|
+
el.classList.toggle("v-mute-on", !isMuted2);
|
|
12592
12830
|
};
|
|
12593
12831
|
const toggle = () => {
|
|
12594
12832
|
sound.toggle();
|
package/dist/essential.d.cts
CHANGED
package/dist/essential.d.ts
CHANGED
package/dist/essential.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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 } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import { magic } from './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
-
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 } from './chunk-RDHYPGH6.js';
|
|
2
|
+
import './chunk-D7675IJG.js';
|
|
3
|
+
import { magic } from './chunk-4M4ZXHNY.js';
|
|
4
|
+
import './chunk-LLNDLLKV.js';
|
|
5
|
+
import './chunk-72PMUUMT.js';
|
|
6
|
+
import './chunk-KN7NAKBL.js';
|
|
7
|
+
import './chunk-NP66JM2P.js';
|
|
8
|
+
import './chunk-T5ION5NG.js';
|
|
9
|
+
import './chunk-GXPNWCGE.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Voodoo.js v0.
|
|
12
|
+
* Voodoo.js v0.12.1
|
|
13
13
|
* JavaScript feels like magic.
|
|
14
14
|
* (c) 2026 Voodoo.js contributors. MIT License.
|
|
15
15
|
*/
|
package/dist/gpu.cjs
CHANGED
package/dist/gpu.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { supported, clock, shared, gpu, surface, effect, frameLoop, frame } from './chunk-
|
|
2
|
-
export { clock, compute, describeWgslType, destroy, effect, findEntry, flattenValue, frame, frameLoop, gpu, inferStruct, init, packStruct, reflectBindings, reflectEntries, reflectStructs, reflectWgsl, resetShared, shared, splitTopLevel, stripWgslComments, supported, surface, target, uniforms, writeField, writeStruct } from './chunk-
|
|
3
|
-
import { http } from './chunk-
|
|
4
|
-
import { originalAttributes, destroy } from './chunk-
|
|
5
|
-
import { handleError } from './chunk-
|
|
6
|
-
import { warn, describeElement } from './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import { defineDirective } from './chunk-
|
|
9
|
-
import './chunk-
|
|
1
|
+
import { supported, clock, shared, gpu, surface, effect, frameLoop, frame } from './chunk-AFMCDNYS.js';
|
|
2
|
+
export { clock, compute, describeWgslType, destroy, effect, findEntry, flattenValue, frame, frameLoop, gpu, inferStruct, init, packStruct, reflectBindings, reflectEntries, reflectStructs, reflectWgsl, resetShared, shared, splitTopLevel, stripWgslComments, supported, surface, target, uniforms, writeField, writeStruct } from './chunk-AFMCDNYS.js';
|
|
3
|
+
import { http } from './chunk-D7675IJG.js';
|
|
4
|
+
import { originalAttributes, destroy } from './chunk-4M4ZXHNY.js';
|
|
5
|
+
import { handleError } from './chunk-LLNDLLKV.js';
|
|
6
|
+
import { warn, describeElement } from './chunk-72PMUUMT.js';
|
|
7
|
+
import './chunk-KN7NAKBL.js';
|
|
8
|
+
import { defineDirective } from './chunk-T5ION5NG.js';
|
|
9
|
+
import './chunk-GXPNWCGE.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Voodoo.js v0.
|
|
12
|
+
* Voodoo.js v0.12.1
|
|
13
13
|
* JavaScript feels like magic.
|
|
14
14
|
* (c) 2026 Voodoo.js contributors. MIT License.
|
|
15
15
|
*/
|
package/dist/http.cjs
CHANGED
package/dist/http.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { HttpError, clearCache, flushOfflineQueue, http, request } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
1
|
+
export { HttpError, clearCache, flushOfflineQueue, http, request } from './chunk-D7675IJG.js';
|
|
2
|
+
import './chunk-72PMUUMT.js';
|
|
3
|
+
import './chunk-KN7NAKBL.js';
|
|
4
|
+
import './chunk-T5ION5NG.js';
|
|
5
|
+
import './chunk-GXPNWCGE.js';
|
|
6
6
|
//# sourceMappingURL=http.js.map
|
|
7
7
|
//# sourceMappingURL=http.js.map
|