Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions docs/_asset/editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
/* @jsxImportSource react */

/**
* @typedef {import('@wooorm/starry-night').Grammar} Grammar
* @typedef {import('estree').Node} EstreeNode
* @typedef {import('estree').Program} Program
* @typedef {import('hast').Nodes} HastNodes
* @typedef {import('hast').Root} HastRoot
* @typedef {import('mdast').Nodes} MdastNodes
* @typedef {import('mdast').Root} MdastRoot
* @typedef {import('mdast-util-mdx-jsx').MdxJsxAttribute} MdxJsxAttribute
* @typedef {import('mdast-util-mdx-jsx').MdxJsxAttributeValueExpression} MdxJsxAttributeValueExpression
* @typedef {import('mdast-util-mdx-jsx').MdxJsxExpressionAttribute} MdxJsxExpressionAttribute
* @typedef {import('mdx/types.js').MDXModule} MDXModule
* @typedef {import('react-error-boundary').FallbackProps} FallbackProperties
* @typedef {import('unified').PluggableList} PluggableList
* @typedef {import('unist').Node} UnistNode
* @import {Grammar} from '@wooorm/starry-night'
* @import {Node as EstreeNode, Program} from 'estree'
* @import {Nodes as HastNodes, Root as HastRoot} from 'hast'
* @import {Nodes as MdastNodes, Root as MdastRoot} from 'mdast'
* @import {
MdxJsxAttribute,
MdxJsxAttributeValueExpression,
MdxJsxExpressionAttribute
Copy link
Member Author

Choose a reason for hiding this comment

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

Using asterisks for multiline imports caused problems, but not in the TypeScript playground. I’m looking into this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I’d work around it by not wrapping 🤷‍♂️

Copy link
Member Author

Choose a reason for hiding this comment

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

I considered that. It would be ok’ish for this line, but some others would become extremely long. I prefer to keep it like this TBH, keeping the max length at approximately what we use for Prettier.

* } from 'mdast-util-mdx-jsx'
* @import {MDXModule} from 'mdx/types.js'
* @import {ReactNode} from 'react'
* @import {FallbackProps} from 'react-error-boundary'
* @import {PluggableList} from 'unified'
* @import {Node as UnistNode} from 'unist'
*/

/**
Expand All @@ -35,7 +35,7 @@
* OK.
* @property {true} ok
* Whether OK.
* @property {JSX.Element} value
* @property {ReactNode} value
* Result.
*
* @typedef {EvalNok | EvalOk} EvalResult
Expand Down Expand Up @@ -315,7 +315,7 @@ function Playground() {
const scope = formatMarkdown ? 'text.md' : 'source.mdx'
// Cast to actual value.
const compiledResult = /** @type {EvalResult | undefined} */ (evalResult)
/** @type {JSX.Element | undefined} */
/** @type {ReactNode | undefined} */
let display

