@bgub/fig 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{element-Od8CmsBL.d.ts → element-9MtOc5qb.d.ts} +113 -0
  3. package/dist/{element-wieeFL9f.js → element-mHDfizuh.js} +55 -1
  4. package/dist/element-mHDfizuh.js.map +1 -0
  5. package/dist/{hooks-BSqKOOez.d.ts → hooks-Bw3vbom7.d.ts} +63 -1
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +3 -3
  8. package/dist/internal.d.ts +45 -2
  9. package/dist/internal.js +24 -4
  10. package/dist/internal.js.map +1 -1
  11. package/dist/jsx-runtime.d.ts +4 -1
  12. package/dist/jsx-runtime.js +7 -1
  13. package/dist/jsx-runtime.js.map +1 -1
  14. package/dist/{payload-format-Dgap54q-.js → payload-format-BbsvTG9V.js} +14 -1
  15. package/dist/payload-format-BbsvTG9V.js.map +1 -0
  16. package/dist/payload.d.ts +6 -1
  17. package/dist/payload.js +4 -3
  18. package/dist/payload.js.map +1 -1
  19. package/{dist-development/resource-Cs0W0XKd.js → dist/resource-BJxS62H2.js} +23 -2
  20. package/dist/resource-BJxS62H2.js.map +1 -0
  21. package/dist/{transition-DjIYK0NB.js → transition-WvgFiYNY.js} +21 -2
  22. package/dist/transition-WvgFiYNY.js.map +1 -0
  23. package/dist-development/{element-Bb5fLsPy.js → element-CVlfN_3_.js} +55 -1
  24. package/dist-development/element-CVlfN_3_.js.map +1 -0
  25. package/dist-development/index.js +3 -3
  26. package/dist-development/internal.js +24 -4
  27. package/dist-development/internal.js.map +1 -1
  28. package/dist-development/jsx-runtime.js +7 -1
  29. package/dist-development/jsx-runtime.js.map +1 -1
  30. package/dist-development/{payload-format-Dgap54q-.js → payload-format-BbsvTG9V.js} +14 -1
  31. package/dist-development/payload-format-BbsvTG9V.js.map +1 -0
  32. package/dist-development/payload.js +4 -3
  33. package/dist-development/payload.js.map +1 -1
  34. package/{dist/resource-BAfMrZ1g.js → dist-development/resource-Bhusybfq.js} +23 -2
  35. package/dist-development/resource-Bhusybfq.js.map +1 -0
  36. package/dist-development/{transition-Di2CpJq5.js → transition-BSxdDR9D.js} +21 -2
  37. package/dist-development/transition-BSxdDR9D.js.map +1 -0
  38. package/package.json +1 -1
  39. package/dist/element-wieeFL9f.js.map +0 -1
  40. package/dist/payload-format-Dgap54q-.js.map +0 -1
  41. package/dist/resource-BAfMrZ1g.js.map +0 -1
  42. package/dist/transition-DjIYK0NB.js.map +0 -1
  43. package/dist-development/element-Bb5fLsPy.js.map +0 -1
  44. package/dist-development/payload-format-Dgap54q-.js.map +0 -1
  45. package/dist-development/resource-Cs0W0XKd.js.map +0 -1
  46. package/dist-development/transition-Di2CpJq5.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-mHDfizuh.js","names":["runtimeType"],"sources":["../src/data.ts","../src/hooks.ts","../src/mixin.ts","../src/element.ts"],"sourcesContent":["/** Describes data resource key input. */\nexport type DataResourceKeyInput =\n | string\n | number\n | boolean\n | null\n | readonly DataResourceKeyInput[]\n | { readonly [key: string]: DataResourceKeyInput };\n\n/** Describes data resource key. */\nexport type DataResourceKey = readonly [string, ...DataResourceKeyInput[]];\n\n/** Describes data resource load context. */\nexport interface DataResourceLoadContext {\n signal: AbortSignal;\n}\n\n/** Describes data resource loader. */\nexport type DataResourceLoader<TArgs extends unknown[], TValue> = (\n ...argsAndContext: [...TArgs, DataResourceLoadContext]\n) => TValue | PromiseLike<TValue>;\n\n/** Describes data resource. */\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\n/** Describes data refresh result. */\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\n/** Describes Fig data hydration entry. */\nexport interface FigDataHydrationEntry {\n key: DataResourceKey;\n value: unknown;\n}\n\n/** Describes Fig data entry status. */\nexport type FigDataEntryStatus =\n | \"pending\"\n | \"fulfilled\"\n | \"rejected\"\n | \"refreshing\";\n\n/** Describes data store entry snapshot. */\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.\n/** Describes Fig data store handle. */\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\n/** Describes Fig data store options. */\nexport interface FigDataStoreOptions {\n initialData?: readonly FigDataHydrationEntry[];\n partition?: DataResourceKeyInput;\n}\n\n/** Describes Fig data store. */\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.\n/** Describes Fig data store host. */\nexport interface FigDataStoreHost {\n getLane(): unknown;\n partition?: DataResourceKeyInput;\n schedule(owner: object, lane: unknown): void;\n}\n\n/** Describes Fig data store factory. */\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.\n/** Describes load context hydrate. */\nexport type LoadContextHydrate = (\n entries: readonly FigDataHydrationEntry[],\n) => void;\n/** Describes load context attribute error. */\nexport type LoadContextAttributeError = (error: unknown) => void;\n\n/** Describes load context capabilities. */\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\n/** Define load context capabilities. */\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\n/** Load context capabilities. */\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\n/** Resolves current data store. */\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\n/** Sets current data store. */\nexport function setCurrentDataStore(\n store: FigDataStore | null,\n): FigDataStore | null {\n const previousStore = currentDataStore;\n currentDataStore = store;\n return previousStore;\n}\n\n/** Marks data resource error. */\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\n/** Data resource keys for error. */\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.\n/** Describes state setter. */\nexport type StateSetter<S> = (next: S | ((previous: S) => S)) => void;\n/** Describes external store subscribe. */\nexport type ExternalStoreSubscribe = (callback: () => void) => () => void;\n// Fig appends the AbortSignal after the runner's args (the data-loader\n// shape). The signal aborts when a newer run supersedes this one, when the\n// owning component unmounts, and when an enclosing Activity hides.\n/** Describes action state action. */\nexport type ActionStateAction<S, Args extends unknown[]> = (\n previousState: S,\n ...argsAndSignal: [...Args, AbortSignal]\n) => S | PromiseLike<S>;\n/** Describes action state runner. */\nexport type ActionStateRunner<Args extends unknown[]> = (...args: Args) => void;\n\n/**\n * Runs state updates scheduled by `callback` at transition priority. If\n * `callback` returns a thenable, `useTransition` keeps `isPending` true until\n * it settles and 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\n/** Describes render dispatcher. */\nexport interface RenderDispatcher {\n useState<S>(initialState: S | (() => S)): [S, StateSetter<S>];\n useActionState<S, Args extends unknown[]>(\n action: ActionStateAction<S, Args>,\n initialState: S,\n ): [S, ActionStateRunner<Args>, boolean];\n useId(): string;\n useDeferredValue<T>(\n value: T,\n initialValue: T | undefined,\n hasInitialValue: boolean,\n ): T;\n useMemo<T>(calculate: () => T, deps: DependencyList): T;\n useTransition(): [boolean, StartTransition];\n useReactive(effect: EffectCallback, deps?: DependencyList): void;\n useBeforePaint(effect: EffectCallback, deps?: DependencyList): void;\n useBeforeLayout(effect: EffectCallback, deps?: DependencyList): void;\n useSyncExternalStore<T>(\n subscribe: ExternalStoreSubscribe,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n ): T;\n useStableEvent<Args extends unknown[], Result>(\n handler: (...args: Args) => Result,\n ): (...args: StableEventCallerArgs<Args>) => Result;\n readContext<T>(context: FigContext<T>): T;\n readData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n args: TArgs,\n ): TValue;\n preloadData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n args: TArgs,\n ): void;\n readPromise<T>(promise: PromiseLike<T>): T;\n}\n\n/** Describes effect callback. */\nexport type EffectCallback = (signal: AbortSignal) => undefined;\n/** Describes dependency list. */\nexport type DependencyList = readonly unknown[];\n\n/** Describes stable event caller args. */\nexport type StableEventCallerArgs<Args extends unknown[]> = Args extends [\n ...infer CallerArgs,\n AbortSignal,\n]\n ? CallerArgs\n : Args;\n\n// Fig appends the AbortSignal when invoking the handler; callers never pass\n// it, so a declared trailing signal is stripped from the callable signature.\nlet currentDispatcher: RenderDispatcher | null = null;\n\n/** Returns state. */\nexport function useState<S>(initialState: S | (() => S)): [S, StateSetter<S>] {\n return resolveDispatcher().useState(initialState);\n}\n\n/**\n * Tracks state returned by a client-side action. The action receives the\n * previous committed state first, then the runner's arguments, then an\n * `AbortSignal` Fig appends (declare the trailing signal parameter — it also\n * drives `Args` inference). 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\n/** Returns ID. */\nexport function useId(): string {\n return resolveDispatcher().useId();\n}\n\n/** Returns deferred value. */\nexport function useDeferredValue<T>(value: T, initialValue?: T): T {\n return resolveDispatcher().useDeferredValue(\n value,\n initialValue,\n arguments.length > 1,\n );\n}\n\n/** Returns memo. */\nexport function useMemo<T>(calculate: () => T, deps: DependencyList): T {\n return resolveDispatcher().useMemo(calculate, deps);\n}\n\n/** Returns transition. */\nexport function useTransition(): [boolean, StartTransition] {\n return resolveDispatcher().useTransition();\n}\n\n/** Returns callback. */\nexport function useCallback<T extends Callback>(\n callback: T,\n deps: DependencyList,\n): T {\n return resolveDispatcher().useMemo(() => callback, deps);\n}\n\n/** Returns reactive. */\nexport function useReactive(\n effect: EffectCallback,\n deps?: DependencyList,\n): void {\n resolveDispatcher().useReactive(effect, deps);\n}\n\n/** Returns before paint. */\nexport function useBeforePaint(\n effect: EffectCallback,\n deps?: DependencyList,\n): void {\n resolveDispatcher().useBeforePaint(effect, deps);\n}\n\n/** Returns before layout. */\nexport function useBeforeLayout(\n effect: EffectCallback,\n deps?: DependencyList,\n): void {\n resolveDispatcher().useBeforeLayout(effect, deps);\n}\n\n/** Returns sync external store. */\nexport function useSyncExternalStore<T>(\n subscribe: ExternalStoreSubscribe,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n): T {\n return resolveDispatcher().useSyncExternalStore(\n subscribe,\n getSnapshot,\n getServerSnapshot,\n );\n}\n\n/** Returns stable event. */\nexport function useStableEvent<Args extends unknown[], Result>(\n handler: (...args: Args) => Result,\n): (...args: StableEventCallerArgs<Args>) => Result {\n return resolveDispatcher().useStableEvent(handler);\n}\n\n/** Reads context. */\nexport function readContext<T>(context: FigContext<T>): T {\n return resolveDispatcher(\n \"readContext can only be called while rendering a component.\",\n ).readContext(context);\n}\n\n/** Reads promise. */\nexport function readPromise<T>(promise: PromiseLike<T>): T {\n return resolveDispatcher(\n \"readPromise can only be called while rendering a component.\",\n ).readPromise(promise);\n}\n\n/** Reads data. */\nexport function readData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n): TValue {\n return resolveDispatcher(\n \"readData can only be called while rendering a component.\",\n ).readData(resource, args);\n}\n\n/** Preloads data. */\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\n/** Sets current dispatcher. */\nexport function setCurrentDispatcher(\n dispatcher: RenderDispatcher | null,\n): RenderDispatcher | null {\n const previousDispatcher = currentDispatcher;\n currentDispatcher = dispatcher;\n return previousDispatcher;\n}\n\nfunction resolveDispatcher(\n message = \"Hooks can only be called while rendering a component.\",\n): RenderDispatcher {\n if (currentDispatcher === null) {\n throw new Error(message);\n }\n\n return currentDispatcher;\n}\n\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\n/** Describes mixin context. */\nexport interface MixinContext {\n /** The intrinsic host name receiving this mixin. */\n readonly type: string;\n /** Props composed by the host and every preceding mixin. */\n readonly props: Readonly<Props>;\n}\n\n/** Describes empty mixin value. */\nexport type EmptyMixinValue = false | 0 | 0n | \"\" | null | undefined;\n\n/** Describes mixin input. */\nexport type MixinInput =\n | MixinDescriptor\n | EmptyMixinValue\n | ReadonlyArray<MixinInput>;\n\n/** Describes mixin result. */\nexport type MixinResult = Props | MixinInput;\n\n/** Describes mixin type. */\nexport type MixinType<TArgs extends unknown[] = unknown[]> = (\n context: MixinContext,\n ...args: TArgs\n) => MixinResult;\n\ntype MixinRuntimeType = (\n context: MixinContext,\n ...args: unknown[]\n) => MixinResult;\n\n/** Describes mixin descriptor. */\nexport interface MixinDescriptor {\n readonly $$typeof: symbol;\n readonly args: readonly unknown[];\n readonly type: MixinRuntimeType;\n}\n\n/** Describes mixin factory. */\nexport type MixinFactory<TArgs extends unknown[]> = (\n ...args: TArgs\n) => MixinDescriptor;\n\n// Registered symbols: descriptors and contexts must stay recognizable when\n// duplicate copies of this module are live (linked source next to a\n// prebundled copy).\n/** The Fig mixin symbol. */\nexport const FigMixinSymbol = Symbol.for(\"fig.mixin\");\nconst FigMixinSlotSymbol = Symbol.for(\"fig.mixin-slot\");\nconst FigClientOnlyHostBehaviorSymbol = Symbol.for(\n \"fig.client-only-host-behavior\",\n);\ntype ClientOnlyHostProps = object & {\n [FigClientOnlyHostBehaviorSymbol]?: string;\n};\n\n/** Creates a render-time host behavior for the `mix` prop. */\nexport function createMixin<TArgs extends unknown[]>(\n type: MixinType<TArgs>,\n): MixinFactory<TArgs> {\n const runtimeType = type as MixinRuntimeType;\n const descriptorType = __DEV__ ? guardMixinType(runtimeType) : runtimeType;\n return (...args) => ({\n $$typeof: FigMixinSymbol,\n args,\n type: descriptorType,\n });\n}\n\nconst maximumResolvedMixins = 1024;\n\n/** Resolves host mix. */\nexport function resolveHostMix<P extends Props>(type: string, input: P): P {\n const props: Props = input;\n const mix = props.mix;\n delete props.mix;\n let resolvedMixins = 0;\n\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\n/** Mixin slot. */\nexport function mixinSlot(context: MixinContext): string {\n return (context as MixinRuntimeContext)[FigMixinSlotSymbol];\n}\n\n/** Marks client only host behavior. */\nexport function markClientOnlyHostBehavior(\n context: MixinContext,\n behavior: string,\n): void {\n markClientOnlyHostProps(context.props, behavior);\n}\n\n/** Marks client only host props. */\nexport function markClientOnlyHostProps(value: object, behavior: string): void {\n const props = value as ClientOnlyHostProps;\n if (props[FigClientOnlyHostBehaviorSymbol] !== undefined) return;\n Object.defineProperty(props, FigClientOnlyHostBehaviorSymbol, {\n configurable: true,\n value: behavior,\n });\n}\n\n/** Client only host behavior. */\nexport function clientOnlyHostBehavior(props: object): string | undefined {\n const behavior = (props as ClientOnlyHostProps)[\n FigClientOnlyHostBehaviorSymbol\n ];\n return typeof behavior === \"string\" ? behavior : undefined;\n}\n\nfunction emptyMixinValue(value: unknown): value is EmptyMixinValue {\n return (\n value === false ||\n value === 0 ||\n value === 0n ||\n value === \"\" ||\n value === null ||\n value === undefined\n );\n}\n\nfunction isMixinDescriptor(value: unknown): value is MixinDescriptor {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"$$typeof\" in value &&\n value.$$typeof === FigMixinSymbol\n );\n}\n\n// Dev-only: the wrapper lives in the createMixin module copy, so it guards the\n// dispatcher used by hooks imported alongside that factory even when another\n// linked or prebundled copy resolves the descriptor.\nfunction guardMixinType(type: MixinRuntimeType): MixinRuntimeType {\n return (context, ...args) => {\n const previousDispatcher = setCurrentDispatcher(\n mixinDispatcher(context.type, mixinSlot(context)),\n );\n try {\n return type(context, ...args);\n } finally {\n setCurrentDispatcher(previousDispatcher);\n }\n };\n}\n\nfunction mixinDispatcher(type: string, slot: string): RenderDispatcher {\n return new Proxy({} as RenderDispatcher, {\n get(_target, property) {\n throw new Error(\n `A mixin on <${type}> (slot ${slot}) called ${String(property)}. ` +\n \"Mixins are pure render-time code: hooks and read verbs belong to \" +\n \"the component; host lifetimes belong in returned on() or bind \" +\n \"behavior.\",\n );\n },\n });\n}\n","import type { DataResourceKey } from \"./data.ts\";\nimport { readPromise } from \"./hooks.ts\";\nimport type { ClientReferenceAssets } from \"./resource.ts\";\nimport { resolveHostMix } from \"./mixin.ts\";\n\n/** Describes key. */\nexport type Key = string | number;\n/** Describes props. */\nexport type Props = Record<string, any>;\n/** Describes component type. */\nexport type ComponentType<P = Props> = (\n props: P & { children?: FigNode },\n) => FigNode;\n/** Describes component props. */\nexport type ComponentProps<T extends ComponentType<any>> =\n Parameters<T> extends [infer P, ...unknown[]]\n ? P extends Props\n ? P\n : Props\n : {};\n/** Describes element type. */\nexport type ElementType<P = Props> =\n | string\n | typeof Fragment\n | FigAssets\n | FigClientReference<P>\n | FigErrorBoundary\n | FigSuspense\n | FigActivity\n | FigViewTransition\n | ComponentType<P>;\n/** Describes awaited Fig node. */\nexport type AwaitedFigNode =\n | FigElement<any>\n | FigPortal<any>\n | string\n | number\n | boolean\n | null\n | undefined\n | FigNode[];\n/** Describes Fig node. */\nexport type FigNode = AwaitedFigNode | PromiseLike<AwaitedFigNode>;\n\n/** Describes Fig element. */\nexport interface FigElement<P = Props> {\n readonly $$typeof: symbol;\n readonly type: ElementType<any>;\n readonly key: Key | null;\n readonly props: P & { children?: FigNode };\n}\n\n/** Describes Fig portal. */\nexport interface FigPortal<Target = unknown> {\n readonly $$typeof: symbol;\n readonly children: FigNode;\n readonly key: Key | null;\n readonly target: Target;\n}\n\n/** Describes client reference options. */\nexport interface ClientReferenceOptions<P extends Props = Props> {\n assets?: ClientReferenceAssets;\n id: string;\n ssr?: ComponentType<P>;\n}\n\n/** Describes Fig client reference. */\nexport interface FigClientReference<P = Props> {\n (props: P & { children?: FigNode }): FigNode;\n readonly $$typeof: symbol;\n readonly assets?: ClientReferenceAssets;\n readonly id: string;\n readonly ssr?: ComponentType<P>;\n}\n\n/** Describes lazy loader. */\nexport type LazyLoader<T extends ComponentType<any> = ComponentType<any>> =\n () => PromiseLike<T>;\n\n/** Describes suspense props. */\nexport interface SuspenseProps {\n fallback?: FigNode;\n children?: FigNode;\n}\n\n/** Describes Fig suspense. */\nexport interface FigSuspense {\n (props: SuspenseProps): FigNode;\n readonly $$typeof: symbol;\n}\n\n/** Describes activity mode. */\nexport type ActivityMode = \"visible\" | \"hidden\";\n\n/** Describes activity props. */\nexport interface ActivityProps {\n mode: ActivityMode;\n children?: FigNode;\n}\n\n/** Describes Fig activity. */\nexport interface FigActivity {\n (props: ActivityProps): FigNode;\n readonly $$typeof: symbol;\n}\n\n/** Describes view transition class. */\nexport type ViewTransitionClass = \"auto\" | \"none\" | (string & {});\n\n/** Describes view transition phase. */\nexport type ViewTransitionPhase = \"enter\" | \"exit\" | \"share\" | \"update\";\n\n// Renderer-neutral identity for one named host surface in the native\n// transition. Renderer packages can resolve it into their own imperative\n// handles without putting host types in core.\n/** Describes view transition surface. */\nexport interface ViewTransitionSurface {\n readonly name: string;\n}\n\n/** Describes view transition event. */\nexport interface ViewTransitionEvent {\n readonly phase: ViewTransitionPhase;\n readonly surfaces: readonly ViewTransitionSurface[];\n readonly types: readonly string[];\n}\n\n/** Describes view transition callback. */\nexport type ViewTransitionCallback = (\n event: ViewTransitionEvent,\n signal: AbortSignal,\n) => undefined;\n\n/** Describes view transition props. */\nexport interface ViewTransitionProps {\n name?: string;\n children?: FigNode;\n default?: ViewTransitionClass;\n enter?: ViewTransitionClass;\n exit?: ViewTransitionClass;\n share?: ViewTransitionClass;\n update?: ViewTransitionClass;\n onTransition?: ViewTransitionCallback;\n}\n\n/** Describes Fig view transition. */\nexport interface FigViewTransition {\n (props: ViewTransitionProps): FigNode;\n readonly $$typeof: symbol;\n}\n\n/** Describes error boundary props. */\nexport interface ErrorBoundaryProps {\n // A function fallback receives the caught error so error UIs can render\n // it (message, retry affordance) without smuggling state above the\n // boundary through onError. Callable thenables are nodes, so the runtime\n // distinguishes them from render fallbacks before invoking the function.\n fallback?: FigNode | ((error: unknown, info: ErrorInfo) => FigNode);\n onError?: (error: unknown, info: ErrorInfo) => void;\n children?: FigNode;\n}\n\n/** Describes error info. */\nexport interface ErrorInfo {\n componentStack: string;\n dataResourceKeys?: DataResourceKey[];\n}\n\n/** Describes Fig error boundary. */\nexport interface FigErrorBoundary {\n (props: ErrorBoundaryProps): FigNode;\n readonly $$typeof: symbol;\n}\n\n/** Describes Fig assets. */\nexport interface FigAssets {\n (props: Props & { children?: FigNode }): FigNode;\n readonly $$typeof: symbol;\n}\n\n/** The fragment. */\nexport const Fragment = Symbol.for(\"fig.fragment\");\n/** The Fig element symbol. */\nexport const FigElementSymbol = Symbol.for(\"fig.element\");\n/** The Fig client reference symbol. */\nexport const FigClientReferenceSymbol = Symbol.for(\"fig.client-reference\");\n/** The Fig activity symbol. */\nexport const FigActivitySymbol = Symbol.for(\"fig.activity\");\n/** The Fig error boundary symbol. */\nexport const FigErrorBoundarySymbol = Symbol.for(\"fig.error-boundary\");\n/** The Fig portal symbol. */\nexport const FigPortalSymbol = Symbol.for(\"fig.portal\");\n/** The Fig assets symbol. */\nexport const FigAssetsSymbol = Symbol.for(\"fig.assets\");\n/** The Fig suspense symbol. */\nexport const FigSuspenseSymbol = Symbol.for(\"fig.suspense\");\n/** The Fig view transition symbol. */\nexport const FigViewTransitionSymbol = Symbol.for(\"fig.view-transition\");\n\n/** The assets. */\nexport const Assets: FigAssets = Object.assign(\n (props: Props & { children?: FigNode }) => props.children,\n { $$typeof: FigAssetsSymbol },\n);\n\n/** The error boundary. */\nexport const ErrorBoundary: FigErrorBoundary = Object.assign(\n (props: ErrorBoundaryProps) => props.children,\n { $$typeof: FigErrorBoundarySymbol },\n);\n\n/** The suspense. */\nexport const Suspense: FigSuspense = Object.assign(\n (props: SuspenseProps) => props.children,\n { $$typeof: FigSuspenseSymbol },\n);\n\n/** The activity. */\nexport const Activity: FigActivity = Object.assign(\n (props: ActivityProps) => props.children,\n { $$typeof: FigActivitySymbol },\n);\n\n/** The view transition. */\nexport const ViewTransition: FigViewTransition = Object.assign(\n (props: ViewTransitionProps) => props.children,\n { $$typeof: FigViewTransitionSymbol },\n);\n\n/** Creates element. */\nexport function createElement<P extends Props>(\n type: ElementType<P>,\n config?: (P & { key?: Key | null }) | null,\n ...children: FigNode[]\n): FigElement<P> {\n const props = { ...config } as P & {\n children?: FigNode;\n key?: Key | null;\n };\n const key = props.key ?? null;\n delete props.key;\n\n if (children.length === 1) props.children = children[0];\n else if (children.length > 1) props.children = children;\n\n return {\n $$typeof: FigElementSymbol,\n type,\n key,\n props:\n \"mix\" in props && typeof type === \"string\"\n ? resolveHostMix(type, props)\n : props,\n };\n}\n\n/** Checks whether valid element. */\nexport function isValidElement(value: unknown): value is FigElement {\n return hasObjectBrand(value, FigElementSymbol);\n}\n\n/** Creates portal node. */\nexport function createPortalNode<Target>(\n children: FigNode,\n target: Target,\n key: Key | null = null,\n): FigPortal<Target> {\n return { $$typeof: FigPortalSymbol, children, key, target };\n}\n\n/** Checks whether portal. */\nexport function isPortal(value: unknown): value is FigPortal {\n return hasObjectBrand(value, FigPortalSymbol);\n}\n\n/** Client reference. */\nexport function clientReference<P extends Props = Props>(\n options: ClientReferenceOptions<P>,\n): FigClientReference<P> {\n return Object.assign(\n (): never => {\n throw new Error(\n `Client reference \"${options.id}\" cannot be rendered on the server directly.`,\n );\n },\n {\n $$typeof: FigClientReferenceSymbol,\n assets: options.assets,\n id: options.id,\n ssr: options.ssr,\n },\n );\n}\n\n/** Lazy. */\nexport function lazy<T extends ComponentType<any>>(\n load: LazyLoader<T>,\n): ComponentType<ComponentProps<T>> {\n let promise: PromiseLike<T> | null = null;\n let rejected = false;\n\n const Lazy: ComponentType<ComponentProps<T>> = (props) => {\n if (promise === null) {\n rejected = false;\n const next = Promise.resolve(load()).then(\n (value) => value,\n (error) => {\n if (promise === next) rejected = true;\n throw error;\n },\n );\n promise = next;\n }\n\n try {\n return createElement(readPromise(promise), props);\n } catch (error) {\n if (rejected) {\n promise = null;\n rejected = false;\n }\n throw error;\n }\n };\n\n return Lazy;\n}\n\n/** Checks whether client reference. */\nexport function isClientReference(value: unknown): value is FigClientReference {\n return hasFunctionBrand(value, FigClientReferenceSymbol);\n}\n\n/** Checks whether suspense. */\nexport function isSuspense(value: unknown): value is FigSuspense {\n return hasFunctionBrand(value, FigSuspenseSymbol);\n}\n\n/** Checks whether activity. */\nexport function isActivity(value: unknown): value is FigActivity {\n return hasFunctionBrand(value, FigActivitySymbol);\n}\n\n/** Checks whether error boundary. */\nexport function isErrorBoundary(value: unknown): value is FigErrorBoundary {\n return hasFunctionBrand(value, FigErrorBoundarySymbol);\n}\n\n/** Checks whether view transition. */\nexport function isViewTransition(value: unknown): value is FigViewTransition {\n return hasFunctionBrand(value, FigViewTransitionSymbol);\n}\n\n/** Checks whether assets. */\nexport function isAssets(value: unknown): value is FigAssets {\n return hasFunctionBrand(value, FigAssetsSymbol);\n}\n\nfunction hasObjectBrand(value: unknown, brand: symbol): boolean {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"$$typeof\" in value &&\n value.$$typeof === brand\n );\n}\n\nfunction hasFunctionBrand(value: unknown, brand: symbol): boolean {\n return (\n typeof value === \"function\" &&\n \"$$typeof\" in value &&\n value.$$typeof === brand\n );\n}\n"],"mappings":";AAoLA,MAAM,gCAAgC,OAAO,IAAI,uBAAuB;;AAMxE,SAAgB,8BACd,SACA,cACM;CACN,OAAO,eAAe,SAAS,+BAA+B;EAC5D,cAAc;EACd,YAAY;EACZ,OAAO;CACT,CAAC;AACH;;AAGA,SAAgB,wBACd,SACqC;CACrC,OAAQ,QACN;AAEJ;AAEA,MAAM,mCAAmB,IAAI,QAAmC;AAEhE,IAAI,mBAAwC;;AAG5C,SAAgB,wBACd,UAAU,gDACI;CACd,IAAI,qBAAqB,MAAM,MAAM,IAAI,MAAM,OAAO;CACtD,OAAO;AACT;;AAGA,SAAgB,oBACd,OACqB;CACrB,MAAM,gBAAgB;CACtB,mBAAmB;CACnB,OAAO;AACT;;AAGA,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;;AAGA,SAAgB,yBACd,OAC+B;CAC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sC;CAC/D,OAAO,iBAAiB,OAAO,iBAAiB;AAClD;;AAGA,SAAgB,gBAAgB,OAA2C;CACzE,OAAO,iBAAiB,OAAO,sBAAsB;AACvD;;AAGA,SAAgB,iBAAiB,OAA4C;CAC3E,OAAO,iBAAiB,OAAO,uBAAuB;AACxD;;AAGA,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,5 +1,6 @@
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";
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-9MtOc5qb.js";
2
2
  //#region src/context.d.ts
