@hanzo/docs-core 16.5.0 → 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.
Files changed (262) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -3
  3. package/dist/{advanced-BRT5Ij43.js → advanced-BH0syJ-M.js} +3 -4
  4. package/dist/{algolia-CQPXCnjV.js → algolia-C7Crg8-5.js} +2 -3
  5. package/dist/breadcrumb.d.ts +2 -3
  6. package/dist/breadcrumb.js +3 -4
  7. package/dist/{chunk-B-ezknvj.js → chunk-CaR5F9JI.js} +3 -3
  8. package/dist/content/github.d.ts +1 -2
  9. package/dist/content/github.js +1 -2
  10. package/dist/content/index.d.ts +3 -4
  11. package/dist/content/index.js +1 -2
  12. package/dist/content/mdx/preset-bundler.d.ts +9 -10
  13. package/dist/content/mdx/preset-bundler.js +2 -3
  14. package/dist/content/mdx/preset-runtime.d.ts +9 -10
  15. package/dist/content/mdx/preset-runtime.js +2 -3
  16. package/dist/content/toc.d.ts +1 -3
  17. package/dist/content/toc.js +4 -5
  18. package/dist/create-i18n-Cv3Cocbs.d.ts +51 -0
  19. package/dist/{definitions-DuxDer_c.d.ts → definitions-DSNTbAwC.d.ts} +1 -2
  20. package/dist/dynamic-link.d.ts +3 -4
  21. package/dist/dynamic-link.js +1 -3
  22. package/dist/{fetch-B5e9CFfN.js → fetch-HotVeLLF.js} +1 -2
  23. package/dist/framework/index.d.ts +5 -6
  24. package/dist/framework/index.js +18 -19
  25. package/dist/framework/next.d.ts +3 -4
  26. package/dist/framework/next.js +1 -2
  27. package/dist/framework/react-router.d.ts +3 -4
  28. package/dist/framework/react-router.js +1 -2
  29. package/dist/framework/tanstack.d.ts +3 -4
  30. package/dist/framework/tanstack.js +1 -2
  31. package/dist/framework/waku.d.ts +3 -4
  32. package/dist/framework/waku.js +1 -2
  33. package/dist/hast-utils-BmGqqmvo.js +15 -0
  34. package/dist/highlight/client.d.ts +2 -4
  35. package/dist/highlight/client.js +7 -13
  36. package/dist/highlight/config.d.ts +15 -0
  37. package/dist/highlight/config.js +18 -0
  38. package/dist/highlight/core/client.d.ts +31 -0
  39. package/dist/highlight/core/client.js +68 -0
  40. package/dist/highlight/core/index.d.ts +27 -0
  41. package/dist/highlight/core/index.js +69 -0
  42. package/dist/highlight/index.d.ts +34 -2
  43. package/dist/highlight/index.js +57 -2
  44. package/dist/i18n/index.d.ts +39 -1
  45. package/dist/i18n/index.js +1 -2
  46. package/dist/i18n/middleware.d.ts +2 -3
  47. package/dist/i18n/middleware.js +1 -2
  48. package/dist/{icon-BWwSDabM.js → icon-OtPFhyk1.js} +1 -2
  49. package/dist/link.d.ts +3 -4
  50. package/dist/link.js +1 -2
  51. package/dist/{mdast-utils-mc9-X-PK.js → mdast-utils-gJMY143g.js} +1 -2
  52. package/dist/mdx-plugins/codeblock-utils.d.ts +35 -1
  53. package/dist/mdx-plugins/codeblock-utils.js +1 -2
  54. package/dist/mdx-plugins/index.d.ts +18 -15
  55. package/dist/mdx-plugins/index.js +7 -5
  56. package/dist/mdx-plugins/rehype-code.core.d.ts +38 -0
  57. package/dist/mdx-plugins/rehype-code.core.js +104 -0
  58. package/dist/mdx-plugins/rehype-code.d.ts +18 -2
  59. package/dist/mdx-plugins/rehype-code.js +24 -3
  60. package/dist/mdx-plugins/rehype-toc.d.ts +16 -1
  61. package/dist/mdx-plugins/rehype-toc.js +127 -1
  62. package/dist/mdx-plugins/remark-admonition.d.ts +20 -1
  63. package/dist/mdx-plugins/remark-admonition.js +2 -3
  64. package/dist/mdx-plugins/remark-code-tab.d.ts +30 -1
  65. package/dist/mdx-plugins/remark-code-tab.js +4 -5
  66. package/dist/mdx-plugins/remark-directive-admonition.d.ts +34 -1
  67. package/dist/mdx-plugins/remark-directive-admonition.js +1 -2
  68. package/dist/mdx-plugins/remark-feedback-block.d.ts +51 -0
  69. package/dist/mdx-plugins/remark-feedback-block.js +47 -0
  70. package/dist/mdx-plugins/remark-gfm.d.ts +2 -2
  71. package/dist/mdx-plugins/remark-heading.d.ts +35 -1
  72. package/dist/mdx-plugins/remark-heading.js +2 -3
  73. package/dist/mdx-plugins/remark-image.d.ts +63 -1
  74. package/dist/mdx-plugins/remark-image.js +1 -2
  75. package/dist/mdx-plugins/remark-mdx-files.d.ts +55 -2
  76. package/dist/mdx-plugins/remark-mdx-files.js +103 -13
  77. package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +15 -1
  78. package/dist/mdx-plugins/remark-mdx-mermaid.js +1 -2
  79. package/dist/mdx-plugins/remark-npm.d.ts +34 -1
  80. package/dist/mdx-plugins/remark-npm.js +1 -2
  81. package/dist/mdx-plugins/remark-steps.d.ts +26 -1
  82. package/dist/mdx-plugins/remark-steps.js +1 -2
  83. package/dist/mdx-plugins/remark-structure.d.ts +75 -1
  84. package/dist/mdx-plugins/remark-structure.js +7 -8
  85. package/dist/{mixedbread-DlByNYSd.js → mixedbread-Bx9drx9S.js} +6 -5
  86. package/dist/negotiation/index.d.ts +1 -2
  87. package/dist/negotiation/index.js +1 -2
  88. package/dist/{normalize-url-ChLsV26G.js → normalize-url-DUHbcuVM.js} +1 -2
  89. package/dist/{orama-cloud-DH3g37zc.js → orama-cloud-ByznDyOk.js} +6 -7
  90. package/dist/orama-cloud-legacy-BbgJnf5f.js +81 -0
  91. package/dist/page-tree/index.d.ts +3 -45
  92. package/dist/page-tree/index.js +1 -1
  93. package/dist/{index-2U6Tl4--.d.ts → path-B77y3W0_.d.ts} +111 -98
  94. package/dist/{path-DHIjrDBP.js → path-D0Bwm6Fs.js} +2 -3
  95. package/dist/{remove-undefined-Cfs4o_mM.js → remove-undefined-CJm9cyrC.js} +1 -2
  96. package/dist/search/algolia.d.ts +66 -2
  97. package/dist/search/algolia.js +1 -2
  98. package/dist/search/client.d.ts +30 -7
  99. package/dist/search/client.js +27 -22
  100. package/dist/search/index.d.ts +1 -2
  101. package/dist/search/index.js +41 -1
  102. package/dist/search/orama-cloud-legacy.d.ts +77 -0
  103. package/dist/search/orama-cloud-legacy.js +49 -0
  104. package/dist/search/orama-cloud.d.ts +5 -9
  105. package/dist/search/orama-cloud.js +1 -2
  106. package/dist/search/server.d.ts +87 -4
  107. package/dist/search/server.js +7 -8
  108. package/dist/source/client/index.d.ts +13 -11
  109. package/dist/source/client/index.js +22 -13
  110. package/dist/source/index.d.ts +5 -3
  111. package/dist/source/index.js +428 -333
  112. package/dist/source/plugins/lucide-icons.d.ts +5 -4
  113. package/dist/source/plugins/lucide-icons.js +2 -3
  114. package/dist/source/plugins/slugs.d.ts +24 -2
  115. package/dist/source/plugins/slugs.js +2 -3
  116. package/dist/source/plugins/status-badges.d.ts +52 -0
  117. package/dist/source/plugins/status-badges.js +54 -0
  118. package/dist/source/schema.d.ts +1 -3
  119. package/dist/source/schema.js +1 -2
  120. package/dist/{static-Dq8pA8Ay.js → static-DTxK4eHk.js} +5 -6
  121. package/dist/toc.d.ts +1 -2
  122. package/dist/toc.js +1 -2
  123. package/dist/{rehype-code-sM9Tq-r7.js → transformer-icon-BYedaeE8.js} +1 -96
  124. package/dist/transformer-icon-D7-6aFzt.d.ts +18 -0
  125. package/dist/types-BSnJn7kF.d.ts +6 -0
  126. package/dist/{util-CK2ykiif.d.ts → util-C60LmklF.d.ts} +1 -2
  127. package/dist/{util-s9piKHsk.js → util-De0ALHOx.js} +1 -2
  128. package/dist/utils/use-media-query.d.ts +1 -2
  129. package/dist/utils/use-media-query.js +1 -2
  130. package/dist/utils/use-on-change.d.ts +1 -2
  131. package/dist/utils/use-on-change.js +1 -2
  132. package/dist/{utils-DUvi2WkD.js → utils-Bc53B3CJ.js} +8 -7
  133. package/dist/utils-IgHyYnrz.d.ts +45 -0
  134. package/package.json +68 -38
  135. package/dist/advanced-BRT5Ij43.js.map +0 -1
  136. package/dist/algolia-CQPXCnjV.js.map +0 -1
  137. package/dist/algolia-Cc1y6qWl.d.ts +0 -68
  138. package/dist/algolia-Cc1y6qWl.d.ts.map +0 -1
  139. package/dist/breadcrumb.d.ts.map +0 -1
  140. package/dist/breadcrumb.js.map +0 -1
  141. package/dist/codeblock-utils-DDnYb8gi.d.ts +0 -37
  142. package/dist/codeblock-utils-DDnYb8gi.d.ts.map +0 -1
  143. package/dist/content/github.d.ts.map +0 -1
  144. package/dist/content/github.js.map +0 -1
  145. package/dist/content/index.d.ts.map +0 -1
  146. package/dist/content/index.js.map +0 -1
  147. package/dist/content/mdx/preset-bundler.d.ts.map +0 -1
  148. package/dist/content/mdx/preset-bundler.js.map +0 -1
  149. package/dist/content/mdx/preset-runtime.d.ts.map +0 -1
  150. package/dist/content/mdx/preset-runtime.js.map +0 -1
  151. package/dist/content/toc.d.ts.map +0 -1
  152. package/dist/content/toc.js.map +0 -1
  153. package/dist/definitions-DuxDer_c.d.ts.map +0 -1
  154. package/dist/dynamic-link.d.ts.map +0 -1
  155. package/dist/dynamic-link.js.map +0 -1
  156. package/dist/fetch-B5e9CFfN.js.map +0 -1
  157. package/dist/framework/index.d.ts.map +0 -1
  158. package/dist/framework/index.js.map +0 -1
  159. package/dist/framework/next.d.ts.map +0 -1
  160. package/dist/framework/next.js.map +0 -1
  161. package/dist/framework/react-router.d.ts.map +0 -1
  162. package/dist/framework/react-router.js.map +0 -1
  163. package/dist/framework/tanstack.d.ts.map +0 -1
  164. package/dist/framework/tanstack.js.map +0 -1
  165. package/dist/framework/waku.d.ts.map +0 -1
  166. package/dist/framework/waku.js.map +0 -1
  167. package/dist/highlight/client.d.ts.map +0 -1
  168. package/dist/highlight/client.js.map +0 -1
  169. package/dist/i18n/index.js.map +0 -1
  170. package/dist/i18n/middleware.d.ts.map +0 -1
  171. package/dist/i18n/middleware.js.map +0 -1
  172. package/dist/icon-BWwSDabM.js.map +0 -1
  173. package/dist/index-2U6Tl4--.d.ts.map +0 -1
  174. package/dist/index-Bw-DCOra.d.ts +0 -41
  175. package/dist/index-Bw-DCOra.d.ts.map +0 -1
  176. package/dist/link.d.ts.map +0 -1
  177. package/dist/link.js.map +0 -1
  178. package/dist/mdast-utils-mc9-X-PK.js.map +0 -1
  179. package/dist/mdx-plugins/codeblock-utils.js.map +0 -1
  180. package/dist/mdx-plugins/remark-admonition.js.map +0 -1
  181. package/dist/mdx-plugins/remark-code-tab.js.map +0 -1
  182. package/dist/mdx-plugins/remark-directive-admonition.js.map +0 -1
  183. package/dist/mdx-plugins/remark-heading.js.map +0 -1
  184. package/dist/mdx-plugins/remark-image.js.map +0 -1
  185. package/dist/mdx-plugins/remark-mdx-files.js.map +0 -1
  186. package/dist/mdx-plugins/remark-mdx-mermaid.js.map +0 -1
  187. package/dist/mdx-plugins/remark-npm.js.map +0 -1
  188. package/dist/mdx-plugins/remark-steps.js.map +0 -1
  189. package/dist/mdx-plugins/remark-structure.js.map +0 -1
  190. package/dist/mixedbread-DlByNYSd.js.map +0 -1
  191. package/dist/negotiation/index.d.ts.map +0 -1
  192. package/dist/negotiation/index.js.map +0 -1
  193. package/dist/normalize-url-ChLsV26G.js.map +0 -1
  194. package/dist/orama-cloud-DH3g37zc.js.map +0 -1
  195. package/dist/page-tree/index.d.ts.map +0 -1
  196. package/dist/path-DHIjrDBP.js.map +0 -1
  197. package/dist/rehype-code-sM9Tq-r7.js.map +0 -1
  198. package/dist/rehype-code-vVWG4-ej.d.ts +0 -58
  199. package/dist/rehype-code-vVWG4-ej.d.ts.map +0 -1
  200. package/dist/rehype-toc-DJvSyE0o.d.ts +0 -18
  201. package/dist/rehype-toc-DJvSyE0o.d.ts.map +0 -1
  202. package/dist/rehype-toc-DVwJcwvA.js +0 -143
  203. package/dist/rehype-toc-DVwJcwvA.js.map +0 -1
  204. package/dist/remark-admonition-DOwBWzsH.d.ts +0 -22
  205. package/dist/remark-admonition-DOwBWzsH.d.ts.map +0 -1
  206. package/dist/remark-code-tab-CXsYlims.d.ts +0 -32
  207. package/dist/remark-code-tab-CXsYlims.d.ts.map +0 -1
  208. package/dist/remark-directive-admonition-BCm_yiU9.d.ts +0 -36
  209. package/dist/remark-directive-admonition-BCm_yiU9.d.ts.map +0 -1
  210. package/dist/remark-gfm-CeWpMwyk.d.ts +0 -2
  211. package/dist/remark-heading-CXvCY0go.d.ts +0 -37
  212. package/dist/remark-heading-CXvCY0go.d.ts.map +0 -1
  213. package/dist/remark-image-CvUis4R1.d.ts +0 -65
  214. package/dist/remark-image-CvUis4R1.d.ts.map +0 -1
  215. package/dist/remark-mdx-files-DOYafA4x.d.ts +0 -42
  216. package/dist/remark-mdx-files-DOYafA4x.d.ts.map +0 -1
  217. package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts +0 -17
  218. package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts.map +0 -1
  219. package/dist/remark-npm-Bo08HqcQ.d.ts +0 -36
  220. package/dist/remark-npm-Bo08HqcQ.d.ts.map +0 -1
  221. package/dist/remark-steps-CHJN-rtm.d.ts +0 -28
  222. package/dist/remark-steps-CHJN-rtm.d.ts.map +0 -1
  223. package/dist/remark-structure-DGuWR82i.d.ts +0 -77
  224. package/dist/remark-structure-DGuWR82i.d.ts.map +0 -1
  225. package/dist/remove-undefined-Cfs4o_mM.js.map +0 -1
  226. package/dist/search/algolia.js.map +0 -1
  227. package/dist/search/client.d.ts.map +0 -1
  228. package/dist/search/client.js.map +0 -1
  229. package/dist/search/index.d.ts.map +0 -1
  230. package/dist/search/orama-cloud.d.ts.map +0 -1
  231. package/dist/search/orama-cloud.js.map +0 -1
  232. package/dist/search/server.js.map +0 -1
  233. package/dist/search-D6ChCLhY.js +0 -44
  234. package/dist/search-D6ChCLhY.js.map +0 -1
  235. package/dist/server-DmY4lGBs.d.ts +0 -133
  236. package/dist/server-DmY4lGBs.d.ts.map +0 -1
  237. package/dist/shiki-B5wNmyIZ.js +0 -80
  238. package/dist/shiki-B5wNmyIZ.js.map +0 -1
  239. package/dist/shiki-Dq3XIYAT.d.ts +0 -33
  240. package/dist/shiki-Dq3XIYAT.d.ts.map +0 -1
  241. package/dist/source/client/index.d.ts.map +0 -1
  242. package/dist/source/client/index.js.map +0 -1
  243. package/dist/source/index.js.map +0 -1
  244. package/dist/source/plugins/lucide-icons.d.ts.map +0 -1
  245. package/dist/source/plugins/lucide-icons.js.map +0 -1
  246. package/dist/source/plugins/slugs.js.map +0 -1
  247. package/dist/source/schema.d.ts.map +0 -1
  248. package/dist/source/schema.js.map +0 -1
  249. package/dist/static-Dq8pA8Ay.js.map +0 -1
  250. package/dist/toc.d.ts.map +0 -1
  251. package/dist/toc.js.map +0 -1
  252. package/dist/util-CK2ykiif.d.ts.map +0 -1
  253. package/dist/util-s9piKHsk.js.map +0 -1
  254. package/dist/utils/use-effect-event.d.ts +0 -11
  255. package/dist/utils/use-effect-event.d.ts.map +0 -1
  256. package/dist/utils/use-effect-event.js +0 -19
  257. package/dist/utils/use-effect-event.js.map +0 -1
  258. package/dist/utils/use-media-query.d.ts.map +0 -1
  259. package/dist/utils/use-media-query.js.map +0 -1
  260. package/dist/utils/use-on-change.d.ts.map +0 -1
  261. package/dist/utils/use-on-change.js.map +0 -1
  262. package/dist/utils-DUvi2WkD.js.map +0 -1
