react-docs-ui 0.6.10 → 0.6.12

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.
Files changed (114) hide show
  1. package/README.md +7 -10
  2. package/dist/AISettingsPanel-CaGVDZ2z.js +1171 -0
  3. package/dist/DocsApp-CEu0IOyd.js +26909 -0
  4. package/dist/GlobalContextMenu-CSEpdhY4.js +210 -0
  5. package/dist/MdxContent-Bbj-p4XT.js +10512 -0
  6. package/dist/MdxContent.lazy-BttoJj5k.js +4 -0
  7. package/dist/SearchDialog-B67saUjp.js +406 -0
  8. package/dist/SearchRuntime-CsSmQWdV.js +31 -0
  9. package/dist/context-menu-BX0jqPJI.js +140 -0
  10. package/dist/docs-app.es.js +4 -0
  11. package/dist/fonts/02c687e7ed17b3df.woff2 +0 -0
  12. package/dist/fonts/09d4de25241bfe76.woff +0 -0
  13. package/dist/fonts/09dfac589fa421e8.woff2 +0 -0
  14. package/dist/fonts/0d29b2b1f8303138.ttf +0 -0
  15. package/dist/fonts/0e9f19247ab3bbab.ttf +0 -0
  16. package/dist/fonts/1969dbe1bc0fb3ba.woff +0 -0
  17. package/dist/fonts/1f89d2fedc85c386.woff +0 -0
  18. package/dist/fonts/20b388d1a51f5745.ttf +0 -0
  19. package/dist/fonts/21851da450182870.ttf +0 -0
  20. package/dist/fonts/22d5c4e6cd1e9474.woff2 +0 -0
  21. package/dist/fonts/22e83d374a2e6691.woff +0 -0
  22. package/dist/fonts/2f36d9db5ff365d4.woff +0 -0
  23. package/dist/fonts/314032aa9f107304.woff2 +0 -0
  24. package/dist/fonts/3533cc38c9cdc602.ttf +0 -0
  25. package/dist/fonts/3d0f44e32f2e74f2.ttf +0 -0
  26. package/dist/fonts/4124e542a1b58f9d.woff +0 -0
  27. package/dist/fonts/46d68807665c21f9.ttf +0 -0
  28. package/dist/fonts/4e1eaced156586d3.ttf +0 -0
  29. package/dist/fonts/4fc7ad74569941de.woff +0 -0
  30. package/dist/fonts/552292117efd3f42.ttf +0 -0
  31. package/dist/fonts/552f66ef43fc7522.woff +0 -0
  32. package/dist/fonts/5600e0919751e982.woff +0 -0
  33. package/dist/fonts/58d42913cac4cb53.woff2 +0 -0
  34. package/dist/fonts/5cff588fceb2856c.ttf +0 -0
  35. package/dist/fonts/5d09426707f9d063.ttf +0 -0
  36. package/dist/fonts/607b70ee0da7b15f.woff2 +0 -0
  37. package/dist/fonts/6652f5c5affcddc6.ttf +0 -0
  38. package/dist/fonts/69732d145fb77d46.ttf +0 -0
  39. package/dist/fonts/69ed18356e7517f2.woff2 +0 -0
  40. package/dist/fonts/705a1783b9c1d57b.ttf +0 -0
  41. package/dist/fonts/72bb9b68fd978fda.woff +0 -0
  42. package/dist/fonts/745939d4e3f4755f.woff2 +0 -0
  43. package/dist/fonts/7591411ae35bc580.woff +0 -0
  44. package/dist/fonts/786e88705bcced94.woff2 +0 -0
  45. package/dist/fonts/79d8b432f0a85a07.woff +0 -0
  46. package/dist/fonts/83b99a8c57312e6e.woff2 +0 -0
  47. package/dist/fonts/83fb1a9d8474dd56.woff2 +0 -0
  48. package/dist/fonts/8cfd3def12a3c5ef.ttf +0 -0
  49. package/dist/fonts/90b626c33ef816d4.ttf +0 -0
  50. package/dist/fonts/96bbd8e3dc776eb1.woff +0 -0
  51. package/dist/fonts/99d6d1362d7b9b12.woff2 +0 -0
  52. package/dist/fonts/a27661173f0a7433.woff2 +0 -0
  53. package/dist/fonts/abe35a8c78edf887.woff +0 -0
  54. package/dist/fonts/ad9576beef3f1d4e.woff2 +0 -0
  55. package/dist/fonts/adbfefebea65cf02.ttf +0 -0
  56. package/dist/fonts/b4aab29b79f992e3.woff2 +0 -0
  57. package/dist/fonts/b9b897e4301ad703.woff2 +0 -0
  58. package/dist/fonts/be03438595f83d0f.ttf +0 -0
  59. package/dist/fonts/c2b56591519e9293.woff2 +0 -0
  60. package/dist/fonts/c505bdad51c9abfa.ttf +0 -0
  61. package/dist/fonts/c811e89c187ceac5.woff +0 -0
  62. package/dist/fonts/ce2290c5c835ea00.woff +0 -0
  63. package/dist/fonts/ce4cb83d70539101.woff2 +0 -0
  64. package/dist/fonts/d601cb8345d82ba5.ttf +0 -0
  65. package/dist/fonts/d6f6ac428c874555.woff +0 -0
  66. package/dist/fonts/debedc918129c66f.woff2 +0 -0
  67. package/dist/fonts/e079035466b8f120.woff +0 -0
  68. package/dist/fonts/e618042c847fd3b9.woff2 +0 -0
  69. package/dist/fonts/e71ae6d3e7debcfd.woff +0 -0
  70. package/dist/fonts/f61879e5a60b36a0.woff +0 -0
  71. package/dist/index-DHF5A5Uk.js +12 -0
  72. package/dist/react-docs-ui.css +1 -1
  73. package/dist/react-docs-ui.es.js +170 -30851
  74. package/dist/types/components/ExportAllDialog.d.ts.map +1 -1
  75. package/dist/types/components/ExportToolbar.d.ts.map +1 -1
  76. package/dist/types/components/FloatingActionBall.d.ts.map +1 -1
  77. package/dist/types/components/FontProvider.d.ts.map +1 -1
  78. package/dist/types/components/HeaderNav.d.ts.map +1 -1
  79. package/dist/types/components/ImageViewer.d.ts.map +1 -1
  80. package/dist/types/components/MdxContent.d.ts +5 -2
  81. package/dist/types/components/MdxContent.d.ts.map +1 -1
  82. package/dist/types/components/MdxContent.lazy.d.ts +2 -0
  83. package/dist/types/components/MdxContent.lazy.d.ts.map +1 -0
  84. package/dist/types/components/SearchLauncher.d.ts +15 -0
  85. package/dist/types/components/SearchLauncher.d.ts.map +1 -0
  86. package/dist/types/components/TableOfContents.d.ts +1 -5
  87. package/dist/types/components/TableOfContents.d.ts.map +1 -1
  88. package/dist/types/components/ai/AISettingsPanel.d.ts.map +1 -1
  89. package/dist/types/components/search/SearchProvider.d.ts +2 -1
  90. package/dist/types/components/search/SearchProvider.d.ts.map +1 -1
  91. package/dist/types/components/search/SearchRuntime.d.ts +9 -0
  92. package/dist/types/components/search/SearchRuntime.d.ts.map +1 -0
  93. package/dist/types/components/ui/toast.d.ts +1 -1
  94. package/dist/types/components/ui/toast.d.ts.map +1 -1
  95. package/dist/types/components/ui/use-toast.d.ts.map +1 -1
  96. package/dist/types/docs-app.d.ts +3 -0
  97. package/dist/types/docs-app.d.ts.map +1 -0
  98. package/dist/types/generated/shiki-bundle.d.ts +17 -0
  99. package/dist/types/generated/shiki-bundle.d.ts.map +1 -0
  100. package/dist/types/index.d.ts +1 -0
  101. package/dist/types/index.d.ts.map +1 -1
  102. package/dist/types/lib/config.d.ts +6 -0
  103. package/dist/types/lib/config.d.ts.map +1 -1
  104. package/dist/types/lib/export-utils.d.ts +5 -1
  105. package/dist/types/lib/export-utils.d.ts.map +1 -1
  106. package/dist/types/lib/rehype-toc.d.ts +21 -0
  107. package/dist/types/lib/rehype-toc.d.ts.map +1 -1
  108. package/dist/types/lib/shiki-highlighter.d.ts +18 -4
  109. package/dist/types/lib/shiki-highlighter.d.ts.map +1 -1
  110. package/dist/types/lib/toc-render.d.ts +4 -0
  111. package/dist/types/lib/toc-render.d.ts.map +1 -0
  112. package/dist/types/react-docs-ui.d.ts +2 -0
  113. package/dist/types/shiki-modules.d.ts +9 -0
  114. package/package.json +5 -1
