boltdocs 2.7.10 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/README.md +2 -2
  2. package/dist/banner-3N4Jd_L9.d.ts +100 -0
  3. package/dist/banner-MynZD_Ox.d.cts +100 -0
  4. package/dist/cache-BMUyNiiA.mjs +6 -0
  5. package/dist/cache-CKm45d2w.cjs +6 -0
  6. package/dist/client/index.cjs +2268 -1
  7. package/dist/client/index.d.cts +86 -110
  8. package/dist/client/index.d.ts +87 -111
  9. package/dist/client/index.js +2214 -1
  10. package/dist/client/mdx.cjs +12 -1
  11. package/dist/client/mdx.d.cts +39 -93
  12. package/dist/client/mdx.d.ts +38 -93
  13. package/dist/client/mdx.js +7 -1
  14. package/dist/client/primitives.cjs +60 -1
  15. package/dist/client/primitives.d.cts +411 -347
  16. package/dist/client/primitives.d.ts +411 -347
  17. package/dist/client/primitives.js +20 -1
  18. package/dist/docs-layout-CwCq42Zt.cjs +1348 -0
  19. package/dist/docs-layout-Dn6S5g59.js +1167 -0
  20. package/dist/doctor-BArviV8X.cjs +28 -0
  21. package/dist/doctor-CgLA7_Uv.mjs +28 -0
  22. package/dist/{doctor-CrytFkqW.cjs → doctor-DyNUVe96.cjs} +1 -1
  23. package/dist/{routes-DP1vmWRj.cjs → doctor-aN_leTbh.mjs} +1 -1
  24. package/dist/{generator-ClVanhvi.mjs → generator-BHCrLU6h.mjs} +2 -2
  25. package/dist/{generator-CHqxiQhF.cjs → generator-CC2yHzhZ.cjs} +2 -2
  26. package/dist/icons-dev-DvJ-hh9x.cjs +1209 -0
  27. package/dist/icons-dev-Oju24Wjp.js +845 -0
  28. package/dist/image-Ch4-GxdO.cjs +268 -0
  29. package/dist/image-Do8V9PCW.js +214 -0
  30. package/dist/mdx-D3A2_l7P.js +520 -0
  31. package/dist/mdx-PLhhPJRS.cjs +531 -0
  32. package/dist/node/cli-entry.cjs +3 -1
  33. package/dist/node/cli-entry.mjs +3 -1
  34. package/dist/node/index.cjs +1 -1
  35. package/dist/node/index.d.cts +258 -152
  36. package/dist/node/index.d.mts +258 -150
  37. package/dist/node/index.mjs +1 -1
  38. package/dist/node/routes/worker.cjs +1 -1
  39. package/dist/node/routes/worker.mjs +1 -1
  40. package/dist/node-BmlP0eBP.cjs +159 -0
  41. package/dist/node-Y8_4ayje.mjs +159 -0
  42. package/dist/package-2nFy_NsW.cjs +6 -0
  43. package/dist/{package--0Yf0t1N.mjs → package-DAbtltXX.mjs} +1 -1
  44. package/dist/parser-B7-6PyQz.cjs +6 -0
  45. package/dist/{parser-Aq8LoH-0.cjs → parser-BzB-zCkF.cjs} +1 -1
  46. package/dist/parser-WGZdWs0X.mjs +6 -0
  47. package/dist/routes-BDDSxAl0.mjs +6 -0
  48. package/dist/routes-DJNJ-rTt.cjs +6 -0
  49. package/dist/routes-DiYC4nD2.cjs +6 -0
  50. package/dist/routes-_Bb2f4eI.mjs +6 -0
  51. package/dist/search-dialog-BXVoecTx.cjs +483 -0
  52. package/dist/search-dialog-BYhOov4S.cjs +331 -0
  53. package/dist/search-dialog-C09riYmx.js +313 -0
  54. package/dist/search-dialog-CUeAfy-8.cjs +8 -0
  55. package/dist/search-dialog-D8gLkhUV.js +453 -0
  56. package/dist/search-dialog-DHc_8FFX.js +8 -0
  57. package/dist/{sidebar-CcBkrm06.d.cts → sidebar-DNq4_ZAa.d.ts} +118 -52
  58. package/dist/{sidebar-CyZS9YOm.d.ts → sidebar-Dlkgbxs6.d.cts} +118 -52
  59. package/dist/utils-BYITg7T5.mjs +7 -0
  60. package/dist/utils-Cjmx1hhk.cjs +7 -0
  61. package/dist/worker-pool-CtqklOXq.cjs +6 -0
  62. package/dist/worker-pool-k0DY6k8T.mjs +6 -0
  63. package/package.json +5 -6
  64. package/src/shared/config-utils.ts +4 -0
  65. package/src/shared/types.ts +52 -6
  66. package/dist/cache-Ba-DZQNH.cjs +0 -6
  67. package/dist/cache-BuMZ58L5.mjs +0 -6
  68. package/dist/cards-BakZPTz9.d.ts +0 -30
  69. package/dist/cards-CQn9mXZS.d.cts +0 -30
  70. package/dist/docs-layout-KoWNZc8_.js +0 -6
  71. package/dist/docs-layout-x2yKt2cL.cjs +0 -6
  72. package/dist/doctor-Be7Ly1oM.mjs +0 -21
  73. package/dist/doctor-jMxWZyLJ.cjs +0 -21
  74. package/dist/icons-dev-B_RZIyxu.js +0 -6
  75. package/dist/icons-dev-BlV3wWFT.cjs +0 -6
  76. package/dist/image-BHhTvQzr.cjs +0 -6
  77. package/dist/image-CqKzYD8f.js +0 -6
  78. package/dist/mdx-DudBEac0.js +0 -7
  79. package/dist/mdx-r4cDQxWu.cjs +0 -7
  80. package/dist/node-DtEDyN1u.cjs +0 -111
  81. package/dist/node-_1jhMGYx.mjs +0 -111
  82. package/dist/package-DrwtlXfk.cjs +0 -6
  83. package/dist/parser-CdNbqN5y.cjs +0 -6
  84. package/dist/parser-nE792MLO.mjs +0 -6
  85. package/dist/rolldown-runtime-fkIsjY3S.mjs +0 -6
  86. package/dist/routes-2k3tbUmC.cjs +0 -6
  87. package/dist/routes-CpxZIsMM.mjs +0 -6
  88. package/dist/search-dialog-B584t9ZF.js +0 -6
  89. package/dist/search-dialog-BvBopRsZ.cjs +0 -6
  90. package/dist/search-dialog-ByvGScjt.js +0 -6
  91. package/dist/search-dialog-Cyko6TJm.cjs +0 -6
  92. package/dist/search-dialog-D6BNohIJ.js +0 -6
  93. package/dist/search-dialog-DuYTIefy.cjs +0 -6
  94. package/dist/utils-CG65J0Sc.mjs +0 -7
  95. package/dist/utils-CKunkU96.cjs +0 -7
  96. package/dist/worker-pool-CGn7DrLb.mjs +0 -6
  97. package/dist/worker-pool-Crbqgw5R.cjs +0 -6
  98. package/src/client/app/config-context.tsx +0 -51
  99. package/src/client/app/doc-page.tsx +0 -38
  100. package/src/client/app/docs-layout.tsx +0 -28
  101. package/src/client/app/head.tsx +0 -122
  102. package/src/client/app/helmet-compat.tsx +0 -36
  103. package/src/client/app/mdx-component.tsx +0 -8
  104. package/src/client/app/mdx-components-context.tsx +0 -72
  105. package/src/client/app/routes-context.tsx +0 -34
  106. package/src/client/app/scroll-handler.tsx +0 -74
  107. package/src/client/app/theme-context.tsx +0 -103
  108. package/src/client/app/ui-context.tsx +0 -42
  109. package/src/client/components/docs-layout-default.tsx +0 -85
  110. package/src/client/components/icons-dev.tsx +0 -282
  111. package/src/client/components/mdx/callout.tsx +0 -97
  112. package/src/client/components/mdx/card.tsx +0 -99
  113. package/src/client/components/mdx/cards.tsx +0 -27
  114. package/src/client/components/mdx/code-block.tsx +0 -184
  115. package/src/client/components/mdx/field.tsx +0 -33
  116. package/src/client/components/mdx/image.tsx +0 -44
  117. package/src/client/components/mdx/index.ts +0 -19
  118. package/src/client/components/mdx/table.tsx +0 -54
  119. package/src/client/components/mdx/typographics.tsx +0 -120
  120. package/src/client/components/mdx/use-code-block.ts +0 -34
  121. package/src/client/components/primitives/breadcrumbs.tsx +0 -54
  122. package/src/client/components/primitives/button-group.tsx +0 -54
  123. package/src/client/components/primitives/button.tsx +0 -6
  124. package/src/client/components/primitives/code-block.tsx +0 -120
  125. package/src/client/components/primitives/docs-layout.tsx +0 -125
  126. package/src/client/components/primitives/error-boundary.tsx +0 -107
  127. package/src/client/components/primitives/heading.tsx +0 -128
  128. package/src/client/components/primitives/helpers/observer.ts +0 -141
  129. package/src/client/components/primitives/image.tsx +0 -26
  130. package/src/client/components/primitives/link.tsx +0 -102
  131. package/src/client/components/primitives/menu.tsx +0 -137
  132. package/src/client/components/primitives/navbar.tsx +0 -466
  133. package/src/client/components/primitives/on-this-page.tsx +0 -430
  134. package/src/client/components/primitives/page-nav.tsx +0 -51
  135. package/src/client/components/primitives/popover.tsx +0 -28
  136. package/src/client/components/primitives/search-dialog.tsx +0 -193
  137. package/src/client/components/primitives/sidebar.tsx +0 -423
  138. package/src/client/components/primitives/skeleton.tsx +0 -26
  139. package/src/client/components/primitives/tabs.tsx +0 -70
  140. package/src/client/components/primitives/tooltip.tsx +0 -81
  141. package/src/client/components/primitives/types.ts +0 -11
  142. package/src/client/components/ui-base/banner.tsx +0 -66
  143. package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
  144. package/src/client/components/ui-base/copy-markdown.tsx +0 -107
  145. package/src/client/components/ui-base/error-boundary.tsx +0 -15
  146. package/src/client/components/ui-base/github-stars.tsx +0 -29
  147. package/src/client/components/ui-base/icons.tsx +0 -240
  148. package/src/client/components/ui-base/index.ts +0 -16
  149. package/src/client/components/ui-base/last-updated.tsx +0 -27
  150. package/src/client/components/ui-base/navbar.tsx +0 -266
  151. package/src/client/components/ui-base/not-found.tsx +0 -26
  152. package/src/client/components/ui-base/on-this-page.tsx +0 -57
  153. package/src/client/components/ui-base/page-nav.tsx +0 -50
  154. package/src/client/components/ui-base/search-dialog.tsx +0 -163
  155. package/src/client/components/ui-base/search-highlight.tsx +0 -10
  156. package/src/client/components/ui-base/sidebar.tsx +0 -92
  157. package/src/client/components/ui-base/tabs.tsx +0 -83
  158. package/src/client/components/ui-base/theme-toggle.tsx +0 -130
  159. package/src/client/components/ui-base/version-i18n.tsx +0 -80
  160. package/src/client/hooks/index.ts +0 -13
  161. package/src/client/hooks/use-analytics.ts +0 -272
  162. package/src/client/hooks/use-breadcrumbs.ts +0 -22
  163. package/src/client/hooks/use-i18n.ts +0 -182
  164. package/src/client/hooks/use-localized-to.ts +0 -113
  165. package/src/client/hooks/use-location.ts +0 -5
  166. package/src/client/hooks/use-navbar.ts +0 -130
  167. package/src/client/hooks/use-page-nav.ts +0 -46
  168. package/src/client/hooks/use-routes.ts +0 -108
  169. package/src/client/hooks/use-search-highlight.ts +0 -185
  170. package/src/client/hooks/use-search.ts +0 -118
  171. package/src/client/hooks/use-sidebar.ts +0 -205
  172. package/src/client/hooks/use-tabs.ts +0 -46
  173. package/src/client/hooks/use-version.ts +0 -111
  174. package/src/client/index.ts +0 -31
  175. package/src/client/mdx.ts +0 -2
  176. package/src/client/primitives.ts +0 -19
  177. package/src/client/ssg/boltdocs-shell.tsx +0 -148
  178. package/src/client/ssg/create-routes.tsx +0 -473
  179. package/src/client/ssg/index.ts +0 -4
  180. package/src/client/ssg/mdx-page.tsx +0 -38
  181. package/src/client/store/boltdocs-context.tsx +0 -137
  182. package/src/client/theme/neutral.css +0 -141
  183. package/src/client/theme/reset.css +0 -189
  184. package/src/client/types.ts +0 -116
  185. package/src/client/utils/cn.ts +0 -6
  186. package/src/client/utils/copy-clipboard.ts +0 -22
  187. package/src/client/utils/get-base-file-path.ts +0 -21
  188. package/src/client/utils/github.ts +0 -121
  189. package/src/client/utils/i18n.ts +0 -23
  190. package/src/client/utils/path.ts +0 -9
  191. package/src/client/utils/react-to-text.ts +0 -34
  192. package/src/client/virtual.d.ts +0 -24
  193. /package/dist/{meta-loader-CWg2gnbY.mjs → meta-loader-DzwDFtdT.mjs} +0 -0
