voodoojs 0.7.0 → 0.10.1

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 (41) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-4T2UIPWX.js → chunk-246ZC2JD.js} +4 -4
  3. package/dist/{chunk-YOZTHZS2.js → chunk-2UST7MKN.js} +3 -3
  4. package/dist/{chunk-II3XBOAP.js → chunk-4MJIS5RZ.js} +13 -13
  5. package/dist/{chunk-QO3I7VLJ.js → chunk-5D7TM3GL.js} +5 -5
  6. package/dist/{chunk-JB2YYNK6.js → chunk-5E3UZREN.js} +325 -64
  7. package/dist/{chunk-MMLUK37L.js → chunk-D4DNTWIS.js} +4 -3
  8. package/dist/{chunk-WSDB7K4X.js → chunk-DNIQLT66.js} +6 -6
  9. package/dist/{chunk-ZIWLQZZL.js → chunk-F3Z3HMZR.js} +4 -4
  10. package/dist/{chunk-GIWKGFGY.js → chunk-KQRWQPD6.js} +4 -4
  11. package/dist/{chunk-CYN6VLMD.js → chunk-RREZZ4FB.js} +4 -4
  12. package/dist/{chunk-E5T65CEI.js → chunk-WYSN4IOV.js} +5 -5
  13. package/dist/essential.cjs +317 -58
  14. package/dist/essential.d.cts +2 -2
  15. package/dist/essential.d.ts +2 -2
  16. package/dist/essential.js +10 -10
  17. package/dist/gpu.cjs +1 -1
  18. package/dist/gpu.js +10 -10
  19. package/dist/http.cjs +1 -1
  20. package/dist/http.js +5 -5
  21. package/dist/index.cjs +596 -76
  22. package/dist/index.d.cts +118 -4
  23. package/dist/index.d.ts +118 -4
  24. package/dist/index.js +282 -31
  25. package/dist/{query-CC-_z7v0.d.ts → query-Cf-7iibE.d.ts} +53 -2
  26. package/dist/{query-sEJXe_cO.d.cts → query-DiQAS73Q.d.cts} +53 -2
  27. package/dist/reactivity.cjs +1 -1
  28. package/dist/reactivity.js +2 -2
  29. package/dist/socket.cjs +303 -57
  30. package/dist/socket.js +9 -9
  31. package/dist/style-BSEVBI4K.js +5 -0
  32. package/dist/utils.cjs +1 -1
  33. package/dist/utils.js +2 -2
  34. package/dist/voodoo.core.js +322 -58
  35. package/dist/voodoo.core.min.js +18 -18
  36. package/dist/voodoo.full.js +599 -74
  37. package/dist/voodoo.full.min.js +61 -61
  38. package/dist/voodoo.js +322 -58
  39. package/dist/voodoo.min.js +25 -25
  40. package/package.json +127 -127
  41. package/dist/style-SLQ6PHZK.js +0 -5
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Voodoo.js v0.7.0
2
+ * Voodoo.js v0.10.1
3
3
  * JavaScript feels like magic.
4
4
  * (c) 2026 Voodoo.js contributors. MIT License.
5
5
  */
