zs_library 0.4.22 → 0.4.23
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/components/dock/dock-desktop.d.ts +5 -1
- package/dist/index.js +279 -274
- package/package.json +1 -1
|
@@ -3,7 +3,11 @@ import { ElementType, FC, ReactNode } from 'react';
|
|
|
3
3
|
import { DockItem } from '.';
|
|
4
4
|
export interface DesktopIconContainerProps extends DockItem, Partial<Omit<HTMLMotionProps<"div">, "title" | "children">> {
|
|
5
5
|
mouseX: MotionValue;
|
|
6
|
-
children?: ReactNode
|
|
6
|
+
children?: ReactNode | ((params: {
|
|
7
|
+
widthIcon: MotionValue<number>;
|
|
8
|
+
heightIcon: MotionValue<number>;
|
|
9
|
+
fontSizeTransform: MotionValue<string>;
|
|
10
|
+
}) => ReactNode);
|
|
7
11
|
as?: ElementType;
|
|
8
12
|
componentClassName?: string;
|
|
9
13
|
titleClassName?: string;
|
package/dist/index.js
CHANGED
|
@@ -6,11 +6,11 @@ import Zt from "i18next";
|
|
|
6
6
|
import { initReactI18next as Qt } from "react-i18next";
|
|
7
7
|
import { jsx as t, jsxs as m, Fragment as ue } from "react/jsx-runtime";
|
|
8
8
|
import * as q from "react";
|
|
9
|
-
import eo, { createContext as st, useMemo as
|
|
9
|
+
import eo, { createContext as st, useMemo as be, useContext as it, useState as j, useRef as xe, useCallback as to, useEffect as ae, forwardRef as lt, Fragment as oo } from "react";
|
|
10
10
|
import { cx as k, css as b } from "@emotion/css";
|
|
11
11
|
import ro from "react-slick";
|
|
12
12
|
import { ReactSortable as Xe } from "react-sortablejs";
|
|
13
|
-
import { AnimatePresence as Ue, motion as R, useMotionValue as ct, useTransform as
|
|
13
|
+
import { AnimatePresence as Ue, motion as R, useMotionValue as ct, useTransform as ge, useSpring as Ae } from "framer-motion";
|
|
14
14
|
import { useMotionValue as Ps } from "framer-motion";
|
|
15
15
|
import { useLocalStorageState as no, useDebounceEffect as ao } from "ahooks";
|
|
16
16
|
import { v4 as Oe } from "uuid";
|
|
@@ -159,7 +159,7 @@ const qe = {
|
|
|
159
159
|
}, Tt = st(
|
|
160
160
|
{}
|
|
161
161
|
), Mt = (r) => {
|
|
162
|
-
const { children: e, theme: o, ...n } = r, a =
|
|
162
|
+
const { children: e, theme: o, ...n } = r, a = be(() => o === "light" ? qe : o === "dark" ? Ye : o, [o]);
|
|
163
163
|
return /* @__PURE__ */ t(Tt.Provider, { value: { theme: a, ...n }, children: e });
|
|
164
164
|
}, le = () => it(Tt), Ve = {
|
|
165
165
|
maxRow: 2,
|
|
@@ -234,161 +234,161 @@ const At = st({
|
|
|
234
234
|
onChange: n,
|
|
235
235
|
storageKey: a = "ZS_LIBRARY_DESKTOP_SORTABLE_CONFIG",
|
|
236
236
|
enableCaching: s = !0
|
|
237
|
-
} = r, [i, d] =
|
|
237
|
+
} = r, [i, d] = j(), [p, x] = j(), [l, c] = j(null), f = xe(l), [v, D] = j(null), [h, g] = j([]), [S, y] = j(
|
|
238
238
|
null
|
|
239
|
-
), [
|
|
239
|
+
), [N, u] = j(
|
|
240
240
|
null
|
|
241
|
-
), [
|
|
241
|
+
), [T, A] = j(!1), [I, C] = j(null), [H, G] = j(
|
|
242
242
|
null
|
|
243
|
-
), [
|
|
243
|
+
), [O, se] = j(!1), [re, L] = no(a, {
|
|
244
244
|
defaultValue: [],
|
|
245
245
|
listenStorageChange: !0
|
|
246
|
-
}),
|
|
246
|
+
}), X = () => {
|
|
247
247
|
D(null), clearTimeout(i), d(void 0), f.current = null;
|
|
248
|
-
}, E = (
|
|
249
|
-
D({ ...
|
|
250
|
-
}, K = (
|
|
251
|
-
const { config: z = {} } =
|
|
248
|
+
}, E = (w, B) => {
|
|
249
|
+
D({ ...w, pageX: w.pageX, pageY: w.pageY, data: B }), clearTimeout(i);
|
|
250
|
+
}, K = (w, B = !0) => {
|
|
251
|
+
const { config: z = {} } = w;
|
|
252
252
|
return z.allowContextMenu === !1 ? {} : {
|
|
253
|
-
onMouseDown: (
|
|
253
|
+
onMouseDown: (M) => {
|
|
254
254
|
d(
|
|
255
255
|
setTimeout(() => {
|
|
256
|
-
B && f.current === null && E(
|
|
256
|
+
B && f.current === null && E(M, w);
|
|
257
257
|
}, 800)
|
|
258
|
-
),
|
|
258
|
+
), A(!1), x(
|
|
259
259
|
setTimeout(() => {
|
|
260
|
-
|
|
260
|
+
A(!0);
|
|
261
261
|
}, 800)
|
|
262
262
|
);
|
|
263
263
|
},
|
|
264
264
|
onMouseUp: () => {
|
|
265
265
|
clearTimeout(p), x(void 0), clearTimeout(i), d(void 0);
|
|
266
266
|
},
|
|
267
|
-
onContextMenu: (
|
|
268
|
-
B && (
|
|
267
|
+
onContextMenu: (M) => {
|
|
268
|
+
B && (M.preventDefault(), E(M, w));
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
271
|
}, ee = to(
|
|
272
|
-
(
|
|
272
|
+
(w, B) => {
|
|
273
273
|
const z = [...B || []];
|
|
274
274
|
if (z.length > 0)
|
|
275
|
-
g((
|
|
276
|
-
const $ = [...
|
|
275
|
+
g((M) => {
|
|
276
|
+
const $ = [...M], F = (P) => {
|
|
277
277
|
var et, tt;
|
|
278
|
-
const
|
|
278
|
+
const _ = z.shift(), U = P.find((ne) => ne.id === _), te = P.findIndex((ne) => ne.id === _);
|
|
279
279
|
if (z.length && U) {
|
|
280
280
|
if (((et = U.children) == null ? void 0 : et.filter(
|
|
281
|
-
(ne) => !
|
|
282
|
-
).length) === 1 &&
|
|
283
|
-
const ne = { ...
|
|
281
|
+
(ne) => !w.some((Wt) => Wt.id === ne.id)
|
|
282
|
+
).length) === 1 && w.length === 1) {
|
|
283
|
+
const ne = { ...w[0] };
|
|
284
284
|
return P.splice(te, 1, ne), n == null || n(P), P;
|
|
285
285
|
}
|
|
286
|
-
return U.children =
|
|
286
|
+
return U.children = F(U.children || []), P.splice(te, 1, U), n == null || n(P), P;
|
|
287
287
|
}
|
|
288
288
|
if (U) {
|
|
289
|
-
if (!((tt = U.children) != null && tt.length) &&
|
|
289
|
+
if (!((tt = U.children) != null && tt.length) && w.length) {
|
|
290
290
|
const ne = { ...U };
|
|
291
|
-
return U.data = { name: "文件夹" }, U.type = "group", U.children = [ne, ...
|
|
291
|
+
return U.data = { name: "文件夹" }, U.type = "group", U.children = [ne, ...w], U.id = Oe(), P.splice(te, 1, U), n == null || n(P), P;
|
|
292
292
|
}
|
|
293
|
-
return U.children = V.uniqueArray(
|
|
293
|
+
return U.children = V.uniqueArray(w), P.splice(te, 1, U), n == null || n(P), P;
|
|
294
294
|
}
|
|
295
|
-
return V.uniqueArray(
|
|
295
|
+
return V.uniqueArray(w);
|
|
296
296
|
};
|
|
297
|
-
return V.uniqueArray(
|
|
297
|
+
return V.uniqueArray(F($));
|
|
298
298
|
});
|
|
299
299
|
else {
|
|
300
|
-
const
|
|
301
|
-
n == null || n(
|
|
300
|
+
const M = V.uniqueArray(w);
|
|
301
|
+
n == null || n(M), g(M);
|
|
302
302
|
}
|
|
303
303
|
},
|
|
304
304
|
[n]
|
|
305
|
-
), $e = (
|
|
305
|
+
), $e = (w, B) => {
|
|
306
306
|
g((z) => {
|
|
307
|
-
const
|
|
307
|
+
const M = [...z], $ = (F) => {
|
|
308
308
|
var P;
|
|
309
|
-
for (let
|
|
310
|
-
if (
|
|
311
|
-
|
|
309
|
+
for (let _ = 0; _ < F.length; _++)
|
|
310
|
+
if (F[_].id === w) {
|
|
311
|
+
F[_].config = B;
|
|
312
312
|
break;
|
|
313
|
-
} else ((P =
|
|
313
|
+
} else ((P = F[_].children) == null ? void 0 : P.length) !== void 0 && $(F[_].children);
|
|
314
314
|
};
|
|
315
|
-
return $(
|
|
315
|
+
return $(M), n == null || n(M), M;
|
|
316
316
|
});
|
|
317
|
-
}, Se = (
|
|
317
|
+
}, Se = (w, B) => {
|
|
318
318
|
g((z) => {
|
|
319
|
-
const
|
|
319
|
+
const M = [...z], $ = (F) => {
|
|
320
320
|
var P;
|
|
321
|
-
for (let
|
|
322
|
-
if (
|
|
323
|
-
|
|
321
|
+
for (let _ = 0; _ < F.length; _++)
|
|
322
|
+
if (F[_].id === w) {
|
|
323
|
+
F[_].data = B;
|
|
324
324
|
break;
|
|
325
|
-
} else ((P =
|
|
325
|
+
} else ((P = F[_].children) == null ? void 0 : P.length) !== void 0 && $(F[_].children);
|
|
326
326
|
};
|
|
327
|
-
return $(
|
|
327
|
+
return $(M), n == null || n(M), M;
|
|
328
328
|
});
|
|
329
|
-
}, Te = (
|
|
329
|
+
}, Te = (w) => {
|
|
330
330
|
g((B) => {
|
|
331
|
-
const z = [...B],
|
|
332
|
-
var
|
|
331
|
+
const z = [...B], M = ($) => {
|
|
332
|
+
var F;
|
|
333
333
|
for (let P = 0; P < $.length; P++)
|
|
334
|
-
if ($[P].id ===
|
|
334
|
+
if ($[P].id === w) {
|
|
335
335
|
$.splice(P, 1);
|
|
336
336
|
break;
|
|
337
|
-
} else ((
|
|
337
|
+
} else ((F = $[P].children) == null ? void 0 : F.length) !== void 0 && M($[P].children);
|
|
338
338
|
};
|
|
339
|
-
return
|
|
339
|
+
return M(z), n == null || n(z), z;
|
|
340
340
|
});
|
|
341
|
-
}, ie = (
|
|
342
|
-
const z = [...h],
|
|
343
|
-
const P =
|
|
344
|
-
if (
|
|
345
|
-
if (
|
|
346
|
-
|
|
341
|
+
}, ie = (w, B) => {
|
|
342
|
+
const z = [...h], M = ($, F) => {
|
|
343
|
+
const P = F.shift(), _ = $.find((te) => te.id === P), U = $.findIndex((te) => te.id === P);
|
|
344
|
+
if (_) {
|
|
345
|
+
if (F.length)
|
|
346
|
+
_.children = M(_.children || [], F);
|
|
347
347
|
else {
|
|
348
|
-
const te = (
|
|
349
|
-
|
|
350
|
-
...
|
|
348
|
+
const te = (w == null ? void 0 : w.type) ?? "app";
|
|
349
|
+
_.children = [
|
|
350
|
+
..._.children ?? [],
|
|
351
351
|
{
|
|
352
|
-
...
|
|
352
|
+
...w,
|
|
353
353
|
id: Oe(),
|
|
354
|
-
config: (
|
|
354
|
+
config: (w == null ? void 0 : w.config) ?? Be[te]
|
|
355
355
|
}
|
|
356
356
|
];
|
|
357
357
|
}
|
|
358
|
-
return $.splice(U, 1,
|
|
358
|
+
return $.splice(U, 1, _), $;
|
|
359
359
|
} else
|
|
360
360
|
return $;
|
|
361
361
|
};
|
|
362
|
-
g(
|
|
363
|
-
}, Me = (
|
|
362
|
+
g(M(z, B));
|
|
363
|
+
}, Me = (w) => {
|
|
364
364
|
g((B) => {
|
|
365
|
-
const z = (
|
|
366
|
-
...
|
|
365
|
+
const z = (w == null ? void 0 : w.type) ?? "app", M = {
|
|
366
|
+
...w,
|
|
367
367
|
id: Oe(),
|
|
368
|
-
config: (
|
|
369
|
-
}, $ = [...B,
|
|
368
|
+
config: (w == null ? void 0 : w.config) ?? Be[z]
|
|
369
|
+
}, $ = [...B, M];
|
|
370
370
|
return n == null || n($), $;
|
|
371
371
|
});
|
|
372
|
-
}, He = (
|
|
372
|
+
}, He = (w, B) => {
|
|
373
373
|
g((z) => {
|
|
374
|
-
const
|
|
375
|
-
return $ !== -1 && (
|
|
374
|
+
const M = [...z], $ = M.findIndex((F) => F.id === w);
|
|
375
|
+
return $ !== -1 && (M[$] = { ...M[$], ...B }, n == null || n(M)), M;
|
|
376
376
|
});
|
|
377
|
-
},
|
|
377
|
+
}, ye = (w) => {
|
|
378
378
|
g((B) => {
|
|
379
|
-
const z = B.filter((
|
|
379
|
+
const z = B.filter((M) => M.id !== w);
|
|
380
380
|
return n == null || n(z), z;
|
|
381
381
|
});
|
|
382
382
|
};
|
|
383
383
|
return ae(() => {
|
|
384
384
|
(o == null ? void 0 : o.length) > 0 && h.length === 0 && ee(o);
|
|
385
385
|
}, [o]), ae(() => {
|
|
386
|
-
f.current = l, l !== null &&
|
|
386
|
+
f.current = l, l !== null && X();
|
|
387
387
|
}, [l]), ae(() => {
|
|
388
|
-
s && re != null && re.length && !
|
|
389
|
-
}, [re,
|
|
388
|
+
s && re != null && re.length && !O && (ee(re), se(!0));
|
|
389
|
+
}, [re, O, s, ee]), ao(
|
|
390
390
|
() => {
|
|
391
|
-
s &&
|
|
391
|
+
s && L(h);
|
|
392
392
|
},
|
|
393
393
|
[h, s],
|
|
394
394
|
{
|
|
@@ -405,21 +405,21 @@ const At = st({
|
|
|
405
405
|
listStatus: l,
|
|
406
406
|
setListStatus: c,
|
|
407
407
|
contextMenuFuns: K,
|
|
408
|
-
hideContextMenu:
|
|
408
|
+
hideContextMenu: X,
|
|
409
409
|
showInfoItemData: S,
|
|
410
410
|
setShowInfoItemData: y,
|
|
411
|
-
openGroupItemData:
|
|
411
|
+
openGroupItemData: N,
|
|
412
412
|
setOpenGroupItemData: u,
|
|
413
|
-
longPressTriggered:
|
|
413
|
+
longPressTriggered: T,
|
|
414
414
|
updateItemConfig: $e,
|
|
415
415
|
updateItem: Se,
|
|
416
416
|
removeItem: Te,
|
|
417
417
|
addItem: ie,
|
|
418
418
|
addRootItem: Me,
|
|
419
419
|
updateRootItem: He,
|
|
420
|
-
removeRootItem:
|
|
421
|
-
moveItemId:
|
|
422
|
-
setMoveItemId:
|
|
420
|
+
removeRootItem: ye,
|
|
421
|
+
moveItemId: I,
|
|
422
|
+
setMoveItemId: C,
|
|
423
423
|
moveTargetId: H,
|
|
424
424
|
setMoveTargetId: G
|
|
425
425
|
},
|
|
@@ -509,13 +509,13 @@ const At = st({
|
|
|
509
509
|
setShowInfoItemData: c,
|
|
510
510
|
removeItem: f,
|
|
511
511
|
updateItemConfig: v
|
|
512
|
-
} = pe(), { theme: D } = le(), { light: h, dark: g } = V.getTheme(D), { data: S } = p ?? {}, { config: y = {} } = S ?? {},
|
|
513
|
-
var
|
|
514
|
-
const u = Be[(
|
|
515
|
-
for (let
|
|
516
|
-
for (let
|
|
517
|
-
|
|
518
|
-
return
|
|
512
|
+
} = pe(), { theme: D } = le(), { light: h, dark: g } = V.getTheme(D), { data: S } = p ?? {}, { config: y = {} } = S ?? {}, N = () => {
|
|
513
|
+
var A;
|
|
514
|
+
const u = Be[(A = p == null ? void 0 : p.data) == null ? void 0 : A.type], T = [];
|
|
515
|
+
for (let I = 1; I <= ((u == null ? void 0 : u.maxRow) ?? 2); I++)
|
|
516
|
+
for (let C = 1; C <= ((u == null ? void 0 : u.maxCol) ?? 2); C++)
|
|
517
|
+
T.push(`${I}x${C}`);
|
|
518
|
+
return T;
|
|
519
519
|
};
|
|
520
520
|
return /* @__PURE__ */ t(Ue, { children: p && /* @__PURE__ */ m(
|
|
521
521
|
R.div,
|
|
@@ -555,14 +555,14 @@ const At = st({
|
|
|
555
555
|
label: "修改大小",
|
|
556
556
|
key: "size",
|
|
557
557
|
icon: /* @__PURE__ */ t(so, { size: 14 }),
|
|
558
|
-
items:
|
|
558
|
+
items: N().map((u) => ({
|
|
559
559
|
label: u,
|
|
560
560
|
key: u,
|
|
561
561
|
onClick: () => {
|
|
562
|
-
const [
|
|
562
|
+
const [T, A] = u.split("x").map(Number);
|
|
563
563
|
v(p.data.id, {
|
|
564
|
-
row:
|
|
565
|
-
col:
|
|
564
|
+
row: T,
|
|
565
|
+
col: A
|
|
566
566
|
});
|
|
567
567
|
}
|
|
568
568
|
}))
|
|
@@ -608,7 +608,7 @@ const At = st({
|
|
|
608
608
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
609
609
|
gap: 0.25rem;
|
|
610
610
|
`,
|
|
611
|
-
children: u.items.map((
|
|
611
|
+
children: u.items.map((T) => /* @__PURE__ */ t(
|
|
612
612
|
R.div,
|
|
613
613
|
{
|
|
614
614
|
className: k(
|
|
@@ -635,17 +635,17 @@ const At = st({
|
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
637
|
`,
|
|
638
|
-
`${y.row}x${y.col}` ===
|
|
638
|
+
`${y.row}x${y.col}` === T.key && b`
|
|
639
639
|
background-color: ${h.contextMenuActiveColor};
|
|
640
640
|
@media (prefers-color-scheme: dark) {
|
|
641
641
|
background-color: ${g.contextMenuActiveColor};
|
|
642
642
|
}
|
|
643
643
|
`
|
|
644
644
|
),
|
|
645
|
-
onClick:
|
|
646
|
-
children:
|
|
645
|
+
onClick: T.onClick,
|
|
646
|
+
children: T.label
|
|
647
647
|
},
|
|
648
|
-
|
|
648
|
+
T.key
|
|
649
649
|
))
|
|
650
650
|
}
|
|
651
651
|
)
|
|
@@ -849,19 +849,19 @@ const At = st({
|
|
|
849
849
|
moveTargetId: f,
|
|
850
850
|
setMoveTargetId: v,
|
|
851
851
|
listStatus: D
|
|
852
|
-
} = pe(), { itemIconBuilder: h, theme: g, contextMenu: S } = le(), { light: y, dark:
|
|
852
|
+
} = pe(), { itemIconBuilder: h, theme: g, contextMenu: S } = le(), { light: y, dark: N } = V.getTheme(g), { children: u, data: T, config: A } = e, { row: I = 1, col: C = 1 } = A ?? {}, H = {
|
|
853
853
|
visible: { opacity: 1, scale: 1 },
|
|
854
854
|
hidden: { opacity: 0, scale: 0.95 }
|
|
855
|
-
}, G = ((u == null ? void 0 : u.length) ?? 0) === 0,
|
|
855
|
+
}, G = ((u == null ? void 0 : u.length) ?? 0) === 0, O = G ? [e] : [...u ?? []].slice(0, 9), se = be(() => c === e.id.toString(), [e.id, c]), re = be(() => f === e.id, [e.id, f]), L = b`
|
|
856
856
|
overflow: hidden;
|
|
857
857
|
cursor: pointer;
|
|
858
858
|
background-color: ${y.itemIconBackgroundColor};
|
|
859
859
|
box-shadow: 0 0 0.5rem ${y.itemIconShadowColor};
|
|
860
860
|
@media (prefers-color-scheme: dark) {
|
|
861
|
-
background-color: ${
|
|
862
|
-
box-shadow: 0 0 0.5rem ${
|
|
861
|
+
background-color: ${N.itemIconBackgroundColor};
|
|
862
|
+
box-shadow: 0 0 0.5rem ${N.itemIconShadowColor};
|
|
863
863
|
}
|
|
864
|
-
`,
|
|
864
|
+
`, X = () => {
|
|
865
865
|
if (G)
|
|
866
866
|
return /* @__PURE__ */ t(
|
|
867
867
|
R.div,
|
|
@@ -879,7 +879,7 @@ const At = st({
|
|
|
879
879
|
top: 0;
|
|
880
880
|
border-radius: 0.75rem;
|
|
881
881
|
@media (prefers-color-scheme: dark) {
|
|
882
|
-
background-color: ${
|
|
882
|
+
background-color: ${N.itemIconBackgroundColor};
|
|
883
883
|
}
|
|
884
884
|
`
|
|
885
885
|
),
|
|
@@ -889,7 +889,7 @@ const At = st({
|
|
|
889
889
|
children: h == null ? void 0 : h(e)
|
|
890
890
|
}
|
|
891
891
|
);
|
|
892
|
-
if (
|
|
892
|
+
if (I === 1 && C === 1 || I === 2 && C === 2)
|
|
893
893
|
return /* @__PURE__ */ t(
|
|
894
894
|
R.div,
|
|
895
895
|
{
|
|
@@ -899,17 +899,17 @@ const At = st({
|
|
|
899
899
|
height: 100%;
|
|
900
900
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
901
901
|
grid-template-rows: repeat(3, minmax(0, 1fr));
|
|
902
|
-
padding: ${
|
|
903
|
-
gap: ${
|
|
902
|
+
padding: ${C === 1 ? "0.125rem" : "0.25rem"};
|
|
903
|
+
gap: ${C === 1 ? "0.125rem" : "0.5rem"};
|
|
904
904
|
place-items: center;
|
|
905
905
|
`,
|
|
906
|
-
children:
|
|
906
|
+
children: O == null ? void 0 : O.slice(0, 9).map((E) => /* @__PURE__ */ t(
|
|
907
907
|
R.div,
|
|
908
908
|
{
|
|
909
909
|
className: k(
|
|
910
|
-
|
|
910
|
+
L,
|
|
911
911
|
b`
|
|
912
|
-
border-radius: ${
|
|
912
|
+
border-radius: ${C === 1 ? "0.25rem" : "0.5rem"};
|
|
913
913
|
width: 100%;
|
|
914
914
|
height: 100%;
|
|
915
915
|
`
|
|
@@ -923,7 +923,7 @@ const At = st({
|
|
|
923
923
|
))
|
|
924
924
|
}
|
|
925
925
|
);
|
|
926
|
-
if (
|
|
926
|
+
if (I === 1 && C === 2)
|
|
927
927
|
return /* @__PURE__ */ t(
|
|
928
928
|
R.div,
|
|
929
929
|
{
|
|
@@ -937,11 +937,11 @@ const At = st({
|
|
|
937
937
|
height: 52px;
|
|
938
938
|
place-items: center;
|
|
939
939
|
`,
|
|
940
|
-
children:
|
|
940
|
+
children: O == null ? void 0 : O.slice(0, 4).map((E, K) => /* @__PURE__ */ t(
|
|
941
941
|
R.div,
|
|
942
942
|
{
|
|
943
943
|
className: k(
|
|
944
|
-
|
|
944
|
+
L,
|
|
945
945
|
K < 2 ? b`
|
|
946
946
|
width: 52px;
|
|
947
947
|
height: 52px;
|
|
@@ -965,7 +965,7 @@ const At = st({
|
|
|
965
965
|
))
|
|
966
966
|
}
|
|
967
967
|
);
|
|
968
|
-
if (
|
|
968
|
+
if (I === 2 && C === 1)
|
|
969
969
|
return /* @__PURE__ */ t(
|
|
970
970
|
R.div,
|
|
971
971
|
{
|
|
@@ -979,11 +979,11 @@ const At = st({
|
|
|
979
979
|
height: 144px;
|
|
980
980
|
place-items: center;
|
|
981
981
|
`,
|
|
982
|
-
children:
|
|
982
|
+
children: O == null ? void 0 : O.slice(0, 4).map((E, K) => /* @__PURE__ */ t(
|
|
983
983
|
R.div,
|
|
984
984
|
{
|
|
985
985
|
className: k(
|
|
986
|
-
|
|
986
|
+
L,
|
|
987
987
|
K < 2 ? b`
|
|
988
988
|
width: 52px;
|
|
989
989
|
height: 52px;
|
|
@@ -1016,8 +1016,8 @@ const At = st({
|
|
|
1016
1016
|
childrenLength: u == null ? void 0 : u.length,
|
|
1017
1017
|
className: k(
|
|
1018
1018
|
b`
|
|
1019
|
-
grid-row: span ${
|
|
1020
|
-
grid-column: span ${
|
|
1019
|
+
grid-row: span ${I};
|
|
1020
|
+
grid-column: span ${C};
|
|
1021
1021
|
`,
|
|
1022
1022
|
o
|
|
1023
1023
|
),
|
|
@@ -1035,14 +1035,14 @@ const At = st({
|
|
|
1035
1035
|
background-color: ${y.groupItemIconBackgroundColor};
|
|
1036
1036
|
box-shadow: 0 0 0.5rem ${y.groupItemIconShadowColor};
|
|
1037
1037
|
@media (prefers-color-scheme: dark) {
|
|
1038
|
-
background-color: ${
|
|
1039
|
-
box-shadow: 0 0 0.5rem ${
|
|
1038
|
+
background-color: ${N.groupItemIconBackgroundColor};
|
|
1039
|
+
box-shadow: 0 0 0.5rem ${N.groupItemIconShadowColor};
|
|
1040
1040
|
}
|
|
1041
1041
|
/* overflow: hidden; */
|
|
1042
1042
|
transition: all 0.3s;
|
|
1043
1043
|
margin: 0 auto;
|
|
1044
|
-
width: ${
|
|
1045
|
-
height: ${
|
|
1044
|
+
width: ${C * 64 + 32 * (C - 1)}px;
|
|
1045
|
+
height: ${I * 64 + 32 * (I - 1)}px;
|
|
1046
1046
|
`
|
|
1047
1047
|
),
|
|
1048
1048
|
onClick: (E) => {
|
|
@@ -1062,7 +1062,7 @@ const At = st({
|
|
|
1062
1062
|
padding: 0.375rem;
|
|
1063
1063
|
`,
|
|
1064
1064
|
children: [
|
|
1065
|
-
|
|
1065
|
+
X(),
|
|
1066
1066
|
/* @__PURE__ */ t(
|
|
1067
1067
|
Xe,
|
|
1068
1068
|
{
|
|
@@ -1106,7 +1106,7 @@ const At = st({
|
|
|
1106
1106
|
b`
|
|
1107
1107
|
color: ${y.itemNameColor};
|
|
1108
1108
|
@media (prefers-color-scheme: dark) {
|
|
1109
|
-
color: ${
|
|
1109
|
+
color: ${N.itemNameColor};
|
|
1110
1110
|
}
|
|
1111
1111
|
`,
|
|
1112
1112
|
i && b`
|
|
@@ -1115,7 +1115,7 @@ const At = st({
|
|
|
1115
1115
|
),
|
|
1116
1116
|
variants: H,
|
|
1117
1117
|
animate: se ? "hidden" : "visible",
|
|
1118
|
-
children: (
|
|
1118
|
+
children: (T == null ? void 0 : T.name) ?? "文件夹"
|
|
1119
1119
|
}
|
|
1120
1120
|
)
|
|
1121
1121
|
]
|
|
@@ -1141,7 +1141,7 @@ const At = st({
|
|
|
1141
1141
|
setMoveItemId: d,
|
|
1142
1142
|
setMoveTargetId: p,
|
|
1143
1143
|
updateItem: x
|
|
1144
|
-
} = pe(), { theme: l } = le(), { light: c, dark: f } = V.getTheme(l), [v, D] =
|
|
1144
|
+
} = pe(), { theme: l } = le(), { light: c, dark: f } = V.getTheme(l), [v, D] = j("文件夹"), h = [...(e == null ? void 0 : e.children) ?? []];
|
|
1145
1145
|
return ae(() => {
|
|
1146
1146
|
var g;
|
|
1147
1147
|
e && D((g = e.data) == null ? void 0 : g.name);
|
|
@@ -1248,9 +1248,9 @@ const At = st({
|
|
|
1248
1248
|
fallbackOnBody: !0,
|
|
1249
1249
|
list: (e == null ? void 0 : e.children) ?? [],
|
|
1250
1250
|
setList: (g) => {
|
|
1251
|
-
var
|
|
1252
|
-
const S = g.map((
|
|
1253
|
-
S.length === (y == null ? void 0 : y.length) && S.every((
|
|
1251
|
+
var N, u;
|
|
1252
|
+
const S = g.map((T) => T.id), y = (u = (N = a.find((T) => T.id === (e == null ? void 0 : e.id))) == null ? void 0 : N.children) == null ? void 0 : u.map((T) => T.id);
|
|
1253
|
+
S.length === (y == null ? void 0 : y.length) && S.every((T, A) => T === y[A]) || S.length < ((y == null ? void 0 : y.length) ?? 0) || s(g, [...(e == null ? void 0 : e.parentIds) ?? [], e == null ? void 0 : e.id]);
|
|
1254
1254
|
},
|
|
1255
1255
|
onMove: () => (p(null), i("onMove"), !0),
|
|
1256
1256
|
onStart: (g) => {
|
|
@@ -1307,7 +1307,7 @@ const At = st({
|
|
|
1307
1307
|
sliderProps: n,
|
|
1308
1308
|
sliderRef: a,
|
|
1309
1309
|
onItemClick: s
|
|
1310
|
-
} = r, i =
|
|
1310
|
+
} = r, i = xe(null), d = xe(null), {
|
|
1311
1311
|
list: p,
|
|
1312
1312
|
setList: x,
|
|
1313
1313
|
setListStatus: l,
|
|
@@ -1318,7 +1318,7 @@ const At = st({
|
|
|
1318
1318
|
setMoveItemId: h,
|
|
1319
1319
|
setMoveTargetId: g,
|
|
1320
1320
|
addItem: S
|
|
1321
|
-
} = pe(), { pagingDotBuilder: y, pagingDotsBuilder:
|
|
1321
|
+
} = pe(), { pagingDotBuilder: y, pagingDotsBuilder: N, itemBuilder: u } = le(), T = be(() => e === !1 ? {} : {
|
|
1322
1322
|
top: b`
|
|
1323
1323
|
display: flex;
|
|
1324
1324
|
flex-direction: column;
|
|
@@ -1380,7 +1380,7 @@ const At = st({
|
|
|
1380
1380
|
touchMove: !1,
|
|
1381
1381
|
lazyLoad: "anticipated",
|
|
1382
1382
|
className: k(
|
|
1383
|
-
|
|
1383
|
+
T,
|
|
1384
1384
|
b`
|
|
1385
1385
|
.slick-track {
|
|
1386
1386
|
display: flex;
|
|
@@ -1399,14 +1399,14 @@ const At = st({
|
|
|
1399
1399
|
`,
|
|
1400
1400
|
o
|
|
1401
1401
|
),
|
|
1402
|
-
customPaging: (
|
|
1403
|
-
var
|
|
1402
|
+
customPaging: (A) => {
|
|
1403
|
+
var I, C;
|
|
1404
1404
|
if (y) {
|
|
1405
|
-
const H = y(p[
|
|
1405
|
+
const H = y(p[A], A);
|
|
1406
1406
|
return eo.cloneElement(H, {
|
|
1407
1407
|
onDragEnter: (G) => {
|
|
1408
|
-
var
|
|
1409
|
-
(
|
|
1408
|
+
var O;
|
|
1409
|
+
(O = (a ?? i).current) == null || O.slickGoTo(A), H.props && H.props.onDragEnter && H.props.onDragEnter(G);
|
|
1410
1410
|
}
|
|
1411
1411
|
});
|
|
1412
1412
|
}
|
|
@@ -1415,13 +1415,13 @@ const At = st({
|
|
|
1415
1415
|
{
|
|
1416
1416
|
onDragEnter: () => {
|
|
1417
1417
|
var H;
|
|
1418
|
-
(H = (a ?? i).current) == null || H.slickGoTo(
|
|
1418
|
+
(H = (a ?? i).current) == null || H.slickGoTo(A);
|
|
1419
1419
|
},
|
|
1420
|
-
children: (
|
|
1420
|
+
children: (C = (I = p[A]) == null ? void 0 : I.data) == null ? void 0 : C.name
|
|
1421
1421
|
}
|
|
1422
1422
|
);
|
|
1423
1423
|
},
|
|
1424
|
-
appendDots: (
|
|
1424
|
+
appendDots: (A) => N ? N(A) : e === !1 ? /* @__PURE__ */ t("div", {}) : /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
1425
1425
|
"ul",
|
|
1426
1426
|
{
|
|
1427
1427
|
ref: d,
|
|
@@ -1448,25 +1448,25 @@ const At = st({
|
|
|
1448
1448
|
}
|
|
1449
1449
|
`
|
|
1450
1450
|
),
|
|
1451
|
-
children:
|
|
1451
|
+
children: A
|
|
1452
1452
|
}
|
|
1453
1453
|
) }),
|
|
1454
1454
|
...n,
|
|
1455
|
-
children: p.map((
|
|
1455
|
+
children: p.map((A) => /* @__PURE__ */ t(
|
|
1456
1456
|
"div",
|
|
1457
1457
|
{
|
|
1458
|
-
onDrop: (
|
|
1459
|
-
|
|
1460
|
-
const
|
|
1461
|
-
if (V.quickJSONCheck(
|
|
1458
|
+
onDrop: (I) => {
|
|
1459
|
+
I.preventDefault();
|
|
1460
|
+
const C = I.dataTransfer.getData("text/plain");
|
|
1461
|
+
if (V.quickJSONCheck(C))
|
|
1462
1462
|
try {
|
|
1463
|
-
S(JSON.parse(
|
|
1463
|
+
S(JSON.parse(C), [A.id]);
|
|
1464
1464
|
} catch (G) {
|
|
1465
1465
|
console.log("drag error", G);
|
|
1466
1466
|
}
|
|
1467
1467
|
},
|
|
1468
|
-
onDragOver: (
|
|
1469
|
-
|
|
1468
|
+
onDragOver: (I) => {
|
|
1469
|
+
I.preventDefault();
|
|
1470
1470
|
},
|
|
1471
1471
|
children: /* @__PURE__ */ t(
|
|
1472
1472
|
Xe,
|
|
@@ -1487,49 +1487,49 @@ const At = st({
|
|
|
1487
1487
|
fallbackOnBody: !0,
|
|
1488
1488
|
swapThreshold: 0.65,
|
|
1489
1489
|
group: "nested",
|
|
1490
|
-
list:
|
|
1491
|
-
setList: (
|
|
1490
|
+
list: A.children ?? [],
|
|
1491
|
+
setList: (I) => x(I, [A.id]),
|
|
1492
1492
|
filter: ".drag-disabled",
|
|
1493
|
-
onMove: (
|
|
1493
|
+
onMove: (I) => {
|
|
1494
1494
|
l("onMove");
|
|
1495
|
-
const { dragged:
|
|
1496
|
-
return g(null), !((Object.keys(
|
|
1495
|
+
const { dragged: C, related: H } = I, G = C.dataset, O = H.dataset;
|
|
1496
|
+
return g(null), !((Object.keys(O).length === 0 || O.parentIds) && Number(G.childrenLength) > 0 && H.classList.contains("sortable-group-item"));
|
|
1497
1497
|
},
|
|
1498
|
-
onStart: (
|
|
1499
|
-
const
|
|
1500
|
-
|
|
1498
|
+
onStart: (I) => {
|
|
1499
|
+
const C = I.item.dataset;
|
|
1500
|
+
C != null && C.id && h(C.id), l("onMove");
|
|
1501
1501
|
},
|
|
1502
1502
|
onEnd: () => {
|
|
1503
1503
|
h(null), g(null), l(null);
|
|
1504
1504
|
},
|
|
1505
1505
|
ghostClass: Rt,
|
|
1506
|
-
children: (
|
|
1506
|
+
children: (A.children ?? []).map((I, C) => {
|
|
1507
1507
|
let H;
|
|
1508
1508
|
if (u)
|
|
1509
|
-
return u(
|
|
1510
|
-
switch (
|
|
1509
|
+
return u(I);
|
|
1510
|
+
switch (I.type) {
|
|
1511
1511
|
case "group":
|
|
1512
1512
|
case "app":
|
|
1513
1513
|
H = /* @__PURE__ */ t(
|
|
1514
1514
|
zn,
|
|
1515
1515
|
{
|
|
1516
|
-
data:
|
|
1517
|
-
itemIndex:
|
|
1518
|
-
parentIds: [
|
|
1516
|
+
data: I,
|
|
1517
|
+
itemIndex: C,
|
|
1518
|
+
parentIds: [A.id, I.id],
|
|
1519
1519
|
onClick: s
|
|
1520
1520
|
},
|
|
1521
|
-
|
|
1521
|
+
I.id
|
|
1522
1522
|
);
|
|
1523
1523
|
break;
|
|
1524
1524
|
default:
|
|
1525
1525
|
H = /* @__PURE__ */ t(
|
|
1526
1526
|
We,
|
|
1527
1527
|
{
|
|
1528
|
-
data:
|
|
1529
|
-
itemIndex:
|
|
1528
|
+
data: I,
|
|
1529
|
+
itemIndex: C,
|
|
1530
1530
|
onClick: s
|
|
1531
1531
|
},
|
|
1532
|
-
|
|
1532
|
+
I.id
|
|
1533
1533
|
);
|
|
1534
1534
|
break;
|
|
1535
1535
|
}
|
|
@@ -1538,7 +1538,7 @@ const At = st({
|
|
|
1538
1538
|
}
|
|
1539
1539
|
)
|
|
1540
1540
|
},
|
|
1541
|
-
|
|
1541
|
+
A.id
|
|
1542
1542
|
))
|
|
1543
1543
|
}
|
|
1544
1544
|
),
|
|
@@ -1595,10 +1595,10 @@ const At = st({
|
|
|
1595
1595
|
contextMenuBuilder: x
|
|
1596
1596
|
}, children: [
|
|
1597
1597
|
/* @__PURE__ */ t(() => {
|
|
1598
|
-
const y = pe(),
|
|
1598
|
+
const y = pe(), N = le();
|
|
1599
1599
|
return ae(() => {
|
|
1600
|
-
e && (typeof e == "function" ? e({ state: y, config:
|
|
1601
|
-
}, [y,
|
|
1600
|
+
e && (typeof e == "function" ? e({ state: y, config: N }) : e.current = { state: y, config: N });
|
|
1601
|
+
}, [y, N]), null;
|
|
1602
1602
|
}, {}),
|
|
1603
1603
|
/* @__PURE__ */ t(Pt, { ...D })
|
|
1604
1604
|
] }) });
|
|
@@ -1995,7 +1995,7 @@ const At = st({
|
|
|
1995
1995
|
className: s,
|
|
1996
1996
|
theme: i = "auto",
|
|
1997
1997
|
...d
|
|
1998
|
-
} = r, p =
|
|
1998
|
+
} = r, p = xe(null), {
|
|
1999
1999
|
image: x,
|
|
2000
2000
|
diffSource: l = {
|
|
2001
2001
|
viewMode: "rich-text"
|
|
@@ -2015,7 +2015,7 @@ const At = st({
|
|
|
2015
2015
|
directives: h = {
|
|
2016
2016
|
directiveDescriptors: [Lo]
|
|
2017
2017
|
}
|
|
2018
|
-
} = a ?? {}, [g, S] =
|
|
2018
|
+
} = a ?? {}, [g, S] = j("");
|
|
2019
2019
|
return ae(() => {
|
|
2020
2020
|
var y;
|
|
2021
2021
|
e !== void 0 && p.current && ((y = p.current) == null || y.setMarkdown(e), S(e));
|
|
@@ -2154,15 +2154,15 @@ const Ke = (r) => {
|
|
|
2154
2154
|
titleClassName: p = "rounded-md bg-gray-100 border dark:bg-neutral-800 dark:border-neutral-900 dark:text-white border-gray-200 text-neutral-700",
|
|
2155
2155
|
childrenClassName: x,
|
|
2156
2156
|
...l
|
|
2157
|
-
} = r, c =
|
|
2158
|
-
var
|
|
2159
|
-
const
|
|
2160
|
-
return
|
|
2161
|
-
}), v =
|
|
2157
|
+
} = r, c = xe(null), f = ge(e, (H) => {
|
|
2158
|
+
var O;
|
|
2159
|
+
const G = ((O = c.current) == null ? void 0 : O.getBoundingClientRect()) ?? { x: 0, width: 0 };
|
|
2160
|
+
return H - G.x - G.width / 2;
|
|
2161
|
+
}), v = ge(f, [-150, 0, 150], [40, 80, 40]), D = ge(f, [-150, 0, 150], [40, 80, 40]), h = ge(
|
|
2162
2162
|
f,
|
|
2163
2163
|
[-150, 0, 150],
|
|
2164
2164
|
[20, 40, 20]
|
|
2165
|
-
), g =
|
|
2165
|
+
), g = ge(
|
|
2166
2166
|
f,
|
|
2167
2167
|
[-150, 0, 150],
|
|
2168
2168
|
[20, 40, 20]
|
|
@@ -2174,7 +2174,7 @@ const Ke = (r) => {
|
|
|
2174
2174
|
mass: 0.1,
|
|
2175
2175
|
stiffness: 150,
|
|
2176
2176
|
damping: 12
|
|
2177
|
-
}),
|
|
2177
|
+
}), N = Ae(h, {
|
|
2178
2178
|
mass: 0.1,
|
|
2179
2179
|
stiffness: 150,
|
|
2180
2180
|
damping: 12
|
|
@@ -2182,20 +2182,20 @@ const Ke = (r) => {
|
|
|
2182
2182
|
mass: 0.1,
|
|
2183
2183
|
stiffness: 150,
|
|
2184
2184
|
damping: 12
|
|
2185
|
-
}), [
|
|
2185
|
+
}), T = ge(N, (H) => `${H}px`), [A, I] = j(!1), C = /* @__PURE__ */ m(
|
|
2186
2186
|
i,
|
|
2187
2187
|
{
|
|
2188
2188
|
ref: c,
|
|
2189
2189
|
style: { width: S, height: y },
|
|
2190
|
-
onMouseEnter: () =>
|
|
2191
|
-
onMouseLeave: () =>
|
|
2190
|
+
onMouseEnter: () => I(!0),
|
|
2191
|
+
onMouseLeave: () => I(!1),
|
|
2192
2192
|
className: ve(
|
|
2193
2193
|
"aspect-square flex items-center justify-center relative",
|
|
2194
2194
|
d
|
|
2195
2195
|
),
|
|
2196
2196
|
...l,
|
|
2197
2197
|
children: [
|
|
2198
|
-
o && /* @__PURE__ */ t(Ue, { children:
|
|
2198
|
+
o && /* @__PURE__ */ t(Ue, { children: A && /* @__PURE__ */ t(
|
|
2199
2199
|
R.div,
|
|
2200
2200
|
{
|
|
2201
2201
|
initial: { opacity: 0, y: 10, x: "-50%" },
|
|
@@ -2208,18 +2208,23 @@ const Ke = (r) => {
|
|
|
2208
2208
|
children: o
|
|
2209
2209
|
}
|
|
2210
2210
|
) }),
|
|
2211
|
+
" ",
|
|
2211
2212
|
/* @__PURE__ */ t(
|
|
2212
2213
|
R.div,
|
|
2213
2214
|
{
|
|
2214
|
-
style: {
|
|
2215
|
+
style: {
|
|
2216
|
+
width: N,
|
|
2217
|
+
height: u,
|
|
2218
|
+
fontSize: T
|
|
2219
|
+
},
|
|
2215
2220
|
className: ve("flex items-center justify-center", x),
|
|
2216
|
-
children: s || n
|
|
2221
|
+
children: typeof s == "function" ? s({ widthIcon: N, heightIcon: u, fontSizeTransform: T }) : s || n
|
|
2217
2222
|
}
|
|
2218
2223
|
)
|
|
2219
2224
|
]
|
|
2220
2225
|
}
|
|
2221
2226
|
);
|
|
2222
|
-
return a ? /* @__PURE__ */ t("a", { href: a, children:
|
|
2227
|
+
return a ? /* @__PURE__ */ t("a", { href: a, children: C }) : C;
|
|
2223
2228
|
}, Je = (r) => {
|
|
2224
2229
|
const {
|
|
2225
2230
|
items: e = [],
|
|
@@ -2281,7 +2286,7 @@ const Ke = (r) => {
|
|
|
2281
2286
|
autoHidden: a = !1,
|
|
2282
2287
|
itemBuilder: s,
|
|
2283
2288
|
children: i
|
|
2284
|
-
} = r, [d, p] =
|
|
2289
|
+
} = r, [d, p] = j(!1), x = () => {
|
|
2285
2290
|
p(!d);
|
|
2286
2291
|
};
|
|
2287
2292
|
return /* @__PURE__ */ m(
|
|
@@ -2452,30 +2457,30 @@ function Wn(r) {
|
|
|
2452
2457
|
v = Re(v, c);
|
|
2453
2458
|
const { from: D, to: h } = c.state.selection, g = D - h, S = Re(D, c);
|
|
2454
2459
|
let y = !1;
|
|
2455
|
-
const
|
|
2456
|
-
if (
|
|
2460
|
+
const N = c.state.doc.resolve(S);
|
|
2461
|
+
if (N.node().type.name === "doc") y = !0;
|
|
2457
2462
|
else {
|
|
2458
|
-
const
|
|
2463
|
+
const C = J.create(
|
|
2459
2464
|
c.state.doc,
|
|
2460
|
-
|
|
2465
|
+
N.before()
|
|
2461
2466
|
);
|
|
2462
|
-
y = !(v + 1 >=
|
|
2467
|
+
y = !(v + 1 >= C.$from.pos && v <= C.$to.pos);
|
|
2463
2468
|
}
|
|
2464
2469
|
let u = c.state.selection;
|
|
2465
2470
|
if (!y && g !== 0 && !(c.state.selection instanceof J)) {
|
|
2466
|
-
const
|
|
2471
|
+
const C = J.create(c.state.doc, h - 1);
|
|
2467
2472
|
u = tn.create(
|
|
2468
2473
|
c.state.doc,
|
|
2469
2474
|
v,
|
|
2470
|
-
|
|
2475
|
+
C.$to.pos
|
|
2471
2476
|
);
|
|
2472
2477
|
} else if (u = J.create(c.state.doc, v), u.node.type.isInline || u.node.type.name === "tableRow") {
|
|
2473
|
-
const
|
|
2474
|
-
u = J.create(c.state.doc,
|
|
2478
|
+
const C = c.state.doc.resolve(u.from);
|
|
2479
|
+
u = J.create(c.state.doc, C.before());
|
|
2475
2480
|
}
|
|
2476
2481
|
c.dispatch(c.state.tr.setSelection(u)), c.state.selection instanceof J && c.state.selection.node.type.name === "listItem" && (e = f.parentElement.tagName);
|
|
2477
|
-
const
|
|
2478
|
-
l.dataTransfer.clearData(), l.dataTransfer.setData("text/html",
|
|
2482
|
+
const T = c.state.selection.content(), { dom: A, text: I } = Yn(c, T);
|
|
2483
|
+
l.dataTransfer.clearData(), l.dataTransfer.setData("text/html", A.innerHTML), l.dataTransfer.setData("text/plain", I), l.dataTransfer.effectAllowed = "copyMove", l.dataTransfer.setDragImage(f, 0, 0), c.dragging = { slice: T, move: l.ctrlKey };
|
|
2479
2484
|
}
|
|
2480
2485
|
let a = null;
|
|
2481
2486
|
function s() {
|
|
@@ -2516,31 +2521,31 @@ function Wn(r) {
|
|
|
2516
2521
|
var h, g, S, y;
|
|
2517
2522
|
const c = r.dragHandleSelector ? document.querySelector(r.dragHandleSelector) : null;
|
|
2518
2523
|
a = c ?? document.createElement("div"), a.draggable = !0, a.dataset.dragHandle = "", a.classList.add("drag-handle");
|
|
2519
|
-
function f(
|
|
2520
|
-
n(
|
|
2524
|
+
function f(N) {
|
|
2525
|
+
n(N, l);
|
|
2521
2526
|
}
|
|
2522
2527
|
a.addEventListener("dragstart", f);
|
|
2523
|
-
function v(
|
|
2524
|
-
c || (
|
|
2528
|
+
function v(N) {
|
|
2529
|
+
c || (N.preventDefault(), N.stopPropagation());
|
|
2525
2530
|
const u = a == null ? void 0 : a.dataset.nodePos;
|
|
2526
2531
|
u && d(l, parseInt(u, 10));
|
|
2527
2532
|
}
|
|
2528
2533
|
a.addEventListener("click", v);
|
|
2529
|
-
function D(
|
|
2534
|
+
function D(N) {
|
|
2530
2535
|
s();
|
|
2531
2536
|
const u = window.scrollY;
|
|
2532
|
-
|
|
2537
|
+
N.clientY < r.scrollTreshold ? window.scrollTo({ top: u - 30, behavior: "smooth" }) : window.innerHeight - N.clientY < r.scrollTreshold && window.scrollTo({ top: u + 30, behavior: "smooth" });
|
|
2533
2538
|
}
|
|
2534
2539
|
return a.addEventListener("drag", D), s(), c || (g = (h = l == null ? void 0 : l.dom) == null ? void 0 : h.parentElement) == null || g.appendChild(a), (y = (S = l == null ? void 0 : l.dom) == null ? void 0 : S.parentElement) == null || y.addEventListener(
|
|
2535
2540
|
"mouseout",
|
|
2536
2541
|
x
|
|
2537
2542
|
), {
|
|
2538
2543
|
destroy: () => {
|
|
2539
|
-
var
|
|
2540
|
-
c || (
|
|
2544
|
+
var N, u, T;
|
|
2545
|
+
c || (N = a == null ? void 0 : a.remove) == null || N.call(a), a == null || a.removeEventListener("drag", D), a == null || a.removeEventListener(
|
|
2541
2546
|
"dragstart",
|
|
2542
2547
|
f
|
|
2543
|
-
), a == null || a.removeEventListener("click", v), a = null, (
|
|
2548
|
+
), a == null || a.removeEventListener("click", v), a = null, (T = (u = l == null ? void 0 : l.dom) == null ? void 0 : u.parentElement) == null || T.removeEventListener(
|
|
2544
2549
|
"mouseout",
|
|
2545
2550
|
x
|
|
2546
2551
|
);
|
|
@@ -2567,8 +2572,8 @@ function Wn(r) {
|
|
|
2567
2572
|
h != null && h >= 0 && (a.dataset.nodePos = String(
|
|
2568
2573
|
Re(h, l)
|
|
2569
2574
|
));
|
|
2570
|
-
const g = window.getComputedStyle(f), S = parseInt(g.lineHeight, 10), y = isNaN(S) ? parseInt(g.fontSize) * 1.2 : S,
|
|
2571
|
-
u.top += (y - 24) / 2, u.top +=
|
|
2575
|
+
const g = window.getComputedStyle(f), S = parseInt(g.lineHeight, 10), y = isNaN(S) ? parseInt(g.fontSize) * 1.2 : S, N = parseInt(g.paddingTop, 10), u = Vn(f);
|
|
2576
|
+
u.top += (y - 24) / 2, u.top += N, f.matches("ul:not([data-type=taskList]) li, ol li") && (u.left -= r.dragHandleWidth - 28), u.width = r.dragHandleWidth, a && (a.style.position = "absolute", a.style.left = `${u.left - u.width}px`, a.style.top = `${u.top}px`, i());
|
|
2572
2577
|
},
|
|
2573
2578
|
keydown: () => {
|
|
2574
2579
|
o || s();
|
|
@@ -3033,7 +3038,7 @@ function fa(r) {
|
|
|
3033
3038
|
}
|
|
3034
3039
|
}
|
|
3035
3040
|
const ha = ({ open: r, onOpenChange: e }) => {
|
|
3036
|
-
const o =
|
|
3041
|
+
const o = xe(null), { editor: n } = Q();
|
|
3037
3042
|
return ae(() => {
|
|
3038
3043
|
var a;
|
|
3039
3044
|
(a = o.current) == null || a.focus();
|
|
@@ -3232,7 +3237,7 @@ const ha = ({ open: r, onOpenChange: e }) => {
|
|
|
3232
3237
|
))
|
|
3233
3238
|
] })
|
|
3234
3239
|
] });
|
|
3235
|
-
},
|
|
3240
|
+
}, fe = q.forwardRef(
|
|
3236
3241
|
({ className: r, orientation: e = "horizontal", decorative: o = !0, ...n }, a) => /* @__PURE__ */ t(
|
|
3237
3242
|
St.Root,
|
|
3238
3243
|
{
|
|
@@ -3248,7 +3253,7 @@ const ha = ({ open: r, onOpenChange: e }) => {
|
|
|
3248
3253
|
}
|
|
3249
3254
|
)
|
|
3250
3255
|
);
|
|
3251
|
-
|
|
3256
|
+
fe.displayName = St.Root.displayName;
|
|
3252
3257
|
const ya = () => /* @__PURE__ */ m("div", { className: "flex items-center justify-center gap-0.5", children: [
|
|
3253
3258
|
/* @__PURE__ */ t("div", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-purple-500 [animation-delay:-0.3s]" }),
|
|
3254
3259
|
/* @__PURE__ */ t("div", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-purple-500 [animation-delay:-0.15s]" }),
|
|
@@ -3404,7 +3409,7 @@ const Qe = q.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ t(
|
|
|
3404
3409
|
}
|
|
3405
3410
|
));
|
|
3406
3411
|
Qe.displayName = W.Separator.displayName;
|
|
3407
|
-
const
|
|
3412
|
+
const he = q.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ t(
|
|
3408
3413
|
W.Item,
|
|
3409
3414
|
{
|
|
3410
3415
|
ref: o,
|
|
@@ -3415,7 +3420,7 @@ const fe = q.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ t(
|
|
|
3415
3420
|
...e
|
|
3416
3421
|
}
|
|
3417
3422
|
));
|
|
3418
|
-
|
|
3423
|
+
he.displayName = W.Item.displayName;
|
|
3419
3424
|
const Sa = ({
|
|
3420
3425
|
completion: r,
|
|
3421
3426
|
onDiscard: e
|
|
@@ -3424,7 +3429,7 @@ const Sa = ({
|
|
|
3424
3429
|
return /* @__PURE__ */ m(ue, { children: [
|
|
3425
3430
|
/* @__PURE__ */ m(Ne, { children: [
|
|
3426
3431
|
/* @__PURE__ */ m(
|
|
3427
|
-
|
|
3432
|
+
he,
|
|
3428
3433
|
{
|
|
3429
3434
|
className: "gap-2 px-4",
|
|
3430
3435
|
value: "replace",
|
|
@@ -3445,7 +3450,7 @@ const Sa = ({
|
|
|
3445
3450
|
}
|
|
3446
3451
|
),
|
|
3447
3452
|
/* @__PURE__ */ m(
|
|
3448
|
-
|
|
3453
|
+
he,
|
|
3449
3454
|
{
|
|
3450
3455
|
className: "gap-2 px-4",
|
|
3451
3456
|
value: "insert",
|
|
@@ -3461,7 +3466,7 @@ const Sa = ({
|
|
|
3461
3466
|
)
|
|
3462
3467
|
] }),
|
|
3463
3468
|
/* @__PURE__ */ t(Qe, {}),
|
|
3464
|
-
/* @__PURE__ */ t(Ne, { children: /* @__PURE__ */ m(
|
|
3469
|
+
/* @__PURE__ */ t(Ne, { children: /* @__PURE__ */ m(he, { onSelect: e, value: "thrash", className: "gap-2 px-4", children: [
|
|
3465
3470
|
/* @__PURE__ */ t(un, { className: "h-4 w-4 text-muted-foreground" }),
|
|
3466
3471
|
"丢弃"
|
|
3467
3472
|
] }) })
|
|
@@ -3497,7 +3502,7 @@ const Sa = ({
|
|
|
3497
3502
|
/* @__PURE__ */ m(Ne, { heading: "编辑或校对选中文本", children: [
|
|
3498
3503
|
" ",
|
|
3499
3504
|
Ta.map((o) => /* @__PURE__ */ m(
|
|
3500
|
-
|
|
3505
|
+
he,
|
|
3501
3506
|
{
|
|
3502
3507
|
onSelect: (n) => {
|
|
3503
3508
|
const a = e.state.selection.content(), s = e.storage.markdown.serializer.serialize(
|
|
@@ -3519,7 +3524,7 @@ const Sa = ({
|
|
|
3519
3524
|
/* @__PURE__ */ m(Ne, { heading: "使用 AI 完成更多", children: [
|
|
3520
3525
|
" ",
|
|
3521
3526
|
/* @__PURE__ */ m(
|
|
3522
|
-
|
|
3527
|
+
he,
|
|
3523
3528
|
{
|
|
3524
3529
|
onSelect: () => {
|
|
3525
3530
|
const o = e.state.selection.from, n = Ar(e, o);
|
|
@@ -3537,7 +3542,7 @@ const Sa = ({
|
|
|
3537
3542
|
] });
|
|
3538
3543
|
};
|
|
3539
3544
|
function La({ onOpenChange: r, options: e }) {
|
|
3540
|
-
const { editor: o } = Q(), [n, a] =
|
|
3545
|
+
const { editor: o } = Q(), [n, a] = j(""), { completion: s, complete: i, isLoading: d } = Nn({
|
|
3541
3546
|
// id: "novel",
|
|
3542
3547
|
api: "/api/generate",
|
|
3543
3548
|
onResponse: (x) => {
|
|
@@ -4074,30 +4079,30 @@ const Ea = ({ children: r, ...e }) => {
|
|
|
4074
4079
|
editorRef: x,
|
|
4075
4080
|
enableAI: l = !1,
|
|
4076
4081
|
aiOptions: c
|
|
4077
|
-
} = r, [f, v] =
|
|
4082
|
+
} = r, [f, v] = j(
|
|
4078
4083
|
o
|
|
4079
|
-
), [D, h] =
|
|
4080
|
-
const
|
|
4081
|
-
return
|
|
4084
|
+
), [D, h] = j("Saved"), [g, S] = j(), [y, N] = j(!1), [u, T] = j(!1), [A, I] = j(!1), [C, H] = j(!1), G = (L) => {
|
|
4085
|
+
const X = new DOMParser().parseFromString(L, "text/html");
|
|
4086
|
+
return X.querySelectorAll("pre code").forEach((E) => {
|
|
4082
4087
|
In.highlightElement(E);
|
|
4083
|
-
}), new XMLSerializer().serializeToString(
|
|
4084
|
-
},
|
|
4085
|
-
async (
|
|
4086
|
-
const
|
|
4087
|
-
S(
|
|
4088
|
+
}), new XMLSerializer().serializeToString(X);
|
|
4089
|
+
}, O = Yr(
|
|
4090
|
+
async (L) => {
|
|
4091
|
+
const X = L.getJSON();
|
|
4092
|
+
S(L.storage.characterCount.words()), n == null || n(X), s && (window.localStorage.setItem(
|
|
4088
4093
|
"html-content",
|
|
4089
|
-
G(
|
|
4090
|
-
), window.localStorage.setItem(a, JSON.stringify(
|
|
4094
|
+
G(L.getHTML())
|
|
4095
|
+
), window.localStorage.setItem(a, JSON.stringify(X)), window.localStorage.setItem(
|
|
4091
4096
|
"markdown",
|
|
4092
|
-
|
|
4097
|
+
L.storage.markdown.getMarkdown()
|
|
4093
4098
|
), h("Saved"));
|
|
4094
4099
|
},
|
|
4095
4100
|
500
|
|
4096
|
-
), se =
|
|
4101
|
+
), se = be(() => {
|
|
4097
4102
|
if (!p) return Ra;
|
|
4098
4103
|
const {
|
|
4099
|
-
beforeUpload:
|
|
4100
|
-
maxSize:
|
|
4104
|
+
beforeUpload: L,
|
|
4105
|
+
maxSize: X,
|
|
4101
4106
|
action: E,
|
|
4102
4107
|
headers: K,
|
|
4103
4108
|
method: ee,
|
|
@@ -4116,33 +4121,33 @@ const Ea = ({ children: r, ...e }) => {
|
|
|
4116
4121
|
},
|
|
4117
4122
|
body: Me
|
|
4118
4123
|
});
|
|
4119
|
-
return new Promise((
|
|
4124
|
+
return new Promise((ye, w) => {
|
|
4120
4125
|
He.then(async (B) => {
|
|
4121
4126
|
if (Se) {
|
|
4122
4127
|
const z = await B.json();
|
|
4123
|
-
|
|
4128
|
+
ye(Se(z));
|
|
4124
4129
|
return;
|
|
4125
4130
|
}
|
|
4126
4131
|
if (B.status === 200) {
|
|
4127
|
-
const { url: z } = await B.json(),
|
|
4128
|
-
|
|
4129
|
-
|
|
4132
|
+
const { url: z } = await B.json(), M = new Image();
|
|
4133
|
+
M.src = z, M.onload = () => {
|
|
4134
|
+
ye(z);
|
|
4130
4135
|
};
|
|
4131
|
-
} else throw B.status === 401 ? (
|
|
4136
|
+
} else throw B.status === 401 ? (ye(ie), new Error(
|
|
4132
4137
|
"`BLOB_READ_WRITE_TOKEN` environment variable not found, reading image locally instead."
|
|
4133
4138
|
)) : new Error("Error uploading image. Please try again.");
|
|
4134
4139
|
}).catch((B) => {
|
|
4135
|
-
Te && Te(B),
|
|
4140
|
+
Te && Te(B), w(B);
|
|
4136
4141
|
});
|
|
4137
4142
|
});
|
|
4138
4143
|
},
|
|
4139
|
-
validateFn: (ie) =>
|
|
4144
|
+
validateFn: (ie) => L ? L(ie) : ie.type.includes("image/") ? X && ie.size > X ? (console.error("File size too big (max 20MB)."), !1) : !0 : (console.error("File type not supported."), !1)
|
|
4140
4145
|
});
|
|
4141
4146
|
}, [p]);
|
|
4142
4147
|
if (ae(() => {
|
|
4143
4148
|
if (!s) return;
|
|
4144
|
-
const
|
|
4145
|
-
v(
|
|
4149
|
+
const L = window.localStorage.getItem(a);
|
|
4150
|
+
v(L ? JSON.parse(L) : za);
|
|
4146
4151
|
}, [a, s]), !f) return null;
|
|
4147
4152
|
const re = [
|
|
4148
4153
|
...Ot,
|
|
@@ -4167,24 +4172,24 @@ const Ea = ({ children: r, ...e }) => {
|
|
|
4167
4172
|
/* @__PURE__ */ t($r, { children: /* @__PURE__ */ m(
|
|
4168
4173
|
Hr,
|
|
4169
4174
|
{
|
|
4170
|
-
onCreate: ({ editor:
|
|
4171
|
-
x && (x.current =
|
|
4175
|
+
onCreate: ({ editor: L }) => {
|
|
4176
|
+
x && (x.current = L);
|
|
4172
4177
|
},
|
|
4173
4178
|
initialContent: f,
|
|
4174
4179
|
extensions: re,
|
|
4175
4180
|
className: "relative min-h-[500px] w-full max-w-screen-lg border-muted bg-background sm:mb-[calc(20vh)] sm:rounded-lg sm:border sm:shadow-lg editor-content",
|
|
4176
4181
|
editorProps: {
|
|
4177
4182
|
handleDOMEvents: {
|
|
4178
|
-
keydown: (
|
|
4183
|
+
keydown: (L, X) => _r(X)
|
|
4179
4184
|
},
|
|
4180
|
-
handlePaste: (
|
|
4181
|
-
handleDrop: (
|
|
4185
|
+
handlePaste: (L, X) => Fr(L, X, se),
|
|
4186
|
+
handleDrop: (L, X, E, K) => Or(L, X, K, se),
|
|
4182
4187
|
attributes: {
|
|
4183
4188
|
class: "prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full"
|
|
4184
4189
|
}
|
|
4185
4190
|
},
|
|
4186
|
-
onUpdate: ({ editor:
|
|
4187
|
-
|
|
4191
|
+
onUpdate: ({ editor: L }) => {
|
|
4192
|
+
O(L), h("Unsaved");
|
|
4188
4193
|
},
|
|
4189
4194
|
slotAfter: /* @__PURE__ */ t(qr, {}),
|
|
4190
4195
|
children: [
|
|
@@ -4192,41 +4197,41 @@ const Ea = ({ children: r, ...e }) => {
|
|
|
4192
4197
|
/* @__PURE__ */ t(Xr, { className: "px-2 text-muted-foreground", children: "没有结果" }),
|
|
4193
4198
|
/* @__PURE__ */ t(Ur, { children: qt({
|
|
4194
4199
|
uploadFn: se
|
|
4195
|
-
}).map((
|
|
4200
|
+
}).map((L) => /* @__PURE__ */ m(
|
|
4196
4201
|
Gr,
|
|
4197
4202
|
{
|
|
4198
|
-
value:
|
|
4199
|
-
onCommand: (
|
|
4203
|
+
value: L.title,
|
|
4204
|
+
onCommand: (X) => L.command(X),
|
|
4200
4205
|
className: "flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm hover:bg-accent aria-selected:bg-accent",
|
|
4201
4206
|
children: [
|
|
4202
|
-
/* @__PURE__ */ t("div", { className: "flex h-10 w-10 items-center justify-center rounded-md border border-muted bg-background", children:
|
|
4207
|
+
/* @__PURE__ */ t("div", { className: "flex h-10 w-10 items-center justify-center rounded-md border border-muted bg-background", children: L.icon }),
|
|
4203
4208
|
/* @__PURE__ */ m("div", { children: [
|
|
4204
|
-
/* @__PURE__ */ t("p", { className: "font-medium", children:
|
|
4205
|
-
/* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children:
|
|
4209
|
+
/* @__PURE__ */ t("p", { className: "font-medium", children: L.title }),
|
|
4210
|
+
/* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: L.description })
|
|
4206
4211
|
] })
|
|
4207
4212
|
]
|
|
4208
4213
|
},
|
|
4209
|
-
|
|
4214
|
+
L.title
|
|
4210
4215
|
)) })
|
|
4211
4216
|
] }),
|
|
4212
4217
|
/* @__PURE__ */ m(
|
|
4213
4218
|
Aa,
|
|
4214
4219
|
{
|
|
4215
|
-
open:
|
|
4220
|
+
open: C,
|
|
4216
4221
|
onOpenChange: H,
|
|
4217
4222
|
enableAI: l,
|
|
4218
4223
|
aiOptions: c,
|
|
4219
4224
|
children: [
|
|
4220
|
-
l && /* @__PURE__ */ t(
|
|
4221
|
-
/* @__PURE__ */ t(xa, { open: y, onOpenChange:
|
|
4222
|
-
/* @__PURE__ */ t(
|
|
4223
|
-
/* @__PURE__ */ t(ha, { open:
|
|
4224
|
-
/* @__PURE__ */ t(
|
|
4225
|
+
l && /* @__PURE__ */ t(fe, { orientation: "vertical" }),
|
|
4226
|
+
/* @__PURE__ */ t(xa, { open: y, onOpenChange: N }),
|
|
4227
|
+
/* @__PURE__ */ t(fe, { orientation: "vertical" }),
|
|
4228
|
+
/* @__PURE__ */ t(ha, { open: A, onOpenChange: I }),
|
|
4229
|
+
/* @__PURE__ */ t(fe, { orientation: "vertical" }),
|
|
4225
4230
|
/* @__PURE__ */ t(ba, {}),
|
|
4226
|
-
/* @__PURE__ */ t(
|
|
4231
|
+
/* @__PURE__ */ t(fe, { orientation: "vertical" }),
|
|
4227
4232
|
/* @__PURE__ */ t(Pa, {}),
|
|
4228
|
-
/* @__PURE__ */ t(
|
|
4229
|
-
/* @__PURE__ */ t(pa, { open: u, onOpenChange:
|
|
4233
|
+
/* @__PURE__ */ t(fe, { orientation: "vertical" }),
|
|
4234
|
+
/* @__PURE__ */ t(pa, { open: u, onOpenChange: T })
|
|
4230
4235
|
]
|
|
4231
4236
|
}
|
|
4232
4237
|
),
|
|
@@ -4236,7 +4241,7 @@ const Ea = ({ children: r, ...e }) => {
|
|
|
4236
4241
|
) })
|
|
4237
4242
|
] });
|
|
4238
4243
|
}, Oa = ({ json: r }) => {
|
|
4239
|
-
const e =
|
|
4244
|
+
const e = be(() => Tn(r ?? {}, Ot), [r]);
|
|
4240
4245
|
return /* @__PURE__ */ t("div", { className: "tiptap ProseMirror prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full", children: /* @__PURE__ */ t("div", { dangerouslySetInnerHTML: { __html: e } }) });
|
|
4241
4246
|
}, Vt = Ha;
|
|
4242
4247
|
Vt.Preview = Oa;
|