@bgub/fig-dom 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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,530 @@
1
+ ## @bgub/fig-dom@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-dom@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
+ ### Restore shadowed document metadata when its winner leaves
40
+
41
+ Client title and meta entries now keep stable per-fiber ownership claims. The
42
+ latest acquired live claim controls the single canonical DOM element; updates
43
+ to shadowed claims stay dormant, and removing the winner immediately restores
44
+ the latest remaining value.
45
+
46
+ Hoisted host and declarative asset lifecycle callbacks receive an opaque,
47
+ stable `AssetResourceOwner`. Hoisted updates own the complete canonical host
48
+ update, including text, so a shadowed fiber cannot overwrite registry state.
49
+
50
+ ### Stable client-reference identity across decodes
51
+
52
+ `@bgub/fig/payload` exposes `createPayloadClientReferenceResolver(resolve)`:
53
+ a caller-owned stateful resolver passed as the `resolveClientReference`
54
+ decode option. With one, every resolvable client reference decodes to one
55
+ resolver-owned wrapper per reference id across all decodes sharing the
56
+ resolver — gated, ungated, or asynchronously resolved — so re-decoding a
57
+ payload updates islands in place instead of remounting them. Reveal gates
58
+ ride the decoded element instances rather than the wrapper: each decode
59
+ gates exactly its own content, so a newer decode's pending assets never
60
+ re-suspend an island already on screen, while its new island instances
61
+ still wait for the stylesheets they declared. The caller owns the
62
+ resolver's lifetime; under fast refresh no manual invalidation is needed
63
+ (hot edits remap the latched resolution through component families, and
64
+ unaccepted updates full-reload), while `delete`/`clear` cover manifest
65
+ swaps without a reload. With a plain resolve function, gated and async
66
+ references keep their per-decode wrapper identity, now with the same
67
+ per-element gating.
68
+
69
+ `@bgub/fig-dom`'s `payloadDataLoader` accepts the stateful resolver through
70
+ its existing `resolveClientReference` option.
71
+
72
+ Framework adapters can retain one resolver across refreshes and navigations,
73
+ preventing asset-gated islands from remounting on every re-decode.
74
+
75
+ ### Publish metadata only with its visible owner
76
+
77
+ Title and meta resources now travel through Payload as owner-bound
78
+ declarations and update the document only when their decoded tree commits.
79
+ Pending or superseded refreshes keep the previous metadata visible.
80
+
81
+ Streaming HTML now treats Suspense fallbacks as metadata owners and reconciles
82
+ the completed visible metadata snapshot in the boundary reveal operation.
83
+ Partial segments and failed or abandoned primary work cannot mutate the head.
84
+
85
+ The obsolete `onAssetError` option and its asset-diagnostic types are removed:
86
+ late metadata is delivered with its owner instead of being dropped.
87
+
88
+ ### Keep styles active during document hydration recovery
89
+
90
+ Full-document hydration recovery now reuses the existing `html`, `head`, and
91
+ `body` singletons and clears their contents sparingly. Loaded stylesheet links,
92
+ style elements, and scripts stay connected while mismatched content is rebuilt,
93
+ preventing a flash of unstyled content.
94
+
95
+ Recoverable errors now report to the console when a root does not provide an
96
+ `onRecoverableError` handler, so hydration mismatches are no longer silent.
97
+
98
+ ### Recover full-document Suspense hydration mismatches
99
+
100
+ Full-document hydration now escalates a mismatch inside the document-level
101
+ Suspense boundary to root recovery, preserves the document doctype, and
102
+ rebuilds the document without reusing cleared insertion anchors.
103
+
104
+ ### Make `configureDomRefreshScheduler` internal
105
+
106
+ The `@bgub/fig-dom/refresh` subpath now exports only `scheduleRefresh`
107
+ and the `RefreshFamily`/`RefreshUpdate` types. The wiring setter was
108
+ called by exactly one place — fig-dom's own renderer, as a module side
109
+ effect — and HMR runtimes only ever needed `scheduleRefresh`. The
110
+ before-main-entry update buffering is unchanged and keeps living in a
111
+ single shared module, so pre-evaluation refreshes still replay once the
112
+ renderer configures itself.
113
+
114
+ ### Attach beforetoggle listeners directly
115
+
116
+ `beforetoggle` does not bubble, so `on("beforetoggle", ...)` was attached as a
117
+ delegated root listener and never fired for a popover or a dialog. It now
118
+ attaches to its element like the other non-bubbling events, `toggle` included.
119
+
120
+ ### Preserve stopped propagation on read-only DOM events
121
+
122
+ Logical propagation stops now call the restored native `stopPropagation()`
123
+ method instead of assigning `cancelBubble`, which can be read-only in DOM
124
+ implementations.
125
+
126
+ ### Split fig-dom's oversized modules into focused ones
127
+
128
+ Internal restructuring with no API or behavior change. The host config and
129
+ renderer wiring move out of the package entry into `renderer.ts`; form
130
+ control value/checked/select handling, style application, the `on()` event
131
+ descriptor, and the propagation-state patching each get their own module.
132
+ Event slot attachment state is now a discriminated union instead of four
133
+ nullable fields.
134
+
135
+ ### Serialized components move to the data-resource model
136
+
137
+ Serialized trees are now ordinary data resources: servers return plain
138
+ Payload streams, and clients consume them through keyed `dataResource`
139
+ instances with `payloadDataLoader`. Refresh is `refreshData`, navigation can
140
+ select a new key, and back/forward navigations reuse cached entries. Commits
141
+ wait for the incoming Payload, island modules, and stylesheet gates.
142
+
143
+ Supporting API additions: `payloadDataLoader` accepts a `prepareAssets`
144
+ override (defaults to `insertAssetResources`), and `decodePayloadStream`
145
+ accepts an `onClientReference` observer for reference metadata.
146
+
147
+ ### Diagnose hoisted resource declassification
148
+
149
+ Development now throws when an update would turn a permanently hoisted host
150
+ fiber into an ordinary in-tree element, naming the affected asset and
151
+ explaining that changing placement requires a different Fig element key.
152
+ Production ignores the update instead of mutating a shared delivery asset or
153
+ overwriting the owner's last valid title or metadata claim.
154
+
155
+ ### Compose host behavior with mixins
156
+
157
+ Core now exports `createMixin()` and resolves render-time host behavior through
158
+ the `mix` prop. Mixins may contribute host props or nested mixins while keeping
159
+ the host type and subtree fixed. Explicit host props form the baseline; mixins
160
+ run in authoring order, and later results win.
161
+
162
+ DOM event listeners now use `mix={on(type, callback)}`. Migrate
163
+ `events={[on(type, callback)]}` to `mix={on(type, callback)}`; multiple or
164
+ conditional descriptors move into `mix={[...]}` and preserve positional
165
+ listener identity.
166
+
167
+ ### Keep empty children and document assets hydration-safe
168
+
169
+ Empty string children now normalize away on both the server and client, so a
170
+ rendered empty token cannot force hydration to recover the root.
171
+
172
+ When full-document hydration does recover, declarative stylesheets, titles,
173
+ and metadata now acquire against the replacement head instead of disappearing
174
+ with the server document.
175
+
176
+ ### Keep `useId` stable through selective hydration
177
+
178
+ `useId` now follows one canonical server/hydration tree path through Suspense
179
+ and Activity. Dehydrated boundaries snapshot that path when they claim their
180
+ server marker, then restore it when hydration resumes, so client updates that
181
+ insert or move surrounding siblings cannot renumber ids already present in the
182
+ server HTML. Suspense's private Activity wrapper is transparent to the path.
183
+
184
+ Components mounted only on the client now receive ids from a separate
185
+ `fig-C-*` namespace. Those ids remain stable for the component lifetime and
186
+ cannot collide with ids reserved by server-rendered content that has not
187
+ hydrated yet.
188
+
189
+ ### Initial alpha release
190
+
191
+ First public alpha release of Fig.
192
+
193
+ ### Allow interactive transitions to interrupt native animations
194
+
195
+ `transition()` and the function returned by `useTransition()` now accept
196
+ `viewTransition: "interrupt"`. When another native View Transition is already
197
+ animating, Fig skips it, waits for its cleanup to settle, and immediately
198
+ commits the latest rendered state, starting a new transition when that commit
199
+ has participating boundaries. The default remains serialized so navigations
200
+ and streamed reveals retain uninterrupted motion. Interruptible DOM
201
+ transitions also drop the implicit full-page snapshot so controls outside
202
+ explicit transition surfaces stay live and can express the next intent by
203
+ pointer before the current animation finishes.
204
+
205
+ ### Trim DOM renderer hot-path work
206
+
207
+ The DOM renderer now avoids transient collections while diffing host props,
208
+ updating event descriptors, and scanning document assets. Event routing keeps
209
+ root state in one container record, stores less per-listener metadata, and
210
+ builds dispatch paths in place. Host configuration callbacks whose signatures
211
+ already match now connect directly instead of paying forwarding closures.
212
+
213
+ Controlled single-select elements also keep their scalar value without
214
+ allocating a one-entry `Set`; multi-select values retain set lookup behavior.
215
+ These changes preserve the public API while reducing the production entry
216
+ bundle and allocation pressure during mount, update, dispatch, and teardown.
217
+
218
+ ### Payload exposes rendering and decoding, not its implementation
219
+
220
+ The payload packages now present two primary operations:
221
+ `renderToPayloadStream` on the server and `decodePayloadStream` in the
222
+ browser-safe core entry. Row/model types, value encoding, codec machinery,
223
+ content-type negotiation helpers, and framework document transports are
224
+ internal implementation details.
225
+
226
+ Client references use one `resolveClientReference(reference)` seam that may
227
+ return a component synchronously or asynchronously. It replaces the separate
228
+ load, resolve, and observation callbacks; reference metadata now includes its
229
+ stream-safe assets. The unused `load` field is also removed from
230
+ `clientReference(...)` declarations.
231
+
232
+ `payloadDataLoader` keeps only `request`, `resolveClientReference`, and the
233
+ optional `prepareAssets` override. Payload encoding is fixed internally rather
234
+ than exposed as a speculative custom-codec interface.
235
+
236
+ ### Make DOM View Transitions explicitly optional
237
+
238
+ `enableViewTransitions()` from `@bgub/fig-dom/view-transitions` explicitly
239
+ activates native DOM View Transitions, including after roots exist. Applications
240
+ that omit the optional entry exclude both the reconciler planner and browser
241
+ adapter from their bundles.
242
+
243
+ Renderer authors can install the optional View Transition planner through the
244
+ new single-owner commit-coordinator seam. Coordinator types preserve the host's
245
+ container and instance identities, while a private type-only contract keeps the
246
+ planner's fiber and root views aligned with the reconciler.
247
+
248
+ ### Make Payload trees directly renderable
249
+
250
+ `createPayloadComponent` now creates a props-typed component backed by Fig's
251
+ ordinary data store. Complete props form its cache identity by default through
252
+ a canonical encoding of Payload-compatible values, and the component works
253
+ with route loaders and the existing data-resource freshness APIs and explicit
254
+ store handles.
255
+
256
+ The lower-level `payloadDataLoader` and `PayloadDataLoaderOptions` exports have
257
+ been removed. Use `createPayloadComponent`, or `decodePayloadStream` when
258
+ managing the transport and data integration directly.
259
+
260
+ TanStack Start replaces `payloadResource({ key, render })` with
261
+ `createPayloadComponent({ key, load: serverPayload(render) })`. Its compiler
262
+ can extract a component imported from `.server.tsx`, while initial companion
263
+ streams, client references, and compiled asset dependencies keep their existing
264
+ transport behavior.
265
+
266
+ Payload component loaders receive the resolved resource `key` alongside
267
+ `signal`, so framework transports can register responses under the exact cache
268
+ entry without changing ordinary data loaders.
269
+
270
+ Default keys are canonical across plain-object property order, and Payload
271
+ components use their namespace as their DevTools label. TanStack Start renders
272
+ the supplied component inside the Payload renderer so root-level reads and
273
+ suspension work, and rejects uncompiled `serverPayload` calls before invoking
274
+ application code.
275
+
276
+ Payload rendering also rejects nesting one Payload component inside another in
277
+ development. Payload components are client-visible delivery boundaries;
278
+ compose ordinary server components inside them or mount separate Payload
279
+ components from the client tree to preserve independent refresh keys.
280
+
281
+ ### Generation-lifetime loader signals and `payloadDataLoader`
282
+
283
+ Data-resource loader signals now live as long as their load's generation,
284
+ not just the pending promise: the `{ signal }` a loader receives stays
285
+ unaborted after the value lands and aborts when the generation loses
286
+ authority — a newer load supersedes it, a server push hydrates over it, the
287
+ entry evicts, or the store is disposed. A rejected load's own signal aborts
288
+ on settlement, and `invalidateData` never aborts (marking stale does not
289
+ revoke authority). Loaders that stream into their value in the background —
290
+ payload decodes filling holes — tie that work to the signal; plain fetch
291
+ loaders are unaffected.
292
+
293
+ The load context also carries an internal, generation-guarded hydration
294
+ capability (symbol-keyed; read through `@bgub/fig/internal`) that hydrates
295
+ server-pushed `data` rows through the calling store only while the load is
296
+ authoritative, skipping rows that target the loading entry's own key.
297
+
298
+ New in `@bgub/fig-dom`: `payloadDataLoader({ request,
299
+ resolveClientReference?, prepareAssets? })` adapts a payload-stream
300
+ endpoint into an ordinary data-resource loader. It validates the response
301
+ (status, body, payload codec content-type; unusable bodies are cancelled),
302
+ wires `decodePayloadStream` to the generation-lifetime signal, hydrates
303
+ `data` rows through the store capability, inserts stream-discovered assets
304
+ with `insertAssetResources` (stylesheet gates delay only dependent reveal),
305
+ and resolves with the decoded root value — so `readData(postResource, slug)`
306
+ suspends like any read and returns renderable elements while streamed holes
307
+ keep filling in the background.
308
+
309
+ ### Move `createPortalNode` to `@bgub/fig/internal`
310
+
311
+ `createPortalNode` is the cross-package seam renderers wrap in their
312
+ container-typed `createPortal`; apps never call it directly. It now lives
313
+ on the internal entry with the other renderer protocol exports instead of
314
+ the app-facing main entry. Portal-creating apps keep using
315
+ `createPortal(children, container, key?)` from `@bgub/fig-dom`; the
316
+ `FigPortal` type stays on the main entry because it appears in public
317
+ signatures.
318
+
319
+ ### Promise-shaped payload decoder
320
+
321
+ `decodePayloadStream` now returns `Promise<FigNode>` directly — the root
322
+ value promise — instead of a `PayloadDecode` handle. Cancellation is
323
+ signal-only (`options.signal`, unchanged); the redundant `abort()` method is
324
+ gone. The `completion` promise is replaced by an `onStreamDone(result)`
325
+ decode option, called exactly once when ingestion settles as `complete`,
326
+ `failed`, or `aborted` — post-root failures that strand no pending hole
327
+ remain observable there. The callback is never awaited and its exceptions
328
+ and rejections are swallowed, so an observer — sync or async — cannot break
329
+ decode teardown or leak an unhandled rejection. The
330
+ `PayloadDecode` interface and its non-thenable caveat are deleted;
331
+ `PayloadDecodeCompletion` remains as the callback's result type.
332
+
333
+ `@bgub/fig-dom`'s `payloadDataLoader` migrates internally; its public API is
334
+ unchanged.
335
+
336
+ Also considered and declined: narrowing `ResolveClientReference` to an
337
+ opaque id. The reference's `exportName`/`ssr`/`assets` mirror the `client`
338
+ row's wire fields and are all load-bearing in framework document pipelines;
339
+ the rationale is recorded in `docs/concepts/payload.md`.
340
+
341
+ ### Promise-valued children render through Suspense
342
+
343
+ `FigNode` now accepts promises of nodes. Promise children occupy distinct,
344
+ host-transparent child slots, suspend through the nearest `Suspense`, and route
345
+ rejections or invalid resolved children through normal error handling.
346
+
347
+ HTML rendering retains exact promise children as independent streaming tasks,
348
+ while Payload uses node-validated promise rows that decode to the same child
349
+ shape. Payload-rendered async components are invoked once and retain their
350
+ component-scoped assets on the outlined row.
351
+
352
+ ### Tighten public component, loader, asset, and bind signatures
353
+
354
+ `@bgub/fig` now names the shared data loader contract as
355
+ `DataResourceLoader`, constrains lazy loaders to components, and exposes
356
+ `ComponentProps` so lazy wrappers preserve the loaded component's props
357
+ without exposing its implementation statics. Client-reference SSR
358
+ implementations stay aligned with the reference's props. Stable-event typing
359
+ now models the trailing lifecycle signal separately from caller arguments.
360
+
361
+ `meta()` descriptors now require exactly one valid metadata identity:
362
+ `charset`, `name` plus `content`, `property` plus `content`, or `http-equiv`
363
+ plus `content`. Raw meta elements that do not satisfy the same shape remain
364
+ ordinary host elements instead of entering the asset registry.
365
+
366
+ `@bgub/fig-dom` payload requests now receive the standard
367
+ `DataResourceLoadContext`, portals retain their DOM container type in the
368
+ returned `FigPortal`, and bind callbacks must return `undefined`; cleanup is
369
+ exclusively driven by their `AbortSignal`.
370
+
371
+ ### Move `act` to `@bgub/fig-reconciler/test-utils`
372
+
373
+ `act` is testing infrastructure, not renderer construction, so it moves
374
+ off the main entry onto a `./test-utils` subpath — the same shape as
375
+ `@bgub/fig-dom/test-utils`. DOM tests keep importing `act` from
376
+ `@bgub/fig-dom/test-utils`; renderer tests now import it from
377
+ `@bgub/fig-reconciler/test-utils`. Behavior is unchanged; the subpath
378
+ shares the scheduler instance with the main entry.
379
+
380
+ ### Reduce asset serialization allocations
381
+
382
+ Asset resources now build their canonical host props directly. Server rendering
383
+ fills its owned props object in place instead of creating attribute tuples,
384
+ filtering them, converting them with `Object.fromEntries`, and cloning again to
385
+ append a nonce. Client insertion uses the same canonical props without changing
386
+ the generated elements or server HTML.
387
+
388
+ ### Attribute rejected payload holes to their data resource
389
+
390
+ Payload hole errors are attributed to the authoritative owning data-resource
391
+ generation. Error boundaries receive `dataResourceKeys`, and
392
+ `invalidateDataError` retires the broken fulfilled value before retrying so a
393
+ remounted boundary suspends on fresh content instead of immediately catching
394
+ the same rejected hole. `decodePayloadStream` also exposes an observational
395
+ `onHoleError` callback.
396
+
397
+ The load context's hydration capability now shares the same authority window:
398
+ a still-visible generation's `data` rows keep hydrating through a superseding
399
+ refresh's window instead of being dropped the moment the refresh starts.
400
+
401
+ ### Renderers now install their reconciler implementation
402
+
403
+ Fig DOM and Fast Refresh now depend on their exact reconciler version directly.
404
+ Applications no longer need to install `@bgub/fig-reconciler` alongside Fig DOM;
405
+ the reconciler remains a direct dependency only for custom-renderer authors.
406
+
407
+ Fast Refresh connects to Fig DOM through a renderer-owned adapter, ensuring its
408
+ family resolver and scheduled updates always reach the same reconciler instance
409
+ even when development tooling resolves through a separate package graph.
410
+
411
+ ### Avoid false selected-option hydration warnings
412
+
413
+ Hydrating a select now recognizes the `selected` attributes synthesized by
414
+ server rendering from the select's value. Genuine mismatched selected options
415
+ still produce a development warning, and uncontrolled selects continue to
416
+ preserve user changes made before hydration.
417
+
418
+ ### Fix first-load styling and development client navigation
419
+
420
+ Keep TanStack Start's compiler-sensitive client modules out of Vite dependency
421
+ prebundling so client navigation uses the client server-function transport
422
+ instead of executing server-only context access in the browser. Preserve
423
+ browser-extension roots appended to document singletons during hydration so a
424
+ third-party node cannot trigger document replacement and remove stylesheets.
425
+
426
+ ### Preserve framework-managed asset placement
427
+
428
+ Framework adapters can now keep externally managed head and body tags in their
429
+ declared positions without exposing a DOM prop. TanStack Router uses this for
430
+ route-managed links, styles, and scripts while continuing to map title and meta
431
+ entries through Fig asset resources. Full-document hydration now ignores the
432
+ doctype and one shared marker identifies every server-owned node without a
433
+ client fiber. Declarative asset lists also gain a client commit lifecycle, so
434
+ route titles and metadata update during navigation.
435
+
436
+ ### Add Payload routes to the TanStack Start adapter
437
+
438
+ `@bgub/fig-tanstack-start/payload` now exposes `payloadResource`, which compiles
439
+ an inline render callback into a private server function and Fig-owned route
440
+ data resource. Applications supply the cache key and component tree without
441
+ authoring transport plumbing. The shared declaration can stay in one
442
+ `.payload.tsx` module; its render callback and render-only imports are omitted
443
+ from the browser build. The initial SSR response is embedded into the document
444
+ and adopted without refetching; client navigation and refresh use the same
445
+ resource request path. Payload data rows
446
+ hydrate the shared store, asset resources are retained on their owning server
447
+ segments or inserted through the browser registry, and client references retain
448
+ their resolver-defined identity. `decodePayloadStream` and `payloadDataLoader`
449
+ now expose `retainAssets` for server document renderers that need this delivery
450
+ path.
451
+
452
+ `@bgub/fig-tanstack-start/server` exposes the lower-level
453
+ `renderPayloadResponse` used by the generated TanStack server function; it
454
+ defaults its render abort signal to the incoming request, so a disconnected
455
+ client cancels the Payload render. Shell
456
+ HTML streams while outlined Suspense holes settle, and the completed initial
457
+ responses are embedded before TanStack starts full-document hydration. The Vite
458
+ adapter also publishes assets imported only by server modules into the client
459
+ build output. Fig Router links also consume TanStack's `viewTransition`
460
+ navigation option without forwarding it as an invalid attribute to the rendered
461
+ anchor, and derive active state from the resolved route instead of an in-flight
462
+ location.
463
+
464
+ ### Add the TanStack Start runtime adapter
465
+
466
+ `createDataStore` now creates a root-neutral Fig store that route loaders can
467
+ populate before a renderer exists. Server and client renderers adopt that exact
468
+ store, preserving one cache while attaching their lifecycle and scheduling.
469
+
470
+ The new TanStack Start runtime uses the store for route loading, server
471
+ rendering, Fig-owned document serialization, client deserialization, and
472
+ hydration. Route-managed head and script output maps through the Router adapter,
473
+ including Fig asset resources. The end-to-end contract verifies no initial
474
+ client refetch and exactly one reload after invalidation.
475
+
476
+ ### Share the text-separator protocol constant; small DOM cleanups
477
+
478
+ The `<!--,-->` text-separator comment the server writes between adjacent text
479
+ fibers was hardcoded independently by the server renderer and fig-dom's
480
+ hydration cursor. The comment data now lives in `@bgub/fig/internal` as
481
+ `TEXT_SEPARATOR_DATA`, next to the other streaming protocol constants, so the
482
+ two sides cannot drift. No wire change — the emitted markup is identical.
483
+
484
+ fig-dom also drops an unused internal `rootFor` helper, routes style clearing
485
+ through the shared `isEmptyPropValue` predicate, and simplifies a redundant
486
+ branch in select-value syncing. No behavior change.
487
+
488
+ ### Add typed View Transition scopes and abortable lifecycle events
489
+
490
+ `transition` and the `useTransition` starter now accept explicit transition
491
+ types, which Fig carries with the updates that reach each root and forwards to
492
+ the browser without leaking into unrelated commits.
493
+
494
+ `ViewTransition` adds one `onTransition(event, signal)` lifecycle callback for
495
+ enter, exit, share, and update phases. Events expose all participating surfaces
496
+ and the commit's transition types. Fig DOM's optional View Transition entry can
497
+ resolve those opaque surfaces into group, image-pair, old, and new pseudo
498
+ handles for animation and inspection; the signal aborts when the native
499
+ transition finishes.
500
+
501
+ ### Bound stalled view-transition waits
502
+
503
+ Transition-eligible commits and annotated streaming reveals now wait at most 60
504
+ seconds for a previous browser View Transition. If its completion promise never
505
+ settles, Fig releases the document mutex and proceeds with the latest work
506
+ instead of parking it forever.
507
+
508
+ ### Let Fig's Vite integration own runtime configuration
509
+
510
+ The new `fig()` Vite integration defines Fig's development gate and installs
511
+ Fast Refresh. TanStack Start composes it automatically, so applications no
512
+ longer need to configure Fig's compile-time mode or SSR package bundling
513
+ themselves.
514
+
515
+ `@bgub/fig-vite` now uses the application's Fig DOM renderer as a peer instead
516
+ of installing a private renderer copy.
517
+
518
+ The development gate follows Vite's command rather than its mode: serving
519
+ enables development behavior, while builds—including `--mode development`—strip
520
+ it from production output.
521
+
522
+ Published npm packages now expose development artifacts through a Fig-owned
523
+ condition, allowing the Vite integration to enable diagnostics and Fast Refresh
524
+ for ordinary installs while explicit static overrides remain authoritative and
525
+ default production imports retain their previous dead-code elimination. A
526
+ static `false` override also disables Fast Refresh instrumentation.
527
+
1
528
  ## @bgub/fig-dom@0.1.0-alpha.7
