import type { OrArray } from '@jsmanifest/typefest'; import NDOMPage from '../../Page'; import NUIPage from '../../../Page'; import * as c from '../../../constants'; import * as t from '../../../types'; export type ComponentPageEvent = typeof c.eventId.componentPage.on[keyof typeof c.eventId.componentPage.on]; export interface ComponentPageHooks { [c.eventId.componentPage.on.ON_LOAD]: OnLoad[]; [c.eventId.componentPage.on.ON_ERROR]: OnError[]; [c.eventId.componentPage.on.ON_MESSAGE]: OnMessage[]; } export type OnLoad = (evt: Event, node: HTMLIFrameElement) => void; export type OnError = (error: ErrorEvent) => void; export type OnMessage = (evt: MessageEvent) => void; declare class ComponentPage extends NDOMPage { #private; initialized: boolean; origin: string; constructor(component: t.NuiComponent.Instance, options?: { onLoad?: OnLoad; onError?: OnError; node?: any; }); get created(): number | null; get component(): t.NuiComponent.Instance; get hasComponent(): boolean; get hasNuiPage(): boolean; get window(): Window; get document(): Document; get head(): HTMLHeadElement; get body(): HTMLElement; get error(): Error | null; get parentElement(): HTMLElement | null; get remote(): boolean; appendChild(childNode: N): void; clear(): void; configure(opts: { [c.ARIA_LABELLEDBY]?: string; [c.ARIA_HIDDEN]?: string; [c.ARIA_LABEL]?: string; /** * A string or an array of strings as policies to control content * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy#directives */ allow?: OrArray; allowPaymentRequest?: boolean; allowFullScreen?: boolean; contentSecurityPolicy?: { allowImages?: boolean; allowVideos?: boolean; allowScripts?: boolean | OrArray; allowedHosts?: OrArray; }; className?: string; name?: string; onLoad?: OnLoad; onError?: OnError; httpsOnly?: boolean; width?: string; height?: string; /** * Indicates which referrer to send when fetching the frame's resource * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-referrerpolicy */ referrerPolicy?: HTMLIFrameElement['referrerPolicy']; /** * Applies extra restrictions to the content in the frame. * Defaults to an empty string (applies all restrictions) * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox */ sandbox?: HTMLIFrameElement['sandbox']; style?: HTMLIFrameElement['style']; src?: string; srcDoc?: string; title?: string; }): this; emitSync(evt: Evt, ...args: Parameters): this; emitSync(...args: Parameters): this; getNuiPage(): NUIPage; on(evt: Evt, fn: Parameters[1] | ComponentPageHooks[ComponentPageEvent][number]): this; patch(value: NUIPage | t.NuiComponent.Instance): void; replaceNode(node: NN): void; sendMessage(message: any, origin?: string, transfer?: Transferable[]): void; } export default ComponentPage;