zs_library 0.4.10 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/desktop/config.js +15 -0
- package/dist/components/desktop/context/config/context.js +14 -0
- package/dist/components/desktop/context/config/hooks.js +7 -0
- package/dist/components/desktop/context/state/context.js +221 -0
- package/dist/components/desktop/context/state/hooks.js +7 -0
- package/dist/components/desktop/context-menu/index.js +312 -0
- package/dist/components/desktop/index.js +40 -0
- package/dist/components/desktop/items/group-item.js +305 -0
- package/dist/components/desktop/items/modal/group-item-modal.js +158 -0
- package/dist/components/desktop/items/modal/info-modal.js +33 -0
- package/dist/components/desktop/items/sortable-item.js +120 -0
- package/dist/components/desktop/sortable.js +272 -0
- package/dist/components/desktop/style.js +18 -0
- package/dist/components/desktop/theme.js +32 -0
- package/dist/components/desktop/utils.js +15 -0
- package/dist/components/dock/dock-desktop.js +83 -0
- package/dist/components/dock/dock-mobile.js +69 -0
- package/dist/components/dock/index.js +24 -0
- package/dist/components/dock/utils.js +9 -0
- package/dist/components/editor/editor.js +199 -0
- package/dist/components/editor/extensions/drag-handle/clipboard-serializer.js +20 -0
- package/dist/components/editor/extensions/drag-handle/index.js +273 -0
- package/dist/components/editor/extensions.js +131 -0
- package/dist/components/editor/generative/ai-completion-command.js +59 -0
- package/dist/components/editor/generative/ai-selector-commands.js +78 -0
- package/dist/components/editor/generative/ai-selector.js +90 -0
- package/dist/components/editor/generative/drag-handle.js +70 -0
- package/dist/components/editor/generative/generative-dropdown-menu.js +55 -0
- package/dist/components/editor/generative/generative-menu-switch.js +59 -0
- package/dist/components/editor/image-upload.js +36 -0
- package/dist/components/editor/index.js +8 -0
- package/dist/components/editor/lib/colors.js +98 -0
- package/dist/components/editor/lib/content.js +8 -0
- package/dist/components/editor/lib/nodes.js +70 -0
- package/dist/components/editor/lib/url-utils.js +21 -0
- package/dist/components/editor/preview.js +12 -0
- package/dist/components/editor/selectors/color-selector.js +100 -0
- package/dist/components/editor/selectors/link-selector.js +82 -0
- package/dist/components/editor/selectors/math-selector.js +37 -0
- package/dist/components/editor/selectors/node-selector.js +56 -0
- package/dist/components/editor/selectors/text-buttons.js +75 -0
- package/dist/components/editor/slash-command.js +129 -0
- package/dist/components/editor/ui/button.js +44 -0
- package/dist/components/editor/ui/command.js +94 -0
- package/dist/components/editor/ui/dialog.js +68 -0
- package/dist/components/editor/ui/dropdown-menu.js +99 -0
- package/dist/components/editor/ui/icons/crazy-spinner.js +10 -0
- package/dist/components/editor/ui/popover.js +24 -0
- package/dist/components/editor/ui/scroll-area.js +39 -0
- package/dist/components/editor/ui/separator.js +25 -0
- package/dist/components/editor/ui/tooltip.js +25 -0
- package/dist/components/md-editor/editor.js +104 -0
- package/dist/components/md-editor/i18n/index.js +12 -0
- package/dist/components/md-editor/i18n/zh_CN.js +122 -0
- package/dist/components/md-editor/index.js +8 -0
- package/dist/components/md-editor/preview.js +81 -0
- package/dist/components/md-editor/style.js +267 -0
- package/dist/components/md-editor/utils.js +8 -0
- package/dist/i18n/index.js +23 -0
- package/dist/i18n/locales/en-US.js +30 -0
- package/dist/i18n/locales/zh-CN.js +30 -0
- package/dist/index.js +12 -10612
- package/dist/node_modules/.pnpm/@tiptap_pm@2.11.5/node_modules/@tiptap/pm/view/dist/index.js +3 -0
- package/package.json +6 -1
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
import { jsxs as I, jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { css as o, cx as p } from "@emotion/css";
|
|
4
|
+
import { motion as n } from "framer-motion";
|
|
5
|
+
import { useMemo as k } from "react";
|
|
6
|
+
import { ReactSortable as U } from "react-sortablejs";
|
|
7
|
+
import { useSortableConfig as q } from "../context/config/hooks.js";
|
|
8
|
+
import { useSortableState as A } from "../context/state/hooks.js";
|
|
9
|
+
import B from "../utils.js";
|
|
10
|
+
import D from "./sortable-item.js";
|
|
11
|
+
const oe = (C) => {
|
|
12
|
+
const {
|
|
13
|
+
data: r,
|
|
14
|
+
className: N,
|
|
15
|
+
parentIds: u,
|
|
16
|
+
itemIndex: S,
|
|
17
|
+
onClick: t,
|
|
18
|
+
noLetters: y = !1
|
|
19
|
+
} = C, {
|
|
20
|
+
contextMenuFuns: M,
|
|
21
|
+
setList: T,
|
|
22
|
+
setOpenGroupItemData: P,
|
|
23
|
+
longPressTriggered: L,
|
|
24
|
+
moveItemId: v,
|
|
25
|
+
moveTargetId: $,
|
|
26
|
+
setMoveTargetId: G,
|
|
27
|
+
listStatus: O
|
|
28
|
+
} = A(), { itemIconBuilder: a, theme: X, contextMenu: Y } = q(), { light: g, dark: h } = B.getTheme(X), { children: d, data: f, config: j } = r, { row: l = 1, col: i = 1 } = j ?? {}, z = {
|
|
29
|
+
visible: { opacity: 1, scale: 1 },
|
|
30
|
+
hidden: { opacity: 0, scale: 0.95 }
|
|
31
|
+
}, w = ((d == null ? void 0 : d.length) ?? 0) === 0, m = w ? [r] : [...d ?? []].slice(0, 9), E = k(() => v === r.id.toString(), [r.id, v]), F = k(() => $ === r.id, [r.id, $]), b = o`
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
background-color: ${g.itemIconBackgroundColor};
|
|
35
|
+
box-shadow: 0 0 0.5rem ${g.itemIconShadowColor};
|
|
36
|
+
@media (prefers-color-scheme: dark) {
|
|
37
|
+
background-color: ${h.itemIconBackgroundColor};
|
|
38
|
+
box-shadow: 0 0 0.5rem ${h.itemIconShadowColor};
|
|
39
|
+
}
|
|
40
|
+
`, R = () => {
|
|
41
|
+
if (w)
|
|
42
|
+
return /* @__PURE__ */ s(
|
|
43
|
+
n.div,
|
|
44
|
+
{
|
|
45
|
+
className: p(
|
|
46
|
+
"sortable-group-item",
|
|
47
|
+
o`
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
width: 100%;
|
|
51
|
+
height: 100%;
|
|
52
|
+
background-color: ${g.itemIconBackgroundColor};
|
|
53
|
+
position: absolute;
|
|
54
|
+
left: 0;
|
|
55
|
+
top: 0;
|
|
56
|
+
border-radius: 0.75rem;
|
|
57
|
+
@media (prefers-color-scheme: dark) {
|
|
58
|
+
background-color: ${h.itemIconBackgroundColor};
|
|
59
|
+
}
|
|
60
|
+
`
|
|
61
|
+
),
|
|
62
|
+
onClick: (e) => {
|
|
63
|
+
e.stopPropagation(), t == null || t(r);
|
|
64
|
+
},
|
|
65
|
+
children: a == null ? void 0 : a(r)
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
if (l === 1 && i === 1 || l === 2 && i === 2)
|
|
69
|
+
return /* @__PURE__ */ s(
|
|
70
|
+
n.div,
|
|
71
|
+
{
|
|
72
|
+
className: o`
|
|
73
|
+
display: grid;
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 100%;
|
|
76
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
77
|
+
grid-template-rows: repeat(3, minmax(0, 1fr));
|
|
78
|
+
padding: ${i === 1 ? "0.125rem" : "0.25rem"};
|
|
79
|
+
gap: ${i === 1 ? "0.125rem" : "0.5rem"};
|
|
80
|
+
place-items: center;
|
|
81
|
+
`,
|
|
82
|
+
children: m == null ? void 0 : m.slice(0, 9).map((e) => /* @__PURE__ */ s(
|
|
83
|
+
n.div,
|
|
84
|
+
{
|
|
85
|
+
className: p(
|
|
86
|
+
b,
|
|
87
|
+
o`
|
|
88
|
+
border-radius: ${i === 1 ? "0.25rem" : "0.5rem"};
|
|
89
|
+
width: 100%;
|
|
90
|
+
height: 100%;
|
|
91
|
+
`
|
|
92
|
+
),
|
|
93
|
+
onClick: (c) => {
|
|
94
|
+
c.stopPropagation(), t == null || t(e);
|
|
95
|
+
},
|
|
96
|
+
children: a == null ? void 0 : a(e)
|
|
97
|
+
},
|
|
98
|
+
e.id
|
|
99
|
+
))
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
if (l === 1 && i === 2)
|
|
103
|
+
return /* @__PURE__ */ s(
|
|
104
|
+
n.div,
|
|
105
|
+
{
|
|
106
|
+
className: o`
|
|
107
|
+
display: grid;
|
|
108
|
+
grid-template-columns: repeat(10, minmax(0, 1fr));
|
|
109
|
+
grid-template-rows: repeat(4, minmax(0, 1fr));
|
|
110
|
+
column-gap: 0.5rem;
|
|
111
|
+
row-gap: 0.25rem;
|
|
112
|
+
width: 144px;
|
|
113
|
+
height: 52px;
|
|
114
|
+
place-items: center;
|
|
115
|
+
`,
|
|
116
|
+
children: m == null ? void 0 : m.slice(0, 4).map((e, c) => /* @__PURE__ */ s(
|
|
117
|
+
n.div,
|
|
118
|
+
{
|
|
119
|
+
className: p(
|
|
120
|
+
b,
|
|
121
|
+
c < 2 ? o`
|
|
122
|
+
width: 52px;
|
|
123
|
+
height: 52px;
|
|
124
|
+
border-radius: 0.5rem;
|
|
125
|
+
grid-column: span 4 / span 4;
|
|
126
|
+
grid-row: span 4 / span 4;
|
|
127
|
+
` : o`
|
|
128
|
+
width: 1.5rem;
|
|
129
|
+
height: 1.5rem;
|
|
130
|
+
border-radius: 0.375rem;
|
|
131
|
+
grid-column: span 2 / span 2;
|
|
132
|
+
grid-row: span 2 / span 2;
|
|
133
|
+
`
|
|
134
|
+
),
|
|
135
|
+
onClick: (x) => {
|
|
136
|
+
c > 2 || (x.stopPropagation(), t == null || t(e));
|
|
137
|
+
},
|
|
138
|
+
children: a == null ? void 0 : a(e)
|
|
139
|
+
},
|
|
140
|
+
e.id
|
|
141
|
+
))
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
if (l === 2 && i === 1)
|
|
145
|
+
return /* @__PURE__ */ s(
|
|
146
|
+
n.div,
|
|
147
|
+
{
|
|
148
|
+
className: o`
|
|
149
|
+
display: grid;
|
|
150
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
151
|
+
grid-template-rows: repeat(10, minmax(0, 1fr));
|
|
152
|
+
column-gap: 0.25rem;
|
|
153
|
+
row-gap: 0.5rem;
|
|
154
|
+
width: 52px;
|
|
155
|
+
height: 144px;
|
|
156
|
+
place-items: center;
|
|
157
|
+
`,
|
|
158
|
+
children: m == null ? void 0 : m.slice(0, 4).map((e, c) => /* @__PURE__ */ s(
|
|
159
|
+
n.div,
|
|
160
|
+
{
|
|
161
|
+
className: p(
|
|
162
|
+
b,
|
|
163
|
+
c < 2 ? o`
|
|
164
|
+
width: 52px;
|
|
165
|
+
height: 52px;
|
|
166
|
+
border-radius: 0.5rem;
|
|
167
|
+
grid-column: span 4 / span 4;
|
|
168
|
+
grid-row: span 4 / span 4;
|
|
169
|
+
` : o`
|
|
170
|
+
width: 1.5rem;
|
|
171
|
+
height: 1.5rem;
|
|
172
|
+
grid-column: span 2 / span 2;
|
|
173
|
+
grid-row: span 2 / span 2;
|
|
174
|
+
`
|
|
175
|
+
),
|
|
176
|
+
onClick: (x) => {
|
|
177
|
+
c > 2 || (x.stopPropagation(), t == null || t(e));
|
|
178
|
+
},
|
|
179
|
+
children: a == null ? void 0 : a(e)
|
|
180
|
+
},
|
|
181
|
+
e.id
|
|
182
|
+
))
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
return /* @__PURE__ */ I(
|
|
187
|
+
D,
|
|
188
|
+
{
|
|
189
|
+
data: r,
|
|
190
|
+
itemIndex: S,
|
|
191
|
+
parentIds: u,
|
|
192
|
+
childrenLength: d == null ? void 0 : d.length,
|
|
193
|
+
className: p(
|
|
194
|
+
o`
|
|
195
|
+
grid-row: span ${l};
|
|
196
|
+
grid-column: span ${i};
|
|
197
|
+
`,
|
|
198
|
+
N
|
|
199
|
+
),
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ s(
|
|
202
|
+
n.div,
|
|
203
|
+
{
|
|
204
|
+
whileTap: { scale: 0.9 },
|
|
205
|
+
className: p(
|
|
206
|
+
F ? "!scale-110" : "",
|
|
207
|
+
o`
|
|
208
|
+
cursor: pointer;
|
|
209
|
+
position: relative;
|
|
210
|
+
border-radius: 0.75rem;
|
|
211
|
+
background-color: ${g.groupItemIconBackgroundColor};
|
|
212
|
+
box-shadow: 0 0 0.5rem ${g.groupItemIconShadowColor};
|
|
213
|
+
@media (prefers-color-scheme: dark) {
|
|
214
|
+
background-color: ${h.groupItemIconBackgroundColor};
|
|
215
|
+
box-shadow: 0 0 0.5rem ${h.groupItemIconShadowColor};
|
|
216
|
+
}
|
|
217
|
+
/* overflow: hidden; */
|
|
218
|
+
transition: all 0.3s;
|
|
219
|
+
margin: 0 auto;
|
|
220
|
+
width: ${i * 64 + 32 * (i - 1)}px;
|
|
221
|
+
height: ${l * 64 + 32 * (l - 1)}px;
|
|
222
|
+
`
|
|
223
|
+
),
|
|
224
|
+
onClick: (e) => {
|
|
225
|
+
!w && !L && (r.parentIds = u, r.pageX = e.pageX, r.pageY = e.pageY, P(r));
|
|
226
|
+
},
|
|
227
|
+
...M(r, Y !== !1),
|
|
228
|
+
children: /* @__PURE__ */ I(
|
|
229
|
+
n.div,
|
|
230
|
+
{
|
|
231
|
+
className: o`
|
|
232
|
+
position: relative;
|
|
233
|
+
width: 100%;
|
|
234
|
+
height: 100%;
|
|
235
|
+
display: flex;
|
|
236
|
+
justify-content: center;
|
|
237
|
+
align-items: center;
|
|
238
|
+
padding: 0.375rem;
|
|
239
|
+
`,
|
|
240
|
+
children: [
|
|
241
|
+
R(),
|
|
242
|
+
/* @__PURE__ */ s(
|
|
243
|
+
U,
|
|
244
|
+
{
|
|
245
|
+
className: p(
|
|
246
|
+
"sortable-group-item",
|
|
247
|
+
o`
|
|
248
|
+
position: absolute;
|
|
249
|
+
cursor: pointer;
|
|
250
|
+
left: 0.375rem;
|
|
251
|
+
top: 0.375rem;
|
|
252
|
+
width: calc(100% - 0.75rem);
|
|
253
|
+
height: calc(100% - 0.75rem);
|
|
254
|
+
pointer-events: ${O === null ? "none" : "auto"};
|
|
255
|
+
> * {
|
|
256
|
+
opacity: 0;
|
|
257
|
+
}
|
|
258
|
+
`
|
|
259
|
+
),
|
|
260
|
+
group: { name: "nested", pull: !1, put: !0 },
|
|
261
|
+
animation: 150,
|
|
262
|
+
fallbackOnBody: !0,
|
|
263
|
+
list: d ?? [],
|
|
264
|
+
setList: (e) => T(e, u),
|
|
265
|
+
filter: () => !0,
|
|
266
|
+
"data-id": r.id,
|
|
267
|
+
onChange: () => {
|
|
268
|
+
G(r.id);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
)
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
}
|
|
276
|
+
),
|
|
277
|
+
/* @__PURE__ */ s(
|
|
278
|
+
n.p,
|
|
279
|
+
{
|
|
280
|
+
className: p(
|
|
281
|
+
o`
|
|
282
|
+
text-align: center;
|
|
283
|
+
margin-top: 0.25rem;
|
|
284
|
+
margin-bottom: 0;
|
|
285
|
+
color: ${g.itemNameColor};
|
|
286
|
+
@media (prefers-color-scheme: dark) {
|
|
287
|
+
color: ${h.itemNameColor};
|
|
288
|
+
}
|
|
289
|
+
`,
|
|
290
|
+
y && o`
|
|
291
|
+
color: transparent;
|
|
292
|
+
`
|
|
293
|
+
),
|
|
294
|
+
variants: z,
|
|
295
|
+
animate: E ? "hidden" : "visible",
|
|
296
|
+
children: (f == null ? void 0 : f.name) ?? "文件夹"
|
|
297
|
+
}
|
|
298
|
+
)
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
};
|
|
303
|
+
export {
|
|
304
|
+
oe as default
|
|
305
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import { cx as w, css as i } from "@emotion/css";
|
|
4
|
+
import C from "rc-dialog";
|
|
5
|
+
import { useState as T, useEffect as N } from "react";
|
|
6
|
+
import { ReactSortable as B } from "react-sortablejs";
|
|
7
|
+
import { useSortableConfig as L } from "../../context/config/hooks.js";
|
|
8
|
+
import { useSortableState as z } from "../../context/state/hooks.js";
|
|
9
|
+
import { ghostClass as D } from "../../style.js";
|
|
10
|
+
import E from "../../utils.js";
|
|
11
|
+
import O from "../sortable-item.js";
|
|
12
|
+
const F = (f) => {
|
|
13
|
+
const { data: e, onClose: s, onItemClick: h } = f, {
|
|
14
|
+
list: b,
|
|
15
|
+
setList: k,
|
|
16
|
+
setListStatus: a,
|
|
17
|
+
setMoveItemId: m,
|
|
18
|
+
setMoveTargetId: c,
|
|
19
|
+
updateItem: v
|
|
20
|
+
} = z(), { theme: x } = L(), { light: I, dark: S } = E.getTheme(x), [u, d] = T("文件夹"), y = [...(e == null ? void 0 : e.children) ?? []];
|
|
21
|
+
return N(() => {
|
|
22
|
+
var o;
|
|
23
|
+
e && d((o = e.data) == null ? void 0 : o.name);
|
|
24
|
+
}, [e]), /* @__PURE__ */ l(
|
|
25
|
+
C,
|
|
26
|
+
{
|
|
27
|
+
visible: !!e,
|
|
28
|
+
onClose: () => {
|
|
29
|
+
s();
|
|
30
|
+
},
|
|
31
|
+
animation: "zoom",
|
|
32
|
+
maskAnimation: "fade",
|
|
33
|
+
mousePosition: e != null && e.pageX && (e != null && e.pageY) ? {
|
|
34
|
+
x: e == null ? void 0 : e.pageX,
|
|
35
|
+
y: e == null ? void 0 : e.pageY
|
|
36
|
+
} : null,
|
|
37
|
+
title: /* @__PURE__ */ l(
|
|
38
|
+
"input",
|
|
39
|
+
{
|
|
40
|
+
className: i`
|
|
41
|
+
background-color: transparent;
|
|
42
|
+
border-style: none;
|
|
43
|
+
text-align: center;
|
|
44
|
+
font-size: 1.25rem;
|
|
45
|
+
line-height: 1.75rem;
|
|
46
|
+
color: white;
|
|
47
|
+
@media (prefers-color-scheme: dark) {
|
|
48
|
+
color: black;
|
|
49
|
+
}
|
|
50
|
+
&:focus {
|
|
51
|
+
outline: none;
|
|
52
|
+
}
|
|
53
|
+
`,
|
|
54
|
+
value: u,
|
|
55
|
+
onChange: (o) => {
|
|
56
|
+
d(o.target.value);
|
|
57
|
+
},
|
|
58
|
+
onBlur: () => {
|
|
59
|
+
e && v(e.id, {
|
|
60
|
+
...e.data,
|
|
61
|
+
name: u
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
footer: null,
|
|
67
|
+
closable: !1,
|
|
68
|
+
className: w(
|
|
69
|
+
"group-item-modal",
|
|
70
|
+
i`
|
|
71
|
+
.rc-dialog-content {
|
|
72
|
+
background-color: transparent;
|
|
73
|
+
box-shadow: none;
|
|
74
|
+
padding: 0;
|
|
75
|
+
.rc-dialog-header {
|
|
76
|
+
text-align: center;
|
|
77
|
+
background-color: transparent;
|
|
78
|
+
margin-bottom: 1rem;
|
|
79
|
+
border-bottom: none;
|
|
80
|
+
.ant-modal-name {
|
|
81
|
+
color: #fff;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
.rc-dialog-body {
|
|
85
|
+
background-color: ${I.groupItemModalBackgroundColor};
|
|
86
|
+
@media (prefers-color-scheme: dark) {
|
|
87
|
+
background-color: ${S.groupItemModalBackgroundColor};
|
|
88
|
+
}
|
|
89
|
+
border-radius: 0.5rem;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
`
|
|
94
|
+
),
|
|
95
|
+
width: 600,
|
|
96
|
+
destroyOnClose: !0,
|
|
97
|
+
children: /* @__PURE__ */ l(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
className: i`
|
|
101
|
+
overflow-y: auto;
|
|
102
|
+
max-height: 60vh;
|
|
103
|
+
padding: 1.25rem 0;
|
|
104
|
+
`,
|
|
105
|
+
onDragLeave: (o) => {
|
|
106
|
+
const r = o.relatedTarget;
|
|
107
|
+
r && (o.currentTarget.contains(r) || setTimeout(() => {
|
|
108
|
+
s();
|
|
109
|
+
}, 500));
|
|
110
|
+
},
|
|
111
|
+
children: /* @__PURE__ */ l(
|
|
112
|
+
B,
|
|
113
|
+
{
|
|
114
|
+
className: i`
|
|
115
|
+
display: grid;
|
|
116
|
+
gap: 1rem;
|
|
117
|
+
place-items: center;
|
|
118
|
+
grid-template-columns: repeat(auto-fill, 96px);
|
|
119
|
+
grid-auto-flow: dense;
|
|
120
|
+
grid-auto-rows: 96px;
|
|
121
|
+
`,
|
|
122
|
+
group: { name: "nested", pull: !0, put: !1 },
|
|
123
|
+
animation: 150,
|
|
124
|
+
fallbackOnBody: !0,
|
|
125
|
+
list: (e == null ? void 0 : e.children) ?? [],
|
|
126
|
+
setList: (o) => {
|
|
127
|
+
var g, p;
|
|
128
|
+
const r = o.map((n) => n.id), t = (p = (g = b.find((n) => n.id === (e == null ? void 0 : e.id))) == null ? void 0 : g.children) == null ? void 0 : p.map((n) => n.id);
|
|
129
|
+
r.length === (t == null ? void 0 : t.length) && r.every((n, M) => n === t[M]) || r.length < ((t == null ? void 0 : t.length) ?? 0) || k(o, [...(e == null ? void 0 : e.parentIds) ?? [], e == null ? void 0 : e.id]);
|
|
130
|
+
},
|
|
131
|
+
onMove: () => (c(null), a("onMove"), !0),
|
|
132
|
+
onStart: (o) => {
|
|
133
|
+
const r = o.item.dataset;
|
|
134
|
+
r != null && r.id && m(r.id), a("onMove");
|
|
135
|
+
},
|
|
136
|
+
onEnd: () => {
|
|
137
|
+
m(null), c(null), a(null);
|
|
138
|
+
},
|
|
139
|
+
ghostClass: D,
|
|
140
|
+
children: y.map((o, r) => /* @__PURE__ */ l(
|
|
141
|
+
O,
|
|
142
|
+
{
|
|
143
|
+
data: o,
|
|
144
|
+
itemIndex: r,
|
|
145
|
+
onClick: h
|
|
146
|
+
},
|
|
147
|
+
o.id
|
|
148
|
+
))
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
};
|
|
156
|
+
export {
|
|
157
|
+
F as default
|
|
158
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
3
|
+
import s from "rc-dialog";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import l from "react-json-view";
|
|
6
|
+
const u = (m) => {
|
|
7
|
+
var i;
|
|
8
|
+
const { data: o, onClose: n } = m;
|
|
9
|
+
return /* @__PURE__ */ e(
|
|
10
|
+
s,
|
|
11
|
+
{
|
|
12
|
+
visible: !!o,
|
|
13
|
+
onClose: () => {
|
|
14
|
+
n();
|
|
15
|
+
},
|
|
16
|
+
animation: "zoom",
|
|
17
|
+
maskAnimation: "fade",
|
|
18
|
+
mousePosition: o != null && o.pageX && (o != null && o.pageY) ? {
|
|
19
|
+
x: o == null ? void 0 : o.pageX,
|
|
20
|
+
y: o == null ? void 0 : o.pageY
|
|
21
|
+
} : null,
|
|
22
|
+
footer: null,
|
|
23
|
+
title: ((i = o == null ? void 0 : o.data) == null ? void 0 : i.name) ?? "信息",
|
|
24
|
+
children: o && /* @__PURE__ */ r("div", { children: [
|
|
25
|
+
/* @__PURE__ */ e("div", { className: "mb-2", children: "开发者信息" }),
|
|
26
|
+
/* @__PURE__ */ e("div", { className: "p-2 rounded-md bg-[#272822]", children: /* @__PURE__ */ e(l, { src: o, theme: "monokai" }) })
|
|
27
|
+
] })
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
u as default
|
|
33
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
import { jsx as r, jsxs as x, Fragment as k } from "react/jsx-runtime";
|
|
3
|
+
import { cx as g, css as i } from "@emotion/css";
|
|
4
|
+
import { motion as p } from "framer-motion";
|
|
5
|
+
import N from "rc-tooltip";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import v from "../context-menu/index.js";
|
|
8
|
+
import { useSortableConfig as u } from "../context/config/hooks.js";
|
|
9
|
+
import { useSortableState as f } from "../context/state/hooks.js";
|
|
10
|
+
import w from "../utils.js";
|
|
11
|
+
const S = (l) => {
|
|
12
|
+
const { data: e, noLetters: m = !1 } = l, { contextMenuFuns: c } = f(), { itemIconBuilder: t, theme: d, contextMenu: s } = u(), { light: o, dark: a } = w.getTheme(d), { data: n = {} } = e, { name: h } = n;
|
|
13
|
+
return /* @__PURE__ */ x(k, { children: [
|
|
14
|
+
/* @__PURE__ */ r(
|
|
15
|
+
p.div,
|
|
16
|
+
{
|
|
17
|
+
className: i`
|
|
18
|
+
width: 4rem;
|
|
19
|
+
height: 4rem;
|
|
20
|
+
background-color: ${o.itemIconBackgroundColor};
|
|
21
|
+
border-radius: 0.75rem;
|
|
22
|
+
box-shadow: 0 0 0.5rem ${o.itemIconShadowColor};
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
position: relative;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
@media (prefers-color-scheme: dark) {
|
|
27
|
+
background-color: ${a.itemIconBackgroundColor};
|
|
28
|
+
box-shadow: 0 0 0.5rem ${a.itemIconShadowColor};
|
|
29
|
+
}
|
|
30
|
+
`,
|
|
31
|
+
whileTap: { scale: 0.9 },
|
|
32
|
+
children: /* @__PURE__ */ r(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: i`
|
|
36
|
+
position: absolute;
|
|
37
|
+
left: 0;
|
|
38
|
+
top: 0;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
color: ${o.itemNameColor};
|
|
42
|
+
@media (prefers-color-scheme: dark) {
|
|
43
|
+
color: ${a.itemNameColor};
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
...c(e, s !== !1),
|
|
47
|
+
children: t == null ? void 0 : t(e)
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ r(
|
|
53
|
+
p.p,
|
|
54
|
+
{
|
|
55
|
+
className: g(
|
|
56
|
+
i`
|
|
57
|
+
text-align: center;
|
|
58
|
+
margin-top: 0.25rem;
|
|
59
|
+
margin-bottom: 0;
|
|
60
|
+
color: ${o.itemNameColor};
|
|
61
|
+
@media (prefers-color-scheme: dark) {
|
|
62
|
+
color: ${a.itemNameColor};
|
|
63
|
+
}
|
|
64
|
+
`,
|
|
65
|
+
m && i`
|
|
66
|
+
color: transparent;
|
|
67
|
+
`
|
|
68
|
+
),
|
|
69
|
+
children: h
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] });
|
|
73
|
+
}, H = (l) => {
|
|
74
|
+
const {
|
|
75
|
+
data: e,
|
|
76
|
+
className: m,
|
|
77
|
+
itemIndex: c,
|
|
78
|
+
onClick: t,
|
|
79
|
+
disabledDrag: d = !1,
|
|
80
|
+
children: s,
|
|
81
|
+
parentIds: o,
|
|
82
|
+
childrenLength: a
|
|
83
|
+
} = l, { contextMenu: n, setContextMenu: h } = f(), { contextMenu: b } = u();
|
|
84
|
+
return /* @__PURE__ */ r(
|
|
85
|
+
N,
|
|
86
|
+
{
|
|
87
|
+
placement: "bottom",
|
|
88
|
+
overlayClassName: i`
|
|
89
|
+
background-color: transparent;
|
|
90
|
+
.rc-tooltip-inner {
|
|
91
|
+
background-color: transparent;
|
|
92
|
+
padding: 0;
|
|
93
|
+
border: none;
|
|
94
|
+
}
|
|
95
|
+
`,
|
|
96
|
+
overlay: /* @__PURE__ */ r(v, { ...b }),
|
|
97
|
+
visible: (n == null ? void 0 : n.data.id) === e.id,
|
|
98
|
+
onVisibleChange: (C) => {
|
|
99
|
+
C || h(null);
|
|
100
|
+
},
|
|
101
|
+
destroyTooltipOnHide: !0,
|
|
102
|
+
children: /* @__PURE__ */ r(
|
|
103
|
+
p.div,
|
|
104
|
+
{
|
|
105
|
+
"data-id": e.id,
|
|
106
|
+
"data-index": c,
|
|
107
|
+
"data-parent-ids": o == null ? void 0 : o.join(","),
|
|
108
|
+
"data-children-length": a,
|
|
109
|
+
onClick: () => t == null ? void 0 : t(e),
|
|
110
|
+
className: g(d && "drag-disabled", m),
|
|
111
|
+
children: s ?? /* @__PURE__ */ r(S, { ...l })
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
export {
|
|
118
|
+
S as SortableItemDefaultContent,
|
|
119
|
+
H as default
|
|
120
|
+
};
|