voodoojs 0.10.0 → 0.11.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.
package/dist/index.js CHANGED
@@ -1,25 +1,25 @@
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, viewTransition, defineComponent, storage, ensurePalette, instances, storeNames, allStores } from './chunk-QWQPKMUH.js';
2
- export { VoodooCollection, alert, allStores, applyMask, cache, clearErrors, clipboard, confirm, cookie, createApp, createResource, defineComponent, dialog, ready as documentReady, enter, fadeIn, fadeOut, fromHtml, hotkey, instances, leave, mask, masks, modal, mountComponent, network, palette, prompt, query, ready2 as ready, registerMask, removeStore, createResource as resource, screen, serializeForm, session, showFormErrors, slideDown, slideUp, sound, efeitos as soundEffects, storage, store, storeNames, theme, toast, unmask, url, validate, validator, viewTransition, whenElement, whenReady } from './chunk-QWQPKMUH.js';
3
- export { gpu, reflectWgsl } from './chunk-WGMUFP5Q.js';
4
- import { http } from './chunk-IK4MQQTO.js';
5
- export { HttpError, http, request } from './chunk-IK4MQQTO.js';
6
- import { devtoolsBus } from './chunk-HW75QJLQ.js';
7
- export { createSocket, devtoolsBus, socket, socketSupported } from './chunk-HW75QJLQ.js';
8
- import { magic, markSkipChildren, destroy, readAttr, rootScope, findScope, walk, evaluate, parse, Scope, getScope, hadDirectives, unwrap, addCleanup, collectDirectives, getEffectScopes, evaluateIn } from './chunk-OUEXXXTU.js';
9
- export { Scope, VoodooRuntimeError, VoodooSyntaxError, addCleanup, allowedGlobals, clearParseCache, destroy, evaluate, findScope, getScope, magic, magics, parse, refresh, rootScope, start, stringify, tokenize, walk } from './chunk-OUEXXXTU.js';
10
- import { reactive, warn, handleError, queuePostFlush, effect, nextTick } from './chunk-H64IUSGJ.js';
11
- export { EffectScope, computed, effect, effectScope, flushSync, isReactive, markRaw, nextTick, reactive, ref, shallowRef, stop, toRaw, unref, watch, watchEffect } from './chunk-H64IUSGJ.js';
12
- import { warnAlias } from './chunk-EYNFAYEV.js';
13
- import { parseDuration, formatNumber, formatCurrency, formatDate, relativeTime, device, setFormatDefaults, uid, merge, escapeHtml, truncate, get, titleCase } from './chunk-H3RGM7PR.js';
14
- export { capitalize, chunk, clone, debounce, device, escapeHtml, formatCurrency, formatDate, formatFileSize, formatNumber, formatPercent, get, groupBy, isBrowser, matchesMedia, memoize, merge, once, parseDuration, random, relativeTime, sample, set, setFormatDefaults, sleep, slugify, sortBy, stripTags, throttle, titleCase, truncate, uid, unique, uuid } from './chunk-H3RGM7PR.js';
15
- import { ensureTokens, injectStyle } from './chunk-TFDCAZYU.js';
16
- export { ensureTokens, injectStyle } from './chunk-TFDCAZYU.js';
17
- import { defineDirective, PRIORITY, config } from './chunk-PXUSD6TT.js';
18
- export { PRIORITY, config, defineDirective } from './chunk-PXUSD6TT.js';
19
- import './chunk-3JV2AYK6.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, viewTransition, defineComponent, storage, ensurePalette, instances, storeNames, allStores } from './chunk-PBZCYF2Y.js';
2
+ export { VoodooCollection, alert, allStores, applyMask, cache, clearErrors, clipboard, confirm, cookie, createApp, createResource, defineComponent, dialog, ready as documentReady, enter, fadeIn, fadeOut, fromHtml, hotkey, instances, leave, mask, masks, modal, mountComponent, network, palette, prompt, query, ready2 as ready, registerMask, removeStore, createResource as resource, screen, serializeForm, session, showFormErrors, slideDown, slideUp, sound, efeitos as soundEffects, storage, store, storeNames, theme, toast, unmask, url, validate, validator, viewTransition, whenElement, whenReady } from './chunk-PBZCYF2Y.js';
3
+ export { gpu, reflectWgsl } from './chunk-TZJSPNLV.js';
4
+ import { http } from './chunk-VQEJ4DTE.js';
5
+ export { HttpError, http, request } from './chunk-VQEJ4DTE.js';
6
+ import { devtoolsBus } from './chunk-KAS77SGY.js';
7
+ export { createSocket, devtoolsBus, socket, socketSupported } from './chunk-KAS77SGY.js';
8
+ import { magic, markSkipChildren, onStart, rootScope, findScope, destroy, readAttr, evaluate, parse, Scope, getScope, walk, unwrap, addCleanup, hadDirectives, collectDirectives, getEffectScopes, evaluateIn } from './chunk-NUBOX6YQ.js';
9
+ export { Scope, VoodooRuntimeError, VoodooSyntaxError, addCleanup, allowedGlobals, clearParseCache, destroy, evaluate, findScope, getScope, magic, magics, parse, refresh, rootScope, start, stringify, tokenize, walk } from './chunk-NUBOX6YQ.js';
10
+ import { reactive, warn, handleError, effect, queuePostFlush, nextTick } from './chunk-5GWN7E6N.js';
11
+ export { EffectScope, computed, effect, effectScope, flushSync, isReactive, markRaw, nextTick, reactive, ref, shallowRef, stop, toRaw, unref, watch, watchEffect } from './chunk-5GWN7E6N.js';
12
+ import { warnAlias } from './chunk-OTRGHJIJ.js';
13
+ import { parseDuration, formatNumber, formatCurrency, formatDate, relativeTime, device, setFormatDefaults, uid, merge, escapeHtml, truncate, get, titleCase } from './chunk-FBQPFIHZ.js';
14
+ export { capitalize, chunk, clone, debounce, device, escapeHtml, formatCurrency, formatDate, formatFileSize, formatNumber, formatPercent, get, groupBy, isBrowser, matchesMedia, memoize, merge, once, parseDuration, random, relativeTime, sample, set, setFormatDefaults, sleep, slugify, sortBy, stripTags, throttle, titleCase, truncate, uid, unique, uuid } from './chunk-FBQPFIHZ.js';
15
+ import { ensureTokens, injectStyle } from './chunk-QL2GIGVQ.js';
16
+ export { ensureTokens, injectStyle } from './chunk-QL2GIGVQ.js';
17
+ import { defineDirective, PRIORITY, config } from './chunk-WIXAZJYS.js';
18
+ export { PRIORITY, config, defineDirective } from './chunk-WIXAZJYS.js';
19
+ import './chunk-EYGQD7OP.js';
20
20
 
