docstra 1.6.2 → 1.6.3
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/client/index.js +134 -142
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +98 -106
- package/dist/client/index.mjs.map +1 -1
- package/dist/server/index.js +15 -24
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +16 -25
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -59,20 +59,9 @@ function cn(...inputs) {
|
|
|
59
59
|
// src/client/search-box.tsx
|
|
60
60
|
var import_react = require("react");
|
|
61
61
|
var import_fuse = __toESM(require("fuse.js"));
|
|
62
|
-
|
|
63
|
-
// src/client/link.tsx
|
|
64
62
|
var import_link = __toESM(require("next/link"));
|
|
65
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
66
|
-
function Link({ href, children, className, onNavigate, ...props }) {
|
|
67
|
-
if (href.startsWith("http")) {
|
|
68
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href, className, ...props, target: "_blank", rel: "noopener noreferrer", children });
|
|
69
|
-
}
|
|
70
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href, className, onNavigate, ...props, children });
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// src/client/search-box.tsx
|
|
74
63
|
var import_navigation = require("next/navigation");
|
|
75
|
-
var
|
|
64
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
76
65
|
function DocstraSearchBox() {
|
|
77
66
|
const { openSearchBox, setOpenSearchBox, docs } = useDocstra();
|
|
78
67
|
const [searchQuery, setSearchQuery] = (0, import_react.useState)("");
|
|
@@ -127,7 +116,7 @@ function DocstraSearchBox() {
|
|
|
127
116
|
window.removeEventListener("keydown", handleEscape);
|
|
128
117
|
};
|
|
129
118
|
}, [openSearchBox]);
|
|
130
|
-
return /* @__PURE__ */ (0,
|
|
119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
131
120
|
"div",
|
|
132
121
|
{
|
|
133
122
|
onClick: () => {
|
|
@@ -138,13 +127,13 @@ function DocstraSearchBox() {
|
|
|
138
127
|
"fixed inset-0 z-25 flex items-start justify-center bg-white/40 backdrop-blur-md opacity-0 pointer-events-none transition-all duration-300",
|
|
139
128
|
openSearchBox && "opacity-100 pointer-events-auto"
|
|
140
129
|
),
|
|
141
|
-
children: /* @__PURE__ */ (0,
|
|
130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
142
131
|
"div",
|
|
143
132
|
{
|
|
144
133
|
onClick: (e) => e.stopPropagation(),
|
|
145
134
|
className: "flex flex-col items-center mt-30 max-w-lg w-full max-md:px-4",
|
|
146
135
|
children: [
|
|
147
|
-
/* @__PURE__ */ (0,
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
148
137
|
"form",
|
|
149
138
|
{
|
|
150
139
|
onSubmit: onSearchHandler,
|
|
@@ -152,14 +141,14 @@ function DocstraSearchBox() {
|
|
|
152
141
|
"relative flex items-center justify-between w-full bg-white border border-slate-200 text-gray-400 h-15 p-0.5 rounded-md",
|
|
153
142
|
searchQuery && "rounded-b-none border-b-0"
|
|
154
143
|
),
|
|
155
|
-
children: openSearchBox && /* @__PURE__ */ (0,
|
|
156
|
-
/* @__PURE__ */ (0,
|
|
157
|
-
/* @__PURE__ */ (0,
|
|
158
|
-
/* @__PURE__ */ (0,
|
|
144
|
+
children: openSearchBox && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
145
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.SearchIcon, { className: "size-5.5 mx-3 shrink-0" }),
|
|
146
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { className: "w-full bg-transparent h-full outline-none text-gray-400 placeholder:text-gray-400", type: "text", placeholder: "Search docs...", spellCheck: "false", autoFocus: true, value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), name: "searchQuery", required: true }),
|
|
147
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "border border-gray-200 px-2 mr-3 py-1 rounded text-xs", children: "Esc" })
|
|
159
148
|
] })
|
|
160
149
|
}
|
|
161
150
|
),
|
|
162
|
-
/* @__PURE__ */ (0,
|
|
151
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
163
152
|
"div",
|
|
164
153
|
{
|
|
165
154
|
className: cn(
|
|
@@ -167,8 +156,8 @@ function DocstraSearchBox() {
|
|
|
167
156
|
searchQuery && "rounded-b-md border border-slate-200"
|
|
168
157
|
),
|
|
169
158
|
children: [
|
|
170
|
-
searchResults.map((item) => /* @__PURE__ */ (0,
|
|
171
|
-
|
|
159
|
+
searchResults.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
160
|
+
import_link.default,
|
|
172
161
|
{
|
|
173
162
|
href: `/docs/${item.info.slug.replace("index", "")}`,
|
|
174
163
|
onNavigate: () => {
|
|
@@ -177,13 +166,13 @@ function DocstraSearchBox() {
|
|
|
177
166
|
},
|
|
178
167
|
className: "w-full hover:bg-gray-100/70 border-b border-slate-200 transition-all py-4 px-4 last:mb-2",
|
|
179
168
|
children: [
|
|
180
|
-
/* @__PURE__ */ (0,
|
|
181
|
-
/* @__PURE__ */ (0,
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { className: "font-medium", children: item.frontmatter.title }),
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm mt-1 text-gray-500", children: item.frontmatter.description })
|
|
182
171
|
]
|
|
183
172
|
},
|
|
184
173
|
item.info.slug
|
|
185
174
|
)),
|
|
186
|
-
searchQuery && searchResults.length === 0 && /* @__PURE__ */ (0,
|
|
175
|
+
searchQuery && searchResults.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-gray-500 text-center py-20", children: "No results found" })
|
|
187
176
|
]
|
|
188
177
|
}
|
|
189
178
|
)
|
|
@@ -195,7 +184,7 @@ function DocstraSearchBox() {
|
|
|
195
184
|
}
|
|
196
185
|
|
|
197
186
|
// src/context/docstra-context.tsx
|
|
198
|
-
var
|
|
187
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
199
188
|
var DocstraContext = (0, import_react2.createContext)(null);
|
|
200
189
|
function DocstraProvider({
|
|
201
190
|
children,
|
|
@@ -205,7 +194,7 @@ function DocstraProvider({
|
|
|
205
194
|
}) {
|
|
206
195
|
const [openSidebar, setOpenSidebar] = (0, import_react2.useState)(false);
|
|
207
196
|
const [openSearchBox, setOpenSearchBox] = (0, import_react2.useState)(false);
|
|
208
|
-
return /* @__PURE__ */ (0,
|
|
197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
209
198
|
DocstraContext.Provider,
|
|
210
199
|
{
|
|
211
200
|
value: {
|
|
@@ -218,8 +207,8 @@ function DocstraProvider({
|
|
|
218
207
|
docs
|
|
219
208
|
},
|
|
220
209
|
children: [
|
|
221
|
-
/* @__PURE__ */ (0,
|
|
222
|
-
/* @__PURE__ */ (0,
|
|
210
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_toast_msg.ToastContainer, {}),
|
|
211
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DocstraSearchBox, {}),
|
|
223
212
|
children
|
|
224
213
|
]
|
|
225
214
|
}
|
|
@@ -234,7 +223,8 @@ function useDocstra() {
|
|
|
234
223
|
// src/client/header.tsx
|
|
235
224
|
var import_lucide_react2 = require("lucide-react");
|
|
236
225
|
var import_react3 = require("react");
|
|
237
|
-
var
|
|
226
|
+
var import_link2 = __toESM(require("next/link"));
|
|
227
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
238
228
|
function DocstraHeader() {
|
|
239
229
|
const { openSidebar, setOpenSidebar, docstraConfig } = useDocstra();
|
|
240
230
|
(0, import_react3.useEffect)(() => {
|
|
@@ -244,8 +234,8 @@ function DocstraHeader() {
|
|
|
244
234
|
document.body.classList.remove("max-md:overflow-hidden");
|
|
245
235
|
}
|
|
246
236
|
}, [openSidebar]);
|
|
247
|
-
return /* @__PURE__ */ (0,
|
|
248
|
-
/* @__PURE__ */ (0,
|
|
237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("header", { className: "sticky top-0 z-10 text-sm flex items-center justify-between border-b border-gray-100 h-18 px-4 md:px-6 bg-white", children: [
|
|
238
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_link2.default, { href: docstraConfig.navbar?.logo?.link || "/", className: "hover:opacity-80 transition", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
249
239
|
"img",
|
|
250
240
|
{
|
|
251
241
|
src: docstraConfig.navbar?.logo?.src || "/logo.png",
|
|
@@ -253,16 +243,16 @@ function DocstraHeader() {
|
|
|
253
243
|
className: cn("h-9.5 w-auto", docstraConfig.navbar?.logo?.className)
|
|
254
244
|
}
|
|
255
245
|
) }),
|
|
256
|
-
/* @__PURE__ */ (0,
|
|
257
|
-
docstraConfig.navbar?.links?.map((link) => /* @__PURE__ */ (0,
|
|
258
|
-
/* @__PURE__ */ (0,
|
|
246
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "hidden divide-x divide-gray-200 md:flex items-center", children: [
|
|
247
|
+
docstraConfig.navbar?.links?.map((link) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_link2.default, { href: link.href, className: "px-6 hover:text-gray-500", children: link.name }, link.name)),
|
|
248
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_link2.default, { href: docstraConfig?.githubRepo || "https://github.com/sudhucodes/docstra", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { className: "size-6 mx-6", width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3" }) }) })
|
|
259
249
|
] }),
|
|
260
|
-
/* @__PURE__ */ (0,
|
|
250
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
261
251
|
"button",
|
|
262
252
|
{
|
|
263
253
|
onClick: () => setOpenSidebar(!openSidebar),
|
|
264
254
|
className: "md:hidden transition text-gray-600 active:ring-2 ring-gray-200 p-1.5 rounded-md",
|
|
265
|
-
children: openSidebar ? /* @__PURE__ */ (0,
|
|
255
|
+
children: openSidebar ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.XIcon, { className: "size-6.5" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.TextAlignEnd, { className: "size-6.5" })
|
|
266
256
|
}
|
|
267
257
|
)
|
|
268
258
|
] });
|
|
@@ -280,12 +270,13 @@ function getIcon(name) {
|
|
|
280
270
|
}
|
|
281
271
|
|
|
282
272
|
// src/client/sidebar.tsx
|
|
283
|
-
var
|
|
273
|
+
var import_link3 = __toESM(require("next/link"));
|
|
274
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
284
275
|
function DocstraSidebar() {
|
|
285
276
|
const { openSidebar, setOpenSidebar, docstraConfig, setOpenSearchBox } = useDocstra();
|
|
286
277
|
const pathname = (0, import_navigation2.usePathname)();
|
|
287
|
-
return /* @__PURE__ */ (0,
|
|
288
|
-
/* @__PURE__ */ (0,
|
|
278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
289
280
|
"div",
|
|
290
281
|
{
|
|
291
282
|
className: cn(
|
|
@@ -295,7 +286,7 @@ function DocstraSidebar() {
|
|
|
295
286
|
onClick: () => setOpenSidebar(false)
|
|
296
287
|
}
|
|
297
288
|
),
|
|
298
|
-
/* @__PURE__ */ (0,
|
|
289
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
299
290
|
"aside",
|
|
300
291
|
{
|
|
301
292
|
className: cn(
|
|
@@ -303,7 +294,7 @@ function DocstraSidebar() {
|
|
|
303
294
|
openSidebar ? "top-32" : "top-full"
|
|
304
295
|
),
|
|
305
296
|
children: [
|
|
306
|
-
/* @__PURE__ */ (0,
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
307
298
|
"div",
|
|
308
299
|
{
|
|
309
300
|
className: "flex items-center select-none gap-2 cursor-pointer mt-6 mb-4 p-2.5 text-gray-500 border border-gray-200 rounded-lg hover:bg-gray-50",
|
|
@@ -312,21 +303,21 @@ function DocstraSidebar() {
|
|
|
312
303
|
setOpenSearchBox(true);
|
|
313
304
|
},
|
|
314
305
|
children: [
|
|
315
|
-
/* @__PURE__ */ (0,
|
|
316
|
-
/* @__PURE__ */ (0,
|
|
317
|
-
/* @__PURE__ */ (0,
|
|
318
|
-
/* @__PURE__ */ (0,
|
|
319
|
-
/* @__PURE__ */ (0,
|
|
306
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react3.SearchIcon, { className: "size-4.5" }),
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: "Search" }),
|
|
308
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "ms-auto font-mono inline-flex gap-0.5", children: [
|
|
309
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "rounded-md border border-gray-200 px-1.5", children: "Ctrl" }),
|
|
310
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "rounded-md border border-gray-200 px-1.5", children: "K" })
|
|
320
311
|
] })
|
|
321
312
|
]
|
|
322
313
|
}
|
|
323
314
|
),
|
|
324
|
-
docstraConfig.sidebar?.links?.map((group) => /* @__PURE__ */ (0,
|
|
325
|
-
/* @__PURE__ */ (0,
|
|
326
|
-
/* @__PURE__ */ (0,
|
|
315
|
+
docstraConfig.sidebar?.links?.map((group) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
316
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "inline-flex items-center gap-2 mb-2 mt-2 px-2", children: group.section }),
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: "mb-4", children: group.items.map((link) => {
|
|
327
318
|
const Icon = getIcon(link.icon);
|
|
328
|
-
return /* @__PURE__ */ (0,
|
|
329
|
-
|
|
319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
320
|
+
import_link3.default,
|
|
330
321
|
{
|
|
331
322
|
href: link.href,
|
|
332
323
|
onNavigate: () => openSidebar && setOpenSidebar(false),
|
|
@@ -335,8 +326,8 @@ function DocstraSidebar() {
|
|
|
335
326
|
pathname === link.href && "bg-gray-100 text-gray-800"
|
|
336
327
|
),
|
|
337
328
|
children: [
|
|
338
|
-
Icon && /* @__PURE__ */ (0,
|
|
339
|
-
/* @__PURE__ */ (0,
|
|
329
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { className: "size-4" }),
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: link.name })
|
|
340
331
|
]
|
|
341
332
|
}
|
|
342
333
|
) }, link.href);
|
|
@@ -349,15 +340,16 @@ function DocstraSidebar() {
|
|
|
349
340
|
}
|
|
350
341
|
|
|
351
342
|
// src/client/docs-page.tsx
|
|
352
|
-
var
|
|
343
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
353
344
|
function DocstraPage({ children }) {
|
|
354
|
-
return /* @__PURE__ */ (0,
|
|
345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "min-h-screen flex bg-white w-full", children });
|
|
355
346
|
}
|
|
356
347
|
|
|
357
348
|
// src/client/breadcrumbs.tsx
|
|
358
349
|
var import_navigation3 = require("next/navigation");
|
|
359
350
|
var import_lucide_react4 = require("lucide-react");
|
|
360
|
-
var
|
|
351
|
+
var import_link4 = __toESM(require("next/link"));
|
|
352
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
361
353
|
function DocstraBreadcrumbs() {
|
|
362
354
|
const pathname = (0, import_navigation3.usePathname)();
|
|
363
355
|
const paths = pathname.split("/").filter(Boolean);
|
|
@@ -366,13 +358,13 @@ function DocstraBreadcrumbs() {
|
|
|
366
358
|
const title = segment.replace(/-/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
367
359
|
return { href, title };
|
|
368
360
|
});
|
|
369
|
-
return /* @__PURE__ */ (0,
|
|
370
|
-
/* @__PURE__ */ (0,
|
|
361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("nav", { "aria-label": "Breadcrumb", className: "flex text-sm items-center pb-4 text-gray-500", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("ol", { className: "flex items-center space-x-2", children: [
|
|
362
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_link4.default, { href: "/", className: "hover:text-gray-700 transition-colors font-medium", children: "Home" }) }),
|
|
371
363
|
breadcrumbs.map((crumb, index) => {
|
|
372
364
|
const isLast = index === breadcrumbs.length - 1;
|
|
373
|
-
return /* @__PURE__ */ (0,
|
|
374
|
-
/* @__PURE__ */ (0,
|
|
375
|
-
isLast ? /* @__PURE__ */ (0,
|
|
365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: "flex items-center space-x-2", children: [
|
|
366
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.ChevronRight, { className: "w-4 h-4 text-gray-400" }),
|
|
367
|
+
isLast ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-gray-600 font-medium", children: crumb.title }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_link4.default, { href: crumb.href, className: "hover:text-gray-700 font-medium transition-colors", children: crumb.title })
|
|
376
368
|
] }, crumb.href);
|
|
377
369
|
})
|
|
378
370
|
] }) });
|
|
@@ -381,7 +373,7 @@ function DocstraBreadcrumbs() {
|
|
|
381
373
|
// src/client/page-buttons.tsx
|
|
382
374
|
var import_lucide_react5 = require("lucide-react");
|
|
383
375
|
var import_react4 = require("react");
|
|
384
|
-
var
|
|
376
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
385
377
|
function DocstraPageButtons() {
|
|
386
378
|
const { pageData } = useDocstra();
|
|
387
379
|
const [isCopied, setIsCopied] = (0, import_react4.useState)(false);
|
|
@@ -395,20 +387,20 @@ function DocstraPageButtons() {
|
|
|
395
387
|
setIsCopied(true);
|
|
396
388
|
setTimeout(() => setIsCopied(false), 3e3);
|
|
397
389
|
};
|
|
398
|
-
return /* @__PURE__ */ (0,
|
|
399
|
-
/* @__PURE__ */ (0,
|
|
390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-3 mt-6", children: [
|
|
391
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
400
392
|
"button",
|
|
401
393
|
{
|
|
402
394
|
title: "Copy Markdown",
|
|
403
395
|
onClick: handleCopy,
|
|
404
396
|
className: "flex items-center cursor-pointer gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",
|
|
405
397
|
children: [
|
|
406
|
-
isCopied ? /* @__PURE__ */ (0,
|
|
398
|
+
isCopied ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.CheckIcon, { className: "size-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.CopyIcon, { className: "size-3.5" }),
|
|
407
399
|
"Copy Markdown"
|
|
408
400
|
]
|
|
409
401
|
}
|
|
410
402
|
),
|
|
411
|
-
/* @__PURE__ */ (0,
|
|
403
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
412
404
|
"a",
|
|
413
405
|
{
|
|
414
406
|
title: "Ask ChatGPT",
|
|
@@ -422,16 +414,16 @@ function DocstraPageButtons() {
|
|
|
422
414
|
}
|
|
423
415
|
|
|
424
416
|
// src/client/docstra-page-head.tsx
|
|
425
|
-
var
|
|
417
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
426
418
|
function DocstraPageHead() {
|
|
427
419
|
const { pageData } = useDocstra();
|
|
428
420
|
const title = pageData?.frontmatter?.title;
|
|
429
421
|
const description = pageData?.frontmatter?.description;
|
|
430
|
-
return /* @__PURE__ */ (0,
|
|
431
|
-
/* @__PURE__ */ (0,
|
|
432
|
-
/* @__PURE__ */ (0,
|
|
433
|
-
/* @__PURE__ */ (0,
|
|
434
|
-
/* @__PURE__ */ (0,
|
|
422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
423
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h1", { className: "text-3xl font-bold", children: title }),
|
|
424
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "my-4 text-gray-500", children: description }),
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DocstraPageButtons, {}),
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("hr", { className: "my-10 border-gray-200" })
|
|
435
427
|
] });
|
|
436
428
|
}
|
|
437
429
|
|
|
@@ -440,7 +432,7 @@ var import_react5 = require("react");
|
|
|
440
432
|
var import_lucide_react7 = require("lucide-react");
|
|
441
433
|
|
|
442
434
|
// src/client/input.tsx
|
|
443
|
-
var
|
|
435
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
444
436
|
function Input({
|
|
445
437
|
label,
|
|
446
438
|
type,
|
|
@@ -453,12 +445,12 @@ function Input({
|
|
|
453
445
|
className = "",
|
|
454
446
|
optional = false
|
|
455
447
|
}) {
|
|
456
|
-
return /* @__PURE__ */ (0,
|
|
457
|
-
label && /* @__PURE__ */ (0,
|
|
448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cn("flex flex-col mt-4 w-full", className), children: [
|
|
449
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { htmlFor: id, className: "font-medium w-max cursor-pointer", children: [
|
|
458
450
|
label,
|
|
459
|
-
optional && /* @__PURE__ */ (0,
|
|
451
|
+
optional && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs font-normal text-gray-400 ml-1 mt-1", children: "(Optional)" })
|
|
460
452
|
] }),
|
|
461
|
-
type === "textarea" ? /* @__PURE__ */ (0,
|
|
453
|
+
type === "textarea" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
462
454
|
"textarea",
|
|
463
455
|
{
|
|
464
456
|
id,
|
|
@@ -474,7 +466,7 @@ function Input({
|
|
|
474
466
|
value,
|
|
475
467
|
readOnly
|
|
476
468
|
}
|
|
477
|
-
) : /* @__PURE__ */ (0,
|
|
469
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
478
470
|
"input",
|
|
479
471
|
{
|
|
480
472
|
type,
|
|
@@ -493,9 +485,9 @@ function Input({
|
|
|
493
485
|
|
|
494
486
|
// src/client/button.tsx
|
|
495
487
|
var import_lucide_react6 = require("lucide-react");
|
|
496
|
-
var
|
|
488
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
497
489
|
function Button({ label, loading, type = "submit", className = "", disabled = false, onClick }) {
|
|
498
|
-
return /* @__PURE__ */ (0,
|
|
490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
499
491
|
"button",
|
|
500
492
|
{
|
|
501
493
|
type,
|
|
@@ -506,21 +498,21 @@ function Button({ label, loading, type = "submit", className = "", disabled = fa
|
|
|
506
498
|
),
|
|
507
499
|
"aria-label": label,
|
|
508
500
|
onClick,
|
|
509
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
501
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.Loader2Icon, { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 animate-spin mx-auto" }) : label
|
|
510
502
|
}
|
|
511
503
|
);
|
|
512
504
|
}
|
|
513
505
|
|
|
514
506
|
// src/client/feedback.tsx
|
|
515
|
-
var
|
|
507
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
516
508
|
function DocstraFeedback() {
|
|
517
509
|
const [opinion, setOpinion] = (0, import_react5.useState)(null);
|
|
518
510
|
const { docstraConfig } = useDocstra();
|
|
519
511
|
const [message, setMessage] = (0, import_react5.useState)("");
|
|
520
512
|
const [submitted, setSubmitted] = (0, import_react5.useState)(false);
|
|
521
|
-
return /* @__PURE__ */ (0,
|
|
522
|
-
/* @__PURE__ */ (0,
|
|
523
|
-
/* @__PURE__ */ (0,
|
|
513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "border-y border-gray-200 mt-20 py-10 space-y-4", children: submitted ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
514
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "font-medium text-gray-900", children: "Thank you for your feedback!" }),
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
524
516
|
Button,
|
|
525
517
|
{
|
|
526
518
|
onClick: () => {
|
|
@@ -532,27 +524,27 @@ function DocstraFeedback() {
|
|
|
532
524
|
className: "w-max text-sm"
|
|
533
525
|
}
|
|
534
526
|
)
|
|
535
|
-
] }) : /* @__PURE__ */ (0,
|
|
536
|
-
/* @__PURE__ */ (0,
|
|
537
|
-
/* @__PURE__ */ (0,
|
|
538
|
-
/* @__PURE__ */ (0,
|
|
527
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "font-medium", children: "How is this guide?" }),
|
|
529
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-2", children: [
|
|
530
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
539
531
|
"button",
|
|
540
532
|
{
|
|
541
533
|
onClick: () => setOpinion("good"),
|
|
542
534
|
className: `flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm ${opinion === "good" ? "bg-green-100 text-green-600 border-green-300" : "border-gray-200 text-gray-600 hover:bg-gray-100"}`,
|
|
543
535
|
children: [
|
|
544
|
-
/* @__PURE__ */ (0,
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.ThumbsUp, { className: `size-4 ${opinion === "good" ? "fill-green-600" : "text-gray-500"}` }),
|
|
545
537
|
"Good"
|
|
546
538
|
]
|
|
547
539
|
}
|
|
548
540
|
),
|
|
549
|
-
/* @__PURE__ */ (0,
|
|
541
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
550
542
|
"button",
|
|
551
543
|
{
|
|
552
544
|
onClick: () => setOpinion("bad"),
|
|
553
545
|
className: `flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm ${opinion === "bad" ? "bg-red-100 text-red-600 border-red-300" : "border-gray-200 text-gray-600 hover:bg-gray-100"}`,
|
|
554
546
|
children: [
|
|
555
|
-
/* @__PURE__ */ (0,
|
|
547
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
556
548
|
import_lucide_react7.ThumbsDown,
|
|
557
549
|
{
|
|
558
550
|
className: `size-4 pt-0.5 ${opinion === "bad" ? "fill-red-600" : "text-gray-500"}`
|
|
@@ -563,14 +555,14 @@ function DocstraFeedback() {
|
|
|
563
555
|
}
|
|
564
556
|
)
|
|
565
557
|
] }),
|
|
566
|
-
opinion && /* @__PURE__ */ (0,
|
|
558
|
+
opinion && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
567
559
|
"form",
|
|
568
560
|
{
|
|
569
561
|
className: "flex flex-col gap-2",
|
|
570
562
|
action: `https://formsync.app/v1/s/${docstraConfig?.feedback?.formSyncFormID || ""}`,
|
|
571
563
|
method: "POST",
|
|
572
564
|
children: [
|
|
573
|
-
/* @__PURE__ */ (0,
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
574
566
|
Input,
|
|
575
567
|
{
|
|
576
568
|
value: message,
|
|
@@ -581,14 +573,14 @@ function DocstraFeedback() {
|
|
|
581
573
|
type: "textarea"
|
|
582
574
|
}
|
|
583
575
|
),
|
|
584
|
-
/* @__PURE__ */ (0,
|
|
585
|
-
/* @__PURE__ */ (0,
|
|
586
|
-
/* @__PURE__ */ (0,
|
|
587
|
-
/* @__PURE__ */ (0,
|
|
588
|
-
docstraConfig?.feedback?.watermark !== false && /* @__PURE__ */ (0,
|
|
576
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "hidden", name: "opinion", value: opinion }),
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "hidden", name: "page", value: window.location.href }),
|
|
578
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "hidden", name: "_redirect", value: window.location.href }),
|
|
579
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { label: "Submit", className: "w-max text-sm" }),
|
|
580
|
+
docstraConfig?.feedback?.watermark !== false && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "text-left text-sm text-gray-500 mt-6", children: [
|
|
589
581
|
"Powered by",
|
|
590
582
|
" ",
|
|
591
|
-
/* @__PURE__ */ (0,
|
|
583
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
592
584
|
"a",
|
|
593
585
|
{
|
|
594
586
|
href: `https://www.formsync.app?utm_source=${docstraConfig?.githubRepo}`,
|
|
@@ -605,9 +597,9 @@ function DocstraFeedback() {
|
|
|
605
597
|
|
|
606
598
|
// src/client/pagination.tsx
|
|
607
599
|
var import_navigation4 = require("next/navigation");
|
|
608
|
-
var
|
|
600
|
+
var import_link5 = __toESM(require("next/link"));
|
|
609
601
|
var import_lucide_react8 = require("lucide-react");
|
|
610
|
-
var
|
|
602
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
611
603
|
function DocstraPagination() {
|
|
612
604
|
const pathname = (0, import_navigation4.usePathname)();
|
|
613
605
|
const { docstraConfig } = useDocstra();
|
|
@@ -615,48 +607,48 @@ function DocstraPagination() {
|
|
|
615
607
|
const currentIndex = flatLinks.findIndex((item) => item.href === pathname);
|
|
616
608
|
const prev = currentIndex > 0 ? flatLinks[currentIndex - 1] : null;
|
|
617
609
|
const next = currentIndex < flatLinks.length - 1 ? flatLinks[currentIndex + 1] : null;
|
|
618
|
-
return /* @__PURE__ */ (0,
|
|
619
|
-
prev ? /* @__PURE__ */ (0,
|
|
620
|
-
|
|
610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col md:flex-row gap-2 justify-between py-10 mt-10", children: [
|
|
611
|
+
prev ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
612
|
+
import_link5.default,
|
|
621
613
|
{
|
|
622
614
|
href: prev.href,
|
|
623
615
|
className: "flex flex-col items-start gap-2 border border-gray-200 hover:bg-gray-50 py-3 md:min-w-62 pl-4 pr-10 rounded-lg text-sm",
|
|
624
616
|
children: [
|
|
625
|
-
/* @__PURE__ */ (0,
|
|
626
|
-
/* @__PURE__ */ (0,
|
|
627
|
-
/* @__PURE__ */ (0,
|
|
617
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-gray-500", children: "Previous" }),
|
|
618
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "flex items-center font-medium", children: [
|
|
619
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.ArrowLeftIcon, { className: "size-5 mr-2" }),
|
|
628
620
|
prev.name
|
|
629
621
|
] })
|
|
630
622
|
]
|
|
631
623
|
}
|
|
632
|
-
) : /* @__PURE__ */ (0,
|
|
633
|
-
next ? /* @__PURE__ */ (0,
|
|
634
|
-
|
|
624
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", {}),
|
|
625
|
+
next ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
626
|
+
import_link5.default,
|
|
635
627
|
{
|
|
636
628
|
href: next.href,
|
|
637
629
|
className: "flex flex-col items-end gap-2 border border-gray-200 hover:bg-gray-50 py-3 pr-4 md:min-w-62 pl-10 rounded-lg text-sm",
|
|
638
630
|
children: [
|
|
639
|
-
/* @__PURE__ */ (0,
|
|
640
|
-
/* @__PURE__ */ (0,
|
|
631
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-gray-500", children: "Next" }),
|
|
632
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "flex items-center font-medium", children: [
|
|
641
633
|
next.name,
|
|
642
|
-
/* @__PURE__ */ (0,
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.ArrowRightIcon, { className: "size-5 ml-2" })
|
|
643
635
|
] })
|
|
644
636
|
]
|
|
645
637
|
}
|
|
646
|
-
) : /* @__PURE__ */ (0,
|
|
638
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", {})
|
|
647
639
|
] });
|
|
648
640
|
}
|
|
649
641
|
|
|
650
642
|
// src/client/docs-body.tsx
|
|
651
|
-
var
|
|
643
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
652
644
|
function DocstraBody({ children }) {
|
|
653
645
|
const { docstraConfig } = useDocstra();
|
|
654
|
-
return /* @__PURE__ */ (0,
|
|
655
|
-
/* @__PURE__ */ (0,
|
|
656
|
-
/* @__PURE__ */ (0,
|
|
646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("main", { className: "flex-1 px-4 md:px-8 py-10 max-w-full text-base/7", children: [
|
|
647
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DocstraBreadcrumbs, {}),
|
|
648
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DocstraPageHead, {}),
|
|
657
649
|
children,
|
|
658
|
-
docstraConfig?.feedback?.enabled && /* @__PURE__ */ (0,
|
|
659
|
-
/* @__PURE__ */ (0,
|
|
650
|
+
docstraConfig?.feedback?.enabled && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DocstraFeedback, {}),
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DocstraPagination, {})
|
|
660
652
|
] });
|
|
661
653
|
}
|
|
662
654
|
|
|
@@ -695,7 +687,7 @@ function extractHeadingsFromMdx(raw) {
|
|
|
695
687
|
}
|
|
696
688
|
|
|
697
689
|
// src/client/docstra-toc.tsx
|
|
698
|
-
var
|
|
690
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
699
691
|
function DocstraTOC() {
|
|
700
692
|
const [headings, setHeadings] = (0, import_react6.useState)([]);
|
|
701
693
|
const [activeId, setActiveId] = (0, import_react6.useState)(null);
|
|
@@ -773,14 +765,14 @@ function DocstraTOC() {
|
|
|
773
765
|
setActiveId(id);
|
|
774
766
|
setIsManualClick(true);
|
|
775
767
|
};
|
|
776
|
-
return /* @__PURE__ */ (0,
|
|
777
|
-
/* @__PURE__ */ (0,
|
|
778
|
-
/* @__PURE__ */ (0,
|
|
768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("aside", { className: "sticky top-18 text-sm hidden xl:block text-gray-500 shrink-0 h-[calc(100svh-72px)] w-64 border-l border-gray-200 p-6 overflow-y-auto", children: [
|
|
769
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "flex items-center gap-2 mb-5", children: [
|
|
770
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.TextAlignStartIcon, { className: "size-4" }),
|
|
779
771
|
"On this page"
|
|
780
772
|
] }),
|
|
781
|
-
/* @__PURE__ */ (0,
|
|
782
|
-
/* @__PURE__ */ (0,
|
|
783
|
-
h2.children.map((h3) => /* @__PURE__ */ (0,
|
|
773
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "toc-scroll-container max-h-3/4 overflow-y-auto scrollbar-none", children: headings.map((h2) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { children: [
|
|
774
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TableOfContentsLink, { heading: h2, activeId, handleClick }),
|
|
775
|
+
h2.children.map((h3) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
784
776
|
TableOfContentsLink,
|
|
785
777
|
{
|
|
786
778
|
heading: h3,
|
|
@@ -791,8 +783,8 @@ function DocstraTOC() {
|
|
|
791
783
|
h3.id
|
|
792
784
|
))
|
|
793
785
|
] }, h2.id)) }),
|
|
794
|
-
/* @__PURE__ */ (0,
|
|
795
|
-
docstraConfig.editOnGithub && /* @__PURE__ */ (0,
|
|
786
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("hr", { className: "my-6 border-gray-200" }),
|
|
787
|
+
docstraConfig.editOnGithub && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
796
788
|
"a",
|
|
797
789
|
{
|
|
798
790
|
href: githubLink,
|
|
@@ -800,25 +792,25 @@ function DocstraTOC() {
|
|
|
800
792
|
className: "flex items-center gap-2 text-gray-400 hover:text-gray-700 transition",
|
|
801
793
|
children: [
|
|
802
794
|
"Edit this page on GitHub",
|
|
803
|
-
/* @__PURE__ */ (0,
|
|
795
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.SquareArrowOutUpRightIcon, { className: "size-4" })
|
|
804
796
|
]
|
|
805
797
|
}
|
|
806
798
|
),
|
|
807
|
-
isScrolled && /* @__PURE__ */ (0,
|
|
799
|
+
isScrolled && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
808
800
|
"button",
|
|
809
801
|
{
|
|
810
802
|
onClick: () => scrollTo({ top: 0, behavior: "smooth" }),
|
|
811
803
|
className: "flex items-center gap-2 mt-3 text-gray-400 hover:text-gray-700 transition",
|
|
812
804
|
children: [
|
|
813
805
|
"Scroll to top",
|
|
814
|
-
/* @__PURE__ */ (0,
|
|
806
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.ArrowUpCircleIcon, { className: "size-4" })
|
|
815
807
|
]
|
|
816
808
|
}
|
|
817
809
|
)
|
|
818
810
|
] });
|
|
819
811
|
}
|
|
820
812
|
function TableOfContentsLink({ heading, activeId, handleClick, className }) {
|
|
821
|
-
return /* @__PURE__ */ (0,
|
|
813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
822
814
|
"a",
|
|
823
815
|
{
|
|
824
816
|
href: `#${heading.id}`,
|
|
@@ -837,7 +829,7 @@ var import_react7 = require("react");
|
|
|
837
829
|
var import_prism_react_renderer = require("prism-react-renderer");
|
|
838
830
|
var import_lucide_react10 = require("lucide-react");
|
|
839
831
|
var import_react_toast_msg2 = require("react-toast-msg");
|
|
840
|
-
var
|
|
832
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
841
833
|
function DocstraCodeBlock(props) {
|
|
842
834
|
const { language, title, children } = props;
|
|
843
835
|
const code = typeof children === "string" ? children.trim() : children?.props?.children?.toString()?.trim() || "";
|
|
@@ -853,19 +845,19 @@ function DocstraCodeBlock(props) {
|
|
|
853
845
|
return () => clearTimeout(timeout);
|
|
854
846
|
}
|
|
855
847
|
}, [copied]);
|
|
856
|
-
return /* @__PURE__ */ (0,
|
|
857
|
-
/* @__PURE__ */ (0,
|
|
858
|
-
/* @__PURE__ */ (0,
|
|
859
|
-
/* @__PURE__ */ (0,
|
|
848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "max-w-2xl overflow-hidden rounded-lg text-sm text-gray-800 border border-gray-200/80 mt-4", children: [
|
|
849
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center bg-gray-50 justify-between border-b border-gray-200/80", children: [
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-xs text-gray-400 p-4", children: title || language }),
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
860
852
|
"button",
|
|
861
853
|
{
|
|
862
854
|
onClick: handleCopy,
|
|
863
855
|
className: "rounded cursor-pointer aspect-square p-2 m-2 text-xs hover:bg-gray-200 transition",
|
|
864
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
856
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react10.CheckIcon, { className: "size-4" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react10.CopyIcon, { className: "size-4" })
|
|
865
857
|
}
|
|
866
858
|
)
|
|
867
859
|
] }),
|
|
868
|
-
/* @__PURE__ */ (0,
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_prism_react_renderer.Highlight, { code, language, theme: import_prism_react_renderer.themes.nightOwlLight, children: ({ style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("pre", { className: "p-4 font-mono whitespace-pre scrollbar-x overflow-x-auto", style, children: tokens.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ...getLineProps({ line }), children: line.map((token, key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { ...getTokenProps({ token }) }, key)) }, i)) }) })
|
|
869
861
|
] });
|
|
870
862
|
}
|
|
871
863
|
// Annotate the CommonJS export names for ESM import in node:
|