2
529
 
3
530
  ### Attach beforetoggle listeners directly
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- import { a as Bind, i as HostStyle, n as EmptyPropValue, o as composeBind, r as HostProps, t as HostIntrinsicElements } from "./jsx-C3owhMDw.js";
1
+ import { a as Bind, i as HostStyle, n as EmptyPropValue, o as composeBind, r as HostProps, t as HostIntrinsicElements } from "./jsx-It_Mpx4I.js";
2
2
  import { AwaitedFigNode, DataResource, DataResourceKey, DataResourceKeyInput, FigAssetResource, FigNode, FigPortal, Key, MixinDescriptor } from "@bgub/fig";
3
3
  import { FigRoot, FigRootOptions, RecoverableErrorInfo } from "@bgub/fig-reconciler";
4
4
  import { PayloadDecodeOptions } from "@bgub/fig/payload";
5
5
  //#region src/event-descriptor.d.ts
6
+ /** Describes event options. */
6
7
  type EventOptions = Pick<AddEventListenerOptions, "capture" | "passive">;
8
+ /** Describes event callback. */
7
9
  type EventCallback<E extends Event = Event> = (event: E, signal: AbortSignal) => void;
8
10
  /**
9
11
  * Declares one native listener for an element's `mix` prop. Bubbling
@@ -11,9 +13,11 @@ type EventCallback<E extends Event = Event> = (event: E, signal: AbortSignal) =>
11
13
  * including `focus` and `blur`, attach directly with native semantics.
12
14
  */