@@ -0,0 +1,210 @@
1
+ import { a as D, j as e } from "./DocsApp-CEu0IOyd.js";
2
+ import { useCallback as c } from "react";
3
+ import { useNavigate as A, useLocation as Q } from "react-router-dom";
4
+ import { C as W, a as _, b as J, c as k, d as C, e as t, f as y, g as w, h as f, i as v, j as P, k as d } from "./context-menu-BX0jqPJI.js";
5
+ const K = {
6
+ "zh-cn": {
7
+ page: "页面",
8
+ copyUrl: "复制当前链接",
9
+ copyTitle: "复制页面标题",
10
+ copyMarkdownLink: "复制 Markdown 链接",
11
+ copySelectedText: "复制",
12
+ openInNewTab: "在新标签页打开",
13
+ reload: "刷新",
14
+ printPage: "打印页面",
15
+ scrollToTop: "回到顶部",
16
+ scrollToBottom: "滚动到底部",
17
+ site: "站点",
18
+ goHome: "返回首页",
19
+ quickNav: "快速跳转",
20
+ docsIndex: "文档首页",
21
+ guide: "指南",
22
+ introduction: "简介",
23
+ installation: "安装",
24
+ quickStart: "快速开始",
25
+ configuration: "配置",
26
+ language: "语言",
27
+ appearance: "外观",
28
+ theme: "主题",
29
+ light: "浅色",
30
+ dark: "深色",
31
+ system: "跟随系统",
32
+ resetThemePref: "重置主题偏好"
33
+ },
34
+ en: {
35
+ page: "Page",
36
+ copyUrl: "Copy Current URL",
37
+ copyTitle: "Copy Page Title",
38
+ copyMarkdownLink: "Copy Markdown Link",
39
+ copySelectedText: "Copy",
40
+ openInNewTab: "Open in New Tab",
41
+ reload: "Reload",
42
+ printPage: "Print Page",
43
+ scrollToTop: "Scroll to Top",
44
+ scrollToBottom: "Scroll to Bottom",
45
+ site: "Site",
46
+ goHome: "Go Home",
47
+ quickNav: "Quick Navigation",
48
+ docsIndex: "Docs Index",
49
+ guide: "Guide",
50
+ introduction: "Introduction",
51
+ installation: "Installation",
52
+ quickStart: "Quick Start",
53
+ configuration: "Configuration",
54
+ language: "Language",
55
+ appearance: "Appearance",
56
+ theme: "Theme",
57
+ light: "Light",
58
+ dark: "Dark",
59
+ system: "System",
60
+ resetThemePref: "Reset Theme Preference"
61
+ }
62
+ }, x = {
63
+ enabled: !0,
64
+ page: {
65
+ copyUrl: !0,
66
+ copyTitle: !0,
67
+ copyMarkdownLink: !0,
68
+ copySelectedText: !0,
69
+ openInNewTab: !0,
70
+ reload: !0,
71
+ printPage: !0,
72
+ scrollToTop: !0,
73
+ scrollToBottom: !0
74
+ },
75
+ site: {
76
+ goHome: !0,
77
+ quickNav: !0,
78
+ language: !0
79
+ },
80
+ appearance: {
81
+ theme: !0,
82
+ resetThemePref: !0
83
+ }
84
+ };
85
+ function ee({
86
+ children: b,
87
+ config: S
88
+ }) {
89
+ const l = A(), m = Q(), { theme: N, setTheme: g } = D(), s = c(async (a) => {
90
+ if (navigator.clipboard && window.isSecureContext)
91
+ await navigator.clipboard.writeText(a);
92
+ else {
93
+ const n = document.createElement("textarea");
94
+ n.value = a, n.style.position = "fixed", n.style.left = "-9999px", n.style.top = "-9999px", document.body.appendChild(n), n.focus(), n.select();
95
+ try {
96
+ document.execCommand("copy");
97
+ } finally {
98
+ document.body.removeChild(n);
99
+ }
100
+ }
101
+ }, []), L = c(async () => {
102
+ try {
103
+ await s(window.location.href);
104
+ } catch {
105
+ }
106
+ }, [s]), B = c(async () => {
107
+ try {
108
+ await s(document.title || "");
109
+ } catch {
110
+ }
111
+ }, [s]), q = c(async () => {
112
+ try {
113
+ const a = document.title || "Docs", n = window.location.href;
114
+ await s(`[${a}](${n})`);
115
+ } catch {
116
+ }
117
+ }, [s]), H = c(async () => {
118
+ try {
119
+ const a = window.getSelection()?.toString() || "";
120
+ a && await s(a);
121
+ } catch {
122
+ }
123
+ }, [s]), U = c(() => {
124
+ window.open(window.location.href, "_blank");
125
+ }, []), R = c(() => {
126
+ window.location.reload();
127
+ }, []), z = c(() => l("/"), [l]), u = m.pathname.startsWith("/en") ? "en" : "zh-cn", o = K[u], M = c(
128
+ (a) => {
129
+ const n = m.pathname.split("/").filter(Boolean);
130
+ n.length > 0 && (n[0] === "en" || n[0] === "zh-cn") ? n[0] = a : n.unshift(a), l("/" + n.join("/"));
131
+ },
132
+ [m.pathname, l]
133
+ ), G = c(() => window.scrollTo({ top: 0, behavior: "smooth" }), []), E = c(
134
+ () => window.scrollTo({ top: document.documentElement.scrollHeight, behavior: "smooth" }),
135
+ []
136
+ ), F = c(() => window.print(), []), r = c((a) => l(`/${u}/${a}`), [l, u]), O = c(() => {
137
+ try {
138
+ localStorage.removeItem("vite-ui-theme");
139
+ } catch {
140
+ }
141
+ }, []), p = S?.enabled === !1 ? null : { ...x, ...S };
142
+ if (!p)
143
+ return /* @__PURE__ */ e.jsx("div", { className: "min-h-screen", children: b });
144
+ const i = { ...x.page, ...p.page }, h = { ...x.site, ...p.site }, T = { ...x.appearance, ...p.appearance }, j = Object.values(i).some(Boolean), I = Object.values(h).some(Boolean), $ = Object.values(T).some(Boolean);
145
+ return /* @__PURE__ */ e.jsxs(W, { children: [
146
+ /* @__PURE__ */ e.jsx(_, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { className: "min-h-screen", children: b }) }),
147
+ /* @__PURE__ */ e.jsxs(J, { children: [
148
+ j && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
149
+ /* @__PURE__ */ e.jsx(k, { children: o.page }),
150
+ /* @__PURE__ */ e.jsxs(C, { children: [
151
+ i.copyUrl && /* @__PURE__ */ e.jsx(t, { onClick: L, children: o.copyUrl }),
152
+ i.copyTitle && /* @__PURE__ */ e.jsx(t, { onClick: B, children: o.copyTitle }),
153
+ i.copyMarkdownLink && /* @__PURE__ */ e.jsx(t, { onClick: q, children: o.copyMarkdownLink }),
154
+ i.copySelectedText && /* @__PURE__ */ e.jsx(t, { onClick: H, children: o.copySelectedText }),
155
+ i.openInNewTab && /* @__PURE__ */ e.jsx(t, { onClick: U, children: o.openInNewTab }),
156
+ i.reload && /* @__PURE__ */ e.jsx(t, { onClick: R, children: o.reload }),
157
+ i.printPage && /* @__PURE__ */ e.jsx(t, { onClick: F, children: o.printPage }),
158
+ (i.scrollToTop || i.scrollToBottom) && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
159
+ /* @__PURE__ */ e.jsx(y, {}),
160
+ i.scrollToTop && /* @__PURE__ */ e.jsx(t, { onClick: G, children: o.scrollToTop }),
161
+ i.scrollToBottom && /* @__PURE__ */ e.jsx(t, { onClick: E, children: o.scrollToBottom })
162
+ ] })
163
+ ] })
164
+ ] }),
165
+ I && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
166
+ j && /* @__PURE__ */ e.jsx(y, {}),
167
+ /* @__PURE__ */ e.jsx(k, { children: o.site }),
168
+ /* @__PURE__ */ e.jsxs(C, { children: [
169
+ h.goHome && /* @__PURE__ */ e.jsx(t, { onClick: z, children: o.goHome }),
170
+ h.quickNav && /* @__PURE__ */ e.jsxs(w, { children: [
171
+ /* @__PURE__ */ e.jsx(f, { children: o.quickNav }),
172
+ /* @__PURE__ */ e.jsxs(v, { children: [
173
+ /* @__PURE__ */ e.jsx(t, { onClick: () => r("index"), children: o.docsIndex }),
174
+ /* @__PURE__ */ e.jsx(t, { onClick: () => r("guide"), children: o.guide }),
175
+ /* @__PURE__ */ e.jsx(t, { onClick: () => r("guide/introduction"), children: o.introduction }),
176
+ /* @__PURE__ */ e.jsx(t, { onClick: () => r("guide/installation"), children: o.installation }),
177
+ /* @__PURE__ */ e.jsx(t, { onClick: () => r("guide/quick-start"), children: o.quickStart }),
178
+ /* @__PURE__ */ e.jsx(t, { onClick: () => r("guide/configuration"), children: o.configuration })
179
+ ] })
180
+ ] }),
181
+ h.language && /* @__PURE__ */ e.jsxs(w, { children: [
182
+ /* @__PURE__ */ e.jsx(f, { children: o.language }),
183
+ /* @__PURE__ */ e.jsx(v, { children: /* @__PURE__ */ e.jsxs(P, { value: u, children: [
184
+ /* @__PURE__ */ e.jsx(d, { value: "en", onClick: () => M("en"), children: "English" }),
185
+ /* @__PURE__ */ e.jsx(d, { value: "zh-cn", onClick: () => M("zh-cn"), children: "简体中文" })
186
+ ] }) })
187
+ ] })
188
+ ] })
189
+ ] }),
190
+ $ && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
191
+ (j || I) && /* @__PURE__ */ e.jsx(y, {}),
192
+ /* @__PURE__ */ e.jsx(k, { children: o.appearance }),
193
+ /* @__PURE__ */ e.jsxs(C, { children: [
194
+ T.theme && /* @__PURE__ */ e.jsxs(w, { children: [
195
+ /* @__PURE__ */ e.jsx(f, { children: o.theme }),
196
+ /* @__PURE__ */ e.jsx(v, { children: /* @__PURE__ */ e.jsxs(P, { value: N, children: [
197
+ /* @__PURE__ */ e.jsx(d, { value: "light", onClick: () => g("light"), children: o.light }),
198
+ /* @__PURE__ */ e.jsx(d, { value: "dark", onClick: () => g("dark"), children: o.dark }),
199
+ /* @__PURE__ */ e.jsx(d, { value: "system", onClick: () => g("system"), children: o.system })
200
+ ] }) })
201
+ ] }),
202
+ T.resetThemePref && /* @__PURE__ */ e.jsx(t, { onClick: O, children: o.resetThemePref })
203
+ ] })
204
+ ] })
205
+ ] })
206
+ ] });
207
+ }
208
+ export {
209
+ ee as GlobalContextMenu
210
+ };