@bgub/fig 0.1.0-alpha.6 → 0.1.0-alpha.7
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 +44 -0
- package/dist/{element-BoGtyNcJ.d.ts → element-Od8CmsBL.d.ts} +3 -3
- package/dist/{element-DmbzNH0T.js → element-wieeFL9f.js} +8 -4
- package/dist/{element-DmbzNH0T.js.map → element-wieeFL9f.js.map} +1 -1
- package/dist/{hooks-BBR4drqc.d.ts → hooks-BSqKOOez.d.ts} +9 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/internal.d.ts +4 -4
- package/dist/internal.js +28 -5
- package/dist/internal.js.map +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/{payload-format-KTNaSI4h.js → payload-format-Dgap54q-.js} +4 -4
- package/dist/payload-format-Dgap54q-.js.map +1 -0
- package/dist/payload.d.ts +5 -3
- package/dist/payload.js +119 -111
- package/dist/payload.js.map +1 -1
- package/dist/{resource-BunwyRMg.js → resource-BfNHyXun.js} +44 -14
- package/dist/resource-BfNHyXun.js.map +1 -0
- package/dist/{transition-CXfg0SN_.js → transition-DBjQTorq.js} +2 -2
- package/dist/{transition-CXfg0SN_.js.map → transition-DBjQTorq.js.map} +1 -1
- package/dist-development/{element-B7mCQIMi.js → element-Bb5fLsPy.js} +8 -4
- package/dist-development/{element-B7mCQIMi.js.map → element-Bb5fLsPy.js.map} +1 -1
- package/dist-development/index.js +3 -3
- package/dist-development/internal.js +28 -5
- package/dist-development/internal.js.map +1 -1
- package/dist-development/jsx-runtime.js +1 -1
- package/dist-development/{payload-format-KTNaSI4h.js → payload-format-Dgap54q-.js} +4 -4
- package/dist-development/payload-format-Dgap54q-.js.map +1 -0
- package/dist-development/payload.js +119 -111
- package/dist-development/payload.js.map +1 -1
- package/dist-development/{resource-Cy5I3Yms.js → resource-Cp01PvqW.js} +44 -14
- package/dist-development/resource-Cp01PvqW.js.map +1 -0
- package/dist-development/{transition-Ddf0mtZs.js → transition-CNVJyoT2.js} +2 -2
- package/dist-development/{transition-Ddf0mtZs.js.map → transition-CNVJyoT2.js.map} +1 -1
- package/package.json +1 -1
- package/dist/payload-format-KTNaSI4h.js.map +0 -1
- package/dist/resource-BunwyRMg.js.map +0 -1
- package/dist-development/payload-format-KTNaSI4h.js.map +0 -1
- package/dist-development/resource-Cy5I3Yms.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
## @bgub/fig@0.1.0-alpha.7
|
|
2
|
+
|
|
3
|
+
### Allow interactive transitions to interrupt native animations
|
|
4
|
+
|
|
5
|
+
`transition()` and the function returned by `useTransition()` now accept
|
|
6
|
+
`viewTransition: "interrupt"`. When another native View Transition is already
|
|
7
|
+
animating, Fig skips it, waits for its cleanup to settle, and immediately
|
|
8
|
+
commits the latest rendered state, starting a new transition when that commit
|
|
9
|
+
has participating boundaries. The default remains serialized so navigations
|
|
10
|
+
and streamed reveals retain uninterrupted motion. Interruptible DOM
|
|
11
|
+
transitions also drop the implicit full-page snapshot so controls outside
|
|
12
|
+
explicit transition surfaces stay live and can express the next intent by
|
|
13
|
+
pointer before the current animation finishes.
|
|
14
|
+
|
|
15
|
+
### Reduce asset serialization allocations
|
|
16
|
+
|
|
17
|
+
Asset resources now build their canonical host props directly. Server rendering
|
|
18
|
+
fills its owned props object in place instead of creating attribute tuples,
|
|
19
|
+
filtering them, converting them with `Object.fromEntries`, and cloning again to
|
|
20
|
+
append a nonce. Client insertion uses the same canonical props without changing
|
|
21
|
+
the generated elements or server HTML.
|
|
22
|
+
|
|
23
|
+
### Reduce render-path allocations
|
|
24
|
+
|
|
25
|
+
Child reconciliation now reuses arrays that are already normalized. Server
|
|
26
|
+
rendering defers `useId` path formatting on branches that do not request an
|
|
27
|
+
ID. This avoids unnecessary allocations in common client-update and sparse-ID
|
|
28
|
+
server trees without changing rendered output.
|
|
29
|
+
|
|
30
|
+
### Reduce server link allocations
|
|
31
|
+
|
|
32
|
+
Server-rendered router links now mark their client navigation behavior directly
|
|
33
|
+
instead of resolving a synthetic click mixin. Links without state props, binds,
|
|
34
|
+
or mixins also avoid creating empty state objects and composition wrappers.
|
|
35
|
+
Payload rendering continues to reject links whose client navigation behavior
|
|
36
|
+
would otherwise be lost.
|
|
37
|
+
|
|
38
|
+
### Simplify Payload rendering and decoding
|
|
39
|
+
|
|
40
|
+
Payload now keeps client-reference identity and delivery state together,
|
|
41
|
+
encapsulates server asset deduplication and wire lowering, and removes
|
|
42
|
+
redundant request, graph, and chunk bookkeeping. The public API, wire values,
|
|
43
|
+
streaming, asset gating, cancellation, and error behavior are unchanged.
|
|
44
|
+
|
|
1
45
|
## @bgub/fig@0.1.0-alpha.6
|
|
2
46
|
|
|
3
47
|
### Identify why data-loader signals abort
|
|
@@ -210,8 +210,8 @@ declare function assetResourceDestination(resource: FigAssetResource): AssetReso
|
|
|
210
210
|
declare function assetResourceFromHostProps(type: string, props: Props): FigAssetResource | null;
|
|
211
211
|
declare function preventAssetResourceHoist<P extends Props>(props: P): P;
|
|
212
212
|
declare function assetResourceFromHostAttributes(type: string, getAttribute: (name: string) => unknown): FigAssetResource | null;
|
|
213
|
-
type
|
|
214
|
-
declare function
|
|
213
|
+
type AssetResourceHostProps = Record<string, string | true>;
|
|
214
|
+
declare function assetResourceHostProps(resource: FigAssetResource, props?: AssetResourceHostProps): AssetResourceHostProps;
|
|
215
215
|
declare function assetResourceFromHostValues(type: string, prop: (name: string) => unknown, children?: FigNode, requireAsyncScript?: boolean): FigAssetResource | null;
|
|
216
216
|
//#endregion
|
|
217
217
|
//#region src/element.d.ts
|
|
@@ -343,4 +343,4 @@ declare function isErrorBoundary(value: unknown): value is FigErrorBoundary;
|
|
|
343
343
|
declare function isViewTransition(value: unknown): value is FigViewTransition;
|
|
344
344
|
declare function isAssets(value: unknown): value is FigAssets;
|
|
345
345
|
//#endregion
|
|
346
|
-
export { isViewTransition as $, LoadContextCapabilities as $t, Fragment as A, modulepreload as At, ViewTransitionPhase as B, DataResourceKeyInput as Bt, FigNode as C,
|
|
346
|
+
export { isViewTransition as $, LoadContextCapabilities as $t, Fragment as A, modulepreload as At, ViewTransitionPhase as B, DataResourceKeyInput as Bt, FigNode as C, assetResourceHostProps as Ct, FigSuspenseSymbol as D, font as Dt, FigSuspense as E, clientReferenceAssets as Et, SuspenseProps as F, stylesheet as Ft, createPortalNode as G, FigDataHydrationEntry as Gt, ViewTransitionSurface as H, DataResourceLoader as Ht, ViewTransition as I, title as It, isClientReference as J, FigDataStoreFactory as Jt, isActivity as K, FigDataStore as Kt, ViewTransitionCallback as L, DataRefreshResult as Lt, LazyLoader as M, preload as Mt, Props as N, preventAssetResourceHoist as Nt, FigViewTransition as O, isFigAssetResource as Ot, Suspense as P, script as Pt, isValidElement as Q, LoadContextAttributeError as Qt, ViewTransitionClass as R, DataResource as Rt, FigErrorBoundarySymbol as S, assetResourceFromHostValues as St, FigPortalSymbol as T, assets as Tt, clientReference as U, DataStoreEntrySnapshot as Ut, ViewTransitionProps as V, DataResourceLoadContext as Vt, createElement as W, FigDataEntryStatus as Wt, isPortal as X, FigDataStoreHost as Xt, isErrorBoundary as Y, FigDataStoreHandle as Yt, isSuspense as Z, FigDataStoreOptions as Zt, FigClientReference as _, StylesheetResource as _t, AwaitedFigNode as a, resolveCurrentDataStore as an, ClientReferenceAssets as at, FigElementSymbol as b, assetResourceFromHostAttributes as bt, ComponentType as c, FigAssetResource as ct, ErrorBoundaryProps as d, MetaResource as dt, LoadContextHydrate as en, lazy as et, ErrorInfo as f, MetaResourceOptions as ft, FigAssetsSymbol as g, ScriptResource as gt, FigAssets as h, PreloadResource as ht, Assets as i, markDataResourceError as in, AssetsProps as it, Key as j, preconnect as jt, FigViewTransitionSymbol as k, meta as kt, ElementType as l, FigAssetResourceList as lt, FigActivitySymbol as m, PreconnectResource as mt, ActivityMode as n, defineLoadContextCapabilities as nn, AssetResourceDestination as nt, ClientReferenceOptions as o, setCurrentDataStore as on, CrossOrigin as ot, FigActivity as p, ModulePreloadResource as pt, isAssets as q, FigDataStoreController as qt, ActivityProps as r, loadContextCapabilities as rn, AssetResourceHostProps as rt, ComponentProps as s, FetchPriority as st, Activity as t, dataResourceKeysForError as tn, AssetResourceBlocking as tt, ErrorBoundary as u, FontResource as ut, FigClientReferenceSymbol as v, TitleResource as vt, FigPortal as w, assetResourceKey as wt, FigErrorBoundary as x, assetResourceFromHostProps as xt, FigElement as y, assetResourceDestination as yt, ViewTransitionEvent as z, DataResourceKey as zt };
|
|
@@ -176,8 +176,12 @@ function mixinSlot(context) {
|
|
|
176
176
|
return context[FigMixinSlotSymbol];
|
|
177
177
|
}
|
|
178
178
|
function markClientOnlyHostBehavior(context, behavior) {
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
markClientOnlyHostProps(context.props, behavior);
|
|
180
|
+
}
|
|
181
|
+
function markClientOnlyHostProps(value, behavior) {
|
|
182
|
+
const props = value;
|
|
183
|
+
if (props[FigClientOnlyHostBehaviorSymbol] !== void 0) return;
|
|
184
|
+
Object.defineProperty(props, FigClientOnlyHostBehaviorSymbol, {
|
|
181
185
|
configurable: true,
|
|
182
186
|
value: behavior
|
|
183
187
|
});
|
|
@@ -294,6 +298,6 @@ function hasFunctionBrand(value, brand) {
|
|
|
294
298
|
return typeof value === "function" && "$$typeof" in value && value.$$typeof === brand;
|
|
295
299
|
}
|
|
296
300
|
//#endregion
|
|
297
|
-
export {
|
|
301
|
+
export { isAttributableError 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, loadContextCapabilities as et, 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, resolveCurrentDataStore as nt, FigClientReferenceSymbol as o, Suspense as p, useStableEvent as q, ErrorBoundary as r, setCurrentDataStore as rt, FigElementSymbol as s, Activity as t, markDataResourceError as tt, FigSuspenseSymbol as u, isActivity as v, isValidElement as w, isErrorBoundary as x, isAssets as y, useActionState as z };
|
|
298
302
|
|
|
299
|
-
//# sourceMappingURL=element-
|
|
303
|
+
//# sourceMappingURL=element-wieeFL9f.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-DmbzNH0T.js","names":["runtimeType"],"sources":["../src/data.ts","../src/hooks.ts","../src/mixin.ts","../src/element.ts"],"sourcesContent":["export type DataResourceKeyInput =\n | string\n | number\n | boolean\n | null\n | readonly DataResourceKeyInput[]\n | { readonly [key: string]: DataResourceKeyInput };\n\nexport type DataResourceKey = readonly [string, ...DataResourceKeyInput[]];\n\nexport interface DataResourceLoadContext {\n signal: AbortSignal;\n}\n\nexport type DataResourceLoader<TArgs extends unknown[], TValue> = (\n ...argsAndContext: [...TArgs, DataResourceLoadContext]\n) => TValue | PromiseLike<TValue>;\n\nexport interface DataResource<\n TArgs extends unknown[] = unknown[],\n TValue = unknown,\n> {\n readonly $$typeof: symbol;\n readonly debugArgs?: (...args: TArgs) => DataResourceKeyInput;\n readonly key: (...args: TArgs) => DataResourceKey;\n readonly load?: DataResourceLoader<TArgs, TValue>;\n}\n\nexport type DataRefreshResult<T> =\n | { status: \"fulfilled\"; value: T }\n | { status: \"rejected\"; error: unknown; staleValue?: T }\n | {\n status: \"aborted\";\n reason: \"superseded\" | \"store-disposed\" | \"evicted\";\n staleValue?: T;\n }\n | {\n status: \"unsupported\";\n reason: \"no-client-loader\";\n staleValue?: T;\n };\n\nexport interface FigDataHydrationEntry {\n key: DataResourceKey;\n value: unknown;\n}\n\nexport type FigDataEntryStatus =\n | \"pending\"\n | \"fulfilled\"\n | \"rejected\"\n | \"refreshing\";\n\nexport interface DataStoreEntrySnapshot {\n canonicalKey: string;\n error?: unknown;\n hasValue: boolean;\n key: DataResourceKey;\n pending: boolean;\n refreshError?: unknown;\n stale: boolean;\n status: FigDataEntryStatus;\n subscriberCount: number;\n value?: unknown;\n}\n\n// The explicit, app-facing store surface (FigRoot.data, readDataStore()).\n// The free functions in @bgub/fig resolve the ambient store slot, which\n// is only set while Fig executes synchronously — render, event handlers, the\n// synchronous prefix of actions and transitions, and effects. After an\n// `await` the slot is gone, so async flows capture this handle first and call\n// its methods instead.\nexport interface FigDataStoreHandle {\n // The awaitable read for code outside render (route loaders, actions after\n // an await): resolve the value this key would render with — the cached\n // value when the entry has one (kicking the same background revalidation a\n // stale readData does), the in-flight load's settlement on a cache miss —\n // and reject with the error readData would throw. Does not subscribe;\n // pair with readData in the component, which claims the settled entry\n // within the preload retention window.\n ensureData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n ): Promise<TValue>;\n hydrate(entries: readonly FigDataHydrationEntry[]): void;\n invalidateData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n ): void;\n invalidateDataError(error: unknown): boolean;\n invalidateDataKey(key: DataResourceKey): void;\n invalidateDataPrefix(prefix: DataResourceKey): void;\n preloadData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n ): void;\n refreshData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n ): Promise<DataRefreshResult<TValue>>;\n run<T>(callback: () => T): T;\n}\n\n/**\n * A root-neutral data store. A renderer adopts it exactly once, preserving\n * entries loaded before rendering while attaching subscriber scheduling.\n */\nexport interface FigDataStoreController extends FigDataStoreHandle {\n dispose(): void;\n snapshot(): FigDataHydrationEntry[];\n}\n\nexport interface FigDataStoreOptions {\n initialData?: readonly FigDataHydrationEntry[];\n partition?: DataResourceKeyInput;\n}\n\nexport interface FigDataStore extends FigDataStoreHandle {\n commitDataDependencies(owner: object, previousOwner: object | null): void;\n deleteDataOwner(owner: object): void;\n releaseDataOwner(owner: object): void;\n resetDataDependencies(owner: object): void;\n dispose(): void;\n inspectDataDependencyCanonicalKeys(owner: object): string[];\n inspectDataEntries(): DataStoreEntrySnapshot[];\n snapshot(): FigDataHydrationEntry[];\n // Renderer plumbing, not handle surface: args stay an array because the\n // subscribing owner trails them.\n readData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n args: TArgs,\n owner: object,\n ): TValue;\n}\n\n// The host callbacks a renderer hands to the data-store factory. Structurally\n// compatible with @bgub/fig's DataStoreHost so its renderer store can\n// register directly.\nexport interface FigDataStoreHost {\n getLane(): unknown;\n partition?: DataResourceKeyInput;\n schedule(owner: object, lane: unknown): void;\n}\n\nexport type FigDataStoreFactory = (host: FigDataStoreHost) => FigDataStore;\n\n// The internal, generation-guarded metadata a store attaches to each loader\n// context (symbol-keyed: DataResourceLoadContext stays { signal } publicly).\n// Adapters use the resolved key and decode Payload rows through the calling\n// store without recomputing identity or exposing these capabilities to loaders.\nexport type LoadContextHydrate = (\n entries: readonly FigDataHydrationEntry[],\n) => void;\nexport type LoadContextAttributeError = (error: unknown) => void;\n\nexport interface LoadContextCapabilities {\n attributeError: LoadContextAttributeError;\n hydrate: LoadContextHydrate;\n // Store contexts always provide this; optional keeps synthetic decoder\n // contexts usable without pretending they belong to a cache entry.\n key?: DataResourceKey;\n}\n\nconst LoadContextCapabilitiesSymbol = Symbol.for(\"fig.data-load-context\");\ntype DataResourceLoadContextWithCapabilities = DataResourceLoadContext & {\n [LoadContextCapabilitiesSymbol]?: LoadContextCapabilities;\n};\n\nexport function defineLoadContextCapabilities(\n context: DataResourceLoadContext,\n capabilities: LoadContextCapabilities,\n): void {\n Object.defineProperty(context, LoadContextCapabilitiesSymbol, {\n configurable: true,\n enumerable: false,\n value: capabilities,\n });\n}\n\nexport function loadContextCapabilities(\n context: DataResourceLoadContext,\n): LoadContextCapabilities | undefined {\n return (context as DataResourceLoadContextWithCapabilities)[\n LoadContextCapabilitiesSymbol\n ];\n}\n\nconst objectDataErrors = new WeakMap<object, DataResourceKey[]>();\n\nlet currentDataStore: FigDataStore | null = null;\n\nexport function resolveCurrentDataStore(\n message = \"Data resource APIs require a Fig data store.\",\n): FigDataStore {\n if (currentDataStore === null) throw new Error(message);\n return currentDataStore;\n}\n\nexport function setCurrentDataStore(\n store: FigDataStore | null,\n): FigDataStore | null {\n const previousStore = currentDataStore;\n currentDataStore = store;\n return previousStore;\n}\n\nexport function markDataResourceError(\n error: unknown,\n key: DataResourceKey,\n): void {\n // Only object errors are attributed: the WeakMap keys them by identity, so the\n // registry is GC-safe and cannot cross-attribute. Primitive rejection values\n // would collide by value and accumulate forever in a plain Map, so a thrown\n // primitive simply carries no resource-key metadata.\n if (!isAttributableError(error)) return;\n\n let keys = objectDataErrors.get(error);\n if (keys === undefined) {\n keys = [];\n objectDataErrors.set(error, keys);\n }\n\n if (keys.some((existing) => sameDataResourceKey(existing, key))) return;\n\n keys.push(key);\n}\n\nexport function dataResourceKeysForError(\n error: unknown,\n): DataResourceKey[] | undefined {\n if (!isAttributableError(error)) return undefined;\n\n const keys = objectDataErrors.get(error);\n return keys === undefined || keys.length === 0 ? undefined : [...keys];\n}\n\nfunction sameDataResourceKey(a: DataResourceKey, b: DataResourceKey): boolean {\n return (\n a.length === b.length &&\n a.every((value, index) => Object.is(value, b[index]))\n );\n}\n\n// The single rule for which errors can carry attribution: identity-keyed\n// (WeakMap/WeakSet) registries require object errors. Shared with the store's\n// per-generation value-error sets so the two can never disagree.\nexport function isAttributableError(value: unknown): value is object {\n return (\n (typeof value === \"object\" || typeof value === \"function\") && value !== null\n );\n}\n","import type { FigContext } from \"./context.ts\";\nimport type { DataResource, FigDataStore } from \"./data.ts\";\nimport { resolveCurrentDataStore } from \"./data.ts\";\nimport type { 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.\nexport type StateSetter<S> = (next: S | ((previous: S) => S)) => void;\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, and when an enclosing Activity hides.\nexport type ActionStateAction<S, Args extends unknown[]> = (\n previousState: S,\n ...argsAndSignal: [...Args, AbortSignal]\n) => S | PromiseLike<S>;\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 updates after an `await` remain in the transition priority\n * scope.\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. Each `useTransition` hook is one cancellation\n * domain — use separate hooks for independently cancellable workflows. An\n * aborted 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: (signal: AbortSignal) => void | PromiseLike<void>,\n options?: TransitionOptions,\n) => void;\ntype Callback = (...args: never[]) => unknown;\n\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 preloadData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n args: TArgs,\n ): void;\n readPromise<T>(promise: PromiseLike<T>): T;\n}\n\nexport type EffectCallback = (signal: AbortSignal) => undefined;\nexport type DependencyList = readonly unknown[];\n\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\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). Async actions run in a transition priority scope\n * and keep `isPending` true until they settle.\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.\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\nexport function useId(): string {\n return resolveDispatcher().useId();\n}\n\nexport function useDeferredValue<T>(value: T, initialValue?: T): T {\n return resolveDispatcher().useDeferredValue(\n value,\n initialValue,\n arguments.length > 1,\n );\n}\n\nexport function useMemo<T>(calculate: () => T, deps: DependencyList): T {\n return resolveDispatcher().useMemo(calculate, deps);\n}\n\nexport function useTransition(): [boolean, StartTransition] {\n return resolveDispatcher().useTransition();\n}\n\nexport function useCallback<T extends Callback>(\n callback: T,\n deps: DependencyList,\n): T {\n return resolveDispatcher().useMemo(() => callback, deps);\n}\n\nexport function useReactive(\n effect: EffectCallback,\n deps?: DependencyList,\n): void {\n resolveDispatcher().useReactive(effect, deps);\n}\n\nexport function useBeforePaint(\n effect: EffectCallback,\n deps?: DependencyList,\n): void {\n resolveDispatcher().useBeforePaint(effect, deps);\n}\n\nexport function useBeforeLayout(\n effect: EffectCallback,\n deps?: DependencyList,\n): void {\n resolveDispatcher().useBeforeLayout(effect, deps);\n}\n\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\nexport function useStableEvent<Args extends unknown[], Result>(\n handler: (...args: Args) => Result,\n): (...args: StableEventCallerArgs<Args>) => Result {\n return resolveDispatcher().useStableEvent(handler);\n}\n\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\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\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\nexport function preloadData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n): void {\n if (currentDispatcher !== null) {\n currentDispatcher.preloadData(resource, args);\n return;\n }\n\n resolveDataStore().preloadData(resource, ...args);\n}\n\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\nfunction resolveDataStore(): FigDataStore {\n return resolveCurrentDataStore(\n \"No ambient Fig data store. Data APIs work synchronously during render, \" +\n \"event handlers, actions, and effects — not after an await. Capture \" +\n \"readDataStore() (or root.data) synchronously and call the handle \" +\n \"instead.\",\n );\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\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}\n\nexport type EmptyMixinValue = false | 0 | 0n | \"\" | null | undefined;\n\nexport type MixinInput =\n | MixinDescriptor\n | EmptyMixinValue\n | ReadonlyArray<MixinInput>;\n\nexport type MixinResult = Props | MixinInput;\n\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\nexport interface MixinDescriptor {\n readonly $$typeof: symbol;\n readonly args: readonly unknown[];\n readonly type: MixinRuntimeType;\n}\n\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).\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\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\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 };\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 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\nexport function mixinSlot(context: MixinContext): string {\n return (context as MixinRuntimeContext)[FigMixinSlotSymbol];\n}\n\nexport function markClientOnlyHostBehavior(\n context: MixinContext,\n behavior: string,\n): void {\n const props = context.props as ClientOnlyHostProps;\n if (props[FigClientOnlyHostBehaviorSymbol] !== undefined) return;\n Object.defineProperty(context.props, FigClientOnlyHostBehaviorSymbol, {\n configurable: true,\n value: behavior,\n });\n}\n\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\nexport type Key = string | number;\nexport type Props = Record<string, any>;\nexport type ComponentType<P = Props> = (\n props: P & { children?: FigNode },\n) => FigNode;\nexport type ComponentProps<T extends ComponentType<any>> =\n Parameters<T> extends [infer P, ...unknown[]]\n ? P extends Props\n ? P\n : Props\n : {};\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>;\nexport type AwaitedFigNode =\n | FigElement<any>\n | FigPortal<any>\n | string\n | number\n | boolean\n | null\n | undefined\n | FigNode[];\nexport type FigNode = AwaitedFigNode | PromiseLike<AwaitedFigNode>;\n\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\nexport interface FigPortal<Target = unknown> {\n readonly $$typeof: symbol;\n readonly children: FigNode;\n readonly key: Key | null;\n readonly target: Target;\n}\n\nexport interface ClientReferenceOptions<P extends Props = Props> {\n assets?: ClientReferenceAssets;\n id: string;\n ssr?: ComponentType<P>;\n}\n\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\nexport type LazyLoader<T extends ComponentType<any> = ComponentType<any>> =\n () => PromiseLike<T>;\n\nexport interface SuspenseProps {\n fallback?: FigNode;\n children?: FigNode;\n}\n\nexport interface FigSuspense {\n (props: SuspenseProps): FigNode;\n readonly $$typeof: symbol;\n}\n\nexport type ActivityMode = \"visible\" | \"hidden\";\n\nexport interface ActivityProps {\n mode: ActivityMode;\n children?: FigNode;\n}\n\nexport interface FigActivity {\n (props: ActivityProps): FigNode;\n readonly $$typeof: symbol;\n}\n\nexport type ViewTransitionClass = \"auto\" | \"none\" | (string & {});\n\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.\nexport interface ViewTransitionSurface {\n readonly name: string;\n}\n\nexport interface ViewTransitionEvent {\n readonly phase: ViewTransitionPhase;\n readonly surfaces: readonly ViewTransitionSurface[];\n readonly types: readonly string[];\n}\n\nexport type ViewTransitionCallback = (\n event: ViewTransitionEvent,\n signal: AbortSignal,\n) => undefined;\n\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\nexport interface FigViewTransition {\n (props: ViewTransitionProps): FigNode;\n readonly $$typeof: symbol;\n}\n\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\nexport interface ErrorInfo {\n componentStack: string;\n dataResourceKeys?: DataResourceKey[];\n}\n\nexport interface FigErrorBoundary {\n (props: ErrorBoundaryProps): FigNode;\n readonly $$typeof: symbol;\n}\n\nexport interface FigAssets {\n (props: Props & { children?: FigNode }): FigNode;\n readonly $$typeof: symbol;\n}\n\nexport const Fragment = Symbol.for(\"fig.fragment\");\nexport const FigElementSymbol = Symbol.for(\"fig.element\");\nexport const FigClientReferenceSymbol = Symbol.for(\"fig.client-reference\");\nexport const FigActivitySymbol = Symbol.for(\"fig.activity\");\nexport const FigErrorBoundarySymbol = Symbol.for(\"fig.error-boundary\");\nexport const FigPortalSymbol = Symbol.for(\"fig.portal\");\nexport const FigAssetsSymbol = Symbol.for(\"fig.assets\");\nexport const FigSuspenseSymbol = Symbol.for(\"fig.suspense\");\nexport const FigViewTransitionSymbol = Symbol.for(\"fig.view-transition\");\n\nexport const Assets: FigAssets = Object.assign(\n (props: Props & { children?: FigNode }) => props.children,\n { $$typeof: FigAssetsSymbol },\n);\n\nexport const ErrorBoundary: FigErrorBoundary = Object.assign(\n (props: ErrorBoundaryProps) => props.children,\n { $$typeof: FigErrorBoundarySymbol },\n);\n\nexport const Suspense: FigSuspense = Object.assign(\n (props: SuspenseProps) => props.children,\n { $$typeof: FigSuspenseSymbol },\n);\n\nexport const Activity: FigActivity = Object.assign(\n (props: ActivityProps) => props.children,\n { $$typeof: FigActivitySymbol },\n);\n\nexport const ViewTransition: FigViewTransition = Object.assign(\n (props: ViewTransitionProps) => props.children,\n { $$typeof: FigViewTransitionSymbol },\n);\n\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\nexport function isValidElement(value: unknown): value is FigElement {\n return hasObjectBrand(value, FigElementSymbol);\n}\n\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\nexport function isPortal(value: unknown): value is FigPortal {\n return hasObjectBrand(value, FigPortalSymbol);\n}\n\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\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\nexport function isClientReference(value: unknown): value is FigClientReference {\n return hasFunctionBrand(value, FigClientReferenceSymbol);\n}\n\nexport function isSuspense(value: unknown): value is FigSuspense {\n return hasFunctionBrand(value, FigSuspenseSymbol);\n}\n\nexport function isActivity(value: unknown): value is FigActivity {\n return hasFunctionBrand(value, FigActivitySymbol);\n}\n\nexport function isErrorBoundary(value: unknown): value is FigErrorBoundary {\n return hasFunctionBrand(value, FigErrorBoundarySymbol);\n}\n\nexport function isViewTransition(value: unknown): value is FigViewTransition {\n return hasFunctionBrand(value, FigViewTransitionSymbol);\n}\n\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":";AAmKA,MAAM,gCAAgC,OAAO,IAAI,uBAAuB;AAKxE,SAAgB,8BACd,SACA,cACM;CACN,OAAO,eAAe,SAAS,+BAA+B;EAC5D,cAAc;EACd,YAAY;EACZ,OAAO;CACT,CAAC;AACH;AAEA,SAAgB,wBACd,SACqC;CACrC,OAAQ,QACN;AAEJ;AAEA,M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UAAU,QACV,UAAU;IACT,IAAI,YAAY,MAAM,WAAW;IACjC,MAAM;GACR,CACF;GACA,UAAU;EACZ;EAEA,IAAI;GACF,OAAO,cAAc,YAAY,OAAO,GAAG,KAAK;EAClD,SAAS,OAAO;GACd,IAAI,UAAU;IACZ,UAAU;IACV,WAAW;GACb;GACA,MAAM;EACR;CACF;CAEA,OAAO;AACT;AAEA,SAAgB,kBAAkB,OAA6C;CAC7E,OAAO,iBAAiB,OAAO,wBAAwB;AACzD;AAEA,SAAgB,WAAW,OAAsC;CAC/D,OAAO,iBAAiB,OAAO,iBAAiB;AAClD;AAEA,SAAgB,WAAW,OAAsC;CAC/D,OAAO,iBAAiB,OAAO,iBAAiB;AAClD;AAEA,SAAgB,gBAAgB,OAA2C;CACzE,OAAO,iBAAiB,OAAO,sBAAsB;AACvD;AAEA,SAAgB,iBAAiB,OAA4C;CAC3E,OAAO,iBAAiB,OAAO,uBAAuB;AACxD;AAEA,SAAgB,SAAS,OAAoC;CAC3D,OAAO,iBAAiB,OAAO,eAAe;AAChD;AAEA,SAAS,eAAe,OAAgB,OAAwB;CAC9D,OACE,OAAO,UAAU,YACjB,UAAU,QACV,cAAc,SACd,MAAM,aAAa;AAEvB;AAEA,SAAS,iBAAiB,OAAgB,OAAwB;CAChE,OACE,OAAO,UAAU,cACjB,cAAc,SACd,MAAM,aAAa;AAEvB"}
|
|
1
|
+
{"version":3,"file":"element-wieeFL9f.js","names":["runtimeType"],"sources":["../src/data.ts","../src/hooks.ts","../src/mixin.ts","../src/element.ts"],"sourcesContent":["export type DataResourceKeyInput =\n | string\n | number\n | boolean\n | null\n | readonly DataResourceKeyInput[]\n | { readonly [key: string]: DataResourceKeyInput };\n\nexport type DataResourceKey = readonly [string, ...DataResourceKeyInput[]];\n\nexport interface DataResourceLoadContext {\n signal: AbortSignal;\n}\n\nexport type DataResourceLoader<TArgs extends unknown[], TValue> = (\n ...argsAndContext: [...TArgs, DataResourceLoadContext]\n) => TValue | PromiseLike<TValue>;\n\nexport interface DataResource<\n TArgs extends unknown[] = unknown[],\n TValue = unknown,\n> {\n readonly $$typeof: symbol;\n readonly debugArgs?: (...args: TArgs) => DataResourceKeyInput;\n readonly key: (...args: TArgs) => DataResourceKey;\n readonly load?: DataResourceLoader<TArgs, TValue>;\n}\n\nexport type DataRefreshResult<T> =\n | { status: \"fulfilled\"; value: T }\n | { status: \"rejected\"; error: unknown; staleValue?: T }\n | {\n status: \"aborted\";\n reason: \"superseded\" | \"store-disposed\" | \"evicted\";\n staleValue?: T;\n }\n | {\n status: \"unsupported\";\n reason: \"no-client-loader\";\n staleValue?: T;\n };\n\nexport interface FigDataHydrationEntry {\n key: DataResourceKey;\n value: unknown;\n}\n\nexport type FigDataEntryStatus =\n | \"pending\"\n | \"fulfilled\"\n | \"rejected\"\n | \"refreshing\";\n\nexport interface DataStoreEntrySnapshot {\n canonicalKey: string;\n error?: unknown;\n hasValue: boolean;\n key: DataResourceKey;\n pending: boolean;\n refreshError?: unknown;\n stale: boolean;\n status: FigDataEntryStatus;\n subscriberCount: number;\n value?: unknown;\n}\n\n// The explicit, app-facing store surface (FigRoot.data, readDataStore()).\n// The free functions in @bgub/fig resolve the ambient store slot, which\n// is only set while Fig executes synchronously — render, event handlers, the\n// synchronous prefix of actions and transitions, and effects. After an\n// `await` the slot is gone, so async flows capture this handle first and call\n// its methods instead.\nexport interface FigDataStoreHandle {\n // The awaitable read for code outside render (route loaders, actions after\n // an await): resolve the value this key would render with — the cached\n // value when the entry has one (kicking the same background revalidation a\n // stale readData does), the in-flight load's settlement on a cache miss —\n // and reject with the error readData would throw. Does not subscribe;\n // pair with readData in the component, which claims the settled entry\n // within the preload retention window.\n ensureData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n ): Promise<TValue>;\n hydrate(entries: readonly FigDataHydrationEntry[]): void;\n invalidateData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n ): void;\n invalidateDataError(error: unknown): boolean;\n invalidateDataKey(key: DataResourceKey): void;\n invalidateDataPrefix(prefix: DataResourceKey): void;\n preloadData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n ): void;\n refreshData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n ): Promise<DataRefreshResult<TValue>>;\n run<T>(callback: () => T): T;\n}\n\n/**\n * A root-neutral data store. A renderer adopts it exactly once, preserving\n * entries loaded before rendering while attaching subscriber scheduling.\n */\nexport interface FigDataStoreController extends FigDataStoreHandle {\n dispose(): void;\n snapshot(): FigDataHydrationEntry[];\n}\n\nexport interface FigDataStoreOptions {\n initialData?: readonly FigDataHydrationEntry[];\n partition?: DataResourceKeyInput;\n}\n\nexport interface FigDataStore extends FigDataStoreHandle {\n commitDataDependencies(owner: object, previousOwner: object | null): void;\n deleteDataOwner(owner: object): void;\n releaseDataOwner(owner: object): void;\n resetDataDependencies(owner: object): void;\n dispose(): void;\n inspectDataDependencyCanonicalKeys(owner: object): string[];\n inspectDataEntries(): DataStoreEntrySnapshot[];\n snapshot(): FigDataHydrationEntry[];\n // Renderer plumbing, not handle surface: args stay an array because the\n // subscribing owner trails them.\n readData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n args: TArgs,\n owner: object,\n ): TValue;\n}\n\n// The host callbacks a renderer hands to the data-store factory. Structurally\n// compatible with @bgub/fig's DataStoreHost so its renderer store can\n// register directly.\nexport interface FigDataStoreHost {\n getLane(): unknown;\n partition?: DataResourceKeyInput;\n schedule(owner: object, lane: unknown): void;\n}\n\nexport type FigDataStoreFactory = (host: FigDataStoreHost) => FigDataStore;\n\n// The internal, generation-guarded metadata a store attaches to each loader\n// context (symbol-keyed: DataResourceLoadContext stays { signal } publicly).\n// Adapters use the resolved key and decode Payload rows through the calling\n// store without recomputing identity or exposing these capabilities to loaders.\nexport type LoadContextHydrate = (\n entries: readonly FigDataHydrationEntry[],\n) => void;\nexport type LoadContextAttributeError = (error: unknown) => void;\n\nexport interface LoadContextCapabilities {\n attributeError: LoadContextAttributeError;\n hydrate: LoadContextHydrate;\n // Store contexts always provide this; optional keeps synthetic decoder\n // contexts usable without pretending they belong to a cache entry.\n key?: DataResourceKey;\n}\n\nconst LoadContextCapabilitiesSymbol = Symbol.for(\"fig.data-load-context\");\ntype DataResourceLoadContextWithCapabilities = DataResourceLoadContext & {\n [LoadContextCapabilitiesSymbol]?: LoadContextCapabilities;\n};\n\nexport function defineLoadContextCapabilities(\n context: DataResourceLoadContext,\n capabilities: LoadContextCapabilities,\n): void {\n Object.defineProperty(context, LoadContextCapabilitiesSymbol, {\n configurable: true,\n enumerable: false,\n value: capabilities,\n });\n}\n\nexport function loadContextCapabilities(\n context: DataResourceLoadContext,\n): LoadContextCapabilities | undefined {\n return (context as DataResourceLoadContextWithCapabilities)[\n LoadContextCapabilitiesSymbol\n ];\n}\n\nconst objectDataErrors = new WeakMap<object, DataResourceKey[]>();\n\nlet currentDataStore: FigDataStore | null = null;\n\nexport function resolveCurrentDataStore(\n message = \"Data resource APIs require a Fig data store.\",\n): FigDataStore {\n if (currentDataStore === null) throw new Error(message);\n return currentDataStore;\n}\n\nexport function setCurrentDataStore(\n store: FigDataStore | null,\n): FigDataStore | null {\n const previousStore = currentDataStore;\n currentDataStore = store;\n return previousStore;\n}\n\nexport function markDataResourceError(\n error: unknown,\n key: DataResourceKey,\n): void {\n // Only object errors are attributed: the WeakMap keys them by identity, so the\n // registry is GC-safe and cannot cross-attribute. Primitive rejection values\n // would collide by value and accumulate forever in a plain Map, so a thrown\n // primitive simply carries no resource-key metadata.\n if (!isAttributableError(error)) return;\n\n let keys = objectDataErrors.get(error);\n if (keys === undefined) {\n keys = [];\n objectDataErrors.set(error, keys);\n }\n\n if (keys.some((existing) => sameDataResourceKey(existing, key))) return;\n\n keys.push(key);\n}\n\nexport function dataResourceKeysForError(\n error: unknown,\n): DataResourceKey[] | undefined {\n if (!isAttributableError(error)) return undefined;\n\n const keys = objectDataErrors.get(error);\n return keys === undefined || keys.length === 0 ? undefined : [...keys];\n}\n\nfunction sameDataResourceKey(a: DataResourceKey, b: DataResourceKey): boolean {\n return (\n a.length === b.length &&\n a.every((value, index) => Object.is(value, b[index]))\n );\n}\n\n// The single rule for which errors can carry attribution: identity-keyed\n// (WeakMap/WeakSet) registries require object errors. Shared with the store's\n// per-generation value-error sets so the two can never disagree.\nexport function isAttributableError(value: unknown): value is object {\n return (\n (typeof value === \"object\" || typeof value === \"function\") && value !== null\n );\n}\n","import type { FigContext } from \"./context.ts\";\nimport type { DataResource, FigDataStore } from \"./data.ts\";\nimport { resolveCurrentDataStore } from \"./data.ts\";\nimport type { 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.\nexport type StateSetter<S> = (next: S | ((previous: S) => S)) => void;\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, and when an enclosing Activity hides.\nexport type ActionStateAction<S, Args extends unknown[]> = (\n previousState: S,\n ...argsAndSignal: [...Args, AbortSignal]\n) => S | PromiseLike<S>;\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 updates after an `await` remain in the transition priority\n * scope.\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. Each `useTransition` hook is one cancellation\n * domain — use separate hooks for independently cancellable workflows. An\n * aborted 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: (signal: AbortSignal) => void | PromiseLike<void>,\n options?: TransitionOptions,\n) => void;\ntype Callback = (...args: never[]) => unknown;\n\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 preloadData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n args: TArgs,\n ): void;\n readPromise<T>(promise: PromiseLike<T>): T;\n}\n\nexport type EffectCallback = (signal: AbortSignal) => undefined;\nexport type DependencyList = readonly unknown[];\n\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\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). Async actions run in a transition priority scope\n * and keep `isPending` true until they settle.\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.\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\nexport function useId(): string {\n return resolveDispatcher().useId();\n}\n\nexport function useDeferredValue<T>(value: T, initialValue?: T): T {\n return resolveDispatcher().useDeferredValue(\n value,\n initialValue,\n arguments.length > 1,\n );\n}\n\nexport function useMemo<T>(calculate: () => T, deps: DependencyList): T {\n return resolveDispatcher().useMemo(calculate, deps);\n}\n\nexport function useTransition(): [boolean, StartTransition] {\n return resolveDispatcher().useTransition();\n}\n\nexport function useCallback<T extends Callback>(\n callback: T,\n deps: DependencyList,\n): T {\n return resolveDispatcher().useMemo(() => callback, deps);\n}\n\nexport function useReactive(\n effect: EffectCallback,\n deps?: DependencyList,\n): void {\n resolveDispatcher().useReactive(effect, deps);\n}\n\nexport function useBeforePaint(\n effect: EffectCallback,\n deps?: DependencyList,\n): void {\n resolveDispatcher().useBeforePaint(effect, deps);\n}\n\nexport function useBeforeLayout(\n effect: EffectCallback,\n deps?: DependencyList,\n): void {\n resolveDispatcher().useBeforeLayout(effect, deps);\n}\n\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\nexport function useStableEvent<Args extends unknown[], Result>(\n handler: (...args: Args) => Result,\n): (...args: StableEventCallerArgs<Args>) => Result {\n return resolveDispatcher().useStableEvent(handler);\n}\n\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\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\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\nexport function preloadData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n): void {\n if (currentDispatcher !== null) {\n currentDispatcher.preloadData(resource, args);\n return;\n }\n\n resolveDataStore().preloadData(resource, ...args);\n}\n\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\nfunction resolveDataStore(): FigDataStore {\n return resolveCurrentDataStore(\n \"No ambient Fig data store. Data APIs work synchronously during render, \" +\n \"event handlers, actions, and effects — not after an await. Capture \" +\n \"readDataStore() (or root.data) synchronously and call the handle \" +\n \"instead.\",\n );\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\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}\n\nexport type EmptyMixinValue = false | 0 | 0n | \"\" | null | undefined;\n\nexport type MixinInput =\n | MixinDescriptor\n | EmptyMixinValue\n | ReadonlyArray<MixinInput>;\n\nexport type MixinResult = Props | MixinInput;\n\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\nexport interface MixinDescriptor {\n readonly $$typeof: symbol;\n readonly args: readonly unknown[];\n readonly type: MixinRuntimeType;\n}\n\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).\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\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\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 };\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 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\nexport function mixinSlot(context: MixinContext): string {\n return (context as MixinRuntimeContext)[FigMixinSlotSymbol];\n}\n\nexport function markClientOnlyHostBehavior(\n context: MixinContext,\n behavior: string,\n): void {\n markClientOnlyHostProps(context.props, behavior);\n}\n\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\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\nexport type Key = string | number;\nexport type Props = Record<string, any>;\nexport type ComponentType<P = Props> = (\n props: P & { children?: FigNode },\n) => FigNode;\nexport type ComponentProps<T extends ComponentType<any>> =\n Parameters<T> extends [infer P, ...unknown[]]\n ? P extends Props\n ? P\n : Props\n : {};\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>;\nexport type AwaitedFigNode =\n | FigElement<any>\n | FigPortal<any>\n | string\n | number\n | boolean\n | null\n | undefined\n | FigNode[];\nexport type FigNode = AwaitedFigNode | PromiseLike<AwaitedFigNode>;\n\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\nexport interface FigPortal<Target = unknown> {\n readonly $$typeof: symbol;\n readonly children: FigNode;\n readonly key: Key | null;\n readonly target: Target;\n}\n\nexport interface ClientReferenceOptions<P extends Props = Props> {\n assets?: ClientReferenceAssets;\n id: string;\n ssr?: ComponentType<P>;\n}\n\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\nexport type LazyLoader<T extends ComponentType<any> = ComponentType<any>> =\n () => PromiseLike<T>;\n\nexport interface SuspenseProps {\n fallback?: FigNode;\n children?: FigNode;\n}\n\nexport interface FigSuspense {\n (props: SuspenseProps): FigNode;\n readonly $$typeof: symbol;\n}\n\nexport type ActivityMode = \"visible\" | \"hidden\";\n\nexport interface ActivityProps {\n mode: ActivityMode;\n children?: FigNode;\n}\n\nexport interface FigActivity {\n (props: ActivityProps): FigNode;\n readonly $$typeof: symbol;\n}\n\nexport type ViewTransitionClass = \"auto\" | \"none\" | (string & {});\n\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.\nexport interface ViewTransitionSurface {\n readonly name: string;\n}\n\nexport interface ViewTransitionEvent {\n readonly phase: ViewTransitionPhase;\n readonly surfaces: readonly ViewTransitionSurface[];\n readonly types: readonly string[];\n}\n\nexport type ViewTransitionCallback = (\n event: ViewTransitionEvent,\n signal: AbortSignal,\n) => undefined;\n\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\nexport interface FigViewTransition {\n (props: ViewTransitionProps): FigNode;\n readonly $$typeof: symbol;\n}\n\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\nexport interface ErrorInfo {\n componentStack: string;\n dataResourceKeys?: DataResourceKey[];\n}\n\nexport interface FigErrorBoundary {\n (props: ErrorBoundaryProps): FigNode;\n readonly $$typeof: symbol;\n}\n\nexport interface FigAssets {\n (props: Props & { children?: FigNode }): FigNode;\n readonly $$typeof: symbol;\n}\n\nexport const Fragment = Symbol.for(\"fig.fragment\");\nexport const FigElementSymbol = Symbol.for(\"fig.element\");\nexport const FigClientReferenceSymbol = Symbol.for(\"fig.client-reference\");\nexport const FigActivitySymbol = Symbol.for(\"fig.activity\");\nexport const FigErrorBoundarySymbol = Symbol.for(\"fig.error-boundary\");\nexport const FigPortalSymbol = Symbol.for(\"fig.portal\");\nexport const FigAssetsSymbol = Symbol.for(\"fig.assets\");\nexport const FigSuspenseSymbol = Symbol.for(\"fig.suspense\");\nexport const FigViewTransitionSymbol = Symbol.for(\"fig.view-transition\");\n\nexport const Assets: FigAssets = Object.assign(\n (props: Props & { children?: FigNode }) => props.children,\n { $$typeof: FigAssetsSymbol },\n);\n\nexport const ErrorBoundary: FigErrorBoundary = Object.assign(\n (props: ErrorBoundaryProps) => props.children,\n { $$typeof: FigErrorBoundarySymbol },\n);\n\nexport const Suspense: FigSuspense = Object.assign(\n (props: SuspenseProps) => props.children,\n { $$typeof: FigSuspenseSymbol },\n);\n\nexport const Activity: FigActivity = Object.assign(\n (props: ActivityProps) => props.children,\n { $$typeof: FigActivitySymbol },\n);\n\nexport const ViewTransition: FigViewTransition = Object.assign(\n (props: ViewTransitionProps) => props.children,\n { $$typeof: FigViewTransitionSymbol },\n);\n\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\nexport function isValidElement(value: unknown): value is FigElement {\n return hasObjectBrand(value, FigElementSymbol);\n}\n\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\nexport function isPortal(value: unknown): value is FigPortal {\n return hasObjectBrand(value, FigPortalSymbol);\n}\n\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\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\nexport function isClientReference(value: unknown): value is FigClientReference {\n return hasFunctionBrand(value, FigClientReferenceSymbol);\n}\n\nexport function isSuspense(value: unknown): value is FigSuspense {\n return hasFunctionBrand(value, FigSuspenseSymbol);\n}\n\nexport function isActivity(value: unknown): value is FigActivity {\n return hasFunctionBrand(value, FigActivitySymbol);\n}\n\nexport function isErrorBoundary(value: unknown): value is FigErrorBoundary {\n return hasFunctionBrand(value, FigErrorBoundarySymbol);\n}\n\nexport function isViewTransition(value: unknown): value is FigViewTransition {\n return hasFunctionBrand(value, FigViewTransitionSymbol);\n}\n\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":";AAmKA,MAAM,gCAAgC,OAAO,IAAI,uBAAuB;AAKxE,SAAgB,8BACd,SACA,cACM;CACN,OAAO,eAAe,SAAS,+BAA+B;EAC5D,cAAc;EACd,YAAY;EACZ,OAAO;CACT,CAAC;AACH;AAEA,SAAgB,wBACd,SACqC;CACrC,OAAQ,QACN;AAEJ;AAEA,MAAM,mCAAmB,IAAI,QAAmC;AAEhE,IAAI,mBAAwC;AAE5C,SAAgB,wBACd,UAAU,gDACI;CACd,IAAI,qBAAqB,MAAM,MAAM,IAAI,MAAM,OAAO;CACtD,OAAO;AACT;AAEA,SAAgB,oBACd,OACqB;CACrB,MAAM,gBAAgB;CACtB,mBAAmB;CACnB,OAAO;AACT;AAEA,SAAgB,sBACd,OACA,KACM;CAKN,IAAI,CAAC,oBAAoB,KAAK,GAAG;CAEjC,IAAI,OAAO,iBAAiB,IAAI,KAAK;CACrC,IAAI,SAAS,KAAA,GAAW;EACtB,OAAO,CAAC;EACR,iBAAiB,IAAI,OAAO,IAAI;CAClC;CAEA,IAAI,KAAK,MAAM,aAAa,oBAAoB,UAAU,GAAG,CAAC,GAAG;CAEjE,KAAK,KAAK,GAAG;AACf;AAEA,SAAgB,yBACd,OAC+B;CAC/B,IAAI,CAAC,oBAAoB,KAAK,GAAG,OAAO,KAAA;CAExC,MAAM,OAAO,iBAAiB,IAAI,KAAK;CACvC,OAAO,SAAS,KAAA,KAAa,KAAK,WAAW,IAAI,KAAA,IAAY,CAAC,GAAG,IAAI;AACvE;AAEA,SAAS,oBAAoB,GAAoB,GAA6B;CAC5E,OACE,EAAE,WAAW,EAAE,UACf,EAAE,OAAO,OAAO,UAAU,OAAO,G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,SACd,MAAM,aAAa;AAEvB;AAEA,SAAS,iBAAiB,OAAgB,OAAwB;CAChE,OACE,OAAO,UAAU,cACjB,cAAc,SACd,MAAM,aAAa;AAEvB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bt as DataResourceKeyInput, C as FigNode, Gt as FigDataHydrationEntry, Ht as DataResourceLoader, Kt as FigDataStore, Lt as DataRefreshResult, N as Props, Rt as DataResource, Ut as DataStoreEntrySnapshot, Xt as FigDataStoreHost, Yt as FigDataStoreHandle, Zt as FigDataStoreOptions, qt as FigDataStoreController, zt as DataResourceKey } from "./element-
|
|
1
|
+
import { Bt as DataResourceKeyInput, C as FigNode, Gt as FigDataHydrationEntry, Ht as DataResourceLoader, Kt as FigDataStore, Lt as DataRefreshResult, N as Props, Rt as DataResource, Ut as DataStoreEntrySnapshot, Xt as FigDataStoreHost, Yt as FigDataStoreHandle, Zt as FigDataStoreOptions, qt as FigDataStoreController, zt as DataResourceKey } from "./element-Od8CmsBL.js";
|
|
2
2
|
//#region src/context.d.ts
|
|
3
3
|
interface FigContext<T> {
|
|
4
4
|
(props: {
|
|
@@ -70,11 +70,18 @@ declare function createMixin<TArgs extends unknown[]>(type: MixinType<TArgs>): M
|
|
|
70
70
|
declare function resolveHostMix<P extends Props>(type: string, input: P): P;
|
|
71
71
|
declare function mixinSlot(context: MixinContext): string;
|
|
72
72
|
declare function markClientOnlyHostBehavior(context: MixinContext, behavior: string): void;
|
|
73
|
+
declare function markClientOnlyHostProps(value: object, behavior: string): void;
|
|
73
74
|
declare function clientOnlyHostBehavior(props: object): string | undefined;
|
|
74
75
|
//#endregion
|
|
75
76
|
//#region src/transition.d.ts
|
|
76
77
|
interface TransitionOptions {
|
|
77
78
|
types?: readonly string[];
|
|
79
|
+
/**
|
|
80
|
+
* Interrupts an active native View Transition before committing this
|
|
81
|
+
* transition. The new commit still waits for the interrupted transition to
|
|
82
|
+
* settle so host restoration cannot race its old-state snapshot.
|
|
83
|
+
*/
|
|
84
|
+
viewTransition?: "interrupt";
|
|
78
85
|
}
|
|
79
86
|
type TransitionHandler = <T>(callback: () => T, options?: TransitionOptions) => T;
|
|
80
87
|
/**
|
|
@@ -155,4 +162,4 @@ declare function readData<TArgs extends unknown[], TValue>(resource: DataResourc
|
|
|
155
162
|
declare function preloadData<TArgs extends unknown[], TValue>(resource: DataResource<TArgs, TValue>, ...args: TArgs): void;
|
|
156
163
|
declare function setCurrentDispatcher(dispatcher: RenderDispatcher | null): RenderDispatcher | null;
|
|
157
164
|
//#endregion
|
|
158
|
-
export {
|
|
165
|
+
export { ensureData as $, transition as A, createMixin as B, useStableEvent as C, TransitionHandler as D, useTransition as E, MixinFactory as F, DataResourceOptions as G, markClientOnlyHostProps as H, MixinInput as I, attachDataStore as J, DataStore as K, MixinResult as L, FigMixinSymbol as M, MixinContext as N, TransitionOptions as O, MixinDescriptor as P, dataResource as Q, MixinType as R, useReactive as S, useSyncExternalStore as T, mixinSlot as U, markClientOnlyHostBehavior as V, resolveHostMix as W, createRendererDataStore as X, createDataStore as Y, currentDataStore as Z, useBeforePaint as _, ExternalStoreSubscribe as a, normalizeDataResourceKey as at, useId as b, StartTransition as c, runWithDataStore as ct, readContext as d, createContext as dt, invalidateData as et, readData as f, isContext as ft, useBeforeLayout as g, useActionState as h, EffectCallback as i, isDataStoreController as it, EmptyMixinValue as j, setTransitionHandler as k, StateSetter as l, FigContext as lt, setCurrentDispatcher as m, ActionStateRunner as n, invalidateDataKey as nt, RenderDispatcher as o, readDataStore as ot, readPromise as p, DataStoreHost as q, DependencyList as r, invalidateDataPrefix as rt, StableEventCallerArgs as s, refreshData as st, ActionStateAction as t, invalidateDataError as tt, preloadData as u, FigContextSymbol as ut, useCallback as v, useState as w, useMemo as x, useDeferredValue as y, clientOnlyHostBehavior as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as Fragment, At as modulepreload, B as ViewTransitionPhase, Bt as DataResourceKeyInput, C as FigNode, Dt as font, F as SuspenseProps, Ft as stylesheet, Gt as FigDataHydrationEntry, H as ViewTransitionSurface, Ht as DataResourceLoader, I as ViewTransition, It as title, L as ViewTransitionCallback, Lt as DataRefreshResult, M as LazyLoader, Mt as preload, N as Props, O as FigViewTransition, P as Suspense, Pt as script, Q as isValidElement, R as ViewTransitionClass, Rt as DataResource, Tt as assets, U as clientReference, V as ViewTransitionProps, Vt as DataResourceLoadContext, W as createElement, Yt as FigDataStoreHandle, Zt as FigDataStoreOptions, _ as FigClientReference, _t as StylesheetResource, a as AwaitedFigNode, at as ClientReferenceAssets, c as ComponentType, ct as FigAssetResource, d as ErrorBoundaryProps, dt as MetaResource, et as lazy, f as ErrorInfo, ft as MetaResourceOptions, gt as ScriptResource, ht as PreloadResource, it as AssetsProps, j as Key, jt as preconnect, kt as meta, l as ElementType, lt as FigAssetResourceList, mt as PreconnectResource, n as ActivityMode, o as ClientReferenceOptions, ot as CrossOrigin, pt as ModulePreloadResource, qt as FigDataStoreController, r as ActivityProps, s as ComponentProps, st as FetchPriority, t as Activity, tt as AssetResourceBlocking, u as ErrorBoundary, ut as FontResource, vt as TitleResource, w as FigPortal, y as FigElement, z as ViewTransitionEvent, zt as DataResourceKey } from "./element-
|
|
2
|
-
import { $ as
|
|
1
|
+
import { A as Fragment, At as modulepreload, B as ViewTransitionPhase, Bt as DataResourceKeyInput, C as FigNode, Dt as font, F as SuspenseProps, Ft as stylesheet, Gt as FigDataHydrationEntry, H as ViewTransitionSurface, Ht as DataResourceLoader, I as ViewTransition, It as title, L as ViewTransitionCallback, Lt as DataRefreshResult, M as LazyLoader, Mt as preload, N as Props, O as FigViewTransition, P as Suspense, Pt as script, Q as isValidElement, R as ViewTransitionClass, Rt as DataResource, Tt as assets, U as clientReference, V as ViewTransitionProps, Vt as DataResourceLoadContext, W as createElement, Yt as FigDataStoreHandle, Zt as FigDataStoreOptions, _ as FigClientReference, _t as StylesheetResource, a as AwaitedFigNode, at as ClientReferenceAssets, c as ComponentType, ct as FigAssetResource, d as ErrorBoundaryProps, dt as MetaResource, et as lazy, f as ErrorInfo, ft as MetaResourceOptions, gt as ScriptResource, ht as PreloadResource, it as AssetsProps, j as Key, jt as preconnect, kt as meta, l as ElementType, lt as FigAssetResourceList, mt as PreconnectResource, n as ActivityMode, o as ClientReferenceOptions, ot as CrossOrigin, pt as ModulePreloadResource, qt as FigDataStoreController, r as ActivityProps, s as ComponentProps, st as FetchPriority, t as Activity, tt as AssetResourceBlocking, u as ErrorBoundary, ut as FontResource, vt as TitleResource, w as FigPortal, y as FigElement, z as ViewTransitionEvent, zt as DataResourceKey } from "./element-Od8CmsBL.js";
|
|
2
|
+
import { $ as ensureData, A as transition, B as createMixin, C as useStableEvent, E as useTransition, F as MixinFactory, G as DataResourceOptions, I as MixinInput, L as MixinResult, N as MixinContext, O as TransitionOptions, P as MixinDescriptor, Q as dataResource, R as MixinType, S as useReactive, T as useSyncExternalStore, Y as createDataStore, _ as useBeforePaint, a as ExternalStoreSubscribe, b as useId, c as StartTransition, d as readContext, dt as createContext, et as invalidateData, f as readData, g as useBeforeLayout, h as useActionState, i as EffectCallback, j as EmptyMixinValue, l as StateSetter, lt as FigContext, n as ActionStateRunner, nt as invalidateDataKey, ot as readDataStore, p as readPromise, r as DependencyList, rt as invalidateDataPrefix, st as refreshData, t as ActionStateAction, tt as invalidateDataError, u as preloadData, v as useCallback, w as useState, x as useMemo, y as useDeferredValue } from "./hooks-BSqKOOez.js";
|
|
3
3
|
export { type ActionStateAction, type ActionStateRunner, Activity, type ActivityMode, type ActivityProps, type AssetResourceBlocking, type AssetsProps, type AwaitedFigNode, type ClientReferenceAssets, type ClientReferenceOptions, type ComponentProps, type ComponentType, type CrossOrigin, type DataRefreshResult, type DataResource, type DataResourceKey, type DataResourceKeyInput, type DataResourceLoadContext, type DataResourceLoader, type DataResourceOptions, type DependencyList, type EffectCallback, type ElementType, type EmptyMixinValue, ErrorBoundary, type ErrorBoundaryProps, type ErrorInfo, type ExternalStoreSubscribe, type FetchPriority, type FigAssetResource, type FigAssetResourceList, type FigClientReference, type FigContext, type FigDataHydrationEntry, type FigDataStoreController, type FigDataStoreHandle, type FigDataStoreOptions, type FigElement, type FigNode, type FigPortal, type FigViewTransition, type FontResource, Fragment, type Key, type LazyLoader, type MetaResource, type MetaResourceOptions, type MixinContext, type MixinDescriptor, type MixinFactory, type MixinInput, type MixinResult, type MixinType, type ModulePreloadResource, type PreconnectResource, type PreloadResource, type Props, type ScriptResource, type StartTransition, type StateSetter, type StylesheetResource, Suspense, type SuspenseProps, type TitleResource, type TransitionOptions, ViewTransition, type ViewTransitionCallback, type ViewTransitionClass, type ViewTransitionEvent, type ViewTransitionPhase, type ViewTransitionProps, type ViewTransitionSurface, assets, clientReference, createContext, createDataStore, createElement, createMixin, dataResource, ensureData, font, invalidateData, invalidateDataError, invalidateDataKey, invalidateDataPrefix, isValidElement, lazy, meta, modulepreload, preconnect, preload, preloadData, readContext, readData, readDataStore, readPromise, refreshData, script, stylesheet, title, transition, useActionState, useBeforeLayout, useBeforePaint, useCallback, useDeferredValue, useId, useMemo, useReactive, useStableEvent, useState, useSyncExternalStore, useTransition };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as ensureData, d as invalidateDataKey, f as invalidateDataPrefix, g as refreshData, h as readDataStore, i as createDataStore, l as invalidateData, n as transition, s as dataResource, u as invalidateDataError, y as createContext } from "./transition-
|
|
2
|
-
import { B as
|
|
3
|
-
import { _ as stylesheet, d as meta, f as modulepreload, g as script, l as font, m as preload, p as preconnect, s as assets, v as title } from "./resource-
|
|
1
|
+
import { c as ensureData, d as invalidateDataKey, f as invalidateDataPrefix, g as refreshData, h as readDataStore, i as createDataStore, l as invalidateData, n as transition, s as dataResource, u as invalidateDataError, y as createContext } from "./transition-DBjQTorq.js";
|
|
2
|
+
import { B as useBeforeLayout, E as lazy, F as readContext, G as useMemo, H as useCallback, I as readData, J as useState, K as useReactive, L as readPromise, P as preloadData, U as useDeferredValue, V as useBeforePaint, W as useId, X as useTransition, Y as useSyncExternalStore, f as Fragment, g as createElement, h as clientReference, k as createMixin, m as ViewTransition, p as Suspense, q as useStableEvent, r as ErrorBoundary, t as Activity, w as isValidElement, z as useActionState } from "./element-wieeFL9f.js";
|
|
3
|
+
import { _ as stylesheet, d as meta, f as modulepreload, g as script, l as font, m as preload, p as preconnect, s as assets, v as title } from "./resource-BfNHyXun.js";
|
|
4
4
|
export { Activity, ErrorBoundary, Fragment, Suspense, ViewTransition, assets, clientReference, createContext, createDataStore, createElement, createMixin, dataResource, ensureData, font, invalidateData, invalidateDataError, invalidateDataKey, invalidateDataPrefix, isValidElement, lazy, meta, modulepreload, preconnect, preload, preloadData, readContext, readData, readDataStore, readPromise, refreshData, script, stylesheet, title, transition, useActionState, useBeforeLayout, useBeforePaint, useCallback, useDeferredValue, useId, useMemo, useReactive, useStableEvent, useState, useSyncExternalStore, useTransition };
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as isViewTransition, $t as LoadContextCapabilities, B as ViewTransitionPhase, Bt as DataResourceKeyInput, C as FigNode, Ct as
|
|
2
|
-
import { D as TransitionHandler,
|
|
1
|
+
import { $ as isViewTransition, $t as LoadContextCapabilities, B as ViewTransitionPhase, Bt as DataResourceKeyInput, C as FigNode, Ct as assetResourceHostProps, D as FigSuspenseSymbol, E as FigSuspense, Et as clientReferenceAssets, F as SuspenseProps, G as createPortalNode, Gt as FigDataHydrationEntry, H as ViewTransitionSurface, J as isClientReference, Jt as FigDataStoreFactory, K as isActivity, Kt as FigDataStore, L as ViewTransitionCallback, Lt as DataRefreshResult, M as LazyLoader, N as Props, Nt as preventAssetResourceHoist, O as FigViewTransition, Ot as isFigAssetResource, Qt as LoadContextAttributeError, R as ViewTransitionClass, Rt as DataResource, S as FigErrorBoundarySymbol, St as assetResourceFromHostValues, T as FigPortalSymbol, Ut as DataStoreEntrySnapshot, V as ViewTransitionProps, Vt as DataResourceLoadContext, Wt as FigDataEntryStatus, X as isPortal, Xt as FigDataStoreHost, Y as isErrorBoundary, Yt as FigDataStoreHandle, Z as isSuspense, Zt as FigDataStoreOptions, _ as FigClientReference, _t as StylesheetResource, a as AwaitedFigNode, an as resolveCurrentDataStore, at as ClientReferenceAssets, b as FigElementSymbol, bt as assetResourceFromHostAttributes, d as ErrorBoundaryProps, dt as MetaResource, en as LoadContextHydrate, f as ErrorInfo, g as FigAssetsSymbol, gt as ScriptResource, h as FigAssets, ht as PreloadResource, i as Assets, in as markDataResourceError, j as Key, k as FigViewTransitionSymbol, l as ElementType, m as FigActivitySymbol, mt as PreconnectResource, nn as defineLoadContextCapabilities, nt as AssetResourceDestination, o as ClientReferenceOptions, on as setCurrentDataStore, p as FigActivity, pt as ModulePreloadResource, q as isAssets, qt as FigDataStoreController, r as ActivityProps, rn as loadContextCapabilities, rt as AssetResourceHostProps, tn as dataResourceKeysForError, ut as FontResource, v as FigClientReferenceSymbol, vt as TitleResource, w as FigPortal, wt as assetResourceKey, x as FigErrorBoundary, xt as assetResourceFromHostProps, y as FigElement, yt as assetResourceDestination, z as ViewTransitionEvent, zt as DataResourceKey } from "./element-Od8CmsBL.js";
|
|
2
|
+
import { D as TransitionHandler, H as markClientOnlyHostProps, J as attachDataStore, K as DataStore, M as FigMixinSymbol, O as TransitionOptions, U as mixinSlot, V as markClientOnlyHostBehavior, W as resolveHostMix, X as createRendererDataStore, Y as createDataStore, Z as currentDataStore, at as normalizeDataResourceKey, ct as runWithDataStore, ft as isContext, it as isDataStoreController, k as setTransitionHandler, lt as FigContext, m as setCurrentDispatcher, o as RenderDispatcher, q as DataStoreHost, s as StableEventCallerArgs, ut as FigContextSymbol, z as clientOnlyHostBehavior } from "./hooks-BSqKOOez.js";
|
|
3
3
|
//#region src/children.d.ts
|
|
4
4
|
type NormalizedChild = FigElement<any> | FigPortal<any> | PromiseLike<AwaitedFigNode> | string;
|
|
5
5
|
declare function collectChildren(node: FigNode): NormalizedChild[];
|
|
@@ -210,7 +210,7 @@ declare function serializePayloadSet(value: Set<unknown>, graph: PayloadGraphEnc
|
|
|
210
210
|
declare function checkpointPayloadGraph(graph: PayloadGraphEncodeContext): number;
|
|
211
211
|
declare function rollbackPayloadGraph(graph: PayloadGraphEncodeContext, checkpoint: number): void;
|
|
212
212
|
declare function definePayloadGraphElement(graph: PayloadGraphEncodeContext, value: object): number | PayloadSpecialModel;
|
|
213
|
-
declare function serializePayloadArray<T>(value:
|
|
213
|
+
declare function serializePayloadArray<T>(value: readonly T[], graph: PayloadGraphEncodeContext, encodeChild: (value: T) => PayloadModel): PayloadModel;
|
|
214
214
|
declare function serializePayloadPlainObject(value: object, graph: PayloadGraphEncodeContext, encodeChild: (value: unknown) => PayloadModel): PayloadModel;
|
|
215
215
|
/** Decode values produced by encodePayloadValue. */
|
|
216
216
|
declare function decodePayloadValue(model: PayloadModel): unknown;
|
|
@@ -241,4 +241,4 @@ declare function trackThenable<T>(thenable: PromiseLike<T>): void;
|
|
|
241
241
|
declare function readThenable<T>(thenable: PromiseLike<T>): T;
|
|
242
242
|
declare function isThenable(value: unknown): value is Thenable;
|
|
243
243
|
//#endregion
|
|
244
|
-
export { ACTIVITY_TEMPLATE_ATTRIBUTE, type ActivityProps, type AssetResourceDestination, type
|
|
244
|
+
export { ACTIVITY_TEMPLATE_ATTRIBUTE, type ActivityProps, type AssetResourceDestination, type AssetResourceHostProps, Assets, type AwaitedFigNode, type ClientReferenceAssets, type ClientReferenceOptions, type DataRefreshResult, type DataResource, type DataResourceKey, type DataResourceKeyInput, type DataResourceLoadContext, type DataStore, type DataStoreEntrySnapshot, type DataStoreHost, EARLY_EVENT_HANDLER_PROPERTY, EARLY_EVENT_QUEUE_PROPERTY, type ElementType, type ErrorBoundaryProps, type ErrorInfo, type FigActivity, FigActivitySymbol, type FigAssets, FigAssetsSymbol, type FigClientReference, FigClientReferenceSymbol, type FigContext, FigContextSymbol, type FigDataEntryStatus, type FigDataHydrationEntry, type FigDataStore, type FigDataStoreController, type FigDataStoreFactory, type FigDataStoreHandle, type FigDataStoreHost, type FigDataStoreOptions, type FigElement, FigElementSymbol, type FigErrorBoundary, FigErrorBoundarySymbol, FigMixinSymbol, type FigNode, type FigPortal, FigPortalSymbol, type FigSuspense, FigSuspenseSymbol, type FigViewTransition, FigViewTransitionSymbol, HYDRATION_SKIP_ATTRIBUTE, type Key, type LazyLoader, type LoadContextAttributeError, type LoadContextCapabilities, type LoadContextHydrate, type NormalizedChild, type PayloadDataHydrationEntry, type PayloadElementModel, type PayloadGraphEncodeContext, type PayloadModel, type PayloadRow, type PayloadSpecialModel, type Props, REPLAYABLE_EVENT_TYPES, type RenderDispatcher, SUSPENSE_CLIENT_MARKER, SUSPENSE_COMPLETED_MARKER, SUSPENSE_END_MARKER, SUSPENSE_MARKER_PREFIX, SUSPENSE_PENDING_PREFIX, type SerializedAssetResource, type StableEventCallerArgs, type SuspenseProps, TEXT_SEPARATOR_DATA, type Thenable, type TransitionHandler, type TransitionOptions, VIEW_TRANSITION_CLASS_ATTRIBUTE, VIEW_TRANSITION_NAME_ATTRIBUTE, VIEW_TRANSITION_PENDING_PROPERTY, VIEW_TRANSITION_TIMEOUT_MS, type ViewTransitionCallback, type ViewTransitionClass, type ViewTransitionEvent, type ViewTransitionPhase, type ViewTransitionProps, type ViewTransitionSurface, assertPayloadCodecMatches, assetResourceDestination, assetResourceFromHostAttributes, assetResourceFromHostProps, assetResourceFromHostValues, assetResourceHostProps, assetResourceKey, attachDataStore, checkpointPayloadGraph, clientOnlyHostBehavior, clientReferenceAssets, collectChildren, createDataStore, createPayloadGraphEncodeContext, createPortalNode, createRendererDataStore, currentDataStore, dataResourceKeysForError, decodePayloadDataEntries, decodePayloadValue, defineLoadContextCapabilities, definePayloadGraphElement, describeInvalidChild, encodePayloadDataEntries, encodePayloadValue, encodePayloadValueWithGraph, invalidChildError, isActivity, isAssets, isClientReference, isContext, isDataStoreController, isErrorBoundary, isFigAssetResource, isPayloadSpecialModel, isPlainPayloadValue, isPortal, isSuspense, isThenable, isViewTransition, jsonPayloadCodec, loadContextCapabilities, markClientOnlyHostBehavior, markClientOnlyHostProps, markDataResourceError, mixinSlot, normalizeDataResourceKey, preventAssetResourceHoist, readThenable, resolveCurrentDataStore, resolveHostMix, rollbackPayloadGraph, runWithDataStore, serializePayloadArray, serializePayloadMap, serializePayloadPlainObject, serializePayloadSet, setCurrentDataStore, setCurrentDispatcher, setTransitionHandler, trackThenable, validateInstanceNesting, validateTextNesting };
|
package/dist/internal.js
CHANGED
|
@@ -1,13 +1,36 @@
|
|
|
1
|
-
import { _ as runWithDataStore, a as createRendererDataStore, b as isContext, i as createDataStore, m as normalizeDataResourceKey, o as currentDataStore, p as isDataStoreController, r as attachDataStore, t as setTransitionHandler, v as FigContextSymbol } from "./transition-
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import { _ as serializePayloadArray, b as serializePayloadSet, c as definePayloadGraphElement, d as encodePayloadValueWithGraph, g as rollbackPayloadGraph, h as jsonPayloadCodec, i as decodePayloadDataEntries, l as encodePayloadDataEntries, m as isPlainPayloadValue, n as checkpointPayloadGraph, o as decodePayloadValue, p as isPayloadSpecialModel, r as createPayloadGraphEncodeContext, t as assertPayloadCodecMatches, u as encodePayloadValue, v as serializePayloadMap, y as serializePayloadPlainObject } from "./payload-format-
|
|
1
|
+
import { _ as runWithDataStore, a as createRendererDataStore, b as isContext, i as createDataStore, m as normalizeDataResourceKey, o as currentDataStore, p as isDataStoreController, r as attachDataStore, t as setTransitionHandler, v as FigContextSymbol } from "./transition-DBjQTorq.js";
|
|
2
|
+
import { A as markClientOnlyHostBehavior, C as isSuspense, D as FigMixinSymbol, M as mixinSlot, N as resolveHostMix, O as clientOnlyHostBehavior, Q as defineLoadContextCapabilities, R as setCurrentDispatcher, S as isPortal, T as isViewTransition, Z as dataResourceKeysForError, _ as createPortalNode, a as FigAssetsSymbol, b as isClientReference, c as FigErrorBoundarySymbol, d as FigViewTransitionSymbol, et as loadContextCapabilities, i as FigActivitySymbol, j as markClientOnlyHostProps, l as FigPortalSymbol, n as Assets, nt as resolveCurrentDataStore, o as FigClientReferenceSymbol, rt as setCurrentDataStore, s as FigElementSymbol, tt as markDataResourceError, u as FigSuspenseSymbol, v as isActivity, w as isValidElement, x as isErrorBoundary, y as isAssets } from "./element-wieeFL9f.js";
|
|
3
|
+
import { a as assetResourceHostProps, b as readThenable, c as clientReferenceAssets, h as preventAssetResourceHoist, i as assetResourceFromHostValues, n as assetResourceFromHostAttributes, o as assetResourceKey, r as assetResourceFromHostProps, t as assetResourceDestination, u as isFigAssetResource, x as trackThenable, y as isThenable } from "./resource-BfNHyXun.js";
|
|
4
|
+
import { _ as serializePayloadArray, b as serializePayloadSet, c as definePayloadGraphElement, d as encodePayloadValueWithGraph, g as rollbackPayloadGraph, h as jsonPayloadCodec, i as decodePayloadDataEntries, l as encodePayloadDataEntries, m as isPlainPayloadValue, n as checkpointPayloadGraph, o as decodePayloadValue, p as isPayloadSpecialModel, r as createPayloadGraphEncodeContext, t as assertPayloadCodecMatches, u as encodePayloadValue, v as serializePayloadMap, y as serializePayloadPlainObject } from "./payload-format-Dgap54q-.js";
|
|
5
5
|
//#region src/children.ts
|
|
6
6
|
function collectChildren(node) {
|
|
7
|
+
if (Array.isArray(node)) return collectArrayChildren(node);
|
|
7
8
|
const children = [];
|
|
8
9
|
collectChild(node, children);
|
|
9
10
|
return children;
|
|
10
11
|
}
|
|
12
|
+
function collectArrayChildren(children) {
|
|
13
|
+
let previousWasText = false;
|
|
14
|
+
for (let index = 0; index < children.length; index += 1) {
|
|
15
|
+
const child = children[index];
|
|
16
|
+
if (typeof child === "string") {
|
|
17
|
+
if (child !== "" && !previousWasText) {
|
|
18
|
+
previousWasText = true;
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
previousWasText = false;
|
|
23
|
+
if (!Array.isArray(child) && child !== null && child !== void 0 && typeof child !== "boolean" && typeof child !== "number") {
|
|
24
|
+
if (isValidElement(child) || isPortal(child) || isThenable(child)) continue;
|
|
25
|
+
throw invalidChildError(child);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const normalized = children.slice(0, index);
|
|
29
|
+
for (; index < children.length; index += 1) collectChild(children[index], normalized);
|
|
30
|
+
return normalized;
|
|
31
|
+
}
|
|
32
|
+
return children;
|
|
33
|
+
}
|
|
11
34
|
function collectChild(node, children) {
|
|
12
35
|
if (Array.isArray(node)) {
|
|
13
36
|
for (const child of node) collectChild(child, children);
|
|
@@ -167,6 +190,6 @@ const REPLAYABLE_EVENT_TYPES = [
|
|
|
167
190
|
"pointerup"
|
|
168
191
|
];
|
|
169
192
|
//#endregion
|
|
170
|
-
export { ACTIVITY_TEMPLATE_ATTRIBUTE, Assets, EARLY_EVENT_HANDLER_PROPERTY, EARLY_EVENT_QUEUE_PROPERTY, FigActivitySymbol, FigAssetsSymbol, FigClientReferenceSymbol, FigContextSymbol, FigElementSymbol, FigErrorBoundarySymbol, FigMixinSymbol, FigPortalSymbol, FigSuspenseSymbol, FigViewTransitionSymbol, HYDRATION_SKIP_ATTRIBUTE, REPLAYABLE_EVENT_TYPES, SUSPENSE_CLIENT_MARKER, SUSPENSE_COMPLETED_MARKER, SUSPENSE_END_MARKER, SUSPENSE_MARKER_PREFIX, SUSPENSE_PENDING_PREFIX, TEXT_SEPARATOR_DATA, VIEW_TRANSITION_CLASS_ATTRIBUTE, VIEW_TRANSITION_NAME_ATTRIBUTE, VIEW_TRANSITION_PENDING_PROPERTY, VIEW_TRANSITION_TIMEOUT_MS, assertPayloadCodecMatches, assetResourceDestination, assetResourceFromHostAttributes, assetResourceFromHostProps, assetResourceFromHostValues,
|
|
193
|
+
export { ACTIVITY_TEMPLATE_ATTRIBUTE, Assets, EARLY_EVENT_HANDLER_PROPERTY, EARLY_EVENT_QUEUE_PROPERTY, FigActivitySymbol, FigAssetsSymbol, FigClientReferenceSymbol, FigContextSymbol, FigElementSymbol, FigErrorBoundarySymbol, FigMixinSymbol, FigPortalSymbol, FigSuspenseSymbol, FigViewTransitionSymbol, HYDRATION_SKIP_ATTRIBUTE, REPLAYABLE_EVENT_TYPES, SUSPENSE_CLIENT_MARKER, SUSPENSE_COMPLETED_MARKER, SUSPENSE_END_MARKER, SUSPENSE_MARKER_PREFIX, SUSPENSE_PENDING_PREFIX, TEXT_SEPARATOR_DATA, VIEW_TRANSITION_CLASS_ATTRIBUTE, VIEW_TRANSITION_NAME_ATTRIBUTE, VIEW_TRANSITION_PENDING_PROPERTY, VIEW_TRANSITION_TIMEOUT_MS, assertPayloadCodecMatches, assetResourceDestination, assetResourceFromHostAttributes, assetResourceFromHostProps, assetResourceFromHostValues, assetResourceHostProps, assetResourceKey, attachDataStore, checkpointPayloadGraph, clientOnlyHostBehavior, clientReferenceAssets, collectChildren, createDataStore, createPayloadGraphEncodeContext, createPortalNode, createRendererDataStore, currentDataStore, dataResourceKeysForError, decodePayloadDataEntries, decodePayloadValue, defineLoadContextCapabilities, definePayloadGraphElement, describeInvalidChild, encodePayloadDataEntries, encodePayloadValue, encodePayloadValueWithGraph, invalidChildError, isActivity, isAssets, isClientReference, isContext, isDataStoreController, isErrorBoundary, isFigAssetResource, isPayloadSpecialModel, isPlainPayloadValue, isPortal, isSuspense, isThenable, isViewTransition, jsonPayloadCodec, loadContextCapabilities, markClientOnlyHostBehavior, markClientOnlyHostProps, markDataResourceError, mixinSlot, normalizeDataResourceKey, preventAssetResourceHoist, readThenable, resolveCurrentDataStore, resolveHostMix, rollbackPayloadGraph, runWithDataStore, serializePayloadArray, serializePayloadMap, serializePayloadPlainObject, serializePayloadSet, setCurrentDataStore, setCurrentDispatcher, setTransitionHandler, trackThenable, validateInstanceNesting, validateTextNesting };
|
|
171
194
|
|
|
172
195
|
//# sourceMappingURL=internal.js.map
|
package/dist/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","names":[],"sources":["../src/children.ts","../src/dom-nesting.ts","../src/suspense-protocol.ts"],"sourcesContent":["import {\n type AwaitedFigNode,\n type FigElement,\n type FigNode,\n type FigPortal,\n isPortal,\n isValidElement,\n} from \"./element.ts\";\nimport { isThenable } from \"./thenables.ts\";\n\n// What normalization leaves behind: arrays are flattened, null/undefined/\n// booleans are dropped, and numbers are stringified into (merged) text.\nexport type NormalizedChild =\n | FigElement<any>\n | FigPortal<any>\n | PromiseLike<AwaitedFigNode>\n | string;\n\n// Child normalization shared by the reconciler and the server renderer.\n// Adjacent text merging here MUST match on both sides: the server emits\n// merged text nodes into HTML, and hydration matches them against the\n// client's fiber children — divergence is a hydration mismatch.\nexport function collectChildren(node: FigNode): NormalizedChild[] {\n const children: NormalizedChild[] = [];\n collectChild(node, children);\n return children;\n}\n\nfunction collectChild(node: FigNode, children: NormalizedChild[]): void {\n if (Array.isArray(node)) {\n for (const child of node) collectChild(child, children);\n return;\n }\n\n if (node === null || node === undefined || typeof node === \"boolean\") return;\n\n if (typeof node === \"string\" || typeof node === \"number\") {\n appendTextChild(children, String(node));\n return;\n }\n\n if (isValidElement(node) || isPortal(node)) {\n children.push(node);\n return;\n }\n\n if (isThenable(node)) {\n children.push(node);\n return;\n }\n\n throw invalidChildError(node);\n}\n\nfunction appendTextChild(children: NormalizedChild[], text: string): void {\n if (text === \"\") return;\n\n const previous = children.at(-1);\n\n if (typeof previous === \"string\") {\n children[children.length - 1] = `${previous}${text}`;\n } else {\n children.push(text);\n }\n}\n\nexport function invalidChildError(value: unknown): Error {\n return new Error(\n `Invalid Fig child: ${describeInvalidChild(value)}. Render a string, number, element, promise, array, boolean, null, or undefined.`,\n );\n}\n\nexport function describeInvalidChild(value: unknown): string {\n if (typeof value !== \"object\" || value === null) return typeof value;\n\n const keys = Object.keys(value);\n return keys.length === 0 ? \"object\" : `object with keys ${keys.join(\", \")}`;\n}\n","const phrasingContainers = \"|a|button|p|\";\n\n// HTML parser auto-close rules are scoped: these tags reset the \"is there an\n// open <a>/<button>/<p>?\" checks, so e.g. <a><table><td><a> and\n// <p><button><div> parse without re-parenting and must not be flagged.\n// <button> additionally terminates button scope (the <p> auto-close check).\nconst scopeTerminators =\n \"|applet|caption|desc|foreignobject|html|marquee|object|table|td|template|th|title|\";\n\nconst pAutoClosingTags =\n \"|address|article|aside|blockquote|center|details|dialog|dir|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|main|menu|nav|ol|p|pre|section|table|ul|\";\n\nconst headChildren =\n \"|base|basefont|bgsound|link|meta|title|noscript|noframes|script|style|template|\";\n\nconst specialTags =\n \"|address|applet|area|article|aside|base|basefont|bgsound|blockquote|body|br|button|caption|center|col|colgroup|dd|details|dir|div|dl|dt|embed|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|iframe|img|input|keygen|li|link|listing|main|marquee|menu|meta|nav|noembed|noframes|noscript|object|ol|p|param|plaintext|pre|script|section|select|source|style|summary|table|tbody|td|template|textarea|tfoot|th|thead|title|tr|track|ul|wbr|xmp|mi|mo|mn|ms|mtext|annotation-xml|foreignobject|desc|\";\n\nexport function validateInstanceNesting(\n type: string,\n ancestors: readonly string[],\n): void {\n const child = normalizedTag(type);\n const parent =\n ancestors[0] === undefined ? null : normalizedTag(ancestors[0]);\n\n if (parent !== null && !validWithParent(child, parent)) {\n throw invalidNestingError(\n `<${child}> cannot be a child of <${parent}>.${hintFor(child, parent)}`,\n );\n }\n\n const invalidAncestor = invalidAncestorFor(child, ancestors);\n if (invalidAncestor !== null) {\n throw invalidNestingError(\n `<${child}> cannot appear inside <${invalidAncestor}>.`,\n );\n }\n}\n\nexport function validateTextNesting(\n text: string,\n ancestors: readonly string[],\n): void {\n // Whitespace-only text is inserted in place even inside tables (\"in table\n // text\" mode only foster-parents non-whitespace), so it is harmless.\n if (!/[^ \\t\\n\\r\\f]/.test(text)) return;\n\n const parent =\n ancestors[0] === undefined ? null : normalizedTag(ancestors[0]);\n if (parent === null || validTextWithParent(parent)) return;\n\n throw invalidNestingError(`text cannot be a child of <${parent}>.`);\n}\n\nfunction validWithParent(child: string, parent: string): boolean {\n switch (parent) {\n case \"select\":\n return (\n child === \"hr\" ||\n child === \"option\" ||\n child === \"optgroup\" ||\n child === \"script\" ||\n child === \"template\"\n );\n case \"optgroup\":\n return child === \"option\";\n case \"option\":\n return false;\n case \"tr\":\n return child === \"th\" || child === \"td\" || scriptLike(child);\n case \"tbody\":\n case \"thead\":\n case \"tfoot\":\n return child === \"tr\" || scriptLike(child);\n case \"colgroup\":\n return child === \"col\" || child === \"template\";\n case \"table\":\n return (\n child === \"caption\" ||\n child === \"colgroup\" ||\n child === \"tbody\" ||\n child === \"tfoot\" ||\n child === \"thead\" ||\n scriptLike(child)\n );\n case \"head\":\n return tagIn(headChildren, child);\n case \"html\":\n return child === \"head\" || child === \"body\";\n case \"frameset\":\n return child === \"frame\";\n }\n\n switch (child) {\n case \"caption\":\n case \"col\":\n case \"colgroup\":\n case \"tbody\":\n case \"tfoot\":\n case \"thead\":\n case \"tr\":\n return parent === \"template\";\n case \"td\":\n case \"th\":\n return parent === \"tr\" || parent === \"template\";\n case \"option\":\n return parent === \"datalist\" || parent === \"template\";\n case \"optgroup\":\n return parent === \"template\";\n case \"head\":\n case \"body\":\n case \"frameset\":\n return parent === \"html\" || parent === \"template\";\n case \"frame\":\n return parent === \"template\";\n case \"html\":\n return false;\n }\n\n return true;\n}\n\nfunction validTextWithParent(parent: string): boolean {\n // <option>, <select>, and <optgroup> reject element children, but the\n // parser inserts character tokens into them in place, so text is legal.\n return (\n parent === \"option\" ||\n parent === \"select\" ||\n parent === \"optgroup\" ||\n validWithParent(\"#text\", parent)\n );\n}\n\nfunction invalidAncestorFor(\n child: string,\n ancestors: readonly string[],\n): string | null {\n let inScope = true;\n let inButtonScope = true;\n let inListScope = true;\n let inTemplate = false;\n\n for (const ancestorType of ancestors) {\n const ancestor = normalizedTag(ancestorType);\n\n if (child === ancestor && tagIn(phrasingContainers, child)) {\n if (child === \"p\" ? inButtonScope : inScope) return ancestor;\n }\n if (inButtonScope && ancestor === \"p\" && tagIn(pAutoClosingTags, child)) {\n return ancestor;\n }\n if (inListScope && listItemAncestor(child, ancestor)) return ancestor;\n // The parser's form element pointer ignores scope but resets in templates.\n if (!inTemplate && ancestor === \"form\" && child === \"form\") return ancestor;\n\n if (tagIn(scopeTerminators, ancestor)) {\n if (ancestor === \"template\") inTemplate = true;\n inScope = false;\n inButtonScope = false;\n } else if (ancestor === \"button\") {\n inButtonScope = false;\n }\n // li/dd/dt auto-closing sees through phrasing/formatting wrappers and\n // address/div/p; other special elements terminate the parser walk.\n if (\n tagIn(specialTags, ancestor) &&\n ancestor !== \"address\" &&\n ancestor !== \"div\" &&\n ancestor !== \"p\"\n ) {\n inListScope = false;\n }\n }\n\n return null;\n}\n\nfunction listItemAncestor(child: string, ancestor: string): boolean {\n if (child === \"li\") return ancestor === \"li\";\n if (child === \"dd\" || child === \"dt\") {\n return ancestor === \"dd\" || ancestor === \"dt\";\n }\n return false;\n}\n\nfunction normalizedTag(type: string): string {\n return type.toLowerCase();\n}\n\nfunction scriptLike(tag: string): boolean {\n return tag === \"script\" || tag === \"style\" || tag === \"template\";\n}\n\nfunction hintFor(child: string, parent: string): string {\n if (parent === \"table\" && child === \"tr\") {\n return \" Add a <tbody>, <thead>, or <tfoot>.\";\n }\n\n return \"\";\n}\n\nfunction invalidNestingError(message: string): Error {\n return new Error(`Invalid DOM nesting: ${message}`);\n}\n\nfunction tagIn(tags: string, tag: string): boolean {\n return tags.includes(`|${tag}|`);\n}\n","// The Suspense streaming wire format shared by the server renderer (which\n// emits these markers as HTML comments and interpolates them into the inline\n// reveal script) and fig-dom (which parses them into dehydrated boundaries).\n// Changing any value is a protocol change: server output and client parsing\n// must move together.\n\nexport const SUSPENSE_MARKER_PREFIX = \"fig:suspense:\";\nexport const SUSPENSE_COMPLETED_MARKER = \"fig:suspense:completed\";\nexport const SUSPENSE_CLIENT_MARKER = \"fig:suspense:client\";\nexport const SUSPENSE_PENDING_PREFIX = \"fig:suspense:pending:\";\nexport const SUSPENSE_END_MARKER = \"/fig:suspense\";\n\n// The server emits a comment with exactly this data between adjacent text\n// writes that come from different normalized text children: the HTML parser\n// would otherwise merge them into one DOM text node while the client keeps\n// one text fiber each. fig-dom's hydration cursor skips only comments whose\n// data matches this value (fig:suspense markers use their own prefixes).\nexport const TEXT_SEPARATOR_DATA = \",\";\n\n// Hidden Activity content streams inside an inert template carrying this\n// attribute; the client treats such templates as dehydrated boundaries.\nexport const ACTIVITY_TEMPLATE_ATTRIBUTE = \"data-fig-activity\";\n\nexport const VIEW_TRANSITION_NAME_ATTRIBUTE = \"data-fig-vt-name\";\nexport const VIEW_TRANSITION_CLASS_ATTRIBUTE = \"data-fig-vt-class\";\n\n// Per-document mutex holding the currently running view transition. Client\n// commits and inline streaming reveals both wait on it before proceeding.\nexport const VIEW_TRANSITION_PENDING_PROPERTY = \"__figViewTransition\";\n// React's maximum suspended-commit wait, shared with streaming reveals so a\n// non-settling transition cannot hold either path indefinitely.\nexport const VIEW_TRANSITION_TIMEOUT_MS = 60_000;\n\n// Early-event capture: a tiny inline script at the top of a server-rendered\n// document queues replayable events that fire before the client bundle\n// executes. The first hydration root drains the queue, removes the capture\n// listeners, and replays claimed events through the standard replay path.\n// The event list must stay in sync with fig-dom's replayable set — a\n// discrete replay forces synchronous hydration of its target, which is what\n// makes pre-bundle clicks safe to honor.\nexport const HYDRATION_SKIP_ATTRIBUTE = \"data-fig-hydration-skip\";\nexport const EARLY_EVENT_QUEUE_PROPERTY = \"__figEarlyEvents\";\nexport const EARLY_EVENT_HANDLER_PROPERTY = \"__figEarlyEventHandler\";\nexport const REPLAYABLE_EVENT_TYPES = [\n \"click\",\n \"keydown\",\n \"keyup\",\n \"pointerdown\",\n \"pointerup\",\n] as const;\n"],"mappings":";;;;;AAsBA,SAAgB,gBAAgB,MAAkC;CAChE,MAAM,WAA8B,CAAC;CACrC,aAAa,MAAM,QAAQ;CAC3B,OAAO;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,WAAW,UAAU,MAClC,OAAO;CAGT,OAAO;AACT;AAEA,SAAS,oBAAoB,SAAwB;CACnD,uBAAO,IAAI,MAAM,wBAAwB,SAAS;AACpD;AAEA,SAAS,MAAM,MAAc,KAAsB;CACjD,OAAO,KAAK,SAAS,IAAI,IAAI,EAAE;AACjC;;;AC1MA,MAAa,yBAAyB;AACtC,MAAa,4BAA4B;AACzC,MAAa,yBAAyB;AACtC,MAAa,0BAA0B;AACvC,MAAa,sBAAsB;AAOnC,MAAa,sBAAsB;AAInC,MAAa,8BAA8B;AAE3C,MAAa,iCAAiC;AAC9C,MAAa,kCAAkC;AAI/C,MAAa,mCAAmC;AAGhD,MAAa,6BAA6B;AAS1C,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAC1C,MAAa,+BAA+B;AAC5C,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;CACA;AACF"}
|
|
1
|
+
{"version":3,"file":"internal.js","names":[],"sources":["../src/children.ts","../src/dom-nesting.ts","../src/suspense-protocol.ts"],"sourcesContent":["import {\n type AwaitedFigNode,\n type FigElement,\n type FigNode,\n type FigPortal,\n isPortal,\n isValidElement,\n} from \"./element.ts\";\nimport { isThenable } from \"./thenables.ts\";\n\n// What normalization leaves behind: arrays are flattened, null/undefined/\n// booleans are dropped, and numbers are stringified into (merged) text.\nexport type NormalizedChild =\n | FigElement<any>\n | FigPortal<any>\n | PromiseLike<AwaitedFigNode>\n | string;\n\n// Child normalization shared by the reconciler and the server renderer.\n// Adjacent text merging here MUST match on both sides: the server emits\n// merged text nodes into HTML, and hydration matches them against the\n// client's fiber children — divergence is a hydration mismatch.\nexport function collectChildren(node: FigNode): NormalizedChild[] {\n if (Array.isArray(node)) return collectArrayChildren(node);\n\n const children: NormalizedChild[] = [];\n collectChild(node, children);\n return children;\n}\n\nfunction collectArrayChildren(children: FigNode[]): NormalizedChild[] {\n let previousWasText = false;\n for (let index = 0; index < children.length; index += 1) {\n const child = children[index];\n if (typeof child === \"string\") {\n if (child !== \"\" && !previousWasText) {\n previousWasText = true;\n continue;\n }\n } else {\n previousWasText = false;\n if (\n !Array.isArray(child) &&\n child !== null &&\n child !== undefined &&\n typeof child !== \"boolean\" &&\n typeof child !== \"number\"\n ) {\n if (isValidElement(child) || isPortal(child) || isThenable(child)) {\n continue;\n }\n throw invalidChildError(child);\n }\n }\n\n const normalized = children.slice(0, index) as NormalizedChild[];\n for (; index < children.length; index += 1) {\n collectChild(children[index], normalized);\n }\n return normalized;\n }\n return children as NormalizedChild[];\n}\n\nfunction collectChild(node: FigNode, children: NormalizedChild[]): void {\n if (Array.isArray(node)) {\n for (const child of node) collectChild(child, children);\n return;\n }\n\n if (node === null || node === undefined || typeof node === \"boolean\") return;\n\n if (typeof node === \"string\" || typeof node === \"number\") {\n appendTextChild(children, String(node));\n return;\n }\n\n if (isValidElement(node) || isPortal(node)) {\n children.push(node);\n return;\n }\n\n if (isThenable(node)) {\n children.push(node);\n return;\n }\n\n throw invalidChildError(node);\n}\n\nfunction appendTextChild(children: NormalizedChild[], text: string): void {\n if (text === \"\") return;\n\n const previous = children.at(-1);\n\n if (typeof previous === \"string\") {\n children[children.length - 1] = `${previous}${text}`;\n } else {\n children.push(text);\n }\n}\n\nexport function invalidChildError(value: unknown): Error {\n return new Error(\n `Invalid Fig child: ${describeInvalidChild(value)}. Render a string, number, element, promise, array, boolean, null, or undefined.`,\n );\n}\n\nexport function describeInvalidChild(value: unknown): string {\n if (typeof value !== \"object\" || value === null) return typeof value;\n\n const keys = Object.keys(value);\n return keys.length === 0 ? \"object\" : `object with keys ${keys.join(\", \")}`;\n}\n","const phrasingContainers = \"|a|button|p|\";\n\n// HTML parser auto-close rules are scoped: these tags reset the \"is there an\n// open <a>/<button>/<p>?\" checks, so e.g. <a><table><td><a> and\n// <p><button><div> parse without re-parenting and must not be flagged.\n// <button> additionally terminates button scope (the <p> auto-close check).\nconst scopeTerminators =\n \"|applet|caption|desc|foreignobject|html|marquee|object|table|td|template|th|title|\";\n\nconst pAutoClosingTags =\n \"|address|article|aside|blockquote|center|details|dialog|dir|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|main|menu|nav|ol|p|pre|section|table|ul|\";\n\nconst headChildren =\n \"|base|basefont|bgsound|link|meta|title|noscript|noframes|script|style|template|\";\n\nconst specialTags =\n \"|address|applet|area|article|aside|base|basefont|bgsound|blockquote|body|br|button|caption|center|col|colgroup|dd|details|dir|div|dl|dt|embed|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|iframe|img|input|keygen|li|link|listing|main|marquee|menu|meta|nav|noembed|noframes|noscript|object|ol|p|param|plaintext|pre|script|section|select|source|style|summary|table|tbody|td|template|textarea|tfoot|th|thead|title|tr|track|ul|wbr|xmp|mi|mo|mn|ms|mtext|annotation-xml|foreignobject|desc|\";\n\nexport function validateInstanceNesting(\n type: string,\n ancestors: readonly string[],\n): void {\n const child = normalizedTag(type);\n const parent =\n ancestors[0] === undefined ? null : normalizedTag(ancestors[0]);\n\n if (parent !== null && !validWithParent(child, parent)) {\n throw invalidNestingError(\n `<${child}> cannot be a child of <${parent}>.${hintFor(child, parent)}`,\n );\n }\n\n const invalidAncestor = invalidAncestorFor(child, ancestors);\n if (invalidAncestor !== null) {\n throw invalidNestingError(\n `<${child}> cannot appear inside <${invalidAncestor}>.`,\n );\n }\n}\n\nexport function validateTextNesting(\n text: string,\n ancestors: readonly string[],\n): void {\n // Whitespace-only text is inserted in place even inside tables (\"in table\n // text\" mode only foster-parents non-whitespace), so it is harmless.\n if (!/[^ \\t\\n\\r\\f]/.test(text)) return;\n\n const parent =\n ancestors[0] === undefined ? null : normalizedTag(ancestors[0]);\n if (parent === null || validTextWithParent(parent)) return;\n\n throw invalidNestingError(`text cannot be a child of <${parent}>.`);\n}\n\nfunction validWithParent(child: string, parent: string): boolean {\n switch (parent) {\n case \"select\":\n return (\n child === \"hr\" ||\n child === \"option\" ||\n child === \"optgroup\" ||\n child === \"script\" ||\n child === \"template\"\n );\n case \"optgroup\":\n return child === \"option\";\n case \"option\":\n return false;\n case \"tr\":\n return child === \"th\" || child === \"td\" || scriptLike(child);\n case \"tbody\":\n case \"thead\":\n case \"tfoot\":\n return child === \"tr\" || scriptLike(child);\n case \"colgroup\":\n return child === \"col\" || child === \"template\";\n case \"table\":\n return (\n child === \"caption\" ||\n child === \"colgroup\" ||\n child === \"tbody\" ||\n child === \"tfoot\" ||\n child === \"thead\" ||\n scriptLike(child)\n );\n case \"head\":\n return tagIn(headChildren, child);\n case \"html\":\n return child === \"head\" || child === \"body\";\n case \"frameset\":\n return child === \"frame\";\n }\n\n switch (child) {\n case \"caption\":\n case \"col\":\n case \"colgroup\":\n case \"tbody\":\n case \"tfoot\":\n case \"thead\":\n case \"tr\":\n return parent === \"template\";\n case \"td\":\n case \"th\":\n return parent === \"tr\" || parent === \"template\";\n case \"option\":\n return parent === \"datalist\" || parent === \"template\";\n case \"optgroup\":\n return parent === \"template\";\n case \"head\":\n case \"body\":\n case \"frameset\":\n return parent === \"html\" || parent === \"template\";\n case \"frame\":\n return parent === \"template\";\n case \"html\":\n return false;\n }\n\n return true;\n}\n\nfunction validTextWithParent(parent: string): boolean {\n // <option>, <select>, and <optgroup> reject element children, but the\n // parser inserts character tokens into them in place, so text is legal.\n return (\n parent === \"option\" ||\n parent === \"select\" ||\n parent === \"optgroup\" ||\n validWithParent(\"#text\", parent)\n );\n}\n\nfunction invalidAncestorFor(\n child: string,\n ancestors: readonly string[],\n): string | null {\n let inScope = true;\n let inButtonScope = true;\n let inListScope = true;\n let inTemplate = false;\n\n for (const ancestorType of ancestors) {\n const ancestor = normalizedTag(ancestorType);\n\n if (child === ancestor && tagIn(phrasingContainers, child)) {\n if (child === \"p\" ? inButtonScope : inScope) return ancestor;\n }\n if (inButtonScope && ancestor === \"p\" && tagIn(pAutoClosingTags, child)) {\n return ancestor;\n }\n if (inListScope && listItemAncestor(child, ancestor)) return ancestor;\n // The parser's form element pointer ignores scope but resets in templates.\n if (!inTemplate && ancestor === \"form\" && child === \"form\") return ancestor;\n\n if (tagIn(scopeTerminators, ancestor)) {\n if (ancestor === \"template\") inTemplate = true;\n inScope = false;\n inButtonScope = false;\n } else if (ancestor === \"button\") {\n inButtonScope = false;\n }\n // li/dd/dt auto-closing sees through phrasing/formatting wrappers and\n // address/div/p; other special elements terminate the parser walk.\n if (\n tagIn(specialTags, ancestor) &&\n ancestor !== \"address\" &&\n ancestor !== \"div\" &&\n ancestor !== \"p\"\n ) {\n inListScope = false;\n }\n }\n\n return null;\n}\n\nfunction listItemAncestor(child: string, ancestor: string): boolean {\n if (child === \"li\") return ancestor === \"li\";\n if (child === \"dd\" || child === \"dt\") {\n return ancestor === \"dd\" || ancestor === \"dt\";\n }\n return false;\n}\n\nfunction normalizedTag(type: string): string {\n return type.toLowerCase();\n}\n\nfunction scriptLike(tag: string): boolean {\n return tag === \"script\" || tag === \"style\" || tag === \"template\";\n}\n\nfunction hintFor(child: string, parent: string): string {\n if (parent === \"table\" && child === \"tr\") {\n return \" Add a <tbody>, <thead>, or <tfoot>.\";\n }\n\n return \"\";\n}\n\nfunction invalidNestingError(message: string): Error {\n return new Error(`Invalid DOM nesting: ${message}`);\n}\n\nfunction tagIn(tags: string, tag: string): boolean {\n return tags.includes(`|${tag}|`);\n}\n","// The Suspense streaming wire format shared by the server renderer (which\n// emits these markers as HTML comments and interpolates them into the inline\n// reveal script) and fig-dom (which parses them into dehydrated boundaries).\n// Changing any value is a protocol change: server output and client parsing\n// must move together.\n\nexport const SUSPENSE_MARKER_PREFIX = \"fig:suspense:\";\nexport const SUSPENSE_COMPLETED_MARKER = \"fig:suspense:completed\";\nexport const SUSPENSE_CLIENT_MARKER = \"fig:suspense:client\";\nexport const SUSPENSE_PENDING_PREFIX = \"fig:suspense:pending:\";\nexport const SUSPENSE_END_MARKER = \"/fig:suspense\";\n\n// The server emits a comment with exactly this data between adjacent text\n// writes that come from different normalized text children: the HTML parser\n// would otherwise merge them into one DOM text node while the client keeps\n// one text fiber each. fig-dom's hydration cursor skips only comments whose\n// data matches this value (fig:suspense markers use their own prefixes).\nexport const TEXT_SEPARATOR_DATA = \",\";\n\n// Hidden Activity content streams inside an inert template carrying this\n// attribute; the client treats such templates as dehydrated boundaries.\nexport const ACTIVITY_TEMPLATE_ATTRIBUTE = \"data-fig-activity\";\n\nexport const VIEW_TRANSITION_NAME_ATTRIBUTE = \"data-fig-vt-name\";\nexport const VIEW_TRANSITION_CLASS_ATTRIBUTE = \"data-fig-vt-class\";\n\n// Per-document mutex holding the currently running view transition. Client\n// commits and inline streaming reveals both wait on it before proceeding.\nexport const VIEW_TRANSITION_PENDING_PROPERTY = \"__figViewTransition\";\n// React's maximum suspended-commit wait, shared with streaming reveals so a\n// non-settling transition cannot hold either path indefinitely.\nexport const VIEW_TRANSITION_TIMEOUT_MS = 60_000;\n\n// Early-event capture: a tiny inline script at the top of a server-rendered\n// document queues replayable events that fire before the client bundle\n// executes. The first hydration root drains the queue, removes the capture\n// listeners, and replays claimed events through the standard replay path.\n// The event list must stay in sync with fig-dom's replayable set — a\n// discrete replay forces synchronous hydration of its target, which is what\n// makes pre-bundle clicks safe to honor.\nexport const HYDRATION_SKIP_ATTRIBUTE = \"data-fig-hydration-skip\";\nexport const EARLY_EVENT_QUEUE_PROPERTY = \"__figEarlyEvents\";\nexport const EARLY_EVENT_HANDLER_PROPERTY = \"__figEarlyEventHandler\";\nexport const REPLAYABLE_EVENT_TYPES = [\n \"click\",\n \"keydown\",\n \"keyup\",\n \"pointerdown\",\n \"pointerup\",\n] as const;\n"],"mappings":";;;;;AAsBA,SAAgB,gBAAgB,MAAkC;CAChE,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,qBAAqB,IAAI;CAEzD,MAAM,WAA8B,CAAC;CACrC,aAAa,MAAM,QAAQ;CAC3B,OAAO;AACT;AAEA,SAAS,qBAAqB,UAAwC;CACpE,IAAI,kBAAkB;CACtB,KAAK,IAAI,QAAQ,GA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AAY,aAAa;GAC1C,UAAU;GACV,gBAAgB;EAClB,OAAO,IAAI,aAAa,UACtB,gBAAgB;EAIlB,IACE,MAAM,aAAa,QAAQ,KAC3B,aAAa,aACb,aAAa,SACb,aAAa,KAEb,cAAc;CAElB;CAEA,OAAO;AACT;AAEA,SAAS,iBAAiB,OAAe,UAA2B;CAClE,IAAI,UAAU,MAAM,OAAO,aAAa;CACxC,IAAI,UAAU,QAAQ,UAAU,MAC9B,OAAO,aAAa,QAAQ,aAAa;CAE3C,OAAO;AACT;AAEA,SAAS,cAAc,MAAsB;CAC3C,OAAO,KAAK,YAAY;AAC1B;AAEA,SAAS,WAAW,KAAsB;CACxC,OAAO,QAAQ,YAAY,QAAQ,WAAW,QAAQ;AACxD;AAEA,SAAS,QAAQ,OAAe,QAAwB;CACtD,IAAI,WAAW,WAAW,UAAU,MAClC,OAAO;CAGT,OAAO;AACT;AAEA,SAAS,oBAAoB,SAAwB;CACnD,uBAAO,IAAI,MAAM,wBAAwB,SAAS;AACpD;AAEA,SAAS,MAAM,MAAc,KAAsB;CACjD,OAAO,KAAK,SAAS,IAAI,IAAI,EAAE;AACjC;;;AC1MA,MAAa,yBAAyB;AACtC,MAAa,4BAA4B;AACzC,MAAa,yBAAyB;AACtC,MAAa,0BAA0B;AACvC,MAAa,sBAAsB;AAOnC,MAAa,sBAAsB;AAInC,MAAa,8BAA8B;AAE3C,MAAa,iCAAiC;AAC9C,MAAa,kCAAkC;AAI/C,MAAa,mCAAmC;AAGhD,MAAa,6BAA6B;AAS1C,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAC1C,MAAa,+BAA+B;AAC5C,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;CACA;AACF"}
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Fragment, C as FigNode, j as Key, l as ElementType, y as FigElement } from "./element-
|
|
1
|
+
import { A as Fragment, C as FigNode, j as Key, l as ElementType, y as FigElement } from "./element-Od8CmsBL.js";
|
|
2
2
|
//#region src/jsx-runtime.d.ts
|
|
3
3
|
type JSXProps = Record<string, unknown>;
|
|
4
4
|
declare function jsx(type: ElementType, props: JSXProps | null, key?: string | number): FigElement;
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { N as resolveHostMix, f as Fragment, s as FigElementSymbol } from "./element-wieeFL9f.js";
|
|
2
2
|
//#region src/jsx-runtime.ts
|
|
3
3
|
function jsx(type, props, key) {
|
|
4
4
|
if (props !== null && "key" in props) {
|