@8btc/whiteboard 0.0.20-alpha.27 → 0.0.20-alpha.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/maze.js +59 -59
- package/dist/index.js +73 -73
- package/dist/maze.d.ts +6 -1
- package/package.json +1 -1
package/dist/adapter/maze.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { v4 as _ } from "uuid";
|
|
2
2
|
import { N as M } from "../const-CNw7pZuI.js";
|
|
3
3
|
async function N(t) {
|
|
4
|
-
return new Promise((
|
|
4
|
+
return new Promise((r, n) => {
|
|
5
5
|
const e = new Image();
|
|
6
6
|
e.onload = () => {
|
|
7
|
-
|
|
7
|
+
r({ width: e.naturalWidth, height: e.naturalHeight });
|
|
8
8
|
}, e.onerror = () => {
|
|
9
9
|
n(new Error(`Failed to load image: ${t}`));
|
|
10
10
|
}, e.src = t;
|
|
@@ -14,14 +14,14 @@ function v(t) {
|
|
|
14
14
|
if (!t) return { x: 0, y: 0 };
|
|
15
15
|
if ((t.getState().nodes || []).length > 0) {
|
|
16
16
|
const e = t.getMainLayer();
|
|
17
|
-
let
|
|
17
|
+
let i = 1 / 0, o = -1 / 0;
|
|
18
18
|
if (e.children.forEach((s) => {
|
|
19
19
|
if (s.visible() && s.getClassName() !== "Transformer" && s.hasName(M.selectable)) {
|
|
20
20
|
const a = s.getAttrs(), c = a.x || 0, d = a.y || 0, l = a.height || 0;
|
|
21
|
-
|
|
21
|
+
i = Math.min(i, c), o = Math.max(o, d + l);
|
|
22
22
|
}
|
|
23
|
-
}),
|
|
24
|
-
return { x:
|
|
23
|
+
}), i !== 1 / 0 && o !== -1 / 0)
|
|
24
|
+
return { x: i, y: o };
|
|
25
25
|
}
|
|
26
26
|
const n = t.getState().viewport;
|
|
27
27
|
return {
|
|
@@ -29,17 +29,17 @@ function v(t) {
|
|
|
29
29
|
y: n.y
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
async function E(t,
|
|
32
|
+
async function E(t, r, n, e) {
|
|
33
33
|
if (!t) return;
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
34
|
+
const i = Array.isArray(r) ? r : [r];
|
|
35
|
+
if (i.length === 0) return;
|
|
36
|
+
const o = e?.spacing ?? 20, s = e?.scrollToView ?? !0, a = e?.direction ?? "horizontal", c = e?.reuseExisting ?? !0, d = /* @__PURE__ */ new Map();
|
|
37
37
|
c && (t.getState().nodes || []).forEach((m) => {
|
|
38
38
|
m.$_type === "image" && m.$_imageUrl && d.set(m.$_imageUrl, m.id);
|
|
39
39
|
});
|
|
40
|
-
const l = await Promise.all(
|
|
40
|
+
const l = await Promise.all(i.map((f) => N(f))), h = [], u = [];
|
|
41
41
|
let g = n.x, y = n.y;
|
|
42
|
-
return
|
|
42
|
+
return i.forEach((f, m) => {
|
|
43
43
|
if (c && d.has(f)) {
|
|
44
44
|
const w = d.get(f);
|
|
45
45
|
u.push(w);
|
|
@@ -54,34 +54,34 @@ async function E(t, o, n, e) {
|
|
|
54
54
|
width: $,
|
|
55
55
|
height: x,
|
|
56
56
|
$_imageUrl: f
|
|
57
|
-
}), u.push(I), a === "horizontal" ? g += $ +
|
|
57
|
+
}), u.push(I), a === "horizontal" ? g += $ + o : y += x + o;
|
|
58
58
|
}), h.length > 0 && t.createNodes(h, !0), s && t.scrollToContent({ scale: !1, nodeIds: u }), u;
|
|
59
59
|
}
|
|
60
|
-
async function B(t,
|
|
60
|
+
async function B(t, r) {
|
|
61
61
|
if (!t) return;
|
|
62
62
|
const n = v(t);
|
|
63
|
-
return E(t,
|
|
63
|
+
return E(t, r, {
|
|
64
64
|
x: n.x,
|
|
65
65
|
y: n.y + 20
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
function L(t,
|
|
68
|
+
function L(t, r) {
|
|
69
69
|
if (!t) return;
|
|
70
70
|
const n = t.getState().selectedNodeIds || [];
|
|
71
71
|
if (n.length === 0) return;
|
|
72
|
-
let e = 1 / 0,
|
|
72
|
+
let e = 1 / 0, i = 1 / 0, o = -1 / 0, s = -1 / 0;
|
|
73
73
|
if (t.getMainLayer().children.forEach((l) => {
|
|
74
74
|
if (l.visible() && l.getClassName() !== "Transformer" && n.includes(l.id())) {
|
|
75
75
|
const h = l.getAttrs(), u = h.x || 0, g = h.y || 0, y = h.width || 0, f = h.height || 0;
|
|
76
|
-
e = Math.min(e, u),
|
|
76
|
+
e = Math.min(e, u), i = Math.min(i, g), o = Math.max(o, u + y), s = Math.max(s, g + f);
|
|
77
77
|
}
|
|
78
|
-
}), e === 1 / 0 ||
|
|
78
|
+
}), e === 1 / 0 || i === 1 / 0 || o === -1 / 0 || s === -1 / 0)
|
|
79
79
|
return;
|
|
80
80
|
const c = {
|
|
81
|
-
x:
|
|
82
|
-
y:
|
|
83
|
-
width:
|
|
84
|
-
height: s -
|
|
81
|
+
x: o + 20,
|
|
82
|
+
y: i,
|
|
83
|
+
width: o - e,
|
|
84
|
+
height: s - i
|
|
85
85
|
}, d = {
|
|
86
86
|
id: _(),
|
|
87
87
|
$_type: "html",
|
|
@@ -90,33 +90,33 @@ function L(t, o) {
|
|
|
90
90
|
y: c.y,
|
|
91
91
|
width: c.width,
|
|
92
92
|
height: c.height,
|
|
93
|
-
$_imageUrl:
|
|
93
|
+
$_imageUrl: r,
|
|
94
94
|
// 示例 loading 图片 URL
|
|
95
95
|
$_htmlContent: `
|
|
96
|
-
<img alt="loading" src="${
|
|
96
|
+
<img alt="loading" src="${r}" style="width: 100%; height: 100%; object-fit: contain;" />
|
|
97
97
|
`
|
|
98
98
|
};
|
|
99
99
|
return t.createNodes([d], !0), d.id;
|
|
100
100
|
}
|
|
101
|
-
function X(t,
|
|
101
|
+
function X(t, r, n) {
|
|
102
102
|
if (!t) return;
|
|
103
|
-
const e = t.getCanvasNodeById(
|
|
103
|
+
const e = t.getCanvasNodeById(r);
|
|
104
104
|
if (!e) return;
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
const s =
|
|
110
|
-
E(t,
|
|
105
|
+
const i = e.getConfig();
|
|
106
|
+
if (i.$_type !== "html") return;
|
|
107
|
+
const o = Array.isArray(n) ? n : [n];
|
|
108
|
+
if (o.length === 0) return;
|
|
109
|
+
const s = i.x, a = i.y;
|
|
110
|
+
E(t, o, { x: s, y: a }, { scrollToView: !1 }), t.deleteNodes([r]);
|
|
111
111
|
}
|
|
112
|
-
async function p(t,
|
|
112
|
+
async function p(t, r, n, e, i) {
|
|
113
113
|
if (!t) return;
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
114
|
+
const o = i?.scrollToView ?? !0;
|
|
115
|
+
if (i?.reuseExisting ?? !0) {
|
|
116
116
|
const d = t.getState().nodes || [];
|
|
117
117
|
for (const l of d)
|
|
118
|
-
if (l.$_type === "video" && l.$_videoUrl ===
|
|
119
|
-
return
|
|
118
|
+
if (l.$_type === "video" && l.$_videoUrl === r)
|
|
119
|
+
return o && t.scrollToContent({ scale: !1, nodeIds: [l.id] }), l.id;
|
|
120
120
|
}
|
|
121
121
|
let a = { width: 320, height: 180 };
|
|
122
122
|
try {
|
|
@@ -133,30 +133,30 @@ async function p(t, o, n, e, r) {
|
|
|
133
133
|
// 使用封面图片的宽度
|
|
134
134
|
height: a.height,
|
|
135
135
|
// 使用封面图片的高度
|
|
136
|
-
$_videoUrl:
|
|
136
|
+
$_videoUrl: r,
|
|
137
137
|
$_coverUrl: n
|
|
138
138
|
};
|
|
139
|
-
return t.createNodes([c], !0),
|
|
139
|
+
return t.createNodes([c], !0), o && t.scrollToContent({ scale: !1, nodeIds: [c.id] }), c.id;
|
|
140
140
|
}
|
|
141
|
-
async function Y(t,
|
|
141
|
+
async function Y(t, r, n) {
|
|
142
142
|
if (!t) return;
|
|
143
143
|
const e = v(t);
|
|
144
|
-
return p(t,
|
|
144
|
+
return p(t, r, n, {
|
|
145
145
|
x: e.x,
|
|
146
146
|
y: e.y + 20
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
-
async function V(t,
|
|
149
|
+
async function V(t, r) {
|
|
150
150
|
if (!t) return null;
|
|
151
|
-
const n = t.getCanvasNodeById(
|
|
151
|
+
const n = t.getCanvasNodeById(r);
|
|
152
152
|
if (!n) return null;
|
|
153
153
|
const e = n.getConfig();
|
|
154
154
|
if (e.$_type !== "image-marker" || !e.$_relativeBox)
|
|
155
155
|
return null;
|
|
156
|
-
const
|
|
157
|
-
if (!
|
|
158
|
-
const
|
|
159
|
-
if (!
|
|
156
|
+
const i = e.$_parentId;
|
|
157
|
+
if (!i) return null;
|
|
158
|
+
const o = t.getNodeConfigById(i);
|
|
159
|
+
if (!o || o.$_type !== "image" || !o.$_imageUrl) return null;
|
|
160
160
|
const { start: s, end: a } = e.$_relativeBox, c = s.ratioX, d = s.ratioY, l = a.ratioX - s.ratioX, h = a.ratioY - s.ratioY;
|
|
161
161
|
return new Promise((u) => {
|
|
162
162
|
const g = new Image();
|
|
@@ -182,21 +182,21 @@ async function V(t, o) {
|
|
|
182
182
|
const S = w.toDataURL("image/png");
|
|
183
183
|
u(S);
|
|
184
184
|
}, g.onerror = () => {
|
|
185
|
-
console.error("Failed to load image:",
|
|
186
|
-
}, g.src =
|
|
185
|
+
console.error("Failed to load image:", o.$_imageUrl), u(null);
|
|
186
|
+
}, g.src = o.$_imageUrl;
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
|
-
function z(t) {
|
|
189
|
+
function z(t, r) {
|
|
190
190
|
if (!t) return null;
|
|
191
|
-
const
|
|
192
|
-
if (
|
|
193
|
-
if (
|
|
194
|
-
const
|
|
195
|
-
if (!
|
|
196
|
-
if (
|
|
197
|
-
return
|
|
191
|
+
const n = t.getState().selectedNodeIds || [];
|
|
192
|
+
if (n.length === 0) return null;
|
|
193
|
+
if (n.length === 1) {
|
|
194
|
+
const e = t.getCanvasNodeById(n[0]);
|
|
195
|
+
if (!e) return null;
|
|
196
|
+
if (e.getConfig().$_type === "image")
|
|
197
|
+
return e.getConfig().$_imageUrl || null;
|
|
198
198
|
}
|
|
199
|
-
return t.exportSelectionAsImage();
|
|
199
|
+
return t.exportSelectionAsImage(r);
|
|
200
200
|
}
|
|
201
201
|
export {
|
|
202
202
|
v as calculateBottomLeftOfCanvasContent,
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ var Xe = (n) => {
|
|
|
4
4
|
};
|
|
5
5
|
var on = (n, e, t) => e in n ? nn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
6
6
|
var C = (n, e, t) => on(n, typeof e != "symbol" ? e + "" : e, t), Ce = (n, e, t) => e.has(n) || Xe("Cannot " + t);
|
|
7
|
-
var r = (n, e, t) => (Ce(n, e, "read from private field"), t ? t.call(n) : e.get(n)), f = (n, e, t) => e.has(n) ? Xe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), b = (n, e, t, i) => (Ce(n, e, "write to private field"), i ? i.call(n, t) : e.set(n, t), t),
|
|
7
|
+
var r = (n, e, t) => (Ce(n, e, "read from private field"), t ? t.call(n) : e.get(n)), f = (n, e, t) => e.has(n) ? Xe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), b = (n, e, t, i) => (Ce(n, e, "write to private field"), i ? i.call(n, t) : e.set(n, t), t), M = (n, e, t) => (Ce(n, e, "access private method"), t);
|
|
8
8
|
import { jsxs as k, jsx as c, Fragment as me } from "react/jsx-runtime";
|
|
9
|
-
import { useState as R, useEffect as V, useRef as
|
|
9
|
+
import { useState as R, useEffect as V, useRef as _e, useMemo as pt, forwardRef as $, createContext as sn, isValidElement as Ye, version as rn, cloneElement as an, useContext as ln, Fragment as hn, useCallback as K, memo as ot } from "react";
|
|
10
10
|
import I from "konva";
|
|
11
11
|
import { N as T, I as q, R as S } from "./const-CNw7pZuI.js";
|
|
12
12
|
import cn from "mitt";
|
|
@@ -15,16 +15,16 @@ import gn from "@tiptap/starter-kit";
|
|
|
15
15
|
import un from "@tiptap/extension-highlight";
|
|
16
16
|
import { TextStyle as mn, Color as fn, FontFamily as pn } from "@tiptap/extension-text-style";
|
|
17
17
|
import { toCanvas as yn } from "html-to-image";
|
|
18
|
-
import { v4 as
|
|
18
|
+
import { v4 as Mt } from "uuid";
|
|
19
19
|
import { Slot as vn } from "@radix-ui/react-slot";
|
|
20
20
|
import { cva as Cn } from "class-variance-authority";
|
|
21
21
|
import { clsx as xn } from "clsx";
|
|
22
22
|
import { twMerge as bn } from "tailwind-merge";
|
|
23
23
|
import { Minus as wn, Plus as En, Undo2 as Sn, Redo2 as Nn } from "lucide-react";
|
|
24
24
|
import { BubbleMenu as Tn } from "@tiptap/react/menus";
|
|
25
|
-
import { NodeSelection as
|
|
25
|
+
import { NodeSelection as Mn } from "@tiptap/pm/state";
|
|
26
26
|
import "@tiptap/pm/tables";
|
|
27
|
-
import { useCurrentEditor as
|
|
27
|
+
import { useCurrentEditor as _n, useEditorState as In } from "@tiptap/react";
|
|
28
28
|
import { FloatingDelayGroup as kn, useMergeRefs as ri, FloatingPortal as Rn, useFloating as $n, offset as Fn, flip as An, shift as Hn, autoUpdate as Ln, useHover as Dn, useFocus as Bn, useDismiss as Vn, useRole as On, useInteractions as Pn } from "@floating-ui/react";
|
|
29
29
|
import * as zt from "@radix-ui/react-popover";
|
|
30
30
|
import { useHotkeys as ai } from "react-hotkeys-hook";
|
|
@@ -160,7 +160,7 @@ class Zn {
|
|
|
160
160
|
scaleY: 1,
|
|
161
161
|
draggable: t.draggable ?? !1,
|
|
162
162
|
className: t.className
|
|
163
|
-
})),
|
|
163
|
+
})), M(this, Qt, li).call(this);
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
166
166
|
* 获取原生 Konva.Stage 实例
|
|
@@ -218,12 +218,12 @@ E = new WeakMap(), w = new WeakMap(), j = new WeakMap(), Wt = new WeakMap(), Xt
|
|
|
218
218
|
li = function() {
|
|
219
219
|
r(this, w).on("wheel", r(this, Wt)), r(this, w).on("pointerdown", r(this, Xt)), r(this, w).on("pointermove", r(this, Yt)), r(this, w).on("pointerup", r(this, Gt)), r(this, w).on("dragstart", r(this, Kt)), r(this, w).on("dragmove", r(this, qt)), r(this, w).on("dragend", r(this, jt)), r(this, w).on("contextmenu", r(this, Jt));
|
|
220
220
|
};
|
|
221
|
-
var kt,
|
|
221
|
+
var kt, _, te, ee, ie, ne, oe, se, re, hi;
|
|
222
222
|
class Un {
|
|
223
223
|
constructor(e, t) {
|
|
224
224
|
f(this, re);
|
|
225
225
|
f(this, kt);
|
|
226
|
-
f(this,
|
|
226
|
+
f(this, _);
|
|
227
227
|
/**
|
|
228
228
|
* 处理 transformstart 事件
|
|
229
229
|
*/
|
|
@@ -260,7 +260,7 @@ class Un {
|
|
|
260
260
|
f(this, se, () => {
|
|
261
261
|
this.emitPositionChange();
|
|
262
262
|
});
|
|
263
|
-
b(this, kt, e), b(this,
|
|
263
|
+
b(this, kt, e), b(this, _, new I.Transformer({
|
|
264
264
|
rotateEnabled: t?.rotateEnabled ?? !0,
|
|
265
265
|
ignoreStroke: t?.ignoreStroke ?? !0,
|
|
266
266
|
anchorSize: t?.anchorSize ?? 8,
|
|
@@ -268,27 +268,27 @@ class Un {
|
|
|
268
268
|
anchorCornerRadius: t?.anchorCornerRadius ?? 4,
|
|
269
269
|
padding: t?.padding ?? 6,
|
|
270
270
|
shouldOverdrawWholeArea: !0
|
|
271
|
-
})),
|
|
271
|
+
})), M(this, re, hi).call(this);
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
274
274
|
* 获取原生 Konva.Transformer 实例
|
|
275
275
|
*/
|
|
276
276
|
getTransformer() {
|
|
277
|
-
return r(this,
|
|
277
|
+
return r(this, _);
|
|
278
278
|
}
|
|
279
279
|
/**
|
|
280
280
|
* 获取 Transformer 的位置信息
|
|
281
281
|
*/
|
|
282
282
|
getPosition() {
|
|
283
|
-
if (r(this,
|
|
283
|
+
if (r(this, _).nodes().length === 0)
|
|
284
284
|
return null;
|
|
285
|
-
const t = r(this,
|
|
285
|
+
const t = r(this, _).getClientRect();
|
|
286
286
|
return {
|
|
287
287
|
x: t.x,
|
|
288
288
|
y: t.y,
|
|
289
289
|
width: t.width,
|
|
290
290
|
height: t.height,
|
|
291
|
-
rotation: r(this,
|
|
291
|
+
rotation: r(this, _).rotation()
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
/**
|
|
@@ -299,11 +299,11 @@ class Un {
|
|
|
299
299
|
this.clearNodes();
|
|
300
300
|
return;
|
|
301
301
|
}
|
|
302
|
-
r(this,
|
|
302
|
+
r(this, _).nodes(e), r(this, _).moveToTop(), r(this, _).rotateEnabled(
|
|
303
303
|
!e.some(
|
|
304
304
|
(t) => ["rich-text", "html"].includes(t.getAttr("$_type"))
|
|
305
305
|
)
|
|
306
|
-
), e.length === 1 && e[0].getAttr("$_type") === "rich-text" && r(this,
|
|
306
|
+
), e.length === 1 && e[0].getAttr("$_type") === "rich-text" && r(this, _).enabledAnchors([
|
|
307
307
|
"top-left",
|
|
308
308
|
"top-right",
|
|
309
309
|
"bottom-left",
|
|
@@ -316,13 +316,13 @@ class Un {
|
|
|
316
316
|
* 获取当前变换的节点
|
|
317
317
|
*/
|
|
318
318
|
getNodes() {
|
|
319
|
-
return r(this,
|
|
319
|
+
return r(this, _).nodes();
|
|
320
320
|
}
|
|
321
321
|
/**
|
|
322
322
|
* 清除所有节点
|
|
323
323
|
*/
|
|
324
324
|
clearNodes() {
|
|
325
|
-
r(this,
|
|
325
|
+
r(this, _).nodes([]), this.emitPositionChange();
|
|
326
326
|
}
|
|
327
327
|
/**
|
|
328
328
|
* emit Transformer 位置
|
|
@@ -335,15 +335,15 @@ class Un {
|
|
|
335
335
|
* 销毁 Transformer
|
|
336
336
|
*/
|
|
337
337
|
destroy() {
|
|
338
|
-
r(this,
|
|
338
|
+
r(this, _).destroy();
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
-
kt = new WeakMap(),
|
|
341
|
+
kt = new WeakMap(), _ = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), ie = new WeakMap(), ne = new WeakMap(), oe = new WeakMap(), se = new WeakMap(), re = new WeakSet(), /**
|
|
342
342
|
* 设置事件监听器
|
|
343
343
|
*/
|
|
344
344
|
hi = function() {
|
|
345
|
-
r(this,
|
|
346
|
-
const t = r(this,
|
|
345
|
+
r(this, _).on("transformstart", r(this, te)), r(this, _).on("transform", r(this, ee)), r(this, _).on("transformend", r(this, ie)), r(this, _).on("dragstart", r(this, ne)), r(this, _).on("dragmove", r(this, oe)), r(this, _).on("dragend", r(this, se)), r(this, _).on("pointerdblclick", (e) => {
|
|
346
|
+
const t = r(this, _).nodes();
|
|
347
347
|
if (t.length === 1) {
|
|
348
348
|
const i = t[0];
|
|
349
349
|
i.fire("pointerdblclick", {
|
|
@@ -628,7 +628,7 @@ class Kn extends yt {
|
|
|
628
628
|
const i = t === "select";
|
|
629
629
|
this.element.listening(i && (this.config.$_listening ?? !0));
|
|
630
630
|
});
|
|
631
|
-
this.core = t, this.config = Ge(i, this.core.getTheme()), this.element = this.createElement(), Ct(this.element, this), this.isDraft = o,
|
|
631
|
+
this.core = t, this.config = Ge(i, this.core.getTheme()), this.element = this.createElement(), Ct(this.element, this), this.isDraft = o, M(this, ae, gi).call(this);
|
|
632
632
|
}
|
|
633
633
|
getID() {
|
|
634
634
|
return this.config.id;
|
|
@@ -709,7 +709,7 @@ class qn extends yt {
|
|
|
709
709
|
!0
|
|
710
710
|
);
|
|
711
711
|
});
|
|
712
|
-
this.core = t, this.config = Ke(i, this.core.getTheme()), this.element = this.createElement(), Ct(this.element, this), this.isDraft = o,
|
|
712
|
+
this.core = t, this.config = Ke(i, this.core.getTheme()), this.element = this.createElement(), Ct(this.element, this), this.isDraft = o, M(this, nt, xe).call(this), M(this, nt, ui).call(this, this.getElement());
|
|
713
713
|
}
|
|
714
714
|
getID() {
|
|
715
715
|
return this.config.id;
|
|
@@ -740,7 +740,7 @@ class qn extends yt {
|
|
|
740
740
|
...t
|
|
741
741
|
},
|
|
742
742
|
this.core.getTheme()
|
|
743
|
-
), delete this.config.image, this.getElement().setAttrs(this.config), t.$_imageUrl && t.$_imageUrl !== i.$_imageUrl &&
|
|
743
|
+
), delete this.config.image, this.getElement().setAttrs(this.config), t.$_imageUrl && t.$_imageUrl !== i.$_imageUrl && M(this, nt, xe).call(this);
|
|
744
744
|
}
|
|
745
745
|
/**
|
|
746
746
|
* 销毁
|
|
@@ -778,11 +778,11 @@ xe = function() {
|
|
|
778
778
|
ui = function(t) {
|
|
779
779
|
this.core.on("toolType:change", r(this, $t)), t.on("transform", (i) => {
|
|
780
780
|
const o = i.target, s = Math.max(q.MIN_SIZE, o.width() * o.scaleX()), a = Math.max(q.MIN_SIZE, o.height() * o.scaleY());
|
|
781
|
-
o.scale({ x: 1, y: 1 }), o.width(s), o.height(a),
|
|
781
|
+
o.scale({ x: 1, y: 1 }), o.width(s), o.height(a), M(this, nt, be).call(this);
|
|
782
782
|
}), t.on("transformend", () => {
|
|
783
783
|
this.syncConfigFromElement(), r(this, Ft).call(this);
|
|
784
784
|
}), t.on("dragmove", () => {
|
|
785
|
-
|
|
785
|
+
M(this, nt, be).call(this);
|
|
786
786
|
}), t.on("dragend", () => {
|
|
787
787
|
this.syncConfigFromElement(), r(this, Ft).call(this);
|
|
788
788
|
});
|
|
@@ -827,8 +827,8 @@ class jn extends yt {
|
|
|
827
827
|
f(this, bt);
|
|
828
828
|
this.core = t, this.config = je(i, this.core.getTheme()), this.isDraft = o, this.element = this.createElement(), Ct(this.element, this);
|
|
829
829
|
const s = this.getElement();
|
|
830
|
-
b(this, J, s.findOne(".rect")), b(this, U, s.findOne(".marker-group")), b(this, lt, r(this, U).findOne("Circle")), b(this, et, r(this, U).findOne("Text")),
|
|
831
|
-
|
|
830
|
+
b(this, J, s.findOne(".rect")), b(this, U, s.findOne(".marker-group")), b(this, lt, r(this, U).findOne("Circle")), b(this, et, r(this, U).findOne("Text")), M(this, Nt, fi).call(this), b(this, xt, () => {
|
|
831
|
+
M(this, Nt, mi).call(this);
|
|
832
832
|
}), this.core.on("viewport:scale:change", r(this, xt)), b(this, bt, (a) => {
|
|
833
833
|
const h = a.includes(this.config.id);
|
|
834
834
|
this.setFocusState(h);
|
|
@@ -967,7 +967,7 @@ class Jn extends yt {
|
|
|
967
967
|
});
|
|
968
968
|
this.core = t, this.config = Je(i, this.core.getTheme()), this.element = this.createElement(), Ct(this.element, this), this.isDraft = o, this.htmlElement = document.createElement("div"), this.htmlElement.style.position = "absolute", this.htmlElement.style.pointerEvents = "none", this.htmlElement.innerHTML = this.config.$_htmlContent, this.core.getContainer().appendChild(this.htmlElement), setTimeout(() => {
|
|
969
969
|
r(this, rt).call(this);
|
|
970
|
-
}),
|
|
970
|
+
}), M(this, le, pi).call(this);
|
|
971
971
|
}
|
|
972
972
|
getID() {
|
|
973
973
|
return this.config.id;
|
|
@@ -1070,7 +1070,7 @@ class Qn extends yt {
|
|
|
1070
1070
|
this.core.on("viewport:change", m), window.addEventListener("click", d), window.addEventListener("touchstart", d);
|
|
1071
1071
|
});
|
|
1072
1072
|
});
|
|
1073
|
-
this.core = t, this.config = Qe(i, this.core.getTheme()), this.element = this.createElement(), this.rect = new I.Rect(this.config), Ct(this.element, this), this.isDraft = o,
|
|
1073
|
+
this.core = t, this.config = Qe(i, this.core.getTheme()), this.element = this.createElement(), this.rect = new I.Rect(this.config), Ct(this.element, this), this.isDraft = o, M(this, ce, yi).call(this), setTimeout(() => {
|
|
1074
1074
|
r(this, he).call(this);
|
|
1075
1075
|
});
|
|
1076
1076
|
}
|
|
@@ -1140,7 +1140,7 @@ class to extends yt {
|
|
|
1140
1140
|
C(this, "resizeObserver");
|
|
1141
1141
|
C(this, "editor");
|
|
1142
1142
|
C(this, "attachEditor", () => {
|
|
1143
|
-
this.htmlElement.id = "rich-text-html-element", this.htmlElement.style.transition = "none", this.htmlElement.style.opacity = "1", this.element.opacity(0), this.
|
|
1143
|
+
this.htmlElement.id = "rich-text-html-element", this.htmlElement.style.transition = "none", this.htmlElement.style.opacity = "1", this.element.opacity(0), this.core._selectNodes(), this.core.isEditingText = !0, this.htmlElement.style.pointerEvents = "auto";
|
|
1144
1144
|
const t = this.htmlEditorElement.innerHTML;
|
|
1145
1145
|
this.htmlEditorElement.innerHTML = "";
|
|
1146
1146
|
const i = new dn({
|
|
@@ -1155,7 +1155,7 @@ class to extends yt {
|
|
|
1155
1155
|
content: t,
|
|
1156
1156
|
autofocus: !0
|
|
1157
1157
|
});
|
|
1158
|
-
i.scaleWhenCreate = this.config.scaleWhenCreate || 1, this.editor = i, this.core._registerTextEditor(i), i.on("focus", () => {
|
|
1158
|
+
i.scaleWhenCreate = this.config.scaleWhenCreate || 1, this.editor = i, this.core._registerTextEditor(i), this.core.getMainLayer().listening(!1), i.on("focus", () => {
|
|
1159
1159
|
window.addEventListener("click", r(this, Vt));
|
|
1160
1160
|
}), window.addEventListener("keydown", r(this, Bt));
|
|
1161
1161
|
});
|
|
@@ -1184,7 +1184,7 @@ class to extends yt {
|
|
|
1184
1184
|
});
|
|
1185
1185
|
});
|
|
1186
1186
|
C(this, "detachEditor", () => {
|
|
1187
|
-
this.editor && (this.htmlElement.id = "", this.htmlEditorElement.innerHTML = this.editor.getHTML(), this.config.$_htmlContent = this.editor.getHTML(), this.editor.commands.blur(), this.htmlElement.style.pointerEvents = "none", this.
|
|
1187
|
+
this.editor && (this.htmlElement.id = "", this.htmlEditorElement.innerHTML = this.editor.getHTML(), this.config.$_htmlContent = this.editor.getHTML(), this.editor.commands.blur(), this.htmlElement.style.pointerEvents = "none", this.core.isEditingText = !1, this.core._unregisterTextEditor(), window.removeEventListener("keydown", r(this, Bt)), window.removeEventListener("click", r(this, Vt)), this.editor.destroy(), this.editor = void 0, this.core.getMainLayer().listening(!0), r(this, wt).call(this).then(() => {
|
|
1188
1188
|
this.htmlElement.style.transition = "opacity 0.1s", this.htmlElement.style.opacity = "0", this.element.opacity(1);
|
|
1189
1189
|
}).finally(() => {
|
|
1190
1190
|
this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !1);
|
|
@@ -1220,7 +1220,7 @@ class to extends yt {
|
|
|
1220
1220
|
const i = t.target;
|
|
1221
1221
|
this.htmlElement.contains(i) || this.detachEditor();
|
|
1222
1222
|
});
|
|
1223
|
-
this.core = t, this.config = ti(i, this.core.getTheme()), this.config.scaleWhenCreate = this.config.scaleWhenCreate || this.core.getState().viewport.scale || 1, this.config.htmlScale = this.config.htmlScale || 1, this.element = this.createElement(), Ct(this.element, this), this.isDraft = o, this.htmlElement = document.createElement("div"), this.htmlElement.style.position = "absolute", this.htmlElement.style.pointerEvents = "none", this.htmlElement.style.overflowWrap = "break-word", this.htmlElement.style.transformOrigin = "top left", this.htmlElement.style.opacity = "0", this.htmlElement.style.transition = "opacity 0.1s", this.htmlEditorElement = document.createElement("div"), this.htmlEditorElement.style.transformOrigin = "top left", this.htmlEditorElement.style.width = "max-content", this.htmlEditorElement.innerHTML = this.config.$_htmlContent || "", this.htmlElement.appendChild(this.htmlEditorElement), this.core.getStage().content.appendChild(this.htmlElement), r(this, de).call(this),
|
|
1223
|
+
this.core = t, this.config = ti(i, this.core.getTheme()), this.config.scaleWhenCreate = this.config.scaleWhenCreate || this.core.getState().viewport.scale || 1, this.config.htmlScale = this.config.htmlScale || 1, this.element = this.createElement(), Ct(this.element, this), this.isDraft = o, this.htmlElement = document.createElement("div"), this.htmlElement.style.position = "absolute", this.htmlElement.style.pointerEvents = "none", this.htmlElement.style.overflowWrap = "break-word", this.htmlElement.style.transformOrigin = "top left", this.htmlElement.style.opacity = "0", this.htmlElement.style.transition = "opacity 0.1s", this.htmlEditorElement = document.createElement("div"), this.htmlEditorElement.style.transformOrigin = "top left", this.htmlEditorElement.style.width = "max-content", this.htmlEditorElement.innerHTML = this.config.$_htmlContent || "", this.htmlElement.appendChild(this.htmlEditorElement), this.core.getStage().content.appendChild(this.htmlElement), r(this, de).call(this), M(this, ge, vi).call(this), setTimeout(() => {
|
|
1224
1224
|
r(this, ht).call(this), this.htmlElement.style.transform = `scale(${this.core.getState().viewport.scale / this.config.scaleWhenCreate})`, r(this, wt).call(this);
|
|
1225
1225
|
});
|
|
1226
1226
|
}
|
|
@@ -1309,7 +1309,7 @@ class eo extends yt {
|
|
|
1309
1309
|
});
|
|
1310
1310
|
this.core = t, this.config = qe(i, this.core.getTheme());
|
|
1311
1311
|
const { group: s, image: a, imgCover: h, playIcon: l } = this.createElement();
|
|
1312
|
-
this.element = s, this.cover = a, this.imgCover = h, this.playIcon = l, this.element = s, Ct(this.element, this), this.isDraft = o,
|
|
1312
|
+
this.element = s, this.cover = a, this.imgCover = h, this.playIcon = l, this.element = s, Ct(this.element, this), this.isDraft = o, M(this, ft, we).call(this), M(this, ft, Ci).call(this, this.getElement());
|
|
1313
1313
|
}
|
|
1314
1314
|
getID() {
|
|
1315
1315
|
return this.config.id;
|
|
@@ -1378,7 +1378,7 @@ class eo extends yt {
|
|
|
1378
1378
|
), this.getElement().setAttrs(this.config), this.cover.setAttrs({
|
|
1379
1379
|
...this.config,
|
|
1380
1380
|
id: `${this.config.id}-image`
|
|
1381
|
-
}), t.$_coverUrl && t.$_coverUrl !== i.$_coverUrl &&
|
|
1381
|
+
}), t.$_coverUrl && t.$_coverUrl !== i.$_coverUrl && M(this, ft, we).call(this);
|
|
1382
1382
|
}
|
|
1383
1383
|
/**
|
|
1384
1384
|
* 销毁
|
|
@@ -1466,7 +1466,7 @@ function ni(n, e) {
|
|
|
1466
1466
|
const io = (n, e, t) => ({
|
|
1467
1467
|
...t,
|
|
1468
1468
|
$_type: n,
|
|
1469
|
-
id:
|
|
1469
|
+
id: Mt(),
|
|
1470
1470
|
x: e.x,
|
|
1471
1471
|
y: e.y
|
|
1472
1472
|
});
|
|
@@ -1544,7 +1544,7 @@ class so extends zn {
|
|
|
1544
1544
|
height: t.clientHeight,
|
|
1545
1545
|
draggable: !1,
|
|
1546
1546
|
className: "touch-none"
|
|
1547
|
-
})), b(this, G, new I.Layer()), b(this, Q, new Un(this)), r(this, H).getStage().add(r(this, G)), r(this, G).add(r(this, Q).getTransformer()), this._renderCanvas(s),
|
|
1547
|
+
})), b(this, G, new I.Layer()), b(this, Q, new Un(this)), r(this, H).getStage().add(r(this, G)), r(this, G).add(r(this, Q).getTransformer()), this._renderCanvas(s), M(this, O, bi).call(this), M(this, O, wi).call(this);
|
|
1548
1548
|
}
|
|
1549
1549
|
/**
|
|
1550
1550
|
* 获取当前主题
|
|
@@ -1664,7 +1664,7 @@ class so extends zn {
|
|
|
1664
1664
|
const o = t.map((s) => ii(this, s.$_type, s, !1)).filter((s) => s !== null);
|
|
1665
1665
|
o.forEach((s) => {
|
|
1666
1666
|
r(this, G).add(s.getElement());
|
|
1667
|
-
}),
|
|
1667
|
+
}), M(this, O, Se).call(this, o, i), this._emit("nodes:created", t);
|
|
1668
1668
|
}
|
|
1669
1669
|
/**
|
|
1670
1670
|
* 创建图片标注节点(内部使用)
|
|
@@ -1676,7 +1676,7 @@ class so extends zn {
|
|
|
1676
1676
|
v.$_type === "image-marker" && typeof v.$_markerNumber == "number" && (h = Math.max(h, v.$_markerNumber));
|
|
1677
1677
|
});
|
|
1678
1678
|
const l = (i.x - s.x) / s.width, d = (i.y - s.y) / s.height, m = (o.x - s.x) / s.width, u = (o.y - s.y) / s.height, g = Math.min(i.x, o.x), p = Math.min(i.y, o.y), x = Math.abs(o.x - i.x), y = Math.abs(o.y - i.y), N = {
|
|
1679
|
-
id:
|
|
1679
|
+
id: Mt(),
|
|
1680
1680
|
$_type: "image-marker",
|
|
1681
1681
|
x: g,
|
|
1682
1682
|
y: p,
|
|
@@ -1755,7 +1755,7 @@ class so extends zn {
|
|
|
1755
1755
|
*/
|
|
1756
1756
|
_finalizeDraftNode() {
|
|
1757
1757
|
if (!r(this, F)) return;
|
|
1758
|
-
const t =
|
|
1758
|
+
const t = Mt(), i = r(this, F).getConfig();
|
|
1759
1759
|
if (i.$_type === "image-marker") {
|
|
1760
1760
|
const s = i.$_bounds, a = {
|
|
1761
1761
|
x: i.x,
|
|
@@ -1802,7 +1802,7 @@ class so extends zn {
|
|
|
1802
1802
|
*/
|
|
1803
1803
|
_createTextNodeAtDrawingPosition(t) {
|
|
1804
1804
|
const i = r(this, W)[1], o = {
|
|
1805
|
-
id:
|
|
1805
|
+
id: Mt(),
|
|
1806
1806
|
$_type: "text",
|
|
1807
1807
|
x: i.x,
|
|
1808
1808
|
y: i.y,
|
|
@@ -1888,7 +1888,7 @@ class so extends zn {
|
|
|
1888
1888
|
return o.forEach((a) => {
|
|
1889
1889
|
const h = this.getStage().findOne(`#${a}`);
|
|
1890
1890
|
h && h.destroy();
|
|
1891
|
-
}),
|
|
1891
|
+
}), M(this, O, Ei).call(this, Array.from(o), !0), r(this, Q).clearNodes(), this._updateState(
|
|
1892
1892
|
{
|
|
1893
1893
|
selectedNodeIds: []
|
|
1894
1894
|
},
|
|
@@ -1914,7 +1914,7 @@ class so extends zn {
|
|
|
1914
1914
|
* 在元素节点改变后(例如 tranfromEnd dragEnd)重建 state.nodes
|
|
1915
1915
|
*/
|
|
1916
1916
|
_rebuildStateAfterNodeChange(t, i) {
|
|
1917
|
-
|
|
1917
|
+
M(this, O, Se).call(this, Array.isArray(t) ? t : [t], i);
|
|
1918
1918
|
}
|
|
1919
1919
|
/**
|
|
1920
1920
|
* 实现父类的状态同步方法
|
|
@@ -2005,12 +2005,12 @@ Ee = function(t) {
|
|
|
2005
2005
|
Se = function(t, i) {
|
|
2006
2006
|
t.length !== 0 && (t.forEach((o) => {
|
|
2007
2007
|
r(this, it).set(o.getID(), o);
|
|
2008
|
-
}),
|
|
2008
|
+
}), M(this, O, Ee).call(this, i));
|
|
2009
2009
|
}, Ei = function(t, i = !1) {
|
|
2010
2010
|
t.length !== 0 && (t.forEach((o) => {
|
|
2011
2011
|
const s = r(this, it).get(o);
|
|
2012
2012
|
s && s.destroy(), r(this, it).delete(o);
|
|
2013
|
-
}),
|
|
2013
|
+
}), M(this, O, Ee).call(this, i));
|
|
2014
2014
|
};
|
|
2015
2015
|
class ro extends so {
|
|
2016
2016
|
/**
|
|
@@ -2049,7 +2049,7 @@ class ro extends so {
|
|
|
2049
2049
|
*/
|
|
2050
2050
|
createImageNode(e, t) {
|
|
2051
2051
|
const i = t ?? { x: 100, y: 100 }, o = {
|
|
2052
|
-
id:
|
|
2052
|
+
id: Mt(),
|
|
2053
2053
|
$_type: "image",
|
|
2054
2054
|
x: i.x,
|
|
2055
2055
|
y: i.y,
|
|
@@ -2418,7 +2418,7 @@ const co = Cn(
|
|
|
2418
2418
|
}
|
|
2419
2419
|
}
|
|
2420
2420
|
);
|
|
2421
|
-
function
|
|
2421
|
+
function _t({
|
|
2422
2422
|
className: n,
|
|
2423
2423
|
variant: e = "default",
|
|
2424
2424
|
size: t = "default",
|
|
@@ -2457,7 +2457,7 @@ function go({ api: n }) {
|
|
|
2457
2457
|
}, h = Math.round(e.scale * 100);
|
|
2458
2458
|
return /* @__PURE__ */ k("div", { className: "zoom-panel flex items-center gap-2", children: [
|
|
2459
2459
|
/* @__PURE__ */ c(
|
|
2460
|
-
|
|
2460
|
+
_t,
|
|
2461
2461
|
{
|
|
2462
2462
|
size: "sm",
|
|
2463
2463
|
variant: "secondary",
|
|
@@ -2467,7 +2467,7 @@ function go({ api: n }) {
|
|
|
2467
2467
|
}
|
|
2468
2468
|
),
|
|
2469
2469
|
/* @__PURE__ */ k(
|
|
2470
|
-
|
|
2470
|
+
_t,
|
|
2471
2471
|
{
|
|
2472
2472
|
size: "sm",
|
|
2473
2473
|
variant: "secondary",
|
|
@@ -2481,7 +2481,7 @@ function go({ api: n }) {
|
|
|
2481
2481
|
}
|
|
2482
2482
|
),
|
|
2483
2483
|
/* @__PURE__ */ c(
|
|
2484
|
-
|
|
2484
|
+
_t,
|
|
2485
2485
|
{
|
|
2486
2486
|
size: "sm",
|
|
2487
2487
|
variant: "secondary",
|
|
@@ -2503,7 +2503,7 @@ function uo({ api: n }) {
|
|
|
2503
2503
|
};
|
|
2504
2504
|
}, [n]), /* @__PURE__ */ k("div", { className: "history-panel flex items-center gap-2", children: [
|
|
2505
2505
|
/* @__PURE__ */ c(
|
|
2506
|
-
|
|
2506
|
+
_t,
|
|
2507
2507
|
{
|
|
2508
2508
|
size: "sm",
|
|
2509
2509
|
variant: "secondary",
|
|
@@ -2514,7 +2514,7 @@ function uo({ api: n }) {
|
|
|
2514
2514
|
}
|
|
2515
2515
|
),
|
|
2516
2516
|
/* @__PURE__ */ c(
|
|
2517
|
-
|
|
2517
|
+
_t,
|
|
2518
2518
|
{
|
|
2519
2519
|
size: "sm",
|
|
2520
2520
|
variant: "secondary",
|
|
@@ -2527,7 +2527,7 @@ function uo({ api: n }) {
|
|
|
2527
2527
|
] });
|
|
2528
2528
|
}
|
|
2529
2529
|
function fs({ setApi: n, theme: e }) {
|
|
2530
|
-
const t =
|
|
2530
|
+
const t = _e(null), [i, o] = R(null), [s, a] = R({ x: 0, y: 0, scale: 1 });
|
|
2531
2531
|
return V(() => {
|
|
2532
2532
|
if (!t.current) return;
|
|
2533
2533
|
const h = new ro(t.current, {
|
|
@@ -2689,7 +2689,7 @@ function Ie(n, e = [], t = !1) {
|
|
|
2689
2689
|
if (!n || !n.state.selection) return !1;
|
|
2690
2690
|
const { selection: i } = n.state;
|
|
2691
2691
|
if (i.empty) return !1;
|
|
2692
|
-
if (i instanceof
|
|
2692
|
+
if (i instanceof Mn) {
|
|
2693
2693
|
const o = i.node;
|
|
2694
2694
|
return o ? e.includes(o.type.name) : !1;
|
|
2695
2695
|
}
|
|
@@ -2704,7 +2704,7 @@ function Ie(n, e = [], t = !1) {
|
|
|
2704
2704
|
return !1;
|
|
2705
2705
|
}
|
|
2706
2706
|
function dt(n) {
|
|
2707
|
-
const { editor: e } =
|
|
2707
|
+
const { editor: e } = _n(), t = pt(
|
|
2708
2708
|
() => n || e,
|
|
2709
2709
|
[n, e]
|
|
2710
2710
|
);
|
|
@@ -2784,7 +2784,7 @@ function Ti({ children: n, ...e }) {
|
|
|
2784
2784
|
}
|
|
2785
2785
|
) : /* @__PURE__ */ c(Ne.Provider, { value: t, children: n });
|
|
2786
2786
|
}
|
|
2787
|
-
const
|
|
2787
|
+
const Mi = $(
|
|
2788
2788
|
function({ children: e, asChild: t = !1, ...i }, o) {
|
|
2789
2789
|
const s = Ni(), a = Ye(e) ? parseInt(rn, 10) >= 19 ? (
|
|
2790
2790
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -2817,7 +2817,7 @@ const _i = $(
|
|
|
2817
2817
|
}
|
|
2818
2818
|
);
|
|
2819
2819
|
}
|
|
2820
|
-
),
|
|
2820
|
+
), _i = $(
|
|
2821
2821
|
function({ style: e, children: t, portal: i = !0, portalProps: o = {}, ...s }, a) {
|
|
2822
2822
|
const h = Ni(), l = ri([h.refs.setFloating, a]);
|
|
2823
2823
|
if (!h.open) return null;
|
|
@@ -2838,8 +2838,8 @@ const _i = $(
|
|
|
2838
2838
|
}
|
|
2839
2839
|
);
|
|
2840
2840
|
Ti.displayName = "Tooltip";
|
|
2841
|
-
|
|
2842
|
-
|
|
2841
|
+
Mi.displayName = "TooltipTrigger";
|
|
2842
|
+
_i.displayName = "TooltipContent";
|
|
2843
2843
|
const vo = ({
|
|
2844
2844
|
shortcuts: n
|
|
2845
2845
|
}) => n.length === 0 ? null : /* @__PURE__ */ c("div", { children: n.map((e, t) => /* @__PURE__ */ k(hn, { children: [
|
|
@@ -2872,7 +2872,7 @@ const vo = ({
|
|
|
2872
2872
|
}
|
|
2873
2873
|
) : /* @__PURE__ */ k(Ti, { delay: 200, children: [
|
|
2874
2874
|
/* @__PURE__ */ c(
|
|
2875
|
-
|
|
2875
|
+
Mi,
|
|
2876
2876
|
{
|
|
2877
2877
|
className: tt("tiptap-button", n),
|
|
2878
2878
|
ref: l,
|
|
@@ -2882,7 +2882,7 @@ const vo = ({
|
|
|
2882
2882
|
children: e
|
|
2883
2883
|
}
|
|
2884
2884
|
),
|
|
2885
|
-
/* @__PURE__ */ k(
|
|
2885
|
+
/* @__PURE__ */ k(_i, { children: [
|
|
2886
2886
|
t,
|
|
2887
2887
|
/* @__PURE__ */ c(vo, { shortcuts: d })
|
|
2888
2888
|
] })
|
|
@@ -3453,7 +3453,7 @@ const Le = $(({ className: n, orientation: e = "vertical", ...t }, i) => /* @__P
|
|
|
3453
3453
|
}
|
|
3454
3454
|
));
|
|
3455
3455
|
Le.displayName = "CardItemGroup";
|
|
3456
|
-
const
|
|
3456
|
+
const Mo = $(
|
|
3457
3457
|
({ className: n, ...e }, t) => /* @__PURE__ */ c(
|
|
3458
3458
|
"div",
|
|
3459
3459
|
{
|
|
@@ -3463,8 +3463,8 @@ const _o = $(
|
|
|
3463
3463
|
}
|
|
3464
3464
|
)
|
|
3465
3465
|
);
|
|
3466
|
-
|
|
3467
|
-
const
|
|
3466
|
+
Mo.displayName = "CardGroupLabel";
|
|
3467
|
+
const _o = $(
|
|
3468
3468
|
({ className: n, ...e }, t) => /* @__PURE__ */ c(
|
|
3469
3469
|
"div",
|
|
3470
3470
|
{
|
|
@@ -3474,7 +3474,7 @@ const Mo = $(
|
|
|
3474
3474
|
}
|
|
3475
3475
|
)
|
|
3476
3476
|
);
|
|
3477
|
-
|
|
3477
|
+
_o.displayName = "CardFooter";
|
|
3478
3478
|
function Io({
|
|
3479
3479
|
shortcutKeys: n = Te
|
|
3480
3480
|
}) {
|
|
@@ -3760,7 +3760,7 @@ function Ao({
|
|
|
3760
3760
|
]),
|
|
3761
3761
|
useColorValue: t = !1
|
|
3762
3762
|
}) {
|
|
3763
|
-
const { handleRemoveHighlight: i } = Be({ editor: n }), o = ye(), s =
|
|
3763
|
+
const { handleRemoveHighlight: i } = Be({ editor: n }), o = ye(), s = _e(null), a = pt(
|
|
3764
3764
|
() => [...e, { label: "Remove highlight", value: "none" }],
|
|
3765
3765
|
[e]
|
|
3766
3766
|
), { selectedIndex: h } = Di({
|
|
@@ -3867,7 +3867,7 @@ const Ve = ot(({ className: n, ...e }) => /* @__PURE__ */ k("svg", { xmlns: "htt
|
|
|
3867
3867
|
] }));
|
|
3868
3868
|
Ve.displayName = "PaletteIcon";
|
|
3869
3869
|
function Lo({
|
|
3870
|
-
shortcutKeys: n =
|
|
3870
|
+
shortcutKeys: n = Me
|
|
3871
3871
|
}) {
|
|
3872
3872
|
return /* @__PURE__ */ c(pe, { children: fe({ shortcutKeys: n }) });
|
|
3873
3873
|
}
|
|
@@ -3943,7 +3943,7 @@ const Wi = $(
|
|
|
3943
3943
|
}
|
|
3944
3944
|
);
|
|
3945
3945
|
Wi.displayName = "TextColorButton";
|
|
3946
|
-
const
|
|
3946
|
+
const Me = "mod+shift+c", Xi = [
|
|
3947
3947
|
{
|
|
3948
3948
|
label: "Black",
|
|
3949
3949
|
value: "var(--tt-color-text-black)",
|
|
@@ -4048,7 +4048,7 @@ function Pe({
|
|
|
4048
4048
|
Bo(a);
|
|
4049
4049
|
}, [a]);
|
|
4050
4050
|
return ai(
|
|
4051
|
-
|
|
4051
|
+
Me,
|
|
4052
4052
|
(y) => {
|
|
4053
4053
|
y.preventDefault(), p();
|
|
4054
4054
|
},
|
|
@@ -4064,7 +4064,7 @@ function Pe({
|
|
|
4064
4064
|
handleTextColor: p,
|
|
4065
4065
|
handleRemoveTextColor: x,
|
|
4066
4066
|
label: t,
|
|
4067
|
-
shortcutKeys:
|
|
4067
|
+
shortcutKeys: Me,
|
|
4068
4068
|
Icon: Ve
|
|
4069
4069
|
};
|
|
4070
4070
|
}
|
|
@@ -4097,7 +4097,7 @@ function Oo({
|
|
|
4097
4097
|
]),
|
|
4098
4098
|
useColorValue: t = !1
|
|
4099
4099
|
}) {
|
|
4100
|
-
const { handleRemoveTextColor: i } = Pe({ editor: n }), o = ye(), s =
|
|
4100
|
+
const { handleRemoveTextColor: i } = Pe({ editor: n }), o = ye(), s = _e(null), a = pt(
|
|
4101
4101
|
() => [...e, { label: "Remove color", value: "none" }],
|
|
4102
4102
|
[e]
|
|
4103
4103
|
), { selectedIndex: h } = Di({
|
package/dist/maze.d.ts
CHANGED
|
@@ -478,7 +478,12 @@ export declare function exportMarkedRegion(api: CanvasApi | null | undefined, im
|
|
|
478
478
|
* @param api
|
|
479
479
|
* @returns
|
|
480
480
|
*/
|
|
481
|
-
export declare function exportSelectionAsImage(api: CanvasApi | null | undefined
|
|
481
|
+
export declare function exportSelectionAsImage(api: CanvasApi | null | undefined, options?: {
|
|
482
|
+
pixelRatio?: number;
|
|
483
|
+
mimeType?: string;
|
|
484
|
+
quality?: number;
|
|
485
|
+
padding?: number;
|
|
486
|
+
}): string | null;
|
|
482
487
|
|
|
483
488
|
declare type HistoryState<T> = {
|
|
484
489
|
past: T[];
|