@layers-app/shared 0.0.26 → 0.0.27

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 (24) hide show
  1. package/dist/index.d.ts +1 -2
  2. package/dist/index.js +46106 -99
  3. package/dist/index.umd.cjs +80 -269
  4. package/package.json +1 -1
  5. package/dist/components/CommentComposer/index.d.ts +0 -52
  6. package/dist/components/CommentsPanel/components/CommentActions.d.ts +0 -16
  7. package/dist/components/CommentsPanel/components/CommentFilterMenu.d.ts +0 -7
  8. package/dist/components/CommentsPanel/components/CommentPanelListItem.d.ts +0 -22
  9. package/dist/components/CommentsPanel/components/CommentsEmptyPlaceholder.d.ts +0 -3
  10. package/dist/components/CommentsPanel/components/CommentsFilterHeader.d.ts +0 -3
  11. package/dist/components/CommentsPanel/components/CommentsListItemMenu.d.ts +0 -6
  12. package/dist/components/CommentsPanel/components/CommentsMultiSelectUsers.d.ts +0 -6
  13. package/dist/components/CommentsPanel/components/CommentsPanelList.d.ts +0 -19
  14. package/dist/components/CommentsPanel/components/CommentsThreadReplyControls.d.ts +0 -10
  15. package/dist/components/CommentsPanel/components/CommentsUploadFilesPreview.d.ts +0 -5
  16. package/dist/components/CommentsPanel/components/Icon.d.ts +0 -8
  17. package/dist/components/CommentsPanel/components/RemoveConfirmModal.d.ts +0 -11
  18. package/dist/components/CommentsPanel/index.d.ts +0 -21
  19. package/dist/components/CommentsPanel/store.d.ts +0 -19
  20. package/dist/components/CommentsPanel/types.d.ts +0 -243
  21. package/dist/components/CommentsPanel/utils.d.ts +0 -8
  22. package/dist/index-Vul891jq.js +0 -68330
  23. package/dist/layers.Cv0RBArs-D32HURxV.js +0 -343
  24. package/dist/layers.DRxNz4Ly-Cp9JbXSH.js +0 -281
