react-docs-ui 0.7.6 → 0.8.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/dist/AIChatDialog-C2mEAX2T.js +407 -0
- package/dist/{AISelectionTrigger-SLyb8Vep.js → AISelectionTrigger-CWTJRvHo.js} +1 -1
- package/dist/{AISettingsPanel-Bsd_wLP4.js → AISettingsPanel-C9Bb_QtE.js} +1 -1
- package/dist/{DocsApp-CCFHuucK.js → DocsApp-CTh7Pa9A.js} +3797 -3560
- package/dist/{GlobalContextMenu-BtVjQk0v.js → GlobalContextMenu-DAIKsl1l.js} +1 -1
- package/dist/{MdxContent-CJydH4kW.js → MdxContent-BAm4izu3.js} +305 -317
- package/dist/{MdxContent.lazy-ChT4eAlU.js → MdxContent.lazy-vS9NrZj4.js} +1 -1
- package/dist/{SearchDialog-Dh1RvEgs.js → SearchDialog-CLbtpf7I.js} +157 -114
- package/dist/{SearchRuntime-wdAGDBv4.js → SearchRuntime--tjedqS6.js} +1 -1
- package/dist/{context-menu-BIQsQup7.js → context-menu-DwILPvwC.js} +1 -1
- package/dist/{dialog-D8otbqQL.js → dialog-D68sEJBe.js} +1 -1
- package/dist/docs-app.es.js +1 -1
- package/dist/{mdx-components-BLq-Umts.js → mdx-components-6beJPZgM.js} +2 -2
- package/dist/react-docs-ui.css +1 -1
- package/dist/react-docs-ui.es.js +10 -10
- package/dist/types/components/Breadcrumb.d.ts +14 -0
- package/dist/types/components/Breadcrumb.d.ts.map +1 -0
- package/dist/types/components/DocsLayout.d.ts.map +1 -1
- package/dist/types/components/MdxContent.d.ts.map +1 -1
- package/dist/types/components/ReadingProgressBar.d.ts +4 -0
- package/dist/types/components/ReadingProgressBar.d.ts.map +1 -0
- package/dist/types/components/ReleaseMetaBar.d.ts +1 -1
- package/dist/types/components/ReleaseMetaBar.d.ts.map +1 -1
- package/dist/types/components/ai/AIChatMessage.d.ts.map +1 -1
- package/dist/types/components/search/SearchItem.d.ts.map +1 -1
- package/dist/types/hooks/useScrollPosition.d.ts.map +1 -1
- package/dist/types/lib/changelog.d.ts +1 -1
- package/dist/types/lib/changelog.d.ts.map +1 -1
- package/dist/types/lib/config.d.ts +20 -0
- package/dist/types/lib/config.d.ts.map +1 -1
- package/dist/types/lib/reading-time.d.ts +7 -0
- package/dist/types/lib/reading-time.d.ts.map +1 -0
- package/dist/types/lib/search/index.d.ts +2 -1
- package/dist/types/lib/search/index.d.ts.map +1 -1
- package/dist/types/lib/search/runtime/highlighter.d.ts +10 -0
- package/dist/types/lib/search/runtime/highlighter.d.ts.map +1 -1
- package/dist/types/lib/utils.d.ts +2 -0
- package/dist/types/lib/utils.d.ts.map +1 -1
- package/dist/utils-KFBtT4Mx.js +25 -0
- package/package.json +147 -143
- package/scripts/cli.mjs +2 -0
- package/scripts/generate-feed.mjs +122 -0
- package/scripts/generate-sitemap.mjs +186 -0
- package/dist/AIChatDialog-BnAX3dRn.js +0 -418
- package/dist/utils-Ct96Mtjw.js +0 -8
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { t as e } from "./utils-
|
|
2
|
-
import { l as t, r as n, t as r, u as i } from "./dialog-
|
|
3
|
-
import {
|
|
4
|
-
import { FileText as
|
|
5
|
-
import { useNavigate as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import
|
|
1
|
+
import { t as e } from "./utils-KFBtT4Mx.js";
|
|
2
|
+
import { l as t, r as n, t as r, u as i } from "./dialog-D68sEJBe.js";
|
|
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
|
+
import { FileText as p, Loader2 as m, Search as h, X as g } from "lucide-react";
|
|
5
|
+
import { useNavigate as _ } from "react-router-dom";
|
|
6
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
7
|
+
import x from "flexsearch";
|
|
8
8
|
//#region src/lib/search/runtime/search-engine.ts
|
|
9
|
-
var
|
|
9
|
+
var S = 20, C = 150, w = class {
|
|
10
10
|
index;
|
|
11
11
|
sections = /* @__PURE__ */ new Map();
|
|
12
12
|
initialized = !1;
|
|
13
13
|
constructor() {
|
|
14
|
-
this.index = new
|
|
14
|
+
this.index = new x.Index({
|
|
15
15
|
tokenize: "full",
|
|
16
16
|
resolution: 9,
|
|
17
17
|
cache: 100
|
|
@@ -23,7 +23,7 @@ var b = 20, x = 150, S = class {
|
|
|
23
23
|
this.initialized = !0;
|
|
24
24
|
}
|
|
25
25
|
clear() {
|
|
26
|
-
this.sections.clear(), this.index = new
|
|
26
|
+
this.sections.clear(), this.index = new x.Index({
|
|
27
27
|
tokenize: "full",
|
|
28
28
|
resolution: 9,
|
|
29
29
|
cache: 100
|
|
@@ -31,7 +31,7 @@ var b = 20, x = 150, S = class {
|
|
|
31
31
|
}
|
|
32
32
|
search(e) {
|
|
33
33
|
if (!this.initialized) return [];
|
|
34
|
-
let { query: t, version: n, limit: r =
|
|
34
|
+
let { query: t, version: n, limit: r = S, snippetLength: i = C } = e, a = t.toLowerCase().trim();
|
|
35
35
|
if (!a) return [];
|
|
36
36
|
let o = Math.max(r * 5, r);
|
|
37
37
|
return this.index.search(a, { limit: o }).map((e) => {
|
|
@@ -69,10 +69,44 @@ var b = 20, x = 150, S = class {
|
|
|
69
69
|
getSectionCount() {
|
|
70
70
|
return this.sections.size;
|
|
71
71
|
}
|
|
72
|
-
},
|
|
72
|
+
}, T = new w();
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/lib/search/runtime/highlighter.ts
|
|
75
|
-
function
|
|
75
|
+
function E(e, t) {
|
|
76
|
+
if (!e || t.length === 0) return [{
|
|
77
|
+
text: e,
|
|
78
|
+
highlighted: !1
|
|
79
|
+
}];
|
|
80
|
+
let n = e.toLowerCase(), r = [];
|
|
81
|
+
for (let e of t) {
|
|
82
|
+
let t = e.toLowerCase(), i = 0;
|
|
83
|
+
for (;;) {
|
|
84
|
+
let a = n.indexOf(t, i);
|
|
85
|
+
if (a === -1) break;
|
|
86
|
+
r.push({
|
|
87
|
+
start: a,
|
|
88
|
+
end: a + e.length
|
|
89
|
+
}), i = a + 1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (r.length === 0) return [{
|
|
93
|
+
text: e,
|
|
94
|
+
highlighted: !1
|
|
95
|
+
}];
|
|
96
|
+
let i = O(r), a = [], o = 0;
|
|
97
|
+
for (let t of i) t.start > o && a.push({
|
|
98
|
+
text: e.slice(o, t.start),
|
|
99
|
+
highlighted: !1
|
|
100
|
+
}), a.push({
|
|
101
|
+
text: e.slice(t.start, t.end),
|
|
102
|
+
highlighted: !0
|
|
103
|
+
}), o = t.end;
|
|
104
|
+
return o < e.length && a.push({
|
|
105
|
+
text: e.slice(o),
|
|
106
|
+
highlighted: !1
|
|
107
|
+
}), a;
|
|
108
|
+
}
|
|
109
|
+
function D(e, t, n = "mark") {
|
|
76
110
|
if (!e || t.length === 0) return e;
|
|
77
111
|
let r = e.toLowerCase(), i = [];
|
|
78
112
|
for (let e of t) {
|
|
@@ -87,11 +121,11 @@ function w(e, t, n = "mark") {
|
|
|
87
121
|
}
|
|
88
122
|
}
|
|
89
123
|
if (i.length === 0) return e;
|
|
90
|
-
let a =
|
|
124
|
+
let a = O(i), o = "", s = 0;
|
|
91
125
|
for (let t of a) o += e.slice(s, t.start), o += `<${n}>`, o += e.slice(t.start, t.end), o += `</${n}>`, s = t.end;
|
|
92
126
|
return o += e.slice(s), o;
|
|
93
127
|
}
|
|
94
|
-
function
|
|
128
|
+
function O(e) {
|
|
95
129
|
if (e.length === 0) return [];
|
|
96
130
|
let t = [...e].sort((e, t) => e.start - t.start), n = [t[0]];
|
|
97
131
|
for (let e = 1; e < t.length; e++) {
|
|
@@ -100,7 +134,7 @@ function T(e) {
|
|
|
100
134
|
}
|
|
101
135
|
return n;
|
|
102
136
|
}
|
|
103
|
-
function
|
|
137
|
+
function k(e, t, n = {}) {
|
|
104
138
|
let { maxLength: r = 120, contextBefore: i = 30, contextAfter: a = 80 } = n;
|
|
105
139
|
if (!e) return "";
|
|
106
140
|
if (t.length === 0) return e.slice(0, r) + (e.length > r ? "..." : "");
|
|
@@ -113,37 +147,40 @@ function E(e, t, n = {}) {
|
|
|
113
147
|
let l = Math.max(0, s - i), u = Math.min(e.length, s + c.length + a), d = e.slice(l, u);
|
|
114
148
|
return l > 0 && (d = "..." + d), u < e.length && (d += "..."), d;
|
|
115
149
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
150
|
+
function A(e, t, n = {}) {
|
|
151
|
+
return D(k(e, t, n), t, n.tag || "mark");
|
|
118
152
|
}
|
|
119
|
-
function
|
|
153
|
+
function j(e, t, n = {}) {
|
|
154
|
+
return E(k(e, t, n), t);
|
|
155
|
+
}
|
|
156
|
+
function M(e) {
|
|
120
157
|
return e.toLowerCase().split(/[\s\-_]+/).filter((e) => e.length > 0);
|
|
121
158
|
}
|
|
122
159
|
//#endregion
|
|
123
160
|
//#region src/components/search/SearchProvider.tsx
|
|
124
|
-
var
|
|
125
|
-
function
|
|
126
|
-
let e =
|
|
161
|
+
var N = o(null);
|
|
162
|
+
function P() {
|
|
163
|
+
let e = l(N);
|
|
127
164
|
if (!e) throw Error("useSearch must be used within a SearchProvider");
|
|
128
165
|
return e;
|
|
129
166
|
}
|
|
130
|
-
function
|
|
131
|
-
let [
|
|
132
|
-
|
|
167
|
+
function F({ children: e, lang: t = "zh-cn", version: n, enabled: r = !0, maxResults: i = 20, snippetLength: a, enableHotkeys: o = !0 }) {
|
|
168
|
+
let [s, l] = f(!1), [p, m] = f(!1), [h, g] = f(null), [_, v] = f([]), [b, x] = f(""), [S, C] = f(!1), T = d(null), E = d(null), D = d(null), O = d(!1);
|
|
169
|
+
u(() => (T.current = new w(), () => {
|
|
133
170
|
T.current &&= (T.current.clear(), null);
|
|
134
|
-
}), []),
|
|
135
|
-
D.current && D.current !== t && (
|
|
136
|
-
}, [t]),
|
|
137
|
-
|
|
171
|
+
}), []), u(() => {
|
|
172
|
+
D.current && D.current !== t && (l(!1), D.current = null, v([]), x(""), T.current && T.current.clear());
|
|
173
|
+
}, [t]), u(() => {
|
|
174
|
+
v([]);
|
|
138
175
|
}, [n]);
|
|
139
|
-
let
|
|
140
|
-
if (!(
|
|
176
|
+
let k = c(async () => {
|
|
177
|
+
if (!(s && D.current === t || O.current || !r)) {
|
|
141
178
|
O.current = !0, m(!0), g(null);
|
|
142
179
|
try {
|
|
143
180
|
let e = await fetch(`/search-index-${t}.json`);
|
|
144
181
|
if (!e.ok) throw Error(`Failed to load search index: ${e.status}`);
|
|
145
182
|
let n = await e.json();
|
|
146
|
-
T.current && T.current.init(n), D.current = t,
|
|
183
|
+
T.current && T.current.init(n), D.current = t, l(!0);
|
|
147
184
|
} catch (e) {
|
|
148
185
|
g(e instanceof Error ? e.message : "Failed to load search index");
|
|
149
186
|
} finally {
|
|
@@ -152,11 +189,11 @@ function j({ children: e, lang: t = "zh-cn", version: n, enabled: r = !0, maxRes
|
|
|
152
189
|
}
|
|
153
190
|
}, [
|
|
154
191
|
t,
|
|
155
|
-
|
|
192
|
+
s,
|
|
156
193
|
r
|
|
157
|
-
]),
|
|
158
|
-
if (!e.trim()) return
|
|
159
|
-
T.current?.isInitialized() || await
|
|
194
|
+
]), A = c(async (e) => {
|
|
195
|
+
if (!e.trim()) return v([]), [];
|
|
196
|
+
T.current?.isInitialized() || await k();
|
|
160
197
|
let r = {
|
|
161
198
|
query: e,
|
|
162
199
|
lang: t,
|
|
@@ -166,63 +203,63 @@ function j({ children: e, lang: t = "zh-cn", version: n, enabled: r = !0, maxRes
|
|
|
166
203
|
};
|
|
167
204
|
if (T.current) {
|
|
168
205
|
let e = T.current.search(r);
|
|
169
|
-
return
|
|
206
|
+
return v(e), e;
|
|
170
207
|
}
|
|
171
208
|
return [];
|
|
172
209
|
}, [
|
|
173
210
|
t,
|
|
174
211
|
n,
|
|
175
|
-
|
|
212
|
+
k,
|
|
176
213
|
i,
|
|
177
214
|
a
|
|
178
215
|
]);
|
|
179
|
-
|
|
216
|
+
u(() => {
|
|
180
217
|
if (!b.trim()) {
|
|
181
|
-
|
|
218
|
+
v([]);
|
|
182
219
|
return;
|
|
183
220
|
}
|
|
184
221
|
return E.current && clearTimeout(E.current), E.current = setTimeout(() => {
|
|
185
|
-
|
|
222
|
+
A(b);
|
|
186
223
|
}, 150), () => {
|
|
187
224
|
E.current && clearTimeout(E.current);
|
|
188
225
|
};
|
|
189
|
-
}, [b,
|
|
190
|
-
|
|
226
|
+
}, [b, A]), u(() => {
|
|
227
|
+
S && !s && !O.current && k();
|
|
191
228
|
}, [
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
]),
|
|
229
|
+
S,
|
|
230
|
+
s,
|
|
231
|
+
k
|
|
232
|
+
]), u(() => {
|
|
196
233
|
if (!o) return;
|
|
197
234
|
let e = (e) => {
|
|
198
|
-
(e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k" && (e.preventDefault(),
|
|
235
|
+
(e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k" && (e.preventDefault(), C((e) => !e)), e.key === "Escape" && S && C(!1);
|
|
199
236
|
};
|
|
200
237
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
201
|
-
}, [o,
|
|
202
|
-
let
|
|
203
|
-
isLoaded:
|
|
238
|
+
}, [o, S]);
|
|
239
|
+
let j = {
|
|
240
|
+
isLoaded: s,
|
|
204
241
|
isLoading: p,
|
|
205
242
|
error: h,
|
|
206
|
-
search:
|
|
207
|
-
results:
|
|
243
|
+
search: A,
|
|
244
|
+
results: _,
|
|
208
245
|
query: b,
|
|
209
246
|
setQuery: x,
|
|
210
|
-
open:
|
|
211
|
-
setOpen:
|
|
212
|
-
loadIndex:
|
|
247
|
+
open: S,
|
|
248
|
+
setOpen: C,
|
|
249
|
+
loadIndex: k
|
|
213
250
|
};
|
|
214
|
-
return /* @__PURE__ */
|
|
215
|
-
value:
|
|
251
|
+
return /* @__PURE__ */ y(N.Provider, {
|
|
252
|
+
value: j,
|
|
216
253
|
children: e
|
|
217
254
|
});
|
|
218
255
|
}
|
|
219
256
|
//#endregion
|
|
220
257
|
//#region src/components/search/SearchInput.tsx
|
|
221
|
-
var
|
|
258
|
+
var I = s(({ value: t, onChange: n, onClear: r, className: i, placeholder: a, ...o }, s) => /* @__PURE__ */ b("div", {
|
|
222
259
|
className: "flex items-center gap-3 px-4 py-3 border-b",
|
|
223
260
|
children: [
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ y(h, { className: "h-5 w-5 shrink-0 text-muted-foreground" }),
|
|
262
|
+
/* @__PURE__ */ y("input", {
|
|
226
263
|
ref: s,
|
|
227
264
|
type: "text",
|
|
228
265
|
value: t,
|
|
@@ -231,63 +268,69 @@ var M = o(({ value: t, onChange: n, onClear: r, className: i, placeholder: a, ..
|
|
|
231
268
|
className: e("flex-1 bg-transparent text-base outline-none placeholder:text-muted-foreground", i),
|
|
232
269
|
...o
|
|
233
270
|
}),
|
|
234
|
-
t && r && /* @__PURE__ */
|
|
271
|
+
t && r && /* @__PURE__ */ y("button", {
|
|
235
272
|
type: "button",
|
|
236
273
|
onClick: r,
|
|
237
274
|
className: "p-1 rounded hover:bg-muted transition-colors",
|
|
238
|
-
children: /* @__PURE__ */
|
|
275
|
+
children: /* @__PURE__ */ y(g, { className: "h-4 w-4 text-muted-foreground" })
|
|
239
276
|
})
|
|
240
277
|
]
|
|
241
278
|
}));
|
|
242
|
-
|
|
279
|
+
I.displayName = "SearchInput";
|
|
243
280
|
//#endregion
|
|
244
281
|
//#region src/components/search/SearchItem.tsx
|
|
245
|
-
|
|
246
|
-
|
|
282
|
+
function L({ segments: e }) {
|
|
283
|
+
return /* @__PURE__ */ y(v, { children: e.map((e, t) => e.highlighted ? /* @__PURE__ */ y("mark", {
|
|
284
|
+
className: "bg-primary/20 text-foreground rounded-sm px-0.5",
|
|
285
|
+
children: e.text
|
|
286
|
+
}, t) : /* @__PURE__ */ y(a, { children: e.text }, t)) });
|
|
287
|
+
}
|
|
288
|
+
var R = s(({ result: t, query: n, isSelected: r, onClick: i, onMouseEnter: a }, o) => {
|
|
289
|
+
let s = M(n), c = j(t.sectionTitle, s, {
|
|
247
290
|
maxLength: 100,
|
|
248
291
|
contextBefore: 0,
|
|
249
292
|
contextAfter: 0
|
|
250
|
-
}), l =
|
|
251
|
-
return /* @__PURE__ */
|
|
293
|
+
}), l = j(t.snippet, s, { maxLength: 150 });
|
|
294
|
+
return /* @__PURE__ */ b("div", {
|
|
252
295
|
ref: o,
|
|
253
296
|
onClick: i,
|
|
254
297
|
onMouseEnter: a,
|
|
255
298
|
className: e("flex items-start gap-3 px-4 py-3 cursor-pointer transition-all duration-200 border-l-2 rounded-r-md mx-2", "hover:shadow-sm hover:translate-x-0.5", r ? "bg-accent/80 border-l-primary shadow-md scale-[1.02] translate-x-1" : "hover:bg-muted/50 border-l-transparent"),
|
|
256
|
-
children: [/* @__PURE__ */
|
|
299
|
+
children: [/* @__PURE__ */ y(p, { className: "h-4 w-4 mt-0.5 shrink-0 text-muted-foreground" }), /* @__PURE__ */ b("div", {
|
|
257
300
|
className: "flex-1 min-w-0",
|
|
258
301
|
children: [
|
|
259
|
-
/* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ y("div", {
|
|
260
303
|
className: "flex items-center gap-2",
|
|
261
|
-
children: /* @__PURE__ */
|
|
304
|
+
children: /* @__PURE__ */ y("span", {
|
|
262
305
|
className: "font-medium text-sm truncate",
|
|
263
|
-
|
|
306
|
+
children: /* @__PURE__ */ y(L, { segments: c })
|
|
264
307
|
})
|
|
265
308
|
}),
|
|
266
|
-
t.pageTitle !== t.sectionTitle && /* @__PURE__ */
|
|
309
|
+
t.pageTitle !== t.sectionTitle && /* @__PURE__ */ y("div", {
|
|
267
310
|
className: "text-xs text-muted-foreground truncate mt-0.5",
|
|
268
311
|
children: t.pageTitle
|
|
269
312
|
}),
|
|
270
|
-
l && /* @__PURE__ */
|
|
313
|
+
l.length > 0 && l.some((e) => e.text) && /* @__PURE__ */ y("div", {
|
|
271
314
|
className: "text-xs text-muted-foreground mt-1 line-clamp-2",
|
|
272
|
-
|
|
315
|
+
children: /* @__PURE__ */ y(L, { segments: l })
|
|
273
316
|
})
|
|
274
317
|
]
|
|
275
318
|
})]
|
|
276
319
|
});
|
|
277
320
|
});
|
|
278
|
-
|
|
321
|
+
R.displayName = "SearchItem";
|
|
279
322
|
//#endregion
|
|
280
323
|
//#region src/components/search/SearchResults.tsx
|
|
281
|
-
function
|
|
282
|
-
let [r, i] =
|
|
283
|
-
|
|
324
|
+
function z({ results: e, query: t, onSelect: n }) {
|
|
325
|
+
let [r, i] = f(0), a = d(null), o = d(null);
|
|
326
|
+
u(() => {
|
|
284
327
|
i(0);
|
|
285
|
-
}, [e]),
|
|
328
|
+
}, [e]), u(() => {
|
|
286
329
|
if (o.current && a.current) {
|
|
287
330
|
let e = a.current, t = o.current, n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
288
331
|
(r.bottom > n.bottom || r.top < n.top) && t.scrollIntoView({ block: "nearest" });
|
|
289
332
|
}
|
|
290
|
-
}, [r]),
|
|
333
|
+
}, [r]), u(() => {
|
|
291
334
|
let t = (t) => {
|
|
292
335
|
if (t.key === "ArrowDown") t.preventDefault(), i((t) => Math.min(t + 1, e.length - 1));
|
|
293
336
|
else if (t.key === "ArrowUp") t.preventDefault(), i((e) => Math.max(e - 1, 0));
|
|
@@ -306,10 +349,10 @@ function P({ results: e, query: t, onSelect: n }) {
|
|
|
306
349
|
let s = (e) => {
|
|
307
350
|
n(e.url);
|
|
308
351
|
};
|
|
309
|
-
return /* @__PURE__ */
|
|
352
|
+
return /* @__PURE__ */ y("div", {
|
|
310
353
|
ref: a,
|
|
311
354
|
className: "py-2",
|
|
312
|
-
children: e.map((e, n) => /* @__PURE__ */
|
|
355
|
+
children: e.map((e, n) => /* @__PURE__ */ y(R, {
|
|
313
356
|
result: e,
|
|
314
357
|
query: t,
|
|
315
358
|
isSelected: n === r,
|
|
@@ -321,49 +364,49 @@ function P({ results: e, query: t, onSelect: n }) {
|
|
|
321
364
|
}
|
|
322
365
|
//#endregion
|
|
323
366
|
//#region src/components/search/SearchDialog.tsx
|
|
324
|
-
function
|
|
325
|
-
let { open: a, setOpen: o, query: s, setQuery: c, results:
|
|
326
|
-
return
|
|
327
|
-
a &&
|
|
328
|
-
}, [a]),
|
|
367
|
+
function B({ placeholder: e }) {
|
|
368
|
+
let { open: a, setOpen: o, query: s, setQuery: c, results: l, isLoading: f, error: p, isLoaded: h } = P(), g = _(), v = d(null);
|
|
369
|
+
return u(() => {
|
|
370
|
+
a && v.current && setTimeout(() => v.current?.focus(), 0);
|
|
371
|
+
}, [a]), u(() => {
|
|
329
372
|
a || c("");
|
|
330
|
-
}, [a, c]), /* @__PURE__ */
|
|
373
|
+
}, [a, c]), /* @__PURE__ */ y(r, {
|
|
331
374
|
open: a,
|
|
332
375
|
onOpenChange: (e) => {
|
|
333
376
|
o(e);
|
|
334
377
|
},
|
|
335
|
-
children: /* @__PURE__ */
|
|
378
|
+
children: /* @__PURE__ */ b(n, {
|
|
336
379
|
className: "overflow-hidden p-0 shadow-lg max-w-xl top-[15%] translate-y-0",
|
|
337
380
|
showCloseButton: !1,
|
|
338
381
|
children: [
|
|
339
|
-
/* @__PURE__ */
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ y(i, { children: "搜索文档" }),
|
|
383
|
+
/* @__PURE__ */ y(t, { children: "搜索文档内容" }),
|
|
384
|
+
/* @__PURE__ */ b("div", {
|
|
342
385
|
className: "flex flex-col",
|
|
343
386
|
children: [
|
|
344
|
-
/* @__PURE__ */
|
|
345
|
-
ref:
|
|
387
|
+
/* @__PURE__ */ y(I, {
|
|
388
|
+
ref: v,
|
|
346
389
|
value: s,
|
|
347
390
|
onChange: c,
|
|
348
391
|
placeholder: e,
|
|
349
392
|
onClear: () => c("")
|
|
350
393
|
}),
|
|
351
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ b("div", {
|
|
352
395
|
className: "max-h-[60vh] overflow-y-auto border-t",
|
|
353
396
|
children: [
|
|
354
|
-
f && !h && /* @__PURE__ */
|
|
397
|
+
f && !h && /* @__PURE__ */ y("div", {
|
|
355
398
|
className: "flex items-center justify-center py-12",
|
|
356
|
-
children: /* @__PURE__ */
|
|
399
|
+
children: /* @__PURE__ */ y(m, { className: "h-6 w-6 animate-spin text-muted-foreground" })
|
|
357
400
|
}),
|
|
358
|
-
|
|
401
|
+
p && /* @__PURE__ */ y("div", {
|
|
359
402
|
className: "px-4 py-8 text-center text-sm text-muted-foreground",
|
|
360
|
-
children:
|
|
403
|
+
children: p
|
|
361
404
|
}),
|
|
362
|
-
h && !f && !s && /* @__PURE__ */
|
|
405
|
+
h && !f && !s && /* @__PURE__ */ y("div", {
|
|
363
406
|
className: "px-4 py-8 text-center text-sm text-muted-foreground",
|
|
364
407
|
children: "输入关键词搜索文档"
|
|
365
408
|
}),
|
|
366
|
-
h && s &&
|
|
409
|
+
h && s && l.length === 0 && !f && /* @__PURE__ */ b("div", {
|
|
367
410
|
className: "px-4 py-8 text-center text-sm text-muted-foreground",
|
|
368
411
|
children: [
|
|
369
412
|
"未找到 \"",
|
|
@@ -371,35 +414,35 @@ function F({ placeholder: e }) {
|
|
|
371
414
|
"\" 相关结果"
|
|
372
415
|
]
|
|
373
416
|
}),
|
|
374
|
-
|
|
375
|
-
results:
|
|
417
|
+
l.length > 0 && /* @__PURE__ */ y(z, {
|
|
418
|
+
results: l,
|
|
376
419
|
query: s,
|
|
377
420
|
onSelect: (e) => {
|
|
378
|
-
|
|
421
|
+
g(e), o(!1);
|
|
379
422
|
}
|
|
380
423
|
})
|
|
381
424
|
]
|
|
382
425
|
}),
|
|
383
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ b("div", {
|
|
384
427
|
className: "flex items-center justify-between border-t px-4 py-2 text-xs text-muted-foreground bg-muted/30",
|
|
385
|
-
children: [/* @__PURE__ */
|
|
428
|
+
children: [/* @__PURE__ */ b("div", {
|
|
386
429
|
className: "flex items-center gap-4",
|
|
387
|
-
children: [/* @__PURE__ */
|
|
430
|
+
children: [/* @__PURE__ */ b("span", {
|
|
388
431
|
className: "flex items-center gap-1",
|
|
389
|
-
children: [/* @__PURE__ */
|
|
432
|
+
children: [/* @__PURE__ */ y("kbd", {
|
|
390
433
|
className: "px-1.5 py-0.5 rounded bg-muted border text-[10px]",
|
|
391
434
|
children: "↵"
|
|
392
435
|
}), "选择"]
|
|
393
|
-
}), /* @__PURE__ */
|
|
436
|
+
}), /* @__PURE__ */ b("span", {
|
|
394
437
|
className: "flex items-center gap-1",
|
|
395
|
-
children: [/* @__PURE__ */
|
|
438
|
+
children: [/* @__PURE__ */ y("kbd", {
|
|
396
439
|
className: "px-1.5 py-0.5 rounded bg-muted border text-[10px]",
|
|
397
440
|
children: "↑↓"
|
|
398
441
|
}), "导航"]
|
|
399
442
|
})]
|
|
400
|
-
}), /* @__PURE__ */
|
|
443
|
+
}), /* @__PURE__ */ b("span", {
|
|
401
444
|
className: "flex items-center gap-1",
|
|
402
|
-
children: [/* @__PURE__ */
|
|
445
|
+
children: [/* @__PURE__ */ y("kbd", {
|
|
403
446
|
className: "px-1.5 py-0.5 rounded bg-muted border text-[10px]",
|
|
404
447
|
children: "esc"
|
|
405
448
|
}), "关闭"]
|
|
@@ -412,4 +455,4 @@ function F({ placeholder: e }) {
|
|
|
412
455
|
});
|
|
413
456
|
}
|
|
414
457
|
//#endregion
|
|
415
|
-
export {
|
|
458
|
+
export { F as a, A as c, w as d, T as f, I as i, D as l, z as n, P as o, R as r, k as s, B as t, M as u };
|
|
@@ -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-CLbtpf7I.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-KFBtT4Mx.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";
|
|
@@ -7272,7 +7272,7 @@ function Rc({ chart: e }) {
|
|
|
7272
7272
|
return Ic ||= (r.initialize({
|
|
7273
7273
|
startOnLoad: !1,
|
|
7274
7274
|
theme: "default",
|
|
7275
|
-
securityLevel: "
|
|
7275
|
+
securityLevel: "strict"
|
|
7276
7276
|
}), !0), r.render(`mermaid-${t}`, e);
|
|
7277
7277
|
}).then((e) => {
|
|
7278
7278
|
n || i(e.svg);
|