boltdocs 1.10.2 → 1.11.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 (225) hide show
  1. package/package.json +29 -7
  2. package/src/client/app/config-context.tsx +18 -0
  3. package/src/client/app/docs-layout.tsx +14 -0
  4. package/src/client/app/index.tsx +132 -260
  5. package/src/client/app/mdx-component.tsx +52 -0
  6. package/src/client/app/mdx-components-context.tsx +23 -0
  7. package/src/client/app/mdx-page.tsx +20 -0
  8. package/src/client/app/preload.tsx +38 -30
  9. package/src/client/app/router.tsx +30 -0
  10. package/src/client/app/scroll-handler.tsx +40 -0
  11. package/src/client/app/theme-context.tsx +75 -0
  12. package/src/client/components/default-layout.tsx +80 -0
  13. package/src/client/components/docs-layout.tsx +105 -0
  14. package/src/client/components/icons-dev.tsx +74 -0
  15. package/src/client/components/mdx/admonition.tsx +107 -0
  16. package/src/client/components/mdx/badge.tsx +41 -0
  17. package/src/client/components/mdx/button.tsx +35 -0
  18. package/src/client/components/mdx/card.tsx +124 -0
  19. package/src/client/components/mdx/code-block.tsx +119 -0
  20. package/src/client/components/mdx/component-preview.tsx +47 -0
  21. package/src/client/components/mdx/component-props.tsx +83 -0
  22. package/src/client/components/mdx/field.tsx +66 -0
  23. package/src/client/components/mdx/file-tree.tsx +287 -0
  24. package/src/client/components/mdx/hooks/use-code-block.ts +56 -0
  25. package/src/client/components/mdx/hooks/use-component-preview.ts +16 -0
  26. package/src/client/components/mdx/hooks/useTable.ts +74 -0
  27. package/src/client/components/mdx/hooks/useTabs.ts +68 -0
  28. package/src/client/components/mdx/image.tsx +23 -0
  29. package/src/client/components/mdx/index.ts +53 -0
  30. package/src/client/components/mdx/link.tsx +38 -0
  31. package/src/client/components/mdx/list.tsx +192 -0
  32. package/src/client/components/mdx/table.tsx +156 -0
  33. package/src/client/components/mdx/tabs.tsx +135 -0
  34. package/src/client/components/mdx/video.tsx +68 -0
  35. package/src/client/components/primitives/breadcrumbs.tsx +79 -0
  36. package/src/client/components/primitives/button-group.tsx +54 -0
  37. package/src/client/components/primitives/button.tsx +145 -0
  38. package/src/client/components/primitives/helpers/observer.ts +120 -0
  39. package/src/client/components/primitives/index.ts +17 -0
  40. package/src/client/components/primitives/link.tsx +122 -0
  41. package/src/client/components/primitives/menu.tsx +159 -0
  42. package/src/client/components/primitives/navbar.tsx +359 -0
  43. package/src/client/components/primitives/navigation-menu.tsx +116 -0
  44. package/src/client/components/primitives/on-this-page.tsx +461 -0
  45. package/src/client/components/primitives/page-nav.tsx +87 -0
  46. package/src/client/components/primitives/popover.tsx +47 -0
  47. package/src/client/components/primitives/search-dialog.tsx +183 -0
  48. package/src/client/components/primitives/sidebar.tsx +154 -0
  49. package/src/client/components/primitives/tabs.tsx +90 -0
  50. package/src/client/components/primitives/tooltip.tsx +83 -0
  51. package/src/client/components/primitives/types.ts +11 -0
  52. package/src/client/components/ui-base/breadcrumbs.tsx +42 -0
  53. package/src/client/components/ui-base/copy-markdown.tsx +112 -0
  54. package/src/client/components/ui-base/error-boundary.tsx +52 -0
  55. package/src/client/components/ui-base/github-stars.tsx +27 -0
  56. package/src/client/components/ui-base/head.tsx +69 -0
  57. package/src/client/components/ui-base/loading.tsx +87 -0
  58. package/src/client/components/ui-base/navbar.tsx +138 -0
  59. package/src/client/components/ui-base/not-found.tsx +24 -0
  60. package/src/client/components/ui-base/on-this-page.tsx +152 -0
  61. package/src/client/components/ui-base/page-nav.tsx +39 -0
  62. package/src/client/components/ui-base/powered-by.tsx +19 -0
  63. package/src/client/components/ui-base/progress-bar.tsx +67 -0
  64. package/src/client/components/ui-base/search-dialog.tsx +82 -0
  65. package/src/client/components/ui-base/sidebar.tsx +104 -0
  66. package/src/client/components/ui-base/tabs.tsx +65 -0
  67. package/src/client/components/ui-base/theme-toggle.tsx +32 -0
  68. package/src/client/hooks/index.ts +12 -0
  69. package/src/client/hooks/use-breadcrumbs.ts +22 -0
  70. package/src/client/hooks/use-i18n.ts +84 -0
  71. package/src/client/hooks/use-localized-to.ts +95 -0
  72. package/src/client/hooks/use-location.ts +5 -0
  73. package/src/client/hooks/use-navbar.ts +60 -0
  74. package/src/client/hooks/use-onthispage.ts +23 -0
  75. package/src/client/hooks/use-page-nav.ts +22 -0
  76. package/src/client/hooks/use-routes.ts +72 -0
  77. package/src/client/hooks/use-search.ts +71 -0
  78. package/src/client/hooks/use-sidebar.ts +49 -0
  79. package/src/client/hooks/use-tabs.ts +43 -0
  80. package/src/client/hooks/use-version.ts +78 -0
  81. package/src/client/index.ts +55 -17
  82. package/src/client/integrations/codesandbox.ts +179 -0
  83. package/src/client/ssr.tsx +27 -16
  84. package/src/client/theme/neutral.css +360 -0
  85. package/src/client/types.ts +131 -27
  86. package/src/client/utils/cn.ts +6 -0
  87. package/src/client/utils/copy-clipboard.ts +22 -0
  88. package/src/client/utils/get-base-file-path.ts +21 -0
  89. package/src/client/utils/github.ts +121 -0
  90. package/src/client/utils/use-on-change.ts +15 -0
  91. package/src/client/virtual.d.ts +24 -0
  92. package/src/node/cache.ts +156 -156
  93. package/src/node/config.ts +159 -103
  94. package/src/node/index.ts +13 -13
  95. package/src/node/mdx.ts +213 -61
  96. package/src/node/plugin/entry.ts +29 -18
  97. package/src/node/plugin/html.ts +11 -11
  98. package/src/node/plugin/index.ts +161 -83
  99. package/src/node/plugin/types.ts +2 -4
  100. package/src/node/routes/cache.ts +6 -6
  101. package/src/node/routes/index.ts +206 -113
  102. package/src/node/routes/parser.ts +106 -81
  103. package/src/node/routes/sorter.ts +15 -15
  104. package/src/node/routes/types.ts +24 -24
  105. package/src/node/ssg/index.ts +46 -46
  106. package/src/node/ssg/meta.ts +4 -4
  107. package/src/node/ssg/options.ts +5 -5
  108. package/src/node/ssg/sitemap.ts +14 -14
  109. package/src/node/utils.ts +31 -31
  110. package/tsconfig.json +25 -20
  111. package/tsup.config.ts +23 -14
  112. package/dist/PackageManagerTabs-NVT7G625.mjs +0 -99
  113. package/dist/SearchDialog-AGVF6JBO.mjs +0 -194
  114. package/dist/SearchDialog-YPDOM7Q6.css +0 -2847
  115. package/dist/Video-KNTY5BNO.mjs +0 -6
  116. package/dist/cache-KNL5B4EE.mjs +0 -12
  117. package/dist/chunk-7SFUJWTB.mjs +0 -211
  118. package/dist/chunk-FFBNU6IJ.mjs +0 -386
  119. package/dist/chunk-FMTOYQLO.mjs +0 -37
  120. package/dist/chunk-TKLQWU7H.mjs +0 -1920
  121. package/dist/chunk-Z7JHYNAS.mjs +0 -57
  122. package/dist/client/index.css +0 -2847
  123. package/dist/client/index.d.mts +0 -372
  124. package/dist/client/index.d.ts +0 -372
  125. package/dist/client/index.js +0 -3630
  126. package/dist/client/index.mjs +0 -697
  127. package/dist/client/ssr.css +0 -2847
  128. package/dist/client/ssr.d.mts +0 -27
  129. package/dist/client/ssr.d.ts +0 -27
  130. package/dist/client/ssr.js +0 -2928
  131. package/dist/client/ssr.mjs +0 -33
  132. package/dist/config-BsFQ-ErD.d.mts +0 -159
  133. package/dist/config-BsFQ-ErD.d.ts +0 -159
  134. package/dist/node/index.d.mts +0 -91
  135. package/dist/node/index.d.ts +0 -91
  136. package/dist/node/index.js +0 -1187
  137. package/dist/node/index.mjs +0 -762
  138. package/dist/types-Dj-bfnC3.d.mts +0 -74
  139. package/dist/types-Dj-bfnC3.d.ts +0 -74
  140. package/src/client/theme/components/CodeBlock/CodeBlock.tsx +0 -61
  141. package/src/client/theme/components/CodeBlock/index.ts +0 -1
  142. package/src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx +0 -131
  143. package/src/client/theme/components/PackageManagerTabs/index.ts +0 -1
  144. package/src/client/theme/components/PackageManagerTabs/pkg-tabs.css +0 -64
  145. package/src/client/theme/components/Playground/Playground.tsx +0 -180
  146. package/src/client/theme/components/Playground/index.ts +0 -1
  147. package/src/client/theme/components/Playground/playground.css +0 -238
  148. package/src/client/theme/components/Video/Video.tsx +0 -84
  149. package/src/client/theme/components/Video/index.ts +0 -1
  150. package/src/client/theme/components/Video/video.css +0 -41
  151. package/src/client/theme/components/mdx/Admonition.tsx +0 -80
  152. package/src/client/theme/components/mdx/Badge.tsx +0 -31
  153. package/src/client/theme/components/mdx/Button.tsx +0 -50
  154. package/src/client/theme/components/mdx/Card.tsx +0 -80
  155. package/src/client/theme/components/mdx/Field.tsx +0 -60
  156. package/src/client/theme/components/mdx/FileTree.tsx +0 -229
  157. package/src/client/theme/components/mdx/List.tsx +0 -57
  158. package/src/client/theme/components/mdx/Table.tsx +0 -151
  159. package/src/client/theme/components/mdx/Tabs.tsx +0 -123
  160. package/src/client/theme/components/mdx/index.ts +0 -27
  161. package/src/client/theme/components/mdx/mdx-components.css +0 -764
  162. package/src/client/theme/icons/bun.tsx +0 -62
  163. package/src/client/theme/icons/deno.tsx +0 -20
  164. package/src/client/theme/icons/discord.tsx +0 -12
  165. package/src/client/theme/icons/github.tsx +0 -15
  166. package/src/client/theme/icons/npm.tsx +0 -13
  167. package/src/client/theme/icons/pnpm.tsx +0 -72
  168. package/src/client/theme/icons/twitter.tsx +0 -12
  169. package/src/client/theme/styles/markdown.css +0 -394
  170. package/src/client/theme/styles/variables.css +0 -175
  171. package/src/client/theme/styles.css +0 -39
  172. package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +0 -68
  173. package/src/client/theme/ui/Breadcrumbs/index.ts +0 -1
  174. package/src/client/theme/ui/CopyMarkdown/CopyMarkdown.tsx +0 -82
  175. package/src/client/theme/ui/CopyMarkdown/copy-markdown.css +0 -112
  176. package/src/client/theme/ui/CopyMarkdown/index.ts +0 -1
  177. package/src/client/theme/ui/ErrorBoundary/ErrorBoundary.tsx +0 -50
  178. package/src/client/theme/ui/ErrorBoundary/error-boundary.css +0 -55
  179. package/src/client/theme/ui/ErrorBoundary/index.ts +0 -1
  180. package/src/client/theme/ui/Footer/footer.css +0 -32
  181. package/src/client/theme/ui/Head/Head.tsx +0 -69
  182. package/src/client/theme/ui/Head/index.ts +0 -1
  183. package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +0 -125
  184. package/src/client/theme/ui/LanguageSwitcher/index.ts +0 -1
  185. package/src/client/theme/ui/LanguageSwitcher/language-switcher.css +0 -98
  186. package/src/client/theme/ui/Layout/Layout.tsx +0 -203
  187. package/src/client/theme/ui/Layout/base.css +0 -106
  188. package/src/client/theme/ui/Layout/index.ts +0 -2
  189. package/src/client/theme/ui/Layout/pagination.css +0 -72
  190. package/src/client/theme/ui/Layout/responsive.css +0 -47
  191. package/src/client/theme/ui/Link/Link.tsx +0 -392
  192. package/src/client/theme/ui/Link/LinkPreview.tsx +0 -59
  193. package/src/client/theme/ui/Link/index.ts +0 -2
  194. package/src/client/theme/ui/Link/link-preview.css +0 -48
  195. package/src/client/theme/ui/Loading/Loading.tsx +0 -10
  196. package/src/client/theme/ui/Loading/index.ts +0 -1
  197. package/src/client/theme/ui/Loading/loading.css +0 -30
  198. package/src/client/theme/ui/Navbar/GithubStars.tsx +0 -27
  199. package/src/client/theme/ui/Navbar/Navbar.tsx +0 -193
  200. package/src/client/theme/ui/Navbar/Tabs.tsx +0 -99
  201. package/src/client/theme/ui/Navbar/index.ts +0 -2
  202. package/src/client/theme/ui/Navbar/navbar.css +0 -347
  203. package/src/client/theme/ui/NotFound/NotFound.tsx +0 -19
  204. package/src/client/theme/ui/NotFound/index.ts +0 -1
  205. package/src/client/theme/ui/NotFound/not-found.css +0 -64
  206. package/src/client/theme/ui/OnThisPage/OnThisPage.tsx +0 -244
  207. package/src/client/theme/ui/OnThisPage/index.ts +0 -1
  208. package/src/client/theme/ui/OnThisPage/toc.css +0 -152
  209. package/src/client/theme/ui/PoweredBy/PoweredBy.tsx +0 -18
  210. package/src/client/theme/ui/PoweredBy/index.ts +0 -1
  211. package/src/client/theme/ui/PoweredBy/powered-by.css +0 -76
  212. package/src/client/theme/ui/ProgressBar/ProgressBar.css +0 -17
  213. package/src/client/theme/ui/ProgressBar/ProgressBar.tsx +0 -51
  214. package/src/client/theme/ui/ProgressBar/index.ts +0 -1
  215. package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +0 -209
  216. package/src/client/theme/ui/SearchDialog/index.ts +0 -1
  217. package/src/client/theme/ui/SearchDialog/search.css +0 -152
  218. package/src/client/theme/ui/Sidebar/Sidebar.tsx +0 -244
  219. package/src/client/theme/ui/Sidebar/index.ts +0 -1
  220. package/src/client/theme/ui/Sidebar/sidebar.css +0 -230
  221. package/src/client/theme/ui/ThemeToggle/ThemeToggle.tsx +0 -69
  222. package/src/client/theme/ui/ThemeToggle/index.ts +0 -1
  223. package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +0 -136
  224. package/src/client/theme/ui/VersionSwitcher/index.ts +0 -1
  225. package/src/client/utils.ts +0 -49
