-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
313 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.DS_Store | ||
*.d.ts | ||
*.log | ||
coverage/ | ||
node_modules/ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,45 @@ | ||
// TypeScript Version: 3.5 | ||
|
||
import {Element, Properties, Node} from 'hast' | ||
|
||
/** | ||
* DSL to create virtual hast trees for HTML or SVG | ||
* | ||
* @param selector Simple CSS selector | ||
* @param children (Lists of) child nodes | ||
*/ | ||
declare function hastscript( | ||
selector?: string, | ||
children?: string | Node | Array<string | Node> | ||
): Element | ||
|
||
/** | ||
* DSL to create virtual hast trees for HTML or SVG | ||
* | ||
* @param selector Simple CSS selector | ||
* @param properties Map of properties | ||
* @param children (Lists of) child nodes | ||
*/ | ||
declare function hastscript( | ||
selector?: string, | ||
properties?: Properties, | ||
children?: string | Node | Array<string | Node> | ||
): Element | ||
|
||
export = hastscript | ||
export function h(): HastRoot | ||
export function h(selector: null | undefined, ...children: HChild[]): HastRoot | ||
export function h( | ||
selector: string, | ||
properties: HProperties, | ||
...children: HChild[] | ||
): HastElement | ||
export function h(selector: string, ...children: HChild[]): HastElement | ||
export function s(): HastRoot | ||
export function s(selector: null | undefined, ...children: HChild[]): HastRoot | ||
export function s( | ||
selector: string, | ||
properties: HProperties, | ||
...children: HChild[] | ||
): HastElement | ||
export function s(selector: string, ...children: HChild[]): HastElement | ||
export type HastRoot = import('hast').Root | ||
export type HastElement = import('hast').Element | ||
export type Properties = import('hast').Properties | ||
export type HastChild = HastRoot['children'][number] | ||
export type Info = import('property-information/lib/util/schema').Schema['property'][string] | ||
export type Schema = | ||
| import('property-information/lib/util/schema').Schema | ||
| import('property-information/lib/util/schema').Schema | ||
export type HStyleValue = string | number | ||
export type HStyle = { | ||
[x: string]: HStyleValue | ||
} | ||
export type HPrimitiveValue = string | number | boolean | null | undefined | ||
export type HArrayValue = Array<string | number> | ||
export type HPropertyValue = HPrimitiveValue | (string | number)[] | ||
export type HProperties = { | ||
[property: string]: | ||
| { | ||
[x: string]: HStyleValue | ||
} | ||
| HPropertyValue | ||
} | ||
export type HPrimitiveChild = string | number | null | undefined | ||
export type HNodeChild = HastChild | HastRoot | ||
export type HArrayChild = Array<HPrimitiveChild | HNodeChild> | ||
export type HChild = | ||
| HPrimitiveChild | ||
| HNodeChild | ||
| (HPrimitiveChild | HNodeChild)[] |
Oops, something went wrong.