@@ -0,0 +1,520 @@
1
+ /**
2
+ * Boltdocs - https://boltdocs.vercel.app
3
+ * Copyright (c) 2026 Jesus Alcala
4
+ * Licensed under the MIT License.
5
+ */
6
+ import { D as Check, F as File, M as Copy, T as AlertTriangle, V as Lightbulb, _ as Link, a as Csv, c as JavaScript, d as React$1, f as Rust, g as Yaml, i as Css, l as Json, m as TypeScript, n as BracketsOrange, p as Shell, r as BracketsRed, u as Markdown, w as AlertCircle, y as cn, z as Info } from "./icons-dev-Oju24Wjp.js";
7
+ import { a as CodeBlockGroup, i as CodeBlockContent, l as useTheme, n as Tooltip, o as CodeBlockHeader, r as CodeBlock$1, s as Heading$1, t as Image$1 } from "./image-Do8V9PCW.js";
8
+ import { useCallback, useEffect, useRef, useState } from "react";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { Button } from "react-aria-components";
11
+
12
+ //#region src/client/components/mdx/field.tsx
13
+ const Field = ({ children, name, type, description, required }) => /* @__PURE__ */ jsxs("div", {
14
+ className: "my-4 border border-subtle bg-surface/50 p-4 rounded-xl flex flex-col gap-1 text-sm select-none",
15
+ children: [
16
+ /* @__PURE__ */ jsxs("div", {
17
+ className: "flex items-center gap-2",
18
+ children: [
19
+ /* @__PURE__ */ jsx("span", {
20
+ className: "font-mono font-bold text-primary-500",
21
+ children: name
22
+ }),
23
+ type && /* @__PURE__ */ jsx("span", {
24
+ className: "text-xs text-muted font-mono bg-soft px-1.5 py-0.5 rounded-md",
25
+ children: type
26
+ }),
27
+ required && /* @__PURE__ */ jsx("span", {
28
+ className: "text-xs text-rose-500 font-semibold",
29
+ children: "required"
30
+ })
31
+ ]
32
+ }),
33
+ description && /* @__PURE__ */ jsx("div", {
34
+ className: "text-muted text-xs mt-1",
35
+ children: description
36
+ }),
37
+ children && /* @__PURE__ */ jsx("div", {
38
+ className: "mt-2",
39
+ children
40
+ })
41
+ ]
42
+ });
43
+
44
+ //#endregion
45
+ //#region src/client/components/mdx/typographics.tsx
46
+ const Anchor = ({ href, children, className, ...props }) => {
47
+ return /* @__PURE__ */ jsx(Link, {
48
+ href: href || "",
49
+ className: cn("text-primary-500 hover:text-primary-400 dark:text-primary-500 hover:underline font-medium transition-colors duration-200", className),
50
+ ...props,
51
+ children
52
+ });
53
+ };
54
+ const HEADING_CLASSES = {
55
+ 1: "text-3xl sm:text-[2.5rem] font-extrabold tracking-tight text-body mb-4 leading-tight",
56
+ 2: "text-2xl sm:text-[1.75rem] font-bold tracking-tight text-body mt-14 mb-5 pb-2 border-b border-subtle scroll-mt-24",
57
+ 3: "text-lg sm:text-[1.4rem] font-semibold tracking-tight text-body mt-10 mb-4 scroll-mt-24",
58
+ 4: "text-base sm:text-[1.1rem] font-semibold tracking-tight text-body mt-8 mb-3 scroll-mt-24",
59
+ 5: "text-sm sm:text-[0.9rem] font-semibold tracking-tight text-body mt-6 mb-2 scroll-mt-24",
60
+ 6: "text-xs sm:text-[0.75rem] font-semibold tracking-tight text-body mt-6 mb-2 scroll-mt-24"
61
+ };
62
+ const Heading = ({ level, className, ...props }) => {
63
+ return /* @__PURE__ */ jsx(Heading$1, {
64
+ level,
65
+ className: cn(HEADING_CLASSES[level] || "", className),
66
+ ...props
67
+ });
68
+ };
69
+ const Typographics = {
70
+ a: Anchor,
71
+ h1: (props) => /* @__PURE__ */ jsx(Heading, {
72
+ level: 1,
73
+ ...props
74
+ }),
75
+ h2: (props) => /* @__PURE__ */ jsx(Heading, {
76
+ level: 2,
77
+ ...props
78
+ }),
79
+ h3: (props) => /* @__PURE__ */ jsx(Heading, {
80
+ level: 3,
81
+ ...props
82
+ }),
83
+ h4: (props) => /* @__PURE__ */ jsx(Heading, {
84
+ level: 4,
85
+ ...props
86
+ }),
87
+ h5: (props) => /* @__PURE__ */ jsx(Heading, {
88
+ level: 5,
89
+ ...props
90
+ }),
91
+ h6: (props) => /* @__PURE__ */ jsx(Heading, {
92
+ level: 6,
93
+ ...props
94
+ }),
95
+ p: ({ className, ...props }) => /* @__PURE__ */ jsx("p", {
96
+ className: cn("text-paragraph leading-relaxed my-5", className),
97
+ ...props
98
+ }),
99
+ strong: ({ className, ...props }) => /* @__PURE__ */ jsx("strong", {
100
+ className: cn("font-semibold text-body", className),
101
+ ...props
102
+ }),
103
+ mark: ({ className, ...props }) => /* @__PURE__ */ jsx("mark", {
104
+ className: cn("bg-primary-500/10 text-primary-500 font-semibold px-1.5 py-0.5 rounded-md", className),
105
+ ...props
106
+ }),
107
+ blockquote: ({ className, ...props }) => /* @__PURE__ */ jsx("blockquote", {
108
+ className: cn("border-l-4 border-primary-500 bg-soft/30 pl-4 py-2 my-6 italic text-muted rounded-r-lg", className),
109
+ ...props
110
+ }),
111
+ hr: ({ className, ...props }) => /* @__PURE__ */ jsx("hr", {
112
+ className: cn("my-8 border-t border-subtle", className),
113
+ ...props
114
+ }),
115
+ ul: ({ className, ...props }) => /* @__PURE__ */ jsx("ul", {
116
+ className: cn("list-disc pl-6 my-5 space-y-2 text-paragraph", className),
117
+ ...props
118
+ }),
119
+ ol: ({ className, ...props }) => /* @__PURE__ */ jsx("ol", {
120
+ className: cn("list-decimal pl-6 my-5 space-y-2 text-paragraph", className),
121
+ ...props
122
+ }),
123
+ li: ({ className, ...props }) => /* @__PURE__ */ jsx("li", {
124
+ className: cn("pl-1", className),
125
+ ...props
126
+ })
127
+ };
128
+
129
+ //#endregion
130
+ //#region src/client/components/mdx/table.tsx
131
+ const Table = (props) => /* @__PURE__ */ jsx("div", {
132
+ className: "my-6 w-full overflow-x-auto rounded-xl border border-subtle bg-surface/30",
133
+ children: /* @__PURE__ */ jsx("table", {
134
+ className: "w-full border-collapse text-left text-sm",
135
+ ...props
136
+ })
137
+ });
138
+ const TableHead = (props) => /* @__PURE__ */ jsx("thead", {
139
+ className: cn("border-b border-subtle bg-soft/50", props.className),
140
+ ...props
141
+ });
142
+ const TableBody = (props) => /* @__PURE__ */ jsx("tbody", { ...props });
143
+ const TableRow = (props) => /* @__PURE__ */ jsx("tr", {
144
+ className: cn("border-b border-subtle last:border-0 even:bg-soft/10 hover:bg-soft/20 transition-colors", props.className),
145
+ ...props
146
+ });
147
+ const TableHeader = (props) => /* @__PURE__ */ jsx("th", {
148
+ className: cn("px-4 py-3 font-semibold text-body text-xs font-mono", props.className),
149
+ ...props
150
+ });
151
+ const TableCell = (props) => /* @__PURE__ */ jsx("td", {
152
+ className: cn("px-4 py-3 text-paragraph leading-relaxed", props.className),
153
+ ...props
154
+ });
155
+ const TableComponents = {
156
+ table: Table,
157
+ thead: TableHead,
158
+ tbody: TableBody,
159
+ tr: TableRow,
160
+ th: TableHeader,
161
+ td: TableCell
162
+ };
163
+
164
+ //#endregion
165
+ //#region src/client/components/mdx/callout.tsx
166
+ const variantStyles = {
167
+ note: {
168
+ container: "bg-slate-500/5 dark:bg-slate-500/10 border-slate-500/40 text-slate-800 dark:text-slate-200",
169
+ titleText: "text-slate-900 dark:text-slate-100",
170
+ iconColor: "text-slate-500",
171
+ icon: Info,
172
+ defaultTitle: "Note"
173
+ },
174
+ info: {
175
+ container: "bg-indigo-500/5 dark:bg-indigo-500/10 border-indigo-500/40 text-indigo-800 dark:text-indigo-200",
176
+ titleText: "text-indigo-900 dark:text-indigo-100",
177
+ iconColor: "text-indigo-500",
178
+ icon: Info,
179
+ defaultTitle: "Info"
180
+ },
181
+ tip: {
182
+ container: "bg-green-500/5 dark:bg-green-500/10 border-green-500/40 text-green-800 dark:text-green-200",
183
+ titleText: "text-green-900 dark:text-green-100",
184
+ iconColor: "text-green-500",
185
+ icon: Lightbulb,
186
+ defaultTitle: "Tip"
187
+ },
188
+ warning: {
189
+ container: "bg-amber-500/5 dark:bg-amber-500/10 border-amber-500/40 text-amber-800 dark:text-amber-200",
190
+ titleText: "text-amber-900 dark:text-amber-100",
191
+ iconColor: "text-amber-500",
192
+ icon: AlertTriangle,
193
+ defaultTitle: "Warning"
194
+ },
195
+ danger: {
196
+ container: "bg-rose-500/5 dark:bg-rose-500/10 border-rose-500/40 text-rose-800 dark:text-rose-200",
197
+ titleText: "text-rose-900 dark:text-rose-100",
198
+ iconColor: "text-rose-500",
199
+ icon: AlertCircle,
200
+ defaultTitle: "Danger"
201
+ }
202
+ };
203
+ function Callout({ children, className = "", variant = "note", title, ...props }) {
204
+ const styles = variantStyles[variant] || variantStyles.note;
205
+ const Icon = styles.icon;
206
+ return /* @__PURE__ */ jsxs("div", {
207
+ className: cn("my-6 flex gap-4 p-4 rounded-xl border-2", styles.container, className),
208
+ ...props,
209
+ children: [/* @__PURE__ */ jsx("div", {
210
+ className: cn("shrink-0 pt-0.5", styles.iconColor),
211
+ children: /* @__PURE__ */ jsx(Icon, { className: "w-5 h-5 stroke-[2]" })
212
+ }), /* @__PURE__ */ jsxs("div", {
213
+ className: "flex-1 text-[0.875rem] leading-[1.6]",
214
+ children: [/* @__PURE__ */ jsx("div", {
215
+ className: cn("font-bold text-sm mb-1", styles.titleText),
216
+ children: title || styles.defaultTitle
217
+ }), /* @__PURE__ */ jsx("div", {
218
+ className: "prose prose-neutral dark:prose-invert max-w-none [&>p]:m-0 [&>p+p]:mt-2",
219
+ children
220
+ })]
221
+ })]
222
+ });
223
+ }
224
+
225
+ //#endregion
226
+ //#region src/client/utils/copy-clipboard.ts
227
+ /**
228
+ * Copy text to clipboard.
229
+ * @param text - The text to copy.
230
+ * @returns True if the text was copied successfully.
231
+ */
232
+ const copyToClipboard = async (text) => {
233
+ try {
234
+ await navigator.clipboard.writeText(text);
235
+ return true;
236
+ } catch {
237
+ const textarea = document.createElement("textarea");
238
+ textarea.value = text;
239
+ textarea.style.position = "fixed";
240
+ textarea.style.opacity = "0";
241
+ document.body.appendChild(textarea);
242
+ textarea.select();
243
+ document.execCommand("copy");
244
+ document.body.removeChild(textarea);
245
+ return true;
246
+ }
247
+ };
248
+
249
+ //#endregion
250
+ //#region src/client/components/mdx/use-code-block.ts
251
+ function useCodeBlock(props) {
252
+ const [copied, setCopied] = useState(false);
253
+ const [isExpanded, setIsExpanded] = useState(false);
254
+ const [isExpandable, setIsExpandable] = useState(false);
255
+ const preRef = useRef(null);
256
+ const timerRef = useRef(null);
257
+ useEffect(() => {
258
+ return () => {
259
+ if (timerRef.current) clearTimeout(timerRef.current);
260
+ };
261
+ }, []);
262
+ const handleCopy = useCallback(async () => {
263
+ copyToClipboard(preRef.current?.textContent ?? "");
264
+ setCopied(true);
265
+ if (timerRef.current) clearTimeout(timerRef.current);
266
+ timerRef.current = setTimeout(() => {
267
+ setCopied(false);
268
+ timerRef.current = null;
269
+ }, 2e3);
270
+ }, []);
271
+ useEffect(() => {
272
+ const lines = (preRef.current?.textContent ?? "").trim().split("\n").length;
273
+ setIsExpandable(lines > 6);
274
+ }, [props.children, props.highlightedHtml]);
275
+ return {
276
+ copied,
277
+ isExpanded,
278
+ setIsExpanded,
279
+ isExpandable,
280
+ preRef,
281
+ handleCopy,
282
+ shouldTruncate: isExpandable && !isExpanded
283
+ };
284
+ }
285
+
286
+ //#endregion
287
+ //#region src/client/components/mdx/code-block.tsx
288
+ const langIconMap = {
289
+ ts: TypeScript,
290
+ tsx: React$1,
291
+ js: JavaScript,
292
+ jsx: React$1,
293
+ json: Json,
294
+ css: Css,
295
+ html: BracketsOrange,
296
+ md: Markdown,
297
+ mdx: Markdown,
298
+ bash: Shell,
299
+ sh: Shell,
300
+ yaml: Yaml,
301
+ yml: Yaml,
302
+ rs: Rust,
303
+ rust: Rust,
304
+ toml: BracketsRed,
305
+ csv: Csv
306
+ };
307
+ const CopyButton = ({ copied, handleCopy }) => {
308
+ return /* @__PURE__ */ jsx(Tooltip, {
309
+ content: copied ? "Copied!" : "Copy code",
310
+ children: /* @__PURE__ */ jsx(Button, {
311
+ onPress: handleCopy,
312
+ className: cn("grid place-items-center size-8 bg-transparent outline-none cursor-pointer transition-all duration-200 hover:scale-110 active:scale-95 [&>svg]:size-4 [&>svg]:stroke-2 z-10", copied ? "text-emerald-400" : "text-muted hover:text-body"),
313
+ "aria-label": "Copy code",
314
+ children: copied ? /* @__PURE__ */ jsx(Check, { size: 20 }) : /* @__PURE__ */ jsx(Copy, { size: 20 })
315
+ })
316
+ });
317
+ };
318
+ function CodeBlock(props) {
319
+ const { children, hideCopy = false, highlightedHtml, "data-highlighted-html": dataHighlightedHtml, title, "data-title": dataTitle, "data-lang": dataLang, plain = false, lineNumbers, showLineNumbers, wordWrap, "word-wrap": wordWrapHyphen, metastring, ...rest } = props;
320
+ const { style, className: shikiClassName, ...cleanRest } = rest;
321
+ const isHighlighted = props["data-highlighted"] === "true" || typeof shikiClassName === "string" && shikiClassName.includes("shiki");
322
+ const rawHighlightedHtml = highlightedHtml || dataHighlightedHtml;
323
+ const effectiveHighlightedHtml = typeof rawHighlightedHtml === "string" ? rawHighlightedHtml.replace(/<span class="line">\s*(?:<span[^>]*>\s*<\/span>)?\s*<\/span>\s*(<\/code>\s*<\/pre>)/g, "$1") : rawHighlightedHtml;
324
+ const effectiveTitle = title || dataTitle;
325
+ const lang = props.lang || dataLang || "";
326
+ const { copied, isExpanded, setIsExpanded, isExpandable, preRef, handleCopy, shouldTruncate } = useCodeBlock(props);
327
+ const LangIcon = langIconMap[lang];
328
+ return /* @__PURE__ */ jsxs(CodeBlock$1, {
329
+ plain,
330
+ className: props.className,
331
+ children: [(effectiveTitle || !hideCopy) && /* @__PURE__ */ jsxs(CodeBlockHeader, {
332
+ className: cn({ "absolute top-2 left-0 w-full": !effectiveTitle }),
333
+ children: [/* @__PURE__ */ jsx(CodeBlockGroup, { children: effectiveTitle && /* @__PURE__ */ jsxs(Fragment, { children: [LangIcon ? /* @__PURE__ */ jsx(LangIcon, { size: 14 }) : /* @__PURE__ */ jsx(File, {
334
+ size: 14,
335
+ className: "opacity-60"
336
+ }), /* @__PURE__ */ jsx("span", { children: effectiveTitle })] }) }), /* @__PURE__ */ jsx("div", {
337
+ className: "flex items-center gap-1",
338
+ children: !hideCopy && /* @__PURE__ */ jsx(CopyButton, {
339
+ copied,
340
+ handleCopy
341
+ })
342
+ })]
343
+ }), /* @__PURE__ */ jsxs(CodeBlockContent, {
344
+ shouldTruncate,
345
+ children: [effectiveHighlightedHtml ? /* @__PURE__ */ jsx("div", {
346
+ ref: preRef,
347
+ className: "shiki-wrapper overflow-x-auto [&>pre]:m-0! [&>pre]:rounded-none! [&>pre]:border-none! [&>pre]:bg-inherit! [&>pre>code]:grid! [&>pre>code]:p-5! [&>pre>code]:text-[0.875rem]! [&>pre>code]:leading-[1.6]! [&>.shiki.shiki-themes]:bg-transparent!",
348
+ dangerouslySetInnerHTML: { __html: effectiveHighlightedHtml }
349
+ }) : /* @__PURE__ */ jsx("pre", {
350
+ ref: preRef,
351
+ className: cn("m-0! rounded-none! border-none! bg-transparent!", "text-[0.875rem] leading-[1.6] overflow-x-auto", shikiClassName, {
352
+ "p-0! [&>code]:grid! [&>code]:p-5! [&>code]:bg-transparent!": isHighlighted,
353
+ "p-5!": !isHighlighted
354
+ }),
355
+ ...cleanRest,
356
+ children
357
+ }), isExpandable && /* @__PURE__ */ jsx("div", {
358
+ className: cn(shouldTruncate ? "absolute bottom-0 inset-x-0 h-24 bg-linear-to-t from-(--color-code-bg) to-transparent flex items-end justify-center pb-4 z-10" : "relative flex justify-center pb-4 pt-1 -mt-4"),
359
+ children: /* @__PURE__ */ jsx(Button, {
360
+ onPress: () => setIsExpanded(!isExpanded),
361
+ className: "rounded-full bg-surface border border-subtle px-5 py-2 text-[0.8125rem] font-medium text-body outline-none cursor-pointer transition-all hover:bg-soft hover:-translate-y-px backdrop-blur-md",
362
+ children: isExpanded ? "Show less" : "Expand code"
363
+ })
364
+ })]
365
+ })]
366
+ });
367
+ }
368
+
369
+ //#endregion
370
+ //#region src/client/components/mdx/image.tsx
371
+ const Image = ({ src, alt, title, theme, className, ...props }) => {
372
+ const { theme: themeContext } = useTheme();
373
+ if (!src) return null;
374
+ if (theme !== themeContext) return null;
375
+ const caption = title || alt;
376
+ return /* @__PURE__ */ jsxs("figure", {
377
+ className: "my-6 sm:my-8 flex flex-col items-center justify-center group not-prose",
378
+ children: [/* @__PURE__ */ jsx("div", {
379
+ className: "relative w-full overflow-hidden rounded-lg sm:rounded-2xl border border-subtle bg-soft/30 transition-all duration-300 sm:max-w-[85%] lg:max-w-full",
380
+ children: /* @__PURE__ */ jsx(Image$1, {
381
+ src,
382
+ alt: alt || "",
383
+ theme,
384
+ loading: "lazy",
385
+ decoding: "async",
386
+ className: cn("w-full h-auto object-contain transition-transform duration-500 group-hover:scale-[1.01] my-0 rounded-md sm:rounded-xl block", className),
387
+ ...props
388
+ })
389
+ }), caption && /* @__PURE__ */ jsx("figcaption", {
390
+ className: "mt-2 sm:mt-3 text-center text-xs sm:text-sm text-muted font-medium select-none tracking-wide opacity-90 sm:opacity-80 group-hover:opacity-100 transition-opacity duration-300 px-2",
391
+ children: caption
392
+ })]
393
+ });
394
+ };
395
+ const ImageComponents = {
396
+ img: Image,
397
+ Image
398
+ };
399
+
400
+ //#endregion
401
+ //#region src/client/components/mdx/card.tsx
402
+ function Card({ className, title, icon, href, children, ...props }) {
403
+ const [position, setPosition] = useState({
404
+ x: 0,
405
+ y: 0
406
+ });
407
+ const [opacity, setOpacity] = useState(0);
408
+ const cardRef = useRef(null);
409
+ const handleMouseMove = (e) => {
410
+ if (!cardRef.current) return;
411
+ const rect = cardRef.current.getBoundingClientRect();
412
+ setPosition({
413
+ x: e.clientX - rect.left,
414
+ y: e.clientY - rect.top
415
+ });
416
+ };
417
+ const handleMouseEnter = () => setOpacity(1);
418
+ const handleMouseLeave = () => setOpacity(0);
419
+ const Wrapper = href ? "a" : "div";
420
+ const spotlightColor = "var(--color-primary-500, #eb5828)";
421
+ return /* @__PURE__ */ jsxs(Wrapper, {
422
+ ref: cardRef,
423
+ href,
424
+ onMouseMove: handleMouseMove,
425
+ onMouseEnter: handleMouseEnter,
426
+ onMouseLeave: handleMouseLeave,
427
+ className: cn("group relative flex flex-col gap-3 rounded-2xl border p-6 overflow-hidden transition-all duration-300", "hover:shadow-lg dark:hover:shadow-none hover:-translate-y-0.5", "bg-surface border-subtle text-paragraph", href && "cursor-pointer", className),
428
+ ...props,
429
+ children: [
430
+ /* @__PURE__ */ jsx("div", {
431
+ className: "pointer-events-none absolute inset-0 transition-opacity duration-300",
432
+ style: {
433
+ opacity,
434
+ background: `radial-gradient(600px circle at ${position.x}px ${position.y}px, color-mix(in srgb, ${spotlightColor} 8%, transparent), transparent 40%)`
435
+ }
436
+ }),
437
+ /* @__PURE__ */ jsx("div", {
438
+ className: "pointer-events-none absolute inset-0 rounded-2xl transition-opacity duration-300",
439
+ style: {
440
+ opacity,
441
+ padding: "1px",
442
+ background: `radial-gradient(400px circle at ${position.x}px ${position.y}px, color-mix(in srgb, ${spotlightColor} 50%, transparent), transparent 40%)`,
443
+ WebkitMask: "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",
444
+ WebkitMaskComposite: "xor",
445
+ maskComposite: "exclude"
446
+ }
447
+ }),
448
+ /* @__PURE__ */ jsxs("div", {
449
+ className: "relative z-10 flex items-center gap-3",
450
+ children: [icon && /* @__PURE__ */ jsx("div", {
451
+ className: cn("shrink-0 transition-transform duration-500 group-hover:rotate-[15deg] group-hover:scale-110 flex items-center justify-center text-muted group-hover:text-primary-500", "[&>svg]:w-6 [&>svg]:h-6 [&>svg]:stroke-[1.5]"),
452
+ children: icon
453
+ }), title && /* @__PURE__ */ jsx("h3", {
454
+ className: "font-semibold text-base m-0 leading-none text-body",
455
+ children: title
456
+ })]
457
+ }),
458
+ /* @__PURE__ */ jsx("div", {
459
+ className: "relative z-10 text-[0.875rem] leading-[1.6] opacity-90 prose prose-neutral dark:prose-invert max-w-none [&>p]:m-0 [&>p+p]:mt-2",
460
+ children
461
+ })
462
+ ]
463
+ });
464
+ }
465
+
466
+ //#endregion
467
+ //#region src/client/components/mdx/cards.tsx
468
+ function Cards({ children, className, cols = 2, ...props }) {
469
+ return /* @__PURE__ */ jsx("div", {
470
+ className: cn("grid gap-4 my-6", {
471
+ "grid-cols-1": cols === 1,
472
+ "grid-cols-1 sm:grid-cols-2": cols === 2,
473
+ "grid-cols-1 sm:grid-cols-2 md:grid-cols-3": cols === 3,
474
+ "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4": cols === 4
475
+ }, className),
476
+ ...props,
477
+ children
478
+ });
479
+ }
480
+
481
+ //#endregion
482
+ //#region src/client/components/mdx/last-updated.tsx
483
+ /**
484
+ * A subtle display for when the page was last updated.
485
+ * Small, opaque, and positioned at the bottom of the content with a thin top border divider.
486
+ */
487
+ function LastUpdated({ date }) {
488
+ if (!date) return null;
489
+ const d = new Date(date);
490
+ if (Number.isNaN(d.getTime())) return null;
491
+ const formattedDate = d.toLocaleDateString(void 0, {
492
+ year: "numeric",
493
+ month: "long",
494
+ day: "numeric"
495
+ });
496
+ return /* @__PURE__ */ jsxs("div", {
497
+ className: "mt-16 pt-6 border-t border-subtle flex items-center justify-between text-xs text-muted select-none",
498
+ children: [/* @__PURE__ */ jsx("span", {}), /* @__PURE__ */ jsxs("span", {
499
+ className: "italic",
500
+ children: ["Last updated on ", formattedDate]
501
+ })]
502
+ });
503
+ }
504
+
505
+ //#endregion
506
+ //#region src/client/components/mdx/index.ts
507
+ const mdx_components_default = {
508
+ ...Typographics,
509
+ ...TableComponents,
510
+ ...ImageComponents,
511
+ LastUpdated,
512
+ pre: CodeBlock,
513
+ Field,
514
+ Callout,
515
+ Card,
516
+ Cards
517
+ };
518
+
519
+ //#endregion
520
+ export { copyToClipboard as n, mdx_components_default as t };