UNPKG

@wordpress/components

Version:
33 lines 1.27 kB
/** * Internal dependencies */ import type { SandBoxProps } from './types'; /** * Matches CSS viewport-relative length values such as `100vh`, `50.5vw`, * and `.5dvh`. Used to strip viewport units from user-supplied HTML inside * the sandbox iframe, because those units are relative to the iframe's * own size and would create a measurement feedback loop with the * resize observer. * * Exported for tests. NOTE: an identical regex literal is duplicated * inside `observeAndResizeJS` below because that function is serialized * via `.toString()` and embedded into the iframe's `srcdoc` — it has no * access to this module's scope at runtime. If you change one, change * the other; the "is embedded in the sandbox iframe srcdoc" test * guards against drift. */ export declare const VIEWPORT_UNIT_VALUE_REGEX: RegExp; /** * This component provides an isolated environment for arbitrary HTML via iframes. * * ```jsx * import { SandBox } from '@wordpress/components'; * * const MySandBox = () => ( * <SandBox html="<p>Content</p>" title="SandBox" type="embed" /> * ); * ``` */ declare function SandBox({ allowSameOrigin, ...contentProps }: SandBoxProps): import("react").JSX.Element; export default SandBox; //# sourceMappingURL=index.d.ts.map