@torpor/view 1.2.6 → 1.3.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 (38) hide show
  1. package/dist/{Effect-DazmAdyC.d.mts → Effect-99HYQdzZ.d.mts} +50 -33
  2. package/dist/Effect-99HYQdzZ.d.mts.map +1 -0
  3. package/dist/{Effect-Dewn7MLc.d.cts → Effect-Bf8fz_zC.d.cts} +50 -33
  4. package/dist/Effect-Bf8fz_zC.d.cts.map +1 -0
  5. package/dist/compile.cjs +1498 -101
  6. package/dist/compile.d.cts +268 -1
  7. package/dist/compile.d.cts.map +1 -1
  8. package/dist/compile.d.mts +268 -1
  9. package/dist/compile.d.mts.map +1 -1
  10. package/dist/compile.mjs +1495 -102
  11. package/dist/compile.mjs.map +1 -1
  12. package/dist/dev.d.cts +1 -1
  13. package/dist/dev.d.mts +1 -1
  14. package/dist/{fromWebSocket-DrN-IduP.cjs → fromWebSocket-Cdoghvmh.cjs} +15 -0
  15. package/dist/{fromWebSocket-CFGoMkV2.mjs → fromWebSocket-ERhd9KZR.mjs} +11 -2
  16. package/dist/fromWebSocket-ERhd9KZR.mjs.map +1 -0
  17. package/dist/index.cjs +121 -75
  18. package/dist/index.d.cts +12 -6
  19. package/dist/index.d.cts.map +1 -1
  20. package/dist/index.d.mts +12 -6
  21. package/dist/index.d.mts.map +1 -1
  22. package/dist/index.mjs +121 -75
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/runtime.iife.js +1 -0
  25. package/dist/slotAutoClose-BbKfzpkz.cjs +177 -0
  26. package/dist/slotAutoClose-CgDkf8fM.mjs +156 -0
  27. package/dist/slotAutoClose-CgDkf8fM.mjs.map +1 -0
  28. package/dist/ssr.cjs +29 -1
  29. package/dist/ssr.d.cts +32 -1
  30. package/dist/ssr.d.cts.map +1 -1
  31. package/dist/ssr.d.mts +32 -1
  32. package/dist/ssr.d.mts.map +1 -1
  33. package/dist/ssr.mjs +25 -2
  34. package/dist/ssr.mjs.map +1 -1
  35. package/package.json +8 -5
  36. package/dist/Effect-DazmAdyC.d.mts.map +0 -1
  37. package/dist/Effect-Dewn7MLc.d.cts.map +0 -1
  38. package/dist/fromWebSocket-CFGoMkV2.mjs.map +0 -1
@@ -1,4 +1,26 @@
1
1
  import { t as Cleanup } from "./Cleanup-D0wvGW5d.mjs";
2
+ //#region src/types/AsyncSettle.d.ts
3
+ /**
4
+ * The result of an `$async` computed's most recent generation-guarded settle —
5
+ * written exactly once per settled generation by the `.then` handlers in
6
+ * `$async` (and by hydration seeding), so it always reflects the last SETTLED
7
+ * run, never a superseded run's in-flight promise.
8
+ *
9
+ * `undefined` until the first settle. This one field replaces the three
10
+ * correlated fields it was previously spread across (`hasResolved` ⇔
11
+ * `settle !== undefined`; `lastErrored` ⇔ `settle?.ok === false`;
12
+ * `staleValue` ⇔ `settle.ok ? settle.value : undefined`), making impossible
13
+ * combinations (resolved but never settled, errored with a retained stale
14
+ * value) unrepresentable.
15
+ */
16
+ type AsyncSettle = {
17
+ ok: true;
18
+ value: any;
19
+ } | {
20
+ ok: false;
21
+ error: any;
22
+ };
23
+ //#endregion
2
24
  //#region src/types/constants.d.ts
3
25
  /**
4
26
  * The type of a Signal object.
@@ -150,21 +172,29 @@ interface Computed<T = any> {
150
172
  */
