UNPKG

1.48 kBTypeScriptView Raw
1import { createAnchor, createCursor, createElement, createFocus, createFragment, createSelection, createText } from './creators';
2/**
3 * `HyperscriptCreators` are dictionaries of `HyperscriptCreator` functions
4 * keyed by tag name.
5 */
6type HyperscriptCreators<T = any> = Record<string, (tagName: string, attributes: {
7 [key: string]: any;
8}, children: any[]) => T>;
9/**
10 * `HyperscriptShorthands` are dictionaries of properties applied to specific
11 * kind of object, keyed by tag name. They allow you to easily define custom
12 * hyperscript tags for your domain.
13 */
14type HyperscriptShorthands = Record<string, Record<string, any>>;
15/**
16 * Create a Slate hyperscript function with `options`.
17 */
18declare const createHyperscript: (options?: {
19 creators?: HyperscriptCreators;
20 elements?: HyperscriptShorthands;
21}) => <S extends "anchor" | "cursor" | "editor" | "element" | "focus" | "fragment" | "selection" | "text">(tagName: S, attributes?: Object, ...children: any[]) => ReturnType<{
22 anchor: typeof createAnchor;
23 cursor: typeof createCursor;
24 editor: (tagName: string, attributes: {
25 [key: string]: any;
26 }, children: any[]) => import("slate").BaseEditor;
27 element: typeof createElement;
28 focus: typeof createFocus;
29 fragment: typeof createFragment;
30 selection: typeof createSelection;
31 text: typeof createText;
32}[S]>;
33export { createHyperscript, HyperscriptCreators, HyperscriptShorthands };
34//# sourceMappingURL=hyperscript.d.ts.map
\No newline at end of file