voodoojs 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +77 -0
  2. package/dist/chunk-234ZLC6W.js +401 -0
  3. package/dist/chunk-4HQEOXTK.js +10271 -0
  4. package/dist/chunk-5777LJVW.js +64 -0
  5. package/dist/chunk-5CKGDARU.js +1845 -0
  6. package/dist/chunk-A2UOVQBP.js +82 -0
  7. package/dist/chunk-E27NRARW.js +16 -0
  8. package/dist/chunk-JZIYRIY6.js +1196 -0
  9. package/dist/chunk-NNU6WOOU.js +641 -0
  10. package/dist/chunk-PQZEVFVZ.js +448 -0
  11. package/dist/chunk-RJUNPXQF.js +946 -0
  12. package/dist/chunk-U76IRJKH.js +72 -0
  13. package/dist/essential.cjs +13889 -0
  14. package/dist/essential.d.cts +24 -0
  15. package/dist/essential.d.ts +24 -0
  16. package/dist/essential.js +51 -0
  17. package/dist/gpu.cjs +2008 -0
  18. package/dist/gpu.d.cts +68 -0
  19. package/dist/gpu.d.ts +68 -0
  20. package/dist/gpu.js +273 -0
  21. package/dist/http.cjs +467 -0
  22. package/dist/http.d.cts +148 -0
  23. package/dist/http.d.ts +148 -0
  24. package/dist/http.js +7 -0
  25. package/dist/index-CaLD-0oh.d.cts +608 -0
  26. package/dist/index-CaLD-0oh.d.ts +608 -0
  27. package/dist/index-DTllqUtj.d.cts +261 -0
  28. package/dist/index-DTllqUtj.d.ts +261 -0
  29. package/dist/index.cjs +23063 -0
  30. package/dist/index.d.cts +1603 -0
  31. package/dist/index.d.ts +1603 -0
  32. package/dist/index.js +6924 -0
  33. package/dist/query-CKJ4oSpG.d.cts +1595 -0
  34. package/dist/query-DQFRmu3u.d.ts +1595 -0
  35. package/dist/reactivity.cjs +676 -0
  36. package/dist/reactivity.d.cts +188 -0
  37. package/dist/reactivity.d.ts +188 -0
  38. package/dist/reactivity.js +4 -0
  39. package/dist/socket.cjs +2685 -0
  40. package/dist/socket.d.cts +167 -0
  41. package/dist/socket.d.ts +167 -0
  42. package/dist/socket.js +238 -0
  43. package/dist/style-XEUAGGJK.js +5 -0
  44. package/dist/utils.cjs +397 -0
  45. package/dist/utils.d.cts +111 -0
  46. package/dist/utils.d.ts +111 -0
  47. package/dist/utils.js +4 -0
  48. package/dist/voodoo.core.js +8213 -0
  49. package/dist/voodoo.core.min.js +146 -0
  50. package/dist/voodoo.full.js +21193 -0
  51. package/dist/voodoo.full.min.js +1784 -0
  52. package/dist/voodoo.js +14185 -0
  53. package/dist/voodoo.min.js +420 -0
  54. package/package.json +127 -0
