voodoojs 0.5.0 → 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-34CGORMO.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()],
@@ -1115,10 +1115,11 @@ var cache = {
1115
1115
  }
1116
1116
  };
1117
1117
  var THEME_KEY = "voodoo:theme";
1118
+ var picked = null;
1118
1119
  var theme = {
1119
1120
  /** Theme chosen by the user, or `system` when never set. */
1120
1121
  get current() {
1121
- return storage.get(THEME_KEY) ?? "system";
1122
+ return storage.get(THEME_KEY) ?? picked ?? "system";
1122
1123
  },
1123
1124
  /** Theme effectively applied, resolving `system`. */
1124
1125
  get resolved() {
@@ -1128,6 +1129,7 @@ var theme = {
1128
1129
  return matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
1129
1130
  },
1130
1131
  set(value) {
1132
+ picked = value;
1131
1133
  storage.set(THEME_KEY, value);
1132
1134
  this.apply();
1133
1135
  },
@@ -1138,7 +1140,7 @@ var theme = {
1138
1140
  },
1139
1141
  /** `true` once the visitor has actually picked a theme. */
1140
1142
  get chosen() {
1141
- return storage.get(THEME_KEY) != null;
1143
+ return picked !== null || storage.get(THEME_KEY) != null;
1142
1144
  },
1143
1145
  /** Writes `data-theme` on the root element and notifies the page. */
1144
1146
  apply() {
@@ -1162,7 +1164,8 @@ var theme = {
1162
1164
  init() {
1163
1165
  if (typeof document === "undefined") return;
1164
1166
  this.apply();
1165
- matchMedia?.("(prefers-color-scheme: dark)").addEventListener("change", () => {
1167
+ if (typeof matchMedia === "undefined") return;
1168
+ matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
1166
1169
  if (this.current === "system") this.apply();
1167
1170
  });
1168
1171
  }
@@ -1590,8 +1593,8 @@ function transitionOptions(el) {
1590
1593
  defineDirective("text", ({ el, effect: effect2, evaluate: ev }) => {
1591
1594
  effect2(() => {
1592
1595
  el.textContent = stringify(ev());
1593
- const primeiro = el.firstChild;
1594
- if (primeiro && primeiro.nodeType === 3) markInitialized(primeiro);
1596
+ const first = el.firstChild;
1597
+ if (first && first.nodeType === 3) markInitialized(first);
1595
1598
  });
1596
1599
  });
1597
1600
  defineDirective("html", (ctx) => {
@@ -1794,10 +1797,10 @@ defineDirective(
1794
1797
  next.push({ key, scope: childScope, nodes, data: childScope.data });
1795
1798
  });
1796
1799
  if (batch.fragment.firstChild) anchor.parentNode?.insertBefore(batch.fragment, anchor);
1797
- for (const [node, escopo] of batch.pending) walk(node, escopo);
1798
- const reaproveitados = new Set(next);
1800
+ for (const [node, rowScope] of batch.pending) walk(node, rowScope);
1801
+ const reused = new Set(next);
1799
1802
  for (const block2 of blocks) {
1800
- if (used.has(block2.key) && reaproveitados.has(block2)) continue;
1803
+ if (used.has(block2.key) && reused.has(block2)) continue;
1801
1804
  for (const node of block2.nodes) {
1802
1805
  destroy(node);
1803
1806
  node.remove();
@@ -1867,7 +1870,7 @@ var BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
1867
1870
  "novalidate",
1868
1871
  "inert"
1869
1872
  ]);
1870
- var ATRIBUTOS_DE_URL = /* @__PURE__ */ new Set([
1873
+ var URL_ATTRIBUTES = /* @__PURE__ */ new Set([
1871
1874
  "href",
1872
1875
  "src",
1873
1876
  "action",
@@ -1876,15 +1879,15 @@ var ATRIBUTOS_DE_URL = /* @__PURE__ */ new Set([
1876
1879
  "ping",
1877
1880
  "poster"
1878
1881
  ]);
1879
- var RUIDO_DE_ESQUEMA = /[\s\x00-\x1f]/g;
1880
- function urlPerigosa(valor) {
1881
- const limpo = valor.replace(RUIDO_DE_ESQUEMA, "").toLowerCase();
1882
- 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");
1883
1886
  }
1884
- function applyBinding(el, name, value, asProp = false, perigoLiberado = false) {
1887
+ function applyBinding(el, name, value, asProp = false, allowDangerous = false) {
1885
1888
  if (name === "class") return applyClass(el, value);
1886
1889
  if (name === "style") return applyStyle(el, value);
1887
- if (config.sanitizeUrls && !perigoLiberado && name === "srcdoc") {
1890
+ if (config.sanitizeUrls && !allowDangerous && name === "srcdoc") {
1888
1891
  warn$1(
1889
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.`
1890
1893
  );
@@ -1892,7 +1895,7 @@ function applyBinding(el, name, value, asProp = false, perigoLiberado = false) {
1892
1895
  return;
1893
1896
  }
1894
1897
  if (config.sanitizeUrls && !asProp) {
1895
- if (ATRIBUTOS_DE_URL.has(name) && typeof value === "string" && urlPerigosa(value)) {
1898
+ if (URL_ATTRIBUTES.has(name) && typeof value === "string" && isDangerousUrl(value)) {
1896
1899
  warn$1(
1897
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.`
1898
1901
  );
@@ -1989,9 +1992,9 @@ defineDirective(
1989
1992
  }
1990
1993
  if (arg === "key") return;
1991
1994
  const asProp = !!modifiers.prop;
1992
- const perigoLiberado = !!modifiers.dangerous;
1995
+ const allowDangerous = !!modifiers.dangerous;
1993
1996
  effect2(() => {
1994
- applyBinding(el, arg, ev(), asProp, perigoLiberado);
1997
+ applyBinding(el, arg, ev(), asProp, allowDangerous);
1995
1998
  });
1996
1999
  },
1997
2000
  { priority: PRIORITY.BIND }
@@ -2946,11 +2949,11 @@ function data(values) {
2946
2949
  Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
2947
2950
  return rootScope.data;
2948
2951
  }
2949
- var version = "0.4.6";
2952
+ var version2 = "0.4.6";
2950
2953
  var core = {
2951
2954
  // Utilities first: Voodoo's own names can override.
2952
2955
  ...utils_exports,
2953
- version,
2956
+ version: version2,
2954
2957
  config,
2955
2958
  // Reactivity
2956
2959
  reactive,
@@ -6552,37 +6555,37 @@ defineDirective("offline", ({ el, expression, scope, modifiers, cleanup }) => {
6552
6555
 
6553
6556
  // src/forms/validate.ts
6554
6557
  var messages = {
6555
- required: "Preencha este campo.",
6556
- email: "Informe um e-mail valido.",
6557
- url: "Informe uma URL valida.",
6558
- number: "Informe um numero valido.",
6559
- integer: "Informe um numero inteiro.",
6560
- decimal: "Informe um numero decimal valido.",
6561
- alpha: "Use apenas letras.",
6562
- alphanumeric: "Use apenas letras e numeros.",
6563
- minlength: "Use no minimo {param} caracteres.",
6564
- maxlength: "Use no maximo {param} caracteres.",
6565
- min: "O valor minimo e {param}.",
6566
- max: "O valor maximo e {param}.",
6567
- between: "Informe um valor entre {min} e {max}.",
6568
- match: "Os campos nao conferem.",
6569
- regex: "O formato informado nao e valido.",
6570
- date: "Informe uma data valida.",
6571
- after: "A data precisa ser posterior a {param}.",
6572
- before: "A data precisa ser anterior a {param}.",
6573
- accepted: "E preciso marcar esta opcao para continuar.",
6574
- same: "Os valores precisam ser iguais.",
6575
- different: "Os valores precisam ser diferentes.",
6576
- in: "Escolha uma das opcoes permitidas.",
6577
- notin: "Este valor nao e permitido.",
6578
- phone: "Informe um telefone valido com DDD.",
6579
- cpf: "CPF invalido.",
6580
- cnpj: "CNPJ invalido.",
6581
- cep: "CEP invalido.",
6582
- creditcard: "Numero de cartao invalido.",
6583
- strongpassword: "Use {param} caracteres ou mais, com maiuscula, minuscula, numero e simbolo.",
6584
- unique: "Este valor ja esta em uso.",
6585
- 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."
6586
6589
  };
6587
6590
  function formatMessage(template, data2) {
6588
6591
  const param = data2.param ?? "";
@@ -9523,7 +9526,7 @@ function openDialog(request2) {
9523
9526
  source.remove();
9524
9527
  }
9525
9528
  sourceAnchors.delete(source);
9526
- if (source.hasAttribute(`${config.prefix}modal-content`) || source.hasAttribute("data-v-modal-content")) {
9529
+ if (hasDirective(source, "modal-content")) {
9527
9530
  source.setAttribute("hidden", "");
9528
9531
  }
9529
9532
  }
@@ -10268,5 +10271,5 @@ defineDirective(
10268
10271
  );
10269
10272
 
10270
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 };
10271
- //# sourceMappingURL=chunk-ABRZI32G.js.map
10272
- //# sourceMappingURL=chunk-ABRZI32G.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-34CGORMO.js.map
1845
- //# sourceMappingURL=chunk-34CGORMO.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()],
@@ -4662,10 +4662,11 @@ var cache2 = {
4662
4662
  }
4663
4663
  };
4664
4664
  var THEME_KEY = "voodoo:theme";
4665
+ var picked = null;
4665
4666
  var theme = {
4666
4667
  /** Theme chosen by the user, or `system` when never set. */
4667
4668
  get current() {
4668
- return storage.get(THEME_KEY) ?? "system";
4669
+ return storage.get(THEME_KEY) ?? picked ?? "system";
4669
4670
  },
4670
4671
  /** Theme effectively applied, resolving `system`. */
4671
4672
  get resolved() {
@@ -4675,6 +4676,7 @@ var theme = {
4675
4676
  return matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
4676
4677
  },
4677
4678
  set(value) {
4679
+ picked = value;
4678
4680
  storage.set(THEME_KEY, value);
4679
4681
  this.apply();
4680
4682
  },
@@ -4685,7 +4687,7 @@ var theme = {
4685
4687
  },
4686
4688
  /** `true` once the visitor has actually picked a theme. */
4687
4689
  get chosen() {
4688
- return storage.get(THEME_KEY) != null;
4690
+ return picked !== null || storage.get(THEME_KEY) != null;
4689
4691
  },
4690
4692
  /** Writes `data-theme` on the root element and notifies the page. */
4691
4693
  apply() {
@@ -4709,7 +4711,8 @@ var theme = {
4709
4711
  init() {
4710
4712
  if (typeof document === "undefined") return;
4711
4713
  this.apply();
4712
- matchMedia?.("(prefers-color-scheme: dark)").addEventListener("change", () => {
4714
+ if (typeof matchMedia === "undefined") return;
4715
+ matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
4713
4716
  if (this.current === "system") this.apply();
4714
4717
  });
4715
4718
  }
@@ -5144,8 +5147,8 @@ function transitionOptions(el) {
5144
5147
  defineDirective("text", ({ el, effect: effect2, evaluate: ev }) => {
5145
5148
  effect2(() => {
5146
5149
  el.textContent = stringify(ev());
5147
- const primeiro = el.firstChild;
5148
- if (primeiro && primeiro.nodeType === 3) markInitialized(primeiro);
5150
+ const first = el.firstChild;
5151
+ if (first && first.nodeType === 3) markInitialized(first);
5149
5152
  });
5150
5153
  });
5151
5154
  defineDirective("html", (ctx) => {
@@ -5348,10 +5351,10 @@ defineDirective(
5348
5351
  next.push({ key, scope: childScope, nodes, data: childScope.data });
5349
5352
  });
5350
5353
  if (batch.fragment.firstChild) anchor.parentNode?.insertBefore(batch.fragment, anchor);
5351
- for (const [node, escopo] of batch.pending) walk(node, escopo);
5352
- const reaproveitados = new Set(next);
5354
+ for (const [node, rowScope] of batch.pending) walk(node, rowScope);
5355
+ const reused = new Set(next);
5353
5356
  for (const block2 of blocks) {
5354
- if (used.has(block2.key) && reaproveitados.has(block2)) continue;
5357
+ if (used.has(block2.key) && reused.has(block2)) continue;
5355
5358
  for (const node of block2.nodes) {
5356
5359
  destroy(node);
5357
5360
  node.remove();
@@ -5421,7 +5424,7 @@ var BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
5421
5424
  "novalidate",
5422
5425
  "inert"
5423
5426
  ]);
5424
- var ATRIBUTOS_DE_URL = /* @__PURE__ */ new Set([
5427
+ var URL_ATTRIBUTES = /* @__PURE__ */ new Set([
5425
5428
  "href",
5426
5429
  "src",
5427
5430
  "action",
@@ -5430,15 +5433,15 @@ var ATRIBUTOS_DE_URL = /* @__PURE__ */ new Set([
5430
5433
  "ping",
5431
5434
  "poster"
5432
5435
  ]);
5433
- var RUIDO_DE_ESQUEMA = /[\s\x00-\x1f]/g;
5434
- function urlPerigosa(valor) {
5435
- const limpo = valor.replace(RUIDO_DE_ESQUEMA, "").toLowerCase();
5436
- 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");
5437
5440
  }
5438
- function applyBinding(el, name, value, asProp = false, perigoLiberado = false) {
5441
+ function applyBinding(el, name, value, asProp = false, allowDangerous = false) {
5439
5442
  if (name === "class") return applyClass(el, value);
5440
5443
  if (name === "style") return applyStyle(el, value);
5441
- if (config.sanitizeUrls && !perigoLiberado && name === "srcdoc") {
5444
+ if (config.sanitizeUrls && !allowDangerous && name === "srcdoc") {
5442
5445
  warn2(
5443
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.`
5444
5447
  );
@@ -5446,7 +5449,7 @@ function applyBinding(el, name, value, asProp = false, perigoLiberado = false) {
5446
5449
  return;
5447
5450
  }
5448
5451
  if (config.sanitizeUrls && !asProp) {
5449
- if (ATRIBUTOS_DE_URL.has(name) && typeof value === "string" && urlPerigosa(value)) {
5452
+ if (URL_ATTRIBUTES.has(name) && typeof value === "string" && isDangerousUrl(value)) {
5450
5453
  warn2(
5451
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.`
5452
5455
  );
@@ -5543,9 +5546,9 @@ defineDirective(
5543
5546
  }
5544
5547
  if (arg === "key") return;
5545
5548
  const asProp = !!modifiers.prop;
5546
- const perigoLiberado = !!modifiers.dangerous;
5549
+ const allowDangerous = !!modifiers.dangerous;
5547
5550
  effect2(() => {
5548
- applyBinding(el, arg, ev(), asProp, perigoLiberado);
5551
+ applyBinding(el, arg, ev(), asProp, allowDangerous);
5549
5552
  });
5550
5553
  },
5551
5554
  { priority: PRIORITY.BIND }
@@ -6502,11 +6505,11 @@ function data(values) {
6502
6505
  Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
6503
6506
  return rootScope.data;
6504
6507
  }
6505
- var version = "0.4.6";
6508
+ var version2 = "0.4.6";
6506
6509
  var core = {
6507
6510
  // Utilities first: Voodoo's own names can override.
6508
6511
  ...utils_exports,
6509
- version,
6512
+ version: version2,
6510
6513
  config,
6511
6514
  // Reactivity
6512
6515
  reactive,
@@ -10126,37 +10129,37 @@ init_reactivity();
10126
10129
  init_registry();
10127
10130
  init_style();
10128
10131
  var messages = {
10129
- required: "Preencha este campo.",
10130
- email: "Informe um e-mail valido.",
10131
- url: "Informe uma URL valida.",
10132
- number: "Informe um numero valido.",
10133
- integer: "Informe um numero inteiro.",
10134
- decimal: "Informe um numero decimal valido.",
10135
- alpha: "Use apenas letras.",
10136
- alphanumeric: "Use apenas letras e numeros.",
10137
- minlength: "Use no minimo {param} caracteres.",
10138
- maxlength: "Use no maximo {param} caracteres.",
10139
- min: "O valor minimo e {param}.",
10140
- max: "O valor maximo e {param}.",
10141
- between: "Informe um valor entre {min} e {max}.",
10142
- match: "Os campos nao conferem.",
10143
- regex: "O formato informado nao e valido.",
10144
- date: "Informe uma data valida.",
10145
- after: "A data precisa ser posterior a {param}.",
10146
- before: "A data precisa ser anterior a {param}.",
10147
- accepted: "E preciso marcar esta opcao para continuar.",
10148
- same: "Os valores precisam ser iguais.",
10149
- different: "Os valores precisam ser diferentes.",
10150
- in: "Escolha uma das opcoes permitidas.",
10151
- notin: "Este valor nao e permitido.",
10152
- phone: "Informe um telefone valido com DDD.",
10153
- cpf: "CPF invalido.",
10154
- cnpj: "CNPJ invalido.",
10155
- cep: "CEP invalido.",
10156
- creditcard: "Numero de cartao invalido.",
10157
- strongpassword: "Use {param} caracteres ou mais, com maiuscula, minuscula, numero e simbolo.",
10158
- unique: "Este valor ja esta em uso.",
10159
- 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."
10160
10163
  };
10161
10164
  function formatMessage(template, data2) {
10162
10165
  const param = data2.param ?? "";
@@ -13106,7 +13109,7 @@ function openDialog(request2) {
13106
13109
  source.remove();
13107
13110
  }
13108
13111
  sourceAnchors.delete(source);
13109
- if (source.hasAttribute(`${config.prefix}modal-content`) || source.hasAttribute("data-v-modal-content")) {
13112
+ if (hasDirective(source, "modal-content")) {
13110
13113
  source.setAttribute("hidden", "");
13111
13114
  }
13112
13115
  }
@@ -1,4 +1,4 @@
1
- import { c as core, V as VoodooCollection } from './query-Bja83lRJ.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-BeYufh-f.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-ABRZI32G.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-34CGORMO.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';