dishui 0.0.59 → 0.0.60

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.
Files changed (36) hide show
  1. package/dist/components/pro/Flow/Flow.js +517 -543
  2. package/dist/components/pro/Flow/Flow.js.map +1 -1
  3. package/dist/components/pro/Flow/FlowCanvas.js +1092 -947
  4. package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
  5. package/dist/components/pro/Flow/context/FlowUIContext.d.ts +3 -0
  6. package/dist/components/pro/Flow/context/FlowUIContext.js +67 -64
  7. package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
  8. package/dist/components/pro/Flow/edges/EdgeRenderer.js +1 -1
  9. package/dist/components/pro/Flow/edges/edgePaths.js +170 -159
  10. package/dist/components/pro/Flow/edges/edgePaths.js.map +1 -1
  11. package/dist/components/pro/Flow/hooks/useDeleteSelection.d.ts +8 -0
  12. package/dist/components/pro/Flow/hooks/useDeleteSelection.js +43 -0
  13. package/dist/components/pro/Flow/hooks/useDeleteSelection.js.map +1 -0
  14. package/dist/components/pro/Flow/hooks/useMindMap.js +19 -17
  15. package/dist/components/pro/Flow/hooks/useMindMap.js.map +1 -1
  16. package/dist/components/pro/Flow/lines/LineRenderer.js +1 -1
  17. package/dist/components/pro/Flow/nodes/NodeRenderer.d.ts +2 -0
  18. package/dist/components/pro/Flow/nodes/NodeRenderer.js +174 -145
  19. package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
  20. package/dist/components/pro/Flow/nodes/shapes.d.ts +20 -0
  21. package/dist/components/pro/Flow/nodes/shapes.js +438 -203
  22. package/dist/components/pro/Flow/nodes/shapes.js.map +1 -1
  23. package/dist/components/pro/Flow/nodes/svgIconTexture.d.ts +4 -0
  24. package/dist/components/pro/Flow/nodes/svgIconTexture.js.map +1 -1
  25. package/dist/components/pro/Flow/panels/FlowToolbar.d.ts +4 -1
  26. package/dist/components/pro/Flow/panels/FlowToolbar.js +106 -100
  27. package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
  28. package/dist/components/pro/Flow/panels/InspectorPanel.js +739 -476
  29. package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
  30. package/dist/components/pro/Flow/panels/toolbarIcons.d.ts +2 -0
  31. package/dist/components/pro/Flow/panels/toolbarIcons.js +30 -25
  32. package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
  33. package/dist/components/pro/Flow/types.d.ts +32 -0
  34. package/dist/components/pro/Flow/types.js.map +1 -1
  35. package/dist/dishui.css +1 -1
  36. package/package.json +1 -1
