@layers-app/editor 0.5.10-optimization → 0.6.0-specific.2

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 (44) hide show
  1. package/README.md +2 -252
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.d.ts +3 -4
  4. package/dist/index.js +11 -12
  5. package/dist/layers.BAh77n3h.js +53500 -0
  6. package/dist/layers.BR_PAAvW.js +319 -0
  7. package/dist/layers.BVrvmVeX.js +343 -0
  8. package/dist/layers.BeZDS7Yo.js +1 -0
  9. package/dist/layers.C9DRKDGJ.js +1 -0
  10. package/dist/layers.Dawun4Ev.js +44715 -0
  11. package/dist/layers.DwBS80Kn.js +285 -0
  12. package/dist/layers.Zo4c9OM_.js +161 -0
  13. package/package.json +23 -66
  14. package/dist/ExcalidrawComponent-D7Z_2awF.cjs +0 -1
  15. package/dist/ExcalidrawComponent-Re4zFgLg.js +0 -283
  16. package/dist/InlineImageComponent-DHgCaPNk.cjs +0 -1
  17. package/dist/InlineImageComponent-kXhZcmF6.js +0 -265
  18. package/dist/collaboration-C7xVk0Zj.cjs +0 -4
  19. package/dist/collaboration-Cn7KizEJ.js +0 -5997
  20. package/dist/excalidraw-C-6bid_P.js +0 -16497
  21. package/dist/excalidraw-DpwKTNBz.cjs +0 -574
  22. package/dist/index-B4yOqKUQ.cjs +0 -1
  23. package/dist/index-BZu8Qnrg.cjs +0 -1
  24. package/dist/index-CFA9Drk2.cjs +0 -16
  25. package/dist/index-CX5msaMB.js +0 -296
  26. package/dist/index-CbQX0N2c.js +0 -136
  27. package/dist/index-DEC5JR_F.js +0 -60
  28. package/dist/index-Dan3tqoj.cjs +0 -1
  29. package/dist/index-WCOc4LNL.js +0 -16600
  30. package/dist/lexical-2rxs76dr.cjs +0 -41
  31. package/dist/lexical-C60GkwxR.js +0 -13122
  32. package/dist/lexical-code-DKIWiZdJ.js +0 -604
  33. package/dist/lexical-code-VafvPacU.cjs +0 -9
  34. package/dist/lexical-collab-1tX9tFVC.js +0 -1025
  35. package/dist/lexical-collab-Nk2LVpJv.cjs +0 -1
  36. package/dist/lexical-file-C52Mze5k.cjs +0 -1
  37. package/dist/lexical-file-DjHP4vVw.js +0 -43
  38. package/dist/lexical-markdown-BSl_ahWw.cjs +0 -12
  39. package/dist/lexical-markdown-DcEwQQba.js +0 -488
  40. package/dist/lodash-3PEMjFQT.cjs +0 -1
  41. package/dist/lodash-jftOdrxX.js +0 -711
  42. package/dist/stats.html +0 -4949
  43. package/dist/vendor-BrXDSyZX.js +0 -136433
  44. package/dist/vendor-Bt6Lma3y.cjs +0 -2469
