boltdocs 2.7.10 → 2.7.11

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 (137) hide show
  1. package/dist/client/index.cjs +1929 -1
  2. package/dist/client/index.js +1880 -1
  3. package/dist/client/mdx.cjs +7 -1
  4. package/dist/client/mdx.js +7 -1
  5. package/dist/client/primitives.cjs +60 -1
  6. package/dist/client/primitives.js +20 -1
  7. package/dist/docs-layout-BXHV0xw_.cjs +1431 -0
  8. package/dist/docs-layout-DwFndmj5.js +1231 -0
  9. package/dist/icons-dev-3cZMyt8r.cjs +1204 -0
  10. package/dist/icons-dev-Df8OQ481.js +839 -0
  11. package/dist/image-DtrI2cw3.cjs +268 -0
  12. package/dist/image-jxPb-2iV.js +214 -0
  13. package/dist/mdx-BdWkJTeB.cjs +523 -0
  14. package/dist/mdx-UTTLFWJq.js +494 -0
  15. package/dist/node/cli-entry.cjs +1 -1
  16. package/dist/node/cli-entry.mjs +1 -1
  17. package/dist/node/index.cjs +1 -1
  18. package/dist/node/index.mjs +1 -1
  19. package/dist/{node-DtEDyN1u.cjs → node-BSM4qcDK.cjs} +1 -1
  20. package/dist/{node-_1jhMGYx.mjs → node-BspZN3R2.mjs} +1 -1
  21. package/dist/{package-DrwtlXfk.cjs → package-DIIrjuWI.cjs} +1 -1
  22. package/dist/{package--0Yf0t1N.mjs → package-K0zsjGIz.mjs} +1 -1
  23. package/dist/{search-dialog-ByvGScjt.js → search-dialog-BHuIiUC6.js} +3 -1
  24. package/dist/search-dialog-BNF10tDl.js +375 -0
  25. package/dist/search-dialog-BwkDuI9R.cjs +220 -0
  26. package/dist/search-dialog-C7xuvyNk.cjs +386 -0
  27. package/dist/search-dialog-CIQg6k8c.cjs +8 -0
  28. package/dist/search-dialog-D-DDN7zJ.js +208 -0
  29. package/package.json +3 -4
  30. package/dist/docs-layout-KoWNZc8_.js +0 -6
  31. package/dist/docs-layout-x2yKt2cL.cjs +0 -6
  32. package/dist/icons-dev-B_RZIyxu.js +0 -6
  33. package/dist/icons-dev-BlV3wWFT.cjs +0 -6
  34. package/dist/image-BHhTvQzr.cjs +0 -6
  35. package/dist/image-CqKzYD8f.js +0 -6
  36. package/dist/mdx-DudBEac0.js +0 -7
  37. package/dist/mdx-r4cDQxWu.cjs +0 -7
  38. package/dist/search-dialog-B584t9ZF.js +0 -6
  39. package/dist/search-dialog-BvBopRsZ.cjs +0 -6
  40. package/dist/search-dialog-Cyko6TJm.cjs +0 -6
  41. package/dist/search-dialog-D6BNohIJ.js +0 -6
  42. package/dist/search-dialog-DuYTIefy.cjs +0 -6
  43. package/src/client/app/config-context.tsx +0 -51
  44. package/src/client/app/doc-page.tsx +0 -38
  45. package/src/client/app/docs-layout.tsx +0 -28
  46. package/src/client/app/head.tsx +0 -122
  47. package/src/client/app/helmet-compat.tsx +0 -36
  48. package/src/client/app/mdx-component.tsx +0 -8
  49. package/src/client/app/mdx-components-context.tsx +0 -72
  50. package/src/client/app/routes-context.tsx +0 -34
  51. package/src/client/app/scroll-handler.tsx +0 -74
  52. package/src/client/app/theme-context.tsx +0 -103
  53. package/src/client/app/ui-context.tsx +0 -42
  54. package/src/client/components/docs-layout-default.tsx +0 -85
  55. package/src/client/components/icons-dev.tsx +0 -282
  56. package/src/client/components/mdx/callout.tsx +0 -97
  57. package/src/client/components/mdx/card.tsx +0 -99
  58. package/src/client/components/mdx/cards.tsx +0 -27
  59. package/src/client/components/mdx/code-block.tsx +0 -184
  60. package/src/client/components/mdx/field.tsx +0 -33
  61. package/src/client/components/mdx/image.tsx +0 -44
  62. package/src/client/components/mdx/index.ts +0 -19
  63. package/src/client/components/mdx/table.tsx +0 -54
  64. package/src/client/components/mdx/typographics.tsx +0 -120
  65. package/src/client/components/mdx/use-code-block.ts +0 -34
  66. package/src/client/components/primitives/breadcrumbs.tsx +0 -54
  67. package/src/client/components/primitives/button-group.tsx +0 -54
  68. package/src/client/components/primitives/button.tsx +0 -6
  69. package/src/client/components/primitives/code-block.tsx +0 -120
  70. package/src/client/components/primitives/docs-layout.tsx +0 -125
  71. package/src/client/components/primitives/error-boundary.tsx +0 -107
  72. package/src/client/components/primitives/heading.tsx +0 -128
  73. package/src/client/components/primitives/helpers/observer.ts +0 -141
  74. package/src/client/components/primitives/image.tsx +0 -26
  75. package/src/client/components/primitives/link.tsx +0 -102
  76. package/src/client/components/primitives/menu.tsx +0 -137
  77. package/src/client/components/primitives/navbar.tsx +0 -466
  78. package/src/client/components/primitives/on-this-page.tsx +0 -430
  79. package/src/client/components/primitives/page-nav.tsx +0 -51
  80. package/src/client/components/primitives/popover.tsx +0 -28
  81. package/src/client/components/primitives/search-dialog.tsx +0 -193
  82. package/src/client/components/primitives/sidebar.tsx +0 -423
  83. package/src/client/components/primitives/skeleton.tsx +0 -26
  84. package/src/client/components/primitives/tabs.tsx +0 -70
  85. package/src/client/components/primitives/tooltip.tsx +0 -81
  86. package/src/client/components/primitives/types.ts +0 -11
  87. package/src/client/components/ui-base/banner.tsx +0 -66
  88. package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
  89. package/src/client/components/ui-base/copy-markdown.tsx +0 -107
  90. package/src/client/components/ui-base/error-boundary.tsx +0 -15
  91. package/src/client/components/ui-base/github-stars.tsx +0 -29
  92. package/src/client/components/ui-base/icons.tsx +0 -240
  93. package/src/client/components/ui-base/index.ts +0 -16
  94. package/src/client/components/ui-base/last-updated.tsx +0 -27
  95. package/src/client/components/ui-base/navbar.tsx +0 -266
  96. package/src/client/components/ui-base/not-found.tsx +0 -26
  97. package/src/client/components/ui-base/on-this-page.tsx +0 -57
  98. package/src/client/components/ui-base/page-nav.tsx +0 -50
  99. package/src/client/components/ui-base/search-dialog.tsx +0 -163
  100. package/src/client/components/ui-base/search-highlight.tsx +0 -10
  101. package/src/client/components/ui-base/sidebar.tsx +0 -92
  102. package/src/client/components/ui-base/tabs.tsx +0 -83
  103. package/src/client/components/ui-base/theme-toggle.tsx +0 -130
  104. package/src/client/components/ui-base/version-i18n.tsx +0 -80
  105. package/src/client/hooks/index.ts +0 -13
  106. package/src/client/hooks/use-analytics.ts +0 -272
  107. package/src/client/hooks/use-breadcrumbs.ts +0 -22
  108. package/src/client/hooks/use-i18n.ts +0 -182
  109. package/src/client/hooks/use-localized-to.ts +0 -113
  110. package/src/client/hooks/use-location.ts +0 -5
  111. package/src/client/hooks/use-navbar.ts +0 -130
  112. package/src/client/hooks/use-page-nav.ts +0 -46
  113. package/src/client/hooks/use-routes.ts +0 -108
  114. package/src/client/hooks/use-search-highlight.ts +0 -185
  115. package/src/client/hooks/use-search.ts +0 -118
  116. package/src/client/hooks/use-sidebar.ts +0 -205
  117. package/src/client/hooks/use-tabs.ts +0 -46
  118. package/src/client/hooks/use-version.ts +0 -111
  119. package/src/client/index.ts +0 -31
  120. package/src/client/mdx.ts +0 -2
  121. package/src/client/primitives.ts +0 -19
  122. package/src/client/ssg/boltdocs-shell.tsx +0 -148
  123. package/src/client/ssg/create-routes.tsx +0 -473
  124. package/src/client/ssg/index.ts +0 -4
  125. package/src/client/ssg/mdx-page.tsx +0 -38
  126. package/src/client/store/boltdocs-context.tsx +0 -137
  127. package/src/client/theme/neutral.css +0 -141
  128. package/src/client/theme/reset.css +0 -189
  129. package/src/client/types.ts +0 -116
  130. package/src/client/utils/cn.ts +0 -6
  131. package/src/client/utils/copy-clipboard.ts +0 -22
  132. package/src/client/utils/get-base-file-path.ts +0 -21
  133. package/src/client/utils/github.ts +0 -121
  134. package/src/client/utils/i18n.ts +0 -23
  135. package/src/client/utils/path.ts +0 -9
  136. package/src/client/utils/react-to-text.ts +0 -34
  137. package/src/client/virtual.d.ts +0 -24
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Boltdocs - https://boltdocs.vercel.app
3
+ * Copyright (c) 2026 Jesus Alcala
4
+ * Licensed under the MIT License.
5
+ */
6
+ const require_icons_dev = require('./icons-dev-3cZMyt8r.cjs');
7
+ let react = require("react");
8
+ react = require_icons_dev.__toESM(react);
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ let react_aria_components = require("react-aria-components");
11
+ react_aria_components = require_icons_dev.__toESM(react_aria_components);
12
+
13
+ //#region src/client/app/theme-context.tsx
14
+ const THEME_CONTEXT_SYMBOL = Symbol.for("__BDOCS_THEME_CONTEXT__");
15
+ const THEME_INSTANCE_SYMBOL = Symbol.for("__BDOCS_THEME_INSTANCE__");
16
+ const THEME_EVENT = "boltdocs-theme-change";
17
+ const ThemeContext = globalThis[THEME_CONTEXT_SYMBOL] || (globalThis[THEME_CONTEXT_SYMBOL] = (0, react.createContext)(void 0));
18
+ function ThemeProvider({ children }) {
19
+ const [theme, setThemeState] = (0, react.useState)("system");
20
+ const [resolvedTheme, setResolvedTheme] = (0, react.useState)("dark");
21
+ const applyTheme = (targetTheme) => {
22
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
23
+ const isDark = targetTheme === "dark" || targetTheme === "system" && mediaQuery.matches;
24
+ const root = window.document.documentElement;
25
+ root.classList.toggle("dark", isDark);
26
+ root.dataset.theme = isDark ? "dark" : "light";
27
+ setResolvedTheme(isDark ? "dark" : "light");
28
+ };
29
+ (0, react.useEffect)(() => {
30
+ const savedTheme = localStorage.getItem("boltdocs-theme");
31
+ if (savedTheme) {
32
+ setThemeState(savedTheme);
33
+ applyTheme(savedTheme);
34
+ } else applyTheme("system");
35
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
36
+ const listener = () => {
37
+ if ((localStorage.getItem("boltdocs-theme") || "system") === "system") applyTheme("system");
38
+ };
39
+ mediaQuery.addEventListener("change", listener);
40
+ return () => mediaQuery.removeEventListener("change", listener);
41
+ }, []);
42
+ const setTheme = (newTheme) => {
43
+ setThemeState(newTheme);
44
+ localStorage.setItem("boltdocs-theme", newTheme);
45
+ applyTheme(newTheme);
46
+ if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent(THEME_EVENT, { detail: newTheme }));
47
+ };
48
+ const value = {
49
+ theme,
50
+ resolvedTheme,
51
+ setTheme
52
+ };
53
+ if (typeof globalThis !== "undefined") globalThis[THEME_INSTANCE_SYMBOL] = value;
54
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeContext.Provider, {
55
+ value,
56
+ children
57
+ });
58
+ }
59
+ function useTheme() {
60
+ const context = (0, react.use)(ThemeContext);
61
+ const [, forceUpdate] = (0, react.useState)({});
62
+ (0, react.useEffect)(() => {
63
+ if (context) return;
64
+ const handler = () => forceUpdate({});
65
+ window.addEventListener(THEME_EVENT, handler);
66
+ return () => window.removeEventListener(THEME_EVENT, handler);
67
+ }, [context]);
68
+ if (!context && typeof globalThis !== "undefined" && globalThis[THEME_INSTANCE_SYMBOL]) return globalThis[THEME_INSTANCE_SYMBOL];
69
+ if (context === void 0) throw new Error("useTheme must be used within a ThemeProvider");
70
+ return context;
71
+ }
72
+
73
+ //#endregion
74
+ //#region src/client/components/primitives/heading.tsx
75
+ const Heading = react.forwardRef(({ level, id, children, className, showAnchor = true, anchorPosition = "wrap", anchorIcon, anchorClassName, ...props }, ref) => {
76
+ const Tag = `h${Math.min(Math.max(Math.floor(level), 1), 6)}`;
77
+ const hasAnchor = !!(id && showAnchor);
78
+ const defaultIcon = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Link$1, {
79
+ className: require_icons_dev.cn("transition-all duration-200", anchorPosition === "wrap" ? "opacity-0 ml-2 text-muted/50 group-hover:text-primary-500 group-hover:opacity-100" : "text-muted/50 hover:text-primary-500"),
80
+ size: 16
81
+ });
82
+ const icon = anchorIcon ?? defaultIcon;
83
+ const renderContent = () => {
84
+ if (!hasAnchor) return children;
85
+ if (anchorPosition === "wrap") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_icons_dev.Link, {
86
+ href: `#${id}`,
87
+ className: require_icons_dev.cn("header-anchor flex flex-row items-center no-underline text-inherit", anchorClassName),
88
+ "aria-label": "Anchor",
89
+ children: [children, icon]
90
+ });
91
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
92
+ anchorPosition === "before" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Link, {
93
+ href: `#${id}`,
94
+ className: require_icons_dev.cn("header-anchor mr-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200", anchorClassName),
95
+ "aria-label": "Anchor",
96
+ children: icon
97
+ }),
98
+ children,
99
+ anchorPosition === "after" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Link, {
100
+ href: `#${id}`,
101
+ className: require_icons_dev.cn("header-anchor ml-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200", anchorClassName),
102
+ "aria-label": "Anchor",
103
+ children: icon
104
+ })
105
+ ] });
106
+ };
107
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
108
+ ref,
109
+ id,
110
+ className: require_icons_dev.cn("boltdocs-heading relative group flex items-center scroll-mt-24", className),
111
+ ...props,
112
+ children: renderContent()
113
+ });
114
+ });
115
+ Heading.displayName = "Heading";
116
+
117
+ //#endregion
118
+ //#region src/client/components/primitives/code-block.tsx
119
+ /**
120
+ * Root component for code blocks.
121
+ * Handles background, borders, and general layout.
122
+ */
123
+ const CodeBlock = ({ children, className, plain = false, ...props }) => {
124
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
125
+ className: require_icons_dev.cn("not-prose boltdocs-code-block", "group relative overflow-hidden bg-(--color-code-bg)", "contain-layout contain-paint", { "my-6 rounded-xl border border-subtle": !plain }, className),
126
+ ...props,
127
+ children
128
+ });
129
+ };
130
+ /**
131
+ * Header section of the code block.
132
+ * Usually contains the title, language label, and action buttons.
133
+ */
134
+ const CodeBlockHeader = ({ children, className, ...props }) => {
135
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
136
+ className: require_icons_dev.cn("flex h-9 items-center justify-between px-4 py-1.5", "text-[13px] font-medium text-muted", className),
137
+ ...props,
138
+ children
139
+ });
140
+ };
141
+ /**
142
+ * Horizontal group for organizing items within the header (e.g., logo + label).
143
+ */
144
+ const CodeBlockGroup = ({ children, className, ...props }) => {
145
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
146
+ className: require_icons_dev.cn("flex items-center space-x-2", className),
147
+ ...props,
148
+ children
149
+ });
150
+ };
151
+ /**
152
+ * Content area of the code block.
153
+ * Wraps the `<pre>` or `<div>` containing the code.
154
+ */
155
+ const CodeBlockContent = ({ className, children, shouldTruncate = false, ...props }) => {
156
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
157
+ className: require_icons_dev.cn("relative", { "[&>pre]:max-h-[300px] [&>pre]:overflow-hidden [&>div>pre]:max-h-[300px] [&>div>pre]:overflow-hidden": shouldTruncate }, className),
158
+ ...props,
159
+ children
160
+ });
161
+ };
162
+ CodeBlock.Header = CodeBlockHeader;
163
+ CodeBlock.Group = CodeBlockGroup;
164
+ CodeBlock.Content = CodeBlockContent;
165
+
166
+ //#endregion
167
+ //#region src/client/components/primitives/tooltip.tsx
168
+ /**
169
+ * Modern, accessible Tooltip component built with React Aria Components.
170
+ * Featuring glassmorphism, animations, and smart positioning.
171
+ */
172
+ const TooltipContent = ({ className, children, ...props }) => {
173
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Tooltip, {
174
+ ...props,
175
+ offset: 8,
176
+ className: (values) => require_icons_dev.cn("group z-50 overflow-visible rounded-md bg-surface px-2.5 py-1.5 text-xs font-medium text-body ring-1 ring-subtle outline-hidden select-none", "data-entering:animate-in data-entering:fade-in data-entering:zoom-in-95 data-entering:duration-100", "data-exiting:animate-out data-exiting:fade-out data-exiting:zoom-out-95 data-exiting:duration-75", "data-[placement=top]:slide-in-from-bottom-1", "data-[placement=bottom]:slide-in-from-top-1", "data-[placement=left]:slide-in-from-right-1", "data-[placement=right]:slide-in-from-left-1", typeof className === "function" ? className(values) : className),
177
+ children: (values) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.OverlayArrow, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
178
+ width: 8,
179
+ height: 8,
180
+ viewBox: "0 0 8 8",
181
+ className: "fill-bg-surface/90 stroke-border-subtle group-data-[placement=bottom]:rotate-180 group-data-[placement=left]:-rotate-90 group-data-[placement=right]:rotate-90",
182
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("title", { children: "Arrow" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M0 0 L4 4 L8 0" })]
183
+ }) }), typeof children === "function" ? children(values) : children] })
184
+ });
185
+ };
186
+ const Tooltip = ({ content, children, delay = 500, closeDelay = 0, ...props }) => {
187
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_aria_components.TooltipTrigger, {
188
+ delay,
189
+ closeDelay,
190
+ children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContent, {
191
+ ...props,
192
+ children: content
193
+ })]
194
+ });
195
+ };
196
+ Tooltip.Root = Tooltip;
197
+ Tooltip.Content = TooltipContent;
198
+
199
+ //#endregion
200
+ //#region src/client/components/primitives/image.tsx
201
+ /**
202
+ * A responsive image component that automatically supports dark and light theme variations
203
+ * via the `theme` prop.
204
+ */
205
+ function Image({ theme, className, ...props }) {
206
+ const { resolvedTheme } = useTheme();
207
+ if (theme && theme !== resolvedTheme) return null;
208
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
209
+ className: require_icons_dev.cn("max-w-full h-auto rounded-lg my-8", className),
210
+ ...props
211
+ });
212
+ }
213
+
214
+ //#endregion
215
+ Object.defineProperty(exports, 'CodeBlock', {
216
+ enumerable: true,
217
+ get: function () {
218
+ return CodeBlock;
219
+ }
220
+ });
221
+ Object.defineProperty(exports, 'CodeBlockContent', {
222
+ enumerable: true,
223
+ get: function () {
224
+ return CodeBlockContent;
225
+ }
226
+ });
227
+ Object.defineProperty(exports, 'CodeBlockGroup', {
228
+ enumerable: true,
229
+ get: function () {
230
+ return CodeBlockGroup;
231
+ }
232
+ });
233
+ Object.defineProperty(exports, 'CodeBlockHeader', {
234
+ enumerable: true,
235
+ get: function () {
236
+ return CodeBlockHeader;
237
+ }
238
+ });
239
+ Object.defineProperty(exports, 'Heading', {
240
+ enumerable: true,
241
+ get: function () {
242
+ return Heading;
243
+ }
244
+ });
245
+ Object.defineProperty(exports, 'Image', {
246
+ enumerable: true,
247
+ get: function () {
248
+ return Image;
249
+ }
250
+ });
251
+ Object.defineProperty(exports, 'ThemeProvider', {
252
+ enumerable: true,
253
+ get: function () {
254
+ return ThemeProvider;
255
+ }
256
+ });
257
+ Object.defineProperty(exports, 'Tooltip', {
258
+ enumerable: true,
259
+ get: function () {
260
+ return Tooltip;
261
+ }
262
+ });
263
+ Object.defineProperty(exports, 'useTheme', {
264
+ enumerable: true,
265
+ get: function () {
266
+ return useTheme;
267
+ }
268
+ });
@@ -0,0 +1,214 @@
1
+ /**
2
+ * Boltdocs - https://boltdocs.vercel.app
3
+ * Copyright (c) 2026 Jesus Alcala
4
+ * Licensed under the MIT License.
5
+ */
6
+ import { _ as Link$1, y as cn, z as Link } from "./icons-dev-Df8OQ481.js";
7
+ import * as React$1 from "react";
8
+ import { createContext, use, useEffect, useState } from "react";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import * as RAC from "react-aria-components";
11
+
12
+ //#region src/client/app/theme-context.tsx
13
+ const THEME_CONTEXT_SYMBOL = Symbol.for("__BDOCS_THEME_CONTEXT__");
14
+ const THEME_INSTANCE_SYMBOL = Symbol.for("__BDOCS_THEME_INSTANCE__");
15
+ const THEME_EVENT = "boltdocs-theme-change";
16
+ const ThemeContext = globalThis[THEME_CONTEXT_SYMBOL] || (globalThis[THEME_CONTEXT_SYMBOL] = createContext(void 0));
17
+ function ThemeProvider({ children }) {
18
+ const [theme, setThemeState] = useState("system");
19
+ const [resolvedTheme, setResolvedTheme] = useState("dark");
20
+ const applyTheme = (targetTheme) => {
21
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
22
+ const isDark = targetTheme === "dark" || targetTheme === "system" && mediaQuery.matches;
23
+ const root = window.document.documentElement;
24
+ root.classList.toggle("dark", isDark);
25
+ root.dataset.theme = isDark ? "dark" : "light";
26
+ setResolvedTheme(isDark ? "dark" : "light");
27
+ };
28
+ useEffect(() => {
29
+ const savedTheme = localStorage.getItem("boltdocs-theme");
30
+ if (savedTheme) {
31
+ setThemeState(savedTheme);
32
+ applyTheme(savedTheme);
33
+ } else applyTheme("system");
34
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
35
+ const listener = () => {
36
+ if ((localStorage.getItem("boltdocs-theme") || "system") === "system") applyTheme("system");
37
+ };
38
+ mediaQuery.addEventListener("change", listener);
39
+ return () => mediaQuery.removeEventListener("change", listener);
40
+ }, []);
41
+ const setTheme = (newTheme) => {
42
+ setThemeState(newTheme);
43
+ localStorage.setItem("boltdocs-theme", newTheme);
44
+ applyTheme(newTheme);
45
+ if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent(THEME_EVENT, { detail: newTheme }));
46
+ };
47
+ const value = {
48
+ theme,
49
+ resolvedTheme,
50
+ setTheme
51
+ };
52
+ if (typeof globalThis !== "undefined") globalThis[THEME_INSTANCE_SYMBOL] = value;
53
+ return /* @__PURE__ */ jsx(ThemeContext.Provider, {
54
+ value,
55
+ children
56
+ });
57
+ }
58
+ function useTheme() {
59
+ const context = use(ThemeContext);
60
+ const [, forceUpdate] = useState({});
61
+ useEffect(() => {
62
+ if (context) return;
63
+ const handler = () => forceUpdate({});
64
+ window.addEventListener(THEME_EVENT, handler);
65
+ return () => window.removeEventListener(THEME_EVENT, handler);
66
+ }, [context]);
67
+ if (!context && typeof globalThis !== "undefined" && globalThis[THEME_INSTANCE_SYMBOL]) return globalThis[THEME_INSTANCE_SYMBOL];
68
+ if (context === void 0) throw new Error("useTheme must be used within a ThemeProvider");
69
+ return context;
70
+ }
71
+
72
+ //#endregion
73
+ //#region src/client/components/primitives/heading.tsx
74
+ const Heading = React$1.forwardRef(({ level, id, children, className, showAnchor = true, anchorPosition = "wrap", anchorIcon, anchorClassName, ...props }, ref) => {
75
+ const Tag = `h${Math.min(Math.max(Math.floor(level), 1), 6)}`;
76
+ const hasAnchor = !!(id && showAnchor);
77
+ const defaultIcon = /* @__PURE__ */ jsx(Link, {
78
+ className: cn("transition-all duration-200", anchorPosition === "wrap" ? "opacity-0 ml-2 text-muted/50 group-hover:text-primary-500 group-hover:opacity-100" : "text-muted/50 hover:text-primary-500"),
79
+ size: 16
80
+ });
81
+ const icon = anchorIcon ?? defaultIcon;
82
+ const renderContent = () => {
83
+ if (!hasAnchor) return children;
84
+ if (anchorPosition === "wrap") return /* @__PURE__ */ jsxs(Link$1, {
85
+ href: `#${id}`,
86
+ className: cn("header-anchor flex flex-row items-center no-underline text-inherit", anchorClassName),
87
+ "aria-label": "Anchor",
88
+ children: [children, icon]
89
+ });
90
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
91
+ anchorPosition === "before" && /* @__PURE__ */ jsx(Link$1, {
92
+ href: `#${id}`,
93
+ className: cn("header-anchor mr-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200", anchorClassName),
94
+ "aria-label": "Anchor",
95
+ children: icon
96
+ }),
97
+ children,
98
+ anchorPosition === "after" && /* @__PURE__ */ jsx(Link$1, {
99
+ href: `#${id}`,
100
+ className: cn("header-anchor ml-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200", anchorClassName),
101
+ "aria-label": "Anchor",
102
+ children: icon
103
+ })
104
+ ] });
105
+ };
106
+ return /* @__PURE__ */ jsx(Tag, {
107
+ ref,
108
+ id,
109
+ className: cn("boltdocs-heading relative group flex items-center scroll-mt-24", className),
110
+ ...props,
111
+ children: renderContent()
112
+ });
113
+ });
114
+ Heading.displayName = "Heading";
115
+
116
+ //#endregion
117
+ //#region src/client/components/primitives/code-block.tsx
118
+ /**
119
+ * Root component for code blocks.
120
+ * Handles background, borders, and general layout.
121
+ */
122
+ const CodeBlock = ({ children, className, plain = false, ...props }) => {
123
+ return /* @__PURE__ */ jsx("div", {
124
+ className: cn("not-prose boltdocs-code-block", "group relative overflow-hidden bg-(--color-code-bg)", "contain-layout contain-paint", { "my-6 rounded-xl border border-subtle": !plain }, className),
125
+ ...props,
126
+ children
127
+ });
128
+ };
129
+ /**
130
+ * Header section of the code block.
131
+ * Usually contains the title, language label, and action buttons.
132
+ */
133
+ const CodeBlockHeader = ({ children, className, ...props }) => {
134
+ return /* @__PURE__ */ jsx("div", {
135
+ className: cn("flex h-9 items-center justify-between px-4 py-1.5", "text-[13px] font-medium text-muted", className),
136
+ ...props,
137
+ children
138
+ });
139
+ };
140
+ /**
141
+ * Horizontal group for organizing items within the header (e.g., logo + label).
142
+ */
143
+ const CodeBlockGroup = ({ children, className, ...props }) => {
144
+ return /* @__PURE__ */ jsx("div", {
145
+ className: cn("flex items-center space-x-2", className),
146
+ ...props,
147
+ children
148
+ });
149
+ };
150
+ /**
151
+ * Content area of the code block.
152
+ * Wraps the `<pre>` or `<div>` containing the code.
153
+ */
154
+ const CodeBlockContent = ({ className, children, shouldTruncate = false, ...props }) => {
155
+ return /* @__PURE__ */ jsx("div", {
156
+ className: cn("relative", { "[&>pre]:max-h-[300px] [&>pre]:overflow-hidden [&>div>pre]:max-h-[300px] [&>div>pre]:overflow-hidden": shouldTruncate }, className),
157
+ ...props,
158
+ children
159
+ });
160
+ };
161
+ CodeBlock.Header = CodeBlockHeader;
162
+ CodeBlock.Group = CodeBlockGroup;
163
+ CodeBlock.Content = CodeBlockContent;
164
+
165
+ //#endregion
166
+ //#region src/client/components/primitives/tooltip.tsx
167
+ /**
168
+ * Modern, accessible Tooltip component built with React Aria Components.
169
+ * Featuring glassmorphism, animations, and smart positioning.
170
+ */
171
+ const TooltipContent = ({ className, children, ...props }) => {
172
+ return /* @__PURE__ */ jsx(RAC.Tooltip, {
173
+ ...props,
174
+ offset: 8,
175
+ className: (values) => cn("group z-50 overflow-visible rounded-md bg-surface px-2.5 py-1.5 text-xs font-medium text-body ring-1 ring-subtle outline-hidden select-none", "data-entering:animate-in data-entering:fade-in data-entering:zoom-in-95 data-entering:duration-100", "data-exiting:animate-out data-exiting:fade-out data-exiting:zoom-out-95 data-exiting:duration-75", "data-[placement=top]:slide-in-from-bottom-1", "data-[placement=bottom]:slide-in-from-top-1", "data-[placement=left]:slide-in-from-right-1", "data-[placement=right]:slide-in-from-left-1", typeof className === "function" ? className(values) : className),
176
+ children: (values) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(RAC.OverlayArrow, { children: /* @__PURE__ */ jsxs("svg", {
177
+ width: 8,
178
+ height: 8,
179
+ viewBox: "0 0 8 8",
180
+ className: "fill-bg-surface/90 stroke-border-subtle group-data-[placement=bottom]:rotate-180 group-data-[placement=left]:-rotate-90 group-data-[placement=right]:rotate-90",
181
+ children: [/* @__PURE__ */ jsx("title", { children: "Arrow" }), /* @__PURE__ */ jsx("path", { d: "M0 0 L4 4 L8 0" })]
182
+ }) }), typeof children === "function" ? children(values) : children] })
183
+ });
184
+ };
185
+ const Tooltip = ({ content, children, delay = 500, closeDelay = 0, ...props }) => {
186
+ return /* @__PURE__ */ jsxs(RAC.TooltipTrigger, {
187
+ delay,
188
+ closeDelay,
189
+ children: [children, /* @__PURE__ */ jsx(TooltipContent, {
190
+ ...props,
191
+ children: content
192
+ })]
193
+ });
194
+ };
195
+ Tooltip.Root = Tooltip;
196
+ Tooltip.Content = TooltipContent;
197
+
198
+ //#endregion
199
+ //#region src/client/components/primitives/image.tsx
200
+ /**
201
+ * A responsive image component that automatically supports dark and light theme variations
202
+ * via the `theme` prop.
203
+ */
204
+ function Image({ theme, className, ...props }) {
205
+ const { resolvedTheme } = useTheme();
206
+ if (theme && theme !== resolvedTheme) return null;
207
+ return /* @__PURE__ */ jsx("img", {
208
+ className: cn("max-w-full h-auto rounded-lg my-8", className),
209
+ ...props
210
+ });
211
+ }
212
+
213
+ //#endregion
214
+ export { CodeBlockGroup as a, ThemeProvider as c, CodeBlockContent as i, useTheme as l, Tooltip as n, CodeBlockHeader as o, CodeBlock as r, Heading as s, Image as t };