import type { EventEmitter } from 'belter'; import type { DomainMatcher } from 'cross-domain-utils'; import type { ZalgoPromise } from 'zalgo-promise'; import { ProxyWindow } from 'post-robot'; import type { AnyProps, PropSerialization, PropType } from './types'; export type EventHandler = (data: T) => unknown; export type Sibling = { readonly props: unknown; readonly exports: unknown; }; export type Dimensions = { readonly width?: number; readonly height?: number; }; export type ParentProp = { readonly uid: string; readonly props: AnyProps; readonly export: (exports: unknown) => ZalgoPromise; }; export type OnProps

= (handler: (props: P) => unknown) => { readonly cancel: () => void; }; export type BuiltInInputProps

= { readonly parent?: ParentProp; readonly timeout?: number; readonly window?: Window | ProxyWindow; readonly cspNonce?: string; readonly onDisplay?: EventHandler; readonly onRendered?: EventHandler; readonly onRender?: EventHandler; readonly onPrerendered?: EventHandler; readonly onPrerender?: EventHandler; readonly onClose?: EventHandler; readonly onDestroy?: EventHandler; readonly onResize?: EventHandler; readonly onFocus?: EventHandler; readonly onBfcacheCache?: EventHandler; readonly onBfcacheRestore?: EventHandler<{ readonly cachedDurationMs?: number; }>; readonly onError?: EventHandler; readonly onProps?: (props: PropsType

) => unknown; }; export type PropsInput

= BuiltInInputProps

& Partial

; export type PropsType

= P & { readonly timeout?: number; readonly window?: Window | ProxyWindow; readonly cspNonce?: string; readonly onDisplay: EventHandler; readonly onRendered: EventHandler; readonly onRender: EventHandler; readonly onPrerendered: EventHandler; readonly onPrerender: EventHandler; readonly onClose: EventHandler; readonly onDestroy: EventHandler; readonly onResize: EventHandler; readonly onFocus: EventHandler; readonly onBfcacheCache: EventHandler; readonly onBfcacheRestore: EventHandler<{ readonly cachedDurationMs?: number; }>; readonly onError?: EventHandler; readonly onProps?: (props: PropsType

) => unknown; }; export type ChildHelpers = { readonly uid: string; readonly tag: string; readonly close: () => ZalgoPromise; readonly focus: () => ZalgoPromise; readonly resize: (dimensions: Dimensions) => ZalgoPromise; readonly onError: (err: unknown) => ZalgoPromise; readonly onProps: OnProps>; readonly getParent: () => Window; readonly getParentDomain: () => string; readonly show: () => ZalgoPromise; readonly hide: () => ZalgoPromise; readonly export: (exports: X) => ZalgoPromise; readonly getSiblings: (opts?: { readonly anyParent?: boolean; }) => ReadonlyArray; }; export type ChildProps = P & ChildHelpers & { readonly parent?: ParentProp; readonly timeout?: number; readonly cspNonce?: string; }; export type PropHelpers

= { readonly props: PropsType

; readonly state: Record; readonly close: () => ZalgoPromise; readonly focus: () => ZalgoPromise; readonly onError: (err: unknown) => ZalgoPromise; readonly container: HTMLElement | undefined; readonly event: EventEmitter; }; type ParamOption = boolean | string | ((opts: { readonly value: T; }) => string | ZalgoPromise); type ValueOption = (opts: { readonly value: T; }) => unknown; export type PropDefinition = { readonly type: PropType; readonly alias?: string; readonly value?: (helpers: PropHelpers

) => T | undefined; readonly default?: (helpers: PropHelpers

) => T | undefined; readonly decorate?: (helpers: PropHelpers

& { readonly value: T; }) => T; readonly childDecorate?: (helpers: ChildHelpers & { readonly value: T | undefined; }) => T | undefined; readonly required?: boolean; readonly queryParam?: ParamOption; readonly bodyParam?: ParamOption; readonly queryValue?: ValueOption; readonly bodyValue?: ValueOption; readonly sendToChild?: boolean; readonly allowDelegate?: boolean; readonly validate?: (opts: { readonly value: T; readonly props: PropsInput

; }) => void; readonly sameDomain?: boolean; readonly serialization?: PropSerialization; readonly trustedDomains?: ReadonlyArray; }; export type UserPropsDefinition = { readonly [Key in keyof P & string]?: PropDefinition; }; export type PropsDefinition

= Readonly>>; type BuiltInProp = PropDefinition; export declare const getBuiltInProps: () => PropsDefinition; type PropCallback = (key: string, propDef: BuiltInProp | undefined, value: unknown) => R; export declare const eachProp: (props: AnyProps, propsDef: PropsDefinition, handler: PropCallback) => void; export declare const mapProps: (props: AnyProps, propsDef: PropsDefinition, handler: PropCallback) => ReadonlyArray; export {}; //# sourceMappingURL=props.d.ts.map