@@ -1,5 +1,7 @@
1
- import "../../definitions-DuxDer_c.js";
2
- import { s as LoaderPlugin } from "../../index-2U6Tl4--.js";
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-BWwSDabM.js";
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-DuxDer_c.js";
2
- import { _ as slugsPlugin, g as slugsFromData, h as getSlugs, m as SlugFn } from "../../index-2U6Tl4--.js";
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-DHIjrDBP.js";
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 };
@@ -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 };
@@ -25,5 +25,4 @@ const pageSchema = z.object({
25
25
  });
26
26
 
27
27
  //#endregion
28
- export { metaSchema, pageSchema };
29
- //# sourceMappingURL=schema.js.map
28
+ export { metaSchema, pageSchema };
@@ -1,4 +1,4 @@
1
- import { n as searchSimple, t as searchAdvanced } from "./advanced-BRT5Ij43.js";
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$1 = await initOrama(k);
21
- load(db$1, v);
20
+ const db = await initOrama(k);
21
+ load(db, v);
22
22
  dbs.set(k, {
23
23
  type: v.type,
24
- db: db$1
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
@@ -52,5 +52,4 @@ declare function TOCItem({
52
52
  ...props
53
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-B5wNmyIZ.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
- //#region src/mdx-plugins/rehype-code.ts
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("[Hanzo Docs] 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-sM9Tq-r7.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 };
@@ -6,5 +6,4 @@ async function resolvePlugins(def, options = []) {
6
6
  }
7
7
 
8
8
  //#endregion
9
- export { resolvePlugins as t };
10
- //# sourceMappingURL=util-s9piKHsk.js.map
9
+ export { resolvePlugins as t };
@@ -1,5 +1,4 @@
1
1
  //#region src/utils/use-media-query.d.ts
2
2
  declare function useMediaQuery(query: string, disabled?: boolean): boolean | null;
3
3
  //#endregion
4
- export { useMediaQuery };
5
- //# sourceMappingURL=use-media-query.d.ts.map
4
+ export { useMediaQuery };
@@ -19,5 +19,4 @@ function useMediaQuery(query, disabled = false) {
19
19
  }
20
20
 
21
21
  //#endregion
22
- export { useMediaQuery };
23
- //# sourceMappingURL=use-media-query.js.map
22
+ export { useMediaQuery };
@@ -6,5 +6,4 @@
6
6
  */
7
7
  declare function useOnChange<T>(value: T, onChange: (current: T, previous: T) => void, isUpdated?: (prev: T, current: T) => boolean): void;
8
8
  //#endregion
9
- export { useOnChange };
10
- //# sourceMappingURL=use-on-change.d.ts.map
9
+ export { useOnChange };
@@ -19,5 +19,4 @@ function useOnChange(value, onChange, isUpdated = isDifferent) {
19
19
  }
20
20
 
21
21
  //#endregion
22
- export { useOnChange };
23
- //# sourceMappingURL=use-on-change.js.map
22
+ export { useOnChange };
@@ -39,7 +39,9 @@ function getPageTreeRoots(pageTree) {
39
39
  return result;
40
40
  }
41
41
  /**
42
- * Get other item nodes that lives under the same parent.
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 = getPageTreePeers(treeOrTrees[lang], url);
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$1) {
81
+ function run(nodes) {
80
82
  let separator;
81
- for (const node of nodes$1) {
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 };