@@ -11,6 +11,7 @@ var config = {
11
11
  autoDiscover: true,
12
12
  root: null,
13
13
  devtools: false,
14
+ xrayShortcut: "ctrl+shift+f2",
14
15
  baseURL: "",
15
16
  globals: {},
16
17
  locale: typeof navigator !== "undefined" ? navigator.language || "pt-BR" : "pt-BR",
@@ -60,5 +61,5 @@ function usePlugin(V, plugin, options) {
60
61
  }
61
62
 
62
63
  export { PRIORITY, components, config, defineDirective, directives, normalizeComponentName, usePlugin };
63
- //# sourceMappingURL=chunk-MMLUK37L.js.map
64
- //# sourceMappingURL=chunk-MMLUK37L.js.map
64
+ //# sourceMappingURL=chunk-D4DNTWIS.js.map
65
+ //# sourceMappingURL=chunk-D4DNTWIS.js.map
@@ -1,9 +1,9 @@
1
- import { warnOnce } from './chunk-CYN6VLMD.js';
2
- import { parseDuration } from './chunk-ZIWLQZZL.js';
3
- import { __publicField } from './chunk-YOZTHZS2.js';
1
+ import { warnOnce } from './chunk-RREZZ4FB.js';
2
+ import { parseDuration } from './chunk-F3Z3HMZR.js';
3
+ import { __publicField } from './chunk-2UST7MKN.js';
4
4
 
5
5
  /**
6
- * Voodoo.js v0.7.0
6
+ * Voodoo.js v0.10.1
7
7
  * JavaScript feels like magic.
8
8
  * (c) 2026 Voodoo.js contributors. MIT License.
9
9
  */
@@ -444,5 +444,5 @@ var http = {
444
444
  };
445
445
 
446
446
  export { HttpError, clearCache, flushOfflineQueue, http, request };
447
- //# sourceMappingURL=chunk-WSDB7K4X.js.map
448
- //# sourceMappingURL=chunk-WSDB7K4X.js.map
447
+ //# sourceMappingURL=chunk-DNIQLT66.js.map
448
+ //# sourceMappingURL=chunk-DNIQLT66.js.map
@@ -1,7 +1,7 @@
1
- import { __export } from './chunk-YOZTHZS2.js';
1
+ import { __export } from './chunk-2UST7MKN.js';
2
2
 
3
3
  /**
4
- * Voodoo.js v0.7.0
4
+ * Voodoo.js v0.10.1
5
5
  * JavaScript feels like magic.
6
6
  * (c) 2026 Voodoo.js contributors. MIT License.
7
7
  */
@@ -397,5 +397,5 @@ var device = {
397
397
  };
398
398
 
399
399
  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, utils_exports, uuid };
400
- //# sourceMappingURL=chunk-ZIWLQZZL.js.map
401
- //# sourceMappingURL=chunk-ZIWLQZZL.js.map
400
+ //# sourceMappingURL=chunk-F3Z3HMZR.js.map
401
+ //# sourceMappingURL=chunk-F3Z3HMZR.js.map
@@ -1,7 +1,7 @@
1
- import { config } from './chunk-MMLUK37L.js';
1
+ import { config } from './chunk-D4DNTWIS.js';
2
2
 
3
3
  /**
4
- * Voodoo.js v0.7.0
4
+ * Voodoo.js v0.10.1
5
5
  * JavaScript feels like magic.
6
6
  * (c) 2026 Voodoo.js contributors. MIT License.
7
7
  */
@@ -68,5 +68,5 @@ function ensureTokens() {
68
68
  }
69
69
 
70
70
  export { BASE_TOKENS, ensureTokens, injectStyle };
71
- //# sourceMappingURL=chunk-GIWKGFGY.js.map
72
- //# sourceMappingURL=chunk-GIWKGFGY.js.map
71
+ //# sourceMappingURL=chunk-KQRWQPD6.js.map
72
+ //# sourceMappingURL=chunk-KQRWQPD6.js.map
@@ -1,7 +1,7 @@
1
- import { config } from './chunk-MMLUK37L.js';
1
+ import { config } from './chunk-D4DNTWIS.js';
2
2
 
3
3
  /**
4
- * Voodoo.js v0.7.0
4
+ * Voodoo.js v0.10.1
5
5
  * JavaScript feels like magic.
6
6
  * (c) 2026 Voodoo.js contributors. MIT License.
7
7
  */
@@ -78,5 +78,5 @@ function warnAlias(alias, canonical) {
78
78
  }
79
79
 
80
80
  export { describeElement, inDevelopment, warn, warnAlias, warnDuplicateKey, warnInvalidExpression, warnOnce, warnRequiredProp, warnUnknownComponent, warnUnknownDirective };
81
- //# sourceMappingURL=chunk-CYN6VLMD.js.map
82
- //# sourceMappingURL=chunk-CYN6VLMD.js.map
81
+ //# sourceMappingURL=chunk-RREZZ4FB.js.map
82
+ //# sourceMappingURL=chunk-RREZZ4FB.js.map
@@ -1,8 +1,8 @@
1
- import { handleError } from './chunk-4T2UIPWX.js';
2
- import { warn } from './chunk-CYN6VLMD.js';
1
+ import { handleError } from './chunk-246ZC2JD.js';
2
+ import { warn } from './chunk-RREZZ4FB.js';
3
3
 
