boltdocs 2.7.9 → 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.
- package/dist/{cache-DorPMFgW.cjs → cache-Ba-DZQNH.cjs} +1 -1
- package/dist/{cache-CQKlT4fI.mjs → cache-BuMZ58L5.mjs} +1 -1
- package/dist/chunk-CU-zTemE.cjs +6 -0
- package/dist/client/index.cjs +1929 -1
- package/dist/client/index.js +1880 -1
- package/dist/client/mdx.cjs +7 -1
- package/dist/client/mdx.js +7 -1
- package/dist/client/primitives.cjs +60 -1
- package/dist/client/primitives.js +20 -1
- package/dist/docs-layout-BXHV0xw_.cjs +1431 -0
- package/dist/docs-layout-DwFndmj5.js +1231 -0
- package/dist/doctor-Be7Ly1oM.mjs +21 -0
- package/dist/{doctor-D4_Y7M4p.cjs → doctor-CrytFkqW.cjs} +1 -1
- package/dist/doctor-jMxWZyLJ.cjs +21 -0
- package/dist/generator-CHqxiQhF.cjs +21 -0
- package/dist/generator-ClVanhvi.mjs +21 -0
- package/dist/icons-dev-3cZMyt8r.cjs +1204 -0
- package/dist/icons-dev-Df8OQ481.js +839 -0
- package/dist/image-DtrI2cw3.cjs +268 -0
- package/dist/image-jxPb-2iV.js +214 -0
- package/dist/mdx-BdWkJTeB.cjs +523 -0
- package/dist/mdx-UTTLFWJq.js +494 -0
- package/dist/meta-loader-CWg2gnbY.mjs +6 -0
- package/dist/meta-loader-Cv9O0Pzl.cjs +6 -0
- package/dist/node/cli-entry.cjs +1 -1
- package/dist/node/cli-entry.mjs +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/node/routes/worker.cjs +1 -1
- package/dist/node/routes/worker.mjs +1 -1
- package/dist/node-BSM4qcDK.cjs +111 -0
- package/dist/node-BspZN3R2.mjs +111 -0
- package/dist/{package-VfQM94VL.cjs → package-DIIrjuWI.cjs} +1 -1
- package/dist/{package-B4MD00N3.mjs → package-K0zsjGIz.mjs} +1 -1
- package/dist/{parser-Bh11BsdA.cjs → parser-Aq8LoH-0.cjs} +1 -1
- package/dist/{parser-DYRzXWmA.cjs → parser-CdNbqN5y.cjs} +1 -1
- package/dist/parser-nE792MLO.mjs +6 -0
- package/dist/rolldown-runtime-fkIsjY3S.mjs +6 -0
- package/dist/{routes-Co1mRM58.cjs → routes-2k3tbUmC.cjs} +1 -1
- package/dist/routes-CpxZIsMM.mjs +6 -0
- package/dist/{routes-CHf76Ye4.cjs → routes-DP1vmWRj.cjs} +1 -1
- package/dist/search-dialog-BHuIiUC6.js +8 -0
- package/dist/search-dialog-BNF10tDl.js +375 -0
- package/dist/search-dialog-BwkDuI9R.cjs +220 -0
- package/dist/search-dialog-C7xuvyNk.cjs +386 -0
- package/dist/search-dialog-CIQg6k8c.cjs +8 -0
- package/dist/search-dialog-D-DDN7zJ.js +208 -0
- package/dist/utils-CG65J0Sc.mjs +7 -0
- package/dist/utils-CKunkU96.cjs +7 -0
- package/dist/{worker-pool-BwU8ckrg.cjs → worker-pool-Crbqgw5R.cjs} +1 -1
- package/package.json +5 -5
- package/dist/chunk-Ds5LZdWN.cjs +0 -6
- package/dist/docs-layout-KoWNZc8_.js +0 -6
- package/dist/docs-layout-x2yKt2cL.cjs +0 -6
- package/dist/doctor-BD1BSB03.mjs +0 -23
- package/dist/doctor-BHc9ua6r.cjs +0 -23
- package/dist/generator-DGW6pkCC.cjs +0 -22
- package/dist/generator-Dv3wEmhZ.mjs +0 -22
- package/dist/icons-dev-B_RZIyxu.js +0 -6
- package/dist/icons-dev-BlV3wWFT.cjs +0 -6
- package/dist/image-BHhTvQzr.cjs +0 -6
- package/dist/image-CqKzYD8f.js +0 -6
- package/dist/mdx-DudBEac0.js +0 -7
- package/dist/mdx-r4cDQxWu.cjs +0 -7
- package/dist/meta-loader-0gJ4PtBC.cjs +0 -6
- package/dist/meta-loader-9IpAHWDS.mjs +0 -6
- package/dist/node-DBaH7kat.mjs +0 -111
- package/dist/node-t5C3Q85p.cjs +0 -111
- package/dist/parser-9cVdK7w9.mjs +0 -6
- package/dist/routes-DwrMa5-z.mjs +0 -6
- package/dist/search-dialog-B584t9ZF.js +0 -6
- package/dist/search-dialog-BvBopRsZ.cjs +0 -6
- package/dist/search-dialog-ByvGScjt.js +0 -6
- package/dist/search-dialog-Cyko6TJm.cjs +0 -6
- package/dist/search-dialog-D6BNohIJ.js +0 -6
- package/dist/search-dialog-DuYTIefy.cjs +0 -6
- package/dist/utils-BxNAXhZZ.mjs +0 -7
- package/dist/utils-Clzu7jvb.cjs +0 -7
- package/src/client/app/config-context.tsx +0 -51
- package/src/client/app/doc-page.tsx +0 -38
- package/src/client/app/docs-layout.tsx +0 -28
- package/src/client/app/head.tsx +0 -122
- package/src/client/app/helmet-compat.tsx +0 -36
- package/src/client/app/mdx-component.tsx +0 -8
- package/src/client/app/mdx-components-context.tsx +0 -72
- package/src/client/app/routes-context.tsx +0 -34
- package/src/client/app/scroll-handler.tsx +0 -74
- package/src/client/app/theme-context.tsx +0 -103
- package/src/client/app/ui-context.tsx +0 -42
- package/src/client/components/docs-layout-default.tsx +0 -85
- package/src/client/components/icons-dev.tsx +0 -282
- package/src/client/components/mdx/callout.tsx +0 -97
- package/src/client/components/mdx/card.tsx +0 -99
- package/src/client/components/mdx/cards.tsx +0 -27
- package/src/client/components/mdx/code-block.tsx +0 -184
- package/src/client/components/mdx/field.tsx +0 -33
- package/src/client/components/mdx/image.tsx +0 -44
- package/src/client/components/mdx/index.ts +0 -19
- package/src/client/components/mdx/table.tsx +0 -54
- package/src/client/components/mdx/typographics.tsx +0 -120
- package/src/client/components/mdx/use-code-block.ts +0 -34
- package/src/client/components/primitives/breadcrumbs.tsx +0 -54
- package/src/client/components/primitives/button-group.tsx +0 -54
- package/src/client/components/primitives/button.tsx +0 -6
- package/src/client/components/primitives/code-block.tsx +0 -120
- package/src/client/components/primitives/docs-layout.tsx +0 -125
- package/src/client/components/primitives/error-boundary.tsx +0 -107
- package/src/client/components/primitives/heading.tsx +0 -128
- package/src/client/components/primitives/helpers/observer.ts +0 -141
- package/src/client/components/primitives/image.tsx +0 -26
- package/src/client/components/primitives/link.tsx +0 -102
- package/src/client/components/primitives/menu.tsx +0 -137
- package/src/client/components/primitives/navbar.tsx +0 -466
- package/src/client/components/primitives/on-this-page.tsx +0 -430
- package/src/client/components/primitives/page-nav.tsx +0 -51
- package/src/client/components/primitives/popover.tsx +0 -28
- package/src/client/components/primitives/search-dialog.tsx +0 -193
- package/src/client/components/primitives/sidebar.tsx +0 -423
- package/src/client/components/primitives/skeleton.tsx +0 -26
- package/src/client/components/primitives/tabs.tsx +0 -70
- package/src/client/components/primitives/tooltip.tsx +0 -81
- package/src/client/components/primitives/types.ts +0 -11
- package/src/client/components/ui-base/banner.tsx +0 -66
- package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
- package/src/client/components/ui-base/copy-markdown.tsx +0 -107
- package/src/client/components/ui-base/error-boundary.tsx +0 -15
- package/src/client/components/ui-base/github-stars.tsx +0 -29
- package/src/client/components/ui-base/icons.tsx +0 -240
- package/src/client/components/ui-base/index.ts +0 -16
- package/src/client/components/ui-base/last-updated.tsx +0 -27
- package/src/client/components/ui-base/navbar.tsx +0 -266
- package/src/client/components/ui-base/not-found.tsx +0 -26
- package/src/client/components/ui-base/on-this-page.tsx +0 -57
- package/src/client/components/ui-base/page-nav.tsx +0 -50
- package/src/client/components/ui-base/search-dialog.tsx +0 -163
- package/src/client/components/ui-base/search-highlight.tsx +0 -10
- package/src/client/components/ui-base/sidebar.tsx +0 -92
- package/src/client/components/ui-base/tabs.tsx +0 -83
- package/src/client/components/ui-base/theme-toggle.tsx +0 -130
- package/src/client/components/ui-base/version-i18n.tsx +0 -80
- package/src/client/hooks/index.ts +0 -13
- package/src/client/hooks/use-analytics.ts +0 -272
- package/src/client/hooks/use-breadcrumbs.ts +0 -22
- package/src/client/hooks/use-i18n.ts +0 -182
- package/src/client/hooks/use-localized-to.ts +0 -113
- package/src/client/hooks/use-location.ts +0 -5
- package/src/client/hooks/use-navbar.ts +0 -130
- package/src/client/hooks/use-page-nav.ts +0 -46
- package/src/client/hooks/use-routes.ts +0 -108
- package/src/client/hooks/use-search-highlight.ts +0 -185
- package/src/client/hooks/use-search.ts +0 -118
- package/src/client/hooks/use-sidebar.ts +0 -205
- package/src/client/hooks/use-tabs.ts +0 -46
- package/src/client/hooks/use-version.ts +0 -111
- package/src/client/index.ts +0 -31
- package/src/client/mdx.ts +0 -2
- package/src/client/primitives.ts +0 -19
- package/src/client/ssg/boltdocs-shell.tsx +0 -148
- package/src/client/ssg/create-routes.tsx +0 -473
- package/src/client/ssg/index.ts +0 -4
- package/src/client/ssg/mdx-page.tsx +0 -38
- package/src/client/store/boltdocs-context.tsx +0 -137
- package/src/client/theme/neutral.css +0 -141
- package/src/client/theme/reset.css +0 -189
- package/src/client/types.ts +0 -116
- package/src/client/utils/cn.ts +0 -6
- package/src/client/utils/copy-clipboard.ts +0 -22
- package/src/client/utils/get-base-file-path.ts +0 -21
- package/src/client/utils/github.ts +0 -121
- package/src/client/utils/i18n.ts +0 -23
- package/src/client/utils/path.ts +0 -9
- package/src/client/utils/react-to-text.ts +0 -34
- package/src/client/virtual.d.ts +0 -24
- /package/dist/{worker-pool-Bd8Y9KDv.mjs → worker-pool-CGn7DrLb.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-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 };
|