13
15
  declare function on<K extends keyof HTMLElementEventMap>(type: K, callback: EventCallback<HTMLElementEventMap[K]>, options?: EventOptions): MixinDescriptor;
16
+ /** On. */
14
17
  declare function on<E extends Event = Event>(type: string, callback: EventCallback<E>, options?: EventOptions): MixinDescriptor;
15
18
  //#endregion
16
19
  //#region src/events.d.ts
20
+ /** Describes container. */
17
21
  type Container = Document | DocumentFragment | Element;
18
22
  //#endregion
19
23
  //#region src/asset-resources.d.ts
@@ -28,22 +32,27 @@ declare function insertAssetResources(resources: readonly FigAssetResource[]): P
28
32
  type PayloadDecoderOptions = Pick<PayloadDecodeOptions, "prepareAssets" | "resolveClientReference" | "retainAssets">;
29
33
  //#endregion
30
34
  //#region src/payload-component.d.ts
35
+ /** Describes payload source. */
31
36
  type PayloadSource = Response | {
32
37
  contentType: string;
33
38
  stream: ReadableStream<Uint8Array>;
34
39
  };
40
+ /** Describes payload component load context. */
35
41
  interface PayloadComponentLoadContext {
36
42
  key: DataResourceKey;
37
43
  signal: AbortSignal;
38
44
  }
