UNPKG

wxt

Version:

⚡ Next-gen Web Extension Framework

38 lines (37 loc) 1.42 kB
import { ContentScriptContext } from "../content-script-context.mjs"; import { ContentScriptUi, ContentScriptUiOptions } from "./types.mjs"; //#region src/utils/content-script-ui/integrated.d.ts /** * Create a content script UI without any isolation. * * @see https://wxt.dev/guide/essentials/content-scripts.html#integrated */ declare function createIntegratedUi<TMounted>(ctx: ContentScriptContext, options: IntegratedContentScriptUiOptions<TMounted>): IntegratedContentScriptUi<TMounted>; /** * Shared types for the different `wxt/utils/content-script-ui/*` modules. * * @module wxt/utils/content-script-ui/types */ interface IntegratedContentScriptUi<TMounted> extends ContentScriptUi<TMounted> { /** A wrapper div that assists in positioning. */ wrapper: HTMLElement; } type IntegratedContentScriptUiOptions<TMounted> = ContentScriptUiOptions<TMounted> & { /** * Tag used to create the wrapper element. * * @default 'div' */ tag?: string; /** * Callback executed when mounting the UI. This function should create and * append the UI to the `wrapper` element. It is called every time * `ui.mount()` is called. * * Optionally return a value that can be accessed at `ui.mounted` or in the * `onRemove` callback. */ onMount: (wrapper: HTMLElement) => TMounted; }; //#endregion export { IntegratedContentScriptUi, IntegratedContentScriptUiOptions, createIntegratedUi };