|
1 |
| -// TypeScript Version: 3.5 |
2 |
| - |
3 |
| -import {Element, Properties, Node} from 'hast' |
4 |
| - |
5 |
| -/** |
6 |
| - * DSL to create virtual hast trees for HTML or SVG |
7 |
| - * |
8 |
| - * @param selector Simple CSS selector |
9 |
| - * @param children (Lists of) child nodes |
10 |
| - */ |
11 |
| -declare function hastscript( |
12 |
| - selector?: string, |
13 |
| - children?: string | Node | Array<string | Node> |
14 |
| -): Element |
15 |
| - |
16 |
| -/** |
17 |
| - * DSL to create virtual hast trees for HTML or SVG |
18 |
| - * |
19 |
| - * @param selector Simple CSS selector |
20 |
| - * @param properties Map of properties |
21 |
| - * @param children (Lists of) child nodes |
22 |
| - */ |
23 |
| -declare function hastscript( |
24 |
| - selector?: string, |
25 |
| - properties?: Properties, |
26 |
| - children?: string | Node | Array<string | Node> |
27 |
| -): Element |
28 |
| - |
29 |
| -export = hastscript |
| 1 | +export function h(): HastRoot |
| 2 | +export function h(selector: null | undefined, ...children: HChild[]): HastRoot |
| 3 | +export function h( |
| 4 | + selector: string, |
| 5 | + properties: HProperties, |
| 6 | + ...children: HChild[] |
| 7 | +): HastElement |
| 8 | +export function h(selector: string, ...children: HChild[]): HastElement |
| 9 | +export function s(): HastRoot |
| 10 | +export function s(selector: null | undefined, ...children: HChild[]): HastRoot |
| 11 | +export function s( |
| 12 | + selector: string, |
| 13 | + properties: HProperties, |
| 14 | + ...children: HChild[] |
| 15 | +): HastElement |
| 16 | +export function s(selector: string, ...children: HChild[]): HastElement |
| 17 | +export type HastRoot = import('hast').Root |
| 18 | +export type HastElement = import('hast').Element |
| 19 | +export type Properties = import('hast').Properties |
| 20 | +export type HastChild = HastRoot['children'][number] |
| 21 | +export type Info = import('property-information/lib/util/schema').Schema['property'][string] |
| 22 | +export type Schema = |
| 23 | + | import('property-information/lib/util/schema').Schema |
| 24 | + | import('property-information/lib/util/schema').Schema |
| 25 | +export type HStyleValue = string | number |
| 26 | +export type HStyle = { |
| 27 | + [x: string]: HStyleValue |
| 28 | +} |
| 29 | +export type HPrimitiveValue = string | number | boolean | null | undefined |
| 30 | +export type HArrayValue = Array<string | number> |
| 31 | +export type HPropertyValue = HPrimitiveValue | (string | number)[] |
| 32 | +export type HProperties = { |
| 33 | + [property: string]: |
| 34 | + | { |
| 35 | + [x: string]: HStyleValue |
| 36 | + } |
| 37 | + | HPropertyValue |
| 38 | +} |
| 39 | +export type HPrimitiveChild = string | number | null | undefined |
| 40 | +export type HNodeChild = HastChild | HastRoot |
| 41 | +export type HArrayChild = Array<HPrimitiveChild | HNodeChild> |
| 42 | +export type HChild = |
| 43 | + | HPrimitiveChild |
| 44 | + | HNodeChild |
| 45 | + | (HPrimitiveChild | HNodeChild)[] |
0 commit comments