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,523 @@
|
|
|
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
|
+
const require_image = require('./image-DtrI2cw3.cjs');
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
let react_aria_components = require("react-aria-components");
|
|
11
|
+
|
|
12
|
+
//#region src/client/components/mdx/callout.tsx
|
|
13
|
+
const variantStyles = {
|
|
14
|
+
note: {
|
|
15
|
+
container: "bg-slate-500/5 dark:bg-slate-500/10 border-slate-500/40 text-slate-800 dark:text-slate-200",
|
|
16
|
+
titleText: "text-slate-900 dark:text-slate-100",
|
|
17
|
+
iconColor: "text-slate-500",
|
|
18
|
+
icon: require_icons_dev.Info,
|
|
19
|
+
defaultTitle: "Note"
|
|
20
|
+
},
|
|
21
|
+
info: {
|
|
22
|
+
container: "bg-indigo-500/5 dark:bg-indigo-500/10 border-indigo-500/40 text-indigo-800 dark:text-indigo-200",
|
|
23
|
+
titleText: "text-indigo-900 dark:text-indigo-100",
|
|
24
|
+
iconColor: "text-indigo-500",
|
|
25
|
+
icon: require_icons_dev.Info,
|
|
26
|
+
defaultTitle: "Info"
|
|
27
|
+
},
|
|
28
|
+
tip: {
|
|
29
|
+
container: "bg-green-500/5 dark:bg-green-500/10 border-green-500/40 text-green-800 dark:text-green-200",
|
|
30
|
+
titleText: "text-green-900 dark:text-green-100",
|
|
31
|
+
iconColor: "text-green-500",
|
|
32
|
+
icon: require_icons_dev.Lightbulb,
|
|
33
|
+
defaultTitle: "Tip"
|
|
34
|
+
},
|
|
35
|
+
warning: {
|
|
36
|
+
container: "bg-amber-500/5 dark:bg-amber-500/10 border-amber-500/40 text-amber-800 dark:text-amber-200",
|
|
37
|
+
titleText: "text-amber-900 dark:text-amber-100",
|
|
38
|
+
iconColor: "text-amber-500",
|
|
39
|
+
icon: require_icons_dev.AlertTriangle,
|
|
40
|
+
defaultTitle: "Warning"
|
|
41
|
+
},
|
|
42
|
+
danger: {
|
|
43
|
+
container: "bg-rose-500/5 dark:bg-rose-500/10 border-rose-500/40 text-rose-800 dark:text-rose-200",
|
|
44
|
+
titleText: "text-rose-900 dark:text-rose-100",
|
|
45
|
+
iconColor: "text-rose-500",
|
|
46
|
+
icon: require_icons_dev.AlertCircle,
|
|
47
|
+
defaultTitle: "Danger"
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
function Callout({ children, className = "", variant = "note", title, ...props }) {
|
|
51
|
+
const styles = variantStyles[variant] || variantStyles.note;
|
|
52
|
+
const Icon = styles.icon;
|
|
53
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
54
|
+
className: require_icons_dev.cn("my-6 flex gap-4 p-4 rounded-xl border-2", styles.container, className),
|
|
55
|
+
...props,
|
|
56
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
57
|
+
className: require_icons_dev.cn("shrink-0 pt-0.5", styles.iconColor),
|
|
58
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: "w-5 h-5 stroke-[2]" })
|
|
59
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
60
|
+
className: "flex-1 text-[0.875rem] leading-[1.6]",
|
|
61
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
62
|
+
className: require_icons_dev.cn("font-bold text-sm mb-1", styles.titleText),
|
|
63
|
+
children: title || styles.defaultTitle
|
|
64
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
65
|
+
className: "prose prose-neutral dark:prose-invert max-w-none [&>p]:m-0 [&>p+p]:mt-2",
|
|
66
|
+
children
|
|
67
|
+
})]
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/client/components/mdx/field.tsx
|
|
74
|
+
const Field = ({ children, name, type, description, required }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
75
|
+
className: "my-4 border border-subtle bg-surface/50 p-4 rounded-xl flex flex-col gap-1 text-sm select-none",
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
78
|
+
className: "flex items-center gap-2",
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
81
|
+
className: "font-mono font-bold text-primary-500",
|
|
82
|
+
children: name
|
|
83
|
+
}),
|
|
84
|
+
type && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
85
|
+
className: "text-xs text-muted font-mono bg-soft px-1.5 py-0.5 rounded-md",
|
|
86
|
+
children: type
|
|
87
|
+
}),
|
|
88
|
+
required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
89
|
+
className: "text-xs text-rose-500 font-semibold",
|
|
90
|
+
children: "required"
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
}),
|
|
94
|
+
description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
95
|
+
className: "text-muted text-xs mt-1",
|
|
96
|
+
children: description
|
|
97
|
+
}),
|
|
98
|
+
children && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
99
|
+
className: "mt-2",
|
|
100
|
+
children
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/client/components/mdx/typographics.tsx
|
|
107
|
+
const Anchor = ({ href, children, className, ...props }) => {
|
|
108
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Link, {
|
|
109
|
+
href: href || "",
|
|
110
|
+
className: require_icons_dev.cn("text-primary-500 hover:text-primary-400 dark:text-primary-500 hover:underline font-medium transition-colors duration-200", className),
|
|
111
|
+
...props,
|
|
112
|
+
children
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
const HEADING_CLASSES = {
|
|
116
|
+
1: "text-3xl sm:text-[2.5rem] font-extrabold tracking-tight text-body mb-4 leading-tight",
|
|
117
|
+
2: "text-2xl sm:text-[1.75rem] font-bold tracking-tight text-body mt-14 mb-5 pb-2 border-b border-subtle scroll-mt-24",
|
|
118
|
+
3: "text-lg sm:text-[1.4rem] font-semibold tracking-tight text-body mt-10 mb-4 scroll-mt-24",
|
|
119
|
+
4: "text-base sm:text-[1.1rem] font-semibold tracking-tight text-body mt-8 mb-3 scroll-mt-24",
|
|
120
|
+
5: "text-sm sm:text-[0.9rem] font-semibold tracking-tight text-body mt-6 mb-2 scroll-mt-24",
|
|
121
|
+
6: "text-xs sm:text-[0.75rem] font-semibold tracking-tight text-body mt-6 mb-2 scroll-mt-24"
|
|
122
|
+
};
|
|
123
|
+
const Heading = ({ level, className, ...props }) => {
|
|
124
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_image.Heading, {
|
|
125
|
+
level,
|
|
126
|
+
className: require_icons_dev.cn(HEADING_CLASSES[level] || "", className),
|
|
127
|
+
...props
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const Typographics = {
|
|
131
|
+
a: Anchor,
|
|
132
|
+
h1: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
|
|
133
|
+
level: 1,
|
|
134
|
+
...props
|
|
135
|
+
}),
|
|
136
|
+
h2: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
|
|
137
|
+
level: 2,
|
|
138
|
+
...props
|
|
139
|
+
}),
|
|
140
|
+
h3: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
|
|
141
|
+
level: 3,
|
|
142
|
+
...props
|
|
143
|
+
}),
|
|
144
|
+
h4: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
|
|
145
|
+
level: 4,
|
|
146
|
+
...props
|
|
147
|
+
}),
|
|
148
|
+
h5: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
|
|
149
|
+
level: 5,
|
|
150
|
+
...props
|
|
151
|
+
}),
|
|
152
|
+
h6: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
|
|
153
|
+
level: 6,
|
|
154
|
+
...props
|
|
155
|
+
}),
|
|
156
|
+
p: ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
157
|
+
className: require_icons_dev.cn("text-paragraph leading-relaxed my-5", className),
|
|
158
|
+
...props
|
|
159
|
+
}),
|
|
160
|
+
strong: ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
|
|
161
|
+
className: require_icons_dev.cn("font-semibold text-body", className),
|
|
162
|
+
...props
|
|
163
|
+
}),
|
|
164
|
+
mark: ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("mark", {
|
|
165
|
+
className: require_icons_dev.cn("bg-primary-500/10 text-primary-500 font-semibold px-1.5 py-0.5 rounded-md", className),
|
|
166
|
+
...props
|
|
167
|
+
}),
|
|
168
|
+
blockquote: ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("blockquote", {
|
|
169
|
+
className: require_icons_dev.cn("border-l-4 border-primary-500 bg-soft/30 pl-4 py-2 my-6 italic text-muted rounded-r-lg", className),
|
|
170
|
+
...props
|
|
171
|
+
}),
|
|
172
|
+
hr: ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", {
|
|
173
|
+
className: require_icons_dev.cn("my-8 border-t border-subtle", className),
|
|
174
|
+
...props
|
|
175
|
+
}),
|
|
176
|
+
ul: ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
177
|
+
className: require_icons_dev.cn("list-disc pl-6 my-5 space-y-2 text-paragraph", className),
|
|
178
|
+
...props
|
|
179
|
+
}),
|
|
180
|
+
ol: ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
|
|
181
|
+
className: require_icons_dev.cn("list-decimal pl-6 my-5 space-y-2 text-paragraph", className),
|
|
182
|
+
...props
|
|
183
|
+
}),
|
|
184
|
+
li: ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
185
|
+
className: require_icons_dev.cn("pl-1", className),
|
|
186
|
+
...props
|
|
187
|
+
})
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/client/components/mdx/table.tsx
|
|
192
|
+
const Table = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
193
|
+
className: "my-6 w-full overflow-x-auto rounded-xl border border-subtle bg-surface/30",
|
|
194
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
|
|
195
|
+
className: "w-full border-collapse text-left text-sm",
|
|
196
|
+
...props
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
const TableHead = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", {
|
|
200
|
+
className: require_icons_dev.cn("border-b border-subtle bg-soft/50", props.className),
|
|
201
|
+
...props
|
|
202
|
+
});
|
|
203
|
+
const TableBody = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { ...props });
|
|
204
|
+
const TableRow = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
|
|
205
|
+
className: require_icons_dev.cn("border-b border-subtle last:border-0 even:bg-soft/10 hover:bg-soft/20 transition-colors", props.className),
|
|
206
|
+
...props
|
|
207
|
+
});
|
|
208
|
+
const TableHeader = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
209
|
+
className: require_icons_dev.cn("px-4 py-3 font-semibold text-body text-xs font-mono", props.className),
|
|
210
|
+
...props
|
|
211
|
+
});
|
|
212
|
+
const TableCell = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
213
|
+
className: require_icons_dev.cn("px-4 py-3 text-paragraph leading-relaxed", props.className),
|
|
214
|
+
...props
|
|
215
|
+
});
|
|
216
|
+
const TableComponents = {
|
|
217
|
+
table: Table,
|
|
218
|
+
thead: TableHead,
|
|
219
|
+
tbody: TableBody,
|
|
220
|
+
tr: TableRow,
|
|
221
|
+
th: TableHeader,
|
|
222
|
+
td: TableCell
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/client/utils/react-to-text.ts
|
|
227
|
+
const reactToText = (node, resolvers) => {
|
|
228
|
+
if (node == null || typeof node === "boolean") return "";
|
|
229
|
+
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
230
|
+
if (Array.isArray(node)) return node.map((n) => reactToText(n, resolvers)).join("");
|
|
231
|
+
if ((0, react.isValidElement)(node)) {
|
|
232
|
+
const resolver = resolvers?.get(node.type);
|
|
233
|
+
if (resolver) return resolver(node.props);
|
|
234
|
+
return reactToText(node.props.children, resolvers);
|
|
235
|
+
}
|
|
236
|
+
return "";
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/client/utils/copy-clipboard.ts
|
|
241
|
+
/**
|
|
242
|
+
* Copy text to clipboard.
|
|
243
|
+
* @param text - The text to copy.
|
|
244
|
+
* @returns True if the text was copied successfully.
|
|
245
|
+
*/
|
|
246
|
+
const copyToClipboard = async (text) => {
|
|
247
|
+
try {
|
|
248
|
+
await navigator.clipboard.writeText(text);
|
|
249
|
+
return true;
|
|
250
|
+
} catch {
|
|
251
|
+
const textarea = document.createElement("textarea");
|
|
252
|
+
textarea.value = text;
|
|
253
|
+
textarea.style.position = "fixed";
|
|
254
|
+
textarea.style.opacity = "0";
|
|
255
|
+
document.body.appendChild(textarea);
|
|
256
|
+
textarea.select();
|
|
257
|
+
document.execCommand("copy");
|
|
258
|
+
document.body.removeChild(textarea);
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/client/components/mdx/use-code-block.ts
|
|
265
|
+
function useCodeBlock(props) {
|
|
266
|
+
const [copied, setCopied] = (0, react.useState)(false);
|
|
267
|
+
const [isExpanded, setIsExpanded] = (0, react.useState)(false);
|
|
268
|
+
const [isExpandable, setIsExpandable] = (0, react.useState)(false);
|
|
269
|
+
const preRef = (0, react.useRef)(null);
|
|
270
|
+
const handleCopy = (0, react.useCallback)(async () => {
|
|
271
|
+
copyToClipboard(preRef.current?.textContent ?? "");
|
|
272
|
+
setCopied(true);
|
|
273
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
274
|
+
}, []);
|
|
275
|
+
(0, react.useEffect)(() => {
|
|
276
|
+
const lines = (preRef.current?.textContent ?? "").trim().split("\n").length;
|
|
277
|
+
setIsExpandable(lines > 6);
|
|
278
|
+
}, [props.children, props.highlightedHtml]);
|
|
279
|
+
return {
|
|
280
|
+
copied,
|
|
281
|
+
isExpanded,
|
|
282
|
+
setIsExpanded,
|
|
283
|
+
isExpandable,
|
|
284
|
+
preRef,
|
|
285
|
+
handleCopy,
|
|
286
|
+
shouldTruncate: isExpandable && !isExpanded
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/client/components/mdx/code-block.tsx
|
|
292
|
+
const langIconMap = {
|
|
293
|
+
ts: require_icons_dev.TypeScript,
|
|
294
|
+
tsx: require_icons_dev.React,
|
|
295
|
+
js: require_icons_dev.JavaScript,
|
|
296
|
+
jsx: require_icons_dev.React,
|
|
297
|
+
json: require_icons_dev.Json,
|
|
298
|
+
css: require_icons_dev.Css,
|
|
299
|
+
html: require_icons_dev.BracketsOrange,
|
|
300
|
+
md: require_icons_dev.Markdown,
|
|
301
|
+
mdx: require_icons_dev.Markdown,
|
|
302
|
+
bash: require_icons_dev.Shell,
|
|
303
|
+
sh: require_icons_dev.Shell,
|
|
304
|
+
yaml: require_icons_dev.Yaml,
|
|
305
|
+
yml: require_icons_dev.Yaml,
|
|
306
|
+
rs: require_icons_dev.Rust,
|
|
307
|
+
rust: require_icons_dev.Rust,
|
|
308
|
+
toml: require_icons_dev.BracketsRed,
|
|
309
|
+
csv: require_icons_dev.Csv
|
|
310
|
+
};
|
|
311
|
+
const CopyButton = ({ copied, handleCopy }) => {
|
|
312
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_image.Tooltip, {
|
|
313
|
+
content: copied ? "Copied!" : "Copy code",
|
|
314
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
315
|
+
onPress: handleCopy,
|
|
316
|
+
className: require_icons_dev.cn("grid place-items-center size-8 bg-transparent outline-none cursor-pointer transition-all duration-200 hover:scale-110 active:scale-95 [&>svg]:size-4 [&>svg]:stroke-2 z-10", copied ? "text-emerald-400" : "text-muted hover:text-body"),
|
|
317
|
+
"aria-label": "Copy code",
|
|
318
|
+
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Check, { size: 20 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Copy, { size: 20 })
|
|
319
|
+
})
|
|
320
|
+
});
|
|
321
|
+
};
|
|
322
|
+
function CodeBlock(props) {
|
|
323
|
+
const { children, hideCopy = false, highlightedHtml, "data-highlighted-html": dataHighlightedHtml, title, "data-title": dataTitle, "data-lang": dataLang, plain = false, ...rest } = props;
|
|
324
|
+
const rawHighlightedHtml = highlightedHtml || dataHighlightedHtml;
|
|
325
|
+
const effectiveHighlightedHtml = typeof rawHighlightedHtml === "string" ? rawHighlightedHtml.replace(/<span class="line">\s*(?:<span[^>]*>\s*<\/span>)?\s*<\/span>\s*(<\/code>\s*<\/pre>)/g, "$1") : rawHighlightedHtml;
|
|
326
|
+
const effectiveTitle = title || dataTitle;
|
|
327
|
+
const lang = props.lang || dataLang || "";
|
|
328
|
+
const { copied, isExpanded, setIsExpanded, isExpandable, preRef, handleCopy, shouldTruncate } = useCodeBlock(props);
|
|
329
|
+
const LangIcon = langIconMap[lang];
|
|
330
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_image.CodeBlock, {
|
|
331
|
+
plain,
|
|
332
|
+
className: props.className,
|
|
333
|
+
children: [(effectiveTitle || !hideCopy) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_image.CodeBlockHeader, {
|
|
334
|
+
className: require_icons_dev.cn({ "absolute top-2 left-0 w-full": !effectiveTitle }),
|
|
335
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_image.CodeBlockGroup, { children: effectiveTitle && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [LangIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LangIcon, { size: 14 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.File, {
|
|
336
|
+
size: 14,
|
|
337
|
+
className: "opacity-60"
|
|
338
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: effectiveTitle })] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
339
|
+
className: "flex items-center gap-1",
|
|
340
|
+
children: !hideCopy && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyButton, {
|
|
341
|
+
copied,
|
|
342
|
+
handleCopy
|
|
343
|
+
})
|
|
344
|
+
})]
|
|
345
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_image.CodeBlockContent, {
|
|
346
|
+
shouldTruncate,
|
|
347
|
+
children: [effectiveHighlightedHtml ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
348
|
+
ref: preRef,
|
|
349
|
+
className: "shiki-wrapper overflow-x-auto [&>pre]:m-0! [&>pre]:rounded-none! [&>pre]:border-none! [&>pre]:bg-inherit! [&>pre>code]:grid! [&>pre>code]:p-5! [&>pre>code]:text-[0.875rem]! [&>pre>code]:leading-[1.6]! [&>.shiki.shiki-themes]:bg-transparent!",
|
|
350
|
+
dangerouslySetInnerHTML: { __html: effectiveHighlightedHtml }
|
|
351
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
352
|
+
ref: preRef,
|
|
353
|
+
className: "m-0! p-5! rounded-none! border-none! bg-inherit! font-mono text-[0.875rem] leading-[1.6] overflow-x-auto",
|
|
354
|
+
...rest,
|
|
355
|
+
children: reactToText(children).trimEnd()
|
|
356
|
+
}), isExpandable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
357
|
+
className: require_icons_dev.cn(shouldTruncate ? "absolute bottom-0 inset-x-0 h-24 bg-linear-to-t from-(--color-code-bg) to-transparent flex items-end justify-center pb-4 z-10" : "relative flex justify-center pb-4 pt-1 -mt-4"),
|
|
358
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
359
|
+
onPress: () => setIsExpanded(!isExpanded),
|
|
360
|
+
className: "rounded-full bg-surface border border-subtle px-5 py-2 text-[0.8125rem] font-medium text-body outline-none cursor-pointer transition-all hover:bg-soft hover:-translate-y-px backdrop-blur-md",
|
|
361
|
+
children: isExpanded ? "Show less" : "Expand code"
|
|
362
|
+
})
|
|
363
|
+
})]
|
|
364
|
+
})]
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region src/client/components/mdx/image.tsx
|
|
370
|
+
const Image = ({ src, alt, title, theme, className, ...props }) => {
|
|
371
|
+
const { theme: themeContext } = require_image.useTheme();
|
|
372
|
+
if (!src) return null;
|
|
373
|
+
if (theme !== themeContext) return null;
|
|
374
|
+
const caption = title || alt;
|
|
375
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("figure", {
|
|
376
|
+
className: "my-6 sm:my-8 flex flex-col items-center justify-center group not-prose",
|
|
377
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
378
|
+
className: "relative w-full overflow-hidden rounded-lg sm:rounded-2xl border border-subtle bg-soft/30 transition-all duration-300 sm:max-w-[85%] lg:max-w-full",
|
|
379
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_image.Image, {
|
|
380
|
+
src,
|
|
381
|
+
alt: alt || "",
|
|
382
|
+
theme,
|
|
383
|
+
loading: "lazy",
|
|
384
|
+
decoding: "async",
|
|
385
|
+
className: require_icons_dev.cn("w-full h-auto object-contain transition-transform duration-500 group-hover:scale-[1.01] my-0 rounded-md sm:rounded-xl block", className),
|
|
386
|
+
...props
|
|
387
|
+
})
|
|
388
|
+
}), caption && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("figcaption", {
|
|
389
|
+
className: "mt-2 sm:mt-3 text-center text-xs sm:text-sm text-muted font-medium select-none tracking-wide opacity-90 sm:opacity-80 group-hover:opacity-100 transition-opacity duration-300 px-2",
|
|
390
|
+
children: caption
|
|
391
|
+
})]
|
|
392
|
+
});
|
|
393
|
+
};
|
|
394
|
+
const ImageComponents = {
|
|
395
|
+
img: Image,
|
|
396
|
+
Image
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
//#endregion
|
|
400
|
+
//#region src/client/components/mdx/card.tsx
|
|
401
|
+
function Card({ className, title, icon, href, children, ...props }) {
|
|
402
|
+
const [position, setPosition] = (0, react.useState)({
|
|
403
|
+
x: 0,
|
|
404
|
+
y: 0
|
|
405
|
+
});
|
|
406
|
+
const [opacity, setOpacity] = (0, react.useState)(0);
|
|
407
|
+
const cardRef = (0, react.useRef)(null);
|
|
408
|
+
const handleMouseMove = (e) => {
|
|
409
|
+
if (!cardRef.current) return;
|
|
410
|
+
const rect = cardRef.current.getBoundingClientRect();
|
|
411
|
+
setPosition({
|
|
412
|
+
x: e.clientX - rect.left,
|
|
413
|
+
y: e.clientY - rect.top
|
|
414
|
+
});
|
|
415
|
+
};
|
|
416
|
+
const handleMouseEnter = () => setOpacity(1);
|
|
417
|
+
const handleMouseLeave = () => setOpacity(0);
|
|
418
|
+
const Wrapper = href ? "a" : "div";
|
|
419
|
+
const spotlightColor = "var(--color-primary-500, #eb5828)";
|
|
420
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Wrapper, {
|
|
421
|
+
ref: cardRef,
|
|
422
|
+
href,
|
|
423
|
+
onMouseMove: handleMouseMove,
|
|
424
|
+
onMouseEnter: handleMouseEnter,
|
|
425
|
+
onMouseLeave: handleMouseLeave,
|
|
426
|
+
className: require_icons_dev.cn("group relative flex flex-col gap-3 rounded-2xl border p-6 overflow-hidden transition-all duration-300", "hover:shadow-lg dark:hover:shadow-none hover:-translate-y-0.5", "bg-surface border-subtle text-paragraph", href && "cursor-pointer", className),
|
|
427
|
+
...props,
|
|
428
|
+
children: [
|
|
429
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
430
|
+
className: "pointer-events-none absolute inset-0 transition-opacity duration-300",
|
|
431
|
+
style: {
|
|
432
|
+
opacity,
|
|
433
|
+
background: `radial-gradient(600px circle at ${position.x}px ${position.y}px, color-mix(in srgb, ${spotlightColor} 8%, transparent), transparent 40%)`
|
|
434
|
+
}
|
|
435
|
+
}),
|
|
436
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
437
|
+
className: "pointer-events-none absolute inset-0 rounded-2xl transition-opacity duration-300",
|
|
438
|
+
style: {
|
|
439
|
+
opacity,
|
|
440
|
+
padding: "1px",
|
|
441
|
+
background: `radial-gradient(400px circle at ${position.x}px ${position.y}px, color-mix(in srgb, ${spotlightColor} 50%, transparent), transparent 40%)`,
|
|
442
|
+
WebkitMask: "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",
|
|
443
|
+
WebkitMaskComposite: "xor",
|
|
444
|
+
maskComposite: "exclude"
|
|
445
|
+
}
|
|
446
|
+
}),
|
|
447
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
448
|
+
className: "relative z-10 flex items-center gap-3",
|
|
449
|
+
children: [icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
450
|
+
className: require_icons_dev.cn("shrink-0 transition-transform duration-500 group-hover:rotate-[15deg] group-hover:scale-110 flex items-center justify-center text-muted group-hover:text-primary-500", "[&>svg]:w-6 [&>svg]:h-6 [&>svg]:stroke-[1.5]"),
|
|
451
|
+
children: icon
|
|
452
|
+
}), title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
453
|
+
className: "font-semibold text-base m-0 leading-none text-body",
|
|
454
|
+
children: title
|
|
455
|
+
})]
|
|
456
|
+
}),
|
|
457
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
458
|
+
className: "relative z-10 text-[0.875rem] leading-[1.6] opacity-90 prose prose-neutral dark:prose-invert max-w-none [&>p]:m-0 [&>p+p]:mt-2",
|
|
459
|
+
children
|
|
460
|
+
})
|
|
461
|
+
]
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
//#endregion
|
|
466
|
+
//#region src/client/components/mdx/cards.tsx
|
|
467
|
+
function Cards({ children, className, cols = 2, ...props }) {
|
|
468
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
469
|
+
className: require_icons_dev.cn("grid gap-4 my-6", {
|
|
470
|
+
"grid-cols-1": cols === 1,
|
|
471
|
+
"grid-cols-1 sm:grid-cols-2": cols === 2,
|
|
472
|
+
"grid-cols-1 sm:grid-cols-2 md:grid-cols-3": cols === 3,
|
|
473
|
+
"grid-cols-1 sm:grid-cols-2 lg:grid-cols-4": cols === 4
|
|
474
|
+
}, className),
|
|
475
|
+
...props,
|
|
476
|
+
children
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region src/client/components/mdx/index.ts
|
|
482
|
+
const mdx_components_default = {
|
|
483
|
+
...Typographics,
|
|
484
|
+
...TableComponents,
|
|
485
|
+
...ImageComponents,
|
|
486
|
+
pre: CodeBlock,
|
|
487
|
+
Field,
|
|
488
|
+
Callout,
|
|
489
|
+
Card,
|
|
490
|
+
Cards
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
//#endregion
|
|
494
|
+
Object.defineProperty(exports, 'Card', {
|
|
495
|
+
enumerable: true,
|
|
496
|
+
get: function () {
|
|
497
|
+
return Card;
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
Object.defineProperty(exports, 'Cards', {
|
|
501
|
+
enumerable: true,
|
|
502
|
+
get: function () {
|
|
503
|
+
return Cards;
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
Object.defineProperty(exports, 'copyToClipboard', {
|
|
507
|
+
enumerable: true,
|
|
508
|
+
get: function () {
|
|
509
|
+
return copyToClipboard;
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
Object.defineProperty(exports, 'mdx_components_default', {
|
|
513
|
+
enumerable: true,
|
|
514
|
+
get: function () {
|
|
515
|
+
return mdx_components_default;
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
Object.defineProperty(exports, 'reactToText', {
|
|
519
|
+
enumerable: true,
|
|
520
|
+
get: function () {
|
|
521
|
+
return reactToText;
|
|
522
|
+
}
|
|
523
|
+
});
|