export type SlottedValue = string | number | bigint | Node | null | undefined;
/**
* Sets the default document to use when no one is specified.
* If this hasn't been set, an attempt is made to read the global `document` object.
* @param document the default document object to use for node creation
*/
export declare function setDefDoc(document: Document): void;
/**
* Sets the default namespace URI to use when the lookup gives `null`.
* In firefox the normal lookup gives `null` for the default namespace.
* @param document the default document object to use for node creation
*/
export declare function setDefNS(namespaceURI: string): void;
export type EmmetCallback
= (i: number, c: number, n: number, p: P) => SlottedValue;
/**
* A slot in the generated emmet structure.
* Although this is an element, use only the methods and properties that manipulate its children.
*/
export interface IEmmetSlot extends Element {
tagName: "emmet-slot";
localName: "emmet-slot";
}
/**
* The numbered slots available.
*
* ```js
* let slots = slotted`a>(b>${
* (paramId, idx, max) => paramId + "<" + idx + "/" + max + ">"
* }*2^c>${
* (paramId, idx, max) => paramId + "<" + idx + "/" + max + ">"
* })*3^d>${4 * 1}`.slots;
*
* assert(slots.length == 3);
* assert(slots[3] == undefined);
*
* assert(Array.isArray(slots[0]) && slots[0].length == 6);
* assert(slots[0][0].parentNode.tagName == "b");
* assert(slots[0][0].textContent == "0<0/6>");
* assert(slots[0][5].textContent == "0<5/6>");
*
* assert(Array.isArray(slots[1]) && slots[1].length == 3);
* assert(slots[1][0].parentNode.tagName == "c");
* assert(slots[1][0].textContent == "1<0/3>");
* assert(slots[1][2].textContent == "1<2/3>");
*
* assert(!Array.isArray(slots[2]));
* assert(slots[2].parentNode.tagName == "d");
* assert(slots[2].textContent == "4");
* ```
*/
export interface IEmmetSlots {
length: number;
[index: number]: undefined | IEmmetSlot | IEmmetSlot[];
}
/**
* Config
*/
export interface IEmmetConfig {
doc: D;
cache: Map;
}
export interface ISlottedEmmet {
doc: D;
root: T;
slots: IEmmetSlots;
}
/**
* Parses the emmet string or template string array and returns the root element and the slots created.
* The actual type in the returned `root` depends on the `strings` parameter and the default document.
*
* @template T the type of the root element, defaults to `Element | DocumentFragment`
* @template D the type of the document, defaults to `Document`
* @param {readonly string[] | string} strings the emmet string or template string array
* @param {Readonly>> | undefined} options optional config object
* @returns {ISlottedEmmet} the root element and the slots created if the `strings` parameter was a string array
*/
export declare function emmetSlots/ NOSONAR
T extends Element | DocumentFragment = Element | DocumentFragment, D extends Document = Document>(strings: readonly string[] | string, options?: Readonly>>): ISlottedEmmet;
/**
* Parses the emmet string or template string array and returns the root element and the slots created.
* The actual type in the returned `root` depends on the `strings` parameter and the default document.
*
* @template T the type of the root element, defaults to `Element | DocumentFragment`
* @param {TemplateStringsArray | string[] | string} strings segments of the emmet string
* @param {Array} values values to initially fill the slots with
* @returns {ISlottedEmmet} the root element and the slots created.
*/
export declare function slotted/ NOSONAR
T extends Element | DocumentFragment = Element | DocumentFragment>(strings: TemplateStringsArray | string[] | string, ...values: (SlottedValue | EmmetCallback | Promise)[]): ISlottedEmmet;
/**
* Parses the emmet string or template string array and returns the root element.
* The actual type in the returned value depends on the `strings` parameter and the default document.
*
* @template T the type of the root element, defaults to `Element | DocumentFragment`
* @param {TemplateStringsArray | string[] | string} strings segments of the emmet string
* @param {(string | number | bigint | Node | null | EmmetCallback | undefined)[]} values values to replace the slots with
* @returns {T} the root element
*/
export declare function emmet/ NOSONAR
T extends Element | DocumentFragment = Element | DocumentFragment>(strings: TemplateStringsArray | string[] | string, ...values: (SlottedValue | EmmetCallback)[]): T;