21
21
  /**
22
- * Voodoo.js v0.10.0
22
+ * Voodoo.js v0.11.0
23
23
  * JavaScript feels like magic.
24
24
  * (c) 2026 Voodoo.js contributors. MIT License.
25
25
  */
@@ -6555,6 +6555,10 @@ var OPAQUE = /* @__PURE__ */ new Set([
6555
6555
  "NOSCRIPT"
6556
6556
  ]);
6557
6557
  magic("$__jsx", (scope) => scope);
6558
+ onStart((root, after) => {
6559
+ if (after) activateJsx();
6560
+ else extractJsx(root);
6561
+ });
6558
6562
  var TEMPLATE = /* @__PURE__ */ Symbol("voodoo.jsx.template");
6559
6563
  function isTemplate(value) {
6560
6564
  return typeof value === "object" && value !== null && TEMPLATE in value;
@@ -6627,6 +6631,30 @@ function collect(start2, offset) {
6627
6631
  if (!closed) return null;
6628
6632
  return { source, templates, nodes, tail };
6629
6633
  }
6634
+ function recoverFromTable(collected) {
6635
+ const empties = collected.source.match(/\(\s*\)/g);
6636
+ if (!empties) return false;
6637
+ const first = collected.nodes[0];
6638
+ const last = collected.nodes[collected.nodes.length - 1];
6639
+ const table = [last?.nextSibling, first?.previousSibling].map((from) => {
6640
+ let node = from ?? null;
6641
+ while (node && node.nodeType === Node.TEXT_NODE && !(node.textContent ?? "").trim()) {
6642
+ node = node === last?.nextSibling ? node.nextSibling : node.previousSibling;
6643
+ }
6644
+ return node && node.nodeType === Node.ELEMENT_NODE ? node : null;
6645
+ }).find((el) => el?.tagName === "TABLE");
6646
+ if (!table) return false;
6647
+ const body = table.querySelector("tbody");
6648
+ if (!body) return false;
6649
+ const rows = Array.from(body.children).filter((el) => el.tagName === "TR");
6650
+ if (rows.length !== empties.length) return false;
6651
+ let index = 0;
6652
+ collected.source = collected.source.replace(/\(\s*\)/g, () => `($t(${index++}, $__jsx))`);
6653
+ collected.templates = rows;
6654
+ collected.host = body;
6655
+ collected.nodes.push(...rows);
6656
+ return true;
6657
+ }
6630
6658
  function render(value, templates, scope, out) {
6631
6659
  if (value == null || value === false || value === true) return;
6632
6660
  if (Array.isArray(value)) {
@@ -6668,7 +6696,11 @@ function applyRegions(root, parentScope) {
6668
6696
  continue;
6669
6697
  }
6670
6698
  const collected = collect(child, open);
6671
- if (!collected || collected.templates.length === 0) {
6699
+ if (!collected) {
6700
+ child = next;
6701
+ continue;
6702
+ }
6703
+ if (collected.templates.length === 0 && !recoverFromTable(collected)) {
6672
6704
  child = next;
6673
6705
  continue;
6674
6706
  }
@@ -6691,8 +6723,9 @@ function install(parent, collected, hint) {
6691
6723
  if (tail && tail.offset < (tail.node.textContent ?? "").length) {
6692
6724
  tail.node.splitText(tail.offset);
6693
6725
  }
6726
+ const target = collected.host ?? parent;
6694
6727
  const anchor = document.createComment("v-jsx");
6695
- parent.insertBefore(anchor, nodes[0]);
6728
+ target.insertBefore(anchor, collected.host ? collected.host.firstChild : nodes[0]);
6696
6729
  for (const node of nodes) node.remove();
6697
6730
  let rendered = [];
6698
6731
  pending.push(() => activateRegion());
@@ -6708,7 +6741,7 @@ function install(parent, collected, hint) {
6708
6741
  render(value, templates, local, out);
6709
6742
  for (const node of rendered) node.remove();
6710
6743
  rendered = out;
6711
- for (const node of out) parent.insertBefore(node, anchor);
6744
+ for (const node of out) target.insertBefore(node, anchor);
6712
6745
  });
6713
6746
  addCleanup(anchor, () => {
6714
6747
  runner.effect.stop();
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- * Voodoo.js v0.10.0
4
+ * Voodoo.js v0.11.0
5
5
  * JavaScript feels like magic.
6
6
  * (c) 2026 Voodoo.js contributors. MIT License.
7
7
  */
@@ -1,4 +1,4 @@
1
- export { EffectScope, ITERATE_KEY, ReactiveEffect, TriggerType, computed, effect, effectScope, enableTracking, flushSync, getActiveEffect, getActiveScope, handleError, hasChanged, isReactive, isRef, markRaw, nextTick, pauseTracking, queueJob, queuePostFlush, reactive, ref, resetTracking, setErrorHandler, shallowRef, stop, toRaw, track, trigger, unref, warn, watch, watchEffect } from './chunk-H64IUSGJ.js';
2
- import './chunk-3JV2AYK6.js';
1
+ export { EffectScope, ITERATE_KEY, ReactiveEffect, TriggerType, computed, effect, effectScope, enableTracking, flushSync, getActiveEffect, getActiveScope, handleError, hasChanged, isReactive, isRef, markRaw, nextTick, pauseTracking, queueJob, queuePostFlush, reactive, ref, resetTracking, setErrorHandler, shallowRef, stop, toRaw, track, trigger, unref, warn, watch, watchEffect } from './chunk-5GWN7E6N.js';
2
+ import './chunk-EYGQD7OP.js';
3
3
  //# sourceMappingURL=reactivity.js.map
4
4
  //# sourceMappingURL=reactivity.js.map
package/dist/socket.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  /**
6
- * Voodoo.js v0.10.0
6
+ * Voodoo.js v0.11.0
7
7
  * JavaScript feels like magic.
8
8
  * (c) 2026 Voodoo.js contributors. MIT License.
9
9
  */
package/dist/socket.js CHANGED
@@ -1,14 +1,14 @@
1
- import { socketSupported, createSocket, socket } from './chunk-HW75QJLQ.js';
2
- export { ENGINE, SIO, createSocket, decodeEngine, decodeSocketIo, encodeSocketIo, engineURL, resolveSocketURL, socket, socketSupported } from './chunk-HW75QJLQ.js';
3
- import { evaluateIn, readAttr } from './chunk-OUEXXXTU.js';
4
- import { reactive } from './chunk-H64IUSGJ.js';
5
- import { warnAlias } from './chunk-EYNFAYEV.js';
6
- import { parseDuration } from './chunk-H3RGM7PR.js';
7
- import { defineDirective, PRIORITY, config } from './chunk-PXUSD6TT.js';
8
- import './chunk-3JV2AYK6.js';
1
+ import { socketSupported, createSocket, socket } from './chunk-KAS77SGY.js';
2
+ export { ENGINE, SIO, createSocket, decodeEngine, decodeSocketIo, encodeSocketIo, engineURL, resolveSocketURL, socket, socketSupported } from './chunk-KAS77SGY.js';
3
+ import { evaluateIn, readAttr } from './chunk-NUBOX6YQ.js';
4
+ import { reactive } from './chunk-5GWN7E6N.js';
5
+ import { warnAlias } from './chunk-OTRGHJIJ.js';
6
+ import { parseDuration } from './chunk-FBQPFIHZ.js';
7
+ import { defineDirective, PRIORITY, config } from './chunk-WIXAZJYS.js';
8
+ import './chunk-EYGQD7OP.js';
9
9
 
10
10
  /**
11
- * Voodoo.js v0.10.0
11
+ * Voodoo.js v0.11.0
12
12
  * JavaScript feels like magic.
13
13
  * (c) 2026 Voodoo.js contributors. MIT License.
14
14
  */
@@ -0,0 +1,5 @@
1
+ export { BASE_TOKENS, ensureTokens, injectStyle } from './chunk-QL2GIGVQ.js';
2
+ import './chunk-WIXAZJYS.js';
3
+ import './chunk-EYGQD7OP.js';
4
+ //# sourceMappingURL=style-ZM3TAT4K.js.map
5
+ //# sourceMappingURL=style-ZM3TAT4K.js.map
package/dist/utils.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- * Voodoo.js v0.10.0
4
+ * Voodoo.js v0.11.0
5
5
  * JavaScript feels like magic.
6
6
  * (c) 2026 Voodoo.js contributors. MIT License.
7
7
  */
package/dist/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- export { capitalize, chunk, clone, debounce, device, escapeHtml, formatCurrency, formatDate, formatFileSize, formatNumber, formatPercent, get, groupBy, isBrowser, matchesMedia, memoize, merge, once, parseDuration, random, relativeTime, sample, set, setFormatDefaults, sleep, slugify, sortBy, stripTags, throttle, titleCase, truncate, uid, unique, uuid } from './chunk-H3RGM7PR.js';
2
- import './chunk-3JV2AYK6.js';
1
+ export { capitalize, chunk, clone, debounce, device, escapeHtml, formatCurrency, formatDate, formatFileSize, formatNumber, formatPercent, get, groupBy, isBrowser, matchesMedia, memoize, merge, once, parseDuration, random, relativeTime, sample, set, setFormatDefaults, sleep, slugify, sortBy, stripTags, throttle, titleCase, truncate, uid, unique, uuid } from './chunk-FBQPFIHZ.js';
2
+ import './chunk-EYGQD7OP.js';
3
3
  //# sourceMappingURL=utils.js.map
4
4
  //# sourceMappingURL=utils.js.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Voodoo.js v0.10.0
2
+ * Voodoo.js v0.11.0
3
3
  * JavaScript feels like magic.
4
4
  * (c) 2026 Voodoo.js contributors. MIT License.
5
5
  */
@@ -2916,13 +2916,25 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
2916
2916
  var componentAliases = /* @__PURE__ */ new Map();
2917
2917
  var started = false;
2918
2918
  var observer = null;
2919
+ var startHooks = [];
2920
+ function runPhase(target, after) {
2921
+ for (const hook of startHooks) {
2922
+ try {
2923
+ hook(target, after);
2924
+ } catch (error) {
2925
+ console.error("[Voodoo] a start hook failed", error);
2926
+ }
2927
+ }
2928
+ }
2919
2929
  function start(root) {
2920
2930
  var _a2;
2921
2931
  if (typeof document === "undefined") return;
2922
2932
  const target = (_a2 = root != null ? root : config.root) != null ? _a2 : document.body;
2923
2933
  if (!target) return;
2924
2934
  Object.assign(allowedGlobals, config.globals);
2935
+ runPhase(target, false);
2925
2936
  walk(target, rootScope);
2937
+ runPhase(target, true);
2926
2938
  if (!started) {
2927
2939
  started = true;
2928
2940
  if (config.autoDiscover) observeDOM(target);
@@ -6813,7 +6825,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
6813
6825
  Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
6814
6826
  return rootScope.data;
6815
6827
  }
6816
- var version2 = "0.10.0";
6828
+ var version2 = "0.11.0";
6817
6829
  var core = {
6818
6830
  // Utilities first: Voodoo's own names can override.
6819
6831
  ...utils_exports,
@@ -8453,9 +8465,7 @@ ${block(':root:not([data-theme="light"])', dark.vars)}
8453
8465
  const boot = () => {
8454
8466
  theme.init();
8455
8467
  applySavedPalette();
8456
- if (typeof V2.extractJsx === "function") V2.extractJsx();
8457
8468
  V2.start();
8458
- if (typeof V2.activateJsx === "function") V2.activateJsx();
8459
8469
  if (typeof V2.enableXrayShortcut === "function") V2.enableXrayShortcut();
8460
8470
  if (config.devtools) mountDevtools(V2);
8461
8471
  };