@windrun-huaiin/third-ui 6.2.2 → 6.3.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/chunk-52YUUCKV.js +3190 -0
- package/dist/chunk-52YUUCKV.js.map +1 -0
- package/dist/chunk-6MM7HLNX.js +226 -0
- package/dist/chunk-6MM7HLNX.js.map +1 -0
- package/dist/chunk-6PW67OXW.js +967 -0
- package/dist/chunk-6PW67OXW.js.map +1 -0
- package/dist/chunk-BZLOMDT7.mjs +90 -0
- package/dist/chunk-BZLOMDT7.mjs.map +1 -0
- package/dist/chunk-C3MW5ZUN.mjs +967 -0
- package/dist/chunk-C3MW5ZUN.mjs.map +1 -0
- package/dist/chunk-FOMCGWDM.mjs +17 -0
- package/dist/chunk-FOMCGWDM.mjs.map +1 -0
- package/dist/chunk-ICXWQI2S.mjs +126 -0
- package/dist/chunk-ICXWQI2S.mjs.map +1 -0
- package/dist/chunk-IOUCFIRG.mjs +3190 -0
- package/dist/chunk-IOUCFIRG.mjs.map +1 -0
- package/dist/chunk-J26XFRUS.js +17 -0
- package/dist/chunk-J26XFRUS.js.map +1 -0
- package/dist/chunk-LZLW5WCC.js +90 -0
- package/dist/chunk-LZLW5WCC.js.map +1 -0
- package/dist/chunk-NV3UQTCW.mjs +226 -0
- package/dist/chunk-NV3UQTCW.mjs.map +1 -0
- package/dist/chunk-TBXDOQXP.js +126 -0
- package/dist/chunk-TBXDOQXP.js.map +1 -0
- package/dist/chunk-TKLIIDBR.mjs +2804 -0
- package/dist/chunk-TKLIIDBR.mjs.map +1 -0
- package/dist/chunk-W7K5Y2WR.js +2804 -0
- package/dist/chunk-W7K5Y2WR.js.map +1 -0
- package/dist/clerk/index.js +13 -57
- package/dist/clerk/index.js.map +1 -1
- package/dist/clerk/index.mjs +7 -27
- package/dist/clerk/index.mjs.map +1 -1
- package/dist/clerk/server.js +60 -2907
- package/dist/clerk/server.js.map +1 -1
- package/dist/clerk/server.mjs +33 -2846
- package/dist/clerk/server.mjs.map +1 -1
- package/dist/fuma/mdx/index.js +7 -4084
- package/dist/fuma/mdx/index.js.map +1 -1
- package/dist/fuma/mdx/index.mjs +20 -4058
- package/dist/fuma/mdx/index.mjs.map +1 -1
- package/dist/fuma/server.js +442 -3695
- package/dist/fuma/server.js.map +1 -1
- package/dist/fuma/server.mjs +232 -3476
- package/dist/fuma/server.mjs.map +1 -1
- package/dist/lib/server.js +39 -105
- package/dist/lib/server.js.map +1 -1
- package/dist/lib/server.mjs +4 -24
- package/dist/lib/server.mjs.map +1 -1
- package/dist/main/index.js +6 -6214
- package/dist/main/index.js.map +1 -1
- package/dist/main/index.mjs +16 -6184
- package/dist/main/index.mjs.map +1 -1
- package/dist/main/server.js +184 -6032
- package/dist/main/server.js.map +1 -1
- package/dist/main/server.mjs +147 -5957
- package/dist/main/server.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,967 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunk6MM7HLNXjs = require('./chunk-6MM7HLNX.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkW7K5Y2WRjs = require('./chunk-W7K5Y2WR.js');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkLZLW5WCCjs = require('./chunk-LZLW5WCC.js');
|
|
15
|
+
|
|
16
|
+
// src/fuma/mdx/mermaid.tsx
|
|
17
|
+
var _nextthemes = require('next-themes');
|
|
18
|
+
var _react = require('react');
|
|
19
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
20
|
+
function Mermaid({ chart, title, watermarkEnabled, watermarkText, enablePreview = true }) {
|
|
21
|
+
const id = _react.useId.call(void 0, );
|
|
22
|
+
const [svg, setSvg] = _react.useState.call(void 0, "");
|
|
23
|
+
const { resolvedTheme } = _nextthemes.useTheme.call(void 0, );
|
|
24
|
+
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
25
|
+
const [scale, setScale] = _react.useState.call(void 0, 1);
|
|
26
|
+
const [translate, setTranslate] = _react.useState.call(void 0, { x: 0, y: 0 });
|
|
27
|
+
const isPanningRef = _react.useRef.call(void 0, false);
|
|
28
|
+
const startPointRef = _react.useRef.call(void 0, { x: 0, y: 0 });
|
|
29
|
+
const startTranslateRef = _react.useRef.call(void 0, { x: 0, y: 0 });
|
|
30
|
+
_react.useEffect.call(void 0, () => {
|
|
31
|
+
let isMounted = true;
|
|
32
|
+
void renderChart();
|
|
33
|
+
function renderChart() {
|
|
34
|
+
return _chunkLZLW5WCCjs.__async.call(void 0, this, null, function* () {
|
|
35
|
+
const mermaidConfig = {
|
|
36
|
+
startOnLoad: false,
|
|
37
|
+
securityLevel: "loose",
|
|
38
|
+
fontFamily: "inherit",
|
|
39
|
+
themeCSS: "margin: 1.5rem auto 0;",
|
|
40
|
+
theme: resolvedTheme === "dark" ? "dark" : "default"
|
|
41
|
+
};
|
|
42
|
+
const { default: mermaid } = yield Promise.resolve().then(() => _interopRequireWildcard(require("mermaid")));
|
|
43
|
+
try {
|
|
44
|
+
mermaid.initialize(mermaidConfig);
|
|
45
|
+
const { svg: svg2 } = yield mermaid.render(
|
|
46
|
+
id.replaceAll(":", ""),
|
|
47
|
+
chart.replaceAll("\\n", "\n")
|
|
48
|
+
);
|
|
49
|
+
let svgWithWatermark = svg2;
|
|
50
|
+
if (watermarkEnabled && watermarkText) {
|
|
51
|
+
svgWithWatermark = addWatermarkToSvg(svg2, watermarkText);
|
|
52
|
+
}
|
|
53
|
+
if (isMounted) setSvg(svgWithWatermark);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error("Error while rendering mermaid", error);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return () => {
|
|
60
|
+
isMounted = false;
|
|
61
|
+
setSvg("");
|
|
62
|
+
};
|
|
63
|
+
}, [chart, id, resolvedTheme, watermarkEnabled, watermarkText]);
|
|
64
|
+
const clamp = (v, min, max) => Math.min(Math.max(v, min), max);
|
|
65
|
+
const resetTransform = _react.useCallback.call(void 0, () => {
|
|
66
|
+
setScale(4);
|
|
67
|
+
setTranslate({ x: 0, y: 0 });
|
|
68
|
+
}, []);
|
|
69
|
+
const zoomBy = _react.useCallback.call(void 0, (delta) => {
|
|
70
|
+
setScale((prev) => clamp(prev + delta, 0.25, 10));
|
|
71
|
+
}, []);
|
|
72
|
+
const onWheel = _react.useCallback.call(void 0, (e) => {
|
|
73
|
+
if (e.metaKey || e.ctrlKey) {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
const delta = e.deltaY > 0 ? -0.1 : 0.1;
|
|
77
|
+
setScale((prev) => clamp(prev + delta, 0.25, 10));
|
|
78
|
+
} else {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
e.stopPropagation();
|
|
81
|
+
setTranslate((prev) => ({ x: prev.x - e.deltaX, y: prev.y - e.deltaY }));
|
|
82
|
+
}
|
|
83
|
+
}, []);
|
|
84
|
+
const onPointerDown = _react.useCallback.call(void 0, (e) => {
|
|
85
|
+
isPanningRef.current = true;
|
|
86
|
+
startPointRef.current = { x: e.clientX, y: e.clientY };
|
|
87
|
+
startTranslateRef.current = _chunkLZLW5WCCjs.__spreadValues.call(void 0, {}, translate);
|
|
88
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
89
|
+
}, [translate]);
|
|
90
|
+
const onPointerMove = _react.useCallback.call(void 0, (e) => {
|
|
91
|
+
if (!isPanningRef.current) return;
|
|
92
|
+
const dx = e.clientX - startPointRef.current.x;
|
|
93
|
+
const dy = e.clientY - startPointRef.current.y;
|
|
94
|
+
setTranslate({ x: startTranslateRef.current.x + dx, y: startTranslateRef.current.y + dy });
|
|
95
|
+
}, []);
|
|
96
|
+
const onPointerUp = _react.useCallback.call(void 0, (e) => {
|
|
97
|
+
isPanningRef.current = false;
|
|
98
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
99
|
+
}, []);
|
|
100
|
+
_react.useEffect.call(void 0, () => {
|
|
101
|
+
if (!open) return;
|
|
102
|
+
resetTransform();
|
|
103
|
+
const onGlobalWheel = (ev) => {
|
|
104
|
+
if (ev.ctrlKey || ev.metaKey) {
|
|
105
|
+
ev.preventDefault();
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const onKeyDown = (ev) => {
|
|
109
|
+
if (!(ev.ctrlKey || ev.metaKey)) return;
|
|
110
|
+
const k = ev.key;
|
|
111
|
+
if (k === "=" || k === "+") {
|
|
112
|
+
ev.preventDefault();
|
|
113
|
+
setScale((prev) => clamp(prev + 0.2, 0.25, 10));
|
|
114
|
+
} else if (k === "-") {
|
|
115
|
+
ev.preventDefault();
|
|
116
|
+
setScale((prev) => clamp(prev - 0.2, 0.25, 10));
|
|
117
|
+
} else if (k === "0") {
|
|
118
|
+
ev.preventDefault();
|
|
119
|
+
resetTransform();
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
window.addEventListener("wheel", onGlobalWheel, { passive: false, capture: true });
|
|
123
|
+
window.addEventListener("keydown", onKeyDown, { capture: true });
|
|
124
|
+
return () => {
|
|
125
|
+
window.removeEventListener("wheel", onGlobalWheel, true);
|
|
126
|
+
window.removeEventListener("keydown", onKeyDown, true);
|
|
127
|
+
};
|
|
128
|
+
}, [open, resetTransform]);
|
|
129
|
+
_react.useEffect.call(void 0, () => {
|
|
130
|
+
if (!open) return;
|
|
131
|
+
const previousPosition = document.body.style.position;
|
|
132
|
+
const previousTop = document.body.style.top;
|
|
133
|
+
const previousLeft = document.body.style.left;
|
|
134
|
+
const previousRight = document.body.style.right;
|
|
135
|
+
const previousWidth = document.body.style.width;
|
|
136
|
+
const scrollY = window.scrollY;
|
|
137
|
+
document.body.style.position = "fixed";
|
|
138
|
+
document.body.style.top = `-${scrollY}px`;
|
|
139
|
+
document.body.style.left = "0";
|
|
140
|
+
document.body.style.right = "0";
|
|
141
|
+
document.body.style.width = "100%";
|
|
142
|
+
return () => {
|
|
143
|
+
document.body.style.position = previousPosition;
|
|
144
|
+
document.body.style.top = previousTop;
|
|
145
|
+
document.body.style.left = previousLeft;
|
|
146
|
+
document.body.style.right = previousRight;
|
|
147
|
+
document.body.style.width = previousWidth;
|
|
148
|
+
window.scrollTo(0, scrollY);
|
|
149
|
+
};
|
|
150
|
+
}, [open]);
|
|
151
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
152
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
className: enablePreview ? "group relative cursor-zoom-in" : void 0,
|
|
156
|
+
onClick: () => enablePreview && svg && setOpen(true),
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { dangerouslySetInnerHTML: { __html: svg } }),
|
|
159
|
+
enablePreview && svg && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pointer-events-none absolute right-2 top-2 hidden rounded bg-black/50 px-2 py-0.5 text-[12px] text-white group-hover:block", children: "Preview Chart" })
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
title && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
className: "mt-2 flex items-center justify-center text-center text-[13px] font-italic text-[#AC62FD]",
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.Mmd, { className: "mr-1 h-4 w-4" }),
|
|
169
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: title })
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
enablePreview && open && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
role: "dialog",
|
|
177
|
+
"aria-modal": "true",
|
|
178
|
+
"aria-label": typeof title === "string" ? title : "Mermaid Preview",
|
|
179
|
+
className: "fixed inset-0 z-[9999] flex items-center justify-center",
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
182
|
+
"div",
|
|
183
|
+
{
|
|
184
|
+
className: "absolute inset-0 bg-black/60",
|
|
185
|
+
onClick: () => {
|
|
186
|
+
setOpen(false);
|
|
187
|
+
resetTransform();
|
|
188
|
+
},
|
|
189
|
+
onWheel: (e) => {
|
|
190
|
+
e.preventDefault();
|
|
191
|
+
e.stopPropagation();
|
|
192
|
+
},
|
|
193
|
+
onTouchMove: (e) => {
|
|
194
|
+
e.preventDefault();
|
|
195
|
+
e.stopPropagation();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative z-[1] max-w-[95vw] w-[95vw] h-[88vh] p-0 bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-700 rounded-md shadow-2xl overflow-hidden", children: [
|
|
200
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between px-3 py-2 border-b border-neutral-200 dark:border-neutral-700", children: [
|
|
201
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 text-sm text-neutral-600 dark:text-neutral-300", children: [
|
|
202
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.Mmd, { className: "h-4 w-4" }),
|
|
203
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "truncate max-w-[50vw]", children: title != null ? title : "Mermaid Preview" })
|
|
204
|
+
] }),
|
|
205
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-0.5", children: [
|
|
206
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
207
|
+
"button",
|
|
208
|
+
{
|
|
209
|
+
"aria-label": "Zoom out",
|
|
210
|
+
className: "flex h-6 w-6 items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-[13px]",
|
|
211
|
+
onClick: () => zoomBy(-0.5),
|
|
212
|
+
children: "\uFF0D"
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "mx-0.5 text-[12px] w-12 text-center select-none", children: [
|
|
216
|
+
Math.round(scale * 100),
|
|
217
|
+
"%"
|
|
218
|
+
] }),
|
|
219
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
220
|
+
"button",
|
|
221
|
+
{
|
|
222
|
+
"aria-label": "Zoom in",
|
|
223
|
+
className: "flex h-6 w-6 items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-[13px]",
|
|
224
|
+
onClick: () => zoomBy(0.5),
|
|
225
|
+
children: "\uFF0B"
|
|
226
|
+
}
|
|
227
|
+
),
|
|
228
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mx-1 h-4 w-px bg-neutral-300 dark:bg-neutral-700" }),
|
|
229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
230
|
+
"button",
|
|
231
|
+
{
|
|
232
|
+
"aria-label": "Zoom 100%",
|
|
233
|
+
className: "inline-flex h-6 min-w-8 items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 px-1.5 text-[12px]",
|
|
234
|
+
onClick: () => setScale(1),
|
|
235
|
+
children: "X1"
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
239
|
+
"button",
|
|
240
|
+
{
|
|
241
|
+
"aria-label": "Zoom 200%",
|
|
242
|
+
className: "ml-1 inline-flex h-6 min-w-8 items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 px-1.5 text-[12px]",
|
|
243
|
+
onClick: () => setScale(2),
|
|
244
|
+
children: "X2"
|
|
245
|
+
}
|
|
246
|
+
),
|
|
247
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
248
|
+
"button",
|
|
249
|
+
{
|
|
250
|
+
"aria-label": "Zoom 300%",
|
|
251
|
+
className: "ml-1 inline-flex h-6 min-w-8 items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 px-1.5 text-[12px]",
|
|
252
|
+
onClick: () => setScale(3),
|
|
253
|
+
children: "X3"
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
257
|
+
"button",
|
|
258
|
+
{
|
|
259
|
+
"aria-label": "Zoom 1000%",
|
|
260
|
+
className: "ml-1 inline-flex h-6 min-w-10 items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 px-1.5 text-[12px]",
|
|
261
|
+
onClick: () => setScale(10),
|
|
262
|
+
children: "X10"
|
|
263
|
+
}
|
|
264
|
+
),
|
|
265
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
266
|
+
"button",
|
|
267
|
+
{
|
|
268
|
+
"aria-label": "Reset",
|
|
269
|
+
className: "ml-1 flex h-6 w-6 items-center justify-center rounded text-purple-500 hover:text-purple-600",
|
|
270
|
+
onClick: resetTransform,
|
|
271
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.RefreshCcw, { className: "h-3.5 w-3.5" })
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
275
|
+
"button",
|
|
276
|
+
{
|
|
277
|
+
"aria-label": "Close",
|
|
278
|
+
className: "ml-1 flex h-6 w-6 items-center justify-center rounded text-purple-500 hover:text-purple-600",
|
|
279
|
+
onClick: () => {
|
|
280
|
+
setOpen(false);
|
|
281
|
+
resetTransform();
|
|
282
|
+
},
|
|
283
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.X, { className: "h-3.5 w-3.5" })
|
|
284
|
+
}
|
|
285
|
+
)
|
|
286
|
+
] })
|
|
287
|
+
] }),
|
|
288
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
289
|
+
"div",
|
|
290
|
+
{
|
|
291
|
+
className: "relative h-[calc(88vh-40px)] w-full overflow-hidden bg-white dark:bg-neutral-900 touch-none overscroll-contain",
|
|
292
|
+
onWheel,
|
|
293
|
+
onPointerDown,
|
|
294
|
+
onPointerMove,
|
|
295
|
+
onPointerUp,
|
|
296
|
+
children: [
|
|
297
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
298
|
+
"div",
|
|
299
|
+
{
|
|
300
|
+
className: "absolute left-1/2 top-1/2",
|
|
301
|
+
style: { transform: `translate(-50%, -50%) translate(${translate.x}px, ${translate.y}px)` },
|
|
302
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
303
|
+
"div",
|
|
304
|
+
{
|
|
305
|
+
style: { transform: `scale(${scale})`, transformOrigin: "50% 50%" },
|
|
306
|
+
dangerouslySetInnerHTML: { __html: svg }
|
|
307
|
+
}
|
|
308
|
+
)
|
|
309
|
+
}
|
|
310
|
+
),
|
|
311
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pointer-events-none absolute bottom-2 right-3 rounded bg-black/40 px-2 py-1 text-xs text-white", children: "Drag to pan, hold Cmd/Ctrl + scroll to zoom" })
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
)
|
|
315
|
+
] })
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
] });
|
|
320
|
+
}
|
|
321
|
+
function addWatermarkToSvg(svg, watermark) {
|
|
322
|
+
const watermarkText = `
|
|
323
|
+
<text
|
|
324
|
+
x="100%"
|
|
325
|
+
y="98%"
|
|
326
|
+
text-anchor="end"
|
|
327
|
+
font-size="12"
|
|
328
|
+
font-style="italic"
|
|
329
|
+
fill="#AC62FD"
|
|
330
|
+
opacity="0.40"
|
|
331
|
+
class="pointer-events-none"
|
|
332
|
+
dx="-8"
|
|
333
|
+
dy="-4"
|
|
334
|
+
>${watermark}</text>
|
|
335
|
+
`;
|
|
336
|
+
return svg.replace("</svg>", `${watermarkText}</svg>`);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// src/fuma/mdx/image-zoom.tsx
|
|
340
|
+
var _framework = require('fumadocs-core/framework');
|
|
341
|
+
|
|
342
|
+
var _reactmediumimagezoom = require('react-medium-image-zoom'); var _reactmediumimagezoom2 = _interopRequireDefault(_reactmediumimagezoom);
|
|
343
|
+
|
|
344
|
+
function getImageSrc(src) {
|
|
345
|
+
if (typeof src === "string") return src;
|
|
346
|
+
if (typeof src === "object") {
|
|
347
|
+
if ("default" in src)
|
|
348
|
+
return src.default.src;
|
|
349
|
+
return src.src;
|
|
350
|
+
}
|
|
351
|
+
return "";
|
|
352
|
+
}
|
|
353
|
+
function ImageZoom(_a) {
|
|
354
|
+
var _b = _a, {
|
|
355
|
+
zoomInProps,
|
|
356
|
+
children,
|
|
357
|
+
rmiz,
|
|
358
|
+
fallbackSrc = "https://r2.d8ger.com/default.webp"
|
|
359
|
+
} = _b, props = _chunkLZLW5WCCjs.__objRest.call(void 0, _b, [
|
|
360
|
+
"zoomInProps",
|
|
361
|
+
"children",
|
|
362
|
+
"rmiz",
|
|
363
|
+
"fallbackSrc"
|
|
364
|
+
]);
|
|
365
|
+
var _a2;
|
|
366
|
+
const [imgSrc, setImgSrc] = _react.useState.call(void 0, getImageSrc(props.src));
|
|
367
|
+
const handleError = () => {
|
|
368
|
+
console.warn("ImageZoom check error:", imgSrc, fallbackSrc);
|
|
369
|
+
if (imgSrc !== fallbackSrc) {
|
|
370
|
+
setImgSrc(fallbackSrc);
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
374
|
+
_reactmediumimagezoom2.default,
|
|
375
|
+
_chunkLZLW5WCCjs.__spreadProps.call(void 0, _chunkLZLW5WCCjs.__spreadValues.call(void 0, {
|
|
376
|
+
zoomMargin: 20,
|
|
377
|
+
wrapElement: "span"
|
|
378
|
+
}, rmiz), {
|
|
379
|
+
zoomImg: _chunkLZLW5WCCjs.__spreadProps.call(void 0, _chunkLZLW5WCCjs.__spreadValues.call(void 0, {
|
|
380
|
+
src: imgSrc,
|
|
381
|
+
sizes: void 0
|
|
382
|
+
}, zoomInProps), {
|
|
383
|
+
onError: handleError
|
|
384
|
+
}),
|
|
385
|
+
children: children != null ? children : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
386
|
+
_framework.Image,
|
|
387
|
+
_chunkLZLW5WCCjs.__spreadProps.call(void 0, _chunkLZLW5WCCjs.__spreadValues.call(void 0, {}, props), {
|
|
388
|
+
src: imgSrc,
|
|
389
|
+
onError: handleError,
|
|
390
|
+
sizes: "(max-width: 400px) 100vw, 300px",
|
|
391
|
+
style: { width: "100%", height: "auto", maxWidth: 300 },
|
|
392
|
+
alt: (_a2 = props.alt) != null ? _a2 : "",
|
|
393
|
+
width: 300,
|
|
394
|
+
height: 225
|
|
395
|
+
})
|
|
396
|
+
)
|
|
397
|
+
})
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// src/fuma/mdx/trophy-card.tsx
|
|
402
|
+
|
|
403
|
+
function TrophyCard({
|
|
404
|
+
icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.Star, {}),
|
|
405
|
+
title,
|
|
406
|
+
children
|
|
407
|
+
}) {
|
|
408
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
409
|
+
"div",
|
|
410
|
+
{
|
|
411
|
+
className: "\n border-2 rounded-xl px-4 py-2\n border-purple-200 dark:border-gray-500\n ",
|
|
412
|
+
children: [
|
|
413
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center font-bold text-sm", children: [
|
|
414
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mr-2", children: icon }),
|
|
415
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: title })
|
|
416
|
+
] }),
|
|
417
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm -mt-1 leading-none", children })
|
|
418
|
+
]
|
|
419
|
+
}
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// src/fuma/mdx/image-grid.tsx
|
|
424
|
+
|
|
425
|
+
function ImageGrid({
|
|
426
|
+
type = "url",
|
|
427
|
+
images,
|
|
428
|
+
altPrefix = "",
|
|
429
|
+
cdnBaseUrl
|
|
430
|
+
}) {
|
|
431
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
432
|
+
"div",
|
|
433
|
+
{
|
|
434
|
+
style: {
|
|
435
|
+
display: "grid",
|
|
436
|
+
gridTemplateColumns: "repeat(2, 1fr)",
|
|
437
|
+
gap: "16px",
|
|
438
|
+
justifyItems: "center",
|
|
439
|
+
alignItems: "center"
|
|
440
|
+
},
|
|
441
|
+
children: images.map((img, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
442
|
+
ImageZoom,
|
|
443
|
+
{
|
|
444
|
+
src: img.startsWith("http://") || img.startsWith("https://") ? img : type === "url" ? `${cdnBaseUrl == null ? void 0 : cdnBaseUrl.replace(/\/+$/, "")}/${img.replace(/^\/+/, "")}` : img,
|
|
445
|
+
alt: `${altPrefix}-${idx + 1}`
|
|
446
|
+
},
|
|
447
|
+
img
|
|
448
|
+
))
|
|
449
|
+
}
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// src/fuma/mdx/zia-card.tsx
|
|
454
|
+
var _link = require('next/link'); var _link2 = _interopRequireDefault(_link);
|
|
455
|
+
|
|
456
|
+
function ZiaCard(_a) {
|
|
457
|
+
var _b = _a, { icon, title, description } = _b, props = _chunkLZLW5WCCjs.__objRest.call(void 0, _b, ["icon", "title", "description"]);
|
|
458
|
+
const validHref = typeof props.href === "string" && props.href.trim() !== "";
|
|
459
|
+
const validDescription = typeof description === "string" && (description == null ? void 0 : description.trim()) !== "";
|
|
460
|
+
if (validHref) {
|
|
461
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
462
|
+
_link2.default,
|
|
463
|
+
_chunkLZLW5WCCjs.__spreadProps.call(void 0, _chunkLZLW5WCCjs.__spreadValues.call(void 0, {
|
|
464
|
+
href: props.href,
|
|
465
|
+
"data-card": true,
|
|
466
|
+
className: _chunk6MM7HLNXjs.cn.call(void 0,
|
|
467
|
+
"block rounded-lg border bg-fd-card p-4 text-fd-card-foreground shadow-md transition-colors @max-lg:col-span-full",
|
|
468
|
+
"hover:bg-fd-accent/80",
|
|
469
|
+
props.className
|
|
470
|
+
)
|
|
471
|
+
}, props), {
|
|
472
|
+
children: [
|
|
473
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "not-prose mb-2 w-fit rounded-md border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4", children: icon ? icon : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.CircleSmall, {}) }),
|
|
474
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "not-prose mb-1 text-sm font-medium line-clamp-2 min-h-[2.5rem]", children: title }),
|
|
475
|
+
validDescription ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "!my-0 text-sm text-fd-muted-foreground", children: description }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "!my-0 text-sm text-fd-muted-foreground opacity-0 select-none", children: "\xA0" }),
|
|
476
|
+
props.children ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-fd-muted-foreground prose-no-margin", children: props.children }) : null
|
|
477
|
+
]
|
|
478
|
+
})
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
482
|
+
"div",
|
|
483
|
+
_chunkLZLW5WCCjs.__spreadProps.call(void 0, _chunkLZLW5WCCjs.__spreadValues.call(void 0, {
|
|
484
|
+
"data-card": true,
|
|
485
|
+
className: _chunk6MM7HLNXjs.cn.call(void 0,
|
|
486
|
+
"block rounded-lg border bg-fd-card p-4 text-fd-card-foreground shadow-md transition-colors @max-lg:col-span-full",
|
|
487
|
+
props.className
|
|
488
|
+
)
|
|
489
|
+
}, props), {
|
|
490
|
+
children: [
|
|
491
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "not-prose mb-2 w-fit rounded-md border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4", children: icon ? icon : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.CircleSmall, {}) }),
|
|
492
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "not-prose mb-1 text-sm font-medium line-clamp-2 min-h-[2.5rem]", children: title }),
|
|
493
|
+
validDescription ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "!my-0 text-sm text-fd-muted-foreground", children: description }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "!my-0 text-sm text-fd-muted-foreground opacity-0 select-none", children: "\xA0" }),
|
|
494
|
+
props.children ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-fd-muted-foreground prose-no-margin", children: props.children }) : null
|
|
495
|
+
]
|
|
496
|
+
})
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// src/fuma/mdx/toc-base.tsx
|
|
501
|
+
|
|
502
|
+
var _navigation = require('next/navigation');
|
|
503
|
+
var _usecopybutton = require('fumadocs-ui/utils/use-copy-button');
|
|
504
|
+
var _link3 = require('fumadocs-core/link'); var _link4 = _interopRequireDefault(_link3);
|
|
505
|
+
|
|
506
|
+
var cache = /* @__PURE__ */ new Map();
|
|
507
|
+
function LLMCopyButton({ llmApiUrl, sourceKey } = {}) {
|
|
508
|
+
const [isLoading, setLoading] = _react.useState.call(void 0, false);
|
|
509
|
+
const params = _navigation.useParams.call(void 0, );
|
|
510
|
+
const locale = params.locale;
|
|
511
|
+
const slug = params.slug;
|
|
512
|
+
const [checked, onClick] = _usecopybutton.useCopyButton.call(void 0, () => _chunkLZLW5WCCjs.__async.call(void 0, null, null, function* () {
|
|
513
|
+
setLoading(true);
|
|
514
|
+
const path = slug && Array.isArray(slug) ? slug.join("/") : "";
|
|
515
|
+
const apiPrefix = llmApiUrl || (sourceKey ? `/api/${sourceKey}/llm-content` : "/api/llm-content");
|
|
516
|
+
let apiUrl = `${apiPrefix}?locale=${encodeURIComponent(locale)}&path=${encodeURIComponent(path)}`;
|
|
517
|
+
if (sourceKey) {
|
|
518
|
+
apiUrl += `&sourceKey=${encodeURIComponent(sourceKey)}`;
|
|
519
|
+
}
|
|
520
|
+
console.log("Fetching LLM content from:", apiUrl);
|
|
521
|
+
let content;
|
|
522
|
+
try {
|
|
523
|
+
if (cache.has(apiUrl)) {
|
|
524
|
+
content = cache.get(apiUrl);
|
|
525
|
+
} else {
|
|
526
|
+
const res = yield fetch(apiUrl);
|
|
527
|
+
if (!res.ok) {
|
|
528
|
+
content = `Error: Failed to fetch LLM content: ${res.status} ${res.statusText}`;
|
|
529
|
+
} else {
|
|
530
|
+
content = yield res.text();
|
|
531
|
+
cache.set(apiUrl, content);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
yield navigator.clipboard.writeText(content);
|
|
535
|
+
} catch (error) {
|
|
536
|
+
const errMsg = `Error: ${error instanceof Error ? error.message : String(error)}`;
|
|
537
|
+
yield navigator.clipboard.writeText(errMsg);
|
|
538
|
+
console.error("Error fetching or copying LLM content:", error);
|
|
539
|
+
} finally {
|
|
540
|
+
setLoading(false);
|
|
541
|
+
}
|
|
542
|
+
}));
|
|
543
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
544
|
+
_chunk6MM7HLNXjs.Button,
|
|
545
|
+
{
|
|
546
|
+
variant: "ghost",
|
|
547
|
+
size: "sm",
|
|
548
|
+
loading: isLoading,
|
|
549
|
+
className: "justify-start px-0 text-stone-600 hover:text-stone-500 dark:text-stone-400 dark:hover:text-stone-300",
|
|
550
|
+
onClick,
|
|
551
|
+
children: checked ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
552
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.Check, {}),
|
|
553
|
+
"Copied!"
|
|
554
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
555
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.Markdown, {}),
|
|
556
|
+
"Copy page as Markdown"
|
|
557
|
+
] })
|
|
558
|
+
}
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
function EditOnGitHub({ url }) {
|
|
562
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
563
|
+
_link4.default,
|
|
564
|
+
{
|
|
565
|
+
className: "flex items-center gap-x-2 text-stone-600 hover:text-stone-500 dark:text-stone-400 dark:hover:text-stone-300 text-sm",
|
|
566
|
+
href: url,
|
|
567
|
+
children: [
|
|
568
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.GitHub, {}),
|
|
569
|
+
"Edit this page on GitHub"
|
|
570
|
+
]
|
|
571
|
+
}
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
function LastUpdatedDate({ date }) {
|
|
575
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2 text-stone-600 dark:text-stone-400 text-sm", children: [
|
|
576
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.LastUpdated, {}),
|
|
577
|
+
"Lastest on ",
|
|
578
|
+
date ? date : "Ages ago"
|
|
579
|
+
] });
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// src/fuma/mdx/fuma-github-info.tsx
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
function GitHubInfoSkeleton({ owner, repo, className }) {
|
|
586
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `flex flex-col gap-1.5 p-2 rounded-lg text-sm text-fd-foreground/80 lg:flex-row lg:items-center animate-pulse ${className}`, children: [
|
|
587
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
588
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "size-3.5 bg-fd-muted rounded" }),
|
|
589
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-4 bg-fd-muted rounded w-20" })
|
|
590
|
+
] }),
|
|
591
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-3 bg-fd-muted rounded w-8" })
|
|
592
|
+
] });
|
|
593
|
+
}
|
|
594
|
+
function GitHubInfoFallback({ owner, repo, className }) {
|
|
595
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
596
|
+
"a",
|
|
597
|
+
{
|
|
598
|
+
href: `https://github.com/${owner}/${repo}`,
|
|
599
|
+
rel: "noreferrer noopener",
|
|
600
|
+
target: "_blank",
|
|
601
|
+
className: `flex flex-col gap-1.5 p-2 rounded-lg text-sm text-fd-foreground/80 transition-colors lg:flex-row lg:items-center hover:text-fd-accent-foreground hover:bg-fd-accent ${className}`,
|
|
602
|
+
children: [
|
|
603
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "flex items-center gap-2 truncate", children: [
|
|
604
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { fill: "currentColor", viewBox: "0 0 24 24", className: "size-3.5", children: [
|
|
605
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "title", { children: "GitHub" }),
|
|
606
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" })
|
|
607
|
+
] }),
|
|
608
|
+
owner,
|
|
609
|
+
"/",
|
|
610
|
+
repo
|
|
611
|
+
] }),
|
|
612
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "flex text-xs items-center gap-1 text-fd-muted-foreground", children: [
|
|
613
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.ExternalLink, { className: "size-3" }),
|
|
614
|
+
"GitHub"
|
|
615
|
+
] })
|
|
616
|
+
]
|
|
617
|
+
}
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
function GitHubInfoSuccess({
|
|
621
|
+
owner,
|
|
622
|
+
repo,
|
|
623
|
+
stars,
|
|
624
|
+
className
|
|
625
|
+
}) {
|
|
626
|
+
const humanizedStars = humanizeNumber(stars);
|
|
627
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
628
|
+
"a",
|
|
629
|
+
{
|
|
630
|
+
href: `https://github.com/${owner}/${repo}`,
|
|
631
|
+
rel: "noreferrer noopener",
|
|
632
|
+
target: "_blank",
|
|
633
|
+
className: `flex flex-col gap-1.5 p-2 rounded-lg text-sm text-fd-foreground/80 transition-colors lg:flex-row lg:items-center hover:text-fd-accent-foreground hover:bg-fd-accent ${className}`,
|
|
634
|
+
children: [
|
|
635
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "flex items-center gap-2 truncate", children: [
|
|
636
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { fill: "currentColor", viewBox: "0 0 24 24", className: "size-3.5", children: [
|
|
637
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "title", { children: "GitHub" }),
|
|
638
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" })
|
|
639
|
+
] }),
|
|
640
|
+
owner,
|
|
641
|
+
"/",
|
|
642
|
+
repo
|
|
643
|
+
] }),
|
|
644
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "flex text-xs items-center gap-1 text-fd-muted-foreground", children: [
|
|
645
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.Star, { className: "size-3" }),
|
|
646
|
+
humanizedStars
|
|
647
|
+
] })
|
|
648
|
+
]
|
|
649
|
+
}
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
function humanizeNumber(num) {
|
|
653
|
+
if (num < 1e3) {
|
|
654
|
+
return num.toString();
|
|
655
|
+
}
|
|
656
|
+
if (num < 1e5) {
|
|
657
|
+
const value = (num / 1e3).toFixed(1);
|
|
658
|
+
const formattedValue = value.endsWith(".0") ? value.slice(0, -2) : value;
|
|
659
|
+
return `${formattedValue}K`;
|
|
660
|
+
}
|
|
661
|
+
if (num < 1e6) {
|
|
662
|
+
return `${Math.floor(num / 1e3)}K`;
|
|
663
|
+
}
|
|
664
|
+
return num.toString();
|
|
665
|
+
}
|
|
666
|
+
function FumaGithubInfo({ owner, repo, token, className }) {
|
|
667
|
+
const [data, setData] = _react.useState.call(void 0, null);
|
|
668
|
+
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
669
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
670
|
+
_react.useEffect.call(void 0, () => {
|
|
671
|
+
const fetchRepoData = () => _chunkLZLW5WCCjs.__async.call(void 0, null, null, function* () {
|
|
672
|
+
try {
|
|
673
|
+
setLoading(true);
|
|
674
|
+
setError(null);
|
|
675
|
+
const controller = new AbortController();
|
|
676
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
677
|
+
const headers = new Headers({
|
|
678
|
+
"Accept": "application/vnd.github.v3+json"
|
|
679
|
+
});
|
|
680
|
+
if (token) {
|
|
681
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
682
|
+
}
|
|
683
|
+
const response = yield fetch(`https://api.github.com/repos/${owner}/${repo}`, {
|
|
684
|
+
signal: controller.signal,
|
|
685
|
+
headers
|
|
686
|
+
});
|
|
687
|
+
clearTimeout(timeoutId);
|
|
688
|
+
if (!response.ok) {
|
|
689
|
+
throw new Error(`GitHub API response error: ${response.status}`);
|
|
690
|
+
}
|
|
691
|
+
const repoData = yield response.json();
|
|
692
|
+
setData({
|
|
693
|
+
stargazers_count: repoData.stargazers_count,
|
|
694
|
+
forks_count: repoData.forks_count
|
|
695
|
+
});
|
|
696
|
+
} catch (err) {
|
|
697
|
+
console.warn("GitHub API call failed:", err);
|
|
698
|
+
if (err instanceof Error) {
|
|
699
|
+
if (err.name === "AbortError") {
|
|
700
|
+
setError("Request timeout");
|
|
701
|
+
} else {
|
|
702
|
+
setError("Failed to get repository information");
|
|
703
|
+
}
|
|
704
|
+
} else {
|
|
705
|
+
setError("Unknown error");
|
|
706
|
+
}
|
|
707
|
+
} finally {
|
|
708
|
+
setLoading(false);
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
fetchRepoData();
|
|
712
|
+
}, [owner, repo, token]);
|
|
713
|
+
if (loading) {
|
|
714
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, GitHubInfoSkeleton, { owner, repo, className });
|
|
715
|
+
}
|
|
716
|
+
if (error || !data) {
|
|
717
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, GitHubInfoFallback, { owner, repo, className });
|
|
718
|
+
}
|
|
719
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
720
|
+
GitHubInfoSuccess,
|
|
721
|
+
{
|
|
722
|
+
owner,
|
|
723
|
+
repo,
|
|
724
|
+
stars: data.stargazers_count,
|
|
725
|
+
className
|
|
726
|
+
}
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// src/fuma/mdx/zia-file.tsx
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
var _collapsible = require('fumadocs-ui/components/ui/collapsible');
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
var itemVariants = "flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground [&_svg]:size-4";
|
|
740
|
+
var anotionClass = "ms-2 px-2 py-0.5 rounded text-xs font-semibold bg-fd-accent/80 text-fd-accent-foreground dark:bg-white/20 dark:text-white";
|
|
741
|
+
function ZiaFile(_a) {
|
|
742
|
+
var _b = _a, {
|
|
743
|
+
name,
|
|
744
|
+
icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.File, {}),
|
|
745
|
+
className,
|
|
746
|
+
anotion,
|
|
747
|
+
href
|
|
748
|
+
} = _b, rest = _chunkLZLW5WCCjs.__objRest.call(void 0, _b, [
|
|
749
|
+
"name",
|
|
750
|
+
"icon",
|
|
751
|
+
"className",
|
|
752
|
+
"anotion",
|
|
753
|
+
"href"
|
|
754
|
+
]);
|
|
755
|
+
const validHref = typeof href === "string" && href.trim() !== "";
|
|
756
|
+
const validAnotion = typeof anotion === "string" && anotion.trim() !== "";
|
|
757
|
+
if (validHref) {
|
|
758
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _link2.default, { href, className: _chunk6MM7HLNXjs.cn.call(void 0, itemVariants, className), children: [
|
|
759
|
+
icon,
|
|
760
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: name }),
|
|
761
|
+
validAnotion && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: anotionClass, children: anotion })
|
|
762
|
+
] });
|
|
763
|
+
}
|
|
764
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", _chunkLZLW5WCCjs.__spreadProps.call(void 0, _chunkLZLW5WCCjs.__spreadValues.call(void 0, { className: _chunk6MM7HLNXjs.cn.call(void 0, itemVariants, className) }, rest), { children: [
|
|
765
|
+
icon,
|
|
766
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: name }),
|
|
767
|
+
validAnotion && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: anotionClass, children: anotion })
|
|
768
|
+
] }));
|
|
769
|
+
}
|
|
770
|
+
function ZiaFolder(_a) {
|
|
771
|
+
var _b = _a, {
|
|
772
|
+
name,
|
|
773
|
+
anotion,
|
|
774
|
+
defaultOpen = false,
|
|
775
|
+
className,
|
|
776
|
+
children
|
|
777
|
+
} = _b, props = _chunkLZLW5WCCjs.__objRest.call(void 0, _b, [
|
|
778
|
+
"name",
|
|
779
|
+
"anotion",
|
|
780
|
+
"defaultOpen",
|
|
781
|
+
"className",
|
|
782
|
+
"children"
|
|
783
|
+
]);
|
|
784
|
+
const [open, setOpen] = _react.useState.call(void 0, defaultOpen);
|
|
785
|
+
const validAnotion = typeof anotion === "string" && anotion.trim() !== "";
|
|
786
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _collapsible.Collapsible, _chunkLZLW5WCCjs.__spreadProps.call(void 0, _chunkLZLW5WCCjs.__spreadValues.call(void 0, { open, onOpenChange: setOpen }, props), { children: [
|
|
787
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _collapsible.CollapsibleTrigger, { className: _chunk6MM7HLNXjs.cn.call(void 0, itemVariants, className, "w-full"), children: [
|
|
788
|
+
open ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.FolderOpen, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.Folder, {}),
|
|
789
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: name }),
|
|
790
|
+
validAnotion && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: anotionClass, children: anotion })
|
|
791
|
+
] }),
|
|
792
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _collapsible.CollapsibleContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "ms-2 flex flex-col border-l ps-2", children }) })
|
|
793
|
+
] }));
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
// src/fuma/mdx/toc-footer-wrapper.tsx
|
|
797
|
+
|
|
798
|
+
function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }) {
|
|
799
|
+
const showEdit = githubBaseUrl && editPath;
|
|
800
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2 items-start m-4", children: [
|
|
801
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LastUpdatedDate, { date: lastModified }),
|
|
802
|
+
copyButtonComponent,
|
|
803
|
+
showEdit && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EditOnGitHub, { url: `${githubBaseUrl}${editPath}` })
|
|
804
|
+
] });
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
// src/fuma/mdx/banner.tsx
|
|
808
|
+
var _classvarianceauthority = require('class-variance-authority');
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
var buttonVariants = _classvarianceauthority.cva.call(void 0,
|
|
812
|
+
"inline-flex items-center justify-center rounded-md p-2 text-sm font-medium transition-colors duration-100 disabled:pointer-events-none disabled:opacity-50",
|
|
813
|
+
{
|
|
814
|
+
variants: {
|
|
815
|
+
color: {
|
|
816
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
817
|
+
outline: "border hover:bg-accent hover:text-accent-foreground",
|
|
818
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
819
|
+
secondary: "border bg-secondary text-secondary-foreground hover:bg-accent hover:text-accent-foreground"
|
|
820
|
+
},
|
|
821
|
+
size: {
|
|
822
|
+
sm: "gap-1 px-2 py-1.5 text-xs",
|
|
823
|
+
icon: "p-1.5 [&_svg]:size-5",
|
|
824
|
+
"icon-sm": "p-1.5 [&_svg]:size-4.5"
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
);
|
|
829
|
+
var maskImage = "linear-gradient(to bottom,white,transparent), radial-gradient(circle at top center, white, transparent)";
|
|
830
|
+
var rainbowLayer = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
831
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
832
|
+
"div",
|
|
833
|
+
{
|
|
834
|
+
className: "absolute inset-0 z-[-1]",
|
|
835
|
+
style: {
|
|
836
|
+
maskImage,
|
|
837
|
+
maskComposite: "intersect",
|
|
838
|
+
animation: "fd-moving-banner 16s linear infinite",
|
|
839
|
+
"--start": "rgba(0,87,255,0.5)",
|
|
840
|
+
"--mid": "rgba(255,0,166,0.77)",
|
|
841
|
+
"--end": "rgba(255,77,0,0.4)",
|
|
842
|
+
"--via": "rgba(164,255,68,0.4)",
|
|
843
|
+
animationDirection: "reverse",
|
|
844
|
+
backgroundImage: "repeating-linear-gradient(60deg, var(--end), var(--start) 2%, var(--start) 5%, transparent 8%, transparent 14%, var(--via) 18%, var(--via) 22%, var(--mid) 28%, var(--mid) 30%, var(--via) 34%, var(--via) 36%, transparent, var(--end) calc(50% - 12px))",
|
|
845
|
+
backgroundSize: "200% 100%",
|
|
846
|
+
mixBlendMode: "difference"
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
),
|
|
850
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
851
|
+
"div",
|
|
852
|
+
{
|
|
853
|
+
className: "absolute inset-0 z-[-1]",
|
|
854
|
+
style: {
|
|
855
|
+
maskImage,
|
|
856
|
+
maskComposite: "intersect",
|
|
857
|
+
animation: "fd-moving-banner 20s linear infinite",
|
|
858
|
+
"--start": "rgba(255,120,120,0.5)",
|
|
859
|
+
"--mid": "rgba(36,188,255,0.4)",
|
|
860
|
+
"--end": "rgba(64,0,255,0.51)",
|
|
861
|
+
"--via": "rgba(255,89,0,0.56)",
|
|
862
|
+
backgroundImage: "repeating-linear-gradient(45deg, var(--end), var(--start) 4%, var(--start) 8%, transparent 9%, transparent 14%, var(--mid) 16%, var(--mid) 20%, transparent, var(--via) 36%, var(--via) 40%, transparent 42%, var(--end) 46%, var(--end) calc(50% - 16.8px))",
|
|
863
|
+
backgroundSize: "200% 100%",
|
|
864
|
+
mixBlendMode: "color-dodge"
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
),
|
|
868
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: `@keyframes fd-moving-banner {
|
|
869
|
+
from { background-position: 0% 0; }
|
|
870
|
+
to { background-position: 100% 0; }
|
|
871
|
+
}` })
|
|
872
|
+
] });
|
|
873
|
+
function Banner(_a) {
|
|
874
|
+
var _b = _a, {
|
|
875
|
+
id,
|
|
876
|
+
variant = "rainbow",
|
|
877
|
+
changeLayout = true,
|
|
878
|
+
height = 3
|
|
879
|
+
} = _b, props = _chunkLZLW5WCCjs.__objRest.call(void 0, _b, [
|
|
880
|
+
"id",
|
|
881
|
+
"variant",
|
|
882
|
+
"changeLayout",
|
|
883
|
+
"height"
|
|
884
|
+
]);
|
|
885
|
+
const [open, setOpen] = _react.useState.call(void 0, true);
|
|
886
|
+
const globalKey = id ? `nd-banner-${id}` : null;
|
|
887
|
+
const bannerHeight = `${height}rem`;
|
|
888
|
+
_react.useEffect.call(void 0, () => {
|
|
889
|
+
if (globalKey) setOpen(localStorage.getItem(globalKey) !== "true");
|
|
890
|
+
}, [globalKey]);
|
|
891
|
+
if (!open) return null;
|
|
892
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
893
|
+
"div",
|
|
894
|
+
_chunkLZLW5WCCjs.__spreadProps.call(void 0, _chunkLZLW5WCCjs.__spreadValues.call(void 0, {
|
|
895
|
+
id
|
|
896
|
+
}, props), {
|
|
897
|
+
className: _chunk6MM7HLNXjs.cn.call(void 0,
|
|
898
|
+
"flex flex-row items-center justify-center px-4 text-center text-sm font-medium",
|
|
899
|
+
"bg-neutral-100 dark:bg-neutral-900",
|
|
900
|
+
!open && "hidden",
|
|
901
|
+
props.className
|
|
902
|
+
),
|
|
903
|
+
style: {
|
|
904
|
+
// 将 fuma.css 中的 .sticky.top-0.z-40 样式完全移到这里
|
|
905
|
+
position: "fixed",
|
|
906
|
+
top: 0,
|
|
907
|
+
left: 0,
|
|
908
|
+
width: "100vw",
|
|
909
|
+
zIndex: 1001,
|
|
910
|
+
height: bannerHeight,
|
|
911
|
+
minHeight: bannerHeight,
|
|
912
|
+
maxHeight: bannerHeight,
|
|
913
|
+
margin: 0,
|
|
914
|
+
borderRadius: 0
|
|
915
|
+
},
|
|
916
|
+
children: [
|
|
917
|
+
globalKey ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: `.${globalKey} #${id} { display: none; }` }) : null,
|
|
918
|
+
globalKey ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
919
|
+
"script",
|
|
920
|
+
{
|
|
921
|
+
dangerouslySetInnerHTML: {
|
|
922
|
+
__html: `if (localStorage.getItem('${globalKey}') === 'true') document.documentElement.classList.add('${globalKey}');`
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
) : null,
|
|
926
|
+
variant === "rainbow" ? rainbowLayer : null,
|
|
927
|
+
props.children,
|
|
928
|
+
id ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
929
|
+
"button",
|
|
930
|
+
{
|
|
931
|
+
type: "button",
|
|
932
|
+
"aria-label": "Close Banner",
|
|
933
|
+
onClick: () => {
|
|
934
|
+
setOpen(false);
|
|
935
|
+
if (globalKey) localStorage.setItem(globalKey, "true");
|
|
936
|
+
},
|
|
937
|
+
className: _chunk6MM7HLNXjs.cn.call(void 0,
|
|
938
|
+
buttonVariants({
|
|
939
|
+
color: "ghost",
|
|
940
|
+
className: "absolute end-2 top-1/2 -translate-y-1/2 text-neutral-600 dark:text-neutral-400",
|
|
941
|
+
size: "icon"
|
|
942
|
+
})
|
|
943
|
+
),
|
|
944
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkW7K5Y2WRjs.globalLucideIcons.X, {})
|
|
945
|
+
}
|
|
946
|
+
) : null
|
|
947
|
+
]
|
|
948
|
+
})
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
exports.Mermaid = Mermaid; exports.ImageZoom = ImageZoom; exports.TrophyCard = TrophyCard; exports.ImageGrid = ImageGrid; exports.ZiaCard = ZiaCard; exports.LLMCopyButton = LLMCopyButton; exports.EditOnGitHub = EditOnGitHub; exports.LastUpdatedDate = LastUpdatedDate; exports.FumaGithubInfo = FumaGithubInfo; exports.ZiaFile = ZiaFile; exports.ZiaFolder = ZiaFolder; exports.TocFooterWrapper = TocFooterWrapper; exports.Banner = Banner;
|
|
967
|
+
//# sourceMappingURL=chunk-6PW67OXW.js.map
|