@bgub/fig 0.1.0-alpha.7 → 0.1.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +610 -0
  2. package/dist/{element-Od8CmsBL.d.ts → element-9MtOc5qb.d.ts} +113 -0
  3. package/dist/{element-wieeFL9f.js → element-mHDfizuh.js} +55 -1
  4. package/dist/element-mHDfizuh.js.map +1 -0
  5. package/dist/{hooks-BSqKOOez.d.ts → hooks-Bw3vbom7.d.ts} +63 -1
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +3 -3
  8. package/dist/internal.d.ts +45 -2
  9. package/dist/internal.js +24 -4
  10. package/dist/internal.js.map +1 -1
  11. package/dist/jsx-runtime.d.ts +4 -1
  12. package/dist/jsx-runtime.js +7 -1
  13. package/dist/jsx-runtime.js.map +1 -1
  14. package/dist/{payload-format-Dgap54q-.js → payload-format-BbsvTG9V.js} +14 -1
  15. package/dist/payload-format-BbsvTG9V.js.map +1 -0
  16. package/dist/payload.d.ts +6 -1
  17. package/dist/payload.js +11 -8
  18. package/dist/payload.js.map +1 -1
  19. package/{dist-development/resource-Cp01PvqW.js → dist/resource-BJxS62H2.js} +23 -3
  20. package/dist/resource-BJxS62H2.js.map +1 -0
  21. package/dist/{transition-DBjQTorq.js → transition-WvgFiYNY.js} +23 -4
  22. package/dist/transition-WvgFiYNY.js.map +1 -0
  23. package/dist-development/{element-Bb5fLsPy.js → element-CVlfN_3_.js} +55 -1
  24. package/dist-development/element-CVlfN_3_.js.map +1 -0
  25. package/dist-development/index.js +3 -3
  26. package/dist-development/internal.js +24 -4
  27. package/dist-development/internal.js.map +1 -1
  28. package/dist-development/jsx-runtime.js +7 -1
  29. package/dist-development/jsx-runtime.js.map +1 -1
  30. package/dist-development/{payload-format-Dgap54q-.js → payload-format-BbsvTG9V.js} +14 -1
  31. package/dist-development/payload-format-BbsvTG9V.js.map +1 -0
  32. package/dist-development/payload.js +11 -8
  33. package/dist-development/payload.js.map +1 -1
  34. package/{dist/resource-BfNHyXun.js → dist-development/resource-Bhusybfq.js} +23 -3
  35. package/dist-development/resource-Bhusybfq.js.map +1 -0
  36. package/dist-development/{transition-CNVJyoT2.js → transition-BSxdDR9D.js} +23 -4
  37. package/dist-development/transition-BSxdDR9D.js.map +1 -0
  38. package/package.json +2 -2
  39. package/dist/element-wieeFL9f.js.map +0 -1
  40. package/dist/payload-format-Dgap54q-.js.map +0 -1
  41. package/dist/resource-BfNHyXun.js.map +0 -1
  42. package/dist/transition-DBjQTorq.js.map +0 -1
  43. package/dist-development/element-Bb5fLsPy.js.map +0 -1
  44. package/dist-development/payload-format-Dgap54q-.js.map +0 -1
  45. package/dist-development/resource-Cp01PvqW.js.map +0 -1
  46. package/dist-development/transition-CNVJyoT2.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,613 @@
