voodoojs 0.4.6 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -942,5 +942,5 @@ Object.defineProperty(factory, "open", {
942
942
  var socket = factory;
943
943
 
944
944
  export { ENGINE, SIO, createSocket, decodeEngine, decodeSocketIo, devtoolsBus, encodeSocketIo, engineURL, resolveSocketURL, socket, socketSupported };
945
- //# sourceMappingURL=chunk-RJUNPXQF.js.map
946
- //# sourceMappingURL=chunk-RJUNPXQF.js.map
945
+ //# sourceMappingURL=chunk-4LR3IFPX.js.map
946
+ //# sourceMappingURL=chunk-4LR3IFPX.js.map
@@ -1,5 +1,5 @@
1
1
  import { http, HttpError, request } from './chunk-PQZEVFVZ.js';
2
- import { stringify, markInitialized, markSkipChildren, destroy, walk, removeQuietly, evaluateIn, addCleanup, markNodeScope, setComponentMounter, closestDirective, magic, readAttr, hasAttr, componentAliases, Scope, queryDirective, parse, evaluate, parseAttribute, originalAttributes, findScope, VoodooRuntimeError, VoodooSyntaxError, allowedGlobals, clearParseCache, tokenize, getScope, stopObserving, refresh, start, magics, rootScope, isInitialized, restoreAttributes, hasDirectives } from './chunk-5CKGDARU.js';
2
+ import { stringify, markInitialized, markSkipChildren, destroy, walk, removeQuietly, evaluateIn, addCleanup, markNodeScope, setComponentMounter, closestDirective, magic, readAttr, hasAttr, componentAliases, Scope, queryDirective, parse, evaluate, parseAttribute, originalAttributes, hasDirective, findScope, VoodooRuntimeError, VoodooSyntaxError, allowedGlobals, clearParseCache, tokenize, getScope, stopObserving, refresh, start, magics, rootScope, isInitialized, restoreAttributes, hasDirectives } from './chunk-PHMBDPWH.js';
3
3
  import { ref, reactive, handleError, nextTick, queuePostFlush, warn, watch, EffectScope, computed, effect, toRaw, flushSync, effectScope, stop, unref, markRaw, watchEffect, shallowRef, setErrorHandler } from './chunk-NNU6WOOU.js';
4
4
  import { warnDuplicateKey, warn as warn$1, describeElement, warnUnknownComponent, warnAlias, warnRequiredProp } from './chunk-A2UOVQBP.js';
5
5
  import { parseDuration, debounce, utils_exports, throttle, uid, device, escapeHtml } from './chunk-234ZLC6W.js';
@@ -617,7 +617,7 @@ function globalThis_V() {
617
617
 
618
618
  // src/store/index.ts
619
619
  var stores = /* @__PURE__ */ new Map();
620
- var versao = ref(0);
620
+ var version = ref(0);
621
621
  var persistHandles = /* @__PURE__ */ new Map();
622
622
  function store(name, definition, options = {}) {
623
623
  const existing = stores.get(name);
@@ -634,30 +634,30 @@ function store(name, definition, options = {}) {
634
634
  return existing;
635
635
  }
636
636
  const key = typeof options.persist === "string" ? options.persist : `voodoo:store:${name}`;
637
- const descritores = Object.getOwnPropertyDescriptors(definition);
638
- const initial = Object.defineProperties({}, descritores);
637
+ const descriptors = Object.getOwnPropertyDescriptors(definition);
638
+ const initial = Object.defineProperties({}, descriptors);
639
639
  if (options.persist && typeof localStorage !== "undefined") {
640
640
  try {
641
641
  const saved = localStorage.getItem(key);
642
642
  if (saved) {
643
- const salvo = JSON.parse(saved);
644
- for (const [chave, valor] of Object.entries(salvo)) {
645
- if (descritores[chave] && !("value" in descritores[chave])) continue;
646
- initial[chave] = valor;
643
+ const parsed = JSON.parse(saved);
644
+ for (const [field, value] of Object.entries(parsed)) {
645
+ if (descriptors[field] && !("value" in descriptors[field])) continue;
646
+ initial[field] = value;
647
647
  }
648
648
  }
649
649
  } catch {
650
650
  }
651
651
  }
652
652
  const created = reactive(initial);
653
- for (const [prop, descritor] of Object.entries(descritores)) {
654
- const value = descritor.value;
653
+ for (const [prop, descriptor] of Object.entries(descriptors)) {
654
+ const value = descriptor.value;
655
655
  if (typeof value === "function") {
656
656
  created[prop] = (...args) => value.apply(created, args);
657
657
  }
658
658
  }
659
659
  stores.set(name, created);
660
- versao.value++;
660
+ version.value++;
661
661
  if (options.persist && typeof localStorage !== "undefined") {
662
662
  const stop2 = watch(
663
663
  created,
@@ -675,10 +675,10 @@ function store(name, definition, options = {}) {
675
675
  }
676
676
  function stripFunctions(source) {
677
677
  const out = {};
678
- const descritores = Object.getOwnPropertyDescriptors(toRaw(source));
678
+ const descriptors = Object.getOwnPropertyDescriptors(toRaw(source));
679
679
  for (const [key, value] of Object.entries(source)) {
680
680
  if (typeof value === "function") continue;
681
- if (descritores[key] && !("value" in descritores[key])) continue;
681
+ if (descriptors[key] && !("value" in descriptors[key])) continue;
682
682
  out[key] = value;
683
683
  }
684
684
  return out;
@@ -687,11 +687,11 @@ var allStores = new Proxy(
687
687
  {},
688
688
  {
689
689
  get: (_t, key) => {
690
- void versao.value;
690
+ void version.value;
691
691
  return stores.get(key);
692
692
  },
693
693
  has: (_t, key) => {
694
- void versao.value;
694
+ void version.value;
695
695
  return stores.has(key);
696
696
  },
697
697
  ownKeys: () => [...stores.keys()],
@@ -794,6 +794,7 @@ function render(options) {
794
794
  element.setAttribute("data-type", type);
795
795
  element.setAttribute("role", type === "error" ? "alert" : "status");
796
796
  element.setAttribute("aria-live", type === "error" ? "assertive" : "polite");
797
+ element.setAttribute("aria-atomic", "true");
797
798
  let closed = false;
798
799
  let timer = null;
799
800
  const close = () => {
@@ -1114,10 +1115,11 @@ var cache = {
1114
1115
  }
1115
1116
  };
1116
1117
  var THEME_KEY = "voodoo:theme";
1118
+ var picked = null;
1117
1119
  var theme = {
1118
1120
  /** Theme chosen by the user, or `system` when never set. */
1119
1121
  get current() {
1120
- return storage.get(THEME_KEY) ?? "system";
1122
+ return storage.get(THEME_KEY) ?? picked ?? "system";
1121
1123
  },
1122
1124
  /** Theme effectively applied, resolving `system`. */
1123
1125
  get resolved() {
@@ -1127,6 +1129,7 @@ var theme = {
1127
1129
  return matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
1128
1130
  },
1129
1131
  set(value) {
1132
+ picked = value;
1130
1133
  storage.set(THEME_KEY, value);
1131
1134
  this.apply();
1132
1135
  },
@@ -1137,7 +1140,7 @@ var theme = {
1137
1140
  },
1138
1141
  /** `true` once the visitor has actually picked a theme. */
1139
1142
  get chosen() {
1140
- return storage.get(THEME_KEY) != null;
1143
+ return picked !== null || storage.get(THEME_KEY) != null;
1141
1144
  },
1142
1145
  /** Writes `data-theme` on the root element and notifies the page. */
1143
1146
  apply() {
@@ -1161,7 +1164,8 @@ var theme = {
1161
1164
  init() {
1162
1165
  if (typeof document === "undefined") return;
1163
1166
  this.apply();
1164
- matchMedia?.("(prefers-color-scheme: dark)").addEventListener("change", () => {
1167
+ if (typeof matchMedia === "undefined") return;
1168
+ matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
1165
1169
  if (this.current === "system") this.apply();
1166
1170
  });
1167
1171
  }
@@ -1589,8 +1593,8 @@ function transitionOptions(el) {
1589
1593
  defineDirective("text", ({ el, effect: effect2, evaluate: ev }) => {
1590
1594
  effect2(() => {
1591
1595
  el.textContent = stringify(ev());
1592
- const primeiro = el.firstChild;
1593
- if (primeiro && primeiro.nodeType === 3) markInitialized(primeiro);
1596
+ const first = el.firstChild;
1597
+ if (first && first.nodeType === 3) markInitialized(first);
1594
1598
  });
1595
1599
  });
1596
1600
  defineDirective("html", (ctx) => {
@@ -1793,10 +1797,10 @@ defineDirective(
1793
1797
  next.push({ key, scope: childScope, nodes, data: childScope.data });
1794
1798
  });
1795
1799
  if (batch.fragment.firstChild) anchor.parentNode?.insertBefore(batch.fragment, anchor);
1796
- for (const [node, escopo] of batch.pending) walk(node, escopo);
1797
- const reaproveitados = new Set(next);
1800
+ for (const [node, rowScope] of batch.pending) walk(node, rowScope);
1801
+ const reused = new Set(next);
1798
1802
  for (const block2 of blocks) {
1799
- if (used.has(block2.key) && reaproveitados.has(block2)) continue;
1803
+ if (used.has(block2.key) && reused.has(block2)) continue;
1800
1804
  for (const node of block2.nodes) {
1801
1805
  destroy(node);
1802
1806
  node.remove();
@@ -1866,7 +1870,7 @@ var BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
1866
1870
  "novalidate",
1867
1871
  "inert"
1868
1872
  ]);
1869
- var ATRIBUTOS_DE_URL = /* @__PURE__ */ new Set([
1873
+ var URL_ATTRIBUTES = /* @__PURE__ */ new Set([
1870
1874
  "href",
1871
1875
  "src",
1872
1876
  "action",
@@ -1875,15 +1879,15 @@ var ATRIBUTOS_DE_URL = /* @__PURE__ */ new Set([
1875
1879
  "ping",
1876
1880
  "poster"
1877
1881
  ]);
1878
- var RUIDO_DE_ESQUEMA = /[\s\x00-\x1f]/g;
1879
- function urlPerigosa(valor) {
1880
- const limpo = valor.replace(RUIDO_DE_ESQUEMA, "").toLowerCase();
1881
- return limpo.startsWith("javascript:") || limpo.startsWith("vbscript:") || limpo.startsWith("data:text/html") || limpo.startsWith("data:application/xhtml");
1882
+ var SCHEME_NOISE = /[\s\x00-\x1f]/g;
1883
+ function isDangerousUrl(value) {
1884
+ const clean = value.replace(SCHEME_NOISE, "").toLowerCase();
1885
+ return clean.startsWith("javascript:") || clean.startsWith("vbscript:") || clean.startsWith("data:text/html") || clean.startsWith("data:application/xhtml");
1882
1886
  }
1883
- function applyBinding(el, name, value, asProp = false, perigoLiberado = false) {
1887
+ function applyBinding(el, name, value, asProp = false, allowDangerous = false) {
1884
1888
  if (name === "class") return applyClass(el, value);
1885
1889
  if (name === "style") return applyStyle(el, value);
1886
- if (config.sanitizeUrls && !perigoLiberado && name === "srcdoc") {
1890
+ if (config.sanitizeUrls && !allowDangerous && name === "srcdoc") {
1887
1891
  warn$1(
1888
1892
  `:srcdoc refused in ${describeElement(el)}: the value becomes a document with active script inside the iframe, the same way v-html becomes markup. If the content is trusted, write :srcdoc.dangerous="..."; to turn off this protection on the entire application, set V.config.sanitizeUrls = false.`
1889
1893
  );
@@ -1891,7 +1895,7 @@ function applyBinding(el, name, value, asProp = false, perigoLiberado = false) {
1891
1895
  return;
1892
1896
  }
1893
1897
  if (config.sanitizeUrls && !asProp) {
1894
- if (ATRIBUTOS_DE_URL.has(name) && typeof value === "string" && urlPerigosa(value)) {
1898
+ if (URL_ATTRIBUTES.has(name) && typeof value === "string" && isDangerousUrl(value)) {
1895
1899
  warn$1(
1896
1900
  `value refused in :${name} of ${describeElement(el)}: "${value.slice(0, 60)}" uses a scheme that executes code. Use an http(s) or relative address. To turn off this protection, set V.config.sanitizeUrls = false.`
1897
1901
  );
@@ -1988,9 +1992,9 @@ defineDirective(
1988
1992
  }
1989
1993
  if (arg === "key") return;
1990
1994
  const asProp = !!modifiers.prop;
1991
- const perigoLiberado = !!modifiers.dangerous;
1995
+ const allowDangerous = !!modifiers.dangerous;
1992
1996
  effect2(() => {
1993
- applyBinding(el, arg, ev(), asProp, perigoLiberado);
1997
+ applyBinding(el, arg, ev(), asProp, allowDangerous);
1994
1998
  });
1995
1999
  },
1996
2000
  { priority: PRIORITY.BIND }
@@ -2945,11 +2949,11 @@ function data(values) {
2945
2949
  Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
2946
2950
  return rootScope.data;
2947
2951
  }
2948
- var version = "0.4.6";
2952
+ var version2 = "0.4.6";
2949
2953
  var core = {
2950
2954
  // Utilities first: Voodoo's own names can override.
2951
2955
  ...utils_exports,
2952
- version,
2956
+ version: version2,
2953
2957
  config,
2954
2958
  // Reactivity
2955
2959
  reactive,
@@ -6551,37 +6555,37 @@ defineDirective("offline", ({ el, expression, scope, modifiers, cleanup }) => {
6551
6555
 
6552
6556
  // src/forms/validate.ts
6553
6557
  var messages = {
6554
- required: "Preencha este campo.",
6555
- email: "Informe um e-mail valido.",
6556
- url: "Informe uma URL valida.",
6557
- number: "Informe um numero valido.",
6558
- integer: "Informe um numero inteiro.",
6559
- decimal: "Informe um numero decimal valido.",
6560
- alpha: "Use apenas letras.",
6561
- alphanumeric: "Use apenas letras e numeros.",
6562
- minlength: "Use no minimo {param} caracteres.",
6563
- maxlength: "Use no maximo {param} caracteres.",
6564
- min: "O valor minimo e {param}.",
6565
- max: "O valor maximo e {param}.",
6566
- between: "Informe um valor entre {min} e {max}.",
6567
- match: "Os campos nao conferem.",
6568
- regex: "O formato informado nao e valido.",
6569
- date: "Informe uma data valida.",
6570
- after: "A data precisa ser posterior a {param}.",
6571
- before: "A data precisa ser anterior a {param}.",
6572
- accepted: "E preciso marcar esta opcao para continuar.",
6573
- same: "Os valores precisam ser iguais.",
6574
- different: "Os valores precisam ser diferentes.",
6575
- in: "Escolha uma das opcoes permitidas.",
6576
- notin: "Este valor nao e permitido.",
6577
- phone: "Informe um telefone valido com DDD.",
6578
- cpf: "CPF invalido.",
6579
- cnpj: "CNPJ invalido.",
6580
- cep: "CEP invalido.",
6581
- creditcard: "Numero de cartao invalido.",
6582
- strongpassword: "Use {param} caracteres ou mais, com maiuscula, minuscula, numero e simbolo.",
6583
- unique: "Este valor ja esta em uso.",
6584
- invalid: "Valor invalido."
6558
+ required: "Please fill in this field.",
6559
+ email: "Enter a valid email address.",
6560
+ url: "Enter a valid URL.",
6561
+ number: "Enter a valid number.",
6562
+ integer: "Enter a whole number.",
6563
+ decimal: "Enter a valid decimal number.",
6564
+ alpha: "Use letters only.",
6565
+ alphanumeric: "Use letters and numbers only.",
6566
+ minlength: "Use at least {param} characters.",
6567
+ maxlength: "Use at most {param} characters.",
6568
+ min: "The smallest allowed value is {param}.",
6569
+ max: "The largest allowed value is {param}.",
6570
+ between: "Enter a value between {min} and {max}.",
6571
+ match: "The fields do not match.",
6572
+ regex: "That format is not valid.",
6573
+ date: "Enter a valid date.",
6574
+ after: "The date has to be later than {param}.",
6575
+ before: "The date has to be earlier than {param}.",
6576
+ accepted: "You have to tick this to continue.",
6577
+ same: "The values have to be the same.",
6578
+ different: "The values have to be different.",
6579
+ in: "Choose one of the allowed options.",
6580
+ notin: "That value is not allowed.",
6581
+ phone: "Enter a valid phone number, including the area code.",
6582
+ cpf: "Invalid CPF.",
6583
+ cnpj: "Invalid CNPJ.",
6584
+ cep: "Invalid postcode.",
6585
+ creditcard: "Invalid card number.",
6586
+ strongpassword: "Use {param} characters or more, with an upper case letter, a lower case letter, a number and a symbol.",
6587
+ unique: "That value is already taken.",
6588
+ invalid: "Invalid value."
6585
6589
  };
6586
6590
  function formatMessage(template, data2) {
6587
6591
  const param = data2.param ?? "";
@@ -9522,7 +9526,7 @@ function openDialog(request2) {
9522
9526
  source.remove();
9523
9527
  }
9524
9528
  sourceAnchors.delete(source);
9525
- if (source.hasAttribute(`${config.prefix}modal-content`) || source.hasAttribute("data-v-modal-content")) {
9529
+ if (hasDirective(source, "modal-content")) {
9526
9530
  source.setAttribute("hidden", "");
9527
9531
  }
9528
9532
  }
@@ -10267,5 +10271,5 @@ defineDirective(
10267
10271
  );
10268
10272
 
10269
10273
  export { VoodooCollection, alert, allStores, applyMask, cache, clearErrors, clipboard, confirm, cookie, core, createApp, createResource, defineComponent, dialog, efeitos, ensurePalette, enter, fadeIn, fadeOut, fromHtml, hotkey, instances, leave, mask, masks, messages, modal, mountComponent, network, palette, prompt, query, ready, ready2, registerMask, removeStore, screen, serializeForm, session, showFieldError, showFormErrors, slideDown, slideUp, sound, storage, store, storeNames, theme, toast, unmask, url, validate, validator, viewTransition, whenElement, whenReady };
10270
- //# sourceMappingURL=chunk-4HQEOXTK.js.map
10271
- //# sourceMappingURL=chunk-4HQEOXTK.js.map
10274
+ //# sourceMappingURL=chunk-CNHNFTPC.js.map
10275
+ //# sourceMappingURL=chunk-CNHNFTPC.js.map
@@ -1840,6 +1840,6 @@ function refresh(root) {
1840
1840
  walk(root ?? document.body, root ? findScope(root.parentNode) : rootScope);
1841
1841
  }
1842
1842
 
1843
- export { Scope, VoodooRuntimeError, VoodooSyntaxError, addCleanup, allowedGlobals, clearParseCache, closestDirective, collectDirectives, componentAliases, destroy, evaluate, evaluateIn, findScope, getEffectScopes, getScope, hadDirectives, hasAttr, hasDirectives, isInitialized, magic, magics, markInitialized, markNodeScope, markSkipChildren, originalAttributes, parse, parseAttribute, queryDirective, readAttr, refresh, removeQuietly, restoreAttributes, rootScope, setComponentMounter, start, stopObserving, stringify, tokenize, walk };
1844
- //# sourceMappingURL=chunk-5CKGDARU.js.map
1845
- //# sourceMappingURL=chunk-5CKGDARU.js.map
1843
+ export { Scope, VoodooRuntimeError, VoodooSyntaxError, addCleanup, allowedGlobals, clearParseCache, closestDirective, collectDirectives, componentAliases, destroy, evaluate, evaluateIn, findScope, getEffectScopes, getScope, hadDirectives, hasAttr, hasDirective, hasDirectives, isInitialized, magic, magics, markInitialized, markNodeScope, markSkipChildren, originalAttributes, parse, parseAttribute, queryDirective, readAttr, refresh, removeQuietly, restoreAttributes, rootScope, setComponentMounter, start, stopObserving, stringify, tokenize, walk };
1844
+ //# sourceMappingURL=chunk-PHMBDPWH.js.map
1845
+ //# sourceMappingURL=chunk-PHMBDPWH.js.map
@@ -3338,7 +3338,7 @@ init_reactivity();
3338
3338
  // src/store/index.ts
3339
3339
  init_reactivity();
3340
3340
  var stores = /* @__PURE__ */ new Map();
3341
- var versao = ref(0);
3341
+ var version = ref(0);
3342
3342
  var persistHandles = /* @__PURE__ */ new Map();
3343
3343
  function store(name, definition, options = {}) {
3344
3344
  const existing = stores.get(name);
@@ -3355,30 +3355,30 @@ function store(name, definition, options = {}) {
3355
3355
  return existing;
3356
3356
  }
3357
3357
  const key = typeof options.persist === "string" ? options.persist : `voodoo:store:${name}`;
3358
- const descritores = Object.getOwnPropertyDescriptors(definition);
3359
- const initial = Object.defineProperties({}, descritores);
3358
+ const descriptors = Object.getOwnPropertyDescriptors(definition);
3359
+ const initial = Object.defineProperties({}, descriptors);
3360
3360
  if (options.persist && typeof localStorage !== "undefined") {
3361
3361
  try {
3362
3362
  const saved = localStorage.getItem(key);
3363
3363
  if (saved) {
3364
- const salvo = JSON.parse(saved);
3365
- for (const [chave, valor] of Object.entries(salvo)) {
3366
- if (descritores[chave] && !("value" in descritores[chave])) continue;
3367
- initial[chave] = valor;
3364
+ const parsed = JSON.parse(saved);
3365
+ for (const [field, value] of Object.entries(parsed)) {
3366
+ if (descriptors[field] && !("value" in descriptors[field])) continue;
3367
+ initial[field] = value;
3368
3368
  }
3369
3369
  }
3370
3370
  } catch {
3371
3371
  }
3372
3372
  }
3373
3373
  const created = reactive(initial);
3374
- for (const [prop, descritor] of Object.entries(descritores)) {
3375
- const value = descritor.value;
3374
+ for (const [prop, descriptor] of Object.entries(descriptors)) {
3375
+ const value = descriptor.value;
3376
3376
  if (typeof value === "function") {
3377
3377
  created[prop] = (...args) => value.apply(created, args);
3378
3378
  }
3379
3379
  }
3380
3380
  stores.set(name, created);
3381
- versao.value++;
3381
+ version.value++;
3382
3382
  if (options.persist && typeof localStorage !== "undefined") {
3383
3383
  const stop2 = watch(
3384
3384
  created,
@@ -3396,10 +3396,10 @@ function store(name, definition, options = {}) {
3396
3396
  }
3397
3397
  function stripFunctions(source) {
3398
3398
  const out = {};
3399
- const descritores = Object.getOwnPropertyDescriptors(toRaw(source));
3399
+ const descriptors = Object.getOwnPropertyDescriptors(toRaw(source));
3400
3400
  for (const [key, value] of Object.entries(source)) {
3401
3401
  if (typeof value === "function") continue;
3402
- if (descritores[key] && !("value" in descritores[key])) continue;
3402
+ if (descriptors[key] && !("value" in descriptors[key])) continue;
3403
3403
  out[key] = value;
3404
3404
  }
3405
3405
  return out;
@@ -3408,11 +3408,11 @@ var allStores = new Proxy(
3408
3408
  {},
3409
3409
  {
3410
3410
  get: (_t, key) => {
3411
- void versao.value;
3411
+ void version.value;
3412
3412
  return stores.get(key);
3413
3413
  },
3414
3414
  has: (_t, key) => {
3415
- void versao.value;
3415
+ void version.value;
3416
3416
  return stores.has(key);
3417
3417
  },
3418
3418
  ownKeys: () => [...stores.keys()],
@@ -4341,6 +4341,7 @@ function render(options) {
4341
4341
  element.setAttribute("data-type", type);
4342
4342
  element.setAttribute("role", type === "error" ? "alert" : "status");
4343
4343
  element.setAttribute("aria-live", type === "error" ? "assertive" : "polite");
4344
+ element.setAttribute("aria-atomic", "true");
4344
4345
  let closed = false;
4345
4346
  let timer = null;
4346
4347
  const close = () => {
@@ -4661,10 +4662,11 @@ var cache2 = {
4661
4662
  }
4662
4663
  };
4663
4664
  var THEME_KEY = "voodoo:theme";
4665
+ var picked = null;
4664
4666
  var theme = {
4665
4667
  /** Theme chosen by the user, or `system` when never set. */
4666
4668
  get current() {
4667
- return storage.get(THEME_KEY) ?? "system";
4669
+ return storage.get(THEME_KEY) ?? picked ?? "system";
4668
4670
  },
4669
4671
  /** Theme effectively applied, resolving `system`. */
4670
4672
  get resolved() {
@@ -4674,6 +4676,7 @@ var theme = {
4674
4676
  return matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
4675
4677
  },
4676
4678
  set(value) {
4679
+ picked = value;
4677
4680
  storage.set(THEME_KEY, value);
4678
4681
  this.apply();
4679
4682
  },
@@ -4684,7 +4687,7 @@ var theme = {
4684
4687
  },
4685
4688
  /** `true` once the visitor has actually picked a theme. */
4686
4689
  get chosen() {
4687
- return storage.get(THEME_KEY) != null;
4690
+ return picked !== null || storage.get(THEME_KEY) != null;
4688
4691
  },
4689
4692
  /** Writes `data-theme` on the root element and notifies the page. */
4690
4693
  apply() {
@@ -4708,7 +4711,8 @@ var theme = {
4708
4711
  init() {
4709
4712
  if (typeof document === "undefined") return;
4710
4713
  this.apply();
4711
- matchMedia?.("(prefers-color-scheme: dark)").addEventListener("change", () => {
4714
+ if (typeof matchMedia === "undefined") return;
4715
+ matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
4712
4716
  if (this.current === "system") this.apply();
4713
4717
  });
4714
4718
  }
@@ -5143,8 +5147,8 @@ function transitionOptions(el) {
5143
5147
  defineDirective("text", ({ el, effect: effect2, evaluate: ev }) => {
5144
5148
  effect2(() => {
5145
5149
  el.textContent = stringify(ev());
5146
- const primeiro = el.firstChild;
5147
- if (primeiro && primeiro.nodeType === 3) markInitialized(primeiro);
5150
+ const first = el.firstChild;
5151
+ if (first && first.nodeType === 3) markInitialized(first);
5148
5152
  });
5149
5153
  });
5150
5154
  defineDirective("html", (ctx) => {
@@ -5347,10 +5351,10 @@ defineDirective(
5347
5351
  next.push({ key, scope: childScope, nodes, data: childScope.data });
5348
5352
  });
5349
5353
  if (batch.fragment.firstChild) anchor.parentNode?.insertBefore(batch.fragment, anchor);
5350
- for (const [node, escopo] of batch.pending) walk(node, escopo);
5351
- const reaproveitados = new Set(next);
5354
+ for (const [node, rowScope] of batch.pending) walk(node, rowScope);
5355
+ const reused = new Set(next);
5352
5356
  for (const block2 of blocks) {
5353
- if (used.has(block2.key) && reaproveitados.has(block2)) continue;
5357
+ if (used.has(block2.key) && reused.has(block2)) continue;
5354
5358
  for (const node of block2.nodes) {
5355
5359
  destroy(node);
5356
5360
  node.remove();
@@ -5420,7 +5424,7 @@ var BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
5420
5424
  "novalidate",
5421
5425
  "inert"
5422
5426
  ]);
5423
- var ATRIBUTOS_DE_URL = /* @__PURE__ */ new Set([
5427
+ var URL_ATTRIBUTES = /* @__PURE__ */ new Set([
5424
5428
  "href",
5425
5429
  "src",
5426
5430
  "action",
@@ -5429,15 +5433,15 @@ var ATRIBUTOS_DE_URL = /* @__PURE__ */ new Set([
5429
5433
  "ping",
5430
5434
  "poster"
5431
5435
  ]);
5432
- var RUIDO_DE_ESQUEMA = /[\s\x00-\x1f]/g;
5433
- function urlPerigosa(valor) {
5434
- const limpo = valor.replace(RUIDO_DE_ESQUEMA, "").toLowerCase();
5435
- return limpo.startsWith("javascript:") || limpo.startsWith("vbscript:") || limpo.startsWith("data:text/html") || limpo.startsWith("data:application/xhtml");
5436
+ var SCHEME_NOISE = /[\s\x00-\x1f]/g;
5437
+ function isDangerousUrl(value) {
5438
+ const clean = value.replace(SCHEME_NOISE, "").toLowerCase();
5439
+ return clean.startsWith("javascript:") || clean.startsWith("vbscript:") || clean.startsWith("data:text/html") || clean.startsWith("data:application/xhtml");
5436
5440
  }
5437
- function applyBinding(el, name, value, asProp = false, perigoLiberado = false) {
5441
+ function applyBinding(el, name, value, asProp = false, allowDangerous = false) {
5438
5442
  if (name === "class") return applyClass(el, value);
5439
5443
  if (name === "style") return applyStyle(el, value);
5440
- if (config.sanitizeUrls && !perigoLiberado && name === "srcdoc") {
5444
+ if (config.sanitizeUrls && !allowDangerous && name === "srcdoc") {
5441
5445
  warn2(
5442
5446
  `:srcdoc refused in ${describeElement(el)}: the value becomes a document with active script inside the iframe, the same way v-html becomes markup. If the content is trusted, write :srcdoc.dangerous="..."; to turn off this protection on the entire application, set V.config.sanitizeUrls = false.`
5443
5447
  );
@@ -5445,7 +5449,7 @@ function applyBinding(el, name, value, asProp = false, perigoLiberado = false) {
5445
5449
  return;
5446
5450
  }
5447
5451
  if (config.sanitizeUrls && !asProp) {
5448
- if (ATRIBUTOS_DE_URL.has(name) && typeof value === "string" && urlPerigosa(value)) {
5452
+ if (URL_ATTRIBUTES.has(name) && typeof value === "string" && isDangerousUrl(value)) {
5449
5453
  warn2(
5450
5454
  `value refused in :${name} of ${describeElement(el)}: "${value.slice(0, 60)}" uses a scheme that executes code. Use an http(s) or relative address. To turn off this protection, set V.config.sanitizeUrls = false.`
5451
5455
  );
@@ -5542,9 +5546,9 @@ defineDirective(
5542
5546
  }
5543
5547
  if (arg === "key") return;
5544
5548
  const asProp = !!modifiers.prop;
5545
- const perigoLiberado = !!modifiers.dangerous;
5549
+ const allowDangerous = !!modifiers.dangerous;
5546
5550
  effect2(() => {
5547
- applyBinding(el, arg, ev(), asProp, perigoLiberado);
5551
+ applyBinding(el, arg, ev(), asProp, allowDangerous);
5548
5552
  });
5549
5553
  },
5550
5554
  { priority: PRIORITY.BIND }
@@ -6501,11 +6505,11 @@ function data(values) {
6501
6505
  Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
6502
6506
  return rootScope.data;
6503
6507
  }
6504
- var version = "0.4.6";
6508
+ var version2 = "0.4.6";
6505
6509
  var core = {
6506
6510
  // Utilities first: Voodoo's own names can override.
6507
6511
  ...utils_exports,
6508
- version,
6512
+ version: version2,
6509
6513
  config,
6510
6514
  // Reactivity
6511
6515
  reactive,
@@ -10125,37 +10129,37 @@ init_reactivity();
10125
10129
  init_registry();
10126
10130
  init_style();
10127
10131
  var messages = {
10128
- required: "Preencha este campo.",
10129
- email: "Informe um e-mail valido.",
10130
- url: "Informe uma URL valida.",
10131
- number: "Informe um numero valido.",
10132
- integer: "Informe um numero inteiro.",
10133
- decimal: "Informe um numero decimal valido.",
10134
- alpha: "Use apenas letras.",
10135
- alphanumeric: "Use apenas letras e numeros.",
10136
- minlength: "Use no minimo {param} caracteres.",
10137
- maxlength: "Use no maximo {param} caracteres.",
10138
- min: "O valor minimo e {param}.",
10139
- max: "O valor maximo e {param}.",
10140
- between: "Informe um valor entre {min} e {max}.",
10141
- match: "Os campos nao conferem.",
10142
- regex: "O formato informado nao e valido.",
10143
- date: "Informe uma data valida.",
10144
- after: "A data precisa ser posterior a {param}.",
10145
- before: "A data precisa ser anterior a {param}.",
10146
- accepted: "E preciso marcar esta opcao para continuar.",
10147
- same: "Os valores precisam ser iguais.",
10148
- different: "Os valores precisam ser diferentes.",
10149
- in: "Escolha uma das opcoes permitidas.",
10150
- notin: "Este valor nao e permitido.",
10151
- phone: "Informe um telefone valido com DDD.",
10152
- cpf: "CPF invalido.",
10153
- cnpj: "CNPJ invalido.",
10154
- cep: "CEP invalido.",
10155
- creditcard: "Numero de cartao invalido.",
10156
- strongpassword: "Use {param} caracteres ou mais, com maiuscula, minuscula, numero e simbolo.",
10157
- unique: "Este valor ja esta em uso.",
10158
- invalid: "Valor invalido."
10132
+ required: "Please fill in this field.",
10133
+ email: "Enter a valid email address.",
10134
+ url: "Enter a valid URL.",
10135
+ number: "Enter a valid number.",
10136
+ integer: "Enter a whole number.",
10137
+ decimal: "Enter a valid decimal number.",
10138
+ alpha: "Use letters only.",
10139
+ alphanumeric: "Use letters and numbers only.",
10140
+ minlength: "Use at least {param} characters.",
10141
+ maxlength: "Use at most {param} characters.",
10142
+ min: "The smallest allowed value is {param}.",
10143
+ max: "The largest allowed value is {param}.",
10144
+ between: "Enter a value between {min} and {max}.",
10145
+ match: "The fields do not match.",
10146
+ regex: "That format is not valid.",
10147
+ date: "Enter a valid date.",
10148
+ after: "The date has to be later than {param}.",
10149
+ before: "The date has to be earlier than {param}.",
10150
+ accepted: "You have to tick this to continue.",
10151
+ same: "The values have to be the same.",
10152
+ different: "The values have to be different.",
10153
+ in: "Choose one of the allowed options.",
10154
+ notin: "That value is not allowed.",
10155
+ phone: "Enter a valid phone number, including the area code.",
10156
+ cpf: "Invalid CPF.",
10157
+ cnpj: "Invalid CNPJ.",
10158
+ cep: "Invalid postcode.",
10159
+ creditcard: "Invalid card number.",
10160
+ strongpassword: "Use {param} characters or more, with an upper case letter, a lower case letter, a number and a symbol.",
10161
+ unique: "That value is already taken.",
10162
+ invalid: "Invalid value."
10159
10163
  };
10160
10164
  function formatMessage(template, data2) {
10161
10165
  const param = data2.param ?? "";
@@ -13105,7 +13109,7 @@ function openDialog(request2) {
13105
13109
  source.remove();
13106
13110
  }
13107
13111
  sourceAnchors.delete(source);
13108
- if (source.hasAttribute(`${config.prefix}modal-content`) || source.hasAttribute("data-v-modal-content")) {
13112
+ if (hasDirective(source, "modal-content")) {
13109
13113
  source.setAttribute("hidden", "");
13110
13114
  }
13111
13115
  }
@@ -1,4 +1,4 @@
1
- import { c as core, V as VoodooCollection } from './query-CKJ4oSpG.cjs';
1
+ import { c as core, V as VoodooCollection } from './query-sEJXe_cO.cjs';
2
2
  import './http.cjs';
3
3
  import './utils.cjs';
4
4
  import './reactivity.cjs';
@@ -1,4 +1,4 @@
1
- import { c as core, V as VoodooCollection } from './query-DQFRmu3u.js';
1
+ import { c as core, V as VoodooCollection } from './query-CC-_z7v0.js';
2
2
  import './http.js';
3
3
  import './utils.js';
4
4
  import './reactivity.js';
package/dist/essential.js CHANGED
@@ -1,6 +1,6 @@
1
- import { core, sound, hotkey, palette, registerMask, unmask, applyMask, masks, mask, clearErrors, showFieldError, showFormErrors, messages, serializeForm, validate, validator, dialog, prompt, confirm, alert, modal, VoodooCollection, fromHtml, ready2, query } from './chunk-4HQEOXTK.js';
1
+ import { core, sound, hotkey, palette, registerMask, unmask, applyMask, masks, mask, clearErrors, showFieldError, showFormErrors, messages, serializeForm, validate, validator, dialog, prompt, confirm, alert, modal, VoodooCollection, fromHtml, ready2, query } from './chunk-CNHNFTPC.js';
2
2
  import './chunk-PQZEVFVZ.js';
3
- import { magic } from './chunk-5CKGDARU.js';
3
+ import { magic } from './chunk-PHMBDPWH.js';
4
4
  import './chunk-NNU6WOOU.js';
5
5
  import './chunk-A2UOVQBP.js';
6
6
  import './chunk-234ZLC6W.js';