4
4
  /**
5
- * Voodoo.js v0.7.0
5
+ * Voodoo.js v0.10.1
6
6
  * JavaScript feels like magic.
7
7
  * (c) 2026 Voodoo.js contributors. MIT License.
8
8
  */
@@ -1192,5 +1192,5 @@ var gpu = {
1192
1192
  };
1193
1193
 
1194
1194
  export { clock, compute, describeWgslType, destroy, effect, findEntry, flattenValue, frame, frameLoop, gpu, inferStruct, init, packStruct, reflectBindings, reflectEntries, reflectStructs, reflectWgsl, resetShared, shared, splitTopLevel, stripWgslComments, supported, surface, target, uniforms, writeField, writeStruct };
1195
- //# sourceMappingURL=chunk-E5T65CEI.js.map
1196
- //# sourceMappingURL=chunk-E5T65CEI.js.map
1195
+ //# sourceMappingURL=chunk-WYSN4IOV.js.map
1196
+ //# sourceMappingURL=chunk-WYSN4IOV.js.map
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  /**
6
- * Voodoo.js v0.7.0
6
+ * Voodoo.js v0.10.1
7
7
  * JavaScript feels like magic.
8
8
  * (c) 2026 Voodoo.js contributors. MIT License.
9
9
  */
@@ -715,6 +715,7 @@ var init_registry = __esm({
715
715
  autoDiscover: true,
716
716
  root: null,
717
717
  devtools: false,
718
+ xrayShortcut: "ctrl+shift+f2",
718
719
  baseURL: "",
719
720
  globals: {},
720
721
  locale: typeof navigator !== "undefined" ? navigator.language || "pt-BR" : "pt-BR",
@@ -843,6 +844,7 @@ var PUNCTUATORS = [
843
844
  "!==",
844
845
  "**=",
845
846
  "...",
847
+ ">>>",
846
848
  "<<=",
847
849
  ">>=",
848
850
  "&&=",
@@ -865,6 +867,11 @@ var PUNCTUATORS = [
865
867
  "*=",
866
868
  "/=",
867
869
  "%=",
870
+ "&=",
871
+ "|=",
872
+ "^=",
873
+ "<<",
874
+ ">>",
868
875
  "+",
869
876
  "-",
870
877
  "*",
@@ -874,6 +881,10 @@ var PUNCTUATORS = [
874
881
  "<",
875
882
  ">",
876
883
  "=",
884
+ "&",
885
+ "|",
886
+ "^",
887
+ "~",
877
888
  "(",
878
889
  ")",
879
890
  "[",
@@ -937,6 +948,10 @@ function tokenize(source) {
937
948
  raw = "0b";
938
949
  i += 2;
939
950
  while (i < len && /[01_]/.test(source[i])) raw += source[i++];
951
+ } else if (ch === "0" && (source[i + 1] === "o" || source[i + 1] === "O")) {
952
+ raw = "0o";
953
+ i += 2;
954
+ while (i < len && /[0-7_]/.test(source[i])) raw += source[i++];
940
955
  } else {
941
956
  while (i < len && /[0-9_]/.test(source[i])) raw += source[i++];
942
957
  if (source[i] === ".") {
@@ -1093,25 +1108,31 @@ var BINARY_PRECEDENCE = {
1093
1108
  "??": 1,
1094
1109
  "||": 2,
1095
1110
  "&&": 3,
1096
- "==": 6,
1097
- "!=": 6,
1098
- "===": 6,
1099
- "!==": 6,
1100
- "<": 7,
1101
- ">": 7,
1102
- "<=": 7,
1103
- ">=": 7,
1104
- in: 7,
1105
- instanceof: 7,
1106
- "+": 9,
1107
- "-": 9,
1108
- "*": 10,
1109
- "/": 10,
1110
- "%": 10,
1111
- "**": 11
1111
+ "|": 4,
1112
+ "^": 5,
1113
+ "&": 6,
1114
+ "==": 7,
1115
+ "!=": 7,
1116
+ "===": 7,
1117
+ "!==": 7,
1118
+ "<": 8,
1119
+ ">": 8,
1120
+ "<=": 8,
1121
+ ">=": 8,
1122
+ in: 8,
1123
+ instanceof: 8,
1124
+ "<<": 9,
1125
+ ">>": 9,
1126
+ ">>>": 9,
1127
+ "+": 10,
1128
+ "-": 10,
1129
+ "*": 11,
1130
+ "/": 11,
1131
+ "%": 11,
1132
+ "**": 12
1112
1133
  };
1113
1134
  var ASSIGN_OPS = /* @__PURE__ */ new Set(["=", "+=", "-=", "*=", "/=", "%=", "**=", "&&=", "||=", "??="]);
1114
- var UNARY_OPS = /* @__PURE__ */ new Set(["!", "-", "+", "typeof", "void"]);
1135
+ var UNARY_OPS = /* @__PURE__ */ new Set(["!", "-", "+", "~", "typeof", "void", "delete"]);
1115
1136
  var LITERALS = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
1116
1137
  true: true,
1117
1138
  false: false,
@@ -1193,6 +1214,13 @@ var Parser = class {
1193
1214
  * language is an expression.
1194
1215
  */
1195
1216
  parseStatement() {
1217
+ if (this.peek().type === "ident" && this.peek().value === "return") {
1218
+ this.next();
1219
+ if (this.isPunct(";") || this.isPunct(",") || this.isPunct("}") || this.peek().type === "eof") {
1220
+ return { t: "return", a: null };
1221
+ }
1222
+ return { t: "return", a: this.parseExpression() };
1223
+ }
1196
1224
  if (this.peek().type === "ident" && this.peek().value === "if" && this.isPunct("(", 1)) {
1197
1225
  this.next();
1198
1226
  this.expect("(");
@@ -1246,7 +1274,7 @@ var Parser = class {
1246
1274
  if (this.peek().type === "ident" && this.isPunct("=>", 1)) {
1247
1275
  const param = this.next().value;
1248
1276
  this.next();
1249
- return { t: "arrow", params: [param], body: this.parseArrowBody() };
1277
+ return { t: "arrow", params: [{ kind: "id", name: param }], body: this.parseArrowBody() };
1250
1278
  }
1251
1279
  if (this.isPunct("(")) {
1252
1280
  const arrow = this.tryParseParenArrow();
@@ -1283,19 +1311,108 @@ var Parser = class {
1283
1311
  const after = this.tokens[i + 1];
1284
1312
  if (!after || after.type !== "punct" || after.value !== "=>") return null;
1285
1313
  this.next();
1314
+ let params;
1315
+ try {
1316
+ params = this.parseParamList();
1317
+ } catch {
1318
+ this.pos = start2;
1319
+ return null;
1320
+ }
1321
+ this.expect("=>");
1322
+ return { t: "arrow", params, body: this.parseArrowBody() };
1323
+ }
1324
+ /** Parameters up to the closing parenthesis, which it consumes. */
1325
+ parseParamList() {
1286
1326
  const params = [];
1287
1327
  while (!this.isPunct(")")) {
1288
- const t = this.next();
1289
- if (t.type !== "ident") {
1290
- this.pos = start2;
1291
- return null;
1292
- }
1293
- params.push(t.value);
1328
+ params.push(this.parseParam());
1294
1329
  if (this.isPunct(",")) this.next();
1330
+ else break;
1295
1331
  }
1296
1332
  this.expect(")");
1297
- this.expect("=>");
1298
- return { t: "arrow", params, body: this.parseArrowBody() };
1333
+ return params;
1334
+ }
1335
+ /**
1336
+ * One binding: `x`, `x = 1`, `...xs`, `{ a, b: c = 2 }`, `[a, , b]`.
1337
+ *
1338
+ * Recursive, so a pattern nests to any depth the way JavaScript's does.
1339
+ */
1340
+ parseParam() {
1341
+ if (this.isPunct("...")) {
1342
+ this.next();
1343
+ const name = this.next();
1344
+ if (name.type !== "ident") {
1345
+ throw new VoodooSyntaxError("Expected a name after ...", this.source, name.start);
1346
+ }
1347
+ return { kind: "rest", name: name.value };
1348
+ }
1349
+ let param;
1350
+ if (this.isPunct("{")) {
1351
+ this.next();
1352
+ const props = [];
1353
+ let rest;
1354
+ while (!this.isPunct("}")) {
1355
+ if (this.isPunct("...")) {
1356
+ this.next();
1357
+ const name = this.next();
1358
+ if (name.type !== "ident") {
1359
+ throw new VoodooSyntaxError("Expected a name after ...", this.source, name.start);
1360
+ }
1361
+ rest = name.value;
1362
+ } else {
1363
+ const key = this.next();
1364
+ if (key.type !== "ident" && key.type !== "str") {
1365
+ throw new VoodooSyntaxError("Expected a property name", this.source, key.start);
1366
+ }
1367
+ const value = this.isPunct(":") ? (this.next(), this.parseParam()) : { kind: "id", name: key.value };
1368
+ if (this.isPunct("=")) {
1369
+ this.next();
1370
+ value.def = this.parseAssignment();
1371
+ }
1372
+ props.push({ key: String(key.value), value });
1373
+ }
1374
+ if (this.isPunct(",")) this.next();
1375
+ else break;
1376
+ }
1377
+ this.expect("}");
1378
+ param = { kind: "obj", props, rest };
1379
+ } else if (this.isPunct("[")) {
1380
+ this.next();
1381
+ const elements = [];
1382
+ let rest;
1383
+ while (!this.isPunct("]")) {
1384
+ if (this.isPunct(",")) {
1385
+ this.next();
1386
+ elements.push(null);
1387
+ continue;
1388
+ }
1389
+ if (this.isPunct("...")) {
1390
+ this.next();
1391
+ const name = this.next();
1392
+ if (name.type !== "ident") {
1393
+ throw new VoodooSyntaxError("Expected a name after ...", this.source, name.start);
1394
+ }
1395
+ rest = name.value;
1396
+ } else {
1397
+ elements.push(this.parseParam());
1398
+ }
1399
+ if (this.isPunct(",")) this.next();
1400
+ else break;
1401
+ }
1402
+ this.expect("]");
1403
+ param = { kind: "arr", elements, rest };
1404
+ } else {
1405
+ const name = this.next();
1406
+ if (name.type !== "ident") {
1407
+ throw new VoodooSyntaxError("Expected a parameter name", this.source, name.start);
1408
+ }
1409
+ param = { kind: "id", name: name.value };
1410
+ }
1411
+ if (this.isPunct("=")) {
1412
+ this.next();
1413
+ param.def = this.parseAssignment();
1414
+ }
1415
+ return param;
1299
1416
  }
1300
1417
  parseConditional() {
1301
1418
  const test = this.parseBinary(0);
@@ -1355,8 +1472,57 @@ var Parser = class {
1355
1472
  }
1356
1473
  return expr;
1357
1474
  }
1475
+ /**
1476
+ * `new X`, `new X(a, b)`, and `new a.b.C(x)`.
1477
+ *
1478
+ * `new` did not exist here, in the lexer, or in the interpreter. So
1479
+ * `new Date(0)` lexed as the identifier `new` followed by `Date(0)`, the
1480
+ * parser dropped the dangling identifier, and what ran was `Date(0)`. Called
1481
+ * without `new`, `Date` returns a STRING of the current time, so
1482
+ * `new Date(0)` produced today's date as text, `new Date(0) instanceof Date`
1483
+ * was false, and `new Date(0).getTime()` failed with "getTime is not a
1484
+ * function". Three wrong answers, none of them an error.
1485
+ *
1486
+ * The callee is parsed as a member chain WITHOUT consuming a call, because in
1487
+ * JavaScript the argument list binds to the `new`: `new a.b.C(x)` constructs
1488
+ * `a.b.C` with `x`, and never calls `a.b.C(x)` and constructs the result. The
1489
+ * trailing `(` is then read here, and anything after it, such as
1490
+ * `new Date(0).getTime()`, is left to the ordinary member loop below.
1491
+ */
1492
+ parseNew() {
1493
+ this.next();
1494
+ const callee = this.parseMemberOnly(this.parsePrimary());
1495
+ const args = this.isPunct("(") ? this.parseArguments() : [];
1496
+ return { t: "new", callee, args };
1497
+ }
1498
+ /**
1499
+ * Member access only: `.x`, `?.x` and `[x]`, stopping at a call.
1500
+ *
1501
+ * Used for a `new` callee, where the argument list belongs to the `new`
1502
+ * rather than to the expression it is constructing.
1503
+ */
1504
+ parseMemberOnly(start2) {
1505
+ let expr = start2;
1506
+ for (; ; ) {
1507
+ if (this.isPunct(".")) {
1508
+ this.next();
1509
+ const prop = this.next();
1510
+ if (prop.type !== "ident") {
1511
+ throw new VoodooSyntaxError("Invalid property name", this.source, prop.start);
1512
+ }
1513
+ expr = { t: "member", o: expr, p: { t: "lit", v: prop.value }, computed: false, opt: false };
1514
+ } else if (this.isPunct("[")) {
1515
+ this.next();
1516
+ const p2 = this.parseExpression();
1517
+ this.expect("]");
1518
+ expr = { t: "member", o: expr, p: p2, computed: true, opt: false };
1519
+ } else {
1520
+ return expr;
1521
+ }
1522
+ }
1523
+ }
1358
1524
  parseCallMember() {
1359
- let expr = this.parsePrimary();
1525
+ let expr = this.isIdent("new") ? this.parseNew() : this.parsePrimary();
1360
1526
  for (; ; ) {
1361
1527
  if (this.isPunct(".")) {
1362
1528
  this.next();
@@ -1421,16 +1587,7 @@ var Parser = class {
1421
1587
  this.next();
1422
1588
  if (this.peek().type === "ident") this.next();
1423
1589
  this.expect("(");
1424
- const params = [];
1425
- while (!this.isPunct(")")) {
1426
- const param = this.next();
1427
- if (param.type !== "ident") {
1428
- throw new VoodooSyntaxError("Expected a parameter name", this.source, param.start);
1429
- }
1430
- params.push(param.value);
1431
- if (this.isPunct(",")) this.next();
1432
- }
1433
- this.expect(")");
1590
+ const params = this.parseParamList();
1434
1591
  return { t: "arrow", params, body: this.parseArrowBody() };
1435
1592
  }
1436
1593
  if (t.type === "num" || t.type === "str") {
@@ -1535,16 +1692,7 @@ var Parser = class {
1535
1692
  props.push({ key, value: this.parseAssignment() });
1536
1693
  } else if (this.isPunct("(")) {
1537
1694
  this.next();
1538
- const params = [];
1539
- while (!this.isPunct(")")) {
1540
- const param = this.next();
1541
- if (param.type !== "ident") {
1542
- throw new VoodooSyntaxError("Expected a parameter name", this.source, param.start);
1543
- }
1544
- params.push(param.value);
1545
- if (this.isPunct(",")) this.next();
1546
- }
1547
- this.expect(")");
1695
+ const params = this.parseParamList();
1548
1696
  props.push({ key, value: { t: "method", params, body: this.parseArrowBody() } });
1549
1697
  } else {
1550
1698
  props.push({ key, value: { t: "id", n: key } });
@@ -1647,6 +1795,14 @@ Expression: ${expression}` : message);
1647
1795
  }
1648
1796
  };
1649
1797
  var SPREAD = /* @__PURE__ */ Symbol("spread");
1798
+ var ReturnSignal = class {
1799
+ constructor(value) {
1800
+ __publicField(this, "value", value);
1801
+ }
1802
+ };
1803
+ function unwrap(value) {
1804
+ return value instanceof ReturnSignal ? value.value : value;
1805
+ }
1650
1806
  var BLOCKED_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
1651
1807
  function chaveBloqueada(key) {
1652
1808
  return typeof key === "string" && BLOCKED_KEYS.has(key);
@@ -1692,6 +1848,19 @@ function evaluate(node, scope) {
1692
1848
  );
1693
1849
  return obj[key];
1694
1850
  }
1851
+ case "new": {
1852
+ const target = evaluate(node.callee, scope);
1853
+ if (typeof target !== "function") {
1854
+ throw new VoodooRuntimeError(
1855
+ `Cannot construct ${stringify(target)}: it is not a constructor`
1856
+ );
1857
+ }
1858
+ if (target === Function) {
1859
+ throw new VoodooRuntimeError("Cannot construct Function: expressions never compile code");
1860
+ }
1861
+ const args = evalArgs(node.args, scope);
1862
+ return Reflect.construct(target, args);
1863
+ }
1695
1864
  case "call": {
1696
1865
  let thisArg;
1697
1866
  let fn;
@@ -1739,6 +1908,19 @@ function evaluate(node, scope) {
1739
1908
  }
1740
1909
  case "unary": {
1741
1910
  if (node.op === "...") return { [SPREAD]: evaluate(node.a, scope) };
1911
+ if (node.op === "delete") {
1912
+ if (node.a.t !== "member") {
1913
+ throw new VoodooRuntimeError(
1914
+ "delete needs a property, as in `delete user.name` or `delete list[0]`"
1915
+ );
1916
+ }
1917
+ const owner = evaluate(node.a.o, scope);
1918
+ if (owner == null) return true;
1919
+ const key = checkKey(
1920
+ node.a.computed ? evaluate(node.a.p, scope) : node.a.p.v
1921
+ );
1922
+ return delete owner[key];
1923
+ }
1742
1924
  if (node.op === "typeof") {
1743
1925
  if (node.a.t === "id") {
1744
1926
  if (chaveBloqueada(node.a.n)) return "undefined";
@@ -1756,6 +1938,8 @@ function evaluate(node, scope) {
1756
1938
  return -v;
1757
1939
  case "+":
1758
1940
  return +v;
1941
+ case "~":
1942
+ return ~v;
1759
1943
  case "void":
1760
1944
  return void 0;
1761
1945
  }
@@ -1803,6 +1987,23 @@ function evaluate(node, scope) {
1803
1987
  return l in r;
1804
1988
  case "instanceof":
1805
1989
  return l instanceof r;
1990
+ // The bitwise operators coerce through ToInt32, and `>>>` through
1991
+ // ToUint32, which is why the two shifts disagree for negatives:
1992
+ // `-1 >> 0` is -1 and `-1 >>> 0` is 4294967295. Applying the JavaScript
1993
+ // operator directly gets that for free; hand-rolling the coercion is
1994
+ // how an implementation ends up subtly wrong on exactly those cases.
1995
+ case "&":
1996
+ return l & r;
1997
+ case "|":
1998
+ return l | r;
1999
+ case "^":
2000
+ return l ^ r;
2001
+ case "<<":
2002
+ return l << r;
2003
+ case ">>":
2004
+ return l >> r;
2005
+ case ">>>":
2006
+ return l >>> r;
1806
2007
  }
1807
2008
  throw new VoodooRuntimeError(`Unsupported operator: ${node.op}`);
1808
2009
  }
@@ -1860,21 +2061,16 @@ function evaluate(node, scope) {
1860
2061
  const methodParams = node.params;
1861
2062
  const methodBody = node.body;
1862
2063
  return function(...args) {
1863
- const vars = {};
1864
- for (let i = 0; i < methodParams.length; i++) vars[methodParams[i]] = args[i];
2064
+ const vars = bindParams(methodParams, args, scope);
1865
2065
  const owner = this;
1866
2066
  const base = owner !== null && typeof owner === "object" ? scope.child(owner) : scope;
1867
- return evaluate(methodBody, base.child(vars));
2067
+ return unwrap(evaluate(methodBody, base.child(vars)));
1868
2068
  };
1869
2069
  }
1870
2070
  case "arrow": {
1871
2071
  const params = node.params;
1872
2072
  const body = node.body;
1873
- return (...args) => {
1874
- const vars = {};
1875
- for (let i = 0; i < params.length; i++) vars[params[i]] = args[i];
1876
- return evaluate(body, scope.child(vars));
1877
- };
2073
+ return (...args) => unwrap(evaluate(body, scope.child(bindParams(params, args, scope))));
1878
2074
  }
1879
2075
  case "obj": {
1880
2076
  const out = {};
@@ -1912,14 +2108,65 @@ function evaluate(node, scope) {
1912
2108
  }
1913
2109
  return out;
1914
2110
  }
2111
+ case "return":
2112
+ return new ReturnSignal(node.a ? evaluate(node.a, scope) : void 0);
1915
2113
  case "seq": {
1916
2114
  let last;
1917
- for (const stmt of node.body) last = evaluate(stmt, scope);
2115
+ for (const stmt of node.body) {
2116
+ last = evaluate(stmt, scope);
2117
+ if (last instanceof ReturnSignal) return last;
2118
+ }
1918
2119
  return last;
1919
2120
  }
1920
2121
  }
1921
2122
  throw new VoodooRuntimeError(`Unknown node: ${node.t}`);
1922
2123
  }
2124
+ function bindParam(param, value, vars, scope) {
2125
+ if (param.kind === "rest") {
2126
+ vars[param.name] = value;
2127
+ return;
2128
+ }
2129
+ if (param.def !== void 0 && value === void 0) {
2130
+ value = evaluate(param.def, scope.child(vars));
2131
+ }
2132
+ if (param.kind === "id") {
2133
+ vars[param.name] = value;
2134
+ return;
2135
+ }
2136
+ if (param.kind === "obj") {
2137
+ if (value == null) {
2138
+ throw new VoodooRuntimeError(
2139
+ `Cannot destructure ${value === null ? "null" : "undefined"}`
2140
+ );
2141
+ }
2142
+ const taken = /* @__PURE__ */ new Set();
2143
+ for (const { key, value: inner } of param.props) {
2144
+ taken.add(key);
2145
+ bindParam(inner, value[checkKey(key)], vars, scope);
2146
+ }
2147
+ if (param.rest) {
2148
+ const rest = {};
2149
+ for (const key of Object.keys(value)) {
2150
+ if (!taken.has(key)) rest[key] = value[key];
2151
+ }
2152
+ vars[param.rest] = rest;
2153
+ }
2154
+ return;
2155
+ }
2156
+ const items = Array.isArray(value) ? value : Array.from(value);
2157
+ param.elements.forEach((element, index) => {
2158
+ if (element) bindParam(element, items[index], vars, scope);
2159
+ });
2160
+ if (param.rest) vars[param.rest] = items.slice(param.elements.length);
2161
+ }
2162
+ function bindParams(params, args, scope) {
2163
+ const vars = {};
2164
+ for (let i = 0; i < params.length; i++) {
2165
+ const param = params[i];
2166
+ bindParam(param, param.kind === "rest" ? args.slice(i) : args[i], vars, scope);
2167
+ }
2168
+ return vars;
2169
+ }
1923
2170
  function evalArgs(args, scope) {
1924
2171
  const out = [];
1925
2172
  for (const arg of args) {
@@ -2684,12 +2931,24 @@ function resolveComponentTag(tagName) {
2684
2931
  var componentAliases = /* @__PURE__ */ new Map();
2685
2932
  var started = false;
2686
2933
  var observer = null;
2934
+ var startHooks = [];
2935
+ function runPhase(target, after) {
2936
+ for (const hook of startHooks) {
2937
+ try {
2938
+ hook(target, after);
2939
+ } catch (error) {
2940
+ console.error("[Voodoo] a start hook failed", error);
2941
+ }
2942
+ }
2943
+ }
2687
2944
  function start(root) {
2688
2945
  if (typeof document === "undefined") return;
2689
2946
  const target = root ?? config.root ?? document.body;
2690
2947
  if (!target) return;
2691
2948
  Object.assign(allowedGlobals, config.globals);
2949
+ runPhase(target, false);
2692
2950
  walk(target, rootScope);
2951
+ runPhase(target, true);
2693
2952
  if (!started) {
2694
2953
  started = true;
2695
2954
  if (config.autoDiscover) observeDOM(target);
@@ -6505,7 +6764,7 @@ function data(values) {
6505
6764
  Object.defineProperties(rootScope.data, Object.getOwnPropertyDescriptors(values));
6506
6765
  return rootScope.data;
6507
6766
  }
6508
- var version2 = "0.7.0";
6767
+ var version2 = "0.10.1";
6509
6768
  var core = {
6510
6769
  // Utilities first: Voodoo's own names can override.
6511
6770
  ...utils_exports,
@@ -1,4 +1,4 @@
1
- import { c as core, V as VoodooCollection } from './query-sEJXe_cO.cjs';
1
+ import { c as core, V as VoodooCollection } from './query-DiQAS73Q.cjs';
2
2
  import './http.cjs';
3
3
  import './utils.cjs';
4
4
  import './reactivity.cjs';
@@ -13,7 +13,7 @@ import './reactivity.cjs';
13
13
  * Excluded to keep the file small: charts, physics-based animations, router,
14
14
  * internationalization, reactivity inspector, and the ready-to-use component
15
15
  * library. For these, use `voodoo.full.min.js` or build a custom version with
16
- * `npx voodoo build`.
16
+ * `npx voodoojs-cli build`.
17
17
  */
18
18
 
19
19
  interface VoodooEssential extends Omit<typeof core, never> {