151
173
  generation: number;
152
174
  /**
153
- * True once an `$async` computed's promise has resolved or rejected at
154
- * least once. Used by `$pending` to distinguish a first load (never
155
- * resolved) from a refresh. Monotonic — once true it stays true across
156
- * subsequent re-suspends. Unused by plain `$cache` computeds.
157
- */
158
- hasResolved: boolean;
159
- /**
160
- * True when the last settled result of an `$async` computed was a
161
- * rejection. Set by the `.then` reject handler, cleared by the resolve
162
- * handler, which also clears `staleValue` — a retry-after-error
163
- * re-suspend must not hand the previous error to readers as "stale
164
- * content" (it renders as a raw value, bypassing the error boundary).
165
- * Unused by plain `$cache` computeds.
175
+ * The result of the most recent generation-guarded settle of an `$async`
176
+ * computed: `{ ok: true, value }` on resolve, `{ ok: false, error }` on
177
+ * rejection — or `undefined` until the first settle. Read side:
178
+ * - `settle !== undefined` ⇔ "has resolved before" — used by `$async` to
179
+ * capture `suspendQuiet`, and by the proxy get trap to distinguish a
180
+ * first load (throw `AwaitSuspend`) from a refresh (stale-while-
181
+ * revalidate). Monotonic — once set it stays set across subsequent
182
+ * re-suspends.
183
+ * - `settle.ok` ⇔ the last settle resolved. On `false`, a retry-after-
184
+ * error re-suspend must not hand the previous error to readers as
185
+ * "stale content" (it renders as a raw value, bypassing the error
186
+ * boundary).
187
+ * - `settle.value` on `ok === true` is the previously resolved value,
188
+ * retained across a refresh suspend for stale-while-revalidate
189
+ * (ASYNC.md → "Stale-while-revalidate") — read by `suspendRead` so
190
+ * readers keep displaying the old value instead of a placeholder while
191
+ * the new promise is in flight.
192
+ *
193
+ * Written only by `$async`'s settle handlers (and hydration seeding), so
194
+ * it is generation-safe by construction. Unused by plain `$cache`
195
+ * computeds (always `undefined`).
166
196
  */
167
- lastErrored: boolean;
197
+ settle: AsyncSettle | undefined;
168
198
  /**
169
199
  * True when the current suspend is a "bare refresh" — a re-fetch with no
170
200
  * tracked dependency change, i.e. a silent `$refresh(fn, { silent: true })`
@@ -173,26 +203,13 @@ interface Computed<T = any> {
173
203
  * matching Solid's stale-while-revalidate default.
174
204
  *
175
205
  * Captured at suspend time inside `$async`'s run: a suspend is quiet iff
176
- * the computed has resolved before (`hasResolved`) AND the run was NOT
177
- * source-driven (`recalc === false`, i.e. not triggered by `checkComputed`
178
- * and not a loud `$refresh`). First loads are always loud (`hasResolved`
179
- * is false); dependency-change refreshes and loud `$refresh` calls are
180
- * always loud (`recalc` is true).
206
+ * the computed has settled before (`settle !== undefined`) AND the run was
207
+ * NOT source-driven (`recalc === false`, i.e. not triggered by
208
+ * `checkComputed` and not a loud `$refresh`). First loads are always loud
209
+ * (`settle` is undefined); dependency-change refreshes and loud `$refresh`
210
+ * calls are always loud (`recalc` is true).
181
211
  */
182
212
  suspendQuiet: boolean;
183
- /**
184
- * The previously resolved value, retained across a refresh suspend for
185
- * stale-while-revalidate (ASYNC.md → "Stale-while-revalidate"). Maintained by `$async`'s
186
- * generation-guarded settle handlers — set on resolve, cleared on
187
- * rejection — so it always holds the last RESOLVED value, never a
188
- * superseded run's in-flight promise (rapid prop changes would otherwise
189
- * render "[object Promise]"). Read by `suspendRead` so readers keep
190
- * displaying the old value instead of a placeholder while the new promise
191
- * is in flight. `undefined` on first load (never resolved) and for plain
192
- * `$cache` computeds (which never suspend, so `suspendRead` is never
193
- * reached for them).
194
- */
195
- staleValue: any;
196
213
  /**
197
214
  * A subscription to roll back to when recursively updating signal targets.
198
215
  */
