sibujs 4.5.0 → 4.7.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.
Files changed (116) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.cjs +326 -133
  3. package/dist/browser.d.cts +46 -14
  4. package/dist/browser.d.ts +46 -14
  5. package/dist/browser.js +8 -6
  6. package/dist/build.cjs +2094 -1033
  7. package/dist/build.d.cts +133 -44
  8. package/dist/build.d.ts +133 -44
  9. package/dist/build.js +1372 -574
  10. package/dist/cdn.dev.global.js +10 -10
  11. package/dist/cdn.full.dev.global.js +11 -11
  12. package/dist/cdn.full.global.js +10 -10
  13. package/dist/cdn.global.js +10 -10
  14. package/dist/{chunk-2DCGACUU.js → chunk-2BPG2XDA.js} +251 -66
  15. package/dist/{chunk-IXKSNWV5.js → chunk-2INLLLMZ.js} +1 -1
  16. package/dist/{chunk-4PMLNECI.js → chunk-3QWBSL5R.js} +98 -29
  17. package/dist/{chunk-KKLW7YWL.js → chunk-4AWA2PVD.js} +275 -144
  18. package/dist/chunk-5HZXGZ6T.js +24 -0
  19. package/dist/{chunk-PCT43HW3.js → chunk-7LUJQAOJ.js} +1 -1
  20. package/dist/{chunk-5DXA2J44.js → chunk-7XHATCIH.js} +5 -2
  21. package/dist/chunk-BC2SECJD.js +44 -0
  22. package/dist/{chunk-TBYTO6BS.js → chunk-BSY63EM6.js} +136 -80
  23. package/dist/{chunk-FTIR4QW2.js → chunk-DKXRACVN.js} +6 -8
  24. package/dist/{chunk-ONOHFDLG.js → chunk-FNJXNGYZ.js} +3 -3
  25. package/dist/{chunk-XZZOBQAY.js → chunk-FQRUXCEE.js} +6 -5
  26. package/dist/{chunk-NIOYEGBQ.js → chunk-HURREPU2.js} +27 -13
  27. package/dist/chunk-J6FW5TV6.js +233 -0
  28. package/dist/{chunk-UGRX3S57.js → chunk-JWKYU5GV.js} +22 -4
  29. package/dist/chunk-NYNYSPK7.js +318 -0
  30. package/dist/{chunk-RBTPLM32.js → chunk-RUSSKG6G.js} +13 -12
  31. package/dist/{chunk-7LN645I6.js → chunk-SLM3IA34.js} +3 -3
  32. package/dist/{chunk-R25EFXXC.js → chunk-TUCPL2HB.js} +3 -3
  33. package/dist/{chunk-B3WHI2QA.js → chunk-UNWRJRKC.js} +55 -31
  34. package/dist/{chunk-KEISJXBU.js → chunk-UOL2ECCS.js} +44 -17
  35. package/dist/{chunk-RJE2BNI4.js → chunk-VZSG24LS.js} +108 -45
  36. package/dist/{chunk-RIXRAYIU.js → chunk-WEQ3DMVL.js} +10 -4
  37. package/dist/{chunk-3JZ4L5TJ.js → chunk-WOLJZUFQ.js} +354 -90
  38. package/dist/{chunk-S373NSMK.js → chunk-XYV3EDB7.js} +283 -123
  39. package/dist/{chunk-VZKNK2V7.js → chunk-XZR4PXRE.js} +296 -38
  40. package/dist/{chunk-GW3SCCZG.js → chunk-Z3OHK6QT.js} +153 -110
  41. package/dist/{chunk-OMJJM3KM.js → chunk-ZVL7TY4K.js} +287 -130
  42. package/dist/{contracts-DBdg9J_a.d.ts → contracts-CLqzJnOV.d.ts} +36 -17
  43. package/dist/{contracts-DBdg9J_a.d.cts → contracts-CTOJXu-x.d.cts} +36 -17
  44. package/dist/{customElement-OB9CIsc5.d.cts → customElement-MmInOW1U.d.cts} +21 -0
  45. package/dist/{customElement-OB9CIsc5.d.ts → customElement-MmInOW1U.d.ts} +21 -0
  46. package/dist/data.cjs +410 -155
  47. package/dist/data.d.cts +166 -12
  48. package/dist/data.d.ts +166 -12
  49. package/dist/data.js +12 -9
  50. package/dist/devtools.cjs +98 -61
  51. package/dist/devtools.js +7 -8
  52. package/dist/dispose-GEIG2KOF.js +28 -0
  53. package/dist/ecosystem.cjs +372 -126
  54. package/dist/ecosystem.d.cts +20 -3
  55. package/dist/ecosystem.d.ts +20 -3
  56. package/dist/ecosystem.js +12 -12
  57. package/dist/extras.cjs +2366 -909
  58. package/dist/extras.d.cts +11 -9
  59. package/dist/extras.d.ts +11 -9
  60. package/dist/extras.js +39 -28
  61. package/dist/index.cjs +421 -158
  62. package/dist/index.d.cts +213 -171
  63. package/dist/index.d.ts +213 -171
  64. package/dist/index.js +24 -27
  65. package/dist/motion.cjs +118 -44
  66. package/dist/motion.js +5 -5
  67. package/dist/patterns.cjs +344 -53
  68. package/dist/patterns.d.cts +28 -9
  69. package/dist/patterns.d.ts +28 -9
  70. package/dist/patterns.js +8 -8
  71. package/dist/performance.cjs +325 -220
  72. package/dist/performance.d.cts +2 -2
  73. package/dist/performance.d.ts +2 -2
  74. package/dist/performance.js +8 -9
  75. package/dist/plugin-DVgSnTfK.d.cts +112 -0
  76. package/dist/plugin-DVgSnTfK.d.ts +112 -0
  77. package/dist/plugins.cjs +664 -233
  78. package/dist/plugins.d.cts +127 -14
  79. package/dist/plugins.d.ts +127 -14
  80. package/dist/plugins.js +96 -42
  81. package/dist/signal-EotCj4hS.d.cts +110 -0
  82. package/dist/signal-EotCj4hS.d.ts +110 -0
  83. package/dist/{ssr-BiPRdZ6n.d.cts → ssr-Bli9XRW5.d.cts} +5 -0
  84. package/dist/{ssr-BiPRdZ6n.d.ts → ssr-Bli9XRW5.d.ts} +5 -0
  85. package/dist/{ssr-Y7XOEPEN.js → ssr-XOTUASDO.js} +4 -5
  86. package/dist/ssr.cjs +229 -84
  87. package/dist/ssr.d.cts +9 -3
  88. package/dist/ssr.d.ts +9 -3
  89. package/dist/ssr.js +11 -12
  90. package/dist/{startup-BMpaiMhP.d.ts → startup-BLfSeL15.d.cts} +73 -22
  91. package/dist/{startup-BMpaiMhP.d.cts → startup-BLfSeL15.d.ts} +73 -22
  92. package/dist/tagFactory-8qL9LCIx.d.cts +156 -0
  93. package/dist/tagFactory-BL2fymez.d.ts +156 -0
  94. package/dist/testing.cjs +2503 -2191
  95. package/dist/testing.d.cts +56 -5
  96. package/dist/testing.d.ts +56 -5
  97. package/dist/testing.js +580 -307
  98. package/dist/types-CJFViL6Q.d.cts +26 -0
  99. package/dist/types-CJFViL6Q.d.ts +26 -0
  100. package/dist/ui.cjs +732 -329
  101. package/dist/ui.d.cts +41 -7
  102. package/dist/ui.d.ts +41 -7
  103. package/dist/ui.js +151 -56
  104. package/dist/widgets.cjs +267 -291
  105. package/dist/widgets.js +9 -10
  106. package/package.json +4 -2
  107. package/dist/chunk-2WLZ6757.js +0 -149
  108. package/dist/chunk-CCSJMTRN.js +0 -15
  109. package/dist/chunk-QKRPLZ2V.js +0 -108
  110. package/dist/chunk-VUF4ALSW.js +0 -60
  111. package/dist/chunk-WWV3SJ3L.js +0 -131
  112. package/dist/dispose-46BOMMQJ.js +0 -19
  113. package/dist/plugin-D30wlGW5.d.cts +0 -71
  114. package/dist/plugin-D30wlGW5.d.ts +0 -71
  115. package/dist/tagFactory-DVoDpHye.d.cts +0 -215
  116. package/dist/tagFactory-DVoDpHye.d.ts +0 -215
