@layers-app/editor 0.5.8-optimization → 0.5.10-optimization

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 (51) hide show
  1. package/README.md +0 -19
  2. package/dist/ExcalidrawComponent-D7Z_2awF.cjs +1 -0
  3. package/dist/ExcalidrawComponent-Re4zFgLg.js +283 -0
  4. package/dist/InlineImageComponent-DHgCaPNk.cjs +1 -0
  5. package/dist/InlineImageComponent-kXhZcmF6.js +265 -0
  6. package/dist/collaboration-C7xVk0Zj.cjs +4 -0
  7. package/dist/collaboration-Cn7KizEJ.js +5997 -0
  8. package/dist/excalidraw-C-6bid_P.js +16497 -0
  9. package/dist/excalidraw-DpwKTNBz.cjs +574 -0
  10. package/dist/index-B4yOqKUQ.cjs +1 -0
  11. package/dist/index-BZu8Qnrg.cjs +1 -0
  12. package/dist/index-CFA9Drk2.cjs +16 -0
  13. package/dist/index-CX5msaMB.js +296 -0
  14. package/dist/index-CbQX0N2c.js +136 -0
  15. package/dist/index-DEC5JR_F.js +60 -0
  16. package/dist/index-Dan3tqoj.cjs +1 -0
  17. package/dist/index-WCOc4LNL.js +16600 -0
  18. package/dist/index.cjs +2 -2
  19. package/dist/index.js +12 -13
  20. package/dist/lexical-2rxs76dr.cjs +41 -0
  21. package/dist/lexical-C60GkwxR.js +13122 -0
  22. package/dist/lexical-code-DKIWiZdJ.js +604 -0
  23. package/dist/lexical-code-VafvPacU.cjs +9 -0
  24. package/dist/lexical-collab-1tX9tFVC.js +1025 -0
  25. package/dist/lexical-collab-Nk2LVpJv.cjs +1 -0
  26. package/dist/lexical-file-C52Mze5k.cjs +1 -0
  27. package/dist/lexical-file-DjHP4vVw.js +43 -0
  28. package/dist/lexical-markdown-BSl_ahWw.cjs +12 -0
  29. package/dist/lexical-markdown-DcEwQQba.js +488 -0
  30. package/dist/lodash-3PEMjFQT.cjs +1 -0
  31. package/dist/lodash-jftOdrxX.js +711 -0
  32. package/dist/stats.html +4949 -0
  33. package/dist/vendor-BrXDSyZX.js +136433 -0
  34. package/dist/vendor-Bt6Lma3y.cjs +2469 -0
  35. package/package.json +42 -74
  36. package/dist/layers.8yssqxrI.js +0 -6774
  37. package/dist/layers.B8z-e4Vg.js +0 -7
  38. package/dist/layers.BQLznd92.js +0 -4
  39. package/dist/layers.BVRvG1mv.js +0 -3
  40. package/dist/layers.BjCQNcdJ.js +0 -341
  41. package/dist/layers.BnVn2uMi.js +0 -7723
  42. package/dist/layers.CLcioDq5.js +0 -2511
  43. package/dist/layers.CTSBFg3j.js +0 -1
  44. package/dist/layers.CoCZDINv.js +0 -864
  45. package/dist/layers.D0ZtUpST.js +0 -2
  46. package/dist/layers.D2zjLyjP.js +0 -6
  47. package/dist/layers.DNCgFYS7.js +0 -27
  48. package/dist/layers.Dt_Jdn4Y.js +0 -2227
  49. package/dist/layers.DwX5sVtx.js +0 -1
  50. package/dist/layers.QjAkD17S.js +0 -3677
  51. package/dist/layers.pre7B8K-.js +0 -530
