@torpor/view 1.3.3 → 1.4.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 (60) hide show
  1. package/dist/{Effect-Bp-BIDDm.d.cts → Effect-Bi_nt6cx.d.cts} +16 -3
  2. package/dist/Effect-Bi_nt6cx.d.cts.map +1 -0
  3. package/dist/{Effect-VsIY2vPx.d.mts → Effect-Bi_nt6cx.d.mts} +16 -3
  4. package/dist/Effect-Bi_nt6cx.d.mts.map +1 -0
  5. package/dist/ListItemSpec-DFkYr2TE.d.cts +28 -0
  6. package/dist/ListItemSpec-DFkYr2TE.d.cts.map +1 -0
  7. package/dist/ListItemSpec-DFkYr2TE.d.mts +28 -0
  8. package/dist/ListItemSpec-DFkYr2TE.d.mts.map +1 -0
  9. package/dist/{AsyncOptions-BDtArmeL.d.mts → WatchOptions--xq-Gn4e.d.cts} +77 -4
  10. package/dist/WatchOptions--xq-Gn4e.d.cts.map +1 -0
  11. package/dist/{AsyncOptions-C_7mWR6F.d.cts → WatchOptions-DWF4EqB6.d.mts} +77 -4
  12. package/dist/WatchOptions-DWF4EqB6.d.mts.map +1 -0
  13. package/dist/compile.cjs +1299 -401
  14. package/dist/compile.d.cts +16 -12
  15. package/dist/compile.d.cts.map +1 -1
  16. package/dist/compile.d.mts +16 -12
  17. package/dist/compile.d.mts.map +1 -1
  18. package/dist/compile.mjs +1299 -401
  19. package/dist/compile.mjs.map +1 -1
  20. package/dist/dev.cjs +101 -51
  21. package/dist/dev.d.cts +33 -2
  22. package/dist/dev.d.cts.map +1 -1
  23. package/dist/dev.d.mts +33 -2
  24. package/dist/dev.d.mts.map +1 -1
  25. package/dist/dev.mjs +51 -2
  26. package/dist/dev.mjs.map +1 -1
  27. package/dist/{fromWebSocket-ERhd9KZR.mjs → fromWebSocket-B22DIys7.mjs} +11 -2
  28. package/dist/fromWebSocket-B22DIys7.mjs.map +1 -0
  29. package/dist/{fromWebSocket-Cdoghvmh.cjs → fromWebSocket-C56rkQpZ.cjs} +15 -0
  30. package/dist/index.cjs +605 -266
  31. package/dist/index.d.cts +36 -129
  32. package/dist/index.d.cts.map +1 -1
  33. package/dist/index.d.mts +36 -129
  34. package/dist/index.d.mts.map +1 -1
  35. package/dist/index.mjs +593 -255
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/runtime.iife.js +1 -1
  38. package/dist/ssr.cjs +122 -22
  39. package/dist/ssr.d.cts +46 -12
  40. package/dist/ssr.d.cts.map +1 -1
  41. package/dist/ssr.d.mts +46 -12
  42. package/dist/ssr.d.mts.map +1 -1
  43. package/dist/ssr.mjs +121 -23
  44. package/dist/ssr.mjs.map +1 -1
  45. package/dist/titleWarning-BMjLAXpn.mjs +72 -0
  46. package/dist/titleWarning-BMjLAXpn.mjs.map +1 -0
  47. package/dist/titleWarning-DXp4fK7q.cjs +87 -0
  48. package/package.json +2 -1
  49. package/dist/AsyncOptions-BDtArmeL.d.mts.map +0 -1
  50. package/dist/AsyncOptions-C_7mWR6F.d.cts.map +0 -1
  51. package/dist/Cleanup-D0wvGW5d.d.cts +0 -9
  52. package/dist/Cleanup-D0wvGW5d.d.cts.map +0 -1
  53. package/dist/Cleanup-D0wvGW5d.d.mts +0 -9
  54. package/dist/Cleanup-D0wvGW5d.d.mts.map +0 -1
  55. package/dist/Effect-Bp-BIDDm.d.cts.map +0 -1
  56. package/dist/Effect-VsIY2vPx.d.mts.map +0 -1
  57. package/dist/devContext-BulTn3U5.cjs +0 -27
  58. package/dist/devContext-ZNsPyOgB.mjs +0 -24
  59. package/dist/devContext-ZNsPyOgB.mjs.map +0 -1
  60. package/dist/fromWebSocket-ERhd9KZR.mjs.map +0 -1
