Skip to content

Commit

Permalink
Update unified, types, plugins, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Oct 12, 2023
1 parent 0206318 commit cbc2822
Show file tree
Hide file tree
Showing 22 changed files with 16,102 additions and 5,940 deletions.
2 changes: 1 addition & 1 deletion docs/_asset/editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ function Playground() {
name="development"
checked={development}
onChange={function () {
setJsx(true)
setDevelopment(true)
}}
/>{' '}
generate for development (<code>development: true</code>)
Expand Down
19 changes: 9 additions & 10 deletions docs/_asset/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,23 @@ for (const copy of copies) {
}

/**
* @param {Event} event
* @this {HTMLButtonElement}
*/
function onclick(event) {
const node = event.target
function onclick() {
assert(copyIcon)
assert(copiedIcon)
assert(node instanceof HTMLButtonElement)
assert(this instanceof HTMLButtonElement)

const value = node.dataset.value
const value = this.dataset.value
assert(value !== undefined)

node.classList.add('success')
node.replaceChildren(copiedIcon.cloneNode(true))
this.classList.add('success')
this.replaceChildren(copiedIcon.cloneNode(true))

copyToClipboard(value)

setTimeout(function () {
node.classList.remove('success')
node.replaceChildren(copyIcon.cloneNode(true))
setTimeout(() => {
this.classList.remove('success')
this.replaceChildren(copyIcon.cloneNode(true))
}, 2000)
}
10 changes: 7 additions & 3 deletions docs/_component/blog.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import React, {createElement} from 'react'
import React from 'react'
// @ts-expect-error: untyped.
import {Fragment, jsx, jsxs} from 'react/jsx-runtime'
import {apStyleTitleCase} from 'ap-style-title-case'
import {toH} from 'hast-to-hyperscript'
import {toJsxRuntime} from 'hast-util-to-jsx-runtime'
import {sortItems} from './sort.js'

const runtime = {Fragment, jsx, jsxs}

const dateTimeFormat = new Intl.DateTimeFormat('en', {dateStyle: 'long'})

export function BlogEntry(props) {
Expand Down Expand Up @@ -36,7 +40,7 @@ export function BlogEntry(props) {
</h3>
<div>
{meta.descriptionHast ? (
toH(createElement, meta.descriptionHast)
toJsxRuntime(meta.descriptionHast, runtime)
) : description ? (
<p>{description}</p>
) : null}
Expand Down
23 changes: 15 additions & 8 deletions docs/_component/nav.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import React, {createElement} from 'react'
import React from 'react'
// @ts-expect-error: untyped.
import {Fragment, jsx, jsxs} from 'react/jsx-runtime'
import {apStyleTitleCase} from 'ap-style-title-case'
import {toH} from 'hast-to-hyperscript'
import {toJsxRuntime} from 'hast-util-to-jsx-runtime'
import {sortItems} from './sort.js'

const runtime = {Fragment, jsx, jsxs}

const dateTimeFormat = new Intl.DateTimeFormat('en', {dateStyle: 'long'})

export function NavGroup(props) {
Expand Down Expand Up @@ -30,12 +34,15 @@ export function NavItem(props) {

if (includeDescription) {
if (meta.descriptionHast) {
description = toH(createElement, {
type: 'element',
tagName: 'div',
properties: {className: ['nav-description']},
children: meta.descriptionHast.children
})
description = toJsxRuntime(
{
type: 'element',
tagName: 'div',
properties: {className: ['nav-description']},
children: meta.descriptionHast.children
},
runtime
)
} else {
description = matter.description || meta.description || null

Expand Down
Loading

1 comment on commit cbc2822

@vercel
Copy link

@vercel vercel bot commented on cbc2822 Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

mdx – ./

mdx-mdx.vercel.app
mdxjs.com
v2.mdxjs.com
mdx-git-main-mdx.vercel.app

Please sign in to comment.