boltdocs 2.7.10 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/README.md +2 -2
  2. package/dist/banner-3N4Jd_L9.d.ts +100 -0
  3. package/dist/banner-MynZD_Ox.d.cts +100 -0
  4. package/dist/cache-BMUyNiiA.mjs +6 -0
  5. package/dist/cache-CKm45d2w.cjs +6 -0
  6. package/dist/client/index.cjs +2268 -1
  7. package/dist/client/index.d.cts +86 -110
  8. package/dist/client/index.d.ts +87 -111
  9. package/dist/client/index.js +2214 -1
  10. package/dist/client/mdx.cjs +12 -1
  11. package/dist/client/mdx.d.cts +39 -93
  12. package/dist/client/mdx.d.ts +38 -93
  13. package/dist/client/mdx.js +7 -1
  14. package/dist/client/primitives.cjs +60 -1
  15. package/dist/client/primitives.d.cts +411 -347
  16. package/dist/client/primitives.d.ts +411 -347
  17. package/dist/client/primitives.js +20 -1
  18. package/dist/docs-layout-CwCq42Zt.cjs +1348 -0
  19. package/dist/docs-layout-Dn6S5g59.js +1167 -0
  20. package/dist/doctor-BArviV8X.cjs +28 -0
  21. package/dist/doctor-CgLA7_Uv.mjs +28 -0
  22. package/dist/{doctor-CrytFkqW.cjs → doctor-DyNUVe96.cjs} +1 -1
  23. package/dist/{routes-DP1vmWRj.cjs → doctor-aN_leTbh.mjs} +1 -1
  24. package/dist/{generator-ClVanhvi.mjs → generator-BHCrLU6h.mjs} +2 -2
  25. package/dist/{generator-CHqxiQhF.cjs → generator-CC2yHzhZ.cjs} +2 -2
  26. package/dist/icons-dev-DvJ-hh9x.cjs +1209 -0
  27. package/dist/icons-dev-Oju24Wjp.js +845 -0
  28. package/dist/image-Ch4-GxdO.cjs +268 -0
  29. package/dist/image-Do8V9PCW.js +214 -0
  30. package/dist/mdx-D3A2_l7P.js +520 -0
  31. package/dist/mdx-PLhhPJRS.cjs +531 -0
  32. package/dist/node/cli-entry.cjs +3 -1
  33. package/dist/node/cli-entry.mjs +3 -1
  34. package/dist/node/index.cjs +1 -1
  35. package/dist/node/index.d.cts +258 -152
  36. package/dist/node/index.d.mts +258 -150
  37. package/dist/node/index.mjs +1 -1
  38. package/dist/node/routes/worker.cjs +1 -1
  39. package/dist/node/routes/worker.mjs +1 -1
  40. package/dist/node-BmlP0eBP.cjs +159 -0
  41. package/dist/node-Y8_4ayje.mjs +159 -0
  42. package/dist/package-2nFy_NsW.cjs +6 -0
  43. package/dist/{package--0Yf0t1N.mjs → package-DAbtltXX.mjs} +1 -1
  44. package/dist/parser-B7-6PyQz.cjs +6 -0
  45. package/dist/{parser-Aq8LoH-0.cjs → parser-BzB-zCkF.cjs} +1 -1
  46. package/dist/parser-WGZdWs0X.mjs +6 -0
  47. package/dist/routes-BDDSxAl0.mjs +6 -0
  48. package/dist/routes-DJNJ-rTt.cjs +6 -0
  49. package/dist/routes-DiYC4nD2.cjs +6 -0
  50. package/dist/routes-_Bb2f4eI.mjs +6 -0
  51. package/dist/search-dialog-BXVoecTx.cjs +483 -0
  52. package/dist/search-dialog-BYhOov4S.cjs +331 -0
  53. package/dist/search-dialog-C09riYmx.js +313 -0
  54. package/dist/search-dialog-CUeAfy-8.cjs +8 -0
  55. package/dist/search-dialog-D8gLkhUV.js +453 -0
  56. package/dist/search-dialog-DHc_8FFX.js +8 -0
  57. package/dist/{sidebar-CcBkrm06.d.cts → sidebar-DNq4_ZAa.d.ts} +118 -52
  58. package/dist/{sidebar-CyZS9YOm.d.ts → sidebar-Dlkgbxs6.d.cts} +118 -52
  59. package/dist/utils-BYITg7T5.mjs +7 -0
  60. package/dist/utils-Cjmx1hhk.cjs +7 -0
  61. package/dist/worker-pool-CtqklOXq.cjs +6 -0
  62. package/dist/worker-pool-k0DY6k8T.mjs +6 -0
  63. package/package.json +5 -6
  64. package/src/shared/config-utils.ts +4 -0
  65. package/src/shared/types.ts +52 -6
  66. package/dist/cache-Ba-DZQNH.cjs +0 -6
  67. package/dist/cache-BuMZ58L5.mjs +0 -6
  68. package/dist/cards-BakZPTz9.d.ts +0 -30
  69. package/dist/cards-CQn9mXZS.d.cts +0 -30
  70. package/dist/docs-layout-KoWNZc8_.js +0 -6
  71. package/dist/docs-layout-x2yKt2cL.cjs +0 -6
  72. package/dist/doctor-Be7Ly1oM.mjs +0 -21
  73. package/dist/doctor-jMxWZyLJ.cjs +0 -21
  74. package/dist/icons-dev-B_RZIyxu.js +0 -6
  75. package/dist/icons-dev-BlV3wWFT.cjs +0 -6
  76. package/dist/image-BHhTvQzr.cjs +0 -6
  77. package/dist/image-CqKzYD8f.js +0 -6
  78. package/dist/mdx-DudBEac0.js +0 -7
  79. package/dist/mdx-r4cDQxWu.cjs +0 -7
  80. package/dist/node-DtEDyN1u.cjs +0 -111
  81. package/dist/node-_1jhMGYx.mjs +0 -111
  82. package/dist/package-DrwtlXfk.cjs +0 -6
  83. package/dist/parser-CdNbqN5y.cjs +0 -6
  84. package/dist/parser-nE792MLO.mjs +0 -6
  85. package/dist/rolldown-runtime-fkIsjY3S.mjs +0 -6
  86. package/dist/routes-2k3tbUmC.cjs +0 -6
  87. package/dist/routes-CpxZIsMM.mjs +0 -6
  88. package/dist/search-dialog-B584t9ZF.js +0 -6
  89. package/dist/search-dialog-BvBopRsZ.cjs +0 -6
  90. package/dist/search-dialog-ByvGScjt.js +0 -6
  91. package/dist/search-dialog-Cyko6TJm.cjs +0 -6
  92. package/dist/search-dialog-D6BNohIJ.js +0 -6
  93. package/dist/search-dialog-DuYTIefy.cjs +0 -6
  94. package/dist/utils-CG65J0Sc.mjs +0 -7
  95. package/dist/utils-CKunkU96.cjs +0 -7
  96. package/dist/worker-pool-CGn7DrLb.mjs +0 -6
  97. package/dist/worker-pool-Crbqgw5R.cjs +0 -6
  98. package/src/client/app/config-context.tsx +0 -51
  99. package/src/client/app/doc-page.tsx +0 -38
  100. package/src/client/app/docs-layout.tsx +0 -28
  101. package/src/client/app/head.tsx +0 -122
  102. package/src/client/app/helmet-compat.tsx +0 -36
  103. package/src/client/app/mdx-component.tsx +0 -8
  104. package/src/client/app/mdx-components-context.tsx +0 -72
  105. package/src/client/app/routes-context.tsx +0 -34
  106. package/src/client/app/scroll-handler.tsx +0 -74
  107. package/src/client/app/theme-context.tsx +0 -103
  108. package/src/client/app/ui-context.tsx +0 -42
  109. package/src/client/components/docs-layout-default.tsx +0 -85
  110. package/src/client/components/icons-dev.tsx +0 -282
  111. package/src/client/components/mdx/callout.tsx +0 -97
  112. package/src/client/components/mdx/card.tsx +0 -99
  113. package/src/client/components/mdx/cards.tsx +0 -27
  114. package/src/client/components/mdx/code-block.tsx +0 -184
  115. package/src/client/components/mdx/field.tsx +0 -33
  116. package/src/client/components/mdx/image.tsx +0 -44
  117. package/src/client/components/mdx/index.ts +0 -19
  118. package/src/client/components/mdx/table.tsx +0 -54
  119. package/src/client/components/mdx/typographics.tsx +0 -120
  120. package/src/client/components/mdx/use-code-block.ts +0 -34
  121. package/src/client/components/primitives/breadcrumbs.tsx +0 -54
  122. package/src/client/components/primitives/button-group.tsx +0 -54
  123. package/src/client/components/primitives/button.tsx +0 -6
  124. package/src/client/components/primitives/code-block.tsx +0 -120
  125. package/src/client/components/primitives/docs-layout.tsx +0 -125
  126. package/src/client/components/primitives/error-boundary.tsx +0 -107
  127. package/src/client/components/primitives/heading.tsx +0 -128
  128. package/src/client/components/primitives/helpers/observer.ts +0 -141
  129. package/src/client/components/primitives/image.tsx +0 -26
  130. package/src/client/components/primitives/link.tsx +0 -102
  131. package/src/client/components/primitives/menu.tsx +0 -137
  132. package/src/client/components/primitives/navbar.tsx +0 -466
  133. package/src/client/components/primitives/on-this-page.tsx +0 -430
  134. package/src/client/components/primitives/page-nav.tsx +0 -51
  135. package/src/client/components/primitives/popover.tsx +0 -28
  136. package/src/client/components/primitives/search-dialog.tsx +0 -193
  137. package/src/client/components/primitives/sidebar.tsx +0 -423
  138. package/src/client/components/primitives/skeleton.tsx +0 -26
  139. package/src/client/components/primitives/tabs.tsx +0 -70
  140. package/src/client/components/primitives/tooltip.tsx +0 -81
  141. package/src/client/components/primitives/types.ts +0 -11
  142. package/src/client/components/ui-base/banner.tsx +0 -66
  143. package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
  144. package/src/client/components/ui-base/copy-markdown.tsx +0 -107
  145. package/src/client/components/ui-base/error-boundary.tsx +0 -15
  146. package/src/client/components/ui-base/github-stars.tsx +0 -29
  147. package/src/client/components/ui-base/icons.tsx +0 -240
  148. package/src/client/components/ui-base/index.ts +0 -16
  149. package/src/client/components/ui-base/last-updated.tsx +0 -27
  150. package/src/client/components/ui-base/navbar.tsx +0 -266
  151. package/src/client/components/ui-base/not-found.tsx +0 -26
  152. package/src/client/components/ui-base/on-this-page.tsx +0 -57
  153. package/src/client/components/ui-base/page-nav.tsx +0 -50
  154. package/src/client/components/ui-base/search-dialog.tsx +0 -163
  155. package/src/client/components/ui-base/search-highlight.tsx +0 -10
  156. package/src/client/components/ui-base/sidebar.tsx +0 -92
  157. package/src/client/components/ui-base/tabs.tsx +0 -83
  158. package/src/client/components/ui-base/theme-toggle.tsx +0 -130
  159. package/src/client/components/ui-base/version-i18n.tsx +0 -80
  160. package/src/client/hooks/index.ts +0 -13
  161. package/src/client/hooks/use-analytics.ts +0 -272
  162. package/src/client/hooks/use-breadcrumbs.ts +0 -22
  163. package/src/client/hooks/use-i18n.ts +0 -182
  164. package/src/client/hooks/use-localized-to.ts +0 -113
  165. package/src/client/hooks/use-location.ts +0 -5
  166. package/src/client/hooks/use-navbar.ts +0 -130
  167. package/src/client/hooks/use-page-nav.ts +0 -46
  168. package/src/client/hooks/use-routes.ts +0 -108
  169. package/src/client/hooks/use-search-highlight.ts +0 -185
  170. package/src/client/hooks/use-search.ts +0 -118
  171. package/src/client/hooks/use-sidebar.ts +0 -205
  172. package/src/client/hooks/use-tabs.ts +0 -46
  173. package/src/client/hooks/use-version.ts +0 -111
  174. package/src/client/index.ts +0 -31
  175. package/src/client/mdx.ts +0 -2
  176. package/src/client/primitives.ts +0 -19
  177. package/src/client/ssg/boltdocs-shell.tsx +0 -148
  178. package/src/client/ssg/create-routes.tsx +0 -473
  179. package/src/client/ssg/index.ts +0 -4
  180. package/src/client/ssg/mdx-page.tsx +0 -38
  181. package/src/client/store/boltdocs-context.tsx +0 -137
  182. package/src/client/theme/neutral.css +0 -141
  183. package/src/client/theme/reset.css +0 -189
  184. package/src/client/types.ts +0 -116
  185. package/src/client/utils/cn.ts +0 -6
  186. package/src/client/utils/copy-clipboard.ts +0 -22
  187. package/src/client/utils/get-base-file-path.ts +0 -21
  188. package/src/client/utils/github.ts +0 -121
  189. package/src/client/utils/i18n.ts +0 -23
  190. package/src/client/utils/path.ts +0 -9
  191. package/src/client/utils/react-to-text.ts +0 -34
  192. package/src/client/virtual.d.ts +0 -24
  193. /package/dist/{meta-loader-CWg2gnbY.mjs → meta-loader-DzwDFtdT.mjs} +0 -0
@@ -0,0 +1,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-DvJ-hh9x.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
+ function 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
+ function 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
+ function 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
+ function 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
+ function 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
+ function 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 { H as Link, _ as Link$1, y as cn } from "./icons-dev-Oju24Wjp.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
+ function 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
+ function 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
+ function 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
+ function 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
+ function 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
+ function 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 };