@hanzo/docs-core 16.4.3 → 16.5.3
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/README.md +3 -3
- package/dist/{advanced-BRT5Ij43.js → advanced-BH0syJ-M.js} +3 -4
- package/dist/{algolia-CQPXCnjV.js → algolia-C7Crg8-5.js} +2 -3
- package/dist/breadcrumb.d.ts +2 -3
- package/dist/breadcrumb.js +3 -4
- package/dist/{chunk-B-ezknvj.js → chunk-CaR5F9JI.js} +3 -3
- package/dist/content/github.d.ts +1 -2
- package/dist/content/github.js +1 -2
- package/dist/content/index.d.ts +3 -4
- package/dist/content/index.js +1 -2
- package/dist/content/mdx/preset-bundler.d.ts +9 -10
- package/dist/content/mdx/preset-bundler.js +2 -3
- package/dist/content/mdx/preset-runtime.d.ts +9 -10
- package/dist/content/mdx/preset-runtime.js +2 -3
- package/dist/content/toc.d.ts +1 -3
- package/dist/content/toc.js +4 -5
- package/dist/create-i18n-Cv3Cocbs.d.ts +51 -0
- package/dist/{definitions-DuxDer_c.d.ts → definitions-DSNTbAwC.d.ts} +1 -2
- package/dist/dynamic-link.d.ts +3 -4
- package/dist/dynamic-link.js +1 -3
- package/dist/{fetch-B5e9CFfN.js → fetch-HotVeLLF.js} +1 -2
- package/dist/framework/index.d.ts +5 -6
- package/dist/framework/index.js +18 -19
- package/dist/framework/next.d.ts +3 -4
- package/dist/framework/next.js +1 -2
- package/dist/framework/react-router.d.ts +1 -2
- package/dist/framework/react-router.js +1 -2
- package/dist/framework/tanstack.d.ts +4 -5
- package/dist/framework/tanstack.js +2 -3
- package/dist/framework/waku.d.ts +1 -2
- package/dist/framework/waku.js +1 -2
- package/dist/hast-utils-BmGqqmvo.js +15 -0
- package/dist/highlight/client.d.ts +2 -4
- package/dist/highlight/client.js +7 -13
- package/dist/highlight/config.d.ts +15 -0
- package/dist/highlight/config.js +18 -0
- package/dist/highlight/core/client.d.ts +31 -0
- package/dist/highlight/core/client.js +68 -0
- package/dist/highlight/core/index.d.ts +27 -0
- package/dist/highlight/core/index.js +69 -0
- package/dist/highlight/index.d.ts +34 -2
- package/dist/highlight/index.js +57 -2
- package/dist/i18n/index.d.ts +39 -1
- package/dist/i18n/index.js +1 -2
- package/dist/i18n/middleware.d.ts +2 -3
- package/dist/i18n/middleware.js +1 -2
- package/dist/{icon-BWwSDabM.js → icon-OtPFhyk1.js} +1 -2
- package/dist/link.d.ts +3 -4
- package/dist/link.js +1 -2
- package/dist/{mdast-utils-mc9-X-PK.js → mdast-utils-gJMY143g.js} +1 -2
- package/dist/mdx-plugins/codeblock-utils.d.ts +35 -1
- package/dist/mdx-plugins/codeblock-utils.js +2 -3
- package/dist/mdx-plugins/index.d.ts +18 -15
- package/dist/mdx-plugins/index.js +7 -5
- package/dist/mdx-plugins/rehype-code.core.d.ts +38 -0
- package/dist/mdx-plugins/rehype-code.core.js +104 -0
- package/dist/mdx-plugins/rehype-code.d.ts +18 -2
- package/dist/mdx-plugins/rehype-code.js +24 -3
- package/dist/mdx-plugins/rehype-toc.d.ts +16 -1
- package/dist/mdx-plugins/rehype-toc.js +127 -1
- package/dist/mdx-plugins/remark-admonition.d.ts +20 -1
- package/dist/mdx-plugins/remark-admonition.js +2 -3
- package/dist/mdx-plugins/remark-code-tab.d.ts +30 -1
- package/dist/mdx-plugins/remark-code-tab.js +4 -5
- package/dist/mdx-plugins/remark-directive-admonition.d.ts +34 -1
- package/dist/mdx-plugins/remark-directive-admonition.js +1 -2
- package/dist/mdx-plugins/remark-feedback-block.d.ts +51 -0
- package/dist/mdx-plugins/remark-feedback-block.js +47 -0
- package/dist/mdx-plugins/remark-gfm.d.ts +2 -2
- package/dist/mdx-plugins/remark-heading.d.ts +35 -1
- package/dist/mdx-plugins/remark-heading.js +2 -3
- package/dist/mdx-plugins/remark-image.d.ts +63 -1
- package/dist/mdx-plugins/remark-image.js +1 -2
- package/dist/mdx-plugins/remark-mdx-files.d.ts +55 -2
- package/dist/mdx-plugins/remark-mdx-files.js +103 -13
- package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +15 -1
- package/dist/mdx-plugins/remark-mdx-mermaid.js +1 -2
- package/dist/mdx-plugins/remark-npm.d.ts +34 -1
- package/dist/mdx-plugins/remark-npm.js +1 -2
- package/dist/mdx-plugins/remark-steps.d.ts +26 -1
- package/dist/mdx-plugins/remark-steps.js +1 -2
- package/dist/mdx-plugins/remark-structure.d.ts +75 -1
- package/dist/mdx-plugins/remark-structure.js +7 -8
- package/dist/{mixedbread-DlByNYSd.js → mixedbread-Bx9drx9S.js} +6 -5
- package/dist/negotiation/index.d.ts +1 -2
- package/dist/negotiation/index.js +1 -2
- package/dist/{normalize-url-DP9-1I-S.js → normalize-url-DUHbcuVM.js} +2 -3
- package/dist/{orama-cloud-DH3g37zc.js → orama-cloud-ByznDyOk.js} +6 -7
- package/dist/orama-cloud-legacy-BbgJnf5f.js +81 -0
- package/dist/page-tree/index.d.ts +3 -45
- package/dist/page-tree/index.js +1 -1
- package/dist/{index-2U6Tl4--.d.ts → path-B77y3W0_.d.ts} +111 -98
- package/dist/{path-DHIjrDBP.js → path-D0Bwm6Fs.js} +2 -3
- package/dist/{remove-undefined-Cfs4o_mM.js → remove-undefined-CJm9cyrC.js} +1 -2
- package/dist/search/algolia.d.ts +66 -2
- package/dist/search/algolia.js +1 -2
- package/dist/search/client.d.ts +31 -8
- package/dist/search/client.js +27 -22
- package/dist/search/index.d.ts +1 -2
- package/dist/search/index.js +41 -1
- package/dist/search/orama-cloud-legacy.d.ts +77 -0
- package/dist/search/orama-cloud-legacy.js +49 -0
- package/dist/search/orama-cloud.d.ts +5 -9
- package/dist/search/orama-cloud.js +1 -2
- package/dist/search/server.d.ts +87 -4
- package/dist/search/server.js +7 -8
- package/dist/source/client/index.d.ts +13 -11
- package/dist/source/client/index.js +22 -13
- package/dist/source/index.d.ts +5 -3
- package/dist/source/index.js +428 -333
- package/dist/source/plugins/lucide-icons.d.ts +5 -4
- package/dist/source/plugins/lucide-icons.js +2 -3
- package/dist/source/plugins/slugs.d.ts +24 -2
- package/dist/source/plugins/slugs.js +2 -3
- package/dist/source/plugins/status-badges.d.ts +52 -0
- package/dist/source/plugins/status-badges.js +54 -0
- package/dist/source/schema.d.ts +1 -3
- package/dist/source/schema.js +1 -2
- package/dist/{static-Dq8pA8Ay.js → static-DTxK4eHk.js} +5 -6
- package/dist/toc.d.ts +5 -6
- package/dist/toc.js +1 -2
- package/dist/{rehype-code-CdiZ1Y6P.js → transformer-icon-BYedaeE8.js} +1 -96
- package/dist/transformer-icon-D7-6aFzt.d.ts +18 -0
- package/dist/types-BSnJn7kF.d.ts +6 -0
- package/dist/{util-CK2ykiif.d.ts → util-C60LmklF.d.ts} +1 -2
- package/dist/{util-s9piKHsk.js → util-De0ALHOx.js} +1 -2
- package/dist/utils/use-media-query.d.ts +1 -2
- package/dist/utils/use-media-query.js +1 -2
- package/dist/utils/use-on-change.d.ts +1 -2
- package/dist/utils/use-on-change.js +1 -2
- package/dist/{utils-DUvi2WkD.js → utils-Bc53B3CJ.js} +8 -7
- package/dist/utils-IgHyYnrz.d.ts +45 -0
- package/package.json +58 -28
- package/dist/advanced-BRT5Ij43.js.map +0 -1
- package/dist/algolia-CBBN8R6-.d.ts +0 -68
- package/dist/algolia-CBBN8R6-.d.ts.map +0 -1
- package/dist/algolia-CQPXCnjV.js.map +0 -1
- package/dist/breadcrumb.d.ts.map +0 -1
- package/dist/breadcrumb.js.map +0 -1
- package/dist/codeblock-utils-lld8UiQo.d.ts +0 -37
- package/dist/codeblock-utils-lld8UiQo.d.ts.map +0 -1
- package/dist/content/github.d.ts.map +0 -1
- package/dist/content/github.js.map +0 -1
- package/dist/content/index.d.ts.map +0 -1
- package/dist/content/index.js.map +0 -1
- package/dist/content/mdx/preset-bundler.d.ts.map +0 -1
- package/dist/content/mdx/preset-bundler.js.map +0 -1
- package/dist/content/mdx/preset-runtime.d.ts.map +0 -1
- package/dist/content/mdx/preset-runtime.js.map +0 -1
- package/dist/content/toc.d.ts.map +0 -1
- package/dist/content/toc.js.map +0 -1
- package/dist/definitions-DuxDer_c.d.ts.map +0 -1
- package/dist/dynamic-link.d.ts.map +0 -1
- package/dist/dynamic-link.js.map +0 -1
- package/dist/fetch-B5e9CFfN.js.map +0 -1
- package/dist/framework/index.d.ts.map +0 -1
- package/dist/framework/index.js.map +0 -1
- package/dist/framework/next.d.ts.map +0 -1
- package/dist/framework/next.js.map +0 -1
- package/dist/framework/react-router.d.ts.map +0 -1
- package/dist/framework/react-router.js.map +0 -1
- package/dist/framework/tanstack.d.ts.map +0 -1
- package/dist/framework/tanstack.js.map +0 -1
- package/dist/framework/waku.d.ts.map +0 -1
- package/dist/framework/waku.js.map +0 -1
- package/dist/highlight/client.d.ts.map +0 -1
- package/dist/highlight/client.js.map +0 -1
- package/dist/i18n/index.js.map +0 -1
- package/dist/i18n/middleware.d.ts.map +0 -1
- package/dist/i18n/middleware.js.map +0 -1
- package/dist/icon-BWwSDabM.js.map +0 -1
- package/dist/index-2U6Tl4--.d.ts.map +0 -1
- package/dist/index-Bw-DCOra.d.ts +0 -41
- package/dist/index-Bw-DCOra.d.ts.map +0 -1
- package/dist/link.d.ts.map +0 -1
- package/dist/link.js.map +0 -1
- package/dist/mdast-utils-mc9-X-PK.js.map +0 -1
- package/dist/mdx-plugins/codeblock-utils.js.map +0 -1
- package/dist/mdx-plugins/remark-admonition.js.map +0 -1
- package/dist/mdx-plugins/remark-code-tab.js.map +0 -1
- package/dist/mdx-plugins/remark-directive-admonition.js.map +0 -1
- package/dist/mdx-plugins/remark-heading.js.map +0 -1
- package/dist/mdx-plugins/remark-image.js.map +0 -1
- package/dist/mdx-plugins/remark-mdx-files.js.map +0 -1
- package/dist/mdx-plugins/remark-mdx-mermaid.js.map +0 -1
- package/dist/mdx-plugins/remark-npm.js.map +0 -1
- package/dist/mdx-plugins/remark-steps.js.map +0 -1
- package/dist/mdx-plugins/remark-structure.js.map +0 -1
- package/dist/mixedbread-DlByNYSd.js.map +0 -1
- package/dist/negotiation/index.d.ts.map +0 -1
- package/dist/negotiation/index.js.map +0 -1
- package/dist/normalize-url-DP9-1I-S.js.map +0 -1
- package/dist/orama-cloud-DH3g37zc.js.map +0 -1
- package/dist/page-tree/index.d.ts.map +0 -1
- package/dist/path-DHIjrDBP.js.map +0 -1
- package/dist/rehype-code-CdiZ1Y6P.js.map +0 -1
- package/dist/rehype-code-vVWG4-ej.d.ts +0 -58
- package/dist/rehype-code-vVWG4-ej.d.ts.map +0 -1
- package/dist/rehype-toc-DJvSyE0o.d.ts +0 -18
- package/dist/rehype-toc-DJvSyE0o.d.ts.map +0 -1
- package/dist/rehype-toc-DVwJcwvA.js +0 -143
- package/dist/rehype-toc-DVwJcwvA.js.map +0 -1
- package/dist/remark-admonition-DOwBWzsH.d.ts +0 -22
- package/dist/remark-admonition-DOwBWzsH.d.ts.map +0 -1
- package/dist/remark-code-tab-CXsYlims.d.ts +0 -32
- package/dist/remark-code-tab-CXsYlims.d.ts.map +0 -1
- package/dist/remark-directive-admonition-BCm_yiU9.d.ts +0 -36
- package/dist/remark-directive-admonition-BCm_yiU9.d.ts.map +0 -1
- package/dist/remark-gfm-CeWpMwyk.d.ts +0 -2
- package/dist/remark-heading-CXvCY0go.d.ts +0 -37
- package/dist/remark-heading-CXvCY0go.d.ts.map +0 -1
- package/dist/remark-image-CvUis4R1.d.ts +0 -65
- package/dist/remark-image-CvUis4R1.d.ts.map +0 -1
- package/dist/remark-mdx-files-DOYafA4x.d.ts +0 -42
- package/dist/remark-mdx-files-DOYafA4x.d.ts.map +0 -1
- package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts +0 -17
- package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts.map +0 -1
- package/dist/remark-npm-BIvIEKT2.d.ts +0 -36
- package/dist/remark-npm-BIvIEKT2.d.ts.map +0 -1
- package/dist/remark-steps-CHJN-rtm.d.ts +0 -28
- package/dist/remark-steps-CHJN-rtm.d.ts.map +0 -1
- package/dist/remark-structure-RZD2gGKp.d.ts +0 -77
- package/dist/remark-structure-RZD2gGKp.d.ts.map +0 -1
- package/dist/remove-undefined-Cfs4o_mM.js.map +0 -1
- package/dist/search/algolia.js.map +0 -1
- package/dist/search/client.d.ts.map +0 -1
- package/dist/search/client.js.map +0 -1
- package/dist/search/index.d.ts.map +0 -1
- package/dist/search/orama-cloud.d.ts.map +0 -1
- package/dist/search/orama-cloud.js.map +0 -1
- package/dist/search/server.js.map +0 -1
- package/dist/search-D6ChCLhY.js +0 -44
- package/dist/search-D6ChCLhY.js.map +0 -1
- package/dist/server-CPR_fgkH.d.ts +0 -133
- package/dist/server-CPR_fgkH.d.ts.map +0 -1
- package/dist/shiki-4oMYwHED.js +0 -80
- package/dist/shiki-4oMYwHED.js.map +0 -1
- package/dist/shiki-CIBQys54.d.ts +0 -33
- package/dist/shiki-CIBQys54.d.ts.map +0 -1
- package/dist/source/client/index.d.ts.map +0 -1
- package/dist/source/client/index.js.map +0 -1
- package/dist/source/index.js.map +0 -1
- package/dist/source/plugins/lucide-icons.d.ts.map +0 -1
- package/dist/source/plugins/lucide-icons.js.map +0 -1
- package/dist/source/plugins/slugs.js.map +0 -1
- package/dist/source/schema.d.ts.map +0 -1
- package/dist/source/schema.js.map +0 -1
- package/dist/static-Dq8pA8Ay.js.map +0 -1
- package/dist/toc.d.ts.map +0 -1
- package/dist/toc.js.map +0 -1
- package/dist/util-CK2ykiif.d.ts.map +0 -1
- package/dist/util-s9piKHsk.js.map +0 -1
- package/dist/utils/use-effect-event.d.ts +0 -11
- package/dist/utils/use-effect-event.d.ts.map +0 -1
- package/dist/utils/use-effect-event.js +0 -19
- package/dist/utils/use-effect-event.js.map +0 -1
- package/dist/utils/use-media-query.d.ts.map +0 -1
- package/dist/utils/use-media-query.js.map +0 -1
- package/dist/utils/use-on-change.d.ts.map +0 -1
- package/dist/utils/use-on-change.js.map +0 -1
- package/dist/utils-DUvi2WkD.js.map +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import "../../definitions-
|
|
2
|
-
import
|
|
1
|
+
import "../../definitions-DSNTbAwC.js";
|
|
2
|
+
import "../../utils-IgHyYnrz.js";
|
|
3
|
+
import { s as LoaderPlugin } from "../../path-B77y3W0_.js";
|
|
4
|
+
import "../index.js";
|
|
3
5
|
import { icons } from "lucide-react";
|
|
4
6
|
|
|
5
7
|
//#region src/source/plugins/lucide-icons.d.ts
|
|
@@ -10,5 +12,4 @@ declare function lucideIconsPlugin(options?: {
|
|
|
10
12
|
defaultIcon?: keyof typeof icons;
|
|
11
13
|
}): LoaderPlugin;
|
|
12
14
|
//#endregion
|
|
13
|
-
export { lucideIconsPlugin };
|
|
14
|
-
//# sourceMappingURL=lucide-icons.d.ts.map
|
|
15
|
+
export { lucideIconsPlugin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as iconPlugin } from "../../icon-
|
|
1
|
+
import { t as iconPlugin } from "../../icon-OtPFhyk1.js";
|
|
2
2
|
import { createElement } from "react";
|
|
3
3
|
import { icons } from "lucide-react";
|
|
4
4
|
|
|
@@ -20,5 +20,4 @@ function lucideIconsPlugin(options = {}) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
//#endregion
|
|
23
|
-
export { lucideIconsPlugin };
|
|
24
|
-
//# sourceMappingURL=lucide-icons.js.map
|
|
23
|
+
export { lucideIconsPlugin };
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
import "../../definitions-
|
|
2
|
-
import
|
|
1
|
+
import "../../definitions-DSNTbAwC.js";
|
|
2
|
+
import "../../utils-IgHyYnrz.js";
|
|
3
|
+
import { i as LoaderConfig, s as LoaderPlugin, x as ContentStoragePageFile } from "../../path-B77y3W0_.js";
|
|
4
|
+
|
|
5
|
+
//#region src/source/plugins/slugs.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* a function to generate slugs, return `undefined` to fallback to default generation.
|
|
8
|
+
*/
|
|
9
|
+
type SlugFn<Config extends LoaderConfig = LoaderConfig> = (file: ContentStoragePageFile<Config['source']>) => string[] | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Generate slugs for pages if missing
|
|
12
|
+
*/
|
|
13
|
+
declare function slugsPlugin<Config extends LoaderConfig = LoaderConfig>(slugFn?: SlugFn<Config>): LoaderPlugin<Config>;
|
|
14
|
+
/**
|
|
15
|
+
* Generate slugs from file data (e.g. frontmatter).
|
|
16
|
+
*
|
|
17
|
+
* @param key - the property name in file data to generate slugs, default to `slug`.
|
|
18
|
+
*/
|
|
19
|
+
declare function slugsFromData<Config extends LoaderConfig = LoaderConfig>(key?: string): SlugFn<Config>;
|
|
20
|
+
/**
|
|
21
|
+
* Convert file path into slugs, also encode non-ASCII characters, so they can work in pathname
|
|
22
|
+
*/
|
|
23
|
+
declare function getSlugs(file: string): string[];
|
|
24
|
+
//#endregion
|
|
3
25
|
export { SlugFn, getSlugs, slugsFromData, slugsPlugin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as dirname, r as extname, t as basename } from "../../path-
|
|
1
|
+
import { n as dirname, r as extname, t as basename } from "../../path-D0Bwm6Fs.js";
|
|
2
2
|
|
|
3
3
|
//#region src/source/plugins/slugs.ts
|
|
4
4
|
/**
|
|
@@ -61,5 +61,4 @@ function getSlugs(file) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
//#endregion
|
|
64
|
-
export { getSlugs, slugsFromData, slugsPlugin };
|
|
65
|
-
//# sourceMappingURL=slugs.js.map
|
|
64
|
+
export { getSlugs, slugsFromData, slugsPlugin };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-DSNTbAwC.js";
|
|
2
|
+
import "../../utils-IgHyYnrz.js";
|
|
3
|
+
import { s as LoaderPlugin } from "../../path-B77y3W0_.js";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/source/plugins/status-badges.d.ts
|
|
7
|
+
interface Item extends Item$1 {
|
|
8
|
+
/**
|
|
9
|
+
* Status badge to display in the sidebar (e.g., "new", "beta", "deprecated", "experimental").
|
|
10
|
+
*/
|
|
11
|
+
status?: string;
|
|
12
|
+
}
|
|
13
|
+
interface Folder extends Omit<Folder$1, 'children' | 'index'> {
|
|
14
|
+
index?: Item;
|
|
15
|
+
children: Node[];
|
|
16
|
+
}
|
|
17
|
+
type Separator = Separator$1;
|
|
18
|
+
type Node = Item | Folder | Separator;
|
|
19
|
+
/**
|
|
20
|
+
* Plugin to add status badges to pages in the sidebar.
|
|
21
|
+
*
|
|
22
|
+
* This reads the `status` field from page frontmatter and adds it to the page tree item.
|
|
23
|
+
* Define the `renderBadge` option to render it.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* import { loader } from '@hanzo/docs-core/source';
|
|
28
|
+
* import { statusBadgesPlugin } from '@hanzo/docs-core/source/status-badges';
|
|
29
|
+
*
|
|
30
|
+
* export const source = loader({
|
|
31
|
+
* plugins: [
|
|
32
|
+
* statusBadgesPlugin({
|
|
33
|
+
* renderBadge: (status) => <span>{status}</span>,
|
|
34
|
+
* }),
|
|
35
|
+
* ],
|
|
36
|
+
* // ...
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* Then in your frontmatter:
|
|
41
|
+
* ```yaml
|
|
42
|
+
* ---
|
|
43
|
+
* title: My Page
|
|
44
|
+
* status: new
|
|
45
|
+
* ---
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare function statusBadgesPlugin(options?: {
|
|
49
|
+
renderBadge?: (status: string) => ReactNode;
|
|
50
|
+
}): LoaderPlugin;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { Folder, Item, Node, Separator, statusBadgesPlugin };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/source/plugins/status-badges.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Plugin to add status badges to pages in the sidebar.
|
|
6
|
+
*
|
|
7
|
+
* This reads the `status` field from page frontmatter and adds it to the page tree item.
|
|
8
|
+
* Define the `renderBadge` option to render it.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { loader } from '@hanzo/docs-core/source';
|
|
13
|
+
* import { statusBadgesPlugin } from '@hanzo/docs-core/source/status-badges';
|
|
14
|
+
*
|
|
15
|
+
* export const source = loader({
|
|
16
|
+
* plugins: [
|
|
17
|
+
* statusBadgesPlugin({
|
|
18
|
+
* renderBadge: (status) => <span>{status}</span>,
|
|
19
|
+
* }),
|
|
20
|
+
* ],
|
|
21
|
+
* // ...
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Then in your frontmatter:
|
|
26
|
+
* ```yaml
|
|
27
|
+
* ---
|
|
28
|
+
* title: My Page
|
|
29
|
+
* status: new
|
|
30
|
+
* ---
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function statusBadgesPlugin(options = {}) {
|
|
34
|
+
const { renderBadge = (status) => /* @__PURE__ */ jsx("span", {
|
|
35
|
+
"data-status": status,
|
|
36
|
+
children: status
|
|
37
|
+
}) } = options;
|
|
38
|
+
return {
|
|
39
|
+
name: "hanzo-docs:status-badges",
|
|
40
|
+
transformPageTree: { file(node, filePath) {
|
|
41
|
+
if (!filePath) return node;
|
|
42
|
+
const file = this.storage.read(filePath);
|
|
43
|
+
if (file?.format === "page" && "status" in file.data && typeof file.data.status === "string") {
|
|
44
|
+
const status = file.data.status;
|
|
45
|
+
node.name = /* @__PURE__ */ jsxs(Fragment, { children: [node.name, renderBadge(status)] });
|
|
46
|
+
node.status = status;
|
|
47
|
+
}
|
|
48
|
+
return node;
|
|
49
|
+
} }
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { statusBadgesPlugin };
|
package/dist/source/schema.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
//#region src/source/schema.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Zod 4 schema
|
|
7
6
|
*/
|
|
@@ -25,5 +24,4 @@ declare const pageSchema: z.ZodObject<{
|
|
|
25
24
|
_openapi: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
26
25
|
}, z.core.$strip>;
|
|
27
26
|
//#endregion
|
|
28
|
-
export { metaSchema, pageSchema };
|
|
29
|
-
//# sourceMappingURL=schema.d.ts.map
|
|
27
|
+
export { metaSchema, pageSchema };
|
package/dist/source/schema.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as searchSimple, t as searchAdvanced } from "./advanced-
|
|
1
|
+
import { n as searchSimple, t as searchAdvanced } from "./advanced-BH0syJ-M.js";
|
|
2
2
|
import { create, load } from "@orama/orama";
|
|
3
3
|
|
|
4
4
|
//#region src/search/client/static.ts
|
|
@@ -17,11 +17,11 @@ async function loadDB({ from = "/api/search", initOrama = (locale) => create({
|
|
|
17
17
|
const dbs = /* @__PURE__ */ new Map();
|
|
18
18
|
if (data.type === "i18n") {
|
|
19
19
|
await Promise.all(Object.entries(data.data).map(async ([k, v]) => {
|
|
20
|
-
const db
|
|
21
|
-
load(db
|
|
20
|
+
const db = await initOrama(k);
|
|
21
|
+
load(db, v);
|
|
22
22
|
dbs.set(k, {
|
|
23
23
|
type: v.type,
|
|
24
|
-
db
|
|
24
|
+
db
|
|
25
25
|
});
|
|
26
26
|
}));
|
|
27
27
|
return dbs;
|
|
@@ -47,5 +47,4 @@ async function search(query, options) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
//#endregion
|
|
50
|
-
export { search };
|
|
51
|
-
//# sourceMappingURL=static-Dq8pA8Ay.js.map
|
|
50
|
+
export { search };
|
package/dist/toc.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode, RefObject } from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/toc.d.ts
|
|
5
5
|
interface TOCItemType {
|
|
@@ -36,12 +36,12 @@ interface ScrollProviderProps {
|
|
|
36
36
|
declare function ScrollProvider({
|
|
37
37
|
containerRef,
|
|
38
38
|
children
|
|
39
|
-
}: ScrollProviderProps):
|
|
39
|
+
}: ScrollProviderProps): react_jsx_runtime0.JSX.Element;
|
|
40
40
|
declare function AnchorProvider({
|
|
41
41
|
toc,
|
|
42
42
|
single,
|
|
43
43
|
children
|
|
44
|
-
}: AnchorProviderProps):
|
|
44
|
+
}: AnchorProviderProps): react_jsx_runtime0.JSX.Element;
|
|
45
45
|
interface TOCItemProps extends Omit<ComponentProps<'a'>, 'href'> {
|
|
46
46
|
href: string;
|
|
47
47
|
onActiveChange?: (v: boolean) => void;
|
|
@@ -50,7 +50,6 @@ declare function TOCItem({
|
|
|
50
50
|
ref,
|
|
51
51
|
onActiveChange,
|
|
52
52
|
...props
|
|
53
|
-
}: TOCItemProps):
|
|
53
|
+
}: TOCItemProps): react_jsx_runtime0.JSX.Element;
|
|
54
54
|
//#endregion
|
|
55
|
-
export { AnchorProvider, AnchorProviderProps, ScrollProvider, ScrollProviderProps, TOCItem, TOCItemProps, TOCItemType, TableOfContents, useActiveAnchor, useActiveAnchors };
|
|
56
|
-
//# sourceMappingURL=toc.d.ts.map
|
|
55
|
+
export { AnchorProvider, AnchorProviderProps, ScrollProvider, ScrollProviderProps, TOCItem, TOCItemProps, TOCItemType, TableOfContents, useActiveAnchor, useActiveAnchors };
|
package/dist/toc.js
CHANGED
|
@@ -134,5 +134,4 @@ function useAnchorObserver(watch, single) {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
//#endregion
|
|
137
|
-
export { AnchorProvider, ScrollProvider, TOCItem, useActiveAnchor, useActiveAnchors };
|
|
138
|
-
//# sourceMappingURL=toc.js.map
|
|
137
|
+
export { AnchorProvider, ScrollProvider, TOCItem, useActiveAnchor, useActiveAnchors };
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { n as getHighlighter, t as defaultThemes } from "./shiki-4oMYwHED.js";
|
|
2
|
-
import { parseCodeBlockAttributes } from "./mdx-plugins/codeblock-utils.js";
|
|
3
|
-
import rehypeShikiFromHighlighter from "@shikijs/rehype/core";
|
|
4
|
-
import { transformerNotationDiff, transformerNotationFocus, transformerNotationHighlight, transformerNotationWordHighlight } from "@shikijs/transformers";
|
|
5
|
-
import { bundledLanguages } from "shiki";
|
|
6
|
-
|
|
7
1
|
//#region src/mdx-plugins/transformer-icon.ts
|
|
8
2
|
const defaultShortcuts = {
|
|
9
3
|
js: "javascript",
|
|
@@ -149,93 +143,4 @@ function transformerIcon(options = {}) {
|
|
|
149
143
|
}
|
|
150
144
|
|
|
151
145
|
//#endregion
|
|
152
|
-
|
|
153
|
-
const rehypeCodeDefaultOptions = {
|
|
154
|
-
lazy: true,
|
|
155
|
-
themes: defaultThemes,
|
|
156
|
-
defaultColor: false,
|
|
157
|
-
defaultLanguage: "plaintext",
|
|
158
|
-
engine: "js",
|
|
159
|
-
transformers: [
|
|
160
|
-
transformerNotationHighlight({ matchAlgorithm: "v3" }),
|
|
161
|
-
transformerNotationWordHighlight({ matchAlgorithm: "v3" }),
|
|
162
|
-
transformerNotationDiff({ matchAlgorithm: "v3" }),
|
|
163
|
-
transformerNotationFocus({ matchAlgorithm: "v3" })
|
|
164
|
-
],
|
|
165
|
-
parseMetaString(meta) {
|
|
166
|
-
const parsed = parseCodeBlockAttributes(meta, ["title", "tab"]);
|
|
167
|
-
const data = parsed.attributes;
|
|
168
|
-
parsed.rest = parseLineNumber(parsed.rest, data);
|
|
169
|
-
data.__parsed_raw = parsed.rest;
|
|
170
|
-
return data;
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
function parseLineNumber(str, data) {
|
|
174
|
-
return str.replace(/lineNumbers=(\d+)|lineNumbers/, (_, ...args) => {
|
|
175
|
-
data["data-line-numbers"] = true;
|
|
176
|
-
if (args[0] !== void 0) data["data-line-numbers-start"] = Number(args[0]);
|
|
177
|
-
return "";
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Handle codeblocks
|
|
182
|
-
*/
|
|
183
|
-
function rehypeCode(_options = {}) {
|
|
184
|
-
const options = {
|
|
185
|
-
...rehypeCodeDefaultOptions,
|
|
186
|
-
..._options
|
|
187
|
-
};
|
|
188
|
-
const transformers = [...options.transformers ?? []];
|
|
189
|
-
transformers.unshift({
|
|
190
|
-
name: "rehype-code:pre-process",
|
|
191
|
-
preprocess(code, { meta }) {
|
|
192
|
-
if (meta && "__parsed_raw" in meta) {
|
|
193
|
-
meta.__raw = meta.__parsed_raw;
|
|
194
|
-
delete meta.__parsed_raw;
|
|
195
|
-
}
|
|
196
|
-
if (meta && options.filterMetaString) meta.__raw = options.filterMetaString(meta.__raw ?? "");
|
|
197
|
-
return code.replace(/\n$/, "");
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
if (options.icon !== false) transformers.push(transformerIcon(options.icon));
|
|
201
|
-
if (options.tab !== false) transformers.push(transformerTab());
|
|
202
|
-
const transformer = getHighlighter(options.engine ?? "js", {
|
|
203
|
-
themes: "themes" in options ? Object.values(options.themes).filter(Boolean) : [options.theme],
|
|
204
|
-
langs: options.langs ?? (options.lazy ? ["ts", "tsx"] : Object.keys(bundledLanguages)),
|
|
205
|
-
langAlias: options.langAlias
|
|
206
|
-
}).then((loaded) => rehypeShikiFromHighlighter(loaded, {
|
|
207
|
-
...options,
|
|
208
|
-
transformers
|
|
209
|
-
}));
|
|
210
|
-
return async (tree, file) => {
|
|
211
|
-
await (await transformer)(tree, file, () => {});
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
function transformerTab() {
|
|
215
|
-
return {
|
|
216
|
-
name: "rehype-code:tab",
|
|
217
|
-
root(root) {
|
|
218
|
-
const value = this.options.meta?.tab;
|
|
219
|
-
if (typeof value !== "string") return root;
|
|
220
|
-
console.warn("[Fumadocs] For `tab=\"value\" in codeblocks, please use `remarkCodeTab` plugin instead.");
|
|
221
|
-
return {
|
|
222
|
-
type: "root",
|
|
223
|
-
children: [{
|
|
224
|
-
type: "mdxJsxFlowElement",
|
|
225
|
-
name: "Tab",
|
|
226
|
-
data: { _codeblock: true },
|
|
227
|
-
attributes: [{
|
|
228
|
-
type: "mdxJsxAttribute",
|
|
229
|
-
name: "value",
|
|
230
|
-
value
|
|
231
|
-
}],
|
|
232
|
-
children: root.children
|
|
233
|
-
}]
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
//#endregion
|
|
240
|
-
export { transformerIcon as i, rehypeCodeDefaultOptions as n, transformerTab as r, rehypeCode as t };
|
|
241
|
-
//# sourceMappingURL=rehype-code-CdiZ1Y6P.js.map
|
|
146
|
+
export { transformerIcon as t };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ShikiTransformer } from "shiki";
|
|
2
|
+
|
|
3
|
+
//#region src/mdx-plugins/transformer-icon.d.ts
|
|
4
|
+
type CodeBlockIcon = {
|
|
5
|
+
viewBox: string;
|
|
6
|
+
fill: string;
|
|
7
|
+
d: string;
|
|
8
|
+
} | string;
|
|
9
|
+
interface IconOptions {
|
|
10
|
+
shortcuts?: Record<string, string>;
|
|
11
|
+
extend?: Record<string, CodeBlockIcon>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Inject icons to `icon` property (as HTML)
|
|
15
|
+
*/
|
|
16
|
+
declare function transformerIcon(options?: IconOptions): ShikiTransformer;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { IconOptions as n, transformerIcon as r, CodeBlockIcon as t };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
3
|
+
type Awaitable<T> = T | PromiseLike<T>;
|
|
4
|
+
type MakeOptional<T, K extends keyof T> = T extends unknown ? Partial<Pick<T, K>> & Omit<T, K> : never;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { DistributiveOmit as n, MakeOptional as r, Awaitable as t };
|
|
@@ -4,5 +4,4 @@ import { Pluggable } from "unified";
|
|
|
4
4
|
type Thenable<T> = T | PromiseLike<T>;
|
|
5
5
|
type ResolvePlugins = Thenable<Pluggable>[] | ((v: Pluggable[]) => Thenable<Pluggable>[]);
|
|
6
6
|
//#endregion
|
|
7
|
-
export { ResolvePlugins as t };
|
|
8
|
-
//# sourceMappingURL=util-CK2ykiif.d.ts.map
|
|
7
|
+
export { ResolvePlugins as t };
|
|
@@ -39,7 +39,9 @@ function getPageTreeRoots(pageTree) {
|
|
|
39
39
|
return result;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* Get other
|
|
42
|
+
* Get other **page** nodes that lives under the same parent.
|
|
43
|
+
*
|
|
44
|
+
* note: folders & its index nodes are not considered, use `findSiblings()` for more control.
|
|
43
45
|
*/
|
|
44
46
|
function getPageTreePeers(treeOrTrees, url) {
|
|
45
47
|
return findSiblings(treeOrTrees, url).filter((item) => item.type === "page");
|
|
@@ -54,8 +56,8 @@ function findSiblings(treeOrTrees, url) {
|
|
|
54
56
|
return parent.children.filter((item) => item.type !== "page" || item.url !== url);
|
|
55
57
|
}
|
|
56
58
|
for (const lang in treeOrTrees) {
|
|
57
|
-
const result =
|
|
58
|
-
if (result) return result;
|
|
59
|
+
const result = findSiblings(treeOrTrees[lang], url);
|
|
60
|
+
if (result.length > 0) return result;
|
|
59
61
|
}
|
|
60
62
|
return [];
|
|
61
63
|
}
|
|
@@ -76,9 +78,9 @@ function findParent(from, url) {
|
|
|
76
78
|
*/
|
|
77
79
|
function findPath(nodes, matcher, options = {}) {
|
|
78
80
|
const { includeSeparator = true } = options;
|
|
79
|
-
function run(nodes
|
|
81
|
+
function run(nodes) {
|
|
80
82
|
let separator;
|
|
81
|
-
for (const node of nodes
|
|
83
|
+
for (const node of nodes) {
|
|
82
84
|
if (matcher(node)) {
|
|
83
85
|
const items = [];
|
|
84
86
|
if (separator) items.push(separator);
|
|
@@ -130,5 +132,4 @@ function visit(root, visitor) {
|
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
//#endregion
|
|
133
|
-
export { flattenTree as a, visit as c, findSiblings as i, findParent as n, getPageTreePeers as o, findPath as r, getPageTreeRoots as s, findNeighbour as t };
|
|
134
|
-
//# sourceMappingURL=utils-DUvi2WkD.js.map
|
|
135
|
+
export { flattenTree as a, visit as c, findSiblings as i, findParent as n, getPageTreePeers as o, findPath as r, getPageTreeRoots as s, findNeighbour as t };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { i as Root, n as Item, r as Node, t as Folder } from "./definitions-DSNTbAwC.js";
|
|
2
|
+
|
|
3
|
+
//#region src/page-tree/utils.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Flatten tree to an array of page nodes
|
|
6
|
+
*/
|
|
7
|
+
declare function flattenTree(nodes: Node[]): Item[];
|
|
8
|
+
/**
|
|
9
|
+
* Get neighbours of a page, useful for implementing "previous & next" buttons
|
|
10
|
+
*/
|
|
11
|
+
declare function findNeighbour(tree: Root, url: string, options?: {
|
|
12
|
+
separateRoot?: boolean;
|
|
13
|
+
}): {
|
|
14
|
+
previous?: Item;
|
|
15
|
+
next?: Item;
|
|
16
|
+
};
|
|
17
|
+
declare function getPageTreeRoots(pageTree: Root | Folder): (Root | Folder)[];
|
|
18
|
+
/**
|
|
19
|
+
* Get other **page** nodes that lives under the same parent.
|
|
20
|
+
*
|
|
21
|
+
* note: folders & its index nodes are not considered, use `findSiblings()` for more control.
|
|
22
|
+
*/
|
|
23
|
+
declare function getPageTreePeers(treeOrTrees: Root | Record<string, Root>, url: string): Item[];
|
|
24
|
+
/**
|
|
25
|
+
* Get other tree nodes that lives under the same parent.
|
|
26
|
+
*/
|
|
27
|
+
declare function findSiblings(treeOrTrees: Root | Record<string, Root>, url: string): Node[];
|
|
28
|
+
declare function findParent(from: Root | Folder, url: string): Root | Folder | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Search the path of a node in the tree matched by the matcher.
|
|
31
|
+
*
|
|
32
|
+
* @returns The path to the target node (from starting root), or null if the page doesn't exist
|
|
33
|
+
*/
|
|
34
|
+
declare function findPath(nodes: Node[], matcher: (node: Node) => boolean, options?: {
|
|
35
|
+
includeSeparator?: boolean;
|
|
36
|
+
}): Node[] | null;
|
|
37
|
+
/**
|
|
38
|
+
* Perform a depth-first search on page tree visiting every node.
|
|
39
|
+
*
|
|
40
|
+
* @param root - the root of page tree to visit.
|
|
41
|
+
* @param visitor - function to receive nodes, return `skip` to skip the children of current node, `break` to stop the search entirely.
|
|
42
|
+
*/
|
|
43
|
+
declare function visit<Root$1 extends Node | Root>(root: Root$1, visitor: <T extends Node | Root>(node: T, parent?: Root | Folder) => 'skip' | 'break' | T | void): Root$1;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { flattenTree as a, visit as c, findSiblings as i, findParent as n, getPageTreePeers as o, findPath as r, getPageTreeRoots as s, findNeighbour as t };
|