lilact 0.26.16 → 0.27.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 (69) hide show
  1. package/dist/lilact.development.js +250 -348
  2. package/dist/lilact.development.js.map +3 -3
  3. package/dist/lilact.development.min.js +34 -34
  4. package/dist/lilact.development.min.js.map +3 -3
  5. package/dist/lilact.production.min.js +34 -34
  6. package/docs/assets/navigation.js +1 -1
  7. package/docs/assets/search.js +1 -1
  8. package/docs/classes/accessories.ErrorBoundary.html +8 -8
  9. package/docs/classes/accessories.Suspense.html +7 -7
  10. package/docs/classes/components.Component.html +11 -11
  11. package/docs/classes/components.HTMLComponent.html +11 -11
  12. package/docs/classes/components.RootComponent.html +11 -11
  13. package/docs/functions/components.cloneComponent.html +1 -1
  14. package/docs/functions/components.createComponent.html +1 -1
  15. package/docs/functions/components.createPortal.html +1 -1
  16. package/docs/functions/components.createRoot.html +1 -1
  17. package/docs/functions/components.memo.html +1 -1
  18. package/docs/functions/components.render.html +1 -1
  19. package/docs/functions/errors.globalErrorHandler.html +1 -2
  20. package/docs/functions/errors.scanBlockLabels.html +1 -2
  21. package/docs/functions/errors.traceError.html +1 -3
  22. package/docs/functions/hooks.createContext.html +1 -1
  23. package/docs/functions/hooks.startTransition.html +1 -1
  24. package/docs/functions/hooks.useActionState.html +1 -1
  25. package/docs/functions/hooks.useContext.html +1 -1
  26. package/docs/functions/hooks.useDebugValue.html +1 -1
  27. package/docs/functions/hooks.useDeferredValue.html +1 -1
  28. package/docs/functions/hooks.useEffect.html +1 -1
  29. package/docs/functions/hooks.useId.html +1 -1
  30. package/docs/functions/hooks.useImperativeHandle.html +1 -1
  31. package/docs/functions/hooks.useInsertionEffect.html +1 -1
  32. package/docs/functions/hooks.useLayoutEffect.html +1 -1
  33. package/docs/functions/hooks.useLocalStorage.html +1 -1
  34. package/docs/functions/hooks.useMemo.html +1 -1
  35. package/docs/functions/hooks.useReducer.html +1 -1
  36. package/docs/functions/hooks.useRef.html +1 -1
  37. package/docs/functions/hooks.useTransition.html +1 -1
  38. package/docs/functions/run.lazy.html +1 -2
  39. package/docs/functions/run.require.html +1 -2
  40. package/docs/functions/run.run.html +1 -2
  41. package/docs/functions/run.runScripts.html +1 -1
  42. package/docs/functions/timers.timeoutPromise.html +3 -3
  43. package/docs/modules/errors.html +1 -1
  44. package/docs/modules/run.html +1 -1
  45. package/docs/static/index.html +1 -1
  46. package/docs/static/lilact.development.js +250 -348
  47. package/docs/static/lilact.development.js.map +3 -3
  48. package/docs/static/lilact.development.min.js +34 -34
  49. package/docs/static/lilact.development.min.js.map +3 -3
  50. package/docs/static/lilact.production.min.js +34 -34
  51. package/docs/variables/components.cloneElement.html +1 -1
  52. package/docs/variables/errors.blocks_info.html +1 -1
  53. package/docs/variables/errors.error.html +1 -1
  54. package/docs/variables/run.required_scripts.html +1 -0
  55. package/examples/index.html +1 -1
  56. package/examples/lilact.development.js +250 -348
  57. package/examples/lilact.development.js.map +3 -3
  58. package/examples/lilact.development.min.js +34 -34
  59. package/examples/lilact.development.min.js.map +3 -3
  60. package/examples/lilact.production.min.js +34 -34
  61. package/package.json +1 -1
  62. package/src/components.jsx +10 -4
  63. package/src/errors.jsx +179 -364
  64. package/src/expscan.js +1 -1
  65. package/src/hooks.jsx +33 -10
  66. package/src/jsx.js +14 -14
  67. package/src/lilact.jsx +5 -3
  68. package/src/run.jsx +121 -159
  69. package/docs/functions/errors.mapLocation.html +0 -1