@@ -1,343 +0,0 @@
1
- import { jsxs as g, Fragment as A, jsx as n } from "react/jsx-runtime";
2
- import { useState as I, useRef as T, useCallback as S, useEffect as K, Suspense as F, useContext as U, useMemo as W } from "react";
3
- import { f as B, b as q, p as G, d as V, T as D, M, t as Y, j as P, L as z, N as H, h as _, c as J, g as Q, q as X, G as Z, V as ee, i as te, A as ae, o as ne, l as le, m as re, r as ie, s as j, Y as oe, e as se } from "./index-Vul891jq.js";
4
- import { TextInput as ce, Button as de } from "@mantine/core";
5
- function ue(e) {
6
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
7
- }
8
- var pe = ue(function(e) {
9
- const t = new URLSearchParams();
10
- t.append("code", e);
11
- for (let a = 1; a < arguments.length; a++) t.append("v", arguments[a]);
12
- throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
13
- });
14
- function R(e) {
15
- const t = e.transform();
16
- return t !== null ? /* @__PURE__ */ new Set([t]) : /* @__PURE__ */ new Set();
17
- }
18
- function he({ initialEditor: e, children: t, initialNodes: a, initialTheme: r, skipCollabChecks: d }) {
19
- const s = T(!1), i = U(j);
20
- i == null && pe(9);
21
- const [h, { getTheme: w }] = i, N = W(() => {
22
- const o = r || w() || void 0, E = oe(i, o);
23
- if (o !== void 0 && (e._config.theme = o), e._parentEditor = h, a) for (let l of a) {
24
- let x = null, m = null;
25
- if (typeof l != "function") {
26
- const C = l;
27
- l = C.replace, x = C.with, m = C.withKlass || null;
28
- }
29
- const y = e._nodes.get(l.getType());
30
- e._nodes.set(l.getType(), { exportDOM: y ? y.exportDOM : void 0, klass: l, replace: x, replaceWithKlass: m, transforms: R(l) });
31
- }
32
- else {
33
- const l = e._nodes = new Map(h._nodes);
34
- for (const [x, m] of l) e._nodes.set(x, { exportDOM: m.exportDOM, klass: m.klass, replace: m.replace, replaceWithKlass: m.replaceWithKlass, transforms: R(m.klass) });
35
- }
36
- return e._config.namespace = h._config.namespace, e._editable = h._editable, [e, E];
37
- }, []), { isCollabActive: v, yjsDocMap: b } = se(), c = d || s.current || b.has(e.getKey());
38
- return K(() => {
39
- c && (s.current = !0);
40
- }, [c]), K(() => h.registerEditableListener((o) => {
41
- e.setEditable(o);
42
- }), [e, h]), n(j.Provider, { value: N, children: !v || c ? t : null });
43
- }
44
- function me({
45
- "data-test-id": e,
46
- children: t,
47
- className: a,
48
- onClick: r,
49
- disabled: d,
50
- small: s,
51
- title: i
52
- }) {
53
- return /* @__PURE__ */ n(de, { onClick: r, disabled: d, variant: "filled", children: t });
54
- }
55
- function fe({
56
- children: e,
57
- className: t
58
- }) {
59
- return /* @__PURE__ */ n("div", { className: t || "Placeholder__root", children: e });
60
- }
61
- function ge({
62
- children: e,
63
- label: t,
64
- className: a,
65
- ...r
66
- }) {
67
- return /* @__PURE__ */ g("div", { className: "Input__wrapper", children: [
68
- /* @__PURE__ */ n("label", { style: { marginTop: "-1em" }, className: "Input__label", children: t }),
69
- /* @__PURE__ */ n("select", { ...r, className: a || "select", children: e })
70
- ] });
71
- }
72
- function ve({
73
- label: e,
74
- value: t,
75
- onChange: a,
76
- placeholder: r = "",
77
- "data-test-id": d,
78
- type: s = "text"
79
- }) {
80
- return /* @__PURE__ */ n(
81
- ce,
82
- {
83
- type: s,
84
- placeholder: r,
85
- value: t,
86
- onChange: (i) => {
87
- a(i.target.value);
88
- },
89
- label: e,
90
- "data-test-id": d,
91
- mb: 10
92
- }
93
- );
94
- }
95
- const $ = /* @__PURE__ */ new Set();
96
- function be(e) {
97
- if (!$.has(e))
98
- throw new Promise((t) => {
99
- const a = new Image();
100
- a.src = e, a.onload = () => {
101
- $.add(e), t(null);
102
- };
103
- });
104
- }
105
- function Ce({
106
- altText: e,
107
- className: t,
108
- imageRef: a,
109
- src: r,
110
- width: d,
111
- height: s,
112
- position: i
113
- }) {
114
- return be(r), /* @__PURE__ */ n(
115
- "img",
116
- {
117
- className: t || void 0,
118
- src: r,
119
- alt: e,
120
- ref: a,
121
- "data-position": i,
122
- style: {
123
- display: "block",
124
- height: s,
125
- width: d
126
- },
127
- draggable: "false"
128
- }
129
- );
130
- }
131
- function _e({
132
- activeEditor: e,
133
- nodeKey: t,
134
- onClose: a
135
- }) {
136
- const r = e.getEditorState().read(
137
- () => B(t)
138
- ), [d, s] = I(r.getAltText()), [i, h] = I(r.getShowCaption()), [w, N] = I(r.getPosition()), v = (o) => {
139
- h(o.target.checked);
140
- }, b = (o) => {
141
- N(o.target.value);
142
- }, c = () => {
143
- const o = { altText: d, position: w, showCaption: i };
144
- r && e.update(() => {
145
- r.update(o);
146
- }), a();
147
- };
148
- return /* @__PURE__ */ g(A, { children: [
149
- /* @__PURE__ */ n("div", { style: { marginBottom: "1em" }, children: /* @__PURE__ */ n(
150
- ve,
151
- {
152
- label: "Alt-текст",
153
- placeholder: "Альтернативный текст",
154
- onChange: s,
155
- value: d,
156
- "data-test-id": "image-modal-alt-text-input"
157
- }
158
- ) }),
159
- /* @__PURE__ */ g(
160
- ge,
161
- {
162
- style: { marginBottom: "1em", width: "208px" },
163
- value: w,
164
- label: "Position",
165
- name: "position",
166
- id: "position-select",
167
- onChange: b,
168
- children: [
169
- /* @__PURE__ */ n("option", { value: "left", children: "Left" }),
170
- /* @__PURE__ */ n("option", { value: "right", children: "Right" }),
171
- /* @__PURE__ */ n("option", { value: "full", children: "Full Width" })
172
- ]
173
- }
174
- ),
175
- /* @__PURE__ */ g("div", { className: "Input__wrapper", children: [
176
- /* @__PURE__ */ n(
177
- "input",
178
- {
179
- id: "caption",
180
- type: "checkbox",
181
- checked: i,
182
- onChange: v
183
- }
184
- ),
185
- /* @__PURE__ */ n("label", { htmlFor: "caption", children: "Show Caption" })
186
- ] }),
187
- /* @__PURE__ */ n(
188
- me,
189
- {
190
- "data-test-id": "image-modal-file-upload-btn",
191
- onClick: () => c(),
192
- children: "Применить"
193
- }
194
- )
195
- ] });
196
- }
197
- function Ee({
198
- src: e,
199
- altText: t,
200
- nodeKey: a,
201
- width: r,
202
- height: d,
203
- showCaption: s,
204
- caption: i,
205
- position: h
206
- }) {
207
- const [w, N] = q(), v = T(null), b = T(null), [c, o, E] = G(a), [l] = V(), [x, m] = I(null), y = T(null), C = S(
208
- (u) => {
209
- if (c && D(M())) {
210
- u.preventDefault();
211
- const f = B(a);
212
- Y(f) && f.remove();
213
- }
214
- return !1;
215
- },
216
- [c, a]
217
- ), L = S(
218
- (u) => {
219
- const f = M(), p = b.current;
220
- if (c && D(f) && f.getNodes().length === 1) {
221
- if (s)
222
- return P(null), u.preventDefault(), i.focus(), !0;
223
- if (p !== null && p !== document.activeElement)
224
- return u.preventDefault(), p.focus(), !0;
225
- }
226
- return !1;
227
- },
228
- [i, c, s]
229
- ), O = S(
230
- (u) => y.current === i || b.current === u.target ? (P(null), l.update(() => {
231
- o(!0);
232
- const f = l.getRootElement();
233
- f !== null && f.focus();
234
- }), !0) : !1,
235
- [i, l, o]
236
- );
237
- return K(() => {
238
- let u = !0;
239
- const f = z(
240
- l.registerUpdateListener(({ editorState: p }) => {
241
- u && m(p.read(() => M()));
242
- }),
243
- l.registerCommand(
244
- te,
245
- (p, k) => (y.current = k, !1),
246
- _
247
- ),
248
- l.registerCommand(
249
- ee,
250
- (p) => {
251
- const k = p;
252
- return k.target === v.current ? (k.shiftKey ? o(!c) : (E(), o(!0)), !0) : !1;
253
- },
254
- _
255
- ),
256
- l.registerCommand(
257
- Z,
258
- (p) => p.target === v.current ? (p.preventDefault(), !0) : !1,
259
- _
260
- ),
261
- l.registerCommand(
262
- X,
263
- C,
264
- _
265
- ),
266
- l.registerCommand(
267
- Q,
268
- C,
269
- _
270
- ),
271
- l.registerCommand(J, L, _),
272
- l.registerCommand(
273
- H,
274
- O,
275
- _
276
- )
277
- );
278
- return () => {
279
- u = !1, f();
280
- };
281
- }, [
282
- E,
283
- l,
284
- c,
285
- a,
286
- C,
287
- L,
288
- O,
289
- o
290
- ]), /* @__PURE__ */ g(F, { fallback: null, children: [
291
- /* @__PURE__ */ g(A, { children: [
292
- /* @__PURE__ */ g("div", { draggable: !1, children: [
293
- /* @__PURE__ */ n(
294
- "button",
295
- {
296
- className: "image-edit-button",
297
- ref: b,
298
- onClick: () => {
299
- N("Update Inline Image", (u) => /* @__PURE__ */ n(
300
- _e,
301
- {
302
- activeEditor: l,
303
- nodeKey: a,
304
- onClose: u
305
- }
306
- ));
307
- },
308
- children: "Edit"
309
- }
310
- ),
311
- /* @__PURE__ */ n(
312
- Ce,
313
- {
314
- className: c ? `focused ${D(x) ? "draggable" : ""}` : null,
315
- src: e,
316
- altText: t,
317
- imageRef: v,
318
- width: r,
319
- height: d,
320
- position: h
321
- }
322
- )
323
- ] }),
324
- s && /* @__PURE__ */ n("div", { className: "image-caption-container", children: /* @__PURE__ */ g(he, { initialEditor: i, children: [
325
- /* @__PURE__ */ n(ae, {}),
326
- /* @__PURE__ */ n(ne, {}),
327
- /* @__PURE__ */ n(
328
- le,
329
- {
330
- contentEditable: /* @__PURE__ */ n(ie, { className: "InlineImageNode__contentEditable" }),
331
- placeholder: /* @__PURE__ */ n(fe, { className: "InlineImageNode__placeholder", children: "Enter a caption..." }),
332
- ErrorBoundary: re
333
- }
334
- )
335
- ] }) })
336
- ] }),
337
- w
338
- ] });
339
- }
340
- export {
341
- _e as UpdateInlineImageDialog,
342
- Ee as default
343
- };
@@ -1,281 +0,0 @@
1
- import { jsx as o, jsxs as $ } from "react/jsx-runtime";
2
- import { useRef as B, useState as w, useContext as q, useEffect as x } from "react";
3
- import { useTranslation as G } from "react-i18next";
4
- import { e as J, d as Q, n as X, u as Y, O as M, f as C, E, _ as ee, k as te, a as ie, H as oe, Z as ae, j as re } from "./index-Vul891jq.js";
5
- import { LoadingOverlay as L, Flex as se, Alert as ne } from "@mantine/core";
6
- import { IconInfoCircle as he } from "@tabler/icons-react";
7
- const D = (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: v,
17
- maxWidth: y
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
- L,
32
- {
33
- visible: s,
34
- zIndex: 1e3,
35
- overlayProps: { backgroundOpacity: 0.5 },
36
- loaderProps: { size: 24, color: "black" }
37
- }
38
- ),
39
- /* @__PURE__ */ o(
40
- L,
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: v,
66
- width: "inherit",
67
- height: "inherit",
68
- maxWidth: y || "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 ue({
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: v,
113
- create: y,
114
- alignment: K
115
- }) {
116
- const k = B(null), [A, W] = w(!0), [O, U] = w(!1), { isCollabActive: P } = J(), [l] = Q(), [f, b] = w(!0), [n, T] = w({
117
- width: 0,
118
- height: 0
119
- }), { fetchUploadImage: S, fetchDeleteImage: j } = q(X), { t: N } = G();
120
- x(() => {
121
- if (!t || t.startsWith("data:image/")) {
122
- W(!1);
123
- return;
124
- }
125
- const e = new Image();
126
- e.src = t, e.onload = () => W(!1), e.onerror = () => {
127
- W(!1), U(!0);
128
- };
129
- }, [t]);
130
- const V = (e, a) => {
131
- l.update(() => {
132
- re(null);
133
- const h = C(r);
134
- E(h) && h.setWidthAndHeight(e, a);
135
- });
136
- }, { historyState: H } = Y(), {
137
- settings: { showNestedEditorTreeView: z }
138
- } = M(), [I, u] = w(!1);
139
- function _(e) {
140
- return e.endsWith(".svg") || e.includes("image/svg+xml");
141
- }
142
- function Z(e) {
143
- return new Promise((a, h) => {
144
- if (_(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
- y && u(!0);
158
- }, [y]), x(() => {
159
- let e = s, a = d, h = 100;
160
- t && Z(t).then((i) => {
161
- typeof e == "number" && e < h && i < h ? (b(!0), T({
162
- width: e,
163
- height: a
164
- })) : i < h ? (b(!0), T({
165
- width: "auto",
166
- height: "auto"
167
- })) : (T({
168
- width: i,
169
- height: i
170
- }), b(!1));
171
- });
172
- }, [t]), x(() => {
173
- n.width && n.height && f && l.update(() => {
174
- const e = C(r);
175
- E(e) && e.setWidthAndHeight(n.width, n.height);
176
- });
177
- }, [n.width, n.height, f]), x(() => {
178
- const e = document.documentElement;
179
- ee(I, e);
180
- }, [I]), t ? f ? /* @__PURE__ */ o(
181
- D,
182
- {
183
- width: n.width,
184
- height: n.height,
185
- isLoading: A,
186
- isError: O,
187
- isIcon: f,
188
- src: t,
189
- id: v,
190
- editor: l,
191
- nodeKey: r,
192
- fetchDeleteImage: j,
193
- altText: c,
194
- imageRef: k,
195
- maxWidth: g,
196
- showCaption: m,
197
- caption: p,
198
- isCollabActive: P,
199
- historyState: H,
200
- showNestedEditorTreeView: z,
201
- t: N
202
- }
203
- ) : /* @__PURE__ */ o(
204
- te,
205
- {
206
- editor: l,
207
- isIcon: f,
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: V,
213
- alignment: K,
214
- children: /* @__PURE__ */ o(
215
- D,
216
- {
217
- width: "inherit",
218
- height: "inherit",
219
- isLoading: A,
220
- isError: O,
221
- isIcon: f,
222
- src: t,
223
- id: v,
224
- editor: l,
225
- nodeKey: r,
226
- fetchDeleteImage: j,
227
- altText: c,
228
- imageRef: k,
229
- maxWidth: g,
230
- showCaption: m,
231
- caption: p,
232
- isCollabActive: P,
233
- historyState: H,
234
- showNestedEditorTreeView: z,
235
- t: N
236
- }
237
- )
238
- }
239
- ) : /* @__PURE__ */ o(
240
- ie,
241
- {
242
- uploading: !1,
243
- onUpload: (e) => {
244
- !S || !e.length || (e.forEach((a, h) => {
245
- S(a, (i, F) => {
246
- h === 0 ? l.update(() => {
247
- const R = C(r);
248
- E(R) && (R.setSrc(i), R.setId(F));
249
- }) : l.dispatchCommand(ae, {
250
- altText: "",
251
- src: i,
252
- id: F
253
- });
254
- });
255
- }), u(!1));
256
- },
257
- popoverProps: {
258
- opened: I,
259
- position: "bottom",
260
- onChange: u
261
- },
262
- onChange: (e) => {
263
- u(!1), l.update(() => {
264
- const a = C(r);
265
- E(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: () => u(!I)
274
- }
275
- )
276
- }
277
- );
278
- }
279
- export {
280
- ue as default
281
- };