import { WaitForProps } from "./WaitFor/types.js"; import { ComponentClass, FC, FunctionComponent, ReactElement } from "react"; import { Entry, EntryOptions } from "@pastweb/tools"; //#region src/createEntry/types.d.ts /** * React component shape accepted by entry helpers. */ type Component = FC | FunctionComponent | ComponentClass; /** * Options used to create a React entry. * * React entries extend the framework-agnostic `EntryOptions` from * `@pastweb/tools` with React-specific rendering concerns such as providers, * async waits, and fallback content. */ type ReactEntryOptions = EntryOptions & { /** Optional provider component wrapping the entry component. */Providers?: Component; /** React component or element rendered by the entry. */ EntryComponent?: Component | ReactElement; /** Async dependencies that must resolve before rendering the entry content. */ waitFor?: WaitForProps['wait']; /** Content rendered while `waitFor` dependencies are pending or failed. */ fallback?: WaitForProps['fallback']; }; /** * Options passed to {@link ReactEntry.mount}. */ interface MountOptions { /** Hydrates existing server-rendered markup instead of creating a fresh root. */ hydrate?: boolean; /** * Server render mode. `createServerEntry` uses this to choose static markup * (`renderToStaticMarkup`) or hydratable HTML (`renderToString`). */ isStatic?: boolean; } /** * React-specific entry object. * * It keeps the core `Entry` behavior from `@pastweb/tools`, but replaces the * lifecycle methods with React-aware mount, render, and unmount operations. */ type ReactEntry = Omit, 'mount' | 'update' | 'unmount'> & { /** Mounts or server-renders the entry depending on the factory that created it. */mount: (options?: MountOptions) => string | void; /** Convenience hydration hook for compatible entry implementations. */ hydrate: () => void; /** Server-side render helper returning HTML. */ render: (isStatic?: boolean) => string; /** Unmounts the React root created for this entry. */ unmount: () => void; }; //#endregion export { Component, MountOptions, ReactEntry, ReactEntryOptions }; //# sourceMappingURL=types.d.ts.map