@@ -1930,10 +1930,10 @@ function getComponentByPointer() {
1930
1930
  const pr = new Promise((res, rej) => {
1931
1931
  resolve_func = res;
1932
1932
  });
1933
- function click_handler(event2) {
1934
- event2.stopImmediatePropagation();
1933
+ function click_handler(event) {
1934
+ event.stopImmediatePropagation();
1935
1935
  window.removeEventListener("click", click_handler, true);
1936
- let t = event2.target;
1936
+ let t = event.target;
1937
1937
  while (!t[COMPONENT] && t.parentNode) {
1938
1938
  t = t.parentNode;
1939
1939
  }
@@ -2579,24 +2579,25 @@ var ComponentCore = class {
2579
2579
  if (this.outlet !== void 0) {
2580
2580
  for (let c of this.outlet) {
2581
2581
  if (c.cleanup) {
2582
- c.cleanup();
2582
+ promises.push(c.cleanup());
2583
2583
  }
2584
2584
  }
2585
2585
  }
2586
2586
  if (((_c = this.props) == null ? void 0 : _c.children) !== void 0) {
2587
2587
  for (let c of this.props.children) {
2588
2588
  if (c.cleanup) {
2589
- c.cleanup();
2589
+ promises.push(c.cleanup());
2590
2590
  }
2591
2591
  }
2592
2592
  }
2593
2593
  if (this.hooks !== void 0) {
2594
2594
  for (let h of this.hooks) {
2595
2595
  if (h.cleanup) {
2596
- h.cleanup();
2596
+ promises.push(h.cleanup());
2597
2597
  }
2598
2598
  }
2599
2599
  }
2600
+ await Promise.all(promises);
2600
2601
  } catch (e) {
2601
2602
  throw e;
2602
2603
  }
@@ -2627,7 +2628,7 @@ var ComponentCore = class {
2627
2628
  if (events_set.has(al)) {
2628
2629
  this.event_detachers[al]();
2629
2630
  } else {
2630
- this.element.setAttribute(a, void 0);
2631
+ this.element.removeAttribute(a);
2631
2632
  }
2632
2633
  }
2633
2634
  }
@@ -2670,6 +2671,7 @@ var ComponentCore = class {
2670
2671
  }
2671
2672
  } else if (boolean_html_attributes_set.has(a)) {
2672
2673
  this.element[a] = toBool(patch[a]);
2674
+ if (!this.element[a]) this.element.removeAttribute(a);
2673
2675
  } else if (a === "autoFocus") {
2674
2676
  this.element["autofocus"] = toBool(patch[a]);
2675
2677
  } else if (a === "htmlFor") {
@@ -3349,8 +3351,8 @@ function useState(initialValue) {
3349
3351
  return [hk.value, hk.set_func];
3350
3352
  }
3351
3353
  function useCallback(callback, deps = void 0) {
3352
- if (deps !== void 0 && (typeof deps !== "object" || deps.constructor.name !== "Array")) {
3353
- throw new Error("Callback dependencies must be an array or omitted.");
3354
+ if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
3355
+ throw new Error("Callback dependencies must be an array, object or omitted.");
3354
3356
  }
3355
3357
  const hk = useHook();
3356
3358
  if (!isEmpty(hk)) {
@@ -3443,7 +3445,7 @@ function useRef(initialValue = null) {
3443
3445
  return hk;
3444
3446
  }
3445
3447
  async function useLayoutEffect(effect, deps = void 0) {
3446
- if (deps !== void 0 && (typeof deps !== "object" || deps.constructor.name !== "Array")) {
3448
+ if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
3447
3449
  throw new Error("Layout effect dependencies must be an array, object or omitted.");
3448
3450
  }
3449
3451
  const hk = useHook();
@@ -3452,6 +3454,7 @@ async function useLayoutEffect(effect, deps = void 0) {
3452
3454
  }
3453
3455
  if (hk == null ? void 0 : hk.cleanup) {
3454
3456
  await hk.cleanup();
3457
+ hk.cleanup = void 0;
3455
3458
  }
3456
3459
  hk.deps = deps;
3457
3460
  lilact_default.layout_effects.add(async () => {
@@ -3461,7 +3464,7 @@ async function useLayoutEffect(effect, deps = void 0) {
3461
3464
  lilact_default.setTimeout(lilact_default.processEffects, 0);
3462
3465
  }
3463
3466
  async function useEffect(effect, deps = void 0) {
3464
- if (deps !== void 0 && (typeof deps !== "object" || deps.constructor.name !== "Array")) {
3467
+ if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
3465
3468
  throw new Error("Effect dependencies must be an array, object or omitted.");
3466
3469
  }
3467
3470
  const hk = useHook();
@@ -3470,6 +3473,7 @@ async function useEffect(effect, deps = void 0) {
3470
3473
  }
3471
3474
  if (hk == null ? void 0 : hk.cleanup) {
3472
3475
  await hk.cleanup();
3476
+ hk.cleanup = void 0;
3473
3477
  }
3474
3478
  hk.deps = deps;
3475
3479
  lilact_default.passive_effects.add(async () => {
@@ -3479,7 +3483,7 @@ async function useEffect(effect, deps = void 0) {
3479
3483
  lilact_default.setTimeout(lilact_default.processEffects, 0);
3480
3484
  }
3481
3485
  async function useInsertionEffect(effect, deps = void 0) {
3482
- if (deps !== void 0 && (typeof deps !== "object" || deps.constructor.name !== "Array")) {
3486
+ if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
3483
3487
  throw new Error("Insertion effect dependencies must be an array, object, or omitted.");
3484
3488
  }
3485
3489
  const hk = useHook();
@@ -3488,6 +3492,7 @@ async function useInsertionEffect(effect, deps = void 0) {
3488
3492
  }
3489
3493
  if (hk == null ? void 0 : hk.cleanup) {
3490
3494
  await hk.cleanup();
3495
+ hk.cleanup = void 0;
3491
3496
  }
3492
3497
  hk.deps = deps;
3493
3498
  lilact_default.insertion_effects.add(async () => {
@@ -3497,7 +3502,7 @@ async function useInsertionEffect(effect, deps = void 0) {
3497
3502
  lilact_default.setTimeout(lilact_default.processEffects, 0);
3498
3503
  }
3499
3504
  function useMemo(factory, deps = void 0) {
3500
- if (deps !== void 0 && (typeof deps !== "object" || deps.constructor.name !== "Array")) {
3505
+ if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
3501
3506
  throw new Error("Memo dependencies must be an array or omitted.");
3502
3507
  }
3503
3508
  const hk = useHook();
@@ -3515,11 +3520,11 @@ function useActionState(action, initialState) {
3515
3520
  const [is_pending, tran_start_func] = useTransition();
3516
3521
  if (isEmpty(hk)) {
3517
3522
  hk.state = initialState;
3518
- hk.form_action = (sub) => {
3523
+ hk.form_action = (event) => {
3519
3524
  event.preventDefault();
3520
3525
  tran_start_func(
3521
3526
  async () => {
3522
- const form_data = new FormData(sub.target, sub.submitter);
3527
+ const form_data = new FormData(event.target, event.submitter);
3523
3528
  hk.state = await action(hk.state, form_data);
3524
3529
  },
3525
3530
  []
@@ -3580,7 +3585,7 @@ function useImperativeHandle(ref, factory, deps = void 0) {
3580
3585
  if (typeof (ref == null ? void 0 : ref.current) !== "object") {
3581
3586
  ref.current = {};
3582
3587
  }
3583
- Object.assign(ref.current, factory(), 0);
3588
+ Object.assign(ref.current, factory());
3584
3589
  }
3585
3590
  function useDebugValue(val, formatter = (x) => x) {
3586
3591
  if (true) {
@@ -3601,165 +3606,144 @@ __export(run_exports, {
3601
3606
  runScripts: () => runScripts
3602
3607
  });
3603
3608
  function joinPaths(basePath, relativePath) {
3604
- const isAbsolute = relativePath.startsWith("/");
3605
- const stack = [];
3606
- const parts = (isAbsolute ? "" : basePath).split("/").filter(Boolean);
3607
- for (const part of parts) {
3608
- stack.push(part);
3609
- }
3610
- if (!basePath.endsWith("/")) {
3611
- stack.pop();
3612
- }
3609
+ const absolute = relativePath.startsWith("/");
3610
+ const parts = (absolute ? "" : basePath).split("/").filter(Boolean);
3611
+ if (!absolute && !basePath.endsWith("/")) parts.pop();
3613
3612
  for (const part of relativePath.split("/")) {
3614
- if (part === "" || part === ".") continue;
3615
- if (part === "..") {
3616
- if (stack.length > 0) stack.pop();
3617
- } else {
3618
- stack.push(part);
3619
- }
3613
+ if (!part || part === ".") continue;
3614
+ if (part === "..") parts.pop();
3615
+ else parts.push(part);
3620
3616
  }
3621
- return `${isAbsolute ? "/" : ""}${stack.join("/")}`;
3617
+ return `${absolute ? "/" : ""}${parts.join("/")}`;
3622
3618
  }
3623
- function asError(value, fallbackMessage = "Unknown error") {
3619
+ function asError(value, fallback = "Unknown error") {
3624
3620
  if (value instanceof Error) return value;
3621
+ if ((value == null ? void 0 : value.error) instanceof Error) return value.error;
3622
+ const error2 = new Error(
3623
+ (value == null ? void 0 : value.message) == null ? fallback : String(value.message)
3624
+ );
3625
3625
  if (value && typeof value === "object") {
3626
- if (value.error instanceof Error) return value.error;
3627
- const error2 = new Error(
3628
- value.message == null ? fallbackMessage : String(value.message)
3629
- );
3630
3626
  if (value.name) error2.name = value.name;
3631
- if (value.stack) {
3632
- Object.defineProperty(error2, "stack", {
3633
- value: value.stack,
3634
- configurable: true
3635
- });
3636
- }
3627
+ if (value.stack) error2.stack = value.stack;
3637
3628
  for (const key of Object.keys(value)) {
3638
3629
  if (!(key in error2)) error2[key] = value[key];
3639
3630
  }
3640
- return error2;
3641
3631
  }
3642
- return new Error(
3643
- value == null ? fallbackMessage : String(value)
3644
- );
3632
+ return error2;
3645
3633
  }
3646
- function attachPath(error2, path2) {
3647
- const result2 = asError(error2);
3648
- if (result2.fileName == null) result2.fileName = path2;
3649
- return result2;
3634
+ function markSource(value, path2) {
3635
+ const error2 = asError(value);
3636
+ if (!error2.lilact_source) {
3637
+ error2.lilact_source = { path: path2 };
3638
+ }
3639
+ return error2;
3650
3640
  }
3651
- function reportRuntimeError(error2, path2) {
3652
- const withPath = attachPath(error2, path2);
3641
+ function report(value, path2) {
3642
+ const error2 = markSource(value, path2);
3643
+ if (error2.isTraced) return error2;
3653
3644
  if (typeof lilact_default.traceError === "function") {
3654
- return lilact_default.traceError(withPath, path2);
3645
+ return lilact_default.traceError(error2, path2);
3655
3646
  }
3656
- lilact_default.error = withPath;
3657
- return withPath;
3647
+ lilact_default.error = error2;
3648
+ return error2;
3658
3649
  }
3659
3650
  var required_scripts = {};
3660
3651
  function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {
3661
3652
  isInline = true,
3662
3653
  isModule = true
3663
3654
  } = {}) {
3664
- const mappings = [];
3655
+ var _a, _b;
3665
3656
  const module = {
3666
- mappings,
3667
- isInline,
3668
- isModule,
3669
3657
  path,
3670
3658
  code: String(jsx),
3671
- exports: {}
3659
+ mappings: [],
3660
+ exports: {},
3661
+ isInline,
3662
+ isModule
3672
3663
  };
3673
3664
  required_scripts[path] = module;
3674
3665
  let processed;
3675
3666
  try {
3676
3667
  processed = lilact_default.transpileJSX(String(jsx), {
3677
3668
  path,
3678
- mappings,
3669
+ mappings: module.mappings,
3679
3670
  factory: "createComponent",
3680
3671
  appendSourcemap: false,
3681
3672
  injectTraceLabels: true,
3682
3673
  produceCJS: true,
3683
3674
  blocks_info: lilact_default.blocks_info
3684
3675
  });
3685
- } catch (error2) {
3686
- const parserError = attachPath(error2, path);
3687
- parserError.sourcePhase = "transpile";
3688
- module.error = parserError;
3689
- lilact_default.error = parserError;
3690
- throw parserError;
3691
- }
3692
- if (true) {
3693
- module.processed = processed;
3676
+ } catch (value) {
3677
+ const error2 = asError(value);
3678
+ (_a = error2.fileName) != null ? _a : error2.fileName = path;
3679
+ error2.sourcePhase = "transpile";
3680
+ module.error = error2;
3681
+ lilact_default.error = error2;
3682
+ throw error2;
3694
3683
  }
3695
- processed = `${processed}
3696
- //# sourceURL=eval:/${path}`;
3697
3684
  if (typeof lilact_default.scanBlockLabels === "function") {
3698
3685
  lilact_default.scanBlockLabels(processed, path);
3699
3686
  }
3687
+ processed += `
3688
+ //# sourceURL=eval:/${path}`;
3700
3689
  try {
3701
3690
  globalThis.Lilact = lilact_default;
3702
3691
  globalThis.createComponent = lilact_default.createComponent;
3703
3692
  globalThis.Fragment = lilact_default.Fragment;
3704
3693
  const result = eval(processed);
3705
- if (!isEmpty(module.exports)) {
3706
- return module.exports;
3707
- }
3708
- return result;
3709
- } catch (error2) {
3710
- const runtimeError = reportRuntimeError(error2, path);
3711
- runtimeError.sourcePhase = "runtime";
3712
- module.error = runtimeError;
3713
- throw runtimeError;
3694
+ return isEmpty(module.exports) ? result : module.exports;
3695
+ } catch (value) {
3696
+ const error2 = report(value, path);
3697
+ (_b = error2.sourcePhase) != null ? _b : error2.sourcePhase = "runtime";
3698
+ module.error = error2;
3699
+ throw error2;
3714
3700
  }
3715
3701
  }
3716
3702
  function require2(path2) {
3717
3703
  var _a, _b, _c, _d, _e, _f;
3718
- let forceUpdate;
3719
- let checkExport;
3720
- let requirer;
3721
- let isLazy;
3704
+ let options = {};
3722
3705
  if (arguments.length === 2 && arguments[1] && typeof arguments[1] === "object") {
3723
- forceUpdate = arguments[1].forceUpdate;
3724
- checkExport = arguments[1].checkExport;
3725
- requirer = arguments[1].requirer;
3726
- isLazy = arguments[1].isLazy;
3706
+ options = arguments[1];
3727
3707
  }
3728
3708
  if ((_a = lilact_default.importObjectPaths) == null ? void 0 : _a[path2]) {
3729
3709
  return lilact_default.importObjectPaths[path2];
3730
3710
  }
3731
- if (required_scripts[path2] && !forceUpdate) {
3711
+ const loadAsync = Boolean(lilact_default[LAZY]) || Boolean(options.isLazy);
3712
+ if ((_b = options.requirer) == null ? void 0 : _b.path) {
3713
+ path2 = joinPaths(options.requirer.path, path2);
3714
+ }
3715
+ if (required_scripts[path2] && !options.forceUpdate && !loadAsync) {
3732
3716
  return required_scripts[path2].exports;
3733
3717
  }
3734
- if (path2[0] === "#") {
3718
+ if (path2.startsWith("#")) {
3735
3719
  const element = document.getElementById(path2.slice(1));
3736
3720
  if (!element) {
3737
- const error3 = new Error(
3738
- `Required element not found (${path2})`
3721
+ throw report(
3722
+ new Error(`Required element not found (${path2})`),
3723
+ path2
3739
3724
  );
3740
- error3.fileName = path2;
3741
- throw error3;
3742
3725
  }
3743
3726
  return run(element.textContent || "", path2);
3744
3727
  }
3745
- if (requirer == null ? void 0 : requirer.path) {
3746
- path2 = joinPaths(requirer.path, path2);
3747
- }
3748
- const loadAsync = Boolean((_b = lilact_default) == null ? void 0 : _b[LAZY]) || Boolean(isLazy);
3749
3728
  if (loadAsync) {
3750
3729
  lilact_default[LAZY] = false;
3751
3730
  let request2 = (_d = (_c = lilact_default).resolver) == null ? void 0 : _d.call(_c, path2);
3752
- if (request2 === void 0 || request2 === null) {
3753
- request2 = fetch(path2).then((response) => {
3754
- if (!response.ok) {
3755
- const error3 = new Error(
3756
- `Unable to load ${path2}: HTTP ${response.status}`
3757
- );
3758
- error3.fileName = path2;
3759
- throw error3;
3760
- }
3761
- return response.text();
3762
- });
3731
+ if (request2 == null) {
3732
+ if (required_scripts[path2] && !options.forceUpdate) {
3733
+ request2 = Promise.resolve(required_scripts[path2].code);
3734
+ } else {
3735
+ request2 = fetch(path2).then((response) => {
3736
+ if (!response.ok) {
3737
+ throw report(
3738
+ new Error(
3739
+ `Unable to load ${path2}: HTTP ${response.status}`
3740
+ ),
3741
+ path2
3742
+ );
3743
+ }
3744
+ return response.text();
3745
+ });
3746
+ }
3763
3747
  } else {
3764
3748
  request2 = Promise.resolve(request2);
3765
3749
  }
@@ -3772,16 +3756,17 @@ function require2(path2) {
3772
3756
  isInline: false,
3773
3757
  isModule: true
3774
3758
  });
3775
- }).then((result2) => {
3776
- var _a2;
3777
- if (path2.endsWith(".css")) return result2;
3778
- return (_a2 = result2 == null ? void 0 : result2.default) != null ? _a2 : result2;
3779
- }).catch((error3) => {
3780
- throw reportRuntimeError(error3, path2);
3759
+ }).then(
3760
+ (result2) => {
3761
+ var _a2;
3762
+ return (_a2 = result2 == null ? void 0 : result2.default) != null ? _a2 : result2;
3763
+ }
3764
+ ).catch((error2) => {
3765
+ throw report(error2, path2);
3781
3766
  });
3782
3767
  }
3783
3768
  const resolved = (_f = (_e = lilact_default).resolver) == null ? void 0 : _f.call(_e, path2);
3784
- if (resolved !== void 0 && resolved !== null) {
3769
+ if (resolved != null) {
3785
3770
  if (path2.endsWith(".css")) {
3786
3771
  injectGlobal(String(resolved));
3787
3772
  return;
@@ -3795,8 +3780,8 @@ function require2(path2) {
3795
3780
  try {
3796
3781
  request.open("GET", path2, false);
3797
3782
  request.send(null);
3798
- } catch (error3) {
3799
- throw reportRuntimeError(error3, path2);
3783
+ } catch (value) {
3784
+ throw report(value, path2);
3800
3785
  }
3801
3786
  if (request.status >= 200 && request.status < 300) {
3802
3787
  if (path2.endsWith(".css")) {
@@ -3808,11 +3793,10 @@ function require2(path2) {
3808
3793
  isModule: true
3809
3794
  });
3810
3795
  }
3811
- const error2 = new Error(
3812
- `Unable to load ${path2}: HTTP ${request.status || 0}`
3796
+ throw report(
3797
+ new Error(`Unable to load ${path2}: HTTP ${request.status || 0}`),
3798
+ path2
3813
3799
  );
3814
- error2.fileName = path2;
3815
- throw error2;
3816
3800
  }
3817
3801
  function lazy(factory) {
3818
3802
  let status = "pending";
@@ -3826,9 +3810,9 @@ function lazy(factory) {
3826
3810
  }
3827
3811
  if (lilact_default.isThenable(result2)) {
3828
3812
  result2.then(
3829
- (module2) => {
3813
+ (value) => {
3830
3814
  status = "success";
3831
- result2 = module2;
3815
+ result2 = value;
3832
3816
  },
3833
3817
  (error2) => {
3834
3818
  status = "error";
@@ -3846,7 +3830,7 @@ function lazy(factory) {
3846
3830
  }
3847
3831
  return LazyComponent;
3848
3832
  }
3849
- function scanScriptTagsWithType() {
3833
+ function scriptTags() {
3850
3834
  return Array.from(
3851
3835
  document.querySelectorAll('script[type="text/jsx"]')
3852
3836
  ).map((element) => ({
@@ -3854,9 +3838,9 @@ function scanScriptTagsWithType() {
3854
3838
  content: element.textContent || ""
3855
3839
  }));
3856
3840
  }
3857
- function runScripts() {
3858
- for (const script of scanScriptTagsWithType()) {
3859
- if (script.src) require2(script.src);
3841
+ async function runScripts() {
3842
+ for (const script of scriptTags()) {
3843
+ if (script.src) await require2(script.src);
3860
3844
  if (script.content) run(script.content);
3861
3845
  }
3862
3846
  }
@@ -4529,220 +4513,135 @@ __export(errors_exports, {
4529
4513
  blocks_info: () => blocks_info,
4530
4514
  error: () => error,
4531
4515
  globalErrorHandler: () => globalErrorHandler,
4532
- mapLocation: () => mapLocation,
4533
4516
  scanBlockLabels: () => scanBlockLabels,
4534
4517
  traceError: () => traceError
4535
4518
  });
4536
- function numberOrNull(value) {
4537
- const n = Number(value);
4538
- return Number.isFinite(n) ? n : null;
4539
- }
4540
- function firstNumber(...values) {
4541
- for (const value of values) {
4542
- const n = numberOrNull(value);
4543
- if (n !== null) return n;
4544
- }
4545
- return null;
4519
+ function number(value) {
4520
+ const result2 = Number(value);
4521
+ return Number.isFinite(result2) ? result2 : null;
4546
4522
  }
4547
4523
  function asError2(value) {
4548
4524
  if (value instanceof Error) return value;
4525
+ if ((value == null ? void 0 : value.error) instanceof Error) return value.error;
4526
+ const error2 = new Error(
4527
+ (value == null ? void 0 : value.message) == null ? String(value) : String(value.message)
4528
+ );
4549
4529
  if (value && typeof value === "object") {
4550
- if (value.error instanceof Error) return value.error;
4551
- const error2 = new Error(
4552
- value.message == null ? String(value) : String(value.message)
4553
- );
4554
4530
  if (value.name) error2.name = value.name;
4555
4531
  if (value.stack) error2.stack = value.stack;
4556
4532
  for (const key of Object.keys(value)) {
4557
4533
  if (!(key in error2)) error2[key] = value[key];
4558
4534
  }
4559
- return error2;
4560
4535
  }
4561
- return new Error(String(value));
4536
+ return error2;
4562
4537
  }
4563
4538
  function isParserError(error2) {
4564
4539
  return (error2 == null ? void 0 : error2.name) === "JSXParserError";
4565
4540
  }
4566
- function getErrorLocation(error2, { zeroBased = false } = {}) {
4567
- const line2 = firstNumber(
4568
- error2 == null ? void 0 : error2.lineNumber,
4569
- error2 == null ? void 0 : error2.lineno,
4570
- error2 == null ? void 0 : error2.line
4571
- );
4572
- const column2 = firstNumber(
4573
- error2 == null ? void 0 : error2.columnNumber,
4574
- error2 == null ? void 0 : error2.colno,
4575
- error2 == null ? void 0 : error2.column
4576
- );
4577
- if (line2 !== null || column2 !== null) {
4578
- return {
4579
- line: line2 === null ? null : zeroBased ? line2 : Math.max(0, line2 - 1),
4580
- col: column2 === null ? null : zeroBased ? column2 : Math.max(0, column2 - 1)
4581
- };
4582
- }
4583
- return null;
4584
- }
4585
- function sourceUrlFromStack(stack) {
4586
- const text = typeof stack === "string" ? stack : "";
4587
- const expression = /(?:^|[\s(@])((?:eval:\/)[\s\S]*):(\d+):(\d+)(?:\)?$)/;
4588
- for (const line2 of text.split(/\r?\n/)) {
4589
- const match2 = line2.trim().match(expression);
4541
+ function stackLocation(stack) {
4542
+ if (typeof stack !== "string") return null;
4543
+ for (const line2 of stack.split(/\r?\n/)) {
4544
+ const match2 = line2.match(/(eval:\/.*):(\d+):(\d+)/);
4590
4545
  if (!match2) continue;
4591
4546
  return {
4592
- url: match2[1],
4593
- line: Number(match2[2]),
4594
- col: Number(match2[3])
4547
+ path: match2[1].replace(/^eval:\/+/, ""),
4548
+ line: Number(match2[2]) - 1,
4549
+ column: Number(match2[3]) - 1
4595
4550
  };
4596
4551
  }
4597
4552
  return null;
4598
4553
  }
4599
- function sourcePathFromEvalUrl(url) {
4600
- if (typeof url !== "string") return null;
4601
- if (url.startsWith("eval:/")) {
4602
- return url.slice("eval:/".length);
4603
- }
4604
- if (url.startsWith("eval:")) {
4605
- return url.slice("eval:".length).replace(/^\/+/, "");
4606
- }
4607
- return null;
4608
- }
4609
- function mapLocation(mappings2, generatedLine, generatedColumn) {
4610
- if (!Array.isArray(mappings2) || mappings2.length === 0) {
4611
- return {
4612
- line: generatedLine,
4613
- col: generatedColumn
4614
- };
4615
- }
4616
- const line2 = Number(generatedLine);
4617
- const col = Number(generatedColumn);
4618
- if (!Number.isFinite(line2) || !Number.isFinite(col)) {
4619
- return {
4620
- line: null,
4621
- col: null
4622
- };
4623
- }
4624
- const validMappings = mappings2.filter(
4625
- (mapping2) => Array.isArray(mapping2) && mapping2.length >= 4 && Number.isFinite(Number(mapping2[0])) && Number.isFinite(Number(mapping2[1])) && Number.isFinite(Number(mapping2[2])) && Number.isFinite(Number(mapping2[3]))
4626
- ).slice().sort((a, b2) => {
4627
- const lineDifference = Number(a[0]) - Number(b2[0]);
4628
- if (lineDifference !== 0) {
4629
- return lineDifference;
4630
- }
4631
- return Number(a[1]) - Number(b2[1]);
4632
- });
4633
- if (validMappings.length === 0) {
4634
- return {
4635
- line: line2,
4636
- col
4637
- };
4638
- }
4639
- let mapping = validMappings[0];
4640
- for (const candidate of validMappings) {
4641
- const generatedMappingLine = Number(candidate[0]);
4642
- const generatedMappingColumn = Number(candidate[1]);
4643
- if (generatedMappingLine < line2 || generatedMappingLine === line2 && generatedMappingColumn <= col) {
4644
- mapping = candidate;
4645
- continue;
4646
- }
4647
- break;
4648
- }
4649
- const mappingGeneratedLine = Number(mapping[0]);
4650
- const mappingGeneratedColumn = Number(mapping[1]);
4651
- const mappingSourceLine = Number(mapping[2]);
4652
- const mappingSourceColumn = Number(mapping[3]);
4653
- const sourceLine = mappingSourceLine + (line2 - mappingGeneratedLine);
4654
- const sourceColumn = line2 === mappingGeneratedLine ? Math.max(
4655
- 0,
4656
- mappingSourceColumn + (col - mappingGeneratedColumn)
4657
- ) : mappingSourceColumn;
4554
+ function browserLocation(error2) {
4555
+ var _a, _b, _c, _d;
4556
+ const line2 = number(
4557
+ (_b = (_a = error2 == null ? void 0 : error2.lineNumber) != null ? _a : error2 == null ? void 0 : error2.lineno) != null ? _b : error2 == null ? void 0 : error2.line
4558
+ );
4559
+ const column2 = number(
4560
+ (_d = (_c = error2 == null ? void 0 : error2.columnNumber) != null ? _c : error2 == null ? void 0 : error2.colno) != null ? _d : error2 == null ? void 0 : error2.column
4561
+ );
4658
4562
  return {
4659
- line: sourceLine,
4660
- col: sourceColumn
4563
+ line: line2 == null ? null : Math.max(0, line2 - 1),
4564
+ column: column2 == null ? null : Math.max(0, column2 - 1)
4661
4565
  };
4662
4566
  }
4663
- function getBlockTrace(error2) {
4567
+ function traceBlock(error2) {
4664
4568
  const trace = error2 == null ? void 0 : error2.lilact_trace;
4665
- if (Array.isArray(trace)) {
4666
- return trace[0];
4667
- }
4668
- return trace;
4569
+ return Array.isArray(trace) ? trace[0] : trace;
4669
4570
  }
4670
- function getBlockInfo(error2) {
4671
- var _a, _b, _c;
4672
- const trace = getBlockTrace(error2);
4673
- if (trace === void 0 || trace === null) {
4674
- return null;
4675
- }
4676
- return (_c = (_b = (_a = lilact_default.blocks_info) == null ? void 0 : _a.labels) == null ? void 0 : _b[trace]) != null ? _c : null;
4571
+ function blockInfo(error2) {
4572
+ var _a, _b;
4573
+ const trace = traceBlock(error2);
4574
+ return trace == null ? null : (_b = (_a = lilact_default.blocks_info) == null ? void 0 : _a.labels) == null ? void 0 : _b[trace];
4677
4575
  }
4678
- function applyBlockFallback(error2, result2, currentPath) {
4679
- const block = getBlockInfo(error2);
4680
- if (!block) return result2;
4681
- if (block.path) {
4682
- result2.fileName = block.path;
4683
- } else if (!result2.fileName) {
4684
- result2.fileName = currentPath;
4576
+ function mapLocation(mappings, line2, column2) {
4577
+ if (!Array.isArray(mappings) || !mappings.length || !Number.isFinite(line2) || !Number.isFinite(column2)) {
4578
+ return { line: line2, column: column2 };
4685
4579
  }
4686
- if (Number.isFinite(block.line) && Number.isFinite(block.col)) {
4687
- result2.lineNumber = block.line;
4688
- result2.columnNumber = block.col;
4689
- }
4690
- if (block.desc) {
4691
- result2.label = block.desc;
4692
- }
4693
- return result2;
4694
- }
4695
- function copyErrorMetadata(source, target) {
4696
- if (!source || typeof source !== "object") return;
4697
- for (const key of [
4698
- "fileName",
4699
- "lineNumber",
4700
- "columnNumber",
4701
- "lineno",
4702
- "colno",
4703
- "line",
4704
- "column",
4705
- "componentStackLog",
4706
- "lilact_trace"
4707
- ]) {
4708
- if (source[key] !== void 0 && target[key] === void 0) {
4709
- target[key] = source[key];
4580
+ const valid = mappings.filter(
4581
+ (mapping) => Array.isArray(mapping) && mapping.length >= 4 && mapping.slice(0, 4).every((value) => Number.isFinite(Number(value)))
4582
+ ).sort(
4583
+ (a, b2) => Number(a[0]) - Number(b2[0]) || Number(a[1]) - Number(b2[1])
4584
+ );
4585
+ if (!valid.length) return { line: line2, column: column2 };
4586
+ let selected = valid[0];
4587
+ for (const mapping of valid) {
4588
+ const generatedLine2 = Number(mapping[0]);
4589
+ const generatedColumn2 = Number(mapping[1]);
4590
+ if (generatedLine2 < line2 || generatedLine2 === line2 && generatedColumn2 <= column2) {
4591
+ selected = mapping;
4592
+ } else {
4593
+ break;
4710
4594
  }
4711
4595
  }
4596
+ const generatedLine = Number(selected[0]);
4597
+ const generatedColumn = Number(selected[1]);
4598
+ const sourceLine = Number(selected[2]);
4599
+ const sourceColumn = Number(selected[3]);
4600
+ return {
4601
+ line: sourceLine + (line2 === generatedLine ? 0 : line2 - generatedLine),
4602
+ column: line2 === generatedLine ? Math.max(0, sourceColumn + column2 - generatedColumn) : sourceColumn
4603
+ };
4712
4604
  }
4713
4605
  function traceError(value, runPath) {
4714
- var _a, _b;
4606
+ var _a, _b, _c, _d, _e, _f;
4715
4607
  if (value == null ? void 0 : value.isTraced) return value;
4716
- const original = (value == null ? void 0 : value.error) instanceof Error ? value.error : asError2(value);
4717
- const parserError = isParserError(original);
4718
- const stackLocation = parserError ? null : sourceUrlFromStack(original.stack);
4719
- const eventLocation = parserError ? getErrorLocation(original, { zeroBased: true }) : getErrorLocation(original);
4608
+ const error2 = asError2(value);
4609
+ const source = error2.lilact_source;
4610
+ const stack = isParserError(error2) ? null : stackLocation(error2.stack);
4611
+ const browser = isParserError(error2) ? {
4612
+ line: number(error2.lineNumber),
4613
+ column: number(error2.columnNumber)
4614
+ } : browserLocation(error2);
4615
+ const fileName = (source == null ? void 0 : source.path) || (stack == null ? void 0 : stack.path) || error2.fileName || runPath || null;
4616
+ let line2 = (_b = (_a = stack == null ? void 0 : stack.line) != null ? _a : browser.line) != null ? _b : null;
4617
+ let column2 = (_d = (_c = stack == null ? void 0 : stack.column) != null ? _c : browser.column) != null ? _d : null;
4720
4618
  const result2 = {
4721
- fileName: sourcePathFromEvalUrl(stackLocation == null ? void 0 : stackLocation.url) || original.fileName || runPath || null,
4722
- lineNumber: (stackLocation == null ? void 0 : stackLocation.line) != null ? Math.max(0, stackLocation.line - 1) : (_a = eventLocation == null ? void 0 : eventLocation.line) != null ? _a : null,
4723
- columnNumber: (stackLocation == null ? void 0 : stackLocation.col) != null ? Math.max(0, stackLocation.col - 1) : (_b = eventLocation == null ? void 0 : eventLocation.col) != null ? _b : null,
4724
- message: original.message == null ? String(original) : String(original.message),
4725
- name: original.name || "Error",
4726
- stack: original.stack || null,
4727
- _error: original,
4619
+ fileName,
4620
+ lineNumber: line2,
4621
+ columnNumber: column2,
4622
+ message: error2.message == null ? String(error2) : String(error2.message),
4623
+ name: error2.name || "Error",
4624
+ stack: error2.stack || null,
4625
+ lilact_source: source || null,
4626
+ _error: error2,
4728
4627
  isTraced: true
4729
4628
  };
4730
- copyErrorMetadata(value, result2);
4731
- copyErrorMetadata(original, result2);
4732
- if (!parserError && (stackLocation == null ? void 0 : stackLocation.url)) {
4733
- const module2 = required_scripts[result2.fileName];
4734
- if (module2 == null ? void 0 : module2.mappings) {
4735
- const mapped = mapLocation(
4736
- module2.mappings,
4737
- result2.lineNumber,
4738
- result2.columnNumber
4739
- );
4740
- result2.lineNumber = mapped.line;
4741
- result2.columnNumber = mapped.col;
4742
- }
4743
- }
4744
- if (!parserError && !(stackLocation == null ? void 0 : stackLocation.url)) {
4745
- applyBlockFallback(original, result2, runPath);
4629
+ const module2 = fileName && required_scripts[fileName];
4630
+ if (module2) {
4631
+ const mapped = mapLocation(
4632
+ module2.mappings,
4633
+ result2.lineNumber,
4634
+ result2.columnNumber
4635
+ );
4636
+ result2.lineNumber = mapped.line;
4637
+ result2.columnNumber = mapped.column;
4638
+ }
4639
+ const block = blockInfo(error2);
4640
+ if (block && (result2.lineNumber == null || result2.columnNumber == null || !result2.fileName)) {
4641
+ result2.fileName || (result2.fileName = block.path || runPath || null);
4642
+ (_e = result2.lineNumber) != null ? _e : result2.lineNumber = block.line;
4643
+ (_f = result2.columnNumber) != null ? _f : result2.columnNumber = block.col;
4644
+ result2.label = block.desc;
4746
4645
  }
4747
4646
  lilact_default.error = result2;
4748
4647
  return result2;
@@ -4750,24 +4649,27 @@ function traceError(value, runPath) {
4750
4649
  function escapeHtml(value) {
4751
4650
  return String(value != null ? value : "").replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
4752
4651
  }
4753
- function sourceExcerpt(module2, zeroBasedLine) {
4652
+ function sourceExcerpt(module2, line2) {
4754
4653
  var _a, _b, _c, _d;
4755
- if (!module2 || !Number.isFinite(zeroBasedLine)) {
4756
- return null;
4757
- }
4654
+ if (!module2 || !Number.isFinite(line2)) return null;
4758
4655
  const lines = String((_a = module2.code) != null ? _a : "").split(/\r?\n/);
4759
- const before = (_b = lines[zeroBasedLine - 1]) != null ? _b : "";
4760
- const current = (_c = lines[zeroBasedLine]) != null ? _c : "";
4761
- const after = (_d = lines[zeroBasedLine + 1]) != null ? _d : "";
4762
- return { before, current, after };
4656
+ return {
4657
+ before: (_b = lines[line2 - 1]) != null ? _b : "",
4658
+ current: (_c = lines[line2]) != null ? _c : "",
4659
+ after: (_d = lines[line2 + 1]) != null ? _d : ""
4660
+ };
4763
4661
  }
4764
4662
  function globalErrorHandler(eventOrError) {
4765
4663
  var _a, _b;
4766
- const raw = (eventOrError == null ? void 0 : eventOrError.error) instanceof Error ? eventOrError.error : (eventOrError == null ? void 0 : eventOrError.reason) !== void 0 ? eventOrError.reason : eventOrError;
4767
- const runPath = (eventOrError == null ? void 0 : eventOrError.fileName) || null;
4768
- const traced = traceError(raw, runPath);
4769
- const module2 = required_scripts[traced.fileName];
4770
- const excerpt = sourceExcerpt(module2, traced.lineNumber);
4664
+ const value = (eventOrError == null ? void 0 : eventOrError.error) instanceof Error ? eventOrError.error : (eventOrError == null ? void 0 : eventOrError.reason) !== void 0 ? eventOrError.reason : eventOrError;
4665
+ const error2 = traceError(
4666
+ value,
4667
+ (eventOrError == null ? void 0 : eventOrError.fileName) || null
4668
+ );
4669
+ const excerpt = sourceExcerpt(
4670
+ required_scripts[error2.fileName],
4671
+ error2.lineNumber
4672
+ );
4771
4673
  const className = css(`
4772
4674
  background: linear-gradient(135deg, #fff2f2d4, #ffffffd4);
4773
4675
  backdrop-filter: blur(10px);
@@ -4791,14 +4693,14 @@ function globalErrorHandler(eventOrError) {
4791
4693
  `);
4792
4694
  const dialog = document.createElement("dialog");
4793
4695
  dialog.className = className;
4794
- const location = traced.fileName ? `At ${escapeHtml(traced.fileName)}` : "";
4795
- const line2 = Number.isFinite(traced.lineNumber) ? `: Line ${traced.lineNumber + 1}` : "";
4796
- const componentStack = ((_a = traced._error) == null ? void 0 : _a.componentStackLog) || ((_b = traced._error) == null ? void 0 : _b.componentStack) || "";
4696
+ const location = error2.fileName ? `At ${escapeHtml(error2.fileName)}` : "";
4697
+ const line2 = Number.isFinite(error2.lineNumber) ? `: Line ${error2.lineNumber + 1}` : "";
4698
+ const componentStack = ((_a = error2._error) == null ? void 0 : _a.componentStackLog) || ((_b = error2._error) == null ? void 0 : _b.componentStack) || "";
4797
4699
  dialog.innerHTML = `
4798
4700
  <h3><red>Error!</red></h3>
4799
4701
  <b>${location}${line2}</b><br><br>
4800
- <b>${escapeHtml(traced.name)}</b>:
4801
- <span>${escapeHtml(traced.message)}</span>
4702
+ <b>${escapeHtml(error2.name)}</b>:
4703
+ <span>${escapeHtml(error2.message)}</span>
4802
4704
  <br><br>
4803
4705
 
4804
4706
  ${excerpt ? "<code><pre></pre><red><pre></pre></red><pre></pre></code>" : ""}
@@ -4822,15 +4724,13 @@ function globalErrorHandler(eventOrError) {
4822
4724
  } else {
4823
4725
  dialog.setAttribute("open", "");
4824
4726
  }
4825
- return traced;
4727
+ return error2;
4826
4728
  }
4827
4729
  function scanBlockLabels(code2, path2) {
4828
- const labels = String(code2).matchAll(
4730
+ for (const match2 of String(code2).matchAll(
4829
4731
  /LILACTBLOCK(\d+):(\d+),(\d+):([^*]+)\*\//gm
4830
- );
4831
- for (const match2 of labels) {
4832
- const id = match2[1];
4833
- lilact_default.blocks_info.labels[id] = {
4732
+ )) {
4733
+ lilact_default.blocks_info.labels[match2[1]] = {
4834
4734
  path: path2,
4835
4735
  line: Number(match2[2]),
4836
4736
  col: Number(match2[3]),
@@ -5712,7 +5612,7 @@ function labeler(custom_words, x) {
5712
5612
  if (x.type === "comment") return "C";
5713
5613
  if (x.type === "regexp") return "R";
5714
5614
  if (x.type === "js") return "J";
5715
- if (x.type === "paranthesis") return "P";
5615
+ if (x.type === "parenthesis") return "P";
5716
5616
  if (x.type === "string") return "S";
5717
5617
  if (x.type === "xml") return "X";
5718
5618
  }
@@ -6011,7 +5911,7 @@ function lookAhead(f, code2, index2, ...args) {
6011
5911
  function parseRegex(code, index, container) {
6012
5912
  let i = index;
6013
5913
  let dels = `;=,([{}!^~&|:?*%-+/<>${transpilerConfig.preprocessorDelimiter}`;
6014
- while (--i > 0) {
5914
+ while (--i >= 0) {
6015
5915
  if (" \r".indexOf(code[i]) !== -1) continue;
6016
5916
  if (code[i] === "\n") {
6017
5917
  dels += ")]";
@@ -6433,10 +6333,10 @@ function parseXML(code2, index2, container2, look_behind = false) {
6433
6333
  }
6434
6334
  }
6435
6335
  }
6436
- function parseParanthesis(code2, index2, container2) {
6336
+ function parseParenthesis(code2, index2, container2) {
6437
6337
  const b2 = {
6438
6338
  // block
6439
- type: "paranthesis",
6339
+ type: "parenthesis",
6440
6340
  begin: index2,
6441
6341
  cbegin: ++index2,
6442
6342
  children: [],
@@ -6460,7 +6360,7 @@ function parseParanthesis(code2, index2, container2) {
6460
6360
  [index2] = lookAhead(parseJS, code2, index2, true, b2);
6461
6361
  break;
6462
6362
  case "(":
6463
- [index2] = lookAhead(parseParanthesis, code2, index2, b2);
6363
+ [index2] = lookAhead(parseParenthesis, code2, index2, b2);
6464
6364
  break;
6465
6365
  case "}":
6466
6366
  raiseError(`Unmatched curly bracket`, b2.begin);
@@ -6482,7 +6382,7 @@ function parseParanthesis(code2, index2, container2) {
6482
6382
  break;
6483
6383
  }
6484
6384
  }
6485
- raiseError(`Unterminated paranthesis block`, b2.begin);
6385
+ raiseError(`Unterminated parenthesis block`, b2.begin);
6486
6386
  }
6487
6387
  function parseJS(code2, index2 = 0, is_block = false, container2) {
6488
6388
  const b2 = {
@@ -6512,10 +6412,10 @@ function parseJS(code2, index2 = 0, is_block = false, container2) {
6512
6412
  break;
6513
6413
  }
6514
6414
  case "(":
6515
- [index2] = lookAhead(parseParanthesis, code2, index2, b2);
6415
+ [index2] = lookAhead(parseParenthesis, code2, index2, b2);
6516
6416
  break;
6517
6417
  case ")":
6518
- raiseError(`Unmatched paranthesis`, b2.begin);
6418
+ raiseError(`Unmatched parenthesis`, b2.begin);
6519
6419
  break;
6520
6420
  case "}":
6521
6421
  if (is_block) {
@@ -6567,7 +6467,7 @@ function labelFunctions(node3, eols, blocks_info2) {
6567
6467
  }
6568
6468
  let i2, nxt, prev2;
6569
6469
  for (let chi = 0; chi < node3.children.length; chi++) {
6570
- if (typeof node3.children[chi] === "object" && node3.children[chi].type === "paranthesis") {
6470
+ if (typeof node3.children[chi] === "object" && node3.children[chi].type === "parenthesis") {
6571
6471
  [i2, prev2] = getNext(chi, -1);
6572
6472
  if (prev2 === null) continue;
6573
6473
  if (typeof prev2 !== "string" || ["switch", "catch", "try", "class"].find((x) => prev2.trim().endsWith(x)) !== void 0) continue;
@@ -6589,7 +6489,7 @@ function labelFunctions(node3, eols, blocks_info2) {
6589
6489
  }
6590
6490
  } else if (node3.children[chi] === "=>") {
6591
6491
  [i2, prev2] = getNext(chi, -1);
6592
- if (typeof prev2 === "object" && prev2.type === "paranthesis") {
6492
+ if (typeof prev2 === "object" && prev2.type === "parenthesis") {
6593
6493
  const begin = getRowCol(eols, prev2.begin);
6594
6494
  [i2, nxt] = getNext(chi);
6595
6495
  if (typeof nxt === "object" && nxt.type === "js") {
@@ -6643,7 +6543,7 @@ function getRowCol(eols, i2) {
6643
6543
  }
6644
6544
  return [eols.last - 1, i2 - eols[eols.last - 1]];
6645
6545
  }
6646
- function generateSourceMap(json, path2, jsx_eols, out_eols, mappings2 = []) {
6546
+ function generateSourceMap(json, path2, jsx_eols, out_eols, mappings = []) {
6647
6547
  let mpps = [];
6648
6548
  const sourcemap = {
6649
6549
  "version": 3,
@@ -6673,7 +6573,7 @@ function generateSourceMap(json, path2, jsx_eols, out_eols, mappings2 = []) {
6673
6573
  return a[0] - b2[0];
6674
6574
  }
6675
6575
  );
6676
- mappings2.push(...mpps);
6576
+ mappings.push(...mpps);
6677
6577
  let mstr = "";
6678
6578
  let r = 0, oc = 0;
6679
6579
  let lr = 0, lc = 0;
@@ -6707,7 +6607,7 @@ function transpileJSX(jsx2, {
6707
6607
  labels: {},
6708
6608
  counter: 0
6709
6609
  },
6710
- mappings: mappings2 = []
6610
+ mappings = []
6711
6611
  } = {}) {
6712
6612
  var _a, _b;
6713
6613
  (_a = transpilerConfig.preprocessorDelimiter) != null ? _a : transpilerConfig.preprocessorDelimiter = "\u0294";
@@ -6786,7 +6686,7 @@ function transpileJSX(jsx2, {
6786
6686
  if (node3.type === "regex") return jsx2.substring(node3.begin, node3.end);
6787
6687
  if (node3.type === "comment") return discardComments || is_attr ? "" : jsx2.substring(node3.begin, node3.end);
6788
6688
  if (node3.type === "directive") return node3.value;
6789
- if (node3.type === "paranthesis") {
6689
+ if (node3.type === "parenthesis") {
6790
6690
  let out2 = "(";
6791
6691
  if (node3.out) {
6792
6692
  if (produceCJS) processImportExports(node3, jsx2);
@@ -6859,7 +6759,7 @@ function transpileJSX(jsx2, {
6859
6759
  out += `}catch(e){ if(typeof(e)!=='object') e=new Error(e);e.lilact_trace=${blocks_info2.counter};throw e}`;
6860
6760
  }
6861
6761
  }
6862
- const inline_sm = generateSourceMap(json, path2, eols, scanEOLs(out), mappings2);
6762
+ const inline_sm = generateSourceMap(json, path2, eols, scanEOLs(out), mappings);
6863
6763
  if (appendSourcemap) {
6864
6764
  out += inline_sm;
6865
6765
  }
@@ -6868,7 +6768,7 @@ function transpileJSX(jsx2, {
6868
6768
 
6869
6769
  // .tmp/src/lilact.jsx
6870
6770
  var Lilact2 = {
6871
- VERSION: "RC.3",
6771
+ VERSION: "RC.4",
6872
6772
  // Configuration
6873
6773
  defaultTransitionTimeout: 300,
6874
6774
  defaultIsEqual: Object.is,
@@ -6905,7 +6805,10 @@ globalThis.createComponent = Lilact2.createComponent;
6905
6805
  globalThis.Fragment = Lilact2.Fragment;
6906
6806
  globalThis.require = Lilact2.require;
6907
6807
  document.addEventListener("DOMContentLoaded", () => {
6908
- Lilact2.runScripts();
6808
+ Lilact2.runScripts().catch((error2) => {
6809
+ var _a;
6810
+ (_a = Lilact2.globalErrorHandler) == null ? void 0 : _a.call(Lilact2, error2);
6811
+ });
6909
6812
  });
6910
6813
  if (true) {
6911
6814
  window.addEventListener("unhandledrejection", (e) => {
@@ -6999,7 +6902,6 @@ export {
6999
6902
  layout_effects,
7000
6903
  lazy,
7001
6904
  length_css_attributes_set,
7002
- mapLocation,
7003
6905
  memo,
7004
6906
  passive_effects,
7005
6907
  pauseTimers,