react-docs-ui 0.6.13 → 0.6.15
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 +13 -0
- package/dist/AIChatDialog-W60DtiEW.js +418 -0
- package/dist/AIProvider-C1_b1iKH.js +1066 -0
- package/dist/AISelectionTrigger-MaBGhxTE.js +86 -0
- package/dist/AISettingsPanel-aiMnncnQ.js +524 -0
- package/dist/DocsApp-BBNDiw8A.js +23556 -0
- package/dist/GlobalContextMenu-DG6x5Y5w.js +278 -0
- package/dist/MdxContent-CMB8ZbXo.js +850 -0
- package/dist/MdxContent.lazy-C4rcCv4v.js +1768 -0
- package/dist/SearchDialog-tUSKKsxW.js +403 -0
- package/dist/SearchRuntime-5fXpxDsi.js +23 -0
- package/dist/context-menu-CB7erSoV.js +73 -0
- package/dist/dialog-DQ6nkP0y.js +97 -0
- package/dist/docs-app.es.d.ts +1 -0
- package/dist/docs-app.es.js +7 -9
- package/dist/react-docs-ui.css +2 -1
- package/dist/react-docs-ui.es.js +66 -195
- package/dist/shiki-highlighter-BmQSSJpS.js +7194 -0
- package/dist/theme-provider-fNhx9xK0.js +37 -0
- package/dist/types/components/DocsLayout.d.ts +1 -31
- package/dist/types/components/DocsLayout.d.ts.map +1 -1
- package/dist/types/components/Footer.d.ts +3 -28
- package/dist/types/components/Footer.d.ts.map +1 -1
- package/dist/types/components/HeaderNav.d.ts.map +1 -1
- package/dist/types/components/MdxContent.d.ts.map +1 -1
- package/dist/types/components/MobileSidebar.d.ts +1 -1
- package/dist/types/components/MobileSidebar.d.ts.map +1 -1
- package/dist/types/components/PageNavigation.d.ts +1 -1
- package/dist/types/components/PageNavigation.d.ts.map +1 -1
- package/dist/types/components/SidebarNav.d.ts +1 -1
- package/dist/types/components/SidebarNav.d.ts.map +1 -1
- package/dist/types/components/TableOfContents.d.ts +1 -1
- package/dist/types/components/TableOfContents.d.ts.map +1 -1
- package/dist/types/components/ai/AIChatDialog.d.ts +1 -1
- package/dist/types/components/ai/AIChatDialog.d.ts.map +1 -1
- package/dist/types/components/ai/AISelectionTrigger.d.ts +1 -1
- package/dist/types/components/ai/AISelectionTrigger.d.ts.map +1 -1
- package/dist/types/components/ai/AISettingsPanel.d.ts +1 -1
- package/dist/types/components/ai/AISettingsPanel.d.ts.map +1 -1
- package/dist/types/components/search/SearchItem.d.ts +1 -2
- package/dist/types/components/search/SearchItem.d.ts.map +1 -1
- package/dist/types/components/ui/button.d.ts +4 -4
- package/dist/types/components/ui/button.d.ts.map +1 -1
- package/dist/types/components/ui/toast.d.ts +3 -3
- package/dist/types/components/ui/toast.d.ts.map +1 -1
- package/dist/types/external-modules.d.ts +38 -0
- package/dist/types/generated/shiki-bundle.d.ts +1 -0
- package/dist/types/generated/shiki-bundle.d.ts.map +1 -1
- package/dist/types/lib/ai/crypto.d.ts.map +1 -1
- package/dist/types/lib/config.d.ts +0 -4
- package/dist/types/lib/config.d.ts.map +1 -1
- package/dist/types/lib/export-utils.d.ts.map +1 -1
- package/dist/types/lib/frontmatter.d.ts +6 -0
- package/dist/types/lib/frontmatter.d.ts.map +1 -0
- package/dist/types/lib/rehype-toc.d.ts.map +1 -1
- package/dist/types/lib/search/search-index-plugin.d.ts.map +1 -1
- package/dist/types/lib/shiki-highlighter.d.ts.map +1 -1
- package/dist/types/mdast.d.ts +53 -0
- package/dist/use-toast-d9VPBjMn.js +98 -0
- package/dist/utils-Ct96Mtjw.js +8 -0
- package/package.json +23 -24
- package/dist/AISettingsPanel-KzfonkeY.js +0 -1171
- package/dist/DocsApp-DTFpyBOl.js +0 -35170
- package/dist/GlobalContextMenu-hGNTKw3S.js +0 -210
- package/dist/MdxContent-B664V_Hk.js +0 -812
- package/dist/MdxContent.lazy-DsQt7MZQ.js +0 -1512
- package/dist/SearchDialog-Cfam5kUW.js +0 -406
- package/dist/SearchRuntime-Dk265vam.js +0 -31
- package/dist/context-menu-CBGG4zJl.js +0 -140
- package/dist/index-ByXnCzVt.js +0 -12
|
@@ -0,0 +1,278 @@
|
|
|
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-CB7erSoV.js";
|
|
3
|
+
import { useCallback as p } from "react";
|
|
4
|
+
import { useLocation as m, useNavigate as h } from "react-router-dom";
|
|
5
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/GlobalContextMenu.tsx
|
|
7
|
+
var y = {
|
|
8
|
+
"zh-cn": {
|
|
9
|
+
page: "页面",
|
|
10
|
+
copyUrl: "复制当前链接",
|
|
11
|
+
copyTitle: "复制页面标题",
|
|
12
|
+
copyMarkdownLink: "复制 Markdown 链接",
|
|
13
|
+
copySelectedText: "复制",
|
|
14
|
+
openInNewTab: "在新标签页打开",
|
|
15
|
+
reload: "刷新",
|
|
16
|
+
printPage: "打印页面",
|
|
17
|
+
scrollToTop: "回到顶部",
|
|
18
|
+
scrollToBottom: "滚动到底部",
|
|
19
|
+
site: "站点",
|
|
20
|
+
goHome: "返回首页",
|
|
21
|
+
quickNav: "快速跳转",
|
|
22
|
+
docsIndex: "文档首页",
|
|
23
|
+
guide: "指南",
|
|
24
|
+
introduction: "简介",
|
|
25
|
+
installation: "安装",
|
|
26
|
+
quickStart: "快速开始",
|
|
27
|
+
configuration: "配置",
|
|
28
|
+
language: "语言",
|
|
29
|
+
appearance: "外观",
|
|
30
|
+
theme: "主题",
|
|
31
|
+
light: "浅色",
|
|
32
|
+
dark: "深色",
|
|
33
|
+
system: "跟随系统",
|
|
34
|
+
resetThemePref: "重置主题偏好"
|
|
35
|
+
},
|
|
36
|
+
en: {
|
|
37
|
+
page: "Page",
|
|
38
|
+
copyUrl: "Copy Current URL",
|
|
39
|
+
copyTitle: "Copy Page Title",
|
|
40
|
+
copyMarkdownLink: "Copy Markdown Link",
|
|
41
|
+
copySelectedText: "Copy",
|
|
42
|
+
openInNewTab: "Open in New Tab",
|
|
43
|
+
reload: "Reload",
|
|
44
|
+
printPage: "Print Page",
|
|
45
|
+
scrollToTop: "Scroll to Top",
|
|
46
|
+
scrollToBottom: "Scroll to Bottom",
|
|
47
|
+
site: "Site",
|
|
48
|
+
goHome: "Go Home",
|
|
49
|
+
quickNav: "Quick Navigation",
|
|
50
|
+
docsIndex: "Docs Index",
|
|
51
|
+
guide: "Guide",
|
|
52
|
+
introduction: "Introduction",
|
|
53
|
+
installation: "Installation",
|
|
54
|
+
quickStart: "Quick Start",
|
|
55
|
+
configuration: "Configuration",
|
|
56
|
+
language: "Language",
|
|
57
|
+
appearance: "Appearance",
|
|
58
|
+
theme: "Theme",
|
|
59
|
+
light: "Light",
|
|
60
|
+
dark: "Dark",
|
|
61
|
+
system: "System",
|
|
62
|
+
resetThemePref: "Reset Theme Preference"
|
|
63
|
+
}
|
|
64
|
+
}, b = {
|
|
65
|
+
enabled: !0,
|
|
66
|
+
page: {
|
|
67
|
+
copyUrl: !0,
|
|
68
|
+
copyTitle: !0,
|
|
69
|
+
copyMarkdownLink: !0,
|
|
70
|
+
copySelectedText: !0,
|
|
71
|
+
openInNewTab: !0,
|
|
72
|
+
reload: !0,
|
|
73
|
+
printPage: !0,
|
|
74
|
+
scrollToTop: !0,
|
|
75
|
+
scrollToBottom: !0
|
|
76
|
+
},
|
|
77
|
+
site: {
|
|
78
|
+
goHome: !0,
|
|
79
|
+
quickNav: !0,
|
|
80
|
+
language: !0
|
|
81
|
+
},
|
|
82
|
+
appearance: {
|
|
83
|
+
theme: !0,
|
|
84
|
+
resetThemePref: !0
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
function x({ children: x, config: S }) {
|
|
88
|
+
let C = h(), w = m(), { theme: T, setTheme: E } = e(), D = p(async (e) => {
|
|
89
|
+
if (navigator.clipboard && window.isSecureContext) await navigator.clipboard.writeText(e);
|
|
90
|
+
else {
|
|
91
|
+
let t = document.createElement("textarea");
|
|
92
|
+
t.value = e, t.style.position = "fixed", t.style.left = "-9999px", t.style.top = "-9999px", document.body.appendChild(t), t.focus(), t.select();
|
|
93
|
+
try {
|
|
94
|
+
document.execCommand("copy");
|
|
95
|
+
} finally {
|
|
96
|
+
document.body.removeChild(t);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, []), O = p(async () => {
|
|
100
|
+
try {
|
|
101
|
+
await D(window.location.href);
|
|
102
|
+
} catch {}
|
|
103
|
+
}, [D]), k = p(async () => {
|
|
104
|
+
try {
|
|
105
|
+
await D(document.title || "");
|
|
106
|
+
} catch {}
|
|
107
|
+
}, [D]), A = p(async () => {
|
|
108
|
+
try {
|
|
109
|
+
let e = document.title || "Docs", t = window.location.href;
|
|
110
|
+
await D(`[${e}](${t})`);
|
|
111
|
+
} catch {}
|
|
112
|
+
}, [D]), j = p(async () => {
|
|
113
|
+
try {
|
|
114
|
+
let e = window.getSelection()?.toString() || "";
|
|
115
|
+
e && await D(e);
|
|
116
|
+
} catch {}
|
|
117
|
+
}, [D]), M = p(() => {
|
|
118
|
+
window.open(window.location.href, "_blank");
|
|
119
|
+
}, []), N = p(() => {
|
|
120
|
+
window.location.reload();
|
|
121
|
+
}, []), P = p(() => C("/"), [C]), F = w.pathname.startsWith("/en") ? "en" : "zh-cn", I = y[F], L = p((e) => {
|
|
122
|
+
let t = w.pathname.split("/").filter(Boolean);
|
|
123
|
+
t.length > 0 && (t[0] === "en" || t[0] === "zh-cn") ? t[0] = e : t.unshift(e), C("/" + t.join("/"));
|
|
124
|
+
}, [w.pathname, C]), R = p(() => window.scrollTo({
|
|
125
|
+
top: 0,
|
|
126
|
+
behavior: "smooth"
|
|
127
|
+
}), []), z = p(() => window.scrollTo({
|
|
128
|
+
top: document.documentElement.scrollHeight,
|
|
129
|
+
behavior: "smooth"
|
|
130
|
+
}), []), B = p(() => window.print(), []), V = p((e) => C(`/${F}/${e}`), [C, F]), H = p(() => {
|
|
131
|
+
try {
|
|
132
|
+
localStorage.removeItem("vite-ui-theme");
|
|
133
|
+
} catch {}
|
|
134
|
+
}, []), U = S?.enabled === !1 ? null : {
|
|
135
|
+
...b,
|
|
136
|
+
...S
|
|
137
|
+
};
|
|
138
|
+
if (!U) return /* @__PURE__ */ _("div", {
|
|
139
|
+
className: "min-h-screen",
|
|
140
|
+
children: x
|
|
141
|
+
});
|
|
142
|
+
let W = {
|
|
143
|
+
...b.page,
|
|
144
|
+
...U.page
|
|
145
|
+
}, G = {
|
|
146
|
+
...b.site,
|
|
147
|
+
...U.site
|
|
148
|
+
}, K = {
|
|
149
|
+
...b.appearance,
|
|
150
|
+
...U.appearance
|
|
151
|
+
}, q = Object.values(W).some(Boolean), J = Object.values(G).some(Boolean), Y = Object.values(K).some(Boolean);
|
|
152
|
+
return /* @__PURE__ */ v(f, { children: [/* @__PURE__ */ _(s, {
|
|
153
|
+
asChild: !0,
|
|
154
|
+
children: /* @__PURE__ */ _("div", {
|
|
155
|
+
className: "min-h-screen",
|
|
156
|
+
children: x
|
|
157
|
+
})
|
|
158
|
+
}), /* @__PURE__ */ v(u, { children: [
|
|
159
|
+
q && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(c, { children: I.page }), /* @__PURE__ */ v(a, { children: [
|
|
160
|
+
W.copyUrl && /* @__PURE__ */ _(t, {
|
|
161
|
+
onClick: O,
|
|
162
|
+
children: I.copyUrl
|
|
163
|
+
}),
|
|
164
|
+
W.copyTitle && /* @__PURE__ */ _(t, {
|
|
165
|
+
onClick: k,
|
|
166
|
+
children: I.copyTitle
|
|
167
|
+
}),
|
|
168
|
+
W.copyMarkdownLink && /* @__PURE__ */ _(t, {
|
|
169
|
+
onClick: A,
|
|
170
|
+
children: I.copyMarkdownLink
|
|
171
|
+
}),
|
|
172
|
+
W.copySelectedText && /* @__PURE__ */ _(t, {
|
|
173
|
+
onClick: j,
|
|
174
|
+
children: I.copySelectedText
|
|
175
|
+
}),
|
|
176
|
+
W.openInNewTab && /* @__PURE__ */ _(t, {
|
|
177
|
+
onClick: M,
|
|
178
|
+
children: I.openInNewTab
|
|
179
|
+
}),
|
|
180
|
+
W.reload && /* @__PURE__ */ _(t, {
|
|
181
|
+
onClick: N,
|
|
182
|
+
children: I.reload
|
|
183
|
+
}),
|
|
184
|
+
W.printPage && /* @__PURE__ */ _(t, {
|
|
185
|
+
onClick: B,
|
|
186
|
+
children: I.printPage
|
|
187
|
+
}),
|
|
188
|
+
(W.scrollToTop || W.scrollToBottom) && /* @__PURE__ */ v(g, { children: [
|
|
189
|
+
/* @__PURE__ */ _(o, {}),
|
|
190
|
+
W.scrollToTop && /* @__PURE__ */ _(t, {
|
|
191
|
+
onClick: R,
|
|
192
|
+
children: I.scrollToTop
|
|
193
|
+
}),
|
|
194
|
+
W.scrollToBottom && /* @__PURE__ */ _(t, {
|
|
195
|
+
onClick: z,
|
|
196
|
+
children: I.scrollToBottom
|
|
197
|
+
})
|
|
198
|
+
] })
|
|
199
|
+
] })] }),
|
|
200
|
+
J && /* @__PURE__ */ v(g, { children: [
|
|
201
|
+
q && /* @__PURE__ */ _(o, {}),
|
|
202
|
+
/* @__PURE__ */ _(c, { children: I.site }),
|
|
203
|
+
/* @__PURE__ */ v(a, { children: [
|
|
204
|
+
G.goHome && /* @__PURE__ */ _(t, {
|
|
205
|
+
onClick: P,
|
|
206
|
+
children: I.goHome
|
|
207
|
+
}),
|
|
208
|
+
G.quickNav && /* @__PURE__ */ v(r, { children: [/* @__PURE__ */ _(l, { children: I.quickNav }), /* @__PURE__ */ v(i, { children: [
|
|
209
|
+
/* @__PURE__ */ _(t, {
|
|
210
|
+
onClick: () => V("index"),
|
|
211
|
+
children: I.docsIndex
|
|
212
|
+
}),
|
|
213
|
+
/* @__PURE__ */ _(t, {
|
|
214
|
+
onClick: () => V("guide"),
|
|
215
|
+
children: I.guide
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ _(t, {
|
|
218
|
+
onClick: () => V("guide/introduction"),
|
|
219
|
+
children: I.introduction
|
|
220
|
+
}),
|
|
221
|
+
/* @__PURE__ */ _(t, {
|
|
222
|
+
onClick: () => V("guide/installation"),
|
|
223
|
+
children: I.installation
|
|
224
|
+
}),
|
|
225
|
+
/* @__PURE__ */ _(t, {
|
|
226
|
+
onClick: () => V("guide/quick-start"),
|
|
227
|
+
children: I.quickStart
|
|
228
|
+
}),
|
|
229
|
+
/* @__PURE__ */ _(t, {
|
|
230
|
+
onClick: () => V("guide/configuration"),
|
|
231
|
+
children: I.configuration
|
|
232
|
+
})
|
|
233
|
+
] })] }),
|
|
234
|
+
G.language && /* @__PURE__ */ v(r, { children: [/* @__PURE__ */ _(l, { children: I.language }), /* @__PURE__ */ _(i, { children: /* @__PURE__ */ v(d, {
|
|
235
|
+
value: F,
|
|
236
|
+
children: [/* @__PURE__ */ _(n, {
|
|
237
|
+
value: "en",
|
|
238
|
+
onClick: () => L("en"),
|
|
239
|
+
children: "English"
|
|
240
|
+
}), /* @__PURE__ */ _(n, {
|
|
241
|
+
value: "zh-cn",
|
|
242
|
+
onClick: () => L("zh-cn"),
|
|
243
|
+
children: "简体中文"
|
|
244
|
+
})]
|
|
245
|
+
}) })] })
|
|
246
|
+
] })
|
|
247
|
+
] }),
|
|
248
|
+
Y && /* @__PURE__ */ v(g, { children: [
|
|
249
|
+
(q || J) && /* @__PURE__ */ _(o, {}),
|
|
250
|
+
/* @__PURE__ */ _(c, { children: I.appearance }),
|
|
251
|
+
/* @__PURE__ */ v(a, { children: [K.theme && /* @__PURE__ */ v(r, { children: [/* @__PURE__ */ _(l, { children: I.theme }), /* @__PURE__ */ _(i, { children: /* @__PURE__ */ v(d, {
|
|
252
|
+
value: T,
|
|
253
|
+
children: [
|
|
254
|
+
/* @__PURE__ */ _(n, {
|
|
255
|
+
value: "light",
|
|
256
|
+
onClick: () => E("light"),
|
|
257
|
+
children: I.light
|
|
258
|
+
}),
|
|
259
|
+
/* @__PURE__ */ _(n, {
|
|
260
|
+
value: "dark",
|
|
261
|
+
onClick: () => E("dark"),
|
|
262
|
+
children: I.dark
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ _(n, {
|
|
265
|
+
value: "system",
|
|
266
|
+
onClick: () => E("system"),
|
|
267
|
+
children: I.system
|
|
268
|
+
})
|
|
269
|
+
]
|
|
270
|
+
}) })] }), K.resetThemePref && /* @__PURE__ */ _(t, {
|
|
271
|
+
onClick: H,
|
|
272
|
+
children: I.resetThemePref
|
|
273
|
+
})] })
|
|
274
|
+
] })
|
|
275
|
+
] })] });
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
export { x as GlobalContextMenu };
|