@torpor/view 1.2.6 → 1.3.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.
- package/dist/{Effect-DazmAdyC.d.mts → Effect-99HYQdzZ.d.mts} +50 -33
- package/dist/Effect-99HYQdzZ.d.mts.map +1 -0
- package/dist/{Effect-Dewn7MLc.d.cts → Effect-Bf8fz_zC.d.cts} +50 -33
- package/dist/Effect-Bf8fz_zC.d.cts.map +1 -0
- package/dist/compile.cjs +1510 -122
- package/dist/compile.d.cts +268 -1
- package/dist/compile.d.cts.map +1 -1
- package/dist/compile.d.mts +268 -1
- package/dist/compile.d.mts.map +1 -1
- package/dist/compile.mjs +1507 -123
- package/dist/compile.mjs.map +1 -1
- package/dist/dev.d.cts +1 -1
- package/dist/dev.d.mts +1 -1
- package/dist/{fromWebSocket-DrN-IduP.cjs → fromWebSocket-Cdoghvmh.cjs} +15 -0
- package/dist/{fromWebSocket-CFGoMkV2.mjs → fromWebSocket-ERhd9KZR.mjs} +11 -2
- package/dist/fromWebSocket-ERhd9KZR.mjs.map +1 -0
- package/dist/index.cjs +266 -105
- package/dist/index.d.cts +54 -12
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +54 -12
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +266 -105
- package/dist/index.mjs.map +1 -1
- package/dist/runtime.iife.js +1 -0
- package/dist/slotAutoClose-BbKfzpkz.cjs +177 -0
- package/dist/slotAutoClose-CgDkf8fM.mjs +156 -0
- package/dist/slotAutoClose-CgDkf8fM.mjs.map +1 -0
- package/dist/ssr.cjs +29 -1
- package/dist/ssr.d.cts +32 -1
- package/dist/ssr.d.cts.map +1 -1
- package/dist/ssr.d.mts +32 -1
- package/dist/ssr.d.mts.map +1 -1
- package/dist/ssr.mjs +25 -2
- package/dist/ssr.mjs.map +1 -1
- package/package.json +8 -5
- package/dist/Effect-DazmAdyC.d.mts.map +0 -1
- package/dist/Effect-Dewn7MLc.d.cts.map +0 -1
- package/dist/fromWebSocket-CFGoMkV2.mjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as SlotRender, t as Component } from "./Component-0MH0zd-m.cjs";
|
|
2
2
|
import { t as Cleanup } from "./Cleanup-D0wvGW5d.cjs";
|
|
3
|
-
import { n as Region, t as Effect } from "./Effect-
|
|
3
|
+
import { n as Region, t as Effect } from "./Effect-Bf8fz_zC.cjs";
|
|
4
4
|
import { a as StreamSource, i as fromElement, n as fromWebSocket, o as StyleValue, r as fromServer, s as ClassValue, t as AsyncOptions } from "./AsyncOptions-C_7mWR6F.cjs";
|
|
5
5
|
//#region src/types/Animation.d.ts
|
|
6
6
|
interface Animation {
|
|
@@ -120,6 +120,14 @@ declare function getElementFragment(document: Document, array: Element[], index:
|
|
|
120
120
|
//#region src/render/hydrate.d.ts
|
|
121
121
|
/**
|
|
122
122
|
* Hydrates a component into an existing DOM tree
|
|
123
|
+
*
|
|
124
|
+
* When a root region is already live (an embed hydrating its server-rendered
|
|
125
|
+
* markup inside a mounted page), the component hydrates against a region
|
|
126
|
+
* tree of its own and the surrounding render context is restored afterwards
|
|
127
|
+
* — hydration must not replace the host's `rootRegion`/`previousRegion`.
|
|
128
|
+
* Tearing the embed down later (`unmount(parent)`) then disposes only the
|
|
129
|
+
* embed's tree.
|
|
130
|
+
*
|
|
123
131
|
* @param parent The parent node
|
|
124
132
|
* @param component The component to mount
|
|
125
133
|
* @param props An object containing component props
|
|
@@ -136,7 +144,13 @@ declare function hydrate(parent: ParentNode, component: Component, props?: Recor
|
|
|
136
144
|
* handlers. (`hydrate` mounts into server-rendered markup, which is already
|
|
137
145
|
* connected.)
|
|
138
146
|
*
|
|
139
|
-
*
|
|
147
|
+
* When a root region is already live (an embed mounting into an element
|
|
148
|
+
* inside a mounted page), the component mounts against a region tree of its
|
|
149
|
+
* own and the surrounding render context is left untouched — so tearing the
|
|
150
|
+
* embed down later (`unmount(parent)`) disposes only the embed.
|
|
151
|
+
*
|
|
152
|
+
* @param parent The node to mount into. Like `hydrate`, it must have no
|
|
153
|
+
* child elements
|
|
140
154
|
* @param component The component to mount
|
|
141
155
|
* @param props An object containing component props
|
|
142
156
|
*/
|
|
@@ -144,14 +158,19 @@ declare function mount(parent: ParentNode, component: Component, props?: Record<
|
|
|
144
158
|
//#endregion
|
|
145
159
|
//#region src/render/unmount.d.ts
|
|
146
160
|
/**
|
|
147
|
-
* Tears down the
|
|
148
|
-
*
|
|
149
|
-
* removes any remaining child nodes from `parent
|
|
161
|
+
* Tears down the component tree that was mounted/hydrated into `parent`:
|
|
162
|
+
* disposes its region tree (running effect cleanups and detaching
|
|
163
|
+
* subscriptions), removes any remaining child nodes from `parent`, and —
|
|
164
|
+
* when `parent` holds the root tree — resets the render context.
|
|
165
|
+
*
|
|
166
|
+
* When `parent` holds a nested tree (an embed inside a live page), only the
|
|
167
|
+
* embed is disposed and the host's render context is left untouched. Any
|
|
168
|
+
* embeds living inside a root container are disposed along with it.
|
|
150
169
|
*
|
|
151
170
|
* Call this before `mount`ing a fresh component tree into the same container
|
|
152
171
|
* (e.g. when client-side navigating to a route whose layout chain differs
|
|
153
172
|
* from the previous one). `mount` refuses to mount into a non-empty parent
|
|
154
|
-
* and
|
|
173
|
+
* and expects no leftover tree, so both must be cleared first.
|
|
155
174
|
*
|
|
156
175
|
* @param parent The container that the previous UI was mounted into
|
|
157
176
|
*/
|
|
@@ -274,12 +293,18 @@ declare function nodeRoot(parent: Node, text?: boolean): ChildNode;
|
|
|
274
293
|
/**
|
|
275
294
|
* Gets the sibling of a node, x nodes after it.
|
|
276
295
|
*
|
|
277
|
-
* When hydrating, sets the hydration node.
|
|
296
|
+
* When hydrating, sets the hydration node. `textMask` marks steps that
|
|
297
|
+
* should land on a text node (bit i = the i-th step, counting from
|
|
298
|
+
* `node`): such a step reuses the current node when it is already text
|
|
299
|
+
* (text nodes get merged in HTML) and does not skip whitespace-only text
|
|
300
|
+
* nodes — matching `nodeNext(node, true)`. Steps without their bit set
|
|
301
|
+
* match `nodeNext(node, false)`.
|
|
278
302
|
*
|
|
279
303
|
* @param node The node.
|
|
280
304
|
* @param count The number of nodes to skip.
|
|
305
|
+
* @param textMask Bitmask of text steps.
|
|
281
306
|
*/
|
|
282
|
-
declare function nodeSkip(node: ChildNode, count: number): ChildNode;
|
|
307
|
+
declare function nodeSkip(node: ChildNode, count: number, textMask?: number): ChildNode;
|
|
283
308
|
//#endregion
|
|
284
309
|
//#region src/render/popRegion.d.ts
|
|
285
310
|
declare function popRegion(oldRegion: Region): void;
|
|
@@ -338,7 +363,24 @@ declare function restoreHydration(node: ChildNode | null): void;
|
|
|
338
363
|
declare function runControl(region: Region, anchor: Node | null, create: (anchor: Node | null) => void, name?: string): void;
|
|
339
364
|
//#endregion
|
|
340
365
|
//#region src/render/runControlBranch.d.ts
|
|
341
|
-
|
|
366
|
+
/**
|
|
367
|
+
* Runs one branch of a control block (`@if`/`@switch`/`@replace`, and the
|
|
368
|
+
* runtime-driven `@await`/`@try` groups). Returns the region to pop after
|
|
369
|
+
* the branch's content has rendered, or `null` when the branch should be
|
|
370
|
+
* skipped (same index as the previous render and not forced to recreate).
|
|
371
|
+
*
|
|
372
|
+
* The branch region is created and pushed here — the single point of branch
|
|
373
|
+
* bookkeeping, so emitters (and the runtime-driven groups) don't repeat the
|
|
374
|
+
* region/push/pop dance and can't get it wrong (e.g. forgetting that the
|
|
375
|
+
* clear above can release the region `context.previousRegion` points at).
|
|
376
|
+
*
|
|
377
|
+
* @param region The control's own region
|
|
378
|
+
* @param oldIndex The branch index of the previous render (callers pass a
|
|
379
|
+
* sentinel like `0` → `-1` to force a clear-and-rerender)
|
|
380
|
+
* @param index The branch index of this render
|
|
381
|
+
* @param name Dev-only name for the pushed branch region
|
|
382
|
+
*/
|
|
383
|
+
declare function runControlBranch(region: Region, oldIndex: number, index: number, name?: string): Region | null;
|
|
342
384
|
//#endregion
|
|
343
385
|
//#region src/render/runList.d.ts
|
|
344
386
|
/**
|
|
@@ -384,7 +426,7 @@ declare function runList(region: Region, parent: ParentNode, anchor: Node | null
|
|
|
384
426
|
* Stale-while-revalidate (ASYNC.md): once content has been produced
|
|
385
427
|
* (`hasContent`), a subsequent suspend during a refresh does NOT switch to
|
|
386
428
|
* the `with` branch — the boundary keeps the stale content mounted. `$async`
|
|
387
|
-
* retains the previous resolved value (`Computed.
|
|
429
|
+
* retains the previous resolved value (`Computed.settle.value`) and
|
|
388
430
|
* `suspendRead` returns it, so child effects keep displaying the old value
|
|
389
431
|
* until the new promise resolves and updates them in place. The `with` branch
|
|
390
432
|
* is shown only on the first load, before content has ever rendered
|
|
@@ -626,7 +668,7 @@ declare function $peek<T>(fn: () => T): T;
|
|
|
626
668
|
* re-asking the same question shouldn't ping the user. First loads and
|
|
627
669
|
* dependency-change refreshes are loud (`true`), as is the default (loud)
|
|
628
670
|
* `$refresh(fn)`. Quiet-ness is captured per computed at suspend time via
|
|
629
|
-
* `suspendQuiet` (computed in `$async`'s run from `
|
|
671
|
+
* `suspendQuiet` (computed in `$async`'s run from `settle` and `recalc`).
|
|
630
672
|
*
|
|
631
673
|
* @param fn A function that reads the reactive values to check.
|
|
632
674
|
*/
|
|
@@ -657,7 +699,7 @@ interface RefreshOptions {
|
|
|
657
699
|
* *loud*: `$pending(fn)` returns `true` while the re-fetch is in flight and
|
|
658
700
|
* subscribers are notified at suspend *start*, so an inline "updating…"
|
|
659
701
|
* indicator appears immediately. Readers keep displaying the previous
|
|
660
|
-
* resolved value (`Computed.
|
|
702
|
+
* resolved value (`Computed.settle.value`) until the new promise resolves and
|
|
661
703
|
* propagates through the reactive graph; an `@await` boundary keeps its
|
|
662
704
|
* content mounted instead of flashing fallback.
|
|
663
705
|
*
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types/Animation.ts","../src/render/addAnimation.ts","../src/render/addEvent.ts","../src/render/addElement.ts","../src/render/addFragment.ts","../src/render/applyProps.ts","../src/render/buildClasses.ts","../src/render/buildStyles.ts","../src/render/clearLayoutSlot.ts","../src/render/fillLayoutSlot.ts","../src/render/formatText.ts","../src/render/firstInsideNode.ts","../src/render/getFragment.ts","../src/render/getElementFragment.ts","../src/render/hydrate.ts","../src/render/mount.ts","../src/render/unmount.ts","../src/types/ListItemSpec.ts","../src/types/ListItem.ts","../src/render/newListItem.ts","../src/render/newRegion.ts","../src/render/nodeAnchor.ts","../src/render/nodeChild.ts","../src/render/nodeNext.ts","../src/render/nodeRootElement.ts","../src/render/nodeRoot.ts","../src/render/nodeSkip.ts","../src/render/popRegion.ts","../src/render/pushRegion.ts","../src/render/rerunRegionEffects.ts","../src/render/restoreHydration.ts","../src/render/runControl.ts","../src/render/runControlBranch.ts","../src/render/runList.ts","../src/render/runAwait.ts","../src/render/runTry.ts","../src/render/saveHydration.ts","../src/render/headElement.ts","../src/render/setAttribute.ts","../src/render/setDynamicElement.ts","../src/types/Bindable.ts","../src/watch/$batch.ts","../src/watch/$async.ts","../src/watch/$bind.ts","../src/watch/$cache.ts","../src/watch/$onmount.ts","../src/watch/$peek.ts","../src/watch/$pending.ts","../src/watch/$refresh.ts","../src/watch/$run.ts","../src/watch/$stream.ts","../src/watch/$unwrap.ts","../src/types/WatchOptions.ts","../src/watch/$watch.ts"],"mappings":";;;;;UAAyB;EACxB,WAAW,aAAa;EACxB,mBAAmB;;;;iBCCI,aAAa,IAAI,aAAa,QAAQ,WAAW,OAAO;;;iBCDxD,SACvB,IAAI,SACJ,cACA,YAAA,MAAkB,SAAS;;;;;;;;;;;;;;;;;;;;;;iBCkBJ,WAAW,MAAM,SAAS,QAAQ,YAAY,QAAQ;;;iBCnBtD,YACvB,UAAU,kBACV,QAAQ,YACR,QAAQ,aACR,UAAU,WACV,YAAY;;;iBCNW,WACvB,IAAI,SACJ,OAAO,iCACP;;;iBCHuB,aAAa,OAAO,YAAY;;;iBCChC,YAAY,OAAO;;;;;;;;;;iBCQnB,gBAAgB,QAAQ;;;;;;;;;;;;;;;;;;iBC6BxB,eACvB,WAAW,WACX,MAAM,YACN,QAAQ,YACR,QAAQ,aACR,SAAS,OAAO,mBAChB,WAAW,OAAO,oBAChB;;;iBC9CqB,WAAW;;;;;;;;iBCiBX,gBAAgB,QAAQ,YAAY;;;iBCnBpC,YACvB,UAAU,UACV,OAAO,oBACP,eACA,cACA,eACE;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCkBqB,mBACvB,UAAU,UACV,OAAO,WACP,eACA,cACA,eACE
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types/Animation.ts","../src/render/addAnimation.ts","../src/render/addEvent.ts","../src/render/addElement.ts","../src/render/addFragment.ts","../src/render/applyProps.ts","../src/render/buildClasses.ts","../src/render/buildStyles.ts","../src/render/clearLayoutSlot.ts","../src/render/fillLayoutSlot.ts","../src/render/formatText.ts","../src/render/firstInsideNode.ts","../src/render/getFragment.ts","../src/render/getElementFragment.ts","../src/render/hydrate.ts","../src/render/mount.ts","../src/render/unmount.ts","../src/types/ListItemSpec.ts","../src/types/ListItem.ts","../src/render/newListItem.ts","../src/render/newRegion.ts","../src/render/nodeAnchor.ts","../src/render/nodeChild.ts","../src/render/nodeNext.ts","../src/render/nodeRootElement.ts","../src/render/nodeRoot.ts","../src/render/nodeSkip.ts","../src/render/popRegion.ts","../src/render/pushRegion.ts","../src/render/rerunRegionEffects.ts","../src/render/restoreHydration.ts","../src/render/runControl.ts","../src/render/runControlBranch.ts","../src/render/runList.ts","../src/render/runAwait.ts","../src/render/runTry.ts","../src/render/saveHydration.ts","../src/render/headElement.ts","../src/render/setAttribute.ts","../src/render/setDynamicElement.ts","../src/types/Bindable.ts","../src/watch/$batch.ts","../src/watch/$async.ts","../src/watch/$bind.ts","../src/watch/$cache.ts","../src/watch/$onmount.ts","../src/watch/$peek.ts","../src/watch/$pending.ts","../src/watch/$refresh.ts","../src/watch/$run.ts","../src/watch/$stream.ts","../src/watch/$un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IAAI,WAAW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCNzE,MACvB,OAAO,OAAO,mBACd,OAAO,OAAO,kCACX;;;;;;;;iBC5BoB,OAAO,GAAG,UAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;iBCcxB,SAAS,UAAU;;;;;;;;;;;iBCdnB,MAAM,GAAG,UAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;iBCcvB,SAAS;;;;;;UCZhB;;;;;;;;EAQhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4CuB,SAAS,eAAe,UAAU;;;;;;;;;;iBChDlC,KACvB,UAAU,gBACV,eACA,UAAU,KAAK,0CACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCqBqB,QAAQ,GAC/B,QAAQ,aAAa,IACrB,UAAU,OAAO,YACjB;EAAY;;;;;;;;;iBCrCW,QAAQ,UAAU,OAAO,mBAAmB,QAAQ,IAAI;;;;;;UCJvD;;;;EAIxB;;;;;;;;;;;;;iBC6CuB,OAAO,kBAAkB,QAAQ,GAAG,UAAU,eAAe"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as SlotRender, t as Component } from "./Component-0MH0zd-m.mjs";
|
|
2
2
|
import { t as Cleanup } from "./Cleanup-D0wvGW5d.mjs";
|
|
3
|
-
import { n as Region, t as Effect } from "./Effect-
|
|
3
|
+
import { n as Region, t as Effect } from "./Effect-99HYQdzZ.mjs";
|
|
4
4
|
import { a as StreamSource, i as fromElement, n as fromWebSocket, o as StyleValue, r as fromServer, s as ClassValue, t as AsyncOptions } from "./AsyncOptions-BDtArmeL.mjs";
|
|
5
5
|
//#region src/types/Animation.d.ts
|
|
6
6
|
interface Animation {
|
|
@@ -120,6 +120,14 @@ declare function getElementFragment(document: Document, array: Element[], index:
|
|
|
120
120
|
//#region src/render/hydrate.d.ts
|
|
121
121
|
/**
|
|
122
122
|
* Hydrates a component into an existing DOM tree
|
|
123
|
+
*
|
|
124
|
+
* When a root region is already live (an embed hydrating its server-rendered
|
|
125
|
+
* markup inside a mounted page), the component hydrates against a region
|
|
126
|
+
* tree of its own and the surrounding render context is restored afterwards
|
|
127
|
+
* — hydration must not replace the host's `rootRegion`/`previousRegion`.
|
|
128
|
+
* Tearing the embed down later (`unmount(parent)`) then disposes only the
|
|
129
|
+
* embed's tree.
|
|
130
|
+
*
|
|
123
131
|
* @param parent The parent node
|
|
124
132
|
* @param component The component to mount
|
|
125
133
|
* @param props An object containing component props
|
|
@@ -136,7 +144,13 @@ declare function hydrate(parent: ParentNode, component: Component, props?: Recor
|
|
|
136
144
|
* handlers. (`hydrate` mounts into server-rendered markup, which is already
|
|
137
145
|
* connected.)
|
|
138
146
|
*
|
|
139
|
-
*
|
|
147
|
+
* When a root region is already live (an embed mounting into an element
|
|
148
|
+
* inside a mounted page), the component mounts against a region tree of its
|
|
149
|
+
* own and the surrounding render context is left untouched — so tearing the
|
|
150
|
+
* embed down later (`unmount(parent)`) disposes only the embed.
|
|
151
|
+
*
|
|
152
|
+
* @param parent The node to mount into. Like `hydrate`, it must have no
|
|
153
|
+
* child elements
|
|
140
154
|
* @param component The component to mount
|
|
141
155
|
* @param props An object containing component props
|
|
142
156
|
*/
|
|
@@ -144,14 +158,19 @@ declare function mount(parent: ParentNode, component: Component, props?: Record<
|
|
|
144
158
|
//#endregion
|
|
145
159
|
//#region src/render/unmount.d.ts
|
|
146
160
|
/**
|
|
147
|
-
* Tears down the
|
|
148
|
-
*
|
|
149
|
-
* removes any remaining child nodes from `parent
|
|
161
|
+
* Tears down the component tree that was mounted/hydrated into `parent`:
|
|
162
|
+
* disposes its region tree (running effect cleanups and detaching
|
|
163
|
+
* subscriptions), removes any remaining child nodes from `parent`, and —
|
|
164
|
+
* when `parent` holds the root tree — resets the render context.
|
|
165
|
+
*
|
|
166
|
+
* When `parent` holds a nested tree (an embed inside a live page), only the
|
|
167
|
+
* embed is disposed and the host's render context is left untouched. Any
|
|
168
|
+
* embeds living inside a root container are disposed along with it.
|
|
150
169
|
*
|
|
151
170
|
* Call this before `mount`ing a fresh component tree into the same container
|
|
152
171
|
* (e.g. when client-side navigating to a route whose layout chain differs
|
|
153
172
|
* from the previous one). `mount` refuses to mount into a non-empty parent
|
|
154
|
-
* and
|
|
173
|
+
* and expects no leftover tree, so both must be cleared first.
|
|
155
174
|
*
|
|
156
175
|
* @param parent The container that the previous UI was mounted into
|
|
157
176
|
*/
|
|
@@ -274,12 +293,18 @@ declare function nodeRoot(parent: Node, text?: boolean): ChildNode;
|
|
|
274
293
|
/**
|
|
275
294
|
* Gets the sibling of a node, x nodes after it.
|
|
276
295
|
*
|
|
277
|
-
* When hydrating, sets the hydration node.
|
|
296
|
+
* When hydrating, sets the hydration node. `textMask` marks steps that
|
|
297
|
+
* should land on a text node (bit i = the i-th step, counting from
|
|
298
|
+
* `node`): such a step reuses the current node when it is already text
|
|
299
|
+
* (text nodes get merged in HTML) and does not skip whitespace-only text
|
|
300
|
+
* nodes — matching `nodeNext(node, true)`. Steps without their bit set
|
|
301
|
+
* match `nodeNext(node, false)`.
|
|
278
302
|
*
|
|
279
303
|
* @param node The node.
|
|
280
304
|
* @param count The number of nodes to skip.
|
|
305
|
+
* @param textMask Bitmask of text steps.
|
|
281
306
|
*/
|
|
282
|
-
declare function nodeSkip(node: ChildNode, count: number): ChildNode;
|
|
307
|
+
declare function nodeSkip(node: ChildNode, count: number, textMask?: number): ChildNode;
|
|
283
308
|
//#endregion
|
|
284
309
|
//#region src/render/popRegion.d.ts
|
|
285
310
|
declare function popRegion(oldRegion: Region): void;
|
|
@@ -338,7 +363,24 @@ declare function restoreHydration(node: ChildNode | null): void;
|
|
|
338
363
|
declare function runControl(region: Region, anchor: Node | null, create: (anchor: Node | null) => void, name?: string): void;
|
|
339
364
|
//#endregion
|
|
340
365
|
//#region src/render/runControlBranch.d.ts
|
|
341
|
-
|
|
366
|
+
/**
|
|
367
|
+
* Runs one branch of a control block (`@if`/`@switch`/`@replace`, and the
|
|
368
|
+
* runtime-driven `@await`/`@try` groups). Returns the region to pop after
|
|
369
|
+
* the branch's content has rendered, or `null` when the branch should be
|
|
370
|
+
* skipped (same index as the previous render and not forced to recreate).
|
|
371
|
+
*
|
|
372
|
+
* The branch region is created and pushed here — the single point of branch
|
|
373
|
+
* bookkeeping, so emitters (and the runtime-driven groups) don't repeat the
|
|
374
|
+
* region/push/pop dance and can't get it wrong (e.g. forgetting that the
|
|
375
|
+
* clear above can release the region `context.previousRegion` points at).
|
|
376
|
+
*
|
|
377
|
+
* @param region The control's own region
|
|
378
|
+
* @param oldIndex The branch index of the previous render (callers pass a
|
|
379
|
+
* sentinel like `0` → `-1` to force a clear-and-rerender)
|
|
380
|
+
* @param index The branch index of this render
|
|
381
|
+
* @param name Dev-only name for the pushed branch region
|
|
382
|
+
*/
|
|
383
|
+
declare function runControlBranch(region: Region, oldIndex: number, index: number, name?: string): Region | null;
|
|
342
384
|
//#endregion
|
|
343
385
|
//#region src/render/runList.d.ts
|
|
344
386
|
/**
|
|
@@ -384,7 +426,7 @@ declare function runList(region: Region, parent: ParentNode, anchor: Node | null
|
|
|
384
426
|
* Stale-while-revalidate (ASYNC.md): once content has been produced
|
|
385
427
|
* (`hasContent`), a subsequent suspend during a refresh does NOT switch to
|
|
386
428
|
* the `with` branch — the boundary keeps the stale content mounted. `$async`
|
|
387
|
-
* retains the previous resolved value (`Computed.
|
|
429
|
+
* retains the previous resolved value (`Computed.settle.value`) and
|
|
388
430
|
* `suspendRead` returns it, so child effects keep displaying the old value
|
|
389
431
|
* until the new promise resolves and updates them in place. The `with` branch
|
|
390
432
|
* is shown only on the first load, before content has ever rendered
|
|
@@ -626,7 +668,7 @@ declare function $peek<T>(fn: () => T): T;
|
|
|
626
668
|
* re-asking the same question shouldn't ping the user. First loads and
|
|
627
669
|
* dependency-change refreshes are loud (`true`), as is the default (loud)
|
|
628
670
|
* `$refresh(fn)`. Quiet-ness is captured per computed at suspend time via
|
|
629
|
-
* `suspendQuiet` (computed in `$async`'s run from `
|
|
671
|
+
* `suspendQuiet` (computed in `$async`'s run from `settle` and `recalc`).
|
|
630
672
|
*
|
|
631
673
|
* @param fn A function that reads the reactive values to check.
|
|
632
674
|
*/
|
|
@@ -657,7 +699,7 @@ interface RefreshOptions {
|
|
|
657
699
|
* *loud*: `$pending(fn)` returns `true` while the re-fetch is in flight and
|
|
658
700
|
* subscribers are notified at suspend *start*, so an inline "updating…"
|
|
659
701
|
* indicator appears immediately. Readers keep displaying the previous
|
|
660
|
-
* resolved value (`Computed.
|
|
702
|
+
* resolved value (`Computed.settle.value`) until the new promise resolves and
|
|
661
703
|
* propagates through the reactive graph; an `@await` boundary keeps its
|
|
662
704
|
* content mounted instead of flashing fallback.
|
|
663
705
|
*
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/Animation.ts","../src/render/addAnimation.ts","../src/render/addEvent.ts","../src/render/addElement.ts","../src/render/addFragment.ts","../src/render/applyProps.ts","../src/render/buildClasses.ts","../src/render/buildStyles.ts","../src/render/clearLayoutSlot.ts","../src/render/fillLayoutSlot.ts","../src/render/formatText.ts","../src/render/firstInsideNode.ts","../src/render/getFragment.ts","../src/render/getElementFragment.ts","../src/render/hydrate.ts","../src/render/mount.ts","../src/render/unmount.ts","../src/types/ListItemSpec.ts","../src/types/ListItem.ts","../src/render/newListItem.ts","../src/render/newRegion.ts","../src/render/nodeAnchor.ts","../src/render/nodeChild.ts","../src/render/nodeNext.ts","../src/render/nodeRootElement.ts","../src/render/nodeRoot.ts","../src/render/nodeSkip.ts","../src/render/popRegion.ts","../src/render/pushRegion.ts","../src/render/rerunRegionEffects.ts","../src/render/restoreHydration.ts","../src/render/runControl.ts","../src/render/runControlBranch.ts","../src/render/runList.ts","../src/render/runAwait.ts","../src/render/runTry.ts","../src/render/saveHydration.ts","../src/render/headElement.ts","../src/render/setAttribute.ts","../src/render/setDynamicElement.ts","../src/types/Bindable.ts","../src/watch/$batch.ts","../src/watch/$async.ts","../src/watch/$bind.ts","../src/watch/$cache.ts","../src/watch/$onmount.ts","../src/watch/$peek.ts","../src/watch/$pending.ts","../src/watch/$refresh.ts","../src/watch/$run.ts","../src/watch/$stream.ts","../src/watch/$unwrap.ts","../src/types/WatchOptions.ts","../src/watch/$watch.ts"],"mappings":";;;;;UAAyB;EACxB,WAAW,aAAa;EACxB,mBAAmB;;;;iBCCI,aAAa,IAAI,aAAa,QAAQ,WAAW,OAAO;;;iBCDxD,SACvB,IAAI,SACJ,cACA,YAAA,MAAkB,SAAS;;;;;;;;;;;;;;;;;;;;;;iBCkBJ,WAAW,MAAM,SAAS,QAAQ,YAAY,QAAQ;;;iBCnBtD,YACvB,UAAU,kBACV,QAAQ,YACR,QAAQ,aACR,UAAU,WACV,YAAY;;;iBCNW,WACvB,IAAI,SACJ,OAAO,iCACP;;;iBCHuB,aAAa,OAAO,YAAY;;;iBCChC,YAAY,OAAO;;;;;;;;;;iBCQnB,gBAAgB,QAAQ;;;;;;;;;;;;;;;;;;iBC6BxB,eACvB,WAAW,WACX,MAAM,YACN,QAAQ,YACR,QAAQ,aACR,SAAS,OAAO,mBAChB,WAAW,OAAO,oBAChB;;;iBC9CqB,WAAW;;;;;;;;iBCiBX,gBAAgB,QAAQ,YAAY;;;iBCnBpC,YACvB,UAAU,UACV,OAAO,oBACP,eACA,cACA,eACE;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCkBqB,mBACvB,UAAU,UACV,OAAO,WACP,eACA,cACA,eACE
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/Animation.ts","../src/render/addAnimation.ts","../src/render/addEvent.ts","../src/render/addElement.ts","../src/render/addFragment.ts","../src/render/applyProps.ts","../src/render/buildClasses.ts","../src/render/buildStyles.ts","../src/render/clearLayoutSlot.ts","../src/render/fillLayoutSlot.ts","../src/render/formatText.ts","../src/render/firstInsideNode.ts","../src/render/getFragment.ts","../src/render/getElementFragment.ts","../src/render/hydrate.ts","../src/render/mount.ts","../src/render/unmount.ts","../src/types/ListItemSpec.ts","../src/types/ListItem.ts","../src/render/newListItem.ts","../src/render/newRegion.ts","../src/render/nodeAnchor.ts","../src/render/nodeChild.ts","../src/render/nodeNext.ts","../src/render/nodeRootElement.ts","../src/render/nodeRoot.ts","../src/render/nodeSkip.ts","../src/render/popRegion.ts","../src/render/pushRegion.ts","../src/render/rerunRegionEffects.ts","../src/render/restoreHydration.ts","../src/render/runControl.ts","../src/render/runControlBranch.ts","../src/render/runList.ts","../src/render/runAwait.ts","../src/render/runTry.ts","../src/render/saveHydration.ts","../src/render/headElement.ts","../src/render/setAttribute.ts","../src/render/setDynamicElement.ts","../src/types/Bindable.ts","../src/watch/$batch.ts","../src/watch/$async.ts","../src/watch/$bind.ts","../src/watch/$cache.ts","../src/watch/$onmount.ts","../src/watch/$peek.ts","../src/watch/$pending.ts","../src/watch/$refresh.ts","../src/watch/$run.ts","../src/watch/$stream.ts","../src/watch/$unwrap.ts","../src/types/WatchOptions.ts","../src/watch/$watch.ts"],"mappings":";;;;;UAAyB;EACxB,WAAW,aAAa;EACxB,mBAAmB;;;;iBCCI,aAAa,IAAI,aAAa,QAAQ,WAAW,OAAO;;;iBCDxD,SACvB,IAAI,SACJ,cACA,YAAA,MAAkB,SAAS;;;;;;;;;;;;;;;;;;;;;;iBCkBJ,WAAW,MAAM,SAAS,QAAQ,YAAY,QAAQ;;;iBCnBtD,YACvB,UAAU,kBACV,QAAQ,YACR,QAAQ,aACR,UAAU,WACV,YAAY;;;iBCNW,WACvB,IAAI,SACJ,OAAO,iCACP;;;iBCHuB,aAAa,OAAO,YAAY;;;iBCChC,YAAY,OAAO;;;;;;;;;;iBCQnB,gBAAgB,QAAQ;;;;;;;;;;;;;;;;;;iBC6BxB,eACvB,WAAW,WACX,MAAM,YACN,QAAQ,YACR,QAAQ,aACR,SAAS,OAAO,mBACh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