@@ -378,4 +395,4 @@ interface Effect {
378
395
  }
379
396
  //#endregion
380
397
  export { ProxySignal as i, Region as n, Computed as r, Effect as t };
381
- //# sourceMappingURL=Effect-DazmAdyC.d.mts.map
398
+ //# sourceMappingURL=Effect-99HYQdzZ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Effect-99HYQdzZ.d.mts","names":[],"sources":["../src/types/AsyncSettle.ts","../src/types/constants.ts","../src/types/ProxySignal.ts","../src/types/Subscription.ts","../src/types/Computed.ts","../src/types/ErrorBoundary.ts","../src/types/Region.ts","../src/types/Effect.ts"],"mappings":";;;;;;;;;;;;;;;KAaK;EAAgB;EAAU;;EAAiB;EAAW;;;;;;;cCV9C;;;;cAKA;;;;cAKA;;;;;;;UCNY;;;;EAIxB,aAAa;;;;EAKb,aAAa;;;;EAKb,oBAAoB;;;;EAKpB;;;;;;;;UClBwB;;;;EAIxB,QAAQ,cAAc;;;;EAKtB,QAAQ,WAAW;;;;;EAMnB,YAAY;;;;;EAMZ,YAAY;;;;;;;EAQZ,gBAAgB;;;;;;EAOhB;;;;;EAMA;;;;EAKA;;;;;;;;;UC9CwB,SAAS;;;;EAIjC,aAAa;;;;;;;;EASb;;;;EAKA,OAAO;;;;EAKP,WAAW;;;;EAKX,aAAa;;;;EAKb,aAAa;;;;;;;EAQb;;;;EAKA;;;;EAKA;;;;;;;EAQA;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,QAAQ;;;;;;;;;;;;;;;EAgBR;;;;EAKA,UAAU;;;;EAKV;;;;;;;;;;UCrHwB;;;;;;EAMxB;;;;;EAMA;;;;;EAMA,QAAQ;;;;;;;;;EAUR,cAAc,cAAc;;;;UCnCJ;EACxB,WAAW;EACX,SAAS;EAET,gBAAgB;EAChB,YAAY;EACZ;;;;;EAMA,YAAY,IAAI;;;;EAKhB;;;;EAKA,SAAS;;;;;;;EAQT,gBAAgB;;;;;;;EAQhB;;;;;;EAOA;;;;;;;UCtCwB;;;;EAIxB,aAAa;;;;;EAMb,WAAW;;;;EAKX,SAAS;;;;EAKT,aAAa;EAKb,YAAY;;;;EAKZ;;;;;;EAOA;;;;EAKA;;;;;;;EAQA;;;;;;;;;;EAWA,iBAAiB,IAAI;;;;EAKrB;;;;;;EAOA,SAAS;;;;;;EAOT,gBAAgB,cAAc;;;;;;;;;EAU9B;;;;;;;;;;;;;;;;EAiBA"}
@@ -1,4 +1,26 @@
1
1
  import { t as Cleanup } from "./Cleanup-D0wvGW5d.cjs";
