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