vue-data-ui 3.25.0 → 3.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Arrow-cWEoIMbe.js → Arrow-CL6s6WpN.js} +1 -1
- package/dist/{BaseDraggableDialog-obpncsqR.js → BaseDraggableDialog-Cwj9aGdF.js} +2 -2
- package/dist/{BaseIcon-Dmgd8MfJ.js → BaseIcon-Oj70ytWI.js} +1 -1
- package/dist/{BaseLegendToggle-Dj1a_tSb.js → BaseLegendToggle-Cvuc-Mrr.js} +1 -1
- package/dist/{BaseZoomControls-CdYm4Qh4.js → BaseZoomControls-xstFfEqA.js} +2 -2
- package/dist/{ColorPicker-B93_eq_J.js → ColorPicker-sZV-tVqO.js} +2 -2
- package/dist/{DataTable-D6vq6n14.js → DataTable-DcDMoMmQ.js} +2 -2
- package/dist/{HillActions-D0OMo0PZ.js → HillActions-BGA3Up35.js} +1 -1
- package/dist/{Legend-Du6YK6gu.js → Legend-BQxAKh7g.js} +2 -2
- package/dist/{NonSvgPenAndPaper-DbwjIxnE.js → NonSvgPenAndPaper-1xl1Xynb.js} +3 -3
- package/dist/{PackageVersion-CU9Hflo-.js → PackageVersion-DWq6mo_q.js} +1 -1
- package/dist/PenAndPaper-Co2OSRzH.js +890 -0
- package/dist/{Shape-Dqpgbk7w.js → Shape-26P9pTZH.js} +1 -1
- package/dist/{SlicerPreview-BSjcCjhA.js → SlicerPreview-CPhQI1vX.js} +2 -2
- package/dist/{SparkTooltip-Da4O7iOD.js → SparkTooltip-CQDq9mwg.js} +1 -1
- package/dist/{Title-y2KUSK-I.js → Title-BLrnZl5j.js} +1 -1
- package/dist/{Tooltip-CLpW5URN.js → Tooltip-CmmM0DtW.js} +1 -1
- package/dist/{UserOptions-3Qr8es3g.js → UserOptions-pq95M7ss.js} +2 -2
- package/dist/components/arrow.js +1 -1
- package/dist/components/vue-ui-3d-bar.js +1 -1
- package/dist/components/vue-ui-accordion.js +1 -1
- package/dist/components/vue-ui-age-pyramid.js +1 -1
- package/dist/components/vue-ui-annotator.js +1 -1
- package/dist/components/vue-ui-bullet.js +1 -1
- package/dist/components/vue-ui-bump.js +1 -1
- package/dist/components/vue-ui-candlestick.js +1 -1
- package/dist/components/vue-ui-carousel-table.js +1 -1
- package/dist/components/vue-ui-chestnut.js +1 -1
- package/dist/components/vue-ui-chord.js +1 -1
- package/dist/components/vue-ui-circle-pack.js +1 -1
- package/dist/components/vue-ui-cursor.js +1 -1
- package/dist/components/vue-ui-dag.js +1 -1
- package/dist/components/vue-ui-dashboard.js +1 -1
- package/dist/components/vue-ui-digits.js +1 -1
- package/dist/components/vue-ui-donut-evolution.js +1 -1
- package/dist/components/vue-ui-donut.js +1 -1
- package/dist/components/vue-ui-dumbbell.js +1 -1
- package/dist/components/vue-ui-flow.js +1 -1
- package/dist/components/vue-ui-funnel.js +1 -1
- package/dist/components/vue-ui-galaxy.js +1 -1
- package/dist/components/vue-ui-gauge.js +1 -1
- package/dist/components/vue-ui-geo.js +1 -1
- package/dist/components/vue-ui-gizmo.js +1 -1
- package/dist/components/vue-ui-heatmap.js +1 -1
- package/dist/components/vue-ui-hill.js +1 -1
- package/dist/components/vue-ui-history-plot.js +1 -1
- package/dist/components/vue-ui-horizontal-bar.js +1 -1
- package/dist/components/vue-ui-icon.js +1 -1
- package/dist/components/vue-ui-kpi.js +1 -1
- package/dist/components/vue-ui-label.js +1 -1
- package/dist/components/vue-ui-mini-loader.js +1 -1
- package/dist/components/vue-ui-molecule.js +1 -1
- package/dist/components/vue-ui-mood-radar.js +1 -1
- package/dist/components/vue-ui-nested-donuts.js +1 -1
- package/dist/components/vue-ui-onion.js +1 -1
- package/dist/components/vue-ui-parallel-coordinate-plot.js +1 -1
- package/dist/components/vue-ui-quadrant.js +1 -1
- package/dist/components/vue-ui-quick-chart.js +1 -1
- package/dist/components/vue-ui-radar.js +1 -1
- package/dist/components/vue-ui-rating.js +1 -1
- package/dist/components/vue-ui-relation-circle.js +1 -1
- package/dist/components/vue-ui-ridgeline.js +1 -1
- package/dist/components/vue-ui-rings.js +1 -1
- package/dist/components/vue-ui-scatter.js +1 -1
- package/dist/components/vue-ui-skeleton.js +1 -1
- package/dist/components/vue-ui-smiley.js +1 -1
- package/dist/components/vue-ui-spark-trend.js +1 -1
- package/dist/components/vue-ui-sparkbar.js +1 -1
- package/dist/components/vue-ui-sparkgauge.js +1 -1
- package/dist/components/vue-ui-sparkhistogram.js +1 -1
- package/dist/components/vue-ui-sparkline.js +1 -1
- package/dist/components/vue-ui-sparkstackbar.js +1 -1
- package/dist/components/vue-ui-stackbar.js +1 -1
- package/dist/components/vue-ui-stackline.js +1 -1
- package/dist/components/vue-ui-strip-plot.js +1 -1
- package/dist/components/vue-ui-table-heatmap.js +1 -1
- package/dist/components/vue-ui-table-sparkline.js +1 -1
- package/dist/components/vue-ui-table.js +1 -1
- package/dist/components/vue-ui-thermometer.js +1 -1
- package/dist/components/vue-ui-timer.js +1 -1
- package/dist/components/vue-ui-tiremarks.js +1 -1
- package/dist/components/vue-ui-treemap.js +1 -1
- package/dist/components/vue-ui-vertical-bar.js +1 -1
- package/dist/components/vue-ui-waffle.js +1 -1
- package/dist/components/vue-ui-wheel.js +1 -1
- package/dist/components/vue-ui-word-cloud.js +1 -1
- package/dist/components/vue-ui-world.js +1 -1
- package/dist/components/vue-ui-xy-canvas.js +1 -1
- package/dist/components/vue-ui-xy.js +1 -1
- package/dist/{dom-to-png-CQUIoewh.js → dom-to-png-C2hxsVHU.js} +1 -1
- package/dist/{exposedLib-4fR8MXNd.js → exposedLib-CHbGXzAI.js} +1 -1
- package/dist/{img-D3Ck2d_T.js → img-EYBQVkRw.js} +1 -1
- package/dist/{labelUtils-CJ6EaaYo.js → labelUtils-Ba5vMXV8.js} +1 -1
- package/dist/{lib-DurLxjMz.js → lib-BPg41jWd.js} +6 -1
- package/dist/{package-CawqE4gj.js → package-ciWqdXC5.js} +1 -1
- package/dist/{pdf-2aQfvzB9.js → pdf-BoZtb_Ft.js} +1 -1
- package/dist/{render-common-DrbN2WgW.js → render-common-BEWzwi32.js} +2 -2
- package/dist/ssr/vue-ui-donut.js +1 -1
- package/dist/ssr/vue-ui-xy.js +1 -1
- package/dist/ssr.js +2 -2
- package/dist/style.css +1 -1
- package/dist/{useNestedProp-B3XMQAL1.js → useNestedProp-fNUUtYXm.js} +1 -1
- package/dist/{usePrinter-D53IAxB2.js → usePrinter-CsDAx75S.js} +2 -2
- package/dist/utils.js +2 -2
- package/dist/{vue-data-ui-DHA6rnQ7.js → vue-data-ui-BHRh3z_-.js} +70 -70
- package/dist/vue-data-ui.js +73 -73
- package/dist/{vue-ui-3d-bar-B3bLF2Fp.js → vue-ui-3d-bar-DUbSp0so.js} +6 -6
- package/dist/{vue-ui-accordion-D2W-dY3E.js → vue-ui-accordion-BGxpEtfk.js} +3 -3
- package/dist/{vue-ui-age-pyramid-CvRi9Web.js → vue-ui-age-pyramid-CYHqR2NK.js} +6 -6
- package/dist/{vue-ui-annotator-BTozB0Fb.js → vue-ui-annotator-Q5zC15Pp.js} +6 -6
- package/dist/{vue-ui-bullet-BbCPpZ5k.js → vue-ui-bullet-DOF7UCo_.js} +7 -7
- package/dist/{vue-ui-bump-FZIoCybJ.js → vue-ui-bump-DkntyN9G.js} +6 -6
- package/dist/{vue-ui-candlestick-IlS8zO5O.js → vue-ui-candlestick-Cz0s9M9a.js} +7 -7
- package/dist/{vue-ui-carousel-table-DokjHbNr.js → vue-ui-carousel-table-f3ddW3LA.js} +4 -4
- package/dist/{vue-ui-chestnut-DoUFUSVm.js → vue-ui-chestnut-iwScoeK0.js} +5 -5
- package/dist/{vue-ui-chord-6t-7dxVu.js → vue-ui-chord-Bl_91Sut.js} +8 -8
- package/dist/{vue-ui-circle-pack-CexF2pcc.js → vue-ui-circle-pack-Dm9BU5Kl.js} +6 -6
- package/dist/{vue-ui-cursor-YbgOW5z6.js → vue-ui-cursor-D_bkWVNS.js} +3 -3
- package/dist/{vue-ui-dag-B4RKzj4H.js → vue-ui-dag-CF4YxXqU.js} +7 -7
- package/dist/{vue-ui-dashboard-BUXA_h5X.js → vue-ui-dashboard-Bwhlqoe4.js} +69 -69
- package/dist/{vue-ui-digits-C4eNwkQW.js → vue-ui-digits-CXM0xSi6.js} +3 -3
- package/dist/{vue-ui-donut-DBhaQARJ.js → vue-ui-donut-BfehCl28.js} +10 -10
- package/dist/{vue-ui-donut-BS9ICnxW.js → vue-ui-donut-DEn7HF5c.js} +2 -2
- package/dist/{vue-ui-donut-evolution-B0v3uJNo.js → vue-ui-donut-evolution-Z7fpl7Zf.js} +9 -9
- package/dist/{vue-ui-dumbbell-Dj-FFcXl.js → vue-ui-dumbbell-BEFPs0t1.js} +7 -7
- package/dist/{vue-ui-flow-CGjXnUTR.js → vue-ui-flow-DAId7lkh.js} +7 -7
- package/dist/{vue-ui-funnel-B8qoKSY6.js → vue-ui-funnel-D6Hvhb_C.js} +6 -6
- package/dist/{vue-ui-galaxy-BOqqpg7g.js → vue-ui-galaxy-So95hmON.js} +9 -9
- package/dist/{vue-ui-gauge-C6gbloYZ.js → vue-ui-gauge-Cs96ssGw.js} +6 -6
- package/dist/{vue-ui-geo-BMRhXP7L.js → vue-ui-geo-MTJoJ3_A.js} +7 -7
- package/dist/{vue-ui-gizmo-DjnW3oDO.js → vue-ui-gizmo-D9tbjzYe.js} +3 -3
- package/dist/{vue-ui-heatmap-DyxHJCSO.js → vue-ui-heatmap-DRdQFkV_.js} +7 -7
- package/dist/{vue-ui-hill-C4osOxU0.js → vue-ui-hill-CdtIsBTO.js} +6 -6
- package/dist/{vue-ui-history-plot-Cwi7sVNg.js → vue-ui-history-plot-BaVZe6Fy.js} +8 -8
- package/dist/{vue-ui-horizontal-bar-CrgP4Bm8.js → vue-ui-horizontal-bar-DETeVTOn.js} +10 -10
- package/dist/{vue-ui-kpi-is2_nVkE.js → vue-ui-kpi-DHDy4LcL.js} +3 -3
- package/dist/{vue-ui-label-BbX73tEX.js → vue-ui-label-Bm5iMSie.js} +3 -3
- package/dist/{vue-ui-mini-loader-DntLxOr0.js → vue-ui-mini-loader-EK0wtL10.js} +2 -2
- package/dist/{vue-ui-molecule-CIY3r7HA.js → vue-ui-molecule-Dt31r51l.js} +5 -5
- package/dist/{vue-ui-mood-radar-CezYlJmD.js → vue-ui-mood-radar-CTiFn6bj.js} +7 -7
- package/dist/{vue-ui-nested-donuts-CF7YdoRx.js → vue-ui-nested-donuts-DKzeriUP.js} +9 -9
- package/dist/{vue-ui-onion-Chk8CzSw.js → vue-ui-onion-C3ZiE1dn.js} +9 -9
- package/dist/{vue-ui-parallel-coordinate-plot-hKkob-cX.js → vue-ui-parallel-coordinate-plot-D1xAQ_qP.js} +9 -9
- package/dist/{vue-ui-quadrant-B3Wy4REJ.js → vue-ui-quadrant-B82S1-8b.js} +9 -9
- package/dist/{vue-ui-quick-chart-rUvFKRs1.js → vue-ui-quick-chart-BeIZ2KVy.js} +7 -7
- package/dist/{vue-ui-radar-DA5EnHNt.js → vue-ui-radar-Bh7LKVWz.js} +8 -8
- package/dist/{vue-ui-rating-DglGQ_DQ.js → vue-ui-rating-AbGGnd-1.js} +2 -2
- package/dist/{vue-ui-relation-circle-ta7aeXOK.js → vue-ui-relation-circle-4ZeUHCx_.js} +6 -6
- package/dist/{vue-ui-ridgeline-BDqNGJ20.js → vue-ui-ridgeline-BmmcBvtt.js} +9 -9
- package/dist/{vue-ui-rings-BbSBLvb4.js → vue-ui-rings-Bx3lTcrM.js} +10 -10
- package/dist/{vue-ui-scatter-DwgFHsYb.js → vue-ui-scatter-Vw4JbCjp.js} +9 -9
- package/dist/{vue-ui-skeleton-UP0Bv65Q.js → vue-ui-skeleton-GSfVAGm5.js} +3 -3
- package/dist/{vue-ui-smiley-CmN35dmK.js → vue-ui-smiley-CVQ85iFx.js} +2 -2
- package/dist/{vue-ui-spark-trend-BHC8GKeh.js → vue-ui-spark-trend-BVS__UWD.js} +3 -3
- package/dist/{vue-ui-sparkbar-DG5Lx7L_.js → vue-ui-sparkbar-C-xEaUvd.js} +3 -3
- package/dist/{vue-ui-sparkgauge-Budj4a8D.js → vue-ui-sparkgauge-_XSE8M-e.js} +3 -3
- package/dist/{vue-ui-sparkhistogram-EF6l_8DB.js → vue-ui-sparkhistogram-DUM6ygCM.js} +4 -4
- package/dist/{vue-ui-sparkline-Bt3WUBs7.js → vue-ui-sparkline-Dg9fXwZG.js} +3 -3
- package/dist/{vue-ui-sparkstackbar-zcc269TN.js → vue-ui-sparkstackbar-8-iyImVK.js} +4 -4
- package/dist/{vue-ui-stackbar-RFBCfoIt.js → vue-ui-stackbar-zl-GieBs.js} +10 -10
- package/dist/{vue-ui-stackline-B2cHovb4.js → vue-ui-stackline-HcXMSuwS.js} +10 -10
- package/dist/{vue-ui-strip-plot-Cu-cVKCS.js → vue-ui-strip-plot-B_q_YQiP.js} +7 -7
- package/dist/{vue-ui-table-BukgLZ8K.js → vue-ui-table-CftOhYTO.js} +5 -5
- package/dist/{vue-ui-table-heatmap-y9oWnS6t.js → vue-ui-table-heatmap-DgFFlNnz.js} +5 -5
- package/dist/{vue-ui-table-sparkline-B4V_s9rK.js → vue-ui-table-sparkline-BsVOuCvB.js} +4 -4
- package/dist/{vue-ui-thermometer-CqVDnPmF.js → vue-ui-thermometer-DOECuI2_.js} +6 -6
- package/dist/{vue-ui-timer-D2pn3RWL.js → vue-ui-timer-B2Cd2bc6.js} +5 -5
- package/dist/{vue-ui-tiremarks-BMIIhkaB.js → vue-ui-tiremarks-CrnFAVS8.js} +6 -6
- package/dist/{vue-ui-treemap-fFJPPf8-.js → vue-ui-treemap-DHZ6BvAc.js} +9 -9
- package/dist/{vue-ui-waffle-B9TaBdel.js → vue-ui-waffle-Ca4QSb5z.js} +10 -10
- package/dist/{vue-ui-wheel-BN-YBzNj.js → vue-ui-wheel-7U-O7-xN.js} +6 -6
- package/dist/{vue-ui-word-cloud-CZzUlZBc.js → vue-ui-word-cloud-CVsvKOiI.js} +7 -7
- package/dist/{vue-ui-world-C--4pHTs.js → vue-ui-world-B9VGieBA.js} +7 -7
- package/dist/{vue-ui-xy-16TcfetH.js → vue-ui-xy-CNy0avUa.js} +2 -2
- package/dist/{vue-ui-xy-canvas-BzbNRbft.js → vue-ui-xy-canvas-B9kzEFnY.js} +11 -11
- package/dist/{vue-ui-xy-BTh5QolL.js → vue-ui-xy-chRPjTTj.js} +10 -10
- package/package.json +1 -1
- package/dist/PenAndPaper-CD5tlFYh.js +0 -571
|
@@ -0,0 +1,890 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
import { At as t, X as n, q as r, t as i } from "./lib-BPg41jWd.js";
|
|
3
|
+
import { t as a } from "./BaseIcon-Oj70ytWI.js";
|
|
4
|
+
import { t as o } from "./ColorPicker-sZV-tVqO.js";
|
|
5
|
+
import { computed as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, guardReactiveProps as f, nextTick as p, normalizeClass as m, normalizeProps as h, normalizeStyle as g, onBeforeUnmount as ee, onMounted as te, openBlock as ne, ref as _, renderSlot as v, toDisplayString as re, unref as ie, vModelText as ae, watch as y, withCtx as oe, withDirectives as se } from "vue";
|
|
6
|
+
//#region src/atoms/PenAndPaper.vue
|
|
7
|
+
var ce = /* @__PURE__ */ e({ default: () => b }), le = {
|
|
8
|
+
"aria-hidden": "true",
|
|
9
|
+
viewBox: "0 0 6 12",
|
|
10
|
+
style: { width: "100%" }
|
|
11
|
+
}, ue = ["fill"], de = ["fill"], fe = ["fill"], pe = ["disabled"], me = 750, he = 8, ge = 2, b = {
|
|
12
|
+
__name: "PenAndPaper",
|
|
13
|
+
props: {
|
|
14
|
+
svgRef: {
|
|
15
|
+
type: [
|
|
16
|
+
Object,
|
|
17
|
+
null,
|
|
18
|
+
void 0
|
|
19
|
+
],
|
|
20
|
+
required: !0
|
|
21
|
+
},
|
|
22
|
+
color: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "#2D353C"
|
|
25
|
+
},
|
|
26
|
+
backgroundColor: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "#FFFFFF"
|
|
29
|
+
},
|
|
30
|
+
active: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !1
|
|
33
|
+
},
|
|
34
|
+
scale: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 1
|
|
37
|
+
},
|
|
38
|
+
isCursorPointer: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: !1
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
emits: ["close"],
|
|
44
|
+
setup(e, { emit: ce }) {
|
|
45
|
+
let b = e, _e = ce, x = _([]), S = _([]), C = _(b.color), w = _(2), T = _(!1), ve = _(""), E = _(null), D = _(null), O = _(null), ye = _(null), k = _(null), be = _(null), A = _(!1), j = _(null), xe = _(""), M = _(""), N = _(!1), Se = _(!1), P = _(null), Ce = _(null), we = _(!1), F = _(""), Te = /* @__PURE__ */ new Map(), Ee = _(`arrow-def-${r()}`), I = _(!1), L = _(null), De = _({
|
|
46
|
+
x: 0,
|
|
47
|
+
y: 0
|
|
48
|
+
}), R = _([""]), z = _({
|
|
49
|
+
row: 0,
|
|
50
|
+
col: 0
|
|
51
|
+
}), B = _(16), Oe = _(!1), ke = _(""), Ae = _(!1), je = [
|
|
52
|
+
"arrow",
|
|
53
|
+
"text",
|
|
54
|
+
"line",
|
|
55
|
+
"draw"
|
|
56
|
+
], V = _(0), H = s(() => je[V.value]), Me = {
|
|
57
|
+
arrow: "plotArrow",
|
|
58
|
+
text: "text",
|
|
59
|
+
line: "plotLine",
|
|
60
|
+
draw: "annotator"
|
|
61
|
+
}, Ne = _("url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAABg2lDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TpSIVh2YQcchQnSyIijhKFYtgobQVWnUwufQLmjQkKS6OgmvBwY/FqoOLs64OroIg+AHi6OSk6CIl/i8ptIjx4Lgf7+497t4BQrPKNKtnAtB020wn4lIuvyqFXhGGiAhCiMnMMpKZxSx8x9c9Any9i/Es/3N/jgG1YDEgIBHPMcO0iTeIZzZtg/M+scjKskp8Tjxu0gWJH7muePzGueSywDNFM5ueJxaJpVIXK13MyqZGPE0cVTWd8oWcxyrnLc5atc7a9+QvDBf0lQzXaY4ggSUkkYIEBXVUUIWNGK06KRbStB/38Q+7/hS5FHJVwMixgBo0yK4f/A9+d2sVpya9pHAc6H1xnI9RILQLtBqO833sOK0TIPgMXOkdf60JzH6S3uho0SNgcBu4uO5oyh5wuQMMPRmyKbtSkKZQLALvZ/RNeSByC/Sveb2193H6AGSpq+Ub4OAQGCtR9rrPu/u6e/v3TLu/H5C7crM1WjgWAAAABmJLR0QAqwB5AHWF+8OUAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5gwUExIUagzGcQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAABfSURBVBjTldAxDoNQDIPhL0+q1L33P1AvAhN7xfK6WAgoLfSfrNiykpQtE+7RLzx2vgF9D3o8lWDmn1QVVMP0LZQGmNtqp1/cmou0XHdG/+sYeGZwFBqPCub8rkcvvAGvsi1VYarR8wAAAABJRU5ErkJggg==') 5 5, auto");
|
|
62
|
+
function Pe(e) {
|
|
63
|
+
let t = e?.target;
|
|
64
|
+
if (!(t instanceof Element)) return null;
|
|
65
|
+
let n = t.closest(".vue-data-ui-doodle");
|
|
66
|
+
return n && E.value?.contains(n) ? n : null;
|
|
67
|
+
}
|
|
68
|
+
function Fe(e) {
|
|
69
|
+
let t = e?.target;
|
|
70
|
+
if (!(t instanceof Element)) return null;
|
|
71
|
+
let n = t.closest(".vue-data-ui-selection-handle");
|
|
72
|
+
return n && E.value?.contains(n) ? n : null;
|
|
73
|
+
}
|
|
74
|
+
function Ie(e) {
|
|
75
|
+
let t = e?.target;
|
|
76
|
+
if (!(t instanceof Element)) return null;
|
|
77
|
+
let n = t.closest(".vue-data-ui-selection-delete");
|
|
78
|
+
return n && E.value?.contains(n) ? n : null;
|
|
79
|
+
}
|
|
80
|
+
function Le(e) {
|
|
81
|
+
if (!e) return "";
|
|
82
|
+
let t = e.getAttribute("data-doodle-id");
|
|
83
|
+
return t || (t = r(), e.setAttribute("data-doodle-id", t)), t;
|
|
84
|
+
}
|
|
85
|
+
function U() {
|
|
86
|
+
return E.value ? Array.from(E.value.children).filter((e) => e.classList?.contains("vue-data-ui-doodle")).map((e) => e.outerHTML).join("") : "";
|
|
87
|
+
}
|
|
88
|
+
function Re(e) {
|
|
89
|
+
if (!E.value) return;
|
|
90
|
+
K();
|
|
91
|
+
let t = E.value.querySelector(".vue-data-ui-svg-caret");
|
|
92
|
+
if (t && t.remove(), Array.from(E.value.children).forEach((e) => {
|
|
93
|
+
e.classList?.contains("vue-data-ui-doodle") && e.remove();
|
|
94
|
+
}), e) {
|
|
95
|
+
let t = document.createElementNS(i, "g");
|
|
96
|
+
t.innerHTML = e, Array.from(t.children).forEach((e) => E.value.appendChild(e));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function W(e, t = null) {
|
|
100
|
+
if (e === U()) return;
|
|
101
|
+
let n = Date.now(), r = x.value[x.value.length - 1];
|
|
102
|
+
t && r?.mergeKey === t && n - r.timestamp <= me ? r.timestamp = n : x.value.push({
|
|
103
|
+
state: e,
|
|
104
|
+
mergeKey: t,
|
|
105
|
+
timestamp: n
|
|
106
|
+
}), S.value = [];
|
|
107
|
+
}
|
|
108
|
+
function ze(e) {
|
|
109
|
+
let t = e.touches?.[0] || e.changedTouches?.[0];
|
|
110
|
+
return {
|
|
111
|
+
x: t ? t.clientX : e.clientX,
|
|
112
|
+
y: t ? t.clientY : e.clientY
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function Be(e, t) {
|
|
116
|
+
let n = b.svgRef;
|
|
117
|
+
if (!n || !e) return null;
|
|
118
|
+
let { x: r, y: i } = ze(t), a = n.createSVGPoint();
|
|
119
|
+
a.x = r, a.y = i;
|
|
120
|
+
let o = e.getScreenCTM()?.inverse();
|
|
121
|
+
return o ? a.matrixTransform(o) : null;
|
|
122
|
+
}
|
|
123
|
+
function Ve(e, t, n, r, i, a) {
|
|
124
|
+
let o = i - n, s = a - r, c = o * o + s * s;
|
|
125
|
+
if (!c) return Math.hypot(e - n, t - r);
|
|
126
|
+
let l = Math.max(0, Math.min(1, ((e - n) * o + (t - r) * s) / c)), u = n + l * o, d = r + l * s;
|
|
127
|
+
return Math.hypot(e - u, t - d);
|
|
128
|
+
}
|
|
129
|
+
function He(e, t) {
|
|
130
|
+
let n = Be(e, t);
|
|
131
|
+
if (!n) return !1;
|
|
132
|
+
let r = e.tagName.toLowerCase(), i = he * b.scale;
|
|
133
|
+
if (r === "line") {
|
|
134
|
+
let t = Number(e.getAttribute("x1")), r = Number(e.getAttribute("y1")), a = Number(e.getAttribute("x2")), o = Number(e.getAttribute("y2")), s = Number(e.getAttribute("stroke-width")) || 0;
|
|
135
|
+
return Ve(n.x, n.y, t, r, a, o) <= Math.max(i, s / 2);
|
|
136
|
+
}
|
|
137
|
+
if (r === "circle") {
|
|
138
|
+
let t = Number(e.getAttribute("cx")), r = Number(e.getAttribute("cy")), a = Number(e.getAttribute("r")) || 0;
|
|
139
|
+
return Math.hypot(n.x - t, n.y - r) <= a + i;
|
|
140
|
+
}
|
|
141
|
+
if (r === "text") try {
|
|
142
|
+
let t = e.getBBox();
|
|
143
|
+
return n.x >= t.x - i && n.x <= t.x + t.width + i && n.y >= t.y - i && n.y <= t.y + t.height + i;
|
|
144
|
+
} catch {
|
|
145
|
+
return !1;
|
|
146
|
+
}
|
|
147
|
+
if (r === "path") try {
|
|
148
|
+
let t = e.getBBox();
|
|
149
|
+
if (n.x < t.x - i || n.x > t.x + t.width + i || n.y < t.y - i || n.y > t.y + t.height + i) return !1;
|
|
150
|
+
if (typeof e.isPointInStroke == "function") {
|
|
151
|
+
let t = e.getAttribute("stroke-width"), r = Math.max(Number(t) || 0, i * 2);
|
|
152
|
+
e.setAttribute("stroke-width", r);
|
|
153
|
+
let a = e.isPointInStroke(n);
|
|
154
|
+
return t === null ? e.removeAttribute("stroke-width") : e.setAttribute("stroke-width", t), a;
|
|
155
|
+
}
|
|
156
|
+
let r = e.getTotalLength(), a = Math.max(2 * b.scale, 2);
|
|
157
|
+
for (let t = 0; t <= r; t += a) {
|
|
158
|
+
let r = e.getPointAtLength(t);
|
|
159
|
+
if (Math.hypot(n.x - r.x, n.y - r.y) <= i) return !0;
|
|
160
|
+
}
|
|
161
|
+
} catch {
|
|
162
|
+
return !1;
|
|
163
|
+
}
|
|
164
|
+
return !1;
|
|
165
|
+
}
|
|
166
|
+
function Ue(e) {
|
|
167
|
+
return Pe(e) || E.value && Array.from(E.value.querySelectorAll(".vue-data-ui-doodle")).reverse().find((t) => He(t, e)) || null;
|
|
168
|
+
}
|
|
169
|
+
function We() {
|
|
170
|
+
be.value?.parentNode && be.value.parentNode.removeChild(be.value), be.value = null;
|
|
171
|
+
}
|
|
172
|
+
function G() {
|
|
173
|
+
if (We(), !I.value && !(!b.active || !E.value || !k.value) && E.value.contains(k.value)) try {
|
|
174
|
+
let e = k.value, t = e.getBBox(), n = 4 * b.scale, r = document.createElementNS(i, "g");
|
|
175
|
+
r.setAttribute("class", "vue-data-ui-selection-overlay");
|
|
176
|
+
let a = document.createElementNS(i, "rect");
|
|
177
|
+
if (a.setAttribute("class", "vue-data-ui-selection-box"), a.setAttribute("x", t.x - n), a.setAttribute("y", t.y - n), a.setAttribute("width", Math.max(t.width + n * 2, n * 2)), a.setAttribute("height", Math.max(t.height + n * 2, n * 2)), a.setAttribute("fill", "none"), a.setAttribute("stroke", b.color), a.setAttribute("stroke-width", Math.max(1, b.scale)), a.setAttribute("stroke-dasharray", `${4 * b.scale} ${3 * b.scale}`), a.setAttribute("pointer-events", "none"), r.appendChild(a), e.tagName.toLowerCase() === "line") {
|
|
178
|
+
let t = Math.max(4, 5 * b.scale), n = Math.max(1, 1.5 * b.scale);
|
|
179
|
+
[{
|
|
180
|
+
endpoint: "start",
|
|
181
|
+
x: Number(e.getAttribute("x1")),
|
|
182
|
+
y: Number(e.getAttribute("y1"))
|
|
183
|
+
}, {
|
|
184
|
+
endpoint: "end",
|
|
185
|
+
x: Number(e.getAttribute("x2")),
|
|
186
|
+
y: Number(e.getAttribute("y2"))
|
|
187
|
+
}].forEach(({ endpoint: e, x: a, y: o }) => {
|
|
188
|
+
let s = document.createElementNS(i, "circle");
|
|
189
|
+
s.setAttribute("class", "vue-data-ui-selection-handle"), s.setAttribute("data-line-endpoint", e), s.setAttribute("cx", a), s.setAttribute("cy", o), s.setAttribute("r", t), s.setAttribute("fill", b.backgroundColor), s.setAttribute("stroke", b.color), s.setAttribute("stroke-width", n), s.setAttribute("pointer-events", "all"), r.appendChild(s);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
let o = Math.max(20, 24 * b.scale), s = Math.max(1, b.scale), c = t.x + t.width + n + 4 * b.scale, l = t.y - n - o - 4 * b.scale, u = document.createElementNS(i, "g");
|
|
193
|
+
u.setAttribute("class", "vue-data-ui-selection-delete"), u.setAttribute("role", "button"), u.setAttribute("tabindex", "0"), u.setAttribute("aria-label", "Delete selected drawing"), u.setAttribute("pointer-events", "all");
|
|
194
|
+
let d = document.createElementNS(i, "rect");
|
|
195
|
+
d.setAttribute("x", c), d.setAttribute("y", l), d.setAttribute("width", o), d.setAttribute("height", o), d.setAttribute("rx", 4 * b.scale), d.setAttribute("fill", b.backgroundColor), d.setAttribute("stroke", J.value), d.setAttribute("stroke-width", s), d.setAttribute("vector-effect", "non-scaling-stroke");
|
|
196
|
+
let f = o / 24, p = document.createElementNS(i, "path");
|
|
197
|
+
p.setAttribute("d", "M 8 8 L 16 16 M 16 8 L 8 16"), p.setAttribute("transform", `translate(${c} ${l}) scale(${f})`), p.setAttribute("fill", "none"), p.setAttribute("stroke", b.color), p.setAttribute("stroke-width", Math.max(1.25, 1.5 * b.scale)), p.setAttribute("stroke-linecap", "round"), p.setAttribute("stroke-linejoin", "round"), p.setAttribute("vector-effect", "non-scaling-stroke"), p.setAttribute("pointer-events", "none"), u.appendChild(d), u.appendChild(p), u.addEventListener("keydown", (e) => {
|
|
198
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), Ge(e));
|
|
199
|
+
}), r.appendChild(u);
|
|
200
|
+
let m = e.getAttribute("transform");
|
|
201
|
+
m && r.setAttribute("transform", m), E.value.appendChild(r), be.value = r;
|
|
202
|
+
} catch {
|
|
203
|
+
We();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function K() {
|
|
207
|
+
k.value = null, A.value = !1, j.value = null, xe.value = "", M.value = "", N.value = !1, Se.value = !1, P.value = null, Ce.value = null, We(), Z();
|
|
208
|
+
}
|
|
209
|
+
function Ge(e = null) {
|
|
210
|
+
if (!b.active || !k.value || !E.value || !E.value.contains(k.value)) return;
|
|
211
|
+
e?.cancelable && e.preventDefault(), e?.stopPropagation?.(), e?.stopImmediatePropagation?.();
|
|
212
|
+
let t = U();
|
|
213
|
+
k.value.remove(), W(t), K();
|
|
214
|
+
}
|
|
215
|
+
function Ke(e) {
|
|
216
|
+
return e ? e.tagName.toLowerCase() === "text" || e.tagName.toLowerCase() === "circle" ? e.getAttribute("fill") : e.getAttribute("stroke") : null;
|
|
217
|
+
}
|
|
218
|
+
function qe(e) {
|
|
219
|
+
if (e) {
|
|
220
|
+
we.value = !0;
|
|
221
|
+
try {
|
|
222
|
+
let t = e.tagName.toLowerCase(), n = Ke(e);
|
|
223
|
+
if (n && (C.value = n), t === "text") {
|
|
224
|
+
V.value = je.indexOf("text");
|
|
225
|
+
let t = Number(e.getAttribute("font-size"));
|
|
226
|
+
Number.isFinite(t) && b.scale && (B.value = t / b.scale);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (t === "line" ? V.value = e.hasAttribute("marker-end") ? je.indexOf("arrow") : je.indexOf("line") : V.value = je.indexOf("draw"), t === "circle") {
|
|
230
|
+
let t = Number(e.getAttribute("r"));
|
|
231
|
+
Number.isFinite(t) && b.scale && (w.value = t * 2 / b.scale);
|
|
232
|
+
} else {
|
|
233
|
+
let t = Number(e.getAttribute("stroke-width"));
|
|
234
|
+
Number.isFinite(t) && b.scale && (w.value = t / b.scale);
|
|
235
|
+
}
|
|
236
|
+
} finally {
|
|
237
|
+
p(() => {
|
|
238
|
+
we.value = !1;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function Je(e) {
|
|
244
|
+
!b.active || !e || !E.value?.contains(e) || (Le(e), k.value = e, qe(e), p(G));
|
|
245
|
+
}
|
|
246
|
+
function Ye(e) {
|
|
247
|
+
if (!b.active || !E.value || I.value) return;
|
|
248
|
+
if (Ie(e)) {
|
|
249
|
+
Ge(e);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
let t = Fe(e);
|
|
253
|
+
if (t && k.value && k.value.tagName.toLowerCase() === "line") {
|
|
254
|
+
e.cancelable && e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation?.();
|
|
255
|
+
let n = t.getAttribute("data-line-endpoint");
|
|
256
|
+
if (!["start", "end"].includes(n)) return;
|
|
257
|
+
P.value = n, Ce.value = Be(k.value, e), A.value = !1, N.value = !1, Se.value = !1, M.value = U(), Z(e);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
let n = Ue(e);
|
|
261
|
+
if (!n) {
|
|
262
|
+
K();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
e.cancelable && e.preventDefault(), Se.value = k.value === n, Je(n);
|
|
266
|
+
let { x: r, y: i } = Y(e);
|
|
267
|
+
A.value = !0, N.value = !1, j.value = {
|
|
268
|
+
x: r,
|
|
269
|
+
y: i
|
|
270
|
+
}, xe.value = n.getAttribute("transform") || "", M.value = U(), Z(e);
|
|
271
|
+
}
|
|
272
|
+
function Xe(e) {
|
|
273
|
+
if (!b.active || !k.value) return;
|
|
274
|
+
if (Z(e), P.value) {
|
|
275
|
+
let t = Be(k.value, e);
|
|
276
|
+
if (!t) return;
|
|
277
|
+
let n = Ce.value;
|
|
278
|
+
if (!N.value && n && Math.hypot(t.x - n.x, t.y - n.y) < ge * b.scale) return;
|
|
279
|
+
e.cancelable && e.preventDefault(), N.value = !0, P.value === "start" ? (k.value.setAttribute("x1", t.x), k.value.setAttribute("y1", t.y)) : (k.value.setAttribute("x2", t.x), k.value.setAttribute("y2", t.y)), G();
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (!A.value || !j.value) return;
|
|
283
|
+
let { x: t, y: n } = Y(e), r = t - j.value.x, i = n - j.value.y, a = Math.hypot(r, i);
|
|
284
|
+
if (!N.value && a < ge * b.scale) return;
|
|
285
|
+
e.cancelable && e.preventDefault(), N.value = !0;
|
|
286
|
+
let o = xe.value.trim();
|
|
287
|
+
k.value.setAttribute("transform", `${o ? `${o} ` : ""}translate(${r} ${i})`), G();
|
|
288
|
+
}
|
|
289
|
+
function q(e) {
|
|
290
|
+
let t = k.value, n = !P.value && t && t.tagName.toLowerCase() === "text" && Se.value && !N.value && !I.value;
|
|
291
|
+
if (N.value && M.value && W(M.value), A.value = !1, j.value = null, M.value = "", N.value = !1, Se.value = !1, P.value = null, Ce.value = null, xe.value = t?.getAttribute("transform") || "", t && E.value?.contains(t) && G(), n && t && E.value?.contains(t)) {
|
|
292
|
+
nt(t, e), Z(e);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
Z(e);
|
|
296
|
+
}
|
|
297
|
+
function Ze(e) {
|
|
298
|
+
if (!b.active || !k.value || we.value) return;
|
|
299
|
+
let t = k.value, n = t.tagName.toLowerCase();
|
|
300
|
+
if (Ke(t) === e) return;
|
|
301
|
+
let r = U();
|
|
302
|
+
if (n === "text" || n === "circle") t.setAttribute("fill", e);
|
|
303
|
+
else if (t.setAttribute("stroke", e), n === "line" && t.hasAttribute("marker-end")) {
|
|
304
|
+
let n = _t(e);
|
|
305
|
+
n && t.setAttribute("marker-end", `url(#${n})`);
|
|
306
|
+
}
|
|
307
|
+
I.value && t === L.value || W(r, `color:${Le(t)}`), G(), I.value && t === L.value && ct();
|
|
308
|
+
}
|
|
309
|
+
function Qe(e) {
|
|
310
|
+
if (!b.active || !k.value || we.value) return;
|
|
311
|
+
let t = k.value, n = t.tagName.toLowerCase();
|
|
312
|
+
if (n === "text") return;
|
|
313
|
+
let r = Number(e) * b.scale;
|
|
314
|
+
if ((n === "circle" ? Number(t.getAttribute("r")) * 2 : Number(t.getAttribute("stroke-width"))) === r) return;
|
|
315
|
+
let i = U();
|
|
316
|
+
n === "circle" ? t.setAttribute("r", r / 2) : t.setAttribute("stroke-width", r), W(i, `size:${Le(t)}`), G();
|
|
317
|
+
}
|
|
318
|
+
function $e(e) {
|
|
319
|
+
if (!b.active || !k.value || we.value) return;
|
|
320
|
+
let t = k.value;
|
|
321
|
+
if (t.tagName.toLowerCase() !== "text") return;
|
|
322
|
+
let n = Number(e) * b.scale;
|
|
323
|
+
if (Number(t.getAttribute("font-size")) === n) return;
|
|
324
|
+
let r = U();
|
|
325
|
+
t.setAttribute("font-size", n), Array.from(t.children).forEach((e, t) => {
|
|
326
|
+
e.setAttribute("dy", t === 0 ? "0" : `${n * 1.2}`);
|
|
327
|
+
}), I.value && t === L.value || W(r, `font-size:${Le(t)}`), G(), I.value && t === L.value && ct();
|
|
328
|
+
}
|
|
329
|
+
y(C, Ze), y(w, Qe), y(B, $e);
|
|
330
|
+
function et() {
|
|
331
|
+
V.value + 1 >= je.length ? V.value = 0 : V.value += 1;
|
|
332
|
+
}
|
|
333
|
+
function tt(e) {
|
|
334
|
+
if (!E.value || !b.active || H.value !== "text" || I.value || Fe(e) || Ue(e)) return;
|
|
335
|
+
K();
|
|
336
|
+
let t = U(), { x: n, y: a } = Y(e);
|
|
337
|
+
De.value = {
|
|
338
|
+
x: n,
|
|
339
|
+
y: a
|
|
340
|
+
}, R.value = [""], z.value = {
|
|
341
|
+
row: 0,
|
|
342
|
+
col: 0
|
|
343
|
+
}, Oe.value = !1, ke.value = t, Ae.value = !1;
|
|
344
|
+
let o = document.createElementNS(i, "text");
|
|
345
|
+
o.setAttribute("x", n), o.setAttribute("y", a), o.setAttribute("fill", C.value), o.setAttribute("font-size", B.value * b.scale), o.setAttribute("font-family", "sans-serif"), o.setAttribute("class", "vue-data-ui-doodle"), o.setAttribute("data-doodle-id", r()), o.setAttribute("dominant-baseline", "hanging"), o.setAttribute("pointer-events", "all");
|
|
346
|
+
let s = document.createElementNS(i, "tspan");
|
|
347
|
+
s.setAttribute("x", n), s.setAttribute("dy", "0"), s.setAttribute("dominant-baseline", "hanging"), s.textContent = "", o.appendChild(s), o.style.pointerEvents = "none", o.style.userSelect = "none", E.value.appendChild(o), k.value = o, L.value = o, I.value = !0, We(), window.addEventListener("keydown", rt), window.addEventListener("mousedown", lt, !0), it(), ct();
|
|
348
|
+
}
|
|
349
|
+
function nt(e) {
|
|
350
|
+
if (!b.active || !E.value || I.value || !e || e.tagName.toLowerCase() !== "text" || !E.value.contains(e)) return;
|
|
351
|
+
let t = U();
|
|
352
|
+
k.value = e, qe(e);
|
|
353
|
+
let n = Number(e.getAttribute("x")) || 0, r = Number(e.getAttribute("y")) || 0, i = Array.from(e.children).map((e) => {
|
|
354
|
+
let t = e.textContent || "";
|
|
355
|
+
return t === "" ? "" : t.split("").join("");
|
|
356
|
+
}), a = i.length ? i : [e.textContent || ""], o = Math.max(0, a.length - 1);
|
|
357
|
+
De.value = {
|
|
358
|
+
x: n,
|
|
359
|
+
y: r
|
|
360
|
+
}, R.value = a, z.value = {
|
|
361
|
+
row: o,
|
|
362
|
+
col: a[o]?.length || 0
|
|
363
|
+
}, ke.value = t, Ae.value = !0, Oe.value = !0, L.value = e, I.value = !0, e.style.pointerEvents = "none", We(), window.addEventListener("keydown", rt), window.addEventListener("mousedown", lt, !0), it(), ct();
|
|
364
|
+
}
|
|
365
|
+
function rt(e) {
|
|
366
|
+
if (!I.value) return;
|
|
367
|
+
let { row: t, col: n } = z.value, r = R.value.slice(), i = !1;
|
|
368
|
+
if (e.key === "Enter") {
|
|
369
|
+
let a = r[t], o = a.slice(0, n), s = a.slice(n);
|
|
370
|
+
r.splice(t, 1, o, s), t += 1, n = 0, i = !0, e.preventDefault();
|
|
371
|
+
} else if (e.key === "Backspace") {
|
|
372
|
+
if (n > 0) r[t] = r[t].slice(0, n - 1) + r[t].slice(n), --n, i = !0;
|
|
373
|
+
else if (t > 0) {
|
|
374
|
+
let e = r[t - 1].length;
|
|
375
|
+
r[t - 1] += r[t], r.splice(t, 1), --t, n = e, i = !0;
|
|
376
|
+
}
|
|
377
|
+
e.preventDefault();
|
|
378
|
+
} else if (e.key === "Delete") n < r[t].length ? (r[t] = r[t].slice(0, n) + r[t].slice(n + 1), i = !0) : t < r.length - 1 && (r[t] += r[t + 1], r.splice(t + 1, 1), i = !0), e.preventDefault();
|
|
379
|
+
else if (e.key === "ArrowLeft") n > 0 ? --n : t > 0 && (--t, n = r[t].length), i = !0, e.preventDefault();
|
|
380
|
+
else if (e.key === "ArrowRight") n < r[t].length ? n += 1 : t < r.length - 1 && (t += 1, n = 0), i = !0, e.preventDefault();
|
|
381
|
+
else if (e.key === "ArrowUp") t > 0 && (--t, n = Math.min(n, r[t].length), i = !0), e.preventDefault();
|
|
382
|
+
else if (e.key === "ArrowDown") t < r.length - 1 && (t += 1, n = Math.min(n, r[t].length), i = !0), e.preventDefault();
|
|
383
|
+
else if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) r[t] = r[t].slice(0, n) + e.key + r[t].slice(n), n += 1, i = !0, e.preventDefault();
|
|
384
|
+
else if (e.key === "Escape") {
|
|
385
|
+
ut(!1, !0);
|
|
386
|
+
return;
|
|
387
|
+
} else e.key === "Tab" && e.preventDefault();
|
|
388
|
+
i && (R.value = r, z.value = {
|
|
389
|
+
row: t,
|
|
390
|
+
col: n
|
|
391
|
+
}, it(), ct());
|
|
392
|
+
}
|
|
393
|
+
function it() {
|
|
394
|
+
let e = L.value;
|
|
395
|
+
if (!e) return;
|
|
396
|
+
let { x: t } = De.value;
|
|
397
|
+
for (; e.firstChild;) e.removeChild(e.firstChild);
|
|
398
|
+
R.value.forEach((n, r) => {
|
|
399
|
+
let a = document.createElementNS(i, "tspan");
|
|
400
|
+
a.setAttribute("x", t), a.setAttribute("dominant-baseline", "hanging"), a.setAttribute("dy", r === 0 ? "0" : `${B.value * 1.2 * b.scale}`), a.textContent = n.length ? n : "", e.appendChild(a);
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
let at = _(null);
|
|
404
|
+
function ot() {
|
|
405
|
+
at.value !== null && (clearInterval(at.value), at.value = null);
|
|
406
|
+
}
|
|
407
|
+
function st(e) {
|
|
408
|
+
ot();
|
|
409
|
+
let t = !0;
|
|
410
|
+
e.style.opacity = "1", at.value = setInterval(() => {
|
|
411
|
+
if (!E.value || !e || !E.value.contains(e)) {
|
|
412
|
+
ot();
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
t = !t, e.style.opacity = t ? "1" : "0";
|
|
416
|
+
}, 500);
|
|
417
|
+
}
|
|
418
|
+
function ct() {
|
|
419
|
+
let e = E.value?.querySelector(".vue-data-ui-svg-caret");
|
|
420
|
+
e && E.value && E.value.removeChild(e);
|
|
421
|
+
let t = L.value;
|
|
422
|
+
if (!t || !E.value) return;
|
|
423
|
+
let { x: n, y: r } = De.value, { row: a, col: o } = z.value, s = B.value * b.scale, c = t.childNodes[a];
|
|
424
|
+
if (!c) return;
|
|
425
|
+
let l = c.textContent.slice(0, o);
|
|
426
|
+
l.endsWith(" ") && (l += "\xA0");
|
|
427
|
+
let u = document.createElementNS(i, "text");
|
|
428
|
+
u.setAttribute("x", n), u.setAttribute("y", r), u.setAttribute("font-size", s), u.setAttribute("font-family", "sans-serif"), u.textContent = l || "", E.value.appendChild(u);
|
|
429
|
+
let d = u.getBBox();
|
|
430
|
+
E.value.removeChild(u);
|
|
431
|
+
let f = r + a * s * 1.2, p = n + d.width, m = document.createElementNS(i, "rect");
|
|
432
|
+
m.setAttribute("x", p), m.setAttribute("y", f), m.setAttribute("rx", 1), m.setAttribute("width", 2), m.setAttribute("height", s), m.setAttribute("fill", C.value), m.setAttribute("class", "vue-data-ui-svg-caret"), m.setAttribute("pointer-events", "none");
|
|
433
|
+
let h = t.getAttribute("transform");
|
|
434
|
+
h && m.setAttribute("transform", h), E.value.appendChild(m), st(m);
|
|
435
|
+
}
|
|
436
|
+
function lt(e) {
|
|
437
|
+
L.value && (L.value.contains(e.target) || ut(!1));
|
|
438
|
+
}
|
|
439
|
+
function ut(e = !1, t = !1) {
|
|
440
|
+
window.removeEventListener("keydown", rt), window.removeEventListener("mousedown", lt, !0), ot();
|
|
441
|
+
let n = E.value?.querySelector(".vue-data-ui-svg-caret");
|
|
442
|
+
n && n.remove();
|
|
443
|
+
let r = L.value, i = ke.value, a = R.value.every((e) => !e.length);
|
|
444
|
+
if (t) {
|
|
445
|
+
I.value = !1, L.value = null, R.value = [""], z.value = {
|
|
446
|
+
row: 0,
|
|
447
|
+
col: 0
|
|
448
|
+
}, Oe.value = !1, ke.value = "", Ae.value = !1, Re(i);
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
r && E.value?.contains(r) && (e || a ? r.remove() : r.style.pointerEvents = "all"), I.value = !1, L.value = null, R.value = [""], z.value = {
|
|
452
|
+
row: 0,
|
|
453
|
+
col: 0
|
|
454
|
+
}, Oe.value = !1, ke.value = "", Ae.value = !1, W(i), r && E.value?.contains(r) ? Je(r) : K();
|
|
455
|
+
}
|
|
456
|
+
let J = s(() => t(b.color, .6));
|
|
457
|
+
function dt() {
|
|
458
|
+
if (!E.value) return;
|
|
459
|
+
let e = E.value.querySelector(".vue-data-ui-mask");
|
|
460
|
+
if (e && E.value.removeChild(e), b.active) {
|
|
461
|
+
let e = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
462
|
+
e.setAttribute("class", "vue-data-ui-mask"), e.setAttribute("width", "100%"), e.setAttribute("height", "100%"), e.setAttribute("fill", "transparent"), e.setAttribute("pointer-events", "all"), E.value.insertBefore(e, E.value.firstChild);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
function Y(e) {
|
|
466
|
+
let t = b.svgRef;
|
|
467
|
+
if (!t) return {
|
|
468
|
+
x: 0,
|
|
469
|
+
y: 0
|
|
470
|
+
};
|
|
471
|
+
let n = t.createSVGPoint(), r = e.touches?.length || e.changedTouches?.length ? e.touches?.[0] || e.changedTouches?.[0] : null, i = r ? r.clientX : e.clientX, a = r ? r.clientY : e.clientY;
|
|
472
|
+
n.x = i, n.y = a;
|
|
473
|
+
let o = t.getScreenCTM()?.inverse();
|
|
474
|
+
return o ? n.matrixTransform(o) : {
|
|
475
|
+
x: 0,
|
|
476
|
+
y: 0
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
function ft(e) {
|
|
480
|
+
let t = e.trim().split(/\s+/);
|
|
481
|
+
if (t.length < 4) return e;
|
|
482
|
+
let n = t.slice(1).map(Number);
|
|
483
|
+
if (n.length % 2 != 0) return e;
|
|
484
|
+
let r = pt(n), i = [`M ${r[0]} ${r[1]}`];
|
|
485
|
+
for (let e = 2; e < r.length - 2; e += 2) {
|
|
486
|
+
let t = r[e - 2], n = r[e - 1], a = r[e], o = r[e + 1], s = (t + a) / 2, c = (n + o) / 2;
|
|
487
|
+
i.push(`Q ${t} ${n} ${s} ${c}`);
|
|
488
|
+
}
|
|
489
|
+
let a = r[r.length - 2], o = r[r.length - 1];
|
|
490
|
+
return i.push(`L ${a} ${o}`), i.join(" ");
|
|
491
|
+
}
|
|
492
|
+
function pt(e, t = 1) {
|
|
493
|
+
let n = [...e];
|
|
494
|
+
for (let r = 2; r < e.length - 2; r += 2) {
|
|
495
|
+
let i = e[r], a = e[r + 1], o = e[r - 2], s = e[r - 1], c = e[r + 2], l = e[r + 3];
|
|
496
|
+
n[r] = i + t * ((o + c) / 2 - i), n[r + 1] = a + t * ((s + l) / 2 - a);
|
|
497
|
+
}
|
|
498
|
+
return n;
|
|
499
|
+
}
|
|
500
|
+
function mt(e) {
|
|
501
|
+
let t = e.trim().split(/\s+/), n = "", r = "", i = null, a = null;
|
|
502
|
+
for (let e = 0; e < t.length; e += 1) {
|
|
503
|
+
let o = t[e];
|
|
504
|
+
if (isNaN(o)) {
|
|
505
|
+
if (r = o, r === "M" || r === "L") i = parseFloat(t[++e]), a = parseFloat(t[++e]), n += `${r}${i} ${a}`;
|
|
506
|
+
else if (r === "Q") {
|
|
507
|
+
let r = parseFloat(t[++e]), o = parseFloat(t[++e]), s = parseFloat(t[++e]), c = parseFloat(t[++e]);
|
|
508
|
+
n += r === i && o === a ? `t${s - i} ${c - a}` : `q${r - i} ${o - a} ${s - i} ${c - a}`, i = s, a = c;
|
|
509
|
+
}
|
|
510
|
+
} else {
|
|
511
|
+
let s = parseFloat(o), c = parseFloat(t[++e]);
|
|
512
|
+
if (r === "L") {
|
|
513
|
+
let e = s - i, t = c - a;
|
|
514
|
+
n += e === 0 ? `v${t}` : t === 0 ? `h${e}` : `l${e} ${t}`, i = s, a = c;
|
|
515
|
+
} else if (r === "Q") {
|
|
516
|
+
let r = s, o = c, l = parseFloat(t[++e]), u = parseFloat(t[++e]);
|
|
517
|
+
n += r === i && o === a ? `t${l - i} ${u - a}` : `q${r - i} ${o - a} ${l - i} ${u - a}`, i = l, a = u;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return n;
|
|
522
|
+
}
|
|
523
|
+
function ht(e) {
|
|
524
|
+
if (H.value !== "draw" || !b.active || !E.value || Fe(e) || Ue(e)) return;
|
|
525
|
+
e.cancelable && e.preventDefault(), K(), F.value = U(), T.value = !0;
|
|
526
|
+
let { x: t, y: n } = Y(e);
|
|
527
|
+
ye.value = {
|
|
528
|
+
x: t,
|
|
529
|
+
y: n
|
|
530
|
+
}, ve.value = `M ${t} ${n}`, D.value = document.createElementNS(i, "path"), D.value.setAttribute("stroke", C.value), D.value.setAttribute("stroke-width", w.value * b.scale), D.value.setAttribute("fill", "none"), D.value.setAttribute("stroke-linecap", "round"), D.value.setAttribute("stroke-linejoin", "round"), D.value.setAttribute("class", "vue-data-ui-doodle"), D.value.setAttribute("data-doodle-id", r()), D.value.setAttribute("pointer-events", "stroke"), E.value.appendChild(D.value);
|
|
531
|
+
}
|
|
532
|
+
function gt(e) {
|
|
533
|
+
if (e.cancelable && e.preventDefault(), !T.value || !E.value || !D.value) return;
|
|
534
|
+
let { x: t, y: n } = Y(e);
|
|
535
|
+
ve.value += ` ${t} ${n}`, D.value.setAttribute("d", ve.value);
|
|
536
|
+
}
|
|
537
|
+
function _t(e) {
|
|
538
|
+
let t = b.svgRef;
|
|
539
|
+
if (!t) return null;
|
|
540
|
+
let n = t.querySelector(`defs#${Ee.value}`);
|
|
541
|
+
n || (n = document.createElementNS(i, "defs"), n.setAttribute("id", Ee.value), t.appendChild(n));
|
|
542
|
+
let a = String(e).trim();
|
|
543
|
+
if (Te.has(a)) return Te.get(a);
|
|
544
|
+
let o = `arrow-${r()}`, s = document.createElementNS(i, "marker");
|
|
545
|
+
s.setAttribute("id", o), s.setAttribute("markerUnits", "strokeWidth"), s.setAttribute("markerWidth", "6"), s.setAttribute("markerHeight", "6"), s.setAttribute("refX", "4"), s.setAttribute("refY", "3"), s.setAttribute("orient", "auto"), s.setAttribute("viewBox", "0 0 6 6");
|
|
546
|
+
let c = document.createElementNS(i, "path");
|
|
547
|
+
return c.setAttribute("d", "M 0 0 L 6 3 L 0 6 z"), c.setAttribute("fill", e), c.setAttribute("stroke", "none"), s.appendChild(c), n.appendChild(s), Te.set(a, o), o;
|
|
548
|
+
}
|
|
549
|
+
function vt(e) {
|
|
550
|
+
if (!["line", "arrow"].includes(H.value) || !b.active || !E.value || Fe(e) || Ue(e)) return;
|
|
551
|
+
e.cancelable && e.preventDefault(), K(), F.value = U(), T.value = !0;
|
|
552
|
+
let { x: t, y: n } = Y(e);
|
|
553
|
+
if (ye.value = {
|
|
554
|
+
x: t,
|
|
555
|
+
y: n
|
|
556
|
+
}, O.value = document.createElementNS(i, "line"), O.value.setAttribute("stroke", C.value), O.value.setAttribute("stroke-width", w.value * b.scale), O.value.setAttribute("stroke-linecap", "round"), O.value.setAttribute("class", "vue-data-ui-doodle"), O.value.setAttribute("data-doodle-id", r()), O.value.setAttribute("pointer-events", "stroke"), O.value.setAttribute("x1", t), O.value.setAttribute("y1", n), O.value.setAttribute("x2", t), O.value.setAttribute("y2", n), H.value === "arrow") {
|
|
557
|
+
let e = _t(C.value);
|
|
558
|
+
e && O.value.setAttribute("marker-end", `url(#${e})`);
|
|
559
|
+
}
|
|
560
|
+
E.value.appendChild(O.value);
|
|
561
|
+
}
|
|
562
|
+
function yt(e) {
|
|
563
|
+
if (e.cancelable && e.preventDefault(), !["line", "arrow"].includes(H.value) || !T.value || !E.value || !O.value) return;
|
|
564
|
+
let { x: t, y: n } = Y(e);
|
|
565
|
+
O.value.setAttribute("x2", t), O.value.setAttribute("y2", n);
|
|
566
|
+
}
|
|
567
|
+
function bt(e) {
|
|
568
|
+
if (T.value && E.value && O.value) {
|
|
569
|
+
let { x: t, y: n } = Y(e);
|
|
570
|
+
O.value.setAttribute("x2", t), O.value.setAttribute("y2", n), W(F.value), O.value = null, F.value = "";
|
|
571
|
+
}
|
|
572
|
+
T.value = !1;
|
|
573
|
+
}
|
|
574
|
+
function X(e) {
|
|
575
|
+
if (T.value && E.value && D.value) {
|
|
576
|
+
let { x: t, y: n } = Y(e);
|
|
577
|
+
if (ye.value && ye.value.x === t && ye.value.y === n) {
|
|
578
|
+
D.value.remove();
|
|
579
|
+
let e = document.createElementNS(i, "circle");
|
|
580
|
+
e.setAttribute("cx", t), e.setAttribute("cy", n), e.setAttribute("r", w.value * b.scale / 2), e.setAttribute("fill", C.value), e.setAttribute("class", "vue-data-ui-doodle"), e.setAttribute("data-doodle-id", r()), e.setAttribute("pointer-events", "all"), E.value.appendChild(e);
|
|
581
|
+
} else D.value.setAttribute("d", mt(ft(ve.value)));
|
|
582
|
+
W(F.value), F.value = "", D.value = null;
|
|
583
|
+
}
|
|
584
|
+
T.value = !1;
|
|
585
|
+
}
|
|
586
|
+
function xt() {
|
|
587
|
+
if (!x.value.length || !E.value) return;
|
|
588
|
+
let e = U(), t = x.value.pop();
|
|
589
|
+
S.value.push({
|
|
590
|
+
state: e,
|
|
591
|
+
mergeKey: null,
|
|
592
|
+
timestamp: Date.now()
|
|
593
|
+
}), Re(t.state);
|
|
594
|
+
}
|
|
595
|
+
function St() {
|
|
596
|
+
if (!S.value.length || !E.value) return;
|
|
597
|
+
let e = U(), t = S.value.pop();
|
|
598
|
+
x.value.push({
|
|
599
|
+
state: e,
|
|
600
|
+
mergeKey: null,
|
|
601
|
+
timestamp: Date.now()
|
|
602
|
+
}), Re(t.state);
|
|
603
|
+
}
|
|
604
|
+
function Ct() {
|
|
605
|
+
I.value && ut(!1), K(), E.value && (E.value.innerHTML = ""), x.value = [], S.value = [], Oe.value = !1, ke.value = "", Ae.value = !1, F.value = "", dt();
|
|
606
|
+
}
|
|
607
|
+
y(H, () => {
|
|
608
|
+
b.active && (Tt(), wt(), Z());
|
|
609
|
+
});
|
|
610
|
+
function wt() {
|
|
611
|
+
!b.svgRef || !b.active || (b.svgRef.addEventListener("mousedown", Ye), b.svgRef.addEventListener("mousemove", Xe), b.svgRef.addEventListener("mouseup", q), b.svgRef.addEventListener("mouseleave", q), b.svgRef.addEventListener("touchstart", Ye, { passive: !1 }), b.svgRef.addEventListener("touchmove", Xe, { passive: !1 }), b.svgRef.addEventListener("touchend", q), b.svgRef.addEventListener("touchcancel", q), H.value === "draw" ? (b.svgRef.addEventListener("mousedown", ht), b.svgRef.addEventListener("mousemove", gt), b.svgRef.addEventListener("mouseup", X), b.svgRef.addEventListener("mouseleave", X), b.svgRef.addEventListener("touchstart", ht, { passive: !1 }), b.svgRef.addEventListener("touchmove", gt, { passive: !1 }), b.svgRef.addEventListener("touchend", X), b.svgRef.addEventListener("touchcancel", X)) : ["line", "arrow"].includes(H.value) ? (b.svgRef.addEventListener("mousedown", vt), b.svgRef.addEventListener("mousemove", yt), b.svgRef.addEventListener("mouseup", bt), b.svgRef.addEventListener("touchstart", vt, { passive: !1 }), b.svgRef.addEventListener("touchmove", yt, { passive: !1 }), b.svgRef.addEventListener("touchend", bt), b.svgRef.addEventListener("touchcancel", bt)) : H.value === "text" && (b.svgRef.addEventListener("mousedown", tt), b.svgRef.addEventListener("touchstart", tt, { passive: !1 })), E.value && (E.value.style.pointerEvents = "auto"));
|
|
612
|
+
}
|
|
613
|
+
function Tt() {
|
|
614
|
+
b.svgRef && (b.svgRef.removeEventListener("mousedown", Ye), b.svgRef.removeEventListener("mousemove", Xe), b.svgRef.removeEventListener("mouseup", q), b.svgRef.removeEventListener("mouseleave", q), b.svgRef.removeEventListener("touchstart", Ye), b.svgRef.removeEventListener("touchmove", Xe), b.svgRef.removeEventListener("touchend", q), b.svgRef.removeEventListener("touchcancel", q), b.svgRef.removeEventListener("mousedown", ht), b.svgRef.removeEventListener("mousemove", gt), b.svgRef.removeEventListener("mouseup", X), b.svgRef.removeEventListener("mouseleave", X), b.svgRef.removeEventListener("touchstart", ht), b.svgRef.removeEventListener("touchmove", gt), b.svgRef.removeEventListener("touchend", X), b.svgRef.removeEventListener("touchcancel", X), b.svgRef.removeEventListener("mousedown", vt), b.svgRef.removeEventListener("mousemove", yt), b.svgRef.removeEventListener("mouseup", bt), b.svgRef.removeEventListener("touchstart", vt), b.svgRef.removeEventListener("touchmove", yt), b.svgRef.removeEventListener("touchend", bt), b.svgRef.removeEventListener("touchcancel", bt), b.svgRef.removeEventListener("mousedown", tt), b.svgRef.removeEventListener("touchstart", tt), E.value && (E.value.style.pointerEvents = "none"));
|
|
615
|
+
}
|
|
616
|
+
y(() => b.active, (e) => {
|
|
617
|
+
e ? wt() : (K(), Tt()), Z();
|
|
618
|
+
}), y(() => b.active, () => {
|
|
619
|
+
p(() => {
|
|
620
|
+
dt();
|
|
621
|
+
});
|
|
622
|
+
}), y(() => b.active, (e) => {
|
|
623
|
+
b.svgRef && (e ? b.svgRef.style.touchAction = "none" : b.svgRef.style.touchAction = "");
|
|
624
|
+
}, { immediate: !0 });
|
|
625
|
+
function Z(e = null) {
|
|
626
|
+
if (E.value) {
|
|
627
|
+
if (!b.active) {
|
|
628
|
+
E.value.style.cursor = "";
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
if (I.value) {
|
|
632
|
+
E.value.style.cursor = "text";
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
if (e && Ie(e)) {
|
|
636
|
+
E.value.style.cursor = "pointer";
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
if (P.value || e && Fe(e)) {
|
|
640
|
+
E.value.style.cursor = "move";
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (A.value && k.value) {
|
|
644
|
+
E.value.style.cursor = "grabbing";
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
if (e && k.value && E.value.contains(k.value) && He(k.value, e)) {
|
|
648
|
+
E.value.style.cursor = "grab";
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
H.value === "text" ? E.value.style.cursor = "text" : ["line", "arrow"].includes(H.value) ? E.value.style.cursor = "crosshair" : E.value.style.cursor = Ne.value;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
let Q = _(null), Et = _(null), Dt = _(!1), $ = _({
|
|
655
|
+
x: 0,
|
|
656
|
+
y: 0
|
|
657
|
+
}), Ot = _(null), kt = _(null), At = s(() => ({
|
|
658
|
+
backgroundColor: b.backgroundColor,
|
|
659
|
+
"--vue-ui-pen-and-paper-drag-x": `${$.value.x}px`,
|
|
660
|
+
"--vue-ui-pen-and-paper-drag-y": `${$.value.y}px`
|
|
661
|
+
}));
|
|
662
|
+
function jt() {
|
|
663
|
+
return {
|
|
664
|
+
width: document.documentElement.clientWidth || window.innerWidth,
|
|
665
|
+
height: document.documentElement.clientHeight || window.innerHeight
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
function Mt() {
|
|
669
|
+
if (!Q.value) return null;
|
|
670
|
+
let e = [
|
|
671
|
+
Q.value,
|
|
672
|
+
Q.value.querySelector(".vue-ui-pen-and-paper-drag-handle"),
|
|
673
|
+
Q.value.querySelector(".vertical-range")
|
|
674
|
+
].filter(Boolean).map((e) => e.getBoundingClientRect());
|
|
675
|
+
return {
|
|
676
|
+
left: Math.min(...e.map((e) => e.left)),
|
|
677
|
+
top: Math.min(...e.map((e) => e.top)),
|
|
678
|
+
right: Math.max(...e.map((e) => e.right)),
|
|
679
|
+
bottom: Math.max(...e.map((e) => e.bottom))
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
function Nt(e) {
|
|
683
|
+
if (e.pointerType === "mouse" && e.button !== 0 || !Q.value) return;
|
|
684
|
+
e.preventDefault(), e.stopPropagation();
|
|
685
|
+
let t = Mt();
|
|
686
|
+
t && (Dt.value = !0, kt.value = e.pointerId, Ot.value = {
|
|
687
|
+
clientX: e.clientX,
|
|
688
|
+
clientY: e.clientY,
|
|
689
|
+
offsetX: $.value.x,
|
|
690
|
+
offsetY: $.value.y,
|
|
691
|
+
rect: t
|
|
692
|
+
}, window.addEventListener("pointermove", Pt), window.addEventListener("pointerup", Ft), window.addEventListener("pointercancel", Ft));
|
|
693
|
+
}
|
|
694
|
+
function Pt(e) {
|
|
695
|
+
if (!Dt.value || !Ot.value || e.pointerId !== kt.value) return;
|
|
696
|
+
e.preventDefault();
|
|
697
|
+
let t = Ot.value, { width: n, height: r } = jt(), i = e.clientX - t.clientX, a = e.clientY - t.clientY, o = Math.min(Math.max(i, -t.rect.left), n - t.rect.right), s = Math.min(Math.max(a, -t.rect.top), r - t.rect.bottom);
|
|
698
|
+
$.value = {
|
|
699
|
+
x: t.offsetX + o,
|
|
700
|
+
y: t.offsetY + s
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
function Ft(e) {
|
|
704
|
+
(e?.pointerId === void 0 || kt.value === null || e.pointerId === kt.value) && (Dt.value = !1, Ot.value = null, kt.value = null, window.removeEventListener("pointermove", Pt), window.removeEventListener("pointerup", Ft), window.removeEventListener("pointercancel", Ft));
|
|
705
|
+
}
|
|
706
|
+
function It() {
|
|
707
|
+
if (!Q.value || !b.active) return;
|
|
708
|
+
let e = Mt();
|
|
709
|
+
if (!e) return;
|
|
710
|
+
let { width: t, height: n } = jt(), r = 0, i = 0;
|
|
711
|
+
e.left < 0 ? r = -e.left : e.right > t && (r = t - e.right), e.top < 0 ? i = -e.top : e.bottom > n && (i = n - e.bottom), (r || i) && ($.value = {
|
|
712
|
+
x: $.value.x + r,
|
|
713
|
+
y: $.value.y + i
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
return te(() => {
|
|
717
|
+
window.addEventListener("resize", It), p(() => {
|
|
718
|
+
b.svgRef && (E.value = document.createElementNS("http://www.w3.org/2000/svg", "g"), E.value.setAttribute("class", "vue-data-ui-doodles"), b.svgRef.appendChild(E.value), Z(), b.active ? wt() : Tt(), dt());
|
|
719
|
+
});
|
|
720
|
+
}), y(() => b.active, async (e) => {
|
|
721
|
+
if (!e) {
|
|
722
|
+
Ft(), $.value = {
|
|
723
|
+
x: 0,
|
|
724
|
+
y: 0
|
|
725
|
+
};
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
await p(), Et.value?.focus();
|
|
729
|
+
}, { flush: "post" }), ee(() => {
|
|
730
|
+
ot(), K(), Ft(), window.removeEventListener("resize", It), E.value && b.svgRef && (E.value.remove(), Tt());
|
|
731
|
+
}), (t, r) => e.active ? (ne(), l("div", {
|
|
732
|
+
key: 0,
|
|
733
|
+
ref_key: "menuRef",
|
|
734
|
+
ref: Q,
|
|
735
|
+
"data-dom-to-png-ignore": "",
|
|
736
|
+
class: m(["vue-ui-pen-and-paper-actions", { "vue-ui-pen-and-paper-actions-dragging": Dt.value }]),
|
|
737
|
+
style: g(At.value)
|
|
738
|
+
}, [
|
|
739
|
+
u("button", {
|
|
740
|
+
type: "button",
|
|
741
|
+
class: "vue-ui-pen-and-paper-drag-handle",
|
|
742
|
+
"aria-label": "Move drawing toolbar",
|
|
743
|
+
style: g({
|
|
744
|
+
backgroundColor: e.backgroundColor,
|
|
745
|
+
border: `1px solid ${J.value}`,
|
|
746
|
+
color: e.color
|
|
747
|
+
}),
|
|
748
|
+
onPointerdown: Nt
|
|
749
|
+
}, [(ne(), l("svg", le, [
|
|
750
|
+
u("circle", {
|
|
751
|
+
fill: e.color,
|
|
752
|
+
cx: "3",
|
|
753
|
+
cy: "3",
|
|
754
|
+
r: "0.7"
|
|
755
|
+
}, null, 8, ue),
|
|
756
|
+
u("circle", {
|
|
757
|
+
fill: e.color,
|
|
758
|
+
cx: "3",
|
|
759
|
+
cy: "6",
|
|
760
|
+
r: "0.7"
|
|
761
|
+
}, null, 8, de),
|
|
762
|
+
u("circle", {
|
|
763
|
+
fill: e.color,
|
|
764
|
+
cx: "3",
|
|
765
|
+
cy: "9",
|
|
766
|
+
r: "0.7"
|
|
767
|
+
}, null, 8, fe)
|
|
768
|
+
]))], 36),
|
|
769
|
+
u("button", {
|
|
770
|
+
ref_key: "buttonToggle",
|
|
771
|
+
ref: Et,
|
|
772
|
+
class: "vue-ui-pen-and-paper-action",
|
|
773
|
+
onClick: r[0] ||= (e) => _e("close"),
|
|
774
|
+
style: g({
|
|
775
|
+
backgroundColor: e.backgroundColor,
|
|
776
|
+
border: `1px solid ${J.value}`,
|
|
777
|
+
cursor: e.isCursorPointer ? "pointer" : "default"
|
|
778
|
+
})
|
|
779
|
+
}, [v(t.$slots, "annotator-action-close", {}, () => [d(a, {
|
|
780
|
+
name: "close",
|
|
781
|
+
stroke: e.color
|
|
782
|
+
}, null, 8, ["stroke"])])], 4),
|
|
783
|
+
u("button", {
|
|
784
|
+
class: "vue-ui-pen-and-paper-action",
|
|
785
|
+
tabindex: "-1",
|
|
786
|
+
style: g(`padding: 0 !important; cursor: ${e.isCursorPointer ? "pointer" : "default"}`)
|
|
787
|
+
}, [d(o, {
|
|
788
|
+
value: C.value,
|
|
789
|
+
"onUpdate:value": r[1] ||= (e) => C.value = e,
|
|
790
|
+
backgroundColor: e.backgroundColor,
|
|
791
|
+
buttonBorderColor: J.value,
|
|
792
|
+
isCursorPointer: e.isCursorPointer
|
|
793
|
+
}, {
|
|
794
|
+
"annotator-action-color": oe(({ color: e }) => [v(t.$slots, "annotator-action-color", h(f({ color: e })))]),
|
|
795
|
+
_: 3
|
|
796
|
+
}, 8, [
|
|
797
|
+
"value",
|
|
798
|
+
"backgroundColor",
|
|
799
|
+
"buttonBorderColor",
|
|
800
|
+
"isCursorPointer"
|
|
801
|
+
])], 4),
|
|
802
|
+
u("button", {
|
|
803
|
+
class: m(["vue-ui-pen-and-paper-action", { "vue-ui-pen-and-paper-action-active": H.value === "text" }]),
|
|
804
|
+
onClick: r[2] ||= (e) => et(),
|
|
805
|
+
style: g({
|
|
806
|
+
backgroundColor: e.backgroundColor,
|
|
807
|
+
border: `1px solid ${J.value}`,
|
|
808
|
+
cursor: e.isCursorPointer ? "pointer" : "default"
|
|
809
|
+
})
|
|
810
|
+
}, [v(t.$slots, "annotator-action-draw", h(f({ mode: H.value })), () => [d(a, {
|
|
811
|
+
name: Me[H.value],
|
|
812
|
+
stroke: e.color
|
|
813
|
+
}, null, 8, ["name", "stroke"])]), u("div", { style: g({
|
|
814
|
+
position: "absolute",
|
|
815
|
+
bottom: "-20px",
|
|
816
|
+
color: J.value,
|
|
817
|
+
width: "100%",
|
|
818
|
+
textAlign: "center",
|
|
819
|
+
fontSize: "12px",
|
|
820
|
+
fontVariantNumeric: "tabular-nums"
|
|
821
|
+
}) }, re(ie(n)({
|
|
822
|
+
v: H.value === "text" ? Math.round(B.value) : Math.round(w.value),
|
|
823
|
+
s: "px",
|
|
824
|
+
r: 1
|
|
825
|
+
})), 5)], 6),
|
|
826
|
+
u("button", {
|
|
827
|
+
class: m(["vue-ui-pen-and-paper-action", { "vue-ui-pen-and-paper-action-disabled": !x.value.length }]),
|
|
828
|
+
disabled: !x.value.length,
|
|
829
|
+
onClick: xt,
|
|
830
|
+
style: g({
|
|
831
|
+
backgroundColor: e.backgroundColor,
|
|
832
|
+
border: `1px solid ${J.value}`,
|
|
833
|
+
marginTop: "20px",
|
|
834
|
+
cursor: e.isCursorPointer ? "pointer" : "default"
|
|
835
|
+
})
|
|
836
|
+
}, [v(t.$slots, "annotator-action-undo", h(f({ disabled: !x.value.length })), () => [d(a, {
|
|
837
|
+
name: "refresh",
|
|
838
|
+
stroke: e.color
|
|
839
|
+
}, null, 8, ["stroke"])])], 14, pe),
|
|
840
|
+
u("button", {
|
|
841
|
+
class: m(["vue-ui-pen-and-paper-action", { "vue-ui-pen-and-paper-action-disabled": !S.value.length }]),
|
|
842
|
+
onClick: St,
|
|
843
|
+
style: g({
|
|
844
|
+
backgroundColor: e.backgroundColor,
|
|
845
|
+
border: `1px solid ${J.value}`,
|
|
846
|
+
cursor: e.isCursorPointer ? "pointer" : "default"
|
|
847
|
+
})
|
|
848
|
+
}, [v(t.$slots, "annotator-action-redo", h(f({ disabled: !S.value.length })), () => [d(a, {
|
|
849
|
+
name: "refresh",
|
|
850
|
+
stroke: e.color,
|
|
851
|
+
style: { transform: "scaleX(-1)" }
|
|
852
|
+
}, null, 8, ["stroke"])])], 6),
|
|
853
|
+
u("button", {
|
|
854
|
+
class: m(["vue-ui-pen-and-paper-action", { "vue-ui-pen-and-paper-action-disabled": !x.value.length }]),
|
|
855
|
+
onClick: Ct,
|
|
856
|
+
style: g({
|
|
857
|
+
backgroundColor: e.backgroundColor,
|
|
858
|
+
border: `1px solid ${J.value}`,
|
|
859
|
+
cursor: e.isCursorPointer ? "pointer" : "default"
|
|
860
|
+
})
|
|
861
|
+
}, [v(t.$slots, "annotator-action-delete", h(f({ disabled: !x.value.length })), () => [d(a, {
|
|
862
|
+
name: "trash",
|
|
863
|
+
stroke: e.color
|
|
864
|
+
}, null, 8, ["stroke"])])], 6),
|
|
865
|
+
H.value === "text" ? se((ne(), l("input", {
|
|
866
|
+
key: 0,
|
|
867
|
+
ref: "range",
|
|
868
|
+
type: "range",
|
|
869
|
+
class: "vertical-range",
|
|
870
|
+
min: 3,
|
|
871
|
+
max: 48,
|
|
872
|
+
step: 1,
|
|
873
|
+
"onUpdate:modelValue": r[3] ||= (e) => B.value = e,
|
|
874
|
+
style: g({ accentColor: e.color })
|
|
875
|
+
}, null, 4)), [[ae, B.value]]) : se((ne(), l("input", {
|
|
876
|
+
key: 1,
|
|
877
|
+
ref: "range",
|
|
878
|
+
type: "range",
|
|
879
|
+
class: "vertical-range",
|
|
880
|
+
min: .5,
|
|
881
|
+
max: 12,
|
|
882
|
+
step: .1,
|
|
883
|
+
"onUpdate:modelValue": r[4] ||= (e) => w.value = e,
|
|
884
|
+
style: g({ accentColor: e.color })
|
|
885
|
+
}, null, 4)), [[ae, w.value]])
|
|
886
|
+
], 6)) : c("", !0);
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
//#endregion
|
|
890
|
+
export { b as n, ce as t };
|