/** * Stamp out an element from a string template * * @param {string} html - The string template * @param {boolean} [firstChild] - if `true` use the `firstChild` of created element, used when a single element is required rather than a DocumentFragment * * @returns {DocumentFragment | Element} - The stamped out element */ export function stamp(html: string, firstChild?: boolean | undefined): DocumentFragment | Element; /** * Helper function for emitting DOM events * * @param {Element} target - the element from which the event should be dispatched * @param {string} name - the event name * @param {object} [detail] - the detail object to pass with event * @param {EventInit} [opts] - event options */ export function emit(target: Element, name: string, detail?: object | undefined, opts?: EventInit | undefined): void; /** * Utility to efficiently repeat and update a series of Elements into a * container, taking in an html template from which the element will be stamped * out, and a series of items and targets used to create and/or update * elements * * @param {Object} opts - Repeat options * @param {Element} opts.container - Container into which to render repeated items * @param {any[]} opts.items - Array of items which are used to create/update elements * @param {string} opts.html - HTML template which will be used to create elements * @param {((value: any, index: number) => string)} opts.keyFn - Key function which is used to create unique id for each item/element * @param {import("./types").Target[]} [opts.targets] - How to update an element when an item changes * @param { ((el: Element, item?: any, index?: number) => void) | null} [opts.init] - function to apply when an element is first created * @param { Object.} [opts.events] - list of events to bind to element when created * */ export function repeat({ container, items, html, keyFn, targets, init, events, }: { container: Element; items: any[]; html: string; keyFn: (value: any, index: number) => string; targets?: import("./types").Target[] | undefined; init?: ((el: Element, item?: any, index?: number | undefined) => void) | null | undefined; events?: { [x: string]: { [x: string]: import("./types").TargetEvent | ((this: Element, ev: Event) => any); }; } | undefined; }): Promise; /** * Take a target DOM element and a selector to apply to that element * and run a function on every match * * @param {Element} el - target DOM element * @param {string} selector - CSS3 selector * @param {(el: Element) => void} func - function to run on all matches */ export function apply(el: Element, selector: string, func: (el: Element) => void): Promise; /** * Bind an event listener to a series of CSS selector matches in a DOM node * * @param {Element} el - the element then listener should be attached to (unless overidden by specifying a different target in `def`) * @param {string} selector - the selector whose matches in `el` this event listener should be added * @param {string} name - the name of the event whose listener is being added * @param {((ev: Event) => any) | import("./types").TargetEvent} func - the listener being added, or a `TargetEvent` */ export function bindEvent(el: Element, selector: string, name: string, func: import("./types").TargetEvent | ((ev: Event) => any)): void;