@getartisanflow/alpineflow 0.1.0-alpha
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/LICENSE +21 -0
- package/README.md +88 -0
- package/dist/alpineflow-collab.esm.js +465 -0
- package/dist/alpineflow-collab.esm.js.map +1 -0
- package/dist/alpineflow-collab.js +247 -0
- package/dist/alpineflow-collab.js.map +1 -0
- package/dist/alpineflow-dagre.esm.js +1661 -0
- package/dist/alpineflow-dagre.esm.js.map +1 -0
- package/dist/alpineflow-dagre.js +1655 -0
- package/dist/alpineflow-dagre.js.map +1 -0
- package/dist/alpineflow-elk.esm.js +47378 -0
- package/dist/alpineflow-elk.esm.js.map +1 -0
- package/dist/alpineflow-elk.js +47373 -0
- package/dist/alpineflow-elk.js.map +1 -0
- package/dist/alpineflow-force.esm.js +599 -0
- package/dist/alpineflow-force.esm.js.map +1 -0
- package/dist/alpineflow-force.js +477 -0
- package/dist/alpineflow-force.js.map +1 -0
- package/dist/alpineflow-hierarchy.esm.js +398 -0
- package/dist/alpineflow-hierarchy.esm.js.map +1 -0
- package/dist/alpineflow-hierarchy.js +393 -0
- package/dist/alpineflow-hierarchy.js.map +1 -0
- package/dist/alpineflow-theme.css +473 -0
- package/dist/alpineflow-whiteboard.esm.js +922 -0
- package/dist/alpineflow-whiteboard.esm.js.map +1 -0
- package/dist/alpineflow-whiteboard.js +922 -0
- package/dist/alpineflow-whiteboard.js.map +1 -0
- package/dist/alpineflow.bundle.esm.js +12604 -0
- package/dist/alpineflow.bundle.esm.js.map +1 -0
- package/dist/alpineflow.css +1415 -0
- package/dist/alpineflow.esm.js +158 -0
- package/dist/alpineflow.esm.js.map +1 -0
- package/dist/alpineflow.js +5 -0
- package/dist/alpineflow.js.map +1 -0
- package/dist/export-DjmXOnKD.js +76 -0
- package/dist/export-DjmXOnKD.js.map +1 -0
- package/dist/geometry-DZSZoYHE.js +82 -0
- package/dist/geometry-DZSZoYHE.js.map +1 -0
- package/dist/index-C0N1DL3G.js +11728 -0
- package/dist/index-C0N1DL3G.js.map +1 -0
- package/dist/index-L3Zm-CoX.js +513 -0
- package/dist/index-L3Zm-CoX.js.map +1 -0
- package/dist/registry-CChkuoVJ.js +15 -0
- package/dist/registry-CChkuoVJ.js.map +1 -0
- package/dist/store-CaFAFEdD.js +9 -0
- package/dist/store-CaFAFEdD.js.map +1 -0
- package/dist/timer-B39XOBYL.js +124 -0
- package/dist/timer-B39XOBYL.js.map +1 -0
- package/dist/types/lib/collab.cdn.d.ts +1 -0
- package/dist/types/lib/collab.d.ts +2 -0
- package/dist/types/lib/core.cdn.d.ts +1 -0
- package/dist/types/lib/core.d.ts +2 -0
- package/dist/types/lib/dagre.cdn.d.ts +1 -0
- package/dist/types/lib/dagre.d.ts +1 -0
- package/dist/types/lib/elk.cdn.d.ts +1 -0
- package/dist/types/lib/elk.d.ts +1 -0
- package/dist/types/lib/force.cdn.d.ts +1 -0
- package/dist/types/lib/force.d.ts +1 -0
- package/dist/types/lib/hierarchy.cdn.d.ts +1 -0
- package/dist/types/lib/hierarchy.d.ts +1 -0
- package/dist/types/lib/whiteboard.cdn.d.ts +1 -0
- package/dist/types/lib/whiteboard.d.ts +1 -0
- package/dist/types/src/animate/animator.d.ts +57 -0
- package/dist/types/src/animate/easing.d.ts +4 -0
- package/dist/types/src/animate/edge-transitions.d.ts +22 -0
- package/dist/types/src/animate/engine.d.ts +37 -0
- package/dist/types/src/animate/index.d.ts +10 -0
- package/dist/types/src/animate/interpolators.d.ts +14 -0
- package/dist/types/src/animate/paths.d.ts +64 -0
- package/dist/types/src/animate/timeline.d.ts +149 -0
- package/dist/types/src/collab/awareness.d.ts +40 -0
- package/dist/types/src/collab/bridge.d.ts +36 -0
- package/dist/types/src/collab/directives/flow-cursors.d.ts +16 -0
- package/dist/types/src/collab/index.d.ts +19 -0
- package/dist/types/src/collab/providers/in-memory.d.ts +41 -0
- package/dist/types/src/collab/providers/reverb.d.ts +59 -0
- package/dist/types/src/collab/providers/websocket.d.ts +33 -0
- package/dist/types/src/collab/store.d.ts +22 -0
- package/dist/types/src/collab/types.d.ts +55 -0
- package/dist/types/src/core/__fixtures__/nodes.d.ts +42 -0
- package/dist/types/src/core/announcer.d.ts +21 -0
- package/dist/types/src/core/auto-pan.d.ts +37 -0
- package/dist/types/src/core/child-layout.d.ts +18 -0
- package/dist/types/src/core/child-validation.d.ts +23 -0
- package/dist/types/src/core/clipboard.d.ts +29 -0
- package/dist/types/src/core/collapse.d.ts +54 -0
- package/dist/types/src/core/color-mode.d.ts +11 -0
- package/dist/types/src/core/compute.d.ts +33 -0
- package/dist/types/src/core/connections.d.ts +32 -0
- package/dist/types/src/core/constants.d.ts +18 -0
- package/dist/types/src/core/controls-panel.d.ts +23 -0
- package/dist/types/src/core/debug.d.ts +10 -0
- package/dist/types/src/core/deep-merge.d.ts +10 -0
- package/dist/types/src/core/drag.d.ts +63 -0
- package/dist/types/src/core/edge-paths/avoidant.d.ts +25 -0
- package/dist/types/src/core/edge-paths/bezier.d.ts +26 -0
- package/dist/types/src/core/edge-paths/editable.d.ts +22 -0
- package/dist/types/src/core/edge-paths/index.d.ts +7 -0
- package/dist/types/src/core/edge-paths/orthogonal.d.ts +27 -0
- package/dist/types/src/core/edge-paths/smoothstep.d.ts +22 -0
- package/dist/types/src/core/edge-paths/straight.d.ts +12 -0
- package/dist/types/src/core/edge-paths/utils.d.ts +30 -0
- package/dist/types/src/core/edge-utils.d.ts +57 -0
- package/dist/types/src/core/export.d.ts +12 -0
- package/dist/types/src/core/floating-edge.d.ts +33 -0
- package/dist/types/src/core/geometry.d.ts +79 -0
- package/dist/types/src/core/gradients.d.ts +30 -0
- package/dist/types/src/core/graph.d.ts +38 -0
- package/dist/types/src/core/helper-lines.d.ts +32 -0
- package/dist/types/src/core/history.d.ts +19 -0
- package/dist/types/src/core/index.d.ts +17 -0
- package/dist/types/src/core/intersection.d.ts +30 -0
- package/dist/types/src/core/keyboard-shortcuts.d.ts +45 -0
- package/dist/types/src/core/lasso-hit-test.d.ts +25 -0
- package/dist/types/src/core/lasso.d.ts +10 -0
- package/dist/types/src/core/layout/dagre.d.ts +11 -0
- package/dist/types/src/core/layout/elk.d.ts +13 -0
- package/dist/types/src/core/layout/force.d.ts +15 -0
- package/dist/types/src/core/layout/hierarchy.d.ts +13 -0
- package/dist/types/src/core/long-press.d.ts +11 -0
- package/dist/types/src/core/markers.d.ts +49 -0
- package/dist/types/src/core/minimap.d.ts +18 -0
- package/dist/types/src/core/node-flags.d.ts +19 -0
- package/dist/types/src/core/pan-zoom.d.ts +62 -0
- package/dist/types/src/core/proximity-connect.d.ts +25 -0
- package/dist/types/src/core/registry.d.ts +16 -0
- package/dist/types/src/core/render-plan.d.ts +52 -0
- package/dist/types/src/core/resize.d.ts +31 -0
- package/dist/types/src/core/rotation.d.ts +8 -0
- package/dist/types/src/core/selection-box.d.ts +14 -0
- package/dist/types/src/core/shapes.d.ts +10 -0
- package/dist/types/src/core/sub-flow.d.ts +61 -0
- package/dist/types/src/core/svg-path.d.ts +5 -0
- package/dist/types/src/core/types.d.ts +1238 -0
- package/dist/types/src/core/wire-bridge.d.ts +36 -0
- package/dist/types/src/index.d.ts +43 -0
- package/dist/types/src/layout/dagre.d.ts +2 -0
- package/dist/types/src/layout/elk.d.ts +2 -0
- package/dist/types/src/layout/force.d.ts +2 -0
- package/dist/types/src/layout/hierarchy.d.ts +2 -0
- package/dist/types/src/plugin/connection-utils.d.ts +54 -0
- package/dist/types/src/plugin/data/__test-utils.d.ts +9 -0
- package/dist/types/src/plugin/data/canvas-animation.d.ts +62 -0
- package/dist/types/src/plugin/data/canvas-collapse.d.ts +35 -0
- package/dist/types/src/plugin/data/canvas-compute.d.ts +6 -0
- package/dist/types/src/plugin/data/canvas-condense.d.ts +19 -0
- package/dist/types/src/plugin/data/canvas-config.d.ts +4 -0
- package/dist/types/src/plugin/data/canvas-context.d.ts +570 -0
- package/dist/types/src/plugin/data/canvas-dom.d.ts +13 -0
- package/dist/types/src/plugin/data/canvas-edges.d.ts +37 -0
- package/dist/types/src/plugin/data/canvas-history.d.ts +53 -0
- package/dist/types/src/plugin/data/canvas-layout.d.ts +151 -0
- package/dist/types/src/plugin/data/canvas-nodes.d.ts +73 -0
- package/dist/types/src/plugin/data/canvas-rows.d.ts +13 -0
- package/dist/types/src/plugin/data/canvas-selection.d.ts +45 -0
- package/dist/types/src/plugin/data/canvas-validation.d.ts +21 -0
- package/dist/types/src/plugin/data/canvas-viewport.d.ts +111 -0
- package/dist/types/src/plugin/data/flow-canvas.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-action.d.ts +12 -0
- package/dist/types/src/plugin/directives/flow-animate.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-arrow-draw.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-circle-draw.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-collapse.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-condense.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-context-menu.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-detail.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-devtools.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-drag-handle.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-draggable.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-edge-toolbar.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-edge.d.ts +7 -0
- package/dist/types/src/plugin/directives/flow-eraser.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-filter.d.ts +9 -0
- package/dist/types/src/plugin/directives/flow-follow.d.ts +9 -0
- package/dist/types/src/plugin/directives/flow-freehand.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-handle-connectable.d.ts +12 -0
- package/dist/types/src/plugin/directives/flow-handle-limit.d.ts +9 -0
- package/dist/types/src/plugin/directives/flow-handle-validate.d.ts +10 -0
- package/dist/types/src/plugin/directives/flow-handle.d.ts +29 -0
- package/dist/types/src/plugin/directives/flow-highlighter.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-loading.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-node-toolbar.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-node.d.ts +10 -0
- package/dist/types/src/plugin/directives/flow-panel.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-rectangle-draw.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-resizer.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-rotate.d.ts +11 -0
- package/dist/types/src/plugin/directives/flow-row-select.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-snapshot.d.ts +14 -0
- package/dist/types/src/plugin/directives/flow-text-tool.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-timeline.d.ts +2 -0
- package/dist/types/src/plugin/directives/flow-viewport.d.ts +2 -0
- package/dist/types/src/plugin/magics/flow.d.ts +2 -0
- package/dist/types/src/plugin/store.d.ts +2 -0
- package/dist/types/src/whiteboard/index.d.ts +2 -0
- package/package.json +153 -0
|
@@ -0,0 +1,922 @@
|
|
|
1
|
+
const it = "http://www.w3.org/2000/svg";
|
|
2
|
+
function st(t, o, r) {
|
|
3
|
+
const g = o.x - t.x, m = o.y - t.y, x = [-g, g, -m, m], e = [
|
|
4
|
+
t.x - r.x,
|
|
5
|
+
r.x + r.w - t.x,
|
|
6
|
+
t.y - r.y,
|
|
7
|
+
r.y + r.h - t.y
|
|
8
|
+
];
|
|
9
|
+
let i = 0, h = 1;
|
|
10
|
+
for (let v = 0; v < 4; v++)
|
|
11
|
+
if (x[v] === 0) {
|
|
12
|
+
if (e[v] < 0) return !1;
|
|
13
|
+
} else {
|
|
14
|
+
const f = e[v] / x[v];
|
|
15
|
+
if (x[v] < 0 ? i = Math.max(i, f) : h = Math.min(h, f), i > h) return !1;
|
|
16
|
+
}
|
|
17
|
+
return !0;
|
|
18
|
+
}
|
|
19
|
+
function At(t) {
|
|
20
|
+
t.directive(
|
|
21
|
+
"flow-eraser",
|
|
22
|
+
(o, { expression: r }, { evaluate: g, effect: m, cleanup: x }) => {
|
|
23
|
+
const e = o, i = t.$data(e);
|
|
24
|
+
if (!i) return;
|
|
25
|
+
let h = !1, v = null, f = null, w = [], u = { x: 0, y: 0 };
|
|
26
|
+
const d = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Set();
|
|
27
|
+
function C(c) {
|
|
28
|
+
const E = e.getBoundingClientRect();
|
|
29
|
+
return { x: c.clientX - E.left, y: c.clientY - E.top };
|
|
30
|
+
}
|
|
31
|
+
function k(c, E) {
|
|
32
|
+
const L = i.viewport;
|
|
33
|
+
return {
|
|
34
|
+
x: (c - L.x) / L.zoom,
|
|
35
|
+
y: (E - L.y) / L.zoom
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function T(c) {
|
|
39
|
+
const E = e.querySelector(
|
|
40
|
+
`[data-flow-node-id="${CSS.escape(c.id)}"]`
|
|
41
|
+
);
|
|
42
|
+
if (E) {
|
|
43
|
+
const _ = E.querySelector("svg > path, svg > line, svg > ellipse, svg > circle, svg > rect, svg > polyline");
|
|
44
|
+
if (_)
|
|
45
|
+
try {
|
|
46
|
+
const z = _.getBBox();
|
|
47
|
+
if (z.width > 0 && z.height > 0) {
|
|
48
|
+
const O = i.getAbsolutePosition(c.id);
|
|
49
|
+
return { x: O.x + z.x, y: O.y + z.y, w: z.width, h: z.height };
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
const U = E.querySelector('[style*="width"]');
|
|
54
|
+
if (U && E.classList.contains("flow-node-annotation")) {
|
|
55
|
+
const z = i.getAbsolutePosition(c.id);
|
|
56
|
+
return { x: z.x, y: z.y, w: U.offsetWidth || 150, h: U.offsetHeight || 40 };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const L = i.getAbsolutePosition(c.id), b = c.dimensions?.width ?? 150, Y = c.dimensions?.height ?? 40;
|
|
60
|
+
return { x: L.x, y: L.y, w: b, h: Y };
|
|
61
|
+
}
|
|
62
|
+
function W(c) {
|
|
63
|
+
const E = e.querySelector(
|
|
64
|
+
`[data-flow-edge-id="${CSS.escape(c.id)}"]`
|
|
65
|
+
);
|
|
66
|
+
if (!E) return null;
|
|
67
|
+
const L = E.querySelector("path");
|
|
68
|
+
if (!L) return null;
|
|
69
|
+
const b = L.getBBox();
|
|
70
|
+
return { x: b.x, y: b.y, w: b.width, h: b.height };
|
|
71
|
+
}
|
|
72
|
+
function $(c, E) {
|
|
73
|
+
const L = E === "node" ? `[data-flow-node-id="${CSS.escape(c)}"]` : `[data-flow-edge-id="${CSS.escape(c)}"]`;
|
|
74
|
+
e.querySelector(L)?.classList.add("flow-eraser-marked");
|
|
75
|
+
}
|
|
76
|
+
function A() {
|
|
77
|
+
e.querySelectorAll(".flow-eraser-marked").forEach((c) => c.classList.remove("flow-eraser-marked")), d.clear(), P.clear();
|
|
78
|
+
}
|
|
79
|
+
function I() {
|
|
80
|
+
v = document.createElementNS(it, "svg"), v.style.cssText = "position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1000;overflow:visible;", f = document.createElementNS(it, "polyline"), f.setAttribute("fill", "none"), f.setAttribute("stroke", "var(--flow-eraser-trail, rgba(239,68,68,0.6))"), f.setAttribute("stroke-width", "3"), f.setAttribute("stroke-linecap", "round"), f.setAttribute("stroke-linejoin", "round"), v.appendChild(f), e.appendChild(v), w = [];
|
|
81
|
+
}
|
|
82
|
+
function q() {
|
|
83
|
+
v && (v.remove(), v = null, f = null, w = []);
|
|
84
|
+
}
|
|
85
|
+
function X(c) {
|
|
86
|
+
w.push(`${c.x},${c.y}`), f?.setAttribute("points", w.join(" "));
|
|
87
|
+
}
|
|
88
|
+
function F(c, E, L) {
|
|
89
|
+
const b = c.querySelector("svg > path");
|
|
90
|
+
if (!b) return !1;
|
|
91
|
+
const Y = b.ownerSVGElement.createSVGPoint();
|
|
92
|
+
if (Y.x = E.x - L.x, Y.y = E.y - L.y, b.isPointInFill(Y)) return !0;
|
|
93
|
+
const _ = b.style.strokeWidth;
|
|
94
|
+
b.style.strokeWidth = "20";
|
|
95
|
+
const U = b.isPointInStroke(Y);
|
|
96
|
+
return b.style.strokeWidth = _, U;
|
|
97
|
+
}
|
|
98
|
+
function N(c, E) {
|
|
99
|
+
for (const L of i.nodes) {
|
|
100
|
+
if (L.hidden || d.has(L.id)) continue;
|
|
101
|
+
const b = T(L);
|
|
102
|
+
if (st(c, E, b)) {
|
|
103
|
+
const Y = e.querySelector(
|
|
104
|
+
`[data-flow-node-id="${CSS.escape(L.id)}"]`
|
|
105
|
+
);
|
|
106
|
+
if (Y?.classList.contains("flow-node-annotation") && Y.querySelector("svg > path")) {
|
|
107
|
+
const _ = i.getAbsolutePosition(L.id);
|
|
108
|
+
if (!F(Y, c, _) && !F(Y, E, _))
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
d.add(L.id), $(L.id, "node");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
for (const L of i.edges) {
|
|
115
|
+
if (P.has(L.id)) continue;
|
|
116
|
+
const b = W(L);
|
|
117
|
+
b && st(c, E, b) && (P.add(L.id), $(L.id, "edge"));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function M(c) {
|
|
121
|
+
const E = c.target;
|
|
122
|
+
if (E.closest(".flow-panel") || E.closest(".canvas-overlay") || c.button !== 0) return;
|
|
123
|
+
c.stopImmediatePropagation(), h = !0;
|
|
124
|
+
const L = C(c);
|
|
125
|
+
u = L, I(), X(L);
|
|
126
|
+
const b = k(L.x, L.y);
|
|
127
|
+
N(b, b), e.setPointerCapture(c.pointerId);
|
|
128
|
+
}
|
|
129
|
+
function D(c) {
|
|
130
|
+
const E = c.target;
|
|
131
|
+
E.closest(".flow-panel") || E.closest(".canvas-overlay") || c.stopImmediatePropagation();
|
|
132
|
+
}
|
|
133
|
+
function a(c) {
|
|
134
|
+
if (!h) return;
|
|
135
|
+
const E = C(c), L = E.x - u.x, b = E.y - u.y;
|
|
136
|
+
if (Math.sqrt(L * L + b * b) < 3) return;
|
|
137
|
+
X(E);
|
|
138
|
+
const _ = k(u.x, u.y), U = k(E.x, E.y);
|
|
139
|
+
N(_, U), u = E;
|
|
140
|
+
}
|
|
141
|
+
function n(c) {
|
|
142
|
+
h && (h = !1, q(), d.size > 0 && i.removeNodes([...d]), P.size > 0 && i.removeEdges([...P]), A(), e.releasePointerCapture(c.pointerId));
|
|
143
|
+
}
|
|
144
|
+
function l(c) {
|
|
145
|
+
h && c.key === "Escape" && (h = !1, q(), A());
|
|
146
|
+
}
|
|
147
|
+
function y() {
|
|
148
|
+
h && (h = !1, q(), A());
|
|
149
|
+
}
|
|
150
|
+
let s = !1;
|
|
151
|
+
function p() {
|
|
152
|
+
s || (s = !0, e.addEventListener("pointerdown", M, !0), e.addEventListener("mousedown", D, !0), e.addEventListener("touchstart", D, !0), e.addEventListener("pointermove", a), e.addEventListener("pointerup", n), document.addEventListener("keydown", l));
|
|
153
|
+
}
|
|
154
|
+
function S() {
|
|
155
|
+
s && (s = !1, y(), e.removeEventListener("pointerdown", M, !0), e.removeEventListener("mousedown", D, !0), e.removeEventListener("touchstart", D, !0), e.removeEventListener("pointermove", a), e.removeEventListener("pointerup", n), document.removeEventListener("keydown", l));
|
|
156
|
+
}
|
|
157
|
+
m(() => {
|
|
158
|
+
!!g(r) ? (e.classList.add("flow-tool-eraser"), p()) : (e.classList.remove("flow-tool-eraser"), S());
|
|
159
|
+
}), x(() => {
|
|
160
|
+
e.classList.remove("flow-tool-eraser"), S();
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
const { PI: Dt } = Math, Z = Dt + 1e-4, lt = 0.5, at = [1, 1];
|
|
166
|
+
function ct(t, o, r, g = (m) => m) {
|
|
167
|
+
return t * g(0.5 - o * (0.5 - r));
|
|
168
|
+
}
|
|
169
|
+
const { min: J } = Math;
|
|
170
|
+
function Pt(t, o, r) {
|
|
171
|
+
let g = J(1, o / r);
|
|
172
|
+
return J(1, t + (J(1, 1 - g) - t) * (g * 0.275));
|
|
173
|
+
}
|
|
174
|
+
function Tt(t) {
|
|
175
|
+
return [-t[0], -t[1]];
|
|
176
|
+
}
|
|
177
|
+
function K(t, o) {
|
|
178
|
+
return [t[0] + o[0], t[1] + o[1]];
|
|
179
|
+
}
|
|
180
|
+
function ut(t, o, r) {
|
|
181
|
+
return t[0] = o[0] + r[0], t[1] = o[1] + r[1], t;
|
|
182
|
+
}
|
|
183
|
+
function R(t, o) {
|
|
184
|
+
return [t[0] - o[0], t[1] - o[1]];
|
|
185
|
+
}
|
|
186
|
+
function nt(t, o, r) {
|
|
187
|
+
return t[0] = o[0] - r[0], t[1] = o[1] - r[1], t;
|
|
188
|
+
}
|
|
189
|
+
function G(t, o) {
|
|
190
|
+
return [t[0] * o, t[1] * o];
|
|
191
|
+
}
|
|
192
|
+
function tt(t, o, r) {
|
|
193
|
+
return t[0] = o[0] * r, t[1] = o[1] * r, t;
|
|
194
|
+
}
|
|
195
|
+
function Nt(t, o) {
|
|
196
|
+
return [t[0] / o, t[1] / o];
|
|
197
|
+
}
|
|
198
|
+
function bt(t) {
|
|
199
|
+
return [t[1], -t[0]];
|
|
200
|
+
}
|
|
201
|
+
function et(t, o) {
|
|
202
|
+
let r = o[0];
|
|
203
|
+
return t[0] = o[1], t[1] = -r, t;
|
|
204
|
+
}
|
|
205
|
+
function dt(t, o) {
|
|
206
|
+
return t[0] * o[0] + t[1] * o[1];
|
|
207
|
+
}
|
|
208
|
+
function $t(t, o) {
|
|
209
|
+
return t[0] === o[0] && t[1] === o[1];
|
|
210
|
+
}
|
|
211
|
+
function Ft(t) {
|
|
212
|
+
return Math.hypot(t[0], t[1]);
|
|
213
|
+
}
|
|
214
|
+
function ft(t, o) {
|
|
215
|
+
let r = t[0] - o[0], g = t[1] - o[1];
|
|
216
|
+
return r * r + g * g;
|
|
217
|
+
}
|
|
218
|
+
function kt(t) {
|
|
219
|
+
return Nt(t, Ft(t));
|
|
220
|
+
}
|
|
221
|
+
function Wt(t, o) {
|
|
222
|
+
return Math.hypot(t[1] - o[1], t[0] - o[0]);
|
|
223
|
+
}
|
|
224
|
+
function ot(t, o, r) {
|
|
225
|
+
let g = Math.sin(r), m = Math.cos(r), x = t[0] - o[0], e = t[1] - o[1], i = x * m - e * g, h = x * g + e * m;
|
|
226
|
+
return [i + o[0], h + o[1]];
|
|
227
|
+
}
|
|
228
|
+
function pt(t, o, r, g) {
|
|
229
|
+
let m = Math.sin(g), x = Math.cos(g), e = o[0] - r[0], i = o[1] - r[1], h = e * x - i * m, v = e * m + i * x;
|
|
230
|
+
return t[0] = h + r[0], t[1] = v + r[1], t;
|
|
231
|
+
}
|
|
232
|
+
function vt(t, o, r) {
|
|
233
|
+
return K(t, G(R(o, t), r));
|
|
234
|
+
}
|
|
235
|
+
function qt(t, o, r, g) {
|
|
236
|
+
let m = r[0] - o[0], x = r[1] - o[1];
|
|
237
|
+
return t[0] = o[0] + m * g, t[1] = o[1] + x * g, t;
|
|
238
|
+
}
|
|
239
|
+
function Ct(t, o, r) {
|
|
240
|
+
return K(t, G(o, r));
|
|
241
|
+
}
|
|
242
|
+
const V = [0, 0], j = [0, 0], B = [0, 0];
|
|
243
|
+
function Xt(t, o) {
|
|
244
|
+
let r = Ct(t, kt(bt(R(t, K(t, [1, 1])))), -o), g = [], m = 1 / 13;
|
|
245
|
+
for (let x = m; x <= 1; x += m) g.push(ot(r, t, Z * 2 * x));
|
|
246
|
+
return g;
|
|
247
|
+
}
|
|
248
|
+
function Yt(t, o, r) {
|
|
249
|
+
let g = [], m = 1 / r;
|
|
250
|
+
for (let x = m; x <= 1; x += m) g.push(ot(o, t, Z * x));
|
|
251
|
+
return g;
|
|
252
|
+
}
|
|
253
|
+
function Vt(t, o, r) {
|
|
254
|
+
let g = R(o, r), m = G(g, 0.5), x = G(g, 0.51);
|
|
255
|
+
return [R(t, m), R(t, x), K(t, x), K(t, m)];
|
|
256
|
+
}
|
|
257
|
+
function zt(t, o, r, g) {
|
|
258
|
+
let m = [], x = Ct(t, o, r), e = 1 / g;
|
|
259
|
+
for (let i = e; i < 1; i += e) m.push(ot(x, t, Z * 3 * i));
|
|
260
|
+
return m;
|
|
261
|
+
}
|
|
262
|
+
function _t(t, o, r) {
|
|
263
|
+
return [K(t, G(o, r)), K(t, G(o, r * 0.99)), R(t, G(o, r * 0.99)), R(t, G(o, r))];
|
|
264
|
+
}
|
|
265
|
+
function ht(t, o, r) {
|
|
266
|
+
return t === !1 || t === void 0 ? 0 : t === !0 ? Math.max(o, r) : t;
|
|
267
|
+
}
|
|
268
|
+
function Kt(t, o, r) {
|
|
269
|
+
return t.slice(0, 10).reduce((g, m) => {
|
|
270
|
+
let x = m.pressure;
|
|
271
|
+
return o && (x = Pt(g, m.distance, r)), (g + x) / 2;
|
|
272
|
+
}, t[0].pressure);
|
|
273
|
+
}
|
|
274
|
+
function Ut(t, o = {}) {
|
|
275
|
+
let { size: r = 16, smoothing: g = 0.5, thinning: m = 0.5, simulatePressure: x = !0, easing: e = (p) => p, start: i = {}, end: h = {}, last: v = !1 } = o, { cap: f = !0, easing: w = (p) => p * (2 - p) } = i, { cap: u = !0, easing: d = (p) => --p * p * p + 1 } = h;
|
|
276
|
+
if (t.length === 0 || r <= 0) return [];
|
|
277
|
+
let P = t[t.length - 1].runningLength, C = ht(i.taper, r, P), k = ht(h.taper, r, P), T = (r * g) ** 2, W = [], $ = [], A = Kt(t, x, r), I = ct(r, m, t[t.length - 1].pressure, e), q, X = t[0].vector, F = t[0].point, N = F, M = F, D = N, a = !1;
|
|
278
|
+
for (let p = 0; p < t.length; p++) {
|
|
279
|
+
let { pressure: S } = t[p], { point: c, vector: E, distance: L, runningLength: b } = t[p], Y = p === t.length - 1;
|
|
280
|
+
if (!Y && P - b < 3) continue;
|
|
281
|
+
m ? (x && (S = Pt(A, L, r)), I = ct(r, m, S, e)) : I = r / 2, q === void 0 && (q = I);
|
|
282
|
+
let _ = b < C ? w(b / C) : 1, U = P - b < k ? d((P - b) / k) : 1;
|
|
283
|
+
I = Math.max(0.01, I * Math.min(_, U));
|
|
284
|
+
let z = (Y ? t[p] : t[p + 1]).vector, O = Y ? 1 : dt(E, z), Mt = dt(E, X) < 0 && !a, rt = O !== null && O < 0;
|
|
285
|
+
if (Mt || rt) {
|
|
286
|
+
et(V, X), tt(V, V, I);
|
|
287
|
+
for (let Q = 0; Q <= 1; Q += 0.07692307692307693) nt(j, c, V), pt(j, j, c, Z * Q), M = [j[0], j[1]], W.push(M), ut(B, c, V), pt(B, B, c, Z * -Q), D = [B[0], B[1]], $.push(D);
|
|
288
|
+
F = M, N = D, rt && (a = !0);
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
if (a = !1, Y) {
|
|
292
|
+
et(V, E), tt(V, V, I), W.push(R(c, V)), $.push(K(c, V));
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
qt(V, z, E, O), et(V, V), tt(V, V, I), nt(j, c, V), M = [j[0], j[1]], (p <= 1 || ft(F, M) > T) && (W.push(M), F = M), ut(B, c, V), D = [B[0], B[1]], (p <= 1 || ft(N, D) > T) && ($.push(D), N = D), A = S, X = E;
|
|
296
|
+
}
|
|
297
|
+
let n = [t[0].point[0], t[0].point[1]], l = t.length > 1 ? [t[t.length - 1].point[0], t[t.length - 1].point[1]] : K(t[0].point, [1, 1]), y = [], s = [];
|
|
298
|
+
if (t.length === 1) {
|
|
299
|
+
if (!(C || k) || v) return Xt(n, q || I);
|
|
300
|
+
} else {
|
|
301
|
+
C || k && t.length === 1 || (f ? y.push(...Yt(n, $[0], 13)) : y.push(...Vt(n, W[0], $[0])));
|
|
302
|
+
let p = bt(Tt(t[t.length - 1].vector));
|
|
303
|
+
k || C && t.length === 1 ? s.push(l) : u ? s.push(...zt(l, p, I, 29)) : s.push(..._t(l, p, I));
|
|
304
|
+
}
|
|
305
|
+
return W.concat(s, $.reverse(), y);
|
|
306
|
+
}
|
|
307
|
+
const wt = [0, 0];
|
|
308
|
+
function gt(t) {
|
|
309
|
+
return t != null && t >= 0;
|
|
310
|
+
}
|
|
311
|
+
function jt(t, o = {}) {
|
|
312
|
+
let { streamline: r = 0.5, size: g = 16, last: m = !1 } = o;
|
|
313
|
+
if (t.length === 0) return [];
|
|
314
|
+
let x = 0.15 + (1 - r) * 0.85, e = Array.isArray(t[0]) ? t : t.map(({ x: u, y: d, pressure: P = lt }) => [u, d, P]);
|
|
315
|
+
if (e.length === 2) {
|
|
316
|
+
let u = e[1];
|
|
317
|
+
e = e.slice(0, -1);
|
|
318
|
+
for (let d = 1; d < 5; d++) e.push(vt(e[0], u, d / 4));
|
|
319
|
+
}
|
|
320
|
+
e.length === 1 && (e = [...e, [...K(e[0], at), ...e[0].slice(2)]]);
|
|
321
|
+
let i = [{ point: [e[0][0], e[0][1]], pressure: gt(e[0][2]) ? e[0][2] : 0.25, vector: [...at], distance: 0, runningLength: 0 }], h = !1, v = 0, f = i[0], w = e.length - 1;
|
|
322
|
+
for (let u = 1; u < e.length; u++) {
|
|
323
|
+
let d = m && u === w ? [e[u][0], e[u][1]] : vt(f.point, e[u], x);
|
|
324
|
+
if ($t(f.point, d)) continue;
|
|
325
|
+
let P = Wt(d, f.point);
|
|
326
|
+
if (v += P, u < w && !h) {
|
|
327
|
+
if (v < g) continue;
|
|
328
|
+
h = !0;
|
|
329
|
+
}
|
|
330
|
+
nt(wt, f.point, d), f = { point: d, pressure: gt(e[u][2]) ? e[u][2] : lt, vector: kt(wt), distance: P, runningLength: v }, i.push(f);
|
|
331
|
+
}
|
|
332
|
+
return i[0].vector = i[1]?.vector || [0, 0], i;
|
|
333
|
+
}
|
|
334
|
+
function St(t, o = {}) {
|
|
335
|
+
return Ut(jt(t, o), o);
|
|
336
|
+
}
|
|
337
|
+
function It(t) {
|
|
338
|
+
if (!t.length) return "";
|
|
339
|
+
const o = t.reduce(
|
|
340
|
+
(r, [g, m], x, e) => {
|
|
341
|
+
const [i, h] = e[(x + 1) % e.length];
|
|
342
|
+
return r.push(g, m, (g + i) / 2, (m + h) / 2), r;
|
|
343
|
+
},
|
|
344
|
+
["M", ...t[0], "Q"]
|
|
345
|
+
);
|
|
346
|
+
return o.push("Z"), o.join(" ");
|
|
347
|
+
}
|
|
348
|
+
const Bt = 3, mt = "http://www.w3.org/2000/svg";
|
|
349
|
+
function Gt(t) {
|
|
350
|
+
t.directive(
|
|
351
|
+
"flow-freehand",
|
|
352
|
+
(o, { expression: r, modifiers: g }, { evaluate: m, effect: x, cleanup: e }) => {
|
|
353
|
+
const i = o, h = g.includes("filled");
|
|
354
|
+
let v = h;
|
|
355
|
+
const f = t.$data(i);
|
|
356
|
+
if (!f) return;
|
|
357
|
+
let w = !1, u = null, d = [], P = { x: 0, y: 0 }, C = null, k = null;
|
|
358
|
+
function T() {
|
|
359
|
+
const p = t.$data(i)?.toolSettings, S = p?.strokeColor ?? (getComputedStyle(i).getPropertyValue("--flow-tool-stroke-color").trim() || "#52525b"), c = p?.strokeWidth ?? 2, E = p?.opacity ?? 1;
|
|
360
|
+
return { strokeColor: S, strokeWidth: c, opacity: E };
|
|
361
|
+
}
|
|
362
|
+
function W() {
|
|
363
|
+
return i.querySelector(".flow-viewport");
|
|
364
|
+
}
|
|
365
|
+
function $() {
|
|
366
|
+
const s = W();
|
|
367
|
+
if (!s) return;
|
|
368
|
+
const { strokeColor: p, opacity: S } = T();
|
|
369
|
+
C = document.createElementNS(mt, "svg"), C.style.cssText = "position:absolute;top:0;left:0;width:1px;height:1px;overflow:visible;pointer-events:none;z-index:1000;", k = document.createElementNS(mt, "polyline"), k.classList.add("flow-freehand-path"), k.setAttribute("fill", "none"), k.setAttribute("stroke", p), k.setAttribute("stroke-width", "2"), k.setAttribute("stroke-linecap", "round"), k.setAttribute("stroke-linejoin", "round"), k.setAttribute("opacity", String(S)), C.appendChild(k), s.appendChild(C);
|
|
370
|
+
}
|
|
371
|
+
function A() {
|
|
372
|
+
C && (C.remove(), C = null, k = null);
|
|
373
|
+
}
|
|
374
|
+
function I() {
|
|
375
|
+
if (!k || d.length === 0) return;
|
|
376
|
+
const s = d.map(([p, S]) => `${p},${S}`).join(" ");
|
|
377
|
+
k.setAttribute("points", s);
|
|
378
|
+
}
|
|
379
|
+
function q(s) {
|
|
380
|
+
let p = 1 / 0, S = 1 / 0, c = -1 / 0, E = -1 / 0;
|
|
381
|
+
for (const [L, b] of s)
|
|
382
|
+
L < p && (p = L), b < S && (S = b), L > c && (c = L), b > E && (E = b);
|
|
383
|
+
return {
|
|
384
|
+
x: p,
|
|
385
|
+
y: S,
|
|
386
|
+
width: c - p,
|
|
387
|
+
height: E - S
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
function X(s) {
|
|
391
|
+
const p = s.target;
|
|
392
|
+
if (p.closest(".flow-panel") || p.closest(".canvas-overlay") || s.button !== 0) return;
|
|
393
|
+
s.stopImmediatePropagation(), w = !0, d = [];
|
|
394
|
+
const S = f.screenToFlowPosition(s.clientX, s.clientY), c = s.pressure > 0 ? s.pressure : 0.5;
|
|
395
|
+
d.push([S.x, S.y, c]), P = S, $(), I(), u = s.pointerId, i.setPointerCapture(s.pointerId);
|
|
396
|
+
}
|
|
397
|
+
function F(s) {
|
|
398
|
+
const p = s.target;
|
|
399
|
+
p.closest(".flow-panel") || p.closest(".canvas-overlay") || s.stopImmediatePropagation();
|
|
400
|
+
}
|
|
401
|
+
function N(s) {
|
|
402
|
+
if (!w) return;
|
|
403
|
+
const p = f.screenToFlowPosition(s.clientX, s.clientY), S = p.x - P.x, c = p.y - P.y;
|
|
404
|
+
if (Math.sqrt(S * S + c * c) < Bt) return;
|
|
405
|
+
const L = s.pressure > 0 ? s.pressure : 0.5;
|
|
406
|
+
d.push([p.x, p.y, L]), P = p, I();
|
|
407
|
+
}
|
|
408
|
+
function M(s) {
|
|
409
|
+
if (!w) return;
|
|
410
|
+
w = !1;
|
|
411
|
+
const p = [...d];
|
|
412
|
+
if (A(), p.length < 3) {
|
|
413
|
+
i.releasePointerCapture(s.pointerId);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
const { strokeColor: S, strokeWidth: c, opacity: E } = T(), L = q(p), b = St(p, {
|
|
417
|
+
size: c * 4,
|
|
418
|
+
thinning: 0.5,
|
|
419
|
+
smoothing: 0.5,
|
|
420
|
+
streamline: 0.5
|
|
421
|
+
}), Y = It(b);
|
|
422
|
+
i.dispatchEvent(
|
|
423
|
+
new CustomEvent("flow-freehand-end", {
|
|
424
|
+
detail: {
|
|
425
|
+
points: p,
|
|
426
|
+
pathData: Y,
|
|
427
|
+
bounds: L,
|
|
428
|
+
strokeColor: S,
|
|
429
|
+
strokeWidth: c,
|
|
430
|
+
opacity: E,
|
|
431
|
+
filled: v
|
|
432
|
+
},
|
|
433
|
+
bubbles: !0
|
|
434
|
+
})
|
|
435
|
+
), u = null, i.releasePointerCapture(s.pointerId);
|
|
436
|
+
}
|
|
437
|
+
function D(s) {
|
|
438
|
+
w && s.key === "Escape" && (w = !1, A(), d = [], u !== null && (i.releasePointerCapture(u), u = null));
|
|
439
|
+
}
|
|
440
|
+
function a() {
|
|
441
|
+
if (w) {
|
|
442
|
+
if (w = !1, A(), d = [], u !== null)
|
|
443
|
+
try {
|
|
444
|
+
i.releasePointerCapture(u);
|
|
445
|
+
} catch {
|
|
446
|
+
}
|
|
447
|
+
u = null;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
let n = !1;
|
|
451
|
+
function l() {
|
|
452
|
+
n || (n = !0, i.addEventListener("pointerdown", X, !0), i.addEventListener("mousedown", F, !0), i.addEventListener("touchstart", F, !0), i.addEventListener("pointermove", N), i.addEventListener("pointerup", M), document.addEventListener("keydown", D));
|
|
453
|
+
}
|
|
454
|
+
function y() {
|
|
455
|
+
n && (n = !1, a(), i.removeEventListener("pointerdown", X, !0), i.removeEventListener("mousedown", F, !0), i.removeEventListener("touchstart", F, !0), i.removeEventListener("pointermove", N), i.removeEventListener("pointerup", M), document.removeEventListener("keydown", D));
|
|
456
|
+
}
|
|
457
|
+
x(() => {
|
|
458
|
+
const s = !!m(r);
|
|
459
|
+
v = h, s ? (i.classList.add("flow-tool-freehand"), v ? i.classList.add("flow-tool-freehand-filled") : i.classList.remove("flow-tool-freehand-filled"), l()) : (i.classList.remove("flow-tool-freehand"), i.classList.remove("flow-tool-freehand-filled"), y());
|
|
460
|
+
}), e(() => {
|
|
461
|
+
i.classList.remove("flow-tool-freehand"), i.classList.remove("flow-tool-freehand-filled"), y();
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
const Rt = 3, yt = "http://www.w3.org/2000/svg";
|
|
467
|
+
function Ot(t) {
|
|
468
|
+
t.directive(
|
|
469
|
+
"flow-highlighter",
|
|
470
|
+
(o, { expression: r }, { evaluate: g, effect: m, cleanup: x }) => {
|
|
471
|
+
const e = o, i = t.$data(e);
|
|
472
|
+
if (!i) return;
|
|
473
|
+
let h = !1, v = null, f = [], w = { x: 0, y: 0 }, u = null, d = null;
|
|
474
|
+
function P() {
|
|
475
|
+
const l = t.$data(e)?.toolSettings, y = l?.strokeColor ?? (getComputedStyle(e).getPropertyValue("--flow-tool-highlighter-color").trim() || "#fbbf24"), s = l?.strokeWidth ?? 2, p = l?.opacity ?? 1;
|
|
476
|
+
return { strokeColor: y, strokeWidth: s, opacity: p };
|
|
477
|
+
}
|
|
478
|
+
function C() {
|
|
479
|
+
return e.querySelector(".flow-viewport");
|
|
480
|
+
}
|
|
481
|
+
function k() {
|
|
482
|
+
const n = C();
|
|
483
|
+
if (!n) return;
|
|
484
|
+
const { strokeColor: l } = P();
|
|
485
|
+
u = document.createElementNS(yt, "svg"), u.style.cssText = "position:absolute;top:0;left:0;width:1px;height:1px;overflow:visible;pointer-events:none;z-index:1000;", d = document.createElementNS(yt, "polyline"), d.classList.add("flow-freehand-path"), d.setAttribute("fill", "none"), d.setAttribute("stroke", l), d.setAttribute("stroke-width", "8"), d.setAttribute("stroke-linecap", "round"), d.setAttribute("stroke-linejoin", "round"), d.setAttribute("opacity", "0.3"), u.appendChild(d), n.appendChild(u);
|
|
486
|
+
}
|
|
487
|
+
function T() {
|
|
488
|
+
u && (u.remove(), u = null, d = null);
|
|
489
|
+
}
|
|
490
|
+
function W() {
|
|
491
|
+
if (!d || f.length === 0) return;
|
|
492
|
+
const n = f.map(([l, y]) => `${l},${y}`).join(" ");
|
|
493
|
+
d.setAttribute("points", n);
|
|
494
|
+
}
|
|
495
|
+
function $(n) {
|
|
496
|
+
let l = 1 / 0, y = 1 / 0, s = -1 / 0, p = -1 / 0;
|
|
497
|
+
for (const [S, c] of n)
|
|
498
|
+
S < l && (l = S), c < y && (y = c), S > s && (s = S), c > p && (p = c);
|
|
499
|
+
return {
|
|
500
|
+
x: l,
|
|
501
|
+
y,
|
|
502
|
+
width: s - l,
|
|
503
|
+
height: p - y
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
function A(n) {
|
|
507
|
+
const l = n.target;
|
|
508
|
+
if (l.closest(".flow-panel") || l.closest(".canvas-overlay") || n.button !== 0) return;
|
|
509
|
+
n.stopImmediatePropagation(), h = !0, f = [];
|
|
510
|
+
const y = i.screenToFlowPosition(n.clientX, n.clientY), s = n.pressure > 0 ? n.pressure : 0.5;
|
|
511
|
+
f.push([y.x, y.y, s]), w = y, k(), W(), v = n.pointerId, e.setPointerCapture(n.pointerId);
|
|
512
|
+
}
|
|
513
|
+
function I(n) {
|
|
514
|
+
const l = n.target;
|
|
515
|
+
l.closest(".flow-panel") || l.closest(".canvas-overlay") || n.stopImmediatePropagation();
|
|
516
|
+
}
|
|
517
|
+
function q(n) {
|
|
518
|
+
if (!h) return;
|
|
519
|
+
const l = i.screenToFlowPosition(n.clientX, n.clientY), y = l.x - w.x, s = l.y - w.y;
|
|
520
|
+
if (Math.sqrt(y * y + s * s) < Rt) return;
|
|
521
|
+
const S = n.pressure > 0 ? n.pressure : 0.5;
|
|
522
|
+
f.push([l.x, l.y, S]), w = l, W();
|
|
523
|
+
}
|
|
524
|
+
function X(n) {
|
|
525
|
+
if (!h) return;
|
|
526
|
+
h = !1;
|
|
527
|
+
const l = [...f];
|
|
528
|
+
if (T(), l.length < 3) {
|
|
529
|
+
e.releasePointerCapture(n.pointerId);
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
const { strokeColor: y, strokeWidth: s } = P(), p = $(l), S = St(l, {
|
|
533
|
+
size: s * 12,
|
|
534
|
+
thinning: 0.2,
|
|
535
|
+
smoothing: 0.7,
|
|
536
|
+
streamline: 0.5
|
|
537
|
+
}), c = It(S);
|
|
538
|
+
e.dispatchEvent(
|
|
539
|
+
new CustomEvent("flow-highlight-end", {
|
|
540
|
+
detail: {
|
|
541
|
+
points: l,
|
|
542
|
+
pathData: c,
|
|
543
|
+
bounds: p,
|
|
544
|
+
strokeColor: y,
|
|
545
|
+
strokeWidth: s,
|
|
546
|
+
opacity: 0.3
|
|
547
|
+
},
|
|
548
|
+
bubbles: !0
|
|
549
|
+
})
|
|
550
|
+
), v = null, e.releasePointerCapture(n.pointerId);
|
|
551
|
+
}
|
|
552
|
+
function F(n) {
|
|
553
|
+
h && n.key === "Escape" && (h = !1, T(), f = [], v !== null && (e.releasePointerCapture(v), v = null));
|
|
554
|
+
}
|
|
555
|
+
function N() {
|
|
556
|
+
if (h) {
|
|
557
|
+
if (h = !1, T(), f = [], v !== null)
|
|
558
|
+
try {
|
|
559
|
+
e.releasePointerCapture(v);
|
|
560
|
+
} catch {
|
|
561
|
+
}
|
|
562
|
+
v = null;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
let M = !1;
|
|
566
|
+
function D() {
|
|
567
|
+
M || (M = !0, e.addEventListener("pointerdown", A, !0), e.addEventListener("mousedown", I, !0), e.addEventListener("touchstart", I, !0), e.addEventListener("pointermove", q), e.addEventListener("pointerup", X), document.addEventListener("keydown", F));
|
|
568
|
+
}
|
|
569
|
+
function a() {
|
|
570
|
+
M && (M = !1, N(), e.removeEventListener("pointerdown", A, !0), e.removeEventListener("mousedown", I, !0), e.removeEventListener("touchstart", I, !0), e.removeEventListener("pointermove", q), e.removeEventListener("pointerup", X), document.removeEventListener("keydown", F));
|
|
571
|
+
}
|
|
572
|
+
m(() => {
|
|
573
|
+
!!g(r) ? (e.classList.add("flow-tool-highlighter"), D()) : (e.classList.remove("flow-tool-highlighter"), a());
|
|
574
|
+
}), x(() => {
|
|
575
|
+
e.classList.remove("flow-tool-highlighter"), a();
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
const Et = 10;
|
|
581
|
+
function Ht(t) {
|
|
582
|
+
t.directive(
|
|
583
|
+
"flow-rectangle-draw",
|
|
584
|
+
(o, { expression: r }, { evaluate: g, effect: m, cleanup: x }) => {
|
|
585
|
+
const e = o, i = t.$data(e);
|
|
586
|
+
if (!i) return;
|
|
587
|
+
let h = !1, v = null, f = { x: 0, y: 0 }, w = { x: 0, y: 0 }, u = null;
|
|
588
|
+
function d() {
|
|
589
|
+
const n = t.$data(e)?.toolSettings, l = n?.strokeColor ?? (getComputedStyle(e).getPropertyValue("--flow-tool-stroke-color").trim() || "#52525b"), y = n?.strokeWidth ?? 2, s = n?.opacity ?? 1;
|
|
590
|
+
return { strokeColor: l, strokeWidth: y, opacity: s };
|
|
591
|
+
}
|
|
592
|
+
function P() {
|
|
593
|
+
return e.querySelector(".flow-viewport");
|
|
594
|
+
}
|
|
595
|
+
function C() {
|
|
596
|
+
const a = P();
|
|
597
|
+
if (!a) return;
|
|
598
|
+
const { strokeColor: n } = d();
|
|
599
|
+
u = document.createElement("div"), u.className = "flow-rectangle-draw-preview", u.style.cssText = `position:absolute;pointer-events:none;border:2px dashed ${n};background:var(--flow-rectangle-draw-bg, rgba(59,130,246,0.08));z-index:1000;`, a.appendChild(u);
|
|
600
|
+
}
|
|
601
|
+
function k() {
|
|
602
|
+
if (!u) return;
|
|
603
|
+
const a = Math.min(f.x, w.x), n = Math.min(f.y, w.y), l = Math.abs(w.x - f.x), y = Math.abs(w.y - f.y);
|
|
604
|
+
u.style.left = `${a}px`, u.style.top = `${n}px`, u.style.width = `${l}px`, u.style.height = `${y}px`;
|
|
605
|
+
}
|
|
606
|
+
function T() {
|
|
607
|
+
u && (u.remove(), u = null);
|
|
608
|
+
}
|
|
609
|
+
function W() {
|
|
610
|
+
const a = Math.min(f.x, w.x), n = Math.min(f.y, w.y), l = Math.abs(w.x - f.x), y = Math.abs(w.y - f.y);
|
|
611
|
+
return { x: a, y: n, width: l, height: y };
|
|
612
|
+
}
|
|
613
|
+
function $(a) {
|
|
614
|
+
const n = a.target;
|
|
615
|
+
n.closest(".flow-panel") || n.closest(".canvas-overlay") || a.button === 0 && (a.stopImmediatePropagation(), h = !0, f = i.screenToFlowPosition(a.clientX, a.clientY), w = { ...f }, C(), k(), v = a.pointerId, e.setPointerCapture(a.pointerId));
|
|
616
|
+
}
|
|
617
|
+
function A(a) {
|
|
618
|
+
const n = a.target;
|
|
619
|
+
n.closest(".flow-panel") || n.closest(".canvas-overlay") || a.stopImmediatePropagation();
|
|
620
|
+
}
|
|
621
|
+
function I(a) {
|
|
622
|
+
h && (w = i.screenToFlowPosition(a.clientX, a.clientY), k());
|
|
623
|
+
}
|
|
624
|
+
function q(a) {
|
|
625
|
+
if (!h) return;
|
|
626
|
+
h = !1, w = i.screenToFlowPosition(a.clientX, a.clientY);
|
|
627
|
+
const n = W();
|
|
628
|
+
if (T(), n.width < Et && n.height < Et) {
|
|
629
|
+
e.releasePointerCapture(a.pointerId);
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
const l = d();
|
|
633
|
+
e.dispatchEvent(
|
|
634
|
+
new CustomEvent("flow-rectangle-draw", {
|
|
635
|
+
detail: {
|
|
636
|
+
bounds: n,
|
|
637
|
+
strokeColor: l.strokeColor,
|
|
638
|
+
strokeWidth: l.strokeWidth,
|
|
639
|
+
opacity: l.opacity
|
|
640
|
+
},
|
|
641
|
+
bubbles: !0
|
|
642
|
+
})
|
|
643
|
+
), v = null, e.releasePointerCapture(a.pointerId);
|
|
644
|
+
}
|
|
645
|
+
function X(a) {
|
|
646
|
+
h && a.key === "Escape" && (h = !1, T(), v !== null && (e.releasePointerCapture(v), v = null));
|
|
647
|
+
}
|
|
648
|
+
function F() {
|
|
649
|
+
if (h) {
|
|
650
|
+
if (h = !1, T(), v !== null)
|
|
651
|
+
try {
|
|
652
|
+
e.releasePointerCapture(v);
|
|
653
|
+
} catch {
|
|
654
|
+
}
|
|
655
|
+
v = null;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
let N = !1;
|
|
659
|
+
function M() {
|
|
660
|
+
N || (N = !0, e.addEventListener("pointerdown", $, !0), e.addEventListener("mousedown", A, !0), e.addEventListener("touchstart", A, !0), e.addEventListener("pointermove", I), e.addEventListener("pointerup", q), document.addEventListener("keydown", X));
|
|
661
|
+
}
|
|
662
|
+
function D() {
|
|
663
|
+
N && (N = !1, F(), e.removeEventListener("pointerdown", $, !0), e.removeEventListener("mousedown", A, !0), e.removeEventListener("touchstart", A, !0), e.removeEventListener("pointermove", I), e.removeEventListener("pointerup", q), document.removeEventListener("keydown", X));
|
|
664
|
+
}
|
|
665
|
+
m(() => {
|
|
666
|
+
!!g(r) ? (e.classList.add("flow-tool-rectangle"), M()) : (e.classList.remove("flow-tool-rectangle"), D());
|
|
667
|
+
}), x(() => {
|
|
668
|
+
e.classList.remove("flow-tool-rectangle"), D();
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
const Zt = 15, H = "http://www.w3.org/2000/svg";
|
|
674
|
+
function Qt(t) {
|
|
675
|
+
t.directive(
|
|
676
|
+
"flow-arrow-draw",
|
|
677
|
+
(o, { expression: r }, { evaluate: g, effect: m, cleanup: x }) => {
|
|
678
|
+
const e = o, i = t.$data(e);
|
|
679
|
+
if (!i) return;
|
|
680
|
+
let h = !1, v = null, f = { x: 0, y: 0 }, w = { x: 0, y: 0 }, u = null, d = null;
|
|
681
|
+
const P = `flow-arrow-preview-${crypto.randomUUID()}`;
|
|
682
|
+
function C() {
|
|
683
|
+
const l = t.$data(e)?.toolSettings, y = l?.strokeColor ?? (getComputedStyle(e).getPropertyValue("--flow-tool-stroke-color").trim() || "#52525b"), s = l?.strokeWidth ?? 2, p = l?.opacity ?? 1;
|
|
684
|
+
return { strokeColor: y, strokeWidth: s, opacity: p };
|
|
685
|
+
}
|
|
686
|
+
function k() {
|
|
687
|
+
return e.querySelector(".flow-viewport");
|
|
688
|
+
}
|
|
689
|
+
function T() {
|
|
690
|
+
const n = k();
|
|
691
|
+
if (!n) return;
|
|
692
|
+
const l = C();
|
|
693
|
+
u = document.createElementNS(H, "svg"), u.style.cssText = "position:absolute;top:0;left:0;width:1px;height:1px;overflow:visible;pointer-events:none;z-index:1000;";
|
|
694
|
+
const y = document.createElementNS(H, "defs"), s = document.createElementNS(H, "marker");
|
|
695
|
+
s.setAttribute("id", P), s.setAttribute("viewBox", "0 0 10 10"), s.setAttribute("refX", "10"), s.setAttribute("refY", "5"), s.setAttribute("markerWidth", "6"), s.setAttribute("markerHeight", "6"), s.setAttribute("orient", "auto-start-reverse");
|
|
696
|
+
const p = document.createElementNS(H, "path");
|
|
697
|
+
p.setAttribute("d", "M 0 0 L 10 5 L 0 10 z"), p.setAttribute("fill", l.strokeColor), s.appendChild(p), y.appendChild(s), u.appendChild(y), d = document.createElementNS(H, "line"), d.setAttribute("stroke", l.strokeColor), d.setAttribute("stroke-width", String(l.strokeWidth)), d.setAttribute("marker-end", `url(#${P})`), u.appendChild(d), n.appendChild(u);
|
|
698
|
+
}
|
|
699
|
+
function W() {
|
|
700
|
+
d && (d.setAttribute("x1", String(f.x)), d.setAttribute("y1", String(f.y)), d.setAttribute("x2", String(w.x)), d.setAttribute("y2", String(w.y)));
|
|
701
|
+
}
|
|
702
|
+
function $() {
|
|
703
|
+
u && (u.remove(), u = null, d = null);
|
|
704
|
+
}
|
|
705
|
+
function A(n) {
|
|
706
|
+
const l = n.target;
|
|
707
|
+
l.closest(".flow-panel") || l.closest(".canvas-overlay") || n.button === 0 && (n.stopImmediatePropagation(), h = !0, f = i.screenToFlowPosition(n.clientX, n.clientY), w = { ...f }, T(), W(), v = n.pointerId, e.setPointerCapture(n.pointerId));
|
|
708
|
+
}
|
|
709
|
+
function I(n) {
|
|
710
|
+
const l = n.target;
|
|
711
|
+
l.closest(".flow-panel") || l.closest(".canvas-overlay") || n.stopImmediatePropagation();
|
|
712
|
+
}
|
|
713
|
+
function q(n) {
|
|
714
|
+
h && (w = i.screenToFlowPosition(n.clientX, n.clientY), W());
|
|
715
|
+
}
|
|
716
|
+
function X(n) {
|
|
717
|
+
if (!h) return;
|
|
718
|
+
h = !1, w = i.screenToFlowPosition(n.clientX, n.clientY);
|
|
719
|
+
const l = C(), y = w.x - f.x, s = w.y - f.y, p = Math.sqrt(y * y + s * s);
|
|
720
|
+
if ($(), p < Zt) {
|
|
721
|
+
e.releasePointerCapture(n.pointerId);
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
e.dispatchEvent(
|
|
725
|
+
new CustomEvent("flow-arrow-draw", {
|
|
726
|
+
detail: {
|
|
727
|
+
start: { x: f.x, y: f.y },
|
|
728
|
+
end: { x: w.x, y: w.y },
|
|
729
|
+
strokeColor: l.strokeColor,
|
|
730
|
+
strokeWidth: l.strokeWidth,
|
|
731
|
+
opacity: l.opacity
|
|
732
|
+
},
|
|
733
|
+
bubbles: !0
|
|
734
|
+
})
|
|
735
|
+
), v = null, e.releasePointerCapture(n.pointerId);
|
|
736
|
+
}
|
|
737
|
+
function F(n) {
|
|
738
|
+
h && n.key === "Escape" && (h = !1, $(), v !== null && (e.releasePointerCapture(v), v = null));
|
|
739
|
+
}
|
|
740
|
+
function N() {
|
|
741
|
+
if (h) {
|
|
742
|
+
if (h = !1, $(), v !== null)
|
|
743
|
+
try {
|
|
744
|
+
e.releasePointerCapture(v);
|
|
745
|
+
} catch {
|
|
746
|
+
}
|
|
747
|
+
v = null;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
let M = !1;
|
|
751
|
+
function D() {
|
|
752
|
+
M || (M = !0, e.addEventListener("pointerdown", A, !0), e.addEventListener("mousedown", I, !0), e.addEventListener("touchstart", I, !0), e.addEventListener("pointermove", q), e.addEventListener("pointerup", X), document.addEventListener("keydown", F));
|
|
753
|
+
}
|
|
754
|
+
function a() {
|
|
755
|
+
M && (M = !1, N(), e.removeEventListener("pointerdown", A, !0), e.removeEventListener("mousedown", I, !0), e.removeEventListener("touchstart", I, !0), e.removeEventListener("pointermove", q), e.removeEventListener("pointerup", X), document.removeEventListener("keydown", F));
|
|
756
|
+
}
|
|
757
|
+
m(() => {
|
|
758
|
+
!!g(r) ? (e.classList.add("flow-tool-arrow"), D()) : (e.classList.remove("flow-tool-arrow"), a());
|
|
759
|
+
}), x(() => {
|
|
760
|
+
e.classList.remove("flow-tool-arrow"), a();
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
);
|
|
764
|
+
}
|
|
765
|
+
const xt = 5, Lt = "http://www.w3.org/2000/svg";
|
|
766
|
+
function Jt(t) {
|
|
767
|
+
t.directive(
|
|
768
|
+
"flow-circle-draw",
|
|
769
|
+
(o, { expression: r }, { evaluate: g, effect: m, cleanup: x }) => {
|
|
770
|
+
const e = o, i = t.$data(e);
|
|
771
|
+
if (!i) return;
|
|
772
|
+
let h = !1, v = null, f = { x: 0, y: 0 }, w = { x: 0, y: 0 }, u = null, d = null;
|
|
773
|
+
function P() {
|
|
774
|
+
const n = t.$data(e)?.toolSettings, l = n?.strokeColor ?? (getComputedStyle(e).getPropertyValue("--flow-tool-stroke-color").trim() || "#52525b"), y = n?.strokeWidth ?? 2, s = n?.opacity ?? 1;
|
|
775
|
+
return { strokeColor: l, strokeWidth: y, opacity: s };
|
|
776
|
+
}
|
|
777
|
+
function C() {
|
|
778
|
+
return e.querySelector(".flow-viewport");
|
|
779
|
+
}
|
|
780
|
+
function k() {
|
|
781
|
+
const a = C();
|
|
782
|
+
if (!a) return;
|
|
783
|
+
const n = P();
|
|
784
|
+
u = document.createElementNS(Lt, "svg"), u.style.cssText = "position:absolute;top:0;left:0;width:1px;height:1px;overflow:visible;pointer-events:none;z-index:1000;", d = document.createElementNS(Lt, "ellipse"), d.style.fill = "var(--flow-circle-draw-fill, rgba(148,163,184,0.08))", d.setAttribute("stroke", n.strokeColor), d.setAttribute("stroke-width", String(n.strokeWidth)), d.setAttribute("stroke-dasharray", "6 3"), u.appendChild(d), a.appendChild(u);
|
|
785
|
+
}
|
|
786
|
+
function T(a) {
|
|
787
|
+
if (!d) return;
|
|
788
|
+
let n = Math.abs(w.x - f.x), l = Math.abs(w.y - f.y);
|
|
789
|
+
if (a) {
|
|
790
|
+
const y = Math.max(n, l);
|
|
791
|
+
n = y, l = y;
|
|
792
|
+
}
|
|
793
|
+
d.setAttribute("cx", String(f.x)), d.setAttribute("cy", String(f.y)), d.setAttribute("rx", String(n)), d.setAttribute("ry", String(l));
|
|
794
|
+
}
|
|
795
|
+
function W() {
|
|
796
|
+
u && (u.remove(), u = null, d = null);
|
|
797
|
+
}
|
|
798
|
+
function $(a) {
|
|
799
|
+
const n = a.target;
|
|
800
|
+
n.closest(".flow-panel") || n.closest(".canvas-overlay") || a.button === 0 && (a.stopImmediatePropagation(), h = !0, f = i.screenToFlowPosition(a.clientX, a.clientY), w = { ...f }, k(), T(a.shiftKey), v = a.pointerId, e.setPointerCapture(a.pointerId));
|
|
801
|
+
}
|
|
802
|
+
function A(a) {
|
|
803
|
+
const n = a.target;
|
|
804
|
+
n.closest(".flow-panel") || n.closest(".canvas-overlay") || a.stopImmediatePropagation();
|
|
805
|
+
}
|
|
806
|
+
function I(a) {
|
|
807
|
+
h && (w = i.screenToFlowPosition(a.clientX, a.clientY), T(a.shiftKey));
|
|
808
|
+
}
|
|
809
|
+
function q(a) {
|
|
810
|
+
if (!h) return;
|
|
811
|
+
h = !1, w = i.screenToFlowPosition(a.clientX, a.clientY);
|
|
812
|
+
const n = P();
|
|
813
|
+
let l = Math.abs(w.x - f.x), y = Math.abs(w.y - f.y);
|
|
814
|
+
if (a.shiftKey) {
|
|
815
|
+
const s = Math.max(l, y);
|
|
816
|
+
l = s, y = s;
|
|
817
|
+
}
|
|
818
|
+
if (W(), l < xt && y < xt) {
|
|
819
|
+
e.releasePointerCapture(a.pointerId);
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
e.dispatchEvent(
|
|
823
|
+
new CustomEvent("flow-circle-draw", {
|
|
824
|
+
detail: {
|
|
825
|
+
cx: f.x,
|
|
826
|
+
cy: f.y,
|
|
827
|
+
rx: l,
|
|
828
|
+
ry: y,
|
|
829
|
+
strokeColor: n.strokeColor,
|
|
830
|
+
strokeWidth: n.strokeWidth,
|
|
831
|
+
opacity: n.opacity
|
|
832
|
+
},
|
|
833
|
+
bubbles: !0
|
|
834
|
+
})
|
|
835
|
+
), v = null, e.releasePointerCapture(a.pointerId);
|
|
836
|
+
}
|
|
837
|
+
function X(a) {
|
|
838
|
+
h && a.key === "Escape" && (h = !1, W(), v !== null && (e.releasePointerCapture(v), v = null));
|
|
839
|
+
}
|
|
840
|
+
function F() {
|
|
841
|
+
if (h) {
|
|
842
|
+
if (h = !1, W(), v !== null)
|
|
843
|
+
try {
|
|
844
|
+
e.releasePointerCapture(v);
|
|
845
|
+
} catch {
|
|
846
|
+
}
|
|
847
|
+
v = null;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
let N = !1;
|
|
851
|
+
function M() {
|
|
852
|
+
N || (N = !0, e.addEventListener("pointerdown", $, !0), e.addEventListener("mousedown", A, !0), e.addEventListener("touchstart", A, !0), e.addEventListener("pointermove", I), e.addEventListener("pointerup", q), document.addEventListener("keydown", X));
|
|
853
|
+
}
|
|
854
|
+
function D() {
|
|
855
|
+
N && (N = !1, F(), e.removeEventListener("pointerdown", $, !0), e.removeEventListener("mousedown", A, !0), e.removeEventListener("touchstart", A, !0), e.removeEventListener("pointermove", I), e.removeEventListener("pointerup", q), document.removeEventListener("keydown", X));
|
|
856
|
+
}
|
|
857
|
+
m(() => {
|
|
858
|
+
!!g(r) ? (e.classList.add("flow-tool-circle"), M()) : (e.classList.remove("flow-tool-circle"), D());
|
|
859
|
+
}), x(() => {
|
|
860
|
+
e.classList.remove("flow-tool-circle"), D();
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
);
|
|
864
|
+
}
|
|
865
|
+
function te(t) {
|
|
866
|
+
t.directive(
|
|
867
|
+
"flow-text-tool",
|
|
868
|
+
(o, { expression: r }, { evaluate: g, effect: m, cleanup: x }) => {
|
|
869
|
+
const e = o, i = t.$data(e);
|
|
870
|
+
if (!i) return;
|
|
871
|
+
function h() {
|
|
872
|
+
const C = t.$data(e)?.toolSettings, k = C?.strokeWidth ?? 2;
|
|
873
|
+
return {
|
|
874
|
+
strokeColor: C?.strokeColor ?? (getComputedStyle(e).getPropertyValue("--flow-tool-stroke-color").trim() || "#52525b"),
|
|
875
|
+
// Map strokeWidth to fontSize: 1->14, 2->18, 4->24, 8->32
|
|
876
|
+
fontSize: k <= 1 ? 14 : k <= 2 ? 18 : k <= 4 ? 24 : 32,
|
|
877
|
+
opacity: C?.opacity ?? 1
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
function v(P) {
|
|
881
|
+
const C = P.target;
|
|
882
|
+
if (C.closest(".flow-panel") || C.closest(".canvas-overlay") || P.button !== 0) return;
|
|
883
|
+
P.stopImmediatePropagation();
|
|
884
|
+
const k = i.screenToFlowPosition(P.clientX, P.clientY), T = h();
|
|
885
|
+
e.dispatchEvent(
|
|
886
|
+
new CustomEvent("flow-text-draw", {
|
|
887
|
+
detail: {
|
|
888
|
+
position: { x: k.x, y: k.y },
|
|
889
|
+
strokeColor: T.strokeColor,
|
|
890
|
+
fontSize: T.fontSize,
|
|
891
|
+
opacity: T.opacity
|
|
892
|
+
},
|
|
893
|
+
bubbles: !0
|
|
894
|
+
})
|
|
895
|
+
);
|
|
896
|
+
}
|
|
897
|
+
function f(P) {
|
|
898
|
+
const C = P.target;
|
|
899
|
+
C.closest(".flow-panel") || C.closest(".canvas-overlay") || P.stopImmediatePropagation();
|
|
900
|
+
}
|
|
901
|
+
let w = !1;
|
|
902
|
+
function u() {
|
|
903
|
+
w || (w = !0, e.addEventListener("pointerdown", v, !0), e.addEventListener("mousedown", f, !0), e.addEventListener("touchstart", f, !0));
|
|
904
|
+
}
|
|
905
|
+
function d() {
|
|
906
|
+
w && (w = !1, e.removeEventListener("pointerdown", v, !0), e.removeEventListener("mousedown", f, !0), e.removeEventListener("touchstart", f, !0));
|
|
907
|
+
}
|
|
908
|
+
m(() => {
|
|
909
|
+
!!g(r) ? (e.classList.add("flow-tool-text"), u()) : (e.classList.remove("flow-tool-text"), d());
|
|
910
|
+
}), x(() => {
|
|
911
|
+
e.classList.remove("flow-tool-text"), d();
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
);
|
|
915
|
+
}
|
|
916
|
+
function ee(t) {
|
|
917
|
+
At(t), Gt(t), Ot(t), Ht(t), Qt(t), Jt(t), te(t);
|
|
918
|
+
}
|
|
919
|
+
document.addEventListener("alpine:init", () => {
|
|
920
|
+
window.Alpine.plugin(ee);
|
|
921
|
+
});
|
|
922
|
+
//# sourceMappingURL=alpineflow-whiteboard.js.map
|