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.
Files changed (64) hide show
  1. package/dist/components/desktop/config.js +15 -0
  2. package/dist/components/desktop/context/config/context.js +14 -0
  3. package/dist/components/desktop/context/config/hooks.js +7 -0
  4. package/dist/components/desktop/context/state/context.js +221 -0
  5. package/dist/components/desktop/context/state/hooks.js +7 -0
  6. package/dist/components/desktop/context-menu/index.js +312 -0
  7. package/dist/components/desktop/index.js +40 -0
  8. package/dist/components/desktop/items/group-item.js +305 -0
  9. package/dist/components/desktop/items/modal/group-item-modal.js +158 -0
  10. package/dist/components/desktop/items/modal/info-modal.js +33 -0
  11. package/dist/components/desktop/items/sortable-item.js +120 -0
  12. package/dist/components/desktop/sortable.js +272 -0
  13. package/dist/components/desktop/style.js +18 -0
  14. package/dist/components/desktop/theme.js +32 -0
  15. package/dist/components/desktop/utils.js +15 -0
  16. package/dist/components/dock/dock-desktop.js +83 -0
  17. package/dist/components/dock/dock-mobile.js +69 -0
  18. package/dist/components/dock/index.js +24 -0
  19. package/dist/components/dock/utils.js +9 -0
  20. package/dist/components/editor/editor.js +199 -0
  21. package/dist/components/editor/extensions/drag-handle/clipboard-serializer.js +20 -0
  22. package/dist/components/editor/extensions/drag-handle/index.js +273 -0
  23. package/dist/components/editor/extensions.js +131 -0
  24. package/dist/components/editor/generative/ai-completion-command.js +59 -0
  25. package/dist/components/editor/generative/ai-selector-commands.js +78 -0
  26. package/dist/components/editor/generative/ai-selector.js +90 -0
  27. package/dist/components/editor/generative/drag-handle.js +70 -0
  28. package/dist/components/editor/generative/generative-dropdown-menu.js +55 -0
  29. package/dist/components/editor/generative/generative-menu-switch.js +59 -0
  30. package/dist/components/editor/image-upload.js +36 -0
  31. package/dist/components/editor/index.js +8 -0
  32. package/dist/components/editor/lib/colors.js +98 -0
  33. package/dist/components/editor/lib/content.js +8 -0
  34. package/dist/components/editor/lib/nodes.js +70 -0
  35. package/dist/components/editor/lib/url-utils.js +21 -0
  36. package/dist/components/editor/preview.js +12 -0
  37. package/dist/components/editor/selectors/color-selector.js +100 -0
  38. package/dist/components/editor/selectors/link-selector.js +82 -0
  39. package/dist/components/editor/selectors/math-selector.js +37 -0
  40. package/dist/components/editor/selectors/node-selector.js +56 -0
  41. package/dist/components/editor/selectors/text-buttons.js +75 -0
  42. package/dist/components/editor/slash-command.js +129 -0
  43. package/dist/components/editor/ui/button.js +44 -0
  44. package/dist/components/editor/ui/command.js +94 -0
  45. package/dist/components/editor/ui/dialog.js +68 -0
  46. package/dist/components/editor/ui/dropdown-menu.js +99 -0
  47. package/dist/components/editor/ui/icons/crazy-spinner.js +10 -0
  48. package/dist/components/editor/ui/popover.js +24 -0
  49. package/dist/components/editor/ui/scroll-area.js +39 -0
  50. package/dist/components/editor/ui/separator.js +25 -0
  51. package/dist/components/editor/ui/tooltip.js +25 -0
  52. package/dist/components/md-editor/editor.js +104 -0
  53. package/dist/components/md-editor/i18n/index.js +12 -0
  54. package/dist/components/md-editor/i18n/zh_CN.js +122 -0
  55. package/dist/components/md-editor/index.js +8 -0
  56. package/dist/components/md-editor/preview.js +81 -0
  57. package/dist/components/md-editor/style.js +267 -0
  58. package/dist/components/md-editor/utils.js +8 -0
  59. package/dist/i18n/index.js +23 -0
  60. package/dist/i18n/locales/en-US.js +30 -0
  61. package/dist/i18n/locales/zh-CN.js +30 -0
  62. package/dist/index.js +12 -10612
  63. package/dist/node_modules/.pnpm/@tiptap_pm@2.11.5/node_modules/@tiptap/pm/view/dist/index.js +3 -0
  64. package/package.json +6 -1
