@bgub/fig 2.0.0 → 2.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 (39) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +21 -22
  3. package/dist/{element-B4LrR2ZB.d.ts → element-DT9ziqWN.d.ts} +43 -14
  4. package/dist/{element-j7AKp0nu.js → element-DpXdLgOZ.js} +6 -68
  5. package/dist/element-DpXdLgOZ.js.map +1 -0
  6. package/dist/{hooks-QSWYd3Vl.d.ts → hooks-GeZ4mX7W.d.ts} +13 -19
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.js +4 -4
  9. package/dist/internal.d.ts +7 -9
  10. package/dist/internal.js +8 -4
  11. package/dist/internal.js.map +1 -1
  12. package/dist/jsx-runtime.d.ts +1 -1
  13. package/dist/jsx-runtime.js +1 -1
  14. package/dist/payload-format-B9UbNtxo.js.map +1 -1
  15. package/dist/payload.d.ts +1 -1
  16. package/dist/payload.js +2 -2
  17. package/{dist-development/resource-YO25HR7G.js → dist/resource-DEDmLSNk.js} +5 -18
  18. package/dist/resource-DEDmLSNk.js.map +1 -0
  19. package/dist/{transition-DJfG2ZSm.js → transition-BFLGYE4q.js} +366 -79
  20. package/dist/transition-BFLGYE4q.js.map +1 -0
  21. package/dist-development/{element-DzmNF67v.js → element-DbzJUf5a.js} +6 -68
  22. package/dist-development/element-DbzJUf5a.js.map +1 -0
  23. package/dist-development/index.js +4 -4
  24. package/dist-development/internal.js +8 -4
  25. package/dist-development/internal.js.map +1 -1
  26. package/dist-development/jsx-runtime.js +1 -1
  27. package/dist-development/payload-format-B9UbNtxo.js.map +1 -1
  28. package/dist-development/payload.js +2 -2
  29. package/{dist/resource-Lwjz_b4h.js → dist-development/resource-BZOBllE_.js} +5 -18
  30. package/dist-development/resource-BZOBllE_.js.map +1 -0
  31. package/dist-development/{transition-CrIF0Kz_.js → transition-CWjp9qRO.js} +363 -78
  32. package/dist-development/transition-CWjp9qRO.js.map +1 -0
  33. package/package.json +1 -1
  34. package/dist/element-j7AKp0nu.js.map +0 -1
  35. package/dist/resource-Lwjz_b4h.js.map +0 -1
  36. package/dist/transition-DJfG2ZSm.js.map +0 -1
  37. package/dist-development/element-DzmNF67v.js.map +0 -1
  38. package/dist-development/resource-YO25HR7G.js.map +0 -1
  39. package/dist-development/transition-CrIF0Kz_.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,89 @@