@@ -0,0 +1,319 @@
1
+ import { jsx as n, jsxs as w, Fragment as U } from "react/jsx-runtime";
2
+ import { useRef as M, useContext as W, useMemo as K, useEffect as $, useState as L, useCallback as y, Suspense as q } from "react";
3
+ import { r as A, e as z, l as G, f as H, g as J, o as Q, h as P, N as R, b as j, i as V, d as B, j as X, O as Y, I, k as Z, A as ee, D as te, B as ne, n as ae, q as oe, L as re, F as se, s as le, v as ie, w as ce } from "./layers.Dawun4Ev.js";
4
+ import { Button as de, TextInput as ue } from "@mantine/core";
5
+ function F(e) {
6
+ const a = e.transform();
7
+ return new Set(a ? [a] : []);
8
+ }
9
+ function me({ initialEditor: e, children: a, initialNodes: o, initialTheme: f, skipCollabChecks: r, skipEditableListener: l }) {
10
+ const s = M(!1), E = W(A);
11
+ E == null && (function(m, ...t) {
12
+ const v = new URL("https://lexical.dev/docs/error"), b = new URLSearchParams();
13
+ b.append("code", m);
14
+ for (const i of t) b.append("v", i);
15
+ throw v.search = b.toString(), Error(`Minified Lexical error #${m}; visit ${v.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
16
+ })(9);
17
+ const [u, { getTheme: k }] = E, S = K((() => {
18
+ const m = f || k() || void 0, t = z(E, m);
19
+ m !== void 0 && (e._config.theme = m), e._parentEditor = e._parentEditor || u;
20
+ const v = e._createEditorArgs, b = v && v.namespace;
21
+ if (o) {
22
+ b || (e._config.namespace = u._config.namespace);
23
+ for (let i of o) {
24
+ let C = null, g = null;
25
+ if (typeof i != "function") {
26
+ const D = i;
27
+ i = D.replace, C = D.with, g = D.withKlass || null;
28
+ }
29
+ const N = e._nodes.get(i.getType());
30
+ e._nodes.set(i.getType(), { exportDOM: N ? N.exportDOM : void 0, klass: i, replace: C, replaceWithKlass: g, transforms: F(i) });
31
+ }
32
+ } else if (v && v.nodes) b || (e._config.namespace = u._config.namespace);
33
+ else {
34
+ const i = e._nodes = new Map(u._nodes);
35
+ b || (e._config.namespace = u._config.namespace);
36
+ for (const [C, g] of i) e._nodes.set(C, { exportDOM: g.exportDOM, klass: g.klass, replace: g.replace, replaceWithKlass: g.replaceWithKlass, transforms: F(g.klass) });
37
+ }
38
+ return [e, t];
39
+ }), []), { isCollabActive: x, yjsDocMap: p } = G(), d = r || s.current || p.has(e.getKey());
40
+ return $((() => {
41
+ d && (s.current = !0);
42
+ }), [d]), $((() => {
43
+ if (!l) {
44
+ const m = (t) => e.setEditable(t);
45
+ return m(u.isEditable()), u.registerEditableListener(m);
46
+ }
47
+ }), [e, u, l]), n(A.Provider, { value: S, children: !x || d ? a : null });
48
+ }
49
+ function fe({
50
+ "data-test-id": e,
51
+ children: a,
52
+ className: o,
53
+ onClick: f,
54
+ disabled: r,
55
+ small: l,
56
+ title: s
57
+ }) {
58
+ return /* @__PURE__ */ n(de, { onClick: f, disabled: r, variant: "filled", children: a });
59
+ }
60
+ function pe({
61
+ children: e,
62
+ className: a
63
+ }) {
64
+ return /* @__PURE__ */ n("div", { className: a || "Placeholder__root", children: e });
65
+ }
66
+ function ge({
67
+ label: e,
68
+ value: a,
69
+ onChange: o,
70
+ placeholder: f = "",
71
+ "data-test-id": r,
72
+ type: l = "text"
73
+ }) {
74
+ return /* @__PURE__ */ n(
75
+ ue,
76
+ {
77
+ type: l,
78
+ placeholder: f,
79
+ value: a,
80
+ onChange: (s) => {
81
+ o(s.target.value);
82
+ },
83
+ label: e,
84
+ "data-test-id": r,
85
+ mb: 10
86
+ }
87
+ );
88
+ }
89
+ const O = /* @__PURE__ */ new Set();
90
+ function he(e) {
91
+ if (!O.has(e))
92
+ throw new Promise((a) => {
93
+ const o = new Image();
94
+ o.src = e, o.onload = () => {
95
+ O.add(e), a(null);
96
+ };
97
+ });
98
+ }
99
+ function ve({
100
+ altText: e,
101
+ className: a,
102
+ imageRef: o,
103
+ src: f,
104
+ width: r,
105
+ height: l,
106
+ position: s
107
+ }) {
108
+ return he(f), /* @__PURE__ */ n(
109
+ "img",
110
+ {
111
+ className: a || void 0,
112
+ src: f,
113
+ alt: e,
114
+ ref: o,
115
+ "data-position": s,
116
+ style: {
117
+ display: "block",
118
+ height: l,
119
+ width: r
120
+ },
121
+ draggable: "false"
122
+ }
123
+ );
124
+ }
125
+ function be({
126
+ activeEditor: e,
127
+ nodeKey: a,
128
+ onClose: o
129
+ }) {
130
+ const r = e.getEditorState().read(
131
+ () => j(a)
132
+ ), [l, s] = L(r.getAltText()), [E, u] = L(r.getShowCaption()), [k, S] = L(r.getPosition()), x = (d) => {
133
+ u(d.target.checked);
134
+ }, p = () => {
135
+ const d = { altText: l, position: k, showCaption: E };
136
+ r && e.update(() => {
137
+ r.update(d);
138
+ }), o();
139
+ };
140
+ return /* @__PURE__ */ w(U, { children: [
141
+ /* @__PURE__ */ n("div", { style: { marginBottom: "1em" }, children: /* @__PURE__ */ n(
142
+ ge,
143
+ {
144
+ label: "Alt-текст",
145
+ placeholder: "Альтернативный текст",
146
+ onChange: s,
147
+ value: l,
148
+ "data-test-id": "image-modal-alt-text-input"
149
+ }
150
+ ) }),
151
+ /* @__PURE__ */ w("div", { className: "Input__wrapper", children: [
152
+ /* @__PURE__ */ n(
153
+ "input",
154
+ {
155
+ id: "caption",
156
+ type: "checkbox",
157
+ checked: E,
158
+ onChange: x
159
+ }
160
+ ),
161
+ /* @__PURE__ */ n("label", { htmlFor: "caption", children: "Show Caption" })
162
+ ] }),
163
+ /* @__PURE__ */ n(
164
+ fe,
165
+ {
166
+ "data-test-id": "image-modal-file-upload-btn",
167
+ onClick: () => p(),
168
+ children: "Применить"
169
+ }
170
+ )
171
+ ] });
172
+ }
173
+ function Ie({
174
+ src: e,
175
+ altText: a,
176
+ nodeKey: o,
177
+ width: f,
178
+ height: r,
179
+ showCaption: l,
180
+ caption: s,
181
+ position: E
182
+ }) {
183
+ const [u, k] = H(), S = M(null), x = M(null), [p, d, m] = J(o), [t] = Q(), [v, b] = L(null), i = M(null), C = y(
184
+ (h) => {
185
+ if (p && P(R())) {
186
+ h.preventDefault();
187
+ const c = j(o);
188
+ V(c) && c.remove();
189
+ }
190
+ return !1;
191
+ },
192
+ [p, o]
193
+ ), g = y(
194
+ (h) => {
195
+ const _ = R(), c = x.current;
196
+ if (p && P(_) && _.getNodes().length === 1) {
197
+ if (l)
198
+ return B(null), h.preventDefault(), s.focus(), !0;
199
+ if (c !== null && c !== document.activeElement)
200
+ return h.preventDefault(), c.focus(), !0;
201
+ }
202
+ return !1;
203
+ },
204
+ [s, p, l]
205
+ ), N = y(
206
+ (h) => i.current === s || x.current === h.target ? (B(null), t.update(() => {
207
+ d(!0);
208
+ const _ = t.getRootElement();
209
+ _ !== null && _.focus();
210
+ }), !0) : !1,
211
+ [s, t, d]
212
+ );
213
+ return $(() => {
214
+ let h = !0;
215
+ const _ = X(
216
+ t.registerUpdateListener(({ editorState: c }) => {
217
+ h && b(c.read(() => R()));
218
+ }),
219
+ t.registerCommand(
220
+ oe,
221
+ (c, T) => (i.current = T, !1),
222
+ I
223
+ ),
224
+ t.registerCommand(
225
+ ae,
226
+ (c) => {
227
+ const T = c;
228
+ return T.target === S.current ? (T.shiftKey ? d(!p) : (m(), d(!0)), !0) : !1;
229
+ },
230
+ I
231
+ ),
232
+ t.registerCommand(
233
+ ne,
234
+ (c) => c.target === S.current ? (c.preventDefault(), !0) : !1,
235
+ I
236
+ ),
237
+ t.registerCommand(
238
+ te,
239
+ C,
240
+ I
241
+ ),
242
+ t.registerCommand(
243
+ ee,
244
+ C,
245
+ I
246
+ ),
247
+ t.registerCommand(Z, g, I),
248
+ t.registerCommand(
249
+ Y,
250
+ N,
251
+ I
252
+ )
253
+ );
254
+ return () => {
255
+ h = !1, _();
256
+ };
257
+ }, [
258
+ m,
259
+ t,
260
+ p,
261
+ o,
262
+ C,
263
+ g,
264
+ N,
265
+ d
266
+ ]), /* @__PURE__ */ w(q, { fallback: null, children: [
267
+ /* @__PURE__ */ w(U, { children: [
268
+ /* @__PURE__ */ w("div", { draggable: !1, children: [
269
+ /* @__PURE__ */ n(
270
+ "button",
271
+ {
272
+ className: "image-edit-button",
273
+ ref: x,
274
+ onClick: () => {
275
+ k("Update Inline Image", (h) => /* @__PURE__ */ n(
276
+ be,
277
+ {
278
+ activeEditor: t,
279
+ nodeKey: o,
280
+ onClose: h
281
+ }
282
+ ));
283
+ },
284
+ children: "Edit"
285
+ }
286
+ ),
287
+ /* @__PURE__ */ n(
288
+ ve,
289
+ {
290
+ className: p ? `focused ${P(v) ? "draggable" : ""}` : null,
291
+ src: e,
292
+ altText: a,
293
+ imageRef: S,
294
+ width: f,
295
+ height: r,
296
+ position: E
297
+ }
298
+ )
299
+ ] }),
300
+ l && /* @__PURE__ */ n("div", { className: "image-caption-container", children: /* @__PURE__ */ w(me, { initialEditor: s, children: [
301
+ /* @__PURE__ */ n(re, {}),
302
+ /* @__PURE__ */ n(se, {}),
303
+ /* @__PURE__ */ n(
304
+ le,
305
+ {
306
+ contentEditable: /* @__PURE__ */ n(ce, { className: "InlineImageNode__contentEditable" }),
307
+ placeholder: /* @__PURE__ */ n(pe, { className: "InlineImageNode__placeholder", children: "Enter a caption..." }),
308
+ ErrorBoundary: ie
309
+ }
310
+ )
311
+ ] }) })
312
+ ] }),
313
+ u
314
+ ] });
315
+ }
316
+ export {
317
+ be as UpdateInlineImageDialog,
318
+ Ie as default
319
+ };