3
+ /** Describes Fig context. */
3
4
  interface FigContext<T> {
4
5
  (props: {
5
6
  value: T;
@@ -8,16 +9,21 @@ interface FigContext<T> {
8
9
  readonly $$typeof: symbol;
9
10
  readonly defaultValue: T;
10
11
  }
12
+ /** The Fig context symbol. */
11
13
  declare const FigContextSymbol: unique symbol;
14
+ /** Creates context. */
12
15
  declare function createContext<T>(defaultValue: T): FigContext<T>;
16
+ /** Checks whether context. */
13
17
  declare function isContext(value: unknown): value is FigContext<unknown>;
14
18
  //#endregion
15
19
  //#region src/data-store.d.ts
20
+ /** Describes data resource options. */
16
21
  interface DataResourceOptions<TArgs extends unknown[], TValue> {
17
22
  key: (...args: TArgs) => DataResourceKey;
18
23
  debugArgs?: (...args: TArgs) => DataResourceKeyInput;
19
24
  load?: DataResourceLoader<TArgs, TValue>;
20
25
  }
26
+ /** Describes data store host. */
21
27
  interface DataStoreHost<Owner extends object, Lane> {
22
28
  getLane(): Lane;
23
29
  inactiveRetentionMs?: number;
@@ -27,53 +33,83 @@ interface DataStoreHost<Owner extends object, Lane> {
27
33
  preloadRetentionMs?: number;
28
34
  schedule(owner: Owner, lane: Lane): void;
29
35
  }
36
+ /** Describes data store. */
30
37
  interface DataStore<Owner extends object = object, Lane = unknown> extends FigDataStore {
31
38
  readonly host: DataStoreHost<Owner, Lane>;
32
39
  }
40
+ /** Data resource. */
33
41
  declare function dataResource<TArgs extends unknown[], TValue>(options: DataResourceOptions<TArgs, TValue>): DataResource<TArgs, TValue>;
42
+ /** Ensures data. */
34
43
  declare function ensureData<TArgs extends unknown[], TValue>(resource: DataResource<TArgs, TValue>, ...args: TArgs): Promise<TValue>;
44
+ /** Invalidates data. */
35
45
  declare function invalidateData<TArgs extends unknown[], TValue>(resource: DataResource<TArgs, TValue>, ...args: TArgs): void;
46
+ /** Invalidates data error. */
36
47
  declare function invalidateDataError(error: unknown): boolean;
48
+ /** Invalidates data key. */
37
49
  declare function invalidateDataKey(key: DataResourceKey): void;
50
+ /** Invalidates data prefix. */
38
51
  declare function invalidateDataPrefix(prefix: DataResourceKey): void;
52
+ /** Refreshes data. */
39
53
  declare function refreshData<TArgs extends unknown[], TValue>(resource: DataResource<TArgs, TValue>, ...args: TArgs): Promise<DataRefreshResult<TValue>>;
54
+ /** Reads data store. */
40
55
  declare function readDataStore(): FigDataStoreHandle;
56
+ /** Creates data store. */
41
57
  declare function createDataStore(options?: FigDataStoreOptions): FigDataStoreController;
58
+ /** Checks whether data store controller. */
42
59
  declare function isDataStoreController(value: unknown): value is FigDataStoreController;
60
+ /** Attach data store. */
43
61
  declare function attachDataStore(controller: FigDataStoreController, host: FigDataStoreHost, initialData?: readonly FigDataHydrationEntry[]): FigDataStore;
62
+ /** Creates renderer data store. */
44
63
  declare function createRendererDataStore<Owner extends object, Lane>(host: DataStoreHost<Owner, Lane>): DataStore<Owner, Lane>;
64
+ /** Normalizes data resource key. */
45
65
  declare function normalizeDataResourceKey(key: DataResourceKey): string;
66
+ /** Runs with data store. */
46
67
  declare function runWithDataStore<T>(store: FigDataStore, callback: () => T): T;
68
+ /** Current data store. */
47
69
  declare function currentDataStore(): FigDataStore;
48
70
  //#endregion
49
71
  //#region src/mixin.d.ts
72
+ /** Describes mixin context. */
50
73
  interface MixinContext {
51
74
  /** The intrinsic host name receiving this mixin. */
52
75
  readonly type: string;
53
76
  /** Props composed by the host and every preceding mixin. */
54
77
  readonly props: Readonly<Props>;
55
78
  }
79
+ /** Describes empty mixin value. */
56
80
  type EmptyMixinValue = false | 0 | 0n | "" | null | undefined;
81
+ /** Describes mixin input. */
57
82
  type MixinInput = MixinDescriptor | EmptyMixinValue | ReadonlyArray<MixinInput>;
83
+ /** Describes mixin result. */
58
84
  type MixinResult = Props | MixinInput;
85
+ /** Describes mixin type. */
59
86
  type MixinType<TArgs extends unknown[] = unknown[]> = (context: MixinContext, ...args: TArgs) => MixinResult;
60
87
  type MixinRuntimeType = (context: MixinContext, ...args: unknown[]) => MixinResult;
88
+ /** Describes mixin descriptor. */
61
89
  interface MixinDescriptor {
62
90
  readonly $$typeof: symbol;
63
91
  readonly args: readonly unknown[];
64
92
  readonly type: MixinRuntimeType;
65
93
  }
94
+ /** Describes mixin factory. */
66
95
  type MixinFactory<TArgs extends unknown[]> = (...args: TArgs) => MixinDescriptor;
96
+ /** The Fig mixin symbol. */
67
97
  declare const FigMixinSymbol: unique symbol;
68
98
  /** Creates a render-time host behavior for the `mix` prop. */
69
99
  declare function createMixin<TArgs extends unknown[]>(type: MixinType<TArgs>): MixinFactory<TArgs>;
100
+ /** Resolves host mix. */
70
101
  declare function resolveHostMix<P extends Props>(type: string, input: P): P;
102
+ /** Mixin slot. */
71
103
  declare function mixinSlot(context: MixinContext): string;
104
+ /** Marks client only host behavior. */
72
105
  declare function markClientOnlyHostBehavior(context: MixinContext, behavior: string): void;
106
+ /** Marks client only host props. */
73
107
  declare function markClientOnlyHostProps(value: object, behavior: string): void;
108
+ /** Client only host behavior. */
74
109
  declare function clientOnlyHostBehavior(props: object): string | undefined;
75
110
  //#endregion
76
111
  //#region src/transition.d.ts
112
+ /** Describes transition options. */
77
113
  interface TransitionOptions {
78
114
  types?: readonly string[];
79
115
  /**
@@ -83,6 +119,7 @@ interface TransitionOptions {
83
119
  */
84
120
  viewTransition?: "interrupt";
85
121
  }
122
+ /** Describes transition handler. */
86
123
  type TransitionHandler = <T>(callback: () => T, options?: TransitionOptions) => T;
87
124
  /**
88
125
  * Runs state updates scheduled by `callback` at transition priority. If
@@ -90,12 +127,17 @@ type TransitionHandler = <T>(callback: () => T, options?: TransitionOptions) =>
90
127
  * transition priority scope until it settles.
91
128
  */
92
129
  declare function transition<T>(callback: () => T, options?: TransitionOptions): T;
130
+ /** Sets transition handler. */
93
131
  declare function setTransitionHandler(handler: TransitionHandler): TransitionHandler;
94
132
  //#endregion
95
133
  //#region src/hooks.d.ts
134
+ /** Describes state setter. */
96
135
  type StateSetter<S> = (next: S | ((previous: S) => S)) => void;
136
+ /** Describes external store subscribe. */
97
137
  type ExternalStoreSubscribe = (callback: () => void) => () => void;
138
+ /** Describes action state action. */
98
139
  type ActionStateAction<S, Args extends unknown[]> = (previousState: S, ...argsAndSignal: [...Args, AbortSignal]) => S | PromiseLike<S>;
140
+ /** Describes action state runner. */
99
141
  type ActionStateRunner<Args extends unknown[]> = (...args: Args) => void;
100
142
  /**
101
143
  * Runs state updates scheduled by `callback` at transition priority. If
@@ -112,6 +154,7 @@ type ActionStateRunner<Args extends unknown[]> = (...args: Args) => void;
112
154
  */
113
155
  type StartTransition = (callback: (signal: AbortSignal) => void | PromiseLike<void>, options?: TransitionOptions) => void;
114
156
  type Callback = (...args: never[]) => unknown;
157
+ /** Describes render dispatcher. */
115
158
  interface RenderDispatcher {
116
159
  useState<S>(initialState: S | (() => S)): [S, StateSetter<S>];
117
160
  useActionState<S, Args extends unknown[]>(action: ActionStateAction<S, Args>, initialState: S): [S, ActionStateRunner<Args>, boolean];
@@ -129,9 +172,13 @@ interface RenderDispatcher {
129
172
  preloadData<TArgs extends unknown[], TValue>(resource: DataResource<TArgs, TValue>, args: TArgs): void;
130
173
  readPromise<T>(promise: PromiseLike<T>): T;
131
174
  }
175
+ /** Describes effect callback. */
132
176
  type EffectCallback = (signal: AbortSignal) => undefined;
177
+ /** Describes dependency list. */
133
178
  type DependencyList = readonly unknown[];
179
+ /** Describes stable event caller args. */
134
180
  type StableEventCallerArgs<Args extends unknown[]> = Args extends [...infer CallerArgs, AbortSignal] ? CallerArgs : Args;
181
+ /** Returns state. */
135
182
  declare function useState<S>(initialState: S | (() => S)): [S, StateSetter<S>];
136
183
  /**
137
184
  * Tracks state returned by a client-side action. The action receives the
@@ -146,20 +193,35 @@ declare function useState<S>(initialState: S | (() => S)): [S, StateSetter<S>];
146
193
  * when an enclosing Activity hides.
147
194
  */
148
195
  declare function useActionState<S, Args extends unknown[]>(action: ActionStateAction<S, Args>, initialState: S): [S, ActionStateRunner<Args>, boolean];
196
+ /** Returns ID. */
149
197
  declare function useId(): string;
198
+ /** Returns deferred value. */
150
199
  declare function useDeferredValue<T>(value: T, initialValue?: T): T;
200
+ /** Returns memo. */
151
201
  declare function useMemo<T>(calculate: () => T, deps: DependencyList): T;
202
+ /** Returns transition. */
152
203
  declare function useTransition(): [boolean, StartTransition];
204
+ /** Returns callback. */
153
205
  declare function useCallback<T extends Callback>(callback: T, deps: DependencyList): T;
206
+ /** Returns reactive. */
154
207
  declare function useReactive(effect: EffectCallback, deps?: DependencyList): void;
208
+ /** Returns before paint. */
155
209
  declare function useBeforePaint(effect: EffectCallback, deps?: DependencyList): void;
210
+ /** Returns before layout. */
156
211
  declare function useBeforeLayout(effect: EffectCallback, deps?: DependencyList): void;
212
+ /** Returns sync external store. */
157
213
  declare function useSyncExternalStore<T>(subscribe: ExternalStoreSubscribe, getSnapshot: () => T, getServerSnapshot?: () => T): T;
214
+ /** Returns stable event. */
158
215
  declare function useStableEvent<Args extends unknown[], Result>(handler: (...args: Args) => Result): (...args: StableEventCallerArgs<Args>) => Result;
216
+ /** Reads context. */
159
217
  declare function readContext<T>(context: FigContext<T>): T;
218
+ /** Reads promise. */
160
219
  declare function readPromise<T>(promise: PromiseLike<T>): T;
220
+ /** Reads data. */
161
221
  declare function readData<TArgs extends unknown[], TValue>(resource: DataResource<TArgs, TValue>, ...args: TArgs): TValue;
222
+ /** Preloads data. */
162
223
  declare function preloadData<TArgs extends unknown[], TValue>(resource: DataResource<TArgs, TValue>, ...args: TArgs): void;
224
+ /** Sets current dispatcher. */
163
225
  declare function setCurrentDispatcher(dispatcher: RenderDispatcher | null): RenderDispatcher | null;
164
226
  //#endregion
165
227
  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-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";
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-9MtOc5qb.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-Bw3vbom7.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-DjIYK0NB.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-BAfMrZ1g.js";
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-WvgFiYNY.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-mHDfizuh.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-BJxS62H2.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 };
@@ -1,16 +1,23 @@
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";
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-9MtOc5qb.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-Bw3vbom7.js";
3
3
  //#region src/children.d.ts
4
+ /** Describes normalized child. */
4
5
  type NormalizedChild = FigElement<any> | FigPortal<any> | PromiseLike<AwaitedFigNode> | string;
6
+ /** Collect children. */
5
7
  declare function collectChildren(node: FigNode): NormalizedChild[];
8
+ /** Invalid child error. */
6
9
  declare function invalidChildError(value: unknown): Error;
10
+ /** Describes invalid child. */
7
11
  declare function describeInvalidChild(value: unknown): string;
8
12
  //#endregion
9
13
  //#region src/dom-nesting.d.ts
14
+ /** Validates instance nesting. */
10
15
  declare function validateInstanceNesting(type: string, ancestors: readonly string[]): void;
16
+ /** Validates text nesting. */
11
17
  declare function validateTextNesting(text: string, ancestors: readonly string[]): void;
12
18
  //#endregion
13
19
  //#region src/payload-format.d.ts
20
+ /** Describes serialized asset resource. */
14
21
  type SerializedAssetResource = {
15
22
  crossorigin?: StylesheetResource["crossorigin"];
16
23
  href: string;
@@ -101,6 +108,7 @@ type PayloadRow = {
101
108
  type PayloadModel = null | boolean | number | string | PayloadModel[] | {
102
109
  [key: string]: PayloadModel;
103
110
  } | PayloadElementModel | PayloadSpecialModel;
111
+ /** Describes payload element model. */
104
112
  type PayloadElementModel = {
105
113
  $fig: "element";
106
114
  id?: number;
@@ -108,6 +116,7 @@ type PayloadElementModel = {
108
116
  props: PayloadModel;
109
117
  type: string | PayloadSpecialModel;
110
118
  };
119
+ /** Describes payload special model. */
111
120
  type PayloadSpecialModel = {
112
121
  $fig: "array";
113
122
  id: number;
@@ -157,6 +166,7 @@ type PayloadSpecialModel = {
157
166
  } | {
158
167
  $fig: "view-transition";
159
168
  };
169
+ /** Describes payload data hydration entry. */
160
170
  type PayloadDataHydrationEntry = Omit<FigDataHydrationEntry, "value"> & {
161
171
  value: PayloadModel;
162
172
  };
@@ -192,11 +202,14 @@ declare const jsonPayloadCodec: PayloadCodec;
192
202
  * declared.
193
203
  */
194
204
  declare function assertPayloadCodecMatches(codec: PayloadCodec, contentTypeHeader: string | null): void;
205
+ /** Describes payload graph encode context. */
195
206
  interface PayloadGraphEncodeContext {
196
207
  defined: object[];
197
208
  ids: WeakMap<object, number>;
198
209
  }
210
+ /** Creates payload graph encode context. */
199
211
  declare function createPayloadGraphEncodeContext(): PayloadGraphEncodeContext;
212
+ /** Checks whether plain payload value. */
200
213
  declare function isPlainPayloadValue(value: unknown): boolean;
201
214
  /**
202
215
  * Encode ordinary data values into PayloadModel. Server component references
@@ -204,41 +217,71 @@ declare function isPlainPayloadValue(value: unknown): boolean;
204
217
  * payload renderer before ordinary values reach this helper.
205
218
  */
206
219
  declare function encodePayloadValue(value: unknown): PayloadModel;
220
+ /** Encodes payload value with graph. */
207
221
  declare function encodePayloadValueWithGraph(value: unknown, graph: PayloadGraphEncodeContext): PayloadModel;
222
+ /** Serializes payload map. */
208
223
  declare function serializePayloadMap(value: Map<unknown, unknown>, graph: PayloadGraphEncodeContext, encodeEntry: (entry: [unknown, unknown]) => [PayloadModel, PayloadModel]): PayloadModel;
224
+ /** Serializes payload set. */
209
225
  declare function serializePayloadSet(value: Set<unknown>, graph: PayloadGraphEncodeContext, encodeItem: (value: unknown) => PayloadModel): PayloadModel;
226
+ /** Checkpoint payload graph. */
210
227
  declare function checkpointPayloadGraph(graph: PayloadGraphEncodeContext): number;
228
+ /** Rollback payload graph. */
211
229
  declare function rollbackPayloadGraph(graph: PayloadGraphEncodeContext, checkpoint: number): void;
230
+ /** Define payload graph element. */
212
231
  declare function definePayloadGraphElement(graph: PayloadGraphEncodeContext, value: object): number | PayloadSpecialModel;
232
+ /** Serializes payload array. */
213
233
  declare function serializePayloadArray<T>(value: readonly T[], graph: PayloadGraphEncodeContext, encodeChild: (value: T) => PayloadModel): PayloadModel;
234
+ /** Serializes payload plain object. */
214
235
  declare function serializePayloadPlainObject(value: object, graph: PayloadGraphEncodeContext, encodeChild: (value: unknown) => PayloadModel): PayloadModel;
215
236
  /** Decode values produced by encodePayloadValue. */
216
237
  declare function decodePayloadValue(model: PayloadModel): unknown;
238
+ /** Encodes payload data entries. */
217
239
  declare function encodePayloadDataEntries(entries: readonly FigDataHydrationEntry[]): PayloadDataHydrationEntry[];
240
+ /** Decodes payload data entries. */
218
241
  declare function decodePayloadDataEntries(entries: readonly PayloadDataHydrationEntry[]): FigDataHydrationEntry[];
242
+ /** Checks whether payload special model. */
219
243
  declare function isPayloadSpecialModel(model: object): model is PayloadElementModel | PayloadSpecialModel;
220
244
  //#endregion
221
245
  //#region src/suspense-protocol.d.ts
246
+ /** The suspense marker prefix. */
222
247
  declare const SUSPENSE_MARKER_PREFIX = "fig:suspense:";
248
+ /** The suspense completed marker. */
223
249
  declare const SUSPENSE_COMPLETED_MARKER = "fig:suspense:completed";
250
+ /** The suspense client marker. */
224
251
  declare const SUSPENSE_CLIENT_MARKER = "fig:suspense:client";
252
+ /** The suspense pending prefix. */
225
253
  declare const SUSPENSE_PENDING_PREFIX = "fig:suspense:pending:";
254
+ /** The suspense end marker. */
226
255
  declare const SUSPENSE_END_MARKER = "/fig:suspense";
256
+ /** The text separator data. */
227
257
  declare const TEXT_SEPARATOR_DATA = ",";
258
+ /** The activity template attribute. */
228
259
  declare const ACTIVITY_TEMPLATE_ATTRIBUTE = "data-fig-activity";
260
+ /** The view transition name attribute. */
229
261
  declare const VIEW_TRANSITION_NAME_ATTRIBUTE = "data-fig-vt-name";
262
+ /** The view transition class attribute. */
230
263
  declare const VIEW_TRANSITION_CLASS_ATTRIBUTE = "data-fig-vt-class";
264
+ /** The view transition pending property. */
231
265
  declare const VIEW_TRANSITION_PENDING_PROPERTY = "__figViewTransition";
266
+ /** The view transition timeout ms. */
232
267
  declare const VIEW_TRANSITION_TIMEOUT_MS = 60000;
268
+ /** The hydration skip attribute. */
233
269
  declare const HYDRATION_SKIP_ATTRIBUTE = "data-fig-hydration-skip";
270
+ /** The early event queue property. */
234
271
  declare const EARLY_EVENT_QUEUE_PROPERTY = "__figEarlyEvents";
272
+ /** The early event handler property. */
235
273
  declare const EARLY_EVENT_HANDLER_PROPERTY = "__figEarlyEventHandler";
274
+ /** The replayable event types. */
236
275
  declare const REPLAYABLE_EVENT_TYPES: readonly ["click", "keydown", "keyup", "pointerdown", "pointerup"];
237
276
  //#endregion
238
277
  //#region src/thenables.d.ts
278
+ /** Describes thenable. */
239
279
  type Thenable<T = unknown> = PromiseLike<T> & object;
280
+ /** Tracks thenable. */
240
281
  declare function trackThenable<T>(thenable: PromiseLike<T>): void;
282
+ /** Reads thenable. */
241
283
  declare function readThenable<T>(thenable: PromiseLike<T>): T;
284
+ /** Checks whether thenable. */
242
285
  declare function isThenable(value: unknown): value is Thenable;
243
286
  //#endregion
244
287
  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,8 +1,9 @@
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-DjIYK0NB.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-BAfMrZ1g.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";
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-WvgFiYNY.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-mHDfizuh.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-BJxS62H2.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-BbsvTG9V.js";
5
5
  //#region src/children.ts
6
+ /** Collect children. */
6
7
  function collectChildren(node) {
7
8
  if (Array.isArray(node)) return collectArrayChildren(node);
8
9
  const children = [];
@@ -57,9 +58,11 @@ function appendTextChild(children, text) {
57
58
  if (typeof previous === "string") children[children.length - 1] = `${previous}${text}`;
58
59
  else children.push(text);
59
60
  }
61
+ /** Invalid child error. */
60
62
  function invalidChildError(value) {
61
63
  return /* @__PURE__ */ new Error(`Invalid Fig child: ${describeInvalidChild(value)}. Render a string, number, element, promise, array, boolean, null, or undefined.`);
62
64
  }
65
+ /** Describes invalid child. */
63
66
  function describeInvalidChild(value) {
64
67
  if (typeof value !== "object" || value === null) return typeof value;
65
68
  const keys = Object.keys(value);
@@ -72,6 +75,7 @@ const scopeTerminators = "|applet|caption|desc|foreignobject|html|marquee|object
72
75
  const pAutoClosingTags = "|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|";
73
76
  const headChildren = "|base|basefont|bgsound|link|meta|title|noscript|noframes|script|style|template|";
74
77
  const specialTags = "|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|";
78
+ /** Validates instance nesting. */
75
79
  function validateInstanceNesting(type, ancestors) {
76
80
  const child = normalizedTag(type);
77
81
  const parent = ancestors[0] === void 0 ? null : normalizedTag(ancestors[0]);
@@ -79,6 +83,7 @@ function validateInstanceNesting(type, ancestors) {
79
83
  const invalidAncestor = invalidAncestorFor(child, ancestors);
80
84
  if (invalidAncestor !== null) throw invalidNestingError(`<${child}> cannot appear inside <${invalidAncestor}>.`);
81
85
  }
86
+ /** Validates text nesting. */
82
87
  function validateTextNesting(text, ancestors) {
83
88
  if (!/[^ \t\n\r\f]/.test(text)) return;
84
89
  const parent = ancestors[0] === void 0 ? null : normalizedTag(ancestors[0]);
@@ -168,20 +173,35 @@ function tagIn(tags, tag) {
168
173
  }
169
174
  //#endregion
170
175
  //#region src/suspense-protocol.ts
176
+ /** The suspense marker prefix. */
171
177
  const SUSPENSE_MARKER_PREFIX = "fig:suspense:";
178
+ /** The suspense completed marker. */
172
179
  const SUSPENSE_COMPLETED_MARKER = "fig:suspense:completed";
180
+ /** The suspense client marker. */
173
181
  const SUSPENSE_CLIENT_MARKER = "fig:suspense:client";
182
+ /** The suspense pending prefix. */
174
183
  const SUSPENSE_PENDING_PREFIX = "fig:suspense:pending:";
184
+ /** The suspense end marker. */
175
185
  const SUSPENSE_END_MARKER = "/fig:suspense";
186
+ /** The text separator data. */
176
187
  const TEXT_SEPARATOR_DATA = ",";
188
+ /** The activity template attribute. */
177
189
  const ACTIVITY_TEMPLATE_ATTRIBUTE = "data-fig-activity";
190
+ /** The view transition name attribute. */
178
191
  const VIEW_TRANSITION_NAME_ATTRIBUTE = "data-fig-vt-name";
192
+ /** The view transition class attribute. */
179
193
  const VIEW_TRANSITION_CLASS_ATTRIBUTE = "data-fig-vt-class";
194
+ /** The view transition pending property. */
180
195
  const VIEW_TRANSITION_PENDING_PROPERTY = "__figViewTransition";
196
+ /** The view transition timeout ms. */
181
197
  const VIEW_TRANSITION_TIMEOUT_MS = 6e4;
198
+ /** The hydration skip attribute. */
182
199
  const HYDRATION_SKIP_ATTRIBUTE = "data-fig-hydration-skip";
200
+ /** The early event queue property. */
183
201
  const EARLY_EVENT_QUEUE_PROPERTY = "__figEarlyEvents";
202
+ /** The early event handler property. */
184
203
  const EARLY_EVENT_HANDLER_PROPERTY = "__figEarlyEventHandler";
204
+ /** The replayable event types. */
185
205
  const REPLAYABLE_EVENT_TYPES = [
186
206
  "click",
187
207
  "keydown",