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/voodoo.full.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Voodoo.js v0.
|
|
2
|
+
* Voodoo.js v0.12.1
|
|
3
3
|
* JavaScript feels like magic.
|
|
4
4
|
* (c) 2026 Voodoo.js contributors. MIT License.
|
|
5
5
|
*/
|
|
@@ -2263,6 +2263,10 @@ Expression: ${expression}` : message);
|
|
|
2263
2263
|
function magic(name, getter) {
|
|
2264
2264
|
magics.set(name.startsWith("$") ? name : `$${name}`, getter);
|
|
2265
2265
|
}
|
|
2266
|
+
var hooks = /* @__PURE__ */ new Map();
|
|
2267
|
+
function hook(name, getter) {
|
|
2268
|
+
hooks.set(name, getter);
|
|
2269
|
+
}
|
|
2266
2270
|
var Scope = class _Scope {
|
|
2267
2271
|
// Assignment order matches the order the fields were declared in before, so
|
|
2268
2272
|
// the properties are created in the same sequence they always were.
|
|
@@ -2318,7 +2322,10 @@ Expression: ${expression}` : message);
|
|
|
2318
2322
|
s = s.parent;
|
|
2319
2323
|
}
|
|
2320
2324
|
if (name.charCodeAt(0) === 36 && magics.has(name)) {
|
|
2321
|
-
return this.magicContainer(name);
|
|
2325
|
+
return this.magicContainer(name, magics);
|
|
2326
|
+
}
|
|
2327
|
+
if (hooks.has(name)) {
|
|
2328
|
+
return this.magicContainer(name, hooks);
|
|
2322
2329
|
}
|
|
2323
2330
|
return void 0;
|
|
2324
2331
|
}
|
|
@@ -2347,11 +2354,11 @@ Expression: ${expression}` : message);
|
|
|
2347
2354
|
reactiveChild(vars, el = null) {
|
|
2348
2355
|
return new _Scope(reactive(vars), this, el != null ? el : this.el);
|
|
2349
2356
|
}
|
|
2350
|
-
magicContainer(name) {
|
|
2357
|
+
magicContainer(name, registry) {
|
|
2351
2358
|
if (!this.magicCache) this.magicCache = /* @__PURE__ */ new Map();
|
|
2352
2359
|
const cached = this.magicCache.get(name);
|
|
2353
2360
|
if (cached) return cached;
|
|
2354
|
-
const getter =
|
|
2361
|
+
const getter = registry.get(name);
|
|
2355
2362
|
const scope = this;
|
|
2356
2363
|
const container2 = {};
|
|
2357
2364
|
Object.defineProperty(container2, name, {
|
|
@@ -2753,7 +2760,16 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
2753
2760
|
},
|
|
2754
2761
|
effect(fn) {
|
|
2755
2762
|
const owner = ownerScope();
|
|
2756
|
-
|
|
2763
|
+
const hosted = () => {
|
|
2764
|
+
const previous = hookHost;
|
|
2765
|
+
hookHost = el;
|
|
2766
|
+
try {
|
|
2767
|
+
fn();
|
|
2768
|
+
} finally {
|
|
2769
|
+
hookHost = previous;
|
|
2770
|
+
}
|
|
2771
|
+
};
|
|
2772
|
+
owner.run(() => effect(hosted, { scope: owner }));
|
|
2757
2773
|
},
|
|
2758
2774
|
cleanup(fn) {
|
|
2759
2775
|
addCleanup(el, fn);
|
|
@@ -2801,6 +2817,56 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
2801
2817
|
return;
|
|
2802
2818
|
}
|
|
2803
2819
|
initialized.add(el);
|
|
2820
|
+
const previousHost = hookHost;
|
|
2821
|
+
hookHost = el;
|
|
2822
|
+
try {
|
|
2823
|
+
walkElementDirectives(el, attrs, tagComponent, current2);
|
|
2824
|
+
} finally {
|
|
2825
|
+
hookHost = previousHost;
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
var hookHost = null;
|
|
2829
|
+
function currentHookHost() {
|
|
2830
|
+
return hookHost;
|
|
2831
|
+
}
|
|
2832
|
+
function createDataScope(expression, parent, el) {
|
|
2833
|
+
let ast = null;
|
|
2834
|
+
try {
|
|
2835
|
+
ast = parse(expression);
|
|
2836
|
+
} catch (e) {
|
|
2837
|
+
ast = null;
|
|
2838
|
+
}
|
|
2839
|
+
const plain = ast && ast.t === "obj" && ast.props.every(
|
|
2840
|
+
(p2) => !p2.spread && !p2.keyExpr
|
|
2841
|
+
);
|
|
2842
|
+
if (!plain) {
|
|
2843
|
+
const raw = evaluateIn(expression, parent, "v-data");
|
|
2844
|
+
return parent.reactiveChild(raw && typeof raw === "object" ? raw : {}, el);
|
|
2845
|
+
}
|
|
2846
|
+
const scope = parent.reactiveChild({}, el);
|
|
2847
|
+
const props = ast.props;
|
|
2848
|
+
for (const prop of props) {
|
|
2849
|
+
if (prop.key === null) continue;
|
|
2850
|
+
try {
|
|
2851
|
+
if (prop.getter) {
|
|
2852
|
+
const compute = evaluate(prop.value, scope);
|
|
2853
|
+
Object.defineProperty(scope.data, prop.key, {
|
|
2854
|
+
enumerable: true,
|
|
2855
|
+
configurable: true,
|
|
2856
|
+
get: () => compute.call(scope.data)
|
|
2857
|
+
});
|
|
2858
|
+
} else {
|
|
2859
|
+
scope.data[prop.key] = evaluate(prop.value, scope);
|
|
2860
|
+
}
|
|
2861
|
+
} catch (err) {
|
|
2862
|
+
if (inDevelopment()) warnInvalidExpression(el, expression, expression, err);
|
|
2863
|
+
else handleError(err, "v-data");
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
return scope;
|
|
2867
|
+
}
|
|
2868
|
+
function walkElementDirectives(el, attrs, tagComponent, scope) {
|
|
2869
|
+
let current2 = scope;
|
|
2804
2870
|
for (const attr2 of attrs) {
|
|
2805
2871
|
const def = directives.get(attr2.name);
|
|
2806
2872
|
if (def == null ? void 0 : def.terminal) {
|
|
@@ -2820,11 +2886,10 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
2820
2886
|
nodeScopes.set(el, current2);
|
|
2821
2887
|
}
|
|
2822
2888
|
} else if (dataAttr || componentAttr) {
|
|
2823
|
-
|
|
2824
|
-
current2 = current2.reactiveChild(raw && typeof raw === "object" ? raw : {}, el);
|
|
2889
|
+
current2 = createDataScope(dataAttr ? dataAttr.expression || "{}" : "{}", current2, el);
|
|
2825
2890
|
nodeScopes.set(el, current2);
|
|
2826
2891
|
}
|
|
2827
|
-
const attributeScope = mountedComponent ?
|
|
2892
|
+
const attributeScope = mountedComponent ? scope : current2;
|
|
2828
2893
|
for (const attr2 of attrs) {
|
|
2829
2894
|
if (attr2.name === "data" || attr2.name === "component") continue;
|
|
2830
2895
|
runDirective(el, attr2, attributeScope);
|
|
@@ -2980,13 +3045,13 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
2980
3045
|
var started = false;
|
|
2981
3046
|
var observer = null;
|
|
2982
3047
|
var startHooks = [];
|
|
2983
|
-
function onStart(
|
|
2984
|
-
startHooks.push(
|
|
3048
|
+
function onStart(hook2) {
|
|
3049
|
+
startHooks.push(hook2);
|
|
2985
3050
|
}
|
|
2986
3051
|
function runPhase(target, after) {
|
|
2987
|
-
for (const
|
|
3052
|
+
for (const hook2 of startHooks) {
|
|
2988
3053
|
try {
|
|
2989
|
-
|
|
3054
|
+
hook2(target, after);
|
|
2990
3055
|
} catch (error) {
|
|
2991
3056
|
console.error("[Voodoo] a start hook failed", error);
|
|
2992
3057
|
}
|
|
@@ -3370,10 +3435,10 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
3370
3435
|
"destroyed"
|
|
3371
3436
|
]);
|
|
3372
3437
|
function callHook(def, instance, name) {
|
|
3373
|
-
const
|
|
3374
|
-
if (typeof
|
|
3438
|
+
const hook2 = def[name];
|
|
3439
|
+
if (typeof hook2 !== "function") return;
|
|
3375
3440
|
try {
|
|
3376
|
-
|
|
3441
|
+
hook2.call(instance);
|
|
3377
3442
|
} catch (err) {
|
|
3378
3443
|
handleError(err, `hook ${name}`);
|
|
3379
3444
|
}
|
|
@@ -4832,6 +4897,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
4832
4897
|
);
|
|
4833
4898
|
|
|
4834
4899
|
// src/storage/index.ts
|
|
4900
|
+
init_reactivity();
|
|
4835
4901
|
function createStorage(getStore, prefix = "") {
|
|
4836
4902
|
const full = (key) => prefix + key;
|
|
4837
4903
|
return {
|
|
@@ -5007,22 +5073,29 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
5007
5073
|
};
|
|
5008
5074
|
var THEME_KEY = "voodoo:theme";
|
|
5009
5075
|
var picked = null;
|
|
5076
|
+
var revision = ref(0);
|
|
5010
5077
|
var theme = {
|
|
5011
5078
|
/** Theme chosen by the user, or `system` when never set. */
|
|
5012
5079
|
get current() {
|
|
5013
5080
|
var _a2, _b;
|
|
5081
|
+
void revision.value;
|
|
5014
5082
|
return (_b = (_a2 = storage.get(THEME_KEY)) != null ? _a2 : picked) != null ? _b : "system";
|
|
5015
5083
|
},
|
|
5016
5084
|
/** Theme effectively applied, resolving `system`. */
|
|
5017
5085
|
get resolved() {
|
|
5018
5086
|
const value = this.current;
|
|
5019
5087
|
if (value !== "system") return value;
|
|
5088
|
+
if (typeof document !== "undefined") {
|
|
5089
|
+
const authored = document.documentElement.getAttribute("data-theme");
|
|
5090
|
+
if (authored === "light" || authored === "dark") return authored;
|
|
5091
|
+
}
|
|
5020
5092
|
if (typeof matchMedia === "undefined") return "light";
|
|
5021
5093
|
return matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
5022
5094
|
},
|
|
5023
5095
|
set(value) {
|
|
5024
5096
|
picked = value;
|
|
5025
5097
|
storage.set(THEME_KEY, value);
|
|
5098
|
+
revision.value++;
|
|
5026
5099
|
this.apply();
|
|
5027
5100
|
},
|
|
5028
5101
|
toggle() {
|
|
@@ -5056,8 +5129,17 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
5056
5129
|
init() {
|
|
5057
5130
|
if (typeof document === "undefined") return;
|
|
5058
5131
|
this.apply();
|
|
5132
|
+
if (typeof MutationObserver !== "undefined") {
|
|
5133
|
+
new MutationObserver(() => {
|
|
5134
|
+
revision.value++;
|
|
5135
|
+
}).observe(document.documentElement, {
|
|
5136
|
+
attributes: true,
|
|
5137
|
+
attributeFilter: ["data-theme"]
|
|
5138
|
+
});
|
|
5139
|
+
}
|
|
5059
5140
|
if (typeof matchMedia === "undefined") return;
|
|
5060
5141
|
matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
5142
|
+
revision.value++;
|
|
5061
5143
|
if (this.current === "system") this.apply();
|
|
5062
5144
|
});
|
|
5063
5145
|
}
|
|
@@ -5201,6 +5283,141 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
5201
5283
|
);
|
|
5202
5284
|
}
|
|
5203
5285
|
|
|
5286
|
+
// src/hooks/index.ts
|
|
5287
|
+
init_reactivity();
|
|
5288
|
+
var tables = /* @__PURE__ */ new WeakMap();
|
|
5289
|
+
function tableFor(scope) {
|
|
5290
|
+
var _a2, _b, _c;
|
|
5291
|
+
const host = (_b = (_a2 = currentHookHost()) != null ? _a2 : scope.el) != null ? _b : scope;
|
|
5292
|
+
let table = tables.get(host);
|
|
5293
|
+
if (!table) {
|
|
5294
|
+
table = { slots: [], index: 0, scheduled: false, bound: false };
|
|
5295
|
+
tables.set(host, table);
|
|
5296
|
+
}
|
|
5297
|
+
const el = (_c = currentHookHost()) != null ? _c : scope.el;
|
|
5298
|
+
if (!table.bound && el) {
|
|
5299
|
+
table.bound = true;
|
|
5300
|
+
const owned = table;
|
|
5301
|
+
addCleanup(el, () => {
|
|
5302
|
+
for (const slot of owned.slots) {
|
|
5303
|
+
if (slot.dispose) slot.dispose();
|
|
5304
|
+
if (slot.runner) stop(slot.runner);
|
|
5305
|
+
}
|
|
5306
|
+
owned.slots.length = 0;
|
|
5307
|
+
});
|
|
5308
|
+
}
|
|
5309
|
+
if (!table.scheduled) {
|
|
5310
|
+
table.scheduled = true;
|
|
5311
|
+
const pending2 = table;
|
|
5312
|
+
queueMicrotask(() => {
|
|
5313
|
+
pending2.index = 0;
|
|
5314
|
+
pending2.scheduled = false;
|
|
5315
|
+
});
|
|
5316
|
+
}
|
|
5317
|
+
return table;
|
|
5318
|
+
}
|
|
5319
|
+
function nextSlot(scope, kind) {
|
|
5320
|
+
const table = tableFor(scope);
|
|
5321
|
+
const at = table.index++;
|
|
5322
|
+
let slot = table.slots[at];
|
|
5323
|
+
if (!slot || slot.kind !== kind) {
|
|
5324
|
+
if (slot) {
|
|
5325
|
+
if (slot.dispose) slot.dispose();
|
|
5326
|
+
if (slot.runner) stop(slot.runner);
|
|
5327
|
+
}
|
|
5328
|
+
slot = { kind, deps: null, value: void 0 };
|
|
5329
|
+
table.slots[at] = slot;
|
|
5330
|
+
}
|
|
5331
|
+
return slot;
|
|
5332
|
+
}
|
|
5333
|
+
function depsChanged(previous, next) {
|
|
5334
|
+
if (!previous || !next) return true;
|
|
5335
|
+
if (previous.length !== next.length) return true;
|
|
5336
|
+
for (let i = 0; i < next.length; i++) {
|
|
5337
|
+
if (!Object.is(previous[i], next[i])) return true;
|
|
5338
|
+
}
|
|
5339
|
+
return false;
|
|
5340
|
+
}
|
|
5341
|
+
function normalizeDeps(deps) {
|
|
5342
|
+
return Array.isArray(deps) ? deps.slice() : null;
|
|
5343
|
+
}
|
|
5344
|
+
function useState(scope, initial) {
|
|
5345
|
+
const slot = nextSlot(scope, "state");
|
|
5346
|
+
if (slot.value === void 0) slot.value = ref(initial);
|
|
5347
|
+
return slot.value;
|
|
5348
|
+
}
|
|
5349
|
+
function useEffect(scope, fn, deps) {
|
|
5350
|
+
const slot = nextSlot(scope, "effect");
|
|
5351
|
+
const next = normalizeDeps(deps);
|
|
5352
|
+
const runCleanup = () => {
|
|
5353
|
+
if (slot.dispose) {
|
|
5354
|
+
const dispose = slot.dispose;
|
|
5355
|
+
slot.dispose = void 0;
|
|
5356
|
+
dispose();
|
|
5357
|
+
}
|
|
5358
|
+
};
|
|
5359
|
+
if (next) {
|
|
5360
|
+
const first = slot.deps === null && !slot.runner;
|
|
5361
|
+
if (first || depsChanged(slot.deps, next)) {
|
|
5362
|
+
slot.deps = next;
|
|
5363
|
+
runCleanup();
|
|
5364
|
+
const result = fn();
|
|
5365
|
+
if (typeof result === "function") slot.dispose = result;
|
|
5366
|
+
}
|
|
5367
|
+
return;
|
|
5368
|
+
}
|
|
5369
|
+
if (slot.runner) return;
|
|
5370
|
+
slot.deps = null;
|
|
5371
|
+
slot.runner = effect(() => {
|
|
5372
|
+
runCleanup();
|
|
5373
|
+
const result = fn();
|
|
5374
|
+
if (typeof result === "function") slot.dispose = result;
|
|
5375
|
+
});
|
|
5376
|
+
}
|
|
5377
|
+
function useMemo(scope, fn, deps) {
|
|
5378
|
+
const slot = nextSlot(scope, "memo");
|
|
5379
|
+
const next = normalizeDeps(deps);
|
|
5380
|
+
if (!next) {
|
|
5381
|
+
if (!slot.value) slot.value = computed(fn);
|
|
5382
|
+
return slot.value;
|
|
5383
|
+
}
|
|
5384
|
+
if (!slot.value) {
|
|
5385
|
+
slot.value = ref(fn());
|
|
5386
|
+
slot.deps = next;
|
|
5387
|
+
} else if (depsChanged(slot.deps, next)) {
|
|
5388
|
+
slot.deps = next;
|
|
5389
|
+
slot.value.value = fn();
|
|
5390
|
+
}
|
|
5391
|
+
return slot.value;
|
|
5392
|
+
}
|
|
5393
|
+
function useRef(scope, initial) {
|
|
5394
|
+
const slot = nextSlot(scope, "ref");
|
|
5395
|
+
if (!slot.value) slot.value = markRaw({ current: initial });
|
|
5396
|
+
return slot.value;
|
|
5397
|
+
}
|
|
5398
|
+
function useContext(name, initial) {
|
|
5399
|
+
if (initial !== void 0 && !(name in allStores)) {
|
|
5400
|
+
store(name, initial);
|
|
5401
|
+
}
|
|
5402
|
+
return allStores[name];
|
|
5403
|
+
}
|
|
5404
|
+
function installHooks() {
|
|
5405
|
+
hook("useState", (scope) => (initial) => useState(scope, initial));
|
|
5406
|
+
hook(
|
|
5407
|
+
"useEffect",
|
|
5408
|
+
(scope) => (fn, deps) => useEffect(scope, fn, deps)
|
|
5409
|
+
);
|
|
5410
|
+
hook(
|
|
5411
|
+
"useMemo",
|
|
5412
|
+
(scope) => (fn, deps) => useMemo(scope, fn, deps)
|
|
5413
|
+
);
|
|
5414
|
+
hook("useRef", (scope) => (initial) => useRef(scope, initial));
|
|
5415
|
+
hook(
|
|
5416
|
+
"useContext",
|
|
5417
|
+
() => (name, initial) => useContext(name, initial)
|
|
5418
|
+
);
|
|
5419
|
+
}
|
|
5420
|
+
|
|
5204
5421
|
// src/http/resource.ts
|
|
5205
5422
|
init_reactivity();
|
|
5206
5423
|
function pick(value, path) {
|
|
@@ -6805,6 +7022,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
6805
7022
|
setScopeMarker(markNodeScope);
|
|
6806
7023
|
setDirectiveRegistrar(directive);
|
|
6807
7024
|
installMagics();
|
|
7025
|
+
installHooks();
|
|
6808
7026
|
var eventBus = /* @__PURE__ */ new Map();
|
|
6809
7027
|
function on(name, handler) {
|
|
6810
7028
|
let set2 = eventBus.get(name);
|
|
@@ -6840,7 +7058,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
6840
7058
|
}
|
|
6841
7059
|
function directive(name, definition) {
|
|
6842
7060
|
var _a2, _b;
|
|
6843
|
-
const
|
|
7061
|
+
const hooks2 = typeof definition === "function" ? { mounted: definition, updated: definition } : definition;
|
|
6844
7062
|
defineDirective(
|
|
6845
7063
|
name,
|
|
6846
7064
|
(ctx) => {
|
|
@@ -6860,38 +7078,38 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
6860
7078
|
instance: (_b3 = (_a4 = ctx.scope.owner) == null ? void 0 : _a4.component) != null ? _b3 : null
|
|
6861
7079
|
};
|
|
6862
7080
|
};
|
|
6863
|
-
const initial =
|
|
6864
|
-
(_a3 =
|
|
6865
|
-
(_b2 =
|
|
7081
|
+
const initial = hooks2.raw ? ctx.expression : ctx.evaluate();
|
|
7082
|
+
(_a3 = hooks2.created) == null ? void 0 : _a3.call(hooks2, ctx.el, makeBinding(initial));
|
|
7083
|
+
(_b2 = hooks2.beforeMount) == null ? void 0 : _b2.call(hooks2, ctx.el, makeBinding(initial));
|
|
6866
7084
|
ctx.effect(() => {
|
|
6867
7085
|
var _a4, _b3;
|
|
6868
|
-
const value =
|
|
7086
|
+
const value = hooks2.raw ? ctx.expression : ctx.evaluate();
|
|
6869
7087
|
if (!mounted2) {
|
|
6870
7088
|
mounted2 = true;
|
|
6871
7089
|
oldValue = value;
|
|
6872
|
-
(_a4 =
|
|
7090
|
+
(_a4 = hooks2.mounted) == null ? void 0 : _a4.call(hooks2, ctx.el, makeBinding(value));
|
|
6873
7091
|
return;
|
|
6874
7092
|
}
|
|
6875
7093
|
if (value === oldValue) return;
|
|
6876
7094
|
const binding = makeBinding(value);
|
|
6877
|
-
(_b3 =
|
|
7095
|
+
(_b3 = hooks2.updated) == null ? void 0 : _b3.call(hooks2, ctx.el, binding);
|
|
6878
7096
|
oldValue = value;
|
|
6879
7097
|
});
|
|
6880
7098
|
ctx.cleanup(() => {
|
|
6881
7099
|
var _a4, _b3;
|
|
6882
7100
|
const binding = makeBinding(oldValue);
|
|
6883
|
-
(_a4 =
|
|
6884
|
-
(_b3 =
|
|
7101
|
+
(_a4 = hooks2.beforeUnmount) == null ? void 0 : _a4.call(hooks2, ctx.el, binding);
|
|
7102
|
+
(_b3 = hooks2.unmounted) == null ? void 0 : _b3.call(hooks2, ctx.el, binding);
|
|
6885
7103
|
});
|
|
6886
7104
|
},
|
|
6887
|
-
{ priority: (_a2 =
|
|
7105
|
+
{ priority: (_a2 = hooks2.priority) != null ? _a2 : PRIORITY.DEFAULT, terminal: (_b = hooks2.terminal) != null ? _b : false }
|
|
6888
7106
|
);
|
|
6889
7107
|
}
|
|
6890
7108
|
function data(values) {
|
|
6891
7109
|
Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
|
|
6892
7110
|
return rootScope.data;
|
|
6893
7111
|
}
|
|
6894
|
-
var version2 = "0.
|
|
7112
|
+
var version2 = "0.12.1";
|
|
6895
7113
|
var core = {
|
|
6896
7114
|
// Utilities first: Voodoo's own names can override.
|
|
6897
7115
|
...utils_exports,
|
|
@@ -13360,12 +13578,15 @@ form.v-loading [type="submit"],form.v-loading button[disabled]{opacity:.6}
|
|
|
13360
13578
|
|
|
13361
13579
|
// src/sound/index.ts
|
|
13362
13580
|
init_registry();
|
|
13581
|
+
init_reactivity();
|
|
13582
|
+
init_style();
|
|
13363
13583
|
var audioContext = null;
|
|
13364
13584
|
var masterVolume = 0.35;
|
|
13365
13585
|
var isMuted = false;
|
|
13366
13586
|
var hasLoadedPreference = false;
|
|
13367
13587
|
var VOLUME_KEY = "voodoo:sound:volume";
|
|
13368
13588
|
var MUTE_KEY = "voodoo:sound:muted";
|
|
13589
|
+
var muteRevision = ref(0);
|
|
13369
13590
|
function loadPreference() {
|
|
13370
13591
|
if (hasLoadedPreference) return;
|
|
13371
13592
|
hasLoadedPreference = true;
|
|
@@ -13681,6 +13902,7 @@ form.v-loading [type="submit"],form.v-loading button[disabled]{opacity:.6}
|
|
|
13681
13902
|
loadPreference();
|
|
13682
13903
|
isMuted = value;
|
|
13683
13904
|
storage.set(MUTE_KEY, isMuted);
|
|
13905
|
+
muteRevision.value++;
|
|
13684
13906
|
},
|
|
13685
13907
|
/** Unmutes sound. */
|
|
13686
13908
|
unmute() {
|
|
@@ -13692,8 +13914,18 @@ form.v-loading [type="submit"],form.v-loading button[disabled]{opacity:.6}
|
|
|
13692
13914
|
this.mute(!isMuted);
|
|
13693
13915
|
return isMuted;
|
|
13694
13916
|
},
|
|
13695
|
-
/**
|
|
13917
|
+
/**
|
|
13918
|
+
* `true` when muted.
|
|
13919
|
+
*
|
|
13920
|
+
* Reads a revision ref first, so that an expression asking whether sound is
|
|
13921
|
+
* muted actually re-runs when it changes. The state lives in a module
|
|
13922
|
+
* variable and in localStorage, both invisible to the Proxy, so
|
|
13923
|
+
* `v-show="$sound.muted"` used to render once and then never move: a page had
|
|
13924
|
+
* no way to show whether it was muted, which made the mute button look like
|
|
13925
|
+
* it did nothing at all.
|
|
13926
|
+
*/
|
|
13696
13927
|
get muted() {
|
|
13928
|
+
void muteRevision.value;
|
|
13697
13929
|
loadPreference();
|
|
13698
13930
|
return isMuted;
|
|
13699
13931
|
},
|
|
@@ -13744,11 +13976,18 @@ form.v-loading [type="submit"],form.v-loading button[disabled]{opacity:.6}
|
|
|
13744
13976
|
cleanup(() => el.removeEventListener(event, play));
|
|
13745
13977
|
void scope;
|
|
13746
13978
|
});
|
|
13979
|
+
var MUTE_CSS = `
|
|
13980
|
+
.v-muted{opacity:.55}
|
|
13981
|
+
.v-muted::after{content:" \\1F507";font-size:.9em}
|
|
13982
|
+
.v-mute-on::after{content:" \\1F50A";font-size:.9em}
|
|
13983
|
+
`;
|
|
13747
13984
|
defineDirective("mute", ({ el, cleanup }) => {
|
|
13985
|
+
injectStyle("mute", MUTE_CSS);
|
|
13748
13986
|
const sync = () => {
|
|
13749
13987
|
const isMuted2 = sound.muted;
|
|
13750
13988
|
el.setAttribute("aria-pressed", String(isMuted2));
|
|
13751
13989
|
el.classList.toggle("v-muted", isMuted2);
|
|
13990
|
+
el.classList.toggle("v-mute-on", !isMuted2);
|
|
13752
13991
|
};
|
|
13753
13992
|
const toggle = () => {
|
|
13754
13993
|
sound.toggle();
|