zs_library 0.2.3 → 0.3.4

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