2
+ //#region src/types/AsyncSettle.d.ts
3
+ /**
4
+ * The result of an `$async` computed's most recent generation-guarded settle —
5
+ * written exactly once per settled generation by the `.then` handlers in
6
+ * `$async` (and by hydration seeding), so it always reflects the last SETTLED
7
+ * run, never a superseded run's in-flight promise.
8
+ *
9
+ * `undefined` until the first settle. This one field replaces the three
10
+ * correlated fields it was previously spread across (`hasResolved` ⇔
11
+ * `settle !== undefined`; `lastErrored` ⇔ `settle?.ok === false`;
12
+ * `staleValue` ⇔ `settle.ok ? settle.value : undefined`), making impossible
13
+ * combinations (resolved but never settled, errored with a retained stale
14
+ * value) unrepresentable.
15
+ */
16
+ type AsyncSettle = {
17
+ ok: true;
18
+ value: any;
19
+ } | {
20
+ ok: false;
21
+ error: any;
22
+ };
23
+ //#endregion
2
24
  //#region src/types/constants.d.ts
3
25
  /**
4
26
  * The type of a Signal object.
@@ -150,21 +172,29 @@ interface Computed<T = any> {
150
172
  */
151
173
  generation: number;
152
174
  /**
153
- * True once an `$async` computed's promise has resolved or rejected at
154
- * least once. Used by `$pending` to distinguish a first load (never
155
- * resolved) from a refresh. Monotonic — once true it stays true across
156
- * subsequent re-suspends. Unused by plain `$cache` computeds.
157
- */
158
- hasResolved: boolean;
159
- /**
160
- * True when the last settled result of an `$async` computed was a
161
- * rejection. Set by the `.then` reject handler, cleared by the resolve
162
- * handler, which also clears `staleValue` — a retry-after-error
163
- * re-suspend must not hand the previous error to readers as "stale
164
- * content" (it renders as a raw value, bypassing the error boundary).
165
- * Unused by plain `$cache` computeds.
175
+ * The result of the most recent generation-guarded settle of an `$async`
176
+ * computed: `{ ok: true, value }` on resolve, `{ ok: false, error }` on
177
+ * rejection — or `undefined` until the first settle. Read side:
178
+ * - `settle !== undefined` ⇔ "has resolved before" — used by `$async` to
179
+ * capture `suspendQuiet`, and by the proxy get trap to distinguish a
180
+ * first load (throw `AwaitSuspend`) from a refresh (stale-while-
181
+ * revalidate). Monotonic — once set it stays set across subsequent
182
+ * re-suspends.
183
+ * - `settle.ok` ⇔ the last settle resolved. On `false`, a retry-after-
184
+ * error re-suspend must not hand the previous error to readers as
185
+ * "stale content" (it renders as a raw value, bypassing the error
186
+ * boundary).
187
+ * - `settle.value` on `ok === true` is the previously resolved value,
188
+ * retained across a refresh suspend for stale-while-revalidate
189
+ * (ASYNC.md → "Stale-while-revalidate") — read by `suspendRead` so
190
+ * readers keep displaying the old value instead of a placeholder while
191
+ * the new promise is in flight.
192
+ *
193
+ * Written only by `$async`'s settle handlers (and hydration seeding), so
194
+ * it is generation-safe by construction. Unused by plain `$cache`
195
+ * computeds (always `undefined`).
166
196
  */
167
- lastErrored: boolean;
197
+ settle: AsyncSettle | undefined;
168
198
  /**
169
199
  * True when the current suspend is a "bare refresh" — a re-fetch with no
170
200
  * tracked dependency change, i.e. a silent `$refresh(fn, { silent: true })`
@@ -173,26 +203,13 @@ interface Computed<T = any> {
173
203
  * matching Solid's stale-while-revalidate default.
174
204
  *
175
205
  * Captured at suspend time inside `$async`'s run: a suspend is quiet iff
176
- * the computed has resolved before (`hasResolved`) AND the run was NOT
177
- * source-driven (`recalc === false`, i.e. not triggered by `checkComputed`
178
- * and not a loud `$refresh`). First loads are always loud (`hasResolved`
179
- * is false); dependency-change refreshes and loud `$refresh` calls are
180
- * always loud (`recalc` is true).
206
+ * the computed has settled before (`settle !== undefined`) AND the run was
207
+ * NOT source-driven (`recalc === false`, i.e. not triggered by
208
+ * `checkComputed` and not a loud `$refresh`). First loads are always loud
209
+ * (`settle` is undefined); dependency-change refreshes and loud `$refresh`
210
+ * calls are always loud (`recalc` is true).
181
211
  */