1
+ ## @bgub/fig@2.1.0
2
+
3
+ ### Add intentional browser-only rendering
4
+
5
+ Components can call `readBrowser(reason?)` to leave their nearest server-rendered
6
+ Suspense boundary in its fallback state and render normally during hydration.
7
+ Server renderers can observe these intentional fallbacks through
8
+ `onBrowserBailout` without treating them as server or recoverable errors.
9
+
10
+ ### Preserve data read handoffs and settle comparison failures
11
+
12
+ Keep pending loader-backed data entries alive when a replacement Suspense boundary takes over their reads, without cancelling loads needed by suspended transitions. Handle equality-comparator exceptions as load failures so synchronous and asynchronous refreshes settle with a rejected outcome while preserving the previous value.
13
+
14
+ ### Require explicit data store handles
15
+
16
+ Remove the ambient `preloadData`, `ensureData`, `refreshData`, `invalidateData`, `invalidateDataKey`, `invalidateDataPrefix`, and `invalidateDataError` exports. Capture `const data = readDataStore()` during render or another synchronous Fig callback, then call the corresponding methods on `data` before or after awaits. Outside Fig, use `root.data`, route `context.data`, or a pre-created store. `readData()` remains the render-only read API.
17
+
18
+ Remove preloading from the internal render-dispatcher protocol. Store methods preserve existing loading, retention, invalidation, and refresh behavior. After an await, use a transition's `update` callback when transition priority is required.
19
+
20
+ ### Preserve asynchronous data failure state
21
+
22
+ Prevent automatic refresh loops when a data loader rejects with an undefined reason. Cache failures thrown while subscribing to a thenable, and preserve its first settlement across duplicate callbacks or subsequent throws.
23
+
24
+ ### Retain data reads through speculative renders
25
+
26
+ Hold data entries for every render read, not only reads of pending loads.
27
+ Committing a render swaps the hold for a subscription; discarding one releases
28
+ it and re-arms inactive cleanup, and a suspended subtree's Suspense boundary
29
+ holds every key its content read until it reveals. Abandoned renders no longer
30
+ leave entries cached indefinitely, and parked or suspended renders keep their
31
+ values, including hydrate-only ones, without reloading.
32
+
33
+ ### Preserve data lifetimes during reentrant cancellation
34
+
35
+ Make data load replacement and retirement safe when abort listeners synchronously start new work. Refresh, rejection, hydration, eviction, and attributed-error invalidation preserve successor values, signals, and pending results. Skip loaders superseded before invocation and stop hydration batches after store disposal. Treat throwing thenable accessors as normal loader failures.
36
+
37
+ ### Remove redundant data store partitions
38
+
39
+ Remove `partition` from `createDataStore` and `dataPartition` from client and server renderer options. Each store already owns an isolated cache, so the fixed key prefix provided no additional isolation. Remove these options from callers; include tenant identity in resource keys when one store holds data for multiple tenants. SSR hydration entries remain unchanged.
40
+
41
+ ### Simplify font assets and binding types
42
+
43
+ Make `font()` shorthand for a font `PreloadResource`, preserving its anonymous cross-origin default. Remove `FontResource` and the separate `font` descriptor and Payload asset kind; use `preload` with `as: "font"` instead. Update clients and servers together when using Payload.
44
+
45
+ Remove the redundant `BindCallback` type alias. Use `Bind` for callbacks and `Binding` for the full bind-prop representation.
46
+
47
+ ### Stop hydration batches when their generation retires
48
+
49
+ Stop applying a loader's hydration batch if an entry's abort listener retires
50
+ the delivering generation. Remaining Payload data entries can no longer
51
+ overwrite data published by its successor.
52
+
53
+ ### Stream Suspense boundary data ahead of each reveal
54
+
55
+ Server stream renders now send the data each Suspense boundary read in a `d`
56
+ operation right before that boundary's reveal, and `hydrateRoot` applies it to
57
+ the root's store. Late boundaries hydrate from server data instead of
58
+ reloading in the browser. Streamed rows fill only entries the client has no
59
+ value for. Disable with `streamData: false` or exclude entries with
60
+ `streamData: { filter }`.
61
+
62
+ `takeData()` on stream results returns the settled entries that have not been
63
+ streamed, so documents can place the shell's snapshot before the client
64
+ bootstrap without duplicating later rows.
65
+
66
+ The TanStack Start transport no longer waits for every boundary before the
67
+ router bootstrap. It uses the renderer's streamed rows, streams initial
68
+ Payload responses ahead of the boundaries that render them, and lets Router's
69
+ deferred data interleave with streamed boundaries.
70
+
71
+ ### Unify data entry retention ownership
72
+
73
+ Simplify internal data retention bookkeeping by tracking pending callers, dependent generations, and speculative reads in one lazily allocated owner set, preserving existing cancellation and subscription lifetimes.
74
+
75
+ ### Add watched data resources and dependent data handles
76
+
77
+ Add watched data resources. A resource's optional `watch(...args, context)` pushes values into its entry while a committed reader exists, through `publish`, `fail`, `refresh` (which now resolves with its `DataRefreshResult`), and `invalidate`. A resource with `watch` and no `load` is push-only: its first read suspends until the first publish, and the render or Suspense fallback waiting on it holds the watch open with no time limit. Watches never run on the server and start only after the hydration commit, so hydration always renders the hydrated value.
78
+
79
+ Load and watch contexts now include `data`, the store running them. `data.ensureData` keeps the ensured entry cached (and a push-only dependency's watch running) while the dependent load's value or watch is live, and a retired dependent's pending wait rejects with its signal's reason. Code that calls a resource's `load` directly, such as an HTTP endpoint or a test, must now pass `data`, for example a `createDataStore()` it disposes afterwards.
80
+
81
+ Add the `equals` resource option, defaulting to `Object.is`: a load, refresh, or publish equal to the visible value keeps that value, its identity, and its generation, re-renders nothing, and still clears staleness and refresh errors. Previously an identical value re-rendered every reader. Add the per-resource `inactiveRetentionMs` option, overriding the store's inactive retention for that resource's entries.
82
+
83
+ In the reconciler, a capturing Suspense boundary now takes over the data reads its suspended content was waiting on and subscribes to them with its fallback, and render attempts release discarded read sets to the store. Unmounting a waiting fallback therefore also stops an abandoned value-less load. Client root hosts set `watchSources`; server stores never start watches.
84
+
85
+ Dependency reads from retired loads or watches reject before creating cache entries.
86
+
1
87
  ## @bgub/fig@2.0.0
2
88
 
3
89
  ### Catch data changes before subscription commit
package/README.md CHANGED
@@ -162,7 +162,7 @@ bundles that never define a resource never ship it.
162
162
  ```tsx
163
163
  import { Suspense } from "@bgub/fig";
164
164
  import { createRoot, on } from "@bgub/fig-dom";
165
- import { dataResource, readData, refreshData } from "@bgub/fig";
165
+ import { dataResource, readData, readDataStore } from "@bgub/fig";
166
166
 
167
167
  const userResource = dataResource({
168
168
  key: (id: string) => ["user", id],
@@ -173,10 +173,11 @@ const userResource = dataResource({
173
173
  });
174
174
 
175
175
  function Profile({ id }: { id: string }) {
176
+ const data = readDataStore();
176
177
  const user = readData(userResource, id);
177
178
 
178
179
  return (
179
- <button mix={on("click", () => void refreshData(userResource, id))}>
180
+ <button mix={on("click", () => void data.refreshData(userResource, id))}>
180
181
  {user.name}
181
182
  </button>
182
183
  );
@@ -213,27 +214,27 @@ DevTools.
213
214
 
214
215
  ### Refresh And Invalidate
215
216
 
216
- `invalidateData(resource, ...args)` marks an existing entry stale. If the key is
217
+ `data.invalidateData(resource, ...args)` marks an existing entry stale. If the key is
217
218
  currently observed, Fig schedules the readers; the next read keeps showing the
218
219
  last fulfilled value and starts a background reload. If nobody is observing the
219
220
  key, invalidation is lazy and does not fetch.
220
221
 
221
- `invalidateDataKey(key)` applies the same stale/reset semantics to one exact
222
- structured key. `invalidateDataError(error)` invalidates every exact key Fig
222
+ `data.invalidateDataKey(key)` applies the same stale/reset semantics to one exact
223
+ structured key. `data.invalidateDataError(error)` invalidates every exact key Fig
223
224
  attributed to a caught data error and returns whether any data keys were found.
224
225
  Use it from an `ErrorBoundary` fallback before remounting or resetting the
225
226
  boundary.
226
227
 
227
- `invalidateDataPrefix(prefix)` marks every existing entry whose structured key
228
- starts with `prefix` stale. For example, `invalidateDataPrefix(["user"])`
228
+ `data.invalidateDataPrefix(prefix)` marks every existing entry whose structured key
229
+ starts with `prefix` stale. For example, `data.invalidateDataPrefix(["user"])`
229
230
  targets entries like `["user", id]`. Prefix matching uses the same canonical
230
231
  key encoder as normal reads, so delimiter-shaped strings do not collide.
231
232
 
232
- `refreshData(resource, ...args)` fetches immediately and resolves with a result
233
+ `data.refreshData(resource, ...args)` fetches immediately and resolves with a result
233
234
  instead of rejecting:
234
235
 
235
236
  ```ts
236
- const result = await refreshData(userResource, "one");
237
+ const result = await data.refreshData(userResource, "one");
237
238
 
238
239
  if (result.status === "fulfilled") {
239
240
  console.log(result.value);
@@ -247,25 +248,23 @@ failed.
247
248
 
248
249
  ### Root Store Scope
249
250
 
250
- Fig installs the current root data store while rendering and while running
251
- Fig-managed callbacks such as delegated event handlers. Outside those scopes,
252
- bind the store explicitly:
251
+ Imperative data operations use an explicit store handle. Components capture
252
+ `readDataStore()` while rendering; external code uses `root.data`:
253
253
 
254
254
  ```ts
255
255
  const root = createRoot(container);
256
256
 
257
257
  socket.on("user:update", (id) => {
258
- root.data.run(() => invalidateData(userResource, id));
258
+ root.data.invalidateData(userResource, id);
259
259
  });
260
260
  ```
261
261
 
262
- `root.data.run(fn)` is synchronous. If you need to invalidate after an `await`,
263
- keep the handle and re-enter:
262
+ The same handle works after an `await`, without re-entering an ambient scope:
264
263
 
265
264
  ```ts
266
265
  const data = root.data;
267
266
  await save();
268
- data.run(() => refreshData(userResource, "one"));
267
+ await data.refreshData(userResource, "one");
269
268
  ```
270
269
 
271
270
  Framework adapters can create and populate a root-neutral store before a
@@ -283,16 +282,16 @@ root.data === dataStore; // true
283
282
  Adoption preserves entry identity and subscriptions. The adopting root owns
284
283
  the store lifetime and disposes it when the root unmounts.
285
284
 
286
- Client roots accept `dataStore`, `dataPartition`, and `initialData` options.
287
- `dataStore` is exclusive with the other two options. The partition separates a
288
- store's internal keyspace without changing public resource keys.
285
+ Client roots accept mutually exclusive `dataStore` and `initialData` options.
286
+ Each store owns an isolated cache keyed by resource identity.
289
287
  Loaders receive only their resource arguments plus `{ signal }`; app services,
290
288
  request cookies, and auth state belong in the surrounding adapter or closure,
291
289
  not in the data store.
292
290
 
293
291
  ### Server Values And Hydration
294
292
 
295
- Server renderers expose fulfilled data entries with `getData()`. Pass those
293
+ Server renderers return the shell's data entries with `takeData()` and stream
294
+ data read inside Suspense boundaries ahead of each reveal. Pass the shell
296
295
  entries to the client root as `initialData` to hydrate by key, or use
297
296
  `createDataStore()` when an adapter needs to populate and render through the
298
297
  same live store.
@@ -324,7 +323,7 @@ export const userServerResource = dataResource({
324
323
 
325
324
  Client code imports the loader-less resource. If the server streamed a value
326
325
  for the same key, the client can read it as a hydrate-only entry. Since the
327
- resource has no client loader, `refreshData(userResource, id)` resolves with
326
+ resource has no client loader, `data.refreshData(userResource, id)` resolves with
328
327
  `{ status: "unsupported", reason: "no-client-loader" }`; revalidation needs a
329
328
  payload or framework refresh path.
330
329
 
@@ -348,7 +347,7 @@ Invalidating a hidden-only key schedules offscreen prerender work and keeps the
348
347
  DOM hidden.
349
348
 
350
349
  Initial load errors are keyed. `ErrorBoundary` reports the failed keys on
351
- `info.dataResourceKeys`; reset flows can call `invalidateDataError(error)` or
350
+ `info.dataResourceKeys`; reset flows can call `data.invalidateDataError(error)` or
352
351
  refresh/invalidate those keys before remounting or changing the boundary key.
353
352
 
354
353
  Fig DevTools root snapshots include data-resource entries with their normalized
@@ -7,16 +7,49 @@ type DataResourceKeyInput = string | number | boolean | null | readonly DataReso
7
7
  type DataResourceKey = readonly [string, ...DataResourceKeyInput[]];
8
8
  /** Describes data resource load context. */
9
9
  interface DataResourceLoadContext {
10
+ /**
11
+ * The store running this load. Entries ensured through it stay cached
12
+ * while this load's value is visible.
13
+ */
14
+ data: FigDataStoreHandle;
10
15
  signal: AbortSignal;
11
16
  }
12
17
  /** Describes data resource loader. */
13
18
  type DataResourceLoader<TArgs extends unknown[], TValue> = (...argsAndContext: [...TArgs, DataResourceLoadContext]) => TValue | PromiseLike<TValue>;
19
+ /**
20
+ * Capabilities a watch receives. Every operation is bound to the watched key
21
+ * and becomes inert once `signal` aborts.
22
+ */
23
+ interface DataResourceWatchContext<TValue> {
24
+ /**
25
+ * The store running this watch. Entries ensured through it stay cached
26
+ * while this watch runs.
27
+ */
28
+ data: FigDataStoreHandle;
29
+ signal: AbortSignal;
30
+ /** Replaces the entry's value, as a successful server push would. */
31
+ publish: (value: TValue) => void;
32
+ /** Records a failure: a visible value stays, a missing one rejects. */
33
+ fail: (error: unknown) => void;
34
+ /**
35
+ * Reruns `load` for this key and resolves with the outcome (`unsupported`
36
+ * for push-only resources; `aborted` once the watch has stopped).
37
+ */
38
+ refresh: () => Promise<DataRefreshResult<TValue>>;
39
+ /** Marks this key stale. */
40
+ invalidate: () => void;
41
+ }
42
+ /** Describes data resource watcher. */
43
+ type DataResourceWatcher<TArgs extends unknown[], TValue> = (...argsAndContext: [...TArgs, DataResourceWatchContext<TValue>]) => void;
14
44
  /** Describes data resource. */
15
45
  interface DataResource<TArgs extends unknown[] = unknown[], TValue = unknown> {
16
46
  readonly $$typeof: symbol;
17
47
  readonly debugArgs?: (...args: TArgs) => DataResourceKeyInput;
48
+ readonly equals?: (previous: TValue, next: TValue) => boolean;
49
+ readonly inactiveRetentionMs?: number;
18
50
  readonly key: (...args: TArgs) => DataResourceKey;
19
51
  readonly load?: DataResourceLoader<TArgs, TValue>;
52
+ readonly watch?: DataResourceWatcher<TArgs, TValue>;
20
53
  }
21
54
  /** Describes data refresh result. */
22
55
  type DataRefreshResult<T> = {
@@ -28,7 +61,7 @@ type DataRefreshResult<T> = {
28
61
  staleValue?: T;
29
62
  } | {
30
63
  status: "aborted";
31
- reason: "superseded" | "store-disposed" | "evicted";
64
+ reason: "superseded" | "store-disposed" | "evicted" | "released";
32
65
  staleValue?: T;
33
66
  } | {
34
67
  status: "unsupported";
@@ -54,6 +87,8 @@ interface DataStoreEntrySnapshot {
54
87
  status: FigDataEntryStatus;
55
88
  subscriberCount: number;
56
89
  value?: unknown;
90
+ /** Present and true while a watch is pushing values into this entry. */
91
+ watching?: boolean;
57
92
  }
58
93
  /** Describes Fig data store handle. */
59
94
  interface FigDataStoreHandle {
@@ -78,7 +113,6 @@ interface FigDataStoreController extends FigDataStoreHandle {
78
113
  /** Describes Fig data store options. */
79
114
  interface FigDataStoreOptions {
80
115
  initialData?: readonly FigDataHydrationEntry[];
81
- partition?: DataResourceKeyInput;
82
116
  }
83
117
  type FigDataReads = Map<string, {
84
118
  value: unknown;
@@ -88,8 +122,11 @@ interface FigDataStore extends FigDataStoreHandle {
88
122
  areDataDependenciesConsistent(reads: FigDataReads): boolean;
89
123
  commitDataDependencies(owner: object, previousOwner: object | null, reads?: FigDataReads): boolean;
90
124
  deleteDataOwner(owner: object): void;
125
+ holdDataRead(reads: FigDataReads, canonicalKey: string): void;
91
126
  releaseDataOwner(owner: object): void;
127
+ releaseDataReads(reads: FigDataReads): void;
92
128
  dispose(): void;
129
+ hydrateMissing(entries: readonly FigDataHydrationEntry[]): void;
93
130
  inspectDataDependencyCanonicalKeys(owner: object): string[];
94
131
  inspectDataEntries(): DataStoreEntrySnapshot[];
95
132
  snapshot(): FigDataHydrationEntry[];
@@ -98,8 +135,8 @@ interface FigDataStore extends FigDataStoreHandle {
98
135
  /** Describes Fig data store host. */
99
136
  interface FigDataStoreHost {
100
137
  getLane(): unknown;
101
- partition?: DataResourceKeyInput;
102
138
  schedule(owner: object, lane: unknown): void;
139
+ readonly watchSources?: boolean;
103
140
  }
104
141
  /** Describes Fig data store factory. */
105
142
  type FigDataStoreFactory = (host: FigDataStoreHost) => FigDataStore;
@@ -136,7 +173,7 @@ type FetchPriority = "high" | "low" | "auto";
136
173
  /** Describes asset resource destination. */
137
174
  type AssetResourceDestination = "head" | "stream";
138
175
  /** Describes Fig asset resource. */
139
- type FigAssetResource = StylesheetResource | PreloadResource | ModulePreloadResource | ScriptResource | FontResource | PreconnectResource | TitleResource | MetaResource;
176
+ type FigAssetResource = StylesheetResource | PreloadResource | ModulePreloadResource | ScriptResource | PreconnectResource | TitleResource | MetaResource;
140
177
  interface ResourceBase {
141
178
  key?: string;
142
179
  }
@@ -177,14 +214,6 @@ interface ScriptResource extends ResourceBase {
177
214
  module?: boolean;
178
215
  src: string;
179
216
  }
180
- /** Describes font resource. */
181
- interface FontResource extends ResourceBase {
182
- crossorigin?: CrossOrigin;
183
- fetchpriority?: FetchPriority;
184
- href: string;
185
- kind: "font";
186
- type: string;
187
- }
188
217
  /** Describes preconnect resource. */
189
218
  interface PreconnectResource extends ResourceBase {
190
219
  crossorigin?: CrossOrigin;
@@ -248,7 +277,7 @@ declare function modulepreload(href: string, options?: Omit<ModulePreloadResourc
248
277
  /** Script. */
249
278
  declare function script(src: string, options?: Omit<ScriptResource, "kind" | "src">): ScriptResource;
250
279
  /** Font. */
251
- declare function font(href: string, type: string, options?: Omit<FontResource, "href" | "kind" | "type">): FontResource;
280
+ declare function font(href: string, type: string, options?: Pick<PreloadResource, "key" | "crossorigin" | "fetchpriority">): PreloadResource;
252
281
  /** Preconnect. */
253
282
  declare function preconnect(href: string, options?: Omit<PreconnectResource, "href" | "kind">): PreconnectResource;
254
283
  /** Title. */
@@ -459,4 +488,4 @@ declare function isViewTransition(value: unknown): value is FigViewTransition;
459
488
  /** Checks whether assets. */
460
489
  declare function isAssets(value: unknown): value is FigAssets;
461
490
  //#endregion
462
- export { isViewTransition as $, LoadContextAttributeError 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, FigDataStoreController as Jt, isActivity as K, FigDataReads 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, FigDataStoreOptions 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, FigDataStoreHandle as Xt, isErrorBoundary as Y, FigDataStoreFactory as Yt, isSuspense as Z, FigDataStoreHost as Zt, FigClientReference as _, StylesheetResource as _t, AwaitedFigNode as a, markDataResourceError as an, ClientReferenceAssets as at, FigElementSymbol as b, assetResourceFromHostAttributes as bt, ComponentType as c, FigAssetResource as ct, ErrorBoundaryProps as d, MetaResource as dt, LoadContextCapabilities 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, loadContextCapabilities 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, dataResourceKeysForError as nn, AssetResourceDestination as nt, ClientReferenceOptions as o, resolveCurrentDataStore as on, CrossOrigin as ot, FigActivity as p, ModulePreloadResource as pt, isAssets as q, FigDataStore as qt, ActivityProps as r, defineLoadContextCapabilities as rn, AssetResourceHostProps as rt, ComponentProps as s, setCurrentDataStore as sn, FetchPriority as st, Activity as t, LoadContextHydrate 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 };
491
+ export { isViewTransition as $, FigDataStoreOptions as $t, Fragment as A, preconnect as At, ViewTransitionPhase as B, DataResourceLoadContext as Bt, FigNode as C, assetResourceKey as Ct, FigSuspenseSymbol as D, isFigAssetResource as Dt, FigSuspense as E, font as Et, SuspenseProps as F, title as Ft, createPortalNode as G, FigDataEntryStatus as Gt, ViewTransitionSurface as H, DataResourceWatchContext as Ht, ViewTransition as I, DataRefreshResult as It, isClientReference as J, FigDataStore as Jt, isActivity as K, FigDataHydrationEntry as Kt, ViewTransitionCallback as L, DataResource as Lt, LazyLoader as M, preventAssetResourceHoist as Mt, Props as N, script as Nt, FigViewTransition as O, meta as Ot, Suspense as P, stylesheet as Pt, isValidElement as Q, FigDataStoreHost as Qt, ViewTransitionClass as R, DataResourceKey as Rt, FigErrorBoundarySymbol as S, assetResourceHostProps as St, FigPortalSymbol as T, clientReferenceAssets as Tt, clientReference as U, DataResourceWatcher as Ut, ViewTransitionProps as V, DataResourceLoader as Vt, createElement as W, DataStoreEntrySnapshot as Wt, isPortal as X, FigDataStoreFactory as Xt, isErrorBoundary as Y, FigDataStoreController as Yt, isSuspense as Z, FigDataStoreHandle as Zt, FigClientReference as _, TitleResource as _t, AwaitedFigNode as a, loadContextCapabilities as an, ClientReferenceAssets as at, FigElementSymbol as b, assetResourceFromHostProps as bt, ComponentType as c, setCurrentDataStore as cn, FigAssetResource as ct, ErrorBoundaryProps as d, MetaResourceOptions as dt, LoadContextAttributeError as en, lazy as et, ErrorInfo as f, ModulePreloadResource as ft, FigAssetsSymbol as g, StylesheetResource as gt, FigAssets as h, ScriptResource as ht, Assets as i, defineLoadContextCapabilities as in, AssetsProps as it, Key as j, preload as jt, FigViewTransitionSymbol as k, modulepreload as kt, ElementType as l, FigAssetResourceList as lt, FigActivitySymbol as m, PreloadResource as mt, ActivityMode as n, LoadContextHydrate as nn, AssetResourceDestination as nt, ClientReferenceOptions as o, markDataResourceError as on, CrossOrigin as ot, FigActivity as p, PreconnectResource as pt, isAssets as q, FigDataReads as qt, ActivityProps as r, dataResourceKeysForError as rn, AssetResourceHostProps as rt, ComponentProps as s, resolveCurrentDataStore as sn, FetchPriority as st, Activity as t, LoadContextCapabilities as tn, AssetResourceBlocking as tt, ErrorBoundary as u, MetaResource as ut, FigClientReferenceSymbol as v, assetResourceDestination as vt, FigPortal as w, assets as wt, FigErrorBoundary as x, assetResourceFromHostValues as xt, FigElement as y, assetResourceFromHostAttributes as yt, ViewTransitionEvent as z, DataResourceKeyInput as zt };
@@ -1,58 +1,3 @@
1
- //#region src/data.ts
2
- const LoadContextCapabilitiesSymbol = Symbol.for("fig.data-load-context");
3
- /** Define load context capabilities. */
4
- function defineLoadContextCapabilities(context, capabilities) {
5
- Object.defineProperty(context, LoadContextCapabilitiesSymbol, {
6
- configurable: true,
7
- enumerable: false,
8
- value: capabilities
9
- });
10
- }
11
- /** Load context capabilities. */
12
- function loadContextCapabilities(context) {
13
- return context[LoadContextCapabilitiesSymbol];
14
- }
15
- const objectDataErrors = /* @__PURE__ */ new WeakMap();
16
- let currentDataStore = null;
17
- /** Captures an optional data store for synchronous scope re-entry. */
18
- function getCurrentDataStore() {
19
- return currentDataStore;
20
- }
21
- /** Resolves current data store. */
22
- function resolveCurrentDataStore(message = "Data resource APIs require a Fig data store.") {
23
- if (currentDataStore === null) throw new Error(message);
24
- return currentDataStore;
25
- }
26
- /** Sets current data store. */
27
- function setCurrentDataStore(store) {
28
- const previousStore = currentDataStore;
29
- currentDataStore = store;
30
- return previousStore;
31
- }
32
- /** Marks data resource error. */
33
- function markDataResourceError(error, key) {
34
- if (!isAttributableError(error)) return;
35
- let keys = objectDataErrors.get(error);
36
- if (keys === void 0) {
37
- keys = [];
38
- objectDataErrors.set(error, keys);
39
- }
40
- if (keys.some((existing) => sameDataResourceKey(existing, key))) return;
41
- keys.push(key);
42
- }
43
- /** Data resource keys for error. */
44
- function dataResourceKeysForError(error) {
45
- if (!isAttributableError(error)) return void 0;
46
- const keys = objectDataErrors.get(error);
47
- return keys === void 0 || keys.length === 0 ? void 0 : [...keys];
48
- }
49
- function sameDataResourceKey(a, b) {
50
- return a.length === b.length && a.every((value, index) => Object.is(value, b[index]));
51
- }
52
- function isAttributableError(value) {
53
- return (typeof value === "object" || typeof value === "function") && value !== null;
54
- }
55
- //#endregion
56
1
  //#region src/hooks.ts
57
2
  let currentDispatcher = null;
58
3
  /** Returns state. */
@@ -119,6 +64,10 @@ function useStableEvent(handler) {
119
64
  function readContext(context) {
120
65
  return resolveDispatcher("readContext can only be called while rendering a component.").readContext(context);
121
66
  }
67
+ /** Marks the current component as requiring browser rendering. */
68
+ function readBrowser(reason) {
69
+ resolveDispatcher("readBrowser can only be called while rendering a component.").readBrowser(reason);
70
+ }
122
71
  /** Reads promise. */
123
72
  function readPromise(promise) {
124
73
  return resolveDispatcher("readPromise can only be called while rendering a component.").readPromise(promise);
@@ -127,14 +76,6 @@ function readPromise(promise) {
127
76
  function readData(resource, ...args) {
128
77
  return resolveDispatcher("readData can only be called while rendering a component.").readData(resource, args);
129
78
  }
130
- /** Preloads data. */
131
- function preloadData(resource, ...args) {
132
- if (currentDispatcher !== null) {
133
- currentDispatcher.preloadData(resource, args);
134
- return;
135
- }
136
- resolveDataStore().preloadData(resource, ...args);
137
- }
138
79
  /** Sets current dispatcher. */
139
80
  function setCurrentDispatcher(dispatcher) {
140
81
  const previousDispatcher = currentDispatcher;
@@ -145,9 +86,6 @@ function resolveDispatcher(message = "Hooks can only be called while rendering a
145
86
  if (currentDispatcher === null) throw new Error(message);
146
87
  return currentDispatcher;
147
88
  }
148
- function resolveDataStore() {
149
- return resolveCurrentDataStore("No ambient Fig data store. Data APIs work synchronously during render, event handlers, actions, and effects — not after an await. Capture readDataStore() (or root.data) synchronously and call the handle instead.");
150
- }
151
89
  //#endregion
152
90
  //#region src/mixin.ts
153
91
  /** The Fig mixin symbol. */
@@ -361,6 +299,6 @@ function hasFunctionBrand(value, brand) {
361
299
  return typeof value === "function" && "$$typeof" in value && value.$$typeof === brand;
362
300
  }
363
301
  //#endregion
364
- export { getCurrentDataStore as $, markClientOnlyHostBehavior as A, useBeforeLayout as B, isSuspense as C, FigMixinSymbol as D, lazy as E, readContext as F, useMemo as G, useCallback as H, readData as I, useState as J, useReactive as K, readPromise as L, mixinSlot as M, resolveHostMix as N, clientOnlyHostBehavior as O, preloadData as P, defineLoadContextCapabilities as Q, setCurrentDispatcher as R, isPortal as S, isViewTransition as T, useDeferredValue as U, useBeforePaint as V, useId as W, useTransition as X, useSyncExternalStore as Y, dataResourceKeysForError as Z, createPortalNode as _, FigAssetsSymbol as a, isClientReference as b, FigErrorBoundarySymbol as c, FigViewTransitionSymbol as d, isAttributableError as et, Fragment as f, createElement as g, clientReference as h, FigActivitySymbol as i, setCurrentDataStore as it, markClientOnlyHostProps as j, createMixin as k, FigPortalSymbol as l, ViewTransition as m, Assets as n, markDataResourceError as nt, FigClientReferenceSymbol as o, Suspense as p, useStableEvent as q, ErrorBoundary as r, resolveCurrentDataStore as rt, FigElementSymbol as s, Activity as t, loadContextCapabilities as tt, FigSuspenseSymbol as u, isActivity as v, isValidElement as w, isErrorBoundary as x, isAssets as y, useActionState as z };
302
+ export { markClientOnlyHostBehavior as A, useBeforeLayout as B, isSuspense as C, FigMixinSymbol as D, lazy as E, readContext as F, useMemo as G, useCallback as H, readData as I, useState as J, useReactive as K, readPromise as L, mixinSlot as M, resolveHostMix as N, clientOnlyHostBehavior as O, readBrowser as P, setCurrentDispatcher as R, isPortal as S, isViewTransition as T, useDeferredValue as U, useBeforePaint as V, useId as W, useTransition as X, useSyncExternalStore as Y, createPortalNode as _, FigAssetsSymbol as a, isClientReference as b, FigErrorBoundarySymbol as c, FigViewTransitionSymbol as d, Fragment as f, createElement as g, clientReference as h, FigActivitySymbol as i, markClientOnlyHostProps as j, createMixin as k, FigPortalSymbol as l, ViewTransition as m, Assets as n, FigClientReferenceSymbol as o, Suspense as p, useStableEvent as q, ErrorBoundary as r, FigElementSymbol as s, Activity as t, FigSuspenseSymbol as u, isActivity as v, isValidElement as w, isErrorBoundary as x, isAssets as y, useActionState as z };
365
303
 
366
- //# sourceMappingURL=element-j7AKp0nu.js.map
304
+ //# sourceMappingURL=element-DpXdLgOZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-DpXdLgOZ.js","names":["runtimeType"],"sources":["../src/hooks.ts","../src/mixin.ts","../src/element.ts"],"sourcesContent":["import type { FigContext } from \"./context.ts\";\nimport type { DataResource } from \"./data.ts\";\nimport type { TransitionCallback, TransitionOptions } from \"./transition.ts\";\n\n// The useState updater: accepts the next state, or an updater function of\n// the previous state for stale-closure safety.\n/** Describes state setter. */\nexport type StateSetter<S> = (next: S | ((previous: S) => S)) => void;\n/** Describes external store subscribe. */\nexport type ExternalStoreSubscribe = (callback: () => void) => () => void;\n// Fig appends the AbortSignal after the runner's args (the data-loader\n// shape). The signal aborts when a newer run supersedes this one, when the\n// owning component unmounts, when an enclosing Activity hides, or on settlement.\n/** Describes action state action. */\nexport type ActionStateAction<S, Args extends unknown[]> = (\n previousState: S,\n ...argsAndSignal: [...Args, AbortSignal]\n) => S | PromiseLike<S>;\n/** Describes action state runner. */\nexport type ActionStateRunner<Args extends unknown[]> = (...args: Args) => void;\n\n/**\n * Runs state updates scheduled by `callback` at transition priority. If\n * `callback` returns a thenable, `useTransition` keeps `isPending` true until\n * it settles and its scheduled updates commit. Use the supplied update callback\n * to explicitly re-enter the transition after an await.\n *\n * The callback receives an `AbortSignal` that aborts when a newer transition\n * starts from the same hook, when the owning component unmounts, and when an\n * enclosing Activity hides. It also aborts when the callback settles, closing\n * its explicit update handle. Each `useTransition` hook is one cancellation\n * domain — use separate hooks for independently cancellable workflows. An\n * cancelled run is retired: its pending slot is released immediately and its\n * settlement (including an aborted fetch's rejection) is inert.\n */\nexport type StartTransition = (\n callback: TransitionCallback,\n options?: TransitionOptions,\n) => void;\ntype Callback = (...args: never[]) => unknown;\n\n/** Describes why a component requires browser rendering. */\nexport type BrowserRenderReason = string | (() => unknown);\n\n/** Describes render dispatcher. */\nexport interface RenderDispatcher {\n useState<S>(initialState: S | (() => S)): [S, StateSetter<S>];\n useActionState<S, Args extends unknown[]>(\n action: ActionStateAction<S, Args>,\n initialState: S,\n ): [S, ActionStateRunner<Args>, boolean];\n useId(): string;\n useDeferredValue<T>(\n value: T,\n initialValue: T | undefined,\n hasInitialValue: boolean,\n ): T;\n useMemo<T>(calculate: () => T, deps: DependencyList): T;\n useTransition(): [boolean, StartTransition];\n useReactive(effect: EffectCallback, deps?: DependencyList): void;\n useBeforePaint(effect: EffectCallback, deps?: DependencyList): void;\n useBeforeLayout(effect: EffectCallback, deps?: DependencyList): void;\n useSyncExternalStore<T>(\n subscribe: ExternalStoreSubscribe,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n ): T;\n useStableEvent<Args extends unknown[], Result>(\n handler: (...args: Args) => Result,\n ): (...args: StableEventCallerArgs<Args>) => Result;\n readContext<T>(context: FigContext<T>): T;\n readData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n args: TArgs,\n ): TValue;\n readBrowser(reason?: BrowserRenderReason): void;\n readPromise<T>(promise: PromiseLike<T>): T;\n}\n\n/** Describes effect callback. */\nexport type EffectCallback = (signal: AbortSignal) => undefined;\n/** Describes dependency list. */\nexport type DependencyList = readonly unknown[];\n\n/** Describes stable event caller args. */\nexport type StableEventCallerArgs<Args extends unknown[]> = Args extends [\n ...infer CallerArgs,\n AbortSignal,\n]\n ? CallerArgs\n : Args;\n\n// Fig appends the AbortSignal when invoking the handler; callers never pass\n// it, so a declared trailing signal is stripped from the callable signature.\nlet currentDispatcher: RenderDispatcher | null = null;\n\n/** Returns state. */\nexport function useState<S>(initialState: S | (() => S)): [S, StateSetter<S>] {\n return resolveDispatcher().useState(initialState);\n}\n\n/**\n * Tracks state returned by a client-side action. The action receives the\n * previous committed state first, then the runner's arguments, then an\n * `AbortSignal` Fig appends (declare the trailing signal parameter — it also\n * drives `Args` inference). Fig schedules the returned value in the action’s\n * transition lane and keeps `isPending` true until settlement and commit.\n * Arbitrary post-await setters have ordinary priority.\n *\n * Runs are last-run-wins: starting a new run aborts the previous one's\n * signal and retires it — a retired run's settlement (value or rejection)\n * never touches state or pending. The signal also aborts on unmount and\n * when an enclosing Activity hides or the action settles.\n */\nexport function useActionState<S, Args extends unknown[]>(\n action: ActionStateAction<S, Args>,\n initialState: S,\n): [S, ActionStateRunner<Args>, boolean] {\n return resolveDispatcher().useActionState(action, initialState);\n}\n\n/** Returns ID. */\nexport function useId(): string {\n return resolveDispatcher().useId();\n}\n\n/** Returns deferred value. */\nexport function useDeferredValue<T>(value: T, initialValue?: T): T {\n return resolveDispatcher().useDeferredValue(\n value,\n initialValue,\n arguments.length > 1,\n );\n}\n\n/** Returns memo. */\nexport function useMemo<T>(calculate: () => T, deps: DependencyList): T {\n return resolveDispatcher().useMemo(calculate, deps);\n}\n\n/** Returns transition. */\nexport function useTransition(): [boolean, StartTransition] {\n return resolveDispatcher().useTransition();\n}\n\n/** Returns callback. */\nexport function useCallback<T extends Callback>(\n callback: T,\n deps: DependencyList,\n): T {\n return resolveDispatcher().useMemo(() => callback, deps);\n}\n\n/** Returns reactive. */\nexport function useReactive(\n effect: EffectCallback,\n deps?: DependencyList,\n): void {\n resolveDispatcher().useReactive(effect, deps);\n}\n\n/** Returns before paint. */\nexport function useBeforePaint(\n effect: EffectCallback,\n deps?: DependencyList,\n): void {\n resolveDispatcher().useBeforePaint(effect, deps);\n}\n\n/** Returns before layout. */\nexport function useBeforeLayout(\n effect: EffectCallback,\n deps?: DependencyList,\n): void {\n resolveDispatcher().useBeforeLayout(effect, deps);\n}\n\n/** Returns sync external store. */\nexport function useSyncExternalStore<T>(\n subscribe: ExternalStoreSubscribe,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n): T {\n return resolveDispatcher().useSyncExternalStore(\n subscribe,\n getSnapshot,\n getServerSnapshot,\n );\n}\n\n/** Returns stable event. */\nexport function useStableEvent<Args extends unknown[], Result>(\n handler: (...args: Args) => Result,\n): (...args: StableEventCallerArgs<Args>) => Result {\n return resolveDispatcher().useStableEvent(handler);\n}\n\n/** Reads context. */\nexport function readContext<T>(context: FigContext<T>): T {\n return resolveDispatcher(\n \"readContext can only be called while rendering a component.\",\n ).readContext(context);\n}\n\n/** Marks the current component as requiring browser rendering. */\nexport function readBrowser(reason?: BrowserRenderReason): void {\n resolveDispatcher(\n \"readBrowser can only be called while rendering a component.\",\n ).readBrowser(reason);\n}\n\n/** Reads promise. */\nexport function readPromise<T>(promise: PromiseLike<T>): T {\n return resolveDispatcher(\n \"readPromise can only be called while rendering a component.\",\n ).readPromise(promise);\n}\n\n/** Reads data. */\nexport function readData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n): TValue {\n return resolveDispatcher(\n \"readData can only be called while rendering a component.\",\n ).readData(resource, args);\n}\n\n/** Sets current dispatcher. */\nexport function setCurrentDispatcher(\n dispatcher: RenderDispatcher | null,\n): RenderDispatcher | null {\n const previousDispatcher = currentDispatcher;\n currentDispatcher = dispatcher;\n return previousDispatcher;\n}\n\nfunction resolveDispatcher(\n message = \"Hooks can only be called while rendering a component.\",\n): RenderDispatcher {\n if (currentDispatcher === null) {\n throw new Error(message);\n }\n\n return currentDispatcher;\n}\n","import type { Props } from \"./element.ts\";\nimport { type RenderDispatcher, setCurrentDispatcher } from \"./hooks.ts\";\n\ndeclare const __FIG_DEV__: boolean | undefined;\n\nconst __DEV__ = typeof __FIG_DEV__ === \"boolean\" ? __FIG_DEV__ : false;\n\n/** Describes mixin context. */\nexport interface MixinContext {\n /** The intrinsic host name receiving this mixin. */\n readonly type: string;\n /** Props composed by the host and every preceding mixin. */\n readonly props: Readonly<Props>;\n /** Whether this mixin is the last writer of a composed prop. Read at commit. */\n readonly owns: (prop: string) => boolean;\n}\n\n/** Describes empty mixin value. */\nexport type EmptyMixinValue = false | 0 | 0n | \"\" | null | undefined;\n\n/** Describes mixin input. */\nexport type MixinInput =\n | MixinDescriptor\n | EmptyMixinValue\n | ReadonlyArray<MixinInput>;\n\n/** Describes mixin result. */\nexport type MixinResult = Props | MixinInput;\n\n/** Describes mixin type. */\nexport type MixinType<TArgs extends unknown[] = unknown[]> = (\n context: MixinContext,\n ...args: TArgs\n) => MixinResult;\n\ntype MixinRuntimeType = (\n context: MixinContext,\n ...args: unknown[]\n) => MixinResult;\n\n/** Describes mixin descriptor. */\nexport interface MixinDescriptor {\n readonly $$typeof: symbol;\n readonly args: readonly unknown[];\n readonly type: MixinRuntimeType;\n}\n\n/** Describes mixin factory. */\nexport type MixinFactory<TArgs extends unknown[]> = (\n ...args: TArgs\n) => MixinDescriptor;\n\n// Registered symbols: descriptors and contexts must stay recognizable when\n// duplicate copies of this module are live (linked source next to a\n// prebundled copy).\n/** The Fig mixin symbol. */\nexport const FigMixinSymbol = Symbol.for(\"fig.mixin\");\nconst FigMixinSlotSymbol = Symbol.for(\"fig.mixin-slot\");\nconst FigClientOnlyHostBehaviorSymbol = Symbol.for(\n \"fig.client-only-host-behavior\",\n);\ntype ClientOnlyHostProps = object & {\n [FigClientOnlyHostBehaviorSymbol]?: string;\n};\n\n/** Creates a render-time host behavior for the `mix` prop. */\nexport function createMixin<TArgs extends unknown[]>(\n type: MixinType<TArgs>,\n): MixinFactory<TArgs> {\n const runtimeType = type as MixinRuntimeType;\n const descriptorType = __DEV__ ? guardMixinType(runtimeType) : runtimeType;\n return (...args) => ({\n $$typeof: FigMixinSymbol,\n args,\n type: descriptorType,\n });\n}\n\nconst maximumResolvedMixins = 1024;\n\n/** Resolves host mix. */\nexport function resolveHostMix<P extends Props>(type: string, input: P): P {\n const props: Props = input;\n const mix = props.mix;\n delete props.mix;\n let resolvedMixins = 0;\n let owners: Map<string, string> | undefined;\n\n function resolve(value: unknown, slot: string): void {\n if (emptyMixinValue(value)) return;\n if (Array.isArray(value)) {\n for (let index = 0; index < value.length; index += 1) {\n resolve(value[index], `${slot}.${index}`);\n }\n return;\n }\n if (!isMixinDescriptor(value)) {\n throw new Error(\n `The mix prop on <${type}> must contain descriptors created by createMixin().`,\n );\n }\n\n resolvedMixins += 1;\n if (resolvedMixins > maximumResolvedMixins) {\n throw new Error(\n `The mix prop on <${type}> resolved more than ${maximumResolvedMixins} mixins.`,\n );\n }\n\n const context: MixinRuntimeContext = {\n [FigMixinSlotSymbol]: slot,\n props,\n type,\n owns: (prop) => owners?.get(prop) === slot,\n };\n const result = value.type(context, ...value.args);\n if (emptyMixinValue(result)) return;\n\n if (isMixinDescriptor(result) || Array.isArray(result)) {\n resolve(result, `${slot}.result`);\n return;\n }\n if (typeof result !== \"object\") {\n throw new Error(\n `A mixin on <${type}> must return host props, more mixins, or nothing.`,\n );\n }\n const returnedProps = result as Props;\n\n if (\n \"children\" in returnedProps ||\n \"key\" in returnedProps ||\n \"unsafeHTML\" in returnedProps\n ) {\n throw new Error(\n `A mixin on <${type}> cannot return children, key, or unsafeHTML.`,\n );\n }\n\n const { mix: nestedMix, ...patch } = returnedProps;\n Object.assign(props, patch);\n owners ??= new Map();\n for (const name of Object.keys(patch)) owners.set(name, slot);\n resolve(nestedMix, `${slot}.mix`);\n }\n\n resolve(mix, \"0\");\n props.mix = mix;\n return props as P;\n}\n\ninterface MixinRuntimeContext extends MixinContext {\n readonly [FigMixinSlotSymbol]: string;\n}\n\n/** Mixin slot. */\nexport function mixinSlot(context: MixinContext): string {\n return (context as MixinRuntimeContext)[FigMixinSlotSymbol];\n}\n\n/** Marks client only host behavior. */\nexport function markClientOnlyHostBehavior(\n context: MixinContext,\n behavior: string,\n): void {\n markClientOnlyHostProps(context.props, behavior);\n}\n\n/** Marks client only host props. */\nexport function markClientOnlyHostProps(value: object, behavior: string): void {\n const props = value as ClientOnlyHostProps;\n if (props[FigClientOnlyHostBehaviorSymbol] !== undefined) return;\n Object.defineProperty(props, FigClientOnlyHostBehaviorSymbol, {\n configurable: true,\n value: behavior,\n });\n}\n\n/** Client only host behavior. */\nexport function clientOnlyHostBehavior(props: object): string | undefined {\n const behavior = (props as ClientOnlyHostProps)[\n FigClientOnlyHostBehaviorSymbol\n ];\n return typeof behavior === \"string\" ? behavior : undefined;\n}\n\nfunction emptyMixinValue(value: unknown): value is EmptyMixinValue {\n return (\n value === false ||\n value === 0 ||\n value === 0n ||\n value === \"\" ||\n value === null ||\n value === undefined\n );\n}\n\nfunction isMixinDescriptor(value: unknown): value is MixinDescriptor {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"$$typeof\" in value &&\n value.$$typeof === FigMixinSymbol\n );\n}\n\n// Dev-only: the wrapper lives in the createMixin module copy, so it guards the\n// dispatcher used by hooks imported alongside that factory even when another\n// linked or prebundled copy resolves the descriptor.\nfunction guardMixinType(type: MixinRuntimeType): MixinRuntimeType {\n return (context, ...args) => {\n const previousDispatcher = setCurrentDispatcher(\n mixinDispatcher(context.type, mixinSlot(context)),\n );\n try {\n return type(context, ...args);\n } finally {\n setCurrentDispatcher(previousDispatcher);\n }\n };\n}\n\nfunction mixinDispatcher(type: string, slot: string): RenderDispatcher {\n return new Proxy({} as RenderDispatcher, {\n get(_target, property) {\n throw new Error(\n `A mixin on <${type}> (slot ${slot}) called ${String(property)}. ` +\n \"Mixins are pure render-time code: hooks and read verbs belong to \" +\n \"the component; host lifetimes belong in returned on() or bind \" +\n \"behavior.\",\n );\n },\n });\n}\n","import type { DataResourceKey } from \"./data.ts\";\nimport { readPromise } from \"./hooks.ts\";\nimport type { ClientReferenceAssets } from \"./resource.ts\";\nimport { resolveHostMix } from \"./mixin.ts\";\n\n/** Describes key. */\nexport type Key = string | number;\n/** Describes props. */\nexport type Props = Record<string, any>;\n/** Describes component type. */\nexport type ComponentType<P = Props> = (\n props: P & { children?: FigNode },\n) => FigNode;\n/** Describes component props. */\nexport type ComponentProps<T extends ComponentType<any>> =\n Parameters<T> extends [infer P, ...unknown[]]\n ? P extends Props\n ? P\n : Props\n : {};\n/** Describes element type. */\nexport type ElementType<P = Props> =\n | string\n | typeof Fragment\n | FigAssets\n | FigClientReference<P>\n | FigErrorBoundary\n | FigSuspense\n | FigActivity\n | FigViewTransition\n | ComponentType<P>;\n/** Describes awaited Fig node. */\nexport type AwaitedFigNode =\n | FigElement<any>\n | FigPortal<any>\n | string\n | number\n | boolean\n | null\n | undefined\n | FigNode[];\n/** Describes Fig node. */\nexport type FigNode = AwaitedFigNode | PromiseLike<AwaitedFigNode>;\n\n/** Describes Fig element. */\nexport interface FigElement<P = Props> {\n readonly $$typeof: symbol;\n readonly type: ElementType<any>;\n readonly key: Key | null;\n readonly props: P & { children?: FigNode };\n}\n\n/** Describes Fig portal. */\nexport interface FigPortal<Target = unknown> {\n readonly $$typeof: symbol;\n readonly children: FigNode;\n readonly key: Key | null;\n readonly target: Target;\n}\n\n/** Describes client reference options. */\nexport interface ClientReferenceOptions<P extends Props = Props> {\n assets?: ClientReferenceAssets;\n id: string;\n ssr?: ComponentType<P>;\n}\n\n/** Describes Fig client reference. */\nexport interface FigClientReference<P = Props> {\n (props: P & { children?: FigNode }): FigNode;\n readonly $$typeof: symbol;\n readonly assets?: ClientReferenceAssets;\n readonly id: string;\n readonly ssr?: ComponentType<P>;\n}\n\n/** Describes lazy loader. */\nexport type LazyLoader<T extends ComponentType<any> = ComponentType<any>> =\n () => PromiseLike<T>;\n\n/** Describes suspense props. */\nexport interface SuspenseProps {\n fallback?: FigNode;\n children?: FigNode;\n}\n\n/** Describes Fig suspense. */\nexport interface FigSuspense {\n (props: SuspenseProps): FigNode;\n readonly $$typeof: symbol;\n}\n\n/** Describes activity mode. */\nexport type ActivityMode = \"visible\" | \"hidden\";\n\n/** Describes activity props. */\nexport interface ActivityProps {\n mode: ActivityMode;\n children?: FigNode;\n}\n\n/** Describes Fig activity. */\nexport interface FigActivity {\n (props: ActivityProps): FigNode;\n readonly $$typeof: symbol;\n}\n\n/** Describes view transition class. */\nexport type ViewTransitionClass = \"auto\" | \"none\" | (string & {});\n\n/** Describes view transition phase. */\nexport type ViewTransitionPhase = \"enter\" | \"exit\" | \"share\" | \"update\";\n\n// Renderer-neutral identity for one named host surface in the native\n// transition. Renderer packages can resolve it into their own imperative\n// handles without putting host types in core.\n/** Describes view transition surface. */\nexport interface ViewTransitionSurface {\n readonly name: string;\n}\n\n/** Describes view transition event. */\nexport interface ViewTransitionEvent {\n readonly phase: ViewTransitionPhase;\n readonly surfaces: readonly ViewTransitionSurface[];\n readonly types: readonly string[];\n}\n\n/** Describes view transition callback. */\nexport type ViewTransitionCallback = (\n event: ViewTransitionEvent,\n signal: AbortSignal,\n) => undefined;\n\n/** Describes view transition props. */\nexport interface ViewTransitionProps {\n name?: string;\n children?: FigNode;\n default?: ViewTransitionClass;\n enter?: ViewTransitionClass;\n exit?: ViewTransitionClass;\n share?: ViewTransitionClass;\n update?: ViewTransitionClass;\n onTransition?: ViewTransitionCallback;\n}\n\n/** Describes Fig view transition. */\nexport interface FigViewTransition {\n (props: ViewTransitionProps): FigNode;\n readonly $$typeof: symbol;\n}\n\n/** Describes error boundary props. */\nexport interface ErrorBoundaryProps {\n // A function fallback receives the caught error so error UIs can render\n // it (message, retry affordance) without smuggling state above the\n // boundary through onError. Callable thenables are nodes, so the runtime\n // distinguishes them from render fallbacks before invoking the function.\n fallback?: FigNode | ((error: unknown, info: ErrorInfo) => FigNode);\n onError?: (error: unknown, info: ErrorInfo) => void;\n children?: FigNode;\n}\n\n/** Describes error info. */\nexport interface ErrorInfo {\n componentStack: string;\n dataResourceKeys?: DataResourceKey[];\n}\n\n/** Describes Fig error boundary. */\nexport interface FigErrorBoundary {\n (props: ErrorBoundaryProps): FigNode;\n readonly $$typeof: symbol;\n}\n\n/** Describes Fig assets. */\nexport interface FigAssets {\n (props: Props & { children?: FigNode }): FigNode;\n readonly $$typeof: symbol;\n}\n\n/** The fragment. */\nexport const Fragment = Symbol.for(\"fig.fragment\");\n/** The Fig element symbol. */\nexport const FigElementSymbol = Symbol.for(\"fig.element\");\n/** The Fig client reference symbol. */\nexport const FigClientReferenceSymbol = Symbol.for(\"fig.client-reference\");\n/** The Fig activity symbol. */\nexport const FigActivitySymbol = Symbol.for(\"fig.activity\");\n/** The Fig error boundary symbol. */\nexport const FigErrorBoundarySymbol = Symbol.for(\"fig.error-boundary\");\n/** The Fig portal symbol. */\nexport const FigPortalSymbol = Symbol.for(\"fig.portal\");\n/** The Fig assets symbol. */\nexport const FigAssetsSymbol = Symbol.for(\"fig.assets\");\n/** The Fig suspense symbol. */\nexport const FigSuspenseSymbol = Symbol.for(\"fig.suspense\");\n/** The Fig view transition symbol. */\nexport const FigViewTransitionSymbol = Symbol.for(\"fig.view-transition\");\n\n/** The assets. */\nexport const Assets: FigAssets = Object.assign(\n (props: Props & { children?: FigNode }) => props.children,\n { $$typeof: FigAssetsSymbol },\n);\n\n/** The error boundary. */\nexport const ErrorBoundary: FigErrorBoundary = Object.assign(\n (props: ErrorBoundaryProps) => props.children,\n { $$typeof: FigErrorBoundarySymbol },\n);\n\n/** The suspense. */\nexport const Suspense: FigSuspense = Object.assign(\n (props: SuspenseProps) => props.children,\n { $$typeof: FigSuspenseSymbol },\n);\n\n/** The activity. */\nexport const Activity: FigActivity = Object.assign(\n (props: ActivityProps) => props.children,\n { $$typeof: FigActivitySymbol },\n);\n\n/** The view transition. */\nexport const ViewTransition: FigViewTransition = Object.assign(\n (props: ViewTransitionProps) => props.children,\n { $$typeof: FigViewTransitionSymbol },\n);\n\n/** Creates element. */\nexport function createElement<P extends Props>(\n type: ElementType<P>,\n config?: (P & { key?: Key | null }) | null,\n ...children: FigNode[]\n): FigElement<P> {\n const props = { ...config } as P & {\n children?: FigNode;\n key?: Key | null;\n };\n const key = props.key ?? null;\n delete props.key;\n\n if (children.length === 1) props.children = children[0];\n else if (children.length > 1) props.children = children;\n\n return {\n $$typeof: FigElementSymbol,\n type,\n key,\n props:\n \"mix\" in props && typeof type === \"string\"\n ? resolveHostMix(type, props)\n : props,\n };\n}\n\n/** Checks whether valid element. */\nexport function isValidElement(value: unknown): value is FigElement {\n return hasObjectBrand(value, FigElementSymbol);\n}\n\n/** Creates portal node. */\nexport function createPortalNode<Target>(\n children: FigNode,\n target: Target,\n key: Key | null = null,\n): FigPortal<Target> {\n return { $$typeof: FigPortalSymbol, children, key, target };\n}\n\n/** Checks whether portal. */\nexport function isPortal(value: unknown): value is FigPortal {\n return hasObjectBrand(value, FigPortalSymbol);\n}\n\n/** Client reference. */\nexport function clientReference<P extends Props = Props>(\n options: ClientReferenceOptions<P>,\n): FigClientReference<P> {\n return Object.assign(\n (): never => {\n throw new Error(\n `Client reference \"${options.id}\" cannot be rendered on the server directly.`,\n );\n },\n {\n $$typeof: FigClientReferenceSymbol,\n assets: options.assets,\n id: options.id,\n ssr: options.ssr,\n },\n );\n}\n\n/** Lazy. */\nexport function lazy<T extends ComponentType<any>>(\n load: LazyLoader<T>,\n): ComponentType<ComponentProps<T>> {\n let promise: PromiseLike<T> | null = null;\n let rejected = false;\n\n const Lazy: ComponentType<ComponentProps<T>> = (props) => {\n if (promise === null) {\n rejected = false;\n const next = Promise.resolve(load()).then(\n (value) => value,\n (error) => {\n if (promise === next) rejected = true;\n throw error;\n },\n );\n promise = next;\n }\n\n try {\n return createElement(readPromise(promise), props);\n } catch (error) {\n if (rejected) {\n promise = null;\n rejected = false;\n }\n throw error;\n }\n };\n\n return Lazy;\n}\n\n/** Checks whether client reference. */\nexport function isClientReference(value: unknown): value is FigClientReference {\n return hasFunctionBrand(value, FigClientReferenceSymbol);\n}\n\n/** Checks whether suspense. */\nexport function isSuspense(value: unknown): value is FigSuspense {\n return hasFunctionBrand(value, FigSuspenseSymbol);\n}\n\n/** Checks whether activity. */\nexport function isActivity(value: unknown): value is FigActivity {\n return hasFunctionBrand(value, FigActivitySymbol);\n}\n\n/** Checks whether error boundary. */\nexport function isErrorBoundary(value: unknown): value is FigErrorBoundary {\n return hasFunctionBrand(value, FigErrorBoundarySymbol);\n}\n\n/** Checks whether view transition. */\nexport function isViewTransition(value: unknown): value is FigViewTransition {\n return hasFunctionBrand(value, FigViewTransitionSymbol);\n}\n\n/** Checks whether assets. */\nexport function isAssets(value: unknown): value is FigAssets {\n return hasFunctionBrand(value, FigAssetsSymbol);\n}\n\nfunction hasObjectBrand(value: unknown, brand: symbol): boolean {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"$$typeof\" in value &&\n value.$$typeof === brand\n );\n}\n\nfunction hasFunctionBrand(value: unknown, brand: symbol): boolean {\n return (\n typeof value === \"function\" &&\n \"$$typeof\" in value &&\n value.$$typeof === brand\n );\n}\n"],"mappings":";AA8FA,IAAI,oBAA6C;;AAGjD,SAAgB,SAAY,cAAkD;CAC5E,OAAO,kBAAkB,CAAC,CAAC,SAAS,YAAY;AAClD;;;;;;;;;;;;;;AAeA,SAAgB,eACd,QACA,cACuC;CACvC,OAAO,kBAAkB,CAAC,CAAC,eAAe,QAAQ,YAAY;AAChE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