voodoojs 0.11.2 → 0.12.2
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-IGZSDZKU.js → chunk-7AKBELZA.js} +4 -4
- package/dist/{chunk-V3O3WOZH.js → chunk-AVXQPDQH.js} +4 -4
- package/dist/{chunk-AH2VXDZD.js → chunk-K2U3O36M.js} +193 -20
- package/dist/{chunk-IS3DR2KY.js → chunk-MEE2ZAKJ.js} +3 -3
- package/dist/{chunk-DJJB35SR.js → chunk-NVANUFWZ.js} +6 -6
- package/dist/{chunk-H2ZUEQWV.js → chunk-OWCQV42D.js} +112 -20
- package/dist/{chunk-KQYSJHZR.js → chunk-RTZEIVNA.js} +5 -5
- package/dist/{chunk-NFDXVIII.js → chunk-RXOLGHSU.js} +3 -3
- package/dist/{chunk-WJP3YGUI.js → chunk-S4BXAGAW.js} +4 -4
- package/dist/{chunk-DCE5WIGA.js → chunk-UGLD36KV.js} +5 -5
- package/dist/{chunk-UV5PMS7P.js → chunk-YV4I45SK.js} +4 -4
- package/dist/essential.cjs +297 -28
- 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 +325 -34
- package/dist/index.d.cts +88 -4
- package/dist/index.d.ts +88 -4
- package/dist/index.js +38 -24
- package/dist/{query-DiQAS73Q.d.cts → query-D_BGQw8m.d.cts} +12 -1
- package/dist/{query-Cf-7iibE.d.ts → query-Dl6Urlwd.d.ts} +12 -1
- package/dist/reactivity.cjs +1 -1
- package/dist/reactivity.js +2 -2
- package/dist/socket.cjs +29 -2
- package/dist/socket.js +9 -9
- package/dist/style-GWGXWHB4.js +5 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/voodoo.core.js +277 -27
- package/dist/voodoo.core.min.js +17 -17
- package/dist/voodoo.full.js +325 -36
- package/dist/voodoo.full.min.js +59 -55
- package/dist/voodoo.js +305 -30
- package/dist/voodoo.min.js +29 -25
- package/package.json +1 -1
- package/dist/style-4X62SABN.js +0 -5
package/dist/voodoo.core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Voodoo.js v0.
|
|
2
|
+
* Voodoo.js v0.12.2
|
|
3
3
|
* JavaScript feels like magic.
|
|
4
4
|
* (c) 2026 Voodoo.js contributors. MIT License.
|
|
5
5
|
*/
|
|
@@ -1798,6 +1798,23 @@ ${pointer}`);
|
|
|
1798
1798
|
"SharedWorker",
|
|
1799
1799
|
"ServiceWorker"
|
|
1800
1800
|
]);
|
|
1801
|
+
function guardedTimer(name) {
|
|
1802
|
+
return function(handler, timeout, ...rest) {
|
|
1803
|
+
if (typeof handler !== "function") {
|
|
1804
|
+
throw new VoodooRuntimeError(
|
|
1805
|
+
`${name} needs a function. Passing a string would compile it, which this library never does.`
|
|
1806
|
+
);
|
|
1807
|
+
}
|
|
1808
|
+
const timer = globalThis[name];
|
|
1809
|
+
return timer(handler, timeout, ...rest);
|
|
1810
|
+
};
|
|
1811
|
+
}
|
|
1812
|
+
function forwardGlobal(name) {
|
|
1813
|
+
return function(...args) {
|
|
1814
|
+
const fn = globalThis[name];
|
|
1815
|
+
return fn(...args);
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1801
1818
|
var allowedGlobals = {
|
|
1802
1819
|
Math,
|
|
1803
1820
|
JSON,
|
|
@@ -1816,7 +1833,17 @@ ${pointer}`);
|
|
|
1816
1833
|
isFinite,
|
|
1817
1834
|
encodeURIComponent,
|
|
1818
1835
|
decodeURIComponent,
|
|
1819
|
-
console
|
|
1836
|
+
console,
|
|
1837
|
+
...typeof setTimeout !== "undefined" ? {
|
|
1838
|
+
setTimeout: guardedTimer("setTimeout"),
|
|
1839
|
+
setInterval: guardedTimer("setInterval"),
|
|
1840
|
+
clearTimeout: forwardGlobal("clearTimeout"),
|
|
1841
|
+
clearInterval: forwardGlobal("clearInterval")
|
|
1842
|
+
} : {},
|
|
1843
|
+
...typeof requestAnimationFrame !== "undefined" ? {
|
|
1844
|
+
requestAnimationFrame: forwardGlobal("requestAnimationFrame"),
|
|
1845
|
+
cancelAnimationFrame: forwardGlobal("cancelAnimationFrame")
|
|
1846
|
+
} : {}
|
|
1820
1847
|
};
|
|
1821
1848
|
var VoodooRuntimeError = class extends Error {
|
|
1822
1849
|
constructor(message, expression) {
|
|
@@ -2263,6 +2290,10 @@ Expression: ${expression}` : message);
|
|
|
2263
2290
|
function magic(name, getter) {
|
|
2264
2291
|
magics.set(name.startsWith("$") ? name : `$${name}`, getter);
|
|
2265
2292
|
}
|
|
2293
|
+
var hooks = /* @__PURE__ */ new Map();
|
|
2294
|
+
function hook(name, getter) {
|
|
2295
|
+
hooks.set(name, getter);
|
|
2296
|
+
}
|
|
2266
2297
|
var Scope = class _Scope {
|
|
2267
2298
|
// Assignment order matches the order the fields were declared in before, so
|
|
2268
2299
|
// the properties are created in the same sequence they always were.
|
|
@@ -2318,7 +2349,10 @@ Expression: ${expression}` : message);
|
|
|
2318
2349
|
s = s.parent;
|
|
2319
2350
|
}
|
|
2320
2351
|
if (name.charCodeAt(0) === 36 && magics.has(name)) {
|
|
2321
|
-
return this.magicContainer(name);
|
|
2352
|
+
return this.magicContainer(name, magics);
|
|
2353
|
+
}
|
|
2354
|
+
if (hooks.has(name)) {
|
|
2355
|
+
return this.magicContainer(name, hooks);
|
|
2322
2356
|
}
|
|
2323
2357
|
return void 0;
|
|
2324
2358
|
}
|
|
@@ -2347,11 +2381,11 @@ Expression: ${expression}` : message);
|
|
|
2347
2381
|
reactiveChild(vars, el = null) {
|
|
2348
2382
|
return new _Scope(reactive(vars), this, el != null ? el : this.el);
|
|
2349
2383
|
}
|
|
2350
|
-
magicContainer(name) {
|
|
2384
|
+
magicContainer(name, registry) {
|
|
2351
2385
|
if (!this.magicCache) this.magicCache = /* @__PURE__ */ new Map();
|
|
2352
2386
|
const cached = this.magicCache.get(name);
|
|
2353
2387
|
if (cached) return cached;
|
|
2354
|
-
const getter =
|
|
2388
|
+
const getter = registry.get(name);
|
|
2355
2389
|
const scope = this;
|
|
2356
2390
|
const container2 = {};
|
|
2357
2391
|
Object.defineProperty(container2, name, {
|
|
@@ -2698,7 +2732,16 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
2698
2732
|
},
|
|
2699
2733
|
effect(fn) {
|
|
2700
2734
|
const owner = ownerScope();
|
|
2701
|
-
|
|
2735
|
+
const hosted = () => {
|
|
2736
|
+
const previous = hookHost;
|
|
2737
|
+
hookHost = el;
|
|
2738
|
+
try {
|
|
2739
|
+
fn();
|
|
2740
|
+
} finally {
|
|
2741
|
+
hookHost = previous;
|
|
2742
|
+
}
|
|
2743
|
+
};
|
|
2744
|
+
owner.run(() => effect(hosted, { scope: owner }));
|
|
2702
2745
|
},
|
|
2703
2746
|
cleanup(fn) {
|
|
2704
2747
|
addCleanup(el, fn);
|
|
@@ -2746,6 +2789,56 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
2746
2789
|
return;
|
|
2747
2790
|
}
|
|
2748
2791
|
initialized.add(el);
|
|
2792
|
+
const previousHost = hookHost;
|
|
2793
|
+
hookHost = el;
|
|
2794
|
+
try {
|
|
2795
|
+
walkElementDirectives(el, attrs, tagComponent, current2);
|
|
2796
|
+
} finally {
|
|
2797
|
+
hookHost = previousHost;
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
var hookHost = null;
|
|
2801
|
+
function currentHookHost() {
|
|
2802
|
+
return hookHost;
|
|
2803
|
+
}
|
|
2804
|
+
function createDataScope(expression, parent, el) {
|
|
2805
|
+
let ast = null;
|
|
2806
|
+
try {
|
|
2807
|
+
ast = parse(expression);
|
|
2808
|
+
} catch (e) {
|
|
2809
|
+
ast = null;
|
|
2810
|
+
}
|
|
2811
|
+
const plain = ast && ast.t === "obj" && ast.props.every(
|
|
2812
|
+
(p2) => !p2.spread && !p2.keyExpr
|
|
2813
|
+
);
|
|
2814
|
+
if (!plain) {
|
|
2815
|
+
const raw = evaluateIn(expression, parent, "v-data");
|
|
2816
|
+
return parent.reactiveChild(raw && typeof raw === "object" ? raw : {}, el);
|
|
2817
|
+
}
|
|
2818
|
+
const scope = parent.reactiveChild({}, el);
|
|
2819
|
+
const props = ast.props;
|
|
2820
|
+
for (const prop of props) {
|
|
2821
|
+
if (prop.key === null) continue;
|
|
2822
|
+
try {
|
|
2823
|
+
if (prop.getter) {
|
|
2824
|
+
const compute = evaluate(prop.value, scope);
|
|
2825
|
+
Object.defineProperty(scope.data, prop.key, {
|
|
2826
|
+
enumerable: true,
|
|
2827
|
+
configurable: true,
|
|
2828
|
+
get: () => compute.call(scope.data)
|
|
2829
|
+
});
|
|
2830
|
+
} else {
|
|
2831
|
+
scope.data[prop.key] = evaluate(prop.value, scope);
|
|
2832
|
+
}
|
|
2833
|
+
} catch (err) {
|
|
2834
|
+
if (inDevelopment()) warnInvalidExpression(el, expression, expression, err);
|
|
2835
|
+
else handleError(err, "v-data");
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
return scope;
|
|
2839
|
+
}
|
|
2840
|
+
function walkElementDirectives(el, attrs, tagComponent, scope) {
|
|
2841
|
+
let current2 = scope;
|
|
2749
2842
|
for (const attr2 of attrs) {
|
|
2750
2843
|
const def = directives.get(attr2.name);
|
|
2751
2844
|
if (def == null ? void 0 : def.terminal) {
|
|
@@ -2765,11 +2858,10 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
2765
2858
|
nodeScopes.set(el, current2);
|
|
2766
2859
|
}
|
|
2767
2860
|
} else if (dataAttr || componentAttr) {
|
|
2768
|
-
|
|
2769
|
-
current2 = current2.reactiveChild(raw && typeof raw === "object" ? raw : {}, el);
|
|
2861
|
+
current2 = createDataScope(dataAttr ? dataAttr.expression || "{}" : "{}", current2, el);
|
|
2770
2862
|
nodeScopes.set(el, current2);
|
|
2771
2863
|
}
|
|
2772
|
-
const attributeScope = mountedComponent ?
|
|
2864
|
+
const attributeScope = mountedComponent ? scope : current2;
|
|
2773
2865
|
for (const attr2 of attrs) {
|
|
2774
2866
|
if (attr2.name === "data" || attr2.name === "component") continue;
|
|
2775
2867
|
runDirective(el, attr2, attributeScope);
|
|
@@ -2926,9 +3018,9 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
2926
3018
|
var observer = null;
|
|
2927
3019
|
var startHooks = [];
|
|
2928
3020
|
function runPhase(target, after) {
|
|
2929
|
-
for (const
|
|
3021
|
+
for (const hook2 of startHooks) {
|
|
2930
3022
|
try {
|
|
2931
|
-
|
|
3023
|
+
hook2(target, after);
|
|
2932
3024
|
} catch (error) {
|
|
2933
3025
|
console.error("[Voodoo] a start hook failed", error);
|
|
2934
3026
|
}
|
|
@@ -3312,10 +3404,10 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
3312
3404
|
"destroyed"
|
|
3313
3405
|
]);
|
|
3314
3406
|
function callHook(def, instance, name) {
|
|
3315
|
-
const
|
|
3316
|
-
if (typeof
|
|
3407
|
+
const hook2 = def[name];
|
|
3408
|
+
if (typeof hook2 !== "function") return;
|
|
3317
3409
|
try {
|
|
3318
|
-
|
|
3410
|
+
hook2.call(instance);
|
|
3319
3411
|
} catch (err) {
|
|
3320
3412
|
handleError(err, `hook ${name}`);
|
|
3321
3413
|
}
|
|
@@ -4774,6 +4866,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
4774
4866
|
);
|
|
4775
4867
|
|
|
4776
4868
|
// src/storage/index.ts
|
|
4869
|
+
init_reactivity();
|
|
4777
4870
|
function createStorage(getStore, prefix = "") {
|
|
4778
4871
|
const full = (key) => prefix + key;
|
|
4779
4872
|
return {
|
|
@@ -4949,22 +5042,29 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
4949
5042
|
};
|
|
4950
5043
|
var THEME_KEY = "voodoo:theme";
|
|
4951
5044
|
var picked = null;
|
|
5045
|
+
var revision = ref(0);
|
|
4952
5046
|
var theme = {
|
|
4953
5047
|
/** Theme chosen by the user, or `system` when never set. */
|
|
4954
5048
|
get current() {
|
|
4955
5049
|
var _a2, _b;
|
|
5050
|
+
void revision.value;
|
|
4956
5051
|
return (_b = (_a2 = storage.get(THEME_KEY)) != null ? _a2 : picked) != null ? _b : "system";
|
|
4957
5052
|
},
|
|
4958
5053
|
/** Theme effectively applied, resolving `system`. */
|
|
4959
5054
|
get resolved() {
|
|
4960
5055
|
const value = this.current;
|
|
4961
5056
|
if (value !== "system") return value;
|
|
5057
|
+
if (typeof document !== "undefined") {
|
|
5058
|
+
const authored = document.documentElement.getAttribute("data-theme");
|
|
5059
|
+
if (authored === "light" || authored === "dark") return authored;
|
|
5060
|
+
}
|
|
4962
5061
|
if (typeof matchMedia === "undefined") return "light";
|
|
4963
5062
|
return matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
4964
5063
|
},
|
|
4965
5064
|
set(value) {
|
|
4966
5065
|
picked = value;
|
|
4967
5066
|
storage.set(THEME_KEY, value);
|
|
5067
|
+
revision.value++;
|
|
4968
5068
|
this.apply();
|
|
4969
5069
|
},
|
|
4970
5070
|
toggle() {
|
|
@@ -4998,8 +5098,17 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
4998
5098
|
init() {
|
|
4999
5099
|
if (typeof document === "undefined") return;
|
|
5000
5100
|
this.apply();
|
|
5101
|
+
if (typeof MutationObserver !== "undefined") {
|
|
5102
|
+
new MutationObserver(() => {
|
|
5103
|
+
revision.value++;
|
|
5104
|
+
}).observe(document.documentElement, {
|
|
5105
|
+
attributes: true,
|
|
5106
|
+
attributeFilter: ["data-theme"]
|
|
5107
|
+
});
|
|
5108
|
+
}
|
|
5001
5109
|
if (typeof matchMedia === "undefined") return;
|
|
5002
5110
|
matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
5111
|
+
revision.value++;
|
|
5003
5112
|
if (this.current === "system") this.apply();
|
|
5004
5113
|
});
|
|
5005
5114
|
}
|
|
@@ -5143,6 +5252,141 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
5143
5252
|
);
|
|
5144
5253
|
}
|
|
5145
5254
|
|
|
5255
|
+
// src/hooks/index.ts
|
|
5256
|
+
init_reactivity();
|
|
5257
|
+
var tables = /* @__PURE__ */ new WeakMap();
|
|
5258
|
+
function tableFor(scope) {
|
|
5259
|
+
var _a2, _b, _c;
|
|
5260
|
+
const host = (_b = (_a2 = currentHookHost()) != null ? _a2 : scope.el) != null ? _b : scope;
|
|
5261
|
+
let table = tables.get(host);
|
|
5262
|
+
if (!table) {
|
|
5263
|
+
table = { slots: [], index: 0, scheduled: false, bound: false };
|
|
5264
|
+
tables.set(host, table);
|
|
5265
|
+
}
|
|
5266
|
+
const el = (_c = currentHookHost()) != null ? _c : scope.el;
|
|
5267
|
+
if (!table.bound && el) {
|
|
5268
|
+
table.bound = true;
|
|
5269
|
+
const owned = table;
|
|
5270
|
+
addCleanup(el, () => {
|
|
5271
|
+
for (const slot of owned.slots) {
|
|
5272
|
+
if (slot.dispose) slot.dispose();
|
|
5273
|
+
if (slot.runner) stop(slot.runner);
|
|
5274
|
+
}
|
|
5275
|
+
owned.slots.length = 0;
|
|
5276
|
+
});
|
|
5277
|
+
}
|
|
5278
|
+
if (!table.scheduled) {
|
|
5279
|
+
table.scheduled = true;
|
|
5280
|
+
const pending = table;
|
|
5281
|
+
queueMicrotask(() => {
|
|
5282
|
+
pending.index = 0;
|
|
5283
|
+
pending.scheduled = false;
|
|
5284
|
+
});
|
|
5285
|
+
}
|
|
5286
|
+
return table;
|
|
5287
|
+
}
|
|
5288
|
+
function nextSlot(scope, kind) {
|
|
5289
|
+
const table = tableFor(scope);
|
|
5290
|
+
const at = table.index++;
|
|
5291
|
+
let slot = table.slots[at];
|
|
5292
|
+
if (!slot || slot.kind !== kind) {
|
|
5293
|
+
if (slot) {
|
|
5294
|
+
if (slot.dispose) slot.dispose();
|
|
5295
|
+
if (slot.runner) stop(slot.runner);
|
|
5296
|
+
}
|
|
5297
|
+
slot = { kind, deps: null, value: void 0 };
|
|
5298
|
+
table.slots[at] = slot;
|
|
5299
|
+
}
|
|
5300
|
+
return slot;
|
|
5301
|
+
}
|
|
5302
|
+
function depsChanged(previous, next) {
|
|
5303
|
+
if (!previous || !next) return true;
|
|
5304
|
+
if (previous.length !== next.length) return true;
|
|
5305
|
+
for (let i = 0; i < next.length; i++) {
|
|
5306
|
+
if (!Object.is(previous[i], next[i])) return true;
|
|
5307
|
+
}
|
|
5308
|
+
return false;
|
|
5309
|
+
}
|
|
5310
|
+
function normalizeDeps(deps) {
|
|
5311
|
+
return Array.isArray(deps) ? deps.slice() : null;
|
|
5312
|
+
}
|
|
5313
|
+
function useState(scope, initial) {
|
|
5314
|
+
const slot = nextSlot(scope, "state");
|
|
5315
|
+
if (slot.value === void 0) slot.value = ref(initial);
|
|
5316
|
+
return slot.value;
|
|
5317
|
+
}
|
|
5318
|
+
function useEffect(scope, fn, deps) {
|
|
5319
|
+
const slot = nextSlot(scope, "effect");
|
|
5320
|
+
const next = normalizeDeps(deps);
|
|
5321
|
+
const runCleanup = () => {
|
|
5322
|
+
if (slot.dispose) {
|
|
5323
|
+
const dispose = slot.dispose;
|
|
5324
|
+
slot.dispose = void 0;
|
|
5325
|
+
dispose();
|
|
5326
|
+
}
|
|
5327
|
+
};
|
|
5328
|
+
if (next) {
|
|
5329
|
+
const first = slot.deps === null && !slot.runner;
|
|
5330
|
+
if (first || depsChanged(slot.deps, next)) {
|
|
5331
|
+
slot.deps = next;
|
|
5332
|
+
runCleanup();
|
|
5333
|
+
const result = fn();
|
|
5334
|
+
if (typeof result === "function") slot.dispose = result;
|
|
5335
|
+
}
|
|
5336
|
+
return;
|
|
5337
|
+
}
|
|
5338
|
+
if (slot.runner) return;
|
|
5339
|
+
slot.deps = null;
|
|
5340
|
+
slot.runner = effect(() => {
|
|
5341
|
+
runCleanup();
|
|
5342
|
+
const result = fn();
|
|
5343
|
+
if (typeof result === "function") slot.dispose = result;
|
|
5344
|
+
});
|
|
5345
|
+
}
|
|
5346
|
+
function useMemo(scope, fn, deps) {
|
|
5347
|
+
const slot = nextSlot(scope, "memo");
|
|
5348
|
+
const next = normalizeDeps(deps);
|
|
5349
|
+
if (!next) {
|
|
5350
|
+
if (!slot.value) slot.value = computed(fn);
|
|
5351
|
+
return slot.value;
|
|
5352
|
+
}
|
|
5353
|
+
if (!slot.value) {
|
|
5354
|
+
slot.value = ref(fn());
|
|
5355
|
+
slot.deps = next;
|
|
5356
|
+
} else if (depsChanged(slot.deps, next)) {
|
|
5357
|
+
slot.deps = next;
|
|
5358
|
+
slot.value.value = fn();
|
|
5359
|
+
}
|
|
5360
|
+
return slot.value;
|
|
5361
|
+
}
|
|
5362
|
+
function useRef(scope, initial) {
|
|
5363
|
+
const slot = nextSlot(scope, "ref");
|
|
5364
|
+
if (!slot.value) slot.value = markRaw({ current: initial });
|
|
5365
|
+
return slot.value;
|
|
5366
|
+
}
|
|
5367
|
+
function useContext(name, initial) {
|
|
5368
|
+
if (initial !== void 0 && !(name in allStores)) {
|
|
5369
|
+
store(name, initial);
|
|
5370
|
+
}
|
|
5371
|
+
return allStores[name];
|
|
5372
|
+
}
|
|
5373
|
+
function installHooks() {
|
|
5374
|
+
hook("useState", (scope) => (initial) => useState(scope, initial));
|
|
5375
|
+
hook(
|
|
5376
|
+
"useEffect",
|
|
5377
|
+
(scope) => (fn, deps) => useEffect(scope, fn, deps)
|
|
5378
|
+
);
|
|
5379
|
+
hook(
|
|
5380
|
+
"useMemo",
|
|
5381
|
+
(scope) => (fn, deps) => useMemo(scope, fn, deps)
|
|
5382
|
+
);
|
|
5383
|
+
hook("useRef", (scope) => (initial) => useRef(scope, initial));
|
|
5384
|
+
hook(
|
|
5385
|
+
"useContext",
|
|
5386
|
+
() => (name, initial) => useContext(name, initial)
|
|
5387
|
+
);
|
|
5388
|
+
}
|
|
5389
|
+
|
|
5146
5390
|
// src/http/resource.ts
|
|
5147
5391
|
init_reactivity();
|
|
5148
5392
|
function pick(value, path) {
|
|
@@ -6747,6 +6991,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
6747
6991
|
setScopeMarker(markNodeScope);
|
|
6748
6992
|
setDirectiveRegistrar(directive);
|
|
6749
6993
|
installMagics();
|
|
6994
|
+
installHooks();
|
|
6750
6995
|
var eventBus = /* @__PURE__ */ new Map();
|
|
6751
6996
|
function on(name, handler) {
|
|
6752
6997
|
let set2 = eventBus.get(name);
|
|
@@ -6782,7 +7027,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
6782
7027
|
}
|
|
6783
7028
|
function directive(name, definition) {
|
|
6784
7029
|
var _a2, _b;
|
|
6785
|
-
const
|
|
7030
|
+
const hooks2 = typeof definition === "function" ? { mounted: definition, updated: definition } : definition;
|
|
6786
7031
|
defineDirective(
|
|
6787
7032
|
name,
|
|
6788
7033
|
(ctx) => {
|
|
@@ -6802,38 +7047,38 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
|
|
|
6802
7047
|
instance: (_b3 = (_a4 = ctx.scope.owner) == null ? void 0 : _a4.component) != null ? _b3 : null
|
|
6803
7048
|
};
|
|
6804
7049
|
};
|
|
6805
|
-
const initial =
|
|
6806
|
-
(_a3 =
|
|
6807
|
-
(_b2 =
|
|
7050
|
+
const initial = hooks2.raw ? ctx.expression : ctx.evaluate();
|
|
7051
|
+
(_a3 = hooks2.created) == null ? void 0 : _a3.call(hooks2, ctx.el, makeBinding(initial));
|
|
7052
|
+
(_b2 = hooks2.beforeMount) == null ? void 0 : _b2.call(hooks2, ctx.el, makeBinding(initial));
|
|
6808
7053
|
ctx.effect(() => {
|
|
6809
7054
|
var _a4, _b3;
|
|
6810
|
-
const value =
|
|
7055
|
+
const value = hooks2.raw ? ctx.expression : ctx.evaluate();
|
|
6811
7056
|
if (!mounted) {
|
|
6812
7057
|
mounted = true;
|
|
6813
7058
|
oldValue = value;
|
|
6814
|
-
(_a4 =
|
|
7059
|
+
(_a4 = hooks2.mounted) == null ? void 0 : _a4.call(hooks2, ctx.el, makeBinding(value));
|
|
6815
7060
|
return;
|
|
6816
7061
|
}
|
|
6817
7062
|
if (value === oldValue) return;
|
|
6818
7063
|
const binding = makeBinding(value);
|
|
6819
|
-
(_b3 =
|
|
7064
|
+
(_b3 = hooks2.updated) == null ? void 0 : _b3.call(hooks2, ctx.el, binding);
|
|
6820
7065
|
oldValue = value;
|
|
6821
7066
|
});
|
|
6822
7067
|
ctx.cleanup(() => {
|
|
6823
7068
|
var _a4, _b3;
|
|
6824
7069
|
const binding = makeBinding(oldValue);
|
|
6825
|
-
(_a4 =
|
|
6826
|
-
(_b3 =
|
|
7070
|
+
(_a4 = hooks2.beforeUnmount) == null ? void 0 : _a4.call(hooks2, ctx.el, binding);
|
|
7071
|
+
(_b3 = hooks2.unmounted) == null ? void 0 : _b3.call(hooks2, ctx.el, binding);
|
|
6827
7072
|
});
|
|
6828
7073
|
},
|
|
6829
|
-
{ priority: (_a2 =
|
|
7074
|
+
{ priority: (_a2 = hooks2.priority) != null ? _a2 : PRIORITY.DEFAULT, terminal: (_b = hooks2.terminal) != null ? _b : false }
|
|
6830
7075
|
);
|
|
6831
7076
|
}
|
|
6832
7077
|
function data(values) {
|
|
6833
7078
|
Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
|
|
6834
7079
|
return rootScope.data;
|
|
6835
7080
|
}
|
|
6836
|
-
var version2 = "0.
|
|
7081
|
+
var version2 = "0.12.2";
|
|
6837
7082
|
var core = {
|
|
6838
7083
|
// Utilities first: Voodoo's own names can override.
|
|
6839
7084
|
...utils_exports,
|
|
@@ -8469,9 +8714,14 @@ ${block(':root:not([data-theme="light"])', dark.vars)}
|
|
|
8469
8714
|
allowedGlobals.V = V2;
|
|
8470
8715
|
allowedGlobals.Voodoo = V2;
|
|
8471
8716
|
if (config.baseURL && ((_a2 = V2.http) == null ? void 0 : _a2.setBaseURL)) V2.http.setBaseURL(config.baseURL);
|
|
8472
|
-
|
|
8717
|
+
theme.init();
|
|
8718
|
+
if (options.manual || !config.autoStart) {
|
|
8719
|
+
whenReady(() => {
|
|
8720
|
+
applySavedPalette();
|
|
8721
|
+
});
|
|
8722
|
+
return;
|
|
8723
|
+
}
|
|
8473
8724
|
const boot = () => {
|
|
8474
|
-
theme.init();
|
|
8475
8725
|
applySavedPalette();
|
|
8476
8726
|
V2.start();
|
|
8477
8727
|
if (typeof V2.enableXrayShortcut === "function") V2.enableXrayShortcut();
|