@@ -1,186 +1,188 @@
1
- function M(e, t) {
2
- if (!(!e || e === "solid")) {
3
- if (e === "dynamic") return [t * 4, t * 3];
4
- if (e === "dashed") return [t * 4, t * 2];
5
- if (e === "dotted") return [t, t * 2];
1
+ import { resolveThemeColor as O } from "../utils/themeColor.js";
2
+ import { drawDashedPath as L } from "../utils/dashedLine.js";
3
+ function g(i, t) {
4
+ if (!(!i || i === "solid")) {
5
+ if (i === "dynamic") return [t * 4, t * 3];
6
+ if (i === "dashed") return [t * 4, t * 2];
7
+ if (i === "dotted") return [t, t * 2];
6
8
  }
7
9
  }
8
- function W(e, t, h = 3) {
9
- const n = [];
10
- for (let i = 0; i <= e; i += h) n.push({
11
- x: i,
10
+ function _(i, t, e = 3) {
11
+ const r = [];
12
+ for (let n = 0; n <= i; n += e) r.push({
13
+ x: n,
12
14
  y: 0
13
15
  });
14
- for (let i = h; i <= t; i += h) n.push({
15
- x: e,
16
- y: i
17
- });
18
- for (let i = e - h; i >= 0; i -= h) n.push({
16
+ for (let n = e; n <= t; n += e) r.push({
19
17
  x: i,
18
+ y: n
19
+ });
20
+ for (let n = i - e; n >= 0; n -= e) r.push({
21
+ x: n,
20
22
  y: t
21
23
  });
22
- for (let i = t - h; i > 0; i -= h) n.push({
24
+ for (let n = t - e; n > 0; n -= e) r.push({
23
25
  x: 0,
24
- y: i
26
+ y: n
25
27
  });
26
- return n.push({
28
+ return r.push({
27
29
  x: 0,
28
30
  y: 0
29
- }), n;
31
+ }), r;
30
32
  }
31
- function P(e, t, h, n = 3) {
32
- const i = [], a = Math.max(4, Math.ceil(Math.PI / 2 * h / n)), r = (s, l, c) => {
33
- for (let y = 0; y <= a; y++) {
34
- const p = c + Math.PI / 2 * (y / a);
35
- i.push({
36
- x: s + h * Math.cos(p),
37
- y: l + h * Math.sin(p)
33
+ function b(i, t, e, r = 3) {
34
+ const n = [], a = Math.max(4, Math.ceil(Math.PI / 2 * e / r)), s = (h, c, l) => {
35
+ for (let u = 0; u <= a; u++) {
36
+ const p = l + Math.PI / 2 * (u / a);
37
+ n.push({
38
+ x: h + e * Math.cos(p),
39
+ y: c + e * Math.sin(p)
38
40
  });
39
41
  }
40
42
  };
41
- return r(e - h, h, -Math.PI / 2), r(e - h, t - h, 0), r(h, t - h, Math.PI / 2), r(h, h, Math.PI), i.length > 0 && i.push(i[0]), i;
43
+ return s(i - e, e, -Math.PI / 2), s(i - e, t - e, 0), s(e, t - e, Math.PI / 2), s(e, e, Math.PI), n.length > 0 && n.push(n[0]), n;
42
44
  }
43
- function D(e, t, h, n, i = 60) {
45
+ function H(i, t, e, r, n = 60) {
44
46
  const a = [];
45
- for (let r = 0; r <= i; r++) {
46
- const s = Math.PI * 2 * r / i;
47
+ for (let s = 0; s <= n; s++) {
48
+ const h = Math.PI * 2 * s / n;
47
49
  a.push({
48
- x: e + h * Math.cos(s),
49
- y: t + n * Math.sin(s)
50
+ x: i + e * Math.cos(h),
51
+ y: t + r * Math.sin(h)
50
52
  });
51
53
  }
52
54
  return a;
53
55
  }
54
- function k(e, t, h, n, i, a) {
56
+ function R(i, t, e, r, n, a) {
55
57
  if (t.length < 2) return;
56
- const r = [0];
57
- for (let o = 1; o < t.length; o++) r.push(r[o - 1] + Math.hypot(t[o].x - t[o - 1].x, t[o].y - t[o - 1].y));
58
- const s = r[r.length - 1];
59
- if (s < 1) return;
60
- const l = h[0] + h[1];
61
- let c = -((n % l + l) % l), y = !0;
62
- const p = (o) => {
63
- if (o <= 0) return t[0];
64
- if (o >= s) return t[t.length - 1];
65
- let d = 0, w = r.length - 1;
66
- for (; d < w - 1; ) {
67
- const T = d + w >> 1;
68
- r[T] <= o ? d = T : w = T;
58
+ const s = [0];
59
+ for (let y = 1; y < t.length; y++) s.push(s[y - 1] + Math.hypot(t[y].x - t[y - 1].x, t[y].y - t[y - 1].y));
60
+ const h = s[s.length - 1];
61
+ if (h < 1) return;
62
+ const c = e[0] + e[1];
63
+ let l = -((r % c + c) % c), u = !0;
64
+ const p = (y) => {
65
+ if (y <= 0) return t[0];
66
+ if (y >= h) return t[t.length - 1];
67
+ let f = 0, o = s.length - 1;
68
+ for (; f < o - 1; ) {
69
+ const M = f + o >> 1;
70
+ s[M] <= y ? f = M : o = M;
69
71
  }
70
- const m = r[w] - r[d] > 0 ? (o - r[d]) / (r[w] - r[d]) : 0;
72
+ const d = s[o] - s[f] > 0 ? (y - s[f]) / (s[o] - s[f]) : 0;
71
73
  return {
72
- x: t[d].x + (t[w].x - t[d].x) * m,
73
- y: t[d].y + (t[w].y - t[d].y) * m
74
+ x: t[f].x + (t[o].x - t[f].x) * d,
75
+ y: t[f].y + (t[o].y - t[f].y) * d
74
76
  };
75
77
  };
76
- for (; c < s; ) {
77
- const o = y ? h[0] : h[1], d = Math.max(c, 0), w = Math.min(c + o, s);
78
- if (y && w > d) {
79
- const m = p(d);
80
- e.moveTo(m.x, m.y);
81
- for (let g = d + 2; g < w; g += 2) {
82
- const v = p(g);
83
- e.lineTo(v.x, v.y);
78
+ for (; l < h; ) {
79
+ const y = u ? e[0] : e[1], f = Math.max(l, 0), o = Math.min(l + y, h);
80
+ if (u && o > f) {
81
+ const d = p(f);
82
+ i.moveTo(d.x, d.y);
83
+ for (let w = f + 2; w < o; w += 2) {
84
+ const v = p(w);
85
+ i.lineTo(v.x, v.y);
84
86
  }
85
- const T = p(w);
86
- e.lineTo(T.x, T.y);
87
+ const M = p(o);
88
+ i.lineTo(M.x, M.y);
87
89
  }
88
- c += o, y = !y;
90
+ l += y, u = !u;
89
91
  }
90
- e.stroke({
91
- color: i,
92
+ i.stroke({
93
+ color: n,
92
94
  width: a,
93
95
  cap: "round"
94
96
  });
95
97
  }
96
- function f(e, t) {
97
- t.fill && t.fill !== "transparent" && e.fill({ color: t.fill }), t.borderStyle !== "none" && t.stroke && t.stroke !== "transparent" && t.strokeWidth > 0 && (M(t.borderStyle, t.strokeWidth) || e.stroke({
98
+ function x(i, t) {
99
+ t.fill && t.fill !== "transparent" && i.fill({ color: t.fill }), t.borderStyle !== "none" && t.stroke && t.stroke !== "transparent" && t.strokeWidth > 0 && (g(t.borderStyle, t.strokeWidth) || i.stroke({
98
100
  color: t.stroke,
99
101
  width: t.strokeWidth
100
102
  }));
101
103
  }
102
- function u(e, t, h) {
103
- const n = M(t.borderStyle, t.strokeWidth);
104
- !n || !t.stroke || t.stroke === "transparent" || t.strokeWidth <= 0 || k(e, h, n, t.borderStyle === "dynamic" ? t.dashOffset ?? 0 : 0, t.stroke, t.strokeWidth);
104
+ function m(i, t, e) {
105
+ const r = g(t.borderStyle, t.strokeWidth);
106
+ !r || !t.stroke || t.stroke === "transparent" || t.strokeWidth <= 0 || R(i, e, r, t.borderStyle === "dynamic" ? t.dashOffset ?? 0 : 0, t.stroke, t.strokeWidth);
105
107
  }
106
- function K(e, t, h) {
108
+ function rt(i, t, e) {
107
109
  if (t.borderStyle === "none" || !t.stroke || t.stroke === "transparent" || t.strokeWidth <= 0) return;
108
- const n = h ?? Math.min(12, t.width * 0.1, t.height * 0.1), i = M(t.borderStyle, t.strokeWidth);
109
- if (i) {
110
+ const r = e ?? Math.min(12, t.width * 0.1, t.height * 0.1), n = g(t.borderStyle, t.strokeWidth);
111
+ if (n) {
110
112
  const a = t.borderStyle === "dynamic" ? t.dashOffset ?? 0 : 0;
111
- k(e, P(t.width, t.height, n), i, a, t.stroke, t.strokeWidth);
112
- } else e.roundRect(0, 0, t.width, t.height, n).stroke({
113
+ R(i, b(t.width, t.height, r), n, a, t.stroke, t.strokeWidth);
114
+ } else i.roundRect(0, 0, t.width, t.height, r).stroke({
113
115
  color: t.stroke,
114
116
  width: t.strokeWidth
115
117
  });
116
118
  }
117
- function x(e) {
118
- return [...e, e[0]];
119
+ function T(i) {
120
+ return [...i, i[0]];
119
121
  }
120
- function R(e, t) {
121
- e.rect(0, 0, t.width, t.height), f(e, t), u(e, t, W(t.width, t.height));
122
+ function W(i, t) {
123
+ i.rect(0, 0, t.width, t.height), x(i, t), m(i, t, _(t.width, t.height));
122
124
  }
123
- function I(e, t) {
124
- const h = Math.min(12, t.width * 0.1, t.height * 0.1);
125
- e.roundRect(0, 0, t.width, t.height, h), f(e, t), u(e, t, P(t.width, t.height, h));
125
+ function G(i, t) {
126
+ const e = Math.min(12, t.width * 0.1, t.height * 0.1);
127
+ i.roundRect(0, 0, t.width, t.height, e), x(i, t), m(i, t, b(t.width, t.height, e));
126
128
  }
127
- function G(e, t) {
128
- e.ellipse(t.width / 2, t.height / 2, t.width / 2, t.height / 2), f(e, t), u(e, t, D(t.width / 2, t.height / 2, t.width / 2, t.height / 2));
129
+ function N(i, t) {
130
+ i.ellipse(t.width / 2, t.height / 2, t.width / 2, t.height / 2), x(i, t), m(i, t, H(t.width / 2, t.height / 2, t.width / 2, t.height / 2));
129
131
  }
130
- function C(e, t) {
131
- const h = t.width / 2, n = t.height / 2, i = [
132
+ function q(i, t) {
133
+ const e = t.width / 2, r = t.height / 2, n = [
132
134
  {
133
- x: h,
135
+ x: e,
134
136
  y: 0
135
137
  },
136
138
  {
137
139
  x: t.width,
138
- y: n
140
+ y: r
139
141
  },
140
142
  {
141
- x: h,
143
+ x: e,
142
144
  y: t.height
143
145
  },
144
146
  {
145
147
  x: 0,
146
- y: n
148
+ y: r
147
149
  }
148
150
  ];
149
- e.moveTo(h, 0).lineTo(t.width, n).lineTo(h, t.height).lineTo(0, n).closePath(), f(e, t), u(e, t, x(i));
151
+ i.moveTo(e, 0).lineTo(t.width, r).lineTo(e, t.height).lineTo(0, r).closePath(), x(i, t), m(i, t, T(n));
150
152
  }
151
- function H(e, t) {
152
- const h = t.width, n = t.height, i = n * 0.15;
153
- e.moveTo(0, 0).lineTo(h, 0).lineTo(h, n - i).bezierCurveTo(h * 0.75, n - i * 2, h * 0.25, n, 0, n - i).closePath(), f(e, t);
153
+ function A(i, t) {
154
+ const e = t.width, r = t.height, n = r * 0.15;
155
+ i.moveTo(0, 0).lineTo(e, 0).lineTo(e, r - n).bezierCurveTo(e * 0.75, r - n * 2, e * 0.25, r, 0, r - n).closePath(), x(i, t);
154
156
  const a = [
155
157
  {
156
158
  x: 0,
157
159
  y: 0
158
160
  },
159
161
  {
160
- x: h,
162
+ x: e,
161
163
  y: 0
162
164
  },
163
165
  {
164
- x: h,
165
- y: n - i
166
+ x: e,
167
+ y: r - n
166
168
  }
167
- ], r = 20;
168
- for (let s = 1; s <= r; s++) {
169
- const l = s / r, c = 1 - l;
169
+ ], s = 20;
170
+ for (let h = 1; h <= s; h++) {
171
+ const c = h / s, l = 1 - c;
170
172
  a.push({
171
- x: c * c * c * h + 3 * c * c * l * (h * 0.75) + 3 * c * l * l * (h * 0.25),
172
- y: c * c * c * (n - i) + 3 * c * c * l * (n - i * 2) + 3 * c * l * l * n + l * l * l * (n - i)
173
+ x: l * l * l * e + 3 * l * l * c * (e * 0.75) + 3 * l * c * c * (e * 0.25),
174
+ y: l * l * l * (r - n) + 3 * l * l * c * (r - n * 2) + 3 * l * c * c * r + c * c * c * (r - n)
173
175
  });
174
176
  }
175
177
  a.push({
176
178
  x: 0,
177
179
  y: 0
178
- }), u(e, t, a);
180
+ }), m(i, t, a);
179
181
  }
180
- function z(e, t) {
181
- const h = t.width * 0.2, n = [
182
+ function F(i, t) {
183
+ const e = t.width * 0.2, r = [
182
184
  {
183
- x: h,
185
+ x: e,
184
186
  y: 0
185
187
  },
186
188
  {
@@ -188,7 +190,7 @@ function z(e, t) {
188
190
  y: 0
189
191
  },
190
192
  {
191
- x: t.width - h,
193
+ x: t.width - e,
192
194
  y: t.height
193
195
  },
194
196
  {
@@ -196,10 +198,10 @@ function z(e, t) {
196
198
  y: t.height
197
199
  }
198
200
  ];
199
- e.moveTo(h, 0).lineTo(t.width, 0).lineTo(t.width - h, t.height).lineTo(0, t.height).closePath(), f(e, t), u(e, t, x(n));
201
+ i.moveTo(e, 0).lineTo(t.width, 0).lineTo(t.width - e, t.height).lineTo(0, t.height).closePath(), x(i, t), m(i, t, T(r));
200
202
  }
201
- function E(e, t) {
202
- const h = [
203
+ function K(i, t) {
204
+ const e = [
203
205
  {
204
206
  x: t.width / 2,
205
207
  y: 0
@@ -213,16 +215,16 @@ function E(e, t) {
213
215
  y: t.height
214
216
  }
215
217
  ];
216
- e.moveTo(t.width / 2, 0).lineTo(t.width, t.height).lineTo(0, t.height).closePath(), f(e, t), u(e, t, x(h));
218
+ i.moveTo(t.width / 2, 0).lineTo(t.width, t.height).lineTo(0, t.height).closePath(), x(i, t), m(i, t, T(e));
217
219
  }
218
- function L(e, t) {
219
- const h = t.width * 0.15, n = [
220
+ function Q(i, t) {
221
+ const e = t.width * 0.15, r = [
220
222
  {
221
- x: h,
223
+ x: e,
222
224
  y: 0
223
225
  },
224
226
  {
225
- x: t.width - h,
227
+ x: t.width - e,
226
228
  y: 0
227
229
  },
228
230
  {
@@ -234,55 +236,55 @@ function L(e, t) {
234
236
  y: t.height
235
237
  }
236
238
  ];
237
- e.moveTo(h, 0).lineTo(t.width - h, 0).lineTo(t.width, t.height).lineTo(0, t.height).closePath(), f(e, t), u(e, t, x(n));
239
+ i.moveTo(e, 0).lineTo(t.width - e, 0).lineTo(t.width, t.height).lineTo(0, t.height).closePath(), x(i, t), m(i, t, T(r));
238
240
  }
239
- function S(e, t, h, n, i, a) {
240
- const r = [];
241
- for (let s = 0; s < h; s++) {
242
- const l = Math.PI * 2 * s / h + a;
243
- r.push({
244
- x: e + n * Math.cos(l),
245
- y: t + i * Math.sin(l)
241
+ function B(i, t, e, r, n, a) {
242
+ const s = [];
243
+ for (let h = 0; h < e; h++) {
244
+ const c = Math.PI * 2 * h / e + a;
245
+ s.push({
246
+ x: i + r * Math.cos(c),
247
+ y: t + n * Math.sin(c)
246
248
  });
247
249
  }
248
- return r;
250
+ return s;
249
251
  }
250
- function O(e, t) {
251
- const h = t.width / 2, n = t.height / 2, i = Math.min(h, n), a = S(h, n, 5, i, i, -Math.PI / 2);
252
- for (let r = 0; r < a.length; r++) r === 0 ? e.moveTo(a[r].x, a[r].y) : e.lineTo(a[r].x, a[r].y);
253
- e.closePath(), f(e, t), u(e, t, x(a));
252
+ function Y(i, t) {
253
+ const e = t.width / 2, r = t.height / 2, n = Math.min(e, r), a = B(e, r, 5, n, n, -Math.PI / 2);
254
+ for (let s = 0; s < a.length; s++) s === 0 ? i.moveTo(a[s].x, a[s].y) : i.lineTo(a[s].x, a[s].y);
255
+ i.closePath(), x(i, t), m(i, t, T(a));
254
256
  }
255
- function B(e, t) {
256
- const h = t.width / 2, n = t.height / 2, i = S(h, n, 6, h, n, -Math.PI / 6);
257
- for (let a = 0; a < i.length; a++) a === 0 ? e.moveTo(i[a].x, i[a].y) : e.lineTo(i[a].x, i[a].y);
258
- e.closePath(), f(e, t), u(e, t, x(i));
257
+ function Z(i, t) {
258
+ const e = t.width / 2, r = t.height / 2, n = B(e, r, 6, e, r, -Math.PI / 6);
259
+ for (let a = 0; a < n.length; a++) a === 0 ? i.moveTo(n[a].x, n[a].y) : i.lineTo(n[a].x, n[a].y);
260
+ i.closePath(), x(i, t), m(i, t, T(n));
259
261
  }
260
- function F(e, t) {
261
- const h = t.width / 2, n = t.height / 2, i = Math.min(h, n), a = i * 0.4, r = 5, s = [];
262
- for (let l = 0; l < r * 2; l++) {
263
- const c = Math.PI * l / r - Math.PI / 2, y = l % 2 === 0 ? i : a;
264
- s.push({
265
- x: h + y * Math.cos(c),
266
- y: n + y * Math.sin(c)
262
+ function j(i, t) {
263
+ const e = t.width / 2, r = t.height / 2, n = Math.min(e, r), a = n * 0.4, s = 5, h = [];
264
+ for (let c = 0; c < s * 2; c++) {
265
+ const l = Math.PI * c / s - Math.PI / 2, u = c % 2 === 0 ? n : a;
266
+ h.push({
267
+ x: e + u * Math.cos(l),
268
+ y: r + u * Math.sin(l)
267
269
  });
268
270
  }
269
- for (let l = 0; l < s.length; l++) l === 0 ? e.moveTo(s[l].x, s[l].y) : e.lineTo(s[l].x, s[l].y);
270
- e.closePath(), f(e, t), u(e, t, x(s));
271
+ for (let c = 0; c < h.length; c++) c === 0 ? i.moveTo(h[c].x, h[c].y) : i.lineTo(h[c].x, h[c].y);
272
+ i.closePath(), x(i, t), m(i, t, T(h));
271
273
  }
272
- function j(e, t) {
273
- const h = t.width / 2, n = t.height / 2, i = Math.min(h, n), a = i * 0.55, r = [];
274
- for (let s = 0; s < 12; s++) {
275
- const l = Math.PI * s / 6 - Math.PI / 2, c = s % 2 === 0 ? i : a;
276
- r.push({
277
- x: h + c * Math.cos(l),
278
- y: n + c * Math.sin(l)
274
+ function J(i, t) {
275
+ const e = t.width / 2, r = t.height / 2, n = Math.min(e, r), a = n * 0.55, s = [];
276
+ for (let h = 0; h < 12; h++) {
277
+ const c = Math.PI * h / 6 - Math.PI / 2, l = h % 2 === 0 ? n : a;
278
+ s.push({
279
+ x: e + l * Math.cos(c),
280
+ y: r + l * Math.sin(c)
279
281
  });
280
282
  }
281
- for (let s = 0; s < r.length; s++) s === 0 ? e.moveTo(r[s].x, r[s].y) : e.lineTo(r[s].x, r[s].y);
282
- e.closePath(), f(e, t), u(e, t, x(r));
283
+ for (let h = 0; h < s.length; h++) h === 0 ? i.moveTo(s[h].x, s[h].y) : i.lineTo(s[h].x, s[h].y);
284
+ i.closePath(), x(i, t), m(i, t, T(s));
283
285
  }
284
- function q(e, t) {
285
- const h = [
286
+ function U(i, t) {
287
+ const e = [
286
288
  {
287
289
  x: 0,
288
290
  y: 0
@@ -296,10 +298,10 @@ function q(e, t) {
296
298
  y: t.height
297
299
  }
298
300
  ];
299
- e.moveTo(0, 0).lineTo(t.width, t.height).lineTo(0, t.height).closePath(), f(e, t), u(e, t, x(h));
301
+ i.moveTo(0, 0).lineTo(t.width, t.height).lineTo(0, t.height).closePath(), x(i, t), m(i, t, T(e));
300
302
  }
301
- function A(e, t) {
302
- const h = Math.min(t.width, t.height) * 0.4, n = [
303
+ function V(i, t) {
304
+ const e = Math.min(t.width, t.height) * 0.4, r = [
303
305
  {
304
306
  x: 0,
305
307
  y: 0
@@ -310,14 +312,14 @@ function A(e, t) {
310
312
  },
311
313
  {
312
314
  x: t.width,
313
- y: h
315
+ y: e
314
316
  },
315
317
  {
316
- x: h,
317
- y: h
318
+ x: e,
319
+ y: e
318
320
  },
319
321
  {
320
- x: h,
322
+ x: e,
321
323
  y: t.height
322
324
  },
323
325
  {
@@ -325,65 +327,298 @@ function A(e, t) {
325
327
  y: t.height
326
328
  }
327
329
  ];
328
- e.moveTo(0, 0).lineTo(t.width, 0).lineTo(t.width, h).lineTo(h, h).lineTo(h, t.height).lineTo(0, t.height).closePath(), f(e, t), u(e, t, x(n));
330
+ i.moveTo(0, 0).lineTo(t.width, 0).lineTo(t.width, e).lineTo(e, e).lineTo(e, t.height).lineTo(0, t.height).closePath(), x(i, t), m(i, t, T(r));
329
331
  }
330
- function b(e, t) {
331
- const h = Math.min(6, t.width * 0.04, t.height * 0.04);
332
- e.roundRect(0, 0, t.width, t.height, h), t.fill && t.fill !== "transparent" && e.fill({
332
+ function C(i, t) {
333
+ const e = Math.min(6, t.width * 0.04, t.height * 0.04);
334
+ i.roundRect(0, 0, t.width, t.height, e), t.fill && t.fill !== "transparent" && i.fill({
333
335
  color: t.fill,
334
336
  alpha: 0.08
335
337
  });
336
- const n = t.borderStyle ?? "dashed";
337
- if (n !== "none" && t.stroke && t.stroke !== "transparent" && t.strokeWidth > 0) {
338
- const i = M(n, t.strokeWidth);
339
- if (i) {
340
- const a = n === "dynamic" ? t.dashOffset ?? 0 : 0;
341
- k(e, P(t.width, t.height, h), i, a, t.stroke, t.strokeWidth);
342
- } else e.stroke({
338
+ const r = t.borderStyle ?? "dashed";
339
+ if (r !== "none" && t.stroke && t.stroke !== "transparent" && t.strokeWidth > 0) {
340
+ const n = g(r, t.strokeWidth);
341
+ if (n) {
342
+ const a = r === "dynamic" ? t.dashOffset ?? 0 : 0;
343
+ R(i, b(t.width, t.height, e), n, a, t.stroke, t.strokeWidth);
344
+ } else i.stroke({
343
345
  color: t.stroke,
344
346
  width: t.strokeWidth
345
347
  });
346
348
  }
347
349
  }
348
- var J = b, N = {
349
- shapeRect: R,
350
- shapeRoundRect: I,
351
- shapeEllipse: G,
352
- shapeDiamond: C,
353
- shapeDocument: H,
354
- shapeParallelogram: z,
355
- shapeTriangle: E,
356
- shapeTrapezoid: L,
357
- shapePentagon: O,
358
- shapeHexagon: B,
359
- shapeStar: F,
360
- shapeHexagram: j,
361
- shapeRightTriangle: q,
362
- shapeCorner: A,
363
- textLabel: R,
364
- flowGroup: b,
365
- geometryGroup: J,
366
- shapeSvg: I
350
+ var X = C, z = [
351
+ "top",
352
+ "right",
353
+ "bottom",
354
+ "left"
355
+ ], $ = /* @__PURE__ */ new Set([
356
+ "shapeRect",
357
+ "shapeRoundRect",
358
+ "shapeEllipse",
359
+ "shapeDiamond",
360
+ "shapeDocument",
361
+ "shapeParallelogram",
362
+ "shapeTrapezoid",
363
+ "mediaNode",
364
+ "flowGroup",
365
+ "geometryGroup"
366
+ ]);
367
+ function ht(i, t) {
368
+ if (t !== void 0 && !$.has(t)) return !1;
369
+ const e = i.borderSides;
370
+ return e ? z.some((r) => {
371
+ const n = e[r];
372
+ return !!n && (n.visible === !1 || n.color !== void 0 || n.width !== void 0);
373
+ }) : !1;
374
+ }
375
+ function tt(i, t, e) {
376
+ switch (i) {
377
+ case "shapeRoundRect":
378
+ return Math.min(12, t * 0.1, e * 0.1);
379
+ case "mediaNode":
380
+ return 6;
381
+ case "flowGroup":
382
+ case "geometryGroup":
383
+ return Math.min(6, t * 0.04, e * 0.04);
384
+ default:
385
+ return 0;
386
+ }
387
+ }
388
+ var k = 0.5522847498;
389
+ function et(i, t, e, r) {
390
+ const n = [], a = (o, d) => n.push({
391
+ type: "L",
392
+ x: o,
393
+ y: d
394
+ }), s = (o, d, M, w, v, P) => n.push({
395
+ type: "C",
396
+ cp1x: o,
397
+ cp1y: d,
398
+ cp2x: M,
399
+ cp2y: w,
400
+ x: v,
401
+ y: P
402
+ }), h = tt(i, t, e);
403
+ if (h >= 0.5) {
404
+ const o = k * h;
405
+ switch (r) {
406
+ case "top":
407
+ n.push({
408
+ type: "M",
409
+ x: 0,
410
+ y: h
411
+ }), s(0, h - o, h - o, 0, h, 0), a(t - h, 0);
412
+ break;
413
+ case "right":
414
+ n.push({
415
+ type: "M",
416
+ x: t - h,
417
+ y: 0
418
+ }), s(t - h + o, 0, t, h - o, t, h), a(t, e - h);
419
+ break;
420
+ case "bottom":
421
+ n.push({
422
+ type: "M",
423
+ x: t,
424
+ y: e - h
425
+ }), s(t, e - h + o, t - h + o, e, t - h, e), a(h, e);
426
+ break;
427
+ case "left":
428
+ n.push({
429
+ type: "M",
430
+ x: h,
431
+ y: e
432
+ }), s(h - o, e, 0, e - h + o, 0, e - h), a(0, h);
433
+ break;
434
+ }
435
+ return n;
436
+ }
437
+ if (i === "shapeEllipse") {
438
+ const o = t / 2, d = e / 2, M = t / 2, w = e / 2, [v, P] = {
439
+ top: [Math.PI * 1.25, Math.PI * 1.75],
440
+ right: [Math.PI * 1.75, Math.PI * 2.25],
441
+ bottom: [Math.PI * 0.25, Math.PI * 0.75],
442
+ left: [Math.PI * 0.75, Math.PI * 1.25]
443
+ }[r], I = o + M * Math.cos(v), S = d + w * Math.sin(v), D = o + M * Math.cos(P), E = d + w * Math.sin(P);
444
+ return n.push({
445
+ type: "M",
446
+ x: I,
447
+ y: S
448
+ }), s(I - k * M * Math.sin(v), S + k * w * Math.cos(v), D + k * M * Math.sin(P), E - k * w * Math.cos(P), D, E), n;
449
+ }
450
+ if (i === "shapeDocument") {
451
+ const o = e * 0.15;
452
+ return r === "top" ? (n.push({
453
+ type: "M",
454
+ x: 0,
455
+ y: 0
456
+ }), a(t, 0)) : r === "right" ? (n.push({
457
+ type: "M",
458
+ x: t,
459
+ y: 0
460
+ }), a(t, e - o)) : r === "bottom" ? (n.push({
461
+ type: "M",
462
+ x: t,
463
+ y: e - o
464
+ }), s(t * 0.75, e - o * 2, t * 0.25, e, 0, e - o)) : (n.push({
465
+ type: "M",
466
+ x: 0,
467
+ y: e - o
468
+ }), a(0, 0)), n;
469
+ }
470
+ let c, l, u, p;
471
+ if (i === "shapeDiamond") {
472
+ const o = t / 2, d = e / 2;
473
+ c = {
474
+ x: o,
475
+ y: 0
476
+ }, l = {
477
+ x: t,
478
+ y: d
479
+ }, u = {
480
+ x: o,
481
+ y: e
482
+ }, p = {
483
+ x: 0,
484
+ y: d
485
+ };
486
+ } else if (i === "shapeParallelogram") {
487
+ const o = t * 0.2;
488
+ c = {
489
+ x: o,
490
+ y: 0
491
+ }, l = {
492
+ x: t,
493
+ y: 0
494
+ }, u = {
495
+ x: t - o,
496
+ y: e
497
+ }, p = {
498
+ x: 0,
499
+ y: e
500
+ };
501
+ } else if (i === "shapeTrapezoid") {
502
+ const o = t * 0.15;
503
+ c = {
504
+ x: o,
505
+ y: 0
506
+ }, l = {
507
+ x: t - o,
508
+ y: 0
509
+ }, u = {
510
+ x: t,
511
+ y: e
512
+ }, p = {
513
+ x: 0,
514
+ y: e
515
+ };
516
+ } else
517
+ c = {
518
+ x: 0,
519
+ y: 0
520
+ }, l = {
521
+ x: t,
522
+ y: 0
523
+ }, u = {
524
+ x: t,
525
+ y: e
526
+ }, p = {
527
+ x: 0,
528
+ y: e
529
+ };
530
+ const [y, f] = {
531
+ top: [c, l],
532
+ right: [l, u],
533
+ bottom: [u, p],
534
+ left: [p, c]
535
+ }[r];
536
+ return n.push({
537
+ type: "M",
538
+ x: y.x,
539
+ y: y.y
540
+ }), a(f.x, f.y), n;
541
+ }
542
+ function st(i, t, e, r, n, a, s, h, c) {
543
+ if (h !== "none")
544
+ for (const l of z) {
545
+ const u = n?.[l];
546
+ if (u?.visible === !1) continue;
547
+ const p = O(u?.color, a) || a, y = u?.width ?? s;
548
+ if (!p || p === "transparent" || !(y > 0)) continue;
549
+ const f = et(t, e, r, l), o = g(h, y);
550
+ if (o)
551
+ L(i, f, o, h === "dynamic" ? c : 0), i.stroke({
552
+ color: p,
553
+ width: y,
554
+ cap: "round"
555
+ });
556
+ else {
557
+ for (const d of f) switch (d.type) {
558
+ case "M":
559
+ i.moveTo(d.x, d.y);
560
+ break;
561
+ case "L":
562
+ i.lineTo(d.x, d.y);
563
+ break;
564
+ case "C":
565
+ i.bezierCurveTo(d.cp1x, d.cp1y, d.cp2x, d.cp2y, d.x, d.y);
566
+ break;
567
+ case "Q":
568
+ i.quadraticCurveTo(d.cp1x, d.cp1y, d.x, d.y);
569
+ break;
570
+ }
571
+ i.stroke({
572
+ color: p,
573
+ width: y
574
+ });
575
+ }
576
+ }
577
+ }
578
+ var at = {
579
+ shapeRect: W,
580
+ shapeRoundRect: G,
581
+ shapeEllipse: N,
582
+ shapeDiamond: q,
583
+ shapeDocument: A,
584
+ shapeParallelogram: F,
585
+ shapeTriangle: K,
586
+ shapeTrapezoid: Q,
587
+ shapePentagon: Y,
588
+ shapeHexagon: Z,
589
+ shapeStar: j,
590
+ shapeHexagram: J,
591
+ shapeRightTriangle: U,
592
+ shapeCorner: V,
593
+ textLabel: W,
594
+ flowGroup: C,
595
+ geometryGroup: X,
596
+ shapeSvg: G
367
597
  };
368
598
  export {
369
- A as drawCorner,
370
- C as drawDiamond,
371
- H as drawDocument,
372
- G as drawEllipse,
373
- b as drawFlowGroup,
374
- J as drawGeometryGroup,
375
- B as drawHexagon,
376
- j as drawHexagram,
377
- z as drawParallelogram,
378
- O as drawPentagon,
379
- R as drawRect,
380
- q as drawRightTriangle,
381
- I as drawRoundRect,
382
- K as drawRoundRectBorder,
383
- F as drawStar,
384
- L as drawTrapezoid,
385
- E as drawTriangle,
386
- N as shapeDrawers
599
+ z as BORDER_SIDE_NAMES,
600
+ $ as BORDER_SIDE_TYPES,
601
+ et as buildBorderSideSegments,
602
+ st as drawBorderSides,
603
+ V as drawCorner,
604
+ q as drawDiamond,
605
+ A as drawDocument,
606
+ N as drawEllipse,
607
+ C as drawFlowGroup,
608
+ X as drawGeometryGroup,
609
+ Z as drawHexagon,
610
+ J as drawHexagram,
611
+ F as drawParallelogram,
612
+ Y as drawPentagon,
613
+ W as drawRect,
614
+ U as drawRightTriangle,
615
+ G as drawRoundRect,
616
+ rt as drawRoundRectBorder,
617
+ j as drawStar,
618
+ Q as drawTrapezoid,
619
+ K as drawTriangle,
620
+ ht as hasBorderSideOverrides,
621
+ at as shapeDrawers
387
622
  };
388
623
 
389
624
  //# sourceMappingURL=shapes.js.map