@@ -26,32 +26,45 @@ declare function createModuleRegistry(): {
26
26
  * Returns an object with only the requested exports.
27
27
  */
28
28
  declare function createBundle<T extends object>(modules: Record<string, () => unknown>): T;
29
+ /** Handle returned by {@link lazyModule}. */
30
+ interface LazyModule<T> {
31
+ /** Whether a load has completed successfully. Read-only. */
32
+ readonly loaded: boolean;
33
+ /** Load the module (once) and resolve to it. Concurrent calls share one load. */
34
+ get(): Promise<T>;
35
+ }
29
36
  /**
30
37
  * Lazy module loader that only imports a module when first accessed.
31
38
  * Uses ES module dynamic import under the hood.
32
39
  * Caches the result after the first successful load.
40
+ *
41
+ * Concurrent `get()` calls made before the first load settles share that one
42
+ * load. A failed load is not cached: the next `get()` retries.
33
43
  */
34
- declare function lazyModule<T>(loader: () => Promise<T>): {
35
- get: () => Promise<T>;
36
- loaded: boolean;
44
+ declare function lazyModule<T>(loader: () => Promise<T>): LazyModule<T>;
45
+ /** One `exports` entry: a module entry point, or a prebuilt CDN script. */
46
+ type PackageExportTarget = {
47
+ types: string;
48
+ import: string;
49
+ require: string;
50
+ } | {
51
+ default: string;
37
52
  };
38
53
  /**
39
54
  * Package metadata for distribution tooling.
40
- * Provides entry point information and can generate Node.js subpath exports maps.
55
+ * Provides entry point information and generates the Node.js subpath exports
56
+ * map that the published package actually uses.
41
57
  */
42
58
  declare const packageInfo: {
43
59
  name: string;
44
60
  version: string;
45
61
  entryPoints: Record<string, string>;
46
62
  /**
47
- * Generate a package.json `exports` map for Node.js subpath exports.
48
- * Maps each entry point to its import, require, and types paths.
63
+ * Generate the package.json `exports` map. Module entries resolve to the
64
+ * `.js` (ESM), `.cjs` and `.d.ts` files tsup emits into `dist/`; CDN entries
65
+ * resolve to their prebuilt global script.
49
66
  */
50
- generateExportsMap(): Record<string, {
51
- import: string;
52
- require: string;
53
- types: string;
54
- }>;
67
+ generateExportsMap(): Record<string, PackageExportTarget>;
55
68
  };
56
69
 
57
70
  /**
@@ -127,16 +140,14 @@ declare const env: {
127
140
  isTest: boolean;
128
141
  };
129
142
 
130
- /**
131
- * Versioning and migration utilities for SibuJS applications.
132
- * Provides semantic version management, migration tooling, and compatibility checks.
133
- */
134
143
  /** Semantic version representation */
135
144
  interface SemVer {
136
145
  major: number;
137
146
  minor: number;
138
147
  patch: number;
139
148
  prerelease?: string;
149
+ /** Build metadata (after `+`). Ignored when comparing versions. */
150
+ build?: string;
140
151
  }
141
152
  /** Migration definition */
142
153
  interface Migration {
@@ -146,11 +157,19 @@ interface Migration {
146
157
  down?: () => void | Promise<void>;
147
158
  }
148
159
  /**
149
- * Framework version constant.
160
+ * Framework version: the published package version, stamped at build time.
161
+ * Only raw, unbundled source reports "dev". (It was hard-coded to "1.0.0", so
162
+ * compatibility checks compared against a version the package never had.)
150
163
  */
151
- declare const VERSION = "1.0.0";
164
+ declare const VERSION: string;
152
165
  /**
153
166
  * Parse a semantic version string into components.
167
+ *
168
+ * Accepts full SemVer 2.0.0 (`1.2.3`, `1.2.3-beta.1`, `1.2.3+build.5`), an
169
+ * optional leading `v`, surrounding whitespace, and the abbreviated `1` and
170
+ * `1.2` forms. Anything else — trailing characters, extra components, empty or
171
+ * illegal identifiers, numeric leading zeros — throws. (`parseInt` used to accept
172
+ * numeric prefixes such as `1.2.3garbage` and ignore extra components.)
154
173
  */
155
174
  declare function parseSemVer(version: string): SemVer;
156
175
  /**
@@ -162,22 +181,46 @@ declare function compareSemVer(a: string | SemVer, b: string | SemVer): -1 | 0 |
162
181
  * Check if a version satisfies a semver range (supports ^, ~, >=, <=, =).
163
182
  */
164
183
  declare function satisfies(version: string, range: string): boolean;
184
+ /**
185
+ * A migration step succeeded but recording its version in storage failed.
186
+ *
187
+ * Reported separately from a failing `up()` / `down()` because the migration's
188
+ * own work DID happen: storage is now behind reality and needs attention, but
189
+ * the step itself must not be retried as if it had failed.
190
+ */
191
+ declare class MigrationStorageError extends Error {
192
+ /** The migration whose checkpoint could not be written. */
193
+ readonly version: string;
194
+ constructor(version: string, cause: unknown);
195
+ }
165
196
  /**
166
197
  * Create a migration runner for managing schema/state version upgrades.
198
+ *
199
+ * `migrate()` and `rollback()` are serialized across ALL runners in this realm
200
+ * that use the same storage object and storage key; runners with a different
201
+ * key (or storage) run independently. Coordination does not extend across
202
+ * tabs or workers.
167
203
  */
168
204
  declare function createMigrationRunner(config: {
169
205
  /** Current version of the app/data */
170
206
  currentVersion: string;
171
207
  /** Storage key for persisting applied migration version */
172
208
  storageKey?: string;
209
+ /** Storage holding the applied version (default: `localStorage`) */
210
+ storage?: Storage;
173
211
  /** Available migrations, sorted by version */
174
212
  migrations: Migration[];
175
213
  }): {
176
214
  /** Get the last applied migration version from storage */
177
- getAppliedVersion(): string | null;
215
+ getAppliedVersion: () => string | null;
178
216
  /** Get pending migrations that haven't been applied */
179
- getPending(): Migration[];
180
- /** Run all pending migrations in order */
217
+ getPending: () => Migration[];
218
+ /**
219
+ * Run all pending migrations in order. Concurrent calls (and calls racing
220
+ * `rollback()`) run one after another, each recomputing what is pending —
221
+ * on this runner and on every other runner in this realm sharing its
222
+ * storage and storage key.
223
+ */
181
224
  migrate(): Promise<{
182
225
  applied: string[];
183
226
  errors: Array<{
@@ -185,7 +228,15 @@ declare function createMigrationRunner(config: {
185
228
  error: Error;
186
229
  }>;
187
230
  }>;
188
- /** Rollback to a specific version */
231
+ /**
232
+ * Rollback to a specific version.
233
+ *
234
+ * The applied version is checkpointed after EVERY successful `down()`, so a
235
+ * rollback that fails part-way leaves storage describing what is actually
236
+ * still applied, and a retry does not repeat completed `down()` steps.
237
+ * Throws the failing `down()`'s error, a missing-`down()` error, or a
238
+ * {@link MigrationStorageError} if a checkpoint cannot be written.
239
+ */
189
240
  rollback(targetVersion: string): Promise<{
190
241
  rolledBack: string[];
191
242
  }>;
@@ -288,4 +339,4 @@ declare function createBootSequence(): {
288
339
  }>;
289
340
  };
290
341
 
291
- export { type Migration as M, type SemVer as S, VERSION as V, compareSemVer as a, bundlerMetadata as b, checkCompatibility as c, createBootSequence as d, createBundle as e, createMigrationRunner as f, createModuleRegistry as g, createSSRCache as h, createTestHarness as i, deferNonCritical as j, env as k, healthCheck as l, lazyModule as m, parseSemVer as n, preloadCritical as o, packageInfo as p, prerenderRoutes as q, satisfies as s };
342
+ export { type LazyModule as L, type Migration as M, type PackageExportTarget as P, type SemVer as S, VERSION as V, MigrationStorageError as a, bundlerMetadata as b, checkCompatibility as c, compareSemVer as d, createBootSequence as e, createBundle as f, createMigrationRunner as g, createModuleRegistry as h, createSSRCache as i, createTestHarness as j, deferNonCritical as k, env as l, healthCheck as m, lazyModule as n, parseSemVer as o, packageInfo as p, preloadCritical as q, prerenderRoutes as r, satisfies as s };
@@ -26,32 +26,45 @@ declare function createModuleRegistry(): {
26
26
  * Returns an object with only the requested exports.
27
27
  */
28
28
  declare function createBundle<T extends object>(modules: Record<string, () => unknown>): T;
29
+ /** Handle returned by {@link lazyModule}. */
30
+ interface LazyModule<T> {
31
+ /** Whether a load has completed successfully. Read-only. */
32
+ readonly loaded: boolean;
33
+ /** Load the module (once) and resolve to it. Concurrent calls share one load. */
34
+ get(): Promise<T>;
35
+ }
29
36
  /**
30
37
  * Lazy module loader that only imports a module when first accessed.
31
38
  * Uses ES module dynamic import under the hood.
32
39
  * Caches the result after the first successful load.
40
+ *
41
+ * Concurrent `get()` calls made before the first load settles share that one
42
+ * load. A failed load is not cached: the next `get()` retries.
33
43
  */
34
- declare function lazyModule<T>(loader: () => Promise<T>): {
35
- get: () => Promise<T>;
36
- loaded: boolean;
44
+ declare function lazyModule<T>(loader: () => Promise<T>): LazyModule<T>;
45
+ /** One `exports` entry: a module entry point, or a prebuilt CDN script. */
46
+ type PackageExportTarget = {
47
+ types: string;
48
+ import: string;
49
+ require: string;
50
+ } | {
51
+ default: string;
37
52
  };
38
53
  /**
39
54
  * Package metadata for distribution tooling.
40
- * Provides entry point information and can generate Node.js subpath exports maps.
55
+ * Provides entry point information and generates the Node.js subpath exports
56
+ * map that the published package actually uses.
41
57
  */
42
58
  declare const packageInfo: {
43
59
  name: string;
44
60
  version: string;
45
61
  entryPoints: Record<string, string>;
46
62
  /**
47
- * Generate a package.json `exports` map for Node.js subpath exports.
48
- * Maps each entry point to its import, require, and types paths.
63
+ * Generate the package.json `exports` map. Module entries resolve to the
64
+ * `.js` (ESM), `.cjs` and `.d.ts` files tsup emits into `dist/`; CDN entries
65
+ * resolve to their prebuilt global script.
49
66
  */
50
- generateExportsMap(): Record<string, {
51
- import: string;
52
- require: string;
53
- types: string;
54
- }>;
67
+ generateExportsMap(): Record<string, PackageExportTarget>;
55
68
  };
56
69
 
57
70
  /**
@@ -127,16 +140,14 @@ declare const env: {
127
140
  isTest: boolean;
128
141
  };
129
142
 
130
- /**
131
- * Versioning and migration utilities for SibuJS applications.
132
- * Provides semantic version management, migration tooling, and compatibility checks.
133
- */
134
143
  /** Semantic version representation */
135
144
  interface SemVer {
136
145
  major: number;
137
146
  minor: number;
138
147
  patch: number;
139
148
  prerelease?: string;
149
+ /** Build metadata (after `+`). Ignored when comparing versions. */
150
+ build?: string;
140
151
  }
141
152
  /** Migration definition */
142
153
  interface Migration {
@@ -146,11 +157,19 @@ interface Migration {
146
157
  down?: () => void | Promise<void>;
147
158
  }
148
159
  /**
149
- * Framework version constant.
160
+ * Framework version: the published package version, stamped at build time.
161
+ * Only raw, unbundled source reports "dev". (It was hard-coded to "1.0.0", so
162
+ * compatibility checks compared against a version the package never had.)
150
163
  */
151
- declare const VERSION = "1.0.0";
164
+ declare const VERSION: string;
152
165
  /**
153
166
  * Parse a semantic version string into components.
167
+ *
168
+ * Accepts full SemVer 2.0.0 (`1.2.3`, `1.2.3-beta.1`, `1.2.3+build.5`), an
169
+ * optional leading `v`, surrounding whitespace, and the abbreviated `1` and
170
+ * `1.2` forms. Anything else — trailing characters, extra components, empty or
171
+ * illegal identifiers, numeric leading zeros — throws. (`parseInt` used to accept
172
+ * numeric prefixes such as `1.2.3garbage` and ignore extra components.)
154
173
  */
155
174
  declare function parseSemVer(version: string): SemVer;
156
175
  /**
@@ -162,22 +181,46 @@ declare function compareSemVer(a: string | SemVer, b: string | SemVer): -1 | 0 |
162
181
  * Check if a version satisfies a semver range (supports ^, ~, >=, <=, =).
163
182
  */
164
183
  declare function satisfies(version: string, range: string): boolean;
184
+ /**
185
+ * A migration step succeeded but recording its version in storage failed.
186
+ *
187
+ * Reported separately from a failing `up()` / `down()` because the migration's
188
+ * own work DID happen: storage is now behind reality and needs attention, but
189
+ * the step itself must not be retried as if it had failed.
190
+ */
191
+ declare class MigrationStorageError extends Error {
192
+ /** The migration whose checkpoint could not be written. */
193
+ readonly version: string;
194
+ constructor(version: string, cause: unknown);
195
+ }
165
196
  /**
166
197
  * Create a migration runner for managing schema/state version upgrades.
198
+ *
199
+ * `migrate()` and `rollback()` are serialized across ALL runners in this realm
200
+ * that use the same storage object and storage key; runners with a different
201
+ * key (or storage) run independently. Coordination does not extend across
202
+ * tabs or workers.
167
203
  */
168
204
  declare function createMigrationRunner(config: {
169
205
  /** Current version of the app/data */
170
206
  currentVersion: string;
171
207
  /** Storage key for persisting applied migration version */
172
208
  storageKey?: string;
209
+ /** Storage holding the applied version (default: `localStorage`) */
210
+ storage?: Storage;
173
211
  /** Available migrations, sorted by version */
174
212
  migrations: Migration[];
175
213
  }): {
176
214
  /** Get the last applied migration version from storage */
177
- getAppliedVersion(): string | null;
215
+ getAppliedVersion: () => string | null;
178
216
  /** Get pending migrations that haven't been applied */
179
- getPending(): Migration[];
180
- /** Run all pending migrations in order */
217
+ getPending: () => Migration[];
218
+ /**
219
+ * Run all pending migrations in order. Concurrent calls (and calls racing
220
+ * `rollback()`) run one after another, each recomputing what is pending —
221
+ * on this runner and on every other runner in this realm sharing its
222
+ * storage and storage key.
223
+ */
181
224
  migrate(): Promise<{
182
225
  applied: string[];
183
226
  errors: Array<{
@@ -185,7 +228,15 @@ declare function createMigrationRunner(config: {
185
228
  error: Error;
186
229
  }>;
187
230
  }>;
188
- /** Rollback to a specific version */
231
+ /**
232
+ * Rollback to a specific version.
233
+ *
234
+ * The applied version is checkpointed after EVERY successful `down()`, so a
235
+ * rollback that fails part-way leaves storage describing what is actually
236
+ * still applied, and a retry does not repeat completed `down()` steps.
237
+ * Throws the failing `down()`'s error, a missing-`down()` error, or a
238
+ * {@link MigrationStorageError} if a checkpoint cannot be written.
239
+ */
189
240
  rollback(targetVersion: string): Promise<{
190
241
  rolledBack: string[];
191
242
  }>;
@@ -288,4 +339,4 @@ declare function createBootSequence(): {
288
339
  }>;
289
340
  };
290
341
 
291
- export { type Migration as M, type SemVer as S, VERSION as V, compareSemVer as a, bundlerMetadata as b, checkCompatibility as c, createBootSequence as d, createBundle as e, createMigrationRunner as f, createModuleRegistry as g, createSSRCache as h, createTestHarness as i, deferNonCritical as j, env as k, healthCheck as l, lazyModule as m, parseSemVer as n, preloadCritical as o, packageInfo as p, prerenderRoutes as q, satisfies as s };
342
+ export { type LazyModule as L, type Migration as M, type PackageExportTarget as P, type SemVer as S, VERSION as V, MigrationStorageError as a, bundlerMetadata as b, checkCompatibility as c, compareSemVer as d, createBootSequence as e, createBundle as f, createMigrationRunner as g, createModuleRegistry as h, createSSRCache as i, createTestHarness as j, deferNonCritical as k, env as l, healthCheck as m, lazyModule as n, parseSemVer as o, packageInfo as p, preloadCritical as q, prerenderRoutes as r, satisfies as s };
@@ -0,0 +1,156 @@
1
+ import { A as Accessor } from './signal-EotCj4hS.cjs';
2
+ import { N as NodeChildren } from './types-CJFViL6Q.cjs';
3
+
4
+ /**
5
+ * derived creates a derived reactive signal whose value updates when dependencies change.
6
+ *
7
+ * Uses lazy pull-based evaluation with a single dirty flag:
8
+ * - When a dependency changes, the computed is marked dirty (no re-evaluation).
9
+ * - Dirtiness propagates downstream via propagateDirty.
10
+ * - The getter only re-evaluates when actually read (pull-based).
11
+ * - On re-evaluation, dependencies are re-tracked via retrack() so that
12
+ * derived-of-derived chains propagate correctly without paying the full
13
+ * Set-delete + re-add cost of track()'s cleanup phase.
14
+ *
15
+ * STABILIZATION — why a dirty flag is enough:
16
+ *
17
+ * A dirty computed does NOT imply a changed value. Downstream effects are
18
+ * enqueued by `propagateDirty` at write time, before this computed has had a
19
+ * chance to recompute and compare. Rather than adding a three-color
20
+ * (CLEAN/CHECK/DIRTY) propagation pass — which an earlier revision measured as
21
+ * a regression on every benchmark, because the extra state has nothing to skip
22
+ * when values genuinely change — the engine settles the question lazily at
23
+ * DRAIN time: `cs._validate` recomputes a dirty computed and `cs.__v` is bumped
24
+ * ONLY when the new value differs under this computed's comparator. The
25
+ * scheduler compares that version against what each subscriber last observed
26
+ * and suppresses the run when nothing changed (see `depsChanged` in
27
+ * ../../reactivity/track-core.ts).
28
+ *
29
+ * That keeps the cheap boolean dirty flag AND makes `equals` actually stop
30
+ * propagation, with recomputation still fully lazy: `_validate` only ever runs
31
+ * when an effect is genuinely about to observe the value.
32
+ *
33
+ * DISPOSAL — a derived subscribes to its sources when it is created, and those
34
+ * edges live as long as the sources do. A derived created per mount (one per
35
+ * virtualized row, say) must be released when its owner goes away:
36
+ * `flag.dispose()`, or `onCleanup(flag.dispose, rowNode)` to tie it to a node.
37
+ * A disposed accessor is inert: it keeps returning the last value it settled,
38
+ * never recomputes, never re-subscribes, and never wakes downstream readers.
39
+ * Disposal is idempotent.
40
+ *
41
+ * ERRORS — a recomputation that throws is thrown to the next reader, in that
42
+ * reader's context: a binding reports it with its node (so the nearest
43
+ * `ErrorBoundary` can claim it), an effect reports it, a direct caller can catch
44
+ * it, and a derived reading another derived passes it on. A live derived stays
45
+ * dirty and recomputes on the following read; a derived that disposed itself
46
+ * during the failing run returns its frozen value afterwards.
47
+ *
48
+ * @returns An accessor for the computed value. It recomputes lazily on read
49
+ * after any dependency changes, and carries `dispose()` to release its source
50
+ * subscriptions.
51
+ */
52
+ declare function derived<T>(getter: () => T, options?: {
53
+ name?: string;
54
+ /** Custom equality — when the recomputed value equals the previous,
55
+ * downstream subscribers are not notified. Defaults to `Object.is`. */
56
+ equals?: (a: T, b: T) => boolean;
57
+ }): DerivedAccessor<T>;
58
+ /** Accessor returned by {@link derived}: read it like any getter, release it with `dispose()`. */
59
+ type DerivedAccessor<T> = Accessor<T> & {
60
+ /** Release every source subscription. The accessor then returns its last settled value. Idempotent. */
61
+ dispose: () => void;
62
+ };
63
+
64
+ declare const SVG_NS = "http://www.w3.org/2000/svg";
65
+ /**
66
+ * A style declaration map: camelCase or kebab-case property names to values.
67
+ * Each value may be a getter, which binds that one property reactively.
68
+ */
69
+ type StyleMap = Record<string, string | number | (() => string | number)>;
70
+ /**
71
+ * A style map produced by a whole-`style` getter. The getter already runs
72
+ * reactively, so its values are plain; a `null` / `undefined` value leaves the
73
+ * property unset (and removes it if an earlier run set it).
74
+ */
75
+ type StyleObject = Record<string, string | number | null | undefined>;
76
+ /**
77
+ * Listeners for the `on` prop. Known DOM event names get their specific event
78
+ * type from the DOM lib (`keydown` → `KeyboardEvent`, `click` → the lib's
79
+ * `MouseEvent` / `PointerEvent`), so a handler may declare it without a cast;
80
+ * any other name (custom events) receives an `Event`. That fallback is
81
+ * method-typed, so a handler declaring a narrower event
82
+ * (`(e: CustomEvent<Detail>) => …`) is still accepted for a custom name.
83
+ */
84
+ type TagEventHandlers = {
85
+ [K in keyof HTMLElementEventMap]?: (ev: HTMLElementEventMap[K]) => void;
86
+ } & {
87
+ [event: string]: {
88
+ handle(ev: Event): void;
89
+ }["handle"] | undefined;
90
+ };
91
+ /**
92
+ * Props accepted by a tag factory. `El` is the element the factory creates;
93
+ * it types `onElement`.
94
+ */
95
+ interface TagProps<El extends Element = HTMLElement> {
96
+ id?: string | (() => string);
97
+ class?: string | (() => string | null | undefined | false) | Record<string, boolean | (() => boolean)>;
98
+ style?: StyleMap | string | (() => string | StyleObject);
99
+ /**
100
+ * Receives the created element. Accepts what `ref()` returns under `strict`
101
+ * (`ref<HTMLInputElement>()` is a `Ref<HTMLInputElement | undefined>`) as
102
+ * well as a `{ current: Element | null }` box.
103
+ */
104
+ ref?: {
105
+ current: Element | null | undefined;
106
+ };
107
+ nodes?: NodeChildren;
108
+ on?: TagEventHandlers;
109
+ /** Called with the element after creation — useful for imperative bindings */
110
+ onElement?(el: El): void;
111
+ [attr: string]: unknown;
112
+ }
113
+ /**
114
+ * A tag factory: builds one `El` per call. See {@link tagFactory} for the
115
+ * accepted calling conventions.
116
+ */
117
+ type TagFunction<El extends Element, Props extends TagProps<El> = TagProps<El>> = (first?: Props | NodeChildren, second?: NodeChildren) => El;
118
+ /**
119
+ * Factory for creating HTML or SVG elements with reactive props and nodes.
120
+ *
121
+ * Calling conventions:
122
+ *
123
+ * tag() empty element
124
+ * tag("text") element with text content
125
+ * tag(42) element with numeric text content
126
+ * tag([childA, childB]) element with children (array)
127
+ * tag(node) element wrapping a single existing node
128
+ * tag(getter) element with a reactive child
129
+ * tag("className", children) positional: class + children
130
+ * tag({ ...props }) full props object (children via props.nodes)
131
+ * tag({ ...props }, children) props + children (no need for `nodes:` key!)
132
+ *
133
+ * The last form is the "deeply-nested shorthand" the codebase favours:
134
+ *
135
+ * div({ class: "card" }, [
136
+ * h1({ class: "title" }, "Hello"),
137
+ * p({ class: "body" }, "World"),
138
+ * div({ class: "row" }, [
139
+ * span({ id: "x" }, "child"),
140
+ * ]),
141
+ * ])
142
+ *
143
+ * `children` overrides `props.nodes` when both are present.
144
+ *
145
+ * The returned factory is typed by the tag: `tagFactory("div")` builds
146
+ * `HTMLDivElement`s, `tagFactory("circle", SVG_NS)` builds `SVGCircleElement`s.
147
+ * A tag name TypeScript does not know builds `HTMLElement`s (which is what
148
+ * `document.createElement` returns for it), or `Element`s in another namespace.
149
+ */
150
+ declare function tagFactory<K extends keyof HTMLElementTagNameMap>(tag: K, ns?: undefined): TagFunction<HTMLElementTagNameMap[K]>;
151
+ declare function tagFactory<K extends keyof SVGElementTagNameMap>(tag: K, ns: typeof SVG_NS): TagFunction<SVGElementTagNameMap[K]>;
152
+ declare function tagFactory(tag: string, ns?: undefined): TagFunction<HTMLElement>;
153
+ declare function tagFactory(tag: string, ns: typeof SVG_NS): TagFunction<SVGElement>;
154
+ declare function tagFactory(tag: string, ns?: string): TagFunction<Element>;
155
+
156
+ export { type DerivedAccessor as D, SVG_NS as S, type TagProps as T, type TagFunction as a, type StyleMap as b, type StyleObject as c, type TagEventHandlers as d, derived as e, tagFactory as t };
@@ -0,0 +1,156 @@
1
+ import { A as Accessor } from './signal-EotCj4hS.js';
2
+ import { N as NodeChildren } from './types-CJFViL6Q.js';
3
+
4
+ /**
5
+ * derived creates a derived reactive signal whose value updates when dependencies change.
6
+ *
7
+ * Uses lazy pull-based evaluation with a single dirty flag:
8
+ * - When a dependency changes, the computed is marked dirty (no re-evaluation).
9
+ * - Dirtiness propagates downstream via propagateDirty.
10
+ * - The getter only re-evaluates when actually read (pull-based).
11
+ * - On re-evaluation, dependencies are re-tracked via retrack() so that
12
+ * derived-of-derived chains propagate correctly without paying the full
13
+ * Set-delete + re-add cost of track()'s cleanup phase.
14
+ *
15
+ * STABILIZATION — why a dirty flag is enough:
16
+ *
17
+ * A dirty computed does NOT imply a changed value. Downstream effects are
18
+ * enqueued by `propagateDirty` at write time, before this computed has had a
19
+ * chance to recompute and compare. Rather than adding a three-color
20
+ * (CLEAN/CHECK/DIRTY) propagation pass — which an earlier revision measured as
21
+ * a regression on every benchmark, because the extra state has nothing to skip
22
+ * when values genuinely change — the engine settles the question lazily at
23
+ * DRAIN time: `cs._validate` recomputes a dirty computed and `cs.__v` is bumped
24
+ * ONLY when the new value differs under this computed's comparator. The
25
+ * scheduler compares that version against what each subscriber last observed
26
+ * and suppresses the run when nothing changed (see `depsChanged` in
27
+ * ../../reactivity/track-core.ts).
28
+ *
29
+ * That keeps the cheap boolean dirty flag AND makes `equals` actually stop
30
+ * propagation, with recomputation still fully lazy: `_validate` only ever runs
31
+ * when an effect is genuinely about to observe the value.
32
+ *
33
+ * DISPOSAL — a derived subscribes to its sources when it is created, and those
34
+ * edges live as long as the sources do. A derived created per mount (one per
35
+ * virtualized row, say) must be released when its owner goes away:
36
+ * `flag.dispose()`, or `onCleanup(flag.dispose, rowNode)` to tie it to a node.
37
+ * A disposed accessor is inert: it keeps returning the last value it settled,
38
+ * never recomputes, never re-subscribes, and never wakes downstream readers.
39
+ * Disposal is idempotent.
40
+ *
41
+ * ERRORS — a recomputation that throws is thrown to the next reader, in that
42
+ * reader's context: a binding reports it with its node (so the nearest
43
+ * `ErrorBoundary` can claim it), an effect reports it, a direct caller can catch
44
+ * it, and a derived reading another derived passes it on. A live derived stays
45
+ * dirty and recomputes on the following read; a derived that disposed itself
46
+ * during the failing run returns its frozen value afterwards.
47
+ *
48
+ * @returns An accessor for the computed value. It recomputes lazily on read
49
+ * after any dependency changes, and carries `dispose()` to release its source
50
+ * subscriptions.
51
+ */
52
+ declare function derived<T>(getter: () => T, options?: {
53
+ name?: string;
54
+ /** Custom equality — when the recomputed value equals the previous,
55
+ * downstream subscribers are not notified. Defaults to `Object.is`. */
56
+ equals?: (a: T, b: T) => boolean;
57
+ }): DerivedAccessor<T>;
58
+ /** Accessor returned by {@link derived}: read it like any getter, release it with `dispose()`. */
59
+ type DerivedAccessor<T> = Accessor<T> & {
60
+ /** Release every source subscription. The accessor then returns its last settled value. Idempotent. */
61
+ dispose: () => void;
62
+ };
63
+
64
+ declare const SVG_NS = "http://www.w3.org/2000/svg";
65
+ /**
66
+ * A style declaration map: camelCase or kebab-case property names to values.
67
+ * Each value may be a getter, which binds that one property reactively.
68
+ */
69
+ type StyleMap = Record<string, string | number | (() => string | number)>;
70
+ /**
71
+ * A style map produced by a whole-`style` getter. The getter already runs
72
+ * reactively, so its values are plain; a `null` / `undefined` value leaves the
73
+ * property unset (and removes it if an earlier run set it).
74
+ */
75
+ type StyleObject = Record<string, string | number | null | undefined>;
76
+ /**
77
+ * Listeners for the `on` prop. Known DOM event names get their specific event
78
+ * type from the DOM lib (`keydown` → `KeyboardEvent`, `click` → the lib's
79
+ * `MouseEvent` / `PointerEvent`), so a handler may declare it without a cast;
80
+ * any other name (custom events) receives an `Event`. That fallback is
81
+ * method-typed, so a handler declaring a narrower event
82
+ * (`(e: CustomEvent<Detail>) => …`) is still accepted for a custom name.
83
+ */
84
+ type TagEventHandlers = {
85
+ [K in keyof HTMLElementEventMap]?: (ev: HTMLElementEventMap[K]) => void;
86
+ } & {
87
+ [event: string]: {
88
+ handle(ev: Event): void;
89
+ }["handle"] | undefined;
90
+ };
91
+ /**
92
+ * Props accepted by a tag factory. `El` is the element the factory creates;
93
+ * it types `onElement`.
94
+ */
95
+ interface TagProps<El extends Element = HTMLElement> {
96
+ id?: string | (() => string);
97
+ class?: string | (() => string | null | undefined | false) | Record<string, boolean | (() => boolean)>;
98
+ style?: StyleMap | string | (() => string | StyleObject);
99
+ /**
100
+ * Receives the created element. Accepts what `ref()` returns under `strict`
101
+ * (`ref<HTMLInputElement>()` is a `Ref<HTMLInputElement | undefined>`) as
102
+ * well as a `{ current: Element | null }` box.
103
+ */
104
+ ref?: {
105
+ current: Element | null | undefined;
106
+ };
107
+ nodes?: NodeChildren;
108
+ on?: TagEventHandlers;
109
+ /** Called with the element after creation — useful for imperative bindings */
110
+ onElement?(el: El): void;
111
+ [attr: string]: unknown;
112
+ }
113
+ /**
114
+ * A tag factory: builds one `El` per call. See {@link tagFactory} for the
115
+ * accepted calling conventions.
116
+ */
117
+ type TagFunction<El extends Element, Props extends TagProps<El> = TagProps<El>> = (first?: Props | NodeChildren, second?: NodeChildren) => El;
118
+ /**
119
+ * Factory for creating HTML or SVG elements with reactive props and nodes.
120
+ *
121
+ * Calling conventions:
122
+ *
123
+ * tag() empty element
124
+ * tag("text") element with text content
125
+ * tag(42) element with numeric text content
126
+ * tag([childA, childB]) element with children (array)
127
+ * tag(node) element wrapping a single existing node
128
+ * tag(getter) element with a reactive child
129
+ * tag("className", children) positional: class + children
130
+ * tag({ ...props }) full props object (children via props.nodes)
131
+ * tag({ ...props }, children) props + children (no need for `nodes:` key!)
132
+ *
133
+ * The last form is the "deeply-nested shorthand" the codebase favours:
134
+ *
135
+ * div({ class: "card" }, [
136
+ * h1({ class: "title" }, "Hello"),
137
+ * p({ class: "body" }, "World"),
138
+ * div({ class: "row" }, [
139
+ * span({ id: "x" }, "child"),
140
+ * ]),
141
+ * ])
142
+ *
143
+ * `children` overrides `props.nodes` when both are present.
144
+ *
145
+ * The returned factory is typed by the tag: `tagFactory("div")` builds
146
+ * `HTMLDivElement`s, `tagFactory("circle", SVG_NS)` builds `SVGCircleElement`s.
147
+ * A tag name TypeScript does not know builds `HTMLElement`s (which is what
148
+ * `document.createElement` returns for it), or `Element`s in another namespace.
149
+ */
150
+ declare function tagFactory<K extends keyof HTMLElementTagNameMap>(tag: K, ns?: undefined): TagFunction<HTMLElementTagNameMap[K]>;
151
+ declare function tagFactory<K extends keyof SVGElementTagNameMap>(tag: K, ns: typeof SVG_NS): TagFunction<SVGElementTagNameMap[K]>;
152
+ declare function tagFactory(tag: string, ns?: undefined): TagFunction<HTMLElement>;
153
+ declare function tagFactory(tag: string, ns: typeof SVG_NS): TagFunction<SVGElement>;
154
+ declare function tagFactory(tag: string, ns?: string): TagFunction<Element>;
155
+
156
+ export { type DerivedAccessor as D, SVG_NS as S, type TagProps as T, type TagFunction as a, type StyleMap as b, type StyleObject as c, type TagEventHandlers as d, derived as e, tagFactory as t };