@@ -1,3630 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res) => function __init() {
9
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
- };
11
- var __export = (target, all) => {
12
- for (var name in all)
13
- __defProp(target, name, { get: all[name], enumerable: true });
14
- };
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
-
33
- // src/client/app/preload.tsx
34
- function usePreload() {
35
- return (0, import_react.useContext)(PreloadContext);
36
- }
37
- function PreloadProvider({
38
- routes,
39
- modules,
40
- children
41
- }) {
42
- const preload = (0, import_react.useCallback)(
43
- (path) => {
44
- const cleanPath = path.split("#")[0].split("?")[0];
45
- const route = routes.find(
46
- (r) => r.path === cleanPath || cleanPath === "/" && r.path === ""
47
- );
48
- if (route && route.filePath) {
49
- const loaderKey = Object.keys(modules).find(
50
- (k) => k.endsWith("/" + route.filePath)
51
- );
52
- if (loaderKey) {
53
- modules[loaderKey]().catch((err) => {
54
- console.error(`[boltdocs] Failed to preload route ${path}:`, err);
55
- });
56
- }
57
- }
58
- },
59
- [routes, modules]
60
- );
61
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PreloadContext.Provider, { value: { preload, routes }, children });
62
- }
63
- var import_react, import_jsx_runtime, PreloadContext;
64
- var init_preload = __esm({
65
- "src/client/app/preload.tsx"() {
66
- "use strict";
67
- import_react = require("react");
68
- import_jsx_runtime = require("react/jsx-runtime");
69
- PreloadContext = (0, import_react.createContext)({
70
- preload: () => {
71
- },
72
- routes: []
73
- });
74
- }
75
- });
76
-
77
- // src/client/theme/ui/Link/link-preview.css
78
- var init_link_preview = __esm({
79
- "src/client/theme/ui/Link/link-preview.css"() {
80
- }
81
- });
82
-
83
- // src/client/theme/ui/Link/LinkPreview.tsx
84
- function LinkPreview({
85
- isVisible,
86
- title,
87
- summary,
88
- x,
89
- y
90
- }) {
91
- const ref = (0, import_react2.useRef)(null);
92
- const [position, setPosition] = (0, import_react2.useState)({ top: 0, left: 0 });
93
- (0, import_react2.useEffect)(() => {
94
- if (ref.current) {
95
- const rect = ref.current.getBoundingClientRect();
96
- const padding = 12;
97
- let top = y + padding;
98
- let left = x + padding;
99
- if (left + rect.width > window.innerWidth - 20) {
100
- left = x - rect.width - padding;
101
- }
102
- if (top + rect.height > window.innerHeight - 20) {
103
- top = y - rect.height - padding;
104
- }
105
- setPosition({ top, left });
106
- }
107
- }, [x, y, isVisible]);
108
- return (0, import_react_dom.createPortal)(
109
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
110
- "div",
111
- {
112
- ref,
113
- className: `boltdocs-link-preview ${isVisible ? "is-visible" : ""}`,
114
- style: {
115
- top: position.top,
116
- left: position.left
117
- },
118
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "boltdocs-link-preview-content", children: [
119
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "boltdocs-link-preview-title", children: title }),
120
- summary && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "boltdocs-link-preview-summary", children: summary })
121
- ] })
122
- }
123
- ),
124
- document.body
125
- );
126
- }
127
- var import_react2, import_react_dom, import_jsx_runtime2;
128
- var init_LinkPreview = __esm({
129
- "src/client/theme/ui/Link/LinkPreview.tsx"() {
130
- "use strict";
131
- import_react2 = require("react");
132
- import_react_dom = require("react-dom");
133
- init_link_preview();
134
- import_jsx_runtime2 = require("react/jsx-runtime");
135
- }
136
- });
137
-
138
- // src/client/theme/ui/Link/Link.tsx
139
- function useLocalizedTo(to) {
140
- const location = (0, import_react_router_dom.useLocation)();
141
- const config = useConfig();
142
- if (!config || typeof to !== "string") return to;
143
- if (!config.i18n && !config.versions) return to;
144
- const basePath = "/docs";
145
- if (!to.startsWith(basePath)) return to;
146
- const curSub = location.pathname.substring(basePath.length);
147
- const curParts = curSub.split("/").filter(Boolean);
148
- let currentVersion = config.versions?.defaultVersion;
149
- let currentLocale = config.i18n?.defaultLocale;
150
- let cIdx = 0;
151
- if (config.versions && curParts.length > cIdx && config.versions.versions[curParts[cIdx]]) {
152
- currentVersion = curParts[cIdx];
153
- cIdx++;
154
- }
155
- if (config.i18n && curParts.length > cIdx && config.i18n.locales[curParts[cIdx]]) {
156
- currentLocale = curParts[cIdx];
157
- }
158
- const toSub = to.substring(basePath.length);
159
- const toParts = toSub.split("/").filter(Boolean);
160
- let tIdx = 0;
161
- let hasVersion = false;
162
- let hasLocale = false;
163
- if (config.versions && toParts.length > tIdx && config.versions.versions[toParts[tIdx]]) {
164
- hasVersion = true;
165
- tIdx++;
166
- }
167
- if (config.i18n && toParts.length > tIdx && config.i18n.locales[toParts[tIdx]]) {
168
- hasLocale = true;
169
- tIdx++;
170
- }
171
- const routeParts = toParts.slice(tIdx);
172
- const finalParts = [];
173
- if (config.versions) {
174
- if (hasVersion) {
175
- finalParts.push(toParts[0]);
176
- } else if (currentVersion) {
177
- finalParts.push(currentVersion);
178
- }
179
- }
180
- if (config.i18n) {
181
- if (hasLocale) {
182
- finalParts.push(toParts[hasVersion ? 1 : 0]);
183
- } else if (currentLocale) {
184
- finalParts.push(currentLocale);
185
- }
186
- }
187
- finalParts.push(...routeParts);
188
- let finalPath = `${basePath}/${finalParts.join("/")}`;
189
- if (finalPath.endsWith("/")) {
190
- finalPath = finalPath.slice(0, -1);
191
- }
192
- return finalPath === basePath ? basePath : finalPath;
193
- }
194
- var import_react3, import_react_router_dom, import_jsx_runtime3, Link, NavLink;
195
- var init_Link = __esm({
196
- "src/client/theme/ui/Link/Link.tsx"() {
197
- "use strict";
198
- import_react3 = __toESM(require("react"));
199
- import_react_router_dom = require("react-router-dom");
200
- init_preload();
201
- init_app();
202
- init_LinkPreview();
203
- import_jsx_runtime3 = require("react/jsx-runtime");
204
- Link = import_react3.default.forwardRef(
205
- (props, ref) => {
206
- const {
207
- boltdocsPrefetch = "hover",
208
- boltdocsPreview = true,
209
- onMouseEnter,
210
- onMouseLeave,
211
- onFocus,
212
- onBlur,
213
- onClick,
214
- to,
215
- ...rest
216
- } = props;
217
- const localizedTo = useLocalizedTo(to);
218
- const { preload, routes } = usePreload();
219
- const config = useConfig();
220
- const navigate = (0, import_react_router_dom.useNavigate)();
221
- const shouldShowPreview = boltdocsPreview && config?.themeConfig?.linkPreview !== false;
222
- const [preview, setPreview] = import_react3.default.useState({ visible: false, x: 0, y: 0, title: "" });
223
- const handleMouseEnter = (e) => {
224
- onMouseEnter?.(e);
225
- if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
226
- preload(localizedTo);
227
- }
228
- if (shouldShowPreview && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
229
- const cleanPath = localizedTo.split("#")[0].split("?")[0];
230
- const route = routes.find(
231
- (r) => r.path === cleanPath || cleanPath === "/" && r.path === ""
232
- );
233
- if (route) {
234
- setPreview({
235
- visible: true,
236
- x: e.clientX,
237
- y: e.clientY,
238
- title: route.title,
239
- summary: route.description
240
- });
241
- }
242
- }
243
- };
244
- const handleMouseMove = (e) => {
245
- if (preview.visible) {
246
- setPreview((prev) => ({ ...prev, x: e.clientX, y: e.clientY }));
247
- }
248
- };
249
- const handleMouseLeave = (e) => {
250
- onMouseLeave?.(e);
251
- setPreview((prev) => ({ ...prev, visible: false }));
252
- };
253
- const handleFocus = (e) => {
254
- onFocus?.(e);
255
- if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
256
- preload(localizedTo);
257
- }
258
- };
259
- const handleBlur = (e) => {
260
- onBlur?.(e);
261
- setPreview((prev) => ({ ...prev, visible: false }));
262
- };
263
- const handleClick = (e) => {
264
- onClick?.(e);
265
- setPreview((prev) => ({ ...prev, visible: false }));
266
- if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
267
- return;
268
- }
269
- if (typeof localizedTo === "string" && !localizedTo.startsWith("http")) {
270
- e.preventDefault();
271
- import_react3.default.startTransition(() => {
272
- navigate(localizedTo);
273
- });
274
- }
275
- };
276
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
277
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
278
- import_react_router_dom.Link,
279
- {
280
- ref,
281
- to: localizedTo,
282
- onMouseEnter: handleMouseEnter,
283
- onMouseMove: handleMouseMove,
284
- onMouseLeave: handleMouseLeave,
285
- onFocus: handleFocus,
286
- onBlur: handleBlur,
287
- onClick: handleClick,
288
- ...rest
289
- }
290
- ),
291
- preview.visible && shouldShowPreview && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
292
- LinkPreview,
293
- {
294
- isVisible: preview.visible,
295
- title: preview.title,
296
- summary: preview.summary,
297
- x: preview.x,
298
- y: preview.y
299
- }
300
- )
301
- ] });
302
- }
303
- );
304
- Link.displayName = "Link";
305
- NavLink = import_react3.default.forwardRef(
306
- (props, ref) => {
307
- const {
308
- boltdocsPrefetch = "hover",
309
- boltdocsPreview = true,
310
- onMouseEnter,
311
- onMouseLeave,
312
- onFocus,
313
- onBlur,
314
- onClick,
315
- to,
316
- ...rest
317
- } = props;
318
- const localizedTo = useLocalizedTo(to);
319
- const { preload, routes } = usePreload();
320
- const config = useConfig();
321
- const navigate = (0, import_react_router_dom.useNavigate)();
322
- const shouldShowPreview = boltdocsPreview && config?.themeConfig?.linkPreview !== false;
323
- const [preview, setPreview] = import_react3.default.useState({ visible: false, x: 0, y: 0, title: "" });
324
- const handleMouseEnter = (e) => {
325
- onMouseEnter?.(e);
326
- if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
327
- preload(localizedTo);
328
- }
329
- if (shouldShowPreview && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
330
- const cleanPath = localizedTo.split("#")[0].split("?")[0];
331
- const route = routes.find(
332
- (r) => r.path === cleanPath || cleanPath === "/" && r.path === ""
333
- );
334
- if (route) {
335
- setPreview({
336
- visible: true,
337
- x: e.clientX,
338
- y: e.clientY,
339
- title: route.title,
340
- summary: route.description
341
- });
342
- }
343
- }
344
- };
345
- const handleMouseMove = (e) => {
346
- if (preview.visible) {
347
- setPreview((prev) => ({ ...prev, x: e.clientX, y: e.clientY }));
348
- }
349
- };
350
- const handleMouseLeave = (e) => {
351
- onMouseLeave?.(e);
352
- setPreview((prev) => ({ ...prev, visible: false }));
353
- };
354
- const handleFocus = (e) => {
355
- onFocus?.(e);
356
- if (boltdocsPrefetch === "hover" && typeof localizedTo === "string" && localizedTo.startsWith("/")) {
357
- preload(localizedTo);
358
- }
359
- };
360
- const handleBlur = (e) => {
361
- onBlur?.(e);
362
- setPreview((prev) => ({ ...prev, visible: false }));
363
- };
364
- const handleClick = (e) => {
365
- onClick?.(e);
366
- setPreview((prev) => ({ ...prev, visible: false }));
367
- if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
368
- return;
369
- }
370
- if (typeof localizedTo === "string" && !localizedTo.startsWith("http")) {
371
- e.preventDefault();
372
- import_react3.default.startTransition(() => {
373
- navigate(localizedTo);
374
- });
375
- }
376
- };
377
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
378
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
379
- import_react_router_dom.NavLink,
380
- {
381
- ref,
382
- to: localizedTo,
383
- onMouseEnter: handleMouseEnter,
384
- onMouseMove: handleMouseMove,
385
- onMouseLeave: handleMouseLeave,
386
- onFocus: handleFocus,
387
- onBlur: handleBlur,
388
- onClick: handleClick,
389
- ...rest
390
- }
391
- ),
392
- preview.visible && shouldShowPreview && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
393
- LinkPreview,
394
- {
395
- isVisible: preview.visible,
396
- title: preview.title,
397
- summary: preview.summary,
398
- x: preview.x,
399
- y: preview.y
400
- }
401
- )
402
- ] });
403
- }
404
- );
405
- NavLink.displayName = "NavLink";
406
- }
407
- });
408
-
409
- // src/client/theme/ui/Link/index.ts
410
- var init_Link2 = __esm({
411
- "src/client/theme/ui/Link/index.ts"() {
412
- "use strict";
413
- init_Link();
414
- }
415
- });
416
-
417
- // src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx
418
- function getBaseFilePath(filePath, version, locale) {
419
- let path = filePath;
420
- if (version && (path === version || path.startsWith(version + "/"))) {
421
- path = path === version ? "index.md" : path.slice(version.length + 1);
422
- }
423
- if (locale && (path === locale || path.startsWith(locale + "/"))) {
424
- path = path === locale ? "index.md" : path.slice(locale.length + 1);
425
- }
426
- return path;
427
- }
428
- function LanguageSwitcher({
429
- i18n,
430
- currentLocale,
431
- allRoutes
432
- }) {
433
- const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
434
- const dropdownRef = (0, import_react4.useRef)(null);
435
- const navigate = (0, import_react_router_dom2.useNavigate)();
436
- const location = (0, import_react_router_dom2.useLocation)();
437
- (0, import_react4.useEffect)(() => {
438
- function handleClickOutside(event) {
439
- if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
440
- setIsOpen(false);
441
- }
442
- }
443
- document.addEventListener("mousedown", handleClickOutside);
444
- return () => document.removeEventListener("mousedown", handleClickOutside);
445
- }, []);
446
- const handleSelect = (locale) => {
447
- setIsOpen(false);
448
- if (locale === currentLocale) return;
449
- const currentRoute = allRoutes.find((r) => r.path === location.pathname);
450
- let targetPath = "/";
451
- if (currentRoute) {
452
- const baseFile = getBaseFilePath(
453
- currentRoute.filePath,
454
- currentRoute.version,
455
- currentRoute.locale
456
- );
457
- const targetRoute = allRoutes.find(
458
- (r) => getBaseFilePath(r.filePath, r.version, r.locale) === baseFile && (r.locale || i18n.defaultLocale) === locale && r.version === currentRoute.version
459
- );
460
- if (targetRoute) {
461
- targetPath = targetRoute.path;
462
- } else {
463
- const defaultIndexRoute = allRoutes.find(
464
- (r) => getBaseFilePath(r.filePath, r.version, r.locale) === "index.md" && (r.locale || i18n.defaultLocale) === locale && r.version === currentRoute.version
465
- );
466
- targetPath = defaultIndexRoute ? defaultIndexRoute.path : locale === i18n.defaultLocale ? currentRoute.version ? `/${currentRoute.version}` : "/" : currentRoute.version ? `/${currentRoute.version}/${locale}` : `/${locale}`;
467
- }
468
- } else {
469
- targetPath = locale === i18n.defaultLocale ? "/" : `/${locale}`;
470
- }
471
- navigate(targetPath);
472
- };
473
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "boltdocs-language-switcher", ref: dropdownRef, children: [
474
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
475
- "button",
476
- {
477
- className: "language-btn",
478
- onClick: () => setIsOpen(!isOpen),
479
- "aria-label": "Switch language",
480
- "aria-expanded": isOpen,
481
- "aria-haspopup": "listbox",
482
- children: [
483
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.Globe, { size: 18 }),
484
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "language-label", children: i18n.locales[currentLocale] || currentLocale }),
485
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronDown, { size: 14 })
486
- ]
487
- }
488
- ),
489
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "language-dropdown", children: Object.entries(i18n.locales).map(([key, label]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
490
- "button",
491
- {
492
- className: `language-option ${key === currentLocale ? "active" : ""}`,
493
- onClick: () => handleSelect(key),
494
- children: label
495
- },
496
- key
497
- )) })
498
- ] });
499
- }
500
- var import_react4, import_lucide_react, import_react_router_dom2, import_jsx_runtime4;
501
- var init_LanguageSwitcher = __esm({
502
- "src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx"() {
503
- "use strict";
504
- import_react4 = require("react");
505
- import_lucide_react = require("lucide-react");
506
- import_react_router_dom2 = require("react-router-dom");
507
- import_jsx_runtime4 = require("react/jsx-runtime");
508
- }
509
- });
510
-
511
- // src/client/theme/ui/LanguageSwitcher/index.ts
512
- var init_LanguageSwitcher2 = __esm({
513
- "src/client/theme/ui/LanguageSwitcher/index.ts"() {
514
- "use strict";
515
- init_LanguageSwitcher();
516
- }
517
- });
518
-
519
- // src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx
520
- function getBaseFilePath2(filePath, version, locale) {
521
- let path = filePath;
522
- if (version && (path === version || path.startsWith(version + "/"))) {
523
- path = path === version ? "index.md" : path.slice(version.length + 1);
524
- }
525
- if (locale && (path === locale || path.startsWith(locale + "/"))) {
526
- path = path === locale ? "index.md" : path.slice(locale.length + 1);
527
- }
528
- return path;
529
- }
530
- function VersionSwitcher({
531
- versions,
532
- currentVersion,
533
- currentLocale,
534
- allRoutes
535
- }) {
536
- const [isOpen, setIsOpen] = (0, import_react5.useState)(false);
537
- const dropdownRef = (0, import_react5.useRef)(null);
538
- const navigate = (0, import_react_router_dom3.useNavigate)();
539
- const location = (0, import_react_router_dom3.useLocation)();
540
- (0, import_react5.useEffect)(() => {
541
- function handleClickOutside(event) {
542
- if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
543
- setIsOpen(false);
544
- }
545
- }
546
- document.addEventListener("mousedown", handleClickOutside);
547
- return () => document.removeEventListener("mousedown", handleClickOutside);
548
- }, []);
549
- const handleSelect = (version) => {
550
- setIsOpen(false);
551
- if (version === currentVersion) return;
552
- const currentRoute = allRoutes.find((r) => r.path === location.pathname);
553
- let targetPath = `/docs/${version}`;
554
- if (currentRoute) {
555
- const baseFile = getBaseFilePath2(
556
- currentRoute.filePath,
557
- currentRoute.version,
558
- currentRoute.locale
559
- );
560
- const targetRoute = allRoutes.find(
561
- (r) => getBaseFilePath2(r.filePath, r.version, r.locale) === baseFile && (r.version || versions.defaultVersion) === version && (currentLocale ? r.locale === currentLocale : !r.locale)
562
- );
563
- if (targetRoute) {
564
- targetPath = targetRoute.path;
565
- } else {
566
- const versionIndexRoute = allRoutes.find(
567
- (r) => getBaseFilePath2(r.filePath, r.version, r.locale) === "index.md" && (r.version || versions.defaultVersion) === version && (currentLocale ? r.locale === currentLocale : !r.locale)
568
- );
569
- targetPath = versionIndexRoute ? versionIndexRoute.path : `/docs/${version}${currentLocale ? `/${currentLocale}` : ""}`;
570
- }
571
- }
572
- navigate(targetPath);
573
- };
574
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
575
- "div",
576
- {
577
- className: "boltdocs-version-switcher",
578
- ref: dropdownRef,
579
- style: { position: "relative", display: "flex", alignItems: "center" },
580
- children: [
581
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
582
- "button",
583
- {
584
- className: "navbar-version",
585
- onClick: () => setIsOpen(!isOpen),
586
- "aria-label": "Switch version",
587
- "aria-expanded": isOpen,
588
- "aria-haspopup": "listbox",
589
- style: {
590
- fontFamily: "inherit",
591
- padding: "0.25rem 0.5rem",
592
- marginLeft: "0.5rem"
593
- },
594
- children: [
595
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: versions.versions[currentVersion] || currentVersion }),
596
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.ChevronDown, { size: 14 })
597
- ]
598
- }
599
- ),
600
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
601
- "div",
602
- {
603
- className: "language-dropdown",
604
- style: {
605
- left: "0.5rem",
606
- right: "auto",
607
- minWidth: "150px",
608
- top: "calc(100% + 8px)"
609
- },
610
- children: Object.entries(versions.versions).map(([key, label]) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
611
- "button",
612
- {
613
- className: `language-option ${key === currentVersion ? "active" : ""}`,
614
- onClick: () => handleSelect(key),
615
- children: label
616
- },
617
- key
618
- ))
619
- }
620
- )
621
- ]
622
- }
623
- );
624
- }
625
- var import_react5, import_lucide_react2, import_react_router_dom3, import_jsx_runtime5;
626
- var init_VersionSwitcher = __esm({
627
- "src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx"() {
628
- "use strict";
629
- import_react5 = require("react");
630
- import_lucide_react2 = require("lucide-react");
631
- import_react_router_dom3 = require("react-router-dom");
632
- import_jsx_runtime5 = require("react/jsx-runtime");
633
- }
634
- });
635
-
636
- // src/client/theme/ui/VersionSwitcher/index.ts
637
- var init_VersionSwitcher2 = __esm({
638
- "src/client/theme/ui/VersionSwitcher/index.ts"() {
639
- "use strict";
640
- init_VersionSwitcher();
641
- }
642
- });
643
-
644
- // src/client/theme/ui/ThemeToggle/ThemeToggle.tsx
645
- function ThemeToggle() {
646
- const [theme, setTheme] = (0, import_react6.useState)("dark");
647
- const [mounted, setMounted] = (0, import_react6.useState)(false);
648
- (0, import_react6.useEffect)(() => {
649
- setMounted(true);
650
- const stored = localStorage.getItem("boltdocs-theme");
651
- if (stored === "light" || stored === "dark") {
652
- setTheme(stored);
653
- } else {
654
- const prefersDark = window.matchMedia(
655
- "(prefers-color-scheme: dark)"
656
- ).matches;
657
- setTheme(prefersDark ? "dark" : "light");
658
- }
659
- const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
660
- const handleChange = (e) => {
661
- if (!localStorage.getItem("boltdocs-theme")) {
662
- setTheme(e.matches ? "dark" : "light");
663
- }
664
- };
665
- mediaQuery.addEventListener("change", handleChange);
666
- return () => mediaQuery.removeEventListener("change", handleChange);
667
- }, []);
668
- (0, import_react6.useEffect)(() => {
669
- if (!mounted) return;
670
- const root = document.documentElement;
671
- if (theme === "light") {
672
- root.classList.add("theme-light");
673
- root.dataset.theme = "light";
674
- } else {
675
- root.classList.remove("theme-light");
676
- root.dataset.theme = "dark";
677
- }
678
- }, [theme, mounted]);
679
- const toggleTheme = () => {
680
- const newTheme = theme === "dark" ? "light" : "dark";
681
- setTheme(newTheme);
682
- localStorage.setItem("boltdocs-theme", newTheme);
683
- };
684
- if (!mounted) {
685
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: "navbar-icon-btn", "aria-label": "Toggle theme", disabled: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { width: 20, height: 20, display: "inline-block" } }) });
686
- }
687
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
688
- "button",
689
- {
690
- className: "navbar-icon-btn",
691
- onClick: toggleTheme,
692
- "aria-label": "Toggle theme",
693
- title: `Switch to ${theme === "dark" ? "light" : "dark"} theme`,
694
- children: theme === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react3.Sun, { size: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react3.Moon, { size: 20 })
695
- }
696
- );
697
- }
698
- var import_react6, import_lucide_react3, import_jsx_runtime6;
699
- var init_ThemeToggle = __esm({
700
- "src/client/theme/ui/ThemeToggle/ThemeToggle.tsx"() {
701
- "use strict";
702
- import_react6 = require("react");
703
- import_lucide_react3 = require("lucide-react");
704
- import_jsx_runtime6 = require("react/jsx-runtime");
705
- }
706
- });
707
-
708
- // src/client/theme/ui/ThemeToggle/index.ts
709
- var init_ThemeToggle2 = __esm({
710
- "src/client/theme/ui/ThemeToggle/index.ts"() {
711
- "use strict";
712
- init_ThemeToggle();
713
- }
714
- });
715
-
716
- // src/client/theme/icons/discord.tsx
717
- var import_jsx_runtime7, Discord;
718
- var init_discord = __esm({
719
- "src/client/theme/icons/discord.tsx"() {
720
- "use strict";
721
- import_jsx_runtime7 = require("react/jsx-runtime");
722
- Discord = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { ...props, viewBox: "0 0 256 199", preserveAspectRatio: "xMidYMid", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
723
- "path",
724
- {
725
- d: "M216.856 16.597A208.502 208.502 0 0 0 164.042 0c-2.275 4.113-4.933 9.645-6.766 14.046-19.692-2.961-39.203-2.961-58.533 0-1.832-4.4-4.55-9.933-6.846-14.046a207.809 207.809 0 0 0-52.855 16.638C5.618 67.147-3.443 116.4 1.087 164.956c22.169 16.555 43.653 26.612 64.775 33.193A161.094 161.094 0 0 0 79.735 175.3a136.413 136.413 0 0 1-21.846-10.632 108.636 108.636 0 0 0 5.356-4.237c42.122 19.702 87.89 19.702 129.51 0a131.66 131.66 0 0 0 5.355 4.237 136.07 136.07 0 0 1-21.886 10.653c4.006 8.02 8.638 15.67 13.873 22.848 21.142-6.58 42.646-16.637 64.815-33.213 5.316-56.288-9.08-105.09-38.056-148.36ZM85.474 135.095c-12.645 0-23.015-11.805-23.015-26.18s10.149-26.2 23.015-26.2c12.867 0 23.236 11.804 23.015 26.2.02 14.375-10.148 26.18-23.015 26.18Zm85.051 0c-12.645 0-23.014-11.805-23.014-26.18s10.148-26.2 23.014-26.2c12.867 0 23.236 11.804 23.015 26.2 0 14.375-10.148 26.18-23.015 26.18Z",
726
- fill: "currentColor"
727
- }
728
- ) });
729
- }
730
- });
731
-
732
- // src/client/theme/icons/twitter.tsx
733
- var import_jsx_runtime8, XformerlyTwitter;
734
- var init_twitter = __esm({
735
- "src/client/theme/icons/twitter.tsx"() {
736
- "use strict";
737
- import_jsx_runtime8 = require("react/jsx-runtime");
738
- XformerlyTwitter = (props) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { ...props, fill: "none", viewBox: "0 0 1200 1227", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
739
- "path",
740
- {
741
- fill: "currentColor",
742
- d: "M714.163 519.284 1160.89 0h-105.86L667.137 450.887 357.328 0H0l468.492 681.821L0 1226.37h105.866l409.625-476.152 327.181 476.152H1200L714.137 519.284h.026ZM569.165 687.828l-47.468-67.894-377.686-540.24h162.604l304.797 435.991 47.468 67.894 396.2 566.721H892.476L569.165 687.854v-.026Z"
743
- }
744
- ) });
745
- }
746
- });
747
-
748
- // src/client/theme/icons/github.tsx
749
- var import_jsx_runtime9, GitHub;
750
- var init_github = __esm({
751
- "src/client/theme/icons/github.tsx"() {
752
- "use strict";
753
- import_jsx_runtime9 = require("react/jsx-runtime");
754
- GitHub = (props) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { ...props, viewBox: "0 0 1024 1024", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
755
- "path",
756
- {
757
- fillRule: "evenodd",
758
- clipRule: "evenodd",
759
- d: "M8 0C3.58 0 0 3.58 0 8C0 11.54 2.29 14.53 5.47 15.59C5.87 15.66 6.02 15.42 6.02 15.21C6.02 15.02 6.01 14.39 6.01 13.72C4 14.09 3.48 13.23 3.32 12.78C3.23 12.55 2.84 11.84 2.5 11.65C2.22 11.5 1.82 11.13 2.49 11.12C3.12 11.11 3.57 11.7 3.72 11.94C4.44 13.15 5.59 12.81 6.05 12.6C6.12 12.08 6.33 11.73 6.56 11.53C4.78 11.33 2.92 10.64 2.92 7.58C2.92 6.71 3.23 5.99 3.74 5.43C3.66 5.23 3.38 4.41 3.82 3.31C3.82 3.31 4.49 3.1 6.02 4.13C6.66 3.95 7.34 3.86 8.02 3.86C8.7 3.86 9.38 3.95 10.02 4.13C11.55 3.09 12.22 3.31 12.22 3.31C12.66 4.41 12.38 5.23 12.3 5.43C12.81 5.99 13.12 6.7 13.12 7.58C13.12 10.65 11.25 11.33 9.47 11.53C9.76 11.78 10.01 12.26 10.01 13.01C10.01 14.08 10 14.94 10 15.21C10 15.42 10.15 15.67 10.55 15.59C13.71 14.53 16 11.53 16 8C16 3.58 12.42 0 8 0Z",
760
- transform: "scale(64)",
761
- fill: "currentColor"
762
- }
763
- ) });
764
- }
765
- });
766
-
767
- // src/client/utils.ts
768
- async function getStarsRepo(repo) {
769
- const response = await fetch(`https://api.github.com/repos/${repo}`);
770
- const data = await response.json();
771
- if (data.stargazers_count !== void 0) {
772
- return formatStars(data.stargazers_count);
773
- } else {
774
- return "0";
775
- }
776
- }
777
- var formatStars, copyToClipboard;
778
- var init_utils = __esm({
779
- "src/client/utils.ts"() {
780
- "use strict";
781
- formatStars = (count) => {
782
- return Intl.NumberFormat("en", {
783
- notation: "compact",
784
- compactDisplay: "short"
785
- }).format(count);
786
- };
787
- copyToClipboard = async (text) => {
788
- try {
789
- await navigator.clipboard.writeText(text);
790
- return true;
791
- } catch {
792
- const textarea = document.createElement("textarea");
793
- textarea.value = text;
794
- textarea.style.position = "fixed";
795
- textarea.style.opacity = "0";
796
- document.body.appendChild(textarea);
797
- textarea.select();
798
- document.execCommand("copy");
799
- document.body.removeChild(textarea);
800
- return true;
801
- }
802
- };
803
- }
804
- });
805
-
806
- // src/client/theme/ui/Navbar/GithubStars.tsx
807
- function GithubStars({ repo }) {
808
- const [stars, setStars] = (0, import_react7.useState)(null);
809
- (0, import_react7.useEffect)(() => {
810
- if (repo) {
811
- getStarsRepo(repo).then((stars2) => setStars(stars2)).catch(() => setStars("0"));
812
- }
813
- }, [repo]);
814
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
815
- "a",
816
- {
817
- href: `https://github.com/${repo}`,
818
- target: "_blank",
819
- rel: "noopener noreferrer",
820
- className: "navbar-github-stars",
821
- children: [
822
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GitHub, {}),
823
- stars && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: stars })
824
- ]
825
- }
826
- );
827
- }
828
- var import_react7, import_jsx_runtime10;
829
- var init_GithubStars = __esm({
830
- "src/client/theme/ui/Navbar/GithubStars.tsx"() {
831
- "use strict";
832
- import_react7 = require("react");
833
- init_github();
834
- init_utils();
835
- import_jsx_runtime10 = require("react/jsx-runtime");
836
- }
837
- });
838
-
839
- // src/client/theme/ui/Navbar/Tabs.tsx
840
- function Tabs({ tabs, routes }) {
841
- const location = (0, import_react_router_dom4.useLocation)();
842
- const containerRef = (0, import_react8.useRef)(null);
843
- const tabRefs = (0, import_react8.useRef)([]);
844
- const [indicatorStyle, setIndicatorStyle] = (0, import_react8.useState)({
845
- opacity: 0,
846
- transform: "translateX(0) scaleX(0)",
847
- width: 0
848
- });
849
- const currentRoute = routes.find((r) => r.path === location.pathname);
850
- const currentTabId = currentRoute?.tab?.toLowerCase();
851
- const activeIndex = tabs.findIndex(
852
- (tab) => currentTabId ? currentTabId === tab.id.toLowerCase() : false
853
- );
854
- const finalActiveIndex = activeIndex === -1 ? 0 : activeIndex;
855
- (0, import_react8.useEffect)(() => {
856
- const activeTab = tabRefs.current[finalActiveIndex];
857
- if (activeTab) {
858
- setIndicatorStyle({
859
- opacity: 1,
860
- width: activeTab.offsetWidth,
861
- transform: `translateX(${activeTab.offsetLeft}px)`
862
- });
863
- }
864
- }, [finalActiveIndex, tabs, location.pathname]);
865
- if (!tabs || tabs.length === 0) return null;
866
- const renderTabIcon = (iconName) => {
867
- if (!iconName) return null;
868
- if (iconName.trim().startsWith("<svg")) {
869
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
870
- "span",
871
- {
872
- className: "tab-icon svg-icon",
873
- dangerouslySetInnerHTML: { __html: iconName }
874
- }
875
- );
876
- }
877
- const LucideIcon = Icons[iconName];
878
- if (LucideIcon) {
879
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LucideIcon, { size: 16, className: "tab-icon lucide-icon" });
880
- }
881
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("img", { src: iconName, alt: "", className: "tab-icon img-icon" });
882
- };
883
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "boltdocs-tabs-container", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "boltdocs-tabs", ref: containerRef, children: [
884
- tabs.map((tab, index) => {
885
- const isActive = index === finalActiveIndex;
886
- const firstRoute = routes.find(
887
- (r) => r.tab && r.tab.toLowerCase() === tab.id.toLowerCase()
888
- );
889
- const linkTo = firstRoute ? firstRoute.path : "#";
890
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
891
- Link,
892
- {
893
- to: linkTo,
894
- ref: (el) => {
895
- tabRefs.current[index] = el;
896
- },
897
- className: `boltdocs-tab-item ${isActive ? "active" : ""}`,
898
- children: [
899
- renderTabIcon(tab.icon),
900
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: tab.text })
901
- ]
902
- },
903
- tab.id
904
- );
905
- }),
906
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "boltdocs-tab-indicator", style: indicatorStyle })
907
- ] }) });
908
- }
909
- var import_react8, import_react_router_dom4, Icons, import_jsx_runtime11;
910
- var init_Tabs = __esm({
911
- "src/client/theme/ui/Navbar/Tabs.tsx"() {
912
- "use strict";
913
- import_react8 = require("react");
914
- import_react_router_dom4 = require("react-router-dom");
915
- init_Link2();
916
- Icons = __toESM(require("lucide-react"));
917
- import_jsx_runtime11 = require("react/jsx-runtime");
918
- }
919
- });
920
-
921
- // src/client/theme/ui/SearchDialog/SearchDialog.tsx
922
- function SearchDialog({ routes }) {
923
- const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
924
- const [query, setQuery] = (0, import_react9.useState)("");
925
- const inputRef = (0, import_react9.useRef)(null);
926
- (0, import_react9.useEffect)(() => {
927
- const handleKeyDown = (e) => {
928
- if ((e.metaKey || e.ctrlKey) && e.key === "k") {
929
- e.preventDefault();
930
- setIsOpen((prev) => !prev);
931
- }
932
- if (e.key === "Escape" && isOpen) {
933
- setIsOpen(false);
934
- }
935
- };
936
- window.addEventListener("keydown", handleKeyDown);
937
- return () => window.removeEventListener("keydown", handleKeyDown);
938
- }, [isOpen]);
939
- (0, import_react9.useEffect)(() => {
940
- if (isOpen) {
941
- setTimeout(() => inputRef.current?.focus(), 50);
942
- } else {
943
- setQuery("");
944
- }
945
- }, [isOpen]);
946
- const searchResults = import_react9.default.useMemo(() => {
947
- if (!query) {
948
- return routes.slice(0, 10).map((r) => ({
949
- title: r.title,
950
- path: r.path,
951
- groupTitle: r.groupTitle
952
- }));
953
- }
954
- const results = [];
955
- const lowerQuery = query.toLowerCase();
956
- for (const route of routes) {
957
- if (route.title && route.title.toLowerCase().includes(lowerQuery)) {
958
- results.push({
959
- title: route.title,
960
- path: route.path,
961
- groupTitle: route.groupTitle
962
- });
963
- }
964
- if (route.headings) {
965
- for (const heading of route.headings) {
966
- if (heading.text.toLowerCase().includes(lowerQuery)) {
967
- results.push({
968
- title: heading.text,
969
- path: `${route.path}#${heading.id}`,
970
- groupTitle: route.title,
971
- isHeading: true
972
- });
973
- }
974
- }
975
- }
976
- if (route._content && route._content.toLowerCase().includes(lowerQuery)) {
977
- results.push({
978
- title: route.title,
979
- path: route.path,
980
- groupTitle: route.groupTitle
981
- });
982
- }
983
- }
984
- const uniqueResults = [];
985
- const seenPaths = /* @__PURE__ */ new Set();
986
- for (const res of results) {
987
- if (!seenPaths.has(res.path)) {
988
- seenPaths.add(res.path);
989
- uniqueResults.push(res);
990
- }
991
- }
992
- return uniqueResults.slice(0, 10);
993
- }, [routes, query]);
994
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
995
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
996
- "div",
997
- {
998
- className: "navbar-search",
999
- role: "button",
1000
- tabIndex: 0,
1001
- onClick: () => setIsOpen(true),
1002
- onKeyDown: (e) => {
1003
- if (e.key === "Enter" || e.key === " ") {
1004
- e.preventDefault();
1005
- setIsOpen(true);
1006
- }
1007
- },
1008
- "aria-label": "Open search dialog",
1009
- children: [
1010
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Search, { className: "boltdocs-search-icon", size: 18 }),
1011
- "Search docs...",
1012
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("kbd", { children: "\u2318K" })
1013
- ]
1014
- }
1015
- ),
1016
- isOpen && (0, import_react_dom2.createPortal)(
1017
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1018
- "div",
1019
- {
1020
- className: "boltdocs-search-overlay",
1021
- onPointerDown: () => setIsOpen(false),
1022
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1023
- "div",
1024
- {
1025
- className: "boltdocs-search-modal",
1026
- role: "dialog",
1027
- "aria-modal": "true",
1028
- "aria-label": "Search",
1029
- onPointerDown: (e) => e.stopPropagation(),
1030
- children: [
1031
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "boltdocs-search-header", children: [
1032
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Search, { size: 18 }),
1033
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1034
- "input",
1035
- {
1036
- ref: inputRef,
1037
- type: "text",
1038
- "aria-label": "Search documentation input",
1039
- placeholder: "Search documentation...",
1040
- value: query,
1041
- onChange: (e) => setQuery(e.target.value)
1042
- }
1043
- ),
1044
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1045
- "button",
1046
- {
1047
- className: "boltdocs-search-close",
1048
- onClick: () => setIsOpen(false),
1049
- "aria-label": "Close search",
1050
- children: "ESC"
1051
- }
1052
- )
1053
- ] }),
1054
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "boltdocs-search-results", children: searchResults.length > 0 ? searchResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1055
- Link,
1056
- {
1057
- to: result.path === "" ? "/" : result.path,
1058
- className: `boltdocs-search-result-item ${result.isHeading ? "is-heading" : ""}`,
1059
- onClick: (e) => {
1060
- const isSamePath = result.path.split("#")[0] === window.location.pathname;
1061
- if (isSamePath && result.isHeading) {
1062
- e.preventDefault();
1063
- const id = result.path.split("#")[1];
1064
- const el = document.getElementById(id);
1065
- if (el) {
1066
- const offset = 80;
1067
- const bodyRect = document.body.getBoundingClientRect().top;
1068
- const elementRect = el.getBoundingClientRect().top;
1069
- const elementPosition = elementRect - bodyRect;
1070
- const offsetPosition = elementPosition - offset;
1071
- window.scrollTo({
1072
- top: offsetPosition,
1073
- behavior: "smooth"
1074
- });
1075
- window.history.pushState(null, "", `#${id}`);
1076
- }
1077
- }
1078
- setIsOpen(false);
1079
- },
1080
- children: [
1081
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "boltdocs-search-result-title", children: [
1082
- result.isHeading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "heading-indicator", children: "#" }) : null,
1083
- result.title
1084
- ] }),
1085
- result.groupTitle && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "boltdocs-search-result-group", children: result.groupTitle })
1086
- ]
1087
- },
1088
- result.path
1089
- )) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "boltdocs-search-empty", children: [
1090
- 'No results found for "',
1091
- query,
1092
- '"'
1093
- ] }) })
1094
- ]
1095
- }
1096
- )
1097
- }
1098
- ),
1099
- document.body
1100
- )
1101
- ] });
1102
- }
1103
- var import_react9, import_react_dom2, import_lucide_react4, import_jsx_runtime12;
1104
- var init_SearchDialog = __esm({
1105
- "src/client/theme/ui/SearchDialog/SearchDialog.tsx"() {
1106
- "use strict";
1107
- import_react9 = __toESM(require("react"));
1108
- import_react_dom2 = require("react-dom");
1109
- init_Link2();
1110
- import_lucide_react4 = require("lucide-react");
1111
- import_jsx_runtime12 = require("react/jsx-runtime");
1112
- }
1113
- });
1114
-
1115
- // src/client/theme/ui/SearchDialog/index.ts
1116
- var SearchDialog_exports = {};
1117
- __export(SearchDialog_exports, {
1118
- SearchDialog: () => SearchDialog
1119
- });
1120
- var init_SearchDialog2 = __esm({
1121
- "src/client/theme/ui/SearchDialog/index.ts"() {
1122
- "use strict";
1123
- init_SearchDialog();
1124
- }
1125
- });
1126
-
1127
- // src/client/theme/ui/Navbar/Navbar.tsx
1128
- function Navbar({
1129
- config,
1130
- routes,
1131
- allRoutes,
1132
- currentLocale,
1133
- currentVersion
1134
- }) {
1135
- const location = (0, import_react_router_dom5.useLocation)();
1136
- const isHomePage = location.pathname === "/";
1137
- const title = config.themeConfig?.title || "Boltdocs";
1138
- const navItems = config.themeConfig?.navbar || [];
1139
- const socialLinks = config.themeConfig?.socialLinks || [];
1140
- const hasTabs = !isHomePage && config.themeConfig?.tabs && config.themeConfig.tabs.length > 0;
1141
- const leftItems = navItems.filter((item) => item.position !== "right");
1142
- const rightItems = navItems.filter((item) => item.position === "right");
1143
- const renderNavItem = (item, i) => {
1144
- const text = item.label || item.text || "";
1145
- const href = item.to || item.href || item.link || "";
1146
- const isExternal = href.startsWith("http") || href.startsWith("//") || href.includes("://");
1147
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_router_dom5.Link, { to: href, target: isExternal ? "_blank" : void 0, children: [
1148
- text,
1149
- isExternal && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "navbar-external-icon", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1150
- "svg",
1151
- {
1152
- viewBox: "0 0 24 24",
1153
- width: "13",
1154
- height: "13",
1155
- stroke: "currentColor",
1156
- strokeWidth: "2",
1157
- fill: "none",
1158
- strokeLinecap: "round",
1159
- strokeLinejoin: "round",
1160
- children: [
1161
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
1162
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("polyline", { points: "15 3 21 3 21 9" }),
1163
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
1164
- ]
1165
- }
1166
- ) })
1167
- ] }, i);
1168
- };
1169
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("header", { className: `boltdocs-navbar ${hasTabs ? "has-tabs" : ""}`, children: [
1170
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1171
- "div",
1172
- {
1173
- className: "navbar-container",
1174
- style: { height: "var(--ld-navbar-height)" },
1175
- children: [
1176
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "navbar-left", children: [
1177
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "navbar-logo", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_router_dom5.Link, { to: "/", children: [
1178
- config.themeConfig?.logo ? config.themeConfig.logo.trim().startsWith("<svg") ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1179
- "span",
1180
- {
1181
- className: "navbar-logo-svg",
1182
- dangerouslySetInnerHTML: {
1183
- __html: config.themeConfig.logo
1184
- }
1185
- }
1186
- ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1187
- "img",
1188
- {
1189
- src: config.themeConfig.logo,
1190
- alt: title,
1191
- className: "navbar-logo-img"
1192
- }
1193
- ) : null,
1194
- title
1195
- ] }) }),
1196
- config.versions && currentVersion && allRoutes ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1197
- VersionSwitcher,
1198
- {
1199
- versions: config.versions,
1200
- currentVersion,
1201
- currentLocale,
1202
- allRoutes
1203
- }
1204
- ) : config.themeConfig?.version ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "navbar-version", children: [
1205
- config.themeConfig.version,
1206
- " ",
1207
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react5.ChevronDown, { size: 14 })
1208
- ] }) : null,
1209
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("nav", { className: "navbar-links", "aria-label": "Top Navigation Left", children: leftItems.map(renderNavItem) })
1210
- ] }),
1211
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "navbar-right", children: [
1212
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("nav", { className: "navbar-links", "aria-label": "Top Navigation Right", children: rightItems.map(renderNavItem) }),
1213
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react10.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "navbar-search-placeholder" }), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SearchDialog2, { routes: routes || [] }) }),
1214
- config.i18n && currentLocale && allRoutes && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1215
- LanguageSwitcher,
1216
- {
1217
- i18n: config.i18n,
1218
- currentLocale,
1219
- allRoutes
1220
- }
1221
- ),
1222
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ThemeToggle, {}),
1223
- config.themeConfig?.githubRepo && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GithubStars, { repo: config.themeConfig.githubRepo }),
1224
- socialLinks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "navbar-divider" }),
1225
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "navbar-icons", children: socialLinks.map((link, i) => {
1226
- const IconComp = ICON_MAP[link.icon.toLowerCase()];
1227
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1228
- "a",
1229
- {
1230
- href: link.link,
1231
- target: "_blank",
1232
- rel: "noopener noreferrer",
1233
- className: "navbar-icon-btn",
1234
- "aria-label": link.icon,
1235
- children: IconComp ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconComp, {}) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: link.icon })
1236
- },
1237
- i
1238
- );
1239
- }) })
1240
- ] })
1241
- ]
1242
- }
1243
- ),
1244
- hasTabs && config.themeConfig?.tabs && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1245
- Tabs,
1246
- {
1247
- tabs: config.themeConfig.tabs,
1248
- routes: allRoutes || routes || []
1249
- }
1250
- )
1251
- ] });
1252
- }
1253
- var import_react10, import_react_router_dom5, import_lucide_react5, import_jsx_runtime13, SearchDialog2, ICON_MAP;
1254
- var init_Navbar = __esm({
1255
- "src/client/theme/ui/Navbar/Navbar.tsx"() {
1256
- "use strict";
1257
- import_react10 = require("react");
1258
- import_react_router_dom5 = require("react-router-dom");
1259
- import_lucide_react5 = require("lucide-react");
1260
- init_LanguageSwitcher2();
1261
- init_VersionSwitcher2();
1262
- init_ThemeToggle2();
1263
- init_discord();
1264
- init_twitter();
1265
- init_GithubStars();
1266
- init_Tabs();
1267
- import_jsx_runtime13 = require("react/jsx-runtime");
1268
- SearchDialog2 = (0, import_react10.lazy)(
1269
- () => Promise.resolve().then(() => (init_SearchDialog2(), SearchDialog_exports)).then((m) => ({ default: m.SearchDialog }))
1270
- );
1271
- ICON_MAP = {
1272
- discord: Discord,
1273
- x: XformerlyTwitter
1274
- };
1275
- }
1276
- });
1277
-
1278
- // src/client/theme/ui/Navbar/index.ts
1279
- var init_Navbar2 = __esm({
1280
- "src/client/theme/ui/Navbar/index.ts"() {
1281
- "use strict";
1282
- init_Navbar();
1283
- init_GithubStars();
1284
- }
1285
- });
1286
-
1287
- // src/client/theme/ui/PoweredBy/PoweredBy.tsx
1288
- function PoweredBy() {
1289
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "powered-by-container", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1290
- "a",
1291
- {
1292
- href: "https://github.com/jesusalcaladev/boltdocs",
1293
- target: "_blank",
1294
- rel: "noopener noreferrer",
1295
- className: "powered-by-link",
1296
- children: [
1297
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react6.Zap, { className: "powered-by-icon", size: 12, fill: "currentColor" }),
1298
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Powered by" }),
1299
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "powered-by-brand", children: "LiteDocs" })
1300
- ]
1301
- }
1302
- ) });
1303
- }
1304
- var import_lucide_react6, import_jsx_runtime14;
1305
- var init_PoweredBy = __esm({
1306
- "src/client/theme/ui/PoweredBy/PoweredBy.tsx"() {
1307
- "use strict";
1308
- import_lucide_react6 = require("lucide-react");
1309
- import_jsx_runtime14 = require("react/jsx-runtime");
1310
- }
1311
- });
1312
-
1313
- // src/client/theme/ui/PoweredBy/index.ts
1314
- var init_PoweredBy2 = __esm({
1315
- "src/client/theme/ui/PoweredBy/index.ts"() {
1316
- "use strict";
1317
- init_PoweredBy();
1318
- }
1319
- });
1320
-
1321
- // src/client/theme/ui/Sidebar/Sidebar.tsx
1322
- function renderBadge(badgeRaw) {
1323
- if (!badgeRaw) return null;
1324
- let text = "";
1325
- let expires = "";
1326
- if (typeof badgeRaw === "string") {
1327
- text = badgeRaw;
1328
- } else {
1329
- text = badgeRaw.text;
1330
- expires = badgeRaw.expires || "";
1331
- }
1332
- if (expires) {
1333
- const expireDate = new Date(expires);
1334
- const now = /* @__PURE__ */ new Date();
1335
- expireDate.setHours(0, 0, 0, 0);
1336
- now.setHours(0, 0, 0, 0);
1337
- if (now > expireDate) {
1338
- return null;
1339
- }
1340
- }
1341
- if (!text) return null;
1342
- let typeClass = "badge-default";
1343
- const lowerText = text.toLowerCase();
1344
- if (lowerText === "new") {
1345
- typeClass = "badge-new";
1346
- } else if (lowerText === "experimental") {
1347
- typeClass = "badge-experimental";
1348
- } else if (lowerText === "updated") {
1349
- typeClass = "badge-updated";
1350
- }
1351
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: `sidebar-badge ${typeClass}`, children: text });
1352
- }
1353
- function renderIcon(iconName, size = 16) {
1354
- if (!iconName) return null;
1355
- const trimmed = iconName.trim();
1356
- if (trimmed.startsWith("<svg") || trimmed.includes("http")) {
1357
- if (trimmed.startsWith("<svg")) {
1358
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1359
- "span",
1360
- {
1361
- className: "sidebar-icon svg-icon",
1362
- dangerouslySetInnerHTML: { __html: trimmed }
1363
- }
1364
- );
1365
- }
1366
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1367
- "img",
1368
- {
1369
- src: trimmed,
1370
- className: "sidebar-icon",
1371
- style: { width: size, height: size },
1372
- alt: ""
1373
- }
1374
- );
1375
- }
1376
- const IconComponent = LucideIcons[iconName];
1377
- if (IconComponent) {
1378
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IconComponent, { size, className: "sidebar-icon lucide-icon" });
1379
- }
1380
- return null;
1381
- }
1382
- function Sidebar({
1383
- routes,
1384
- config
1385
- }) {
1386
- const location = (0, import_react_router_dom6.useLocation)();
1387
- const currentRoute = routes.find((r) => r.path === location.pathname);
1388
- const activeTabId = currentRoute?.tab?.toLowerCase();
1389
- const filteredRoutes = activeTabId ? routes.filter((r) => {
1390
- if (!r.tab) return true;
1391
- return r.tab.toLowerCase() === activeTabId;
1392
- }) : routes;
1393
- const ungrouped = [];
1394
- const groupMap = /* @__PURE__ */ new Map();
1395
- for (const route of filteredRoutes) {
1396
- if (!route.group) {
1397
- ungrouped.push(route);
1398
- } else {
1399
- if (!groupMap.has(route.group)) {
1400
- groupMap.set(route.group, {
1401
- slug: route.group,
1402
- title: route.groupTitle || route.group,
1403
- routes: [],
1404
- icon: route.groupIcon
1405
- });
1406
- }
1407
- groupMap.get(route.group).routes.push(route);
1408
- }
1409
- }
1410
- const groups = Array.from(groupMap.values());
1411
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("aside", { className: "boltdocs-sidebar", children: [
1412
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("nav", { "aria-label": "Main Navigation", children: [
1413
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "sidebar-list", children: ungrouped.map((route) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1414
- Link,
1415
- {
1416
- to: route.path === "" ? "/" : route.path,
1417
- className: `sidebar-link ${location.pathname === route.path ? "active" : ""}`,
1418
- "aria-current": location.pathname === route.path ? "page" : void 0,
1419
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "sidebar-link-content", children: [
1420
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "sidebar-link-title-container", children: [
1421
- renderIcon(route.icon),
1422
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: route.title })
1423
- ] }),
1424
- renderBadge(route.badge)
1425
- ] })
1426
- }
1427
- ) }, route.path)) }),
1428
- groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1429
- SidebarGroupSection,
1430
- {
1431
- group,
1432
- currentPath: location.pathname
1433
- },
1434
- group.slug
1435
- ))
1436
- ] }),
1437
- config.themeConfig?.poweredBy !== false && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PoweredBy, {})
1438
- ] });
1439
- }
1440
- function SidebarGroupSection({
1441
- group,
1442
- currentPath
1443
- }) {
1444
- const isActive = group.routes.some((r) => currentPath === r.path);
1445
- const [open, setOpen] = (0, import_react11.useState)(true);
1446
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "sidebar-group", children: [
1447
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1448
- "button",
1449
- {
1450
- className: `sidebar-group-header ${isActive ? "active" : ""}`,
1451
- onClick: () => setOpen(!open),
1452
- "aria-expanded": open,
1453
- "aria-controls": `sidebar-group-${group.slug}`,
1454
- children: [
1455
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "sidebar-group-header-content", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "sidebar-group-title", children: group.title }) }),
1456
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: `sidebar-group-chevron ${open ? "open" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react7.ChevronRight, { size: 16 }) })
1457
- ]
1458
- }
1459
- ),
1460
- open && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "sidebar-group-list", id: `sidebar-group-${group.slug}`, children: group.routes.map((route) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1461
- Link,
1462
- {
1463
- to: route.path === "" ? "/" : route.path,
1464
- className: `sidebar-link sidebar-link-nested ${currentPath === route.path ? "active" : ""}`,
1465
- "aria-current": currentPath === route.path ? "page" : void 0,
1466
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "sidebar-link-content", children: [
1467
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "sidebar-link-title-container", children: [
1468
- renderIcon(route.icon),
1469
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: route.title })
1470
- ] }),
1471
- renderBadge(route.badge)
1472
- ] })
1473
- }
1474
- ) }, route.path)) })
1475
- ] });
1476
- }
1477
- var import_react11, import_react_router_dom6, import_lucide_react7, LucideIcons, import_jsx_runtime15;
1478
- var init_Sidebar = __esm({
1479
- "src/client/theme/ui/Sidebar/Sidebar.tsx"() {
1480
- "use strict";
1481
- import_react11 = require("react");
1482
- import_react_router_dom6 = require("react-router-dom");
1483
- init_Link2();
1484
- init_PoweredBy2();
1485
- import_lucide_react7 = require("lucide-react");
1486
- LucideIcons = __toESM(require("lucide-react"));
1487
- import_jsx_runtime15 = require("react/jsx-runtime");
1488
- }
1489
- });
1490
-
1491
- // src/client/theme/ui/Sidebar/index.ts
1492
- var init_Sidebar2 = __esm({
1493
- "src/client/theme/ui/Sidebar/index.ts"() {
1494
- "use strict";
1495
- init_Sidebar();
1496
- }
1497
- });
1498
-
1499
- // src/client/theme/ui/OnThisPage/OnThisPage.tsx
1500
- function OnThisPage({
1501
- headings = [],
1502
- editLink,
1503
- communityHelp,
1504
- filePath
1505
- }) {
1506
- const [activeId, setActiveId] = (0, import_react12.useState)(null);
1507
- const [indicatorStyle, setIndicatorStyle] = (0, import_react12.useState)({});
1508
- const observerRef = (0, import_react12.useRef)(null);
1509
- const location = (0, import_react_router_dom7.useLocation)();
1510
- const listRef = (0, import_react12.useRef)(null);
1511
- const visibleIdsRef = (0, import_react12.useRef)(/* @__PURE__ */ new Set());
1512
- (0, import_react12.useEffect)(() => {
1513
- if (headings.length > 0) {
1514
- const hash = window.location.hash.substring(1);
1515
- if (hash && headings.some((h) => h.id === hash)) {
1516
- setActiveId(hash);
1517
- } else {
1518
- setActiveId(headings[0].id);
1519
- }
1520
- }
1521
- }, [location.pathname, headings]);
1522
- (0, import_react12.useEffect)(() => {
1523
- if (!activeId || !listRef.current) return;
1524
- const activeLink = listRef.current.querySelector(
1525
- `a[href="#${activeId}"]`
1526
- );
1527
- if (activeLink) {
1528
- const top = activeLink.offsetTop;
1529
- const height = activeLink.offsetHeight;
1530
- setIndicatorStyle({
1531
- transform: `translateY(${top}px)`,
1532
- height: `${height}px`,
1533
- opacity: 1
1534
- });
1535
- }
1536
- }, [activeId, headings]);
1537
- (0, import_react12.useEffect)(() => {
1538
- if (headings.length === 0) return;
1539
- visibleIdsRef.current.clear();
1540
- if (observerRef.current) {
1541
- observerRef.current.disconnect();
1542
- }
1543
- const callback = (entries) => {
1544
- entries.forEach((entry) => {
1545
- if (entry.isIntersecting) {
1546
- visibleIdsRef.current.add(entry.target.id);
1547
- } else {
1548
- visibleIdsRef.current.delete(entry.target.id);
1549
- }
1550
- });
1551
- const firstVisible = headings.find((h) => visibleIdsRef.current.has(h.id));
1552
- if (firstVisible) {
1553
- setActiveId(firstVisible.id);
1554
- } else {
1555
- const firstEl = document.getElementById(headings[0].id);
1556
- if (firstEl) {
1557
- const rect = firstEl.getBoundingClientRect();
1558
- if (rect.top > 200) {
1559
- setActiveId(headings[0].id);
1560
- return;
1561
- }
1562
- }
1563
- }
1564
- };
1565
- const observerOptions = {
1566
- root: document.querySelector(".boltdocs-content"),
1567
- rootMargin: "-20% 0px -70% 0px",
1568
- threshold: [0, 1]
1569
- };
1570
- observerRef.current = new IntersectionObserver(callback, observerOptions);
1571
- const observeHeadings = () => {
1572
- headings.forEach(({ id }) => {
1573
- const el = document.getElementById(id);
1574
- if (el) {
1575
- observerRef.current.observe(el);
1576
- }
1577
- });
1578
- };
1579
- observeHeadings();
1580
- const timeoutId = setTimeout(observeHeadings, 1e3);
1581
- const handleScroll = () => {
1582
- const scrollPosition = window.innerHeight + window.pageYOffset;
1583
- const bodyHeight = document.documentElement.scrollHeight;
1584
- if (scrollPosition >= bodyHeight - 50) {
1585
- setActiveId(headings[headings.length - 1].id);
1586
- }
1587
- };
1588
- window.addEventListener("scroll", handleScroll, { passive: true });
1589
- return () => {
1590
- observerRef.current?.disconnect();
1591
- clearTimeout(timeoutId);
1592
- window.removeEventListener("scroll", handleScroll);
1593
- };
1594
- }, [headings, location.pathname]);
1595
- (0, import_react12.useEffect)(() => {
1596
- if (!activeId || !listRef.current) return;
1597
- const activeLink = listRef.current.querySelector(
1598
- `a[href="#${activeId}"]`
1599
- );
1600
- if (activeLink) {
1601
- const container = listRef.current.parentElement;
1602
- if (!container) return;
1603
- const linkRect = activeLink.getBoundingClientRect();
1604
- const containerRect = container.getBoundingClientRect();
1605
- const isVisible = linkRect.top >= containerRect.top && linkRect.bottom <= containerRect.bottom;
1606
- if (!isVisible) {
1607
- activeLink.scrollIntoView({
1608
- behavior: "auto",
1609
- block: "nearest"
1610
- });
1611
- }
1612
- }
1613
- }, [activeId]);
1614
- const handleClick = (0, import_react12.useCallback)(
1615
- (e, id) => {
1616
- e.preventDefault();
1617
- const el = document.getElementById(id);
1618
- if (el) {
1619
- el.scrollIntoView({
1620
- behavior: "smooth"
1621
- });
1622
- setActiveId(id);
1623
- window.history.pushState(null, "", `#${id}`);
1624
- }
1625
- },
1626
- []
1627
- );
1628
- if (headings.length === 0) return null;
1629
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("nav", { className: "boltdocs-on-this-page", "aria-label": "Table of contents", children: [
1630
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "on-this-page-title", children: "On this page" }),
1631
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "on-this-page-container", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "on-this-page-list-container", children: [
1632
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "toc-indicator", style: indicatorStyle }),
1633
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "on-this-page-list", ref: listRef, children: headings.map((h) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { className: h.level === 3 ? "toc-indent" : "", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1634
- "a",
1635
- {
1636
- href: `#${h.id}`,
1637
- className: `toc-link ${activeId === h.id ? "active" : ""}`,
1638
- "aria-current": activeId === h.id ? "true" : void 0,
1639
- onClick: (e) => handleClick(e, h.id),
1640
- children: h.text
1641
- }
1642
- ) }, h.id)) })
1643
- ] }) }),
1644
- (editLink || communityHelp) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "toc-help", children: [
1645
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "toc-help-title", children: "Need help?" }),
1646
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("ul", { className: "toc-help-links", children: [
1647
- editLink && filePath && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1648
- "a",
1649
- {
1650
- href: editLink.replace(":path", filePath),
1651
- target: "_blank",
1652
- rel: "noopener noreferrer",
1653
- className: "toc-help-link",
1654
- children: [
1655
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react8.Pencil, { size: 16 }),
1656
- "Edit this page"
1657
- ]
1658
- }
1659
- ) }),
1660
- communityHelp && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1661
- "a",
1662
- {
1663
- href: communityHelp,
1664
- target: "_blank",
1665
- rel: "noopener noreferrer",
1666
- className: "toc-help-link",
1667
- children: [
1668
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react8.CircleHelp, { size: 16 }),
1669
- "Community help"
1670
- ]
1671
- }
1672
- ) })
1673
- ] })
1674
- ] })
1675
- ] });
1676
- }
1677
- var import_react12, import_react_router_dom7, import_lucide_react8, import_jsx_runtime16;
1678
- var init_OnThisPage = __esm({
1679
- "src/client/theme/ui/OnThisPage/OnThisPage.tsx"() {
1680
- "use strict";
1681
- import_react12 = require("react");
1682
- import_react_router_dom7 = require("react-router-dom");
1683
- import_lucide_react8 = require("lucide-react");
1684
- import_jsx_runtime16 = require("react/jsx-runtime");
1685
- }
1686
- });
1687
-
1688
- // src/client/theme/ui/OnThisPage/index.ts
1689
- var init_OnThisPage2 = __esm({
1690
- "src/client/theme/ui/OnThisPage/index.ts"() {
1691
- "use strict";
1692
- init_OnThisPage();
1693
- }
1694
- });
1695
-
1696
- // src/client/theme/ui/Head/Head.tsx
1697
- function Head({ siteTitle, siteDescription, routes }) {
1698
- const location = (0, import_react_router_dom8.useLocation)();
1699
- (0, import_react13.useEffect)(() => {
1700
- const currentRoute = routes.find((r) => r.path === location.pathname);
1701
- const pageTitle = currentRoute?.title;
1702
- const pageDescription = currentRoute?.description || siteDescription || "";
1703
- document.title = pageTitle ? `${pageTitle} | ${siteTitle}` : siteTitle;
1704
- let metaDesc = document.querySelector(
1705
- 'meta[name="description"]'
1706
- );
1707
- if (!metaDesc) {
1708
- metaDesc = document.createElement("meta");
1709
- metaDesc.name = "description";
1710
- document.head.appendChild(metaDesc);
1711
- }
1712
- metaDesc.content = pageDescription;
1713
- setMetaTag("property", "og:title", document.title);
1714
- setMetaTag("property", "og:description", pageDescription);
1715
- setMetaTag("property", "og:type", "article");
1716
- setMetaTag("property", "og:url", window.location.href);
1717
- setMetaTag("name", "twitter:card", "summary");
1718
- setMetaTag("name", "twitter:title", document.title);
1719
- setMetaTag("name", "twitter:description", pageDescription);
1720
- let canonical = document.querySelector(
1721
- 'link[rel="canonical"]'
1722
- );
1723
- if (!canonical) {
1724
- canonical = document.createElement("link");
1725
- canonical.rel = "canonical";
1726
- document.head.appendChild(canonical);
1727
- }
1728
- canonical.href = window.location.origin + location.pathname;
1729
- }, [location.pathname, siteTitle, siteDescription, routes]);
1730
- return null;
1731
- }
1732
- function setMetaTag(attr, key, content) {
1733
- let tag = document.querySelector(
1734
- `meta[${attr}="${key}"]`
1735
- );
1736
- if (!tag) {
1737
- tag = document.createElement("meta");
1738
- tag.setAttribute(attr, key);
1739
- document.head.appendChild(tag);
1740
- }
1741
- tag.content = content;
1742
- }
1743
- var import_react13, import_react_router_dom8;
1744
- var init_Head = __esm({
1745
- "src/client/theme/ui/Head/Head.tsx"() {
1746
- "use strict";
1747
- import_react13 = require("react");
1748
- import_react_router_dom8 = require("react-router-dom");
1749
- }
1750
- });
1751
-
1752
- // src/client/theme/ui/Head/index.ts
1753
- var init_Head2 = __esm({
1754
- "src/client/theme/ui/Head/index.ts"() {
1755
- "use strict";
1756
- init_Head();
1757
- }
1758
- });
1759
-
1760
- // src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx
1761
- function Breadcrumbs({ routes, config }) {
1762
- const location = (0, import_react_router_dom9.useLocation)();
1763
- if (config.themeConfig?.breadcrumbs === false) return null;
1764
- if (location.pathname === "/") return null;
1765
- const currentRoute = routes.find((r) => r.path === location.pathname);
1766
- const groupRoute = currentRoute?.group ? routes.find((r) => r.group === currentRoute.group) : null;
1767
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("nav", { className: "boltdocs-breadcrumbs", "aria-label": "Breadcrumb", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("ol", { className: "boltdocs-breadcrumbs-list", children: [
1768
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "boltdocs-breadcrumbs-item", children: [
1769
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Link, { to: "/", className: "boltdocs-breadcrumbs-link", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.Home, { size: 14 }) }),
1770
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "boltdocs-breadcrumbs-separator", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.ChevronRight, { size: 14 }) })
1771
- ] }),
1772
- currentRoute?.groupTitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "boltdocs-breadcrumbs-item", children: [
1773
- groupRoute ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Link, { to: groupRoute.path, className: "boltdocs-breadcrumbs-link", children: currentRoute.groupTitle }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "boltdocs-breadcrumbs-text", children: currentRoute.groupTitle }),
1774
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "boltdocs-breadcrumbs-separator", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.ChevronRight, { size: 14 }) })
1775
- ] }),
1776
- currentRoute?.title && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("li", { className: "boltdocs-breadcrumbs-item", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1777
- "span",
1778
- {
1779
- className: "boltdocs-breadcrumbs-text boltdocs-breadcrumbs-active",
1780
- "aria-current": "page",
1781
- children: currentRoute.title
1782
- }
1783
- ) })
1784
- ] }) });
1785
- }
1786
- var import_react_router_dom9, import_lucide_react9, import_jsx_runtime17;
1787
- var init_Breadcrumbs = __esm({
1788
- "src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx"() {
1789
- "use strict";
1790
- import_react_router_dom9 = require("react-router-dom");
1791
- init_Link2();
1792
- import_lucide_react9 = require("lucide-react");
1793
- import_jsx_runtime17 = require("react/jsx-runtime");
1794
- }
1795
- });
1796
-
1797
- // src/client/theme/ui/Breadcrumbs/index.ts
1798
- var init_Breadcrumbs2 = __esm({
1799
- "src/client/theme/ui/Breadcrumbs/index.ts"() {
1800
- "use strict";
1801
- init_Breadcrumbs();
1802
- }
1803
- });
1804
-
1805
- // src/client/theme/ui/ProgressBar/ProgressBar.css
1806
- var init_ProgressBar = __esm({
1807
- "src/client/theme/ui/ProgressBar/ProgressBar.css"() {
1808
- }
1809
- });
1810
-
1811
- // src/client/theme/ui/ProgressBar/ProgressBar.tsx
1812
- function ProgressBar() {
1813
- const [progress, setProgress] = (0, import_react14.useState)(0);
1814
- (0, import_react14.useEffect)(() => {
1815
- let container = null;
1816
- let timer;
1817
- const handleScroll = () => {
1818
- if (!container) return;
1819
- const { scrollTop, scrollHeight, clientHeight } = container;
1820
- if (scrollHeight <= clientHeight) {
1821
- setProgress(0);
1822
- return;
1823
- }
1824
- const scrollPercent = scrollTop / (scrollHeight - clientHeight) * 100;
1825
- setProgress(Math.min(100, Math.max(0, scrollPercent)));
1826
- };
1827
- const attachListener = () => {
1828
- container = document.querySelector(".boltdocs-content");
1829
- if (container) {
1830
- container.addEventListener("scroll", handleScroll);
1831
- handleScroll();
1832
- if (timer) clearInterval(timer);
1833
- return true;
1834
- }
1835
- return false;
1836
- };
1837
- if (!attachListener()) {
1838
- timer = setInterval(attachListener, 100);
1839
- }
1840
- return () => {
1841
- if (container) container.removeEventListener("scroll", handleScroll);
1842
- if (timer) clearInterval(timer);
1843
- };
1844
- }, []);
1845
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "boltdocs-progress-container", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1846
- "div",
1847
- {
1848
- className: "boltdocs-progress-bar",
1849
- style: { width: `${progress}%` }
1850
- }
1851
- ) });
1852
- }
1853
- var import_react14, import_jsx_runtime18;
1854
- var init_ProgressBar2 = __esm({
1855
- "src/client/theme/ui/ProgressBar/ProgressBar.tsx"() {
1856
- "use strict";
1857
- import_react14 = require("react");
1858
- init_ProgressBar();
1859
- import_jsx_runtime18 = require("react/jsx-runtime");
1860
- }
1861
- });
1862
-
1863
- // src/client/theme/ui/ProgressBar/index.ts
1864
- var init_ProgressBar3 = __esm({
1865
- "src/client/theme/ui/ProgressBar/index.ts"() {
1866
- "use strict";
1867
- init_ProgressBar2();
1868
- }
1869
- });
1870
-
1871
- // src/client/theme/ui/ErrorBoundary/error-boundary.css
1872
- var init_error_boundary = __esm({
1873
- "src/client/theme/ui/ErrorBoundary/error-boundary.css"() {
1874
- }
1875
- });
1876
-
1877
- // src/client/theme/ui/ErrorBoundary/ErrorBoundary.tsx
1878
- var import_react15, import_jsx_runtime19, ErrorBoundary;
1879
- var init_ErrorBoundary = __esm({
1880
- "src/client/theme/ui/ErrorBoundary/ErrorBoundary.tsx"() {
1881
- "use strict";
1882
- import_react15 = require("react");
1883
- init_error_boundary();
1884
- import_jsx_runtime19 = require("react/jsx-runtime");
1885
- ErrorBoundary = class extends import_react15.Component {
1886
- state = {
1887
- hasError: false
1888
- };
1889
- static getDerivedStateFromError(error) {
1890
- return { hasError: true, error };
1891
- }
1892
- componentDidCatch(error, errorInfo) {
1893
- console.error("Uncaught error in Boltdocs Layout:", error, errorInfo);
1894
- }
1895
- render() {
1896
- if (this.state.hasError) {
1897
- return this.props.fallback || /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "boltdocs-error-boundary", children: [
1898
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "boltdocs-error-title", children: "Something went wrong" }),
1899
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "boltdocs-error-message", children: this.state.error?.message || "An unexpected error occurred while rendering this page." }),
1900
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1901
- "button",
1902
- {
1903
- className: "boltdocs-error-retry",
1904
- onClick: () => this.setState({ hasError: false }),
1905
- children: "Try again"
1906
- }
1907
- )
1908
- ] });
1909
- }
1910
- return this.props.children;
1911
- }
1912
- };
1913
- }
1914
- });
1915
-
1916
- // src/client/theme/ui/ErrorBoundary/index.ts
1917
- var init_ErrorBoundary2 = __esm({
1918
- "src/client/theme/ui/ErrorBoundary/index.ts"() {
1919
- "use strict";
1920
- init_ErrorBoundary();
1921
- }
1922
- });
1923
-
1924
- // src/client/theme/ui/CopyMarkdown/copy-markdown.css
1925
- var init_copy_markdown = __esm({
1926
- "src/client/theme/ui/CopyMarkdown/copy-markdown.css"() {
1927
- }
1928
- });
1929
-
1930
- // src/client/theme/ui/CopyMarkdown/CopyMarkdown.tsx
1931
- function CopyMarkdown({ content, config }) {
1932
- const [isOpen, setIsOpen] = (0, import_react16.useState)(false);
1933
- const [copied, setCopied] = (0, import_react16.useState)(false);
1934
- const dropdownRef = (0, import_react16.useRef)(null);
1935
- const isEnabled = config !== false;
1936
- const buttonText = typeof config === "object" ? config.text || "Copy Markdown" : "Copy Markdown";
1937
- (0, import_react16.useEffect)(() => {
1938
- function handleClickOutside(event) {
1939
- if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
1940
- setIsOpen(false);
1941
- }
1942
- }
1943
- document.addEventListener("mousedown", handleClickOutside);
1944
- return () => document.removeEventListener("mousedown", handleClickOutside);
1945
- }, []);
1946
- if (!isEnabled || !content) return null;
1947
- const handleCopy = () => {
1948
- navigator.clipboard.writeText(content);
1949
- setCopied(true);
1950
- setIsOpen(false);
1951
- setTimeout(() => setCopied(false), 2e3);
1952
- };
1953
- const handleOpenRaw = () => {
1954
- const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
1955
- const url = URL.createObjectURL(blob);
1956
- window.open(url, "_blank");
1957
- setIsOpen(false);
1958
- };
1959
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "boltdocs-copy-markdown", ref: dropdownRef, children: [
1960
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copy-btn-group", children: [
1961
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1962
- "button",
1963
- {
1964
- className: "copy-btn",
1965
- onClick: handleCopy,
1966
- "aria-label": "Copy Markdown",
1967
- children: [
1968
- copied ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Check, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Copy, { size: 16 }),
1969
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "copy-label", children: copied ? "Copied!" : buttonText })
1970
- ]
1971
- }
1972
- ),
1973
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1974
- "button",
1975
- {
1976
- className: `copy-dropdown-toggle ${isOpen ? "is-active" : ""}`,
1977
- onClick: () => setIsOpen(!isOpen),
1978
- "aria-label": "More options",
1979
- "aria-expanded": isOpen,
1980
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.ChevronDown, { size: 14, className: "arrow-icon" })
1981
- }
1982
- )
1983
- ] }),
1984
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copy-dropdown", children: [
1985
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("button", { className: "copy-option", onClick: handleCopy, children: [
1986
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Copy, { size: 14 }),
1987
- "Copy Markdown"
1988
- ] }),
1989
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("button", { className: "copy-option", onClick: handleOpenRaw, children: [
1990
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.ExternalLink, { size: 14 }),
1991
- "View as Markdown"
1992
- ] })
1993
- ] })
1994
- ] });
1995
- }
1996
- var import_react16, import_lucide_react10, import_jsx_runtime20;
1997
- var init_CopyMarkdown = __esm({
1998
- "src/client/theme/ui/CopyMarkdown/CopyMarkdown.tsx"() {
1999
- "use strict";
2000
- import_react16 = require("react");
2001
- import_lucide_react10 = require("lucide-react");
2002
- init_copy_markdown();
2003
- import_jsx_runtime20 = require("react/jsx-runtime");
2004
- }
2005
- });
2006
-
2007
- // src/client/theme/ui/CopyMarkdown/index.ts
2008
- var init_CopyMarkdown2 = __esm({
2009
- "src/client/theme/ui/CopyMarkdown/index.ts"() {
2010
- "use strict";
2011
- init_CopyMarkdown();
2012
- }
2013
- });
2014
-
2015
- // src/client/theme/styles.css
2016
- var init_styles = __esm({
2017
- "src/client/theme/styles.css"() {
2018
- }
2019
- });
2020
-
2021
- // src/client/theme/ui/Layout/Layout.tsx
2022
- function ThemeLayout({
2023
- config,
2024
- routes,
2025
- children,
2026
- navbar,
2027
- sidebar,
2028
- toc,
2029
- background,
2030
- head,
2031
- breadcrumbs,
2032
- className = "",
2033
- style
2034
- }) {
2035
- const siteTitle = config.themeConfig?.title || "Boltdocs";
2036
- const siteDescription = config.themeConfig?.description || "";
2037
- const location = (0, import_react_router_dom10.useLocation)();
2038
- const currentIndex = routes.findIndex((r) => r.path === location.pathname);
2039
- const currentRoute = routes[currentIndex];
2040
- const currentLocale = config.i18n ? currentRoute?.locale || config.i18n.defaultLocale : void 0;
2041
- const currentVersion = config.versions ? currentRoute?.version || config.versions.defaultVersion : void 0;
2042
- const filteredRoutes = routes.filter((r) => {
2043
- const localeMatch = config.i18n ? (r.locale || config.i18n.defaultLocale) === currentLocale : true;
2044
- const versionMatch = config.versions ? (r.version || config.versions.defaultVersion) === currentVersion : true;
2045
- return localeMatch && versionMatch;
2046
- });
2047
- const localIndex = filteredRoutes.findIndex(
2048
- (r) => r.path === location.pathname
2049
- );
2050
- const prevPage = localIndex > 0 ? filteredRoutes[localIndex - 1] : null;
2051
- const nextPage = localIndex >= 0 && localIndex < filteredRoutes.length - 1 ? filteredRoutes[localIndex + 1] : null;
2052
- const { preload } = usePreload();
2053
- import_react17.default.useEffect(() => {
2054
- if (prevPage?.path) preload(prevPage.path);
2055
- if (nextPage?.path) preload(nextPage.path);
2056
- }, [prevPage, nextPage, preload]);
2057
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `boltdocs-layout ${className}`, style, children: [
2058
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ProgressBar, {}),
2059
- head !== void 0 ? head : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2060
- Head,
2061
- {
2062
- siteTitle,
2063
- siteDescription,
2064
- routes
2065
- }
2066
- ),
2067
- navbar !== void 0 ? navbar : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2068
- Navbar,
2069
- {
2070
- config,
2071
- routes: filteredRoutes,
2072
- allRoutes: routes,
2073
- currentLocale,
2074
- currentVersion
2075
- }
2076
- ),
2077
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "boltdocs-main-container", children: [
2078
- sidebar !== void 0 ? sidebar : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Sidebar, { routes: filteredRoutes, config }),
2079
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("main", { className: "boltdocs-content", children: [
2080
- breadcrumbs !== void 0 ? breadcrumbs : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Breadcrumbs, { routes: filteredRoutes, config }),
2081
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "boltdocs-page", children: [
2082
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "boltdocs-page-header", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2083
- CopyMarkdown,
2084
- {
2085
- content: routes[currentIndex]?._rawContent,
2086
- config: config.themeConfig?.copyMarkdown
2087
- }
2088
- ) }),
2089
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorBoundary, { children })
2090
- ] }),
2091
- (prevPage || nextPage) && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("nav", { className: "page-nav", "aria-label": "Pagination", children: [
2092
- prevPage ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2093
- Link,
2094
- {
2095
- to: prevPage.path || "/",
2096
- className: "page-nav-link page-nav-link--prev",
2097
- children: [
2098
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "page-nav-info", children: [
2099
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "page-nav-label", children: "Previous" }),
2100
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "page-nav-title", children: prevPage.title })
2101
- ] }),
2102
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react11.ChevronLeft, { className: "page-nav-arrow", size: 16 })
2103
- ]
2104
- }
2105
- ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", {}),
2106
- nextPage ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2107
- Link,
2108
- {
2109
- to: nextPage.path || "/",
2110
- className: "page-nav-link page-nav-link--next",
2111
- children: [
2112
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "page-nav-info", children: [
2113
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "page-nav-label", children: "Next" }),
2114
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "page-nav-title", children: nextPage.title })
2115
- ] }),
2116
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react11.ChevronRight, { className: "page-nav-arrow", size: 16 })
2117
- ]
2118
- }
2119
- ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", {})
2120
- ] })
2121
- ] }),
2122
- toc !== void 0 ? toc : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2123
- OnThisPage,
2124
- {
2125
- headings: routes[currentIndex]?.headings,
2126
- editLink: config.themeConfig?.editLink,
2127
- communityHelp: config.themeConfig?.communityHelp,
2128
- filePath: routes[currentIndex]?.filePath
2129
- }
2130
- )
2131
- ] })
2132
- ] });
2133
- }
2134
- var import_react17, import_react_router_dom10, import_lucide_react11, import_jsx_runtime21;
2135
- var init_Layout = __esm({
2136
- "src/client/theme/ui/Layout/Layout.tsx"() {
2137
- "use strict";
2138
- import_react17 = __toESM(require("react"));
2139
- import_react_router_dom10 = require("react-router-dom");
2140
- init_Link2();
2141
- import_lucide_react11 = require("lucide-react");
2142
- init_preload();
2143
- init_Navbar2();
2144
- init_Sidebar2();
2145
- init_OnThisPage2();
2146
- init_Head2();
2147
- init_Breadcrumbs2();
2148
- init_Navbar2();
2149
- init_Sidebar2();
2150
- init_OnThisPage2();
2151
- init_Head2();
2152
- init_Breadcrumbs2();
2153
- init_ProgressBar3();
2154
- init_ErrorBoundary2();
2155
- init_CopyMarkdown2();
2156
- init_styles();
2157
- import_jsx_runtime21 = require("react/jsx-runtime");
2158
- }
2159
- });
2160
-
2161
- // src/client/theme/ui/Layout/index.ts
2162
- var init_Layout2 = __esm({
2163
- "src/client/theme/ui/Layout/index.ts"() {
2164
- "use strict";
2165
- init_Layout();
2166
- }
2167
- });
2168
-
2169
- // src/client/theme/ui/NotFound/NotFound.tsx
2170
- function NotFound() {
2171
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "boltdocs-not-found", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "not-found-content", children: [
2172
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "not-found-code", children: "404" }),
2173
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h1", { className: "not-found-title", children: "Page Not Found" }),
2174
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "not-found-text", children: "The page you're looking for doesn't exist or has been moved." }),
2175
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Link, { to: "/", className: "not-found-link", children: [
2176
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.ArrowLeft, { size: 16 }),
2177
- " Go to Home"
2178
- ] })
2179
- ] }) });
2180
- }
2181
- var import_lucide_react12, import_jsx_runtime22;
2182
- var init_NotFound = __esm({
2183
- "src/client/theme/ui/NotFound/NotFound.tsx"() {
2184
- "use strict";
2185
- init_Link2();
2186
- import_lucide_react12 = require("lucide-react");
2187
- import_jsx_runtime22 = require("react/jsx-runtime");
2188
- }
2189
- });
2190
-
2191
- // src/client/theme/ui/NotFound/index.ts
2192
- var init_NotFound2 = __esm({
2193
- "src/client/theme/ui/NotFound/index.ts"() {
2194
- "use strict";
2195
- init_NotFound();
2196
- }
2197
- });
2198
-
2199
- // src/client/theme/ui/Loading/Loading.tsx
2200
- function Loading() {
2201
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "boltdocs-loading", children: [
2202
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "loading-spinner" }),
2203
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "loading-text", children: "Loading..." })
2204
- ] });
2205
- }
2206
- var import_jsx_runtime23;
2207
- var init_Loading = __esm({
2208
- "src/client/theme/ui/Loading/Loading.tsx"() {
2209
- "use strict";
2210
- import_jsx_runtime23 = require("react/jsx-runtime");
2211
- }
2212
- });
2213
-
2214
- // src/client/theme/ui/Loading/index.ts
2215
- var init_Loading2 = __esm({
2216
- "src/client/theme/ui/Loading/index.ts"() {
2217
- "use strict";
2218
- init_Loading();
2219
- }
2220
- });
2221
-
2222
- // src/client/theme/components/CodeBlock/CodeBlock.tsx
2223
- function CodeBlock({ children, ...props }) {
2224
- const [copied, setCopied] = (0, import_react18.useState)(false);
2225
- const [isExpanded, setIsExpanded] = (0, import_react18.useState)(false);
2226
- const [isExpandable, setIsExpandable] = (0, import_react18.useState)(false);
2227
- const preRef = (0, import_react18.useRef)(null);
2228
- const handleCopy = (0, import_react18.useCallback)(async () => {
2229
- const code = preRef.current?.textContent || "";
2230
- copyToClipboard(code);
2231
- setCopied(true);
2232
- setTimeout(() => setCopied(false), 2e3);
2233
- }, []);
2234
- import_react18.default.useEffect(() => {
2235
- if (preRef.current) {
2236
- const codeLength = preRef.current.textContent?.length || 0;
2237
- setIsExpandable(codeLength > 500);
2238
- }
2239
- }, [children]);
2240
- const shouldTruncate = isExpandable && !isExpanded;
2241
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `code-block-wrapper ${shouldTruncate ? "is-truncated" : ""}`, children: [
2242
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2243
- "button",
2244
- {
2245
- className: `code-block-copy ${copied ? "copied" : ""}`,
2246
- onClick: handleCopy,
2247
- "aria-label": "Copy code",
2248
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Check, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Copy, { size: 16 })
2249
- }
2250
- ),
2251
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("pre", { ref: preRef, ...props, children }),
2252
- isExpandable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "code-block-expand-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2253
- "button",
2254
- {
2255
- className: "code-block-expand-btn",
2256
- onClick: () => setIsExpanded(!isExpanded),
2257
- children: isExpanded ? "Show less" : "Expand code"
2258
- }
2259
- ) })
2260
- ] });
2261
- }
2262
- var import_react18, import_lucide_react13, import_jsx_runtime24;
2263
- var init_CodeBlock = __esm({
2264
- "src/client/theme/components/CodeBlock/CodeBlock.tsx"() {
2265
- "use strict";
2266
- import_react18 = __toESM(require("react"));
2267
- import_lucide_react13 = require("lucide-react");
2268
- init_utils();
2269
- import_jsx_runtime24 = require("react/jsx-runtime");
2270
- }
2271
- });
2272
-
2273
- // src/client/theme/components/CodeBlock/index.ts
2274
- var init_CodeBlock2 = __esm({
2275
- "src/client/theme/components/CodeBlock/index.ts"() {
2276
- "use strict";
2277
- init_CodeBlock();
2278
- }
2279
- });
2280
-
2281
- // src/client/theme/components/Video/Video.tsx
2282
- function Video({
2283
- src,
2284
- poster,
2285
- alt,
2286
- children,
2287
- controls,
2288
- preload = "metadata",
2289
- ...rest
2290
- }) {
2291
- const containerRef = (0, import_react19.useRef)(null);
2292
- const [isVisible, setIsVisible] = (0, import_react19.useState)(false);
2293
- (0, import_react19.useEffect)(() => {
2294
- const el = containerRef.current;
2295
- if (!el) return;
2296
- const observer = new IntersectionObserver(
2297
- ([entry]) => {
2298
- if (entry.isIntersecting) {
2299
- setIsVisible(true);
2300
- observer.disconnect();
2301
- }
2302
- },
2303
- { rootMargin: "200px" }
2304
- );
2305
- observer.observe(el);
2306
- return () => observer.disconnect();
2307
- }, []);
2308
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: containerRef, className: "boltdocs-video-wrapper", children: isVisible ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2309
- "video",
2310
- {
2311
- className: "boltdocs-video",
2312
- src,
2313
- poster,
2314
- controls: true,
2315
- preload,
2316
- playsInline: true,
2317
- ...rest,
2318
- children: [
2319
- children,
2320
- "Your browser does not support the video tag."
2321
- ]
2322
- }
2323
- ) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2324
- "div",
2325
- {
2326
- className: "boltdocs-video-placeholder",
2327
- role: "img",
2328
- "aria-label": alt || "Video"
2329
- }
2330
- ) });
2331
- }
2332
- var import_react19, import_jsx_runtime25;
2333
- var init_Video = __esm({
2334
- "src/client/theme/components/Video/Video.tsx"() {
2335
- "use strict";
2336
- import_react19 = require("react");
2337
- import_jsx_runtime25 = require("react/jsx-runtime");
2338
- }
2339
- });
2340
-
2341
- // src/client/theme/components/Video/index.ts
2342
- var Video_exports = {};
2343
- __export(Video_exports, {
2344
- Video: () => Video
2345
- });
2346
- var init_Video2 = __esm({
2347
- "src/client/theme/components/Video/index.ts"() {
2348
- "use strict";
2349
- init_Video();
2350
- }
2351
- });
2352
-
2353
- // src/client/theme/icons/npm.tsx
2354
- var import_jsx_runtime26, NPM;
2355
- var init_npm = __esm({
2356
- "src/client/theme/icons/npm.tsx"() {
2357
- "use strict";
2358
- import_jsx_runtime26 = require("react/jsx-runtime");
2359
- NPM = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("svg", { ...props, viewBox: "0 0 2500 2500", children: [
2360
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { fill: "#c00", d: "M0 0h2500v2500H0z" }),
2361
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2362
- "path",
2363
- {
2364
- fill: "#fff",
2365
- d: "M1241.5 268.5h-973v1962.9h972.9V763.5h495v1467.9h495V268.5z"
2366
- }
2367
- )
2368
- ] });
2369
- }
2370
- });
2371
-
2372
- // src/client/theme/icons/pnpm.tsx
2373
- var import_jsx_runtime27, Pnpm;
2374
- var init_pnpm = __esm({
2375
- "src/client/theme/icons/pnpm.tsx"() {
2376
- "use strict";
2377
- import_jsx_runtime27 = require("react/jsx-runtime");
2378
- Pnpm = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
2379
- "svg",
2380
- {
2381
- ...props,
2382
- xmlnsXlink: "http://www.w3.org/1999/xlink",
2383
- viewBox: "76.58987244897958 44 164.00775510204068 164",
2384
- children: [
2385
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("defs", { children: [
2386
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2387
- "path",
2388
- {
2389
- d: "M237.6 95L187.6 95L187.6 45L237.6 45L237.6 95Z",
2390
- id: "pnpm_dark__b45vdTD8hs"
2391
- }
2392
- ),
2393
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2394
- "path",
2395
- {
2396
- d: "M182.59 95L132.59 95L132.59 45L182.59 45L182.59 95Z",
2397
- id: "pnpm_dark__a40WtxIl8d"
2398
- }
2399
- ),
2400
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2401
- "path",
2402
- {
2403
- d: "M127.59 95L77.59 95L77.59 45L127.59 45L127.59 95Z",
2404
- id: "pnpm_dark__h2CN9AEEpe"
2405
- }
2406
- ),
2407
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2408
- "path",
2409
- {
2410
- d: "M237.6 150L187.6 150L187.6 100L237.6 100L237.6 150Z",
2411
- id: "pnpm_dark__dqv5133G8"
2412
- }
2413
- ),
2414
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2415
- "path",
2416
- {
2417
- d: "M182.59 150L132.59 150L132.59 100L182.59 100L182.59 150Z",
2418
- id: "pnpm_dark__b1Lv79ypvm"
2419
- }
2420
- ),
2421
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2422
- "path",
2423
- {
2424
- d: "M182.59 205L132.59 205L132.59 155L182.59 155L182.59 205Z",
2425
- id: "pnpm_dark__hy1IZWwLX"
2426
- }
2427
- ),
2428
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2429
- "path",
2430
- {
2431
- d: "M237.6 205L187.6 205L187.6 155L237.6 155L237.6 205Z",
2432
- id: "pnpm_dark__akQfjxQes"
2433
- }
2434
- ),
2435
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2436
- "path",
2437
- {
2438
- d: "M127.59 205L77.59 205L77.59 155L127.59 155L127.59 205Z",
2439
- id: "pnpm_dark__bdSrwE5pk"
2440
- }
2441
- )
2442
- ] }),
2443
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("g", { children: [
2444
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("use", { xlinkHref: "#pnpm_dark__b45vdTD8hs", fill: "#f9ad00" }) }),
2445
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("use", { xlinkHref: "#pnpm_dark__a40WtxIl8d", fill: "#f9ad00" }) }),
2446
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("use", { xlinkHref: "#pnpm_dark__h2CN9AEEpe", fill: "#f9ad00" }) }),
2447
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("use", { xlinkHref: "#pnpm_dark__dqv5133G8", fill: "#f9ad00" }) }),
2448
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("use", { xlinkHref: "#pnpm_dark__b1Lv79ypvm", fill: "#ffffff" }) }),
2449
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("use", { xlinkHref: "#pnpm_dark__hy1IZWwLX", fill: "#ffffff" }) }),
2450
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("use", { xlinkHref: "#pnpm_dark__akQfjxQes", fill: "#ffffff" }) }),
2451
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("use", { xlinkHref: "#pnpm_dark__bdSrwE5pk", fill: "#ffffff" }) })
2452
- ] })
2453
- ]
2454
- }
2455
- );
2456
- }
2457
- });
2458
-
2459
- // src/client/theme/icons/bun.tsx
2460
- var import_jsx_runtime28, Bun;
2461
- var init_bun = __esm({
2462
- "src/client/theme/icons/bun.tsx"() {
2463
- "use strict";
2464
- import_jsx_runtime28 = require("react/jsx-runtime");
2465
- Bun = (props) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("svg", { ...props, viewBox: "0 0 80 70", children: [
2466
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M71.09 20.74c-.16-.17-.33-.34-.5-.5s-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5A26.46 26.46 0 0 1 75.5 35.7c0 16.57-16.82 30.05-37.5 30.05-11.58 0-21.94-4.23-28.83-10.86l.5.5.5.5.5.5.5.5.5.5.5.5.5.5C19.55 65.3 30.14 69.75 42 69.75c20.68 0 37.5-13.48 37.5-30 0-7.06-3.04-13.75-8.41-19.01Z" }),
2467
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2468
- "path",
2469
- {
2470
- d: "M73 35.7c0 15.21-15.67 27.54-35 27.54S3 50.91 3 35.7C3 26.27 9 17.94 18.22 13S33.18 3 38 3s8.94 4.13 19.78 10C67 17.94 73 26.27 73 35.7Z",
2471
- style: { fill: "#fbf0df" }
2472
- }
2473
- ),
2474
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2475
- "path",
2476
- {
2477
- d: "M73 35.7a21.67 21.67 0 0 0-.8-5.78c-2.73 33.3-43.35 34.9-59.32 24.94A40 40 0 0 0 38 63.24c19.3 0 35-12.35 35-27.54Z",
2478
- style: { fill: "#f6dece" }
2479
- }
2480
- ),
2481
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2482
- "path",
2483
- {
2484
- d: "M24.53 11.17C29 8.49 34.94 3.46 40.78 3.45A9.29 9.29 0 0 0 38 3c-2.42 0-5 1.25-8.25 3.13-1.13.66-2.3 1.39-3.54 2.15-2.33 1.44-5 3.07-8 4.7C8.69 18.13 3 26.62 3 35.7v1.19c6.06-21.41 17.07-23.04 21.53-25.72Z",
2485
- style: { fill: "#fffefc" }
2486
- }
2487
- ),
2488
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2489
- "path",
2490
- {
2491
- d: "M35.12 5.53A16.41 16.41 0 0 1 29.49 18c-.28.25-.06.73.3.59 3.37-1.31 7.92-5.23 6-13.14-.08-.45-.67-.33-.67.08Zm2.27 0A16.24 16.24 0 0 1 39 19c-.12.35.31.65.55.36 2.19-2.8 4.1-8.36-1.62-14.36-.29-.26-.74.14-.54.49Zm2.76-.17A16.42 16.42 0 0 1 47 17.12a.33.33 0 0 0 .65.11c.92-3.49.4-9.44-7.17-12.53-.4-.16-.66.38-.33.62Zm-18.46 10.4a16.94 16.94 0 0 0 10.47-9c.18-.36.75-.22.66.18-1.73 8-7.52 9.67-11.12 9.45-.38.01-.37-.52-.01-.63Z",
2492
- style: { fill: "#ccbea7", fillRule: "evenodd" }
2493
- }
2494
- ),
2495
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M38 65.75C17.32 65.75.5 52.27.5 35.7c0-10 6.18-19.33 16.53-24.92 3-1.6 5.57-3.21 7.86-4.62 1.26-.78 2.45-1.51 3.6-2.19C32 1.89 35 .5 38 .5s5.62 1.2 8.9 3.14c1 .57 2 1.19 3.07 1.87 2.49 1.54 5.3 3.28 9 5.27C69.32 16.37 75.5 25.69 75.5 35.7c0 16.57-16.82 30.05-37.5 30.05ZM38 3c-2.42 0-5 1.25-8.25 3.13-1.13.66-2.3 1.39-3.54 2.15-2.33 1.44-5 3.07-8 4.7C8.69 18.13 3 26.62 3 35.7c0 15.19 15.7 27.55 35 27.55S73 50.89 73 35.7c0-9.08-5.69-17.57-15.22-22.7-3.78-2-6.73-3.88-9.12-5.36-1.09-.67-2.09-1.29-3-1.84C42.63 4 40.42 3 38 3Z" }),
2496
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("g", { children: [
2497
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2498
- "path",
2499
- {
2500
- d: "M45.05 43a8.93 8.93 0 0 1-2.92 4.71 6.81 6.81 0 0 1-4 1.88A6.84 6.84 0 0 1 34 47.71 8.93 8.93 0 0 1 31.12 43a.72.72 0 0 1 .8-.81h12.34a.72.72 0 0 1 .79.81Z",
2501
- style: { fill: "#b71422" }
2502
- }
2503
- ),
2504
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2505
- "path",
2506
- {
2507
- d: "M34 47.79a6.91 6.91 0 0 0 4.12 1.9 6.91 6.91 0 0 0 4.11-1.9 10.63 10.63 0 0 0 1-1.07 6.83 6.83 0 0 0-4.9-2.31 6.15 6.15 0 0 0-5 2.78c.23.21.43.41.67.6Z",
2508
- style: { fill: "#ff6164" }
2509
- }
2510
- ),
2511
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M34.16 47a5.36 5.36 0 0 1 4.19-2.08 6 6 0 0 1 4 1.69c.23-.25.45-.51.66-.77a7 7 0 0 0-4.71-1.93 6.36 6.36 0 0 0-4.89 2.36 9.53 9.53 0 0 0 .75.73Z" }),
2512
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M38.09 50.19a7.42 7.42 0 0 1-4.45-2 9.52 9.52 0 0 1-3.11-5.05 1.2 1.2 0 0 1 .26-1 1.41 1.41 0 0 1 1.13-.51h12.34a1.44 1.44 0 0 1 1.13.51 1.19 1.19 0 0 1 .25 1 9.52 9.52 0 0 1-3.11 5.05 7.42 7.42 0 0 1-4.44 2Zm-6.17-7.4c-.16 0-.2.07-.21.09a8.29 8.29 0 0 0 2.73 4.37A6.23 6.23 0 0 0 38.09 49a6.28 6.28 0 0 0 3.65-1.73 8.3 8.3 0 0 0 2.72-4.37.21.21 0 0 0-.2-.09Z" })
2513
- ] }),
2514
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("g", { children: [
2515
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2516
- "ellipse",
2517
- {
2518
- cx: "53.22",
2519
- cy: "40.18",
2520
- rx: "5.85",
2521
- ry: "3.44",
2522
- style: { fill: "#febbd0" }
2523
- }
2524
- ),
2525
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2526
- "ellipse",
2527
- {
2528
- cx: "22.95",
2529
- cy: "40.18",
2530
- rx: "5.85",
2531
- ry: "3.44",
2532
- style: { fill: "#febbd0" }
2533
- }
2534
- ),
2535
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2536
- "path",
2537
- {
2538
- d: "M25.7 38.8a5.51 5.51 0 1 0-5.5-5.51 5.51 5.51 0 0 0 5.5 5.51Zm24.77 0A5.51 5.51 0 1 0 45 33.29a5.5 5.5 0 0 0 5.47 5.51Z",
2539
- style: { fillRule: "evenodd" }
2540
- }
2541
- ),
2542
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2543
- "path",
2544
- {
2545
- d: "M24 33.64a2.07 2.07 0 1 0-2.06-2.07A2.07 2.07 0 0 0 24 33.64Zm24.77 0a2.07 2.07 0 1 0-2.06-2.07 2.07 2.07 0 0 0 2.04 2.07Z",
2546
- style: { fill: "#fff", fillRule: "evenodd" }
2547
- }
2548
- )
2549
- ] })
2550
- ] });
2551
- }
2552
- });
2553
-
2554
- // src/client/theme/icons/deno.tsx
2555
- var import_jsx_runtime29, Deno;
2556
- var init_deno = __esm({
2557
- "src/client/theme/icons/deno.tsx"() {
2558
- "use strict";
2559
- import_jsx_runtime29 = require("react/jsx-runtime");
2560
- Deno = (props) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2561
- "svg",
2562
- {
2563
- ...props,
2564
- xmlSpace: "preserve",
2565
- fillRule: "evenodd",
2566
- strokeLinejoin: "round",
2567
- strokeMiterlimit: "2",
2568
- clipRule: "evenodd",
2569
- viewBox: "0 0 441 441",
2570
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2571
- "path",
2572
- {
2573
- fill: "currentColor",
2574
- d: "M229.858-2.62c121.29 5.675 215.154 108.755 209.479 230.045S330.582 442.578 209.292 436.903-5.863 328.149-.188 206.859 108.568-8.296 229.858-2.62Zm51.365 264.922c-13.886-.687-27.594-3.012-38.616-4.857-8.381-1.404-16.33-3.616-22.855-5.858a2.576 2.576 0 0 0-2.932.878c-.678.905-.777 2.22-.02 3.061 3.08 3.418 12.848 10.54 20.439 13.812-6.491 5.357-10.933 17.608-12.684 23.95-2.35 8.51-2.687 20.801-2.12 25.312 2.282 18.146 8.95 34.41 25.467 48.64 11.562 9.96 28.295 16.77 45.399 17.08 23.603.426 51.882-9.705 74.085-32.493 29.028-31.807 48.051-73.17 51.593-119.393 8.434-110.06-74.073-206.264-184.134-214.698C124.785 9.302 28.582 91.81 20.147 201.87c-4.368 56.998 15.655 110.28 51.267 149.576a3.185 3.185 0 0 0 5.422-2.974c-26.39-103.487 30.95-215.162 94.926-250.494 23.751-13.118 46.884-18.1 67.664-9.69 31.814 12.874 50 34.21 89.375 52.163 39.375 17.951 43.625 47.862 32.64 78.098-10.986 30.236-46.358 45.425-80.218 43.753Zm-68.863-160.08c-12.906 1.006-21.384 16.978-22.497 27.253-1.117 10.275 3.978 27.236 20.794 26.91 19.694-.383 25.681-17.238 23.525-33.55-1.618-12.25-11.033-21.456-21.822-20.613Z"
2575
- }
2576
- )
2577
- }
2578
- );
2579
- }
2580
- });
2581
-
2582
- // src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx
2583
- function getCommandForManager(manager, command, pkg) {
2584
- const isInstall = command === "install" || command === "add" || command === "i";
2585
- const isCreate = command === "create" || command === "init";
2586
- const isRun = command === "run" || command === "exec";
2587
- if (isInstall) {
2588
- const pkgArgs2 = pkg ? ` ${pkg}` : "";
2589
- if (manager === "npm") return `npm install${pkgArgs2}`;
2590
- if (manager === "pnpm") return pkg ? `pnpm add${pkgArgs2}` : `pnpm install`;
2591
- if (manager === "bun") return pkg ? `bun add${pkgArgs2}` : `bun install`;
2592
- if (manager === "deno")
2593
- return pkg ? `deno install npm:${pkg}` : `deno install`;
2594
- }
2595
- if (isCreate) {
2596
- const pkgArgs2 = pkg ? ` ${pkg}` : "";
2597
- if (manager === "npm") return `npm create${pkgArgs2}`;
2598
- if (manager === "pnpm") return `pnpm create${pkgArgs2}`;
2599
- if (manager === "bun") return `bun create${pkgArgs2}`;
2600
- if (manager === "deno") return `deno run -A npm:create-${pkg}`;
2601
- }
2602
- if (isRun) {
2603
- const pkgArgs2 = pkg ? ` ${pkg}` : "";
2604
- if (manager === "npm") return `npm run${pkgArgs2}`;
2605
- if (manager === "pnpm") return `pnpm run${pkgArgs2}`;
2606
- if (manager === "bun") return `bun run${pkgArgs2}`;
2607
- if (manager === "deno") return `deno task ${pkg}`;
2608
- }
2609
- const pkgArgs = pkg ? ` ${pkg}` : "";
2610
- return `${manager} ${command}${pkgArgs}`;
2611
- }
2612
- function PackageManagerTabs({
2613
- command,
2614
- pkg = "",
2615
- className = ""
2616
- }) {
2617
- const [activeTab, setActiveTab] = (0, import_react20.useState)("npm");
2618
- const [copied, setCopied] = (0, import_react20.useState)(false);
2619
- const activeCommand = getCommandForManager(activeTab, command, pkg);
2620
- const handleCopy = (0, import_react20.useCallback)(async () => {
2621
- copyToClipboard(activeCommand);
2622
- setCopied(true);
2623
- setTimeout(() => setCopied(false), 2e3);
2624
- }, [activeCommand]);
2625
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: `pkg-tabs-wrapper ${className}`, children: [
2626
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "pkg-tabs-header", children: MANAGERS.map((mgr) => {
2627
- const Icon = mgr.icon;
2628
- const isActive = activeTab === mgr.id;
2629
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
2630
- "button",
2631
- {
2632
- className: `pkg-tab-btn ${isActive ? "active" : ""}`,
2633
- onClick: () => setActiveTab(mgr.id),
2634
- "aria-selected": isActive,
2635
- role: "tab",
2636
- children: [
2637
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { className: "pkg-tab-icon", width: "16", height: "16" }),
2638
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: mgr.label })
2639
- ]
2640
- },
2641
- mgr.id
2642
- );
2643
- }) }),
2644
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "code-block-wrapper pkg-tabs-content", children: [
2645
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2646
- "button",
2647
- {
2648
- className: `code-block-copy ${copied ? "copied" : ""}`,
2649
- onClick: handleCopy,
2650
- type: "button",
2651
- "aria-label": "Copy code",
2652
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react14.Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react14.Copy, { size: 14 })
2653
- }
2654
- ),
2655
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("pre", { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("code", { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "line", children: activeCommand }) }) })
2656
- ] })
2657
- ] });
2658
- }
2659
- var import_react20, import_lucide_react14, import_jsx_runtime30, MANAGERS;
2660
- var init_PackageManagerTabs = __esm({
2661
- "src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx"() {
2662
- "use strict";
2663
- import_react20 = require("react");
2664
- import_lucide_react14 = require("lucide-react");
2665
- init_npm();
2666
- init_pnpm();
2667
- init_bun();
2668
- init_deno();
2669
- init_utils();
2670
- import_jsx_runtime30 = require("react/jsx-runtime");
2671
- MANAGERS = [
2672
- { id: "npm", label: "npm", icon: NPM },
2673
- { id: "pnpm", label: "pnpm", icon: Pnpm },
2674
- { id: "bun", label: "bun", icon: Bun },
2675
- { id: "deno", label: "deno", icon: Deno }
2676
- ];
2677
- }
2678
- });
2679
-
2680
- // src/client/theme/components/PackageManagerTabs/index.ts
2681
- var PackageManagerTabs_exports = {};
2682
- __export(PackageManagerTabs_exports, {
2683
- PackageManagerTabs: () => PackageManagerTabs
2684
- });
2685
- var init_PackageManagerTabs2 = __esm({
2686
- "src/client/theme/components/PackageManagerTabs/index.ts"() {
2687
- "use strict";
2688
- init_PackageManagerTabs();
2689
- }
2690
- });
2691
-
2692
- // src/client/app/index.tsx
2693
- function useConfig() {
2694
- return (0, import_react23.useContext)(ConfigContext);
2695
- }
2696
- function AppShell({
2697
- initialRoutes,
2698
- initialConfig,
2699
- docsDirName,
2700
- modules,
2701
- hot,
2702
- homePage: HomePage,
2703
- components: customComponents = {}
2704
- }) {
2705
- const [routesInfo, setRoutesInfo] = (0, import_react21.useState)(initialRoutes);
2706
- const [config] = (0, import_react21.useState)(initialConfig);
2707
- const resolveRoutes = (infos) => {
2708
- return infos.filter(
2709
- (route) => !(HomePage && (route.path === "/" || route.path === ""))
2710
- ).map((route) => {
2711
- const loaderKey = Object.keys(modules).find(
2712
- (k) => k === `/${docsDirName}/${route.filePath}`
2713
- );
2714
- const loader = loaderKey ? modules[loaderKey] : null;
2715
- return {
2716
- ...route,
2717
- Component: import_react21.default.lazy(() => {
2718
- if (!loader)
2719
- return Promise.resolve({ default: () => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(NotFound, {}) });
2720
- return loader();
2721
- })
2722
- };
2723
- });
2724
- };
2725
- const [resolvedRoutes, setResolvedRoutes] = (0, import_react21.useState)(
2726
- () => resolveRoutes(initialRoutes)
2727
- );
2728
- (0, import_react21.useEffect)(() => {
2729
- if (hot) {
2730
- hot.on("boltdocs:routes-update", (newRoutes) => {
2731
- setRoutesInfo(newRoutes);
2732
- });
2733
- }
2734
- }, [hot]);
2735
- (0, import_react21.useEffect)(() => {
2736
- setResolvedRoutes(resolveRoutes(routesInfo));
2737
- }, [routesInfo, modules, docsDirName]);
2738
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(PreloadProvider, { routes: routesInfo, modules, children: [
2739
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ScrollHandler, {}),
2740
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_router_dom11.Routes, { children: [
2741
- HomePage && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2742
- import_react_router_dom11.Route,
2743
- {
2744
- path: "/",
2745
- element: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2746
- ThemeLayout,
2747
- {
2748
- config,
2749
- routes: routesInfo,
2750
- sidebar: null,
2751
- toc: null,
2752
- breadcrumbs: null,
2753
- ...config.themeConfig?.layoutProps,
2754
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(HomePage, {})
2755
- }
2756
- )
2757
- }
2758
- ),
2759
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2760
- import_react_router_dom11.Route,
2761
- {
2762
- element: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DocsLayout, { config, routes: routesInfo }),
2763
- children: resolvedRoutes.map((route) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2764
- import_react_router_dom11.Route,
2765
- {
2766
- path: route.path === "" ? "/" : route.path,
2767
- element: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react21.default.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Loading, {}), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2768
- MdxPage,
2769
- {
2770
- Component: route.Component,
2771
- customComponents
2772
- }
2773
- ) })
2774
- },
2775
- route.path
2776
- ))
2777
- },
2778
- "docs-layout"
2779
- ),
2780
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2781
- import_react_router_dom11.Route,
2782
- {
2783
- path: "*",
2784
- element: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2785
- ThemeLayout,
2786
- {
2787
- config,
2788
- routes: routesInfo,
2789
- ...config.themeConfig?.layoutProps,
2790
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(NotFound, {})
2791
- }
2792
- )
2793
- }
2794
- )
2795
- ] })
2796
- ] }) });
2797
- }
2798
- function ScrollHandler() {
2799
- const { pathname, hash } = (0, import_react_router_dom11.useLocation)();
2800
- (0, import_react23.useLayoutEffect)(() => {
2801
- const container = document.querySelector(".boltdocs-content");
2802
- if (!container) return;
2803
- if (hash) {
2804
- const id = hash.replace("#", "");
2805
- const element = document.getElementById(id);
2806
- if (element) {
2807
- const offset = 80;
2808
- const containerRect = container.getBoundingClientRect().top;
2809
- const elementRect = element.getBoundingClientRect().top;
2810
- const elementPosition = elementRect - containerRect;
2811
- const offsetPosition = elementPosition - offset + container.scrollTop;
2812
- container.scrollTo({
2813
- top: offsetPosition,
2814
- behavior: "smooth"
2815
- });
2816
- return;
2817
- }
2818
- }
2819
- container.scrollTo(0, 0);
2820
- }, [pathname, hash]);
2821
- return null;
2822
- }
2823
- function DocsLayout({
2824
- config,
2825
- routes
2826
- }) {
2827
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2828
- ThemeLayout,
2829
- {
2830
- config,
2831
- routes,
2832
- ...config.themeConfig?.layoutProps,
2833
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_router_dom11.Outlet, {})
2834
- }
2835
- );
2836
- }
2837
- function MdxPage({
2838
- Component: Component2,
2839
- customComponents = {}
2840
- }) {
2841
- const allComponents = { ...mdxComponents, ...customComponents };
2842
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react22.MDXProvider, { components: allComponents, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Component2, {}) });
2843
- }
2844
- function createBoltdocsApp(options) {
2845
- const { target, routes, docsDirName, config, modules, hot, homePage } = options;
2846
- const container = document.querySelector(target);
2847
- if (!container) {
2848
- throw new Error(
2849
- `[boltdocs] Mount target "${target}" not found in document.`
2850
- );
2851
- }
2852
- const app = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react21.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_router_dom11.BrowserRouter, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2853
- AppShell,
2854
- {
2855
- initialRoutes: routes,
2856
- initialConfig: config,
2857
- docsDirName,
2858
- modules,
2859
- hot,
2860
- homePage,
2861
- components: options.components
2862
- }
2863
- ) }) });
2864
- container.innerHTML = "";
2865
- import_client.default.createRoot(container).render(app);
2866
- }
2867
- var import_react21, import_client, import_react_router_dom11, import_react22, import_react23, import_lucide_react15, import_jsx_runtime31, ConfigContext, Video2, PackageManagerTabs2, Heading, mdxComponents;
2868
- var init_app = __esm({
2869
- "src/client/app/index.tsx"() {
2870
- "use strict";
2871
- import_react21 = __toESM(require("react"));
2872
- import_client = __toESM(require("react-dom/client"));
2873
- import_react_router_dom11 = require("react-router-dom");
2874
- init_Layout2();
2875
- init_NotFound2();
2876
- init_Loading2();
2877
- import_react22 = require("@mdx-js/react");
2878
- import_react23 = require("react");
2879
- import_lucide_react15 = require("lucide-react");
2880
- init_CodeBlock2();
2881
- init_preload();
2882
- import_jsx_runtime31 = require("react/jsx-runtime");
2883
- ConfigContext = (0, import_react23.createContext)(null);
2884
- Video2 = (0, import_react23.lazy)(
2885
- () => Promise.resolve().then(() => (init_Video2(), Video_exports)).then((m) => ({ default: m.Video }))
2886
- );
2887
- PackageManagerTabs2 = (0, import_react23.lazy)(
2888
- () => Promise.resolve().then(() => (init_PackageManagerTabs2(), PackageManagerTabs_exports)).then((m) => ({
2889
- default: m.PackageManagerTabs
2890
- }))
2891
- );
2892
- Heading = ({
2893
- level,
2894
- id,
2895
- children
2896
- }) => {
2897
- const Tag = `h${level}`;
2898
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Tag, { id, className: "boltdocs-heading", children: [
2899
- children,
2900
- id && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("a", { href: `#${id}`, className: "header-anchor", "aria-label": "Anchor", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react15.Link, { size: 16 }) })
2901
- ] });
2902
- };
2903
- mdxComponents = {
2904
- h1: (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Heading, { level: 1, ...props }),
2905
- h2: (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Heading, { level: 2, ...props }),
2906
- h3: (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Heading, { level: 3, ...props }),
2907
- h4: (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Heading, { level: 4, ...props }),
2908
- h5: (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Heading, { level: 5, ...props }),
2909
- h6: (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Heading, { level: 6, ...props }),
2910
- pre: (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CodeBlock, { ...props, children: props.children }),
2911
- video: (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react23.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "video-skeleton" }), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Video2, { ...props }) }),
2912
- PackageManagerTabs: (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react23.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "pkg-tabs-skeleton" }), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PackageManagerTabs2, { ...props }) })
2913
- };
2914
- }
2915
- });
2916
-
2917
- // src/client/index.ts
2918
- var client_exports = {};
2919
- __export(client_exports, {
2920
- Admonition: () => Admonition,
2921
- Badge: () => Badge,
2922
- Breadcrumbs: () => Breadcrumbs,
2923
- Button: () => Button,
2924
- Card: () => Card,
2925
- Cards: () => Cards,
2926
- CodeBlock: () => CodeBlock,
2927
- Danger: () => Danger,
2928
- Field: () => Field,
2929
- FileTree: () => FileTree,
2930
- Head: () => Head,
2931
- InfoBox: () => InfoBox,
2932
- List: () => List,
2933
- Loading: () => Loading,
2934
- Navbar: () => Navbar,
2935
- NotFound: () => NotFound,
2936
- Note: () => Note,
2937
- OnThisPage: () => OnThisPage,
2938
- Playground: () => Playground,
2939
- Sidebar: () => Sidebar,
2940
- Tab: () => Tab,
2941
- Table: () => Table,
2942
- Tabs: () => Tabs2,
2943
- ThemeLayout: () => ThemeLayout,
2944
- Tip: () => Tip,
2945
- Video: () => Video,
2946
- Warning: () => Warning,
2947
- createBoltdocsApp: () => createBoltdocsApp
2948
- });
2949
- module.exports = __toCommonJS(client_exports);
2950
- init_app();
2951
- init_Layout2();
2952
- init_Navbar2();
2953
- init_Sidebar2();
2954
- init_OnThisPage2();
2955
- init_Head2();
2956
- init_Breadcrumbs2();
2957
-
2958
- // src/client/theme/components/Playground/Playground.tsx
2959
- var import_react24 = __toESM(require("react"));
2960
- var import_react_live = require("react-live");
2961
- var import_lucide_react16 = require("lucide-react");
2962
- var import_jsx_runtime32 = require("react/jsx-runtime");
2963
- function prepareCode(raw) {
2964
- const trimmed = (raw || "").trim();
2965
- const fnMatch = trimmed.match(/export\s+default\s+function\s+(\w+)/);
2966
- if (fnMatch) {
2967
- const name = fnMatch[1];
2968
- const code = trimmed.replace(/export\s+default\s+/, "") + `
2969
-
2970
- render(<${name} />);`;
2971
- return { code, noInline: true };
2972
- }
2973
- const varMatch = trimmed.match(/export\s+default\s+(\w+)\s*;?\s*$/);
2974
- if (varMatch) {
2975
- const name = varMatch[1];
2976
- const code = trimmed.replace(/export\s+default\s+\w+\s*;?\s*$/, "") + `
2977
- render(<${name} />);`;
2978
- return { code, noInline: true };
2979
- }
2980
- return { code: trimmed, noInline: false };
2981
- }
2982
- function Playground({
2983
- code: propsCode,
2984
- children,
2985
- preview,
2986
- scope = {},
2987
- readonly = false,
2988
- noInline: forceNoInline
2989
- }) {
2990
- const initialCode = (0, import_react24.useMemo)(() => {
2991
- let base = propsCode || "";
2992
- if (!base && typeof children === "string") {
2993
- base = children;
2994
- }
2995
- return base.trim();
2996
- }, [propsCode, children]);
2997
- const prepared = (0, import_react24.useMemo)(() => prepareCode(initialCode), [initialCode]);
2998
- const useNoInline = forceNoInline ?? prepared.noInline;
2999
- const [copied, setCopied] = (0, import_react24.useState)(false);
3000
- const [activeCode, setActiveCode] = (0, import_react24.useState)(prepared.code);
3001
- const [isExpanded, setIsExpanded] = (0, import_react24.useState)(false);
3002
- import_react24.default.useEffect(() => {
3003
- setActiveCode(prepared.code);
3004
- }, [prepared.code]);
3005
- const handleCopy = () => {
3006
- const textToCopy = !!preview ? initialCode : activeCode;
3007
- navigator.clipboard.writeText(textToCopy);
3008
- setCopied(true);
3009
- setTimeout(() => setCopied(false), 2e3);
3010
- };
3011
- const extendedScope = { React: import_react24.default, ...scope };
3012
- const charLimit = 800;
3013
- const isExpandable = (propsCode || initialCode).length > charLimit;
3014
- const shouldTruncate = isExpandable && !isExpanded;
3015
- const isStatic = !!preview;
3016
- const staticTransform = (code) => {
3017
- return "render(<div style={{display:'none'}} />)";
3018
- };
3019
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: `boltdocs-playground ${shouldTruncate ? "is-truncated" : ""}`, "data-readonly": readonly || isStatic, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "playground-split-container", children: [
3020
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "playground-panel playground-preview-panel", children: [
3021
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "playground-panel-header", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "playground-panel-title", children: [
3022
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Play, { size: 14 }),
3023
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Preview" })
3024
- ] }) }),
3025
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "playground-panel-content playground-preview", children: isStatic ? preview : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
3026
- import_react_live.LiveProvider,
3027
- {
3028
- code: activeCode,
3029
- scope: extendedScope,
3030
- theme: void 0,
3031
- noInline: useNoInline,
3032
- children: [
3033
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_live.LivePreview, {}),
3034
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_live.LiveError, { className: "playground-error" })
3035
- ]
3036
- }
3037
- ) })
3038
- ] }),
3039
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "playground-panel playground-editor-panel", children: [
3040
- !isStatic && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "playground-panel-header", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "playground-panel-title", children: [
3041
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Terminal, { size: 14 }),
3042
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: readonly ? "Code Example" : "Live Editor" })
3043
- ] }) }),
3044
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "playground-panel-content playground-editor", children: [
3045
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3046
- "button",
3047
- {
3048
- className: "playground-copy-btn-inner",
3049
- onClick: handleCopy,
3050
- title: "Copy code",
3051
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Copy, { size: 14 })
3052
- }
3053
- ),
3054
- isStatic ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3055
- import_react_live.LiveProvider,
3056
- {
3057
- code: initialCode,
3058
- noInline: true,
3059
- transformCode: staticTransform,
3060
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_live.LiveEditor, { disabled: true })
3061
- }
3062
- ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3063
- import_react_live.LiveProvider,
3064
- {
3065
- code: activeCode,
3066
- scope: extendedScope,
3067
- theme: void 0,
3068
- noInline: useNoInline,
3069
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_live.LiveEditor, { disabled: readonly, onChange: setActiveCode })
3070
- }
3071
- )
3072
- ] }),
3073
- isExpandable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "playground-expand-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3074
- "button",
3075
- {
3076
- className: "playground-expand-btn",
3077
- onClick: () => setIsExpanded(!isExpanded),
3078
- children: isExpanded ? "Show less" : "Expand code"
3079
- }
3080
- ) })
3081
- ] })
3082
- ] }) });
3083
- }
3084
-
3085
- // src/client/index.ts
3086
- init_NotFound2();
3087
- init_Loading2();
3088
- init_CodeBlock2();
3089
- init_Video2();
3090
-
3091
- // src/client/theme/components/mdx/Button.tsx
3092
- var import_jsx_runtime33 = require("react/jsx-runtime");
3093
- function Button({
3094
- variant = "primary",
3095
- size = "md",
3096
- href,
3097
- children,
3098
- className = "",
3099
- ...rest
3100
- }) {
3101
- const cls = `ld-btn ld-btn--${variant} ld-btn--${size} ${className}`.trim();
3102
- if (href) {
3103
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3104
- "a",
3105
- {
3106
- href,
3107
- style: { textDecoration: "none" },
3108
- className: cls,
3109
- ...rest,
3110
- children
3111
- }
3112
- );
3113
- }
3114
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { className: cls, ...rest, children });
3115
- }
3116
-
3117
- // src/client/theme/components/mdx/Badge.tsx
3118
- var import_jsx_runtime34 = require("react/jsx-runtime");
3119
- function Badge({
3120
- variant = "default",
3121
- children,
3122
- className = "",
3123
- ...rest
3124
- }) {
3125
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3126
- "span",
3127
- {
3128
- className: `ld-badge ld-badge--${variant} ${className}`.trim(),
3129
- ...rest,
3130
- children
3131
- }
3132
- );
3133
- }
3134
-
3135
- // src/client/theme/components/mdx/Card.tsx
3136
- var import_jsx_runtime35 = require("react/jsx-runtime");
3137
- function Cards({
3138
- cols = 3,
3139
- children,
3140
- className = "",
3141
- ...rest
3142
- }) {
3143
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: `ld-cards ld-cards--${cols} ${className}`.trim(), ...rest, children });
3144
- }
3145
- function Card({
3146
- title,
3147
- icon,
3148
- href,
3149
- children,
3150
- className = "",
3151
- ...rest
3152
- }) {
3153
- const inner = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
3154
- icon && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "ld-card__icon", children: icon }),
3155
- title && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h3", { className: "ld-card__title", children: title }),
3156
- children && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "ld-card__body", children })
3157
- ] });
3158
- if (href) {
3159
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3160
- "a",
3161
- {
3162
- href,
3163
- className: `ld-card ld-card--link ${className}`.trim(),
3164
- ...rest,
3165
- children: inner
3166
- }
3167
- );
3168
- }
3169
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: `ld-card ${className}`.trim(), ...rest, children: inner });
3170
- }
3171
-
3172
- // src/client/theme/components/mdx/Tabs.tsx
3173
- var import_react25 = require("react");
3174
- init_CodeBlock2();
3175
- init_npm();
3176
- init_pnpm();
3177
- init_bun();
3178
- init_deno();
3179
- var import_jsx_runtime36 = require("react/jsx-runtime");
3180
- function Tab({ children }) {
3181
- const content = typeof children === "string" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CodeBlock, { className: "language-bash", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("code", { children: children.trim() }) }) : children;
3182
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "ld-tab-panel", children: content });
3183
- }
3184
- var getIconForLabel = (label) => {
3185
- const l = label.toLowerCase();
3186
- if (l.includes("pnpm")) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Pnpm, {});
3187
- if (l.includes("npm")) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(NPM, {});
3188
- if (l.includes("bun")) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Bun, {});
3189
- if (l.includes("deno")) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Deno, {});
3190
- return null;
3191
- };
3192
- function Tabs2({ defaultIndex = 0, children }) {
3193
- const [active, setActive] = (0, import_react25.useState)(defaultIndex);
3194
- const tabRefs = (0, import_react25.useRef)([]);
3195
- const tabs = import_react25.Children.toArray(children).filter(
3196
- (child) => (0, import_react25.isValidElement)(child) && child.props?.label
3197
- );
3198
- const handleKeyDown = (e) => {
3199
- let newIndex = active;
3200
- if (e.key === "ArrowRight") {
3201
- newIndex = (active + 1) % tabs.length;
3202
- } else if (e.key === "ArrowLeft") {
3203
- newIndex = (active - 1 + tabs.length) % tabs.length;
3204
- }
3205
- if (newIndex !== active) {
3206
- setActive(newIndex);
3207
- tabRefs.current[newIndex]?.focus();
3208
- }
3209
- };
3210
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "ld-tabs", children: [
3211
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "ld-tabs__bar", role: "tablist", onKeyDown: handleKeyDown, children: tabs.map((child, i) => {
3212
- const label = child.props.label;
3213
- const Icon = getIconForLabel(label);
3214
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
3215
- "button",
3216
- {
3217
- role: "tab",
3218
- "aria-selected": i === active,
3219
- "aria-controls": `tabpanel-${i}`,
3220
- id: `tab-${i}`,
3221
- tabIndex: i === active ? 0 : -1,
3222
- ref: (el) => {
3223
- tabRefs.current[i] = el;
3224
- },
3225
- className: `ld-tabs__trigger ${i === active ? "ld-tabs__trigger--active" : ""}`,
3226
- onClick: () => setActive(i),
3227
- children: [
3228
- Icon,
3229
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: label })
3230
- ]
3231
- },
3232
- i
3233
- );
3234
- }) }),
3235
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3236
- "div",
3237
- {
3238
- className: "ld-tabs__content",
3239
- role: "tabpanel",
3240
- id: `tabpanel-${active}`,
3241
- "aria-labelledby": `tab-${active}`,
3242
- children: tabs[active]
3243
- }
3244
- )
3245
- ] });
3246
- }
3247
-
3248
- // src/client/theme/components/mdx/Admonition.tsx
3249
- var import_lucide_react17 = require("lucide-react");
3250
- var import_jsx_runtime37 = require("react/jsx-runtime");
3251
- var ICON_MAP2 = {
3252
- note: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react17.Bookmark, { size: 18 }),
3253
- tip: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react17.Lightbulb, { size: 18 }),
3254
- info: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react17.Info, { size: 18 }),
3255
- warning: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react17.AlertTriangle, { size: 18 }),
3256
- danger: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react17.ShieldAlert, { size: 18 })
3257
- };
3258
- var LABEL_MAP = {
3259
- note: "Note",
3260
- tip: "Tip",
3261
- info: "Info",
3262
- warning: "Warning",
3263
- danger: "Danger"
3264
- };
3265
- function Admonition({
3266
- type = "note",
3267
- title,
3268
- children,
3269
- className = "",
3270
- ...rest
3271
- }) {
3272
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
3273
- "div",
3274
- {
3275
- className: `ld-admonition ld-admonition--${type} ${className}`.trim(),
3276
- role: type === "warning" || type === "danger" ? "alert" : "note",
3277
- ...rest,
3278
- children: [
3279
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ld-admonition__header", children: [
3280
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ld-admonition__icon", children: ICON_MAP2[type] }),
3281
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ld-admonition__title", children: title || LABEL_MAP[type] })
3282
- ] }),
3283
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "ld-admonition__body", children })
3284
- ]
3285
- }
3286
- );
3287
- }
3288
- var Note = (props) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Admonition, { type: "note", ...props });
3289
- var Tip = (props) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Admonition, { type: "tip", ...props });
3290
- var Warning = (props) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Admonition, { type: "warning", ...props });
3291
- var Danger = (props) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Admonition, { type: "danger", ...props });
3292
- var InfoBox = (props) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Admonition, { type: "info", ...props });
3293
-
3294
- // src/client/theme/components/mdx/List.tsx
3295
- var import_react26 = __toESM(require("react"));
3296
- var import_lucide_react18 = require("lucide-react");
3297
- var import_jsx_runtime38 = require("react/jsx-runtime");
3298
- var ICON_MAP3 = {
3299
- checked: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react18.Check, { size: 14, className: "ld-list__icon" }),
3300
- arrow: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react18.ChevronRight, { size: 14, className: "ld-list__icon" })
3301
- };
3302
- function List({
3303
- variant = "default",
3304
- children,
3305
- className = "",
3306
- ...rest
3307
- }) {
3308
- if (variant === "default") {
3309
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("ul", { className: `ld-list ${className}`.trim(), ...rest, children });
3310
- }
3311
- const icon = ICON_MAP3[variant];
3312
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("ul", { className: `ld-list ld-list--${variant} ${className}`.trim(), ...rest, children: import_react26.Children.map(children, (child) => {
3313
- if (!import_react26.default.isValidElement(child)) return child;
3314
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("li", { className: "ld-list__item", children: [
3315
- icon,
3316
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "ld-list__text", children: child.props.children })
3317
- ] });
3318
- }) });
3319
- }
3320
-
3321
- // src/client/theme/components/mdx/FileTree.tsx
3322
- var import_react27 = __toESM(require("react"));
3323
- var import_lucide_react19 = require("lucide-react");
3324
- var import_jsx_runtime39 = require("react/jsx-runtime");
3325
- function getTextContent(node) {
3326
- if (typeof node === "string") return node;
3327
- if (typeof node === "number") return node.toString();
3328
- if (Array.isArray(node)) return node.map(getTextContent).join("");
3329
- if ((0, import_react27.isValidElement)(node)) {
3330
- return getTextContent(node.props.children);
3331
- }
3332
- return "";
3333
- }
3334
- function getFileIcon(filename) {
3335
- const name = filename.toLowerCase();
3336
- if (name.endsWith(".ts") || name.endsWith(".tsx") || name.endsWith(".js") || name.endsWith(".jsx") || name.endsWith(".json") || name.endsWith(".mjs") || name.endsWith(".cjs") || name.endsWith(".astro") || name.endsWith(".vue") || name.endsWith(".svelte")) {
3337
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react19.FileCode, { size: 16, strokeWidth: 2, className: "ld-file-tree__icon-file" });
3338
- }
3339
- if (name.endsWith(".md") || name.endsWith(".mdx") || name.endsWith(".txt")) {
3340
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react19.FileText, { size: 16, strokeWidth: 2, className: "ld-file-tree__icon-file" });
3341
- }
3342
- if (name.endsWith(".png") || name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(".svg") || name.endsWith(".gif")) {
3343
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
3344
- import_lucide_react19.FileImage,
3345
- {
3346
- size: 16,
3347
- strokeWidth: 2,
3348
- className: "ld-file-tree__icon-file"
3349
- }
3350
- );
3351
- }
3352
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react19.File, { size: 16, strokeWidth: 2, className: "ld-file-tree__icon-file" });
3353
- }
3354
- function isListElement(node, tag) {
3355
- if (typeof node.type === "string") {
3356
- return node.type === tag;
3357
- }
3358
- if (typeof node.type === "function") {
3359
- return node.type.name === tag || node.type.name?.toLowerCase() === tag;
3360
- }
3361
- if (node.props && node.props.originalType === tag) {
3362
- return true;
3363
- }
3364
- if (node.props && node.props.mdxType === tag) {
3365
- return true;
3366
- }
3367
- return false;
3368
- }
3369
- function FolderNode({
3370
- labelText,
3371
- nestedNodes,
3372
- depth
3373
- }) {
3374
- const [isOpen, setIsOpen] = (0, import_react27.useState)(true);
3375
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("li", { className: "ld-file-tree__item", children: [
3376
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
3377
- "div",
3378
- {
3379
- className: "ld-file-tree__label ld-file-tree__label--folder",
3380
- onClick: () => setIsOpen(!isOpen),
3381
- style: { cursor: "pointer" },
3382
- children: [
3383
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ld-file-tree__icon ld-file-tree__icon--chevron", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
3384
- import_lucide_react19.ChevronRight,
3385
- {
3386
- size: 14,
3387
- className: `ld-file-tree__chevron ${isOpen ? "ld-file-tree__chevron--open" : ""}`,
3388
- strokeWidth: 3
3389
- }
3390
- ) }),
3391
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ld-file-tree__icon", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
3392
- import_lucide_react19.Folder,
3393
- {
3394
- size: 16,
3395
- strokeWidth: 2,
3396
- className: "ld-file-tree__icon-folder",
3397
- fill: "currentColor",
3398
- fillOpacity: 0.15
3399
- }
3400
- ) }),
3401
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ld-file-tree__name", children: labelText })
3402
- ]
3403
- }
3404
- ),
3405
- isOpen && nestedNodes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "ld-file-tree__nested", children: nestedNodes.map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react27.default.Fragment, { children: parseNode(child, depth) }, index)) })
3406
- ] });
3407
- }
3408
- function parseNode(node, depth = 0) {
3409
- if (!(0, import_react27.isValidElement)(node)) {
3410
- return node;
3411
- }
3412
- if (isListElement(node, "ul")) {
3413
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
3414
- "ul",
3415
- {
3416
- className: `ld-file-tree__list ${depth === 0 ? "ld-file-tree__list--root" : ""}`,
3417
- children: import_react27.Children.map(node.props.children, (child, index) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react27.default.Fragment, { children: parseNode(child, depth + 1) }, index))
3418
- }
3419
- );
3420
- }
3421
- if (isListElement(node, "li")) {
3422
- const children = import_react27.Children.toArray(node.props.children);
3423
- const nestedListIndex = children.findIndex(
3424
- (child) => (0, import_react27.isValidElement)(child) && isListElement(child, "ul")
3425
- );
3426
- const hasNested = nestedListIndex !== -1;
3427
- const labelNodes = hasNested ? children.slice(0, nestedListIndex) : children;
3428
- const nestedNodes = hasNested ? children.slice(nestedListIndex) : [];
3429
- const rawLabelContent = getTextContent(labelNodes).trim();
3430
- const isExplicitDir = rawLabelContent.endsWith("/");
3431
- const labelText = isExplicitDir ? rawLabelContent.slice(0, -1) : rawLabelContent;
3432
- const isFolder = hasNested || isExplicitDir;
3433
- if (isFolder) {
3434
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
3435
- FolderNode,
3436
- {
3437
- labelText,
3438
- nestedNodes,
3439
- depth
3440
- }
3441
- );
3442
- }
3443
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("li", { className: "ld-file-tree__item", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ld-file-tree__label ld-file-tree__label--file", children: [
3444
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ld-file-tree__icon ld-file-tree__icon--spacer" }),
3445
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ld-file-tree__icon", children: getFileIcon(labelText) }),
3446
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ld-file-tree__name", children: labelText })
3447
- ] }) });
3448
- }
3449
- if (node.props.children) {
3450
- return import_react27.Children.map(node.props.children, (child, index) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react27.default.Fragment, { children: parseNode(child, depth) }, index));
3451
- }
3452
- return node;
3453
- }
3454
- function FileTree({ children }) {
3455
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "ld-file-tree", dir: "ltr", children: import_react27.Children.map(children, (child) => parseNode(child, 0)) });
3456
- }
3457
-
3458
- // src/client/theme/components/mdx/Table.tsx
3459
- var import_react28 = require("react");
3460
- var import_lucide_react20 = require("lucide-react");
3461
- var import_jsx_runtime40 = require("react/jsx-runtime");
3462
- function Table({
3463
- headers,
3464
- data,
3465
- children,
3466
- className = "",
3467
- sortable = false,
3468
- paginated = false,
3469
- pageSize = 10
3470
- }) {
3471
- const [sortConfig, setSortConfig] = (0, import_react28.useState)(null);
3472
- const [currentPage, setCurrentPage] = (0, import_react28.useState)(1);
3473
- const processedData = (0, import_react28.useMemo)(() => {
3474
- if (!data) return [];
3475
- let items = [...data];
3476
- if (sortable && sortConfig !== null) {
3477
- items.sort((a, b) => {
3478
- const aVal = a[sortConfig.key];
3479
- const bVal = b[sortConfig.key];
3480
- const aStr = typeof aVal === "string" ? aVal : "";
3481
- const bStr = typeof bVal === "string" ? bVal : "";
3482
- if (aStr < bStr) return sortConfig.direction === "asc" ? -1 : 1;
3483
- if (aStr > bStr) return sortConfig.direction === "asc" ? 1 : -1;
3484
- return 0;
3485
- });
3486
- }
3487
- return items;
3488
- }, [data, sortConfig, sortable]);
3489
- const totalPages = Math.ceil(processedData.length / pageSize);
3490
- const paginatedData = (0, import_react28.useMemo)(() => {
3491
- if (!paginated) return processedData;
3492
- const start = (currentPage - 1) * pageSize;
3493
- return processedData.slice(start, start + pageSize);
3494
- }, [processedData, paginated, currentPage, pageSize]);
3495
- const requestSort = (index) => {
3496
- if (!sortable) return;
3497
- let direction = "asc";
3498
- if (sortConfig && sortConfig.key === index && sortConfig.direction === "asc") {
3499
- direction = "desc";
3500
- }
3501
- setSortConfig({ key: index, direction });
3502
- };
3503
- const renderSortIcon = (index) => {
3504
- if (!sortable) return null;
3505
- if (sortConfig?.key !== index) return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react20.ChevronDown, { size: 14, className: "ld-table-sort-icon ld-table-sort-icon--hidden" });
3506
- return sortConfig.direction === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react20.ChevronUp, { size: 14, className: "ld-table-sort-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react20.ChevronDown, { size: 14, className: "ld-table-sort-icon" });
3507
- };
3508
- const tableContent = children ? children : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
3509
- headers && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tr", { children: headers.map((header, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3510
- "th",
3511
- {
3512
- onClick: () => requestSort(i),
3513
- className: sortable ? "ld-table-header--sortable" : "",
3514
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "ld-table-header-content", children: [
3515
- header,
3516
- renderSortIcon(i)
3517
- ] })
3518
- },
3519
- i
3520
- )) }) }),
3521
- paginatedData && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tbody", { children: paginatedData.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tr", { children: row.map((cell, j) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("td", { children: cell }, j)) }, i)) })
3522
- ] });
3523
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: `ld-table-container ${className}`.trim(), children: [
3524
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "ld-table-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("table", { className: "ld-table", children: tableContent }) }),
3525
- paginated && totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "ld-table-pagination", children: [
3526
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "ld-table-pagination-info", children: [
3527
- "Page ",
3528
- currentPage,
3529
- " of ",
3530
- totalPages
3531
- ] }),
3532
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "ld-table-pagination-controls", children: [
3533
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3534
- "button",
3535
- {
3536
- onClick: () => setCurrentPage(1),
3537
- disabled: currentPage === 1,
3538
- className: "ld-table-pagination-btn",
3539
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react20.ChevronsLeft, { size: 16 })
3540
- }
3541
- ),
3542
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3543
- "button",
3544
- {
3545
- onClick: () => setCurrentPage((prev) => Math.max(prev - 1, 1)),
3546
- disabled: currentPage === 1,
3547
- className: "ld-table-pagination-btn",
3548
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react20.ChevronLeft, { size: 16 })
3549
- }
3550
- ),
3551
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3552
- "button",
3553
- {
3554
- onClick: () => setCurrentPage((prev) => Math.min(prev + 1, totalPages)),
3555
- disabled: currentPage === totalPages,
3556
- className: "ld-table-pagination-btn",
3557
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react20.ChevronRight, { size: 16 })
3558
- }
3559
- ),
3560
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3561
- "button",
3562
- {
3563
- onClick: () => setCurrentPage(totalPages),
3564
- disabled: currentPage === totalPages,
3565
- className: "ld-table-pagination-btn",
3566
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react20.ChevronsRight, { size: 16 })
3567
- }
3568
- )
3569
- ] })
3570
- ] })
3571
- ] });
3572
- }
3573
-
3574
- // src/client/theme/components/mdx/Field.tsx
3575
- var import_jsx_runtime41 = require("react/jsx-runtime");
3576
- function Field({
3577
- name,
3578
- type,
3579
- defaultValue,
3580
- required = false,
3581
- children,
3582
- id,
3583
- className = ""
3584
- }) {
3585
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `ld-field ${className}`.trim(), id, children: [
3586
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "ld-field__header", children: [
3587
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "ld-field__signature", children: [
3588
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("code", { className: "ld-field__name", children: name }),
3589
- type && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "ld-field__type-badge", children: type }),
3590
- required && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "ld-field__required-badge", children: "required" })
3591
- ] }),
3592
- defaultValue && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "ld-field__default", children: [
3593
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "ld-field__default-label", children: "Default:" }),
3594
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("code", { className: "ld-field__default-value", children: defaultValue })
3595
- ] })
3596
- ] }),
3597
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "ld-field__content", children })
3598
- ] });
3599
- }
3600
- // Annotate the CommonJS export names for ESM import in node:
3601
- 0 && (module.exports = {
3602
- Admonition,
3603
- Badge,
3604
- Breadcrumbs,
3605
- Button,
3606
- Card,
3607
- Cards,
3608
- CodeBlock,
3609
- Danger,
3610
- Field,
3611
- FileTree,
3612
- Head,
3613
- InfoBox,
3614
- List,
3615
- Loading,
3616
- Navbar,
3617
- NotFound,
3618
- Note,
3619
- OnThisPage,
3620
- Playground,
3621
- Sidebar,
3622
- Tab,
3623
- Table,
3624
- Tabs,
3625
- ThemeLayout,
3626
- Tip,
3627
- Video,
3628
- Warning,
3629
- createBoltdocsApp
3630
- });