if (compiledResult) {
Expand Down Expand Up @@ -579,9 +579,9 @@ function Playground() {

/**
*
* @param {Readonly<FallbackProperties>} properties
* @param {Readonly<FallbackProps>} properties
* Properties.
* @returns {JSX.Element}
* @returns {ReactNode}
* Element.
*/
function ErrorFallback(properties) {
Expand All @@ -601,7 +601,7 @@ function ErrorFallback(properties) {
/**
* @param {DisplayProperties} properties
* Properties.
* @returns {JSX.Element}
* @returns {ReactNode}
Copy link
Member

Choose a reason for hiding this comment

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

better in separate PRs

Copy link
Member Author

Choose a reason for hiding this comment

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

True. One thing let to another. IMO this is fine to keep as-is now.

* Element.
*/
function DisplayError(properties) {
Expand Down
7 changes: 4 additions & 3 deletions docs/_component/blog.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* @typedef {import('./sort.js').Item} Item
* @import {ReactNode} from 'react'
* @import {Item} from './sort.js'
*/

/**
Expand Down Expand Up @@ -29,7 +30,7 @@ const dateTimeFormat = new Intl.DateTimeFormat('en', {dateStyle: 'long'})
/**
* @param {Readonly<EntryProperties>} properties
* Properties.
* @returns {JSX.Element}
* @returns {ReactNode}
* Element.
*/
export function BlogEntry(properties) {
Expand Down Expand Up @@ -106,7 +107,7 @@ export function BlogEntry(properties) {
/**
* @param {Readonly<GroupProperties>} properties
* Properties.
* @returns {JSX.Element}
* @returns {ReactNode}
* Element.
*/
export function BlogGroup(properties) {
Expand Down
10 changes: 5 additions & 5 deletions docs/_component/home.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* @typedef {import('react').ReactNode} ReactNode
* @typedef {import('vfile').Data['meta']} DataMeta
* @typedef {import('./sort.js').Item} Item
* @import {ReactNode} from 'react'
* @import {Data} from 'vfile'
* @import {Item} from './sort.js'
*/

/**
* @typedef {Exclude<DataMeta, undefined>} Meta
* @typedef {Exclude<Data['meta'], undefined>} Meta
*
* @typedef Properties
* Properties.
Expand All @@ -26,7 +26,7 @@ import {NavigationSite, NavigationSiteSkip} from './nav-site.jsx'
/**
* @param {Readonly<Properties>} properties
* Properties.
* @returns {JSX.Element}
* @returns {ReactNode}
* Element.
*/
export function Home(properties) {
Expand Down
11 changes: 6 additions & 5 deletions docs/_component/layout.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* @typedef {import('vfile').Data['meta']} DataMeta
* @typedef {import('./sort.js').Item} Item
* @import {ReactNode} from 'react'
* @import {Data} from 'vfile'
* @import {Item} from './sort.js'
*/

/**
Expand All @@ -10,11 +11,11 @@
* Name.
* @property {Readonly<URL>} ghUrl
* GitHub URL.
* @property {Readonly<DataMeta> | undefined} [meta]
* @property {Readonly<Data['meta']> | undefined} [meta]
* Meta.
* @property {Readonly<Item>} navigationTree
* Navigation tree.
* @property {JSX.Element} children
* @property {ReactNode} children
* Children.
*/

Expand All @@ -28,7 +29,7 @@ const dateTimeFormat = new Intl.DateTimeFormat('en', {dateStyle: 'long'})
/**
* @param {Readonly<Properties>} properties
* Properties.
* @returns {JSX.Element}
* @returns {ReactNode}
* Element.
*/
export function Layout(properties) {
Expand Down
5 changes: 3 additions & 2 deletions docs/_component/nav-site.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* @typedef {import('./sort.js').Item} Item
* @import {ReactNode} from 'react'
* @import {Item} from './sort.js'
*/

/**
Expand Down Expand Up @@ -34,7 +35,7 @@ export function NavigationSiteSkip() {
/**
* @param {Readonly<Properties>} properties
* Properties.
* @returns {JSX.Element}
* @returns {ReactNode}
* Element.
*/
export function NavigationSite(properties) {
Expand Down
10 changes: 5 additions & 5 deletions docs/_component/nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/// <reference types="rehype-infer-description-meta" />

/**
* @typedef {import('hast').ElementContent} ElementContent
* @typedef {import('react').ReactNode} ReactNode
* @typedef {import('./sort.js').Item} Item
* @import {ElementContent} from 'hast'
* @import {ReactNode} from 'react'
* @import {Item} from './sort.js'
*/

/**
Expand Down Expand Up @@ -46,7 +46,7 @@ const dateTimeFormat = new Intl.DateTimeFormat('en', {dateStyle: 'long'})
/**
* @param {Readonly<GroupProperties>} properties
* Properties.
* @returns {JSX.Element}
* @returns {ReactNode}
* Element.
*/
export function NavigationGroup(properties) {
Expand All @@ -69,7 +69,7 @@ export function NavigationGroup(properties) {
/**
* @param {Readonly<ItemProperties>} properties
* Properties.
* @returns {JSX.Element}
* @returns {ReactNode}
* Element.
*/
export function NavigationItem(properties) {
Expand Down
4 changes: 2 additions & 2 deletions docs/_component/note.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import('react').ReactNode} ReactNode
* @import {ReactNode} from 'react'
*/

/**
Expand All @@ -22,7 +22,7 @@ const known = new Set(['info', 'legacy', 'important'])
/**
* @param {Readonly<Properties>} properties
* Properties.
* @returns {JSX.Element}
* @returns {ReactNode}
* Element.
*/
export function Note(properties) {
Expand Down
6 changes: 5 additions & 1 deletion docs/_component/snowfall.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @import {ReactNode} from 'react'
*/

/**
* @typedef Properties
* Properties.
Expand All @@ -14,7 +18,7 @@ const data = [6, 5, 2, 4.5, 1.5, 2.5, 2, 2.5, 1.5, 2.5, 3.5, 7]
/**
* @param {Readonly<Properties>} properties
* Properties.
* @returns {JSX.Element}
* @returns {ReactNode}
* Element.
*/
export function Chart(properties) {
Expand Down
2 changes: 1 addition & 1 deletion docs/_component/sort.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import('vfile').Data} Data
* @import {Data} from 'vfile'
*/

/**
Expand Down
16 changes: 11 additions & 5 deletions docs/blog/index.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
/**
* @import {Item} from '../_component/sort.js
*/

/**
* @typedef Props
* @property {Item} navigationTree
*/
}
Copy link
Member

Choose a reason for hiding this comment

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

<3


import assert from 'node:assert/strict'
import {BlogGroup} from '../_component/blog.jsx'

Expand All @@ -16,11 +27,6 @@ The latest news about MDX.

{
(function () {
/**
* @typedef {import('../_component/sort.js').Item} Item
*/

/** @type {Item} */
const navigationTree = props.navigationTree
const category = navigationTree.children.find(function (item) {
return item.name === '/blog/'
Expand Down
16 changes: 11 additions & 5 deletions docs/community/index.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
/**
* @import {Item} from '../_component/sort.js
*/

/**
* @typedef Props
* @property {Item} navigationTree
*/
}
Copy link
Member

Choose a reason for hiding this comment

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

Like this it’s also more similar to frontmatter 🤔


import assert from 'node:assert/strict'
import {NavigationGroup} from '../_component/nav.jsx'

Expand All @@ -15,11 +26,6 @@ and some background information.

{
(function () {
/**
* @typedef {import('../_component/sort.js').Item} Item
*/

/** @type {Item} */
const navigationTree = props.navigationTree
const category = navigationTree.children.find(function (item) {
return item.name === '/community/'
Expand Down
16 changes: 11 additions & 5 deletions docs/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
/**
* @import {Item} from '../_component/sort.js
*/

/**
* @typedef Props
* @property {Item} navigationTree
*/
}

import assert from 'node:assert/strict'
import {NavigationGroup} from '../_component/nav.jsx'

Expand All @@ -17,11 +28,6 @@ Reading through these should give you a good understanding of MDX.

{
(function () {
/**
* @typedef {import('../_component/sort.js').Item} Item
*/

/** @type {Item} */
const navigationTree = props.navigationTree
const category = navigationTree.children.find(function (item) {
return item.name === '/docs/'
Expand Down
16 changes: 11 additions & 5 deletions docs/guides/index.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
/**
* @import {Item} from '../_component/sort.js
*/

/**
* @typedef Props
* @property {Item} navigationTree
*/
}

import assert from 'node:assert/strict'
import {NavigationGroup} from '../_component/nav.jsx'

Expand All @@ -15,11 +26,6 @@ around MDX.

{
(function () {
/**
* @typedef {import('../_component/sort.js').Item} Item
*/

/** @type {Item} */
const navigationTree = props.navigationTree
const category = navigationTree.children.find(function (item) {
return item.name === '/guides/'
Expand Down
16 changes: 11 additions & 5 deletions docs/packages/index.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
/**
* @import {Item} from '../_component/sort.js
*/

/**
* @typedef Props
* @property {Item} navigationTree
*/
}

import assert from 'node:assert/strict'
import {NavigationGroup} from '../_component/nav.jsx'

Expand All @@ -17,11 +28,6 @@ bundlers and frontend frameworks.

{
(function () {
/**
* @typedef {import('../_component/sort.js').Item} Item
*/

/** @type {Item} */
const navigationTree = props.navigationTree
const category = navigationTree.children.find(function (item) {
return item.name === '/packages/'
Expand Down
Loading