docstra 1.6.0 → 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 +150 -147
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +114 -111
- package/dist/client/index.mjs.map +1 -1
- package/dist/server/index.js +19 -27
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +20 -28
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -3
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)("");
|
|
@@ -113,7 +102,21 @@ function DocstraSearchBox() {
|
|
|
113
102
|
}
|
|
114
103
|
}
|
|
115
104
|
};
|
|
116
|
-
|
|
105
|
+
(0, import_react.useEffect)(() => {
|
|
106
|
+
const handleEscape = (e) => {
|
|
107
|
+
if (e.key === "Escape") {
|
|
108
|
+
setOpenSearchBox(false);
|
|
109
|
+
setSearchQuery("");
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
if (openSearchBox) {
|
|
113
|
+
window.addEventListener("keydown", handleEscape);
|
|
114
|
+
}
|
|
115
|
+
return () => {
|
|
116
|
+
window.removeEventListener("keydown", handleEscape);
|
|
117
|
+
};
|
|
118
|
+
}, [openSearchBox]);
|
|
119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
120
|
"div",
|
|
118
121
|
{
|
|
119
122
|
onClick: () => {
|
|
@@ -124,13 +127,13 @@ function DocstraSearchBox() {
|
|
|
124
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",
|
|
125
128
|
openSearchBox && "opacity-100 pointer-events-auto"
|
|
126
129
|
),
|
|
127
|
-
children: /* @__PURE__ */ (0,
|
|
130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
128
131
|
"div",
|
|
129
132
|
{
|
|
130
133
|
onClick: (e) => e.stopPropagation(),
|
|
131
134
|
className: "flex flex-col items-center mt-30 max-w-lg w-full max-md:px-4",
|
|
132
135
|
children: [
|
|
133
|
-
/* @__PURE__ */ (0,
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
137
|
"form",
|
|
135
138
|
{
|
|
136
139
|
onSubmit: onSearchHandler,
|
|
@@ -138,17 +141,14 @@ function DocstraSearchBox() {
|
|
|
138
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",
|
|
139
142
|
searchQuery && "rounded-b-none border-b-0"
|
|
140
143
|
),
|
|
141
|
-
children: openSearchBox && /* @__PURE__ */ (0,
|
|
142
|
-
/* @__PURE__ */ (0,
|
|
143
|
-
/* @__PURE__ */ (0,
|
|
144
|
-
/* @__PURE__ */ (0,
|
|
145
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M13.5 2.25a2.25 2.25 0 0 0-2.25 2.25v9a2.25 2.25 0 1 0 2.25-2.25h-9a2.25 2.25 0 1 0 2.25 2.25v-9A2.25 2.25 0 1 0 4.5 6.75h9a2.25 2.25 0 0 0 0-4.5", stroke: "#99A1AF", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
146
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M25.986 14 21.45 8.89l4.438-4.69h2.058l-4.9 5.096v-.882L28.086 14zm-5.922 0V4.2h1.61V14z", fill: "#99A1AF" })
|
|
147
|
-
] })
|
|
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" })
|
|
148
148
|
] })
|
|
149
149
|
}
|
|
150
150
|
),
|
|
151
|
-
/* @__PURE__ */ (0,
|
|
151
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
152
152
|
"div",
|
|
153
153
|
{
|
|
154
154
|
className: cn(
|
|
@@ -156,23 +156,23 @@ function DocstraSearchBox() {
|
|
|
156
156
|
searchQuery && "rounded-b-md border border-slate-200"
|
|
157
157
|
),
|
|
158
158
|
children: [
|
|
159
|
-
searchResults.map((item) => /* @__PURE__ */ (0,
|
|
160
|
-
|
|
159
|
+
searchResults.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
160
|
+
import_link.default,
|
|
161
161
|
{
|
|
162
|
-
href: `/docs/${item.info.slug}`,
|
|
162
|
+
href: `/docs/${item.info.slug.replace("index", "")}`,
|
|
163
163
|
onNavigate: () => {
|
|
164
164
|
setOpenSearchBox(false);
|
|
165
165
|
setSearchQuery("");
|
|
166
166
|
},
|
|
167
167
|
className: "w-full hover:bg-gray-100/70 border-b border-slate-200 transition-all py-4 px-4 last:mb-2",
|
|
168
168
|
children: [
|
|
169
|
-
/* @__PURE__ */ (0,
|
|
170
|
-
/* @__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 })
|
|
171
171
|
]
|
|
172
172
|
},
|
|
173
173
|
item.info.slug
|
|
174
174
|
)),
|
|
175
|
-
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" })
|
|
176
176
|
]
|
|
177
177
|
}
|
|
178
178
|
)
|
|
@@ -184,7 +184,7 @@ function DocstraSearchBox() {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
// src/context/docstra-context.tsx
|
|
187
|
-
var
|
|
187
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
188
188
|
var DocstraContext = (0, import_react2.createContext)(null);
|
|
189
189
|
function DocstraProvider({
|
|
190
190
|
children,
|
|
@@ -194,7 +194,7 @@ function DocstraProvider({
|
|
|
194
194
|
}) {
|
|
195
195
|
const [openSidebar, setOpenSidebar] = (0, import_react2.useState)(false);
|
|
196
196
|
const [openSearchBox, setOpenSearchBox] = (0, import_react2.useState)(false);
|
|
197
|
-
return /* @__PURE__ */ (0,
|
|
197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
198
198
|
DocstraContext.Provider,
|
|
199
199
|
{
|
|
200
200
|
value: {
|
|
@@ -207,8 +207,8 @@ function DocstraProvider({
|
|
|
207
207
|
docs
|
|
208
208
|
},
|
|
209
209
|
children: [
|
|
210
|
-
/* @__PURE__ */ (0,
|
|
211
|
-
/* @__PURE__ */ (0,
|
|
210
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_toast_msg.ToastContainer, {}),
|
|
211
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DocstraSearchBox, {}),
|
|
212
212
|
children
|
|
213
213
|
]
|
|
214
214
|
}
|
|
@@ -223,7 +223,8 @@ function useDocstra() {
|
|
|
223
223
|
// src/client/header.tsx
|
|
224
224
|
var import_lucide_react2 = require("lucide-react");
|
|
225
225
|
var import_react3 = require("react");
|
|
226
|
-
var
|
|
226
|
+
var import_link2 = __toESM(require("next/link"));
|
|
227
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
227
228
|
function DocstraHeader() {
|
|
228
229
|
const { openSidebar, setOpenSidebar, docstraConfig } = useDocstra();
|
|
229
230
|
(0, import_react3.useEffect)(() => {
|
|
@@ -233,8 +234,8 @@ function DocstraHeader() {
|
|
|
233
234
|
document.body.classList.remove("max-md:overflow-hidden");
|
|
234
235
|
}
|
|
235
236
|
}, [openSidebar]);
|
|
236
|
-
return /* @__PURE__ */ (0,
|
|
237
|
-
/* @__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)(
|
|
238
239
|
"img",
|
|
239
240
|
{
|
|
240
241
|
src: docstraConfig.navbar?.logo?.src || "/logo.png",
|
|
@@ -242,16 +243,16 @@ function DocstraHeader() {
|
|
|
242
243
|
className: cn("h-9.5 w-auto", docstraConfig.navbar?.logo?.className)
|
|
243
244
|
}
|
|
244
245
|
) }),
|
|
245
|
-
/* @__PURE__ */ (0,
|
|
246
|
-
docstraConfig.navbar?.links?.map((link) => /* @__PURE__ */ (0,
|
|
247
|
-
/* @__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" }) }) })
|
|
248
249
|
] }),
|
|
249
|
-
/* @__PURE__ */ (0,
|
|
250
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
250
251
|
"button",
|
|
251
252
|
{
|
|
252
253
|
onClick: () => setOpenSidebar(!openSidebar),
|
|
253
254
|
className: "md:hidden transition text-gray-600 active:ring-2 ring-gray-200 p-1.5 rounded-md",
|
|
254
|
-
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" })
|
|
255
256
|
}
|
|
256
257
|
)
|
|
257
258
|
] });
|
|
@@ -269,12 +270,13 @@ function getIcon(name) {
|
|
|
269
270
|
}
|
|
270
271
|
|
|
271
272
|
// src/client/sidebar.tsx
|
|
272
|
-
var
|
|
273
|
+
var import_link3 = __toESM(require("next/link"));
|
|
274
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
273
275
|
function DocstraSidebar() {
|
|
274
276
|
const { openSidebar, setOpenSidebar, docstraConfig, setOpenSearchBox } = useDocstra();
|
|
275
277
|
const pathname = (0, import_navigation2.usePathname)();
|
|
276
|
-
return /* @__PURE__ */ (0,
|
|
277
|
-
/* @__PURE__ */ (0,
|
|
278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
278
280
|
"div",
|
|
279
281
|
{
|
|
280
282
|
className: cn(
|
|
@@ -284,7 +286,7 @@ function DocstraSidebar() {
|
|
|
284
286
|
onClick: () => setOpenSidebar(false)
|
|
285
287
|
}
|
|
286
288
|
),
|
|
287
|
-
/* @__PURE__ */ (0,
|
|
289
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
288
290
|
"aside",
|
|
289
291
|
{
|
|
290
292
|
className: cn(
|
|
@@ -292,30 +294,30 @@ function DocstraSidebar() {
|
|
|
292
294
|
openSidebar ? "top-32" : "top-full"
|
|
293
295
|
),
|
|
294
296
|
children: [
|
|
295
|
-
/* @__PURE__ */ (0,
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
296
298
|
"div",
|
|
297
299
|
{
|
|
298
|
-
className: "flex items-center gap-2 cursor-pointer mt-6 mb-4 p-2.5 text-gray-500 border border-gray-200 rounded-lg hover:bg-gray-50",
|
|
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",
|
|
299
301
|
onClick: () => {
|
|
300
302
|
setOpenSidebar(openSidebar && false);
|
|
301
303
|
setOpenSearchBox(true);
|
|
302
304
|
},
|
|
303
305
|
children: [
|
|
304
|
-
/* @__PURE__ */ (0,
|
|
305
|
-
/* @__PURE__ */ (0,
|
|
306
|
-
/* @__PURE__ */ (0,
|
|
307
|
-
/* @__PURE__ */ (0,
|
|
308
|
-
/* @__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" })
|
|
309
311
|
] })
|
|
310
312
|
]
|
|
311
313
|
}
|
|
312
314
|
),
|
|
313
|
-
docstraConfig.sidebar?.links?.map((group) => /* @__PURE__ */ (0,
|
|
314
|
-
/* @__PURE__ */ (0,
|
|
315
|
-
/* @__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) => {
|
|
316
318
|
const Icon = getIcon(link.icon);
|
|
317
|
-
return /* @__PURE__ */ (0,
|
|
318
|
-
|
|
319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
320
|
+
import_link3.default,
|
|
319
321
|
{
|
|
320
322
|
href: link.href,
|
|
321
323
|
onNavigate: () => openSidebar && setOpenSidebar(false),
|
|
@@ -324,8 +326,8 @@ function DocstraSidebar() {
|
|
|
324
326
|
pathname === link.href && "bg-gray-100 text-gray-800"
|
|
325
327
|
),
|
|
326
328
|
children: [
|
|
327
|
-
Icon && /* @__PURE__ */ (0,
|
|
328
|
-
/* @__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 })
|
|
329
331
|
]
|
|
330
332
|
}
|
|
331
333
|
) }, link.href);
|
|
@@ -338,15 +340,16 @@ function DocstraSidebar() {
|
|
|
338
340
|
}
|
|
339
341
|
|
|
340
342
|
// src/client/docs-page.tsx
|
|
341
|
-
var
|
|
343
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
342
344
|
function DocstraPage({ children }) {
|
|
343
|
-
return /* @__PURE__ */ (0,
|
|
345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "min-h-screen flex bg-white w-full", children });
|
|
344
346
|
}
|
|
345
347
|
|
|
346
348
|
// src/client/breadcrumbs.tsx
|
|
347
349
|
var import_navigation3 = require("next/navigation");
|
|
348
350
|
var import_lucide_react4 = require("lucide-react");
|
|
349
|
-
var
|
|
351
|
+
var import_link4 = __toESM(require("next/link"));
|
|
352
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
350
353
|
function DocstraBreadcrumbs() {
|
|
351
354
|
const pathname = (0, import_navigation3.usePathname)();
|
|
352
355
|
const paths = pathname.split("/").filter(Boolean);
|
|
@@ -355,13 +358,13 @@ function DocstraBreadcrumbs() {
|
|
|
355
358
|
const title = segment.replace(/-/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
356
359
|
return { href, title };
|
|
357
360
|
});
|
|
358
|
-
return /* @__PURE__ */ (0,
|
|
359
|
-
/* @__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" }) }),
|
|
360
363
|
breadcrumbs.map((crumb, index) => {
|
|
361
364
|
const isLast = index === breadcrumbs.length - 1;
|
|
362
|
-
return /* @__PURE__ */ (0,
|
|
363
|
-
/* @__PURE__ */ (0,
|
|
364
|
-
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 })
|
|
365
368
|
] }, crumb.href);
|
|
366
369
|
})
|
|
367
370
|
] }) });
|
|
@@ -370,7 +373,7 @@ function DocstraBreadcrumbs() {
|
|
|
370
373
|
// src/client/page-buttons.tsx
|
|
371
374
|
var import_lucide_react5 = require("lucide-react");
|
|
372
375
|
var import_react4 = require("react");
|
|
373
|
-
var
|
|
376
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
374
377
|
function DocstraPageButtons() {
|
|
375
378
|
const { pageData } = useDocstra();
|
|
376
379
|
const [isCopied, setIsCopied] = (0, import_react4.useState)(false);
|
|
@@ -384,20 +387,20 @@ function DocstraPageButtons() {
|
|
|
384
387
|
setIsCopied(true);
|
|
385
388
|
setTimeout(() => setIsCopied(false), 3e3);
|
|
386
389
|
};
|
|
387
|
-
return /* @__PURE__ */ (0,
|
|
388
|
-
/* @__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)(
|
|
389
392
|
"button",
|
|
390
393
|
{
|
|
391
394
|
title: "Copy Markdown",
|
|
392
395
|
onClick: handleCopy,
|
|
393
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",
|
|
394
397
|
children: [
|
|
395
|
-
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" }),
|
|
396
399
|
"Copy Markdown"
|
|
397
400
|
]
|
|
398
401
|
}
|
|
399
402
|
),
|
|
400
|
-
/* @__PURE__ */ (0,
|
|
403
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
401
404
|
"a",
|
|
402
405
|
{
|
|
403
406
|
title: "Ask ChatGPT",
|
|
@@ -411,16 +414,16 @@ function DocstraPageButtons() {
|
|
|
411
414
|
}
|
|
412
415
|
|
|
413
416
|
// src/client/docstra-page-head.tsx
|
|
414
|
-
var
|
|
417
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
415
418
|
function DocstraPageHead() {
|
|
416
419
|
const { pageData } = useDocstra();
|
|
417
420
|
const title = pageData?.frontmatter?.title;
|
|
418
421
|
const description = pageData?.frontmatter?.description;
|
|
419
|
-
return /* @__PURE__ */ (0,
|
|
420
|
-
/* @__PURE__ */ (0,
|
|
421
|
-
/* @__PURE__ */ (0,
|
|
422
|
-
/* @__PURE__ */ (0,
|
|
423
|
-
/* @__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" })
|
|
424
427
|
] });
|
|
425
428
|
}
|
|
426
429
|
|
|
@@ -429,7 +432,7 @@ var import_react5 = require("react");
|
|
|
429
432
|
var import_lucide_react7 = require("lucide-react");
|
|
430
433
|
|
|
431
434
|
// src/client/input.tsx
|
|
432
|
-
var
|
|
435
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
433
436
|
function Input({
|
|
434
437
|
label,
|
|
435
438
|
type,
|
|
@@ -442,12 +445,12 @@ function Input({
|
|
|
442
445
|
className = "",
|
|
443
446
|
optional = false
|
|
444
447
|
}) {
|
|
445
|
-
return /* @__PURE__ */ (0,
|
|
446
|
-
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: [
|
|
447
450
|
label,
|
|
448
|
-
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)" })
|
|
449
452
|
] }),
|
|
450
|
-
type === "textarea" ? /* @__PURE__ */ (0,
|
|
453
|
+
type === "textarea" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
451
454
|
"textarea",
|
|
452
455
|
{
|
|
453
456
|
id,
|
|
@@ -463,7 +466,7 @@ function Input({
|
|
|
463
466
|
value,
|
|
464
467
|
readOnly
|
|
465
468
|
}
|
|
466
|
-
) : /* @__PURE__ */ (0,
|
|
469
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
467
470
|
"input",
|
|
468
471
|
{
|
|
469
472
|
type,
|
|
@@ -482,9 +485,9 @@ function Input({
|
|
|
482
485
|
|
|
483
486
|
// src/client/button.tsx
|
|
484
487
|
var import_lucide_react6 = require("lucide-react");
|
|
485
|
-
var
|
|
488
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
486
489
|
function Button({ label, loading, type = "submit", className = "", disabled = false, onClick }) {
|
|
487
|
-
return /* @__PURE__ */ (0,
|
|
490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
488
491
|
"button",
|
|
489
492
|
{
|
|
490
493
|
type,
|
|
@@ -495,21 +498,21 @@ function Button({ label, loading, type = "submit", className = "", disabled = fa
|
|
|
495
498
|
),
|
|
496
499
|
"aria-label": label,
|
|
497
500
|
onClick,
|
|
498
|
-
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
|
|
499
502
|
}
|
|
500
503
|
);
|
|
501
504
|
}
|
|
502
505
|
|
|
503
506
|
// src/client/feedback.tsx
|
|
504
|
-
var
|
|
507
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
505
508
|
function DocstraFeedback() {
|
|
506
509
|
const [opinion, setOpinion] = (0, import_react5.useState)(null);
|
|
507
510
|
const { docstraConfig } = useDocstra();
|
|
508
511
|
const [message, setMessage] = (0, import_react5.useState)("");
|
|
509
512
|
const [submitted, setSubmitted] = (0, import_react5.useState)(false);
|
|
510
|
-
return /* @__PURE__ */ (0,
|
|
511
|
-
/* @__PURE__ */ (0,
|
|
512
|
-
/* @__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)(
|
|
513
516
|
Button,
|
|
514
517
|
{
|
|
515
518
|
onClick: () => {
|
|
@@ -521,27 +524,27 @@ function DocstraFeedback() {
|
|
|
521
524
|
className: "w-max text-sm"
|
|
522
525
|
}
|
|
523
526
|
)
|
|
524
|
-
] }) : /* @__PURE__ */ (0,
|
|
525
|
-
/* @__PURE__ */ (0,
|
|
526
|
-
/* @__PURE__ */ (0,
|
|
527
|
-
/* @__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)(
|
|
528
531
|
"button",
|
|
529
532
|
{
|
|
530
533
|
onClick: () => setOpinion("good"),
|
|
531
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"}`,
|
|
532
535
|
children: [
|
|
533
|
-
/* @__PURE__ */ (0,
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.ThumbsUp, { className: `size-4 ${opinion === "good" ? "fill-green-600" : "text-gray-500"}` }),
|
|
534
537
|
"Good"
|
|
535
538
|
]
|
|
536
539
|
}
|
|
537
540
|
),
|
|
538
|
-
/* @__PURE__ */ (0,
|
|
541
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
539
542
|
"button",
|
|
540
543
|
{
|
|
541
544
|
onClick: () => setOpinion("bad"),
|
|
542
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"}`,
|
|
543
546
|
children: [
|
|
544
|
-
/* @__PURE__ */ (0,
|
|
547
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
545
548
|
import_lucide_react7.ThumbsDown,
|
|
546
549
|
{
|
|
547
550
|
className: `size-4 pt-0.5 ${opinion === "bad" ? "fill-red-600" : "text-gray-500"}`
|
|
@@ -552,14 +555,14 @@ function DocstraFeedback() {
|
|
|
552
555
|
}
|
|
553
556
|
)
|
|
554
557
|
] }),
|
|
555
|
-
opinion && /* @__PURE__ */ (0,
|
|
558
|
+
opinion && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
556
559
|
"form",
|
|
557
560
|
{
|
|
558
561
|
className: "flex flex-col gap-2",
|
|
559
562
|
action: `https://formsync.app/v1/s/${docstraConfig?.feedback?.formSyncFormID || ""}`,
|
|
560
563
|
method: "POST",
|
|
561
564
|
children: [
|
|
562
|
-
/* @__PURE__ */ (0,
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
563
566
|
Input,
|
|
564
567
|
{
|
|
565
568
|
value: message,
|
|
@@ -570,14 +573,14 @@ function DocstraFeedback() {
|
|
|
570
573
|
type: "textarea"
|
|
571
574
|
}
|
|
572
575
|
),
|
|
573
|
-
/* @__PURE__ */ (0,
|
|
574
|
-
/* @__PURE__ */ (0,
|
|
575
|
-
/* @__PURE__ */ (0,
|
|
576
|
-
/* @__PURE__ */ (0,
|
|
577
|
-
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: [
|
|
578
581
|
"Powered by",
|
|
579
582
|
" ",
|
|
580
|
-
/* @__PURE__ */ (0,
|
|
583
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
581
584
|
"a",
|
|
582
585
|
{
|
|
583
586
|
href: `https://www.formsync.app?utm_source=${docstraConfig?.githubRepo}`,
|
|
@@ -594,9 +597,9 @@ function DocstraFeedback() {
|
|
|
594
597
|
|
|
595
598
|
// src/client/pagination.tsx
|
|
596
599
|
var import_navigation4 = require("next/navigation");
|
|
597
|
-
var
|
|
600
|
+
var import_link5 = __toESM(require("next/link"));
|
|
598
601
|
var import_lucide_react8 = require("lucide-react");
|
|
599
|
-
var
|
|
602
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
600
603
|
function DocstraPagination() {
|
|
601
604
|
const pathname = (0, import_navigation4.usePathname)();
|
|
602
605
|
const { docstraConfig } = useDocstra();
|
|
@@ -604,48 +607,48 @@ function DocstraPagination() {
|
|
|
604
607
|
const currentIndex = flatLinks.findIndex((item) => item.href === pathname);
|
|
605
608
|
const prev = currentIndex > 0 ? flatLinks[currentIndex - 1] : null;
|
|
606
609
|
const next = currentIndex < flatLinks.length - 1 ? flatLinks[currentIndex + 1] : null;
|
|
607
|
-
return /* @__PURE__ */ (0,
|
|
608
|
-
prev ? /* @__PURE__ */ (0,
|
|
609
|
-
|
|
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,
|
|
610
613
|
{
|
|
611
614
|
href: prev.href,
|
|
612
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",
|
|
613
616
|
children: [
|
|
614
|
-
/* @__PURE__ */ (0,
|
|
615
|
-
/* @__PURE__ */ (0,
|
|
616
|
-
/* @__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" }),
|
|
617
620
|
prev.name
|
|
618
621
|
] })
|
|
619
622
|
]
|
|
620
623
|
}
|
|
621
|
-
) : /* @__PURE__ */ (0,
|
|
622
|
-
next ? /* @__PURE__ */ (0,
|
|
623
|
-
|
|
624
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", {}),
|
|
625
|
+
next ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
626
|
+
import_link5.default,
|
|
624
627
|
{
|
|
625
628
|
href: next.href,
|
|
626
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",
|
|
627
630
|
children: [
|
|
628
|
-
/* @__PURE__ */ (0,
|
|
629
|
-
/* @__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: [
|
|
630
633
|
next.name,
|
|
631
|
-
/* @__PURE__ */ (0,
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.ArrowRightIcon, { className: "size-5 ml-2" })
|
|
632
635
|
] })
|
|
633
636
|
]
|
|
634
637
|
}
|
|
635
|
-
) : /* @__PURE__ */ (0,
|
|
638
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", {})
|
|
636
639
|
] });
|
|
637
640
|
}
|
|
638
641
|
|
|
639
642
|
// src/client/docs-body.tsx
|
|
640
|
-
var
|
|
643
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
641
644
|
function DocstraBody({ children }) {
|
|
642
645
|
const { docstraConfig } = useDocstra();
|
|
643
|
-
return /* @__PURE__ */ (0,
|
|
644
|
-
/* @__PURE__ */ (0,
|
|
645
|
-
/* @__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, {}),
|
|
646
649
|
children,
|
|
647
|
-
docstraConfig?.feedback?.enabled && /* @__PURE__ */ (0,
|
|
648
|
-
/* @__PURE__ */ (0,
|
|
650
|
+
docstraConfig?.feedback?.enabled && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DocstraFeedback, {}),
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DocstraPagination, {})
|
|
649
652
|
] });
|
|
650
653
|
}
|
|
651
654
|
|
|
@@ -684,7 +687,7 @@ function extractHeadingsFromMdx(raw) {
|
|
|
684
687
|
}
|
|
685
688
|
|
|
686
689
|
// src/client/docstra-toc.tsx
|
|
687
|
-
var
|
|
690
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
688
691
|
function DocstraTOC() {
|
|
689
692
|
const [headings, setHeadings] = (0, import_react6.useState)([]);
|
|
690
693
|
const [activeId, setActiveId] = (0, import_react6.useState)(null);
|
|
@@ -762,14 +765,14 @@ function DocstraTOC() {
|
|
|
762
765
|
setActiveId(id);
|
|
763
766
|
setIsManualClick(true);
|
|
764
767
|
};
|
|
765
|
-
return /* @__PURE__ */ (0,
|
|
766
|
-
/* @__PURE__ */ (0,
|
|
767
|
-
/* @__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" }),
|
|
768
771
|
"On this page"
|
|
769
772
|
] }),
|
|
770
|
-
/* @__PURE__ */ (0,
|
|
771
|
-
/* @__PURE__ */ (0,
|
|
772
|
-
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)(
|
|
773
776
|
TableOfContentsLink,
|
|
774
777
|
{
|
|
775
778
|
heading: h3,
|
|
@@ -780,8 +783,8 @@ function DocstraTOC() {
|
|
|
780
783
|
h3.id
|
|
781
784
|
))
|
|
782
785
|
] }, h2.id)) }),
|
|
783
|
-
/* @__PURE__ */ (0,
|
|
784
|
-
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)(
|
|
785
788
|
"a",
|
|
786
789
|
{
|
|
787
790
|
href: githubLink,
|
|
@@ -789,25 +792,25 @@ function DocstraTOC() {
|
|
|
789
792
|
className: "flex items-center gap-2 text-gray-400 hover:text-gray-700 transition",
|
|
790
793
|
children: [
|
|
791
794
|
"Edit this page on GitHub",
|
|
792
|
-
/* @__PURE__ */ (0,
|
|
795
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.SquareArrowOutUpRightIcon, { className: "size-4" })
|
|
793
796
|
]
|
|
794
797
|
}
|
|
795
798
|
),
|
|
796
|
-
isScrolled && /* @__PURE__ */ (0,
|
|
799
|
+
isScrolled && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
797
800
|
"button",
|
|
798
801
|
{
|
|
799
802
|
onClick: () => scrollTo({ top: 0, behavior: "smooth" }),
|
|
800
803
|
className: "flex items-center gap-2 mt-3 text-gray-400 hover:text-gray-700 transition",
|
|
801
804
|
children: [
|
|
802
805
|
"Scroll to top",
|
|
803
|
-
/* @__PURE__ */ (0,
|
|
806
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.ArrowUpCircleIcon, { className: "size-4" })
|
|
804
807
|
]
|
|
805
808
|
}
|
|
806
809
|
)
|
|
807
810
|
] });
|
|
808
811
|
}
|
|
809
812
|
function TableOfContentsLink({ heading, activeId, handleClick, className }) {
|
|
810
|
-
return /* @__PURE__ */ (0,
|
|
813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
811
814
|
"a",
|
|
812
815
|
{
|
|
813
816
|
href: `#${heading.id}`,
|
|
@@ -826,7 +829,7 @@ var import_react7 = require("react");
|
|
|
826
829
|
var import_prism_react_renderer = require("prism-react-renderer");
|
|
827
830
|
var import_lucide_react10 = require("lucide-react");
|
|
828
831
|
var import_react_toast_msg2 = require("react-toast-msg");
|
|
829
|
-
var
|
|
832
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
830
833
|
function DocstraCodeBlock(props) {
|
|
831
834
|
const { language, title, children } = props;
|
|
832
835
|
const code = typeof children === "string" ? children.trim() : children?.props?.children?.toString()?.trim() || "";
|
|
@@ -842,19 +845,19 @@ function DocstraCodeBlock(props) {
|
|
|
842
845
|
return () => clearTimeout(timeout);
|
|
843
846
|
}
|
|
844
847
|
}, [copied]);
|
|
845
|
-
return /* @__PURE__ */ (0,
|
|
846
|
-
/* @__PURE__ */ (0,
|
|
847
|
-
/* @__PURE__ */ (0,
|
|
848
|
-
/* @__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)(
|
|
849
852
|
"button",
|
|
850
853
|
{
|
|
851
854
|
onClick: handleCopy,
|
|
852
855
|
className: "rounded cursor-pointer aspect-square p-2 m-2 text-xs hover:bg-gray-200 transition",
|
|
853
|
-
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" })
|
|
854
857
|
}
|
|
855
858
|
)
|
|
856
859
|
] }),
|
|
857
|
-
/* @__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)) }) })
|
|
858
861
|
] });
|
|
859
862
|
}
|
|
860
863
|
// Annotate the CommonJS export names for ESM import in node:
|