@@ -1,4 +1,10 @@
1
- import { t as Cleanup } from "./Cleanup-D0wvGW5d.cjs";
1
+ //#region src/types/Cleanup.d.ts
2
+ /**
3
+ * A function that may be returned from an effect, and is run before the effect
4
+ * is run or destroyed
5
+ */
6
+ type Cleanup = () => void;
7
+ //#endregion
2
8
  //#region src/types/AsyncSettle.d.ts
3
9
  /**
4
10
  * The result of an `$async` computed's most recent generation-guarded settle —
@@ -345,6 +351,13 @@ interface Effect {
345
351
  * flush — or during the effect's own run — can correctly re-queue it.
346
352
  */
347
353
  queued: boolean;
354
+ /**
355
+ * How many times this effect has run in the current flush. Used by
356
+ * `triggerEffects` to detect runaway cycles (effects that keep re-queuing
357
+ * each other) without limiting the size of a legitimate flush. Reset at
358
+ * the end of each flush.
359
+ */
360
+ flushRuns?: number;
348
361
  /**
349
362
  * True if the effect encountered an exception in its last run.
350
363
  */
@@ -409,5 +422,5 @@ interface Effect {
409
422
  forVarMask?: number;
410
423
  }
411
424
  //#endregion
412
- export { ProxySignal as i, Region as n, Computed as r, Effect as t };
413
- //# sourceMappingURL=Effect-Bp-BIDDm.d.cts.map
425
+ export { Cleanup as a, ProxySignal as i, Region as n, Computed as r, Effect as t };
426
+ //# sourceMappingURL=Effect-Bi_nt6cx.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Effect-Bi_nt6cx.d.cts","names":[],"sources":["../src/types/Cleanup.ts","../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":";;;;;KAIK;;;;;;;;;;;;;;;;KCSA;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;;;;;;;;EASA;;;;;;;EAQA;;;;;;EAOA;;;;;;;EAQA;;;;EAKA;;;;;;;EAQA;;;;;;;;;;EAWA,iBAAiB,IAAI;;;;EAKrB;;;;;;EAOA,SAAS;;;;;;EAOT,gBAAgB,cAAc;;;;;;;;;EAU9B;;;;;;;;;;;;;;;;EAiBA"}
@@ -1,4 +1,10 @@
1
- import { t as Cleanup } from "./Cleanup-D0wvGW5d.mjs";
1
+ //#region src/types/Cleanup.d.ts
2
+ /**
3
+ * A function that may be returned from an effect, and is run before the effect
4
+ * is run or destroyed
5
+ */
6
+ type Cleanup = () => void;
7
+ //#endregion
2
8
  //#region src/types/AsyncSettle.d.ts
3
9
  /**
4
10
  * The result of an `$async` computed's most recent generation-guarded settle —
@@ -345,6 +351,13 @@ interface Effect {
345
351
  * flush — or during the effect's own run — can correctly re-queue it.
346
352
  */
347
353
  queued: boolean;
354
+ /**
355
+ * How many times this effect has run in the current flush. Used by
356
+ * `triggerEffects` to detect runaway cycles (effects that keep re-queuing
357
+ * each other) without limiting the size of a legitimate flush. Reset at
358
+ * the end of each flush.
359
+ */
360
+ flushRuns?: number;
348
361
  /**
349
362
  * True if the effect encountered an exception in its last run.
350
363
  */
@@ -409,5 +422,5 @@ interface Effect {
409
422
  forVarMask?: number;
410
423
  }
411
424
  //#endregion
