Skip to content

Commit cbc2822

Browse files
committed
Update unified, types, plugins, etc
1 parent 0206318 commit cbc2822

22 files changed

+16102
-5940
lines changed

docs/_asset/editor.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ function Playground() {
456456
name="development"
457457
checked={development}
458458
onChange={function () {
459-
setJsx(true)
459+
setDevelopment(true)
460460
}}
461461
/>{' '}
462462
generate for development (<code>development: true</code>)

docs/_asset/index.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,23 @@ for (const copy of copies) {
6161
}
6262

6363
/**
64-
* @param {Event} event
64+
* @this {HTMLButtonElement}
6565
*/
66-
function onclick(event) {
67-
const node = event.target
66+
function onclick() {
6867
assert(copyIcon)
6968
assert(copiedIcon)
70-
assert(node instanceof HTMLButtonElement)
69+
assert(this instanceof HTMLButtonElement)
7170

72-
const value = node.dataset.value
71+
const value = this.dataset.value
7372
assert(value !== undefined)
7473

75-
node.classList.add('success')
76-
node.replaceChildren(copiedIcon.cloneNode(true))
74+
this.classList.add('success')
75+
this.replaceChildren(copiedIcon.cloneNode(true))
7776

7877
copyToClipboard(value)
7978

80-
setTimeout(function () {
81-
node.classList.remove('success')
82-
node.replaceChildren(copyIcon.cloneNode(true))
79+
setTimeout(() => {
80+
this.classList.remove('success')
81+
this.replaceChildren(copyIcon.cloneNode(true))
8382
}, 2000)
8483
}

docs/_component/blog.jsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
import React, {createElement} from 'react'
1+
import React from 'react'
2+
// @ts-expect-error: untyped.
3+
import {Fragment, jsx, jsxs} from 'react/jsx-runtime'
24
import {apStyleTitleCase} from 'ap-style-title-case'
3-
import {toH} from 'hast-to-hyperscript'
5+
import {toJsxRuntime} from 'hast-util-to-jsx-runtime'
46
import {sortItems} from './sort.js'
57

8+
const runtime = {Fragment, jsx, jsxs}
9+
610
const dateTimeFormat = new Intl.DateTimeFormat('en', {dateStyle: 'long'})
711

812
export function BlogEntry(props) {
@@ -36,7 +40,7 @@ export function BlogEntry(props) {
3640
</h3>
3741
<div>
3842
{meta.descriptionHast ? (
39-
toH(createElement, meta.descriptionHast)
43+
toJsxRuntime(meta.descriptionHast, runtime)
4044
) : description ? (
4145
<p>{description}</p>
4246
) : null}

docs/_component/nav.jsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
import React, {createElement} from 'react'
1+
import React from 'react'
2+
// @ts-expect-error: untyped.
3+
import {Fragment, jsx, jsxs} from 'react/jsx-runtime'
24
import {apStyleTitleCase} from 'ap-style-title-case'
3-
import {toH} from 'hast-to-hyperscript'
5+
import {toJsxRuntime} from 'hast-util-to-jsx-runtime'
46
import {sortItems} from './sort.js'
57

8+
const runtime = {Fragment, jsx, jsxs}
9+
610
const dateTimeFormat = new Intl.DateTimeFormat('en', {dateStyle: 'long'})
711

812
export function NavGroup(props) {
@@ -30,12 +34,15 @@ export function NavItem(props) {
3034

3135
if (includeDescription) {
3236
if (meta.descriptionHast) {
33-
description = toH(createElement, {
34-
type: 'element',
35-
tagName: 'div',
36-
properties: {className: ['nav-description']},
37-
children: meta.descriptionHast.children
38-
})
37+
description = toJsxRuntime(
38+
{
39+
type: 'element',
40+
tagName: 'div',
41+
properties: {className: ['nav-description']},
42+
children: meta.descriptionHast.children
43+
},
44+
runtime
45+
)
3946
} else {
4047
description = matter.description || meta.description || null
4148

0 commit comments

Comments
 (0)