stickyflow 0.7.0 → 0.8.0
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/CHANGELOG.md +12 -0
- package/dist/binding/index.cjs +9 -9
- package/dist/binding/index.d.cts +4 -4
- package/dist/binding/index.d.ts +4 -4
- package/dist/binding/index.js +3 -3
- package/dist/{chunk-JCRPLPKV.js → chunk-CZW3ARXQ.js} +4 -4
- package/dist/{chunk-JCRPLPKV.js.map → chunk-CZW3ARXQ.js.map} +1 -1
- package/dist/{chunk-MUKIGLR5.js → chunk-EDOPENSE.js} +169 -42
- package/dist/chunk-EDOPENSE.js.map +1 -0
- package/dist/{chunk-EKAWJFJQ.cjs → chunk-FQ7GMLCM.cjs} +15 -15
- package/dist/{chunk-EKAWJFJQ.cjs.map → chunk-FQ7GMLCM.cjs.map} +1 -1
- package/dist/{chunk-JQK4IGXJ.js → chunk-GLZVHUSW.js} +50 -6
- package/dist/chunk-GLZVHUSW.js.map +1 -0
- package/dist/{chunk-BUOWM3LC.cjs → chunk-IR2T47NW.cjs} +198 -71
- package/dist/chunk-IR2T47NW.cjs.map +1 -0
- package/dist/{chunk-ZNHYW47T.js → chunk-LFEGZJWC.js} +3 -3
- package/dist/{chunk-ZNHYW47T.js.map → chunk-LFEGZJWC.js.map} +1 -1
- package/dist/{chunk-KXYSO6GC.cjs → chunk-LNW5VIEA.cjs} +53 -5
- package/dist/chunk-LNW5VIEA.cjs.map +1 -0
- package/dist/{chunk-SDMQRSRW.js → chunk-MAPNY7MJ.js} +331 -125
- package/dist/chunk-MAPNY7MJ.js.map +1 -0
- package/dist/{chunk-A73UJ5AQ.cjs → chunk-VOYX6JMW.cjs} +950 -744
- package/dist/chunk-VOYX6JMW.cjs.map +1 -0
- package/dist/{chunk-OWNVXKXN.cjs → chunk-XPM3E7NV.cjs} +23 -23
- package/dist/{chunk-OWNVXKXN.cjs.map → chunk-XPM3E7NV.cjs.map} +1 -1
- package/dist/index.cjs +36 -36
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/interaction/index.cjs +266 -235
- package/dist/interaction/index.cjs.map +1 -1
- package/dist/interaction/index.d.cts +2 -2
- package/dist/interaction/index.d.ts +2 -2
- package/dist/interaction/index.js +42 -11
- package/dist/interaction/index.js.map +1 -1
- package/dist/{render-BU2uYzjG.d.cts → render-Bp2FLEzv.d.cts} +10 -0
- package/dist/{render-BU2uYzjG.d.ts → render-Bp2FLEzv.d.ts} +10 -0
- package/dist/{runtime-BPzyD-Nd.d.ts → runtime-CWIGxRcL.d.ts} +2 -2
- package/dist/{runtime-B7KiTmn8.d.cts → runtime-DIag-XBa.d.cts} +2 -2
- package/dist/{runtimeTypes-BIP70z72.d.cts → runtimeTypes-BYODuxHk.d.cts} +1 -1
- package/dist/{runtimeTypes-DalvhScn.d.ts → runtimeTypes-C7sSLfOK.d.ts} +1 -1
- package/dist/stickyflow-diagram.global.js +141 -38
- package/dist/stickyflow-diagram.global.js.map +1 -1
- package/dist/{types-DMWs27Hn.d.ts → types-B9QM_H3R.d.ts} +1 -1
- package/dist/{types-D_2NZ6lL.d.cts → types-D2w6D_wG.d.cts} +1 -1
- package/dist/viewer/index.cjs +9 -9
- package/dist/viewer/index.d.cts +4 -4
- package/dist/viewer/index.d.ts +4 -4
- package/dist/viewer/index.js +4 -4
- package/dist/web-component/index.cjs +6 -6
- package/dist/web-component/index.d.cts +2 -2
- package/dist/web-component/index.d.ts +2 -2
- package/dist/web-component/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-A73UJ5AQ.cjs.map +0 -1
- package/dist/chunk-BUOWM3LC.cjs.map +0 -1
- package/dist/chunk-JQK4IGXJ.js.map +0 -1
- package/dist/chunk-KXYSO6GC.cjs.map +0 -1
- package/dist/chunk-MUKIGLR5.js.map +0 -1
- package/dist/chunk-SDMQRSRW.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as OwnerRef, E as Emitter$1, V as Viewer, U as Unsubscribe } from '../types-
|
|
2
|
-
import { Z as Side, I as IsometricFace } from '../render-
|
|
1
|
+
import { O as OwnerRef, E as Emitter$1, V as Viewer, U as Unsubscribe } from '../types-D2w6D_wG.cjs';
|
|
2
|
+
import { Z as Side, I as IsometricFace } from '../render-Bp2FLEzv.cjs';
|
|
3
3
|
|
|
4
4
|
interface TextChangeEvent {
|
|
5
5
|
owner: OwnerRef;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as OwnerRef, E as Emitter$1, V as Viewer, U as Unsubscribe } from '../types-
|
|
2
|
-
import { Z as Side, I as IsometricFace } from '../render-
|
|
1
|
+
import { O as OwnerRef, E as Emitter$1, V as Viewer, U as Unsubscribe } from '../types-B9QM_H3R.js';
|
|
2
|
+
import { Z as Side, I as IsometricFace } from '../render-Bp2FLEzv.js';
|
|
3
3
|
|
|
4
4
|
interface TextChangeEvent {
|
|
5
5
|
owner: OwnerRef;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { screenRectOf, Emitter, resolveOwner, isCameraGesture, pointerUserPoint, clearAlignmentGuides, updateAlignmentGuides, pxPerUnit, findOwnerNode, isPrimary, SVG_NAMESPACE, isTextLabel, findSnapCandidateBounds, symbolDeclaredBounds, updateQuickDuplicateBubbles, isometricGeometryOf, ISO_HALO_ATTR, ISO_DUPLICATE_BUBBLES_ATTR, updateHalo, axisArrowPlacements, updateAxisArrowGroup, PATH_HALO_ATTR, findAllOwnerNodes, findIsometricApexCandidates, DERIVED_HEIGHT_ROLES, resizeHandlePositions, pathGeometryOf } from '../chunk-
|
|
2
|
-
import { sflToCanvasState, isIsometricObject, tokenizeSource, roundedOrthogonalPathData, seriesLabelOffsetXProp, seriesLabelOffsetYProp, radarVertexPoint, AXIS_SIN, AXIS_COS, freeformPathData, CORNER_RADIUS_ATTR, isometricFaces, roundedPolygonPath, isometricTopFaceCenter, calculateLinkRoute, pointAtPort, roundedBarPath, barShapePath, formatBarLabel, LABEL_WIDTH, LEADER_INSET, clipSegmentToRect, radarValueAtPoint, radarSeriesPath, estimateTextWidth, wrapText, personLabelArea, isometricFaceCenter, PATH_POINT_INDEX_ATTR, linePathData, barLabelSize, BAR_LABEL, pillPath, getLineMidpoint, labelGapDash, pillCornerRadius, SQUARE_CORNER_ATTR, cornersRoundedRectPath, localShapePath, relativeOffsetOnRectangleSide, edgePointToward, SYMBOL_POINTS_ATTR, SYMBOL_TENSION_ATTR } from '../chunk-
|
|
1
|
+
import { screenRectOf, Emitter, resolveOwner, isCameraGesture, pointerUserPoint, clearAlignmentGuides, updateAlignmentGuides, pxPerUnit, findOwnerNode, isPrimary, SVG_NAMESPACE, isTextLabel, findSnapCandidateBounds, symbolDeclaredBounds, updateQuickDuplicateBubbles, isometricGeometryOf, ISO_HALO_ATTR, ISO_DUPLICATE_BUBBLES_ATTR, updateHalo, axisArrowPlacements, updateAxisArrowGroup, PATH_HALO_ATTR, findAllOwnerNodes, findIsometricApexCandidates, DERIVED_HEIGHT_ROLES, resizeHandlePositions, pathGeometryOf } from '../chunk-LFEGZJWC.js';
|
|
2
|
+
import { sflToCanvasState, isIsometricObject, tokenizeSource, roundedOrthogonalPathData, seriesLabelOffsetXProp, seriesLabelOffsetYProp, radarVertexPoint, AXIS_SIN, AXIS_COS, freeformPathData, CORNER_RADIUS_ATTR, isometricFaces, roundedPolygonPath, isometricTopFaceCenter, calculateLinkRoute, pointAtPort, roundedBarPath, barShapePath, formatBarLabel, LABEL_WIDTH, LEADER_INSET, clipSegmentToRect, radarValueAtPoint, radarSeriesPath, estimateTextWidth, wrapText, personLabelArea, isometricFaceCenter, PATH_POINT_INDEX_ATTR, linePathData, barLabelSize, BAR_LABEL, pillPath, getLineMidpoint, labelGapDash, pillCornerRadius, SQUARE_CORNER_ATTR, cornersRoundedRectPath, localShapePath, relativeOffsetOnRectangleSide, edgePointToward, SYMBOL_POINTS_ATTR, SYMBOL_TENSION_ATTR } from '../chunk-GLZVHUSW.js';
|
|
3
3
|
|
|
4
4
|
// src/runtime/interaction/chartValue/coordinates.ts
|
|
5
5
|
function pointerUserY(svg, event) {
|
|
@@ -2175,6 +2175,12 @@ var SNAP_ATTR = "data-sf-snap";
|
|
|
2175
2175
|
function isSnapDisabled(svg) {
|
|
2176
2176
|
return svg.getAttribute(SNAP_ATTR) === "off";
|
|
2177
2177
|
}
|
|
2178
|
+
var SNAP_DISTANCE_ATTR = "data-sf-snap-distance";
|
|
2179
|
+
var DEFAULT_SNAP_DISTANCE_PX = 20;
|
|
2180
|
+
function snapDistancePx(svg) {
|
|
2181
|
+
const value = Number(svg.getAttribute(SNAP_DISTANCE_ATTR));
|
|
2182
|
+
return value > 0 ? value : DEFAULT_SNAP_DISTANCE_PX;
|
|
2183
|
+
}
|
|
2178
2184
|
var ISOMETRIC_GRID = /^isometric:(\d+(?:\.\d+)?)$/;
|
|
2179
2185
|
function readIsometricSnapStep(svg) {
|
|
2180
2186
|
const match = ISOMETRIC_GRID.exec(svg.getAttribute(SNAP_GRID_ATTR) ?? "");
|
|
@@ -3501,7 +3507,6 @@ function applyAxisSnap(bounds, moveX, moveY, snap, minSize) {
|
|
|
3501
3507
|
var MOVE_ACTIVE_POINTS = ["min", "center", "max"];
|
|
3502
3508
|
|
|
3503
3509
|
// src/runtime/interaction/move/snapping.ts
|
|
3504
|
-
var SNAP_THRESHOLD_PX = 20;
|
|
3505
3510
|
var GUIDE_OVERHANG2 = 10;
|
|
3506
3511
|
function isometricApexOf(svg, drag, declared = false) {
|
|
3507
3512
|
if (drag.canvasObjects.length !== 1) {
|
|
@@ -3535,7 +3540,7 @@ function snapIsometricMove(svg, drag, rawDx, rawDy) {
|
|
|
3535
3540
|
}
|
|
3536
3541
|
const excludedIds = new Set(drag.canvasObjects.map((canvasObject) => canvasObject.owner.id));
|
|
3537
3542
|
const candidates = findIsometricApexCandidates(svg, excludedIds);
|
|
3538
|
-
const snap = snapIsometricDiagonal(apex, rawDx, rawDy, candidates,
|
|
3543
|
+
const snap = snapIsometricDiagonal(apex, rawDx, rawDy, candidates, snapDistancePx(svg) / pxPerUnit(svg));
|
|
3539
3544
|
return snap ? { dx: snap.dx, dy: snap.dy, guides: [snap.guide] } : null;
|
|
3540
3545
|
}
|
|
3541
3546
|
function snapMove(svg, drag, rawDx, rawDy) {
|
|
@@ -3554,7 +3559,7 @@ function snapMove(svg, drag, rawDx, rawDy) {
|
|
|
3554
3559
|
const excludedIds = new Set(drag.canvasObjects.map((canvasObject) => canvasObject.owner.id));
|
|
3555
3560
|
const candidates = nearestCandidates(leadBounds, findSnapCandidateBounds(svg, excludedIds));
|
|
3556
3561
|
const snap = computeSnap(leadBounds, candidates, {
|
|
3557
|
-
threshold:
|
|
3562
|
+
threshold: snapDistancePx(svg) / pxPerUnit(svg),
|
|
3558
3563
|
activeX: MOVE_ACTIVE_POINTS,
|
|
3559
3564
|
activeY: MOVE_ACTIVE_POINTS,
|
|
3560
3565
|
guideOverhang: GUIDE_OVERHANG2
|
|
@@ -5396,6 +5401,30 @@ var HANDLE_AXES = {
|
|
|
5396
5401
|
"bottom-left": { x: "left", y: "bottom" },
|
|
5397
5402
|
left: { x: "left", y: "none" }
|
|
5398
5403
|
};
|
|
5404
|
+
var ROUND_CHARTS = /* @__PURE__ */ new Set(["pie", "radar", "radial", "radialBar", "polarArea"]);
|
|
5405
|
+
function keepsProportions(drag, shift) {
|
|
5406
|
+
return shift || drag.owner.role === "chart" && drag.kind !== null && ROUND_CHARTS.has(drag.kind);
|
|
5407
|
+
}
|
|
5408
|
+
function lockAspect(bounds, start, handle) {
|
|
5409
|
+
const ratio2 = start.width / start.height;
|
|
5410
|
+
const axes = HANDLE_AXES[handle];
|
|
5411
|
+
let width = bounds.width;
|
|
5412
|
+
let height = bounds.height;
|
|
5413
|
+
if (axes.x === "none") {
|
|
5414
|
+
width = height * ratio2;
|
|
5415
|
+
} else if (axes.y === "none") {
|
|
5416
|
+
height = width / ratio2;
|
|
5417
|
+
} else if (width / start.width > height / start.height) {
|
|
5418
|
+
height = width / ratio2;
|
|
5419
|
+
} else {
|
|
5420
|
+
width = height * ratio2;
|
|
5421
|
+
}
|
|
5422
|
+
width = Math.max(MIN_SIZE2, width);
|
|
5423
|
+
height = Math.max(MIN_SIZE2, height);
|
|
5424
|
+
const x = axes.x === "left" ? start.x + start.width - width : axes.x === "none" ? start.x + (start.width - width) / 2 : start.x;
|
|
5425
|
+
const y = axes.y === "top" ? start.y + start.height - height : axes.y === "none" ? start.y + (start.height - height) / 2 : start.y;
|
|
5426
|
+
return { x, y, width, height };
|
|
5427
|
+
}
|
|
5399
5428
|
function resizedBounds(start, handle, pointer) {
|
|
5400
5429
|
const axes = HANDLE_AXES[handle];
|
|
5401
5430
|
let x = start.x, width = start.width;
|
|
@@ -5658,7 +5687,6 @@ function applyResizePreview(drag, bounds) {
|
|
|
5658
5687
|
}
|
|
5659
5688
|
|
|
5660
5689
|
// src/runtime/interaction/resize/snapping.ts
|
|
5661
|
-
var SNAP_THRESHOLD_PX2 = 20;
|
|
5662
5690
|
var GUIDE_OVERHANG3 = 10;
|
|
5663
5691
|
function snapResize(svg, drag, pointer) {
|
|
5664
5692
|
const proposed = resizedBounds(drag.startBounds, drag.handle, pointer);
|
|
@@ -5676,7 +5704,7 @@ function snapResize(svg, drag, pointer) {
|
|
|
5676
5704
|
const axes = HANDLE_AXES[drag.handle];
|
|
5677
5705
|
const candidates = nearestCandidates(proposed, findSnapCandidateBounds(svg, /* @__PURE__ */ new Set([drag.owner.id])));
|
|
5678
5706
|
const snap = computeSnap(proposed, candidates, {
|
|
5679
|
-
threshold:
|
|
5707
|
+
threshold: snapDistancePx(svg) / pxPerUnit(svg),
|
|
5680
5708
|
activeX: resizeActivePoints(axes.x),
|
|
5681
5709
|
activeY: resizeActivePoints(axes.y),
|
|
5682
5710
|
guideOverhang: GUIDE_OVERHANG3
|
|
@@ -5809,7 +5837,9 @@ var ResizeSession = class {
|
|
|
5809
5837
|
return;
|
|
5810
5838
|
}
|
|
5811
5839
|
drag.moved = true;
|
|
5812
|
-
const
|
|
5840
|
+
const snapped = snapResize(this.#svg, drag, resizePointerPosition(this.#svg, event));
|
|
5841
|
+
const bounds = keepsProportions(drag, event.shiftKey) ? lockAspect(snapped.bounds, drag.startBounds, drag.handle) : snapped.bounds;
|
|
5842
|
+
const { guides } = snapped;
|
|
5813
5843
|
applyResizePreview(drag, clampResizeToChildren(bounds, drag.childrenBounds));
|
|
5814
5844
|
updateAlignmentGuides(this.#svg, guides, RESIZE_GUIDE_COLOR);
|
|
5815
5845
|
};
|
|
@@ -5824,7 +5854,8 @@ var ResizeSession = class {
|
|
|
5824
5854
|
if (!drag.moved) {
|
|
5825
5855
|
return;
|
|
5826
5856
|
}
|
|
5827
|
-
const
|
|
5857
|
+
const snapped = snapResize(this.#svg, drag, resizePointerPosition(this.#svg, event)).bounds;
|
|
5858
|
+
const bounds = keepsProportions(drag, event.shiftKey) ? lockAspect(snapped, drag.startBounds, drag.handle) : snapped;
|
|
5828
5859
|
emitResizeCompletion(this.#emitter, drag, clampResizeToChildren(bounds, drag.childrenBounds));
|
|
5829
5860
|
};
|
|
5830
5861
|
cancel() {
|
|
@@ -6016,7 +6047,7 @@ function resolveSankeyNodeDrag(svg, event) {
|
|
|
6016
6047
|
|
|
6017
6048
|
// src/runtime/interaction/sankeyNode/session.ts
|
|
6018
6049
|
var MOVE_NOISE3 = 2;
|
|
6019
|
-
var
|
|
6050
|
+
var SNAP_THRESHOLD_PX = 20;
|
|
6020
6051
|
var GUIDE_OVERHANG4 = 10;
|
|
6021
6052
|
var GUIDE_COLOR3 = "#8b5cf6";
|
|
6022
6053
|
var SankeyNodeDragSession = class {
|
|
@@ -6052,7 +6083,7 @@ var SankeyNodeDragSession = class {
|
|
|
6052
6083
|
const leadBounds = offsetBounds(drag.originalBounds, rawDx, rawDy);
|
|
6053
6084
|
const candidates = nearestCandidates(leadBounds, drag.siblingBounds);
|
|
6054
6085
|
const snap = computeSnap(leadBounds, candidates, {
|
|
6055
|
-
threshold:
|
|
6086
|
+
threshold: SNAP_THRESHOLD_PX / pxPerUnit(this.#svg),
|
|
6056
6087
|
activeX: MOVE_ACTIVE_POINTS,
|
|
6057
6088
|
activeY: MOVE_ACTIVE_POINTS,
|
|
6058
6089
|
guideOverhang: GUIDE_OVERHANG4
|