412
- export { ProxySignal as i, Region as n, Computed as r, Effect as t };
413
- //# sourceMappingURL=Effect-VsIY2vPx.d.mts.map
425
+ export { Cleanup as a, ProxySignal as i, Region as n, Computed as r, Effect as t };
426
+ //# sourceMappingURL=Effect-Bi_nt6cx.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Effect-Bi_nt6cx.d.mts","names":[],"sources":["../src/types/Cleanup.ts","../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":";;;;;KAIK;;;;;;;;;;;;;;;;KCSA;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;;;;;;;;EASA;;;;;;;EAQA;;;;;;EAOA;;;;;;;EAQA;;;;EAKA;;;;;;;EAQA;;;;;;;;;;EAWA,iBAAiB,IAAI;;;;EAKrB;;;;;;EAOA,SAAS;;;;;;EAOT,gBAAgB,cAAc;;;;;;;;;EAU9B;;;;;;;;;;;;;;;;EAiBA"}
@@ -0,0 +1,28 @@
1
+ //#region src/types/ListItemSpec.d.ts
2
+ /**
3
+ * A lightweight, per-row descriptor emitted by the compiler's `@for`
4
+ * `buildItems` callback: just the key (for reconciliation) and the data bag
5
+ * (the loop variables). Unlike a full {@link ListItem}, a spec carries no DOM
6
+ * nodes, no effects, and no sibling-chain pointers — so allocating one per row
7
+ * on every list update is cheap.
8
+ *
9
+ * The keyed-list reconciler (`runListItems`) maps each spec to either an
10
+ * existing `ListItem` (matched by key, reused wholesale) or a freshly mounted
11
+ * one (for genuinely new keys), keeping the per-update cost proportional to
12
+ * what actually changed instead of to the list size.
13
+ *
14
+ * NOTE: `data` is `any` rather than `Record<string, any>` -- when a `@for`
15
+ * body binds a single loop variable and is proxy-safe, the variable is stored
16
+ * directly (e.g. `data: page` for a number), not as a bag.
17
+ *
18
+ * NOTE: `key` is optional -- the compiler only emits it when the `@for` has
19
+ * an `@key` block; unkeyed loops omit it (a missing key behaves the same as
20
+ * an `undefined` one during reconciliation).
21
+ */
22
+ interface ListItemSpec {
23
+ key?: any;
24
+ data: any;
25
+ }
26
+ //#endregion
27
+ export { ListItemSpec as t };
28
+ //# sourceMappingURL=ListItemSpec-DFkYr2TE.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItemSpec-DFkYr2TE.d.cts","names":[],"sources":["../src/types/ListItemSpec.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAoByB;EACxB;EACA"}
@@ -0,0 +1,28 @@
1
+ //#region src/types/ListItemSpec.d.ts
2
+ /**
3
+ * A lightweight, per-row descriptor emitted by the compiler's `@for`
4
+ * `buildItems` callback: just the key (for reconciliation) and the data bag
5
+ * (the loop variables). Unlike a full {@link ListItem}, a spec carries no DOM
6
+ * nodes, no effects, and no sibling-chain pointers — so allocating one per row
7
+ * on every list update is cheap.
8
+ *
9
+ * The keyed-list reconciler (`runListItems`) maps each spec to either an
10
+ * existing `ListItem` (matched by key, reused wholesale) or a freshly mounted
11
+ * one (for genuinely new keys), keeping the per-update cost proportional to
12
+ * what actually changed instead of to the list size.
13
+ *
14
+ * NOTE: `data` is `any` rather than `Record<string, any>` -- when a `@for`
15
+ * body binds a single loop variable and is proxy-safe, the variable is stored
16
+ * directly (e.g. `data: page` for a number), not as a bag.
17
+ *
18
+ * NOTE: `key` is optional -- the compiler only emits it when the `@for` has
19
+ * an `@key` block; unkeyed loops omit it (a missing key behaves the same as
20
+ * an `undefined` one during reconciliation).
21
+ */
22
+ interface ListItemSpec {
23
+ key?: any;
24
+ data: any;
25
+ }
26
+ //#endregion
27
+ export { ListItemSpec as t };
28
+ //# sourceMappingURL=ListItemSpec-DFkYr2TE.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItemSpec-DFkYr2TE.d.mts","names":[],"sources":["../src/types/ListItemSpec.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAoByB;EACxB;EACA"}
@@ -1,10 +1,13 @@
1
- import { t as Cleanup } from "./Cleanup-D0wvGW5d.mjs";
1
+ import { a as Cleanup } from "./Effect-Bi_nt6cx.cjs";
2
2
  //#region src/types/ClassValue.d.ts
3
3
  type ClassValue = string | Record<string, boolean | null | undefined> | Array<ClassValue> | null | undefined;
4
4
  //#endregion
5
5
  //#region src/types/StyleValue.d.ts
6
6
  type StyleValue = string | Record<string, string | null | undefined> | Array<StyleValue> | null | undefined;