@@ -0,0 +1,1595 @@
1
+ import { HttpMethod, HttpDefaults, request, RequestInterceptor, ResponseInterceptor, ErrorInterceptor, clearCache, flushOfflineQueue, HttpError } from './http.cjs';
2
+ import { reactive, ref, shallowRef, computed, effect, watch, watchEffect, nextTick, toRaw, markRaw, unref, stop, effectScope, EffectScope, flushSync } from './reactivity.cjs';
3
+ import { parseDuration, DebouncedFunction, FormatOptions } from './utils.cjs';
4
+
5
+ /**
6
+ * @module parser/lexer
7
+ *
8
+ * Tokenizer for the JavaScript subset accepted within `v-*` attributes.
9
+ *
10
+ * Voodoo does not use `eval` or `new Function`. All expression text
11
+ * goes through this lexer, then the parser, and finally through a tree
12
+ * interpreter. This keeps the library compatible with restrictive Content
13
+ * Security Policy, without `unsafe-eval`.
14
+ */
15
+ type TokenType = 'num' | 'str' | 'tpl' | 'ident' | 'punct' | 'eof';
16
+ interface TemplatePart {
17
+ /** Literal chunks between interpolations. Always has 1 more item than `exprs`. */
18
+ quasis: string[];
19
+ /** Source code of each `${...}`. */
20
+ exprs: string[];
21
+ }
22
+ interface Token {
23
+ type: TokenType;
24
+ value: string;
25
+ /** Value already converted to number or string, when applicable. */
26
+ parsed?: number | string;
27
+ tpl?: TemplatePart;
28
+ start: number;
29
+ end: number;
30
+ }
31
+ /** Syntax error with position within the original expression. */
32
+ declare class VoodooSyntaxError extends Error {
33
+ readonly source: string;
34
+ readonly position: number;
35
+ constructor(message: string, source: string, position: number);
36
+ }
37
+ /**
38
+ * Converts an expression to a list of tokens.
39
+ *
40
+ * @throws {VoodooSyntaxError} when it encounters an invalid character.
41
+ */
42
+ declare function tokenize(source: string): Token[];
43
+
44
+ /**
45
+ * @module parser/parser
46
+ *
47
+ * Pratt parser (operator precedence) that transforms tokens to AST.
48
+ *
49
+ * Supports the subset of JavaScript that makes sense within an attribute:
50
+ * literals, identifiers, member access, function calls, unary and binary
51
+ * operators, ternary, assignment, increment, objects, arrays, arrow functions,
52
+ * template literals, spread, optional chaining and sequences with `;`.
53
+ *
54
+ * Does not support, by design decision: `function`, `class`, `new`, `delete`,
55
+ * `import`, `await`, `for` loop, `while`, `try` and complex destructuring.
56
+ * Attribute expressions should be short. Larger logic lives in methods.
57
+ */
58
+
59
+ type Node$1 = {
60
+ t: 'lit';
61
+ v: string | number | boolean | null | undefined;
62
+ } | {
63
+ t: 'tpl';
64
+ quasis: string[];
65
+ exprs: Node$1[];
66
+ } | {
67
+ t: 'id';
68
+ n: string;
69
+ } | {
70
+ t: 'member';
71
+ o: Node$1;
72
+ p: Node$1;
73
+ computed: boolean;
74
+ opt: boolean;
75
+ } | {
76
+ t: 'call';
77
+ callee: Node$1;
78
+ args: Node$1[];
79
+ opt: boolean;
80
+ } | {
81
+ t: 'unary';
82
+ op: string;
83
+ a: Node$1;
84
+ } | {
85
+ t: 'update';
86
+ op: string;
87
+ a: Node$1;
88
+ prefix: boolean;
89
+ } | {
90
+ t: 'bin';
91
+ op: string;
92
+ l: Node$1;
93
+ r: Node$1;
94
+ } | {
95
+ t: 'logic';
96
+ op: string;
97
+ l: Node$1;
98
+ r: Node$1;
99
+ } | {
100
+ t: 'cond';
101
+ test: Node$1;
102
+ cons: Node$1;
103
+ alt: Node$1;
104
+ } | {
105
+ t: 'assign';
106
+ op: string;
107
+ target: Node$1;
108
+ value: Node$1;
109
+ } | {
110
+ t: 'arrow';
111
+ params: string[];
112
+ body: Node$1;
113
+ } | {
114
+ t: 'method';
115
+ params: string[];
116
+ body: Node$1;
117
+ } | {
118
+ t: 'if';
119
+ test: Node$1;
120
+ cons: Node$1;
121
+ alt: Node$1 | null;
122
+ } | {
123
+ t: 'obj';
124
+ props: ObjectProperty[];
125
+ } | {
126
+ t: 'arr';
127
+ els: Array<Node$1 | {
128
+ spread: Node$1;
129
+ }>;
130
+ } | {
131
+ t: 'seq';
132
+ body: Node$1[];
133
+ };
134
+ interface ObjectProperty {
135
+ /** Fixed key name, or `null` when the key is computed. */
136
+ key: string | null;
137
+ keyExpr?: Node$1;
138
+ value?: Node$1;
139
+ spread?: Node$1;
140
+ /** `true` for `{ get name() { ... } }`, evaluated on every read. */
141
+ getter?: boolean;
142
+ }
143
+ /**
144
+ * Converts text to AST, with caching.
145
+ *
146
+ * ```js
147
+ * parse('count + 1')
148
+ * // { t: 'bin', op: '+', l: { t: 'id', n: 'count' }, r: { t: 'lit', v: 1 } }
149
+ * ```
150
+ */
151
+ declare function parse(source: string): Node$1;
152
+ /** Clears the expression cache. Used in tests and hot reload. */
153
+ declare function clearParseCache(): void;
154
+
155
+ /**
156
+ * @module parser/interpreter
157
+ *
158
+ * AST interpreter. Takes a node and a scope and returns the value.
159
+ *
160
+ * Security: there is no implicit access to `window`, `globalThis`, `document`,
161
+ * `fetch` or `eval`. Identifiers not in scope are looked up in a closed list of
162
+ * allowed globals, configurable by the application.
163
+ */
164
+
165
+ /** Minimum contract that a scope must fulfill to be evaluated. */
166
+ interface EvalScope {
167
+ /** Returns the object containing the key, walking up the scope chain. */
168
+ lookup(name: string): Record<string, any> | undefined;
169
+ /** Reads a value from the scope chain. */
170
+ get(name: string): unknown;
171
+ /** Writes to the scope chain, in the key owner when it exists. */
172
+ set(name: string, value: unknown): void;
173
+ /** Creates a child scope with local variables, used by arrow functions and `v-for`. */
174
+ child(vars: Record<string, unknown>): EvalScope;
175
+ }
176
+ declare const allowedGlobals: Record<string, unknown>;
177
+ /** Runtime error for an expression, with original text attached. */
178
+ declare class VoodooRuntimeError extends Error {
179
+ readonly expression?: string | undefined;
180
+ constructor(message: string, expression?: string | undefined);
181
+ }
182
+ /**
183
+ * Evaluates an AST node.
184
+ *
185
+ * @param node node generated by `parse()`
186
+ * @param scope read and write scope
187
+ */
188
+ declare function evaluate(node: Node$1, scope: EvalScope): any;
189
+ /** Converts any value to text that will be written to the DOM. */
190
+ declare function stringify(value: unknown): string;
191
+
192
+ /**
193
+ * @module runtime/scope
194
+ *
195
+ * Scope chain. Each `v-data`, each component, and each iteration of `v-for`
196
+ * creates a child scope. Identifier lookup travels up the chain to the root, and
197
+ * if nothing is found, falls back to magic variables (`$store`, `$el`, ...).
198
+ */
199
+
200
+ type MagicGetter = (scope: Scope) => unknown;
201
+ /** Global registry of magic variables, filled by modules. */
202
+ declare const magics: Map<string, MagicGetter>;
203
+ /** Register a magic variable available in any expression. */
204
+ declare function magic(name: string, getter: MagicGetter): void;
205
+ /**
206
+ * Fields are `declare`d and assigned in the constructor, not initialised at the
207
+ * declaration.
208
+ *
209
+ * With `useDefineForClassFields` and a build target below native class fields,
210
+ * `refs = {}` compiles to an `Object.defineProperty` call. A list creates two of
211
+ * these scopes per row, so a thousand rows meant thousands of defines before any
212
+ * work happened. Plain assignment produces the same own, writable, enumerable,
213
+ * configurable properties, in the same order.
214
+ */
215
+ declare class Scope implements EvalScope {
216
+ /** Data local to this scope, normally a reactive proxy. */
217
+ data: Record<string, any>;
218
+ parent: Scope | null;
219
+ /** Element that created the scope. Used by `$el` and `$refs`. */
220
+ el: Element | null;
221
+ /** References declared with `v-ref` within this scope. */
222
+ refs: Record<string, Element>;
223
+ /** Component instance, when this scope belongs to one. */
224
+ component: any;
225
+ /** Values delivered by `provide`, visible to lower scopes. */
226
+ provides: Record<string, unknown> | null;
227
+ private magicCache;
228
+ constructor(data?: Record<string, any>, parent?: Scope | null, el?: Element | null);
229
+ /** Root scope of the chain. */
230
+ get root(): Scope;
231
+ /** Look up a `provide` value by traveling up the scope chain. */
232
+ inject<T = unknown>(key: string, fallback?: T): T | undefined;
233
+ /** Nearest component scope, traveling up the chain. */
234
+ get owner(): Scope | null;
235
+ /** Set of visible refs, merging ancestor scopes. */
236
+ get allRefs(): Record<string, Element>;
237
+ lookup(name: string): Record<string, any> | undefined;
238
+ has(name: string): boolean;
239
+ get(name: string): unknown;
240
+ set(name: string, value: unknown): void;
241
+ child(vars?: Record<string, unknown>, el?: Element | null): Scope;
242
+ /** Create a reactive child scope, used by `v-data` and `v-for`. */
243
+ reactiveChild(vars: Record<string, unknown>, el?: Element | null): Scope;
244
+ private magicContainer;
245
+ }
246
+ /**
247
+ * Global root scope, shared by elements without `v-data`.
248
+ * The data is reactive, so any value placed here by `V.data()` or `v-resource`
249
+ * automatically updates the page.
250
+ */
251
+ declare const rootScope: Scope;
252
+
253
+ /**
254
+ * @module runtime/registry
255
+ *
256
+ * Global registries: configuration, directives, components, and plugins.
257
+ */
258
+
259
+ interface VoodooConfig {
260
+ /** Attribute prefix. Change to `data-v-` for strictly valid HTML. */
261
+ prefix: string;
262
+ /** Initialize the DOM automatically when the script loads. */
263
+ autoStart: boolean;
264
+ /** Watch the DOM with MutationObserver and initialize new elements. */
265
+ autoDiscover: boolean;
266
+ /** Observed root. Default is `document.body`. */
267
+ root: Element | null;
268
+ /** Show detailed warnings in the console. */
269
+ devtools: boolean;
270
+ /** Base URL for requests triggered by attributes. */
271
+ baseURL: string;
272
+ /** Globals allowed inside expressions. */
273
+ globals: Record<string, unknown>;
274
+ /** Locale used by date, number, and currency formatters. */
275
+ locale: string;
276
+ /** Default currency for `v-currency`. */
277
+ currency: string;
278
+ /** Inject UI component CSS automatically. */
279
+ injectStyles: boolean;
280
+ /**
281
+ * Remove `v-*` attributes from HTML after processing, leaving the DOM clean
282
+ * in the inspector. Values remain accessible internally.
283
+ */
284
+ cleanAttributes: boolean;
285
+ /**
286
+ * Reject `javascript:`, `vbscript:`, and `data:text/html` in attributes that
287
+ * the browser navigates, like `href`, `src`, `action`, and `formaction`. Only
288
+ * turn off if the application truly needs to generate those schemes.
289
+ */
290
+ sanitizeUrls: boolean;
291
+ }
292
+ declare const config: VoodooConfig;
293
+ interface DirectiveBinding<T = any> {
294
+ el: HTMLElement;
295
+ /** Already-evaluated value of the expression. */
296
+ value: T;
297
+ oldValue: T | undefined;
298
+ /** Argument after the colon, like `click` in `v-on:click`. */
299
+ arg?: string;
300
+ /** Modifiers after the dots, like `.prevent.stop`. */
301
+ modifiers: Record<string, string | true>;
302
+ /** Original text of the expression. */
303
+ expression: string;
304
+ scope: Scope;
305
+ /** Nearest component instance, when it exists. */
306
+ instance: any;
307
+ }
308
+ /** Directive in lifecycle format, used by `V.directive()`. */
309
+ interface DirectiveHooks<T = any> {
310
+ created?(el: HTMLElement, binding: DirectiveBinding<T>): void;
311
+ beforeMount?(el: HTMLElement, binding: DirectiveBinding<T>): void;
312
+ mounted?(el: HTMLElement, binding: DirectiveBinding<T>): void;
313
+ updated?(el: HTMLElement, binding: DirectiveBinding<T>): void;
314
+ beforeUnmount?(el: HTMLElement, binding: DirectiveBinding<T>): void;
315
+ unmounted?(el: HTMLElement, binding: DirectiveBinding<T>): void;
316
+ /** Execution order. Higher runs first. Default 0. */
317
+ priority?: number;
318
+ /** When `true`, the expression is not evaluated automatically. */
319
+ raw?: boolean;
320
+ /**
321
+ * Takes over the entire subtree, as `v-if` and `v-for` do: the walker doesn't
322
+ * descend into children, and the directive itself decides what to do with them.
323
+ * Without this, a plugin can't write a structural directive.
324
+ */
325
+ terminal?: boolean;
326
+ }
327
+ /** Context delivered to internal directives, with fine-grained effect control. */
328
+ interface DirectiveContext {
329
+ el: HTMLElement;
330
+ scope: Scope;
331
+ /** Expression text, exactly as written in the attribute. */
332
+ expression: string;
333
+ arg?: string;
334
+ modifiers: Record<string, string | true>;
335
+ /** Evaluate the attribute expression, or another passed as parameter. */
336
+ evaluate<T = any>(expression?: string): T;
337
+ /** Create a reactive effect with cleanup tied to the element. */
338
+ effect(fn: () => void): void;
339
+ /** Register cleanup executed when the element leaves the DOM. */
340
+ cleanup(fn: () => void): void;
341
+ /** Walk a subtree applying directives, used by `v-if` and `v-for`. */
342
+ walk(node: Node, scope: Scope): void;
343
+ /** Full attribute name, useful for error messages. */
344
+ raw: string;
345
+ }
346
+ type DirectiveSetup = (ctx: DirectiveContext) => void;
347
+ interface DirectiveDefinition {
348
+ name: string;
349
+ setup: DirectiveSetup;
350
+ /** Higher runs first. */
351
+ priority: number;
352
+ /** Prevents the walker from descending into children, as in `v-for` and `v-if`. */
353
+ terminal: boolean;
354
+ }
355
+ /** Priorities of special cases. Higher values are processed first. */
356
+ declare const PRIORITY: {
357
+ readonly IGNORE: 100;
358
+ readonly FOR: 90;
359
+ readonly IF: 80;
360
+ readonly DATA: 70;
361
+ readonly COMPONENT: 65;
362
+ readonly REF: 60;
363
+ readonly BIND: 45;
364
+ readonly MODEL: 40;
365
+ readonly DEFAULT: 0;
366
+ readonly INIT: -10;
367
+ readonly TRANSITION: -20;
368
+ };
369
+ interface RegisterDirectiveOptions {
370
+ priority?: number;
371
+ terminal?: boolean;
372
+ }
373
+ /** Internal registry, used by native directives. */
374
+ declare function defineDirective(name: string, setup: DirectiveSetup, options?: RegisterDirectiveOptions): void;
375
+ interface ComponentDefinition {
376
+ /** Initial state. Receives already-resolved props. */
377
+ state?: (this: any, props: Record<string, any>) => Record<string, any>;
378
+ /** Alias for `state`, for those coming from Vue. */
379
+ data?: (this: any, props: Record<string, any>) => Record<string, any>;
380
+ /** Names of accepted props, or definition with type and default value. */
381
+ props?: string[] | Record<string, PropDefinition>;
382
+ methods?: Record<string, (this: any, ...args: any[]) => any>;
383
+ computed?: Record<string, (this: any) => any>;
384
+ watch?: Record<string, (this: any, value: any, oldValue: any) => void>;
385
+ /** Component HTML. Use `<slot>` to receive the original content. */
386
+ template?: string;
387
+ /** CSS injected once when the component is used. */
388
+ style?: string;
389
+ /** Inherit parent scope instead of isolating. Default `false`. */
390
+ inheritScope?: boolean;
391
+ /** Values delivered to descendants, read with `inject`. */
392
+ provide?: Record<string, unknown> | ((this: any) => Record<string, unknown>);
393
+ /** Values looked up in a `provide` above, available as state. */
394
+ inject?: string[] | Record<string, {
395
+ from?: string;
396
+ default?: unknown;
397
+ }>;
398
+ beforeMount?(this: any): void;
399
+ mounted?(this: any): void;
400
+ updated?(this: any): void;
401
+ beforeUnmount?(this: any): void;
402
+ destroyed?(this: any): void;
403
+ unmounted?(this: any): void;
404
+ [key: string]: any;
405
+ }
406
+ interface PropDefinition {
407
+ type?: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'any';
408
+ default?: any;
409
+ required?: boolean;
410
+ }
411
+ interface VoodooPlugin {
412
+ name?: string;
413
+ install(V: any, options?: Record<string, unknown>): void;
414
+ }
415
+
416
+ /**
417
+ * @module runtime/component
418
+ *
419
+ * Component model. A Voodoo component is a scope with state, methods, computed
420
+ * properties, watchers, props, slots and lifecycle, mounted on an existing
421
+ * element. There is no compilation step.
422
+ *
423
+ * Three ways to use:
424
+ *
425
+ * ```html
426
+ * <div v-component="counter"></div> <!-- registered -->
427
+ * <counter></counter> <!-- custom tag -->
428
+ * <Counter start="10"></Counter> <!-- PascalCase tag -->
429
+ * ```
430
+ */
431
+
432
+ interface ComponentInstance {
433
+ $el: HTMLElement;
434
+ $props: Record<string, any>;
435
+ $refs: Record<string, Element>;
436
+ $scope: Scope;
437
+ $parent: ComponentInstance | null;
438
+ $name: string;
439
+ emit(event: string, detail?: unknown): void;
440
+ [key: string]: any;
441
+ }
442
+ /** Already mounted components, for inspection by devtools. */
443
+ declare const instances: Set<ComponentInstance>;
444
+ /**
445
+ * Registers a component.
446
+ *
447
+ * ```js
448
+ * V.component('counter', {
449
+ * props: { start: { type: 'number', default: 0 } },
450
+ * state(props) { return { count: props.start } },
451
+ * computed: { double() { return this.count * 2 } },
452
+ * methods: { increment() { this.count++ } },
453
+ * template: `
454
+ * <button v-click="increment" v-text="count"></button>
455
+ * <small v-text="double"></small>
456
+ * `,
457
+ * mounted() { console.log('mounted') }
458
+ * })
459
+ * ```
460
+ */
461
+ declare function defineComponent(name: string, definition: ComponentDefinition): void;
462
+ /**
463
+ * Mounts a component on an element and returns the resulting scope.
464
+ * Called by the walker when it finds `v-component` or a registered tag.
465
+ */
466
+ declare function mountComponent(el: HTMLElement, name: string, parentScope: Scope): Scope | null;
467
+
468
+ /**
469
+ * @module storage
470
+ *
471
+ * Uniform access to localStorage, sessionStorage, cookies, query string, and an
472
+ * in-memory cache with expiration. All reads and writes are safe: in private mode,
473
+ * with full quota, or outside the browser, calls do not throw.
474
+ */
475
+ interface StorageAdapter {
476
+ get<T = unknown>(key: string, fallback?: T): T | undefined;
477
+ set(key: string, value: unknown): boolean;
478
+ remove(key: string): void;
479
+ clear(): void;
480
+ has(key: string): boolean;
481
+ keys(): string[];
482
+ }
483
+ /** `localStorage` with automatic JSON serialization. */
484
+ declare const storage: StorageAdapter;
485
+ /** `sessionStorage` with automatic JSON serialization. */
486
+ declare const session: StorageAdapter;
487
+ interface CookieOptions {
488
+ /** Days until expiry, or a date. */
489
+ expires?: number | Date;
490
+ path?: string;
491
+ domain?: string;
492
+ secure?: boolean;
493
+ sameSite?: 'Strict' | 'Lax' | 'None';
494
+ }
495
+ declare const cookie: {
496
+ get(name: string): string | undefined;
497
+ set(name: string, value: string, options?: CookieOptions): void;
498
+ remove(name: string, options?: CookieOptions): void;
499
+ has(name: string): boolean;
500
+ };
501
+ declare const url: {
502
+ /** Reads a parameter from the current URL. */
503
+ get(key: string, fallback?: string): string | undefined;
504
+ /** Reads all parameters as an object. */
505
+ all(): Record<string, string>;
506
+ /** Writes a parameter without reloading the page. */
507
+ set(key: string, value: string | number | null, replace?: boolean): void;
508
+ remove(key: string, replace?: boolean): void;
509
+ /** Applies multiple parameters at once. */
510
+ merge(params: Record<string, string | number | null>, replace?: boolean): void;
511
+ };
512
+ declare const cache: {
513
+ /** Stores a value. `ttl` in milliseconds, `0` means no expiration. */
514
+ set<T>(key: string, value: T, ttl?: number): T;
515
+ get<T = unknown>(key: string, fallback?: T): T | undefined;
516
+ has(key: string): boolean;
517
+ remove(key: string): void;
518
+ clear(): void;
519
+ /** Executes the function only when the value is not in cache. */
520
+ remember<T>(key: string, ttl: number, factory: () => Promise<T> | T): Promise<T>;
521
+ readonly size: number;
522
+ };
523
+ type ThemeName = 'light' | 'dark' | 'system';
524
+ declare const theme: {
525
+ /** Theme chosen by the user, or `system` when never set. */
526
+ readonly current: ThemeName;
527
+ /** Theme effectively applied, resolving `system`. */
528
+ readonly resolved: "light" | "dark";
529
+ set(value: ThemeName): void;
530
+ toggle(): "light" | "dark";
531
+ /** `true` once the visitor has actually picked a theme. */
532
+ readonly chosen: boolean;
533
+ /** Writes `data-theme` on the root element and notifies the page. */
534
+ apply(): void;
535
+ /**
536
+ * Applies the saved theme as soon as the page loads.
537
+ *
538
+ * Does nothing when the visitor never chose one, which is the common case on
539
+ * a page that simply included the script.
540
+ */
541
+ init(): void;
542
+ };
543
+
544
+ /**
545
+ * @module ui/toast
546
+ *
547
+ * Temporary notifications. No dependencies, with queue, mouse-over pause,
548
+ * progress bar, optional action, and promise support.
549
+ *
550
+ * ```js
551
+ * V.toast.success('User saved!')
552
+ * V.toast.promise(save(), { loading: 'Saving', success: 'Done', error: 'Failed' })
553
+ * ```
554
+ */
555
+ type ToastType = 'success' | 'error' | 'warning' | 'info' | 'loading' | 'default';
556
+ type ToastPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
557
+ interface ToastOptions {
558
+ title?: string;
559
+ description?: string;
560
+ type?: ToastType;
561
+ /** Milliseconds until close. `0` keeps it open until the user closes it. */
562
+ duration?: number;
563
+ position?: ToastPosition;
564
+ /** Action button inside the notification. */
565
+ action?: {
566
+ label: string;
567
+ onClick: () => void;
568
+ };
569
+ /** Show the close button. */
570
+ closable?: boolean;
571
+ /** Custom HTML in place of default content. Use with caution. */
572
+ html?: string;
573
+ onClose?: () => void;
574
+ }
575
+ interface ToastHandle {
576
+ id: string;
577
+ close(): void;
578
+ update(options: Partial<ToastOptions>): void;
579
+ }
580
+ declare const settings: {
581
+ duration: number;
582
+ position: ToastPosition;
583
+ max: number;
584
+ };
585
+ declare const toast: ((message: string | ToastOptions, options?: Partial<ToastOptions>) => ToastHandle) & {
586
+ success: (message: string | ToastOptions, options?: Partial<ToastOptions>) => ToastHandle;
587
+ error: (message: string | ToastOptions, options?: Partial<ToastOptions>) => ToastHandle;
588
+ warning: (message: string | ToastOptions, options?: Partial<ToastOptions>) => ToastHandle;
589
+ info: (message: string | ToastOptions, options?: Partial<ToastOptions>) => ToastHandle;
590
+ loading: (message: string | ToastOptions, options?: Partial<ToastOptions>) => ToastHandle;
591
+ /**
592
+ * Monitor a promise: show loading, then success or error.
593
+ *
594
+ * ```js
595
+ * V.toast.promise(save(), {
596
+ * loading: 'Saving...',
597
+ * success: (data) => `Saved with id ${data.id}`,
598
+ * error: 'Failed to save'
599
+ * })
600
+ * ```
601
+ */
602
+ promise<T>(promise: Promise<T>, messages?: {
603
+ loading?: string;
604
+ success?: string | ((value: T) => string);
605
+ error?: string | ((error: unknown) => string);
606
+ }): Promise<T>;
607
+ /** Close all open notifications. */
608
+ clear(): void;
609
+ /** Adjust default duration, position, and limit. */
610
+ configure(options: Partial<typeof settings>): void;
611
+ settings: {
612
+ duration: number;
613
+ position: ToastPosition;
614
+ max: number;
615
+ };
616
+ };
617
+
618
+ /**
619
+ * @module runtime/walker
620
+ *
621
+ * Walks the DOM, finds `v-*`, `:` and `@` attributes, and connects each to the
622
+ * reactive system. This is the engine that turns HTML into an application.
623
+ *
624
+ * Order rules for a single element:
625
+ * 1. `v-ignore` and `v-pre` cancel processing.
626
+ * 2. Terminal directives (`v-for`, `v-if`) take control of the subtree.
627
+ * 3. `v-data` and `v-component` create the scope used by the rest.
628
+ * 4. Other directives run by descending priority.
629
+ * 5. Children are walked with the resulting scope.
630
+ */
631
+
632
+ /** Scope associated with a node, if any. */
633
+ declare function getScope(node: Node): Scope | undefined;
634
+ /** Effective scope of a node, walking up through ancestors. */
635
+ declare function findScope(node: Node | null): Scope;
636
+ /** Registers a function executed when the node is removed from the DOM. */
637
+ declare function addCleanup(node: Node, fn: () => void): void;
638
+ /**
639
+ * Unmounts a node and all descendants: stops effects, removes listeners, and
640
+ * fires the `beforeUnmount` and `unmounted` hooks.
641
+ */
642
+ declare function destroy(node: Node): void;
643
+ interface ParsedAttribute {
644
+ /** Attribute name as written in HTML. */
645
+ raw: string;
646
+ /** Directive name, without prefix, like `text`, `on`, `toast-success`. */
647
+ name: string;
648
+ /** Argument after the colon, like `click` in `v-on:click`. */
649
+ arg?: string;
650
+ modifiers: Record<string, string | true>;
651
+ /** Attribute value. */
652
+ expression: string;
653
+ }
654
+ /**
655
+ * Converts an HTML attribute into a directive description.
656
+ * Returns `null` when the attribute doesn't belong to Voodoo.
657
+ *
658
+ * ```
659
+ * v-on:click.prevent="save" -> { name:'on', arg:'click', modifiers:{prevent:true} }
660
+ * :disabled="loading" -> { name:'bind', arg:'disabled' }
661
+ * @submit.prevent="save" -> { name:'on', arg:'submit', modifiers:{prevent:true} }
662
+ * ```
663
+ */
664
+ declare function parseAttribute(name: string, value: string): ParsedAttribute | null;
665
+ /**
666
+ * Evaluates an expression in the given scope. Errors are reported without
667
+ * breaking the page, because a problematic attribute shouldn't crash the rest
668
+ * of the app.
669
+ */
670
+ declare function evaluateIn<T = any>(expression: string, scope: Scope, context?: string, el?: Element | null): T;
671
+ /**
672
+ * Walks a node applying the directives found.
673
+ *
674
+ * @param node root of the section to initialize
675
+ * @param scope scope applied to the node. When absent, inferred from ancestors.
676
+ */
677
+ declare function walk(node: Node, scope?: Scope): void;
678
+ /** Initializes Voodoo in a root. Called automatically in the browser. */
679
+ declare function start(root?: Element | Document): void;
680
+ /** Stops automatic DOM observation. */
681
+ declare function stopObserving(): void;
682
+ /** Reinitializes Voodoo within a root, useful in tests. */
683
+ declare function refresh(root?: Element): void;
684
+
685
+ /**
686
+ * @module runtime/app
687
+ *
688
+ * Application mode: `createApp(...).mount('#app')`.
689
+ *
690
+ * Voodoo's traditional mode binds attributes to existing HTML. This module adds
691
+ * the alternative path used by Vue and React: the entire application is described
692
+ * in JavaScript, has its own root, and HTML comes from the template.
693
+ *
694
+ * ```js
695
+ * const app = V.createApp({
696
+ * data: () => ({ n: 0 }),
697
+ * computed: { dobro() { return this.n * 2 } },
698
+ * methods: { somar() { this.n++ } },
699
+ * template: `
700
+ * <button @click="somar()">Cliques: { n }</button>
701
+ * <p>Dobro: { dobro }</p>
702
+ * `
703
+ * })
704
+ *
705
+ * app.mount('#app')
706
+ * ```
707
+ *
708
+ * Two intentional differences from Vue:
709
+ *
710
+ * 1. `mount` accepts a target that doesn't exist yet. No race with page loading,
711
+ * because Voodoo's own scheduler waits, not `DOMContentLoaded`.
712
+ * 2. `unmount` restores the container to original HTML instead of leaving it empty.
713
+ */
714
+
715
+ interface AppOptions extends ComponentDefinition {
716
+ /** Components visible only within this application. */
717
+ components?: Record<string, ComponentDefinition>;
718
+ /** Values delivered to the entire tree, read with `inject`. */
719
+ provide?: Record<string, unknown> | (() => Record<string, unknown>);
720
+ }
721
+ interface AppConfig {
722
+ /** Values allowed inside this application's expressions. */
723
+ globalProperties: Record<string, unknown>;
724
+ }
725
+ interface App {
726
+ /** Internal name of the root component, useful in messages and inspector. */
727
+ readonly name: string;
728
+ readonly config: AppConfig;
729
+ /** Root instance, or `null` until the application is mounted. */
730
+ readonly instance: ComponentInstance | null;
731
+ /** Element that received the application, or `null`. */
732
+ readonly container: Element | null;
733
+ readonly isMounted: boolean;
734
+ component(name: string): ComponentDefinition | undefined;
735
+ component(name: string, definition: ComponentDefinition): App;
736
+ directive(name: string, definition: unknown): App;
737
+ use(plugin: VoodooPlugin | Function, options?: Record<string, unknown>): App;
738
+ provide(key: string, value: unknown): App;
739
+ /**
740
+ * Mounts the application. The target can be a selector or element, and may
741
+ * not exist yet: in that case mounting happens as soon as it appears.
742
+ */
743
+ mount(target: string | Element): ComponentInstance | null;
744
+ /** Promise resolved with the root instance when mounting happens. */
745
+ whenMounted(): Promise<ComponentInstance>;
746
+ /** Unmount and restore the container to its original content. */
747
+ unmount(): void;
748
+ }
749
+ /**
750
+ * Creates an application. Options are the same as for a component, plus
751
+ * `components` and `provide`.
752
+ */
753
+ declare function createApp(options?: AppOptions): App;
754
+
755
+ /**
756
+ * @module runtime/boot
757
+ *
758
+ * Voodoo's custom initialization scheduler.
759
+ *
760
+ * The library doesn't use `DOMContentLoaded` or `document.readyState` to know
761
+ * when to start. Instead it maintains its own loop: at each step it asks whether
762
+ * a task's condition is met, and executes those that are.
763
+ *
764
+ * The reason is simple. Browser load events answer the wrong question.
765
+ * `DOMContentLoaded` says the parser finished, not that the tree we care about
766
+ * exists. A page rendered by another script, a fragment inserted later, a
767
+ * container that only appears on the second viewport: in all these cases the
768
+ * event already passed, or will pass too early.
769
+ *
770
+ * The loop here answers the right question: "do I have what I need in the
771
+ * document and has it stopped changing?". This applies both to automatic startup
772
+ * and to `app.mount('#app')` called before `#app` exists.
773
+ *
774
+ * ```js
775
+ * whenReady(() => V.start()) // document stable
776
+ * whenElement('#app', (el) => mount(el)) // element, whether it exists or not
777
+ * ```
778
+ */
779
+ /**
780
+ * Executes when the document has a body and stops changing.
781
+ *
782
+ * Replaces `DOMContentLoaded`. The practical difference appears in two cases:
783
+ * a script without `defer` in `<head>`, where the body doesn't exist yet, and a
784
+ * page rendered by another script, where the event already passed.
785
+ */
786
+ declare function whenReady(action: () => void): void;
787
+ /**
788
+ * Resolves an element that may not exist yet.
789
+ *
790
+ * ```js
791
+ * whenElement('#app', (el) => app.mount(el))
792
+ * ```
793
+ */
794
+ declare function whenElement(target: string | Element, action: (el: Element) => void, onGiveUp?: () => void): void;
795
+ /** Promise resolved when the document is ready by the above criterion. */
796
+ declare function ready$1(): Promise<void>;
797
+
798
+ /**
799
+ * @module http/resource
800
+ *
801
+ * Reactive resource: a request with loading state, error, and data ready to be
802
+ * read directly in HTML.
803
+ *
804
+ * It's the same core used by `v-resource`. The directive just reads the
805
+ * configuration from attributes and calls this function, so the behavior of
806
+ * both is always the same, with no duplicated logic.
807
+ *
808
+ * ```js
809
+ * const produtos = V.resource('/api/produtos')
810
+ * V.effect(() => console.log(produtos.loading, produtos.data))
811
+ * await produtos.reload()
812
+ * ```
813
+ */
814
+
815
+ interface ResourceOptions {
816
+ /** HTTP verb. Default `GET`. */
817
+ method?: HttpMethod;
818
+ /** Query parameters. A function is re-evaluated on each request. */
819
+ params?: Record<string, string | number | boolean | null | undefined> | (() => Record<string, string | number | boolean | null | undefined> | undefined);
820
+ /** Response cache duration in ms. */
821
+ cache?: number;
822
+ /** Extra attempts on failure. */
823
+ retry?: number;
824
+ /** Milliseconds before aborting. */
825
+ timeout?: number;
826
+ headers?: Record<string, string>;
827
+ /** Path within the JSON response, like `data.items`. */
828
+ jsonPath?: string | null;
829
+ /** Don't fire the first request automatically. */
830
+ manual?: boolean;
831
+ /** Repeat request every N ms while the tab is visible. */
832
+ poll?: number;
833
+ /** Called after each successful response. */
834
+ onSuccess?(data: unknown): void;
835
+ /** Called when request fails, with message already extracted. */
836
+ onError?(err: unknown, message: string): void;
837
+ }
838
+ interface Resource<T = unknown> {
839
+ /** Response body, already sliced by `jsonPath` if present. */
840
+ data: T | null;
841
+ /** `true` while request is in progress. */
842
+ loading: boolean;
843
+ /** Error from last attempt, or `null`. */
844
+ error: (Error & {
845
+ message: string;
846
+ }) | null;
847
+ /** `true` after first successful response. */
848
+ loaded: boolean;
849
+ /** Redo the request. */
850
+ reload(): Promise<void>;
851
+ /** Change data locally, useful for optimistic updates. */
852
+ set(value: T): void;
853
+ /** Cancel in-progress request and stop automatic repetition. */
854
+ stop(): void;
855
+ }
856
+ /**
857
+ * Creates a reactive resource.
858
+ *
859
+ * @param url fixed address, or function that returns the address on each call.
860
+ * Returning empty postpones the request, useful while a parameter doesn't exist.
861
+ * @param options request and lifecycle configuration
862
+ */
863
+ declare function createResource<T = unknown>(url: string | (() => string), options?: ResourceOptions): Resource<T>;
864
+
865
+ /**
866
+ * @module store
867
+ *
868
+ * Reactive global state. A store is a named reactive object, accessible from
869
+ * any expression via the magic variable `$store`.
870
+ *
871
+ * ```js
872
+ * V.store('cart', { items: [], get total() { return this.items.length } })
873
+ * ```
874
+ *
875
+ * ```html
876
+ * <span>{ $store.cart.total }</span>
877
+ * <button v-click="$store.cart.items.push(product)">Add</button>
878
+ * ```
879
+ */
880
+ type StoreDefinition = Record<string, any>;
881
+ interface StoreOptions {
882
+ /** Saves the store to localStorage and restores on next load. */
883
+ persist?: boolean | string;
884
+ }
885
+ /**
886
+ * Creates or retrieves a store.
887
+ *
888
+ * Passing only the name returns the existing store. Passing the definition
889
+ * creates the store. Methods declared in the definition receive `this` pointing
890
+ * to the store itself.
891
+ */
892
+ declare function store<T extends StoreDefinition>(name: string, definition?: T, options?: StoreOptions): T;
893
+ /** All registered stores, used by `$store` and devtools. */
894
+ declare const allStores: Record<string, Record<string, any>>;
895
+ /** Removes a store and stops its associated persistence. */
896
+ declare function removeStore(name: string): void;
897
+ /** Lists the names of existing stores. */
898
+ declare function storeNames(): string[];
899
+
900
+ /**
901
+ * @module dom/style
902
+ *
903
+ * On-demand CSS injection. Each block enters the document only once, only
904
+ * when the corresponding resource is actually used, avoiding dead CSS.
905
+ *
906
+ * All styles use CSS variables with built-in default values. If the project
907
+ * loads Voodoo's design system, colors automatically follow the theme.
908
+ */
909
+ /** Injects a CSS block identified by `id`. Repeating the call does not duplicate. */
910
+ declare function injectStyle(id: string, css: string): void;
911
+ /** Ensures tokens are present before any UI component. */
912
+ declare function ensureTokens(): void;
913
+
914
+ /**
915
+ * @module dom/transition
916
+ *
917
+ * Entry and exit transitions based on CSS classes, in the same model as Vue,
918
+ * but without a wrapper component: just use `v-transition` on the element.
919
+ *
920
+ * Entry cycle:
921
+ * `.{name}-enter-from` applied, next frame switches to `.{name}-enter-to`,
922
+ * both with `.{name}-enter-active`, removed when animation finishes.
923
+ */
924
+ interface TransitionClasses {
925
+ enterFrom?: string;
926
+ enterActive?: string;
927
+ enterTo?: string;
928
+ leaveFrom?: string;
929
+ leaveActive?: string;
930
+ leaveTo?: string;
931
+ }
932
+ interface TransitionOptions extends TransitionClasses {
933
+ /** Base name of the classes. Default `v-fade`. */
934
+ name?: string;
935
+ /** Forced duration in ms. When absent, read from computed CSS. */
936
+ duration?: number;
937
+ }
938
+ /** Executes the entry transition and resolves when it finishes. */
939
+ declare function enter(el: HTMLElement, options?: TransitionOptions): Promise<void>;
940
+ /** Executes the exit transition and resolves when it finishes. */
941
+ declare function leave(el: HTMLElement, options?: TransitionOptions): Promise<void>;
942
+ /** Animates height from 0 to content. Used by `v-collapse`. */
943
+ declare function slideDown(el: HTMLElement, duration?: number): Promise<void>;
944
+ /** Animates height to zero and hides the element. */
945
+ declare function slideUp(el: HTMLElement, duration?: number): Promise<void>;
946
+ /** Appearance with fade. */
947
+ declare function fadeIn(el: HTMLElement, duration?: number): Promise<void>;
948
+ /** Disappearance with fade, ending in `display:none`. */
949
+ declare function fadeOut(el: HTMLElement, duration?: number): Promise<void>;
950
+ /**
951
+ * Smooth layout transitions using the View Transitions API when available.
952
+ * On browsers without support, the function just executes the change.
953
+ */
954
+ declare function viewTransition(update: () => void): void;
955
+
956
+ type EventHandler = (payload?: any) => void;
957
+ /** Subscribes to a global event. Returns a function that cancels the subscription. */
958
+ declare function on(name: string, handler: EventHandler): () => void;
959
+ /** Subscribes to a global event for only the next occurrence. */
960
+ declare function onceEvent(name: string, handler: EventHandler): () => void;
961
+ /** Emits a global event. */
962
+ declare function emit(name: string, payload?: unknown): void;
963
+ declare function off(name: string, handler?: EventHandler): void;
964
+ /**
965
+ * Registers a custom directive.
966
+ *
967
+ * ```js
968
+ * V.directive('highlight', {
969
+ * mounted(el, binding) { el.style.background = binding.value },
970
+ * updated(el, binding) { el.style.background = binding.value }
971
+ * })
972
+ * ```
973
+ *
974
+ * ```html
975
+ * <div v-highlight="'yellow'">Highlight</div>
976
+ * ```
977
+ *
978
+ * Also accepts a short function, called in both `mounted` and `updated`:
979
+ *
980
+ * ```js
981
+ * V.directive('highlight', (el, binding) => { el.style.background = binding.value })
982
+ * ```
983
+ */
984
+ declare function directive<T = any>(name: string, definition: DirectiveHooks<T> | ((el: HTMLElement, binding: DirectiveBinding<T>) => void)): void;
985
+ /**
986
+ * Places values in the root scope, visible to any expression on the page.
987
+ *
988
+ * ```js
989
+ * V.data({ user: null, loading: false })
990
+ * ```
991
+ */
992
+ declare function data<T extends Record<string, unknown>>(values: T): T;
993
+ /**
994
+ * Core of Voodoo. The exported object is also callable: `V('#app')` returns
995
+ * a chainable collection of elements.
996
+ */
997
+ declare const core: {
998
+ version: string;
999
+ config: VoodooConfig;
1000
+ reactive: typeof reactive;
1001
+ ref: typeof ref;
1002
+ shallowRef: typeof shallowRef;
1003
+ computed: typeof computed;
1004
+ effect: typeof effect;
1005
+ watch: typeof watch;
1006
+ watchEffect: typeof watchEffect;
1007
+ nextTick: typeof nextTick;
1008
+ toRaw: typeof toRaw;
1009
+ markRaw: typeof markRaw;
1010
+ unref: typeof unref;
1011
+ stop: typeof stop;
1012
+ effectScope: typeof effectScope;
1013
+ EffectScope: typeof EffectScope;
1014
+ flushSync: typeof flushSync;
1015
+ data: typeof data;
1016
+ store: typeof store;
1017
+ stores: Record<string, Record<string, any>>;
1018
+ removeStore: typeof removeStore;
1019
+ storeNames: typeof storeNames;
1020
+ scope: Scope;
1021
+ component: typeof defineComponent;
1022
+ components: Map<string, ComponentDefinition>;
1023
+ directive: typeof directive;
1024
+ directives: Map<string, DirectiveDefinition>;
1025
+ magic: typeof magic;
1026
+ magics: Map<string, MagicGetter>;
1027
+ createApp: typeof createApp;
1028
+ start: typeof start;
1029
+ whenReady: typeof whenReady;
1030
+ whenElement: typeof whenElement;
1031
+ walk: typeof walk;
1032
+ refresh: typeof refresh;
1033
+ destroy: typeof destroy;
1034
+ stopObserving: typeof stopObserving;
1035
+ getScope: typeof getScope;
1036
+ findScope: typeof findScope;
1037
+ addCleanup: typeof addCleanup;
1038
+ parseAttribute: typeof parseAttribute;
1039
+ parse: typeof parse;
1040
+ tokenize: typeof tokenize;
1041
+ evaluate: typeof evaluate;
1042
+ evaluateIn: typeof evaluateIn;
1043
+ stringify: typeof stringify;
1044
+ clearParseCache: typeof clearParseCache;
1045
+ globals: Record<string, unknown>;
1046
+ http: {
1047
+ defaults: HttpDefaults;
1048
+ get<T = unknown>(url: string, options?: {
1049
+ responseType?: "auto" | "json" | "text" | "blob" | "arrayBuffer" | "formData" | undefined;
1050
+ headers?: Record<string, string> | undefined;
1051
+ credentials?: RequestCredentials | undefined;
1052
+ signal?: AbortSignal | undefined;
1053
+ params?: Record<string, string | number | boolean | null | undefined> | undefined;
1054
+ timeout?: number | undefined;
1055
+ retry?: number | undefined;
1056
+ retryDelay?: number | undefined;
1057
+ retryUnsafe?: boolean | undefined;
1058
+ cache?: number | undefined;
1059
+ onProgress?: ((loaded: number, total: number) => void) | undefined;
1060
+ offlineQueue?: boolean | undefined;
1061
+ }): Promise<T>;
1062
+ post<T = unknown>(url: string, body?: unknown, options?: {
1063
+ responseType?: "auto" | "json" | "text" | "blob" | "arrayBuffer" | "formData" | undefined;
1064
+ headers?: Record<string, string> | undefined;
1065
+ credentials?: RequestCredentials | undefined;
1066
+ signal?: AbortSignal | undefined;
1067
+ params?: Record<string, string | number | boolean | null | undefined> | undefined;
1068
+ timeout?: number | undefined;
1069
+ retry?: number | undefined;
1070
+ retryDelay?: number | undefined;
1071
+ retryUnsafe?: boolean | undefined;
1072
+ cache?: number | undefined;
1073
+ onProgress?: ((loaded: number, total: number) => void) | undefined;
1074
+ offlineQueue?: boolean | undefined;
1075
+ }): Promise<T>;
1076
+ put<T = unknown>(url: string, body?: unknown, options?: {
1077
+ responseType?: "auto" | "json" | "text" | "blob" | "arrayBuffer" | "formData" | undefined;
1078
+ headers?: Record<string, string> | undefined;
1079
+ credentials?: RequestCredentials | undefined;
1080
+ signal?: AbortSignal | undefined;
1081
+ params?: Record<string, string | number | boolean | null | undefined> | undefined;
1082
+ timeout?: number | undefined;
1083
+ retry?: number | undefined;
1084
+ retryDelay?: number | undefined;
1085
+ retryUnsafe?: boolean | undefined;
1086
+ cache?: number | undefined;
1087
+ onProgress?: ((loaded: number, total: number) => void) | undefined;
1088
+ offlineQueue?: boolean | undefined;
1089
+ }): Promise<T>;
1090
+ patch<T = unknown>(url: string, body?: unknown, options?: {
1091
+ responseType?: "auto" | "json" | "text" | "blob" | "arrayBuffer" | "formData" | undefined;
1092
+ headers?: Record<string, string> | undefined;
1093
+ credentials?: RequestCredentials | undefined;
1094
+ signal?: AbortSignal | undefined;
1095
+ params?: Record<string, string | number | boolean | null | undefined> | undefined;
1096
+ timeout?: number | undefined;
1097
+ retry?: number | undefined;
1098
+ retryDelay?: number | undefined;
1099
+ retryUnsafe?: boolean | undefined;
1100
+ cache?: number | undefined;
1101
+ onProgress?: ((loaded: number, total: number) => void) | undefined;
1102
+ offlineQueue?: boolean | undefined;
1103
+ }): Promise<T>;
1104
+ delete<T = unknown>(url: string, options?: {
1105
+ responseType?: "auto" | "json" | "text" | "blob" | "arrayBuffer" | "formData" | undefined;
1106
+ headers?: Record<string, string> | undefined;
1107
+ credentials?: RequestCredentials | undefined;
1108
+ signal?: AbortSignal | undefined;
1109
+ params?: Record<string, string | number | boolean | null | undefined> | undefined;
1110
+ timeout?: number | undefined;
1111
+ retry?: number | undefined;
1112
+ retryDelay?: number | undefined;
1113
+ retryUnsafe?: boolean | undefined;
1114
+ cache?: number | undefined;
1115
+ onProgress?: ((loaded: number, total: number) => void) | undefined;
1116
+ offlineQueue?: boolean | undefined;
1117
+ }): Promise<T>;
1118
+ head(url: string, options?: {
1119
+ responseType?: "auto" | "json" | "text" | "blob" | "arrayBuffer" | "formData" | undefined;
1120
+ headers?: Record<string, string> | undefined;
1121
+ credentials?: RequestCredentials | undefined;
1122
+ signal?: AbortSignal | undefined;
1123
+ params?: Record<string, string | number | boolean | null | undefined> | undefined;
1124
+ timeout?: number | undefined;
1125
+ retry?: number | undefined;
1126
+ retryDelay?: number | undefined;
1127
+ retryUnsafe?: boolean | undefined;
1128
+ cache?: number | undefined;
1129
+ onProgress?: ((loaded: number, total: number) => void) | undefined;
1130
+ offlineQueue?: boolean | undefined;
1131
+ }): Promise<unknown>;
1132
+ request: typeof request;
1133
+ upload<T = unknown>(url: string, data: FormData, options?: {
1134
+ method?: "POST" | "PUT" | "PATCH";
1135
+ headers?: Record<string, string>;
1136
+ onProgress?: (percent: number, loaded: number, total: number) => void;
1137
+ signal?: AbortSignal;
1138
+ }): Promise<T>;
1139
+ sse(url: string, handlers?: {
1140
+ message?: (data: unknown, event: MessageEvent) => void;
1141
+ error?: (e: Event) => void;
1142
+ }): EventSource;
1143
+ stream(url: string, onLine: (line: string) => void, options?: {
1144
+ responseType?: "auto" | "json" | "text" | "blob" | "arrayBuffer" | "formData" | undefined;
1145
+ headers?: Record<string, string> | undefined;
1146
+ credentials?: RequestCredentials | undefined;
1147
+ signal?: AbortSignal | undefined;
1148
+ params?: Record<string, string | number | boolean | null | undefined> | undefined;
1149
+ timeout?: number | undefined;
1150
+ retry?: number | undefined;
1151
+ retryDelay?: number | undefined;
1152
+ retryUnsafe?: boolean | undefined;
1153
+ cache?: number | undefined;
1154
+ onProgress?: ((loaded: number, total: number) => void) | undefined;
1155
+ offlineQueue?: boolean | undefined;
1156
+ }): Promise<void>;
1157
+ interceptors: {
1158
+ request: {
1159
+ use(fn: RequestInterceptor): () => void;
1160
+ };
1161
+ response: {
1162
+ use(fn: ResponseInterceptor): () => void;
1163
+ };
1164
+ error: {
1165
+ use(fn: ErrorInterceptor): () => void;
1166
+ };
1167
+ };
1168
+ setHeader(name: string, value: string | null): void;
1169
+ setToken(token: string | null, scheme?: string): void;
1170
+ setBaseURL(url: string): void;
1171
+ clearCache: typeof clearCache;
1172
+ flushOfflineQueue: typeof flushOfflineQueue;
1173
+ parseDuration: typeof parseDuration;
1174
+ };
1175
+ request: typeof request;
1176
+ HttpError: typeof HttpError;
1177
+ /** Reactive resource via JavaScript, equivalent to `v-resource`. */
1178
+ resource: typeof createResource;
1179
+ toast: ((message: string | ToastOptions, options?: Partial<ToastOptions>) => ToastHandle) & {
1180
+ success: (message: string | ToastOptions, options?: Partial<ToastOptions>) => ToastHandle;
1181
+ error: (message: string | ToastOptions, options?: Partial<ToastOptions>) => ToastHandle;
1182
+ warning: (message: string | ToastOptions, options?: Partial<ToastOptions>) => ToastHandle;
1183
+ info: (message: string | ToastOptions, options?: Partial<ToastOptions>) => ToastHandle;
1184
+ loading: (message: string | ToastOptions, options?: Partial<ToastOptions>) => ToastHandle;
1185
+ promise<T>(promise: Promise<T>, messages?: {
1186
+ loading?: string;
1187
+ success?: string | ((value: T) => string);
1188
+ error?: string | ((error: unknown) => string);
1189
+ }): Promise<T>;
1190
+ clear(): void;
1191
+ configure(options: Partial<{
1192
+ duration: number;
1193
+ position: ToastPosition;
1194
+ max: number;
1195
+ }>): void;
1196
+ settings: {
1197
+ duration: number;
1198
+ position: ToastPosition;
1199
+ max: number;
1200
+ };
1201
+ };
1202
+ storage: StorageAdapter;
1203
+ session: StorageAdapter;
1204
+ cookie: {
1205
+ get(name: string): string | undefined;
1206
+ set(name: string, value: string, options?: CookieOptions): void;
1207
+ remove(name: string, options?: CookieOptions): void;
1208
+ has(name: string): boolean;
1209
+ };
1210
+ cache: {
1211
+ set<T>(key: string, value: T, ttl?: number): T;
1212
+ get<T = unknown>(key: string, fallback?: T): T | undefined;
1213
+ has(key: string): boolean;
1214
+ remove(key: string): void;
1215
+ clear(): void;
1216
+ remember<T>(key: string, ttl: number, factory: () => Promise<T> | T): Promise<T>;
1217
+ readonly size: number;
1218
+ };
1219
+ url: {
1220
+ get(key: string, fallback?: string): string | undefined;
1221
+ all(): Record<string, string>;
1222
+ set(key: string, value: string | number | null, replace?: boolean): void;
1223
+ remove(key: string, replace?: boolean): void;
1224
+ merge(params: Record<string, string | number | null>, replace?: boolean): void;
1225
+ };
1226
+ theme: {
1227
+ readonly current: ThemeName;
1228
+ readonly resolved: "light" | "dark";
1229
+ set(value: ThemeName): void;
1230
+ toggle(): "light" | "dark";
1231
+ readonly chosen: boolean;
1232
+ apply(): void;
1233
+ init(): void;
1234
+ };
1235
+ clipboard: {
1236
+ copy(text: string): Promise<boolean>;
1237
+ read(): Promise<string>;
1238
+ };
1239
+ screen: {
1240
+ width: number;
1241
+ height: number;
1242
+ mobile: boolean;
1243
+ tablet: boolean;
1244
+ desktop: boolean;
1245
+ portrait: boolean;
1246
+ landscape: boolean;
1247
+ matches(query: string): boolean;
1248
+ };
1249
+ network: {
1250
+ online: boolean;
1251
+ type: string;
1252
+ saveData: boolean;
1253
+ slow: boolean;
1254
+ };
1255
+ enter: typeof enter;
1256
+ leave: typeof leave;
1257
+ fadeIn: typeof fadeIn;
1258
+ fadeOut: typeof fadeOut;
1259
+ slideUp: typeof slideUp;
1260
+ slideDown: typeof slideDown;
1261
+ viewTransition: typeof viewTransition;
1262
+ injectStyle: typeof injectStyle;
1263
+ ensureTokens: typeof ensureTokens;
1264
+ on: typeof on;
1265
+ once: typeof onceEvent;
1266
+ off: typeof off;
1267
+ emit: typeof emit;
1268
+ use(plugin: VoodooPlugin | ((V: any) => void), options?: Record<string, unknown>): void;
1269
+ /** Defines error handling for the entire application. */
1270
+ onError(handler: (err: unknown, context: string) => void): void;
1271
+ /** Mounted component instances for inspection. */
1272
+ instances: Set<ComponentInstance>;
1273
+ Scope: typeof Scope;
1274
+ PRIORITY: {
1275
+ readonly IGNORE: 100;
1276
+ readonly FOR: 90;
1277
+ readonly IF: 80;
1278
+ readonly DATA: 70;
1279
+ readonly COMPONENT: 65;
1280
+ readonly REF: 60;
1281
+ readonly BIND: 45;
1282
+ readonly MODEL: 40;
1283
+ readonly DEFAULT: 0;
1284
+ readonly INIT: -10;
1285
+ readonly TRANSITION: -20;
1286
+ };
1287
+ VoodooSyntaxError: typeof VoodooSyntaxError;
1288
+ VoodooRuntimeError: typeof VoodooRuntimeError;
1289
+ uuid(): string;
1290
+ uid(prefix?: string): string;
1291
+ sleep(ms: number): Promise<void>;
1292
+ parseDuration(value: string | number | null | undefined, fallback?: number): number;
1293
+ debounce<T extends (...args: any[]) => any>(fn: T, wait?: number, immediate?: boolean): DebouncedFunction<T>;
1294
+ throttle<T extends (...args: any[]) => any>(fn: T, wait?: number): DebouncedFunction<T>;
1295
+ memoize<T extends (...args: any[]) => any>(fn: T, keyFn?: (...args: Parameters<T>) => string): T & {
1296
+ cache: Map<string, ReturnType<T>>;
1297
+ };
1298
+ clone<T>(value: T): T;
1299
+ merge<T extends Record<string, any>>(target: T, ...sources: Array<Partial<T>>): T;
1300
+ groupBy<T>(list: T[], key: string | ((item: T) => string | number)): Record<string, T[]>;
1301
+ unique<T>(list: T[], key?: string | ((item: T) => unknown)): T[];
1302
+ chunk<T>(list: T[], size?: number): T[][];
1303
+ sortBy<T>(list: T[], key: string | ((item: T) => any), direction?: "asc" | "desc"): T[];
1304
+ get<T = unknown>(object: unknown, path: string, fallback?: T): T | undefined;
1305
+ set(object: Record<string, any>, path: string, value: unknown): void;
1306
+ random(min?: number, max?: number): number;
1307
+ sample<T>(list: T[]): T | undefined;
1308
+ slugify(text: string, separator?: string): string;
1309
+ truncate(text: string, length?: number, suffix?: string): string;
1310
+ capitalize(text: string): string;
1311
+ titleCase(text: string): string;
1312
+ escapeHtml(text: string): string;
1313
+ stripTags(html: string): string;
1314
+ setFormatDefaults(locale?: string, currency?: string): void;
1315
+ formatCurrency(value: number | string, options?: FormatOptions): string;
1316
+ formatNumber(value: number | string, options?: Intl.NumberFormatOptions & FormatOptions): string;
1317
+ formatDate(value: Date | string | number, format?: string | Intl.DateTimeFormatOptions, locale?: string): string;
1318
+ relativeTime(value: Date | string | number, locale?: string): string;
1319
+ formatFileSize(bytes: number, decimals?: number): string;
1320
+ formatPercent(value: number, decimals?: number, locale?: string): string;
1321
+ matchesMedia(query: string): boolean;
1322
+ isBrowser: boolean;
1323
+ device: {
1324
+ readonly touch: boolean;
1325
+ readonly mobile: boolean;
1326
+ readonly tablet: boolean;
1327
+ readonly desktop: boolean;
1328
+ readonly online: boolean;
1329
+ readonly reducedMotion: boolean;
1330
+ readonly darkMode: boolean;
1331
+ };
1332
+ };
1333
+
1334
+ /**
1335
+ * @module dom/query
1336
+ *
1337
+ * Chainable collection of elements. The idea is the same as jQuery: select,
1338
+ * traverse, and manipulate with few lines. The difference is in strict typing,
1339
+ * native iteration with `for...of`, zero dependencies, and integration with
1340
+ * Voodoo's runtime: removing or emptying elements unmounts the reactive effects
1341
+ * tied to them, preventing memory leaks.
1342
+ *
1343
+ * ```js
1344
+ * V.query('.card')
1345
+ * .addClass('ativo')
1346
+ * .on('click', '.botao', function () { V.query(this).closest('.card').remove() })
1347
+ * ```
1348
+ */
1349
+ /** Function executed when the document becomes ready. */
1350
+ type ReadyCallback = () => void;
1351
+ /** Event handler. `this` points to the element that matched the filter. */
1352
+ type QueryEventHandler = (this: HTMLElement, event: Event) => unknown;
1353
+ /** Everything that `query()` accepts as input. */
1354
+ type QueryInput = string | Node | Element | Document | DocumentFragment | ArrayLike<Node> | VoodooCollection | ReadyCallback | null | undefined;
1355
+ /** Filter accepted by `filter`, `not`, and `is`. */
1356
+ type QueryFilter = string | ((el: HTMLElement, index: number) => boolean);
1357
+ /** Coordinates returned by `offset` and `position`. */
1358
+ interface QueryPoint {
1359
+ top: number;
1360
+ left: number;
1361
+ }
1362
+ /** Value accepted when writing simple attributes and properties. */
1363
+ type QueryValue = string | number | boolean | null;
1364
+ /**
1365
+ * Immutable list of elements with chainable methods. Instances are created
1366
+ * by `query()`, never with `new` in user code.
1367
+ */
1368
+ declare class VoodooCollection implements Iterable<HTMLElement> {
1369
+ /** Indexed access, as in `collection[0]`. */
1370
+ [index: number]: HTMLElement;
1371
+ /** Number of elements in the collection. */
1372
+ readonly length: number;
1373
+ /** Elements of the collection, in the order they were found. */
1374
+ readonly elements: HTMLElement[];
1375
+ constructor(elements?: HTMLElement[]);
1376
+ /** Enables `for (const el of query('.item'))`. */
1377
+ [Symbol.iterator](): Iterator<HTMLElement>;
1378
+ /** Descendants that match the selector. */
1379
+ find(selector: string): VoodooCollection;
1380
+ /** Nearest ancestor, including the element itself. */
1381
+ closest(selector: string): VoodooCollection;
1382
+ /** Parent element of each item, optionally filtered. */
1383
+ parent(selector?: string): VoodooCollection;
1384
+ /** All ancestors, from nearest to farthest. */
1385
+ parents(selector?: string): VoodooCollection;
1386
+ /** Direct children, optionally filtered. */
1387
+ children(selector?: string): VoodooCollection;
1388
+ /** Siblings, excluding the elements themselves. */
1389
+ siblings(selector?: string): VoodooCollection;
1390
+ /** Next sibling of each element. */
1391
+ next(selector?: string): VoodooCollection;
1392
+ /** Previous sibling of each element. */
1393
+ prev(selector?: string): VoodooCollection;
1394
+ /** Only the first element. */
1395
+ first(): VoodooCollection;
1396
+ /** Only the last element. */
1397
+ last(): VoodooCollection;
1398
+ /** Element at the specified position. Negative indices count from the end. */
1399
+ eq(index: number): VoodooCollection;
1400
+ /** Keeps only elements that pass the filter. */
1401
+ filter(test: QueryFilter): VoodooCollection;
1402
+ /** Removes from the collection elements that pass the filter. */
1403
+ not(test: QueryFilter): VoodooCollection;
1404
+ /** Keeps elements that contain the specified descendant. */
1405
+ has(target: string | Element): VoodooCollection;
1406
+ /** Checks if at least one element matches the filter. */
1407
+ is(test: QueryFilter): boolean;
1408
+ /** Projects each element to a value and returns a regular array. */
1409
+ map<T>(fn: (el: HTMLElement, index: number) => T): T[];
1410
+ /** Iterates over the collection. Inside the function, `this` is the current element. */
1411
+ each(fn: (this: HTMLElement, el: HTMLElement, index: number) => unknown): this;
1412
+ /** Without arguments returns the array; with index returns an element. */
1413
+ get(): HTMLElement[];
1414
+ get(index: number): HTMLElement | undefined;
1415
+ /** Copy of elements as a regular array. */
1416
+ toArray(): HTMLElement[];
1417
+ /** Joins other elements to the collection without duplication. */
1418
+ add(input: QueryInput, context?: QueryInput): VoodooCollection;
1419
+ /** Slice of the collection with the same semantics as `Array.prototype.slice`. */
1420
+ slice(start?: number, end?: number): VoodooCollection;
1421
+ /** Reads the text of the first element or writes to all. */
1422
+ text(): string;
1423
+ text(value: string | number | null): this;
1424
+ /** Reads the inner HTML of the first element or writes to all. */
1425
+ html(): string;
1426
+ html(value: string | null): this;
1427
+ /** Reads the value of the first field or writes to all. */
1428
+ val(): string | string[];
1429
+ val(value: string | number | boolean | string[] | null): this;
1430
+ /** Reads an attribute of the first element, or writes one or more. */
1431
+ attr(name: string): string | undefined;
1432
+ attr(name: string, value: QueryValue): this;
1433
+ attr(values: Record<string, QueryValue>): this;
1434
+ /** Removes one or more space-separated attributes. */
1435
+ removeAttr(name: string): this;
1436
+ /** Reads a property of the first element or writes to all. */
1437
+ prop<T = unknown>(name: string): T | undefined;
1438
+ prop(name: string, value: unknown): this;
1439
+ /**
1440
+ * Reads and writes `dataset`. Reading converts JSON, numbers, and booleans,
1441
+ * so `data-config='{"a":1}'` comes back as an actual object.
1442
+ */
1443
+ data(): Record<string, unknown>;
1444
+ data(key: string): unknown;
1445
+ data(key: string, value: unknown): this;
1446
+ data(values: Record<string, unknown>): this;
1447
+ /** Reads a computed style or applies one or more styles. */
1448
+ css(property: string): string;
1449
+ css(property: string, value: string | number | null): this;
1450
+ css(values: Record<string, string | number | null>): this;
1451
+ /** Width in pixels of the first element, or writes to all. */
1452
+ width(): number;
1453
+ width(value: string | number): this;
1454
+ /** Height in pixels of the first element, or writes to all. */
1455
+ height(): number;
1456
+ height(value: string | number): this;
1457
+ /** Position of the first element relative to the document. */
1458
+ offset(): QueryPoint;
1459
+ /** Position of the first element relative to the positioned ancestor. */
1460
+ position(): QueryPoint;
1461
+ /** Reads the vertical scroll of the first element or writes to all. */
1462
+ scrollTop(): number;
1463
+ scrollTop(value: number): this;
1464
+ /** Adds one or more space-separated classes. */
1465
+ addClass(value: string): this;
1466
+ /** Removes one or more space-separated classes. */
1467
+ removeClass(value: string): this;
1468
+ /** Toggles classes. The second argument forces on or off. */
1469
+ toggleClass(value: string, force?: boolean): this;
1470
+ /** True when some element has all the specified classes. */
1471
+ hasClass(value: string): boolean;
1472
+ /**
1473
+ * Base of `append`, `prepend`, `before`, and `after`. When the collection has more
1474
+ * than one element, each destination receives a copy and the last gets the
1475
+ * original, which is the expected behavior for those coming from jQuery.
1476
+ */
1477
+ private insert;
1478
+ /** Inserts content at the end of each element. */
1479
+ append(content: QueryInput): this;
1480
+ /** Inserts content at the beginning of each element. */
1481
+ prepend(content: QueryInput): this;
1482
+ /** Inserts content before each element. */
1483
+ before(content: QueryInput): this;
1484
+ /** Inserts content after each element. */
1485
+ after(content: QueryInput): this;
1486
+ /** Moves the collection's elements into the target. */
1487
+ appendTo(target: QueryInput): this;
1488
+ /** Moves the collection's elements to the beginning of the target. */
1489
+ prependTo(target: QueryInput): this;
1490
+ /** Replaces each element with the provided content, unmounting the old one. */
1491
+ replaceWith(content: QueryInput): this;
1492
+ /** Wraps each element with the provided HTML or element. */
1493
+ wrap(wrapper: QueryInput): this;
1494
+ /** Removes the parent of each element, keeping children in place. */
1495
+ unwrap(): this;
1496
+ /** Removes elements from the document and unmounts reactive effects. */
1497
+ remove(): this;
1498
+ /** Empties elements, unmounting removed content. */
1499
+ empty(): this;
1500
+ /** Clones elements. The clone starts without directives initialized. */
1501
+ clone(deep?: boolean): VoodooCollection;
1502
+ /**
1503
+ * Listens for events. With the second argument as a string, uses delegation:
1504
+ * `on('click', '.item', fn)` continues to work for items created later.
1505
+ */
1506
+ on(types: string, handler: QueryEventHandler, options?: AddEventListenerOptions): this;
1507
+ on(types: string, selector: string, handler: QueryEventHandler, options?: AddEventListenerOptions): this;
1508
+ /**
1509
+ * Removes listeners registered by `on`. Without arguments removes all, with type
1510
+ * removes those for that event, and with selector or function refines further.
1511
+ */
1512
+ off(types?: string, selectorOrHandler?: string | QueryEventHandler, handler?: QueryEventHandler): this;
1513
+ /** Listens only once. Accepts delegation like `on`. */
1514
+ once(types: string, handler: QueryEventHandler): this;
1515
+ once(types: string, selector: string, handler: QueryEventHandler): this;
1516
+ /**
1517
+ * Dispatches an event. Native events with their own method, like `click` and
1518
+ * `focus`, use the element's method when there is no `detail`.
1519
+ */
1520
+ trigger(type: string, detail?: unknown): this;
1521
+ /** Dispatches a custom event that bubbles up the tree, component-style. */
1522
+ emit(type: string, detail?: unknown): this;
1523
+ /** Shows elements by restoring their previous display value. */
1524
+ show(): this;
1525
+ /** Hides elements while saving their current display value. */
1526
+ hide(): this;
1527
+ /** Toggles visibility. The argument forces show or hide. */
1528
+ toggle(force?: boolean): this;
1529
+ /** Appearance with fade. */
1530
+ fadeIn(duration?: number): this;
1531
+ /** Disappearance with fade, ending hidden. */
1532
+ fadeOut(duration?: number): this;
1533
+ /** Collapses height to zero. */
1534
+ slideUp(duration?: number): this;
1535
+ /** Expands height to content. */
1536
+ slideDown(duration?: number): this;
1537
+ /** Toggles between collapse and expand. */
1538
+ slideToggle(duration?: number): this;
1539
+ /** Animation via Web Animations API. */
1540
+ animate(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions): this;
1541
+ /** Scrolls the page to the first element. */
1542
+ scrollIntoView(options?: boolean | ScrollIntoViewOptions): this;
1543
+ /** Serializes the first element's fields as a query string. */
1544
+ serialize(): string;
1545
+ /**
1546
+ * Serializes fields into an object. Repeated names and names ending in
1547
+ * `[]` become arrays, checkboxes become booleans, and numeric fields become numbers.
1548
+ */
1549
+ serializeObject(): Record<string, unknown>;
1550
+ /** Sets focus on the first element. */
1551
+ focus(options?: FocusOptions): this;
1552
+ /** Removes focus from all elements. */
1553
+ blur(): this;
1554
+ /** Selects the text of the collection's fields. */
1555
+ select(): this;
1556
+ /**
1557
+ * Initializes directives for the collection's elements, inheriting the parent's scope.
1558
+ * With `force`, unmounts first to restart from scratch.
1559
+ */
1560
+ walk(force?: boolean): this;
1561
+ /** Unmounts effects, listeners, and components while keeping elements in the DOM. */
1562
+ destroy(): this;
1563
+ }
1564
+ /**
1565
+ * Creates a collection from a CSS selector, element, list of elements,
1566
+ * HTML string, or function.
1567
+ *
1568
+ * ```js
1569
+ * V.query('#lista li') // selector
1570
+ * V.query(document.body) // element
1571
+ * V.query('<li>novo</li>') // creates elements
1572
+ * V.query(() => iniciar()) // equivalent to V.ready
1573
+ * ```
1574
+ *
1575
+ * @param input selector, node, list, HTML or initialization function
1576
+ * @param context optional search root, useful for local scopes
1577
+ */
1578
+ declare function query(input?: QueryInput, context?: QueryInput): VoodooCollection;
1579
+ /**
1580
+ * Executes the function when Voodoo considers the document ready, and returns a
1581
+ * promise for the same moment. Both forms work:
1582
+ *
1583
+ * ```js
1584
+ * V.ready(() => console.log('pronto'))
1585
+ * await V.ready()
1586
+ * ```
1587
+ *
1588
+ * The library's own scheduler decides the time, waiting for the body to exist
1589
+ * and the tree to stop growing. This does not listen to `DOMContentLoaded`.
1590
+ */
1591
+ declare function ready(fn?: ReadyCallback): Promise<void>;
1592
+ /** Creates elements from an HTML string without inserting them in the document. */
1593
+ declare function fromHtml(html: string): VoodooCollection;
1594
+
1595
+ export { store as $, type App as A, findScope as B, type ComponentDefinition as C, type DirectiveBinding as D, fromHtml as E, getScope as F, injectStyle as G, instances as H, leave as I, magic as J, magics as K, mountComponent as L, parse as M, query as N, ready as O, PRIORITY as P, refresh as Q, type Resource as R, Scope as S, removeStore as T, rootScope as U, VoodooCollection as V, session as W, slideDown as X, slideUp as Y, start as Z, storage as _, type AppOptions as a, storeNames as a0, stringify as a1, theme as a2, toast as a3, tokenize as a4, url as a5, viewTransition as a6, walk as a7, whenElement as a8, whenReady as a9, type DirectiveHooks as b, core as c, type ResourceOptions as d, type VoodooConfig as e, type VoodooPlugin as f, VoodooRuntimeError as g, VoodooSyntaxError as h, addCleanup as i, allStores as j, allowedGlobals as k, cache as l, clearParseCache as m, config as n, cookie as o, createApp as p, createResource as q, defineComponent as r, defineDirective as s, destroy as t, ready$1 as u, ensureTokens as v, enter as w, evaluate as x, fadeIn as y, fadeOut as z };