dishui 0.0.57 → 0.0.59
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/components/pro/Flow/Flow.js +460 -436
- package/dist/components/pro/Flow/Flow.js.map +1 -1
- package/dist/components/pro/Flow/FlowCanvas.js +921 -903
- package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
- package/dist/components/pro/Flow/nodes/nodeUtils.d.ts +2 -2
- package/dist/components/pro/Flow/nodes/nodeUtils.js +12 -12
- package/dist/components/pro/Flow/nodes/nodeUtils.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,8 +9,8 @@ export declare function getFlipScale(data: FlowNodeData): {
|
|
|
9
9
|
sy: number;
|
|
10
10
|
};
|
|
11
11
|
export declare function generateId(prefix?: string): string;
|
|
12
|
-
/** Check if a point is within a node's bounding box */
|
|
13
|
-
export declare function isPointInNode(px: number, py: number, node: FlowNode): boolean;
|
|
12
|
+
/** Check if a point is within a node's bounding box (optionally padded) */
|
|
13
|
+
export declare function isPointInNode(px: number, py: number, node: FlowNode, pad?: number): boolean;
|
|
14
14
|
/** Check if two axis-aligned rects overlap */
|
|
15
15
|
export declare function rectsOverlap(ax: number, ay: number, aw: number, ah: number, bx: number, by: number, bw: number, bh: number): boolean;
|
|
16
16
|
/** Shortest distance from point (px,py) to line segment (ax,ay)-(bx,by) */
|
|
@@ -11,26 +11,26 @@ var s = 0;
|
|
|
11
11
|
function M(t = "flow") {
|
|
12
12
|
return `${t}_${Date.now().toString(36)}_${(++s).toString(36)}`;
|
|
13
13
|
}
|
|
14
|
-
function S(t, o, n) {
|
|
15
|
-
const { x:
|
|
16
|
-
return t >=
|
|
14
|
+
function S(t, r, o, n = 0) {
|
|
15
|
+
const { x: i, y: e } = o.position;
|
|
16
|
+
return t >= i - n && t <= i + o.width + n && r >= e - n && r <= e + o.height + n;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return t < i +
|
|
18
|
+
function m(t, r, o, n, i, e, u, c) {
|
|
19
|
+
return t < i + u && t + o > i && r < e + c && r + n > e;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
if (f === 0) return Math.hypot(t -
|
|
24
|
-
const h = Math.max(0, Math.min(1, ((t -
|
|
25
|
-
return Math.hypot(t - (
|
|
21
|
+
function w(t, r, o, n, i, e) {
|
|
22
|
+
const u = i - o, c = e - n, f = u * u + c * c;
|
|
23
|
+
if (f === 0) return Math.hypot(t - o, r - n);
|
|
24
|
+
const h = Math.max(0, Math.min(1, ((t - o) * u + (r - n) * c) / f));
|
|
25
|
+
return Math.hypot(t - (o + h * u), r - (n + h * c));
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
w as distToSegment,
|
|
29
29
|
M as generateId,
|
|
30
30
|
l as getFlipScale,
|
|
31
31
|
g as getRotationRad,
|
|
32
32
|
S as isPointInNode,
|
|
33
|
-
|
|
33
|
+
m as rectsOverlap
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
//# sourceMappingURL=nodeUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeUtils.js","names":[],"sources":["../../../../../src/components/pro/Flow/nodes/nodeUtils.ts"],"sourcesContent":["import type { FlowNodeData, FlowNode } from '../types';\n\n/** Get CSS-parseable color number from hex string */\nexport function colorToNumber(hex: string): number {\n if (!hex || hex === 'transparent') return 0x000000;\n const clean = hex.replace('#', '');\n return parseInt(clean, 16) || 0x000000;\n}\n\n/** Compute rotation transform in radians */\nexport function getRotationRad(data: FlowNodeData): number {\n return ((data.rotation ?? 0) * Math.PI) / 180;\n}\n\n/** Compute scale for flip */\nexport function getFlipScale(data: FlowNodeData): { sx: number; sy: number } {\n return {\n sx: data.flipX ? -1 : 1,\n sy: data.flipY ? -1 : 1,\n };\n}\n\n/** Generate a unique ID */\nlet _counter = 0;\nexport function generateId(prefix = 'flow'): string {\n return `${prefix}_${Date.now().toString(36)}_${(++_counter).toString(36)}`;\n}\n\n/** Check if a point is within a node's bounding box */\nexport function isPointInNode(\n px: number,\n py: number,\n node: FlowNode,\n): boolean {\n const { x, y } = node.position;\n return px >= x && px <= x + node.width && py >= y && py <= y + node.height;\n}\n\n/** Check if two axis-aligned rects overlap */\nexport function rectsOverlap(\n ax: number, ay: number, aw: number, ah: number,\n bx: number, by: number, bw: number, bh: number,\n): boolean {\n return ax < bx + bw && ax + aw > bx && ay < by + bh && ay + ah > by;\n}\n\n/** Shortest distance from point (px,py) to line segment (ax,ay)-(bx,by) */\nexport function distToSegment(\n px: number, py: number,\n ax: number, ay: number,\n bx: number, by: number,\n): number {\n const dx = bx - ax, dy = by - ay;\n const lenSq = dx * dx + dy * dy;\n if (lenSq === 0) return Math.hypot(px - ax, py - ay);\n const t = Math.max(0, Math.min(1, ((px - ax) * dx + (py - ay) * dy) / lenSq));\n return Math.hypot(px - (ax + t * dx), py - (ay + t * dy));\n}\n"],"mappings":"AAUA,SAAgB,EAAe,GAA4B;AACzD,UAAS,EAAK,YAAY,KAAK,KAAK,KAAM;AAC5C;AAGA,SAAgB,EAAa,GAAgD;AAC3E,SAAO;AAAA,IACL,IAAI,EAAK,QAAQ,KAAK;AAAA,IACtB,IAAI,EAAK,QAAQ,KAAK;AAAA,EACxB;AACF;AAGA,IAAI,IAAW;AACf,SAAgB,EAAW,IAAS,QAAgB;AAClD,SAAO,GAAG,CAAA,IAAU,KAAK,IAAI,EAAE,SAAS,EAAE,CAAA,KAAM,EAAE,GAAU,SAAS,EAAE,CAAA;AACzE;AAGA,SAAgB,EACd,GACA,GACA,
|
|
1
|
+
{"version":3,"file":"nodeUtils.js","names":[],"sources":["../../../../../src/components/pro/Flow/nodes/nodeUtils.ts"],"sourcesContent":["import type { FlowNodeData, FlowNode } from '../types';\n\n/** Get CSS-parseable color number from hex string */\nexport function colorToNumber(hex: string): number {\n if (!hex || hex === 'transparent') return 0x000000;\n const clean = hex.replace('#', '');\n return parseInt(clean, 16) || 0x000000;\n}\n\n/** Compute rotation transform in radians */\nexport function getRotationRad(data: FlowNodeData): number {\n return ((data.rotation ?? 0) * Math.PI) / 180;\n}\n\n/** Compute scale for flip */\nexport function getFlipScale(data: FlowNodeData): { sx: number; sy: number } {\n return {\n sx: data.flipX ? -1 : 1,\n sy: data.flipY ? -1 : 1,\n };\n}\n\n/** Generate a unique ID */\nlet _counter = 0;\nexport function generateId(prefix = 'flow'): string {\n return `${prefix}_${Date.now().toString(36)}_${(++_counter).toString(36)}`;\n}\n\n/** Check if a point is within a node's bounding box (optionally padded) */\nexport function isPointInNode(\n px: number,\n py: number,\n node: FlowNode,\n pad = 0,\n): boolean {\n const { x, y } = node.position;\n return px >= x - pad && px <= x + node.width + pad && py >= y - pad && py <= y + node.height + pad;\n}\n\n/** Check if two axis-aligned rects overlap */\nexport function rectsOverlap(\n ax: number, ay: number, aw: number, ah: number,\n bx: number, by: number, bw: number, bh: number,\n): boolean {\n return ax < bx + bw && ax + aw > bx && ay < by + bh && ay + ah > by;\n}\n\n/** Shortest distance from point (px,py) to line segment (ax,ay)-(bx,by) */\nexport function distToSegment(\n px: number, py: number,\n ax: number, ay: number,\n bx: number, by: number,\n): number {\n const dx = bx - ax, dy = by - ay;\n const lenSq = dx * dx + dy * dy;\n if (lenSq === 0) return Math.hypot(px - ax, py - ay);\n const t = Math.max(0, Math.min(1, ((px - ax) * dx + (py - ay) * dy) / lenSq));\n return Math.hypot(px - (ax + t * dx), py - (ay + t * dy));\n}\n"],"mappings":"AAUA,SAAgB,EAAe,GAA4B;AACzD,UAAS,EAAK,YAAY,KAAK,KAAK,KAAM;AAC5C;AAGA,SAAgB,EAAa,GAAgD;AAC3E,SAAO;AAAA,IACL,IAAI,EAAK,QAAQ,KAAK;AAAA,IACtB,IAAI,EAAK,QAAQ,KAAK;AAAA,EACxB;AACF;AAGA,IAAI,IAAW;AACf,SAAgB,EAAW,IAAS,QAAgB;AAClD,SAAO,GAAG,CAAA,IAAU,KAAK,IAAI,EAAE,SAAS,EAAE,CAAA,KAAM,EAAE,GAAU,SAAS,EAAE,CAAA;AACzE;AAGA,SAAgB,EACd,GACA,GACA,GACA,IAAM,GACG;AACT,QAAM,EAAE,GAAA,GAAG,GAAA,EAAA,IAAM,EAAK;AACtB,SAAO,KAAM,IAAI,KAAO,KAAM,IAAI,EAAK,QAAQ,KAAO,KAAM,IAAI,KAAO,KAAM,IAAI,EAAK,SAAS;AACjG;AAGA,SAAgB,EACd,GAAY,GAAY,GAAY,GACpC,GAAY,GAAY,GAAY,GAC3B;AACT,SAAO,IAAK,IAAK,KAAM,IAAK,IAAK,KAAM,IAAK,IAAK,KAAM,IAAK,IAAK;AACnE;AAGA,SAAgB,EACd,GAAY,GACZ,GAAY,GACZ,GAAY,GACJ;AACR,QAAM,IAAK,IAAK,GAAI,IAAK,IAAK,GACxB,IAAQ,IAAK,IAAK,IAAK;AAC7B,MAAI,MAAU,EAAG,QAAO,KAAK,MAAM,IAAK,GAAI,IAAK,CAAE;AACnD,QAAM,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,IAAK,KAAM,KAAM,IAAK,KAAM,KAAM,CAAK,CAAC;AAC5E,SAAO,KAAK,MAAM,KAAM,IAAK,IAAI,IAAK,KAAM,IAAK,IAAI,EAAG;AAC1D"}
|