voodoojs 0.12.1 → 0.12.3

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Voodoo.js v0.12.1
2
+ * Voodoo.js v0.12.3
3
3
  * JavaScript feels like magic.
4
4
  * (c) 2026 Voodoo.js contributors. MIT License.
5
5
  */
@@ -1798,6 +1798,23 @@ ${pointer}`);
1798
1798
  "SharedWorker",
1799
1799
  "ServiceWorker"
1800
1800
  ]);
1801
+ function guardedTimer(name) {
1802
+ return function(handler, timeout, ...rest) {
1803
+ if (typeof handler !== "function") {
1804
+ throw new VoodooRuntimeError(
1805
+ `${name} needs a function. Passing a string would compile it, which this library never does.`
1806
+ );
1807
+ }
1808
+ const timer = globalThis[name];
1809
+ return timer(handler, timeout, ...rest);
1810
+ };
1811
+ }
1812
+ function forwardGlobal(name) {
1813
+ return function(...args) {
1814
+ const fn = globalThis[name];
1815
+ return fn(...args);
1816
+ };
1817
+ }
1801
1818
  var allowedGlobals = {
1802
1819
  Math,
1803
1820
  JSON,
@@ -1816,7 +1833,17 @@ ${pointer}`);
1816
1833
  isFinite,
1817
1834
  encodeURIComponent,
1818
1835
  decodeURIComponent,
1819
- console
1836
+ console,
1837
+ ...typeof setTimeout !== "undefined" ? {
1838
+ setTimeout: guardedTimer("setTimeout"),
1839
+ setInterval: guardedTimer("setInterval"),
1840
+ clearTimeout: forwardGlobal("clearTimeout"),
1841
+ clearInterval: forwardGlobal("clearInterval")
1842
+ } : {},
1843
+ ...typeof requestAnimationFrame !== "undefined" ? {
1844
+ requestAnimationFrame: forwardGlobal("requestAnimationFrame"),
1845
+ cancelAnimationFrame: forwardGlobal("cancelAnimationFrame")
1846
+ } : {}
1820
1847
  };
1821
1848
  var VoodooRuntimeError = class extends Error {
1822
1849
  constructor(message, expression) {
@@ -7109,7 +7136,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
7109
7136
  Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
7110
7137
  return rootScope.data;
7111
7138
  }
7112
- var version2 = "0.12.1";
7139
+ var version2 = "0.12.3";
7113
7140
  var core = {
7114
7141
  // Utilities first: Voodoo's own names can override.
7115
7142
  ...utils_exports,
@@ -10275,6 +10302,7 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
10275
10302
  ensureUi();
10276
10303
  collapseOf(el);
10277
10304
  });
10305
+ var selfToggling = /* @__PURE__ */ new WeakSet();
10278
10306
  defineDirective("collapse-toggle", ({ el, expression, cleanup }) => {
10279
10307
  ensureUi();
10280
10308
  const target = resolveTarget(el, expression);
@@ -10283,6 +10311,8 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
10283
10311
  controller.triggers.add(el);
10284
10312
  controller.sync();
10285
10313
  makeInteractive(el, cleanup);
10314
+ selfToggling.add(el);
10315
+ cleanup(() => selfToggling.delete(el));
10286
10316
  const onClick = (event) => {
10287
10317
  event.preventDefault();
10288
10318
  controller.toggle();
@@ -10697,10 +10727,11 @@ Suggestion: attribute expressions accept a single value. If the logic spans more
10697
10727
  if (index === -1) return;
10698
10728
  event.preventDefault();
10699
10729
  const controller = controllers2[index];
10700
- if (single && !controller.open) {
10730
+ const ownToggle = selfToggling.has(header);
10731
+ if (single && (ownToggle ? controller.open : !controller.open)) {
10701
10732
  for (const other of controllers2) if (other !== controller) other.hide();
10702
10733
  }
10703
- controller.toggle();
10734
+ if (!ownToggle) controller.toggle();
10704
10735
  };
10705
10736
  const onKeyDown = (event) => {
10706
10737
  var _a2;
@@ -18336,8 +18367,22 @@ ${block(':root:not([data-theme="light"])', dark.vars)}
18336
18367
  }
18337
18368
  },
18338
18369
  methods: {
18339
- cell(row, column) {
18340
- const value = get(row, column.key);
18370
+ /**
18371
+ * A row may be an object keyed by column, or a positional array.
18372
+ *
18373
+ * Only the object form was ever read. The documentation's own example on
18374
+ * the components page passes `[['Ada', 'Engineer']]` against columns
18375
+ * `['Name', 'Role']`, and looking `'Name'` up on an array finds nothing, so
18376
+ * every cell rendered empty while the header row and the row count both
18377
+ * looked perfectly right — which is a hard failure to even notice, let
18378
+ * alone diagnose.
18379
+ *
18380
+ * The index comes from the template rather than `cols.indexOf(column)`,
18381
+ * because `cols` is a computed and identity is not guaranteed to survive a
18382
+ * recomputation.
18383
+ */
18384
+ cell(row, column, index) {
18385
+ const value = Array.isArray(row) && typeof index === "number" ? row[index] : get(row, column.key);
18341
18386
  if (value === null || value === void 0) return "";
18342
18387
  return String(value);
18343
18388
  },
@@ -18385,8 +18430,8 @@ ${block(':root:not([data-theme="light"])', dark.vars)}
18385
18430
  </thead>
18386
18431
  <tbody>
18387
18432
  <tr v-for="(row, index) in sorted" :key="index">
18388
- <td v-for="column in cols" :key="column.key" :style="alignStyle(column)"
18389
- v-text="cell(row, column)"></td>
18433
+ <td v-for="(column, ci) in cols" :key="column.key" :style="alignStyle(column)"
18434
+ v-text="cell(row, column, ci)"></td>
18390
18435
  </tr>
18391
18436
  <tr v-if="!sorted.length">
18392
18437
  <td class="v-table-empty" :colspan="cols.length || 1" v-text="empty"></td>
@@ -22029,9 +22074,14 @@ textarea.v-dialog-input{min-height:96px;resize:vertical}
22029
22074
  allowedGlobals.V = V2;
22030
22075
  allowedGlobals.Voodoo = V2;
22031
22076
  if (config.baseURL && ((_a2 = V2.http) == null ? void 0 : _a2.setBaseURL)) V2.http.setBaseURL(config.baseURL);
22032
- if (options.manual || !config.autoStart) return;
22077
+ theme.init();
22078
+ if (options.manual || !config.autoStart) {
22079
+ whenReady(() => {
22080
+ applySavedPalette();
22081
+ });
22082
+ return;
22083
+ }
22033
22084
  const boot = () => {
22034
- theme.init();
22035
22085
  applySavedPalette();
22036
22086
  V2.start();
22037
22087
  if (typeof V2.enableXrayShortcut === "function") V2.enableXrayShortcut();