@depup/nextra 4.6.1-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +56 -0
- package/changes.json +110 -0
- package/dist/client/components/banner/close-banner-button.d.ts +8 -0
- package/dist/client/components/banner/close-banner-button.js +45 -0
- package/dist/client/components/banner/index.client.d.ts +5 -0
- package/dist/client/components/banner/index.client.js +46 -0
- package/dist/client/components/banner/index.d.ts +51 -0
- package/dist/client/components/banner/index.js +93 -0
- package/dist/client/components/bleed.d.ts +63 -0
- package/dist/client/components/bleed.js +54 -0
- package/dist/client/components/button.d.ts +9 -0
- package/dist/client/components/button.js +55 -0
- package/dist/client/components/callout.d.ts +136 -0
- package/dist/client/components/callout.js +99 -0
- package/dist/client/components/cards.d.ts +104 -0
- package/dist/client/components/cards.js +132 -0
- package/dist/client/components/collapse.d.ts +12 -0
- package/dist/client/components/collapse.js +143 -0
- package/dist/client/components/file-tree/file.d.ts +9 -0
- package/dist/client/components/file-tree/file.js +43 -0
- package/dist/client/components/file-tree/folder.d.ts +12 -0
- package/dist/client/components/file-tree/folder.js +94 -0
- package/dist/client/components/file-tree/index.d.ts +57 -0
- package/dist/client/components/file-tree/index.js +12 -0
- package/dist/client/components/file-tree/tree.d.ts +5 -0
- package/dist/client/components/file-tree/tree.js +41 -0
- package/dist/client/components/head.d.ts +139 -0
- package/dist/client/components/head.js +202 -0
- package/dist/client/components/image-zoom.d.ts +6 -0
- package/dist/client/components/image-zoom.js +79 -0
- package/dist/client/components/index.d.ts +56 -0
- package/dist/client/components/index.js +42 -0
- package/dist/client/components/playground.d.ts +90 -0
- package/dist/client/components/playground.js +103 -0
- package/dist/client/components/popup/index.client.d.ts +7 -0
- package/dist/client/components/popup/index.client.js +83 -0
- package/dist/client/components/popup/index.d.ts +12 -0
- package/dist/client/components/popup/index.js +11 -0
- package/dist/client/components/search.d.ts +88 -0
- package/dist/client/components/search.js +426 -0
- package/dist/client/components/select.d.ts +19 -0
- package/dist/client/components/select.js +109 -0
- package/dist/client/components/skip-nav/index.client.d.ts +5 -0
- package/dist/client/components/skip-nav/index.client.js +45 -0
- package/dist/client/components/skip-nav/index.d.ts +6 -0
- package/dist/client/components/skip-nav/index.js +24 -0
- package/dist/client/components/steps.d.ts +64 -0
- package/dist/client/components/steps.js +74 -0
- package/dist/client/components/tabs/index.client.d.ts +21 -0
- package/dist/client/components/tabs/index.client.js +243 -0
- package/dist/client/components/tabs/index.d.ts +53 -0
- package/dist/client/components/tabs/index.js +9 -0
- package/dist/client/evaluate.d.ts +30 -0
- package/dist/client/evaluate.js +17 -0
- package/dist/client/hocs/index.d.ts +4 -0
- package/dist/client/hocs/index.js +6 -0
- package/dist/client/hocs/with-github-alert.d.ts +11 -0
- package/dist/client/hocs/with-github-alert.js +30 -0
- package/dist/client/hocs/with-icons.d.ts +6 -0
- package/dist/client/hocs/with-icons.js +76 -0
- package/dist/client/hooks/index.d.ts +4 -0
- package/dist/client/hooks/index.js +10 -0
- package/dist/client/hooks/use-copy.d.ts +9 -0
- package/dist/client/hooks/use-copy.js +77 -0
- package/dist/client/hooks/use-fs-route.d.ts +3 -0
- package/dist/client/hooks/use-fs-route.js +20 -0
- package/dist/client/hooks/use-hash.d.ts +3 -0
- package/dist/client/hooks/use-hash.js +20 -0
- package/dist/client/hooks/use-mounted.d.ts +3 -0
- package/dist/client/hooks/use-mounted.js +13 -0
- package/dist/client/icons/arrow-right.d.ts +5 -0
- package/dist/client/icons/arrow-right.js +24 -0
- package/dist/client/icons/chatgpt.d.ts +2 -0
- package/dist/client/icons/chatgpt.js +24 -0
- package/dist/client/icons/check.d.ts +2 -0
- package/dist/client/icons/check.js +24 -0
- package/dist/client/icons/claude.d.ts +2 -0
- package/dist/client/icons/claude.js +81 -0
- package/dist/client/icons/copy.d.ts +2 -0
- package/dist/client/icons/copy.js +31 -0
- package/dist/client/icons/cpp.d.ts +2 -0
- package/dist/client/icons/cpp.js +24 -0
- package/dist/client/icons/cross-circled.d.ts +2 -0
- package/dist/client/icons/cross-circled.js +24 -0
- package/dist/client/icons/csharp.d.ts +2 -0
- package/dist/client/icons/csharp.js +24 -0
- package/dist/client/icons/css.d.ts +2 -0
- package/dist/client/icons/css.js +24 -0
- package/dist/client/icons/discord.d.ts +2 -0
- package/dist/client/icons/discord.js +24 -0
- package/dist/client/icons/expand.d.ts +2 -0
- package/dist/client/icons/expand.js +31 -0
- package/dist/client/icons/file.d.ts +2 -0
- package/dist/client/icons/file.js +24 -0
- package/dist/client/icons/folder-open.d.ts +2 -0
- package/dist/client/icons/folder-open.js +24 -0
- package/dist/client/icons/folder.d.ts +2 -0
- package/dist/client/icons/folder.js +24 -0
- package/dist/client/icons/github-caution.d.ts +2 -0
- package/dist/client/icons/github-caution.js +24 -0
- package/dist/client/icons/github-important.d.ts +2 -0
- package/dist/client/icons/github-important.js +24 -0
- package/dist/client/icons/github-note.d.ts +2 -0
- package/dist/client/icons/github-note.js +24 -0
- package/dist/client/icons/github-tip.d.ts +2 -0
- package/dist/client/icons/github-tip.js +24 -0
- package/dist/client/icons/github-warning.d.ts +2 -0
- package/dist/client/icons/github-warning.js +24 -0
- package/dist/client/icons/github.d.ts +2 -0
- package/dist/client/icons/github.js +24 -0
- package/dist/client/icons/globe.d.ts +2 -0
- package/dist/client/icons/globe.js +24 -0
- package/dist/client/icons/go.d.ts +2 -0
- package/dist/client/icons/go.js +46 -0
- package/dist/client/icons/graphql.d.ts +2 -0
- package/dist/client/icons/graphql.js +56 -0
- package/dist/client/icons/index.d.ts +2 -0
- package/dist/client/icons/index.js +92 -0
- package/dist/client/icons/javascript.d.ts +2 -0
- package/dist/client/icons/javascript.js +24 -0
- package/dist/client/icons/json.d.ts +2 -0
- package/dist/client/icons/json.js +41 -0
- package/dist/client/icons/link-arrow.d.ts +2 -0
- package/dist/client/icons/link-arrow.js +31 -0
- package/dist/client/icons/link.d.ts +2 -0
- package/dist/client/icons/link.js +24 -0
- package/dist/client/icons/markdown.d.ts +2 -0
- package/dist/client/icons/markdown.js +24 -0
- package/dist/client/icons/mdx.d.ts +2 -0
- package/dist/client/icons/mdx.js +24 -0
- package/dist/client/icons/menu.d.ts +2 -0
- package/dist/client/icons/menu.js +36 -0
- package/dist/client/icons/moon.d.ts +2 -0
- package/dist/client/icons/moon.js +24 -0
- package/dist/client/icons/move.d.ts +2 -0
- package/dist/client/icons/move.js +24 -0
- package/dist/client/icons/python.d.ts +2 -0
- package/dist/client/icons/python.js +31 -0
- package/dist/client/icons/react.d.ts +2 -0
- package/dist/client/icons/react.js +38 -0
- package/dist/client/icons/rust.d.ts +2 -0
- package/dist/client/icons/rust.js +31 -0
- package/dist/client/icons/spinner.d.ts +2 -0
- package/dist/client/icons/spinner.js +31 -0
- package/dist/client/icons/sun.d.ts +2 -0
- package/dist/client/icons/sun.js +24 -0
- package/dist/client/icons/svelte.d.ts +2 -0
- package/dist/client/icons/svelte.js +31 -0
- package/dist/client/icons/terminal.d.ts +2 -0
- package/dist/client/icons/terminal.js +24 -0
- package/dist/client/icons/terraform.d.ts +2 -0
- package/dist/client/icons/terraform.js +24 -0
- package/dist/client/icons/typescript.d.ts +2 -0
- package/dist/client/icons/typescript.js +24 -0
- package/dist/client/icons/word-wrap.d.ts +2 -0
- package/dist/client/icons/word-wrap.js +24 -0
- package/dist/client/icons/x.d.ts +2 -0
- package/dist/client/icons/x.js +24 -0
- package/dist/client/mdx-components/anchor.d.ts +10 -0
- package/dist/client/mdx-components/anchor.js +109 -0
- package/dist/client/mdx-components/code.d.ts +7 -0
- package/dist/client/mdx-components/code.js +52 -0
- package/dist/client/mdx-components/details.d.ts +5 -0
- package/dist/client/mdx-components/details.js +166 -0
- package/dist/client/mdx-components/image.d.ts +28 -0
- package/dist/client/mdx-components/image.js +39 -0
- package/dist/client/mdx-components/index.d.ts +11 -0
- package/dist/client/mdx-components/index.js +16 -0
- package/dist/client/mdx-components/pre/copy-to-clipboard.d.ts +5 -0
- package/dist/client/mdx-components/pre/copy-to-clipboard.js +49 -0
- package/dist/client/mdx-components/pre/index.d.ts +16 -0
- package/dist/client/mdx-components/pre/index.js +156 -0
- package/dist/client/mdx-components/pre/toggle-word-wrap-button.d.ts +7 -0
- package/dist/client/mdx-components/pre/toggle-word-wrap-button.js +31 -0
- package/dist/client/mdx-components/summary.d.ts +5 -0
- package/dist/client/mdx-components/summary.js +80 -0
- package/dist/client/mdx-components/table.d.ts +57 -0
- package/dist/client/mdx-components/table.js +95 -0
- package/dist/client/mdx-components.d.ts +89 -0
- package/dist/client/mdx-components.js +15 -0
- package/dist/client/mdx-remote.d.ts +62 -0
- package/dist/client/mdx-remote.js +36 -0
- package/dist/client/normalize-pages.d.ts +84 -0
- package/dist/client/normalize-pages.js +232 -0
- package/dist/client/package.json +1 -0
- package/dist/client/pages.d.ts +131 -0
- package/dist/client/pages.js +39 -0
- package/dist/client/remove-links.d.ts +6 -0
- package/dist/client/remove-links.js +35 -0
- package/dist/client/setup-page.d.ts +18 -0
- package/dist/client/setup-page.js +14 -0
- package/dist/server/compile-metadata.d.ts +12 -0
- package/dist/server/compile-metadata.js +39 -0
- package/dist/server/compile.d.ts +39 -0
- package/dist/server/compile.js +158 -0
- package/dist/server/constants.d.ts +15 -0
- package/dist/server/constants.js +22 -0
- package/dist/server/fetch-filepaths-from-github.d.ts +10 -0
- package/dist/server/fetch-filepaths-from-github.js +36 -0
- package/dist/server/index.d.ts +39 -0
- package/dist/server/index.js +203 -0
- package/dist/server/loader.d.ts +18 -0
- package/dist/server/loader.js +155 -0
- package/dist/server/locales.d.ts +22 -0
- package/dist/server/locales.js +38 -0
- package/dist/server/page-map/find-meta-and-page-file-paths.d.ts +8 -0
- package/dist/server/page-map/find-meta-and-page-file-paths.js +32 -0
- package/dist/server/page-map/get.d.ts +50 -0
- package/dist/server/page-map/get.js +28 -0
- package/dist/server/page-map/index-page.d.ts +21 -0
- package/dist/server/page-map/index-page.js +57 -0
- package/dist/server/page-map/index.d.ts +26 -0
- package/dist/server/page-map/index.js +24 -0
- package/dist/server/page-map/merge-meta-with-page-map.d.ts +17 -0
- package/dist/server/page-map/merge-meta-with-page-map.js +74 -0
- package/dist/server/page-map/normalize.d.ts +17 -0
- package/dist/server/page-map/normalize.js +122 -0
- package/dist/server/page-map/placeholder.d.ts +2 -0
- package/dist/server/page-map/placeholder.js +0 -0
- package/dist/server/page-map/to-ast.d.ts +18 -0
- package/dist/server/page-map/to-ast.js +47 -0
- package/dist/server/page-map/to-js.d.ts +21 -0
- package/dist/server/page-map/to-js.js +72 -0
- package/dist/server/page-map/to-page-map.d.ts +26 -0
- package/dist/server/page-map/to-page-map.js +101 -0
- package/dist/server/recma-plugins/index.d.ts +3 -0
- package/dist/server/recma-plugins/index.js +4 -0
- package/dist/server/recma-plugins/recma-rewrite.d.ts +11 -0
- package/dist/server/recma-plugins/recma-rewrite.js +98 -0
- package/dist/server/rehype-plugins/index.d.ts +18 -0
- package/dist/server/rehype-plugins/index.js +16 -0
- package/dist/server/rehype-plugins/rehype-better-react-mathjax.d.ts +24 -0
- package/dist/server/rehype-plugins/rehype-better-react-mathjax.js +96 -0
- package/dist/server/rehype-plugins/rehype-extract-toc-content.d.ts +6 -0
- package/dist/server/rehype-plugins/rehype-extract-toc-content.js +119 -0
- package/dist/server/rehype-plugins/rehype-twoslash-popup.d.ts +6 -0
- package/dist/server/rehype-plugins/rehype-twoslash-popup.js +50 -0
- package/dist/server/rehype-plugins/rehype.d.ts +21 -0
- package/dist/server/rehype-plugins/rehype.js +84 -0
- package/dist/server/remark-plugins/index.d.ts +15 -0
- package/dist/server/remark-plugins/index.js +26 -0
- package/dist/server/remark-plugins/remark-assign-frontmatter.d.ts +10 -0
- package/dist/server/remark-plugins/remark-assign-frontmatter.js +24 -0
- package/dist/server/remark-plugins/remark-custom-heading-id.d.ts +9 -0
- package/dist/server/remark-plugins/remark-custom-heading-id.js +18 -0
- package/dist/server/remark-plugins/remark-export-only-metadata.d.ts +6 -0
- package/dist/server/remark-plugins/remark-export-only-metadata.js +18 -0
- package/dist/server/remark-plugins/remark-export-source-code.d.ts +6 -0
- package/dist/server/remark-plugins/remark-export-source-code.js +35 -0
- package/dist/server/remark-plugins/remark-headings.d.ts +12 -0
- package/dist/server/remark-plugins/remark-headings.js +133 -0
- package/dist/server/remark-plugins/remark-link-rewrite.d.ts +11 -0
- package/dist/server/remark-plugins/remark-link-rewrite.js +12 -0
- package/dist/server/remark-plugins/remark-mdx-disable-explicit-jsx.d.ts +10 -0
- package/dist/server/remark-plugins/remark-mdx-disable-explicit-jsx.js +10 -0
- package/dist/server/remark-plugins/remark-mdx-frontmatter.d.ts +6 -0
- package/dist/server/remark-plugins/remark-mdx-frontmatter.js +37 -0
- package/dist/server/remark-plugins/remark-mdx-title.d.ts +10 -0
- package/dist/server/remark-plugins/remark-mdx-title.js +53 -0
- package/dist/server/remark-plugins/remark-remove-imports.d.ts +6 -0
- package/dist/server/remark-plugins/remark-remove-imports.js +12 -0
- package/dist/server/remark-plugins/remark-static-image.d.ts +6 -0
- package/dist/server/remark-plugins/remark-static-image.js +107 -0
- package/dist/server/schemas.d.ts +352 -0
- package/dist/server/schemas.js +240 -0
- package/dist/server/tsdoc/base.d.ts +38 -0
- package/dist/server/tsdoc/base.js +284 -0
- package/dist/server/tsdoc/index.d.ts +6 -0
- package/dist/server/tsdoc/index.js +10 -0
- package/dist/server/tsdoc/tsdoc.d.ts +102 -0
- package/dist/server/tsdoc/tsdoc.js +262 -0
- package/dist/server/tsdoc/types.d.ts +64 -0
- package/dist/server/tsdoc/types.js +0 -0
- package/dist/server/tsdoc/zod-to-ts.d.ts +5 -0
- package/dist/server/tsdoc/zod-to-ts.js +107 -0
- package/dist/server/twoslash.d.ts +6 -0
- package/dist/server/twoslash.js +60 -0
- package/dist/server/utils.d.ts +12 -0
- package/dist/server/utils.js +45 -0
- package/dist/types.d.ts +128 -0
- package/dist/types.generated.d.ts +203 -0
- package/dist/types.generated.js +0 -0
- package/dist/types.js +0 -0
- package/loader.cjs +24 -0
- package/package.json +265 -0
- package/styles/cards.css +24 -0
- package/styles/code-block.css +266 -0
- package/styles/default.css +55 -0
- package/styles/react-medium-image-zoom.css +101 -0
- package/styles/scrollbar.css +14 -0
- package/styles/steps.css +22 -0
- package/styles/subheading-anchor.css +25 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Mermaid } from "@theguild/remark-mermaid/mermaid";
|
|
2
|
+
import { MathJax, MathJaxContext } from "better-react-mathjax";
|
|
3
|
+
import { Banner } from "./banner/index.js";
|
|
4
|
+
import { FileTree } from "./file-tree/index.js";
|
|
5
|
+
import { SkipNavContent, SkipNavLink } from "./skip-nav/index.js";
|
|
6
|
+
import { Popup } from "./popup/index.js";
|
|
7
|
+
import { Tabs } from "./tabs/index.js";
|
|
8
|
+
import { Bleed } from "./bleed.js";
|
|
9
|
+
import { Button } from "./button.js";
|
|
10
|
+
import { Callout } from "./callout.js";
|
|
11
|
+
import { Cards } from "./cards.js";
|
|
12
|
+
import { Collapse } from "./collapse.js";
|
|
13
|
+
import { Head } from "./head.js";
|
|
14
|
+
import { ImageZoom } from "./image-zoom.js";
|
|
15
|
+
import { Playground } from "./playground.js";
|
|
16
|
+
import { Search } from "./search.js";
|
|
17
|
+
import { Select } from "./select.js";
|
|
18
|
+
import { Steps } from "./steps.js";
|
|
19
|
+
export * from "../hocs/index.js";
|
|
20
|
+
export * from "../mdx-components/index.js";
|
|
21
|
+
export {
|
|
22
|
+
Banner,
|
|
23
|
+
Bleed,
|
|
24
|
+
Button,
|
|
25
|
+
Callout,
|
|
26
|
+
Cards,
|
|
27
|
+
Collapse,
|
|
28
|
+
FileTree,
|
|
29
|
+
Head,
|
|
30
|
+
ImageZoom,
|
|
31
|
+
MathJax,
|
|
32
|
+
MathJaxContext,
|
|
33
|
+
Mermaid,
|
|
34
|
+
Playground,
|
|
35
|
+
Popup,
|
|
36
|
+
Search,
|
|
37
|
+
Select,
|
|
38
|
+
SkipNavContent,
|
|
39
|
+
SkipNavLink,
|
|
40
|
+
Steps,
|
|
41
|
+
Tabs
|
|
42
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { FC, ReactElement } from 'react';
|
|
2
|
+
import { MDXRemoteProps } from '../mdx-remote.js';
|
|
3
|
+
import '../evaluate.js';
|
|
4
|
+
import '../../types.js';
|
|
5
|
+
import 'mdast';
|
|
6
|
+
import 'next';
|
|
7
|
+
import 'zod';
|
|
8
|
+
import '../../server/schemas.js';
|
|
9
|
+
import './lib/index.js';
|
|
10
|
+
import 'rehype-katex/lib/index.js';
|
|
11
|
+
import 'better-react-mathjax';
|
|
12
|
+
import 'rehype-pretty-code';
|
|
13
|
+
import '../../types.generated.js';
|
|
14
|
+
import '@mdx-js/mdx';
|
|
15
|
+
import 'rehype-katex';
|
|
16
|
+
import '../mdx-components.js';
|
|
17
|
+
import 'url';
|
|
18
|
+
import 'next/link.js';
|
|
19
|
+
import 'next/image.js';
|
|
20
|
+
import './image-zoom.js';
|
|
21
|
+
import 'next/image';
|
|
22
|
+
import '../mdx-components/anchor.js';
|
|
23
|
+
import 'next/link';
|
|
24
|
+
|
|
25
|
+
type PlaygroundProps = {
|
|
26
|
+
/**
|
|
27
|
+
* String with source MDX.
|
|
28
|
+
* @example '# hello world <br /> nice to see you'
|
|
29
|
+
*/
|
|
30
|
+
source: string;
|
|
31
|
+
/**
|
|
32
|
+
* Fallback component for loading.
|
|
33
|
+
* @default null
|
|
34
|
+
*/
|
|
35
|
+
fallback?: ReactElement | null;
|
|
36
|
+
} & Pick<MDXRemoteProps, 'components' | 'scope'>;
|
|
37
|
+
/**
|
|
38
|
+
* A built-in component lets you write Nextra-compatible MDX that renders only on the client.
|
|
39
|
+
* @example
|
|
40
|
+
* <PlaygroundDemo />
|
|
41
|
+
*
|
|
42
|
+
* @usage
|
|
43
|
+
* ```mdx filename="Basic Usage"
|
|
44
|
+
* import { Playground } from 'nextra/components'
|
|
45
|
+
*
|
|
46
|
+
* # Playground
|
|
47
|
+
*
|
|
48
|
+
* Below is a playground component. It mixes into the rest of your MDX perfectly.
|
|
49
|
+
*
|
|
50
|
+
* <Playground
|
|
51
|
+
* source="## Hello world"
|
|
52
|
+
* components={{ h2: props => <h2 {...props} className="myClass" /> }}
|
|
53
|
+
* />
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* You may also specify a fallback component like so:
|
|
57
|
+
*
|
|
58
|
+
* ```mdx filename="Usage with Fallback"
|
|
59
|
+
* import { Playground } from 'nextra/components'
|
|
60
|
+
*
|
|
61
|
+
* <Playground
|
|
62
|
+
* source="## Hello world"
|
|
63
|
+
* components={{ h2: props => <h2 {...props} className="myClass" /> }}
|
|
64
|
+
* fallback={<div>Loading playground...</div>}
|
|
65
|
+
* />
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* ### Avoiding unstyled outputs
|
|
69
|
+
*
|
|
70
|
+
* To prevent unstyled elements, import `useMDXComponents` from your
|
|
71
|
+
* `mdx-components` file. Call this function and pass the returned components to
|
|
72
|
+
* the `components` prop. You can also include your custom components as the first
|
|
73
|
+
* argument:
|
|
74
|
+
*
|
|
75
|
+
* ```mdx {1,6-8}
|
|
76
|
+
* import { Playground } from 'nextra/components'
|
|
77
|
+
* import { useMDXComponents } from '../path/to/my/mdx-components'
|
|
78
|
+
*
|
|
79
|
+
* <Playground
|
|
80
|
+
* source="## Hello world"
|
|
81
|
+
* components={useMDXComponents({
|
|
82
|
+
* h2: props => <h2 {...props} className="myClass" />
|
|
83
|
+
* })}
|
|
84
|
+
* fallback={<div>Loading playground...</div>}
|
|
85
|
+
* />
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
declare const Playground: FC<PlaygroundProps>;
|
|
89
|
+
|
|
90
|
+
export { Playground };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { c as _c } from "react-compiler-runtime";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { evaluate } from "../evaluate.js";
|
|
6
|
+
import { Callout } from "./callout.js";
|
|
7
|
+
const Playground = (t0) => {
|
|
8
|
+
const $ = _c(13);
|
|
9
|
+
const {
|
|
10
|
+
source,
|
|
11
|
+
fallback: t1,
|
|
12
|
+
components,
|
|
13
|
+
scope
|
|
14
|
+
} = t0;
|
|
15
|
+
const fallback = t1 === void 0 ? null : t1;
|
|
16
|
+
const [compiledSource, setCompiledSource] = useState("");
|
|
17
|
+
const [error, setError] = useState();
|
|
18
|
+
let t2;
|
|
19
|
+
let t3;
|
|
20
|
+
if ($[0] !== source) {
|
|
21
|
+
t2 = () => {
|
|
22
|
+
const doCompile = async function doCompile2() {
|
|
23
|
+
const {
|
|
24
|
+
compileMdx
|
|
25
|
+
} = await importCompile();
|
|
26
|
+
;
|
|
27
|
+
try {
|
|
28
|
+
const rawJs = await compileMdx(source);
|
|
29
|
+
setCompiledSource(rawJs);
|
|
30
|
+
setError(null);
|
|
31
|
+
} catch (t4) {
|
|
32
|
+
const error_0 = t4;
|
|
33
|
+
setError(error_0);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
doCompile();
|
|
37
|
+
};
|
|
38
|
+
t3 = [source];
|
|
39
|
+
$[0] = source;
|
|
40
|
+
$[1] = t2;
|
|
41
|
+
$[2] = t3;
|
|
42
|
+
} else {
|
|
43
|
+
t2 = $[1];
|
|
44
|
+
t3 = $[2];
|
|
45
|
+
}
|
|
46
|
+
useEffect(t2, t3);
|
|
47
|
+
if (error) {
|
|
48
|
+
let t4;
|
|
49
|
+
let t5;
|
|
50
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
51
|
+
t4 = /* @__PURE__ */ jsx("b", { children: "Could not compile code" });
|
|
52
|
+
t5 = /* @__PURE__ */ jsx("br", {});
|
|
53
|
+
$[3] = t4;
|
|
54
|
+
$[4] = t5;
|
|
55
|
+
} else {
|
|
56
|
+
t4 = $[3];
|
|
57
|
+
t5 = $[4];
|
|
58
|
+
}
|
|
59
|
+
const t6 = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
60
|
+
let t7;
|
|
61
|
+
if ($[5] !== t6) {
|
|
62
|
+
t7 = /* @__PURE__ */ jsxs(Callout, { type: "error", children: [
|
|
63
|
+
t4,
|
|
64
|
+
t5,
|
|
65
|
+
t6
|
|
66
|
+
] });
|
|
67
|
+
$[5] = t6;
|
|
68
|
+
$[6] = t7;
|
|
69
|
+
} else {
|
|
70
|
+
t7 = $[6];
|
|
71
|
+
}
|
|
72
|
+
return t7;
|
|
73
|
+
}
|
|
74
|
+
if (compiledSource) {
|
|
75
|
+
let t4;
|
|
76
|
+
if ($[7] !== compiledSource || $[8] !== components || $[9] !== scope) {
|
|
77
|
+
t4 = evaluate(compiledSource, components, scope);
|
|
78
|
+
$[7] = compiledSource;
|
|
79
|
+
$[8] = components;
|
|
80
|
+
$[9] = scope;
|
|
81
|
+
$[10] = t4;
|
|
82
|
+
} else {
|
|
83
|
+
t4 = $[10];
|
|
84
|
+
}
|
|
85
|
+
const MDXContent = t4.default;
|
|
86
|
+
let t5;
|
|
87
|
+
if ($[11] !== MDXContent) {
|
|
88
|
+
t5 = /* @__PURE__ */ jsx(MDXContent, {});
|
|
89
|
+
$[11] = MDXContent;
|
|
90
|
+
$[12] = t5;
|
|
91
|
+
} else {
|
|
92
|
+
t5 = $[12];
|
|
93
|
+
}
|
|
94
|
+
return t5;
|
|
95
|
+
}
|
|
96
|
+
return fallback;
|
|
97
|
+
};
|
|
98
|
+
function importCompile() {
|
|
99
|
+
return import("../../server/compile.js");
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
Playground
|
|
103
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { c as _c } from "react-compiler-runtime";
|
|
4
|
+
import { Popover, PopoverPanel } from "@headlessui/react";
|
|
5
|
+
import cn from "clsx";
|
|
6
|
+
import { createContext, useContext, useState } from "react";
|
|
7
|
+
const PopupContext = createContext(null);
|
|
8
|
+
function usePopup() {
|
|
9
|
+
const ctx = useContext(PopupContext);
|
|
10
|
+
if (typeof ctx !== "boolean") {
|
|
11
|
+
throw new Error("`usePopup` must be used within a `<Popup>` component");
|
|
12
|
+
}
|
|
13
|
+
return ctx;
|
|
14
|
+
}
|
|
15
|
+
const Popup = (props) => {
|
|
16
|
+
const $ = _c(6);
|
|
17
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
18
|
+
let t0;
|
|
19
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
20
|
+
t0 = (event) => {
|
|
21
|
+
setIsOpen(event.type === "mouseenter");
|
|
22
|
+
};
|
|
23
|
+
$[0] = t0;
|
|
24
|
+
} else {
|
|
25
|
+
t0 = $[0];
|
|
26
|
+
}
|
|
27
|
+
const handleMouse = t0;
|
|
28
|
+
let t1;
|
|
29
|
+
if ($[1] !== props) {
|
|
30
|
+
t1 = /* @__PURE__ */ jsx(Popover, { as: "span", onMouseEnter: handleMouse, onMouseLeave: handleMouse, ...props });
|
|
31
|
+
$[1] = props;
|
|
32
|
+
$[2] = t1;
|
|
33
|
+
} else {
|
|
34
|
+
t1 = $[2];
|
|
35
|
+
}
|
|
36
|
+
let t2;
|
|
37
|
+
if ($[3] !== isOpen || $[4] !== t1) {
|
|
38
|
+
t2 = /* @__PURE__ */ jsx(PopupContext.Provider, { value: isOpen, children: t1 });
|
|
39
|
+
$[3] = isOpen;
|
|
40
|
+
$[4] = t1;
|
|
41
|
+
$[5] = t2;
|
|
42
|
+
} else {
|
|
43
|
+
t2 = $[5];
|
|
44
|
+
}
|
|
45
|
+
return t2;
|
|
46
|
+
};
|
|
47
|
+
const PopupPanel = (props) => {
|
|
48
|
+
const $ = _c(7);
|
|
49
|
+
const isOpen = usePopup();
|
|
50
|
+
let t0;
|
|
51
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
52
|
+
t0 = {
|
|
53
|
+
to: "bottom start",
|
|
54
|
+
gap: -24
|
|
55
|
+
};
|
|
56
|
+
$[0] = t0;
|
|
57
|
+
} else {
|
|
58
|
+
t0 = $[0];
|
|
59
|
+
}
|
|
60
|
+
let t1;
|
|
61
|
+
if ($[1] !== props.className) {
|
|
62
|
+
t1 = cn("x:max-w-2xl!", props.className);
|
|
63
|
+
$[1] = props.className;
|
|
64
|
+
$[2] = t1;
|
|
65
|
+
} else {
|
|
66
|
+
t1 = $[2];
|
|
67
|
+
}
|
|
68
|
+
let t2;
|
|
69
|
+
if ($[3] !== isOpen || $[4] !== props || $[5] !== t1) {
|
|
70
|
+
t2 = /* @__PURE__ */ jsx(PopoverPanel, { static: isOpen, anchor: t0, ...props, className: t1 });
|
|
71
|
+
$[3] = isOpen;
|
|
72
|
+
$[4] = props;
|
|
73
|
+
$[5] = t1;
|
|
74
|
+
$[6] = t2;
|
|
75
|
+
} else {
|
|
76
|
+
t2 = $[6];
|
|
77
|
+
}
|
|
78
|
+
return t2;
|
|
79
|
+
};
|
|
80
|
+
export {
|
|
81
|
+
Popup,
|
|
82
|
+
PopupPanel
|
|
83
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
import * as _headlessui_react from '@headlessui/react';
|
|
4
|
+
import * as react_jsx_runtime_js from 'react/jsx-runtime.js';
|
|
5
|
+
import { Popup as Popup$1 } from './index.client.js';
|
|
6
|
+
|
|
7
|
+
declare const Popup: ((props: ComponentProps<typeof Popup$1>) => react_jsx_runtime_js.JSX.Element) & {
|
|
8
|
+
Button: _headlessui_react._internal_ComponentPopoverButton;
|
|
9
|
+
Panel: react.FC<_headlessui_react.PopoverPanelProps>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { Popup };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { PopoverButton } from "@headlessui/react";
|
|
4
|
+
import { Popup as _Popup, PopupPanel } from "./index.client.js";
|
|
5
|
+
const Popup = Object.assign((props) => /* @__PURE__ */ jsx(_Popup, { ...props }), {
|
|
6
|
+
Button: PopoverButton,
|
|
7
|
+
Panel: PopupPanel
|
|
8
|
+
});
|
|
9
|
+
export {
|
|
10
|
+
Popup
|
|
11
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { ComboboxInputProps } from '@headlessui/react';
|
|
2
|
+
import { FC, ReactNode } from 'react';
|
|
3
|
+
import { PagefindSearchOptions } from '../../types.js';
|
|
4
|
+
import 'mdast';
|
|
5
|
+
import 'next';
|
|
6
|
+
import 'zod';
|
|
7
|
+
import '../../server/schemas.js';
|
|
8
|
+
import './lib/index.js';
|
|
9
|
+
import 'rehype-katex/lib/index.js';
|
|
10
|
+
import 'better-react-mathjax';
|
|
11
|
+
import 'rehype-pretty-code';
|
|
12
|
+
import '../../types.generated.js';
|
|
13
|
+
import '@mdx-js/mdx';
|
|
14
|
+
import 'rehype-katex';
|
|
15
|
+
|
|
16
|
+
declare function importPagefind(): Promise<void>;
|
|
17
|
+
type InputProps = Omit<ComboboxInputProps, 'className' | 'onChange' | 'onFocus' | 'onBlur' | 'value' | 'placeholder'>;
|
|
18
|
+
interface SearchProps extends InputProps {
|
|
19
|
+
/**
|
|
20
|
+
* Not found text.
|
|
21
|
+
* @default 'No results found.'
|
|
22
|
+
*/
|
|
23
|
+
emptyResult?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Error text.
|
|
26
|
+
* @default 'Failed to load search index.'
|
|
27
|
+
* */
|
|
28
|
+
errorText?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Loading text.
|
|
31
|
+
* @default 'Loading…'
|
|
32
|
+
*/
|
|
33
|
+
loading?: ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Placeholder text.
|
|
36
|
+
* @default 'Search documentation…'
|
|
37
|
+
*/
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
/** Input container CSS class name. */
|
|
40
|
+
className?: string;
|
|
41
|
+
searchOptions?: PagefindSearchOptions;
|
|
42
|
+
/**
|
|
43
|
+
* Callback function that triggers whenever the search input changes.
|
|
44
|
+
*
|
|
45
|
+
* This prop is **not serializable** and cannot be used directly in a server-side layout.
|
|
46
|
+
*
|
|
47
|
+
* To use this prop, wrap the component in a **client-side** wrapper. Example:
|
|
48
|
+
*
|
|
49
|
+
* ```tsx filename="search-with-callback.jsx"
|
|
50
|
+
* 'use client'
|
|
51
|
+
*
|
|
52
|
+
* import { Search } from 'nextra/components'
|
|
53
|
+
*
|
|
54
|
+
* export function SearchWithCallback() {
|
|
55
|
+
* return (
|
|
56
|
+
* <Search
|
|
57
|
+
* onSearch={query => {
|
|
58
|
+
* console.log('Search query:', query)
|
|
59
|
+
* }}
|
|
60
|
+
* />
|
|
61
|
+
* )
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* Then pass the wrapper to the layout:
|
|
66
|
+
*
|
|
67
|
+
* ```tsx filename="app/layout.jsx"
|
|
68
|
+
* import { SearchWithCallback } from '../path/to/your/search-with-callback'
|
|
69
|
+
* // ...
|
|
70
|
+
* <Layout search={<SearchWithCallback />} {...rest} />
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @param query - The current search input string.
|
|
74
|
+
*/
|
|
75
|
+
onSearch?: (query: string) => void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A built-in search component provides a seamless and fast search
|
|
79
|
+
* experience out of the box. Under the hood, it leverages the
|
|
80
|
+
* [Pagefind package](https://pagefind.app) — a fully client-side search engine optimized for static
|
|
81
|
+
* sites. Pagefind indexes your content at build time and enables highly performant,
|
|
82
|
+
* zero-JavaScript-dependency searches at runtime.
|
|
83
|
+
*
|
|
84
|
+
* @see [Nextra search setup guide](https://nextra.site/docs/guide/search)
|
|
85
|
+
*/
|
|
86
|
+
declare const Search: FC<SearchProps>;
|
|
87
|
+
|
|
88
|
+
export { Search, importPagefind };
|