1
+ ## @bgub/fig@0.1.1
2
+
3
+ ### Document every JSR entrypoint and exported symbol
4
+
5
+ All Fig packages now publish module documentation for every JSR entrypoint and
6
+ API documentation for their exported symbols. This makes the generated JSR
7
+ reference complete and improves package discovery and quality scores.
8
+
9
+ ## @bgub/fig@0.1.0
10
+
11
+ ### Publish stable pre-1.0 releases
12
+
13
+ Fig's runtime, tooling, and TanStack adapter packages now publish without an
14
+ `alpha` prerelease suffix. Patch releases preserve compatibility within their
15
+ current `0.x` minor line; minor releases may make breaking changes before 1.0.
16
+
17
+ ### Asset descriptors use native names and preserve native ordering
18
+
19
+ Client-inserted and host-rendered stylesheets now form precedence buckets in
20
+ the order each distinct precedence value is first discovered. A stylesheet
21
+ discovered later for an existing bucket is inserted before the following
22
+ bucket, keeping lazy and payload-delivered CSS in its intended cascade order.
23
+
24
+ Raw `<script>` elements now enter the asset registry only when explicitly
25
+ marked `async`. Non-async scripts retain their native document position and
26
+ execution semantics; explicit `script()` descriptors continue to support all
27
+ asset-delivery modes.
28
+
29
+ Asset descriptor options and serialized payload asset rows now use native HTML
30
+ attribute names: `crossorigin`, `fetchpriority`, and `http-equiv`. The previous
31
+ React-style `crossOrigin`, `fetchPriority`, and `httpEquiv` spellings are
32
+ removed.
33
+
34
+ Host resource resolution now receives the actual host parent and fixes
35
+ out-of-band placement once per fiber. SVG and MathML titles consequently stay
36
+ in their native namespace, while HTML titles carrying `itemprop` stay in-tree;
37
+ ordinary document titles continue to use the shared head registry.
38
+
39
+ ### Preload eligible host images during server rendering
40
+
41
+ HTML and Payload rendering now derive image preload assets from eager `<img>`
42
+ hosts. The hints share Fig's existing asset registry, dedupe against explicit
43
+ preloads, preserve responsive `srcset` and `sizes` selection, and arrive before
44
+ the content that depends on them.
45
+
46
+ The first ten distinct images receive early shell delivery without being
47
+ forced to high browser priority. Lazy, explicitly low-priority, data-URL,
48
+ `<picture>`, and `<noscript>` images remain untouched.
49
+
50
+ ### Drop the `clientReferenceAssets` helper from the main entry
51
+
52
+ The runtime helper `clientReferenceAssets(reference)` (read a client
53
+ reference's declared assets, resolving thunks) had two homes; it is now
54
+ exported only from `@bgub/fig/internal`, where its consumers — the payload
55
+ serializer and framework manifest plumbing — already import it. Apps
56
+ declare assets with `clientReference({ assets })` and never call the
57
+ helper. The `ClientReferenceAssets` type stays on the main entry because
58
+ it appears in the public `ClientReferenceOptions.assets` signature.
59
+
60
+ ### Stable client-reference identity across decodes
61
+
62
+ `@bgub/fig/payload` exposes `createPayloadClientReferenceResolver(resolve)`:
63
+ a caller-owned stateful resolver passed as the `resolveClientReference`
64
+ decode option. With one, every resolvable client reference decodes to one
65
+ resolver-owned wrapper per reference id across all decodes sharing the
66
+ resolver — gated, ungated, or asynchronously resolved — so re-decoding a
67
+ payload updates islands in place instead of remounting them. Reveal gates
68
+ ride the decoded element instances rather than the wrapper: each decode
69
+ gates exactly its own content, so a newer decode's pending assets never
70
+ re-suspend an island already on screen, while its new island instances
71
+ still wait for the stylesheets they declared. The caller owns the
72
+ resolver's lifetime; under fast refresh no manual invalidation is needed
73
+ (hot edits remap the latched resolution through component families, and
74
+ unaccepted updates full-reload), while `delete`/`clear` cover manifest
75
+ swaps without a reload. With a plain resolve function, gated and async
76
+ references keep their per-decode wrapper identity, now with the same
77
+ per-element gating.
78
+
79
+ `@bgub/fig-dom`'s `payloadDataLoader` accepts the stateful resolver through
80
+ its existing `resolveClientReference` option.
81
+
82
+ Framework adapters can retain one resolver across refreshes and navigations,
83
+ preventing asset-gated islands from remounting on every re-decode.
84
+
85
+ ### Publish metadata only with its visible owner
86
+
87
+ Title and meta resources now travel through Payload as owner-bound
88
+ declarations and update the document only when their decoded tree commits.
89
+ Pending or superseded refreshes keep the previous metadata visible.
90
+
91
+ Streaming HTML now treats Suspense fallbacks as metadata owners and reconciles
92
+ the completed visible metadata snapshot in the boundary reveal operation.
93
+ Partial segments and failed or abandoned primary work cannot mutate the head.
94
+
95
+ The obsolete `onAssetError` option and its asset-diagnostic types are removed:
96
+ late metadata is delivered with its owner instead of being dropped.
97
+
98
+ ### Identify why data-loader signals abort
99
+
100
+ Data-resource loader signals now expose whether their generation was
101
+ superseded, evicted, or disposed. Rejected generations and values invalidated
102
+ through an attributed error receive the originating error as their abort
103
+ reason; reasonless rejections receive the platform's default `AbortError`.
104
+
105
+ ### Supersession abort waits for the successor's value
106
+
107
+ Refreshing a fulfilled data-resource entry no longer aborts the previous
108
+ generation's signal when the new load starts. Authority transfers when the
109
+ successor's value publishes: the visible stale value keeps streaming through
110
+ the refresh window (payload holes keep filling), subscribers re-render onto
111
+ the new tree in the same pass the old generation retires in, and a failed
112
+ refresh leaves the previous generation fully alive — stale value usable,
113
+ live holes included. Value-less pending loads still abort immediately when
114
+ superseded, and hydrate-over/eviction/disposal still end every generation.
115
+
116
+ This closes the gap where refreshing a serialized-component resource while
117
+ its holes were still streaming surfaced "Payload decode aborted." through
118
+ the nearest ErrorBoundary — cancellation now stays retirement, never a user
119
+ error, for plain consumers too.
120
+
121
+ ### DevTools show per-fiber data-resource dependencies
122
+
123
+ `@bgub/fig` data stores expose `inspectDataDependencyCanonicalKeys(owner)`,
124
+ a dev-only inspection read of the canonical keys an owner's committed
125
+ `readData` subscriptions point at (returns an empty array in prod builds).
126
+
127
+ `@bgub/fig-reconciler` devtools snapshots record those keys on every fiber
128
+ as `FigDevtoolsFiberSnapshot.dataResourceCanonicalKeys`. The field is
129
+ required, so external snapshot producers must supply it (empty array when
130
+ unknown).
131
+
132
+ The `@bgub/fig-devtools` panel filters the Data section by the selected
133
+ fiber's dependencies instead of always listing the entire store, and tree
134
+ rows show a green badge with the fiber's data-resource read count next to
135
+ the blue hook-count badge. Selecting
136
+ the root still lists every entry, including those with no committed
137
+ subscriber (unclaimed preloads, hydrated-but-unread rows). Refreshing
138
+ entries no longer render a redundant `Pending` row.
139
+
140
+ ### `ensureData`: the awaitable read for code outside render
141
+
142
+ `ensureData(resource, ...args)` resolves the value a key would render with:
143
+ the cached value when the entry has one (kicking the same background
144
+ revalidation a stale `readData` does), or the in-flight load's settlement on
145
+ a cache miss. It rejects with the error `readData` would throw, follows
146
+ superseding loads and server hydrations to the authoritative value, and never
147
+ subscribes — pair it with `readData` in the component, which claims the
148
+ settled entry within the preload retention window. An awaiting caller retains
149
+ the entry, so the unclaimed-preload eviction cannot abort a load out from
150
+ under an ensure.
151
+
152
+ Available as a free function (ambient store) and on the explicit handle
153
+ (`readDataStore()`, `root.data`). This is the delegation verb for external
154
+ routers: a route loader awaits `ensureData`, the component reads with
155
+ `readData`, and the data store stays the single cache.
156
+
157
+ ### Serialized components move to the data-resource model
158
+
159
+ Serialized trees are now ordinary data resources: servers return plain
160
+ Payload streams, and clients consume them through keyed `dataResource`
161
+ instances with `payloadDataLoader`. Refresh is `refreshData`, navigation can
162
+ select a new key, and back/forward navigations reuse cached entries. Commits
163
+ wait for the incoming Payload, island modules, and stylesheet gates.
164
+
165
+ Supporting API additions: `payloadDataLoader` accepts a `prepareAssets`
166
+ override (defaults to `insertAssetResources`), and `decodePayloadStream`
167
+ accepts an `onClientReference` observer for reference metadata.
168
+
169
+ ### Compose host behavior with mixins
170
+
171
+ Core now exports `createMixin()` and resolves render-time host behavior through
172
+ the `mix` prop. Mixins may contribute host props or nested mixins while keeping
173
+ the host type and subtree fixed. Explicit host props form the baseline; mixins
174
+ run in authoring order, and later results win.
175
+
176
+ DOM event listeners now use `mix={on(type, callback)}`. Migrate
177
+ `events={[on(type, callback)]}` to `mix={on(type, callback)}`; multiple or
178
+ conditional descriptors move into `mix={[...]}` and preserve positional
179
+ listener identity.
180
+
181
+ ### Keep empty children and document assets hydration-safe
182
+
183
+ Empty string children now normalize away on both the server and client, so a
184
+ rendered empty token cannot force hydration to recover the root.
185
+
186
+ When full-document hydration does recover, declarative stylesheets, titles,
187
+ and metadata now acquire against the replacement head instead of disappearing
188
+ with the server document.
189
+
190
+ ### Keep `useId` stable through selective hydration
191
+
192
+ `useId` now follows one canonical server/hydration tree path through Suspense
193
+ and Activity. Dehydrated boundaries snapshot that path when they claim their
194
+ server marker, then restore it when hydration resumes, so client updates that
195
+ insert or move surrounding siblings cannot renumber ids already present in the
196
+ server HTML. Suspense's private Activity wrapper is transparent to the path.
197
+
198
+ Components mounted only on the client now receive ids from a separate
199
+ `fig-C-*` namespace. Those ids remain stable for the component lifetime and
200
+ cannot collide with ids reserved by server-rendered content that has not
201
+ hydrated yet.
202
+
203
+ ### Initial alpha release
204
+
205
+ First public alpha release of Fig.
206
+
207
+ ### Allow interactive transitions to interrupt native animations
208
+
209
+ `transition()` and the function returned by `useTransition()` now accept
210
+ `viewTransition: "interrupt"`. When another native View Transition is already
211
+ animating, Fig skips it, waits for its cleanup to settle, and immediately
212
+ commits the latest rendered state, starting a new transition when that commit
213
+ has participating boundaries. The default remains serialized so navigations
214
+ and streamed reveals retain uninterrupted motion. Interruptible DOM
215
+ transitions also drop the implicit full-page snapshot so controls outside
216
+ explicit transition surfaces stay live and can express the next intent by
217
+ pointer before the current animation finishes.
218
+
219
+ ### `isValidElement` has a single home on the main entry
220
+
221
+ `isValidElement` was the one runtime export with two homes: the app-facing
222
+ main entry and `@bgub/fig/internal` (grouped with the other `$$typeof`
223
+ brand predicates). It is now exported only from `@bgub/fig`; the renderer
224
+ and server packages import it from there. The internal-only predicates
225
+ (`isSuspense`, `isPortal`, ...) are unchanged.
226
+
227
+ ### Expose the payload decoder on JSR
228
+
229
+ The JSR manifest now exports `@bgub/fig/payload`, matching the npm package
230
+ and making the browser-safe payload decoder available from both registries.
231
+
232
+ ### Reduce server-render and TanStack Start overhead
233
+
234
+ Server rendering now avoids redundant child normalization, component-stack,
235
+ and asset-classification work. Route assets are normalized lazily, payload
236
+ markers are injected without decoding and re-encoding HTML bytes, and
237
+ successful stream cancellation propagates directly through the existing Web
238
+ stream chain.
239
+
240
+ ### Payload exposes rendering and decoding, not its implementation
241
+
242
+ The payload packages now present two primary operations:
243
+ `renderToPayloadStream` on the server and `decodePayloadStream` in the
244
+ browser-safe core entry. Row/model types, value encoding, codec machinery,
245
+ content-type negotiation helpers, and framework document transports are
246
+ internal implementation details.
247
+
248
+ Client references use one `resolveClientReference(reference)` seam that may
249
+ return a component synchronously or asynchronously. It replaces the separate
250
+ load, resolve, and observation callbacks; reference metadata now includes its
251
+ stream-safe assets. The unused `load` field is also removed from
252
+ `clientReference(...)` declarations.
253
+
254
+ `payloadDataLoader` keeps only `request`, `resolveClientReference`, and the
255
+ optional `prepareAssets` override. Payload encoding is fixed internally rather
256
+ than exposed as a speculative custom-codec interface.
257
+
258
+ ### Generation-lifetime loader signals and `payloadDataLoader`
259
+
260
+ Data-resource loader signals now live as long as their load's generation,
261
+ not just the pending promise: the `{ signal }` a loader receives stays
262
+ unaborted after the value lands and aborts when the generation loses
263
+ authority — a newer load supersedes it, a server push hydrates over it, the
264
+ entry evicts, or the store is disposed. A rejected load's own signal aborts
265
+ on settlement, and `invalidateData` never aborts (marking stale does not
266
+ revoke authority). Loaders that stream into their value in the background —
267
+ payload decodes filling holes — tie that work to the signal; plain fetch
268
+ loaders are unaffected.
269
+
270
+ The load context also carries an internal, generation-guarded hydration
271
+ capability (symbol-keyed; read through `@bgub/fig/internal`) that hydrates
272
+ server-pushed `data` rows through the calling store only while the load is
273
+ authoritative, skipping rows that target the loading entry's own key.
274
+
275
+ New in `@bgub/fig-dom`: `payloadDataLoader({ request,
276
+ resolveClientReference?, prepareAssets? })` adapts a payload-stream
277
+ endpoint into an ordinary data-resource loader. It validates the response
278
+ (status, body, payload codec content-type; unusable bodies are cancelled),
279
+ wires `decodePayloadStream` to the generation-lifetime signal, hydrates
280
+ `data` rows through the store capability, inserts stream-discovered assets
281
+ with `insertAssetResources` (stylesheet gates delay only dependent reveal),
282
+ and resolves with the decoded root value — so `readData(postResource, slug)`
283
+ suspends like any read and returns renderable elements while streamed holes
284
+ keep filling in the background.
285
+
286
+ ### `@bgub/fig/payload`: the browser-safe payload home and `decodePayloadStream`
287
+
288
+ The payload decoder moved from `@bgub/fig-server/payload` to a new browser-safe
289
+ `@bgub/fig/payload` entry. Browser code no longer imports the server package to
290
+ decode; fig-server's serializer and the decoder share their private row/value
291
+ format through `@bgub/fig/internal`.
292
+
293
+ New client half: `decodePayloadStream(stream, options)` returns a live
294
+ `PayloadDecode` — `value` resolves when the root row decodes while outlined
295
+ holes keep streaming in, the never-rejecting `completion` reports
296
+ complete/failed/aborted, and `abort()` idempotently rejects unresolved holes
297
+ with an internal cancellation reason. Options wire data-row hydration
298
+ (`hydrate`), unified client-reference resolution, and asset preparation with
299
+ reveal gating (`prepareAssets`).
300
+
301
+ Internally, `assets` rows now carry an optional `for` — the row id whose
302
+ reveal depends on those assets, decided at serialization scope exit so a
303
+ suspended subtree's assets gate its outlined row rather than the enclosing
304
+ tree.
305
+
306
+ Dev-time enforcement: serialized components are render-only. During
307
+ `renderToPayloadStream`, `useState`, `useActionState`, `useTransition`,
308
+ `useStableEvent`, and the effect hooks now throw in development; the read
309
+ verbs, `useMemo`, `useId`, and `useSyncExternalStore`'s `getServerSnapshot`
310
+ path stay server-safe.
311
+
312
+ ### Deliver client-reference assets outside the resolution suspension
313
+
314
+ A decoded client reference's asset declarations now attach above its
315
+ module-load and reveal-gate suspension points. A server document render
316
+ that hits a cold reference module emits the island's stylesheet with the
317
+ segment containing the reference instead of with the late fill, so
318
+ first-request asset ordering matches warm requests.
319
+
320
+ ### Move `createPortalNode` to `@bgub/fig/internal`
321
+
322
+ `createPortalNode` is the cross-package seam renderers wrap in their
323
+ container-typed `createPortal`; apps never call it directly. It now lives
324
+ on the internal entry with the other renderer protocol exports instead of
325
+ the app-facing main entry. Portal-creating apps keep using
326
+ `createPortal(children, container, key?)` from `@bgub/fig-dom`; the
327
+ `FigPortal` type stays on the main entry because it appears in public
328
+ signatures.
329
+
330
+ ### Promise-shaped payload decoder
331
+
332
+ `decodePayloadStream` now returns `Promise<FigNode>` directly — the root
333
+ value promise — instead of a `PayloadDecode` handle. Cancellation is
334
+ signal-only (`options.signal`, unchanged); the redundant `abort()` method is
335
+ gone. The `completion` promise is replaced by an `onStreamDone(result)`
336
+ decode option, called exactly once when ingestion settles as `complete`,
337
+ `failed`, or `aborted` — post-root failures that strand no pending hole
338
+ remain observable there. The callback is never awaited and its exceptions
339
+ and rejections are swallowed, so an observer — sync or async — cannot break
340
+ decode teardown or leak an unhandled rejection. The
341
+ `PayloadDecode` interface and its non-thenable caveat are deleted;
342
+ `PayloadDecodeCompletion` remains as the callback's result type.
343
+
344
+ `@bgub/fig-dom`'s `payloadDataLoader` migrates internally; its public API is
345
+ unchanged.
346
+
347
+ Also considered and declined: narrowing `ResolveClientReference` to an
348
+ opaque id. The reference's `exportName`/`ssr`/`assets` mirror the `client`
349
+ row's wire fields and are all load-bearing in framework document pipelines;
350
+ the rationale is recorded in `docs/concepts/payload.md`.
351
+
352
+ ### Promise-valued children render through Suspense
353
+
354
+ `FigNode` now accepts promises of nodes. Promise children occupy distinct,
355
+ host-transparent child slots, suspend through the nearest `Suspense`, and route
356
+ rejections or invalid resolved children through normal error handling.
357
+
358
+ HTML rendering retains exact promise children as independent streaming tasks,
359
+ while Payload uses node-validated promise rows that decode to the same child
360
+ shape. Payload-rendered async components are invoked once and retain their
361
+ component-scoped assets on the outlined row.
362
+
363
+ ### Tighten public component, loader, asset, and bind signatures
364
+
365
+ `@bgub/fig` now names the shared data loader contract as
366
+ `DataResourceLoader`, constrains lazy loaders to components, and exposes
367
+ `ComponentProps` so lazy wrappers preserve the loaded component's props
368
+ without exposing its implementation statics. Client-reference SSR
369
+ implementations stay aligned with the reference's props. Stable-event typing
370
+ now models the trailing lifecycle signal separately from caller arguments.
371
+
372
+ `meta()` descriptors now require exactly one valid metadata identity:
373
+ `charset`, `name` plus `content`, `property` plus `content`, or `http-equiv`
374
+ plus `content`. Raw meta elements that do not satisfy the same shape remain
375
+ ordinary host elements instead of entering the asset registry.
376
+
377
+ `@bgub/fig-dom` payload requests now receive the standard
378
+ `DataResourceLoadContext`, portals retain their DOM container type in the
379
+ returned `FigPortal`, and bind callbacks must return `undefined`; cleanup is
380
+ exclusively driven by their `AbortSignal`.
381
+
382
+ ### Reduce asset serialization allocations
383
+
384
+ Asset resources now build their canonical host props directly. Server rendering
385
+ fills its owned props object in place instead of creating attribute tuples,
386
+ filtering them, converting them with `Object.fromEntries`, and cloning again to
387
+ append a nonce. Client insertion uses the same canonical props without changing
388
+ the generated elements or server HTML.
389
+
390
+ ### Reduce render-path allocations
391
+
392
+ Child reconciliation now reuses arrays that are already normalized. Server
393
+ rendering defers `useId` path formatting on branches that do not request an
394
+ ID. This avoids unnecessary allocations in common client-update and sparse-ID
395
+ server trees without changing rendered output.
396
+
397
+ ### Reduce server link allocations
398
+
399
+ Server-rendered router links now mark their client navigation behavior directly
400
+ instead of resolving a synthetic click mixin. Links without state props, binds,
401
+ or mixins also avoid creating empty state objects and composition wrappers.
402
+ Payload rendering continues to reject links whose client navigation behavior
403
+ would otherwise be lost.
404
+
405
+ ### Attribute rejected payload holes to their data resource
406
+
407
+ Payload hole errors are attributed to the authoritative owning data-resource
408
+ generation. Error boundaries receive `dataResourceKeys`, and
409
+ `invalidateDataError` retires the broken fulfilled value before retrying so a
410
+ remounted boundary suspends on fresh content instead of immediately catching
411
+ the same rejected hole. `decodePayloadStream` also exposes an observational
412
+ `onHoleError` callback.
413
+
414
+ The load context's hydration capability now shares the same authority window:
415
+ a still-visible generation's `data` rows keep hydrating through a superseding
416
+ refresh's window instead of being dropped the moment the refresh starts.
417
+
418
+ ### Remove the `FigText` type alias
419
+
420
+ `FigText` was a two-member alias (`string | number`) whose only use was
421
+ as a constituent of the `FigNode` union; no signature anywhere took it
422
+ by name. The union now spells out `string | number` directly, and the
423
+ alias is gone from both the main and internal entries. Code that
424
+ referenced `FigText` should use `string | number` (or `FigNode` where
425
+ the full children type is meant).
426
+
427
+ ### Remove the `h` alias for `createElement`
428
+
429
+ `@bgub/fig` no longer exports `createElement` under the second name `h`.
430
+ Every export has one home and one name; migrate by importing
431
+ `createElement` (or alias it locally: `const h = createElement`).
432
+
433
+ ### Use one data-resource API in every environment
434
+
435
+ `dataResource` now covers shared, browser, and server-only loaders without a
436
+ second API. Server-only loaders belong behind the framework's server module
437
+ boundary; browser code uses an explicit key-only resource when it needs the
438
+ same hydrated value.
439
+
440
+ The pass-through `serverDataResource` API, `@bgub/fig/server` entry point,
441
+ `figData` Vite transform, and generated browser resource stubs are removed.
442
+
443
+ ### The targeted-refresh protocol and payload consumer are gone
444
+
445
+ The serialized-components deletion gate passed across the demo e2e suites,
446
+ so the legacy architecture is removed rather than deprecated:
447
+
448
+ - `@bgub/fig-server/payload` no longer exports `createPayloadConsumer`,
449
+ `PayloadConsumer`, `PayloadBoundary`, `PAYLOAD_BOUNDARY_HEADER`,
450
+ `PayloadFetchError`, or the consumer fetch/ingestion seam, and
451
+ `renderToPayloadStream` drops its `refreshBoundary` option.
452
+ - The wire format loses the `refresh`/`refresh-error` rows and the
453
+ `$fig:"boundary"` model: the refresh unit is the data-resource key that
454
+ delivers the payload, so refreshing is requesting the same stream again.
455
+
456
+ Replacements, all already shipping: `decodePayloadStream` in
457
+ `@bgub/fig/payload` is the client half; fig-dom's `payloadDataLoader`
458
+ delivers a serialized tree as an ordinary data resource; the freshness
459
+ verbs (`refreshData`/`invalidateData`) are the refresh story; sub-tree
460
+ refresh granularity is finer resource keys.
461
+
462
+ ### Move HTML escaping helpers to a focused subpath
463
+
464
+ `escapeAttribute`, `escapeText`, `escapeScriptText`, and `escapeScriptJson` now export from
465
+ `@bgub/fig-server/html` instead of the main `@bgub/fig-server` entry.
466
+ The dedicated subpath keeps companion-markup helpers separate from server
467
+ render entry points while preserving their exact escaping behavior. The
468
+ TanStack Start adapter now consumes these helpers, Fig's internal data-store
469
+ brand predicate, and its own storage-context API instead of duplicating them.
470
+
471
+ ### Simplify Payload rendering and decoding
472
+
473
+ Payload now keeps client-reference identity and delivery state together,
474
+ encapsulates server asset deduplication and wire lowering, and removes
475
+ redundant request, graph, and chunk bookkeeping. The public API, wire values,
476
+ streaming, asset gating, cancellation, and error behavior are unchanged.
477
+
478
+ ### Server-route navigations commit content in one pass
479
+
480
+ Navigating to a payload server route used to commit an empty slot for one
481
+ retry beat (stretched to the full animation length when a view transition
482
+ was running) before the content revealed, because three already-settled
483
+ promises still suspended on their first render read:
484
+
485
+ - payload element gates are now tracked at creation, so a gate that settles
486
+ before its first read resolves synchronously;
487
+ - client-reference module resolutions are tracked the same way;
488
+ - pre-commit asset preparation now reveals the island hydration gate,
489
+ so navigations mount real islands instead of paying a placeholder →
490
+ reveal follow-up commit.
491
+
492
+ The route swap now lands as a single commit containing the full decoded
493
+ content, so view transitions capture the destination page with its content
494
+ already present.
495
+
496
+ ### Resolved client references keep their identity across decodes
497
+
498
+ `decodePayloadStream` used to wrap every client reference in a fresh
499
+ per-decode component, so re-decoding a surrounding payload (refreshing a
500
+ server component that contains islands) remounted every island and dropped
501
+ its client state.
502
+
503
+ References that `resolveClientReference` resolves synchronously and that carry no asset
504
+ gate now decode to the resolved component itself. The element type is
505
+ identity-stable across decodes, so a refresh of the surrounding payload
506
+ updates islands in place and their state survives. Gated or
507
+ asynchronously resolved references still decode to per-decode wrappers.
508
+
509
+ ### Preserve framework-managed asset placement
510
+
511
+ Framework adapters can now keep externally managed head and body tags in their
512
+ declared positions without exposing a DOM prop. TanStack Router uses this for
513
+ route-managed links, styles, and scripts while continuing to map title and meta
514
+ entries through Fig asset resources. Full-document hydration now ignores the
515
+ doctype and one shared marker identifies every server-owned node without a
516
+ client fiber. Declarative asset lists also gain a client commit lifecycle, so
517
+ route titles and metadata update during navigation.
518
+
519
+ ### Add Payload routes to the TanStack Start adapter
520
+
521
+ `@bgub/fig-tanstack-start/payload` now exposes `payloadResource`, which compiles
522
+ an inline render callback into a private server function and Fig-owned route
523
+ data resource. Applications supply the cache key and component tree without
524
+ authoring transport plumbing. The shared declaration can stay in one
525
+ `.payload.tsx` module; its render callback and render-only imports are omitted
526
+ from the browser build. The initial SSR response is embedded into the document
527
+ and adopted without refetching; client navigation and refresh use the same
528
+ resource request path. Payload data rows
529
+ hydrate the shared store, asset resources are retained on their owning server
530
+ segments or inserted through the browser registry, and client references retain
531
+ their resolver-defined identity. `decodePayloadStream` and `payloadDataLoader`
532
+ now expose `retainAssets` for server document renderers that need this delivery
533
+ path.
534
+
535
+ `@bgub/fig-tanstack-start/server` exposes the lower-level
536
+ `renderPayloadResponse` used by the generated TanStack server function; it
537
+ defaults its render abort signal to the incoming request, so a disconnected
538
+ client cancels the Payload render. Shell
539
+ HTML streams while outlined Suspense holes settle, and the completed initial
540
+ responses are embedded before TanStack starts full-document hydration. The Vite
541
+ adapter also publishes assets imported only by server modules into the client
542
+ build output. Fig Router links also consume TanStack's `viewTransition`
543
+ navigation option without forwarding it as an invalid attribute to the rendered
544
+ anchor, and derive active state from the resolved route instead of an in-flight
545
+ location.
546
+
547
+ ### Add the TanStack Start runtime adapter
548
+
549
+ `createDataStore` now creates a root-neutral Fig store that route loaders can
550
+ populate before a renderer exists. Server and client renderers adopt that exact
551
+ store, preserving one cache while attaching their lifecycle and scheduling.
552
+
553
+ The new TanStack Start runtime uses the store for route loading, server
554
+ rendering, Fig-owned document serialization, client deserialization, and
555
+ hydration. Route-managed head and script output maps through the Router adapter,
556
+ including Fig asset resources. The end-to-end contract verifies no initial
557
+ client refetch and exactly one reload after invalidation.
558
+
559
+ ### Share the text-separator protocol constant; small DOM cleanups
560
+
561
+ The `<!--,-->` text-separator comment the server writes between adjacent text
562
+ fibers was hardcoded independently by the server renderer and fig-dom's
563
+ hydration cursor. The comment data now lives in `@bgub/fig/internal` as
564
+ `TEXT_SEPARATOR_DATA`, next to the other streaming protocol constants, so the
565
+ two sides cannot drift. No wire change — the emitted markup is identical.
566
+
567
+ fig-dom also drops an unused internal `rootFor` helper, routes style clearing
568
+ through the shared `isEmptyPropValue` predicate, and simplifies a redundant
569
+ branch in select-value syncing. No behavior change.
570
+
571
+ ### Add typed View Transition scopes and abortable lifecycle events
572
+
573
+ `transition` and the `useTransition` starter now accept explicit transition
574
+ types, which Fig carries with the updates that reach each root and forwards to
575
+ the browser without leaking into unrelated commits.
576
+
577
+ `ViewTransition` adds one `onTransition(event, signal)` lifecycle callback for
578
+ enter, exit, share, and update phases. Events expose all participating surfaces
579
+ and the commit's transition types. Fig DOM's optional View Transition entry can
580
+ resolve those opaque surfaces into group, image-pair, old, and new pseudo
581
+ handles for animation and inspection; the signal aborts when the native
582
+ transition finishes.
583
+
584
+ ### Bound stalled view-transition waits
585
+
586
+ Transition-eligible commits and annotated streaming reveals now wait at most 60
587
+ seconds for a previous browser View Transition. If its completion promise never
588
+ settles, Fig releases the document mutex and proceeds with the latest work
589
+ instead of parking it forever.
590
+
591
+ ### Let Fig's Vite integration own runtime configuration
592
+
593
+ The new `fig()` Vite integration defines Fig's development gate and installs
594
+ Fast Refresh. TanStack Start composes it automatically, so applications no
595
+ longer need to configure Fig's compile-time mode or SSR package bundling
596
+ themselves.
597
+
598
+ `@bgub/fig-vite` now uses the application's Fig DOM renderer as a peer instead
599
+ of installing a private renderer copy.
600
+
601
+ The development gate follows Vite's command rather than its mode: serving
602
+ enables development behavior, while builds—including `--mode development`—strip
603
+ it from production output.
604
+
605
+ Published npm packages now expose development artifacts through a Fig-owned
606
+ condition, allowing the Vite integration to enable diagnostics and Fast Refresh
607
+ for ordinary installs while explicit static overrides remain authoritative and
608
+ default production imports retain their previous dead-code elimination. A
609
+ static `false` override also disables Fast Refresh instrumentation.
610
+
1
611
  ## @bgub/fig@0.1.0-alpha.7
2
612
 
3
613
  ### Allow interactive transitions to interrupt native animations