@flowdrop/flowdrop 2.10.0 → 2.10.1
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 +13 -0
- package/dist/components/CanvasController.svelte +1 -1
- package/dist/components/EdgeRefresher.svelte +1 -1
- package/dist/components/FlowDropZone.svelte +11 -7
- package/dist/components/FlowDropZone.svelte.d.ts +12 -0
- package/dist/components/PortCoordinateTracker.svelte +1 -1
- package/dist/components/WorkflowEditor.svelte +138 -138
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.10.1] - 2026-10-07
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- With `@xyflow/svelte` 1.6.6 or later, the context menu's Delete did nothing
|
|
13
|
+
after the editor loaded a workflow (for example on mount in the Drupal
|
|
14
|
+
module, or after dropping a workflow file on the canvas): the menu closed
|
|
15
|
+
and the node stayed. The editor's other canvas helpers (fit view, zoom,
|
|
16
|
+
pan, sidebar drop position, caption placement, edge refresh, port
|
|
17
|
+
tracking) read the same stale state and were exposed to the same problem.
|
|
18
|
+
They now live inside the canvas, so they always act on the one that is
|
|
19
|
+
showing. The Delete key was never affected.
|
|
20
|
+
|
|
8
21
|
## [2.10.0] - 2026-10-07
|
|
9
22
|
|
|
10
23
|
### Added
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
CanvasController Component
|
|
3
3
|
Provides viewport control methods (fitView, zoom, pan) via useSvelteFlow().
|
|
4
|
-
Must be rendered inside
|
|
4
|
+
Must be rendered inside <SvelteFlow> (not beside it under a provider).
|
|
5
5
|
-->
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
Flow Drop Zone Component
|
|
3
|
-
Handles drag and drop with proper coordinate transformation
|
|
4
|
-
|
|
3
|
+
Handles drag and drop with proper coordinate transformation.
|
|
4
|
+
It wraps the canvas, so it sits outside <SvelteFlow>'s context: the parent
|
|
5
|
+
passes the screen-to-flow conversion in as `toFlowPosition`.
|
|
5
6
|
-->
|
|
6
7
|
|
|
7
8
|
<script lang="ts">
|
|
8
|
-
import { useSvelteFlow } from '@xyflow/svelte';
|
|
9
9
|
import type { Snippet } from 'svelte';
|
|
10
10
|
import { m } from '../messages/index.js';
|
|
11
11
|
|
|
@@ -13,14 +13,17 @@
|
|
|
13
13
|
ondrop: (nodeTypeData: string, position: { x: number; y: number }) => void;
|
|
14
14
|
/** Optional callback invoked when a JSON file is dropped onto the canvas. */
|
|
15
15
|
onfiledrop?: (file: File) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Convert a viewport (client) point to flow coordinates, accounting for
|
|
18
|
+
* zoom and pan. Returns null while no canvas is mounted; the drop is then
|
|
19
|
+
* ignored.
|
|
20
|
+
*/
|
|
21
|
+
toFlowPosition: (point: { x: number; y: number }) => { x: number; y: number } | null;
|
|
16
22
|
children: Snippet;
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
let props: Props = $props();
|
|
20
26
|
|
|
21
|
-
// Access SvelteFlow instance for coordinate transformation
|
|
22
|
-
const { screenToFlowPosition } = useSvelteFlow();
|
|
23
|
-
|
|
24
27
|
/**
|
|
25
28
|
* Handle drag over event
|
|
26
29
|
*/
|
|
@@ -55,10 +58,11 @@
|
|
|
55
58
|
const nodeTypeData = e.dataTransfer?.getData('application/json');
|
|
56
59
|
if (nodeTypeData) {
|
|
57
60
|
// Convert screen coordinates to flow coordinates (accounts for zoom and pan)
|
|
58
|
-
const position =
|
|
61
|
+
const position = props.toFlowPosition({
|
|
59
62
|
x: e.clientX,
|
|
60
63
|
y: e.clientY
|
|
61
64
|
});
|
|
65
|
+
if (!position) return;
|
|
62
66
|
|
|
63
67
|
// Call the parent handler with the converted position
|
|
64
68
|
props.ondrop(nodeTypeData, position);
|
|
@@ -6,6 +6,18 @@ interface Props {
|
|
|
6
6
|
}) => void;
|
|
7
7
|
/** Optional callback invoked when a JSON file is dropped onto the canvas. */
|
|
8
8
|
onfiledrop?: (file: File) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Convert a viewport (client) point to flow coordinates, accounting for
|
|
11
|
+
* zoom and pan. Returns null while no canvas is mounted; the drop is then
|
|
12
|
+
* ignored.
|
|
13
|
+
*/
|
|
14
|
+
toFlowPosition: (point: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
}) => {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
} | null;
|
|
9
21
|
children: Snippet;
|
|
10
22
|
}
|
|
11
23
|
declare const FlowDropZone: import("svelte").Component<Props, {}, "">;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
Port Coordinate Tracker Component
|
|
3
3
|
Bridge component that exposes SvelteFlow's getInternalNode to the parent.
|
|
4
|
-
Must be rendered inside
|
|
4
|
+
Must be rendered inside <SvelteFlow> (not beside it under a provider).
|
|
5
5
|
|
|
6
6
|
Uses the same pattern as EdgeRefresher - a renderless component that hooks
|
|
7
7
|
into the SvelteFlow context.
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
Background,
|
|
13
13
|
BackgroundVariant,
|
|
14
14
|
MiniMap,
|
|
15
|
-
SvelteFlowProvider,
|
|
16
15
|
type ColorMode
|
|
17
16
|
} from '@xyflow/svelte';
|
|
18
17
|
import '@xyflow/svelte/dist/style.css';
|
|
@@ -1051,7 +1050,8 @@
|
|
|
1051
1050
|
*/
|
|
1052
1051
|
let nodeIdToRefresh = $state<string | null>(null);
|
|
1053
1052
|
|
|
1054
|
-
// Canvas viewport controller ref
|
|
1053
|
+
// Canvas viewport controller ref. Rendered inside <SvelteFlow>, so it is
|
|
1054
|
+
// remounted with the canvas and always talks to the live instance's store.
|
|
1055
1055
|
let canvasControllerRef: CanvasController | undefined = $state();
|
|
1056
1056
|
|
|
1057
1057
|
/**
|
|
@@ -1099,7 +1099,7 @@
|
|
|
1099
1099
|
nodeIdToRefresh = nodeId;
|
|
1100
1100
|
}
|
|
1101
1101
|
|
|
1102
|
-
// Canvas viewport methods (forwarded to CanvasController inside
|
|
1102
|
+
// Canvas viewport methods (forwarded to CanvasController inside <SvelteFlow>)
|
|
1103
1103
|
|
|
1104
1104
|
export function canvasFitView(): void {
|
|
1105
1105
|
canvasControllerRef?.canvasFitView();
|
|
@@ -1193,152 +1193,152 @@
|
|
|
1193
1193
|
|
|
1194
1194
|
<svelte:window onkeydown={handleKeydown} />
|
|
1195
1195
|
|
|
1196
|
-
<
|
|
1197
|
-
<!--
|
|
1198
|
-
<
|
|
1199
|
-
|
|
1200
|
-
<!-- EdgeRefresher component - handles updateNodeInternals calls -->
|
|
1201
|
-
<EdgeRefresher {nodeIdToRefresh} onRefreshComplete={handleEdgeRefreshComplete} />
|
|
1202
|
-
|
|
1203
|
-
<!-- Port Coordinate Tracker - maintains port positions for proximity connect -->
|
|
1204
|
-
<PortCoordinateTracker
|
|
1205
|
-
nodeToUpdate={portCoordNodeToUpdate}
|
|
1206
|
-
rebuildTrigger={portCoordRebuildTrigger}
|
|
1207
|
-
nodes={flowNodes}
|
|
1208
|
-
/>
|
|
1209
|
-
|
|
1210
|
-
<div class="flowdrop-workflow-editor">
|
|
1211
|
-
<!-- Main Editor Area -->
|
|
1212
|
-
<div class="flowdrop-workflow-editor__main">
|
|
1213
|
-
<!-- Flow Canvas.
|
|
1196
|
+
<div class="flowdrop-workflow-editor">
|
|
1197
|
+
<!-- Main Editor Area -->
|
|
1198
|
+
<div class="flowdrop-workflow-editor__main">
|
|
1199
|
+
<!-- Flow Canvas.
|
|
1214
1200
|
Capture-phase mousedown so dragging from a port never turns into a
|
|
1215
1201
|
WebKit text-selection drag — see suppressPortDragSelection. -->
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1202
|
+
<div
|
|
1203
|
+
class="flowdrop-canvas"
|
|
1204
|
+
bind:this={canvasEl}
|
|
1205
|
+
onmousedowncapture={suppressPortDragSelection}
|
|
1206
|
+
>
|
|
1207
|
+
<FlowDropZone
|
|
1208
|
+
ondrop={handleNodeDrop}
|
|
1209
|
+
onfiledrop={handleWorkflowFileDrop}
|
|
1210
|
+
toFlowPosition={(point) => canvasControllerRef?.canvasScreenToFlow(point) ?? null}
|
|
1220
1211
|
>
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1212
|
+
{#key svelteFlowKey}
|
|
1213
|
+
<SvelteFlow
|
|
1214
|
+
id={fd.id}
|
|
1215
|
+
bind:nodes={flowNodes}
|
|
1216
|
+
bind:edges={flowEdges}
|
|
1217
|
+
{nodeTypes}
|
|
1218
|
+
{edgeTypes}
|
|
1219
|
+
{defaultEdgeOptions}
|
|
1220
|
+
onconnect={() => void handleConnect()}
|
|
1221
|
+
onbeforedelete={handleBeforeDelete}
|
|
1222
|
+
ondelete={handleNodesDelete}
|
|
1223
|
+
onnodedragstart={handleNodeDragStart}
|
|
1224
|
+
onnodedrag={handleNodeDrag}
|
|
1225
|
+
onnodedragstop={handleNodeDragStop}
|
|
1226
|
+
onnodecontextmenu={handleNodeContextMenu}
|
|
1227
|
+
onselectioncontextmenu={handleSelectionContextMenu}
|
|
1228
|
+
onpanecontextmenu={handlePaneContextMenu}
|
|
1229
|
+
minZoom={0.2}
|
|
1230
|
+
maxZoom={3}
|
|
1231
|
+
clickConnect={true}
|
|
1232
|
+
elevateEdgesOnSelect={true}
|
|
1233
|
+
connectionLineType={ConnectionLineType.Bezier}
|
|
1234
|
+
connectionLineComponent={ConnectionLine}
|
|
1235
|
+
{snapGrid}
|
|
1236
|
+
{initialViewport}
|
|
1237
|
+
colorMode={getResolvedTheme() as ColorMode}
|
|
1238
|
+
fitView={getEditorSettings().fitViewOnLoad}
|
|
1239
|
+
nodesDraggable={canvasEditable}
|
|
1240
|
+
nodesConnectable={canvasEditable}
|
|
1241
|
+
elementsSelectable={canvasEditable}
|
|
1242
|
+
>
|
|
1243
|
+
<!-- Renderless helpers. They live inside <SvelteFlow>, not beside it
|
|
1244
|
+
under a provider: @xyflow/svelte >= 1.6.6 replaces the provider's
|
|
1245
|
+
store with an empty one when a SvelteFlow is destroyed, so after
|
|
1246
|
+
the {#key} remount a helper outside would act on that empty
|
|
1247
|
+
store (context-menu Delete silently did nothing). -->
|
|
1248
|
+
<CanvasController bind:this={canvasControllerRef} />
|
|
1249
|
+
<EdgeRefresher {nodeIdToRefresh} onRefreshComplete={handleEdgeRefreshComplete} />
|
|
1250
|
+
<PortCoordinateTracker
|
|
1251
|
+
nodeToUpdate={portCoordNodeToUpdate}
|
|
1252
|
+
rebuildTrigger={portCoordRebuildTrigger}
|
|
1253
|
+
nodes={flowNodes}
|
|
1254
|
+
/>
|
|
1255
|
+
<Controls />
|
|
1256
|
+
{#if canvasEditable && props.onToggleConsole}
|
|
1257
|
+
<CanvasIconButton
|
|
1258
|
+
class="flowdrop-console-toggle"
|
|
1259
|
+
label={props.consoleToggleLabel ?? m().layout.commandConsole}
|
|
1260
|
+
active={props.consoleOpen}
|
|
1261
|
+
onclick={props.onToggleConsole}
|
|
1262
|
+
>
|
|
1263
|
+
{#snippet icon()}
|
|
1264
|
+
<CommandLineIcon />
|
|
1265
|
+
{/snippet}
|
|
1266
|
+
</CanvasIconButton>
|
|
1267
|
+
{/if}
|
|
1268
|
+
<!-- Always render Background for consistent bg color in dark/light mode -->
|
|
1269
|
+
<Background
|
|
1270
|
+
gap={getEditorSettings().gridSize}
|
|
1271
|
+
bgColor="var(--fd-canvas-bg)"
|
|
1272
|
+
variant={gridVariant}
|
|
1273
|
+
lineWidth={1}
|
|
1274
|
+
patternColor={getEditorSettings().showGrid
|
|
1275
|
+
? 'var(--fd-grid-pattern-color)'
|
|
1276
|
+
: 'transparent'}
|
|
1277
|
+
/>
|
|
1278
|
+
{#if getEditorSettings().showMinimap}
|
|
1279
|
+
<MiniMap />
|
|
1280
|
+
{/if}
|
|
1281
|
+
</SvelteFlow>
|
|
1282
|
+
{/key}
|
|
1283
|
+
<!-- Drop Zone Indicator -->
|
|
1284
|
+
{#if flowNodes.length === 0}
|
|
1285
|
+
<CanvasBanner
|
|
1286
|
+
title="Drag components here to start building"
|
|
1287
|
+
description="Use the sidebar to add components to your workflow"
|
|
1288
|
+
>
|
|
1289
|
+
{#snippet icon()}
|
|
1290
|
+
<svg
|
|
1291
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1292
|
+
width="1em"
|
|
1293
|
+
height="1em"
|
|
1294
|
+
viewBox="0 0 24 24"
|
|
1295
|
+
fill="none"
|
|
1296
|
+
stroke="currentColor"
|
|
1297
|
+
stroke-width="1.5"
|
|
1298
|
+
stroke-linecap="round"
|
|
1299
|
+
stroke-linejoin="round"
|
|
1300
|
+
>
|
|
1301
|
+
<circle cx="18" cy="5" r="3" />
|
|
1302
|
+
<circle cx="6" cy="12" r="3" />
|
|
1303
|
+
<circle cx="18" cy="19" r="3" />
|
|
1304
|
+
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49" />
|
|
1305
|
+
<line x1="15.41" y1="6.51" x2="8.59" y2="10.49" />
|
|
1306
|
+
</svg>
|
|
1307
|
+
{/snippet}
|
|
1308
|
+
</CanvasBanner>
|
|
1318
1309
|
{/if}
|
|
1319
|
-
</
|
|
1310
|
+
</FlowDropZone>
|
|
1311
|
+
|
|
1312
|
+
{#if openMenu}
|
|
1313
|
+
<CanvasContextMenu
|
|
1314
|
+
entries={openMenu.entries}
|
|
1315
|
+
x={openMenu.x}
|
|
1316
|
+
y={openMenu.y}
|
|
1317
|
+
onselect={selectContextMenuEntry}
|
|
1318
|
+
onclose={closeContextMenu}
|
|
1319
|
+
/>
|
|
1320
|
+
{/if}
|
|
1321
|
+
</div>
|
|
1320
1322
|
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1323
|
+
<!-- Status Bar: aria-live announces dynamic changes (node/edge counts, cycle warnings) -->
|
|
1324
|
+
<div class="flowdrop-status-bar" aria-live="polite" aria-atomic="true">
|
|
1325
|
+
<div class="flowdrop-status-bar__content">
|
|
1326
|
+
<div class="flowdrop-flex flowdrop-gap--4">
|
|
1327
|
+
<span class="flowdrop-text--xs flowdrop-text--gray">{flowNodes.length} nodes</span>
|
|
1328
|
+
<span class="flowdrop-text--xs flowdrop-text--gray">•</span>
|
|
1329
|
+
<span class="flowdrop-text--xs flowdrop-text--gray">{flowEdges.length} connections</span>
|
|
1330
|
+
|
|
1331
|
+
{#if hasCycles}
|
|
1326
1332
|
<span class="flowdrop-text--xs flowdrop-text--gray">•</span>
|
|
1327
|
-
<span class="flowdrop-text--xs flowdrop-text--
|
|
1333
|
+
<span class="flowdrop-text--xs flowdrop-font--medium flowdrop-text--error"
|
|
1334
|
+
>⚠️ Cycles detected</span
|
|
1328
1335
|
>
|
|
1329
|
-
|
|
1330
|
-
{#if hasCycles}
|
|
1331
|
-
<span class="flowdrop-text--xs flowdrop-text--gray">•</span>
|
|
1332
|
-
<span class="flowdrop-text--xs flowdrop-font--medium flowdrop-text--error"
|
|
1333
|
-
>⚠️ Cycles detected</span
|
|
1334
|
-
>
|
|
1335
|
-
{/if}
|
|
1336
|
-
</div>
|
|
1336
|
+
{/if}
|
|
1337
1337
|
</div>
|
|
1338
1338
|
</div>
|
|
1339
1339
|
</div>
|
|
1340
1340
|
</div>
|
|
1341
|
-
</
|
|
1341
|
+
</div>
|
|
1342
1342
|
|
|
1343
1343
|
<!-- Toast notifications container -->
|
|
1344
1344
|
<!-- aria-live="polite" ensures screen readers announce toast messages without interrupting -->
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "2.10.
|
|
6
|
+
"version": "2.10.1",
|
|
7
7
|
"author": "Shibin Das (D34dMan)",
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://github.com/flowdrop-io/flowdrop/issues"
|
|
@@ -224,7 +224,7 @@
|
|
|
224
224
|
"@vitest/browser": "^3.2.3",
|
|
225
225
|
"@vitest/coverage-v8": "^3.2.4",
|
|
226
226
|
"@vitest/ui": "^3.2.4",
|
|
227
|
-
"@xyflow/svelte": "^1.
|
|
227
|
+
"@xyflow/svelte": "^1.7.0",
|
|
228
228
|
"codemirror": "^6.0.2",
|
|
229
229
|
"eslint": "^9.18.0",
|
|
230
230
|
"eslint-config-prettier": "^10.0.1",
|