45
+ /** Describes payload component loader. */
39
46
  interface PayloadComponentLoader<TProps extends object> extends PayloadDecoderOptions {
40
47
  (props: TProps, context: PayloadComponentLoadContext): PayloadSource | PromiseLike<PayloadSource>;
41
48
  }
49
+ /** Describes payload component options. */
42
50
  interface PayloadComponentOptions<TProps extends object> extends PayloadDecoderOptions {
43
51
  cacheKey?: (props: TProps) => DataResourceKeyInput;
44
52
  key: DataResourceKey;
45
53
  load: PayloadComponentLoader<TProps>;
46
54
  }
55
+ /** Describes payload component. */
47
56
  interface PayloadComponent<TProps extends object> extends DataResource<[TProps], AwaitedFigNode> {
48
57
  (props: TProps & {
49
58
  children?: FigNode;
@@ -55,9 +64,13 @@ interface PayloadComponent<TProps extends object> extends DataResource<[TProps],
55
64
  declare function createPayloadComponent<TProps extends object>(options: PayloadComponentOptions<TProps>): PayloadComponent<TProps>;
56
65
  //#endregion
57
66
  //#region src/index.d.ts
67
+ /** The flush sync. */
58
68
  declare const flushSync: <T>(this: void, callback: () => T) => T;
69
+ /** Creates root. */
59
70
  declare function createRoot(container: Container, options?: FigRootOptions): FigRoot;
71
+ /** Hydrates root. */
60
72
  declare function hydrateRoot(container: Container, children: FigNode, options?: FigRootOptions): FigRoot;
73
+ /** Creates portal. */
61
74
  declare function createPortal(children: FigNode, container: Container, key?: Key | null): FigPortal<Container>;
62
75
  //#endregion
63
76
  export { type Bind, type Container, type EmptyPropValue, type EventCallback, type EventOptions, type FigRoot, type FigRootOptions, type HostIntrinsicElements, type HostProps, type HostStyle, type PayloadComponent, type PayloadComponentLoadContext, type PayloadComponentLoader, type PayloadComponentOptions, type PayloadSource, type RecoverableErrorInfo, composeBind, createPayloadComponent, createPortal, createRoot, flushSync, hydrateRoot, insertAssetResources, on };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./renderer-DBahcxuV.js";import{assertPayloadCodecMatches as o,createPortalNode as s,jsonPayloadCodec as c,loadContextCapabilities as l}from"@bgub/fig/internal";import{dataResource as u,readData as d}from"@bgub/fig";import{decodePayloadStream as f}from"@bgub/fig/payload";const p=()=>void 0;async function m(e,t,r={}){let{signal:i}=t;if(i.aborted)throw await e.body?.cancel().catch(p),h(i);if(!e.ok)throw await e.body?.cancel().catch(p),Error(`Payload request failed with status ${e.status}.`);let a=e.body;if(a===null)throw Error(`Payload response did not include a body.`);try{o(c,e.headers.get(`content-type`))}catch(e){throw await a.cancel().catch(p),e}let s=l(t);return f(a,{hydrate:s?.hydrate,onHoleError:s?.attributeError,onStreamDone:e=>{},prepareAssets:r.prepareAssets??(e=>n(e)),retainAssets:r.retainAssets,resolveClientReference:r.resolveClientReference,signal:i})}function h(e){return e.reason??Error(`Payload request aborted.`)}function g(e){let t=new WeakMap,n=1;function r(e){if(e===null)return null;if(e===void 0)return[`undefined`];if(typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`)return Number.isNaN(e)?[`number`,`NaN`]:e===1/0?[`number`,`Infinity`]:e===-1/0?[`number`,`-Infinity`]:Object.is(e,-0)?[`number`,`-0`]:e;if(typeof e==`bigint`)return[`bigint`,e.toString()];if(typeof e==`symbol`){let t=Symbol.keyFor(e);if(t===void 0)throw Error(`Only global Symbol.for symbols can be serialized.`);return[`symbol`,t]}if(typeof e==`function`)throw Error(`Functions cannot be serialized into the payload.`);if(e instanceof Date){let t=e.toJSON();if(t===null)throw Error(`Invalid Date values cannot be serialized.`);return[`date`,t]}let i=t.get(e);if(i!==void 0)return[`ref`,i];let a=n++;if(t.set(e,a),Array.isArray(e))return[`array`,a,e.map(r)];if(e instanceof Map)return[`map`,a,Array.from(e,([e,t])=>[r(e),r(t)])];if(e instanceof Set)return[`set`,a,Array.from(e,r)];let o=Object.getPrototypeOf(e);if(o!==Object.prototype&&o!==null)throw Error(`Cannot serialize ${o?.constructor?.name??`object`} into the payload.`);let s=e;return[`object`,a,Object.keys(s).sort().map(e=>[e,r(s[e])])]}return r(e)}function _(e){let t=t=>{let n=v(t);return[...e.key,e.cacheKey===void 0?n:e.cacheKey(t)]},n=u({debugArgs:e.cacheKey===void 0?void 0:v,key:t,load:async(n,r)=>{let i=await e.load(n,{key:l(r)?.key??t(n),signal:r.signal});return m(i instanceof Response?i:new Response(i.stream,{headers:{"content-type":i.contentType}}),r,{prepareAssets:e.prepareAssets??e.load.prepareAssets,resolveClientReference:e.resolveClientReference??e.load.resolveClientReference,retainAssets:e.retainAssets??e.load.retainAssets})}}),r=Object.assign(function(e){return y(e),d(r,e)},n);return Object.defineProperty(r,"displayName",{configurable:!0,value:`Payload(${e.key[0]})`}),r}function v(e){return y(e),g(e)}function y(e){if(Object.hasOwn(e,`children`))throw Error(`Payload components do not accept children.`)}const b=a.flushSync;function x(e,t){let n=a.createRoot(e,t);return i(e,{run:e=>n.data.run(e)}),w(n,e)}function S(e,t,n){let r=a.hydrateRoot(e,t,n);return i(e,{hydrate:(t,n)=>a.hydrateTarget(e,t,n),run:e=>r.data.run(e)}),w(r,e)}function C(e,t,n=null){return s(e,t,n)}function w(e,n){return{...e,unmount:()=>{e.unmount(),t(n)}}}export{r as composeBind,_ as createPayloadComponent,C as createPortal,x as createRoot,b as flushSync,S as hydrateRoot,n as insertAssetResources,e as on};
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./renderer-jfUYsG5x.js";import{assertPayloadCodecMatches as o,createPortalNode as s,jsonPayloadCodec as c,loadContextCapabilities as l}from"@bgub/fig/internal";import{dataResource as u,readData as d}from"@bgub/fig";import{decodePayloadStream as f}from"@bgub/fig/payload";const p=()=>void 0;async function m(e,t,r={}){let{signal:i}=t;if(i.aborted)throw await e.body?.cancel().catch(p),h(i);if(!e.ok)throw await e.body?.cancel().catch(p),Error(`Payload request failed with status ${e.status}.`);let a=e.body;if(a===null)throw Error(`Payload response did not include a body.`);try{o(c,e.headers.get(`content-type`))}catch(e){throw await a.cancel().catch(p),e}let s=l(t);return f(a,{hydrate:s?.hydrate,onHoleError:s?.attributeError,onStreamDone:e=>{},prepareAssets:r.prepareAssets??(e=>n(e)),retainAssets:r.retainAssets,resolveClientReference:r.resolveClientReference,signal:i})}function h(e){return e.reason??Error(`Payload request aborted.`)}function g(e){let t=new WeakMap,n=1;function r(e){if(e===null)return null;if(e===void 0)return[`undefined`];if(typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`)return Number.isNaN(e)?[`number`,`NaN`]:e===1/0?[`number`,`Infinity`]:e===-1/0?[`number`,`-Infinity`]:Object.is(e,-0)?[`number`,`-0`]:e;if(typeof e==`bigint`)return[`bigint`,e.toString()];if(typeof e==`symbol`){let t=Symbol.keyFor(e);if(t===void 0)throw Error(`Only global Symbol.for symbols can be serialized.`);return[`symbol`,t]}if(typeof e==`function`)throw Error(`Functions cannot be serialized into the payload.`);if(e instanceof Date){let t=e.toJSON();if(t===null)throw Error(`Invalid Date values cannot be serialized.`);return[`date`,t]}let i=t.get(e);if(i!==void 0)return[`ref`,i];let a=n++;if(t.set(e,a),Array.isArray(e))return[`array`,a,e.map(r)];if(e instanceof Map)return[`map`,a,Array.from(e,([e,t])=>[r(e),r(t)])];if(e instanceof Set)return[`set`,a,Array.from(e,r)];let o=Object.getPrototypeOf(e);if(o!==Object.prototype&&o!==null)throw Error(`Cannot serialize ${o?.constructor?.name??`object`} into the payload.`);let s=e;return[`object`,a,Object.keys(s).sort().map(e=>[e,r(s[e])])]}return r(e)}function _(e){let t=t=>{let n=v(t);return[...e.key,e.cacheKey===void 0?n:e.cacheKey(t)]},n=u({debugArgs:e.cacheKey===void 0?void 0:v,key:t,load:async(n,r)=>{let i=await e.load(n,{key:l(r)?.key??t(n),signal:r.signal});return m(i instanceof Response?i:new Response(i.stream,{headers:{"content-type":i.contentType}}),r,{prepareAssets:e.prepareAssets??e.load.prepareAssets,resolveClientReference:e.resolveClientReference??e.load.resolveClientReference,retainAssets:e.retainAssets??e.load.retainAssets})}}),r=Object.assign(function(e){return y(e),d(r,e)},n);return Object.defineProperty(r,"displayName",{configurable:!0,value:`Payload(${e.key[0]})`}),r}function v(e){return y(e),g(e)}function y(e){if(Object.hasOwn(e,`children`))throw Error(`Payload components do not accept children.`)}const b=a.flushSync;function x(e,t){let n=a.createRoot(e,t);return i(e,{run:e=>n.data.run(e)}),w(n,e)}function S(e,t,n){let r=a.hydrateRoot(e,t,n);return i(e,{hydrate:(t,n)=>a.hydrateTarget(e,t,n),run:e=>r.data.run(e)}),w(r,e)}function C(e,t,n=null){return s(e,t,n)}function w(e,n){return{...e,unmount:()=>{e.unmount(),t(n)}}}export{r as composeBind,_ as createPayloadComponent,C as createPortal,x as createRoot,b as flushSync,S as hydrateRoot,n as insertAssetResources,e as on};
2
2
  //# sourceMappingURL=index.js.map