lilact 0.29.1 → 0.29.2

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.
@@ -3211,6 +3211,7 @@ var events_set = /* @__PURE__ */ new Set([
3211
3211
  "onsearch",
3212
3212
  "onselect",
3213
3213
  "onsubmit",
3214
+ "oncancel",
3214
3215
  "onkeydown",
3215
3216
  "onkeypress",
3216
3217
  "onkeyup",
@@ -3695,22 +3696,110 @@ function createModule(path2, {
3695
3696
  required_scripts[path2] = module2;
3696
3697
  return module2;
3697
3698
  }
3699
+ function loadModule(path2, options = {}) {
3700
+ if (lilact_default.importObjectPaths?.[path2]) {
3701
+ return lilact_default.importObjectPaths[path2];
3702
+ }
3703
+ if (options.requirer?.path) {
3704
+ path2 = joinPaths(options.requirer.path, path2);
3705
+ }
3706
+ const loadAsync = Boolean(lilact_default[LAZY]) || Boolean(options.isLazy);
3707
+ const module2 = getOrCreateModule(path2, {});
3708
+ if (module2.loaded && !options.forceReload) {
3709
+ return module2.exports;
3710
+ }
3711
+ if (path2.startsWith("#")) {
3712
+ const element = document.getElementById(path2.slice(1));
3713
+ if (!element) {
3714
+ throw report(
3715
+ new Error(`Required element not found (${path2})`),
3716
+ path2
3717
+ );
3718
+ }
3719
+ return run(
3720
+ element.textContent || "",
3721
+ path2,
3722
+ { forceReload: options.forceReload }
3723
+ );
3724
+ }
3725
+ if (loadAsync) {
3726
+ lilact_default[LAZY] = false;
3727
+ if (module2.request) {
3728
+ return module2.request;
3729
+ }
3730
+ return loadAsyncResource(path2, module2);
3731
+ }
3732
+ const resolved = lilact_default.resolver?.(path2);
3733
+ if (resolved != null) {
3734
+ if (path2.endsWith(".css")) {
3735
+ injectGlobal(String(resolved));
3736
+ module2.code = String(resolved);
3737
+ module2.loaded = true;
3738
+ return void 0;
3739
+ }
3740
+ return run(
3741
+ String(resolved),
3742
+ path2,
3743
+ { forceReload: options.forceReload }
3744
+ );
3745
+ }
3746
+ const request = new XMLHttpRequest();
3747
+ try {
3748
+ request.open("GET", path2, false);
3749
+ request.send(null);
3750
+ } catch (value) {
3751
+ throw report(value, path2);
3752
+ }
3753
+ if (request.status >= 200 && request.status < 300) {
3754
+ if (path2.endsWith(".css")) {
3755
+ module2.code = request.responseText;
3756
+ injectGlobal(module2.code);
3757
+ module2.loaded = true;
3758
+ return void 0;
3759
+ }
3760
+ return run(
3761
+ request.responseText,
3762
+ path2,
3763
+ { forceReload: true }
3764
+ );
3765
+ }
3766
+ throw report(
3767
+ new Error(
3768
+ `Unable to load ${path2}: HTTP ${request.status || 0}`
3769
+ ),
3770
+ path2
3771
+ );
3772
+ }
3773
+ function require2(path2) {
3774
+ let options = {};
3775
+ if (arguments.length === 2 && arguments[1] && typeof arguments[1] === "object") {
3776
+ options = arguments[1];
3777
+ }
3778
+ return loadModule(path2, options);
3779
+ }
3698
3780
  function makeImportsObject(mod) {
3699
- mod.importsObject ?? (mod.importsObject = {});
3781
+ mod.importsObject = {};
3700
3782
  for (const path2 in mod.meta.imports) {
3701
- let exps = required_scripts[path2];
3702
- let imps = mod.meta.imports[path2];
3703
- if (!exps) {
3704
- exps = lilact_default.require(path2, { requirer: mod });
3705
- }
3783
+ const imps = mod.meta.imports[path2];
3784
+ const exps = loadModule(path2, {
3785
+ requirer: mod
3786
+ });
3706
3787
  for (const i2 in imps.named_imports) {
3707
3788
  if (i2 === "") continue;
3708
- const j = imps.named_imports[i2];
3709
- if (!exps.hasOwnProperty(j)) throw new Error(`Imported module does not export any "${i2}".`);
3710
- mod.importsObject[i2] = exps[j];
3789
+ const exportedName = imps.named_imports[i2];
3790
+ if (!Object.prototype.hasOwnProperty.call(exps, exportedName)) {
3791
+ throw new Error(
3792
+ `Imported module does not export any "${i2}".`
3793
+ );
3794
+ }
3795
+ mod.importsObject[i2] = exps[exportedName];
3711
3796
  }
3712
3797
  for (const i2 of imps.import_defaults) {
3713
- if (!exps.hasOwnProperty("default")) throw new Error(`Imported module does not export a default.`);
3798
+ if (!Object.prototype.hasOwnProperty.call(exps, "default")) {
3799
+ throw new Error(
3800
+ `Imported module does not export a default.`
3801
+ );
3802
+ }
3714
3803
  mod.importsObject[i2] = exps.default;
3715
3804
  }
3716
3805
  for (const i2 of imps.import_stars) {
@@ -3824,72 +3913,6 @@ function loadAsyncResource(path2, module2) {
3824
3913
  module2.request = request;
3825
3914
  return request;
3826
3915
  }
3827
- function require2(path2) {
3828
- let options = {};
3829
- if (arguments.length === 2 && arguments[1] && typeof arguments[1] === "object") {
3830
- options = arguments[1];
3831
- }
3832
- if (lilact_default.importObjectPaths?.[path2]) {
3833
- return lilact_default.importObjectPaths[path2];
3834
- }
3835
- if (options?.requirer?.path) {
3836
- path2 = joinPaths(options.requirer.path, path2);
3837
- }
3838
- const loadAsync = Boolean(lilact_default[LAZY]) || Boolean(options.isLazy);
3839
- const module2 = getOrCreateModule(path2, {});
3840
- if (module2.loaded && !options.forceReload) {
3841
- return module2.exports;
3842
- }
3843
- if (path2.startsWith("#")) {
3844
- const element = document.getElementById(path2.slice(1));
3845
- if (!element) {
3846
- throw report(
3847
- new Error(`Required element not found (${path2})`),
3848
- path2
3849
- );
3850
- }
3851
- return run(element.textContent || "", path2, { forceReload: options.forceReload });
3852
- }
3853
- if (loadAsync) {
3854
- lilact_default[LAZY] = false;
3855
- if (module2.request) {
3856
- return module2.request;
3857
- }
3858
- return loadAsyncResource(path2, module2);
3859
- }
3860
- const resolved = lilact_default.resolver?.(path2);
3861
- if (resolved != null) {
3862
- if (path2.endsWith(".css")) {
3863
- injectGlobal(String(resolved));
3864
- module2.code = String(resolved);
3865
- module2.loaded = true;
3866
- return void 0;
3867
- }
3868
- return run(String(resolved), path2, { forceReload: options.forceReload });
3869
- }
3870
- const request = new XMLHttpRequest();
3871
- try {
3872
- request.open("GET", path2, false);
3873
- request.send(null);
3874
- } catch (value) {
3875
- throw report(value, path2);
3876
- }
3877
- if (request.status >= 200 && request.status < 300) {
3878
- if (path2.endsWith(".css")) {
3879
- module2.code = request.responseText;
3880
- injectGlobal(module2.code);
3881
- module2.loaded = true;
3882
- return void 0;
3883
- }
3884
- return run(request.responseText, path2, { forceReload: true });
3885
- }
3886
- throw report(
3887
- new Error(
3888
- `Unable to load ${path2}: HTTP ${request.status || 0}`
3889
- ),
3890
- path2
3891
- );
3892
- }
3893
3916
  function lazy(factory) {
3894
3917
  let status = "pending";
3895
3918
  let result2;