dopecanvas 0.1.2 → 0.1.3

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.
@@ -1,18 +1,19 @@
1
- import { jsxs as x, jsx as o } from "react/jsx-runtime";
2
- import { useRef as M, useState as R, useCallback as p, useEffect as _, forwardRef as ne, useMemo as U, useImperativeHandle as re } from "react";
3
- const G = ({
4
- dimensions: i,
1
+ import { jsxs as C, jsx as r } from "react/jsx-runtime";
2
+ import be, { useState as R, useRef as H, useCallback as h, useEffect as F, forwardRef as Ce, useMemo as ne, useImperativeHandle as ye } from "react";
3
+ import { createPortal as xe } from "react-dom";
4
+ const oe = ({
5
+ dimensions: s,
5
6
  margins: e,
6
7
  pageNumber: t,
7
- totalPages: r,
8
- children: n
9
- }) => /* @__PURE__ */ x(
8
+ totalPages: n,
9
+ children: o
10
+ }) => /* @__PURE__ */ C(
10
11
  "div",
11
12
  {
12
13
  className: "dopecanvas-page",
13
14
  style: {
14
- width: `${i.width}px`,
15
- height: `${i.height}px`,
15
+ width: `${s.width}px`,
16
+ height: `${s.height}px`,
16
17
  backgroundColor: "#ffffff",
17
18
  boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.1)",
18
19
  position: "relative",
@@ -20,7 +21,7 @@ const G = ({
20
21
  flexShrink: 0
21
22
  },
22
23
  children: [
23
- /* @__PURE__ */ o(
24
+ /* @__PURE__ */ r(
24
25
  "div",
25
26
  {
26
27
  className: "dopecanvas-page-content",
@@ -33,10 +34,10 @@ const G = ({
33
34
  boxSizing: "border-box",
34
35
  overflow: "hidden"
35
36
  },
36
- children: n
37
+ children: o
37
38
  }
38
39
  ),
39
- /* @__PURE__ */ x(
40
+ /* @__PURE__ */ C(
40
41
  "div",
41
42
  {
42
43
  className: "dopecanvas-page-number",
@@ -55,209 +56,493 @@ const G = ({
55
56
  children: [
56
57
  t,
57
58
  " / ",
58
- r
59
+ n
59
60
  ]
60
61
  }
61
62
  )
62
63
  ]
63
64
  }
64
- ), ee = {
65
+ ), ve = ({
66
+ visible: s,
67
+ onAddBelow: e,
68
+ onEditHTML: t,
69
+ onDelete: n
70
+ }) => /* @__PURE__ */ C(
71
+ "div",
72
+ {
73
+ className: "dopecanvas-block-toolbar",
74
+ style: {
75
+ ...Me,
76
+ display: s ? "flex" : "none"
77
+ },
78
+ onMouseDown: (o) => o.preventDefault(),
79
+ children: [
80
+ /* @__PURE__ */ r(X, { onClick: e, title: "Add block below", children: /* @__PURE__ */ r(Se, {}) }),
81
+ /* @__PURE__ */ r(X, { onClick: t, title: "Edit HTML", children: /* @__PURE__ */ r(ke, {}) }),
82
+ /* @__PURE__ */ r(X, { onClick: n, title: "Delete block", danger: !0, children: /* @__PURE__ */ r(Te, {}) })
83
+ ]
84
+ }
85
+ ), Se = () => /* @__PURE__ */ C("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", children: [
86
+ /* @__PURE__ */ r("line", { x1: "7", y1: "3", x2: "7", y2: "11" }),
87
+ /* @__PURE__ */ r("line", { x1: "3", y1: "7", x2: "11", y2: "7" })
88
+ ] }), ke = () => /* @__PURE__ */ C("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
89
+ /* @__PURE__ */ r("polyline", { points: "4.5,3 1.5,7 4.5,11" }),
90
+ /* @__PURE__ */ r("polyline", { points: "9.5,3 12.5,7 9.5,11" })
91
+ ] }), Te = () => /* @__PURE__ */ r("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ r("path", { d: "M2.5 4h9M5 4V2.5h4V4M3.5 4l.5 8h6l.5-8" }) }), X = ({ onClick: s, title: e, children: t, danger: n }) => {
92
+ const [o, a] = R(!1);
93
+ return /* @__PURE__ */ r(
94
+ "button",
95
+ {
96
+ onClick: s,
97
+ title: e,
98
+ onMouseEnter: () => a(!0),
99
+ onMouseLeave: () => a(!1),
100
+ style: {
101
+ ...Le,
102
+ background: o ? n ? "#fff0f0" : "#f0f0f0" : "transparent",
103
+ color: o && n ? "#d32f2f" : "#666"
104
+ },
105
+ children: t
106
+ }
107
+ );
108
+ }, Me = {
109
+ position: "absolute",
110
+ top: 0,
111
+ left: -40,
112
+ flexDirection: "column",
113
+ gap: "1px",
114
+ zIndex: 100,
115
+ background: "#fff",
116
+ borderRadius: "6px",
117
+ boxShadow: "0 1px 5px rgba(0,0,0,0.12)",
118
+ padding: "3px",
119
+ paddingRight: "6px"
120
+ }, Le = {
121
+ width: "30px",
122
+ height: "26px",
123
+ border: "none",
124
+ cursor: "pointer",
125
+ borderRadius: "4px",
126
+ fontSize: "13px",
127
+ fontFamily: "system-ui, -apple-system, sans-serif",
128
+ display: "flex",
129
+ alignItems: "center",
130
+ justifyContent: "center",
131
+ padding: 0,
132
+ transition: "background 0.1s, color 0.1s"
133
+ }, He = ({
134
+ html: s,
135
+ onSave: e,
136
+ onCancel: t
137
+ }) => {
138
+ const [n, o] = R(s);
139
+ return xe(
140
+ /* @__PURE__ */ r("div", { style: Ee, onClick: t, children: /* @__PURE__ */ C("div", { style: we, onClick: (i) => i.stopPropagation(), children: [
141
+ /* @__PURE__ */ C("div", { style: Re, children: [
142
+ /* @__PURE__ */ r("span", { style: { fontWeight: 600, fontSize: "14px" }, children: "Edit Block HTML" }),
143
+ /* @__PURE__ */ r("span", { style: { fontSize: "11px", color: "#888" }, children: "⌘Enter to save · Escape to cancel" })
144
+ ] }),
145
+ /* @__PURE__ */ r(
146
+ "textarea",
147
+ {
148
+ style: Pe,
149
+ value: n,
150
+ onChange: (i) => o(i.target.value),
151
+ onKeyDown: (i) => {
152
+ if (i.key === "Enter" && (i.metaKey || i.ctrlKey) && (i.preventDefault(), e(n)), i.key === "Escape" && (i.preventDefault(), t()), i.key === "Tab") {
153
+ i.preventDefault();
154
+ const c = i.target, g = c.selectionStart, S = c.selectionEnd, d = n.substring(0, g) + " " + n.substring(S);
155
+ o(d), requestAnimationFrame(() => {
156
+ c.selectionStart = c.selectionEnd = g + 2;
157
+ });
158
+ }
159
+ },
160
+ spellCheck: !1,
161
+ autoFocus: !0
162
+ }
163
+ ),
164
+ /* @__PURE__ */ C("div", { style: _e, children: [
165
+ /* @__PURE__ */ r(
166
+ "button",
167
+ {
168
+ style: Ae,
169
+ onClick: t,
170
+ onMouseEnter: (i) => {
171
+ i.target.style.borderColor = "#888";
172
+ },
173
+ onMouseLeave: (i) => {
174
+ i.target.style.borderColor = "#555";
175
+ },
176
+ children: "Cancel"
177
+ }
178
+ ),
179
+ /* @__PURE__ */ r(
180
+ "button",
181
+ {
182
+ style: De,
183
+ onClick: () => e(n),
184
+ onMouseEnter: (i) => {
185
+ i.target.style.background = "#0055dd";
186
+ },
187
+ onMouseLeave: (i) => {
188
+ i.target.style.background = "#0066ff";
189
+ },
190
+ children: "Save"
191
+ }
192
+ )
193
+ ] })
194
+ ] }) }),
195
+ document.body
196
+ );
197
+ }, Ee = {
198
+ position: "fixed",
199
+ inset: 0,
200
+ background: "rgba(0, 0, 0, 0.5)",
201
+ display: "flex",
202
+ alignItems: "center",
203
+ justifyContent: "center",
204
+ zIndex: 1e4
205
+ }, we = {
206
+ width: "min(800px, 90vw)",
207
+ height: "min(600px, 80vh)",
208
+ background: "#1e1e1e",
209
+ borderRadius: "10px",
210
+ display: "flex",
211
+ flexDirection: "column",
212
+ overflow: "hidden",
213
+ boxShadow: "0 20px 60px rgba(0, 0, 0, 0.4)"
214
+ }, Re = {
215
+ display: "flex",
216
+ justifyContent: "space-between",
217
+ alignItems: "center",
218
+ padding: "12px 16px",
219
+ background: "#2d2d2d",
220
+ color: "#ccc",
221
+ borderBottom: "1px solid #444"
222
+ }, Pe = {
223
+ flex: 1,
224
+ background: "#1e1e1e",
225
+ color: "#d4d4d4",
226
+ border: "none",
227
+ padding: "16px",
228
+ fontFamily: "'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace",
229
+ fontSize: "13px",
230
+ lineHeight: "1.6",
231
+ resize: "none",
232
+ outline: "none",
233
+ tabSize: 2
234
+ }, _e = {
235
+ display: "flex",
236
+ justifyContent: "flex-end",
237
+ gap: "8px",
238
+ padding: "12px 16px",
239
+ background: "#2d2d2d",
240
+ borderTop: "1px solid #444"
241
+ }, Ae = {
242
+ padding: "6px 16px",
243
+ border: "1px solid #555",
244
+ borderRadius: "6px",
245
+ background: "transparent",
246
+ color: "#ccc",
247
+ cursor: "pointer",
248
+ fontSize: "13px",
249
+ transition: "border-color 0.15s"
250
+ }, De = {
251
+ padding: "6px 16px",
252
+ border: "none",
253
+ borderRadius: "6px",
254
+ background: "#0066ff",
255
+ color: "#fff",
256
+ cursor: "pointer",
257
+ fontSize: "13px",
258
+ fontWeight: 500,
259
+ transition: "background 0.15s"
260
+ }, ue = {
65
261
  letter: { width: 816, height: 1056 },
66
262
  // 8.5 x 11 inches
67
263
  a4: { width: 794, height: 1123 },
68
264
  // 210 x 297 mm
69
265
  legal: { width: 816, height: 1344 }
70
266
  // 8.5 x 14 inches
71
- }, ie = {
267
+ }, Ie = {
72
268
  top: 96,
73
269
  right: 96,
74
270
  bottom: 96,
75
271
  left: 96
76
- }, O = {
272
+ }, G = {
77
273
  size: "letter",
78
- margins: { ...ie }
274
+ margins: { ...Ie }
79
275
  };
80
- function oe(i) {
276
+ function Be(s) {
81
277
  const e = [];
82
- return i.querySelectorAll("script").forEach((t) => {
83
- const r = document.createElement("script");
278
+ return s.querySelectorAll("script").forEach((t) => {
279
+ const n = document.createElement("script");
84
280
  Array.from(t.attributes).forEach(
85
- (n) => r.setAttribute(n.name, n.value)
86
- ), r.textContent = t.textContent || "", t.parentNode?.replaceChild(r, t), e.push(r);
281
+ (o) => n.setAttribute(o.name, o.value)
282
+ ), n.textContent = t.textContent || "", t.parentNode?.replaceChild(n, t), e.push(n);
87
283
  }), e;
88
284
  }
89
- function ae(i) {
285
+ function ze(s) {
90
286
  const e = window.getSelection();
91
287
  if (!e || e.rangeCount === 0) return null;
92
- const t = e.getRangeAt(0), r = t.startContainer, n = Array.from(
93
- i.querySelectorAll(".dopecanvas-block-wrapper")
94
- ), s = n.findIndex((a) => a.contains(r));
95
- if (s === -1) return null;
288
+ const t = e.getRangeAt(0), n = t.startContainer, o = Array.from(
289
+ s.querySelectorAll(".dopecanvas-block-content")
290
+ ), a = o.findIndex((i) => i.contains(n));
291
+ if (a === -1) return null;
96
292
  try {
97
- const a = document.createRange();
98
- a.selectNodeContents(n[s]), a.setEnd(t.startContainer, t.startOffset);
99
- const l = a.toString().length;
100
- return { blockIndex: s, textOffset: l };
293
+ const i = document.createRange();
294
+ i.selectNodeContents(o[a]), i.setEnd(t.startContainer, t.startOffset);
295
+ const c = i.toString().length;
296
+ return { blockIndex: a, textOffset: c };
101
297
  } catch {
102
298
  return null;
103
299
  }
104
300
  }
105
- function se(i, e) {
106
- const t = i.querySelectorAll(".dopecanvas-block-wrapper");
301
+ function Fe(s, e) {
302
+ const t = s.querySelectorAll(".dopecanvas-block-content");
107
303
  if (e.blockIndex >= t.length) return;
108
- const r = t[e.blockIndex], n = document.createTreeWalker(r, NodeFilter.SHOW_TEXT);
109
- let s = e.textOffset;
110
- for (; n.nextNode(); ) {
111
- const a = n.currentNode;
112
- if (s <= a.length) {
304
+ const n = t[e.blockIndex], o = document.createTreeWalker(n, NodeFilter.SHOW_TEXT);
305
+ let a = e.textOffset;
306
+ for (; o.nextNode(); ) {
307
+ const i = o.currentNode;
308
+ if (a <= i.length) {
113
309
  try {
114
- const l = document.createRange();
115
- l.setStart(a, s), l.collapse(!0);
116
- const h = window.getSelection();
117
- h?.removeAllRanges(), h?.addRange(l);
310
+ const c = document.createRange();
311
+ c.setStart(i, a), c.collapse(!0);
312
+ const g = window.getSelection();
313
+ g?.removeAllRanges(), g?.addRange(c);
118
314
  } catch {
119
315
  }
120
316
  return;
121
317
  }
122
- s -= a.length;
318
+ a -= i.length;
123
319
  }
124
320
  try {
125
- const a = document.createRange();
126
- a.selectNodeContents(r), a.collapse(!1);
127
- const l = window.getSelection();
128
- l?.removeAllRanges(), l?.addRange(a);
321
+ const i = document.createRange();
322
+ i.selectNodeContents(n), i.collapse(!1);
323
+ const c = window.getSelection();
324
+ c?.removeAllRanges(), c?.addRange(i);
129
325
  } catch {
130
326
  }
131
327
  }
132
- const le = ({
133
- html: i,
328
+ const qe = be.memo(({ html: s, isEditable: e, isTable: t }) => /* @__PURE__ */ r(
329
+ "div",
330
+ {
331
+ className: "dopecanvas-block-content",
332
+ contentEditable: e && !t ? !0 : void 0,
333
+ suppressContentEditableWarning: !0,
334
+ dangerouslySetInnerHTML: { __html: s }
335
+ }
336
+ )), Ne = ({
337
+ html: s,
134
338
  css: e,
135
339
  pageConfig: t,
136
- layoutEngine: r,
137
- editableManager: n,
138
- onContentChange: s,
139
- onPaginationChange: a
340
+ layoutEngine: n,
341
+ editableManager: o,
342
+ onContentChange: a,
343
+ onPaginationChange: i
140
344
  }) => {
141
- const l = M(null), h = M(null), v = M(null), c = M(s);
142
- c.current = s;
143
- const [d, L] = R([]), m = M(null), C = M(!1), b = M([]), B = typeof t.size == "string" ? ee[t.size] : t.size, F = p(() => {
144
- if (!h.current) return;
145
- const g = h.current.querySelectorAll(
146
- ".dopecanvas-block-wrapper"
147
- ), H = [];
148
- g.forEach((y) => {
149
- const f = y.firstElementChild;
150
- f && H.push(f.outerHTML);
345
+ const c = H(null), g = H(null), S = H(null), d = H(a);
346
+ d.current = a;
347
+ const [p, k] = R([]), A = H(null), y = H(!1), E = H([]), [D, q] = R(null), [B, j] = R(null), [m, x] = R(""), P = H(null), I = typeof t.size == "string" ? ue[t.size] : t.size, V = h(() => {
348
+ if (!g.current) return;
349
+ const u = g.current.querySelectorAll(
350
+ ".dopecanvas-block-content"
351
+ ), l = [];
352
+ u.forEach((b) => {
353
+ const f = b.firstElementChild;
354
+ f && l.push(f.outerHTML);
151
355
  });
152
- const T = H.join(`
356
+ const w = l.join(`
153
357
  `);
154
- c.current?.(T);
155
- }, []), N = p(() => {
156
- if (!h.current || !l.current) return;
157
- const g = h.current, H = ae(g), T = g.querySelectorAll(".dopecanvas-block-wrapper"), y = [];
158
- if (T.forEach((S) => {
159
- const D = S.firstElementChild;
160
- D && y.push(D.outerHTML);
161
- }), y.length === 0) return;
162
- const f = l.current, P = r.getContentAreaWidth();
163
- if (f.style.width = `${P}px`, f.style.position = "absolute", f.style.left = "-9999px", f.style.top = "0", f.style.visibility = "hidden", f.innerHTML = "", e) {
164
- const S = document.createElement("style");
165
- S.textContent = e, f.appendChild(S);
166
- }
167
- const k = document.createElement("div");
168
- k.innerHTML = y.join(`
169
- `), f.appendChild(k);
170
- const A = r.measureBlocks(k), I = A.map(
171
- (S) => S.element.cloneNode(!0).outerHTML
172
- ), w = r.paginate(A);
173
- f.innerHTML = "";
174
- const q = w.pages.map((S) => ({
175
- blocks: S.blockIndices.map((D) => I[D])
176
- })), $ = b.current.map((S) => S.blocks.length), V = q.map((S) => S.blocks.length);
177
- ($.length !== V.length || $.some((S, D) => S !== V[D])) && (C.current = !0, m.current = H, b.current = q, L(q), a?.(w));
178
- }, [e, r, a]), u = M(N);
179
- u.current = N;
180
- const E = p(() => {
181
- if (!l.current) return;
182
- const g = l.current, H = r.getContentAreaWidth();
183
- if (g.style.width = `${H}px`, g.style.position = "absolute", g.style.left = "-9999px", g.style.top = "0", g.style.visibility = "hidden", g.innerHTML = "", e) {
184
- const w = document.createElement("style");
185
- w.textContent = e, g.appendChild(w);
358
+ d.current?.(w);
359
+ }, []), _ = h((u) => {
360
+ if (!c.current) return;
361
+ const l = c.current;
362
+ if (l.style.width = `${n.getContentAreaWidth()}px`, l.style.position = "absolute", l.style.left = "-9999px", l.style.top = "0", l.style.visibility = "hidden", l.innerHTML = "", e) {
363
+ const M = document.createElement("style");
364
+ M.textContent = e, l.appendChild(M);
186
365
  }
187
- const T = new DOMParser().parseFromString(i, "text/html");
188
- T.head.querySelectorAll('style, link[rel="stylesheet"]').forEach((w) => {
189
- T.body.insertBefore(w, T.body.firstChild);
190
- });
191
- const y = T.body.innerHTML, f = document.createElement("div");
192
- f.innerHTML = y, g.appendChild(f);
193
- const P = r.measureBlocks(f), k = P.map(
194
- (w) => w.element.cloneNode(!0).outerHTML
195
- ), A = r.paginate(P), I = A.pages.map((w) => ({
196
- blocks: w.blockIndices.map((q) => k[q])
366
+ const w = document.createElement("div");
367
+ w.innerHTML = u, l.appendChild(w);
368
+ const b = n.measureBlocks(w), f = b.map(
369
+ (M) => M.element.cloneNode(!0).outerHTML
370
+ ), v = n.paginate(b), T = v.pages.map((M) => ({
371
+ blocks: M.blockIndices.map((N) => f[N])
197
372
  }));
198
- g.innerHTML = "", b.current = I, L(I), a?.(A);
199
- }, [i, e, r, a]);
200
- return _(() => {
201
- E();
202
- }, [E]), _(() => {
203
- const g = h.current;
204
- if (!g) return;
205
- v.current && v.current.disconnect(), g.querySelectorAll(".dopecanvas-block-wrapper").forEach((P) => {
206
- const k = P.firstElementChild;
207
- k && (k.tagName === "TABLE" ? k.querySelectorAll("td, th").forEach((I) => {
208
- I.contentEditable = "true";
209
- }) : k.tagName === "SCRIPT" || k.tagName === "STYLE" || (k.contentEditable = "true"));
373
+ l.innerHTML = "", E.current = T, k(T), i?.(v), d.current?.(u);
374
+ }, [e, n, i]), J = h(() => {
375
+ if (!g.current || !c.current) return;
376
+ const u = g.current, l = ze(u), w = u.querySelectorAll(".dopecanvas-block-content"), b = [];
377
+ if (w.forEach((L) => {
378
+ const W = L.firstElementChild;
379
+ W && b.push(W.outerHTML);
380
+ }), b.length === 0) return;
381
+ const f = c.current, v = n.getContentAreaWidth();
382
+ if (f.style.width = `${v}px`, f.style.position = "absolute", f.style.left = "-9999px", f.style.top = "0", f.style.visibility = "hidden", f.innerHTML = "", e) {
383
+ const L = document.createElement("style");
384
+ L.textContent = e, f.appendChild(L);
385
+ }
386
+ const T = document.createElement("div");
387
+ T.innerHTML = b.join(`
388
+ `), f.appendChild(T);
389
+ const M = n.measureBlocks(T), N = M.map(
390
+ (L) => L.element.cloneNode(!0).outerHTML
391
+ ), O = n.paginate(M);
392
+ f.innerHTML = "";
393
+ const K = O.pages.map((L) => ({
394
+ blocks: L.blockIndices.map((W) => N[W])
395
+ })), ee = E.current.map((L) => L.blocks.length), te = K.map((L) => L.blocks.length);
396
+ (ee.length !== te.length || ee.some((L, W) => L !== te[W])) && (y.current = !0, A.current = l, E.current = K, k(K), i?.(O));
397
+ }, [e, n, i]), Q = H(J);
398
+ Q.current = J;
399
+ const Y = h(() => {
400
+ const u = new DOMParser().parseFromString(s, "text/html");
401
+ u.head.querySelectorAll('style, link[rel="stylesheet"]').forEach((l) => {
402
+ u.body.insertBefore(l, u.body.firstChild);
403
+ }), _(u.body.innerHTML);
404
+ }, [s, _]);
405
+ F(() => {
406
+ Y();
407
+ }, [Y]);
408
+ const z = h(() => {
409
+ if (!g.current) return [];
410
+ const u = g.current.querySelectorAll(
411
+ ".dopecanvas-block-content"
412
+ ), l = [];
413
+ return u.forEach((w) => {
414
+ const b = w.firstElementChild;
415
+ b && l.push(b.outerHTML);
416
+ }), l;
417
+ }, []), he = h(
418
+ (u) => {
419
+ const l = z();
420
+ l.splice(
421
+ u + 1,
422
+ 0,
423
+ '<p style="min-height: 1.5em; line-height: 1.6;">&nbsp;</p>'
424
+ ), q(null), _(l.join(`
425
+ `));
426
+ },
427
+ [z, _]
428
+ ), ge = h(
429
+ (u) => {
430
+ const l = z();
431
+ l.length <= 1 || (l.splice(u, 1), q(null), _(l.join(`
432
+ `)));
433
+ },
434
+ [z, _]
435
+ ), pe = h(
436
+ (u) => {
437
+ const l = z();
438
+ u < l.length && (j(u), x(l[u]));
439
+ },
440
+ [z]
441
+ ), fe = h(
442
+ (u) => {
443
+ if (B === null) return;
444
+ const l = z();
445
+ B < l.length && (l[B] = u), j(null), x(""), q(null), _(l.join(`
446
+ `));
447
+ },
448
+ [B, z, _]
449
+ ), me = h(() => {
450
+ j(null), x("");
451
+ }, []);
452
+ return F(() => {
453
+ const u = g.current;
454
+ if (!u) return;
455
+ S.current && S.current.disconnect(), u.querySelectorAll(".dopecanvas-block-content").forEach((v) => {
456
+ const T = v.firstElementChild;
457
+ T && T.tagName === "TABLE" && T.querySelectorAll("td, th").forEach((N) => {
458
+ N.contentEditable = "true";
459
+ });
210
460
  });
211
- const T = oe(g);
212
- let y = null;
461
+ const w = Be(u);
462
+ let b = null;
213
463
  const f = new MutationObserver(() => {
214
- C.current || (y && clearTimeout(y), y = setTimeout(() => {
215
- F(), u.current();
464
+ y.current || (b && clearTimeout(b), b = setTimeout(() => {
465
+ V(), Q.current();
216
466
  }, 300));
217
467
  });
218
- return f.observe(g, {
468
+ return f.observe(u, {
219
469
  childList: !0,
220
470
  subtree: !0,
221
471
  characterData: !0,
222
472
  attributes: !1
223
- }), v.current = f, m.current ? requestAnimationFrame(() => {
224
- m.current && h.current && (se(
225
- h.current,
226
- m.current
227
- ), m.current = null), C.current = !1;
228
- }) : C.current = !1, () => {
229
- f.disconnect(), T.forEach((P) => P.remove()), y && clearTimeout(y);
473
+ }), S.current = f, A.current ? requestAnimationFrame(() => {
474
+ A.current && g.current && (Fe(
475
+ g.current,
476
+ A.current
477
+ ), A.current = null), y.current = !1;
478
+ }) : y.current = !1, () => {
479
+ f.disconnect(), w.forEach((v) => v.remove()), b && clearTimeout(b);
230
480
  };
231
- }, [d, F]), /* @__PURE__ */ x("div", { className: "dopecanvas-paged-view", style: ce, children: [
232
- /* @__PURE__ */ o("div", { ref: l, "aria-hidden": "true" }),
233
- /* @__PURE__ */ x("div", { ref: h, style: ue, children: [
234
- e && /* @__PURE__ */ o("style", { dangerouslySetInnerHTML: { __html: e } }),
235
- d.map((g, H) => /* @__PURE__ */ o(
236
- G,
237
- {
238
- dimensions: B,
239
- margins: t.margins,
240
- pageNumber: H + 1,
241
- totalPages: d.length,
242
- children: g.blocks.map((T, y) => /* @__PURE__ */ o(
243
- "div",
244
- {
245
- className: "dopecanvas-block-wrapper",
246
- dangerouslySetInnerHTML: { __html: T }
247
- },
248
- `${H}-${y}`
249
- ))
250
- },
251
- H
252
- )),
253
- d.length === 0 && /* @__PURE__ */ o(
254
- G,
481
+ }, [p, V]), /* @__PURE__ */ C("div", { className: "dopecanvas-paged-view", style: We, children: [
482
+ /* @__PURE__ */ r("div", { ref: c, "aria-hidden": "true" }),
483
+ /* @__PURE__ */ C("div", { ref: g, style: je, children: [
484
+ e && /* @__PURE__ */ r("style", { dangerouslySetInnerHTML: { __html: e } }),
485
+ p.map((u, l) => {
486
+ const w = p.slice(0, l).reduce((b, f) => b + f.blocks.length, 0);
487
+ return /* @__PURE__ */ r(
488
+ oe,
489
+ {
490
+ dimensions: I,
491
+ margins: t.margins,
492
+ pageNumber: l + 1,
493
+ totalPages: p.length,
494
+ children: u.blocks.map((b, f) => {
495
+ const v = w + f, T = b.trim().toLowerCase(), M = !T.startsWith("<script") && !T.startsWith("<style"), N = T.startsWith("<table");
496
+ return /* @__PURE__ */ C(
497
+ "div",
498
+ {
499
+ className: "dopecanvas-block-wrapper",
500
+ style: { position: "relative" },
501
+ onMouseEnter: () => {
502
+ M && (P.current && (clearTimeout(P.current), P.current = null), q(v));
503
+ },
504
+ onMouseLeave: () => {
505
+ P.current = setTimeout(() => {
506
+ q(
507
+ (O) => O === v ? null : O
508
+ );
509
+ }, 250);
510
+ },
511
+ children: [
512
+ /* @__PURE__ */ r(
513
+ qe,
514
+ {
515
+ html: b,
516
+ isEditable: M,
517
+ isTable: N
518
+ }
519
+ ),
520
+ M && /* @__PURE__ */ r(
521
+ ve,
522
+ {
523
+ visible: D === v,
524
+ onAddBelow: () => he(v),
525
+ onEditHTML: () => pe(v),
526
+ onDelete: () => ge(v)
527
+ }
528
+ )
529
+ ]
530
+ },
531
+ `${l}-${f}`
532
+ );
533
+ })
534
+ },
535
+ l
536
+ );
537
+ }),
538
+ p.length === 0 && /* @__PURE__ */ r(
539
+ oe,
255
540
  {
256
- dimensions: B,
541
+ dimensions: I,
257
542
  margins: t.margins,
258
543
  pageNumber: 1,
259
544
  totalPages: 1,
260
- children: /* @__PURE__ */ o(
545
+ children: /* @__PURE__ */ r(
261
546
  "div",
262
547
  {
263
548
  contentEditable: "true",
@@ -267,25 +552,33 @@ const le = ({
267
552
  )
268
553
  }
269
554
  )
270
- ] })
555
+ ] }),
556
+ B !== null && /* @__PURE__ */ r(
557
+ He,
558
+ {
559
+ html: m,
560
+ onSave: fe,
561
+ onCancel: me
562
+ }
563
+ )
271
564
  ] });
272
- }, ce = {
565
+ }, We = {
273
566
  flex: 1,
274
567
  overflow: "auto",
275
568
  backgroundColor: "#e8e8e8",
276
569
  display: "flex",
277
570
  flexDirection: "column",
278
571
  alignItems: "center"
279
- }, ue = {
572
+ }, je = {
280
573
  display: "flex",
281
574
  flexDirection: "column",
282
575
  alignItems: "center",
283
576
  gap: "24px",
284
577
  padding: "24px 0"
285
578
  };
286
- class te {
579
+ class de {
287
580
  config;
288
- constructor(e = O) {
581
+ constructor(e = G) {
289
582
  this.config = { ...e };
290
583
  }
291
584
  // ----------------------------------------------------------
@@ -299,7 +592,7 @@ class te {
299
592
  }
300
593
  /** Resolve page size name to pixel dimensions */
301
594
  getPageDimensions() {
302
- return typeof this.config.size == "string" ? ee[this.config.size] : this.config.size;
595
+ return typeof this.config.size == "string" ? ue[this.config.size] : this.config.size;
303
596
  }
304
597
  /** Usable content area height (page height minus top+bottom margins) */
305
598
  getContentAreaHeight() {
@@ -318,18 +611,18 @@ class te {
318
611
  * so that measurements reflect actual rendered heights.
319
612
  */
320
613
  measureBlocks(e) {
321
- const t = Array.from(e.children), r = [];
322
- for (let n = 0; n < t.length; n++) {
323
- const s = t[n], a = window.getComputedStyle(s), l = a.getPropertyValue("break-before") === "page" || a.getPropertyValue("page-break-before") === "always", h = a.getPropertyValue("break-after") === "page" || a.getPropertyValue("page-break-after") === "always", v = s.getBoundingClientRect(), c = parseFloat(a.marginTop) || 0, d = parseFloat(a.marginBottom) || 0, L = v.height + c + d;
324
- r.push({
325
- index: n,
326
- height: L,
327
- element: s,
328
- breakBefore: l,
329
- breakAfter: h
614
+ const t = Array.from(e.children), n = [];
615
+ for (let o = 0; o < t.length; o++) {
616
+ const a = t[o], i = window.getComputedStyle(a), c = i.getPropertyValue("break-before") === "page" || i.getPropertyValue("page-break-before") === "always", g = i.getPropertyValue("break-after") === "page" || i.getPropertyValue("page-break-after") === "always", S = a.getBoundingClientRect(), d = parseFloat(i.marginTop) || 0, p = parseFloat(i.marginBottom) || 0, k = S.height + d + p;
617
+ n.push({
618
+ index: o,
619
+ height: k,
620
+ element: a,
621
+ breakBefore: c,
622
+ breakAfter: g
330
623
  });
331
624
  }
332
- return r;
625
+ return n;
333
626
  }
334
627
  // ----------------------------------------------------------
335
628
  // Pagination
@@ -347,19 +640,19 @@ class te {
347
640
  paginate(e) {
348
641
  if (e.length === 0)
349
642
  return { pages: [{ blockIndices: [] }], pageCount: 1 };
350
- const t = this.getContentAreaHeight(), r = [];
351
- let n = [], s = 0;
352
- for (let a = 0; a < e.length; a++) {
353
- const l = e[a];
354
- l.breakBefore && n.length > 0 && (r.push({ blockIndices: n }), n = [], s = 0), s + l.height > t && n.length > 0 && (r.push({ blockIndices: n }), n = [], s = 0), n.push(l.index), s += l.height, l.breakAfter && (r.push({ blockIndices: n }), n = [], s = 0);
643
+ const t = this.getContentAreaHeight(), n = [];
644
+ let o = [], a = 0;
645
+ for (let i = 0; i < e.length; i++) {
646
+ const c = e[i];
647
+ c.breakBefore && o.length > 0 && (n.push({ blockIndices: o }), o = [], a = 0), a + c.height > t && o.length > 0 && (n.push({ blockIndices: o }), o = [], a = 0), o.push(c.index), a += c.height, c.breakAfter && (n.push({ blockIndices: o }), o = [], a = 0);
355
648
  }
356
- return n.length > 0 && r.push({ blockIndices: n }), r.length === 0 && r.push({ blockIndices: [] }), {
357
- pages: r,
358
- pageCount: r.length
649
+ return o.length > 0 && n.push({ blockIndices: o }), n.length === 0 && n.push({ blockIndices: [] }), {
650
+ pages: n,
651
+ pageCount: n.length
359
652
  };
360
653
  }
361
654
  }
362
- class z {
655
+ class $ {
363
656
  observer = null;
364
657
  changeCallbacks = /* @__PURE__ */ new Set();
365
658
  contextCallbacks = /* @__PURE__ */ new Set();
@@ -402,12 +695,12 @@ class z {
402
695
  */
403
696
  makeChildrenEditable(e) {
404
697
  const t = Array.from(e.children);
405
- for (const r of t)
406
- r.tagName === "TABLE" ? this.makeTableCellsEditable(r) : r.contentEditable = "true";
698
+ for (const n of t)
699
+ n.tagName === "TABLE" ? this.makeTableCellsEditable(n) : n.contentEditable = "true";
407
700
  }
408
701
  makeTableCellsEditable(e) {
409
- e.querySelectorAll("td, th").forEach((r) => {
410
- r.contentEditable = "true";
702
+ e.querySelectorAll("td, th").forEach((n) => {
703
+ n.contentEditable = "true";
411
704
  });
412
705
  }
413
706
  // ----------------------------------------------------------
@@ -416,7 +709,7 @@ class z {
416
709
  handleMutations = (e) => {
417
710
  this.debounceTimer && clearTimeout(this.debounceTimer), this.debounceTimer = setTimeout(() => {
418
711
  this.pushUndoSnapshot(), this.notifyChange();
419
- }, z.DEBOUNCE_MS);
712
+ }, $.DEBOUNCE_MS);
420
713
  };
421
714
  // ----------------------------------------------------------
422
715
  // Selection / context detection
@@ -427,27 +720,27 @@ class z {
427
720
  this.setContext("none");
428
721
  return;
429
722
  }
430
- const r = e.getRangeAt(0).startContainer;
431
- let n = r;
432
- for (; n && n !== this.container; ) {
433
- if (n instanceof HTMLElement) {
434
- const s = n.tagName;
435
- if (s === "TD" || s === "TH" || s === "TABLE") {
723
+ const n = e.getRangeAt(0).startContainer;
724
+ let o = n;
725
+ for (; o && o !== this.container; ) {
726
+ if (o instanceof HTMLElement) {
727
+ const a = o.tagName;
728
+ if (a === "TD" || a === "TH" || a === "TABLE") {
436
729
  this.setContext("table");
437
730
  return;
438
731
  }
439
- if (s === "IMG") {
732
+ if (a === "IMG") {
440
733
  this.setContext("image");
441
734
  return;
442
735
  }
443
- if (n.dataset?.dopecanvasChart) {
736
+ if (o.dataset?.dopecanvasChart) {
444
737
  this.setContext("chart");
445
738
  return;
446
739
  }
447
740
  }
448
- n = n.parentNode;
741
+ o = o.parentNode;
449
742
  }
450
- this.container.contains(r) ? this.setContext("text") : this.setContext("none");
743
+ this.container.contains(n) ? this.setContext("text") : this.setContext("none");
451
744
  }
452
745
  setContext(e) {
453
746
  e !== this.currentContext && (this.currentContext = e, this.contextCallbacks.forEach((t) => t(e)));
@@ -461,7 +754,7 @@ class z {
461
754
  pushUndoSnapshot() {
462
755
  if (!this.container) return;
463
756
  const e = this.container.innerHTML, t = this.undoStack[this.undoStack.length - 1];
464
- t && t.html === e || (this.undoStack.push({ html: e, timestamp: Date.now() }), this.redoStack = [], this.undoStack.length > z.MAX_UNDO_STACK && this.undoStack.shift());
757
+ t && t.html === e || (this.undoStack.push({ html: e, timestamp: Date.now() }), this.redoStack = [], this.undoStack.length > $.MAX_UNDO_STACK && this.undoStack.shift());
465
758
  }
466
759
  undo() {
467
760
  if (!this.container || this.undoStack.length <= 1) return !1;
@@ -533,65 +826,91 @@ class z {
533
826
  return this.container && (this.container.innerText || this.container.textContent) || "";
534
827
  }
535
828
  }
536
- const Me = ne(({
537
- html: i = "",
829
+ const rt = Ce(({
830
+ html: s = "",
538
831
  css: e,
539
832
  pageConfig: t,
540
- onContentChange: r,
541
- onPageConfigChange: n,
542
- style: s
543
- }, a) => {
544
- const [l, h] = R(
545
- t || O
546
- ), [v, c] = R({
833
+ onContentChange: n,
834
+ onPageConfigChange: o,
835
+ style: a
836
+ }, i) => {
837
+ const [c, g] = R(
838
+ t || G
839
+ ), [S, d] = R({
547
840
  pages: [],
548
841
  pageCount: 0
549
- }), d = M(i), L = M(r);
550
- L.current = r;
551
- const m = t || l, C = U(() => new te(m), []), b = U(() => new z(), []);
552
- _(() => {
553
- C.setConfig(m);
554
- }, [m, C]);
555
- const B = p(
556
- (u) => {
557
- d.current = u, L.current?.(u);
842
+ }), p = H(s), k = H(null), A = H(n);
843
+ A.current = n;
844
+ const y = t || c, E = ne(() => new de(y), []), D = ne(() => new $(), []);
845
+ F(() => {
846
+ E.setConfig(y);
847
+ }, [y, E]);
848
+ const q = h(
849
+ (m) => {
850
+ p.current = m, A.current?.(m);
558
851
  },
559
852
  []
560
- ), F = p(
561
- (u) => {
562
- const E = {
853
+ ), B = h(
854
+ (m) => {
855
+ const x = {
856
+ ...y,
563
857
  ...m,
564
- ...u,
565
858
  margins: {
566
- ...m.margins,
567
- ...u.margins || {}
859
+ ...y.margins,
860
+ ...m.margins || {}
568
861
  }
569
862
  };
570
- h(E), C.setConfig(E), n?.(E);
863
+ g(x), E.setConfig(x), o?.(x);
571
864
  },
572
- [m, C, n]
573
- ), N = p((u) => {
574
- c(u);
865
+ [y, E, o]
866
+ ), j = h((m) => {
867
+ d(m);
575
868
  }, []);
576
- return re(a, () => ({
577
- execCommand: (u, E) => b.execCommand(u, E),
578
- queryCommandState: (u) => b.queryCommandState(u),
579
- queryCommandValue: (u) => b.queryCommandValue(u),
580
- getPageConfig: () => ({ ...m }),
581
- setPageConfig: (u) => {
582
- F(u);
869
+ return ye(i, () => ({
870
+ execCommand: (m, x) => D.execCommand(m, x),
871
+ queryCommandState: (m) => D.queryCommandState(m),
872
+ queryCommandValue: (m) => D.queryCommandValue(m),
873
+ getPageConfig: () => ({ ...y }),
874
+ setPageConfig: (m) => {
875
+ B(m);
876
+ },
877
+ getPageCount: () => S.pageCount,
878
+ getHTML: () => {
879
+ if (k.current) {
880
+ const m = k.current.querySelectorAll(
881
+ ".dopecanvas-block-content"
882
+ );
883
+ if (m.length > 0) {
884
+ const x = [];
885
+ if (m.forEach((P) => {
886
+ const I = P.firstElementChild;
887
+ I && x.push(I.outerHTML);
888
+ }), x.length > 0) {
889
+ const P = x.join(`
890
+ `);
891
+ return p.current = P, P;
892
+ }
893
+ }
894
+ }
895
+ return p.current;
583
896
  },
584
- getPageCount: () => v.pageCount,
585
- getHTML: () => d.current,
586
897
  getPlainText: () => {
587
- const u = document.createElement("div");
588
- return u.innerHTML = d.current, u.innerText || u.textContent || "";
898
+ const m = k.current ? (() => {
899
+ const P = k.current.querySelectorAll(".dopecanvas-block-content"), I = [];
900
+ return P.forEach((V) => {
901
+ const _ = V.firstElementChild;
902
+ _ && I.push(_.outerHTML);
903
+ }), I.length > 0 ? I.join(`
904
+ `) : p.current;
905
+ })() : p.current, x = document.createElement("div");
906
+ return x.innerHTML = m, x.innerText || x.textContent || "";
589
907
  },
590
- undo: () => b.undo(),
591
- redo: () => b.redo()
592
- }), [b, m, v.pageCount, F]), /* @__PURE__ */ o(
908
+ undo: () => D.undo(),
909
+ redo: () => D.redo()
910
+ }), [D, y, S.pageCount, B]), /* @__PURE__ */ r(
593
911
  "div",
594
912
  {
913
+ ref: k,
595
914
  className: "dopecanvas-root",
596
915
  style: {
597
916
  display: "flex",
@@ -599,24 +918,24 @@ const Me = ne(({
599
918
  height: "100%",
600
919
  width: "100%",
601
920
  fontFamily: "system-ui, -apple-system, BlinkMacSystemFont, sans-serif",
602
- ...s
921
+ ...a
603
922
  },
604
- children: /* @__PURE__ */ o(
605
- le,
923
+ children: /* @__PURE__ */ r(
924
+ Ne,
606
925
  {
607
- html: i,
926
+ html: s,
608
927
  css: e,
609
- pageConfig: m,
610
- layoutEngine: C,
611
- editableManager: b,
612
- onContentChange: B,
613
- onPaginationChange: N
928
+ pageConfig: y,
929
+ layoutEngine: E,
930
+ editableManager: D,
931
+ onContentChange: q,
932
+ onPaginationChange: j
614
933
  }
615
934
  )
616
935
  }
617
936
  );
618
937
  });
619
- class he {
938
+ class Oe {
620
939
  layoutEngine;
621
940
  editableManager;
622
941
  sourceHTML = "";
@@ -626,8 +945,8 @@ class he {
626
945
  paginationResult = { pages: [], pageCount: 0 };
627
946
  paginationCallbacks = /* @__PURE__ */ new Set();
628
947
  changeCallbacks = /* @__PURE__ */ new Set();
629
- constructor(e = O) {
630
- this.layoutEngine = new te(e), this.editableManager = new z();
948
+ constructor(e = G) {
949
+ this.layoutEngine = new de(e), this.editableManager = new $();
631
950
  }
632
951
  // ----------------------------------------------------------
633
952
  // Accessors
@@ -695,10 +1014,10 @@ class he {
695
1014
  this.measureContainer.style.width = `${e}px`, this.measureContainer.style.position = "absolute", this.measureContainer.style.left = "-9999px", this.measureContainer.style.top = "0", this.measureContainer.style.visibility = "hidden";
696
1015
  let t = null;
697
1016
  this.sourceCSS && (t = document.createElement("style"), t.textContent = this.sourceCSS, this.measureContainer.appendChild(t));
698
- const r = document.createElement("div");
699
- r.innerHTML = this.sourceHTML, this.measureContainer.appendChild(r);
700
- const n = this.layoutEngine.measureBlocks(r);
701
- return this.paginationResult = this.layoutEngine.paginate(n), this.measureContainer.innerHTML = "", this.paginationCallbacks.forEach((s) => s(this.paginationResult)), { result: this.paginationResult, measurements: n };
1017
+ const n = document.createElement("div");
1018
+ n.innerHTML = this.sourceHTML, this.measureContainer.appendChild(n);
1019
+ const o = this.layoutEngine.measureBlocks(n);
1020
+ return this.paginationResult = this.layoutEngine.paginate(o), this.measureContainer.innerHTML = "", this.paginationCallbacks.forEach((a) => a(this.paginationResult)), { result: this.paginationResult, measurements: o };
702
1021
  }
703
1022
  /**
704
1023
  * Re-paginate using the current content container's live DOM.
@@ -757,7 +1076,7 @@ class he {
757
1076
  this.editableManager.detach(), this.paginationCallbacks.clear(), this.changeCallbacks.clear(), this.measureContainer = null, this.contentContainer = null;
758
1077
  }
759
1078
  }
760
- class Le {
1079
+ class it {
761
1080
  _html = "";
762
1081
  _css = "";
763
1082
  _pageConfig = null;
@@ -777,7 +1096,7 @@ class Le {
777
1096
  * Optionally provide CSS to inject alongside.
778
1097
  */
779
1098
  loadHTML(e, t) {
780
- this._html = e, this._css = t || "", this._loadCallbacks.forEach((r) => r(e, t));
1099
+ this._html = e, this._css = t || "", this._loadCallbacks.forEach((n) => n(e, t));
781
1100
  }
782
1101
  /**
783
1102
  * Get the current document HTML content.
@@ -869,18 +1188,18 @@ class Le {
869
1188
  getElementContent(e) {
870
1189
  const t = document.createElement("div");
871
1190
  t.innerHTML = this.getHTML();
872
- const r = t.querySelector(`#${e}`);
873
- return r ? r.innerHTML : null;
1191
+ const n = t.querySelector(`#${e}`);
1192
+ return n ? n.innerHTML : null;
874
1193
  }
875
1194
  /**
876
1195
  * Set the innerHTML of a specific element by its ID.
877
1196
  * Re-loads the full document with the modification.
878
1197
  */
879
1198
  setElementContent(e, t) {
880
- const r = document.createElement("div");
881
- r.innerHTML = this.getHTML();
882
- const n = r.querySelector(`#${e}`);
883
- n && (n.innerHTML = t, this.loadHTML(r.innerHTML, this._css));
1199
+ const n = document.createElement("div");
1200
+ n.innerHTML = this.getHTML();
1201
+ const o = n.querySelector(`#${e}`);
1202
+ o && (o.innerHTML = t, this.loadHTML(n.innerHTML, this._css));
884
1203
  }
885
1204
  // ----------------------------------------------------------
886
1205
  // Internal connectors (used by DopeCanvas component)
@@ -906,14 +1225,14 @@ class Le {
906
1225
  this._pageConfig = e;
907
1226
  }
908
1227
  }
909
- function He(i) {
1228
+ function st(s) {
910
1229
  const [e, t] = R("none");
911
- return _(() => i ? i.onContextChange((n) => {
912
- t(n);
913
- }) : void 0, [i]), e;
1230
+ return F(() => s ? s.onContextChange((o) => {
1231
+ t(o);
1232
+ }) : void 0, [s]), e;
914
1233
  }
915
- function de() {
916
- const [i, e] = R({
1234
+ function $e() {
1235
+ const [s, e] = R({
917
1236
  bold: !1,
918
1237
  italic: !1,
919
1238
  underline: !1,
@@ -922,7 +1241,7 @@ function de() {
922
1241
  justifyCenter: !1,
923
1242
  justifyRight: !1,
924
1243
  justifyFull: !1
925
- }), t = p(() => {
1244
+ }), t = h(() => {
926
1245
  e({
927
1246
  bold: document.queryCommandState("bold"),
928
1247
  italic: document.queryCommandState("italic"),
@@ -934,146 +1253,146 @@ function de() {
934
1253
  justifyFull: document.queryCommandState("justifyFull")
935
1254
  });
936
1255
  }, []);
937
- return _(() => (document.addEventListener("selectionchange", t), () => {
1256
+ return F(() => (document.addEventListener("selectionchange", t), () => {
938
1257
  document.removeEventListener("selectionchange", t);
939
- }), [t]), i;
1258
+ }), [t]), s;
940
1259
  }
941
- const ge = ({ onExecCommand: i }) => {
942
- const e = de(), t = M(null), r = p(() => {
943
- const c = window.getSelection();
944
- c && c.rangeCount > 0 && (t.current = c.getRangeAt(0).cloneRange());
945
- }, []), n = p(() => {
946
- const c = t.current;
947
- if (!c) return;
1260
+ const Ve = ({ onExecCommand: s }) => {
1261
+ const e = $e(), t = H(null), n = h(() => {
948
1262
  const d = window.getSelection();
949
- d && (d.removeAllRanges(), d.addRange(c));
950
- }, []), s = p(
951
- (c, d) => (L) => {
952
- L.preventDefault(), i(c, d);
1263
+ d && d.rangeCount > 0 && (t.current = d.getRangeAt(0).cloneRange());
1264
+ }, []), o = h(() => {
1265
+ const d = t.current;
1266
+ if (!d) return;
1267
+ const p = window.getSelection();
1268
+ p && (p.removeAllRanges(), p.addRange(d));
1269
+ }, []), a = h(
1270
+ (d, p) => (k) => {
1271
+ k.preventDefault(), s(d, p);
953
1272
  },
954
- [i]
955
- ), a = p(
956
- (c) => {
957
- n(), i("fontSize", c.target.value);
1273
+ [s]
1274
+ ), i = h(
1275
+ (d) => {
1276
+ o(), s("fontSize", d.target.value);
958
1277
  },
959
- [i, n]
960
- ), l = p(
961
- (c) => {
962
- n();
963
- const d = c.target.value;
964
- d === "p" ? i("formatBlock", "p") : i("formatBlock", d);
1278
+ [s, o]
1279
+ ), c = h(
1280
+ (d) => {
1281
+ o();
1282
+ const p = d.target.value;
1283
+ p === "p" ? s("formatBlock", "p") : s("formatBlock", p);
965
1284
  },
966
- [i, n]
967
- ), h = p(
968
- (c) => {
969
- n(), i("foreColor", c.target.value);
1285
+ [s, o]
1286
+ ), g = h(
1287
+ (d) => {
1288
+ o(), s("foreColor", d.target.value);
970
1289
  },
971
- [i, n]
972
- ), v = p(
973
- (c) => {
974
- n(), i("hiliteColor", c.target.value);
1290
+ [s, o]
1291
+ ), S = h(
1292
+ (d) => {
1293
+ o(), s("hiliteColor", d.target.value);
975
1294
  },
976
- [i, n]
1295
+ [s, o]
977
1296
  );
978
- return /* @__PURE__ */ x("div", { style: pe, children: [
979
- /* @__PURE__ */ x(
1297
+ return /* @__PURE__ */ C("div", { style: Ue, children: [
1298
+ /* @__PURE__ */ C(
980
1299
  "select",
981
1300
  {
982
- onChange: l,
1301
+ onChange: c,
983
1302
  defaultValue: "p",
984
- style: K,
1303
+ style: ie,
985
1304
  title: "Block Format",
986
- onMouseDown: r,
1305
+ onMouseDown: n,
987
1306
  children: [
988
- /* @__PURE__ */ o("option", { value: "p", children: "Paragraph" }),
989
- /* @__PURE__ */ o("option", { value: "h1", children: "Heading 1" }),
990
- /* @__PURE__ */ o("option", { value: "h2", children: "Heading 2" }),
991
- /* @__PURE__ */ o("option", { value: "h3", children: "Heading 3" }),
992
- /* @__PURE__ */ o("option", { value: "h4", children: "Heading 4" }),
993
- /* @__PURE__ */ o("option", { value: "h5", children: "Heading 5" }),
994
- /* @__PURE__ */ o("option", { value: "h6", children: "Heading 6" })
1307
+ /* @__PURE__ */ r("option", { value: "p", children: "Paragraph" }),
1308
+ /* @__PURE__ */ r("option", { value: "h1", children: "Heading 1" }),
1309
+ /* @__PURE__ */ r("option", { value: "h2", children: "Heading 2" }),
1310
+ /* @__PURE__ */ r("option", { value: "h3", children: "Heading 3" }),
1311
+ /* @__PURE__ */ r("option", { value: "h4", children: "Heading 4" }),
1312
+ /* @__PURE__ */ r("option", { value: "h5", children: "Heading 5" }),
1313
+ /* @__PURE__ */ r("option", { value: "h6", children: "Heading 6" })
995
1314
  ]
996
1315
  }
997
1316
  ),
998
- /* @__PURE__ */ o("div", { style: j }),
999
- /* @__PURE__ */ x(
1317
+ /* @__PURE__ */ r("div", { style: Z }),
1318
+ /* @__PURE__ */ C(
1000
1319
  "select",
1001
1320
  {
1002
- onChange: a,
1321
+ onChange: i,
1003
1322
  defaultValue: "3",
1004
- style: K,
1323
+ style: ie,
1005
1324
  title: "Font Size",
1006
- onMouseDown: r,
1325
+ onMouseDown: n,
1007
1326
  children: [
1008
- /* @__PURE__ */ o("option", { value: "1", children: "8pt" }),
1009
- /* @__PURE__ */ o("option", { value: "2", children: "10pt" }),
1010
- /* @__PURE__ */ o("option", { value: "3", children: "12pt" }),
1011
- /* @__PURE__ */ o("option", { value: "4", children: "14pt" }),
1012
- /* @__PURE__ */ o("option", { value: "5", children: "18pt" }),
1013
- /* @__PURE__ */ o("option", { value: "6", children: "24pt" }),
1014
- /* @__PURE__ */ o("option", { value: "7", children: "36pt" })
1327
+ /* @__PURE__ */ r("option", { value: "1", children: "8pt" }),
1328
+ /* @__PURE__ */ r("option", { value: "2", children: "10pt" }),
1329
+ /* @__PURE__ */ r("option", { value: "3", children: "12pt" }),
1330
+ /* @__PURE__ */ r("option", { value: "4", children: "14pt" }),
1331
+ /* @__PURE__ */ r("option", { value: "5", children: "18pt" }),
1332
+ /* @__PURE__ */ r("option", { value: "6", children: "24pt" }),
1333
+ /* @__PURE__ */ r("option", { value: "7", children: "36pt" })
1015
1334
  ]
1016
1335
  }
1017
1336
  ),
1018
- /* @__PURE__ */ o("div", { style: j }),
1019
- /* @__PURE__ */ o(
1020
- X,
1337
+ /* @__PURE__ */ r("div", { style: Z }),
1338
+ /* @__PURE__ */ r(
1339
+ re,
1021
1340
  {
1022
1341
  icon: "B",
1023
1342
  title: "Bold (Ctrl+B)",
1024
1343
  active: e.bold,
1025
- onMouseDown: s("bold"),
1344
+ onMouseDown: a("bold"),
1026
1345
  extraStyle: { fontWeight: "bold" }
1027
1346
  }
1028
1347
  ),
1029
- /* @__PURE__ */ o(
1030
- X,
1348
+ /* @__PURE__ */ r(
1349
+ re,
1031
1350
  {
1032
1351
  icon: "I",
1033
1352
  title: "Italic (Ctrl+I)",
1034
1353
  active: e.italic,
1035
- onMouseDown: s("italic"),
1354
+ onMouseDown: a("italic"),
1036
1355
  extraStyle: { fontStyle: "italic" }
1037
1356
  }
1038
1357
  ),
1039
- /* @__PURE__ */ o("div", { style: j }),
1040
- /* @__PURE__ */ x("label", { style: Y, title: "Text Color", onMouseDown: r, children: [
1358
+ /* @__PURE__ */ r("div", { style: Z }),
1359
+ /* @__PURE__ */ C("label", { style: se, title: "Text Color", onMouseDown: n, children: [
1041
1360
  "A",
1042
- /* @__PURE__ */ o(
1361
+ /* @__PURE__ */ r(
1043
1362
  "input",
1044
1363
  {
1045
1364
  type: "color",
1046
1365
  defaultValue: "#000000",
1047
- onChange: h,
1048
- style: Z
1366
+ onChange: g,
1367
+ style: ae
1049
1368
  }
1050
1369
  )
1051
1370
  ] }),
1052
- /* @__PURE__ */ x("label", { style: Y, title: "Highlight Color", onMouseDown: r, children: [
1053
- /* @__PURE__ */ o("span", { style: { backgroundColor: "#ffff00", padding: "0 2px" }, children: "A" }),
1054
- /* @__PURE__ */ o(
1371
+ /* @__PURE__ */ C("label", { style: se, title: "Highlight Color", onMouseDown: n, children: [
1372
+ /* @__PURE__ */ r("span", { style: { backgroundColor: "#ffff00", padding: "0 2px" }, children: "A" }),
1373
+ /* @__PURE__ */ r(
1055
1374
  "input",
1056
1375
  {
1057
1376
  type: "color",
1058
1377
  defaultValue: "#ffff00",
1059
- onChange: v,
1060
- style: Z
1378
+ onChange: S,
1379
+ style: ae
1061
1380
  }
1062
1381
  )
1063
1382
  ] })
1064
1383
  ] });
1065
- }, X = ({
1066
- icon: i,
1384
+ }, re = ({
1385
+ icon: s,
1067
1386
  title: e,
1068
1387
  active: t,
1069
- onMouseDown: r,
1070
- extraStyle: n
1071
- }) => /* @__PURE__ */ o(
1388
+ onMouseDown: n,
1389
+ extraStyle: o
1390
+ }) => /* @__PURE__ */ r(
1072
1391
  "button",
1073
1392
  {
1074
1393
  type: "button",
1075
1394
  title: e,
1076
- onMouseDown: r,
1395
+ onMouseDown: n,
1077
1396
  style: {
1078
1397
  width: "28px",
1079
1398
  height: "28px",
@@ -1090,16 +1409,16 @@ const ge = ({ onExecCommand: i }) => {
1090
1409
  color: "#333",
1091
1410
  padding: 0,
1092
1411
  fontFamily: "inherit",
1093
- ...n
1412
+ ...o
1094
1413
  },
1095
- dangerouslySetInnerHTML: { __html: i }
1414
+ dangerouslySetInnerHTML: { __html: s }
1096
1415
  }
1097
- ), pe = {
1416
+ ), Ue = {
1098
1417
  display: "flex",
1099
1418
  alignItems: "center",
1100
1419
  gap: "2px",
1101
1420
  flexWrap: "wrap"
1102
- }, K = {
1421
+ }, ie = {
1103
1422
  height: "28px",
1104
1423
  borderWidth: "1px",
1105
1424
  borderStyle: "solid",
@@ -1109,12 +1428,12 @@ const ge = ({ onExecCommand: i }) => {
1109
1428
  padding: "0 4px",
1110
1429
  cursor: "pointer",
1111
1430
  backgroundColor: "#fff"
1112
- }, j = {
1431
+ }, Z = {
1113
1432
  width: "1px",
1114
1433
  height: "20px",
1115
1434
  backgroundColor: "#ddd",
1116
1435
  margin: "0 4px"
1117
- }, Y = {
1436
+ }, se = {
1118
1437
  position: "relative",
1119
1438
  width: "28px",
1120
1439
  height: "28px",
@@ -1124,7 +1443,7 @@ const ge = ({ onExecCommand: i }) => {
1124
1443
  cursor: "pointer",
1125
1444
  fontSize: "13px",
1126
1445
  fontWeight: "bold"
1127
- }, Z = {
1446
+ }, ae = {
1128
1447
  position: "absolute",
1129
1448
  bottom: 0,
1130
1449
  left: 0,
@@ -1134,114 +1453,114 @@ const ge = ({ onExecCommand: i }) => {
1134
1453
  borderWidth: 0,
1135
1454
  borderStyle: "none",
1136
1455
  cursor: "pointer"
1137
- }, fe = ({
1138
- pageConfig: i,
1456
+ }, Ge = ({
1457
+ pageConfig: s,
1139
1458
  pageCount: e,
1140
1459
  onPageConfigChange: t
1141
1460
  }) => {
1142
- const r = p(
1143
- (a) => {
1144
- const l = a.target.value;
1145
- t({ size: l });
1461
+ const n = h(
1462
+ (i) => {
1463
+ const c = i.target.value;
1464
+ t({ size: c });
1146
1465
  },
1147
1466
  [t]
1148
- ), n = p(
1149
- (a) => (l) => {
1150
- const h = Math.max(0, parseInt(l.target.value) || 0);
1467
+ ), o = h(
1468
+ (i) => (c) => {
1469
+ const g = Math.max(0, parseInt(c.target.value) || 0);
1151
1470
  t({
1152
1471
  margins: {
1153
- ...i.margins,
1154
- [a]: h
1472
+ ...s.margins,
1473
+ [i]: g
1155
1474
  }
1156
1475
  });
1157
1476
  },
1158
- [i.margins, t]
1159
- ), s = typeof i.size == "string" ? i.size : "custom";
1160
- return /* @__PURE__ */ x("div", { style: me, children: [
1161
- /* @__PURE__ */ x("label", { style: Ce, children: [
1477
+ [s.margins, t]
1478
+ ), a = typeof s.size == "string" ? s.size : "custom";
1479
+ return /* @__PURE__ */ C("div", { style: Ke, children: [
1480
+ /* @__PURE__ */ C("label", { style: Xe, children: [
1162
1481
  "Page:",
1163
- /* @__PURE__ */ x(
1482
+ /* @__PURE__ */ C(
1164
1483
  "select",
1165
1484
  {
1166
- value: s,
1167
- onChange: r,
1168
- style: be,
1485
+ value: a,
1486
+ onChange: n,
1487
+ style: Ze,
1169
1488
  children: [
1170
- /* @__PURE__ */ o("option", { value: "letter", children: "Letter (8.5 x 11)" }),
1171
- /* @__PURE__ */ o("option", { value: "a4", children: "A4 (210 x 297mm)" }),
1172
- /* @__PURE__ */ o("option", { value: "legal", children: "Legal (8.5 x 14)" })
1489
+ /* @__PURE__ */ r("option", { value: "letter", children: "Letter (8.5 x 11)" }),
1490
+ /* @__PURE__ */ r("option", { value: "a4", children: "A4 (210 x 297mm)" }),
1491
+ /* @__PURE__ */ r("option", { value: "legal", children: "Legal (8.5 x 14)" })
1173
1492
  ]
1174
1493
  }
1175
1494
  )
1176
1495
  ] }),
1177
- /* @__PURE__ */ o("div", { style: J }),
1178
- /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: "Margins (px):" }),
1179
- /* @__PURE__ */ o(
1180
- W,
1496
+ /* @__PURE__ */ r("div", { style: le }),
1497
+ /* @__PURE__ */ r("span", { style: { fontSize: "12px", color: "#666" }, children: "Margins (px):" }),
1498
+ /* @__PURE__ */ r(
1499
+ U,
1181
1500
  {
1182
1501
  label: "T",
1183
- value: i.margins.top,
1184
- onChange: n("top")
1502
+ value: s.margins.top,
1503
+ onChange: o("top")
1185
1504
  }
1186
1505
  ),
1187
- /* @__PURE__ */ o(
1188
- W,
1506
+ /* @__PURE__ */ r(
1507
+ U,
1189
1508
  {
1190
1509
  label: "R",
1191
- value: i.margins.right,
1192
- onChange: n("right")
1510
+ value: s.margins.right,
1511
+ onChange: o("right")
1193
1512
  }
1194
1513
  ),
1195
- /* @__PURE__ */ o(
1196
- W,
1514
+ /* @__PURE__ */ r(
1515
+ U,
1197
1516
  {
1198
1517
  label: "B",
1199
- value: i.margins.bottom,
1200
- onChange: n("bottom")
1518
+ value: s.margins.bottom,
1519
+ onChange: o("bottom")
1201
1520
  }
1202
1521
  ),
1203
- /* @__PURE__ */ o(
1204
- W,
1522
+ /* @__PURE__ */ r(
1523
+ U,
1205
1524
  {
1206
1525
  label: "L",
1207
- value: i.margins.left,
1208
- onChange: n("left")
1526
+ value: s.margins.left,
1527
+ onChange: o("left")
1209
1528
  }
1210
1529
  ),
1211
- /* @__PURE__ */ o("div", { style: J }),
1212
- /* @__PURE__ */ x("span", { style: { fontSize: "12px", color: "#666" }, children: [
1530
+ /* @__PURE__ */ r("div", { style: le }),
1531
+ /* @__PURE__ */ C("span", { style: { fontSize: "12px", color: "#666" }, children: [
1213
1532
  e,
1214
1533
  " ",
1215
1534
  e === 1 ? "page" : "pages"
1216
1535
  ] })
1217
1536
  ] });
1218
- }, W = ({ label: i, value: e, onChange: t }) => /* @__PURE__ */ x("label", { style: ye, title: `${i} margin`, children: [
1219
- i,
1537
+ }, U = ({ label: s, value: e, onChange: t }) => /* @__PURE__ */ C("label", { style: Je, title: `${s} margin`, children: [
1538
+ s,
1220
1539
  ":",
1221
- /* @__PURE__ */ o(
1540
+ /* @__PURE__ */ r(
1222
1541
  "input",
1223
1542
  {
1224
1543
  type: "number",
1225
1544
  value: e,
1226
1545
  onChange: t,
1227
- style: xe,
1546
+ style: Qe,
1228
1547
  min: 0,
1229
1548
  max: 300,
1230
1549
  step: 12
1231
1550
  }
1232
1551
  )
1233
- ] }), me = {
1552
+ ] }), Ke = {
1234
1553
  display: "flex",
1235
1554
  alignItems: "center",
1236
1555
  gap: "6px",
1237
1556
  flexWrap: "wrap"
1238
- }, Ce = {
1557
+ }, Xe = {
1239
1558
  display: "flex",
1240
1559
  alignItems: "center",
1241
1560
  gap: "4px",
1242
1561
  fontSize: "12px",
1243
1562
  color: "#666"
1244
- }, be = {
1563
+ }, Ze = {
1245
1564
  height: "26px",
1246
1565
  borderWidth: "1px",
1247
1566
  borderStyle: "solid",
@@ -1251,18 +1570,18 @@ const ge = ({ onExecCommand: i }) => {
1251
1570
  padding: "0 4px",
1252
1571
  cursor: "pointer",
1253
1572
  backgroundColor: "#fff"
1254
- }, J = {
1573
+ }, le = {
1255
1574
  width: "1px",
1256
1575
  height: "20px",
1257
1576
  backgroundColor: "#ddd",
1258
1577
  margin: "0 4px"
1259
- }, ye = {
1578
+ }, Je = {
1260
1579
  display: "flex",
1261
1580
  alignItems: "center",
1262
1581
  gap: "2px",
1263
1582
  fontSize: "11px",
1264
1583
  color: "#666"
1265
- }, xe = {
1584
+ }, Qe = {
1266
1585
  width: "44px",
1267
1586
  height: "24px",
1268
1587
  borderWidth: "1px",
@@ -1272,22 +1591,22 @@ const ge = ({ onExecCommand: i }) => {
1272
1591
  fontSize: "11px",
1273
1592
  textAlign: "center",
1274
1593
  padding: "0 2px"
1275
- }, we = ({
1276
- pageConfig: i,
1594
+ }, at = ({
1595
+ pageConfig: s,
1277
1596
  pageCount: e,
1278
1597
  onExecCommand: t,
1279
- onPageConfigChange: r
1280
- }) => /* @__PURE__ */ x("div", { style: Se, children: [
1281
- /* @__PURE__ */ o("div", { style: Q, children: /* @__PURE__ */ o(ge, { onExecCommand: t }) }),
1282
- /* @__PURE__ */ o("div", { style: Q, children: /* @__PURE__ */ o(
1283
- fe,
1598
+ onPageConfigChange: n
1599
+ }) => /* @__PURE__ */ C("div", { style: Ye, children: [
1600
+ /* @__PURE__ */ r("div", { style: ce, children: /* @__PURE__ */ r(Ve, { onExecCommand: t }) }),
1601
+ /* @__PURE__ */ r("div", { style: ce, children: /* @__PURE__ */ r(
1602
+ Ge,
1284
1603
  {
1285
- pageConfig: i,
1604
+ pageConfig: s,
1286
1605
  pageCount: e,
1287
- onPageConfigChange: r
1606
+ onPageConfigChange: n
1288
1607
  }
1289
1608
  ) })
1290
- ] }), Se = {
1609
+ ] }), Ye = {
1291
1610
  borderBottomWidth: "1px",
1292
1611
  borderBottomStyle: "solid",
1293
1612
  borderBottomColor: "#d0d0d0",
@@ -1298,59 +1617,59 @@ const ge = ({ onExecCommand: i }) => {
1298
1617
  gap: "4px",
1299
1618
  flexShrink: 0,
1300
1619
  zIndex: 10
1301
- }, Q = {
1620
+ }, ce = {
1302
1621
  display: "flex",
1303
1622
  alignItems: "center",
1304
1623
  gap: "4px",
1305
1624
  minHeight: "32px"
1306
1625
  };
1307
- function Ee(i = {}) {
1626
+ function lt(s = {}) {
1308
1627
  const {
1309
1628
  initialHTML: e = "",
1310
1629
  initialCSS: t = "",
1311
- initialConfig: r = O
1312
- } = i, n = M(new he(r)), [s, a] = R({
1630
+ initialConfig: n = G
1631
+ } = s, o = H(new Oe(n)), [a, i] = R({
1313
1632
  pages: [{ blockIndices: [] }],
1314
1633
  pageCount: 1
1315
- }), [l, h] = R(r), v = p((C, b) => {
1316
- n.current.loadHTML(C, b);
1317
- }, []), c = p((C) => {
1318
- n.current.setPageConfig(C), h(n.current.getPageConfig());
1319
- }, []), d = p(() => {
1320
- const { result: C } = n.current.runPagination();
1321
- a(C);
1322
- }, []), L = p(() => n.current.getHTML(), []), m = p(() => n.current.getPlainText(), []);
1323
- return _(() => {
1324
- e && n.current.loadHTML(e, t);
1325
- }, [e, t]), _(() => n.current.onPagination((b) => {
1326
- a(b);
1327
- }), []), _(() => () => {
1328
- n.current.destroy();
1634
+ }), [c, g] = R(n), S = h((y, E) => {
1635
+ o.current.loadHTML(y, E);
1636
+ }, []), d = h((y) => {
1637
+ o.current.setPageConfig(y), g(o.current.getPageConfig());
1638
+ }, []), p = h(() => {
1639
+ const { result: y } = o.current.runPagination();
1640
+ i(y);
1641
+ }, []), k = h(() => o.current.getHTML(), []), A = h(() => o.current.getPlainText(), []);
1642
+ return F(() => {
1643
+ e && o.current.loadHTML(e, t);
1644
+ }, [e, t]), F(() => o.current.onPagination((E) => {
1645
+ i(E);
1646
+ }), []), F(() => () => {
1647
+ o.current.destroy();
1329
1648
  }, []), {
1330
- engine: n.current,
1331
- paginationResult: s,
1332
- pageConfig: l,
1333
- loadHTML: v,
1334
- setPageConfig: c,
1335
- triggerPagination: d,
1336
- getHTML: L,
1337
- getPlainText: m
1649
+ engine: o.current,
1650
+ paginationResult: a,
1651
+ pageConfig: c,
1652
+ loadHTML: S,
1653
+ setPageConfig: d,
1654
+ triggerPagination: p,
1655
+ getHTML: k,
1656
+ getPlainText: A
1338
1657
  };
1339
1658
  }
1340
1659
  export {
1341
- ie as DEFAULT_MARGINS,
1342
- O as DEFAULT_PAGE_CONFIG,
1343
- Le as DocumentAPI,
1344
- he as DocumentEngine,
1345
- Me as DopeCanvas,
1346
- z as EditableManager,
1347
- ee as PAGE_SIZE_PRESETS,
1348
- te as PageLayoutEngine,
1349
- fe as PageSetupToolbar,
1350
- ge as TextToolbar,
1351
- we as Toolbar,
1352
- Ee as useDocumentEngine,
1353
- de as useFormattingState,
1354
- He as useSelectionContext
1660
+ Ie as DEFAULT_MARGINS,
1661
+ G as DEFAULT_PAGE_CONFIG,
1662
+ it as DocumentAPI,
1663
+ Oe as DocumentEngine,
1664
+ rt as DopeCanvas,
1665
+ $ as EditableManager,
1666
+ ue as PAGE_SIZE_PRESETS,
1667
+ de as PageLayoutEngine,
1668
+ Ge as PageSetupToolbar,
1669
+ Ve as TextToolbar,
1670
+ at as Toolbar,
1671
+ lt as useDocumentEngine,
1672
+ $e as useFormattingState,
1673
+ st as useSelectionContext
1355
1674
  };
1356
1675
  //# sourceMappingURL=dopecanvas.js.map