@layers-app/shared 0.0.27 → 0.0.28
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/CommentComposer/index.d.ts +52 -0
- package/dist/components/CommentsPanel/components/CommentActions.d.ts +16 -0
- package/dist/components/CommentsPanel/components/CommentFilterMenu.d.ts +6 -0
- package/dist/components/CommentsPanel/components/CommentPanelListItem.d.ts +22 -0
- package/dist/components/CommentsPanel/components/CommentsEmptyPlaceholder.d.ts +3 -0
- package/dist/components/CommentsPanel/components/CommentsFilterHeader.d.ts +3 -0
- package/dist/components/CommentsPanel/components/CommentsListItemMenu.d.ts +6 -0
- package/dist/components/CommentsPanel/components/CommentsMultiSelectUsers.d.ts +6 -0
- package/dist/components/CommentsPanel/components/CommentsPanelList.d.ts +19 -0
- package/dist/components/CommentsPanel/components/CommentsThreadReplyControls.d.ts +10 -0
- package/dist/components/CommentsPanel/components/CommentsUploadFilesPreview.d.ts +5 -0
- package/dist/components/CommentsPanel/components/Icon.d.ts +8 -0
- package/dist/components/CommentsPanel/components/RemoveConfirmModal.d.ts +11 -0
- package/dist/components/CommentsPanel/index.d.ts +21 -0
- package/dist/components/CommentsPanel/store.d.ts +19 -0
- package/dist/components/CommentsPanel/types.d.ts +243 -0
- package/dist/components/CommentsPanel/utils.d.ts +8 -0
- package/dist/helpers/getFileIcons.d.ts +1 -0
- package/dist/helpers/getFileType.d.ts +1 -0
- package/dist/index-Bz8Yenv3.js +75975 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +102 -46106
- package/dist/index.umd.cjs +269 -77
- package/dist/layers.C5oAiCeN-DZQs9zcO.js +288 -0
- package/dist/layers.CovbS90x-CThbTGYw.js +52 -0
- package/dist/layers.CsuN1Q94-BT7000dw.js +170 -0
- package/dist/layers.DETHwCxI-BvdKGW_B.js +281 -0
- package/dist/layers.vNINlb5t-Bef3Moef.js +289 -0
- package/package.json +2 -2
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { jsx as o, jsxs as $ } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as q, useState as w, useContext as G, useEffect as x } from "react";
|
|
3
|
+
import { useTranslation as J } from "react-i18next";
|
|
4
|
+
import { I as Q, s as X, p as Y, h as Z, T as M, u as T, o as W, t as ee, e as te, l as ie, z as oe, K as ae, B as re } from "./index-Bz8Yenv3.js";
|
|
5
|
+
import { LoadingOverlay as D, Flex as se, Alert as ne } from "@mantine/core";
|
|
6
|
+
import { IconInfoCircle as he } from "@tabler/icons-react";
|
|
7
|
+
const H = (t) => {
|
|
8
|
+
const {
|
|
9
|
+
width: c,
|
|
10
|
+
height: r,
|
|
11
|
+
isLoading: s,
|
|
12
|
+
isError: d,
|
|
13
|
+
src: g,
|
|
14
|
+
id: m,
|
|
15
|
+
altText: p,
|
|
16
|
+
imageRef: y,
|
|
17
|
+
maxWidth: v
|
|
18
|
+
} = t;
|
|
19
|
+
return /* @__PURE__ */ $(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: "media-wrapper",
|
|
23
|
+
style: {
|
|
24
|
+
width: c,
|
|
25
|
+
height: r,
|
|
26
|
+
display: "inline-flex",
|
|
27
|
+
position: "relative"
|
|
28
|
+
},
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ o(
|
|
31
|
+
D,
|
|
32
|
+
{
|
|
33
|
+
visible: s,
|
|
34
|
+
zIndex: 1e3,
|
|
35
|
+
overlayProps: { backgroundOpacity: 0.5 },
|
|
36
|
+
loaderProps: { size: 24, color: "black" }
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ o(
|
|
40
|
+
D,
|
|
41
|
+
{
|
|
42
|
+
visible: d,
|
|
43
|
+
zIndex: 1e3,
|
|
44
|
+
overlayProps: { backgroundOpacity: 0.5 },
|
|
45
|
+
loaderProps: {
|
|
46
|
+
children: /* @__PURE__ */ o(se, { bg: "white", maw: 300, justify: "center", children: /* @__PURE__ */ o(
|
|
47
|
+
ne,
|
|
48
|
+
{
|
|
49
|
+
variant: "light",
|
|
50
|
+
color: "red",
|
|
51
|
+
title: "Ошибка загрузки",
|
|
52
|
+
icon: /* @__PURE__ */ o(he, {}),
|
|
53
|
+
children: "Попробуйте загрузить заново."
|
|
54
|
+
}
|
|
55
|
+
) })
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ o(
|
|
60
|
+
de,
|
|
61
|
+
{
|
|
62
|
+
className: null,
|
|
63
|
+
src: g,
|
|
64
|
+
altText: p,
|
|
65
|
+
imageRef: y,
|
|
66
|
+
width: "inherit",
|
|
67
|
+
height: "inherit",
|
|
68
|
+
maxWidth: v || "auto",
|
|
69
|
+
id: m
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
function de({
|
|
77
|
+
altText: t,
|
|
78
|
+
className: c,
|
|
79
|
+
imageRef: r,
|
|
80
|
+
src: s,
|
|
81
|
+
width: d,
|
|
82
|
+
height: g,
|
|
83
|
+
maxWidth: m,
|
|
84
|
+
id: p
|
|
85
|
+
}) {
|
|
86
|
+
return /* @__PURE__ */ o(
|
|
87
|
+
"img",
|
|
88
|
+
{
|
|
89
|
+
className: c || void 0,
|
|
90
|
+
src: s,
|
|
91
|
+
alt: t,
|
|
92
|
+
ref: r,
|
|
93
|
+
style: {
|
|
94
|
+
height: g,
|
|
95
|
+
maxWidth: m,
|
|
96
|
+
width: d
|
|
97
|
+
},
|
|
98
|
+
draggable: "false",
|
|
99
|
+
"data-id": p
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function fe({
|
|
104
|
+
src: t,
|
|
105
|
+
altText: c,
|
|
106
|
+
nodeKey: r,
|
|
107
|
+
width: s,
|
|
108
|
+
height: d,
|
|
109
|
+
maxWidth: g,
|
|
110
|
+
showCaption: m,
|
|
111
|
+
caption: p,
|
|
112
|
+
id: y,
|
|
113
|
+
create: v,
|
|
114
|
+
alignment: O
|
|
115
|
+
}) {
|
|
116
|
+
const z = q(null), [A, b] = w(!0), [P, B] = w(!1), { isCollabActive: S } = Q(), [l] = X(), [u, C] = w(!0), [n, E] = w({
|
|
117
|
+
width: 0,
|
|
118
|
+
height: 0
|
|
119
|
+
}), { fetchUploadImage: k, fetchDeleteImage: F } = G(Y), { t: N } = J();
|
|
120
|
+
x(() => {
|
|
121
|
+
if (!t || t.startsWith("data:image/")) {
|
|
122
|
+
b(!1);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const e = new Image();
|
|
126
|
+
e.src = t, e.onload = () => b(!1), e.onerror = () => {
|
|
127
|
+
b(!1), B(!0);
|
|
128
|
+
};
|
|
129
|
+
}, [t]);
|
|
130
|
+
const U = (e, a) => {
|
|
131
|
+
l.update(() => {
|
|
132
|
+
re(null);
|
|
133
|
+
const h = T(r);
|
|
134
|
+
W(h) && h.setWidthAndHeight(e, a);
|
|
135
|
+
});
|
|
136
|
+
}, { historyState: K } = Z(), {
|
|
137
|
+
settings: { showNestedEditorTreeView: L }
|
|
138
|
+
} = M(), [I, f] = w(!1);
|
|
139
|
+
function V(e) {
|
|
140
|
+
return e.endsWith(".svg") || e.includes("image/svg+xml");
|
|
141
|
+
}
|
|
142
|
+
function _(e) {
|
|
143
|
+
return new Promise((a, h) => {
|
|
144
|
+
if (V(e)) {
|
|
145
|
+
a(0);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const i = new Image();
|
|
149
|
+
i.src = e, i.onload = () => {
|
|
150
|
+
a(i.width);
|
|
151
|
+
}, i.onerror = () => {
|
|
152
|
+
h(new Error("Failed to load image"));
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return x(() => {
|
|
157
|
+
v && f(!0);
|
|
158
|
+
}, [v]), x(() => {
|
|
159
|
+
let e = s, a = d, h = 100;
|
|
160
|
+
t && _(t).then((i) => {
|
|
161
|
+
typeof e == "number" && e < h && i < h ? (C(!0), E({
|
|
162
|
+
width: e,
|
|
163
|
+
height: a
|
|
164
|
+
})) : i < h ? (C(!0), E({
|
|
165
|
+
width: "auto",
|
|
166
|
+
height: "auto"
|
|
167
|
+
})) : (E({
|
|
168
|
+
width: i,
|
|
169
|
+
height: i
|
|
170
|
+
}), C(!1));
|
|
171
|
+
});
|
|
172
|
+
}, [t]), x(() => {
|
|
173
|
+
n.width && n.height && u && l.update(() => {
|
|
174
|
+
const e = T(r);
|
|
175
|
+
W(e) && e.setWidthAndHeight(n.width, n.height);
|
|
176
|
+
});
|
|
177
|
+
}, [n.width, n.height, u]), x(() => {
|
|
178
|
+
const e = document.documentElement;
|
|
179
|
+
ee(I, e);
|
|
180
|
+
}, [I]), t ? u ? /* @__PURE__ */ o(
|
|
181
|
+
H,
|
|
182
|
+
{
|
|
183
|
+
width: n.width,
|
|
184
|
+
height: n.height,
|
|
185
|
+
isLoading: A,
|
|
186
|
+
isError: P,
|
|
187
|
+
isIcon: u,
|
|
188
|
+
src: t,
|
|
189
|
+
id: y,
|
|
190
|
+
editor: l,
|
|
191
|
+
nodeKey: r,
|
|
192
|
+
fetchDeleteImage: F,
|
|
193
|
+
altText: c,
|
|
194
|
+
imageRef: z,
|
|
195
|
+
maxWidth: g,
|
|
196
|
+
showCaption: m,
|
|
197
|
+
caption: p,
|
|
198
|
+
isCollabActive: S,
|
|
199
|
+
historyState: K,
|
|
200
|
+
showNestedEditorTreeView: L,
|
|
201
|
+
t: N
|
|
202
|
+
}
|
|
203
|
+
) : /* @__PURE__ */ o(
|
|
204
|
+
te,
|
|
205
|
+
{
|
|
206
|
+
editor: l,
|
|
207
|
+
isIcon: u,
|
|
208
|
+
width: typeof s == "string" && s.includes("%") ? parseFloat(s) : s,
|
|
209
|
+
height: typeof d == "string" && d.includes("%") ? parseFloat(d) : s,
|
|
210
|
+
initialWidth: n.width || "",
|
|
211
|
+
initialHeight: n.height || "",
|
|
212
|
+
onResizeEnd: U,
|
|
213
|
+
alignment: O,
|
|
214
|
+
children: /* @__PURE__ */ o(
|
|
215
|
+
H,
|
|
216
|
+
{
|
|
217
|
+
width: "inherit",
|
|
218
|
+
height: "inherit",
|
|
219
|
+
isLoading: A,
|
|
220
|
+
isError: P,
|
|
221
|
+
isIcon: u,
|
|
222
|
+
src: t,
|
|
223
|
+
id: y,
|
|
224
|
+
editor: l,
|
|
225
|
+
nodeKey: r,
|
|
226
|
+
fetchDeleteImage: F,
|
|
227
|
+
altText: c,
|
|
228
|
+
imageRef: z,
|
|
229
|
+
maxWidth: g,
|
|
230
|
+
showCaption: m,
|
|
231
|
+
caption: p,
|
|
232
|
+
isCollabActive: S,
|
|
233
|
+
historyState: K,
|
|
234
|
+
showNestedEditorTreeView: L,
|
|
235
|
+
t: N
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
) : /* @__PURE__ */ o(
|
|
240
|
+
ie,
|
|
241
|
+
{
|
|
242
|
+
uploading: !1,
|
|
243
|
+
onUpload: (e) => {
|
|
244
|
+
!k || !e.length || (e.forEach((a, h) => {
|
|
245
|
+
k(a, (i, j) => {
|
|
246
|
+
h === 0 ? l.update(() => {
|
|
247
|
+
const R = T(r);
|
|
248
|
+
W(R) && (R.setSrc(i), R.setId(j));
|
|
249
|
+
}) : l.dispatchCommand(ae, {
|
|
250
|
+
altText: "",
|
|
251
|
+
src: i,
|
|
252
|
+
id: j
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
}), f(!1));
|
|
256
|
+
},
|
|
257
|
+
popoverProps: {
|
|
258
|
+
opened: I,
|
|
259
|
+
position: "bottom",
|
|
260
|
+
onChange: f
|
|
261
|
+
},
|
|
262
|
+
onChange: (e) => {
|
|
263
|
+
f(!1), l.update(() => {
|
|
264
|
+
const a = T(r);
|
|
265
|
+
W(a) && a.setSrc(e);
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
children: /* @__PURE__ */ o(
|
|
269
|
+
oe,
|
|
270
|
+
{
|
|
271
|
+
title: N("editor.image.add_photo"),
|
|
272
|
+
icon: "photo",
|
|
273
|
+
onClick: () => f(!I)
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
export {
|
|
280
|
+
fe as default
|
|
281
|
+
};
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { jsx as g, jsxs as _, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as A, useEffect as b, useLayoutEffect as $, useState as j, useMemo as G, Suspense as H } from "react";
|
|
3
|
+
import { s as X, I as Q, h as V, y as Z, G as J, A as ee, $ as te, n as ne, X as re, u as k, C as S, _ as oe, D as se, c as B, Z as ae, q as ie, L as i, E as l, F as c, H as le, J as ue, N as P, P as ce, R as de, S as me, V as fe, M as ge, W as M, Q as pe, Y as T, i as ve, a0 as he, a1 as z, a2 as Y, a3 as Ce, a4 as ye, a5 as we, a6 as Ee, a7 as De, a8 as Le, a9 as be, aa as xe, ab as Re, ac as ke } from "./index-Bz8Yenv3.js";
|
|
4
|
+
import { S as Se, W as Te } from "./layers.CovbS90x-CThbTGYw.js";
|
|
5
|
+
import { flushSync as _e, createPortal as Ne } from "react-dom";
|
|
6
|
+
const w = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Xe = w && "documentMode" in document ? document.documentMode : null, Be = !(!w || !("InputEvent" in window) || Xe) && "getTargetRanges" in new window.InputEvent("input"), Ke = w && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), I = w && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Ae = w && /^(?=.*Chrome).*/i.test(navigator.userAgent), Pe = w && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !Ae;
|
|
7
|
+
function U(n, t) {
|
|
8
|
+
t.update(() => {
|
|
9
|
+
if (n !== null) {
|
|
10
|
+
const e = xe(n, KeyboardEvent) ? null : n.clipboardData, s = i();
|
|
11
|
+
if (s !== null && e != null) {
|
|
12
|
+
n.preventDefault();
|
|
13
|
+
const a = Re(t);
|
|
14
|
+
a !== null && e.setData("text/html", a), e.setData("text/plain", s.getTextContent());
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function Me(n) {
|
|
20
|
+
return B(n.registerCommand(T, (t) => {
|
|
21
|
+
const e = i();
|
|
22
|
+
return !!l(e) && (e.deleteCharacter(t), !0);
|
|
23
|
+
}, c), n.registerCommand(Le, (t) => {
|
|
24
|
+
const e = i();
|
|
25
|
+
return !!l(e) && (e.deleteWord(t), !0);
|
|
26
|
+
}, c), n.registerCommand(De, (t) => {
|
|
27
|
+
const e = i();
|
|
28
|
+
return !!l(e) && (e.deleteLine(t), !0);
|
|
29
|
+
}, c), n.registerCommand(Ee, (t) => {
|
|
30
|
+
const e = i();
|
|
31
|
+
if (!l(e)) return !1;
|
|
32
|
+
if (typeof t == "string") e.insertText(t);
|
|
33
|
+
else {
|
|
34
|
+
const s = t.dataTransfer;
|
|
35
|
+
if (s != null) P(s, e);
|
|
36
|
+
else {
|
|
37
|
+
const a = t.data;
|
|
38
|
+
a && e.insertText(a);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return !0;
|
|
42
|
+
}, c), n.registerCommand(we, () => {
|
|
43
|
+
const t = i();
|
|
44
|
+
return !!l(t) && (t.removeText(), !0);
|
|
45
|
+
}, c), n.registerCommand(M, (t) => {
|
|
46
|
+
const e = i();
|
|
47
|
+
return !!l(e) && (e.insertLineBreak(t), !0);
|
|
48
|
+
}, c), n.registerCommand(ye, () => {
|
|
49
|
+
const t = i();
|
|
50
|
+
return !!l(t) && (t.insertLineBreak(), !0);
|
|
51
|
+
}, c), n.registerCommand(Ce, (t) => {
|
|
52
|
+
const e = i();
|
|
53
|
+
if (!l(e)) return !1;
|
|
54
|
+
const s = t, a = s.shiftKey;
|
|
55
|
+
return !!z(e, !0) && (s.preventDefault(), Y(e, a, !0), !0);
|
|
56
|
+
}, c), n.registerCommand(he, (t) => {
|
|
57
|
+
const e = i();
|
|
58
|
+
if (!l(e)) return !1;
|
|
59
|
+
const s = t, a = s.shiftKey;
|
|
60
|
+
return !!z(e, !1) && (s.preventDefault(), Y(e, a, !1), !0);
|
|
61
|
+
}, c), n.registerCommand(ve, (t) => {
|
|
62
|
+
const e = i();
|
|
63
|
+
return !!l(e) && (!I || navigator.language !== "ko-KR") && (t.preventDefault(), n.dispatchCommand(T, !0));
|
|
64
|
+
}, c), n.registerCommand(pe, (t) => {
|
|
65
|
+
const e = i();
|
|
66
|
+
return !!l(e) && (t.preventDefault(), n.dispatchCommand(T, !1));
|
|
67
|
+
}, c), n.registerCommand(ge, (t) => {
|
|
68
|
+
const e = i();
|
|
69
|
+
if (!l(e)) return !1;
|
|
70
|
+
if (t !== null) {
|
|
71
|
+
if ((I || Ke || Pe) && Be) return !1;
|
|
72
|
+
t.preventDefault();
|
|
73
|
+
}
|
|
74
|
+
return n.dispatchCommand(M, !1);
|
|
75
|
+
}, c), n.registerCommand(me, () => (fe(), !0), c), n.registerCommand(de, (t) => {
|
|
76
|
+
const e = i();
|
|
77
|
+
return !!l(e) && (U(t, n), !0);
|
|
78
|
+
}, c), n.registerCommand(ce, (t) => {
|
|
79
|
+
const e = i();
|
|
80
|
+
return !!l(e) && (function(s, a) {
|
|
81
|
+
U(s, a), a.update(() => {
|
|
82
|
+
const o = i();
|
|
83
|
+
l(o) && o.removeText();
|
|
84
|
+
});
|
|
85
|
+
}(t, n), !0);
|
|
86
|
+
}, c), n.registerCommand(ue, (t) => {
|
|
87
|
+
const e = i();
|
|
88
|
+
return !!l(e) && (function(s, a) {
|
|
89
|
+
s.preventDefault(), a.update(() => {
|
|
90
|
+
const o = i(), { clipboardData: d } = s;
|
|
91
|
+
d != null && l(o) && P(d, o);
|
|
92
|
+
}, { tag: "paste" });
|
|
93
|
+
}(t, n), !0);
|
|
94
|
+
}, c), n.registerCommand(le, (t) => {
|
|
95
|
+
const e = i();
|
|
96
|
+
return !!l(e) && (t.preventDefault(), !0);
|
|
97
|
+
}, c), n.registerCommand(ie, (t) => {
|
|
98
|
+
const e = i();
|
|
99
|
+
return !!l(e) && (t.preventDefault(), !0);
|
|
100
|
+
}, c));
|
|
101
|
+
}
|
|
102
|
+
const N = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? $ : b;
|
|
103
|
+
function W(n) {
|
|
104
|
+
return n.getEditorState().read(ke(n.isComposing()));
|
|
105
|
+
}
|
|
106
|
+
function ze({ contentEditable: n, placeholder: t = null, ErrorBoundary: e }) {
|
|
107
|
+
const [s] = X(), a = function(o, d) {
|
|
108
|
+
const [f, y] = j(() => o.getDecorators());
|
|
109
|
+
return N(() => o.registerDecoratorListener((C) => {
|
|
110
|
+
_e(() => {
|
|
111
|
+
y(C);
|
|
112
|
+
});
|
|
113
|
+
}), [o]), b(() => {
|
|
114
|
+
y(o.getDecorators());
|
|
115
|
+
}, [o]), G(() => {
|
|
116
|
+
const C = [], E = Object.keys(f);
|
|
117
|
+
for (let D = 0; D < E.length; D++) {
|
|
118
|
+
const L = E[D], R = g(d, { onError: (u) => o._onError(u), children: g(H, { fallback: null, children: f[L] }) }), r = o.getElementByKey(L);
|
|
119
|
+
r !== null && C.push(Ne(R, r, L));
|
|
120
|
+
}
|
|
121
|
+
return C;
|
|
122
|
+
}, [d, f, o]);
|
|
123
|
+
}(s, e);
|
|
124
|
+
return function(o) {
|
|
125
|
+
N(() => B(Me(o), ae(o)), [o]);
|
|
126
|
+
}(s), _(F, { children: [n, g(Ye, { content: t }), a] });
|
|
127
|
+
}
|
|
128
|
+
function Ye({ content: n }) {
|
|
129
|
+
const [t] = X(), e = function(a) {
|
|
130
|
+
const [o, d] = j(() => W(a));
|
|
131
|
+
return N(() => {
|
|
132
|
+
function f() {
|
|
133
|
+
const y = W(a);
|
|
134
|
+
d(y);
|
|
135
|
+
}
|
|
136
|
+
return f(), B(a.registerUpdateListener(() => {
|
|
137
|
+
f();
|
|
138
|
+
}), a.registerEditableListener(() => {
|
|
139
|
+
f();
|
|
140
|
+
}));
|
|
141
|
+
}, [a]), o;
|
|
142
|
+
}(t), s = be();
|
|
143
|
+
return e ? typeof n == "function" ? n(s) : n : null;
|
|
144
|
+
}
|
|
145
|
+
const Ie = new URL(window.location.href);
|
|
146
|
+
new URLSearchParams(Ie.search);
|
|
147
|
+
const Ue = "https://wss.dudoc.io";
|
|
148
|
+
function We(n, t) {
|
|
149
|
+
let e = t.get(n);
|
|
150
|
+
return e === void 0 ? (e = new se(), t.set(n, e)) : e.load(), new oe(Ue, "/" + n, e, {
|
|
151
|
+
connect: !1
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
const $e = re ? $ : b, je = {
|
|
155
|
+
...Z,
|
|
156
|
+
paragraph: "StickyEditorTheme__paragraph"
|
|
157
|
+
};
|
|
158
|
+
function x(n, t) {
|
|
159
|
+
const e = n.style, s = t.rootElementRect, a = s !== null ? s.left : 0, o = s !== null ? s.top : 0;
|
|
160
|
+
e.top = o + t.y + "px", e.left = a + t.x + "px";
|
|
161
|
+
}
|
|
162
|
+
function Qe({
|
|
163
|
+
x: n,
|
|
164
|
+
y: t,
|
|
165
|
+
nodeKey: e,
|
|
166
|
+
color: s,
|
|
167
|
+
caption: a
|
|
168
|
+
}) {
|
|
169
|
+
const [o] = X(), d = A(null), f = A({
|
|
170
|
+
isDragging: !1,
|
|
171
|
+
offsetX: 0,
|
|
172
|
+
offsetY: 0,
|
|
173
|
+
rootElementRect: null,
|
|
174
|
+
x: 0,
|
|
175
|
+
y: 0
|
|
176
|
+
}), { isCollabActive: y } = Q();
|
|
177
|
+
b(() => {
|
|
178
|
+
const r = f.current;
|
|
179
|
+
r.x = n, r.y = t;
|
|
180
|
+
const u = d.current;
|
|
181
|
+
u !== null && x(u, r);
|
|
182
|
+
}, [n, t]), $e(() => {
|
|
183
|
+
const r = f.current, u = new ResizeObserver((h) => {
|
|
184
|
+
for (let p = 0; p < h.length; p++) {
|
|
185
|
+
const O = h[p], { target: q } = O;
|
|
186
|
+
r.rootElementRect = q.getBoundingClientRect();
|
|
187
|
+
const K = d.current;
|
|
188
|
+
K !== null && x(K, r);
|
|
189
|
+
}
|
|
190
|
+
}), m = o.registerRootListener(
|
|
191
|
+
(h, p) => {
|
|
192
|
+
p !== null && u.unobserve(p), h !== null && u.observe(h);
|
|
193
|
+
}
|
|
194
|
+
), v = () => {
|
|
195
|
+
const h = o.getRootElement(), p = d.current;
|
|
196
|
+
h !== null && p !== null && (r.rootElementRect = h.getBoundingClientRect(), x(p, r));
|
|
197
|
+
};
|
|
198
|
+
return window.addEventListener("resize", v), () => {
|
|
199
|
+
window.removeEventListener("resize", v), m();
|
|
200
|
+
};
|
|
201
|
+
}, [o]), b(() => {
|
|
202
|
+
const r = d.current;
|
|
203
|
+
r !== null && setTimeout(() => {
|
|
204
|
+
r.style.setProperty(
|
|
205
|
+
"transition",
|
|
206
|
+
"top 0.3s ease 0s, left 0.3s ease 0s"
|
|
207
|
+
);
|
|
208
|
+
}, 500);
|
|
209
|
+
}, []);
|
|
210
|
+
const C = (r) => {
|
|
211
|
+
const u = d.current, m = f.current, v = m.rootElementRect;
|
|
212
|
+
u !== null && m.isDragging && v !== null && (m.x = r.pageX - m.offsetX - v.left, m.y = r.pageY - m.offsetY - v.top, x(u, m));
|
|
213
|
+
}, E = () => {
|
|
214
|
+
const r = d.current, u = f.current;
|
|
215
|
+
r !== null && (u.isDragging = !1, r.classList.remove("dragging"), o.update(() => {
|
|
216
|
+
const m = k(e);
|
|
217
|
+
S(m) && m.setPosition(u.x, u.y);
|
|
218
|
+
})), document.removeEventListener("pointermove", C), document.removeEventListener("pointerup", E);
|
|
219
|
+
}, D = () => {
|
|
220
|
+
o.update(() => {
|
|
221
|
+
const r = k(e);
|
|
222
|
+
S(r) && r.remove();
|
|
223
|
+
});
|
|
224
|
+
}, L = () => {
|
|
225
|
+
o.update(() => {
|
|
226
|
+
const r = k(e);
|
|
227
|
+
S(r) && r.toggleColor();
|
|
228
|
+
});
|
|
229
|
+
}, { historyState: R } = V();
|
|
230
|
+
return /* @__PURE__ */ g("div", { ref: d, className: "sticky-note-container", children: /* @__PURE__ */ _(
|
|
231
|
+
"div",
|
|
232
|
+
{
|
|
233
|
+
className: `sticky-note ${s}`,
|
|
234
|
+
onPointerDown: (r) => {
|
|
235
|
+
const u = d.current;
|
|
236
|
+
if (u == null || r.button === 2 || r.target !== u.firstChild)
|
|
237
|
+
return;
|
|
238
|
+
const m = u, v = f.current;
|
|
239
|
+
if (m !== null) {
|
|
240
|
+
const { top: h, left: p } = m.getBoundingClientRect();
|
|
241
|
+
v.offsetX = r.clientX - p, v.offsetY = r.clientY - h, v.isDragging = !0, m.classList.add("dragging"), document.addEventListener("pointermove", C), document.addEventListener("pointerup", E), r.preventDefault();
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
children: [
|
|
245
|
+
/* @__PURE__ */ g(
|
|
246
|
+
"button",
|
|
247
|
+
{
|
|
248
|
+
onClick: D,
|
|
249
|
+
className: "delete",
|
|
250
|
+
"aria-label": "Delete sticky note",
|
|
251
|
+
title: "Delete",
|
|
252
|
+
children: "X"
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
/* @__PURE__ */ g(
|
|
256
|
+
"button",
|
|
257
|
+
{
|
|
258
|
+
onClick: L,
|
|
259
|
+
className: "color",
|
|
260
|
+
"aria-label": "Change sticky note color",
|
|
261
|
+
title: "Color",
|
|
262
|
+
children: /* @__PURE__ */ g("i", { className: "bucket" })
|
|
263
|
+
}
|
|
264
|
+
),
|
|
265
|
+
/* @__PURE__ */ _(Se, { initialEditor: a, initialTheme: je, children: [
|
|
266
|
+
y ? /* @__PURE__ */ g(
|
|
267
|
+
J,
|
|
268
|
+
{
|
|
269
|
+
id: a.getKey(),
|
|
270
|
+
providerFactory: We,
|
|
271
|
+
shouldBootstrap: !0
|
|
272
|
+
}
|
|
273
|
+
) : /* @__PURE__ */ g(ee, { externalHistoryState: R }),
|
|
274
|
+
/* @__PURE__ */ g(
|
|
275
|
+
ze,
|
|
276
|
+
{
|
|
277
|
+
contentEditable: /* @__PURE__ */ g(ne, { className: "StickyNode__contentEditable" }),
|
|
278
|
+
placeholder: /* @__PURE__ */ g(Te, { className: "StickyNode__placeholder", children: "What's up?" }),
|
|
279
|
+
ErrorBoundary: te
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
] })
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
) });
|
|
286
|
+
}
|
|
287
|
+
export {
|
|
288
|
+
Qe as default
|
|
289
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layers-app/shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"react-helmet": "^6.1.0",
|
|
47
47
|
"react-i18next": "^15.0.2",
|
|
48
48
|
"react-joyride": "^2.8.2",
|
|
49
|
-
"react-router-dom": "
|
|
49
|
+
"react-router-dom": "^7.5.2",
|
|
50
50
|
"zustand": "^4.5.4"
|
|
51
51
|
}
|
|
52
52
|
}
|