Skip to content

Commit 2f8c133

Browse files
committed
Add improved docs
1 parent e70ba2a commit 2f8c133

File tree

9 files changed

+134
-110
lines changed

9 files changed

+134
-110
lines changed

example.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import {h, s} from './index.js'
2+
3+
// Children as an array:
4+
console.log(
5+
h('.foo#some-id', [
6+
h('span', 'some text'),
7+
h('input', {type: 'text', value: 'foo'}),
8+
h('a.alpha', {class: 'bravo charlie', download: 'download'}, [
9+
'delta',
10+
'echo'
11+
])
12+
])
13+
)
14+
15+
// SVG:
16+
console.log(
17+
s('svg', {xmlns: 'http://www.w3.org/2000/svg', viewbox: '0 0 500 500'}, [
18+
s('title', 'SVG `<circle>` element'),
19+
s('circle', {cx: 120, cy: 120, r: 100})
20+
])
21+
)

html.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* @typedef {import('./lib/index.js').Child} Child Acceptable child value
3-
* @typedef {import('./lib/index.js').Properties} Properties Acceptable properties value.
2+
* @typedef {import('./lib/index.js').Child} Child
3+
* @typedef {import('./lib/index.js').Properties} Properties
44
*/
55

66
export {h} from './lib/html.js'

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* @typedef {import('./lib/index.js').Child} Child Acceptable child value
3-
* @typedef {import('./lib/index.js').Properties} Properties Acceptable properties value.
2+
* @typedef {import('./lib/index.js').Child} Child
3+
* @typedef {import('./lib/index.js').Properties} Properties
44
*/
55

66
export {h, s} from './lib/index.js'

lib/core.js

+2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
* @typedef {Array<string|number>} HArrayValue
1515
* @typedef {HPrimitiveValue|HArrayValue} HPropertyValue
1616
* @typedef {{[property: string]: HPropertyValue|HStyle}} HProperties
17+
* Acceptable properties value.
1718
*
1819
* @typedef {string|number|null|undefined} HPrimitiveChild
1920
* @typedef {Array<Node|HPrimitiveChild>} HArrayChild
2021
* @typedef {Node|HPrimitiveChild|HArrayChild} HChild
22+
* Acceptable child value
2123
*/
2224

2325
import {find, normalize} from 'property-information'

lib/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* @typedef {import('./core.js').HChild} Child Acceptable child value
3-
* @typedef {import('./core.js').HProperties} Properties Acceptable properties value.
2+
* @typedef {import('./core.js').HChild} Child
3+
* @typedef {import('./core.js').HProperties} Properties
44
*/
55

66
export {h} from './html.js'

lib/runtime.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @typedef {import('./core.js').HStyle} HStyle
99
* @typedef {import('./core.js').core} Core
1010
*
11-
* @typedef {{[x: string]: HPropertyValue|HStyle|HChild}} JSXProps
11+
* @typedef {Record<string, HPropertyValue|HStyle|HChild>} JSXProps
1212
*/
1313

1414
/**

lib/svg.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* @typedef {import('./core.js').HChild} Child Acceptable child value
3-
* @typedef {import('./core.js').HProperties} Properties Acceptable properties value.
2+
* @typedef {import('./core.js').HChild} Child
3+
* @typedef {import('./core.js').HProperties} Properties
44
*
55
* @typedef {import('./jsx-classic').Element} s.JSX.Element
66
* @typedef {import('./jsx-classic').IntrinsicAttributes} s.JSX.IntrinsicAttributes

0 commit comments

Comments
 (0)