zs_library 0.3.8 → 0.3.9

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/index.js DELETED
@@ -1,1696 +0,0 @@
1
- var Ne = Object.defineProperty;
2
- var $e = (a, e, r) => e in a ? Ne(a, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[e] = r;
3
- var ne = (a, e, r) => $e(a, typeof e != "symbol" ? e + "" : e, r);
4
- import { jsx as t, jsxs as q, Fragment as le } from "E:/Projects/Private/zs_library/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js";
5
- import { cx as $, css as i } from "E:/Projects/Private/zs_library/node_modules/.pnpm/@emotion+css@11.13.0/node_modules/@emotion/css/dist/emotion-css.esm.js";
6
- import { createContext as ge, useMemo as oe, useContext as pe, useState as j, useRef as ae, useEffect as ee } from "E:/Projects/Private/zs_library/node_modules/.pnpm/react@18.3.1/node_modules/react/index.js";
7
- import Be from "E:/Projects/Private/zs_library/node_modules/.pnpm/react-slick@0.30.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-slick/lib/index.js";
8
- import { ReactSortable as se } from "E:/Projects/Private/zs_library/node_modules/.pnpm/react-sortablejs@6.1.4_@types+sortablejs@1.15.8_react-dom@18.3.1_react@18.3.1__react@18.3.1_sortablejs@1.15.3/node_modules/react-sortablejs/dist/index.js";
9
- import "E:/Projects/Private/zs_library/node_modules/.pnpm/slick-carousel@1.8.1_jquery@3.7.1/node_modules/slick-carousel/slick/slick-theme.css";
10
- import "E:/Projects/Private/zs_library/node_modules/.pnpm/slick-carousel@1.8.1_jquery@3.7.1/node_modules/slick-carousel/slick/slick.css";
11
- import { AnimatePresence as De, motion as v } from "E:/Projects/Private/zs_library/node_modules/.pnpm/framer-motion@11.5.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/index.mjs";
12
- import { useLocalStorageState as Pe, useDebounceEffect as Le } from "E:/Projects/Private/zs_library/node_modules/.pnpm/ahooks@3.8.1_react@18.3.1/node_modules/ahooks/es/index.js";
13
- import { v4 as me } from "E:/Projects/Private/zs_library/node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-browser/index.js";
14
- import Re from "E:/Projects/Private/zs_library/node_modules/.pnpm/rc-tooltip@6.2.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-tooltip/es/index.js";
15
- import "E:/Projects/Private/zs_library/node_modules/.pnpm/rc-tooltip@6.2.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-tooltip/assets/bootstrap_white.css";
16
- import { RiPencilRuler2Line as Ae, RiShareLine as ze, RiInformationLine as Ee, RiCloseCircleLine as Xe } from "E:/Projects/Private/zs_library/node_modules/.pnpm/@remixicon+react@4.2.0_react@18.3.1/node_modules/@remixicon/react/index.mjs";
17
- import he from "E:/Projects/Private/zs_library/node_modules/.pnpm/rc-dialog@9.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-dialog/es/index.js";
18
- import "E:/Projects/Private/zs_library/node_modules/.pnpm/rc-dialog@9.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-dialog/assets/index.css";
19
- import Ge from "E:/Projects/Private/zs_library/node_modules/.pnpm/react-json-view@1.21.3_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-json-view/dist/main.js";
20
- import { MDXEditor as Ye, toolbarPlugin as je, DiffSourceToggleWrapper as qe, UndoRedo as Fe, Separator as K, BoldItalicUnderlineToggles as Ue, CodeToggle as Ve, StrikeThroughSupSubToggles as Je, ListsToggle as Ke, CreateLink as He, InsertImage as _e, InsertTable as We, InsertThematicBreak as Ze, InsertCodeBlock as Oe, ConditionalContents as Qe, InsertAdmonition as et, InsertFrontmatter as tt, diffSourcePlugin as ot, listsPlugin as rt, quotePlugin as nt, headingsPlugin as it, linkPlugin as at, linkDialogPlugin as lt, imagePlugin as st, tablePlugin as ct, thematicBreakPlugin as dt, frontmatterPlugin as ut, codeBlockPlugin as mt, codeMirrorPlugin as gt, markdownShortcutPlugin as pt, directivesPlugin as ht, AdmonitionDirectiveDescriptor as ft } from "E:/Projects/Private/zs_library/node_modules/.pnpm/@mdxeditor+editor@3.11.3_@codemirror+language@6.10.2_@lezer+common@1.2.1_@lezer+highlight@1.2_hb5siswbm5zateow6zcvbwvsv4/node_modules/@mdxeditor/editor/dist/index.js";
21
- import "E:/Projects/Private/zs_library/node_modules/.pnpm/@mdxeditor+editor@3.11.3_@codemirror+language@6.10.2_@lezer+common@1.2.1_@lezer+highlight@1.2_hb5siswbm5zateow6zcvbwvsv4/node_modules/@mdxeditor/editor/dist/style.css";
22
- import "E:/Projects/Private/zs_library/node_modules/.pnpm/github-markdown-css@5.6.1/node_modules/github-markdown-css/github-markdown.css";
23
- const fe = {
24
- token: {
25
- itemNameColor: "#1a1a1a",
26
- itemIconBackgroundColor: "white",
27
- itemIconShadowColor: "rgba(0, 0, 0, 0.1)",
28
- groupItemIconBackgroundColor: "rgba(255, 255, 255, 0.1)",
29
- groupItemIconShadowColor: "rgba(0, 0, 0, 0.1)",
30
- groupItemModalBackgroundColor: "rgba(255, 255, 255, 0.8)",
31
- contextMenuTextColor: "black",
32
- contextMenuActiveColor: "#f3f4f6",
33
- contextMenuBackgroundColor: "white",
34
- contextMenuShadowColor: "rgba(0, 0, 0, 0.1)"
35
- }
36
- }, be = {
37
- token: {
38
- itemNameColor: "white",
39
- itemIconBackgroundColor: "#1f2937",
40
- itemIconShadowColor: "rgba(0, 0, 0, 0.1)",
41
- groupItemIconBackgroundColor: "rgba(0, 0, 0, 0.1)",
42
- groupItemIconShadowColor: "rgba(0, 0, 0, 0.1)",
43
- groupItemModalBackgroundColor: "rgba(0, 0, 0, 0.1)",
44
- contextMenuTextColor: "white",
45
- contextMenuActiveColor: "#1a1a1a",
46
- contextMenuBackgroundColor: "#1a1a1a",
47
- contextMenuShadowColor: "rgba(255, 255, 255, 0.1)"
48
- }
49
- }, ke = ge(
50
- {}
51
- ), bt = (a) => {
52
- const { children: e, theme: r, ...o } = a, m = oe(() => r === "light" ? fe : r === "dark" ? be : r, [r]);
53
- return /* @__PURE__ */ t(ke.Provider, { value: { theme: m, ...o }, children: e });
54
- }, Z = () => pe(ke), xe = {
55
- maxRow: 2,
56
- maxCol: 2
57
- }, kt = {
58
- ...xe
59
- }, ve = {
60
- app: xe,
61
- group: kt
62
- };
63
- class F {
64
- }
65
- /** 清理重复id */
66
- ne(F, "uniqueArray", (e) => e.reduce((r, o) => r.find((n) => n.id === o.id) ? r : r.concat([o]), [])), ne(F, "getTheme", (e) => {
67
- const r = fe.token, o = be.token, m = { ...r, ...e == null ? void 0 : e.token }, n = { ...o, ...e == null ? void 0 : e.token };
68
- return { light: m, dark: n };
69
- });
70
- const Ce = ge({
71
- list: [],
72
- setList: () => {
73
- },
74
- contextMenu: null,
75
- setContextMenu: () => {
76
- },
77
- listStatus: null,
78
- setListStatus: () => {
79
- },
80
- contextMenuFuns: () => {
81
- },
82
- hideContextMenu: () => {
83
- },
84
- showInfoItemData: null,
85
- setShowInfoItemData: () => {
86
- },
87
- openGroupItemData: null,
88
- setOpenGroupItemData: () => {
89
- },
90
- longPressTriggered: !1,
91
- updateItem: () => {
92
- },
93
- updateItemConfig: () => {
94
- },
95
- removeItem: () => {
96
- },
97
- addItem: () => {
98
- },
99
- moveItemId: null,
100
- setMoveItemId: () => {
101
- },
102
- moveTargetId: null,
103
- setMoveTargetId: () => {
104
- }
105
- }), xt = (a) => {
106
- const {
107
- children: e,
108
- list: r = [],
109
- onChange: o,
110
- storageKey: m = "ZS_LIBRARY_DESKTOP_SORTABLE_CONFIG",
111
- enableCaching: n = !0
112
- } = a, [f, b] = j(), [s, N] = j(), [C, L] = j(null), B = ae(C), [G, R] = j(null), [l, c] = j([]), [M, I] = j(
113
- null
114
- ), [A, d] = j(
115
- null
116
- ), [x, k] = j(!1), [u, g] = j(null), [z, H] = j(
117
- null
118
- ), [E, re] = j(!1), [_, Q] = Pe(m, {
119
- defaultValue: [],
120
- listenStorageChange: !0
121
- }), te = () => {
122
- R(null), clearTimeout(f), b(void 0), B.current = null;
123
- }, S = (p, Y) => {
124
- R({ ...p, pageX: p.pageX, pageY: p.pageY, data: Y }), clearTimeout(f);
125
- }, V = (p, Y = !0) => {
126
- const { config: X = {} } = p;
127
- return X.allowContextMenu === !1 ? {} : {
128
- onMouseDown: (w) => {
129
- b(
130
- setTimeout(() => {
131
- Y && B.current === null && S(w, p);
132
- }, 800)
133
- ), k(!1), N(
134
- setTimeout(() => {
135
- k(!0);
136
- }, 800)
137
- );
138
- },
139
- onMouseUp: () => {
140
- clearTimeout(s), N(void 0), clearTimeout(f), b(void 0);
141
- },
142
- onContextMenu: (w) => {
143
- Y && (w.preventDefault(), S(w, p));
144
- }
145
- };
146
- }, W = (p, Y) => {
147
- const X = [...Y || []];
148
- if (X.length > 0)
149
- c((w) => {
150
- const D = [...w], T = (h) => {
151
- var de, ue;
152
- const y = X.shift(), P = h.find((J) => J.id === y), U = h.findIndex((J) => J.id === y);
153
- if (X.length && P) {
154
- if (((de = P.children) == null ? void 0 : de.filter(
155
- (J) => !p.some((Te) => Te.id === J.id)
156
- ).length) === 1 && p.length === 1) {
157
- const J = { ...p[0] };
158
- return h.splice(U, 1, J), o == null || o(h), h;
159
- }
160
- return P.children = T(P.children || []), h.splice(U, 1, P), o == null || o(h), h;
161
- }
162
- if (P) {
163
- if (!((ue = P.children) != null && ue.length) && p.length) {
164
- const J = { ...P };
165
- return P.data = { name: "文件夹" }, P.type = "group", P.children = [J, ...p], P.id = me(), h.splice(U, 1, P), o == null || o(h), h;
166
- }
167
- return P.children = F.uniqueArray(p), h.splice(U, 1, P), o == null || o(h), h;
168
- }
169
- return F.uniqueArray(p);
170
- };
171
- return F.uniqueArray(T(D));
172
- });
173
- else {
174
- const w = F.uniqueArray(p);
175
- o == null || o(w), c(w);
176
- }
177
- }, we = (p, Y) => {
178
- c((X) => {
179
- const w = [...X], D = (T) => {
180
- var h;
181
- for (let y = 0; y < T.length; y++)
182
- if (T[y].id === p) {
183
- T[y].config = Y;
184
- break;
185
- } else ((h = T[y].children) == null ? void 0 : h.length) !== void 0 && D(T[y].children);
186
- };
187
- return D(w), o == null || o(w), w;
188
- });
189
- }, ye = (p, Y) => {
190
- c((X) => {
191
- const w = [...X], D = (T) => {
192
- var h;
193
- for (let y = 0; y < T.length; y++)
194
- if (T[y].id === p) {
195
- T[y].data = Y;
196
- break;
197
- } else ((h = T[y].children) == null ? void 0 : h.length) !== void 0 && D(T[y].children);
198
- };
199
- return D(w), o == null || o(w), w;
200
- });
201
- }, Me = (p) => {
202
- c((Y) => {
203
- const X = [...Y], w = (D) => {
204
- var T;
205
- for (let h = 0; h < D.length; h++)
206
- if (D[h].id === p) {
207
- D.splice(h, 1);
208
- break;
209
- } else ((T = D[h].children) == null ? void 0 : T.length) !== void 0 && w(D[h].children);
210
- };
211
- return w(X), o == null || o(X), X;
212
- });
213
- }, Se = (p, Y) => {
214
- const X = [...l], w = (D, T) => {
215
- const h = T.shift(), y = D.find((U) => U.id === h), P = D.findIndex((U) => U.id === h);
216
- if (y) {
217
- if (T.length)
218
- y.children = w(y.children || [], T);
219
- else {
220
- const U = (p == null ? void 0 : p.type) ?? "app";
221
- y.children = [
222
- ...y.children ?? [],
223
- {
224
- ...p,
225
- id: me(),
226
- config: (p == null ? void 0 : p.config) ?? ve[U]
227
- }
228
- ];
229
- }
230
- return D.splice(P, 1, y), D;
231
- } else
232
- return D;
233
- };
234
- c(w(X, Y));
235
- };
236
- return ee(() => {
237
- (r == null ? void 0 : r.length) > 0 && l.length === 0 && W(r);
238
- }, [r]), ee(() => {
239
- B.current = C, C !== null && te();
240
- }, [C]), ee(() => {
241
- n && _ != null && _.length && !E && (W(_), re(!0));
242
- }, [_, E, n]), Le(
243
- () => {
244
- n && Q(l);
245
- },
246
- [l, n],
247
- {
248
- wait: 1e3
249
- }
250
- ), /* @__PURE__ */ t(
251
- Ce.Provider,
252
- {
253
- value: {
254
- list: l,
255
- setList: W,
256
- contextMenu: G,
257
- setContextMenu: R,
258
- listStatus: C,
259
- setListStatus: L,
260
- contextMenuFuns: V,
261
- hideContextMenu: te,
262
- showInfoItemData: M,
263
- setShowInfoItemData: I,
264
- openGroupItemData: A,
265
- setOpenGroupItemData: d,
266
- longPressTriggered: x,
267
- updateItemConfig: we,
268
- updateItem: ye,
269
- removeItem: Me,
270
- addItem: Se,
271
- moveItemId: u,
272
- setMoveItemId: g,
273
- moveTargetId: z,
274
- setMoveTargetId: H
275
- },
276
- children: e
277
- }
278
- );
279
- }, O = () => pe(Ce), vt = {
280
- menuShow: {
281
- opacity: 1,
282
- y: 0,
283
- transition: { type: "spring", stiffness: 300, damping: 24 }
284
- },
285
- menuHide: { opacity: 0, y: 20, transition: { duration: 0.2 } }
286
- }, ie = (a) => {
287
- const { icon: e, title: r, onClick: o } = a, { theme: m } = Z(), { light: n, dark: f } = F.getTheme(m);
288
- return /* @__PURE__ */ t(
289
- v.div,
290
- {
291
- className: i`
292
- &:hover {
293
- background-color: ${n.contextMenuActiveColor};
294
- @media (prefers-color-scheme: dark) {
295
- background-color: ${f.contextMenuActiveColor};
296
- }
297
- }
298
- @media (prefers-color-scheme: dark) {
299
- color: black;
300
- }
301
- font-size: 0.75rem;
302
- line-height: 1rem;
303
- cursor: pointer;
304
- transition: all 0.3s;
305
- user-select: none;
306
- border-radius: 0.5rem;
307
- `,
308
- onClick: (b) => {
309
- b.stopPropagation(), o == null || o();
310
- },
311
- variants: vt,
312
- children: /* @__PURE__ */ q(
313
- v.div,
314
- {
315
- className: $(
316
- "py-1.5 px-3 rounded-lg",
317
- i`
318
- padding-top: 0.375rem;
319
- padding-bottom: 0.375rem;
320
- padding-left: 0.75rem;
321
- padding-right: 0.75rem;
322
- border-radius: 0.5rem;
323
- `
324
- ),
325
- whileTap: { scale: 0.9 },
326
- children: [
327
- /* @__PURE__ */ t(
328
- v.div,
329
- {
330
- className: $(
331
- i`
332
- margin-bottom: 0.375rem;
333
- display: flex;
334
- justify-content: center;
335
- `
336
- ),
337
- children: e
338
- }
339
- ),
340
- /* @__PURE__ */ t(v.div, { children: r })
341
- ]
342
- }
343
- )
344
- }
345
- );
346
- }, Ct = (a) => {
347
- const {
348
- showInfoButton: e = !0,
349
- showRemoveButton: r = !0,
350
- showShareButton: o = !0,
351
- showSizeButton: m = !0,
352
- onInfoClick: n,
353
- onShareClick: f,
354
- onRemoveClick: b
355
- } = a, {
356
- contextMenu: s,
357
- setContextMenu: N,
358
- hideContextMenu: C,
359
- setShowInfoItemData: L,
360
- removeItem: B,
361
- updateItemConfig: G
362
- } = O(), { theme: R } = Z(), { light: l, dark: c } = F.getTheme(R), { data: M } = s ?? {}, { config: I = {} } = M ?? {}, A = () => {
363
- var k;
364
- const d = ve[(k = s == null ? void 0 : s.data) == null ? void 0 : k.type], x = [];
365
- for (let u = 1; u <= ((d == null ? void 0 : d.maxRow) ?? 2); u++)
366
- for (let g = 1; g <= ((d == null ? void 0 : d.maxCol) ?? 2); g++)
367
- x.push(`${u}x${g}`);
368
- return x;
369
- };
370
- return /* @__PURE__ */ t(De, { children: s && /* @__PURE__ */ q(
371
- v.div,
372
- {
373
- initial: { opacity: 0 },
374
- animate: { opacity: 1 },
375
- exit: { opacity: 0 },
376
- onMouseDown: (d) => {
377
- d.stopPropagation(), d.preventDefault();
378
- },
379
- children: [
380
- /* @__PURE__ */ t(
381
- v.div,
382
- {
383
- className: $(
384
- i`
385
- border-radius: 0.5rem;
386
- overflow: hidden;
387
- background-color: ${l.contextMenuBackgroundColor};
388
- box-shadow: 0 0 0.5rem ${l.contextMenuShadowColor};
389
- @media (prefers-color-scheme: dark) {
390
- background-color: ${c.contextMenuBackgroundColor};
391
- box-shadow: 0 0 0.5rem ${c.contextMenuShadowColor};
392
- }
393
- `
394
- ),
395
- children: m && I.allowResize !== !1 && /* @__PURE__ */ t(
396
- v.ul,
397
- {
398
- className: i`
399
- background-color: white;
400
- padding: 0.25rem;
401
- margin: 0;
402
- `,
403
- children: [
404
- {
405
- label: "修改大小",
406
- key: "size",
407
- icon: /* @__PURE__ */ t(Ae, { size: 14 }),
408
- items: A().map((d) => ({
409
- label: d,
410
- key: d,
411
- onClick: () => {
412
- const [x, k] = d.split("x").map(Number);
413
- G(s.data.id, {
414
- row: x,
415
- col: k
416
- });
417
- }
418
- }))
419
- }
420
- ].map((d) => /* @__PURE__ */ q(
421
- v.li,
422
- {
423
- className: i`
424
- padding-top: 0.5rem;
425
- padding-bottom: 0.5rem;
426
- padding-left: 0.75rem;
427
- padding-right: 0.75rem;
428
- `,
429
- children: [
430
- /* @__PURE__ */ q(
431
- v.p,
432
- {
433
- className: i`
434
- display: flex;
435
- align-items: center;
436
- font-size: 0.875rem;
437
- line-height: 1.25rem;
438
- gap: 0.5rem;
439
- padding-bottom: 0.5rem;
440
- margin: 0;
441
- `,
442
- children: [
443
- d.icon,
444
- " ",
445
- d.label
446
- ]
447
- }
448
- ),
449
- /* @__PURE__ */ t(
450
- v.div,
451
- {
452
- className: i`
453
- display: grid;
454
- grid-template-columns: repeat(2, minmax(0, 1fr));
455
- gap: 0.25rem;
456
- `,
457
- children: d.items.map((x) => /* @__PURE__ */ t(
458
- v.div,
459
- {
460
- className: $(
461
- "py-1 px-2 hover:bg-gray-100 rounded transition-all cursor-pointer text-center text-sm",
462
- i`
463
- padding-top: 0.25rem;
464
- padding-bottom: 0.25rem;
465
- padding-left: 0.5rem;
466
- padding-right: 0.5rem;
467
- border-radius: 0.25rem;
468
- transition: all 0.3s;
469
- font-size: 0.875rem;
470
- line-height: 1.25rem;
471
- cursor: pointer;
472
- text-align: center;
473
- color: ${l.contextMenuTextColor};
474
- @media (prefers-color-scheme: dark) {
475
- color: ${c.contextMenuTextColor};
476
- }
477
- &:hover {
478
- background-color: ${l.contextMenuActiveColor};
479
- @media (prefers-color-scheme: dark) {
480
- background-color: ${c.contextMenuActiveColor};
481
- }
482
- }
483
- `,
484
- `${I.row}x${I.col}` === x.key && i`
485
- background-color: ${l.contextMenuActiveColor};
486
- @media (prefers-color-scheme: dark) {
487
- background-color: ${c.contextMenuActiveColor};
488
- }
489
- `
490
- ),
491
- onClick: x.onClick,
492
- children: x.label
493
- },
494
- x.key
495
- ))
496
- }
497
- )
498
- ]
499
- },
500
- d.key
501
- ))
502
- }
503
- )
504
- }
505
- ),
506
- /* @__PURE__ */ q(
507
- v.div,
508
- {
509
- className: $(
510
- i`
511
- background-color: ${l.contextMenuBackgroundColor};
512
- box-shadow: 0 0 0.5rem ${l.contextMenuShadowColor};
513
- @media (prefers-color-scheme: dark) {
514
- background-color: ${c.contextMenuBackgroundColor};
515
- box-shadow: 0 0 0.5rem ${c.contextMenuShadowColor};
516
- }
517
- display: flex;
518
- justify-content: space-around;
519
- align-items: center;
520
- margin-top: 0.5rem;
521
- border-radius: 0.5rem;
522
- overflow: hidden;
523
- padding: 0.25rem;
524
- `
525
- ),
526
- children: [
527
- o && /* @__PURE__ */ t(
528
- ie,
529
- {
530
- icon: /* @__PURE__ */ t(ze, { size: 20 }),
531
- title: "分享",
532
- onClick: () => {
533
- if (f) {
534
- f(s.data);
535
- return;
536
- }
537
- }
538
- }
539
- ),
540
- e && /* @__PURE__ */ t(
541
- ie,
542
- {
543
- icon: /* @__PURE__ */ t(Ee, { size: 20 }),
544
- title: "信息",
545
- onClick: () => {
546
- if (n) {
547
- n(s.data);
548
- return;
549
- }
550
- L({
551
- ...s.data,
552
- pageX: s.pageX,
553
- pageY: s.pageY
554
- }), C();
555
- }
556
- }
557
- ),
558
- r && /* @__PURE__ */ t(
559
- ie,
560
- {
561
- icon: /* @__PURE__ */ t(Xe, { size: 20 }),
562
- title: "移除",
563
- onClick: () => {
564
- if (b) {
565
- b(s.data, B);
566
- return;
567
- }
568
- N(null), B(s.data.id);
569
- }
570
- }
571
- )
572
- ]
573
- }
574
- )
575
- ]
576
- }
577
- ) });
578
- }, It = (a) => {
579
- const { data: e, noLetters: r = !1 } = a, { contextMenuFuns: o } = O(), { itemIconBuilder: m, theme: n, contextMenu: f } = Z(), { light: b, dark: s } = F.getTheme(n), { data: N = {} } = e, { name: C } = N;
580
- return /* @__PURE__ */ q(le, { children: [
581
- /* @__PURE__ */ t(
582
- v.div,
583
- {
584
- className: i`
585
- width: 4rem;
586
- height: 4rem;
587
- background-color: ${b.itemIconBackgroundColor};
588
- border-radius: 0.75rem;
589
- box-shadow: 0 0 0.5rem ${b.itemIconShadowColor};
590
- cursor: pointer;
591
- position: relative;
592
- overflow: hidden;
593
- @media (prefers-color-scheme: dark) {
594
- background-color: ${s.itemIconBackgroundColor};
595
- box-shadow: 0 0 0.5rem ${s.itemIconShadowColor};
596
- }
597
- `,
598
- whileTap: { scale: 0.9 },
599
- children: /* @__PURE__ */ t(
600
- "div",
601
- {
602
- className: i`
603
- position: absolute;
604
- left: 0;
605
- top: 0;
606
- width: 100%;
607
- height: 100%;
608
- color: ${b.itemNameColor};
609
- @media (prefers-color-scheme: dark) {
610
- color: ${s.itemNameColor};
611
- }
612
- `,
613
- ...o(e, f !== !1),
614
- children: m == null ? void 0 : m(e)
615
- }
616
- )
617
- }
618
- ),
619
- /* @__PURE__ */ t(
620
- v.p,
621
- {
622
- className: $(
623
- i`
624
- text-align: center;
625
- margin-top: 0.25rem;
626
- margin-bottom: 0;
627
- color: ${b.itemNameColor};
628
- @media (prefers-color-scheme: dark) {
629
- color: ${s.itemNameColor};
630
- }
631
- `,
632
- r && i`
633
- color: transparent;
634
- `
635
- ),
636
- children: C
637
- }
638
- )
639
- ] });
640
- }, ce = (a) => {
641
- const {
642
- data: e,
643
- className: r,
644
- itemIndex: o,
645
- onClick: m,
646
- disabledDrag: n = !1,
647
- children: f,
648
- parentIds: b,
649
- childrenLength: s
650
- } = a, { contextMenu: N, setContextMenu: C } = O(), { contextMenu: L } = Z();
651
- return /* @__PURE__ */ t(
652
- Re,
653
- {
654
- placement: "bottom",
655
- overlayClassName: i`
656
- background-color: transparent;
657
- .rc-tooltip-inner {
658
- background-color: transparent;
659
- padding: 0;
660
- border: none;
661
- }
662
- `,
663
- overlay: /* @__PURE__ */ t(Ct, { ...L }),
664
- visible: (N == null ? void 0 : N.data.id) === e.id,
665
- onVisibleChange: (B) => {
666
- B || C(null);
667
- },
668
- destroyTooltipOnHide: !0,
669
- children: /* @__PURE__ */ t(
670
- v.div,
671
- {
672
- "data-id": e.id,
673
- "data-index": o,
674
- "data-parent-ids": b == null ? void 0 : b.join(","),
675
- "data-children-length": s,
676
- onClick: () => m == null ? void 0 : m(e),
677
- className: $(n && "drag-disabled", r),
678
- children: f ?? /* @__PURE__ */ t(It, { ...a })
679
- }
680
- )
681
- }
682
- );
683
- }, wt = (a) => {
684
- const {
685
- data: e,
686
- className: r,
687
- parentIds: o,
688
- itemIndex: m,
689
- onClick: n,
690
- noLetters: f = !1
691
- } = a, {
692
- contextMenuFuns: b,
693
- setList: s,
694
- setOpenGroupItemData: N,
695
- longPressTriggered: C,
696
- moveItemId: L,
697
- moveTargetId: B,
698
- setMoveTargetId: G,
699
- listStatus: R
700
- } = O(), { itemIconBuilder: l, theme: c, contextMenu: M } = Z(), { light: I, dark: A } = F.getTheme(c), { children: d, data: x, config: k } = e, { row: u = 1, col: g = 1 } = k ?? {}, z = {
701
- visible: { opacity: 1, scale: 1 },
702
- hidden: { opacity: 0, scale: 0.95 }
703
- }, H = ((d == null ? void 0 : d.length) ?? 0) === 0, E = H ? [e] : [...d ?? []].slice(0, 9), re = oe(() => L === e.id.toString(), [e.id, L]), _ = oe(() => B === e.id, [e.id, B]), Q = i`
704
- overflow: hidden;
705
- cursor: pointer;
706
- background-color: ${I.itemIconBackgroundColor};
707
- box-shadow: 0 0 0.5rem ${I.itemIconShadowColor};
708
- @media (prefers-color-scheme: dark) {
709
- background-color: ${A.itemIconBackgroundColor};
710
- box-shadow: 0 0 0.5rem ${A.itemIconShadowColor};
711
- }
712
- `, te = () => {
713
- if (H)
714
- return /* @__PURE__ */ t(
715
- v.div,
716
- {
717
- className: $(
718
- "sortable-group-item",
719
- i`
720
- overflow: hidden;
721
- cursor: pointer;
722
- width: 100%;
723
- height: 100%;
724
- background-color: ${I.itemIconBackgroundColor};
725
- position: absolute;
726
- left: 0;
727
- top: 0;
728
- border-radius: 0.75rem;
729
- @media (prefers-color-scheme: dark) {
730
- background-color: ${A.itemIconBackgroundColor};
731
- }
732
- `
733
- ),
734
- onClick: (S) => {
735
- S.stopPropagation(), n == null || n(e);
736
- },
737
- children: l == null ? void 0 : l(e)
738
- }
739
- );
740
- if (u === 1 && g === 1 || u === 2 && g === 2)
741
- return /* @__PURE__ */ t(
742
- v.div,
743
- {
744
- className: i`
745
- display: grid;
746
- width: 100%;
747
- height: 100%;
748
- grid-template-columns: repeat(3, minmax(0, 1fr));
749
- grid-template-rows: repeat(3, minmax(0, 1fr));
750
- padding: ${g === 1 ? "0.125rem" : "0.25rem"};
751
- gap: ${g === 1 ? "0.125rem" : "0.5rem"};
752
- place-items: center;
753
- `,
754
- children: E == null ? void 0 : E.slice(0, 9).map((S) => /* @__PURE__ */ t(
755
- v.div,
756
- {
757
- className: $(
758
- Q,
759
- i`
760
- border-radius: ${g === 1 ? "0.25rem" : "0.5rem"};
761
- width: 100%;
762
- height: 100%;
763
- `
764
- ),
765
- onClick: (V) => {
766
- V.stopPropagation(), n == null || n(S);
767
- },
768
- children: l == null ? void 0 : l(S)
769
- },
770
- S.id
771
- ))
772
- }
773
- );
774
- if (u === 1 && g === 2)
775
- return /* @__PURE__ */ t(
776
- v.div,
777
- {
778
- className: i`
779
- display: grid;
780
- grid-template-columns: repeat(10, minmax(0, 1fr));
781
- grid-template-rows: repeat(4, minmax(0, 1fr));
782
- column-gap: 0.5rem;
783
- row-gap: 0.25rem;
784
- width: 144px;
785
- height: 52px;
786
- place-items: center;
787
- `,
788
- children: E == null ? void 0 : E.slice(0, 4).map((S, V) => /* @__PURE__ */ t(
789
- v.div,
790
- {
791
- className: $(
792
- Q,
793
- V < 2 ? i`
794
- width: 52px;
795
- height: 52px;
796
- border-radius: 0.5rem;
797
- grid-column: span 4 / span 4;
798
- grid-row: span 4 / span 4;
799
- ` : i`
800
- width: 1.5rem;
801
- height: 1.5rem;
802
- border-radius: 0.375rem;
803
- grid-column: span 2 / span 2;
804
- grid-row: span 2 / span 2;
805
- `
806
- ),
807
- onClick: (W) => {
808
- V > 2 || (W.stopPropagation(), n == null || n(S));
809
- },
810
- children: l == null ? void 0 : l(S)
811
- },
812
- S.id
813
- ))
814
- }
815
- );
816
- if (u === 2 && g === 1)
817
- return /* @__PURE__ */ t(
818
- v.div,
819
- {
820
- className: i`
821
- display: grid;
822
- grid-template-columns: repeat(4, minmax(0, 1fr));
823
- grid-template-rows: repeat(10, minmax(0, 1fr));
824
- column-gap: 0.25rem;
825
- row-gap: 0.5rem;
826
- width: 52px;
827
- height: 144px;
828
- place-items: center;
829
- `,
830
- children: E == null ? void 0 : E.slice(0, 4).map((S, V) => /* @__PURE__ */ t(
831
- v.div,
832
- {
833
- className: $(
834
- Q,
835
- V < 2 ? i`
836
- width: 52px;
837
- height: 52px;
838
- border-radius: 0.5rem;
839
- grid-column: span 4 / span 4;
840
- grid-row: span 4 / span 4;
841
- ` : i`
842
- width: 1.5rem;
843
- height: 1.5rem;
844
- grid-column: span 2 / span 2;
845
- grid-row: span 2 / span 2;
846
- `
847
- ),
848
- onClick: (W) => {
849
- V > 2 || (W.stopPropagation(), n == null || n(S));
850
- },
851
- children: l == null ? void 0 : l(S)
852
- },
853
- S.id
854
- ))
855
- }
856
- );
857
- };
858
- return /* @__PURE__ */ q(
859
- ce,
860
- {
861
- data: e,
862
- itemIndex: m,
863
- parentIds: o,
864
- childrenLength: d == null ? void 0 : d.length,
865
- className: $(
866
- i`
867
- grid-row: span ${u};
868
- grid-column: span ${g};
869
- `,
870
- r
871
- ),
872
- children: [
873
- /* @__PURE__ */ t(
874
- v.div,
875
- {
876
- whileTap: { scale: 0.9 },
877
- className: $(
878
- _ ? "!scale-110" : "",
879
- i`
880
- cursor: pointer;
881
- position: relative;
882
- border-radius: 0.75rem;
883
- background-color: ${I.groupItemIconBackgroundColor};
884
- box-shadow: 0 0 0.5rem ${I.groupItemIconShadowColor};
885
- @media (prefers-color-scheme: dark) {
886
- background-color: ${A.groupItemIconBackgroundColor};
887
- box-shadow: 0 0 0.5rem ${A.groupItemIconShadowColor};
888
- }
889
- /* overflow: hidden; */
890
- transition: all 0.3s;
891
- margin: 0 auto;
892
- width: ${g * 64 + 32 * (g - 1)}px;
893
- height: ${u * 64 + 32 * (u - 1)}px;
894
- `
895
- ),
896
- onClick: (S) => {
897
- !H && !C && (e.parentIds = o, e.pageX = S.pageX, e.pageY = S.pageY, N(e));
898
- },
899
- ...b(e, M !== !1),
900
- children: /* @__PURE__ */ q(
901
- v.div,
902
- {
903
- className: i`
904
- position: relative;
905
- width: 100%;
906
- height: 100%;
907
- display: flex;
908
- justify-content: center;
909
- align-items: center;
910
- padding: 0.375rem;
911
- `,
912
- children: [
913
- te(),
914
- /* @__PURE__ */ t(
915
- se,
916
- {
917
- className: $(
918
- "sortable-group-item",
919
- i`
920
- position: absolute;
921
- cursor: pointer;
922
- left: 0.375rem;
923
- top: 0.375rem;
924
- width: calc(100% - 0.75rem);
925
- height: calc(100% - 0.75rem);
926
- pointer-events: ${R === null ? "none" : "auto"};
927
- > * {
928
- opacity: 0;
929
- }
930
- `
931
- ),
932
- group: { name: "nested", pull: !1, put: !0 },
933
- animation: 150,
934
- fallbackOnBody: !0,
935
- list: d ?? [],
936
- setList: (S) => s(S, o),
937
- filter: () => !0,
938
- "data-id": e.id,
939
- onChange: () => {
940
- G(e.id);
941
- }
942
- }
943
- )
944
- ]
945
- }
946
- )
947
- }
948
- ),
949
- /* @__PURE__ */ t(
950
- v.p,
951
- {
952
- className: $(
953
- i`
954
- text-align: center;
955
- margin-top: 0.25rem;
956
- margin-bottom: 0;
957
- color: ${I.itemNameColor};
958
- @media (prefers-color-scheme: dark) {
959
- color: ${A.itemNameColor};
960
- }
961
- `,
962
- f && i`
963
- color: transparent;
964
- `
965
- ),
966
- variants: z,
967
- animate: re ? "hidden" : "visible",
968
- children: (x == null ? void 0 : x.name) ?? "文件夹"
969
- }
970
- )
971
- ]
972
- }
973
- );
974
- }, Ie = i`
975
- padding: 8px;
976
- transition: all 0.2s;
977
- > div {
978
- transition: all 0.2s;
979
- border: 2px solid aquamarine;
980
- background-color: transparent;
981
- > div {
982
- opacity: 0;
983
- transition: all 0.2s;
984
- }
985
- }
986
- `, yt = (a) => {
987
- const { data: e, onClose: r, onItemClick: o } = a, {
988
- list: m,
989
- setList: n,
990
- setListStatus: f,
991
- setMoveItemId: b,
992
- setMoveTargetId: s,
993
- updateItem: N
994
- } = O(), { theme: C } = Z(), { light: L, dark: B } = F.getTheme(C), [G, R] = j("文件夹"), l = [...(e == null ? void 0 : e.children) ?? []];
995
- return ee(() => {
996
- var c;
997
- e && R((c = e.data) == null ? void 0 : c.name);
998
- }, [e]), /* @__PURE__ */ t(
999
- he,
1000
- {
1001
- visible: !!e,
1002
- onClose: () => {
1003
- r();
1004
- },
1005
- animation: "zoom",
1006
- maskAnimation: "fade",
1007
- mousePosition: e != null && e.pageX && (e != null && e.pageY) ? {
1008
- x: e == null ? void 0 : e.pageX,
1009
- y: e == null ? void 0 : e.pageY
1010
- } : null,
1011
- title: /* @__PURE__ */ t(
1012
- "input",
1013
- {
1014
- className: i`
1015
- background-color: transparent;
1016
- border-style: none;
1017
- text-align: center;
1018
- font-size: 1.25rem;
1019
- line-height: 1.75rem;
1020
- color: white;
1021
- @media (prefers-color-scheme: dark) {
1022
- color: black;
1023
- }
1024
- &:focus {
1025
- outline: none;
1026
- }
1027
- `,
1028
- value: G,
1029
- onChange: (c) => {
1030
- R(c.target.value);
1031
- },
1032
- onBlur: () => {
1033
- e && N(e.id, {
1034
- ...e.data,
1035
- name: G
1036
- });
1037
- }
1038
- }
1039
- ),
1040
- footer: null,
1041
- closable: !1,
1042
- className: $(
1043
- "group-item-modal",
1044
- i`
1045
- .rc-dialog-content {
1046
- background-color: transparent;
1047
- box-shadow: none;
1048
- padding: 0;
1049
- .rc-dialog-header {
1050
- text-align: center;
1051
- background-color: transparent;
1052
- margin-bottom: 1rem;
1053
- border-bottom: none;
1054
- .ant-modal-name {
1055
- color: #fff;
1056
- }
1057
- }
1058
- .rc-dialog-body {
1059
- background-color: ${L.groupItemModalBackgroundColor};
1060
- @media (prefers-color-scheme: dark) {
1061
- background-color: ${B.groupItemModalBackgroundColor};
1062
- }
1063
- border-radius: 0.5rem;
1064
- overflow: hidden;
1065
- }
1066
- }
1067
- `
1068
- ),
1069
- width: 600,
1070
- destroyOnClose: !0,
1071
- children: /* @__PURE__ */ t(
1072
- "div",
1073
- {
1074
- className: i`
1075
- overflow-y: auto;
1076
- max-height: 60vh;
1077
- padding: 1.25rem 0;
1078
- `,
1079
- onDragLeave: (c) => {
1080
- const M = c.relatedTarget;
1081
- M && (c.currentTarget.contains(M) || setTimeout(() => {
1082
- r();
1083
- }, 500));
1084
- },
1085
- children: /* @__PURE__ */ t(
1086
- se,
1087
- {
1088
- className: i`
1089
- display: grid;
1090
- gap: 1rem;
1091
- place-items: center;
1092
- grid-template-columns: repeat(auto-fill, 96px);
1093
- grid-auto-flow: dense;
1094
- grid-auto-rows: 96px;
1095
- `,
1096
- group: { name: "nested", pull: !0, put: !1 },
1097
- animation: 150,
1098
- fallbackOnBody: !0,
1099
- list: (e == null ? void 0 : e.children) ?? [],
1100
- setList: (c) => {
1101
- var A, d;
1102
- const M = c.map((x) => x.id), I = (d = (A = m.find((x) => x.id === (e == null ? void 0 : e.id))) == null ? void 0 : A.children) == null ? void 0 : d.map((x) => x.id);
1103
- M.length === (I == null ? void 0 : I.length) && M.every((x, k) => x === I[k]) || M.length < ((I == null ? void 0 : I.length) ?? 0) || n(c, [...(e == null ? void 0 : e.parentIds) ?? [], e == null ? void 0 : e.id]);
1104
- },
1105
- onMove: () => (s(null), f("onMove"), !0),
1106
- onStart: (c) => {
1107
- const M = c.item.dataset;
1108
- M != null && M.id && b(M.id), f("onMove");
1109
- },
1110
- onEnd: () => {
1111
- b(null), s(null), f(null);
1112
- },
1113
- ghostClass: Ie,
1114
- children: l.map((c, M) => /* @__PURE__ */ t(
1115
- ce,
1116
- {
1117
- data: c,
1118
- itemIndex: M,
1119
- onClick: o
1120
- },
1121
- c.id
1122
- ))
1123
- }
1124
- )
1125
- }
1126
- )
1127
- }
1128
- );
1129
- }, Mt = (a) => {
1130
- var o;
1131
- const { data: e, onClose: r } = a;
1132
- return /* @__PURE__ */ t(
1133
- he,
1134
- {
1135
- visible: !!e,
1136
- onClose: () => {
1137
- r();
1138
- },
1139
- animation: "zoom",
1140
- maskAnimation: "fade",
1141
- mousePosition: e != null && e.pageX && (e != null && e.pageY) ? {
1142
- x: e == null ? void 0 : e.pageX,
1143
- y: e == null ? void 0 : e.pageY
1144
- } : null,
1145
- footer: null,
1146
- title: ((o = e == null ? void 0 : e.data) == null ? void 0 : o.name) ?? "信息",
1147
- children: e && /* @__PURE__ */ q("div", { children: [
1148
- /* @__PURE__ */ t("div", { className: "mb-2", children: "开发者信息" }),
1149
- /* @__PURE__ */ t("div", { className: "p-2 rounded-md bg-[#272822]", children: /* @__PURE__ */ t(Ge, { src: e, theme: "monokai" }) })
1150
- ] })
1151
- }
1152
- );
1153
- }, St = (a) => {
1154
- const {
1155
- pagination: e = { position: "bottom" },
1156
- className: r,
1157
- sliderProps: o,
1158
- sliderRef: m,
1159
- onItemClick: n
1160
- } = a, f = ae(null), b = ae(null), {
1161
- list: s,
1162
- setList: N,
1163
- setListStatus: C,
1164
- showInfoItemData: L,
1165
- setShowInfoItemData: B,
1166
- openGroupItemData: G,
1167
- setOpenGroupItemData: R,
1168
- setMoveItemId: l,
1169
- setMoveTargetId: c,
1170
- addItem: M
1171
- } = O(), { pagingDotBuilder: I, pagingDotsBuilder: A, itemBuilder: d } = Z(), x = oe(() => e === !1 ? {} : {
1172
- top: i`
1173
- display: flex;
1174
- flex-direction: column;
1175
- .slick-list {
1176
- order: 1;
1177
- }
1178
- .slick-dots {
1179
- position: static;
1180
- }
1181
- `,
1182
- bottom: i`
1183
- .slick-dots {
1184
- position: static;
1185
- }
1186
- `,
1187
- left: i`
1188
- .slick-dots {
1189
- position: absolute;
1190
- width: auto;
1191
- left: 0;
1192
- top: 0;
1193
- bottom: 0;
1194
- transform: translateX(-100%);
1195
- display: flex;
1196
- justify-content: center;
1197
- align-items: center;
1198
- .slick-dots-default {
1199
- flex-direction: column;
1200
- }
1201
- }
1202
- `,
1203
- right: i`
1204
- .slick-dots {
1205
- position: absolute;
1206
- width: auto;
1207
- right: 0;
1208
- top: 0;
1209
- bottom: 0;
1210
- transform: translateX(100%);
1211
- display: flex;
1212
- justify-content: center;
1213
- align-items: center;
1214
- .slick-dots-default {
1215
- flex-direction: column;
1216
- }
1217
- }
1218
- `
1219
- }[e.position ?? "bottom"], [e]);
1220
- return /* @__PURE__ */ q(le, { children: [
1221
- /* @__PURE__ */ t(
1222
- Be,
1223
- {
1224
- useCSS: !0,
1225
- useTransform: !0,
1226
- arrows: !1,
1227
- ref: m ?? f,
1228
- infinite: !1,
1229
- dots: !0,
1230
- touchMove: !1,
1231
- lazyLoad: "anticipated",
1232
- className: $(
1233
- x,
1234
- i`
1235
- .slick-track {
1236
- display: flex;
1237
- align-items: stretch;
1238
- }
1239
- .slick-slide {
1240
- display: flex;
1241
- align-self: stretch;
1242
- height: unset;
1243
- > div {
1244
- display: flex;
1245
- align-self: stretch;
1246
- width: 100%;
1247
- }
1248
- }
1249
- `,
1250
- r
1251
- ),
1252
- customPaging: (k) => {
1253
- var u, g;
1254
- return I ? I(s[k], k) : /* @__PURE__ */ t(
1255
- "div",
1256
- {
1257
- onDragEnter: () => {
1258
- var z;
1259
- (z = (m ?? f).current) == null || z.slickGoTo(k);
1260
- },
1261
- children: (g = (u = s[k]) == null ? void 0 : u.data) == null ? void 0 : g.name
1262
- }
1263
- );
1264
- },
1265
- appendDots: (k) => A ? A(k) : e === !1 ? /* @__PURE__ */ t("div", {}) : /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
1266
- "ul",
1267
- {
1268
- ref: b,
1269
- className: $(
1270
- "slick-dots-default",
1271
- i`
1272
- padding: 0.5rem;
1273
- display: inline-flex;
1274
- justify-content: center;
1275
- align-items: center;
1276
- gap: 0.5rem;
1277
- background-color: rgba(0, 0, 0, 0.1);
1278
- border-radius: 0.5rem;
1279
- .slick-active {
1280
- background-color: rgba(0, 0, 0, 0.3);
1281
- color: white;
1282
- padding: 0.25rem;
1283
- border-radius: 0.25rem;
1284
- }
1285
- li {
1286
- margin: 0;
1287
- width: auto;
1288
- height: auto;
1289
- }
1290
- `
1291
- ),
1292
- children: k
1293
- }
1294
- ) }),
1295
- ...o,
1296
- children: s.map((k) => /* @__PURE__ */ t(
1297
- "div",
1298
- {
1299
- onDrop: (u) => {
1300
- u.preventDefault();
1301
- const g = u.dataTransfer.getData("text/plain");
1302
- if (g !== "")
1303
- try {
1304
- M(JSON.parse(g), [k.id]);
1305
- } catch (z) {
1306
- console.log("drag error", z);
1307
- }
1308
- },
1309
- onDragOver: (u) => {
1310
- u.preventDefault();
1311
- },
1312
- children: /* @__PURE__ */ t(
1313
- se,
1314
- {
1315
- className: $(
1316
- i`
1317
- display: grid;
1318
- transition: all 0.3s;
1319
- grid-template-columns: repeat(auto-fill, 96px);
1320
- grid-auto-flow: dense;
1321
- grid-auto-rows: 96px;
1322
- place-items: center;
1323
- justify-content: center;
1324
- align-items: center;
1325
- `
1326
- ),
1327
- animation: 150,
1328
- fallbackOnBody: !0,
1329
- swapThreshold: 0.65,
1330
- group: "nested",
1331
- list: k.children ?? [],
1332
- setList: (u) => N(u, [k.id]),
1333
- filter: ".drag-disabled",
1334
- onMove: (u) => {
1335
- C("onMove");
1336
- const { dragged: g, related: z } = u, H = g.dataset, E = z.dataset;
1337
- return c(null), !((Object.keys(E).length === 0 || E.parentIds) && Number(H.childrenLength) > 0 && z.classList.contains("sortable-group-item"));
1338
- },
1339
- onStart: (u) => {
1340
- const g = u.item.dataset;
1341
- g != null && g.id && l(g.id), C("onMove");
1342
- },
1343
- onEnd: () => {
1344
- l(null), c(null), C(null);
1345
- },
1346
- ghostClass: Ie,
1347
- children: (k.children ?? []).map((u, g) => {
1348
- let z;
1349
- if (d)
1350
- return d(u);
1351
- switch (u.type) {
1352
- case "group":
1353
- case "app":
1354
- z = /* @__PURE__ */ t(
1355
- wt,
1356
- {
1357
- data: u,
1358
- itemIndex: g,
1359
- parentIds: [k.id, u.id],
1360
- onClick: n
1361
- },
1362
- u.id
1363
- );
1364
- break;
1365
- default:
1366
- z = /* @__PURE__ */ t(
1367
- ce,
1368
- {
1369
- data: u,
1370
- itemIndex: g,
1371
- onClick: n
1372
- },
1373
- u.id
1374
- );
1375
- break;
1376
- }
1377
- return z;
1378
- })
1379
- }
1380
- )
1381
- },
1382
- k.id
1383
- ))
1384
- }
1385
- ),
1386
- /* @__PURE__ */ t(
1387
- Mt,
1388
- {
1389
- data: L,
1390
- onClose: () => {
1391
- B(null);
1392
- }
1393
- }
1394
- ),
1395
- /* @__PURE__ */ t(
1396
- yt,
1397
- {
1398
- data: G,
1399
- onClose: () => {
1400
- R(null);
1401
- },
1402
- onItemClick: n
1403
- }
1404
- )
1405
- ] });
1406
- }, Wt = (a) => {
1407
- const {
1408
- list: e,
1409
- onChange: r,
1410
- storageKey: o,
1411
- enableCaching: m,
1412
- theme: n,
1413
- noLetters: f,
1414
- contextMenu: b,
1415
- contextMenuBuilder: s,
1416
- itemBuilder: N,
1417
- itemIconBuilder: C,
1418
- pagingDotBuilder: L,
1419
- pagingDotsBuilder: B,
1420
- ...G
1421
- } = a;
1422
- return /* @__PURE__ */ t(xt, { ...{
1423
- list: e,
1424
- onChange: r,
1425
- storageKey: o,
1426
- enableCaching: m
1427
- }, children: /* @__PURE__ */ t(bt, { ...{
1428
- theme: n,
1429
- noLetters: f,
1430
- contextMenu: b,
1431
- pagingDotsBuilder: B,
1432
- pagingDotBuilder: L,
1433
- itemBuilder: N,
1434
- itemIconBuilder: C,
1435
- contextMenuBuilder: s
1436
- }, children: /* @__PURE__ */ t(St, { ...G }) }) });
1437
- }, Tt = {
1438
- frontmatterEditor: {
1439
- title: "编辑前置元数据",
1440
- key: "键",
1441
- value: "值",
1442
- addEntry: "添加项目"
1443
- },
1444
- dialogControls: {
1445
- save: "保存",
1446
- cancel: "取消"
1447
- },
1448
- uploadImage: {
1449
- uploadInstructions: "从您的设备中上传图片:",
1450
- addViaUrlInstructions: "或从网址新增图片:",
1451
- autoCompletePlaceholder: "选择或粘贴图片",
1452
- alt: "替代文本:",
1453
- title: "标题:"
1454
- },
1455
- imageEditor: {
1456
- editImage: "编辑图片"
1457
- },
1458
- createLink: {
1459
- url: "网址",
1460
- urlPlaceholder: "选择或粘贴网址",
1461
- title: "标题",
1462
- saveTooltip: "设置网址",
1463
- cancelTooltip: "取消更改"
1464
- },
1465
- linkPreview: {
1466
- open: "在新窗口中打开 {{url}}",
1467
- edit: "编辑链接网址",
1468
- copyToClipboard: "复制到剪贴板",
1469
- copied: "已复制!",
1470
- remove: "移除链接"
1471
- },
1472
- table: {
1473
- deleteTable: "删除表格",
1474
- columnMenu: "列菜单",
1475
- textAlignment: "文字对齐",
1476
- alignLeft: "左对齐",
1477
- alignCenter: "居中对齐",
1478
- alignRight: "右对齐",
1479
- insertColumnLeft: "在当前列左侧插入一列",
1480
- insertColumnRight: "在当前列右侧插入一列",
1481
- deleteColumn: "删除此列",
1482
- rowMenu: "行菜单",
1483
- insertRowAbove: "在当前行上方插入一行",
1484
- insertRowBelow: "在当前行下方插入一行",
1485
- deleteRow: "删除此行"
1486
- },
1487
- toolbar: {
1488
- blockTypes: {
1489
- paragraph: "段落",
1490
- quote: "引用",
1491
- heading: "标题 {{level}}"
1492
- },
1493
- blockTypeSelect: {
1494
- selectBlockTypeTooltip: "选择块类型",
1495
- placeholder: "块类型"
1496
- },
1497
- toggleGroup: "切换组",
1498
- removeBold: "移除粗体",
1499
- bold: "粗体",
1500
- removeItalic: "移除斜体",
1501
- italic: "斜体",
1502
- underline: "移除下划线",
1503
- removeUnderline: "下划线",
1504
- removeInlineCode: "移除内联代码样式",
1505
- inlineCode: "内联代码样式",
1506
- link: "创建链接",
1507
- richText: "富文本",
1508
- diffMode: "差异模式",
1509
- source: "源码模式",
1510
- admonition: "插入注释区块",
1511
- codeBlock: "插入代码块",
1512
- editFrontmatter: "编辑前置元数据",
1513
- insertFrontmatter: "插入前置元数据",
1514
- image: "插入图片",
1515
- insertSandpack: "插入 Sandpack",
1516
- table: "插入表格",
1517
- thematicBreak: "插入主题换行",
1518
- bulletedList: "无序列表",
1519
- numberedList: "有序列表",
1520
- checkList: "任务列表",
1521
- deleteSandpack: "删除 Sandpack",
1522
- undo: "撤销 {{shortcut}}",
1523
- redo: "重做 {{shortcut}}",
1524
- superscript: "上标",
1525
- subscript: "下标",
1526
- strikethrough: "删除线",
1527
- removeSubscript: "移除下标",
1528
- removeSuperscript: "移除上标",
1529
- removeStrikethrough: "移除删除线"
1530
- },
1531
- admonitions: {
1532
- note: "注意",
1533
- tip: "提示",
1534
- danger: "危险",
1535
- info: "信息",
1536
- caution: "警告",
1537
- changeType: "选择注释区块类型",
1538
- placeholder: "注释区块类型"
1539
- },
1540
- codeBlock: {
1541
- language: "代码块语言",
1542
- selectLanguage: "选择代码块语言",
1543
- inlineLanguage: "代码块语言"
1544
- },
1545
- codeblock: {
1546
- delete: "删除代码块"
1547
- },
1548
- contentArea: {
1549
- editableMarkdown: "可编辑的 Markdown"
1550
- },
1551
- image: {
1552
- delete: "删除图片"
1553
- }
1554
- }, Nt = (a, e, r) => {
1555
- const m = a.split(".").reduce(
1556
- (n, f) => typeof n == "string" ? n : n[f],
1557
- Tt
1558
- );
1559
- return typeof m != "string" ? e : r ? m.replace(/{{(.*?)}}/g, (n, f) => r[f]) : m;
1560
- };
1561
- function $t(a) {
1562
- const e = a == null ? void 0 : a.rootNode;
1563
- return !e || e.getType() !== "directive" ? !1 : ["note", "tip", "danger", "info", "caution"].includes(
1564
- e.getMdastNode().name
1565
- );
1566
- }
1567
- const Zt = (a) => {
1568
- const { value: e, onChange: r, translation: o, pluginConfig: m, ...n } = a, {
1569
- image: f,
1570
- diffSource: b = {
1571
- viewMode: "rich-text"
1572
- },
1573
- headings: s,
1574
- link: N,
1575
- codeBlock: C,
1576
- codeMirror: L = {
1577
- codeBlockLanguages: {
1578
- js: "JavaScript",
1579
- css: "CSS",
1580
- txt: "Plain Text",
1581
- tsx: "TypeScript",
1582
- "": "Unspecified"
1583
- }
1584
- },
1585
- directives: B = {
1586
- directiveDescriptors: [ft]
1587
- }
1588
- } = m ?? {}, [G, R] = j("");
1589
- return ee(() => {
1590
- e !== void 0 && R(e);
1591
- }, [e]), /* @__PURE__ */ t(
1592
- Ye,
1593
- {
1594
- contentEditableClassName: $(
1595
- "markdown-body",
1596
- i`
1597
- table {
1598
- border-spacing: 0;
1599
- border-collapse: collapse;
1600
- width: 100%;
1601
- display: table;
1602
- th[data-tool-cell],
1603
- td[data-tool-cell] {
1604
- padding: 0;
1605
- border: none;
1606
- }
1607
- tr {
1608
- border-top: 0;
1609
- }
1610
- thead {
1611
- th {
1612
- padding: 0;
1613
- border: none;
1614
- }
1615
- }
1616
- tfoot {
1617
- th {
1618
- padding: 0;
1619
- border: none;
1620
- }
1621
- }
1622
- [class*="_addRowButton"],
1623
- [class*="_addColumnButton"],
1624
- [class*="_tableColumnEditorTrigger"],
1625
- [class*="_iconButton"] {
1626
- cursor: pointer;
1627
- transition: all 0.3s;
1628
- }
1629
- }
1630
- `
1631
- ),
1632
- markdown: G,
1633
- onChange: (l) => {
1634
- !e && !r && R(l), r && r(l);
1635
- },
1636
- translation: o ?? Nt,
1637
- plugins: [
1638
- je({
1639
- toolbarContents: () => /* @__PURE__ */ q(qe, { options: ["rich-text", "source"], children: [
1640
- /* @__PURE__ */ t(Fe, {}),
1641
- /* @__PURE__ */ t(K, {}),
1642
- /* @__PURE__ */ t(Ue, {}),
1643
- /* @__PURE__ */ t(Ve, {}),
1644
- /* @__PURE__ */ t(K, {}),
1645
- /* @__PURE__ */ t(Je, {}),
1646
- /* @__PURE__ */ t(K, {}),
1647
- /* @__PURE__ */ t(Ke, {}),
1648
- /* @__PURE__ */ t(K, {}),
1649
- /* @__PURE__ */ t(He, {}),
1650
- /* @__PURE__ */ t(_e, {}),
1651
- /* @__PURE__ */ t(K, {}),
1652
- /* @__PURE__ */ t(We, {}),
1653
- /* @__PURE__ */ t(Ze, {}),
1654
- /* @__PURE__ */ t(K, {}),
1655
- /* @__PURE__ */ t(Oe, {}),
1656
- /* @__PURE__ */ t(
1657
- Qe,
1658
- {
1659
- options: [
1660
- {
1661
- when: (l) => !$t(l),
1662
- contents: () => /* @__PURE__ */ q(le, { children: [
1663
- /* @__PURE__ */ t(K, {}),
1664
- /* @__PURE__ */ t(et, {})
1665
- ] })
1666
- }
1667
- ]
1668
- }
1669
- ),
1670
- /* @__PURE__ */ t(K, {}),
1671
- /* @__PURE__ */ t(tt, {})
1672
- ] })
1673
- }),
1674
- ot(b),
1675
- rt(),
1676
- nt(),
1677
- it(s),
1678
- at(N),
1679
- lt(),
1680
- st(f),
1681
- ct(),
1682
- dt(),
1683
- ut(),
1684
- mt(C),
1685
- gt(L),
1686
- pt(),
1687
- ht(B)
1688
- ],
1689
- ...n
1690
- }
1691
- );
1692
- };
1693
- export {
1694
- Wt as Desktop,
1695
- Zt as MdEditor
1696
- };