@@ -0,0 +1,272 @@
1
+ import "./index.css";
2
+ import { jsxs as G, Fragment as O, jsx as i } from "react/jsx-runtime";
3
+ import { css as a, cx as c } from "@emotion/css";
4
+ import { useRef as I, useMemo as T } from "react";
5
+ import B from "react-slick";
6
+ import { ReactSortable as E } from "react-sortablejs";
7
+ /* empty css */
8
+ /* empty css */
9
+ import P from "./items/group-item.js";
10
+ import X from "./items/modal/group-item-modal.js";
11
+ import z from "./items/modal/info-modal.js";
12
+ import { ghostClass as F } from "./style.js";
13
+ import { useSortableState as J } from "./context/state/hooks.js";
14
+ import { useSortableConfig as _ } from "./context/config/hooks.js";
15
+ import q from "./items/sortable-item.js";
16
+ const at = (x) => {
17
+ const {
18
+ pagination: s = { position: "bottom" },
19
+ className: y,
20
+ sliderProps: D,
21
+ sliderRef: u,
22
+ onItemClick: n
23
+ } = x, m = I(null), v = I(null), {
24
+ list: l,
25
+ setList: S,
26
+ setListStatus: d,
27
+ showInfoItemData: w,
28
+ setShowInfoItemData: C,
29
+ openGroupItemData: M,
30
+ setOpenGroupItemData: j,
31
+ setMoveItemId: f,
32
+ setMoveTargetId: p,
33
+ addItem: L
34
+ } = J(), { pagingDotBuilder: g, pagingDotsBuilder: h, itemBuilder: b } = _(), N = T(() => s === !1 ? {} : {
35
+ top: a`
36
+ display: flex;
37
+ flex-direction: column;
38
+ .slick-list {
39
+ order: 1;
40
+ }
41
+ .slick-dots {
42
+ position: static;
43
+ }
44
+ `,
45
+ bottom: a`
46
+ .slick-dots {
47
+ position: static;
48
+ }
49
+ `,
50
+ left: a`
51
+ .slick-dots {
52
+ position: absolute;
53
+ width: auto;
54
+ left: 0;
55
+ top: 0;
56
+ bottom: 0;
57
+ transform: translateX(-100%);
58
+ display: flex;
59
+ justify-content: center;
60
+ align-items: center;
61
+ .slick-dots-default {
62
+ flex-direction: column;
63
+ }
64
+ }
65
+ `,
66
+ right: a`
67
+ .slick-dots {
68
+ position: absolute;
69
+ width: auto;
70
+ right: 0;
71
+ top: 0;
72
+ bottom: 0;
73
+ transform: translateX(100%);
74
+ display: flex;
75
+ justify-content: center;
76
+ align-items: center;
77
+ .slick-dots-default {
78
+ flex-direction: column;
79
+ }
80
+ }
81
+ `
82
+ }[s.position ?? "bottom"], [s]);
83
+ return /* @__PURE__ */ G(O, { children: [
84
+ /* @__PURE__ */ i(
85
+ B,
86
+ {
87
+ useCSS: !0,
88
+ useTransform: !0,
89
+ arrows: !1,
90
+ ref: u ?? m,
91
+ infinite: !1,
92
+ dots: !0,
93
+ touchMove: !1,
94
+ lazyLoad: "anticipated",
95
+ className: c(
96
+ N,
97
+ a`
98
+ .slick-track {
99
+ display: flex;
100
+ align-items: stretch;
101
+ }
102
+ .slick-slide {
103
+ display: flex;
104
+ align-self: stretch;
105
+ height: unset;
106
+ > div {
107
+ display: flex;
108
+ align-self: stretch;
109
+ width: 100%;
110
+ }
111
+ }
112
+ `,
113
+ y
114
+ ),
115
+ customPaging: (r) => {
116
+ var t, e;
117
+ return g ? g(l[r], r) : /* @__PURE__ */ i(
118
+ "div",
119
+ {
120
+ onDragEnter: () => {
121
+ var o;
122
+ (o = (u ?? m).current) == null || o.slickGoTo(r);
123
+ },
124
+ children: (e = (t = l[r]) == null ? void 0 : t.data) == null ? void 0 : e.name
125
+ }
126
+ );
127
+ },
128
+ appendDots: (r) => h ? h(r) : s === !1 ? /* @__PURE__ */ i("div", {}) : /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(
129
+ "ul",
130
+ {
131
+ ref: v,
132
+ className: c(
133
+ "slick-dots-default",
134
+ a`
135
+ padding: 0.5rem;
136
+ display: inline-flex;
137
+ justify-content: center;
138
+ align-items: center;
139
+ gap: 0.5rem;
140
+ background-color: rgba(0, 0, 0, 0.1);
141
+ border-radius: 0.5rem;
142
+ .slick-active {
143
+ background-color: rgba(0, 0, 0, 0.3);
144
+ color: white;
145
+ padding: 0.25rem;
146
+ border-radius: 0.25rem;
147
+ }
148
+ li {
149
+ margin: 0;
150
+ width: auto;
151
+ height: auto;
152
+ }
153
+ `
154
+ ),
155
+ children: r
156
+ }
157
+ ) }),
158
+ ...D,
159
+ children: l.map((r) => /* @__PURE__ */ i(
160
+ "div",
161
+ {
162
+ onDrop: (t) => {
163
+ t.preventDefault();
164
+ const e = t.dataTransfer.getData("text/plain");
165
+ if (e !== "")
166
+ try {
167
+ L(JSON.parse(e), [r.id]);
168
+ } catch (o) {
169
+ console.log("drag error", o);
170
+ }
171
+ },
172
+ onDragOver: (t) => {
173
+ t.preventDefault();
174
+ },
175
+ children: /* @__PURE__ */ i(
176
+ E,
177
+ {
178
+ className: c(
179
+ a`
180
+ display: grid;
181
+ transition: all 0.3s;
182
+ grid-template-columns: repeat(auto-fill, 96px);
183
+ grid-auto-flow: dense;
184
+ grid-auto-rows: 96px;
185
+ place-items: center;
186
+ justify-content: center;
187
+ align-items: center;
188
+ `
189
+ ),
190
+ animation: 150,
191
+ fallbackOnBody: !0,
192
+ swapThreshold: 0.65,
193
+ group: "nested",
194
+ list: r.children ?? [],
195
+ setList: (t) => S(t, [r.id]),
196
+ filter: ".drag-disabled",
197
+ onMove: (t) => {
198
+ d("onMove");
199
+ const { dragged: e, related: o } = t, R = e.dataset, k = o.dataset;
200
+ return p(null), !((Object.keys(k).length === 0 || k.parentIds) && Number(R.childrenLength) > 0 && o.classList.contains("sortable-group-item"));
201
+ },
202
+ onStart: (t) => {
203
+ const e = t.item.dataset;
204
+ e != null && e.id && f(e.id), d("onMove");
205
+ },
206
+ onEnd: () => {
207
+ f(null), p(null), d(null);
208
+ },
209
+ ghostClass: F,
210
+ children: (r.children ?? []).map((t, e) => {
211
+ let o;
212
+ if (b)
213
+ return b(t);
214
+ switch (t.type) {
215
+ case "group":
216
+ case "app":
217
+ o = /* @__PURE__ */ i(
218
+ P,
219
+ {
220
+ data: t,
221
+ itemIndex: e,
222
+ parentIds: [r.id, t.id],
223
+ onClick: n
224
+ },
225
+ t.id
226
+ );
227
+ break;
228
+ default:
229
+ o = /* @__PURE__ */ i(
230
+ q,
231
+ {
232
+ data: t,
233
+ itemIndex: e,
234
+ onClick: n
235
+ },
236
+ t.id
237
+ );
238
+ break;
239
+ }
240
+ return o;
241
+ })
242
+ }
243
+ )
244
+ },
245
+ r.id
246
+ ))
247
+ }
248
+ ),
249
+ /* @__PURE__ */ i(
250
+ z,
251
+ {
252
+ data: w,
253
+ onClose: () => {
254
+ C(null);
255
+ }
256
+ }
257
+ ),
258
+ /* @__PURE__ */ i(
259
+ X,
260
+ {
261
+ data: M,
262
+ onClose: () => {
263
+ j(null);
264
+ },
265
+ onItemClick: n
266
+ }
267
+ )
268
+ ] });
269
+ };
270
+ export {
271
+ at as default
272
+ };
@@ -0,0 +1,18 @@
1
+ import "./index.css";
2
+ import { css as a } from "@emotion/css";
3
+ const r = a`
4
+ padding: 8px;
5
+ transition: all 0.2s;
6
+ > div {
7
+ transition: all 0.2s;
8
+ border: 2px solid aquamarine;
9
+ background-color: transparent;
10
+ > div {
11
+ opacity: 0;
12
+ transition: all 0.2s;
13
+ }
14
+ }
15
+ `;
16
+ export {
17
+ r as ghostClass
18
+ };
@@ -0,0 +1,32 @@
1
+ import "./index.css";
2
+ const r = {
3
+ token: {
4
+ itemNameColor: "#1a1a1a",
5
+ itemIconBackgroundColor: "white",
6
+ itemIconShadowColor: "rgba(0, 0, 0, 0.1)",
7
+ groupItemIconBackgroundColor: "rgba(255, 255, 255, 0.1)",
8
+ groupItemIconShadowColor: "rgba(0, 0, 0, 0.1)",
9
+ groupItemModalBackgroundColor: "rgba(255, 255, 255, 0.8)",
10
+ contextMenuTextColor: "black",
11
+ contextMenuActiveColor: "#f3f4f6",
12
+ contextMenuBackgroundColor: "white",
13
+ contextMenuShadowColor: "rgba(0, 0, 0, 0.1)"
14
+ }
15
+ }, e = {
16
+ token: {
17
+ itemNameColor: "white",
18
+ itemIconBackgroundColor: "#1f2937",
19
+ itemIconShadowColor: "rgba(0, 0, 0, 0.1)",
20
+ groupItemIconBackgroundColor: "rgba(0, 0, 0, 0.1)",
21
+ groupItemIconShadowColor: "rgba(0, 0, 0, 0.1)",
22
+ groupItemModalBackgroundColor: "rgba(0, 0, 0, 0.1)",
23
+ contextMenuTextColor: "white",
24
+ contextMenuActiveColor: "#1a1a1a",
25
+ contextMenuBackgroundColor: "#1a1a1a",
26
+ contextMenuShadowColor: "rgba(255, 255, 255, 0.1)"
27
+ }
28
+ };
29
+ export {
30
+ e as themeDark,
31
+ r as themeLight
32
+ };
@@ -0,0 +1,15 @@
1
+ var c = Object.defineProperty;
2
+ var k = (o, t, n) => t in o ? c(o, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[t] = n;
3
+ var s = (o, t, n) => k(o, typeof t != "symbol" ? t + "" : t, n);
4
+ import "./index.css";
5
+ import { themeLight as u, themeDark as l } from "./theme.js";
6
+ class a {
7
+ }
8
+ /** 清理重复id */
9
+ s(a, "uniqueArray", (t) => t.reduce((n, r) => n.find((i) => i.id === r.id) ? n : n.concat([r]), [])), s(a, "getTheme", (t) => {
10
+ const n = u.token, r = l.token, d = { ...n, ...t == null ? void 0 : t.token }, i = { ...r, ...t == null ? void 0 : t.token };
11
+ return { light: d, dark: i };
12
+ });
13
+ export {
14
+ a as default
15
+ };
@@ -0,0 +1,83 @@
1
+ import "./index.css";
2
+ import { jsx as t, jsxs as M } from "react/jsx-runtime";
3
+ import { useMotionValue as N, motion as i, useTransform as n, useSpring as o, AnimatePresence as T } from "framer-motion";
4
+ import { cn as j } from "./utils.js";
5
+ import { useRef as X, useState as C } from "react";
6
+ const D = (a) => {
7
+ const { mouseX: c, title: d, icon: s, href: e } = a, m = X(null), r = n(c, (I) => {
8
+ var f;
9
+ const u = ((f = m.current) == null ? void 0 : f.getBoundingClientRect()) ?? { x: 0, width: 0 };
10
+ return I - u.x - u.width / 2;
11
+ }), h = n(r, [-150, 0, 150], [40, 80, 40]), p = n(r, [-150, 0, 150], [40, 80, 40]), g = n(
12
+ r,
13
+ [-150, 0, 150],
14
+ [20, 40, 20]
15
+ ), x = n(
16
+ r,
17
+ [-150, 0, 150],
18
+ [20, 40, 20]
19
+ ), y = o(h, {
20
+ mass: 0.1,
21
+ stiffness: 150,
22
+ damping: 12
23
+ }), b = o(p, {
24
+ mass: 0.1,
25
+ stiffness: 150,
26
+ damping: 12
27
+ }), v = o(g, {
28
+ mass: 0.1,
29
+ stiffness: 150,
30
+ damping: 12
31
+ }), w = o(x, {
32
+ mass: 0.1,
33
+ stiffness: 150,
34
+ damping: 12
35
+ }), [k, l] = C(!1);
36
+ return /* @__PURE__ */ t("a", { href: e, children: /* @__PURE__ */ M(
37
+ i.div,
38
+ {
39
+ ref: m,
40
+ style: { width: y, height: b },
41
+ onMouseEnter: () => l(!0),
42
+ onMouseLeave: () => l(!1),
43
+ className: "aspect-square rounded-full bg-gray-200 dark:bg-neutral-800 flex items-center justify-center relative",
44
+ children: [
45
+ /* @__PURE__ */ t(T, { children: k && /* @__PURE__ */ t(
46
+ i.div,
47
+ {
48
+ initial: { opacity: 0, y: 10, x: "-50%" },
49
+ animate: { opacity: 1, y: 0, x: "-50%" },
50
+ exit: { opacity: 0, y: 2, x: "-50%" },
51
+ className: "px-2 py-0.5 whitespace-pre rounded-md bg-gray-100 border dark:bg-neutral-800 dark:border-neutral-900 dark:text-white border-gray-200 text-neutral-700 absolute left-1/2 -translate-x-1/2 -top-8 w-fit text-xs",
52
+ children: d
53
+ }
54
+ ) }),
55
+ /* @__PURE__ */ t(
56
+ i.div,
57
+ {
58
+ style: { width: v, height: w },
59
+ className: "flex items-center justify-center",
60
+ children: s
61
+ }
62
+ )
63
+ ]
64
+ }
65
+ ) });
66
+ }, B = (a) => {
67
+ const { items: c, className: d } = a, s = N(1 / 0);
68
+ return /* @__PURE__ */ t(
69
+ i.div,
70
+ {
71
+ onMouseMove: (e) => s.set(e.pageX),
72
+ onMouseLeave: () => s.set(1 / 0),
73
+ className: j(
74
+ "mx-auto hidden md:flex h-16 gap-4 items-end rounded-2xl bg-gray-50 dark:bg-neutral-900 px-4 pb-3",
75
+ d
76
+ ),
77
+ children: c.map((e) => /* @__PURE__ */ t(D, { mouseX: s, ...e }, e.title))
78
+ }
79
+ );
80
+ };
81
+ export {
82
+ B as default
83
+ };
@@ -0,0 +1,69 @@
1
+ import "./index.css";
2
+ import { jsxs as f, jsx as e } from "react/jsx-runtime";
3
+ import { useState as u } from "react";
4
+ import { cn as h } from "./utils.js";
5
+ import { AnimatePresence as p, motion as r } from "framer-motion";
6
+ import { RiMoreLine as y } from "@remixicon/react";
7
+ const j = (o) => {
8
+ const { items: a, className: s, collapseIcon: l, autoHidden: c = !1 } = o, [n, d] = u(!1), m = () => {
9
+ d(!n);
10
+ };
11
+ return /* @__PURE__ */ f(
12
+ "div",
13
+ {
14
+ className: h(
15
+ "relative block",
16
+ c ? "md:hidden" : "",
17
+ s
18
+ ),
19
+ children: [
20
+ /* @__PURE__ */ e(p, { children: n && /* @__PURE__ */ e(
21
+ r.div,
22
+ {
23
+ layoutId: "nav",
24
+ className: "absolute bottom-full mb-2 inset-x-0 flex flex-col gap-2",
25
+ children: a.map((t, i) => /* @__PURE__ */ e(
26
+ r.div,
27
+ {
28
+ initial: { opacity: 0, y: 10 },
29
+ animate: {
30
+ opacity: 1,
31
+ y: 0
32
+ },
33
+ exit: {
34
+ opacity: 0,
35
+ y: 10,
36
+ transition: {
37
+ delay: i * 0.05
38
+ }
39
+ },
40
+ transition: { delay: (a.length - 1 - i) * 0.05 },
41
+ children: /* @__PURE__ */ e(
42
+ "a",
43
+ {
44
+ href: t.href,
45
+ className: "h-10 w-10 rounded-full bg-gray-50 dark:bg-neutral-900 flex items-center justify-center",
46
+ children: /* @__PURE__ */ e("div", { className: "h-4 w-4", children: t.icon })
47
+ },
48
+ t.title
49
+ )
50
+ },
51
+ t.title
52
+ ))
53
+ }
54
+ ) }),
55
+ /* @__PURE__ */ e(
56
+ "button",
57
+ {
58
+ onClick: m,
59
+ className: "h-10 w-10 rounded-full bg-gray-50 dark:bg-neutral-800 flex items-center justify-center",
60
+ children: l || /* @__PURE__ */ e(y, { className: "h-5 w-5 text-neutral-500 dark:text-neutral-400" })
61
+ }
62
+ )
63
+ ]
64
+ }
65
+ );
66
+ };
67
+ export {
68
+ j as default
69
+ };
@@ -0,0 +1,24 @@
1
+ import "./index.css";
2
+ import { jsxs as l, Fragment as p, jsx as e } from "react/jsx-runtime";
3
+ import t from "./dock-desktop.js";
4
+ import r from "./dock-mobile.js";
5
+ const k = (a) => {
6
+ const { items: o, desktopClassName: i, mobileClassName: c, ...s } = a;
7
+ return /* @__PURE__ */ l(p, { children: [
8
+ /* @__PURE__ */ e(t, { items: o, className: i, ...s }),
9
+ /* @__PURE__ */ e(
10
+ r,
11
+ {
12
+ items: o,
13
+ className: c,
14
+ autoHidden: !0,
15
+ ...s
16
+ }
17
+ )
18
+ ] });
19
+ }, m = k;
20
+ m.Desktop = t;
21
+ m.Mobile = r;
22
+ export {
23
+ m as default
24
+ };
@@ -0,0 +1,9 @@
1
+ import "./index.css";
2
+ import { clsx as o } from "clsx";
3
+ import { twMerge as t } from "tailwind-merge";
4
+ function n(...r) {
5
+ return t(o(r));
6
+ }
7
+ export {
8
+ n as cn
9
+ };