UNPKG

@benev/slate

Version:
16 lines (15 loc) 820 B
import { BaseElement } from "../element.js"; export declare function attributes<A extends Attributes.Spec>(element: BaseElement, spec: A): Attributes.SoftenSpec<A>; export declare namespace Attributes { type HardValue = (typeof String | typeof Number | typeof Boolean); type SoftenValue<H extends HardValue> = (H extends typeof String ? string | undefined : H extends typeof Number ? number | undefined : H extends typeof Boolean ? boolean : never); export type Spec = { [key: string]: HardValue; }; export type SoftenSpec<A extends Spec> = { [P in keyof A]: SoftenValue<A[P]>; }; export const proxy: <A extends Spec>(element: HTMLElement, spec: A) => SoftenSpec<A>; export function on_change(element: HTMLElement, handle_change: () => void): () => void; export {}; }