@runic-artifex/react
CollectionViewportre-exportexport { CollectionViewport } from '@runic-artifex/views'Re-exported from
CollectionViewport.CollectionViewportHandleinterfaceCollectionViewportOptionsre-exportexport { CollectionViewportOptions } from '@runic-artifex/views'Re-exported from
CollectionViewportOptions.CommandHandleinterfaceretrySuspenseViewfunctionfunction retrySuspenseView(source: ViewConnector<ViewClient>): void;Forgets a failed
useSuspenseViewconnection, so the next render connects again. Call it from an error boundary's reset before rendering the component again. A connection that is pending or connected is unaffected.SuspenseViewHandleinterfaceuseCollectionViewportfunctionfunction useCollectionViewport(options: CollectionViewportOptions): CollectionViewportHandle;Follows a fixed-row-height scroll container and returns the rows to request from .NET. Send
viewport.startandviewport.sizeto the ViewModel from an effect; the hook only measures.useCommandfunctionfunction useCommand<TArgs extends readonly unknown[], TReturn>(command: (...args: TArgs) => TReturn): CommandHandle<TArgs, Awaited<TReturn>>;Tracks a command's pending state and failure for rendering.
runalways calls the latestcommand, so it may close over the current client:const increment = useCommand(() => client?.increment()); <button disabled={!client || increment.pending} onClick={() => increment.run()}>…</button>useSuspenseViewfunctionfunction useSuspenseView<TClient extends ViewClient>(source: ViewConnector<TClient> | TClient): SuspenseViewHandle<TClient>;Suspends the component until a generated View reference connects, then renders its state. A failed connection is thrown to the nearest error boundary; call
retrySuspenseView(reference)when resetting the boundary to connect again. An unretried failure is forgotten after ten seconds. Components that pass a reference with the sameconnectfunction share one client, which is disposed after the last of them unmounts. Pass a stable function such as a generated page reference or{ connect: connectWorkspace }: a function recreated on every render never resolves. An already connected client is observed and left to its owner.useViewfunctionfunction useView<TClient extends ViewClient>(source: ViewSource<TClient>): ViewHandle<TClient>;Connects a generated View reference for the lifetime of the component and renders its state through
useSyncExternalStore. A changed reference disposes the previous client; StrictMode's extra mount disposes its connection when it resolves. A reference is identified by itsconnectfunction, so an inline{ connect: connectWorkspace }does not reconnect. In development aconnectfunction recreated on every render logs a warning.ViewClientre-exportexport { ViewClient } from '@runic-artifex/views'Re-exported from
ViewClient.ViewConnectorre-exportexport { ViewConnector } from '@runic-artifex/views'Re-exported from
ViewConnector.ViewHandleinterfaceViewOutletfunctionfunction ViewOutlet<R extends ViewReference>({ content, registry, fallback }: ViewOutletProps<R>): ReactNode;Renders the registered component for a generated View reference and passes the reference as its
pageprop. A different reference remounts the component. A kind without a component renders an alert.ViewOutletPropsinterfaceViewReferencere-exportexport { ViewReference } from '@runic-artifex/views'Re-exported from
ViewReference.ViewRegistrytype aliastype ViewRegistry<R extends ViewReference> = { readonly [K in R["kind"]]: ComponentType<{ readonly page: Extract<R, { readonly kind: K; }>; }>; };A build-known map checks each generated reference kind against its component's
pageprop.ViewSourcere-exportexport { ViewSource } from '@runic-artifex/views'Re-exported from
ViewSource.