import { default as React } from 'react'; import { Root } from 'react-dom/client'; interface MountOptions { el: HTMLElement; component: React.ComponentType; props?: Record; customTheme?: 'light' | 'dark'; /** 强制将样式注入到主文档而非 iframe(用于 traits 面板等主文档组件) */ forMainDocument?: boolean; /** * 跳过卸载旧 Root (仅用于强制重置 DOM 等特殊场景) * 警告:可能导致 React Root 泄漏,仅在明确知晓 DOM 已被破坏时使用 */ skipUnmount?: boolean; } /** * 初始化全局配置 */ export declare const initReactMount: () => void; /** * 清除指定 Document 的 CSS cache * 在 iframe 销毁时调用此函数,确保新 iframe 能够重新生成样式 */ export declare const clearCssCache: (doc?: Document) => void; /** * 挂载 React 组件到指定 DOM 元素 * 用于在 GrapesJS Canvas 中动态渲染 React 组件 * * 使用 StyleProvider 的 container 属性将 CSS-in-JS 样式注入到 iframe 的 head 中 */ export declare const mountReactComponent: ({ el, component: Component, props, customTheme, forMainDocument, skipUnmount, }: MountOptions) => Promise<{ root: Root; unmount: () => void; update: (newProps: Record) => void; }>; /** * 清理所有已挂载的组件 */ export declare const cleanupAllMounts: () => void; export default mountReactComponent; //# sourceMappingURL=mountReactComponent.d.ts.map