react-docs-ui 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{AIChatDialog-C2mEAX2T.js → AIChatDialog-TeF0UMa0.js} +1 -1
- package/dist/{AISelectionTrigger-CWTJRvHo.js → AISelectionTrigger-DlIUBzEs.js} +1 -1
- package/dist/{AISettingsPanel-C9Bb_QtE.js → AISettingsPanel-DQeyU4eW.js} +26 -26
- package/dist/{DocsApp-CTh7Pa9A.js → DocsApp-DfK7TY-W.js} +5695 -3888
- package/dist/{GlobalContextMenu-DAIKsl1l.js → GlobalContextMenu-DmsqlfsV.js} +1 -1
- package/dist/{MdxContent-BAm4izu3.js → MdxContent-Bj-hsc_-.js} +120 -120
- package/dist/{MdxContent.lazy-vS9NrZj4.js → MdxContent.lazy-B_p0r_Lg.js} +1 -1
- package/dist/{SearchDialog-CLbtpf7I.js → SearchDialog-CSsOqT7K.js} +2 -2
- package/dist/{SearchRuntime--tjedqS6.js → SearchRuntime-_h-lNr-D.js} +1 -1
- package/dist/{context-menu-DwILPvwC.js → context-menu-CdhjBgD1.js} +1 -1
- package/dist/{dialog-D68sEJBe.js → dialog-DisDZkkN.js} +1 -1
- package/dist/docs-app.es.js +1 -1
- package/dist/{mdx-components-6beJPZgM.js → mdx-components-DoD1nZRa.js} +1 -1
- package/dist/react-docs-ui.css +1 -1
- package/dist/react-docs-ui.es.js +16 -16
- package/dist/types/components/BookmarkButton.d.ts +8 -0
- package/dist/types/components/BookmarkButton.d.ts.map +1 -0
- package/dist/types/components/DocsLayout.d.ts.map +1 -1
- package/dist/types/components/FontProvider.d.ts.map +1 -1
- package/dist/types/components/Footer.d.ts.map +1 -1
- package/dist/types/components/HeaderNav.d.ts.map +1 -1
- package/dist/types/components/PageFeedback.d.ts.map +1 -1
- package/dist/types/components/PageMetaActions.d.ts +1 -0
- package/dist/types/components/PageMetaActions.d.ts.map +1 -1
- package/dist/types/components/auth/LoginDialog.d.ts +8 -0
- package/dist/types/components/auth/LoginDialog.d.ts.map +1 -0
- package/dist/types/components/auth/ProfileDialog.d.ts +7 -0
- package/dist/types/components/auth/ProfileDialog.d.ts.map +1 -0
- package/dist/types/components/auth/RegisterDialog.d.ts +8 -0
- package/dist/types/components/auth/RegisterDialog.d.ts.map +1 -0
- package/dist/types/components/auth/UserMenu.d.ts +2 -0
- package/dist/types/components/auth/UserMenu.d.ts.map +1 -0
- package/dist/types/components/comments/CommentInput.d.ts +8 -0
- package/dist/types/components/comments/CommentInput.d.ts.map +1 -0
- package/dist/types/components/comments/CommentItem.d.ts +11 -0
- package/dist/types/components/comments/CommentItem.d.ts.map +1 -0
- package/dist/types/components/comments/CommentSection.d.ts +7 -0
- package/dist/types/components/comments/CommentSection.d.ts.map +1 -0
- package/dist/types/components/ui/button.d.ts +1 -1
- package/dist/types/hooks/useAnalytics.d.ts +9 -0
- package/dist/types/hooks/useAnalytics.d.ts.map +1 -0
- package/dist/types/hooks/useAuth.d.ts +24 -0
- package/dist/types/hooks/useAuth.d.ts.map +1 -0
- package/dist/types/lib/api/analytics.d.ts +4 -0
- package/dist/types/lib/api/analytics.d.ts.map +1 -0
- package/dist/types/lib/api/auth.d.ts +15 -0
- package/dist/types/lib/api/auth.d.ts.map +1 -0
- package/dist/types/lib/api/bookmarks.d.ts +9 -0
- package/dist/types/lib/api/bookmarks.d.ts.map +1 -0
- package/dist/types/lib/api/client.d.ts +14 -0
- package/dist/types/lib/api/client.d.ts.map +1 -0
- package/dist/types/lib/api/comments.d.ts +7 -0
- package/dist/types/lib/api/comments.d.ts.map +1 -0
- package/dist/types/lib/api/index.d.ts +7 -0
- package/dist/types/lib/api/index.d.ts.map +1 -0
- package/dist/types/lib/api/types.d.ts +102 -0
- package/dist/types/lib/api/types.d.ts.map +1 -0
- package/dist/types/lib/config.d.ts +33 -1
- package/dist/types/lib/config.d.ts.map +1 -1
- package/package.json +1 -1
- /package/dist/{use-toast-DK69oadB.js → use-toast-BnYFxs3T.js} +0 -0
- /package/dist/{utils-KFBtT4Mx.js → utils-C1xOyiTe.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as e } from "./theme-provider-fNhx9xK0.js";
|
|
2
|
-
import { a as t, c as n, d as r, f as i, i as a, l as o, m as s, o as c, p as l, r as u, s as d, t as f } from "./context-menu-
|
|
2
|
+
import { a as t, c as n, d as r, f as i, i as a, l as o, m as s, o as c, p as l, r as u, s as d, t as f } from "./context-menu-CdhjBgD1.js";
|
|
3
3
|
import { useCallback as p } from "react";
|
|
4
4
|
import { useLocation as m, useNavigate as h } from "react-router-dom";
|
|
5
5
|
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { l as
|
|
1
|
+
import { t as e } from "./use-toast-BnYFxs3T.js";
|
|
2
|
+
import { n as t, r as n, t as r } from "./utils-C1xOyiTe.js";
|
|
3
|
+
import { l as i, r as a, t as o, u as s } from "./dialog-DisDZkkN.js";
|
|
4
|
+
import { S as c, b as l, c as u, d, h as f, l as p, p as m, s as h, t as g, v as _, x as v, y } from "./mdx-components-DoD1nZRa.js";
|
|
5
5
|
import * as b from "react";
|
|
6
6
|
import { Check as ee, Copy as x, Download as te, ExternalLink as S, Maximize as ne, Minimize as re, RefreshCw as ie, RotateCcw as ae, RotateCw as oe, Search as se, X as ce, ZoomIn as le, ZoomOut as ue } from "lucide-react";
|
|
7
7
|
import { Link as C, useParams as w } from "react-router-dom";
|
|
@@ -101,25 +101,25 @@ function ve(e) {
|
|
|
101
101
|
return !1;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
function B({ open:
|
|
105
|
-
let
|
|
104
|
+
function B({ open: t, onOpenChange: n, src: u, alt: d, title: f, lang: p = "zh-cn", labels: m }) {
|
|
105
|
+
let h = b.useMemo(() => fe(p, m), [p, m]), g = b.useRef(null), ee = b.useRef(null), [x, C] = b.useState(1), [w, T] = b.useState(0), [O, k] = b.useState("fit"), [de, A] = b.useState(!1), [j, M] = b.useState(!1), [N, P] = b.useState({
|
|
106
106
|
x: 0,
|
|
107
107
|
y: 0
|
|
108
|
-
}), [F, I] = b.useState(!1), L = b.useRef(/* @__PURE__ */ new Map()), R = b.useRef(null), B = b.useRef(null), V =
|
|
108
|
+
}), [F, I] = b.useState(!1), L = b.useRef(/* @__PURE__ */ new Map()), R = b.useRef(null), B = b.useRef(null), V = d?.trim() || f?.trim() || h.imageAltFallback, H = b.useCallback(() => {
|
|
109
109
|
C(1), T(0), k("fit"), M(!1), P({
|
|
110
110
|
x: 0,
|
|
111
111
|
y: 0
|
|
112
112
|
}), I(!1), L.current.clear(), R.current = null, B.current = null;
|
|
113
113
|
}, []);
|
|
114
114
|
b.useEffect(() => {
|
|
115
|
-
if (
|
|
115
|
+
if (t) {
|
|
116
116
|
H();
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
A(!1);
|
|
120
|
-
}, [
|
|
120
|
+
}, [t, H]), b.useEffect(() => {
|
|
121
121
|
document.fullscreenElement || A(!1);
|
|
122
|
-
}, [
|
|
122
|
+
}, [t]), b.useEffect(() => {
|
|
123
123
|
let e = () => {
|
|
124
124
|
A(!!document.fullscreenElement);
|
|
125
125
|
};
|
|
@@ -157,64 +157,64 @@ function B({ open: e, onOpenChange: t, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
157
157
|
}, []), Y = b.useCallback(() => {
|
|
158
158
|
T((e) => e + 90);
|
|
159
159
|
}, []), X = b.useCallback(async () => {
|
|
160
|
-
let
|
|
160
|
+
let t = ge(u, f, d), n = null;
|
|
161
161
|
try {
|
|
162
|
-
if (ve(
|
|
163
|
-
_e(
|
|
162
|
+
if (ve(u)) {
|
|
163
|
+
_e(u, t), e({ description: h.downloadSuccess });
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
} catch {}
|
|
167
167
|
try {
|
|
168
|
-
let
|
|
169
|
-
if (!
|
|
170
|
-
let
|
|
171
|
-
|
|
168
|
+
let r = await fetch(u, { mode: "cors" });
|
|
169
|
+
if (!r.ok) throw Error(`Failed to fetch image: ${r.status}`);
|
|
170
|
+
let i = await r.blob();
|
|
171
|
+
n = URL.createObjectURL(i), _e(n, t), e({ description: h.downloadSuccess });
|
|
172
172
|
} catch {
|
|
173
|
-
|
|
173
|
+
e({
|
|
174
174
|
variant: "destructive",
|
|
175
|
-
description:
|
|
175
|
+
description: h.downloadError
|
|
176
176
|
});
|
|
177
177
|
} finally {
|
|
178
|
-
|
|
178
|
+
n && URL.revokeObjectURL(n);
|
|
179
179
|
}
|
|
180
180
|
}, [
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
181
|
+
d,
|
|
182
|
+
h.downloadError,
|
|
183
|
+
h.downloadSuccess,
|
|
184
|
+
u,
|
|
185
|
+
f
|
|
186
186
|
]), Z = b.useCallback(() => {
|
|
187
187
|
try {
|
|
188
|
-
window.open(
|
|
188
|
+
window.open(u, "_blank", "noopener,noreferrer");
|
|
189
189
|
} catch {
|
|
190
|
-
|
|
190
|
+
e({
|
|
191
191
|
variant: "destructive",
|
|
192
|
-
description:
|
|
192
|
+
description: h.openInNewTabError
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
|
-
}, [
|
|
196
|
-
let
|
|
197
|
-
if (!
|
|
198
|
-
|
|
195
|
+
}, [h.openInNewTabError, u]), Q = b.useCallback(async () => {
|
|
196
|
+
let t = g.current;
|
|
197
|
+
if (!t?.requestFullscreen) {
|
|
198
|
+
e({ description: h.fullscreenError });
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
201
|
try {
|
|
202
|
-
document.fullscreenElement ? await document.exitFullscreen() : await
|
|
202
|
+
document.fullscreenElement ? await document.exitFullscreen() : await t.requestFullscreen();
|
|
203
203
|
} catch {
|
|
204
|
-
|
|
204
|
+
e({ description: h.fullscreenError });
|
|
205
205
|
}
|
|
206
|
-
}, [
|
|
206
|
+
}, [h.fullscreenError]);
|
|
207
207
|
b.useEffect(() => {
|
|
208
|
-
if (!
|
|
209
|
-
let
|
|
208
|
+
if (!t) return;
|
|
209
|
+
let e = (e) => {
|
|
210
210
|
e.key === "+" ? (e.preventDefault(), W()) : e.key === "-" ? (e.preventDefault(), G()) : e.key === "0" ? (e.preventDefault(), H()) : e.key === "f" || e.key === "F" ? (e.preventDefault(), Q()) : e.key === "[" ? (e.preventDefault(), J()) : e.key === "]" && (e.preventDefault(), Y());
|
|
211
211
|
};
|
|
212
|
-
return window.addEventListener("keydown",
|
|
213
|
-
window.removeEventListener("keydown",
|
|
212
|
+
return window.addEventListener("keydown", e), () => {
|
|
213
|
+
window.removeEventListener("keydown", e);
|
|
214
214
|
};
|
|
215
215
|
}, [
|
|
216
216
|
Q,
|
|
217
|
-
|
|
217
|
+
t,
|
|
218
218
|
H,
|
|
219
219
|
J,
|
|
220
220
|
Y,
|
|
@@ -225,12 +225,12 @@ function B({ open: e, onOpenChange: t, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
225
225
|
e.preventDefault(), e.stopPropagation(), e.deltaY < 0 ? W() : G();
|
|
226
226
|
}, [W, G]);
|
|
227
227
|
b.useEffect(() => {
|
|
228
|
-
if (!
|
|
229
|
-
let
|
|
230
|
-
if (
|
|
231
|
-
|
|
228
|
+
if (!t) return;
|
|
229
|
+
let e = g.current;
|
|
230
|
+
if (e) return e.addEventListener("wheel", $, { passive: !1 }), () => {
|
|
231
|
+
e.removeEventListener("wheel", $);
|
|
232
232
|
};
|
|
233
|
-
}, [$,
|
|
233
|
+
}, [$, t]);
|
|
234
234
|
let ye = b.useCallback((e) => {
|
|
235
235
|
L.current.set(e.pointerId, {
|
|
236
236
|
x: e.clientX,
|
|
@@ -248,7 +248,7 @@ function B({ open: e, onOpenChange: t, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
248
248
|
y: n.originY + (e.clientY - n.startY)
|
|
249
249
|
});
|
|
250
250
|
}, []), be = b.useCallback((e) => {
|
|
251
|
-
e &&
|
|
251
|
+
e && g.current?.hasPointerCapture(e.pointerId) && g.current.releasePointerCapture(e.pointerId), e && L.current.delete(e.pointerId), R.current = null, L.current.size < 2 && (B.current = null), I(!1);
|
|
252
252
|
}, []), xe = b.useCallback((e) => {
|
|
253
253
|
if (e.button !== 0 || j) return;
|
|
254
254
|
e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture(e.pointerId), L.current.set(e.pointerId, {
|
|
@@ -278,85 +278,85 @@ function B({ open: e, onOpenChange: t, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
278
278
|
N.y
|
|
279
279
|
]);
|
|
280
280
|
b.useEffect(() => {
|
|
281
|
-
if (!
|
|
282
|
-
let
|
|
283
|
-
let t =
|
|
281
|
+
if (!t) return;
|
|
282
|
+
let e = (e) => {
|
|
283
|
+
let t = g.current, n = e.target;
|
|
284
284
|
!t || !(n instanceof Node) || !t.contains(n) || !e.ctrlKey || $(e);
|
|
285
285
|
};
|
|
286
|
-
return window.addEventListener("wheel",
|
|
286
|
+
return window.addEventListener("wheel", e, {
|
|
287
287
|
passive: !1,
|
|
288
288
|
capture: !0
|
|
289
289
|
}), () => {
|
|
290
|
-
window.removeEventListener("wheel",
|
|
290
|
+
window.removeEventListener("wheel", e, { capture: !0 });
|
|
291
291
|
};
|
|
292
|
-
}, [$,
|
|
292
|
+
}, [$, t]);
|
|
293
293
|
let Se = b.useMemo(() => [
|
|
294
294
|
{
|
|
295
295
|
key: "zoom-in",
|
|
296
|
-
label:
|
|
296
|
+
label: h.zoomIn,
|
|
297
297
|
icon: le,
|
|
298
298
|
onClick: W,
|
|
299
299
|
disabled: j || x >= me
|
|
300
300
|
},
|
|
301
301
|
{
|
|
302
302
|
key: "zoom-out",
|
|
303
|
-
label:
|
|
303
|
+
label: h.zoomOut,
|
|
304
304
|
icon: ue,
|
|
305
305
|
onClick: G,
|
|
306
306
|
disabled: j || x <= pe
|
|
307
307
|
},
|
|
308
308
|
{
|
|
309
309
|
key: "fit",
|
|
310
|
-
label:
|
|
310
|
+
label: h.fit,
|
|
311
311
|
icon: re,
|
|
312
312
|
onClick: K,
|
|
313
313
|
disabled: j
|
|
314
314
|
},
|
|
315
315
|
{
|
|
316
316
|
key: "actual-size",
|
|
317
|
-
label:
|
|
317
|
+
label: h.actualSize,
|
|
318
318
|
icon: se,
|
|
319
319
|
onClick: q,
|
|
320
320
|
disabled: j
|
|
321
321
|
},
|
|
322
322
|
{
|
|
323
323
|
key: "reset",
|
|
324
|
-
label:
|
|
324
|
+
label: h.reset,
|
|
325
325
|
icon: ie,
|
|
326
326
|
onClick: H,
|
|
327
327
|
disabled: j
|
|
328
328
|
},
|
|
329
329
|
{
|
|
330
330
|
key: "rotate-left",
|
|
331
|
-
label:
|
|
331
|
+
label: h.rotateLeft,
|
|
332
332
|
icon: ae,
|
|
333
333
|
onClick: J,
|
|
334
334
|
disabled: j
|
|
335
335
|
},
|
|
336
336
|
{
|
|
337
337
|
key: "rotate-right",
|
|
338
|
-
label:
|
|
338
|
+
label: h.rotateRight,
|
|
339
339
|
icon: oe,
|
|
340
340
|
onClick: Y,
|
|
341
341
|
disabled: j
|
|
342
342
|
},
|
|
343
343
|
{
|
|
344
344
|
key: "fullscreen",
|
|
345
|
-
label:
|
|
345
|
+
label: h.fullscreen,
|
|
346
346
|
icon: ne,
|
|
347
347
|
onClick: () => void Q(),
|
|
348
348
|
disabled: !1
|
|
349
349
|
},
|
|
350
350
|
{
|
|
351
351
|
key: "download",
|
|
352
|
-
label:
|
|
352
|
+
label: h.download,
|
|
353
353
|
icon: te,
|
|
354
354
|
onClick: X,
|
|
355
355
|
disabled: j
|
|
356
356
|
},
|
|
357
357
|
{
|
|
358
358
|
key: "new-tab",
|
|
359
|
-
label:
|
|
359
|
+
label: h.openInNewTab,
|
|
360
360
|
icon: S,
|
|
361
361
|
onClick: Z,
|
|
362
362
|
disabled: !1
|
|
@@ -366,16 +366,16 @@ function B({ open: e, onOpenChange: t, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
366
366
|
Q,
|
|
367
367
|
Z,
|
|
368
368
|
j,
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
369
|
+
h.actualSize,
|
|
370
|
+
h.download,
|
|
371
|
+
h.fit,
|
|
372
|
+
h.fullscreen,
|
|
373
|
+
h.openInNewTab,
|
|
374
|
+
h.reset,
|
|
375
|
+
h.rotateLeft,
|
|
376
|
+
h.rotateRight,
|
|
377
|
+
h.zoomIn,
|
|
378
|
+
h.zoomOut,
|
|
379
379
|
H,
|
|
380
380
|
J,
|
|
381
381
|
Y,
|
|
@@ -385,16 +385,16 @@ function B({ open: e, onOpenChange: t, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
385
385
|
W,
|
|
386
386
|
G
|
|
387
387
|
]);
|
|
388
|
-
return /* @__PURE__ */ E(
|
|
389
|
-
open:
|
|
390
|
-
onOpenChange:
|
|
391
|
-
children: /* @__PURE__ */ D(
|
|
388
|
+
return /* @__PURE__ */ E(o, {
|
|
389
|
+
open: t,
|
|
390
|
+
onOpenChange: n,
|
|
391
|
+
children: /* @__PURE__ */ D(a, {
|
|
392
392
|
showCloseButton: !1,
|
|
393
393
|
className: "flex h-[min(94vh,980px)] w-[calc(100vw-0.75rem)] sm:w-[40rem] md:w-[52rem] lg:w-[64rem] xl:w-[74rem] 2xl:w-[86rem] max-w-[calc(100vw-0.75rem)] flex-col gap-3 border-zinc-800 bg-zinc-950 p-3 text-zinc-50 sm:max-w-[calc(100vw-2rem)] sm:p-4",
|
|
394
394
|
children: [
|
|
395
|
-
/* @__PURE__ */ E(
|
|
396
|
-
/* @__PURE__ */ E(
|
|
397
|
-
/* @__PURE__ */ D(
|
|
395
|
+
/* @__PURE__ */ E(s, { children: V }),
|
|
396
|
+
/* @__PURE__ */ E(i, { children: h.close }),
|
|
397
|
+
/* @__PURE__ */ D(l, {
|
|
398
398
|
delayDuration: 100,
|
|
399
399
|
children: [/* @__PURE__ */ D("div", {
|
|
400
400
|
className: "flex items-center justify-between gap-3 rounded-lg border border-zinc-800 bg-zinc-900/80 px-3 py-2",
|
|
@@ -406,19 +406,19 @@ function B({ open: e, onOpenChange: t, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
406
406
|
}), /* @__PURE__ */ D("p", {
|
|
407
407
|
className: "text-xs text-zinc-400",
|
|
408
408
|
children: [
|
|
409
|
-
O === "fit" ?
|
|
409
|
+
O === "fit" ? h.fit : `${Math.round(x * 100)}%`,
|
|
410
410
|
w === 0 ? "" : ` · ${w}deg`,
|
|
411
|
-
de ? ` · ${
|
|
411
|
+
de ? ` · ${h.fullscreen}` : ""
|
|
412
412
|
]
|
|
413
413
|
})]
|
|
414
|
-
}), /* @__PURE__ */ E(
|
|
414
|
+
}), /* @__PURE__ */ E(c, {
|
|
415
415
|
type: "button",
|
|
416
416
|
size: "icon",
|
|
417
417
|
variant: "ghost",
|
|
418
418
|
className: "h-9 w-9 shrink-0 text-zinc-100 hover:bg-zinc-800 hover:text-white",
|
|
419
|
-
onClick: () =>
|
|
420
|
-
"aria-label":
|
|
421
|
-
title:
|
|
419
|
+
onClick: () => n(!1),
|
|
420
|
+
"aria-label": h.close,
|
|
421
|
+
title: h.close,
|
|
422
422
|
children: /* @__PURE__ */ E(ce, { className: "h-4 w-4" })
|
|
423
423
|
})]
|
|
424
424
|
}), /* @__PURE__ */ E("div", {
|
|
@@ -427,9 +427,9 @@ function B({ open: e, onOpenChange: t, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
427
427
|
className: "flex min-w-max items-center gap-2",
|
|
428
428
|
children: Se.map((e) => {
|
|
429
429
|
let t = e.icon;
|
|
430
|
-
return /* @__PURE__ */ D(
|
|
430
|
+
return /* @__PURE__ */ D(_, { children: [/* @__PURE__ */ E(v, {
|
|
431
431
|
asChild: !0,
|
|
432
|
-
children: /* @__PURE__ */ E(
|
|
432
|
+
children: /* @__PURE__ */ E(c, {
|
|
433
433
|
type: "button",
|
|
434
434
|
size: "icon",
|
|
435
435
|
variant: "secondary",
|
|
@@ -440,13 +440,13 @@ function B({ open: e, onOpenChange: t, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
440
440
|
title: e.label,
|
|
441
441
|
children: /* @__PURE__ */ E(t, { className: "h-4 w-4" })
|
|
442
442
|
})
|
|
443
|
-
}), /* @__PURE__ */ E(
|
|
443
|
+
}), /* @__PURE__ */ E(y, { children: e.label })] }, e.key);
|
|
444
444
|
})
|
|
445
445
|
})
|
|
446
446
|
})]
|
|
447
447
|
}),
|
|
448
448
|
/* @__PURE__ */ E("div", {
|
|
449
|
-
ref:
|
|
449
|
+
ref: g,
|
|
450
450
|
className: "relative flex min-h-0 flex-1 items-center justify-center overflow-hidden rounded-xl border border-zinc-800 bg-[radial-gradient(circle_at_top,_rgba(255,255,255,0.08),_transparent_40%),linear-gradient(180deg,_rgba(24,24,27,0.9),_rgba(9,9,11,1))] p-4 touch-none",
|
|
451
451
|
onPointerDown: xe,
|
|
452
452
|
onPointerMove: ye,
|
|
@@ -461,18 +461,18 @@ function B({ open: e, onOpenChange: t, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
461
461
|
}),
|
|
462
462
|
/* @__PURE__ */ E("p", {
|
|
463
463
|
className: "text-sm font-medium",
|
|
464
|
-
children:
|
|
464
|
+
children: h.imageLoadError
|
|
465
465
|
}),
|
|
466
466
|
/* @__PURE__ */ E("p", {
|
|
467
467
|
className: "max-w-md text-xs text-zinc-400",
|
|
468
|
-
children:
|
|
468
|
+
children: u
|
|
469
469
|
})
|
|
470
470
|
]
|
|
471
471
|
}) : /* @__PURE__ */ E("img", {
|
|
472
472
|
ref: ee,
|
|
473
|
-
src:
|
|
473
|
+
src: u,
|
|
474
474
|
alt: V,
|
|
475
|
-
className:
|
|
475
|
+
className: r("max-h-full max-w-full select-none rounded-lg object-contain shadow-2xl", O === "fit" ? "h-auto w-auto" : ""),
|
|
476
476
|
style: U,
|
|
477
477
|
onError: () => M(!0),
|
|
478
478
|
draggable: !1
|
|
@@ -638,8 +638,8 @@ var Y = {
|
|
|
638
638
|
diff: "Diff",
|
|
639
639
|
text: "Text"
|
|
640
640
|
};
|
|
641
|
-
function X({ className:
|
|
642
|
-
let [
|
|
641
|
+
function X({ className: e, children: r, meta: i, codeHighlight: a, shikiBundle: o }) {
|
|
642
|
+
let [s, c] = b.useState(""), [l, u] = b.useState(!1), [f, m] = b.useState(!1), g = b.useMemo(() => i?.toLowerCase().includes("showlinenumbers") ?? !1, [i]), _ = /language-(\w+)/.exec(e || ""), v = _ ? _[1] : "text", y = d(v), te = Y[v.toLowerCase()] || v.toUpperCase(), S = b.useMemo(() => {
|
|
643
643
|
let e = "";
|
|
644
644
|
return e = typeof r == "string" ? r : b.Children.count(r) === 1 && typeof r == "string" ? String(r) : b.Children.toArray(r).map((e) => {
|
|
645
645
|
if (typeof e == "string") return e;
|
|
@@ -655,7 +655,7 @@ function X({ className: n, children: r, meta: i, codeHighlight: a, shikiBundle:
|
|
|
655
655
|
}, [r]);
|
|
656
656
|
b.useEffect(() => {
|
|
657
657
|
let e = () => {
|
|
658
|
-
|
|
658
|
+
u(document.documentElement.classList.contains("dark"));
|
|
659
659
|
};
|
|
660
660
|
e();
|
|
661
661
|
let t = new MutationObserver(() => e());
|
|
@@ -664,27 +664,27 @@ function X({ className: n, children: r, meta: i, codeHighlight: a, shikiBundle:
|
|
|
664
664
|
attributeFilter: ["class"]
|
|
665
665
|
}), () => t.disconnect();
|
|
666
666
|
}, []), b.useEffect(() => {
|
|
667
|
-
|
|
667
|
+
p(S, {
|
|
668
668
|
lang: y,
|
|
669
|
-
theme:
|
|
669
|
+
theme: h(l, a, o),
|
|
670
670
|
showLineNumbers: g
|
|
671
|
-
}, a,
|
|
671
|
+
}, a, o).then((e) => c(n(e)));
|
|
672
672
|
}, [
|
|
673
673
|
S,
|
|
674
674
|
y,
|
|
675
|
-
|
|
675
|
+
l,
|
|
676
676
|
g,
|
|
677
677
|
a,
|
|
678
|
-
|
|
678
|
+
o
|
|
679
679
|
]);
|
|
680
680
|
let ne = b.useCallback(async () => {
|
|
681
681
|
try {
|
|
682
|
-
await
|
|
682
|
+
await t(S), m(!0), setTimeout(() => m(!1), 2e3);
|
|
683
683
|
} catch (e) {
|
|
684
684
|
console.error("Failed to copy:", e);
|
|
685
685
|
}
|
|
686
686
|
}, [S]);
|
|
687
|
-
return
|
|
687
|
+
return s ? /* @__PURE__ */ D("div", {
|
|
688
688
|
className: "code-block-wrapper",
|
|
689
689
|
children: [
|
|
690
690
|
/* @__PURE__ */ E("span", {
|
|
@@ -694,13 +694,13 @@ function X({ className: n, children: r, meta: i, codeHighlight: a, shikiBundle:
|
|
|
694
694
|
/* @__PURE__ */ E("button", {
|
|
695
695
|
className: "code-copy-btn",
|
|
696
696
|
onClick: ne,
|
|
697
|
-
title:
|
|
697
|
+
title: f ? "已复制" : "复制代码",
|
|
698
698
|
"aria-label": "复制代码",
|
|
699
|
-
children:
|
|
699
|
+
children: f ? /* @__PURE__ */ E(ee, { className: "h-4 w-4 text-green-500" }) : /* @__PURE__ */ E(x, { className: "h-4 w-4" })
|
|
700
700
|
}),
|
|
701
701
|
/* @__PURE__ */ E("pre", {
|
|
702
702
|
className: `shiki-code-block${g ? " show-line-numbers" : ""}`,
|
|
703
|
-
dangerouslySetInnerHTML: { __html:
|
|
703
|
+
dangerouslySetInnerHTML: { __html: s }
|
|
704
704
|
})
|
|
705
705
|
]
|
|
706
706
|
}) : /* @__PURE__ */ E("div", {
|
|
@@ -808,17 +808,17 @@ function Z({ lang: e, viewerConfig: t, src: n, alt: r, title: i, className: a, n
|
|
|
808
808
|
}) : null;
|
|
809
809
|
}
|
|
810
810
|
function Q({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: r, shikiBundle: i }) {
|
|
811
|
-
let
|
|
811
|
+
let a = w(), o = a.lang || "zh-cn", s = a.version, c = m();
|
|
812
812
|
b.useEffect(() => {
|
|
813
|
-
|
|
813
|
+
u(r, i);
|
|
814
814
|
}, [r, i]);
|
|
815
|
-
let
|
|
815
|
+
let l = b.useMemo(() => {
|
|
816
816
|
if (!t) return e;
|
|
817
817
|
let n = e.split("\n"), r = !1;
|
|
818
818
|
return n.filter((e) => !r && e.startsWith("# ") ? (r = !0, !1) : !0).join("\n");
|
|
819
|
-
}, [e, t]),
|
|
819
|
+
}, [e, t]), d = b.useMemo(() => K(l), [l]), p = b.useMemo(() => {
|
|
820
820
|
let e = /* @__PURE__ */ new Map();
|
|
821
|
-
return
|
|
821
|
+
return c && Object.entries(c).forEach(([t, n]) => {
|
|
822
822
|
let r = b.memo(({ children: e, ...t }) => {
|
|
823
823
|
let r = J(t);
|
|
824
824
|
return b.createElement(n, r, e);
|
|
@@ -828,7 +828,7 @@ function Q({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: r, s
|
|
|
828
828
|
e.set(a, r);
|
|
829
829
|
}
|
|
830
830
|
}), e;
|
|
831
|
-
}, [
|
|
831
|
+
}, [c]), h = b.useMemo(() => Object.fromEntries(p), [p]);
|
|
832
832
|
return /* @__PURE__ */ E("div", {
|
|
833
833
|
className: "prose dark:prose-invert max-w-none",
|
|
834
834
|
children: /* @__PURE__ */ E(de, {
|
|
@@ -836,7 +836,7 @@ function Q({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: r, s
|
|
|
836
836
|
rehypePlugins: [
|
|
837
837
|
j,
|
|
838
838
|
M,
|
|
839
|
-
L(
|
|
839
|
+
L(h),
|
|
840
840
|
V,
|
|
841
841
|
[A, { behavior: "append" }],
|
|
842
842
|
[N, {
|
|
@@ -853,7 +853,7 @@ function Q({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: r, s
|
|
|
853
853
|
}]
|
|
854
854
|
],
|
|
855
855
|
components: {
|
|
856
|
-
...
|
|
856
|
+
...h,
|
|
857
857
|
table({ children: e, ...t }) {
|
|
858
858
|
return /* @__PURE__ */ E("div", {
|
|
859
859
|
className: "overflow-x-auto",
|
|
@@ -869,7 +869,7 @@ function Q({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: r, s
|
|
|
869
869
|
let e = n.props, t = e?.className || "", a = /language-(\w+)/.exec(t), o = a ? a[1].toLowerCase() : "text", s = e?.node, c = e?.children, l = e?.["data-raw-value"];
|
|
870
870
|
l && (c = l);
|
|
871
871
|
let u = s?.data?.meta || "";
|
|
872
|
-
return o === "mermaid" ? /* @__PURE__ */ E(
|
|
872
|
+
return o === "mermaid" ? /* @__PURE__ */ E(g, { chart: typeof c == "string" ? c : String(c || "") }) : /* @__PURE__ */ E(X, {
|
|
873
873
|
className: t,
|
|
874
874
|
meta: u,
|
|
875
875
|
codeHighlight: r,
|
|
@@ -894,7 +894,7 @@ function Q({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: r, s
|
|
|
894
894
|
...n,
|
|
895
895
|
children: t
|
|
896
896
|
}) : /* @__PURE__ */ E(C, {
|
|
897
|
-
to:
|
|
897
|
+
to: f(o, e.startsWith("/") ? e : `/${e}`, s),
|
|
898
898
|
...n,
|
|
899
899
|
children: t
|
|
900
900
|
}) : /* @__PURE__ */ E("a", {
|
|
@@ -902,20 +902,20 @@ function Q({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: r, s
|
|
|
902
902
|
children: t
|
|
903
903
|
});
|
|
904
904
|
},
|
|
905
|
-
img({ src: e, alt: t, title: r, className: i, node: a, ...
|
|
905
|
+
img({ src: e, alt: t, title: r, className: i, node: a, ...s }) {
|
|
906
906
|
return /* @__PURE__ */ E(Z, {
|
|
907
|
-
lang:
|
|
907
|
+
lang: o,
|
|
908
908
|
viewerConfig: n,
|
|
909
909
|
src: e,
|
|
910
910
|
alt: t,
|
|
911
911
|
title: r,
|
|
912
912
|
className: i,
|
|
913
913
|
node: a,
|
|
914
|
-
...
|
|
914
|
+
...s
|
|
915
915
|
});
|
|
916
916
|
}
|
|
917
917
|
},
|
|
918
|
-
children:
|
|
918
|
+
children: d
|
|
919
919
|
})
|
|
920
920
|
});
|
|
921
921
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "./utils-
|
|
2
|
-
import { l as t, r as n, t as r, u as i } from "./dialog-
|
|
1
|
+
import { t as e } from "./utils-C1xOyiTe.js";
|
|
2
|
+
import { l as t, r as n, t as r, u as i } from "./dialog-DisDZkkN.js";
|
|
3
3
|
import { Fragment as a, createContext as o, forwardRef as s, useCallback as c, useContext as l, useEffect as u, useRef as d, useState as f } from "react";
|
|
4
4
|
import { FileText as p, Loader2 as m, Search as h, X as g } from "lucide-react";
|
|
5
5
|
import { useNavigate as _ } from "react-router-dom";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, o as t, t as n } from "./SearchDialog-
|
|
1
|
+
import { a as e, o as t, t as n } from "./SearchDialog-CSsOqT7K.js";
|
|
2
2
|
import { useEffect as r } from "react";
|
|
3
3
|
import { jsx as i } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/search/SearchRuntime.tsx
|
package/dist/docs-app.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as e } from "./chunk-NBPlniwU.js";
|
|
2
|
-
import { t } from "./utils-
|
|
2
|
+
import { t } from "./utils-C1xOyiTe.js";
|
|
3
3
|
import * as n from "react";
|
|
4
4
|
import { createContext as r, useContext as i } from "react";
|
|
5
5
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|