7
7
  //#endregion
8
+ //#region src/render/formatText.d.ts
9
+ declare function formatText(value: any): string;
10
+ //#endregion
8
11
  //#region src/types/StreamSource.d.ts
9
12
  /**
10
13
  * A subscription to an external source of events — server-sent events,
@@ -95,10 +98,80 @@ interface AsyncOptions {
95
98
  /**
96
99
  * With `source: "server"`, how long (ms) the server waits for this
97
100
  * getter's promise before the enclosing `@await` boundary degrades to its
98
- * `with` branch and the client fetches instead. Defaults to 5000.
101
+ * `with` branch and the client fetches instead. Counted from the start of
102
+ * the server render, so nested boundaries share it rather than each
103
+ * adding their own wait. Defaults to 5000.
99
104
  */
100
105
  timeout?: number;
101
106
  }
102
107
  //#endregion
103
- export { StreamSource as a, fromElement as i, fromWebSocket as n, StyleValue as o, fromServer as r, ClassValue as s, AsyncOptions as t };
104
- //# sourceMappingURL=AsyncOptions-BDtArmeL.d.mts.map
108
+ //#region src/watch/$refresh.d.ts
109
+ /**
110
+ * Options for `$refresh`.
111
+ */
112
+ interface RefreshOptions {
113
+ /**
114
+ * Re-fetch silently — stale-while-revalidate. The suspend is *quiet*
115
+ * (`$pending` stays `false`) and subscribers aren't notified until the new
116
+ * promise resolves. For background revalidation: polling, refetch-on-
117
+ * focus. Defaults to `false` — a refresh is loud, so `$pending` reads
118
+ * `true` and inline "updating…" indicators flip on at refresh start.
119
+ */
120
+ silent?: boolean;
121
+ }
122
+ /**
123
+ * Re-fetches the `$async` getters read inside `fn` without changing a
124
+ * dependency. A companion to `$pending` (ASYNC.md): pull-to-refresh,
125
+ * refresh buttons, refetch-on-focus, polling, retry-after-error.
126
+ *
127
+ * `fn` is run in a tracking context that collects every `$async` computed it
128
+ * reads (`$cache` computeds are ignored). Each collected computed is then
129
+ * re-run with `recalc` left true — a "bare refresh" — so the suspend is
130
+ * *loud*: `$pending(fn)` returns `true` while the re-fetch is in flight and
131
+ * subscribers are notified at suspend *start*, so an inline "updating…"
132
+ * indicator appears immediately. Readers keep displaying the previous
133
+ * resolved value (`Computed.settle.value`) until the new promise resolves and
134
+ * propagates through the reactive graph; an `@await` boundary keeps its
135
+ * content mounted instead of flashing fallback.
136
+ *
137
+ * Pass `{ silent: true }` to re-fetch quietly (stale-while-revalidate):
138
+ * `$pending(fn)` stays `false` and nothing re-runs until the new promise
139
+ * resolves. For background revalidation where feedback would be noise —
140
+ * polling, refetch-on-focus:
141
+ *
142
+ * ```torp
143
+ * // poll quietly every 30s
144
+ * $run(() => {
145
+ * const id = setInterval(() => $refresh(() => $state.data, { silent: true }), 30_000);
146
+ * return () => clearInterval(id);
147
+ * });
148
+ * ```
149
+ *
150
+ * A refresh is loud regardless of `silent` when the computed has never
151
+ * resolved — e.g. retrying after an error that left `didError` set on a first
152
+ * load — or when the re-fetch is triggered by a dependency change, which
153
+ * flows through the normal `recalc` path instead of here.
154
+ *
155
+ * If `fn` reads a getter the UI has never read, the collection read
156
+ * initializes it — and that fetch IS the refresh: the computed is not re-run
157
+ * (a second fetch would be a duplicate whose resolve the generation guard
158
+ * drops). Getters already read (pending, resolved, or errored) are re-run as
159
+ * usual.
160
+ *
161
+ * The returned value of `fn` is ignored; use `fn` to reference the getters.
162
+ */
163
+ declare function $refresh(fn: () => any, options?: RefreshOptions): void;
164
+ //#endregion
165
+ //#region src/types/WatchOptions.d.ts
166
+ /**
167
+ * Options for $watch.
168
+ */
169
+ interface WatchOptions {
170
+ /**
171
+ * Only watch top-level properties, don't recursively watch children.
172
+ */
173
+ shallow?: boolean;
174
+ }
175
+ //#endregion
176
+ export { fromWebSocket as a, StreamSource as c, ClassValue as d, AsyncOptions as i, formatText as l, $refresh as n, fromServer as o, RefreshOptions as r, fromElement as s, WatchOptions as t, StyleValue as u };
177
+ //# sourceMappingURL=WatchOptions--xq-Gn4e.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WatchOptions--xq-Gn4e.d.cts","names":[],"sources":["../src/types/ClassValue.ts","../src/types/StyleValue.ts","../src/render/formatText.ts","../src/types/StreamSource.ts","../src/stream/fromElement.ts","../src/stream/fromServer.ts","../src/stream/fromWebSocket.ts","../src/types/AsyncOptions.ts","../src/watch/$refresh.ts","../src/types/WatchOptions.ts"],"mappings":";;KAAK,sBAEF,6CACA,MAAM;;;KCHJ,sBAEF,4CACA,MAAM;;;iBCDe,WAAW;;;;;;;;;;;;;;;;;KCc9B,aAAa,MAAM,OAAO,OAAO,eAAe;;;;;;;;;;;;;;KCHhD,mBAAmB,qBAAqB;;;;;;;;;;;iBAYrB,YAAY,UAAU,QAAQ,OACrD,QAAQ,kBACR,eACE,aAAa;;;;;;;;;;;;;;;;;iBCZQ,WAAW,+BAA+B,aAAa;;;;;;;;;;;;;;;;;iBCAvD,cAAc,+BAA+B,aAAa;;;;;;UCbzD;;;;;;EAMxB;;;;;;;;EASA;;;;;;;UCNgB;;;;;;;;EAQhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4CuB,SAAS,eAAe,UAAU;;;;;;UC7DjC;;;;EAIxB"}
@@ -1,10 +1,13 @@
1
- import { t as Cleanup } from "./Cleanup-D0wvGW5d.cjs";
1
+ import { a as Cleanup } from "./Effect-Bi_nt6cx.mjs";
2
2
  //#region src/types/ClassValue.d.ts
