xiaodao-painter 0.1.9 → 0.1.11

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.
@@ -101,14 +101,33 @@ function ae() {
101
101
  }
102
102
  //#endregion
103
103
  //#region src/components/painter/types/index.ts
104
- var oe = 800, se = 600, ce = 3, le = 16, ue = 8, N = b([]), P = b(/* @__PURE__ */ new Set()), F = b("#000000"), I = b("transparent"), L = b("foreground"), R = b(!1), z = b(3), B = b("transparent"), V = b("light"), H = b(0), U = b("#000000"), W = b(null), G = b(null), K = b(800), q = b(600), J = b(0), Y = b(0), X = b(1), de = b(!1), Z = null, fe = n(() => `0 0 ${K.value} ${q.value}`), pe = n(() => `translate(${J.value}px, ${Y.value}px) scale(${X.value})`);
105
- function me(e, t) {
106
- J.value = e, Y.value = t;
104
+ var oe = 800, se = 600, ce = 3, le = 16, ue = 8, N = 0;
105
+ function P() {
106
+ let e = globalThis.crypto;
107
+ if (e && typeof e.randomUUID == "function") return e.randomUUID();
108
+ let t = /* @__PURE__ */ new Uint8Array(16);
109
+ if (e && typeof e.getRandomValues == "function") e.getRandomValues(t);
110
+ else {
111
+ let e = Date.now(), n = N++;
112
+ for (let r = 0; r < t.length; r++) {
113
+ let i = Math.floor(e / 2 ** (r % 6 * 8)) % 256, a = Math.floor(n / 2 ** (r % 4 * 8)) % 256;
114
+ t[r] = Math.floor(Math.random() * 256) ^ i ^ a;
115
+ }
116
+ }
117
+ t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128;
118
+ let n = Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
119
+ return `${n.slice(0, 8)}-${n.slice(8, 12)}-${n.slice(12, 16)}-${n.slice(16, 20)}-${n.slice(20)}`;
107
120
  }
121
+ //#endregion
122
+ //#region src/components/painter/stores/canvas.ts
123
+ var F = b([]), I = b(/* @__PURE__ */ new Set()), L = b("#000000"), de = b("transparent"), R = b("foreground"), z = b(!1), B = b(3), V = b("transparent"), H = b("light"), U = b(0), W = b("#000000"), fe = b(null), G = b(null), K = b(800), q = b(600), J = b(0), Y = b(0), X = b(1), Z = b(!1), Q = null, pe = n(() => `0 0 ${K.value} ${q.value}`), me = n(() => `translate(${J.value}px, ${Y.value}px) scale(${X.value})`);
108
124
  function he(e, t) {
109
- K.value = e, q.value = t, H.value++;
125
+ J.value = e, Y.value = t;
126
+ }
127
+ function ge(e, t) {
128
+ K.value = e, q.value = t, U.value++;
110
129
  }
111
- var ge = [
130
+ var _e = [
112
131
  .1,
113
132
  .25,
114
133
  .33,
@@ -126,9 +145,9 @@ var ge = [
126
145
  8,
127
146
  10
128
147
  ];
129
- function _e(e, t, n) {
148
+ function ve(e, t, n) {
130
149
  let r = X.value, i = n > 1, a = null;
131
- for (let e of ge) if (i) {
150
+ for (let e of _e) if (i) {
132
151
  if (e > r + .001) {
133
152
  a = e;
134
153
  break;
@@ -136,99 +155,99 @@ function _e(e, t, n) {
136
155
  } else e < r - .001 && (a = e);
137
156
  if (a === null) return;
138
157
  let o = (e - J.value) / r, s = (t - Y.value) / r;
139
- J.value = e - o * a, Y.value = t - s * a, X.value = a, de.value = !0, Z && clearTimeout(Z), Z = setTimeout(() => {
140
- de.value = !1;
158
+ J.value = e - o * a, Y.value = t - s * a, X.value = a, Z.value = !0, Q && clearTimeout(Q), Q = setTimeout(() => {
159
+ Z.value = !1;
141
160
  }, 1500);
142
161
  }
143
- function ve(e, t, n) {
144
- let r = ge[0], i = ge[ge.length - 1];
162
+ function ye(e, t, n) {
163
+ let r = _e[0], i = _e[_e.length - 1];
145
164
  n = Math.max(r, Math.min(i, n));
146
165
  let a = X.value, o = (e - J.value) / a, s = (t - Y.value) / a;
147
- J.value = e - o * n, Y.value = t - s * n, X.value = n, de.value = !0, Z && clearTimeout(Z), Z = setTimeout(() => {
148
- de.value = !1;
166
+ J.value = e - o * n, Y.value = t - s * n, X.value = n, Z.value = !0, Q && clearTimeout(Q), Q = setTimeout(() => {
167
+ Z.value = !1;
149
168
  }, 1500);
150
169
  }
151
- function ye() {
170
+ function be() {
152
171
  return Math.round(X.value * 100);
153
172
  }
154
- var be = b([]), xe = b([]), Se = b(!1), Ce = b(null);
155
- function we(e) {
156
- z.value = e;
157
- }
173
+ var xe = b([]), Se = b([]), Ce = b(!1), we = b(null);
158
174
  function Te(e) {
159
- B.value = e, H.value++;
175
+ B.value = e;
160
176
  }
161
- function Ee() {
162
- R.value = !R.value;
177
+ function Ee(e) {
178
+ V.value = e, U.value++;
163
179
  }
164
180
  function De() {
165
- R.value = !1;
181
+ z.value = !z.value;
166
182
  }
167
- var Oe = n(() => N.value.filter((e) => P.value.has(e.id))), ke = n(() => {
168
- let e = Oe.value.filter((e) => e.type !== "text");
183
+ function Oe() {
184
+ z.value = !1;
185
+ }
186
+ var ke = n(() => F.value.filter((e) => I.value.has(e.id))), Ae = n(() => {
187
+ let e = ke.value.filter((e) => e.type !== "text");
169
188
  if (e.length === 0) return null;
170
189
  let t = e[0].strokeColor;
171
190
  return e.every((e) => e.strokeColor === t) ? t : null;
172
- }), Ae = n(() => {
173
- let e = Oe.value.filter((e) => e.type !== "line" && e.type !== "pencil" && e.type !== "text");
191
+ }), je = n(() => {
192
+ let e = ke.value.filter((e) => e.type !== "line" && e.type !== "pencil" && e.type !== "text");
174
193
  if (e.length === 0) return null;
175
194
  let t = e[0].fillColor;
176
195
  return e.every((e) => e.fillColor === t) ? t : null;
177
- }), je = n(() => {
178
- let e = Oe.value.filter((e) => e.type === "text");
179
- if (e.length === 0) return null;
180
- let t = e[0].textColor ?? F.value;
181
- return e.every((e) => (e.textColor ?? F.value) === t) ? t : null;
182
196
  }), Me = n(() => {
183
- let e = Oe.value;
197
+ let e = ke.value.filter((e) => e.type === "text");
198
+ if (e.length === 0) return null;
199
+ let t = e[0].textColor ?? L.value;
200
+ return e.every((e) => (e.textColor ?? L.value) === t) ? t : null;
201
+ }), Ne = n(() => {
202
+ let e = ke.value;
184
203
  return e.length === 1 ? e[0] : null;
185
- }), Ne = n(() => Me.value?.id ?? null);
186
- function Pe(e) {
187
- return P.value.has(e);
188
- }
204
+ }), Pe = n(() => Ne.value?.id ?? null);
189
205
  function Fe(e) {
190
- P.value = e ? /* @__PURE__ */ new Set([e]) : /* @__PURE__ */ new Set();
206
+ return I.value.has(e);
191
207
  }
192
208
  function Ie(e) {
193
- P.value = new Set(e);
209
+ I.value = e ? /* @__PURE__ */ new Set([e]) : /* @__PURE__ */ new Set();
210
+ }
211
+ function Le(e) {
212
+ I.value = new Set(e);
194
213
  }
195
- function Le() {
196
- P.value = /* @__PURE__ */ new Set();
214
+ function Re() {
215
+ I.value = /* @__PURE__ */ new Set();
197
216
  }
198
- function Re(e) {
199
- Q(), N.value.push(e);
217
+ function ze(e) {
218
+ Ye(), F.value.push(e);
200
219
  }
201
- function ze(e, t) {
202
- let n = N.value.findIndex((t) => t.id === e);
220
+ function Be(e, t) {
221
+ let n = F.value.findIndex((t) => t.id === e);
203
222
  if (n === -1) return;
204
223
  let r = { ...t };
205
224
  r.x !== void 0 && (r.x = Math.round(r.x)), r.y !== void 0 && (r.y = Math.round(r.y)), r.width !== void 0 && (r.width = Math.round(r.width)), r.height !== void 0 && (r.height = Math.round(r.height)), r.points &&= r.points.map((e) => ({
206
225
  x: Math.round(e.x),
207
226
  y: Math.round(e.y)
208
- })), N.value[n] = {
209
- ...N.value[n],
227
+ })), F.value[n] = {
228
+ ...F.value[n],
210
229
  ...r
211
230
  };
212
231
  }
213
- function Be() {
214
- let e = P.value;
215
- e.size !== 0 && (Q(), N.value = N.value.filter((t) => !e.has(t.id)), P.value = /* @__PURE__ */ new Set());
216
- }
217
- var Ve = n(() => be.value.length > 0), He = n(() => xe.value.length > 0), Ue = b([]);
218
- function We() {
219
- P.value.size !== 0 && (Ue.value = Oe.value.map((e) => qe(e)), Be());
232
+ function Ve() {
233
+ let e = I.value;
234
+ e.size !== 0 && (Ye(), F.value = F.value.filter((t) => !e.has(t.id)), I.value = /* @__PURE__ */ new Set());
220
235
  }
236
+ var He = n(() => xe.value.length > 0), Ue = n(() => Se.value.length > 0), We = b([]);
221
237
  function Ge() {
222
- P.value.size !== 0 && (Ue.value = Oe.value.map((e) => qe(e)));
238
+ I.value.size !== 0 && (We.value = ke.value.map((e) => Je(e)), Ve());
223
239
  }
224
240
  function Ke() {
225
- if (Ue.value.length === 0) return;
226
- Q(), Le();
241
+ I.value.size !== 0 && (We.value = ke.value.map((e) => Je(e)));
242
+ }
243
+ function qe() {
244
+ if (We.value.length === 0) return;
245
+ Ye(), Re();
227
246
  let e = [];
228
- for (let t of Ue.value) {
247
+ for (let t of We.value) {
229
248
  let n = {
230
- ...qe(t),
231
- id: rt(),
249
+ ...Je(t),
250
+ id: at(),
232
251
  x: t.x + 20,
233
252
  y: t.y + 20,
234
253
  points: t.points.map((e) => ({
@@ -236,61 +255,61 @@ function Ke() {
236
255
  y: e.y + 20
237
256
  }))
238
257
  };
239
- N.value.push(n), e.push(n.id);
258
+ F.value.push(n), e.push(n.id);
240
259
  }
241
- Ie(e);
260
+ Le(e);
242
261
  }
243
- function qe(e) {
262
+ function Je(e) {
244
263
  return {
245
264
  ...e,
246
265
  points: e.points.map((e) => ({ ...e }))
247
266
  };
248
267
  }
249
- function Q() {
250
- be.value.push(N.value.map((e) => ({
268
+ function Ye() {
269
+ xe.value.push(F.value.map((e) => ({
251
270
  ...e,
252
271
  points: e.points.map((e) => ({ ...e }))
253
- }))), xe.value = [];
272
+ }))), Se.value = [];
254
273
  }
255
- function Je() {
256
- be.value.length !== 0 && (xe.value.push(N.value.map((e) => ({
274
+ function Xe() {
275
+ xe.value.length !== 0 && (Se.value.push(F.value.map((e) => ({
257
276
  ...e,
258
277
  points: e.points.map((e) => ({ ...e }))
259
- }))), N.value = be.value.pop(), P.value = /* @__PURE__ */ new Set());
278
+ }))), F.value = xe.value.pop(), I.value = /* @__PURE__ */ new Set());
260
279
  }
261
- function Ye() {
262
- xe.value.length !== 0 && (be.value.push(N.value.map((e) => ({
280
+ function Ze() {
281
+ Se.value.length !== 0 && (xe.value.push(F.value.map((e) => ({
263
282
  ...e,
264
283
  points: e.points.map((e) => ({ ...e }))
265
- }))), N.value = xe.value.pop(), P.value = /* @__PURE__ */ new Set());
284
+ }))), F.value = Se.value.pop(), I.value = /* @__PURE__ */ new Set());
266
285
  }
267
- function Xe() {
268
- let e = P.value;
286
+ function Qe() {
287
+ let e = I.value;
269
288
  if (e.size === 0) return;
270
- Q();
271
- let t = N.value.map((t, n) => e.has(t.id) ? n : -1).filter((e) => e >= 0).sort((e, t) => t - e);
272
- for (let e of t) e < N.value.length - 1 && ([N.value[e], N.value[e + 1]] = [N.value[e + 1], N.value[e]]);
289
+ Ye();
290
+ let t = F.value.map((t, n) => e.has(t.id) ? n : -1).filter((e) => e >= 0).sort((e, t) => t - e);
291
+ for (let e of t) e < F.value.length - 1 && ([F.value[e], F.value[e + 1]] = [F.value[e + 1], F.value[e]]);
273
292
  }
274
- function Ze() {
275
- let e = P.value;
293
+ function $e() {
294
+ let e = I.value;
276
295
  if (e.size === 0) return;
277
- Q();
278
- let t = N.value.map((t, n) => e.has(t.id) ? n : -1).filter((e) => e >= 0).sort((e, t) => e - t);
279
- for (let e of t) e > 0 && ([N.value[e], N.value[e - 1]] = [N.value[e - 1], N.value[e]]);
296
+ Ye();
297
+ let t = F.value.map((t, n) => e.has(t.id) ? n : -1).filter((e) => e >= 0).sort((e, t) => e - t);
298
+ for (let e of t) e > 0 && ([F.value[e], F.value[e - 1]] = [F.value[e - 1], F.value[e]]);
280
299
  }
281
- var Qe = !1;
282
- function $e(e) {
283
- if (Qe) return;
284
- Qe = !0, N.value = Array.isArray(e) ? e.map((e) => ({
300
+ var et = !1;
301
+ function tt(e) {
302
+ if (et) return;
303
+ et = !0, F.value = Array.isArray(e) ? e.map((e) => ({
285
304
  ...e,
286
305
  points: e.points.map((e) => ({ ...e }))
287
306
  })) : [];
288
- let t = new Set(N.value.map((e) => e.id));
289
- P.value = new Set([...P.value].filter((e) => t.has(e))), setTimeout(() => {
290
- Qe = !1;
307
+ let t = new Set(F.value.map((e) => e.id));
308
+ I.value = new Set([...I.value].filter((e) => t.has(e))), setTimeout(() => {
309
+ et = !1;
291
310
  }, 0);
292
311
  }
293
- function et(e) {
312
+ function nt(e) {
294
313
  let { x: t, y: n, width: r, height: i, type: a } = e;
295
314
  return a === "line" || a === "triangle" || a === "star" ? {
296
315
  x: r >= 0 ? t : t + r,
@@ -304,40 +323,40 @@ function et(e) {
304
323
  height: i
305
324
  };
306
325
  }
307
- function tt(e) {
308
- L.value = e;
326
+ function rt(e) {
327
+ R.value = e;
309
328
  }
310
- function nt(e) {
311
- if (P.value.size > 0) {
312
- Q();
313
- for (let t of P.value) {
314
- let n = N.value.find((e) => e.id === t);
315
- if (L.value === "foreground") {
329
+ function it(e) {
330
+ if (I.value.size > 0) {
331
+ Ye();
332
+ for (let t of I.value) {
333
+ let n = F.value.find((e) => e.id === t);
334
+ if (R.value === "foreground") {
316
335
  if (e === "transparent" || n?.type === "text") continue;
317
- ze(t, { strokeColor: e });
318
- } else if (L.value === "textColor") {
336
+ Be(t, { strokeColor: e });
337
+ } else if (R.value === "textColor") {
319
338
  if (e === "transparent") return;
320
- ze(t, { textColor: e });
339
+ Be(t, { textColor: e });
321
340
  } else {
322
341
  if (n?.type === "text") continue;
323
- ze(t, { fillColor: e });
342
+ Be(t, { fillColor: e });
324
343
  }
325
344
  }
326
- H.value++;
327
- } else if (L.value === "foreground") {
345
+ U.value++;
346
+ } else if (R.value === "foreground") {
328
347
  if (e === "transparent") return;
329
- F.value = e;
330
- } else if (L.value === "textColor") {
348
+ L.value = e;
349
+ } else if (R.value === "textColor") {
331
350
  if (e === "transparent") return;
332
- U.value = e;
333
- } else I.value = e;
351
+ W.value = e;
352
+ } else de.value = e;
334
353
  }
335
- function rt() {
336
- return crypto.randomUUID();
354
+ function at() {
355
+ return P();
337
356
  }
338
- function it(e, t, n, r, i, a) {
357
+ function ot(e, t, n, r, i, a) {
339
358
  return {
340
- id: rt(),
359
+ id: at(),
341
360
  type: e,
342
361
  x: Math.round(t),
343
362
  y: Math.round(n),
@@ -347,14 +366,14 @@ function it(e, t, n, r, i, a) {
347
366
  x: Math.round(e.x),
348
367
  y: Math.round(e.y)
349
368
  })),
350
- strokeColor: F.value,
351
- fillColor: e === "pencil" || e === "line" ? "none" : I.value,
352
- strokeWidth: z.value,
369
+ strokeColor: L.value,
370
+ fillColor: e === "pencil" || e === "line" ? "none" : de.value,
371
+ strokeWidth: B.value,
353
372
  ...e === "text" ? {
354
373
  text: "",
355
374
  fontSize: 16,
356
375
  textAlign: "left",
357
- textColor: F.value,
376
+ textColor: L.value,
358
377
  textAutoWidth: !0,
359
378
  fillColor: "transparent",
360
379
  strokeColor: "transparent",
@@ -363,101 +382,101 @@ function it(e, t, n, r, i, a) {
363
382
  } : {}
364
383
  };
365
384
  }
366
- function at() {
367
- N.value = [], P.value = /* @__PURE__ */ new Set(), F.value = "#000000", I.value = "transparent", L.value = "foreground", R.value = !1, z.value = 3, B.value = "transparent", V.value = "light", H.value = 0, U.value = "#000000", W.value = null, G.value = null, K.value = 800, q.value = 600, J.value = 0, Y.value = 0, X.value = 1, de.value = !1, Z &&= (clearTimeout(Z), null), be.value = [], xe.value = [], Se.value = !1, Ce.value = null, Ue.value = [];
385
+ function st() {
386
+ F.value = [], I.value = /* @__PURE__ */ new Set(), L.value = "#000000", de.value = "transparent", R.value = "foreground", z.value = !1, B.value = 3, V.value = "transparent", H.value = "light", U.value = 0, W.value = "#000000", fe.value = null, G.value = null, K.value = 800, q.value = 600, J.value = 0, Y.value = 0, X.value = 1, Z.value = !1, Q &&= (clearTimeout(Q), null), xe.value = [], Se.value = [], Ce.value = !1, we.value = null, We.value = [];
368
387
  }
369
- var ot = y({
370
- strokes: N,
371
- selectedStrokeIds: P,
372
- selectedStrokeId: Ne,
373
- selectedStroke: Me,
374
- selectedStrokes: Oe,
375
- selectedStrokeColor: ke,
376
- selectedFillColor: Ae,
377
- selectedTextColor: je,
378
- foregroundColor: F,
379
- backgroundColor: I,
380
- activeColorSlot: L,
381
- showColorPalette: R,
382
- isSelecting: Se,
383
- selectionBox: Ce,
384
- toggleColorPalette: Ee,
385
- hideColorPalette: De,
386
- addStroke: Re,
387
- updateStroke: ze,
388
- selectStroke: Fe,
389
- selectStrokes: Ie,
390
- clearSelection: Le,
391
- isSelected: Pe,
392
- deleteSelectedStrokes: Be,
393
- setColorSlot: tt,
394
- setColor: nt,
395
- buildStroke: it,
396
- strokeWidth: z,
397
- setStrokeWidth: we,
398
- canvasBackgroundColor: B,
399
- setCanvasBackgroundColor: Te,
400
- canUndo: Ve,
401
- canRedo: He,
402
- undoStack: be,
403
- pushUndo: Q,
404
- undo: Je,
405
- redo: Ye,
406
- moveSelectedUp: Xe,
407
- moveSelectedDown: Ze,
408
- syncFromParent: $e,
409
- getStrokeDisplayBounds: et,
410
- clipboard: Ue,
411
- cutSelectedStrokes: We,
412
- copySelectedStrokes: Ge,
413
- pasteStrokes: Ke,
388
+ var ct = y({
389
+ strokes: F,
390
+ selectedStrokeIds: I,
391
+ selectedStrokeId: Pe,
392
+ selectedStroke: Ne,
393
+ selectedStrokes: ke,
394
+ selectedStrokeColor: Ae,
395
+ selectedFillColor: je,
396
+ selectedTextColor: Me,
397
+ foregroundColor: L,
398
+ backgroundColor: de,
399
+ activeColorSlot: R,
400
+ showColorPalette: z,
401
+ isSelecting: Ce,
402
+ selectionBox: we,
403
+ toggleColorPalette: De,
404
+ hideColorPalette: Oe,
405
+ addStroke: ze,
406
+ updateStroke: Be,
407
+ selectStroke: Ie,
408
+ selectStrokes: Le,
409
+ clearSelection: Re,
410
+ isSelected: Fe,
411
+ deleteSelectedStrokes: Ve,
412
+ setColorSlot: rt,
413
+ setColor: it,
414
+ buildStroke: ot,
415
+ strokeWidth: B,
416
+ setStrokeWidth: Te,
417
+ canvasBackgroundColor: V,
418
+ setCanvasBackgroundColor: Ee,
419
+ canUndo: He,
420
+ canRedo: Ue,
421
+ undoStack: xe,
422
+ pushUndo: Ye,
423
+ undo: Xe,
424
+ redo: Ze,
425
+ moveSelectedUp: Qe,
426
+ moveSelectedDown: $e,
427
+ syncFromParent: tt,
428
+ getStrokeDisplayBounds: nt,
429
+ clipboard: We,
430
+ cutSelectedStrokes: Ge,
431
+ copySelectedStrokes: Ke,
432
+ pasteStrokes: qe,
414
433
  canvasWidth: K,
415
434
  canvasHeight: q,
416
435
  panX: J,
417
436
  panY: Y,
418
437
  zoomLevel: X,
419
- showZoomIndicator: de,
420
- viewBox: fe,
421
- canvasTransform: pe,
422
- setPan: me,
423
- setCanvasSize: he,
424
- zoomAt: _e,
425
- continuousZoomAt: ve,
426
- getZoomPercent: ye,
427
- dataVersion: H,
428
- theme: V,
429
- textColor: U,
430
- editingTextId: W,
438
+ showZoomIndicator: Z,
439
+ viewBox: pe,
440
+ canvasTransform: me,
441
+ setPan: he,
442
+ setCanvasSize: ge,
443
+ zoomAt: ve,
444
+ continuousZoomAt: ye,
445
+ getZoomPercent: be,
446
+ dataVersion: U,
447
+ theme: H,
448
+ textColor: W,
449
+ editingTextId: fe,
431
450
  hoveredTextId: G,
432
- reset: at
451
+ reset: st
433
452
  });
434
- function st() {
435
- return ot;
453
+ function lt() {
454
+ return ct;
436
455
  }
437
456
  //#endregion
438
457
  //#region src/components/painter/stores/tools.ts
439
- var ct = b("select");
440
- function lt(e) {
441
- if (ct.value === "select" && e !== "select") {
442
- let e = st();
458
+ var ut = b("select");
459
+ function dt(e) {
460
+ if (ut.value === "select" && e !== "select") {
461
+ let e = lt();
443
462
  e.selectedStrokeIds.size > 0 && e.clearSelection();
444
463
  }
445
- ct.value = e;
464
+ ut.value = e;
446
465
  }
447
- function ut() {
448
- ct.value = "select";
466
+ function ft() {
467
+ ut.value = "select";
449
468
  }
450
- var dt = y({
451
- activeTool: ct,
452
- setTool: lt,
453
- reset: ut
469
+ var pt = y({
470
+ activeTool: ut,
471
+ setTool: dt,
472
+ reset: ft
454
473
  });
455
- function ft() {
456
- return dt;
474
+ function mt() {
475
+ return pt;
457
476
  }
458
477
  //#endregion
459
478
  //#region src/components/painter/Toolbar.vue?vue&type=script&setup=true&lang.ts
460
- var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" }, gt = ["title", "onClick"], _t = {
479
+ var ht = { class: "toolbar" }, gt = ["disabled"], _t = { class: "tool-group" }, vt = ["title", "onClick"], yt = {
461
480
  key: 0,
462
481
  class: "tool-icon",
463
482
  viewBox: "0 0 24 24",
@@ -466,7 +485,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
466
485
  "stroke-width": "1.6",
467
486
  "stroke-linecap": "round",
468
487
  "stroke-linejoin": "round"
469
- }, vt = {
488
+ }, bt = {
470
489
  key: 1,
471
490
  class: "tool-icon",
472
491
  viewBox: "0 0 24 24",
@@ -474,7 +493,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
474
493
  stroke: "currentColor",
475
494
  "stroke-width": "1.8",
476
495
  "stroke-linecap": "round"
477
- }, yt = {
496
+ }, xt = {
478
497
  key: 2,
479
498
  class: "tool-icon",
480
499
  viewBox: "0 0 24 24",
@@ -483,7 +502,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
483
502
  "stroke-width": "1.8",
484
503
  "stroke-linecap": "round",
485
504
  "stroke-linejoin": "round"
486
- }, bt = {
505
+ }, St = {
487
506
  key: 3,
488
507
  class: "tool-icon",
489
508
  viewBox: "0 0 24 24",
@@ -491,14 +510,14 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
491
510
  stroke: "currentColor",
492
511
  "stroke-width": "1.8",
493
512
  "stroke-linecap": "round"
494
- }, xt = {
513
+ }, Ct = {
495
514
  key: 4,
496
515
  class: "tool-icon",
497
516
  viewBox: "0 0 24 24",
498
517
  fill: "none",
499
518
  stroke: "currentColor",
500
519
  "stroke-width": "1.8"
501
- }, St = {
520
+ }, wt = {
502
521
  key: 5,
503
522
  class: "tool-icon",
504
523
  viewBox: "0 0 24 24",
@@ -506,7 +525,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
506
525
  stroke: "currentColor",
507
526
  "stroke-width": "1.8",
508
527
  "stroke-linejoin": "round"
509
- }, Ct = {
528
+ }, Tt = {
510
529
  key: 6,
511
530
  class: "tool-icon",
512
531
  viewBox: "0 0 24 24",
@@ -514,7 +533,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
514
533
  stroke: "currentColor",
515
534
  "stroke-width": "1.8",
516
535
  "stroke-linejoin": "round"
517
- }, wt = {
536
+ }, Et = {
518
537
  key: 7,
519
538
  class: "tool-icon",
520
539
  viewBox: "0 0 24 24",
@@ -522,7 +541,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
522
541
  stroke: "currentColor",
523
542
  "stroke-width": "1.8",
524
543
  "stroke-linejoin": "round"
525
- }, Tt = {
544
+ }, Dt = {
526
545
  key: 8,
527
546
  class: "tool-icon",
528
547
  viewBox: "0 0 24 24",
@@ -531,7 +550,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
531
550
  "stroke-width": "1.8",
532
551
  "stroke-linecap": "round",
533
552
  "stroke-linejoin": "round"
534
- }, Et = { class: "tool-group nav-group" }, Dt = ["title"], Ot = ["disabled"], kt = { class: "canvas-size-wrapper" }, At = ["title"], jt = { class: "popover-title" }, Mt = { class: "popover-field" }, Nt = { class: "popover-label" }, Pt = { class: "popover-field" }, Ft = { class: "popover-label" }, It = { class: "popover-field" }, Lt = { class: "popover-label" }, Rt = { class: "bg-color-row" }, zt = ["title"], Bt = ["value"], Vt = ["title"], Ht = { class: "popover-actions" }, Ut = { class: "color-section" }, Wt = ["title"], Gt = { class: "color-swatch text-color-swatch" }, Kt = {
553
+ }, Ot = { class: "tool-group nav-group" }, kt = ["title"], At = ["disabled"], jt = { class: "canvas-size-wrapper" }, Mt = ["title"], Nt = { class: "popover-title" }, Pt = { class: "popover-field" }, Ft = { class: "popover-label" }, It = { class: "popover-field" }, Lt = { class: "popover-label" }, Rt = { class: "popover-field" }, zt = { class: "popover-label" }, Bt = { class: "bg-color-row" }, Vt = ["title"], Ht = ["value"], Ut = ["title"], Wt = { class: "popover-actions" }, Gt = { class: "color-section" }, Kt = ["title"], qt = { class: "color-swatch text-color-swatch" }, Jt = {
535
554
  key: 0,
536
555
  class: "mixed-icon",
537
556
  viewBox: "0 0 24 24",
@@ -539,7 +558,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
539
558
  stroke: "currentColor",
540
559
  "stroke-width": "2",
541
560
  "stroke-linecap": "round"
542
- }, qt = ["title"], Jt = {
561
+ }, Yt = ["title"], Xt = {
543
562
  key: 0,
544
563
  class: "mixed-icon",
545
564
  viewBox: "0 0 24 24",
@@ -547,7 +566,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
547
566
  stroke: "currentColor",
548
567
  "stroke-width": "2",
549
568
  "stroke-linecap": "round"
550
- }, Yt = ["title"], Xt = {
569
+ }, Zt = ["title"], Qt = {
551
570
  key: 0,
552
571
  class: "mixed-icon",
553
572
  viewBox: "0 0 24 24",
@@ -555,7 +574,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
555
574
  stroke: "currentColor",
556
575
  "stroke-width": "2",
557
576
  "stroke-linecap": "round"
558
- }, Zt = {
577
+ }, $t = {
559
578
  key: 1,
560
579
  class: "mixed-icon",
561
580
  viewBox: "0 0 24 24",
@@ -563,10 +582,10 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
563
582
  stroke: "currentColor",
564
583
  "stroke-width": "2",
565
584
  "stroke-linecap": "round"
566
- }, Qt = 42, $t = /*@__PURE__*/ l({
585
+ }, en = 42, tn = /*@__PURE__*/ l({
567
586
  __name: "Toolbar",
568
587
  setup(c) {
569
- let l = ft(), u = st(), { t: d } = ie(), f = ae(), v = b(null), y = b(!1), S = b(!1);
588
+ let l = mt(), u = lt(), { t: d } = ie(), f = ae(), v = b(null), y = b(!1), S = b(!1);
570
589
  function T() {
571
590
  let e = v.value;
572
591
  e && (y.value = e.scrollTop > 0, S.value = e.scrollTop + e.clientHeight < e.scrollHeight - 1);
@@ -581,7 +600,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
581
600
  function O() {
582
601
  let e = v.value;
583
602
  e && e.scrollBy({
584
- top: Qt,
603
+ top: en,
585
604
  behavior: "smooth"
586
605
  });
587
606
  }
@@ -644,17 +663,17 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
644
663
  function L(e) {
645
664
  e.key === "Escape" && (A.value = !1);
646
665
  }
647
- let R = n(() => k.value && u.selectedStrokeColor !== null ? u.selectedStrokeColor : u.foregroundColor), z = n(() => !U.value && k.value && u.selectedStrokeColor === null), B = n(() => k.value && u.selectedFillColor !== null ? u.selectedFillColor : u.backgroundColor), V = n(() => !U.value && k.value && u.selectedFillColor === null), H = n(() => u.selectedStrokes.some((e) => e.type === "text")), U = n(() => k.value && u.selectedStrokes.every((e) => e.type === "text")), W = n(() => U.value), G = n(() => U.value), K = n(() => k.value && u.selectedTextColor !== null ? u.selectedTextColor : u.textColor), q = n(() => H.value && u.selectedTextColor === null);
648
- function J() {
666
+ let de = n(() => k.value && u.selectedStrokeColor !== null ? u.selectedStrokeColor : u.foregroundColor), R = n(() => !H.value && k.value && u.selectedStrokeColor === null), z = n(() => k.value && u.selectedFillColor !== null ? u.selectedFillColor : u.backgroundColor), B = n(() => !H.value && k.value && u.selectedFillColor === null), V = n(() => u.selectedStrokes.some((e) => e.type === "text")), H = n(() => k.value && u.selectedStrokes.every((e) => e.type === "text")), U = n(() => H.value), W = n(() => H.value), fe = n(() => k.value && u.selectedTextColor !== null ? u.selectedTextColor : u.textColor), G = n(() => V.value && u.selectedTextColor === null);
667
+ function K() {
649
668
  u.setColorSlot("textColor"), u.toggleColorPalette();
650
669
  }
651
- function Y() {
652
- W.value || (u.setColorSlot("foreground"), u.toggleColorPalette());
670
+ function q() {
671
+ U.value || (u.setColorSlot("foreground"), u.toggleColorPalette());
653
672
  }
654
- function X() {
655
- G.value || (u.setColorSlot("background"), u.toggleColorPalette());
673
+ function J() {
674
+ W.value || (u.setColorSlot("background"), u.toggleColorPalette());
656
675
  }
657
- return (n, c) => (_(), a("div", pt, [
676
+ return (n, c) => (_(), a("div", ht, [
658
677
  y.value || S.value ? (_(), a("button", {
659
678
  key: 0,
660
679
  class: "scroll-btn scroll-up",
@@ -668,33 +687,33 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
668
687
  "stroke-width": "2",
669
688
  "stroke-linecap": "round",
670
689
  "stroke-linejoin": "round"
671
- }, [o("polyline", { points: "18 15 12 9 6 15" })], -1)]], 8, mt)) : i("", !0),
690
+ }, [o("polyline", { points: "18 15 12 9 6 15" })], -1)]], 8, gt)) : i("", !0),
672
691
  o("div", {
673
692
  ref_key: "toolsScrollRef",
674
693
  ref: v,
675
694
  class: "tools-scroll",
676
695
  onScroll: T
677
- }, [o("div", ht, [(_(), a(e, null, x(re, (e) => o("button", {
696
+ }, [o("div", _t, [(_(), a(e, null, x(re, (e) => o("button", {
678
697
  key: e,
679
698
  class: p(["tool-btn", { active: w(l).activeTool === e }]),
680
699
  title: w(d)(`tool.${e}`),
681
700
  onClick: (t) => w(l).setTool(e)
682
- }, [e === "select" ? (_(), a("svg", _t, [...c[4] ||= [o("path", { d: "M4.5 3.5l5.5 15 2.5-6 6-2.5z" }, null, -1)]])) : e === "pan" ? (_(), a("svg", vt, [...c[5] ||= [s("<line x1=\"12\" y1=\"4\" x2=\"12\" y2=\"20\" data-v-9532ade7></line><line x1=\"4\" y1=\"12\" x2=\"20\" y2=\"12\" data-v-9532ade7></line><polygon points=\"12,4 9,8 15,8\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon><polygon points=\"12,20 9,16 15,16\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon><polygon points=\"4,12 8,9 8,15\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon><polygon points=\"20,12 16,9 16,15\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon>", 6)]])) : e === "pencil" ? (_(), a("svg", yt, [...c[6] ||= [o("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z" }, null, -1), o("path", { d: "m15 5 4 4" }, null, -1)]])) : e === "line" ? (_(), a("svg", bt, [...c[7] ||= [o("line", {
701
+ }, [e === "select" ? (_(), a("svg", yt, [...c[4] ||= [o("path", { d: "M4.5 3.5l5.5 15 2.5-6 6-2.5z" }, null, -1)]])) : e === "pan" ? (_(), a("svg", bt, [...c[5] ||= [s("<line x1=\"12\" y1=\"4\" x2=\"12\" y2=\"20\" data-v-9532ade7></line><line x1=\"4\" y1=\"12\" x2=\"20\" y2=\"12\" data-v-9532ade7></line><polygon points=\"12,4 9,8 15,8\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon><polygon points=\"12,20 9,16 15,16\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon><polygon points=\"4,12 8,9 8,15\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon><polygon points=\"20,12 16,9 16,15\" fill=\"currentColor\" stroke=\"none\" data-v-9532ade7></polygon>", 6)]])) : e === "pencil" ? (_(), a("svg", xt, [...c[6] ||= [o("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z" }, null, -1), o("path", { d: "m15 5 4 4" }, null, -1)]])) : e === "line" ? (_(), a("svg", St, [...c[7] ||= [o("line", {
683
702
  x1: "5",
684
703
  y1: "19",
685
704
  x2: "19",
686
705
  y2: "5"
687
- }, null, -1)]])) : e === "circle" ? (_(), a("svg", xt, [...c[8] ||= [o("circle", {
706
+ }, null, -1)]])) : e === "circle" ? (_(), a("svg", Ct, [...c[8] ||= [o("circle", {
688
707
  cx: "12",
689
708
  cy: "12",
690
709
  r: "9"
691
- }, null, -1)]])) : e === "rect" ? (_(), a("svg", St, [...c[9] ||= [o("rect", {
710
+ }, null, -1)]])) : e === "rect" ? (_(), a("svg", wt, [...c[9] ||= [o("rect", {
692
711
  x: "3",
693
712
  y: "3",
694
713
  width: "18",
695
714
  height: "18",
696
715
  rx: "2"
697
- }, null, -1)]])) : e === "triangle" ? (_(), a("svg", Ct, [...c[10] ||= [o("polygon", { points: "12,3 22,21 2,21" }, null, -1)]])) : e === "star" ? (_(), a("svg", wt, [...c[11] ||= [o("polygon", { points: "12,2 15.09,8.26 22,9.27 17,14.14 18.18,21.02 12,17.77 5.82,21.02 7,14.14 2,9.27 8.91,8.26" }, null, -1)]])) : e === "text" ? (_(), a("svg", Tt, [...c[12] ||= [
716
+ }, null, -1)]])) : e === "triangle" ? (_(), a("svg", Tt, [...c[10] ||= [o("polygon", { points: "12,3 22,21 2,21" }, null, -1)]])) : e === "star" ? (_(), a("svg", Et, [...c[11] ||= [o("polygon", { points: "12,2 15.09,8.26 22,9.27 17,14.14 18.18,21.02 12,17.77 5.82,21.02 7,14.14 2,9.27 8.91,8.26" }, null, -1)]])) : e === "text" ? (_(), a("svg", Dt, [...c[12] ||= [
698
717
  o("polyline", { points: "4 7 4 4 20 4 20 7" }, null, -1),
699
718
  o("line", {
700
719
  x1: "9",
@@ -708,11 +727,11 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
708
727
  x2: "12",
709
728
  y2: "20"
710
729
  }, null, -1)
711
- ]])) : i("", !0)], 10, gt)), 64))]), o("div", Et, [o("button", {
730
+ ]])) : i("", !0)], 10, vt)), 64))]), o("div", Ot, [o("button", {
712
731
  class: p(["tool-btn", { active: w(l).activeTool === "zoom" }]),
713
732
  title: w(d)("tool.zoom"),
714
733
  onClick: c[0] ||= (e) => w(l).setTool("zoom")
715
- }, [...c[13] ||= [s("<svg class=\"tool-icon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-9532ade7><circle cx=\"11\" cy=\"11\" r=\"8\" data-v-9532ade7></circle><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\" data-v-9532ade7></line><line x1=\"11\" y1=\"8\" x2=\"11\" y2=\"14\" data-v-9532ade7></line><line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\" data-v-9532ade7></line></svg>", 1)]], 10, Dt)])], 544),
734
+ }, [...c[13] ||= [s("<svg class=\"tool-icon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-9532ade7><circle cx=\"11\" cy=\"11\" r=\"8\" data-v-9532ade7></circle><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\" data-v-9532ade7></line><line x1=\"11\" y1=\"8\" x2=\"11\" y2=\"14\" data-v-9532ade7></line><line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\" data-v-9532ade7></line></svg>", 1)]], 10, kt)])], 544),
716
735
  y.value || S.value ? (_(), a("button", {
717
736
  key: 1,
718
737
  class: "scroll-btn scroll-down",
@@ -726,9 +745,9 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
726
745
  "stroke-width": "2",
727
746
  "stroke-linecap": "round",
728
747
  "stroke-linejoin": "round"
729
- }, [o("polyline", { points: "6 9 12 15 18 9" })], -1)]], 8, Ot)) : i("", !0),
748
+ }, [o("polyline", { points: "6 9 12 15 18 9" })], -1)]], 8, At)) : i("", !0),
730
749
  c[24] ||= o("div", { class: "spacer" }, null, -1),
731
- o("div", kt, [o("button", {
750
+ o("div", jt, [o("button", {
732
751
  class: "tool-btn",
733
752
  title: w(d)("canvasSize.title"),
734
753
  onClick: oe
@@ -760,7 +779,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
760
779
  x2: "19",
761
780
  y2: "22"
762
781
  })
763
- ], -1)]], 8, At), (_(), r(t, { to: "body" }, [A.value ? (_(), a("div", {
782
+ ], -1)]], 8, Mt), (_(), r(t, { to: "body" }, [A.value ? (_(), a("div", {
764
783
  key: 0,
765
784
  class: "canvas-size-backdrop",
766
785
  onMousedown: I
@@ -769,9 +788,9 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
769
788
  style: m(F.value),
770
789
  onKeydown: L
771
790
  }, [
772
- o("div", jt, C(w(d)("canvasSize.title")), 1),
773
- o("div", Mt, [
774
- o("label", Nt, C(w(d)("canvasSize.width")), 1),
791
+ o("div", Nt, C(w(d)("canvasSize.title")), 1),
792
+ o("div", Pt, [
793
+ o("label", Ft, C(w(d)("canvasSize.width")), 1),
775
794
  D(o("input", {
776
795
  ref: "widthInput",
777
796
  "onUpdate:modelValue": c[1] ||= (e) => j.value.width = e,
@@ -787,8 +806,8 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
787
806
  ]]),
788
807
  c[16] ||= o("span", { class: "popover-unit" }, "px", -1)
789
808
  ]),
790
- o("div", Pt, [
791
- o("label", Ft, C(w(d)("canvasSize.height")), 1),
809
+ o("div", It, [
810
+ o("label", Lt, C(w(d)("canvasSize.height")), 1),
792
811
  D(o("input", {
793
812
  "onUpdate:modelValue": c[2] ||= (e) => j.value.height = e,
794
813
  type: "number",
@@ -803,7 +822,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
803
822
  ]]),
804
823
  c[17] ||= o("span", { class: "popover-unit" }, "px", -1)
805
824
  ]),
806
- o("div", It, [o("label", Lt, C(w(d)("canvasSize.background")), 1), o("div", Rt, [o("button", {
825
+ o("div", Rt, [o("label", zt, C(w(d)("canvasSize.background")), 1), o("div", Bt, [o("button", {
807
826
  class: p(["bg-radio-btn", { active: M.value !== "transparent" }]),
808
827
  title: w(d)("canvasSize.solidColor"),
809
828
  onClick: ce
@@ -817,7 +836,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
817
836
  class: "hidden-color-input",
818
837
  value: M.value === "transparent" ? "#ffffff" : M.value,
819
838
  onChange: le
820
- }, null, 40, Bt)], 10, zt), o("button", {
839
+ }, null, 40, Ht)], 10, Vt), o("button", {
821
840
  class: p([
822
841
  "bg-radio-btn",
823
842
  "bg-radio-btn--transparent",
@@ -838,8 +857,8 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
838
857
  y1: "5",
839
858
  x2: "19",
840
859
  y2: "19"
841
- })], -1)]], 10, Vt)])]),
842
- o("div", Ht, [o("button", {
860
+ })], -1)]], 10, Ut)])]),
861
+ o("div", Wt, [o("button", {
843
862
  class: "popover-btn cancel",
844
863
  onClick: P
845
864
  }, C(w(d)("canvasSize.cancel")), 1), o("button", {
@@ -847,15 +866,15 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
847
866
  onClick: N
848
867
  }, C(w(d)("canvasSize.confirm")), 1)])
849
868
  ], 36)], 32)) : i("", !0)]))]),
850
- o("div", Ut, [
851
- H.value ? (_(), a("div", {
869
+ o("div", Gt, [
870
+ V.value ? (_(), a("div", {
852
871
  key: 0,
853
872
  class: p(["color-indicator", { active: w(u).showColorPalette && w(u).activeColorSlot === "textColor" }]),
854
873
  title: w(d)("color.textColor"),
855
- onClick: J
856
- }, [o("div", Gt, [(_(), a("svg", {
874
+ onClick: K
875
+ }, [o("div", qt, [(_(), a("svg", {
857
876
  class: "text-color-icon",
858
- style: m({ color: q.value ? "var(--wb-text-secondary)" : K.value }),
877
+ style: m({ color: G.value ? "var(--wb-text-secondary)" : fe.value }),
859
878
  viewBox: "0 0 24 24",
860
879
  fill: "none",
861
880
  stroke: "currentColor",
@@ -876,7 +895,7 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
876
895
  x2: "12",
877
896
  y2: "20"
878
897
  }, null, -1)
879
- ]], 4)), q.value ? (_(), a("svg", Kt, [...c[20] ||= [o("line", {
898
+ ]], 4)), G.value ? (_(), a("svg", Jt, [...c[20] ||= [o("line", {
880
899
  x1: "5",
881
900
  y1: "12",
882
901
  x2: "19",
@@ -886,18 +905,18 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
886
905
  y1: "5",
887
906
  x2: "12",
888
907
  y2: "19"
889
- }, null, -1)]])) : i("", !0)])], 10, Wt)) : i("", !0),
908
+ }, null, -1)]])) : i("", !0)])], 10, Kt)) : i("", !0),
890
909
  o("div", {
891
910
  class: p(["color-indicator", {
892
911
  active: w(u).showColorPalette && w(u).activeColorSlot === "foreground",
893
- disabled: W.value
912
+ disabled: U.value
894
913
  }]),
895
914
  title: w(d)("color.foreground"),
896
- onClick: Y
915
+ onClick: q
897
916
  }, [o("div", {
898
- class: p(["color-swatch fg", { mixed: z.value }]),
899
- style: m({ background: z.value ? "none" : R.value })
900
- }, [z.value ? (_(), a("svg", Jt, [...c[21] ||= [o("line", {
917
+ class: p(["color-swatch fg", { mixed: R.value }]),
918
+ style: m({ background: R.value ? "none" : de.value })
919
+ }, [R.value ? (_(), a("svg", Xt, [...c[21] ||= [o("line", {
901
920
  x1: "5",
902
921
  y1: "12",
903
922
  x2: "19",
@@ -907,21 +926,21 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
907
926
  y1: "5",
908
927
  x2: "12",
909
928
  y2: "19"
910
- }, null, -1)]])) : i("", !0)], 6)], 10, qt),
929
+ }, null, -1)]])) : i("", !0)], 6)], 10, Yt),
911
930
  o("div", {
912
931
  class: p(["color-indicator", {
913
932
  active: w(u).showColorPalette && w(u).activeColorSlot === "background",
914
- disabled: G.value
933
+ disabled: W.value
915
934
  }]),
916
935
  title: w(d)("color.background"),
917
- onClick: X
936
+ onClick: J
918
937
  }, [o("div", {
919
938
  class: p(["color-swatch bg", {
920
- mixed: V.value,
921
- transparent: !V.value && B.value === "transparent"
939
+ mixed: B.value,
940
+ transparent: !B.value && z.value === "transparent"
922
941
  }]),
923
- style: m({ background: V.value || B.value === "transparent" ? "none" : B.value })
924
- }, [V.value ? (_(), a("svg", Xt, [...c[22] ||= [o("line", {
942
+ style: m({ background: B.value || z.value === "transparent" ? "none" : z.value })
943
+ }, [B.value ? (_(), a("svg", Qt, [...c[22] ||= [o("line", {
925
944
  x1: "5",
926
945
  y1: "12",
927
946
  x2: "19",
@@ -931,23 +950,23 @@ var pt = { class: "toolbar" }, mt = ["disabled"], ht = { class: "tool-group" },
931
950
  y1: "5",
932
951
  x2: "12",
933
952
  y2: "19"
934
- }, null, -1)]])) : B.value === "transparent" ? (_(), a("svg", Zt, [...c[23] ||= [o("line", {
953
+ }, null, -1)]])) : z.value === "transparent" ? (_(), a("svg", $t, [...c[23] ||= [o("line", {
935
954
  x1: "5",
936
955
  y1: "5",
937
956
  x2: "19",
938
957
  y2: "19"
939
- }, null, -1)]])) : i("", !0)], 6)], 10, Yt)
958
+ }, null, -1)]])) : i("", !0)], 6)], 10, Zt)
940
959
  ])
941
960
  ]));
942
961
  }
943
- }), en = (e, t) => {
962
+ }), nn = (e, t) => {
944
963
  let n = e.__vccOpts || e;
945
964
  for (let [e, r] of t) n[e] = r;
946
965
  return n;
947
- }, tn = /*#__PURE__*/ en($t, [["__scopeId", "data-v-9532ade7"]]);
966
+ }, rn = /*#__PURE__*/ nn(tn, [["__scopeId", "data-v-9532ade7"]]);
948
967
  //#endregion
949
968
  //#region src/components/painter/utils/geometry.ts
950
- function nn(e, t, n, r, i = !1, a = .382) {
969
+ function an(e, t, n, r, i = !1, a = .382) {
951
970
  let o = i ? -1 : 1, s = [];
952
971
  for (let i = 0; i < 5; i++) {
953
972
  let c = Math.PI / 2 * -1 + Math.PI * 2 * i / 5, l = c + Math.PI / 5;
@@ -961,7 +980,7 @@ function nn(e, t, n, r, i = !1, a = .382) {
961
980
  }
962
981
  return s;
963
982
  }
964
- function rn(e, t, n, r) {
983
+ function on(e, t, n, r) {
965
984
  let i = n >= 0 ? e : e + n, a = r >= 0 ? t : t + r, o = Math.abs(n), s = Math.abs(r);
966
985
  return r >= 0 ? [
967
986
  {
@@ -991,13 +1010,13 @@ function rn(e, t, n, r) {
991
1010
  }
992
1011
  ];
993
1012
  }
994
- function an(e, t, n) {
1013
+ function sn(e, t, n) {
995
1014
  let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
996
1015
  if (a === 0) return Math.hypot(e.x - t.x, e.y - t.y);
997
1016
  let o = ((e.x - t.x) * r + (e.y - t.y) * i) / a;
998
1017
  return o = Math.max(0, Math.min(1, o)), Math.hypot(e.x - (t.x + o * r), e.y - (t.y + o * i));
999
1018
  }
1000
- function on(e, t) {
1019
+ function cn(e, t) {
1001
1020
  let n = !1;
1002
1021
  for (let r = 0, i = t.length - 1; r < t.length; i = r++) {
1003
1022
  let a = t[r].x, o = t[r].y, s = t[i].x, c = t[i].y;
@@ -1005,12 +1024,12 @@ function on(e, t) {
1005
1024
  }
1006
1025
  return n;
1007
1026
  }
1008
- function sn(e, t, n, r, i) {
1027
+ function ln(e, t, n, r, i) {
1009
1028
  if (r <= 0 || i <= 0) return !1;
1010
1029
  let a = (e.x - t) / r, o = (e.y - n) / i;
1011
1030
  return a * a + o * o <= 1;
1012
1031
  }
1013
- function cn(e) {
1032
+ function un(e) {
1014
1033
  if (e.length === 0) return {
1015
1034
  x: 0,
1016
1035
  y: 0,
@@ -1026,14 +1045,14 @@ function cn(e) {
1026
1045
  height: i - n
1027
1046
  };
1028
1047
  }
1029
- function ln(e, t) {
1048
+ function dn(e, t) {
1030
1049
  let { x: n, y: r, width: i, height: a, type: o, points: s, fillColor: c } = t, l = c !== "none" && c !== "transparent";
1031
1050
  switch (o) {
1032
1051
  case "pencil":
1033
1052
  if (s.length < 2) return !1;
1034
- for (let t = 0; t < s.length - 1; t++) if (an(e, s[t], s[t + 1]) < 8) return !0;
1053
+ for (let t = 0; t < s.length - 1; t++) if (sn(e, s[t], s[t + 1]) < 8) return !0;
1035
1054
  return !1;
1036
- case "line": return an(e, {
1055
+ case "line": return sn(e, {
1037
1056
  x: n,
1038
1057
  y: r
1039
1058
  }, {
@@ -1042,7 +1061,7 @@ function ln(e, t) {
1042
1061
  }) < 8;
1043
1062
  case "circle": {
1044
1063
  let t = n + i / 2, o = r + a / 2, s = Math.abs(i) / 2, c = Math.abs(a) / 2;
1045
- return l && sn(e, t, o, s, c) ? !0 : sn(e, t, o, s + 8, c + 8) && !sn(e, t, o, s - 8, c - 8);
1064
+ return l && ln(e, t, o, s, c) ? !0 : ln(e, t, o, s + 8, c + 8) && !ln(e, t, o, s - 8, c - 8);
1046
1065
  }
1047
1066
  case "rect": {
1048
1067
  if (l && e.x >= n && e.x <= n + i && e.y >= r && e.y <= r + a) return !0;
@@ -1050,12 +1069,12 @@ function ln(e, t) {
1050
1069
  return t && !o;
1051
1070
  }
1052
1071
  case "triangle": {
1053
- let t = rn(n, r, i, a);
1054
- return l && on(e, t) ? !0 : on(e, t);
1072
+ let t = on(n, r, i, a);
1073
+ return l && cn(e, t) ? !0 : cn(e, t);
1055
1074
  }
1056
1075
  case "star": {
1057
- let t = nn(n + i / 2, r + a / 2, Math.abs(i) / 2, Math.abs(a) / 2, a >= 0);
1058
- return l && on(e, t) ? !0 : on(e, t);
1076
+ let t = an(n + i / 2, r + a / 2, Math.abs(i) / 2, Math.abs(a) / 2, a >= 0);
1077
+ return l && cn(e, t) ? !0 : cn(e, t);
1059
1078
  }
1060
1079
  case "text": return e.x >= n - 8 && e.x <= n + Math.max(i, 32) + 8 && e.y >= r - 8 && e.y <= r + Math.max(a, 16) + 8;
1061
1080
  default: return !1;
@@ -1063,8 +1082,8 @@ function ln(e, t) {
1063
1082
  }
1064
1083
  //#endregion
1065
1084
  //#region src/components/painter/composables/useDrawing.ts
1066
- function un(e) {
1067
- let t = st(), r = ft(), i = b(!1), a = b({
1085
+ function fn(e) {
1086
+ let t = lt(), r = mt(), i = b(!1), a = b({
1068
1087
  x: 0,
1069
1088
  y: 0
1070
1089
  }), o = b({
@@ -1132,7 +1151,7 @@ function un(e) {
1132
1151
  return e === "pencil" ? {
1133
1152
  id: "__preview__",
1134
1153
  type: "pencil",
1135
- ...cn(s.value),
1154
+ ...un(s.value),
1136
1155
  points: [...s.value],
1137
1156
  strokeColor: t.foregroundColor,
1138
1157
  fillColor: "none",
@@ -1189,9 +1208,9 @@ function un(e) {
1189
1208
  let e = t.editingTextId;
1190
1209
  if (e) {
1191
1210
  let n = t.strokes.find((t) => t.id === e);
1192
- if (n && ln(u, n)) return;
1211
+ if (n && dn(u, n)) return;
1193
1212
  } else {
1194
- let e = [...t.strokes].reverse().find((e) => ln(u, e));
1213
+ let e = [...t.strokes].reverse().find((e) => dn(u, e));
1195
1214
  if (e && e.type === "text") {
1196
1215
  t.hoveredTextId = null, E(), t.pushUndo(), t.editingTextId = e.id;
1197
1216
  return;
@@ -1201,7 +1220,7 @@ function un(e) {
1201
1220
  return;
1202
1221
  }
1203
1222
  if (a.value = u, o.value = u, i.value = !0, r.activeTool === "pencil" && (s.value = [u]), r.activeTool === "select") {
1204
- let e = [...t.strokes].reverse().find((e) => ln(u, e));
1223
+ let e = [...t.strokes].reverse().find((e) => dn(u, e));
1205
1224
  if (e && t.isSelected(e.id)) {
1206
1225
  t.pushUndo(), d.value = !0, f.value.clear();
1207
1226
  for (let e of t.selectedStrokes) f.value.set(e.id, {
@@ -1232,7 +1251,7 @@ function un(e) {
1232
1251
  function se(e, n) {
1233
1252
  let c = A(e, n);
1234
1253
  if (r.activeTool === "text" && !i.value && !t.editingTextId) {
1235
- let e = [...t.strokes].reverse().find((e) => ln(c, e));
1254
+ let e = [...t.strokes].reverse().find((e) => dn(c, e));
1236
1255
  t.hoveredTextId = e && e.type === "text" ? e.id : null;
1237
1256
  } else i.value || (t.hoveredTextId = null);
1238
1257
  if (i.value && (o.value = c, r.activeTool === "pencil" && s.value.push(c), r.activeTool === "select")) if (d.value) {
@@ -1288,7 +1307,7 @@ function un(e) {
1288
1307
  if (d.value) d.value = !1, f.value.clear(), t.dataVersion++;
1289
1308
  else {
1290
1309
  if (t.isSelecting = !1, u < 3) {
1291
- let e = [...t.strokes].reverse().find((e) => ln(o, e));
1310
+ let e = [...t.strokes].reverse().find((e) => dn(o, e));
1292
1311
  t.selectStroke(e?.id ?? null);
1293
1312
  } else {
1294
1313
  let e = t.selectionBox, n = [];
@@ -1315,7 +1334,7 @@ function un(e) {
1315
1334
  let e = s.value.map((e) => ({
1316
1335
  x: Math.round(e.x),
1317
1336
  y: Math.round(e.y)
1318
- })), n = cn(e);
1337
+ })), n = un(e);
1319
1338
  if (n.width < 3 && n.height < 3) {
1320
1339
  t.clearSelection();
1321
1340
  return;
@@ -1342,14 +1361,14 @@ function un(e) {
1342
1361
  function L(e) {
1343
1362
  t.pushUndo(), t.editingTextId = e;
1344
1363
  }
1345
- function R(e) {
1364
+ function de(e) {
1346
1365
  let t = e.ctrlKey || e.metaKey;
1347
1366
  c.value = t, l.value = e.shiftKey, u.value = e.shiftKey;
1348
1367
  }
1349
- function z() {
1368
+ function R() {
1350
1369
  c.value = !1, l.value = !1, u.value = !1;
1351
1370
  }
1352
- function B(e, t) {
1371
+ function z(e, t) {
1353
1372
  let { x: n, y: r, w: i, h: a } = e;
1354
1373
  switch (t) {
1355
1374
  case "nw": return {
@@ -1398,14 +1417,14 @@ function un(e) {
1398
1417
  };
1399
1418
  }
1400
1419
  }
1401
- function V(e) {
1420
+ function B(e) {
1402
1421
  return e === "n" || e === "s" || e === "e" || e === "w";
1403
1422
  }
1404
- function H(e, n, r, i) {
1423
+ function V(e, n, r, i) {
1405
1424
  let s = t.strokes.find((t) => t.id === e);
1406
1425
  if (!s) return;
1407
1426
  t.pushUndo();
1408
- let c = Y(s);
1427
+ let c = q(s);
1409
1428
  _.value = {
1410
1429
  x: c.x,
1411
1430
  y: c.y,
@@ -1419,23 +1438,23 @@ function un(e) {
1419
1438
  l = e.clientX, u = e.clientY, i.preventDefault();
1420
1439
  } else l = i.clientX, u = i.clientY;
1421
1440
  let d = A(l, u);
1422
- a.value = d, o.value = d, window.addEventListener("mousemove", U), window.addEventListener("mouseup", K), window.addEventListener("touchmove", W, { passive: !1 }), window.addEventListener("touchend", q);
1441
+ a.value = d, o.value = d, window.addEventListener("mousemove", H), window.addEventListener("mouseup", fe), window.addEventListener("touchmove", U, { passive: !1 }), window.addEventListener("touchend", G);
1423
1442
  }
1424
- function U(e) {
1425
- G(e.clientX, e.clientY);
1443
+ function H(e) {
1444
+ W(e.clientX, e.clientY);
1426
1445
  }
1427
- function W(e) {
1446
+ function U(e) {
1428
1447
  if (e.touches.length !== 1) return;
1429
1448
  e.preventDefault();
1430
1449
  let t = e.touches[0];
1431
- G(t.clientX, t.clientY);
1450
+ W(t.clientX, t.clientY);
1432
1451
  }
1433
- function G(e, n) {
1452
+ function W(e, n) {
1434
1453
  if (!p.value || !_.value || !m.value) return;
1435
1454
  let r = A(e, n);
1436
1455
  o.value = r;
1437
1456
  let i = _.value, a = i.x + i.width / 2, s = i.y + i.height / 2, c;
1438
- if (l.value && V(h.value)) {
1457
+ if (l.value && B(h.value)) {
1439
1458
  let { x: e, y: n, width: o, height: l } = i;
1440
1459
  switch (h.value) {
1441
1460
  case "n": {
@@ -1492,7 +1511,7 @@ function un(e) {
1492
1511
  c = O(i.type, a, s, r.x, r.y), t.updateStroke(m.value, c);
1493
1512
  return;
1494
1513
  }
1495
- if (V(h.value)) {
1514
+ if (B(h.value)) {
1496
1515
  let { x: e, y: t, width: n, height: a } = i;
1497
1516
  switch (h.value) {
1498
1517
  case "n": {
@@ -1539,7 +1558,7 @@ function un(e) {
1539
1558
  };
1540
1559
  }
1541
1560
  } else {
1542
- let e = B({
1561
+ let e = z({
1543
1562
  x: i.x,
1544
1563
  y: i.y,
1545
1564
  w: i.width,
@@ -1557,16 +1576,16 @@ function un(e) {
1557
1576
  }
1558
1577
  t.updateStroke(m.value, c);
1559
1578
  }
1560
- function K() {
1561
- J();
1579
+ function fe() {
1580
+ K();
1562
1581
  }
1563
- function q(e) {
1564
- e.touches.length === 0 && J();
1582
+ function G(e) {
1583
+ e.touches.length === 0 && K();
1565
1584
  }
1566
- function J() {
1567
- p.value = !1, m.value = null, h.value = "", g.value = "", _.value = null, t.dataVersion++, window.removeEventListener("mousemove", U), window.removeEventListener("mouseup", K), window.removeEventListener("touchmove", W), window.removeEventListener("touchend", q);
1585
+ function K() {
1586
+ p.value = !1, m.value = null, h.value = "", g.value = "", _.value = null, t.dataVersion++, window.removeEventListener("mousemove", H), window.removeEventListener("mouseup", fe), window.removeEventListener("touchmove", U), window.removeEventListener("touchend", G);
1568
1587
  }
1569
- function Y(e) {
1588
+ function q(e) {
1570
1589
  let { type: t } = e;
1571
1590
  if (t === "line" || t === "triangle" || t === "star") {
1572
1591
  let { x: t, y: n, width: r, height: i } = e;
@@ -1594,11 +1613,11 @@ function un(e) {
1594
1613
  onTouchMove: oe,
1595
1614
  onTouchEnd: N,
1596
1615
  getSVGPoint: k,
1597
- updateModifiers: R,
1598
- clearModifiers: z,
1616
+ updateModifiers: de,
1617
+ clearModifiers: R,
1599
1618
  isResizing: p,
1600
1619
  resizeCursor: g,
1601
- startResize: H,
1620
+ startResize: V,
1602
1621
  commitTextEdit: F,
1603
1622
  cancelTextEdit: I,
1604
1623
  startEditText: L,
@@ -1608,7 +1627,7 @@ function un(e) {
1608
1627
  }
1609
1628
  //#endregion
1610
1629
  //#region src/components/painter/utils/svg.ts
1611
- function dn(e) {
1630
+ function pn(e) {
1612
1631
  if (e.length === 0) return "";
1613
1632
  if (e.length === 1) return `M ${e[0].x} ${e[0].y}`;
1614
1633
  if (e.length === 2) return `M ${e[0].x} ${e[0].y} L ${e[1].x} ${e[1].y}`;
@@ -1619,7 +1638,7 @@ function dn(e) {
1619
1638
  }
1620
1639
  return t += ` L ${e[e.length - 1].x} ${e[e.length - 1].y}`, t;
1621
1640
  }
1622
- function fn(e) {
1641
+ function mn(e) {
1623
1642
  let { type: t, x: n, y: r, width: i, height: a, points: o, strokeColor: s, fillColor: c, strokeWidth: l } = e, u = {
1624
1643
  stroke: s,
1625
1644
  fill: c,
@@ -1633,7 +1652,7 @@ function fn(e) {
1633
1652
  attrs: {
1634
1653
  ...u,
1635
1654
  fill: "none",
1636
- d: dn(o)
1655
+ d: pn(o)
1637
1656
  }
1638
1657
  };
1639
1658
  case "line": return {
@@ -1671,7 +1690,7 @@ function fn(e) {
1671
1690
  }
1672
1691
  };
1673
1692
  case "triangle": {
1674
- let e = rn(n, r, i, a).map((e) => `${e.x},${e.y}`).join(" ");
1693
+ let e = on(n, r, i, a).map((e) => `${e.x},${e.y}`).join(" ");
1675
1694
  return {
1676
1695
  tag: "polygon",
1677
1696
  attrs: {
@@ -1681,7 +1700,7 @@ function fn(e) {
1681
1700
  };
1682
1701
  }
1683
1702
  case "star": {
1684
- let e = nn(n + i / 2, r + a / 2, Math.abs(i) / 2, Math.abs(a) / 2, a >= 0).map((e) => `${e.x},${e.y}`).join(" ");
1703
+ let e = an(n + i / 2, r + a / 2, Math.abs(i) / 2, Math.abs(a) / 2, a >= 0).map((e) => `${e.x},${e.y}`).join(" ");
1685
1704
  return {
1686
1705
  tag: "polygon",
1687
1706
  attrs: {
@@ -1702,45 +1721,45 @@ function fn(e) {
1702
1721
  }
1703
1722
  //#endregion
1704
1723
  //#region src/components/painter/StrokeRenderer.vue
1705
- var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
1724
+ var hn = /*#__PURE__*/ nn(/* @__PURE__ */ l({
1706
1725
  __name: "StrokeRenderer",
1707
1726
  props: {
1708
1727
  stroke: {},
1709
1728
  isSelected: { type: Boolean }
1710
1729
  },
1711
1730
  setup(e) {
1712
- return (t, n) => (_(), r(S(w(fn)(e.stroke).tag), d(w(fn)(e.stroke).attrs, {
1731
+ return (t, n) => (_(), r(S(w(mn)(e.stroke).tag), d(w(mn)(e.stroke).attrs, {
1713
1732
  class: { selected: e.isSelected },
1714
1733
  "data-stroke-id": e.stroke.id
1715
1734
  }), null, 16, ["class", "data-stroke-id"]));
1716
1735
  }
1717
- }), [["__scopeId", "data-v-d3706fa4"]]), mn = { key: 0 }, hn = [
1736
+ }), [["__scopeId", "data-v-d3706fa4"]]), gn = { key: 0 }, _n = [
1718
1737
  "x",
1719
1738
  "y",
1720
1739
  "width",
1721
1740
  "height"
1722
- ], gn = [
1741
+ ], vn = [
1723
1742
  "x",
1724
1743
  "y",
1725
1744
  "onMousedown",
1726
1745
  "onTouchstart"
1727
- ], _n = [
1746
+ ], yn = [
1728
1747
  "x",
1729
1748
  "y",
1730
1749
  "onMousedown",
1731
1750
  "onTouchstart"
1732
- ], vn = 6, $ = 8, yn = /* @__PURE__ */ l({
1751
+ ], bn = 6, $ = 8, xn = /* @__PURE__ */ l({
1733
1752
  __name: "SelectionOverlay",
1734
1753
  props: {
1735
1754
  stroke: {},
1736
1755
  startResize: { type: Function }
1737
1756
  },
1738
1757
  setup(t) {
1739
- let r = t, s = st(), c = n(() => {
1758
+ let r = t, s = lt(), c = n(() => {
1740
1759
  let e = s.getStrokeDisplayBounds(r.stroke);
1741
1760
  return {
1742
- x: e.x - vn,
1743
- y: e.y - vn,
1761
+ x: e.x - bn,
1762
+ y: e.y - bn,
1744
1763
  w: e.width + 12,
1745
1764
  h: e.height + 12
1746
1765
  };
@@ -1813,7 +1832,7 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
1813
1832
  function p(e, t, n) {
1814
1833
  n.preventDefault(), n.stopPropagation(), r.startResize(r.stroke.id, e, t, n);
1815
1834
  }
1816
- return (n, r) => t.stroke ? (_(), a("g", mn, [
1835
+ return (n, r) => t.stroke ? (_(), a("g", gn, [
1817
1836
  o("rect", {
1818
1837
  x: c.value.x,
1819
1838
  y: c.value.y,
@@ -1824,7 +1843,7 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
1824
1843
  "stroke-width": "2",
1825
1844
  "stroke-dasharray": "6 4",
1826
1845
  rx: "4"
1827
- }, null, 8, hn),
1846
+ }, null, 8, _n),
1828
1847
  (_(!0), a(e, null, x(u.value, (e) => D((_(), a("rect", {
1829
1848
  key: e.name,
1830
1849
  x: e.cx - $ / 2,
@@ -1838,7 +1857,7 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
1838
1857
  style: m({ cursor: e.cursor }),
1839
1858
  onMousedown: O((t) => p(e.name, e.cursor, t), ["stop", "prevent"]),
1840
1859
  onTouchstart: O((t) => p(e.name, e.cursor, t), ["stop", "prevent"])
1841
- }, null, 44, gn)), [[T, l.value]])), 128)),
1860
+ }, null, 44, vn)), [[T, l.value]])), 128)),
1842
1861
  (_(!0), a(e, null, x(f.value, (e) => D((_(), a("rect", {
1843
1862
  key: e.name,
1844
1863
  x: e.cx - $ / 2,
@@ -1852,39 +1871,39 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
1852
1871
  style: m({ cursor: e.cursor }),
1853
1872
  onMousedown: O((t) => p(e.name, e.cursor, t), ["stop", "prevent"]),
1854
1873
  onTouchstart: O((t) => p(e.name, e.cursor, t), ["stop", "prevent"])
1855
- }, null, 44, _n)), [[T, !l.value]])), 128))
1874
+ }, null, 44, yn)), [[T, !l.value]])), 128))
1856
1875
  ])) : i("", !0);
1857
1876
  }
1858
- }), bn = ["viewBox"], xn = [
1877
+ }), Sn = ["viewBox"], Cn = [
1859
1878
  "width",
1860
1879
  "height",
1861
1880
  "fill"
1862
- ], Sn = [
1881
+ ], wn = [
1863
1882
  "width",
1864
1883
  "height",
1865
1884
  "fill"
1866
- ], Cn = [
1885
+ ], Tn = [
1867
1886
  "width",
1868
1887
  "height",
1869
1888
  "stroke"
1870
- ], wn = { class: "strokes-layer" }, Tn = [
1889
+ ], En = { class: "strokes-layer" }, Dn = [
1871
1890
  "x",
1872
1891
  "y",
1873
1892
  "width"
1874
- ], En = ["contenteditable", "onDblclick"], Dn = [
1893
+ ], On = ["contenteditable", "onDblclick"], kn = [
1875
1894
  "x",
1876
1895
  "y",
1877
1896
  "width",
1878
1897
  "height"
1879
- ], On = [
1898
+ ], An = [
1880
1899
  "x",
1881
1900
  "y",
1882
1901
  "width",
1883
1902
  "height"
1884
- ], kn = ["disabled", "title"], An = ["disabled", "title"], jn = ["title"], Mn = ["title"], Nn = ["title"], Pn = ["title"], Fn = { class: "zoom-percent" }, In = ["title"], Ln = { class: "font-size-value" }, Rn = ["title"], zn = ["title"], Bn = ["title"], Vn = /*#__PURE__*/ en(/* @__PURE__ */ l({
1903
+ ], jn = ["disabled", "title"], Mn = ["disabled", "title"], Nn = ["title"], Pn = ["title"], Fn = ["title"], In = ["title"], Ln = { class: "zoom-percent" }, Rn = ["title"], zn = { class: "font-size-value" }, Bn = ["title"], Vn = ["title"], Hn = ["title"], Un = /*#__PURE__*/ nn(/* @__PURE__ */ l({
1885
1904
  __name: "Whiteboard",
1886
1905
  setup(t) {
1887
- let c = st(), l = ft(), { t: u } = ie(), d = b(null), { isDrawing: v, previewStroke: y, onMouseDown: S, onMouseMove: ee, onMouseUp: T, onTouchStart: D, onTouchMove: te, onTouchEnd: ne, updateModifiers: re, clearModifiers: k, isResizing: A, resizeCursor: j, startResize: M, commitTextEdit: ae, cancelTextEdit: oe, startEditText: se, saveCurrentTextEdit: ce, setTextContentGetter: le } = un(d);
1906
+ let c = lt(), l = mt(), { t: u } = ie(), d = b(null), { isDrawing: v, previewStroke: y, onMouseDown: S, onMouseMove: ee, onMouseUp: T, onTouchStart: D, onTouchMove: te, onTouchEnd: ne, updateModifiers: re, clearModifiers: k, isResizing: A, resizeCursor: j, startResize: M, commitTextEdit: ae, cancelTextEdit: oe, startEditText: se, saveCurrentTextEdit: ce, setTextContentGetter: le } = fn(d);
1888
1907
  le(() => {
1889
1908
  let e = c.editingTextId;
1890
1909
  if (!e) return null;
@@ -1921,73 +1940,73 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
1921
1940
  }
1922
1941
  });
1923
1942
  });
1924
- function R(e) {
1943
+ function de(e) {
1925
1944
  (l.activeTool === "text" || l.activeTool === "select") && se(e);
1926
1945
  }
1927
- function z() {
1946
+ function R() {
1928
1947
  c.hoveredTextId = null;
1929
1948
  }
1930
- function B() {
1949
+ function z() {
1931
1950
  let e = d.value?.parentElement;
1932
1951
  e && c.zoomAt(e.clientWidth / 2, e.clientHeight / 2, 1.1);
1933
1952
  }
1934
- function V() {
1953
+ function B() {
1935
1954
  let e = d.value?.parentElement;
1936
1955
  e && c.zoomAt(e.clientWidth / 2, e.clientHeight / 2, .9);
1937
1956
  }
1938
- function H(e) {
1957
+ function V(e) {
1939
1958
  let t = e.ctrlKey || e.metaKey;
1940
1959
  c.editingTextId || ((v.value || A.value) && re(e), e.key === "Delete" || e.key === "Backspace" ? c.deleteSelectedStrokes() : e.key === "Escape" ? c.clearSelection() : t && e.key === "z" && !e.shiftKey ? (e.preventDefault(), c.undo()) : t && (e.key === "y" || e.shiftKey && e.key === "z") ? (e.preventDefault(), c.redo()) : t && e.key === "x" ? (e.preventDefault(), c.cutSelectedStrokes()) : t && e.key === "c" ? (e.preventDefault(), c.copySelectedStrokes()) : t && e.key === "v" && (e.preventDefault(), c.pasteStrokes()));
1941
1960
  }
1942
- function U(e) {
1961
+ function H(e) {
1943
1962
  (v.value || A.value) && re(e);
1944
1963
  }
1945
- function W() {
1964
+ function U() {
1946
1965
  k();
1947
1966
  }
1948
- let G = b(0), K = b(1), q = b(0), J = b(0);
1949
- function Y(e) {
1967
+ let W = b(0), fe = b(1), G = b(0), K = b(0);
1968
+ function q(e) {
1950
1969
  let t = e[0].clientX - e[1].clientX, n = e[0].clientY - e[1].clientY;
1951
1970
  return Math.hypot(t, n);
1952
1971
  }
1953
- function X(e) {
1954
- l.activeTool === "zoom" && e.touches.length === 2 && (G.value = Y(e.touches), K.value = c.zoomLevel, q.value = (e.touches[0].clientX + e.touches[1].clientX) / 2, J.value = (e.touches[0].clientY + e.touches[1].clientY) / 2);
1972
+ function J(e) {
1973
+ l.activeTool === "zoom" && e.touches.length === 2 && (W.value = q(e.touches), fe.value = c.zoomLevel, G.value = (e.touches[0].clientX + e.touches[1].clientX) / 2, K.value = (e.touches[0].clientY + e.touches[1].clientY) / 2);
1955
1974
  }
1956
- function de(e) {
1957
- if (l.activeTool === "zoom" && e.touches.length === 2 && G.value > 0) {
1958
- let t = Y(e.touches) / G.value, n = K.value * t, r = d.value;
1975
+ function Y(e) {
1976
+ if (l.activeTool === "zoom" && e.touches.length === 2 && W.value > 0) {
1977
+ let t = q(e.touches) / W.value, n = fe.value * t, r = d.value;
1959
1978
  if (r) {
1960
1979
  let e = r.getBoundingClientRect();
1961
- c.continuousZoomAt(q.value - e.left, J.value - e.top, n);
1980
+ c.continuousZoomAt(G.value - e.left, K.value - e.top, n);
1962
1981
  }
1963
1982
  }
1964
1983
  }
1965
- function Z(e) {
1966
- l.activeTool === "zoom" && e.touches.length < 2 && (G.value = 0);
1984
+ function X(e) {
1985
+ l.activeTool === "zoom" && e.touches.length < 2 && (W.value = 0);
1967
1986
  }
1968
- let fe = null;
1969
- function pe() {
1987
+ let Z = null;
1988
+ function Q() {
1970
1989
  let e = d.value?.parentElement;
1971
1990
  if (!e) return;
1972
1991
  let t = c.canvasWidth * c.zoomLevel, n = c.canvasHeight * c.zoomLevel, r = e.clientWidth, i = e.clientHeight;
1973
1992
  r > 0 && i > 0 && c.setPan((r - t) / 2, (i - n) / 2);
1974
1993
  }
1975
- function me(e) {
1994
+ function pe(e) {
1976
1995
  let t = I.value;
1977
1996
  if (!t) return;
1978
1997
  let n = t.fontSize ?? 16, r = Math.max(8, Math.min(200, n + e));
1979
1998
  c.pushUndo(), c.updateStroke(t.id, { fontSize: r }), c.dataVersion++;
1980
1999
  }
1981
- function he(e) {
2000
+ function me(e) {
1982
2001
  let t = I.value;
1983
2002
  t && (c.pushUndo(), c.updateStroke(t.id, { textAlign: e }), c.dataVersion++);
1984
2003
  }
1985
- function ge(e) {
2004
+ function he(e) {
1986
2005
  return (t) => {
1987
- t ? (P.value.set(e, t), f(() => _e(e, t))) : P.value.delete(e);
2006
+ t ? (P.value.set(e, t), f(() => ge(e, t))) : P.value.delete(e);
1988
2007
  };
1989
2008
  }
1990
- function _e(e, t) {
2009
+ function ge(e, t) {
1991
2010
  let n = c.strokes.find((t) => t.id === e);
1992
2011
  if (!n) return;
1993
2012
  let r = Math.max(t.scrollWidth / c.zoomLevel, n.fontSize ?? 16), i = Math.max(t.scrollHeight / c.zoomLevel, n.fontSize ?? 16);
@@ -2007,11 +2026,11 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2007
2026
  }
2008
2027
  }
2009
2028
  return h(() => {
2010
- window.addEventListener("keydown", H), window.addEventListener("keydown", L), window.addEventListener("keyup", U), window.addEventListener("blur", W), pe(), fe = new ResizeObserver(() => pe());
2029
+ window.addEventListener("keydown", V), window.addEventListener("keydown", L), window.addEventListener("keyup", H), window.addEventListener("blur", U), Q(), Z = new ResizeObserver(() => Q());
2011
2030
  let e = d.value?.parentElement;
2012
- e && fe.observe(e);
2031
+ e && Z.observe(e);
2013
2032
  }), g(() => {
2014
- window.removeEventListener("keydown", H), window.removeEventListener("keydown", L), window.removeEventListener("keyup", U), window.removeEventListener("blur", W), fe?.disconnect();
2033
+ window.removeEventListener("keydown", V), window.removeEventListener("keydown", L), window.removeEventListener("keyup", H), window.removeEventListener("blur", U), Z?.disconnect();
2015
2034
  }), (t, n) => (_(), a("div", {
2016
2035
  class: "whiteboard",
2017
2036
  onContextmenu: n[23] ||= O(() => {}, ["prevent"]),
@@ -2019,13 +2038,13 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2019
2038
  onMousemove: n[25] ||= (...e) => w(ee) && w(ee)(...e),
2020
2039
  onMouseup: n[26] ||= (...e) => w(T) && w(T)(...e),
2021
2040
  onTouchstart: n[27] ||= O((e) => {
2022
- w(D)(e), X(e);
2041
+ w(D)(e), J(e);
2023
2042
  }, ["prevent"]),
2024
2043
  onTouchmove: n[28] ||= O((e) => {
2025
- w(te)(e), de(e);
2044
+ w(te)(e), Y(e);
2026
2045
  }, ["prevent"]),
2027
2046
  onTouchend: n[29] ||= (e) => {
2028
- w(ne)(e), Z(e);
2047
+ w(ne)(e), X(e);
2029
2048
  }
2030
2049
  }, [
2031
2050
  o("div", {
@@ -2044,7 +2063,7 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2044
2063
  width: "100%",
2045
2064
  height: "100%",
2046
2065
  style: m({ cursor: ue.value }),
2047
- onMouseleave: z
2066
+ onMouseleave: R
2048
2067
  }, [
2049
2068
  n[30] ||= s("<defs data-v-975e0b8b><pattern id=\"grid-light\" width=\"16\" height=\"16\" patternUnits=\"userSpaceOnUse\" data-v-975e0b8b><rect width=\"16\" height=\"16\" fill=\"#ffffff\" data-v-975e0b8b></rect><rect width=\"8\" height=\"8\" fill=\"#f0f0f0\" data-v-975e0b8b></rect><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" fill=\"#f0f0f0\" data-v-975e0b8b></rect></pattern><pattern id=\"grid-dark\" width=\"16\" height=\"16\" patternUnits=\"userSpaceOnUse\" data-v-975e0b8b><rect width=\"16\" height=\"16\" fill=\"#1e1e30\" data-v-975e0b8b></rect><rect width=\"8\" height=\"8\" fill=\"#2a2a3e\" data-v-975e0b8b></rect><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" fill=\"#2a2a3e\" data-v-975e0b8b></rect></pattern></defs>", 1),
2050
2069
  w(c).canvasBackgroundColor === "transparent" ? (_(), a("rect", {
@@ -2054,14 +2073,14 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2054
2073
  width: w(c).canvasWidth,
2055
2074
  height: w(c).canvasHeight,
2056
2075
  fill: w(c).theme === "dark" ? "url(#grid-dark)" : "url(#grid-light)"
2057
- }, null, 8, xn)) : (_(), a("rect", {
2076
+ }, null, 8, Cn)) : (_(), a("rect", {
2058
2077
  key: 1,
2059
2078
  x: "0",
2060
2079
  y: "0",
2061
2080
  width: w(c).canvasWidth,
2062
2081
  height: w(c).canvasHeight,
2063
2082
  fill: w(c).canvasBackgroundColor
2064
- }, null, 8, Sn)),
2083
+ }, null, 8, wn)),
2065
2084
  o("rect", {
2066
2085
  x: "0",
2067
2086
  y: "0",
@@ -2070,8 +2089,8 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2070
2089
  fill: "none",
2071
2090
  stroke: w(c).theme === "dark" ? "#4a4a5a" : "#c0c0c0",
2072
2091
  "stroke-width": "2"
2073
- }, null, 8, Cn),
2074
- o("g", wn, [(_(!0), a(e, null, x(w(c).strokes, (t) => (_(), a(e, { key: t.id }, [t.type === "text" ? (_(), a("foreignObject", {
2092
+ }, null, 8, Tn),
2093
+ o("g", En, [(_(!0), a(e, null, x(w(c).strokes, (t) => (_(), a(e, { key: t.id }, [t.type === "text" ? (_(), a("foreignObject", {
2075
2094
  key: 0,
2076
2095
  x: t.x,
2077
2096
  y: t.y,
@@ -2083,7 +2102,7 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2083
2102
  }
2084
2103
  }, [o("div", {
2085
2104
  ref_for: !0,
2086
- ref: ge(t.id),
2105
+ ref: he(t.id),
2087
2106
  xmlns: "http://www.w3.org/1999/xhtml",
2088
2107
  contenteditable: w(c).editingTextId === t.id,
2089
2108
  style: m({
@@ -2103,18 +2122,18 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2103
2122
  display: "inline-block",
2104
2123
  maxWidth: t.textAutoWidth ? "none" : "100%"
2105
2124
  }),
2106
- onDblclick: O((e) => R(t.id), ["stop"])
2107
- }, C(t.text || ""), 45, En)], 8, Tn)) : (_(), r(pn, {
2125
+ onDblclick: O((e) => de(t.id), ["stop"])
2126
+ }, C(t.text || ""), 45, On)], 8, Dn)) : (_(), r(hn, {
2108
2127
  key: 1,
2109
2128
  stroke: t,
2110
2129
  "is-selected": w(c).isSelected(t.id)
2111
2130
  }, null, 8, ["stroke", "is-selected"]))], 64))), 128))]),
2112
- w(y) ? (_(), r(pn, {
2131
+ w(y) ? (_(), r(hn, {
2113
2132
  key: 2,
2114
2133
  stroke: w(y),
2115
2134
  "is-selected": !1
2116
2135
  }, null, 8, ["stroke"])) : i("", !0),
2117
- (_(!0), a(e, null, x(w(c).selectedStrokes, (e) => (_(), r(yn, {
2136
+ (_(!0), a(e, null, x(w(c).selectedStrokes, (e) => (_(), r(xn, {
2118
2137
  key: "sel-" + e.id,
2119
2138
  stroke: e,
2120
2139
  "start-resize": w(M)
@@ -2129,7 +2148,7 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2129
2148
  stroke: "#6366f1",
2130
2149
  "stroke-width": "1",
2131
2150
  "stroke-dasharray": "6 4"
2132
- }, null, 8, Dn)) : i("", !0),
2151
+ }, null, 8, kn)) : i("", !0),
2133
2152
  F.value ? (_(), a("rect", {
2134
2153
  key: 4,
2135
2154
  x: F.value.x - 4,
@@ -2141,8 +2160,8 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2141
2160
  "stroke-width": "1",
2142
2161
  "stroke-dasharray": "4 3",
2143
2162
  "pointer-events": "none"
2144
- }, null, 8, On)) : i("", !0)
2145
- ], 44, bn))], 4),
2163
+ }, null, 8, An)) : i("", !0)
2164
+ ], 44, Sn))], 4),
2146
2165
  o("div", {
2147
2166
  class: "canvas-toolbar",
2148
2167
  onMousedown: n[5] ||= O(() => {}, ["stop"]),
@@ -2166,7 +2185,7 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2166
2185
  "stroke-width": "2",
2167
2186
  "stroke-linecap": "round",
2168
2187
  "stroke-linejoin": "round"
2169
- }, [o("path", { d: "M3 10h10a5 5 0 0 1 0 10H9" }), o("polyline", { points: "7 6 3 10 7 14" })], -1)]], 8, kn),
2188
+ }, [o("path", { d: "M3 10h10a5 5 0 0 1 0 10H9" }), o("polyline", { points: "7 6 3 10 7 14" })], -1)]], 8, jn),
2170
2189
  o("button", {
2171
2190
  class: "canvas-tb-btn",
2172
2191
  disabled: !w(c).canRedo,
@@ -2181,7 +2200,7 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2181
2200
  "stroke-width": "2",
2182
2201
  "stroke-linecap": "round",
2183
2202
  "stroke-linejoin": "round"
2184
- }, [o("path", { d: "M21 10H11a5 5 0 0 0 0 10h4" }), o("polyline", { points: "17 6 21 10 17 14" })], -1)]], 8, An),
2203
+ }, [o("path", { d: "M21 10H11a5 5 0 0 0 0 10h4" }), o("polyline", { points: "17 6 21 10 17 14" })], -1)]], 8, Mn),
2185
2204
  w(c).selectedStrokeIds.size > 0 ? (_(), a("button", {
2186
2205
  key: 0,
2187
2206
  class: "canvas-tb-btn",
@@ -2196,7 +2215,7 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2196
2215
  "stroke-width": "2",
2197
2216
  "stroke-linecap": "round",
2198
2217
  "stroke-linejoin": "round"
2199
- }, [o("path", { d: "m18 15-6-6-6 6" })], -1)]], 8, jn)) : i("", !0),
2218
+ }, [o("path", { d: "m18 15-6-6-6 6" })], -1)]], 8, Nn)) : i("", !0),
2200
2219
  w(c).selectedStrokeIds.size > 0 ? (_(), a("button", {
2201
2220
  key: 1,
2202
2221
  class: "canvas-tb-btn",
@@ -2211,13 +2230,13 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2211
2230
  "stroke-width": "2",
2212
2231
  "stroke-linecap": "round",
2213
2232
  "stroke-linejoin": "round"
2214
- }, [o("path", { d: "m6 9 6 6 6-6" })], -1)]], 8, Mn)) : i("", !0),
2233
+ }, [o("path", { d: "m6 9 6 6 6-6" })], -1)]], 8, Pn)) : i("", !0),
2215
2234
  w(c).selectedStrokeIds.size > 0 ? (_(), a("button", {
2216
2235
  key: 2,
2217
2236
  class: "canvas-tb-btn canvas-tb-btn--danger",
2218
2237
  title: w(u)("toolbar.delete"),
2219
2238
  onClick: n[4] ||= (e) => w(c).deleteSelectedStrokes()
2220
- }, [...n[35] ||= [s("<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><polyline points=\"3 6 5 6 21 6\" data-v-975e0b8b></polyline><path d=\"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6\" data-v-975e0b8b></path><path d=\"M10 11v6\" data-v-975e0b8b></path><path d=\"M14 11v6\" data-v-975e0b8b></path><path d=\"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2\" data-v-975e0b8b></path></svg>", 1)]], 8, Nn)) : i("", !0)
2239
+ }, [...n[35] ||= [s("<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><polyline points=\"3 6 5 6 21 6\" data-v-975e0b8b></polyline><path d=\"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6\" data-v-975e0b8b></path><path d=\"M10 11v6\" data-v-975e0b8b></path><path d=\"M14 11v6\" data-v-975e0b8b></path><path d=\"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2\" data-v-975e0b8b></path></svg>", 1)]], 8, Fn)) : i("", !0)
2221
2240
  ], 32),
2222
2241
  N.value || w(c).showZoomIndicator ? (_(), a("div", {
2223
2242
  key: 0,
@@ -2228,8 +2247,8 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2228
2247
  key: 0,
2229
2248
  class: "zoom-btn",
2230
2249
  title: w(u)("zoom.zoomOut"),
2231
- onMousedown: O(V, ["stop", "prevent"]),
2232
- onTouchstart: O(V, ["stop", "prevent"])
2250
+ onMousedown: O(B, ["stop", "prevent"]),
2251
+ onTouchstart: O(B, ["stop", "prevent"])
2233
2252
  }, [...n[36] ||= [o("svg", {
2234
2253
  width: "16",
2235
2254
  height: "16",
@@ -2243,14 +2262,14 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2243
2262
  y1: "12",
2244
2263
  x2: "19",
2245
2264
  y2: "12"
2246
- })], -1)]], 40, Pn)) : i("", !0),
2247
- o("span", Fn, C(w(c).getZoomPercent()) + "%", 1),
2265
+ })], -1)]], 40, In)) : i("", !0),
2266
+ o("span", Ln, C(w(c).getZoomPercent()) + "%", 1),
2248
2267
  N.value ? (_(), a("button", {
2249
2268
  key: 1,
2250
2269
  class: "zoom-btn",
2251
2270
  title: w(u)("zoom.zoomIn"),
2252
- onMousedown: O(B, ["stop", "prevent"]),
2253
- onTouchstart: O(B, ["stop", "prevent"])
2271
+ onMousedown: O(z, ["stop", "prevent"]),
2272
+ onTouchstart: O(z, ["stop", "prevent"])
2254
2273
  }, [...n[37] ||= [o("svg", {
2255
2274
  width: "16",
2256
2275
  height: "16",
@@ -2269,7 +2288,7 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2269
2288
  y1: "12",
2270
2289
  x2: "19",
2271
2290
  y2: "12"
2272
- })], -1)]], 40, In)) : i("", !0)
2291
+ })], -1)]], 40, Rn)) : i("", !0)
2273
2292
  ], 32)) : i("", !0),
2274
2293
  I.value ? (_(), a("div", {
2275
2294
  key: 1,
@@ -2278,8 +2297,8 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2278
2297
  }, [
2279
2298
  o("button", {
2280
2299
  class: "font-size-btn",
2281
- onMousedown: n[12] ||= O((e) => me(-1), ["stop", "prevent"]),
2282
- onTouchstart: n[13] ||= O((e) => me(-1), ["stop", "prevent"])
2300
+ onMousedown: n[12] ||= O((e) => pe(-1), ["stop", "prevent"]),
2301
+ onTouchstart: n[13] ||= O((e) => pe(-1), ["stop", "prevent"])
2283
2302
  }, [...n[38] ||= [o("svg", {
2284
2303
  width: "12",
2285
2304
  height: "12",
@@ -2294,11 +2313,11 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2294
2313
  x2: "19",
2295
2314
  y2: "12"
2296
2315
  })], -1)]], 32),
2297
- o("span", Ln, C(I.value.fontSize ?? w(16)), 1),
2316
+ o("span", zn, C(I.value.fontSize ?? w(16)), 1),
2298
2317
  o("button", {
2299
2318
  class: "font-size-btn",
2300
- onMousedown: n[14] ||= O((e) => me(1), ["stop", "prevent"]),
2301
- onTouchstart: n[15] ||= O((e) => me(1), ["stop", "prevent"])
2319
+ onMousedown: n[14] ||= O((e) => pe(1), ["stop", "prevent"]),
2320
+ onTouchstart: n[15] ||= O((e) => pe(1), ["stop", "prevent"])
2302
2321
  }, [...n[39] ||= [o("svg", {
2303
2322
  width: "12",
2304
2323
  height: "12",
@@ -2322,25 +2341,25 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2322
2341
  o("button", {
2323
2342
  class: p(["text-align-btn", { active: I.value.textAlign === "left" || !I.value.textAlign }]),
2324
2343
  title: w(u)("textAlign.left"),
2325
- onMousedown: n[16] ||= O((e) => he("left"), ["stop", "prevent"]),
2326
- onTouchstart: n[17] ||= O((e) => he("left"), ["stop", "prevent"])
2327
- }, [...n[40] ||= [s("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" data-v-975e0b8b></line><line x1=\"3\" y1=\"10\" x2=\"17\" y2=\"10\" data-v-975e0b8b></line><line x1=\"3\" y1=\"14\" x2=\"21\" y2=\"14\" data-v-975e0b8b></line><line x1=\"3\" y1=\"18\" x2=\"15\" y2=\"18\" data-v-975e0b8b></line></svg>", 1)]], 42, Rn),
2344
+ onMousedown: n[16] ||= O((e) => me("left"), ["stop", "prevent"]),
2345
+ onTouchstart: n[17] ||= O((e) => me("left"), ["stop", "prevent"])
2346
+ }, [...n[40] ||= [s("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" data-v-975e0b8b></line><line x1=\"3\" y1=\"10\" x2=\"17\" y2=\"10\" data-v-975e0b8b></line><line x1=\"3\" y1=\"14\" x2=\"21\" y2=\"14\" data-v-975e0b8b></line><line x1=\"3\" y1=\"18\" x2=\"15\" y2=\"18\" data-v-975e0b8b></line></svg>", 1)]], 42, Bn),
2328
2347
  o("button", {
2329
2348
  class: p(["text-align-btn", { active: I.value.textAlign === "center" }]),
2330
2349
  title: w(u)("textAlign.center"),
2331
- onMousedown: n[18] ||= O((e) => he("center"), ["stop", "prevent"]),
2332
- onTouchstart: n[19] ||= O((e) => he("center"), ["stop", "prevent"])
2333
- }, [...n[41] ||= [s("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" data-v-975e0b8b></line><line x1=\"5\" y1=\"10\" x2=\"19\" y2=\"10\" data-v-975e0b8b></line><line x1=\"3\" y1=\"14\" x2=\"21\" y2=\"14\" data-v-975e0b8b></line><line x1=\"7\" y1=\"18\" x2=\"17\" y2=\"18\" data-v-975e0b8b></line></svg>", 1)]], 42, zn),
2350
+ onMousedown: n[18] ||= O((e) => me("center"), ["stop", "prevent"]),
2351
+ onTouchstart: n[19] ||= O((e) => me("center"), ["stop", "prevent"])
2352
+ }, [...n[41] ||= [s("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" data-v-975e0b8b></line><line x1=\"5\" y1=\"10\" x2=\"19\" y2=\"10\" data-v-975e0b8b></line><line x1=\"3\" y1=\"14\" x2=\"21\" y2=\"14\" data-v-975e0b8b></line><line x1=\"7\" y1=\"18\" x2=\"17\" y2=\"18\" data-v-975e0b8b></line></svg>", 1)]], 42, Vn),
2334
2353
  o("button", {
2335
2354
  class: p(["text-align-btn", { active: I.value.textAlign === "right" }]),
2336
2355
  title: w(u)("textAlign.right"),
2337
- onMousedown: n[20] ||= O((e) => he("right"), ["stop", "prevent"]),
2338
- onTouchstart: n[21] ||= O((e) => he("right"), ["stop", "prevent"])
2339
- }, [...n[42] ||= [s("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" data-v-975e0b8b></line><line x1=\"7\" y1=\"10\" x2=\"21\" y2=\"10\" data-v-975e0b8b></line><line x1=\"3\" y1=\"14\" x2=\"21\" y2=\"14\" data-v-975e0b8b></line><line x1=\"9\" y1=\"18\" x2=\"21\" y2=\"18\" data-v-975e0b8b></line></svg>", 1)]], 42, Bn)
2356
+ onMousedown: n[20] ||= O((e) => me("right"), ["stop", "prevent"]),
2357
+ onTouchstart: n[21] ||= O((e) => me("right"), ["stop", "prevent"])
2358
+ }, [...n[42] ||= [s("<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" data-v-975e0b8b><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" data-v-975e0b8b></line><line x1=\"7\" y1=\"10\" x2=\"21\" y2=\"10\" data-v-975e0b8b></line><line x1=\"3\" y1=\"14\" x2=\"21\" y2=\"14\" data-v-975e0b8b></line><line x1=\"9\" y1=\"18\" x2=\"21\" y2=\"18\" data-v-975e0b8b></line></svg>", 1)]], 42, Hn)
2340
2359
  ], 32)) : i("", !0)
2341
2360
  ], 32));
2342
2361
  }
2343
- }), [["__scopeId", "data-v-975e0b8b"]]), Hn = { class: "palette-header" }, Un = { class: "palette-title" }, Wn = { class: "current-color" }, Gn = {
2362
+ }), [["__scopeId", "data-v-975e0b8b"]]), Wn = { class: "palette-header" }, Gn = { class: "palette-title" }, Kn = { class: "current-color" }, qn = {
2344
2363
  key: 0,
2345
2364
  width: "14",
2346
2365
  height: "14",
@@ -2349,13 +2368,13 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2349
2368
  stroke: "currentColor",
2350
2369
  "stroke-width": "2",
2351
2370
  "stroke-linecap": "round"
2352
- }, Kn = { class: "preset-grid" }, qn = ["title", "onClick"], Jn = {
2371
+ }, Jn = { class: "preset-grid" }, Yn = ["title", "onClick"], Xn = {
2353
2372
  key: 0,
2354
2373
  class: "transparent-row"
2355
- }, Yn = { class: "palette-footer" }, Xn = { class: "custom-color" }, Zn = ["value"], Qn = { class: "custom-label" }, $n = /*#__PURE__*/ en(/* @__PURE__ */ l({
2374
+ }, Zn = { class: "palette-footer" }, Qn = { class: "custom-color" }, $n = ["value"], er = { class: "custom-label" }, tr = /*#__PURE__*/ nn(/* @__PURE__ */ l({
2356
2375
  __name: "ColorPalette",
2357
2376
  setup(s) {
2358
- let c = st(), { t: l } = ie(), u = ae(), d = n(() => {
2377
+ let c = lt(), { t: l } = ie(), u = ae(), d = n(() => {
2359
2378
  if (!u?.value) return {};
2360
2379
  let e = u.value.getBoundingClientRect();
2361
2380
  return {
@@ -2408,26 +2427,26 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2408
2427
  style: m(d.value),
2409
2428
  onClick: s[0] ||= O(() => {}, ["stop"])
2410
2429
  }, [
2411
- o("div", Hn, [o("span", Un, C(w(c).activeColorSlot === "textColor" ? w(l)("color.textColor") : w(c).activeColorSlot === "foreground" ? w(l)("palette.stroke") : w(l)("palette.fill")), 1), o("div", Wn, [o("div", {
2430
+ o("div", Wn, [o("span", Gn, C(w(c).activeColorSlot === "textColor" ? w(l)("color.textColor") : w(c).activeColorSlot === "foreground" ? w(l)("palette.stroke") : w(l)("palette.fill")), 1), o("div", Kn, [o("div", {
2412
2431
  class: p(["current-swatch", {
2413
2432
  fill: w(c).activeColorSlot === "background",
2414
2433
  "current-transparent": w(c).activeColorSlot === "background" && w(c).backgroundColor === "transparent"
2415
2434
  }]),
2416
2435
  style: m({ background: w(c).activeColorSlot === "textColor" ? w(c).textColor : w(c).activeColorSlot === "foreground" ? w(c).foregroundColor : w(c).backgroundColor === "transparent" ? "none" : w(c).backgroundColor })
2417
- }, [w(c).activeColorSlot === "background" && w(c).backgroundColor === "transparent" ? (_(), a("svg", Gn, [...s[2] ||= [o("line", {
2436
+ }, [w(c).activeColorSlot === "background" && w(c).backgroundColor === "transparent" ? (_(), a("svg", qn, [...s[2] ||= [o("line", {
2418
2437
  x1: "5",
2419
2438
  y1: "5",
2420
2439
  x2: "19",
2421
2440
  y2: "19"
2422
2441
  }, null, -1)]])) : i("", !0)], 6)])]),
2423
- o("div", Kn, [(_(), a(e, null, x(f, (e) => o("button", {
2442
+ o("div", Jn, [(_(), a(e, null, x(f, (e) => o("button", {
2424
2443
  key: e,
2425
2444
  class: "color-swatch",
2426
2445
  style: m({ background: e }),
2427
2446
  title: e,
2428
2447
  onClick: (t) => g(e)
2429
- }, null, 12, qn)), 64))]),
2430
- w(c).activeColorSlot === "background" ? (_(), a("div", Jn, [o("button", {
2448
+ }, null, 12, Yn)), 64))]),
2449
+ w(c).activeColorSlot === "background" ? (_(), a("div", Xn, [o("button", {
2431
2450
  class: "color-swatch transparent-swatch",
2432
2451
  title: "透明(无填充)",
2433
2452
  onClick: v
@@ -2445,15 +2464,15 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2445
2464
  x2: "19",
2446
2465
  y2: "19"
2447
2466
  })], -1)]])])) : i("", !0),
2448
- o("div", Yn, [o("div", Xn, [o("input", {
2467
+ o("div", Zn, [o("div", Qn, [o("input", {
2449
2468
  type: "color",
2450
2469
  value: w(c).activeColorSlot === "textColor" ? w(c).textColor : w(c).activeColorSlot === "foreground" ? w(c).foregroundColor : w(c).backgroundColor === "transparent" ? "#ffffff" : w(c).backgroundColor,
2451
2470
  class: "color-picker",
2452
2471
  onChange: h
2453
- }, null, 40, Zn), o("span", Qn, C(w(l)("palette.custom")), 1)])])
2472
+ }, null, 40, $n), o("span", er, C(w(l)("palette.custom")), 1)])])
2454
2473
  ], 4)])) : i("", !0)]));
2455
2474
  }
2456
- }), [["__scopeId", "data-v-a8b8bc9c"]]), er = /*#__PURE__*/ en(/* @__PURE__ */ l({
2475
+ }), [["__scopeId", "data-v-a8b8bc9c"]]), nr = /*#__PURE__*/ nn(/* @__PURE__ */ l({
2457
2476
  __name: "Painter",
2458
2477
  props: {
2459
2478
  theme: { default: "light" },
@@ -2478,7 +2497,7 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2478
2497
  A(o.value);
2479
2498
  let l = b(null);
2480
2499
  M(l);
2481
- let u = st(), d = ft();
2500
+ let u = lt(), d = mt();
2482
2501
  u.reset(), d.reset();
2483
2502
  let f = !1;
2484
2503
  function h(e) {
@@ -2519,11 +2538,11 @@ var pn = /*#__PURE__*/ en(/* @__PURE__ */ l({
2519
2538
  class: p(["wb-root", g.value]),
2520
2539
  style: m(s.value)
2521
2540
  }, [
2522
- c(tn),
2523
- c(Vn),
2524
- c($n)
2541
+ c(rn),
2542
+ c(Un),
2543
+ c(tr)
2525
2544
  ], 6));
2526
2545
  }
2527
- }), [["__scopeId", "data-v-40d42bb5"]]);
2546
+ }), [["__scopeId", "data-v-18ed1ca7"]]);
2528
2547
  //#endregion
2529
- export { se as DEFAULT_CANVAS_HEIGHT, oe as DEFAULT_CANVAS_WIDTH, le as DEFAULT_FONT_SIZE, ue as HIT_THRESHOLD, er as Painter, er as default, ce as STROKE_WIDTH };
2548
+ export { se as DEFAULT_CANVAS_HEIGHT, oe as DEFAULT_CANVAS_WIDTH, le as DEFAULT_FONT_SIZE, ue as HIT_THRESHOLD, nr as Painter, nr as default, ce as STROKE_WIDTH };