182
212
  suspendQuiet: boolean;
183
- /**
184
- * The previously resolved value, retained across a refresh suspend for
185
- * stale-while-revalidate (ASYNC.md → "Stale-while-revalidate"). Maintained by `$async`'s
186
- * generation-guarded settle handlers — set on resolve, cleared on
187
- * rejection — so it always holds the last RESOLVED value, never a
188
- * superseded run's in-flight promise (rapid prop changes would otherwise
189
- * render "[object Promise]"). Read by `suspendRead` so readers keep
190
- * displaying the old value instead of a placeholder while the new promise
191
- * is in flight. `undefined` on first load (never resolved) and for plain
192
- * `$cache` computeds (which never suspend, so `suspendRead` is never
193
- * reached for them).
194
- */
195
- staleValue: any;
196
213
  /**
197
214
  * A subscription to roll back to when recursively updating signal targets.
198
215
  */
@@ -378,4 +395,4 @@ interface Effect {
378
395
  }
379
396
  //#endregion
380
397
  export { ProxySignal as i, Region as n, Computed as r, Effect as t };
381
- //# sourceMappingURL=Effect-Dewn7MLc.d.cts.map
398
+ //# sourceMappingURL=Effect-Bf8fz_zC.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Effect-Bf8fz_zC.d.cts","names":[],"sources":["../src/types/AsyncSettle.ts","../src/types/constants.ts","../src/types/ProxySignal.ts","../src/types/Subscription.ts","../src/types/Computed.ts","../src/types/ErrorBoundary.ts","../src/types/Region.ts","../src/types/Effect.ts"],"mappings":";;;;;;;;;;;;;;;KAaK;EAAgB;EAAU;;EAAiB;EAAW;;;;;;;cCV9C;;;;cAKA;;;;cAKA;;;;;;;UCNY;;;;EAIxB,aAAa;;;;EAKb,aAAa;;;;EAKb,oBAAoB;;;;EAKpB;;;;;;;;UClBwB;;;;EAIxB,QAAQ,cAAc;;;;EAKtB,QAAQ,WAAW;;;;;EAMnB,YAAY;;;;;EAMZ,YAAY;;;;;;;EAQZ,gBAAgB;;;;;;EAOhB;;;;;EAMA;;;;EAKA;;;;;;;;;UC9CwB,SAAS;;;;EAIjC,aAAa;;;;;;;;EASb;;;;EAKA,OAAO;;;;EAKP,WAAW;;;;EAKX,aAAa;;;;EAKb,aAAa;;;;;;;EAQb;;;;EAKA;;;;EAKA;;;;;;;EAQA;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,QAAQ;;;;;;;;;;;;;;;EAgBR;;;;EAKA,UAAU;;;;EAKV;;;;;;;;;;UCrHwB;;;;;;EAMxB;;;;;EAMA;;;;;EAMA,QAAQ;;;;;;;;;EAUR,cAAc,cAAc;;;;UCnCJ;EACxB,WAAW;EACX,SAAS;EAET,gBAAgB;EAChB,YAAY;EACZ;;;;;EAMA,YAAY,IAAI;;;;EAKhB;;;;EAKA,SAAS;;;;;;;EAQT,gBAAgB;;;;;;;EAQhB;;;;;;EAOA;;;;;;;UCtCwB;;;;EAIxB,aAAa;;;;;EAMb,WAAW;;;;EAKX,SAAS;;;;EAKT,aAAa;EAKb,YAAY;;;;EAKZ;;;;;;EAOA;;;;EAKA;;;;;;;EAQA;;;;;;;;;;EAWA,iBAAiB,IAAI;;;;EAKrB;;;;;;EAOA,SAAS;;;;;;EAOT,gBAAgB,cAAc;;;;;;;;;EAU9B;;;;;;;;;;;;;;;;EAiBA"}