@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
@@ -0,0 +1,77 @@
1
+ import "../transformer-icon-D7-6aFzt.js";
2
+ import { StructuredData } from "../mdx-plugins/remark-structure.js";
3
+ import "../mdx-plugins/index.js";
4
+ import { CloudManager } from "@oramacloud/client";
5
+
6
+ //#region src/search/orama-cloud-legacy.d.ts
7
+ interface SyncOptions {
8
+ /**
9
+ * Index name to sync
10
+ */
11
+ index: string;
12
+ documents: OramaDocument[];
13
+ /**
14
+ * Deploy changes
15
+ *
16
+ * @defaultValue true
17
+ */
18
+ autoDeploy?: boolean;
19
+ }
20
+ interface I18nSyncOptions extends Omit<SyncOptions, 'index' | 'documents'> {
21
+ /**
22
+ * Indexes to sync.
23
+ *
24
+ * Pairs of `locale`-`index`.
25
+ **/
26
+ indexes: Record<string, string>;
27
+ documents: {
28
+ locale: string;
29
+ items: OramaDocument[];
30
+ }[];
31
+ }
32
+ interface OramaDocument {
33
+ /**
34
+ * The ID of document, must be unique
35
+ */
36
+ id: string;
37
+ title: string;
38
+ description?: string;
39
+ /**
40
+ * URL to the page
41
+ */
42
+ url: string;
43
+ structured: StructuredData;
44
+ /**
45
+ * Tag to filter results
46
+ */
47
+ tag?: string;
48
+ /**
49
+ * Data to be added to each section index
50
+ */
51
+ extra_data?: object;
52
+ breadcrumbs?: string[];
53
+ }
54
+ interface OramaIndex {
55
+ id: string;
56
+ title: string;
57
+ url: string;
58
+ tag?: string;
59
+ /**
60
+ * The id of page, used for `group by`
61
+ */
62
+ page_id: string;
63
+ /**
64
+ * Heading content
65
+ */
66
+ section?: string;
67
+ breadcrumbs?: string[];
68
+ /**
69
+ * Heading (anchor) id
70
+ */
71
+ section_id?: string;
72
+ content: string;
73
+ }
74
+ declare function sync(cloudManager: CloudManager, options: SyncOptions): Promise<void>;
75
+ declare function syncI18n(cloudManager: CloudManager, options: I18nSyncOptions): Promise<void>;
76
+ //#endregion
77
+ export { I18nSyncOptions, OramaDocument, OramaIndex, SyncOptions, sync, syncI18n };
@@ -0,0 +1,49 @@
1
+ //#region src/search/orama-cloud-legacy.ts
2
+ async function sync(cloudManager, options) {
3
+ const { autoDeploy = true } = options;
4
+ const index = cloudManager.index(options.index);
5
+ await index.snapshot(options.documents.flatMap(toIndex));
6
+ if (autoDeploy) await index.deploy();
7
+ }
8
+ async function syncI18n(cloudManager, options) {
9
+ const { autoDeploy = true } = options;
10
+ const tasks = options.documents.map(async (document) => {
11
+ const index = cloudManager.index(options.indexes[document.locale]);
12
+ await index.snapshot(document.items.flatMap(toIndex));
13
+ if (autoDeploy) await index.deploy();
14
+ });
15
+ await Promise.all(tasks);
16
+ }
17
+ function toIndex(page) {
18
+ let id = 0;
19
+ const indexes = [];
20
+ const scannedHeadings = /* @__PURE__ */ new Set();
21
+ function createIndex(section, sectionId, content) {
22
+ return {
23
+ id: `${page.id}-${(id++).toString()}`,
24
+ title: page.title,
25
+ url: page.url,
26
+ page_id: page.id,
27
+ tag: page.tag,
28
+ section,
29
+ section_id: sectionId,
30
+ content,
31
+ breadcrumbs: page.breadcrumbs,
32
+ ...page.extra_data
33
+ };
34
+ }
35
+ if (page.description) indexes.push(createIndex(void 0, void 0, page.description));
36
+ page.structured.contents.forEach((p) => {
37
+ const heading = p.heading ? page.structured.headings.find((h) => p.heading === h.id) : null;
38
+ const index = createIndex(heading?.content, heading?.id, p.content);
39
+ if (heading && !scannedHeadings.has(heading.id)) {
40
+ scannedHeadings.add(heading.id);
41
+ indexes.push(createIndex(heading.content, heading.id, heading.content));
42
+ }
43
+ indexes.push(index);
44
+ });
45
+ return indexes;
46
+ }
47
+
48
+ //#endregion
49
+ export { sync, syncI18n };
@@ -1,8 +1,5 @@
1
- import "../remark-gfm-CeWpMwyk.js";
2
- import "../rehype-code-vVWG4-ej.js";
3
- import { n as StructuredData } from "../remark-structure-DGuWR82i.js";
4
- import "../remark-heading-CXvCY0go.js";
5
- import "../remark-code-tab-CXsYlims.js";
1
+ import "../transformer-icon-D7-6aFzt.js";
2
+ import { StructuredData } from "../mdx-plugins/remark-structure.js";
6
3
  import "../mdx-plugins/index.js";