3
3
  type ClassValue = string | Record<string, boolean | null | undefined> | Array<ClassValue> | null | undefined;
4
4
  //#endregion
5
5
  //#region src/types/StyleValue.d.ts
6
6
  type StyleValue = string | Record<string, string | null | undefined> | Array<StyleValue> | null | undefined;
7
7
  //#endregion
8
+ //#region src/render/formatText.d.ts
9
+ declare function formatText(value: any): string;
10
+ //#endregion
8
11
  //#region src/types/StreamSource.d.ts
9
12
  /**
10
13
  * A subscription to an external source of events — server-sent events,
@@ -95,10 +98,80 @@ interface AsyncOptions {
95
98
  /**
96
99
  * With `source: "server"`, how long (ms) the server waits for this
97
100
  * getter's promise before the enclosing `@await` boundary degrades to its
98
- * `with` branch and the client fetches instead. Defaults to 5000.
101
+ * `with` branch and the client fetches instead. Counted from the start of
102
+ * the server render, so nested boundaries share it rather than each
103
+ * adding their own wait. Defaults to 5000.
99
104
  */
100
105
  timeout?: number;
101
106
  }
102
107
  //#endregion
103
- export { StreamSource as a, fromElement as i, fromWebSocket as n, StyleValue as o, fromServer as r, ClassValue as s, AsyncOptions as t };
104
- //# sourceMappingURL=AsyncOptions-C_7mWR6F.d.cts.map
108
+ //#region src/watch/$refresh.d.ts
109
+ /**
110
+ * Options for `$refresh`.
111
+ */
112
+ interface RefreshOptions {
113
+ /**
114
+ * Re-fetch silently — stale-while-revalidate. The suspend is *quiet*
115
+ * (`$pending` stays `false`) and subscribers aren't notified until the new
116
+ * promise resolves. For background revalidation: polling, refetch-on-
117
+ * focus. Defaults to `false` — a refresh is loud, so `$pending` reads
118
+ * `true` and inline "updating…" indicators flip on at refresh start.
119
+ */
120
+ silent?: boolean;
121
+ }
122
+ /**
123
+ * Re-fetches the `$async` getters read inside `fn` without changing a
124
+ * dependency. A companion to `$pending` (ASYNC.md): pull-to-refresh,
125
+ * refresh buttons, refetch-on-focus, polling, retry-after-error.
126
+ *
127
+ * `fn` is run in a tracking context that collects every `$async` computed it
128
+ * reads (`$cache` computeds are ignored). Each collected computed is then
129
+ * re-run with `recalc` left true — a "bare refresh" — so the suspend is
130
+ * *loud*: `$pending(fn)` returns `true` while the re-fetch is in flight and
131
+ * subscribers are notified at suspend *start*, so an inline "updating…"
132
+ * indicator appears immediately. Readers keep displaying the previous
133
+ * resolved value (`Computed.settle.value`) until the new promise resolves and
134
+ * propagates through the reactive graph; an `@await` boundary keeps its
135
+ * content mounted instead of flashing fallback.
136
+ *
137
+ * Pass `{ silent: true }` to re-fetch quietly (stale-while-revalidate):
138
+ * `$pending(fn)` stays `false` and nothing re-runs until the new promise
139
+ * resolves. For background revalidation where feedback would be noise —
140
+ * polling, refetch-on-focus:
141
+ *
142
+ * ```torp
143
+ * // poll quietly every 30s
144
+ * $run(() => {
145
+ * const id = setInterval(() => $refresh(() => $state.data, { silent: true }), 30_000);
146
+ * return () => clearInterval(id);
147
+ * });
148
+ * ```
149
+ *
150
+ * A refresh is loud regardless of `silent` when the computed has never
151
+ * resolved — e.g. retrying after an error that left `didError` set on a first
152
+ * load — or when the re-fetch is triggered by a dependency change, which
153
+ * flows through the normal `recalc` path instead of here.
154
+ *
155
+ * If `fn` reads a getter the UI has never read, the collection read
156
+ * initializes it — and that fetch IS the refresh: the computed is not re-run
157
+ * (a second fetch would be a duplicate whose resolve the generation guard
158
+ * drops). Getters already read (pending, resolved, or errored) are re-run as
159
+ * usual.
160
+ *
161
+ * The returned value of `fn` is ignored; use `fn` to reference the getters.
162
+ */
163
+ declare function $refresh(fn: () => any, options?: RefreshOptions): void;
164
+ //#endregion
165
+ //#region src/types/WatchOptions.d.ts
166
+ /**
167
+ * Options for $watch.
168
+ */
169
+ interface WatchOptions {
170
+ /**
171
+ * Only watch top-level properties, don't recursively watch children.
172
+ */
173
+ shallow?: boolean;
174
+ }
175
+ //#endregion
176
+ export { fromWebSocket as a, StreamSource as c, ClassValue as d, AsyncOptions as i, formatText as l, $refresh as n, fromServer as o, RefreshOptions as r, fromElement as s, WatchOptions as t, StyleValue as u };
177
+ //# sourceMappingURL=WatchOptions-DWF4EqB6.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WatchOptions-DWF4EqB6.d.mts","names":[],"sources":["../src/types/ClassValue.ts","../src/types/StyleValue.ts","../src/render/formatText.ts","../src/types/StreamSource.ts","../src/stream/fromElement.ts","../src/stream/fromServer.ts","../src/stream/fromWebSocket.ts","../src/types/AsyncOptions.ts","../src/watch/$refresh.ts","../src/types/WatchOptions.ts"],"mappings":";;KAAK,sBAEF,6CACA,MAAM;;;KCHJ,sBAEF,4CACA,MAAM;;;iBCDe,WAAW;;;;;;;;;;;;;;;;;KCc9B,aAAa,MAAM,OAAO,OAAO,eAAe;;;;;;;;;;;;;;KCHhD,mBAAmB,qBAAqB;;;;;;;;;;;iBAYrB,YAAY,UAAU,QAAQ,OACrD,QAAQ,kBACR,eACE,aAAa;;;;;;;;;;;;;;;;;iBCZQ,WAAW,+BAA+B,aAAa;;;;;;;;;;;;;;;;;iBCAvD,cAAc,+BAA+B,aAAa;;;;;;UCbzD;;;;;;EAMxB;;;;;;;;EASA;;;;;;;UCNgB;;;;;;;;EAQhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4CuB,SAAS,eAAe,UAAU;;;;;;UC7DjC;;;;EAIxB"}