@@ -1,864 +0,0 @@
1
- import { jsx as t, jsxs as R } from "react/jsx-runtime";
2
- import { useContext as le, memo as Xe, useState as O, useMemo as j, useRef as ie, useEffect as X } from "react";
3
- import { useTranslation as U } from "react-i18next";
4
- import { useLexicalComposerContext as je } from "@lexical/react/LexicalComposerContext";
5
- import { Flex as Ue, UnstyledButton as qe, Loader as Ve, Text as ue, Progress as Ze, Tooltip as we, Modal as Je, Button as Ke, Menu as w, Portal as Qe } from "@mantine/core";
6
- import { $getNodeByKey as et, CLICK_COMMAND as tt, COMMAND_PRIORITY_NORMAL as nt, $createParagraphNode as rt, $getNearestNodeFromDOMNode as it, DecoratorNode as ot, FORMAT_ELEMENT_COMMAND as st, BLUR_COMMAND as ct, COMMAND_PRIORITY_LOW as ze, FOCUS_COMMAND as at, $getRoot as lt } from "lexical";
7
- import { C as de } from "./layers.Dt_Jdn4Y.js";
8
- import { IconPalette as xe, IconLayoutSidebarLeftExpand as ut, IconSend as dt, IconReload as mt, IconShieldCheckFilled as ht, IconMessages as pt, IconFilter as gt, IconArrowBackUp as Me, IconMessage as ft, IconMusic as It, IconApi as yt, IconX as Ct, IconPaperclip as Et, IconAt as zt, IconCodeCircle as Mt, IconBaseline as be, IconExclamationCircle as Tt, IconAlertTriangle as Pt, IconCheck as Te, IconFile as ae, IconMoodSmile as Rt, IconBrandYoutube as _t, IconCheckupList as wt, IconDropletOff as xt, IconLayersSubtract as bt, IconLayersUnion as St, IconTableOff as kt, IconContainerOff as Dt, IconRowInsertBottom as Nt, IconRowInsertTop as vt, IconColumnInsertRight as Ot, IconColumnInsertLeft as Lt, IconArrowBarToRight as At, IconArrowBarToLeft as Ht, IconArrowBarToDown as Bt, IconArrowBarToUp as Ft, IconCut as Wt, IconClipboard as $t, IconCopy as Gt, IconDotsVertical as Yt, IconColumns3 as Xt, IconCaretRight as jt, IconTable as Se, IconTrash as Ut, IconPencil as qt, IconCircleX as Vt, IconCircleCheck as Zt, IconGripVertical as Jt, IconChevronRight as Kt, IconChevronDown as Qt, IconPlus as en, IconMinus as tn, IconSuperscript as nn, IconSubscript as rn, IconStrikethrough as on, IconFlipHorizontal as sn, IconAlignJustified as cn, IconAlignCenter as an, IconAlignRight as ln, IconAlignLeft as oe, IconPhotoCheck as un, IconPhoto as dn, IconBucketDroplet as mn, IconColorPicker as hn, IconLink as pn, IconUnderline as gn, IconItalic as fn, IconBold as In, IconArrowForwardUp as yn, IconLetterT as Cn, IconQuote as En, IconIndentIncrease as zn, IconListNumbers as ke, IconH3 as Mn, IconH2 as Tn, IconH1 as De, IconCode as Ne, IconListCheck as Pn, IconList as Rn, IconColumns2 as _n, IconTemplate as wn, IconApps as xn } from "@tabler/icons-react";
9
- import { ProjectIcon as bn } from "@layers-app/shared";
10
- import { aE as Sn, a4 as ve, a0 as kn, Z as Dn, a1 as Nn } from "./layers.BnVn2uMi.js";
11
- import { l as Pe, O as vn, c as Re, U as On, I as Ln } from "./layers.pre7B8K-.js";
12
- import { createPortal as An } from "react-dom";
13
- import { ContentEditable as Hn } from "@lexical/react/LexicalContentEditable";
14
- import { $createHeadingNode as Bn } from "@lexical/rich-text";
15
- import { mergeRegister as Fn } from "@lexical/utils";
16
- import { V as Wn, W as $n, X as Gn, I as Yn, Y as Xn, Z as jn } from "./layers.8yssqxrI.js";
17
- const _e = {
18
- bullet: Rn,
19
- check: Pn,
20
- "check-mark": Te,
21
- code: Ne,
22
- h1: De,
23
- h2: Tn,
24
- h3: Mn,
25
- number: ke,
26
- paragraph: zn,
27
- quote: En,
28
- fontFamily: Cn,
29
- undo: Me,
30
- redo: yn,
31
- bold: In,
32
- italic: fn,
33
- underline: gn,
34
- link: pn,
35
- "color-picker": hn,
36
- background: mn,
37
- photo: dn,
38
- "photo-check": un,
39
- "align-left": oe,
40
- "align-end": oe,
41
- "align-start": oe,
42
- "align-right": ln,
43
- "align-center": an,
44
- "align-justify": cn,
45
- "horizontal-rule": sn,
46
- strikethrough: on,
47
- subscript: rn,
48
- superscript: nn,
49
- minus: tn,
50
- plus: en,
51
- "chevron-down": Qt,
52
- "chevron-right": Kt,
53
- grip: Jt,
54
- "circle-check": Zt,
55
- "circle-x": Vt,
56
- pencil: qt,
57
- trash: Ut,
58
- table: Se,
59
- "caret-right": jt,
60
- grid: Xt,
61
- "dots-vertical": Yt,
62
- copy: Gt,
63
- clipboard: $t,
64
- cut: Wt,
65
- "arrow-bar-to-up": Ft,
66
- "arrow-bar-to-down": Bt,
67
- "arrow-bar-to-left": Ht,
68
- "arrow-bar-to-right": At,
69
- "column-insert-left": Lt,
70
- "column-insert-right": Ot,
71
- "row-insert-top": vt,
72
- "row-insert-bottom": Nt,
73
- "container-off": Dt,
74
- "table-off": kt,
75
- "layers-union": St,
76
- "layers-substract": bt,
77
- "сlear-format": xt,
78
- form: wt,
79
- youtube: _t,
80
- emoji: Rt,
81
- file: ae,
82
- success: Te,
83
- warning: Pt,
84
- alert: Tt,
85
- defaultOff: be,
86
- embed: Mt,
87
- at: zt,
88
- paperclip: Et,
89
- close: Ct,
90
- api: yt,
91
- music: It,
92
- message: ft,
93
- reply: Me,
94
- filter: gt,
95
- messages: pt,
96
- "shield-check": ht,
97
- reOpen: mt,
98
- send: dt,
99
- expandSidebar: ut,
100
- palette: xe
101
- }, T = ({
102
- name: e,
103
- iconStyle: i,
104
- ...c
105
- }) => {
106
- const r = _e[e] || _e.bullet;
107
- return /* @__PURE__ */ t(Ue, { gap: 0, justify: "center", align: "center", ...c, children: /* @__PURE__ */ t(r, { size: 18, stroke: 2, style: i, ...c }) });
108
- }, Mr = ({
109
- icon: e,
110
- title: i,
111
- pointerEvents: c = "auto",
112
- isLoading: r,
113
- progress: y,
114
- nodeKey: f,
115
- onAfterCancel: m,
116
- ...g
117
- }) => {
118
- const [I] = je(), { t: C } = U(), { fetchUploadMedia: a } = le(de), P = ((a == null ? void 0 : a.length) ?? 0) >= 5, E = () => {
119
- I.update(() => {
120
- const z = et(f);
121
- z && z.remove();
122
- });
123
- };
124
- return /* @__PURE__ */ R(
125
- qe,
126
- {
127
- className: "image-node-picker-button",
128
- styles: {
129
- root: {
130
- width: "100%",
131
- display: "flex",
132
- alignItems: "center",
133
- gap: "var(--mantine-spacing-sm)",
134
- flexDirection: "column",
135
- padding: "var(--mantine-spacing-md)",
136
- background: "var(--mantine-primary-color-light)",
137
- color: "var(--mantine-color-text)",
138
- borderRadius: "var(--mantine-radius-default)",
139
- opacity: 0.75,
140
- pointerEvents: r ? "none" : c,
141
- boxSizing: "border-box"
142
- }
143
- },
144
- ...g,
145
- children: [
146
- /* @__PURE__ */ R("div", { className: "empty-node-button__content", children: [
147
- r && !P && /* @__PURE__ */ t(Ve, { size: "xs", mb: 2, mr: 4, color: "gray" }),
148
- !r && /* @__PURE__ */ t(T, { name: e }),
149
- i,
150
- r && m && /* @__PURE__ */ t(
151
- ue,
152
- {
153
- component: "span",
154
- onClick: (z) => {
155
- z.stopPropagation(), m == null || m();
156
- },
157
- variant: "link",
158
- style: {
159
- marginLeft: "auto",
160
- cursor: "pointer",
161
- pointerEvents: "auto"
162
- },
163
- children: C("editor.cancel")
164
- }
165
- ),
166
- f && !r && /* @__PURE__ */ t(
167
- T,
168
- {
169
- style: { pointerEvents: "auto" },
170
- className: "delete-icon",
171
- name: "close",
172
- size: 22,
173
- onClick: E
174
- }
175
- )
176
- ] }),
177
- r && typeof y == "number" && P && /* @__PURE__ */ t(Ze, { w: "100%", value: y, animated: !0, transitionDuration: 200 })
178
- ]
179
- }
180
- );
181
- }, Un = "_title_81iwv_1", qn = "_icon_81iwv_11", Vn = "_link_81iwv_20", se = {
182
- title: Un,
183
- icon: qn,
184
- link: Vn
185
- }, Zn = ({ page: e }) => {
186
- const { t: i } = U();
187
- return /* @__PURE__ */ R("div", { className: se.link, onClick: e.onClick, children: [
188
- /* @__PURE__ */ t("div", { className: se.icon, children: e.icon ? /* @__PURE__ */ t(
189
- bn,
190
- {
191
- size: 16,
192
- fz: 16,
193
- icon: e.icon,
194
- fallback: /* @__PURE__ */ t(ae, { size: "1em" })
195
- }
196
- ) : /* @__PURE__ */ t(ae, { size: 16 }) }),
197
- /* @__PURE__ */ t(we, { label: e.title, disabled: !e.title, openDelay: 400, children: /* @__PURE__ */ t(ue, { truncate: !0, className: se.title, "data-empty": !e.title, children: e.title || i("editor.noTitle") }) })
198
- ] });
199
- }, Jn = Xe, Tr = Jn(Zn), Kn = {
200
- center: -8,
201
- right: 2,
202
- left: -18
203
- }, Qn = (e, i, c, r) => {
204
- const f = e.width / 2, m = e.height / 2, g = r == null ? void 0 : r.classList[1], I = Kn[g];
205
- switch (i) {
206
- case "nw-resize":
207
- return { x: 0, y: 0 };
208
- case "ne-resize":
209
- return { x: e.width - 16, y: 0 };
210
- case "sw-resize":
211
- return { x: 0, y: e.height - 16 };
212
- case "se-resize":
213
- return { x: e.width - 16, y: e.height - 16 };
214
- case "n-resize":
215
- return { x: f + I, y: 0 };
216
- case "s-resize":
217
- return { x: f + I, y: e.height - 16 };
218
- case "w-resize":
219
- return { x: 0, y: m - 8 };
220
- case "e-resize":
221
- return { x: e.width - 16, y: m - (c ? 17 : 8) };
222
- }
223
- }, er = (e, i, c, r = [
224
- "nw-resize",
225
- "ne-resize",
226
- "sw-resize",
227
- "se-resize",
228
- "n-resize",
229
- "s-resize",
230
- "w-resize",
231
- "e-resize"
232
- ]) => {
233
- const f = c <= 32, m = c >= e.height - 32, g = i <= 32, I = i >= e.width - 32;
234
- return f && g ? r.includes("nw-resize") ? "nw-resize" : "default" : f && I ? r.includes("ne-resize") ? "ne-resize" : "default" : m && g ? r.includes("sw-resize") ? "sw-resize" : "default" : m && I ? r.includes("se-resize") ? "se-resize" : "default" : f ? r.includes("n-resize") ? "n-resize" : "default" : m ? r.includes("s-resize") ? "s-resize" : "default" : g ? r.includes("w-resize") ? "w-resize" : "default" : I && r.includes("e-resize") ? "e-resize" : "default";
235
- }, G = 32, Y = (e, i) => e && typeof e == "number" ? Math.min(e / i * 100, 95.5) : 95.5;
236
- function tr(e) {
237
- const c = 100 - 4e3 / e;
238
- return { minResizePercent: Math.max(5, 9792 / e), maxWidthPercent: c };
239
- }
240
- const Pr = ({
241
- editor: e,
242
- width: i,
243
- height: c,
244
- initialHeight: r,
245
- initialWidth: y,
246
- children: f,
247
- onResizeStart: m,
248
- isIcon: g,
249
- onResizeEnd: I,
250
- alignment: C,
251
- isEmbed: a,
252
- type: P
253
- }) => {
254
- const [E, L] = O({ x: -1e3, y: -1e3 }), [z, q] = O(30), [F, V] = O("default"), [W, me] = O(!1), { imperativeHandleRef: $ } = le(de), [Z, J] = O(
255
- null
256
- ), S = j(
257
- () => Sn(C) || ["e-resize"],
258
- [C]
259
- ), Oe = S.length === 1 && S[0] === "e-resize", l = ie(null), he = ie(null), M = ie({
260
- rootHeight: 0,
261
- rootWidth: 0,
262
- ratio: 1,
263
- currentWidth: 0,
264
- currentWidthPercent: 0,
265
- currentHeight: 0,
266
- currentHeightPercent: 0,
267
- startWidth: 0,
268
- startWidthPercent: 0,
269
- startHeight: 0,
270
- startHeightPercent: 0,
271
- startX: 0,
272
- startY: 0,
273
- direction: "x",
274
- isResizing: !1,
275
- isTop: !1,
276
- isBottom: !1,
277
- isLeft: !1,
278
- isRight: !1
279
- }), k = (n, o = 95.5) => {
280
- var u;
281
- const h = (u = e._window) == null ? void 0 : u.innerWidth;
282
- if (h) {
283
- let p = 100;
284
- a && (p = 250);
285
- const d = p / h * 100;
286
- return n < d ? d : n > o ? o : n;
287
- } else
288
- return n < 20 ? 20 : n > 100 ? 100 : n;
289
- }, pe = (n, o) => {
290
- const h = Math.min(n, o);
291
- return 15 + (Math.max(200, Math.min(800, h)) - 100) / 500 * 15;
292
- }, ge = (n, o, h) => {
293
- if (V("default"), !W) return;
294
- let u = F;
295
- u = er(n, o, h, S), M.current.isResizing && (u = F), V(u), q(z), L((p) => Qn(
296
- n,
297
- u,
298
- a || !1,
299
- l.current
300
- ) || p);
301
- }, Le = (n) => {
302
- var p;
303
- if (Pe) return;
304
- n.preventDefault();
305
- const o = (p = l.current) == null ? void 0 : p.getBoundingClientRect();
306
- if (!o) return;
307
- const h = n.clientX - o.left, u = n.clientY - o.top;
308
- M.current.isResizing || ge(o, h, u);
309
- }, fe = (n, o = 12, h = 95.5, u = M.current.rootWidth) => {
310
- const p = l.current, d = M.current;
311
- if (!p || n.button === 2 || !(d != null && d.isResizing)) return;
312
- const x = p.getBoundingClientRect(), D = n.clientX - x.left, K = n.clientY - x.top;
313
- ge(x, D, K);
314
- const Q = 0.17, A = C === "right", H = C === "center", N = d.isLeft, v = d.isTop, B = d.isBottom, ee = d.direction === "y", s = d.isRight, b = Math.floor(
315
- A ? x.right - n.clientX - (x.right - d.startX) : n.clientX - d.startX
316
- ), te = Math.floor(n.clientY - d.startY);
317
- let _ = 0;
318
- N || s ? _ = b / u * 100 : (v || B || H) && (_ = te * Q), (N || v) && (!A || ee && !N) && (!B || H) && (_ = -_), (v && s || B && s) && (_ = b / u * 100), _ = Math.max(-100, Math.min(100, _));
319
- const ne = d.startWidthPercent + _, re = d.startHeightPercent + _;
320
- d.currentWidthPercent = k(
321
- Math.max(o, ne),
322
- h
323
- ), d.currentHeightPercent = k(
324
- Math.max(o, re),
325
- h
326
- ), p.style.width = `${d.currentWidthPercent}%`, p.style.height = `${d.currentHeightPercent}%`;
327
- }, Ae = (n) => {
328
- var p, d;
329
- const o = M.current;
330
- if (o.isResizing = !1, (p = l.current) == null || p.classList.remove("is-resizing"), (d = l.current) == null || d.releasePointerCapture(n.pointerId), I(
331
- o.currentWidthPercent + "%",
332
- o.currentHeightPercent + "%"
333
- ), document.removeEventListener("pointermove", fe), !l.current) return;
334
- const h = l.current.getBoundingClientRect(), u = pe(h.width, h.height);
335
- q(u);
336
- }, He = (n) => {
337
- var Ie, ye;
338
- if (n.button === 2 || !W) {
339
- n.preventDefault(), n.stopPropagation();
340
- return;
341
- }
342
- if (!l.current) return;
343
- l.current.classList.add("is-resizing");
344
- const o = e.getRootElement();
345
- if (!o) return;
346
- const h = o.getBoundingClientRect();
347
- if (!e.isEditable() || F === "default") return;
348
- const u = he.current;
349
- if (u === null) return;
350
- const p = (Ie = l.current) == null ? void 0 : Ie.getBoundingClientRect();
351
- if (!u.getBoundingClientRect() || !p) return;
352
- const { width: x, height: D, top: K, left: Q } = p, A = n.clientX - Q, H = n.clientY - K, N = H <= G, v = H >= D - G, B = A <= G, ee = A >= x - G, s = M.current, b = window.getComputedStyle(o), te = parseFloat(b.paddingTop), _ = parseFloat(b.paddingBottom), ne = parseFloat(b.paddingLeft), re = parseFloat(b.paddingRight);
353
- s.rootHeight = h.height - te - _ || 0, s.rootWidth = h.width - ne - re || 0, s.ratio = x / D, s.currentWidth = s.currentWidth || x, s.currentWidthPercent = +l.current.style.width.replace(
354
- "%",
355
- ""
356
- ), s.currentHeight = s.currentHeight || D, s.currentHeightPercent = +l.current.style.height.replace("%", ""), s.startX = n.clientX, s.startY = n.clientY, s.startWidth = s.currentWidth || x, s.startWidthPercent = s.currentWidthPercent, s.startHeight = s.currentHeight || D, s.startHeightPercent = s.currentHeightPercent, s.isResizing = !0, s.isTop = N, s.isBottom = v, s.isLeft = B, s.isRight = ee, s.direction = v || N ? "y" : "x", m && m(), l.current.setPointerCapture(n.pointerId);
357
- const We = ((ye = l.current.parentElement) == null ? void 0 : ye.offsetWidth) ?? s.rootWidth, { maxWidthPercent: $e, minResizePercent: Ge } = tr(We);
358
- document.addEventListener(
359
- "pointermove",
360
- (Ye) => {
361
- var Ce, Ee;
362
- return fe(
363
- Ye,
364
- P === "video" ? 40 : Ge,
365
- $e,
366
- (Ee = (Ce = l.current) == null ? void 0 : Ce.parentElement) == null ? void 0 : Ee.offsetWidth
367
- );
368
- }
369
- ), document.addEventListener("pointerup", Ae, {
370
- capture: !0,
371
- once: !0
372
- });
373
- };
374
- X(() => {
375
- var p;
376
- const n = l.current;
377
- if (!n) return;
378
- if (typeof i == "number" && typeof c == "number") {
379
- n.style.width = `${k(i)}%`, n.style.height = `${k(c)}%`;
380
- return;
381
- }
382
- const o = (p = n.parentElement) == null ? void 0 : p.getBoundingClientRect();
383
- if (!o) return;
384
- const h = Y(
385
- r,
386
- o.height
387
- ), u = Y(
388
- y,
389
- o.width
390
- );
391
- n.style.width = `${u}%`, n.style.height = `${h}%`;
392
- }, [i, c, y, r]), X(() => {
393
- var u;
394
- if (!l.current) return;
395
- const n = l.current.getBoundingClientRect(), o = (u = l.current.parentElement) == null ? void 0 : u.getBoundingClientRect(), h = pe(n.width, n.height);
396
- if (q(h), typeof i == "number" && typeof c == "number")
397
- l.current.style.width = `${k(i)}%`, l.current.style.height = `${k(c)}%`, M.current.currentWidthPercent = i, M.current.currentHeightPercent = c;
398
- else if (o) {
399
- const p = Y(
400
- r,
401
- o.height
402
- ), d = Y(
403
- y,
404
- o.width
405
- );
406
- requestAnimationFrame(() => {
407
- l.current && (l.current.style.height = `${p}%`, l.current.style.width = `${d}%`);
408
- }), M.current.currentWidthPercent = d, M.current.currentHeightPercent = p;
409
- } else
410
- l.current.style.height = "100%", l.current.style.width = "100%", M.current.currentWidthPercent = 100, M.current.currentHeightPercent = 100;
411
- }, [l.current, g, r, y]);
412
- const Be = (n) => {
413
- const h = n.target.closest("[data-lexical-decorator]");
414
- return h ? e.update(() => {
415
- const u = it(h);
416
- u && u instanceof ot && J(u);
417
- }) : J(null), !1;
418
- }, Fe = () => (Z && setTimeout(() => {
419
- e.update(() => (Z.insertAfter(rt()).selectStart(), J(null), !0));
420
- }), !1);
421
- return $ != null && $.current && ($.current.decoratorEnterAction = Fe), X(() => {
422
- const n = e.registerCommand(
423
- tt,
424
- Be,
425
- nt
426
- );
427
- return () => {
428
- n();
429
- };
430
- }, [Z]), Pe ? f : /* @__PURE__ */ R(
431
- "div",
432
- {
433
- ref: l,
434
- className: `resizable-container ${C || ""} ${Oe ? "hide-padding" : ""}`,
435
- style: { cursor: F },
436
- onMouseMove: Le,
437
- onMouseEnter: () => me(!0),
438
- onMouseLeave: () => {
439
- me(!1), V("default");
440
- },
441
- onMouseUp: () => {
442
- e.dispatchCommand(vn, "show_menu");
443
- },
444
- onPointerDown: He,
445
- children: [
446
- /* @__PURE__ */ t(
447
- "svg",
448
- {
449
- className: `resizable-container__handle ${W ? "hovered" : ""}`,
450
- style: {
451
- "--clip-x1": `${E.x - z}px`,
452
- "--clip-y1": `${E.y - z}px`,
453
- "--clip-x2": `${E.x + z}px`,
454
- "--clip-y2": `${E.y - z}px`,
455
- "--clip-x3": `${E.x + z}px`,
456
- "--clip-y3": `${E.y + z}px`,
457
- "--clip-x4": `${E.x - z}px`,
458
- "--clip-y4": `${E.y + z}px`,
459
- clipPath: `polygon(
460
- var(--clip-x1) var(--clip-y1),
461
- var(--clip-x2) var(--clip-y2),
462
- var(--clip-x3) var(--clip-y3),
463
- var(--clip-x4) var(--clip-y4)
464
- )`,
465
- opacity: W ? 1 : 0,
466
- transition: `${M.current.isResizing ? "none" : ` opacity 0.3s ease-in-out, clip-path ${(S == null ? void 0 : S.length) < 4 ? "0.2s" : "0.3s"} cubic-bezier(0.825, 0.225, 0.280, 0.770)`}`
467
- },
468
- children: /* @__PURE__ */ t(
469
- "rect",
470
- {
471
- x: 0,
472
- y: 0,
473
- width: "100%",
474
- height: "100%",
475
- stroke: "#D9D9D9",
476
- strokeWidth: 8,
477
- rx: 15,
478
- ry: 15,
479
- fill: "none"
480
- }
481
- )
482
- }
483
- ),
484
- /* @__PURE__ */ t(
485
- "div",
486
- {
487
- ref: he,
488
- className: "resizable-container__inner",
489
- style: {
490
- height: "100%",
491
- width: "100%",
492
- pointerEvents: M.current.isResizing ? "none" : "auto"
493
- },
494
- children: f
495
- }
496
- )
497
- ]
498
- }
499
- );
500
- };
501
- function Rr({
502
- children: e
503
- }) {
504
- return An(
505
- /* @__PURE__ */ t("div", { className: "FlashMessage__overlay", role: "dialog", children: /* @__PURE__ */ t("p", { className: "FlashMessage__alert", role: "alert", children: e }) }),
506
- document.body
507
- );
508
- }
509
- function _r({
510
- onClose: e,
511
- children: i,
512
- title: c,
513
- size: r
514
- }) {
515
- return /* @__PURE__ */ t(
516
- Je,
517
- {
518
- className: "doc-space-editor-wrapper",
519
- size: r,
520
- centered: !0,
521
- opened: !0,
522
- onClose: e,
523
- title: c,
524
- zIndex: 999,
525
- children: i
526
- }
527
- );
528
- }
529
- function wr({
530
- "data-test-id": e,
531
- children: i,
532
- className: c,
533
- onClick: r,
534
- disabled: y,
535
- small: f,
536
- title: m
537
- }) {
538
- return /* @__PURE__ */ t(Ke, { onClick: r, disabled: y, variant: "filled", children: i });
539
- }
540
- const xr = ({
541
- label: e,
542
- icon: i
543
- }) => /* @__PURE__ */ R("div", { className: "custom-menu-item", children: [
544
- /* @__PURE__ */ R("div", { children: [
545
- i,
546
- /* @__PURE__ */ t("span", { children: e })
547
- ] }),
548
- /* @__PURE__ */ t(T, { name: "chevron-right" })
549
- ] }), nr = (e) => ({
550
- center: {
551
- icon: "align-center",
552
- iconRTL: "center-align",
553
- name: e("editor.toolbar.center")
554
- },
555
- end: {
556
- icon: "align-end",
557
- iconRTL: "left-align",
558
- name: "End Align"
559
- },
560
- justify: {
561
- icon: "align-justify",
562
- iconRTL: "justify-align",
563
- name: e("editor.toolbar.justify")
564
- },
565
- left: {
566
- icon: "align-left",
567
- iconRTL: "left-align",
568
- name: e("editor.toolbar.left")
569
- },
570
- right: {
571
- icon: "align-right",
572
- iconRTL: "left-align",
573
- name: e("editor.toolbar.right")
574
- },
575
- start: {
576
- icon: "align-start",
577
- iconRTL: "right-align",
578
- name: "Start Align"
579
- }
580
- });
581
- function br({
582
- editor: e,
583
- value: i,
584
- // isRTL,
585
- disabled: c = !1,
586
- setElementFormat: r
587
- }) {
588
- const { t: y, i18n: f } = U(), m = j(
589
- () => nr(y),
590
- [f.language]
591
- ), g = j(() => i === "start" || i === "end" ? m.left : m[i || "left"], [i, f.language]), I = (C) => {
592
- r(C), e.dispatchCommand(st, C);
593
- };
594
- return /* @__PURE__ */ R(
595
- w,
596
- {
597
- transitionProps: ve,
598
- shadow: "md",
599
- styles: { dropdown: { zIndex: 1e3 } },
600
- children: [
601
- /* @__PURE__ */ t(w.Target, { children: /* @__PURE__ */ t(we, { label: y("editor.toolbar.align"), children: /* @__PURE__ */ R(
602
- "button",
603
- {
604
- disabled: c,
605
- className: "toolbar-item spaced alignment",
606
- "aria-label": "Formatting options for text alignment",
607
- type: "button",
608
- children: [
609
- /* @__PURE__ */ t(T, { size: 18, name: g.icon }),
610
- /* @__PURE__ */ R(ue, { mx: 5, size: "sm", children: [
611
- " ",
612
- g.name
613
- ] }),
614
- /* @__PURE__ */ t(T, { name: "chevron-down" })
615
- ]
616
- }
617
- ) }) }),
618
- /* @__PURE__ */ R(
619
- w.Dropdown,
620
- {
621
- onMouseDown: (C) => {
622
- C.preventDefault();
623
- },
624
- children: [
625
- /* @__PURE__ */ t(
626
- w.Item,
627
- {
628
- leftSection: /* @__PURE__ */ t(T, { size: 18, name: "align-left" }),
629
- rightSection: i === "left" && /* @__PURE__ */ t(T, { name: "check-mark" }),
630
- onClick: () => I("left"),
631
- children: m.left.name
632
- }
633
- ),
634
- /* @__PURE__ */ t(
635
- w.Item,
636
- {
637
- leftSection: /* @__PURE__ */ t(T, { size: 18, name: "align-center" }),
638
- rightSection: i === "center" && /* @__PURE__ */ t(T, { name: "check-mark" }),
639
- onClick: () => I("center"),
640
- children: m.center.name
641
- }
642
- ),
643
- /* @__PURE__ */ t(
644
- w.Item,
645
- {
646
- leftSection: /* @__PURE__ */ t(T, { size: 18, name: "align-right" }),
647
- rightSection: i === "right" && /* @__PURE__ */ t(T, { name: "check-mark" }),
648
- onClick: () => I("right"),
649
- children: m.right.name
650
- }
651
- ),
652
- /* @__PURE__ */ t(
653
- w.Item,
654
- {
655
- leftSection: /* @__PURE__ */ t(T, { size: 18, name: "align-justify" }),
656
- rightSection: i === "justify" && /* @__PURE__ */ t(T, { name: "check-mark" }),
657
- onClick: () => I("justify"),
658
- children: m.justify.name
659
- }
660
- )
661
- ]
662
- }
663
- )
664
- ]
665
- }
666
- );
667
- }
668
- function Sr({
669
- className: e
670
- }) {
671
- return /* @__PURE__ */ t(
672
- Hn,
673
- {
674
- contentEditable: !1,
675
- className: e || "ContentEditable__root"
676
- }
677
- );
678
- }
679
- const rr = "_listContainer_1d88b_1", ir = "_list_1d88b_1", or = "_text_1d88b_28", ce = {
680
- listContainer: rr,
681
- list: ir,
682
- text: or
683
- }, kr = ({ editor: e }) => {
684
- var C;
685
- const [i, c] = O(!1), { t: r, i18n: y } = U(), { excludeNodes: f } = le(de), m = (a) => {
686
- const P = document.querySelector(".editor-container");
687
- if (a) {
688
- P.classList.add("empty-editor");
689
- return;
690
- }
691
- P.classList.remove("empty-editor");
692
- };
693
- X(() => {
694
- e.update(() => {
695
- Re() && (c(!0), m(!0));
696
- }), Fn(
697
- e.registerCommand(
698
- ct,
699
- () => {
700
- const a = !!Re();
701
- return c(a), m(a), !1;
702
- },
703
- ze
704
- ),
705
- e.registerCommand(
706
- at,
707
- () => (c(!1), m(!1), !1),
708
- ze
709
- )
710
- );
711
- }, []);
712
- const g = (a, P) => {
713
- a == null || a.update(() => {
714
- a.focus();
715
- const L = lt().getFirstChild();
716
- L && P && (P(L), c(!1));
717
- });
718
- }, I = j(() => [
719
- {
720
- title: r("editor.emptyPageOptions.heading"),
721
- icon: /* @__PURE__ */ t(De, { stroke: 2, size: 18 }),
722
- onSelect: () => g(e, (a) => {
723
- a.replace(Bn("h1"));
724
- })
725
- },
726
- {
727
- title: r("editor.emptyPageOptions.grid"),
728
- icon: /* @__PURE__ */ t(_n, { stroke: 2, size: 18 }),
729
- onSelect: () => {
730
- g(e, () => {
731
- e == null || e.dispatchCommand(
732
- Gn,
733
- Yn
734
- );
735
- });
736
- }
737
- },
738
- {
739
- title: r("editor.emptyPageOptions.list"),
740
- icon: /* @__PURE__ */ t(ke, { stroke: 2, size: 18 }),
741
- onSelect: () => {
742
- g(e, () => {
743
- e == null || e.dispatchCommand(Dn, void 0);
744
- });
745
- }
746
- },
747
- {
748
- title: r("editor.emptyPageOptions.code"),
749
- icon: /* @__PURE__ */ t(Ne, { stroke: 2, size: 18 }),
750
- onSelect: () => {
751
- g(e, () => {
752
- e == null || e.dispatchCommand(Xn, void 0);
753
- });
754
- }
755
- },
756
- {
757
- title: r("editor.menu.media.excalidraw.hint.description"),
758
- icon: /* @__PURE__ */ t(xe, { stroke: 2, size: 18 }),
759
- onSelect: () => {
760
- import("./layers.8yssqxrI.js").then((a) => a.ac).then(
761
- ({ INSERT_EXCALIDRAW_COMMAND: a }) => {
762
- g(e, () => {
763
- e.dispatchCommand(a, void 0);
764
- });
765
- }
766
- );
767
- }
768
- },
769
- f.template ? {
770
- title: r("editor.emptyPageOptions.template"),
771
- icon: /* @__PURE__ */ t(wn, { stroke: 2, size: 18 }),
772
- onSelect: () => {
773
- g(e, () => {
774
- e == null || e.dispatchCommand(On, void 0);
775
- });
776
- }
777
- } : null,
778
- {
779
- title: r("editor.emptyPageOptions.callout"),
780
- icon: /* @__PURE__ */ t(be, { stroke: 2, size: 18 }),
781
- onSelect: () => {
782
- g(e, () => {
783
- setTimeout(() => {
784
- e == null || e.dispatchCommand(Ln, "success");
785
- });
786
- });
787
- }
788
- },
789
- {
790
- title: r("editor.emptyPageOptions.table"),
791
- icon: /* @__PURE__ */ t(Se, { stroke: 2, size: 18 }),
792
- onSelect: () => {
793
- g(e, () => {
794
- setTimeout(() => {
795
- e == null || e.dispatchCommand(Nn, {
796
- columns: "4",
797
- includeHeaders: !1,
798
- rows: "3"
799
- });
800
- });
801
- });
802
- }
803
- },
804
- {
805
- title: r("editor.emptyPageOptions.integrations"),
806
- icon: /* @__PURE__ */ t(xn, { stroke: 2, size: 18 }),
807
- onSelect: () => {
808
- }
809
- }
810
- ], [y.language]);
811
- return i ? /* @__PURE__ */ t(Qe, { target: ((C = e == null ? void 0 : e._rootElement) == null ? void 0 : C.parentElement) || document.body, children: /* @__PURE__ */ t("ul", { className: `${ce.listContainer} empty-page-options`, children: I.map((a, P) => a ? /* @__PURE__ */ R(
812
- w,
813
- {
814
- disabled: P !== I.length - 1,
815
- position: "bottom-start",
816
- shadow: "md",
817
- styles: { dropdown: { overflow: "auto", zIndex: 1e3 } },
818
- middlewares: Wn,
819
- width: 200,
820
- transitionProps: ve,
821
- children: [
822
- /* @__PURE__ */ t(w.Target, { children: /* @__PURE__ */ R("li", { className: ce.list, onClick: a.onSelect, children: [
823
- a.icon,
824
- " ",
825
- /* @__PURE__ */ t("span", { className: ce.text, children: a.title })
826
- ] }) }),
827
- /* @__PURE__ */ t(w.Dropdown, { children: kn.map((E) => /* @__PURE__ */ t(
828
- w.Item,
829
- {
830
- className: "item " + $n(E.key === "1"),
831
- leftSection: E.icon,
832
- style: { borderRadius: "var(--mantine-radius-sm)" },
833
- onClick: () => {
834
- g(e, () => {
835
- setTimeout(() => {
836
- e == null || e.dispatchCommand(
837
- jn,
838
- ""
839
- ), c(!1);
840
- });
841
- });
842
- },
843
- children: E.name
844
- },
845
- E.name
846
- )) })
847
- ]
848
- },
849
- a.title
850
- ) : null) }) }) : null;
851
- };
852
- export {
853
- br as A,
854
- wr as B,
855
- xr as C,
856
- kr as E,
857
- Rr as F,
858
- T as I,
859
- Sr as L,
860
- _r as M,
861
- Tr as P,
862
- Pr as R,
863
- Mr as a
864
- };