7
4
  import { OramaCloud } from "@orama/core";
8
5
 
@@ -20,7 +17,7 @@ interface SyncOptions {
20
17
  */
21
18
  autoDeploy?: boolean;
22
19
  }
23
- type I18nSyncOptions = Omit<SyncOptions, 'index' | 'documents'> & {
20
+ interface I18nSyncOptions extends Omit<SyncOptions, 'index' | 'documents'> {
24
21
  /**
25
22
  * Indexes to sync.
26
23
  *
@@ -31,7 +28,7 @@ type I18nSyncOptions = Omit<SyncOptions, 'index' | 'documents'> & {
31
28
  locale: string;
32
29
  items: OramaDocument[];
33
30
  }[];
34
- };
31
+ }
35
32
  interface OramaDocument {
36
33
  /**
37
34
  * The ID of document, must be unique
@@ -77,5 +74,4 @@ interface OramaIndex {
77
74
  declare function sync(orama: OramaCloud, options: SyncOptions): Promise<void>;
78
75
  declare function syncI18n(orama: OramaCloud, options: I18nSyncOptions): Promise<void>;
79
76
  //#endregion
80
- export { I18nSyncOptions, OramaDocument, OramaIndex, SyncOptions, sync, syncI18n };
81
- //# sourceMappingURL=orama-cloud.d.ts.map
77
+ export { I18nSyncOptions, OramaDocument, OramaIndex, SyncOptions, sync, syncI18n };
@@ -48,5 +48,4 @@ function toIndex(page) {
48
48
  }
49
49
 
50
50
  //#endregion
51
- export { sync, syncI18n };
52
- //# sourceMappingURL=orama-cloud.js.map
51
+ export { sync, syncI18n };
@@ -1,6 +1,89 @@
1
- import "../definitions-DuxDer_c.js";
2
- import "../remark-structure-DGuWR82i.js";
1
+ import "../definitions-DSNTbAwC.js";
2
+ import { StructuredData } from "../mdx-plugins/remark-structure.js";
3
+ import "../utils-IgHyYnrz.js";
3
4
  import { HighlightedText, ReactSortedResult, SortedResult, createContentHighlighter } from "./index.js";
4
- import { a as Index, c as SimpleOptions, d as initSimpleSearch, f as createI18nSearchAPI, i as ExportedData, l as createSearchAPI, n as AdvancedOptions, o as SearchAPI, p as createFromSource, r as Dynamic, s as SearchServer, t as AdvancedIndex, u as initAdvancedSearch } from "../server-DmY4lGBs.js";
5
- import "../index-2U6Tl4--.js";
5
+ import { a as advancedSchema, i as SimpleDocument, n as createFromSource, o as simpleSchema, r as AdvancedDocument, t as createI18nSearchAPI } from "../create-i18n-Cv3Cocbs.js";
6
+ import "../path-B77y3W0_.js";
7
+ import { Orama, RawData, SearchParams, create } from "@orama/orama";
8
+
9
+ //#region src/search/server.d.ts
10
+ type SearchType = 'simple' | 'advanced';
11
+ type ExportedData = (RawData & {
12
+ type: SearchType;
13
+ }) | {
14
+ type: 'i18n';
15
+ data: Record<string, RawData & {
16
+ type: SearchType;
17
+ }>;
18
+ };
19
+ interface SearchServer {
20
+ search: (query: string, options?: {
21
+ locale?: string;
22
+ tag?: string | string[];
23
+ mode?: 'vector' | 'full';
24
+ }) => Promise<SortedResult[]>;
25
+ /**
26
+ * Export the database
27
+ *
28
+ * You can reference the exported database to implement client-side search
29
+ */
30
+ export: () => Promise<ExportedData>;
31
+ }
32
+ interface SearchAPI extends SearchServer {
33
+ GET: (request: Request) => Promise<Response>;
34
+ /**
35
+ * `GET` route handler that exports search indexes for static search.
36
+ */
37
+ staticGET: () => Promise<Response>;
38
+ }
39
+ /**
40
+ * Resolve indexes dynamically
41
+ */
42
+ type Dynamic<T> = () => T[] | Promise<T[]>;
43
+ type OramaInput = Parameters<typeof create>[0];
44
+ type SharedOptions = Pick<OramaInput, 'sort' | 'components' | 'plugins'> & {
45
+ language?: string;
46
+ tokenizer?: Required<OramaInput>['components']['tokenizer'];
47
+ };
48
+ interface SimpleOptions extends SharedOptions {
49
+ indexes: Index[] | Dynamic<Index>;
50
+ /**
51
+ * Customise search options on server
52
+ */
53
+ search?: Partial<SearchParams<Orama<typeof simpleSchema>, SimpleDocument>>;
54
+ }
55
+ interface AdvancedOptions extends SharedOptions {
56
+ indexes: AdvancedIndex[] | Dynamic<AdvancedIndex>;
57
+ /**
58
+ * Customise search options on server
59
+ */
60
+ search?: Partial<SearchParams<Orama<typeof advancedSchema>, AdvancedDocument>>;
61
+ }
62
+ declare function createSearchAPI<T extends SearchType>(type: T, options: T extends 'simple' ? SimpleOptions : AdvancedOptions): SearchAPI;
63
+ interface Index {
64
+ title: string;
65
+ description?: string;
66
+ breadcrumbs?: string[];
67
+ content: string;
68
+ url: string;
69
+ keywords?: string;
70
+ }
71
+ declare function initSimpleSearch(options: SimpleOptions): SearchServer;
72
+ interface AdvancedIndex {
73
+ id: string;
74
+ title: string;
75
+ description?: string;
76
+ breadcrumbs?: string[];
77
+ /**
78
+ * Required if tag filter is enabled
79
+ */
80
+ tag?: string | string[];
81
+ /**
82
+ * preprocess mdx content with `structure`
83
+ */
84
+ structuredData: StructuredData;
85
+ url: string;
86
+ }
87
+ declare function initAdvancedSearch(options: AdvancedOptions): SearchServer;
88
+ //#endregion
6
89
  export { AdvancedIndex, AdvancedOptions, Dynamic, ExportedData, HighlightedText, Index, ReactSortedResult, SearchAPI, SearchServer, SimpleOptions, SortedResult, createContentHighlighter, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
@@ -1,12 +1,12 @@
1
- import { r as findPath } from "../utils-DUvi2WkD.js";
2
- import { t as createContentHighlighter } from "../search-D6ChCLhY.js";
3
- import { n as searchSimple, t as searchAdvanced } from "../advanced-BRT5Ij43.js";
4
- import { r as extname, t as basename } from "../path-DHIjrDBP.js";
1
+ import { r as findPath } from "../utils-Bc53B3CJ.js";
2
+ import { createContentHighlighter } from "./index.js";
3
+ import { n as searchSimple, t as searchAdvanced } from "../advanced-BH0syJ-M.js";
4
+ import { r as extname, t as basename } from "../path-D0Bwm6Fs.js";
5
5
  import { create, insertMultiple, save } from "@orama/orama";
6
6
 
7
7
  //#region src/search/orama/create-endpoint.ts
8
8
  function createEndpoint(server) {
9
- const { search: search$1 } = server;
9
+ const { search } = server;
10
10
  return {
11
11
  ...server,
12
12
  async staticGET() {
@@ -16,7 +16,7 @@ function createEndpoint(server) {
16
16
  const url = new URL(request.url);
17
17
  const query = url.searchParams.get("query");
18
18
  if (!query) return Response.json([]);
19
- return Response.json(await search$1(query, {
19
+ return Response.json(await search(query, {
20
20
  tag: url.searchParams.get("tag")?.split(",") ?? void 0,
21
21
  locale: url.searchParams.get("locale") ?? void 0,
22
22
  mode: url.searchParams.get("mode") === "vector" ? "vector" : "full"
@@ -319,5 +319,4 @@ function initAdvancedSearch(options) {
319
319
  }
320
320
 
321
321
  //#endregion
322
- export { createContentHighlighter, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
323
- //# sourceMappingURL=server.js.map
322
+ export { createContentHighlighter, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
@@ -1,18 +1,20 @@
1
- import { i as Root } from "../../definitions-DuxDer_c.js";
1
+ import { i as Root } from "../../definitions-DSNTbAwC.js";
2
+ import "../../utils-IgHyYnrz.js";
2
3
  import "../../page-tree/index.js";
3
4
 
4
5
  //#region src/source/client/index.d.ts
5
- declare function deserializePageTree(root: Root): Root;
6
+ interface SerializedPageTree {
7
+ $hanzo_docs_loader: 'page-tree';
8
+ data: object;
9
+ }
10
+ type Serialized<Data> = { [K in keyof Data]: Data[K] extends SerializedPageTree ? Root : Data[K] };
11
+ declare function deserializePageTree(serialized: SerializedPageTree): Root;
6
12
  /**
7
- * Deserialize data passed from server-side loader.
13
+ * Deserialize loader data that is serialized by the server-side Hanzo Docs `loader()`, supported:
14
+ * - Page Tree
8
15
  *
9
- * It only receives the serialized data from server-side, hence not sharing plugins and some properties.
16
+ * other unrelated properties are kept in the output.
10
17
  */
11
- declare function useDocsLoader<V extends {
12
- pageTree?: object;
13
- }>(serialized: V): {
14
- pageTree: V["pageTree"] extends object ? Root : undefined;
15
- };
18
+ declare function useHanzoDocsLoader<V>(serialized: V): Serialized<V>;
16
19
  //#endregion
17
- export { deserializePageTree, useDocsLoader };
18
- //# sourceMappingURL=index.d.ts.map
20
+ export { Serialized, SerializedPageTree, deserializePageTree, useHanzoDocsLoader };
@@ -1,12 +1,13 @@
1
- import { c as visit } from "../../utils-DUvi2WkD.js";
1
+ import { c as visit } from "../../utils-Bc53B3CJ.js";
2
2
  import { useMemo } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
 
5
5
  //#region src/source/client/index.tsx
6
- function deserializePageTree(root) {
7
- function deserializeHTML(html) {
8
- return /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: html } });
9
- }
6
+ function deserializeHTML(html) {
7
+ return /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: html } });
8
+ }
9
+ function deserializePageTree(serialized) {
10
+ const root = serialized.data;
10
11
  visit(root, (item) => {
11
12
  if ("icon" in item && typeof item.icon === "string") item.icon = deserializeHTML(item.icon);
12
13
  if (typeof item.name === "string") item.name = deserializeHTML(item.name);
@@ -14,17 +15,25 @@ function deserializePageTree(root) {
14
15
  return root;
15
16
  }
16
17
  /**
17
- * Deserialize data passed from server-side loader.
18
+ * Deserialize loader data that is serialized by the server-side Hanzo Docs `loader()`, supported:
19
+ * - Page Tree
18
20
  *
19
- * It only receives the serialized data from server-side, hence not sharing plugins and some properties.
21
+ * other unrelated properties are kept in the output.
20
22
  */
21
- function useDocsLoader(serialized) {
22
- const { pageTree } = serialized;
23
+ function useHanzoDocsLoader(serialized) {
23
24
  return useMemo(() => {
24
- return { pageTree: pageTree ? deserializePageTree(pageTree) : void 0 };
25
- }, [pageTree]);
25
+ const out = {};
26
+ for (const k in serialized) {
27
+ const v = serialized[k];
28
+ if (isSerializedPageTree(v)) out[k] = deserializePageTree(v);
29
+ else out[k] = v;
30
+ }
31
+ return out;
32
+ }, [serialized]);
33
+ }
34
+ function isSerializedPageTree(v) {
35
+ return typeof v === "object" && v !== null && "$hanzo_docs_loader" in v && v.$hanzo_docs_loader === "page-tree";
26
36
  }
27
37
 
28
38
  //#endregion
29
- export { deserializePageTree, useDocsLoader };
30
- //# sourceMappingURL=index.js.map
39
+ export { deserializePageTree, useHanzoDocsLoader };
@@ -1,3 +1,5 @@
1
- import "../definitions-DuxDer_c.js";
2
- import { A as PageData, C as ContentStorage, D as buildContentStorage, E as ContentStoragePageFile, F as multiple, I as source, L as update, M as SourceConfig, N as VirtualFile, O as FileSystem, P as _ConfigUnion_, S as createPageTreeBuilder, T as ContentStorageMetaFile, a as LoaderOptions, b as PageTreeOptions, c as LoaderPluginOption, d as ResolvedLoaderConfig, f as createGetUrl, h as getSlugs, i as LoaderConfig, j as Source, k as MetaData, l as Meta, n as InferMetaType, o as LoaderOutput, p as loader, r as InferPageType, s as LoaderPlugin, t as path_d_exports, u as Page, v as PageTreeBuilder, w as ContentStorageFile, x as PageTreeTransformer, y as PageTreeBuilderContext } from "../index-2U6Tl4--.js";
3
- export { ContentStorage, ContentStorageFile, ContentStorageMetaFile, ContentStoragePageFile, FileSystem, InferMetaType, InferPageType, LoaderConfig, LoaderOptions, LoaderOutput, LoaderPlugin, LoaderPluginOption, Meta, MetaData, Page, PageData, PageTreeBuilder, PageTreeBuilderContext, PageTreeOptions, PageTreeTransformer, path_d_exports as PathUtils, ResolvedLoaderConfig, Source, SourceConfig, VirtualFile, _ConfigUnion_, buildContentStorage, createGetUrl, createPageTreeBuilder, getSlugs, loader, multiple, source, update };
1
+ import "../definitions-DSNTbAwC.js";
2
+ import "../utils-IgHyYnrz.js";
3
+ import { A as _SourceUpdate_, C as FileSystem, D as SourceConfig, E as Source, M as source, N as update, O as VirtualFile, S as createContentStorageBuilder, T as PageData, _ as PageTreeTransformer, a as LoaderOptions, b as ContentStorageMetaFile, c as LoaderPluginOption, d as ResolvedLoaderConfig, f as createGetUrl, g as PageTreeOptions, h as PageTreeBuilderContext, i as LoaderConfig, j as multiple, k as _ConfigUnion_, l as Meta, m as PageTreeBuilder, n as InferMetaType, o as LoaderOutput, p as loader, r as InferPageType, s as LoaderPlugin, t as path_d_exports, u as Page, v as ContentStorage, w as MetaData, x as ContentStoragePageFile, y as ContentStorageFile } from "../path-B77y3W0_.js";
4
+ import { getSlugs } from "./plugins/slugs.js";
5
+ export { ContentStorage, ContentStorageFile, ContentStorageMetaFile, ContentStoragePageFile, FileSystem, InferMetaType, InferPageType, LoaderConfig, LoaderOptions, LoaderOutput, LoaderPlugin, LoaderPluginOption, Meta, MetaData, Page, PageData, type PageTreeBuilder, type PageTreeBuilderContext, type PageTreeOptions, type PageTreeTransformer, path_d_exports as PathUtils, ResolvedLoaderConfig, Source, SourceConfig, VirtualFile, _ConfigUnion_, _SourceUpdate_, createContentStorageBuilder, createGetUrl, getSlugs, loader, multiple, source, update };