import { WebflowContext, ComponentClientRendererFactory, ComponentRuntimeProps, ComponentDecorator, ComponentData, ComponentDefinition } from '@webflow/data-types'; export { PrerenderDataValue } from '@webflow/data-types'; import { EmptyParams, FunctionResult, FunctionRef, FunctionCaller } from '@webflow/functions'; import React$1 from 'react'; import ReactDOM from 'react-dom/client'; export { useHydrateData, usePrerenderData, useSuspenseData } from './shared.js'; export { P as PrerenderDataKey, a as PrerenderDataMode, b as PrerenderDataProvider, c as PrerenderDataProviderProps } from './PrerenderDataProvider-CCyg3Z4U.js'; /** * Hook to access the Webflow context data. * Example context value: { * mode: "design", * interactive: true, * locale: "en-US" * } * * @returns WebflowContext */ declare function useWebflowContext(): WebflowContext; /** * Returns a typed caller for a Code Function. Params are checked as JSON * on write, and the promise resolves to `JsonSerializable` after the * wire round-trip. * * `fn` is the imported module (`declareFunction(...)`) at compile time; the * bundler replaces it with a stub carrying the id it assigned, and the call is * addressed with that id. Calling an unbundled module rejects. * * Reads `functions` configs from Webflow context (must already include the * `/function/` prefix). Does not throw when the URL is missing — the returned * function rejects on call instead. * * **Waiting.** When the host reports `functions.readiness: "pending"` and has no * base URL yet (the Designer while its Functions preview connects), a call * stays pending until credentials arrive rather than failing. Only components * that actually invoke a function wait; the rest render immediately. A host that * knows its config up front (published site, Webflow Cloud) never sets * `readiness`, so nothing waits there. * * The caller identity is stable across renders when `fn` and `functions` are * unchanged, so it is safe to list in `useEffect` / `useMemo` dependency arrays. */ declare function useFunction(fn: FunctionRef): FunctionCaller; /** * A factory that creates a client-side renderer for a given React component * * @param Component - The React component to render. * @returns An object with create and render functions. */ declare const ClientRenderer: ComponentClientRendererFactory>, ReactDOM.Root, React$1.ReactNode>; /** * Applies an array of decorators to a component in reverse order. * * Decorators are applied using `reduceRight` so that the first decorator * in the array becomes the outermost wrapper, matching the intuitive * reading order and Storybook's decorator behavior. * * @param component - The component to decorate * @param decorators - Array of decorator functions to apply * @returns The decorated component * * @example * ```typescript * const decorators = [decorator1, decorator2, decorator3]; * const decorated = applyDecorators(MyComponent, decorators); * // Result: decorator1(decorator2(decorator3(MyComponent))) * ``` */ declare function applyDecorators(component: ComponentType, decorators: ComponentDecorator[]): ComponentType; /** * Creates a Webflow code component definition for the provided React component. Expected as the default export from a *.webflow.tsx file. * * @example * ```tsx * import { declareComponent } from "@webflow/react"; * import { props } from "@webflow/data-types"; * import Button from "./Button"; * * export default declareComponent(Button, { * name: "Button", * description: "Optional description", * group: "Optional group", * props: { * text: props.Text({ name: "Text", defaultValue: "Lorem ipsum" }), * link: props.Link({ name: "Link" }), * }, * options: { * applyTagSelectors: true * } * ``` * * @example With decorators * ```tsx * import { declareComponent } from "@webflow/react"; * import { emotionShadowDomDecorator } from "@webflow/emotion-utils"; * * export default declareComponent(MyComponent, { * name: "My Component", * decorators: [emotionShadowDomDecorator], * }); * ``` * * @param Component The React component to render * @param data An object with metadata about the code component * @param data.name The display name of the code component * @param data.description An optional description of the code component * @param data.group An optional group for the code component * @param data.props An optional object with the code component props configurations * @param data.options An optional object with additional code component options * @param data.options.applyTagSelectors An optional flag to provide styles targeting tag selectors to the code component (default: false) * @param data.options.ssr An optional flag to enable server-side rendering for the code component (default: true) * @param data.decorators An optional array of decorator functions to wrap the component * @returns A Webflow code component definition */ declare const declareComponent:

( /** The React component to render */ Component: React.ComponentType

, /** An object with metadata about the code component */ data: ComponentData>) => ComponentDefinition, React.ReactNode, P>; export { ClientRenderer, applyDecorators, declareComponent, useFunction, useWebflowContext };