@k-4u/resource-mapper-core 0.0.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/.aws-icons-last-updated +1 -0
- package/.svelte-kit/ambient.d.ts +263 -0
- package/.svelte-kit/generated/client/app.js +31 -0
- package/.svelte-kit/generated/client/matchers.js +1 -0
- package/.svelte-kit/generated/client/nodes/0.js +1 -0
- package/.svelte-kit/generated/client/nodes/1.js +1 -0
- package/.svelte-kit/generated/client/nodes/2.js +3 -0
- package/.svelte-kit/generated/client/nodes/3.js +3 -0
- package/.svelte-kit/generated/client-optimized/app.js +31 -0
- package/.svelte-kit/generated/client-optimized/matchers.js +1 -0
- package/.svelte-kit/generated/client-optimized/nodes/0.js +1 -0
- package/.svelte-kit/generated/client-optimized/nodes/1.js +1 -0
- package/.svelte-kit/generated/client-optimized/nodes/2.js +3 -0
- package/.svelte-kit/generated/client-optimized/nodes/3.js +3 -0
- package/.svelte-kit/generated/root.js +3 -0
- package/.svelte-kit/generated/root.svelte +68 -0
- package/.svelte-kit/generated/server/internal.js +53 -0
- package/.svelte-kit/non-ambient.d.ts +43 -0
- package/.svelte-kit/output/client/.vite/manifest.json +175 -0
- package/.svelte-kit/output/client/_app/immutable/assets/0.Czt_67iE.css +1 -0
- package/.svelte-kit/output/client/_app/immutable/assets/TeamContactCard.Dxj5nUCr.css +1 -0
- package/.svelte-kit/output/client/_app/immutable/assets/helpers.ysDrpaDf.css +1 -0
- package/.svelte-kit/output/client/_app/immutable/assets/libavoid.DQJapW5w.wasm +0 -0
- package/.svelte-kit/output/client/_app/immutable/chunks/BlLuv0eP.js +46 -0
- package/.svelte-kit/output/client/_app/immutable/chunks/CSBHmwYv.js +1 -0
- package/.svelte-kit/output/client/_app/immutable/chunks/CTCi5ueQ.js +1 -0
- package/.svelte-kit/output/client/_app/immutable/chunks/CfOzjaik.js +2 -0
- package/.svelte-kit/output/client/_app/immutable/chunks/D4PdvFNs.js +1 -0
- package/.svelte-kit/output/client/_app/immutable/chunks/DXgP-QUS.js +2 -0
- package/.svelte-kit/output/client/_app/immutable/chunks/DlbDC5An.js +1 -0
- package/.svelte-kit/output/client/_app/immutable/chunks/wRWe7aK9.js +1 -0
- package/.svelte-kit/output/client/_app/immutable/entry/app.ConrMuHl.js +2 -0
- package/.svelte-kit/output/client/_app/immutable/entry/start.Bm6FyGme.js +1 -0
- package/.svelte-kit/output/client/_app/immutable/nodes/0.d3cL-ETU.js +1 -0
- package/.svelte-kit/output/client/_app/immutable/nodes/1.D6z9rPGv.js +1 -0
- package/.svelte-kit/output/client/_app/immutable/nodes/2.CLD-8chl.js +1 -0
- package/.svelte-kit/output/client/_app/immutable/nodes/3.DXYeBoel.js +1 -0
- package/.svelte-kit/output/client/_app/version.json +1 -0
- package/.svelte-kit/output/client/libavoid.wasm +0 -0
- package/.svelte-kit/output/client/static/robots.txt +3 -0
- package/.svelte-kit/output/prerendered/dependencies/_app/env.js +1 -0
- package/.svelte-kit/output/server/.vite/manifest.json +224 -0
- package/.svelte-kit/output/server/_app/immutable/assets/LoadingOverlay.DBbe6V8W.css +1 -0
- package/.svelte-kit/output/server/_app/immutable/assets/_layout.Czt_67iE.css +1 -0
- package/.svelte-kit/output/server/_app/immutable/assets/_page.D9P41uDZ.css +1 -0
- package/.svelte-kit/output/server/chunks/ErrorDisplay.js +59 -0
- package/.svelte-kit/output/server/chunks/LoadingOverlay.js +12 -0
- package/.svelte-kit/output/server/chunks/LoadingOverlay.svelte_svelte_type_style_lang.js +1671 -0
- package/.svelte-kit/output/server/chunks/connections.js +33 -0
- package/.svelte-kit/output/server/chunks/diagram.js +7 -0
- package/.svelte-kit/output/server/chunks/environment.js +34 -0
- package/.svelte-kit/output/server/chunks/equality.js +57 -0
- package/.svelte-kit/output/server/chunks/exports.js +174 -0
- package/.svelte-kit/output/server/chunks/false.js +4 -0
- package/.svelte-kit/output/server/chunks/index.js +59 -0
- package/.svelte-kit/output/server/chunks/index2.js +2939 -0
- package/.svelte-kit/output/server/chunks/index3.js +20 -0
- package/.svelte-kit/output/server/chunks/internal.js +1017 -0
- package/.svelte-kit/output/server/chunks/shared.js +770 -0
- package/.svelte-kit/output/server/chunks/utils.js +43 -0
- package/.svelte-kit/output/server/entries/pages/_error.svelte.js +64 -0
- package/.svelte-kit/output/server/entries/pages/_layout.svelte.js +65 -0
- package/.svelte-kit/output/server/entries/pages/_page.svelte.js +3991 -0
- package/.svelte-kit/output/server/entries/pages/_page.ts.js +30 -0
- package/.svelte-kit/output/server/entries/pages/group/_groupId_/_page.svelte.js +67 -0
- package/.svelte-kit/output/server/entries/pages/group/_groupId_/_page.ts.js +47 -0
- package/.svelte-kit/output/server/index.js +3747 -0
- package/.svelte-kit/output/server/internal.js +13 -0
- package/.svelte-kit/output/server/manifest-full.js +47 -0
- package/.svelte-kit/output/server/manifest.js +47 -0
- package/.svelte-kit/output/server/nodes/0.js +8 -0
- package/.svelte-kit/output/server/nodes/1.js +8 -0
- package/.svelte-kit/output/server/nodes/2.js +10 -0
- package/.svelte-kit/output/server/nodes/3.js +10 -0
- package/.svelte-kit/output/server/remote-entry.js +557 -0
- package/.svelte-kit/tsconfig.json +61 -0
- package/.svelte-kit/types/route_meta_data.json +8 -0
- package/.svelte-kit/types/src/routes/$types.d.ts +26 -0
- package/.svelte-kit/types/src/routes/group/[groupId]/$types.d.ts +21 -0
- package/.svelte-kit/types/src/routes/group/[groupId]/proxy+page.ts +49 -0
- package/.svelte-kit/types/src/routes/proxy+page.ts +33 -0
- package/build/_app/env.js +1 -0
- package/build/_app/env.js.br +1 -0
- package/build/_app/env.js.gz +0 -0
- package/build/_app/immutable/assets/0.Czt_67iE.css +1 -0
- package/build/_app/immutable/assets/0.Czt_67iE.css.br +0 -0
- package/build/_app/immutable/assets/0.Czt_67iE.css.gz +0 -0
- package/build/_app/immutable/assets/TeamContactCard.Dxj5nUCr.css +1 -0
- package/build/_app/immutable/assets/TeamContactCard.Dxj5nUCr.css.br +0 -0
- package/build/_app/immutable/assets/TeamContactCard.Dxj5nUCr.css.gz +0 -0
- package/build/_app/immutable/assets/helpers.ysDrpaDf.css +1 -0
- package/build/_app/immutable/assets/helpers.ysDrpaDf.css.br +0 -0
- package/build/_app/immutable/assets/helpers.ysDrpaDf.css.gz +0 -0
- package/build/_app/immutable/assets/libavoid.DQJapW5w.wasm +0 -0
- package/build/_app/immutable/assets/libavoid.DQJapW5w.wasm.br +0 -0
- package/build/_app/immutable/assets/libavoid.DQJapW5w.wasm.gz +0 -0
- package/build/_app/immutable/chunks/BlLuv0eP.js +46 -0
- package/build/_app/immutable/chunks/BlLuv0eP.js.br +0 -0
- package/build/_app/immutable/chunks/BlLuv0eP.js.gz +0 -0
- package/build/_app/immutable/chunks/CSBHmwYv.js +1 -0
- package/build/_app/immutable/chunks/CSBHmwYv.js.br +0 -0
- package/build/_app/immutable/chunks/CSBHmwYv.js.gz +0 -0
- package/build/_app/immutable/chunks/CTCi5ueQ.js +1 -0
- package/build/_app/immutable/chunks/CTCi5ueQ.js.br +0 -0
- package/build/_app/immutable/chunks/CTCi5ueQ.js.gz +0 -0
- package/build/_app/immutable/chunks/CfOzjaik.js +2 -0
- package/build/_app/immutable/chunks/CfOzjaik.js.br +0 -0
- package/build/_app/immutable/chunks/CfOzjaik.js.gz +0 -0
- package/build/_app/immutable/chunks/D4PdvFNs.js +1 -0
- package/build/_app/immutable/chunks/D4PdvFNs.js.br +0 -0
- package/build/_app/immutable/chunks/D4PdvFNs.js.gz +0 -0
- package/build/_app/immutable/chunks/DXgP-QUS.js +2 -0
- package/build/_app/immutable/chunks/DXgP-QUS.js.br +0 -0
- package/build/_app/immutable/chunks/DXgP-QUS.js.gz +0 -0
- package/build/_app/immutable/chunks/DlbDC5An.js +1 -0
- package/build/_app/immutable/chunks/DlbDC5An.js.br +0 -0
- package/build/_app/immutable/chunks/DlbDC5An.js.gz +0 -0
- package/build/_app/immutable/chunks/wRWe7aK9.js +1 -0
- package/build/_app/immutable/chunks/wRWe7aK9.js.br +0 -0
- package/build/_app/immutable/chunks/wRWe7aK9.js.gz +0 -0
- package/build/_app/immutable/entry/app.ConrMuHl.js +2 -0
- package/build/_app/immutable/entry/app.ConrMuHl.js.br +0 -0
- package/build/_app/immutable/entry/app.ConrMuHl.js.gz +0 -0
- package/build/_app/immutable/entry/start.Bm6FyGme.js +1 -0
- package/build/_app/immutable/entry/start.Bm6FyGme.js.br +2 -0
- package/build/_app/immutable/entry/start.Bm6FyGme.js.gz +0 -0
- package/build/_app/immutable/nodes/0.d3cL-ETU.js +1 -0
- package/build/_app/immutable/nodes/0.d3cL-ETU.js.br +0 -0
- package/build/_app/immutable/nodes/0.d3cL-ETU.js.gz +0 -0
- package/build/_app/immutable/nodes/1.D6z9rPGv.js +1 -0
- package/build/_app/immutable/nodes/1.D6z9rPGv.js.br +0 -0
- package/build/_app/immutable/nodes/1.D6z9rPGv.js.gz +0 -0
- package/build/_app/immutable/nodes/2.CLD-8chl.js +1 -0
- package/build/_app/immutable/nodes/2.CLD-8chl.js.br +0 -0
- package/build/_app/immutable/nodes/2.CLD-8chl.js.gz +0 -0
- package/build/_app/immutable/nodes/3.DXYeBoel.js +1 -0
- package/build/_app/immutable/nodes/3.DXYeBoel.js.br +0 -0
- package/build/_app/immutable/nodes/3.DXYeBoel.js.gz +0 -0
- package/build/_app/version.json +1 -0
- package/build/_app/version.json.br +0 -0
- package/build/_app/version.json.gz +0 -0
- package/build/index.html +34 -0
- package/build/index.html.br +0 -0
- package/build/index.html.gz +0 -0
- package/build/libavoid.wasm +0 -0
- package/build/libavoid.wasm.br +0 -0
- package/build/libavoid.wasm.gz +0 -0
- package/build/static/robots.txt +3 -0
- package/coverage/coverage-final.json +6 -0
- package/coverage/coverage-summary.json +7 -0
- package/coverage/junit.xml +57 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +131 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/stores/index.html +116 -0
- package/coverage/lcov-report/stores/routingStore.ts.html +781 -0
- package/coverage/lcov-report/utils/flow/helpers.ts.html +127 -0
- package/coverage/lcov-report/utils/flow/index.html +161 -0
- package/coverage/lcov-report/utils/flow/layout.ts.html +805 -0
- package/coverage/lcov-report/utils/flow/serviceIds.ts.html +97 -0
- package/coverage/lcov-report/utils/flow/servicesGraph.ts.html +859 -0
- package/coverage/lcov.info +646 -0
- package/coverage/test-results.json +1 -0
- package/data/services/api/api-gateway.yaml +18 -0
- package/data/services/api/group-info.yaml +7 -0
- package/data/services/api/lambda-orders.yaml +21 -0
- package/data/services/api/lambda-products.yaml +15 -0
- package/data/services/api/lambda-users.yaml +15 -0
- package/data/services/compute/alb.yaml +15 -0
- package/data/services/compute/ecs-inventory.yaml +16 -0
- package/data/services/compute/ecs-notification.yaml +15 -0
- package/data/services/compute/group-info.yaml +7 -0
- package/data/services/data/dynamodb-notifications.yaml +12 -0
- package/data/services/data/dynamodb-orders.yaml +9 -0
- package/data/services/data/dynamodb-products.yaml +9 -0
- package/data/services/data/dynamodb-users.yaml +9 -0
- package/data/services/data/group-info.yaml +7 -0
- package/data/services/data/rds-postgres.yaml +9 -0
- package/data/services/data/redis.yaml +10 -0
- package/data/services/frontend/cloudfront.yaml +12 -0
- package/data/services/frontend/group-info.yaml +7 -0
- package/data/services/frontend/route53.yaml +15 -0
- package/data/services/frontend/s3-website.yaml +9 -0
- package/data/teams/cloud-shepherds.yaml +15 -0
- package/data/teams/data-wizards.yaml +15 -0
- package/data/teams/interface-architects.yaml +19 -0
- package/e2e/demo.test.ts +54 -0
- package/e2e/header-toolbar.simple.spec.ts +0 -0
- package/e2e/header-toolbar.spec.ts +53 -0
- package/e2e/layout.spec.ts +30 -0
- package/package.json +69 -0
- package/playwright.config.ts +10 -0
- package/plugins/mapper-data-plugin.ts +32 -0
- package/project.json +23 -0
- package/src/app.css +125 -0
- package/src/app.d.ts +31 -0
- package/src/app.html +11 -0
- package/src/lib/assets/favicon.svg +19 -0
- package/src/lib/components/EmptyState.svelte +37 -0
- package/src/lib/components/ErrorDisplay.svelte +82 -0
- package/src/lib/components/FlowCanvas.svelte +223 -0
- package/src/lib/components/GenericSidebarCard.svelte +44 -0
- package/src/lib/components/GroupDetailSidebar.svelte +31 -0
- package/src/lib/components/Header.svelte +57 -0
- package/src/lib/components/Legend.svelte +25 -0
- package/src/lib/components/LoadingOverlay.svelte +42 -0
- package/src/lib/components/LoadingSpinner.svelte +10 -0
- package/src/lib/components/ServiceDetailSidebar.svelte +90 -0
- package/src/lib/components/TeamContactCard.svelte +166 -0
- package/src/lib/components/flow/ExternalNode.svelte +45 -0
- package/src/lib/components/flow/MainGroupNode.svelte +24 -0
- package/src/lib/components/flow/ServiceGroupNode.svelte +17 -0
- package/src/lib/components/flow/ServiceNode.svelte +40 -0
- package/src/lib/components/flow/SnakeEdge.svelte +206 -0
- package/src/lib/components/flow/index.ts +6 -0
- package/src/lib/components/index.ts +12 -0
- package/src/lib/data/connections.ts +26 -0
- package/src/lib/data/groups.ts +11 -0
- package/src/lib/data/services.ts +12 -0
- package/src/lib/data/teams.ts +11 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/state/theme.svelte.ts +21 -0
- package/src/lib/stores/diagram.ts +6 -0
- package/src/lib/stores/routingStore.test.ts +133 -0
- package/src/lib/stores/routingStore.ts +232 -0
- package/src/lib/utils/awsIcons.ts +117 -0
- package/src/lib/utils/flow/groupOverviewGraph.ts +73 -0
- package/src/lib/utils/flow/helpers.ts +14 -0
- package/src/lib/utils/flow/layout.test.ts +271 -0
- package/src/lib/utils/flow/layout.ts +240 -0
- package/src/lib/utils/flow/serviceIds.ts +5 -0
- package/src/lib/utils/flow/servicesGraph.test.ts +119 -0
- package/src/lib/utils/flow/servicesGraph.ts +258 -0
- package/src/routes/+error.svelte +36 -0
- package/src/routes/+layout.svelte +27 -0
- package/src/routes/+page.svelte +81 -0
- package/src/routes/+page.ts +31 -0
- package/src/routes/group/[groupId]/+page.svelte +102 -0
- package/src/routes/group/[groupId]/+page.ts +48 -0
- package/src/routes/layout.css +0 -0
- package/static/static/robots.txt +3 -0
- package/svelte.config.js +28 -0
- package/tailwind.config.js +12 -0
- package/tsconfig.json +22 -0
- package/vite.config.ts +81 -0
|
@@ -0,0 +1,3991 @@
|
|
|
1
|
+
import { a4 as hasContext, a3 as getContext, Z as setContext, a5 as attributes, a6 as clsx, a7 as stringify, $ as escape_html, a0 as attr, a8 as attr_class, a9 as attr_style, aa as derived, ab as bind_props, ac as ensure_array_like, ad as spread_props, ae as css_props, _ as store_get, a1 as unsubscribe_stores, a2 as head } from "../../chunks/index2.js";
|
|
2
|
+
import { o as onDestroy, c as calculateEdgeOffset, r as routingStore, t as theme, I as Icon, g as goto, i as invalidateAll } from "../../chunks/LoadingOverlay.svelte_svelte_type_style_lang.js";
|
|
3
|
+
import { E as ErrorDisplay } from "../../chunks/ErrorDisplay.js";
|
|
4
|
+
import "@sveltejs/kit/internal";
|
|
5
|
+
import "../../chunks/exports.js";
|
|
6
|
+
import "../../chunks/utils.js";
|
|
7
|
+
import "@sveltejs/kit/internal/server";
|
|
8
|
+
import { Position, ConnectionMode, isEdgeBase, isNodeBase, getBezierPath, getSmoothStepPath, getStraightPath, getNodesInside, isEdgeVisible, getEdgePosition, getElevatedEdgeZIndex, initialConnection, fitViewport, getInternalNodesBounds, getViewportForBounds, adoptUserNodes, updateConnectionLookup, infiniteExtent, SelectionMode, mergeAriaLabelConfig, pointToRendererPoint, createMarkerIds, devWarn, panBy, snapPosition, calculateNodePosition, errorMessages, updateNodeInternals, updateAbsolutePositions, getHandlePosition, addEdge, nodeHasDimensions, getMarkerId, MarkerType, isNumeric, getNodesBounds, rendererPointToPoint, getElementsToRemove, isRectObject, getOverlappingArea, nodeToRect, evaluateAbsolutePosition, isMacOs, ConnectionLineType, getConnectionStatus, PanOnScrollMode, getNodeDimensions, getBoundsOfRects } from "@xyflow/system";
|
|
9
|
+
import "clsx";
|
|
10
|
+
import { p as page } from "../../chunks/index3.js";
|
|
11
|
+
import { a as showLegend } from "../../chunks/diagram.js";
|
|
12
|
+
import { i as is_array, g as get_prototype_of, o as object_prototype, r as run } from "../../chunks/equality.js";
|
|
13
|
+
const empty = [];
|
|
14
|
+
function snapshot(value, skip_warning = false, no_tojson = false) {
|
|
15
|
+
return clone(value, /* @__PURE__ */ new Map(), "", empty, null, no_tojson);
|
|
16
|
+
}
|
|
17
|
+
function clone(value, cloned, path, paths, original = null, no_tojson = false) {
|
|
18
|
+
if (typeof value === "object" && value !== null) {
|
|
19
|
+
var unwrapped = cloned.get(value);
|
|
20
|
+
if (unwrapped !== void 0) return unwrapped;
|
|
21
|
+
if (value instanceof Map) return (
|
|
22
|
+
/** @type {Snapshot<T>} */
|
|
23
|
+
new Map(value)
|
|
24
|
+
);
|
|
25
|
+
if (value instanceof Set) return (
|
|
26
|
+
/** @type {Snapshot<T>} */
|
|
27
|
+
new Set(value)
|
|
28
|
+
);
|
|
29
|
+
if (is_array(value)) {
|
|
30
|
+
var copy = (
|
|
31
|
+
/** @type {Snapshot<any>} */
|
|
32
|
+
Array(value.length)
|
|
33
|
+
);
|
|
34
|
+
cloned.set(value, copy);
|
|
35
|
+
if (original !== null) {
|
|
36
|
+
cloned.set(original, copy);
|
|
37
|
+
}
|
|
38
|
+
for (var i = 0; i < value.length; i += 1) {
|
|
39
|
+
var element = value[i];
|
|
40
|
+
if (i in value) {
|
|
41
|
+
copy[i] = clone(element, cloned, path, paths, null, no_tojson);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return copy;
|
|
45
|
+
}
|
|
46
|
+
if (get_prototype_of(value) === object_prototype) {
|
|
47
|
+
copy = {};
|
|
48
|
+
cloned.set(value, copy);
|
|
49
|
+
if (original !== null) {
|
|
50
|
+
cloned.set(original, copy);
|
|
51
|
+
}
|
|
52
|
+
for (var key2 in value) {
|
|
53
|
+
copy[key2] = clone(
|
|
54
|
+
// @ts-expect-error
|
|
55
|
+
value[key2],
|
|
56
|
+
cloned,
|
|
57
|
+
path,
|
|
58
|
+
paths,
|
|
59
|
+
null,
|
|
60
|
+
no_tojson
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return copy;
|
|
64
|
+
}
|
|
65
|
+
if (value instanceof Date) {
|
|
66
|
+
return (
|
|
67
|
+
/** @type {Snapshot<T>} */
|
|
68
|
+
structuredClone(value)
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
if (typeof /** @type {T & { toJSON?: any } } */
|
|
72
|
+
value.toJSON === "function" && !no_tojson) {
|
|
73
|
+
return clone(
|
|
74
|
+
/** @type {T & { toJSON(): any } } */
|
|
75
|
+
value.toJSON(),
|
|
76
|
+
cloned,
|
|
77
|
+
path,
|
|
78
|
+
paths,
|
|
79
|
+
// Associate the instance with the toJSON clone
|
|
80
|
+
value
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (value instanceof EventTarget) {
|
|
85
|
+
return (
|
|
86
|
+
/** @type {Snapshot<T>} */
|
|
87
|
+
value
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
return (
|
|
92
|
+
/** @type {Snapshot<T>} */
|
|
93
|
+
structuredClone(value)
|
|
94
|
+
);
|
|
95
|
+
} catch (e) {
|
|
96
|
+
return (
|
|
97
|
+
/** @type {Snapshot<T>} */
|
|
98
|
+
value
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function createContext() {
|
|
103
|
+
const key2 = {};
|
|
104
|
+
return [
|
|
105
|
+
(errorMessage) => {
|
|
106
|
+
if (errorMessage && !hasContext(key2)) {
|
|
107
|
+
throw new Error(errorMessage);
|
|
108
|
+
}
|
|
109
|
+
return getContext(key2);
|
|
110
|
+
},
|
|
111
|
+
(context) => setContext(key2, context)
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
const [getNodeIdContext, setNodeIdContext] = createContext();
|
|
115
|
+
const [getNodeConnectableContext, setNodeConnectableContext] = createContext();
|
|
116
|
+
const [getEdgeIdContext, setEdgeIdContext] = createContext();
|
|
117
|
+
function Handle($$renderer, $$props) {
|
|
118
|
+
$$renderer.component(($$renderer2) => {
|
|
119
|
+
let {
|
|
120
|
+
id: handleId = null,
|
|
121
|
+
type = "source",
|
|
122
|
+
position = Position.Top,
|
|
123
|
+
style,
|
|
124
|
+
class: className,
|
|
125
|
+
isConnectable: isConnectableProp,
|
|
126
|
+
isConnectableStart = true,
|
|
127
|
+
isConnectableEnd = true,
|
|
128
|
+
isValidConnection,
|
|
129
|
+
onconnect,
|
|
130
|
+
ondisconnect,
|
|
131
|
+
children,
|
|
132
|
+
$$slots,
|
|
133
|
+
$$events,
|
|
134
|
+
...rest
|
|
135
|
+
} = $$props;
|
|
136
|
+
const nodeId = getNodeIdContext("Handle must be used within a Custom Node component");
|
|
137
|
+
const isConnectableContext = getNodeConnectableContext("Handle must be used within a Custom Node component");
|
|
138
|
+
let isTarget = type === "target";
|
|
139
|
+
let isConnectable = isConnectableProp !== void 0 ? isConnectableProp : isConnectableContext.value;
|
|
140
|
+
let store = useStore();
|
|
141
|
+
let ariaLabelConfig = store.ariaLabelConfig;
|
|
142
|
+
let [
|
|
143
|
+
connectionInProgress,
|
|
144
|
+
connectingFrom,
|
|
145
|
+
connectingTo,
|
|
146
|
+
isPossibleTargetHandle,
|
|
147
|
+
valid
|
|
148
|
+
] = (() => {
|
|
149
|
+
if (!store.connection.inProgress) {
|
|
150
|
+
return [false, false, false, false, null];
|
|
151
|
+
}
|
|
152
|
+
const { fromHandle, toHandle, isValid } = store.connection;
|
|
153
|
+
const connectingFrom2 = fromHandle && fromHandle.nodeId === nodeId && fromHandle.type === type && fromHandle.id === handleId;
|
|
154
|
+
const connectingTo2 = toHandle && toHandle.nodeId === nodeId && toHandle.type === type && toHandle.id === handleId;
|
|
155
|
+
const isPossibleTargetHandle2 = store.connectionMode === ConnectionMode.Strict ? fromHandle?.type !== type : nodeId !== fromHandle?.nodeId || handleId !== fromHandle?.id;
|
|
156
|
+
const valid2 = connectingTo2 && isValid;
|
|
157
|
+
return [
|
|
158
|
+
true,
|
|
159
|
+
connectingFrom2,
|
|
160
|
+
connectingTo2,
|
|
161
|
+
isPossibleTargetHandle2,
|
|
162
|
+
valid2
|
|
163
|
+
];
|
|
164
|
+
})();
|
|
165
|
+
$$renderer2.push(`<div${attributes(
|
|
166
|
+
{
|
|
167
|
+
"data-handleid": handleId,
|
|
168
|
+
"data-nodeid": nodeId,
|
|
169
|
+
"data-handlepos": position,
|
|
170
|
+
"data-id": `${stringify(store.flowId)}-${stringify(nodeId)}-${stringify(handleId ?? "null")}-${stringify(type)}`,
|
|
171
|
+
class: clsx([
|
|
172
|
+
"svelte-flow__handle",
|
|
173
|
+
`svelte-flow__handle-${position}`,
|
|
174
|
+
store.noDragClass,
|
|
175
|
+
store.noPanClass,
|
|
176
|
+
position,
|
|
177
|
+
className
|
|
178
|
+
]),
|
|
179
|
+
style,
|
|
180
|
+
role: "button",
|
|
181
|
+
"aria-label": ariaLabelConfig[`handle.ariaLabel`],
|
|
182
|
+
tabindex: "-1",
|
|
183
|
+
...rest
|
|
184
|
+
},
|
|
185
|
+
void 0,
|
|
186
|
+
{
|
|
187
|
+
valid,
|
|
188
|
+
connectingto: connectingTo,
|
|
189
|
+
connectingfrom: connectingFrom,
|
|
190
|
+
source: !isTarget,
|
|
191
|
+
target: isTarget,
|
|
192
|
+
connectablestart: isConnectableStart,
|
|
193
|
+
connectableend: isConnectableEnd,
|
|
194
|
+
connectable: isConnectable,
|
|
195
|
+
connectionindicator: isConnectable && (!connectionInProgress || isPossibleTargetHandle) && (connectionInProgress || store.clickConnectStartHandle ? isConnectableEnd : isConnectableStart)
|
|
196
|
+
}
|
|
197
|
+
)}>`);
|
|
198
|
+
children?.($$renderer2);
|
|
199
|
+
$$renderer2.push(`<!----></div>`);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function DefaultNode($$renderer, $$props) {
|
|
203
|
+
$$renderer.component(($$renderer2) => {
|
|
204
|
+
let {
|
|
205
|
+
data,
|
|
206
|
+
targetPosition = Position.Top,
|
|
207
|
+
sourcePosition = Position.Bottom
|
|
208
|
+
} = $$props;
|
|
209
|
+
Handle($$renderer2, { type: "target", position: targetPosition });
|
|
210
|
+
$$renderer2.push(`<!----> ${escape_html(data?.label)} `);
|
|
211
|
+
Handle($$renderer2, { type: "source", position: sourcePosition });
|
|
212
|
+
$$renderer2.push(`<!---->`);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function InputNode($$renderer, $$props) {
|
|
216
|
+
$$renderer.component(($$renderer2) => {
|
|
217
|
+
let { data = { label: "Node" }, sourcePosition = Position.Bottom } = $$props;
|
|
218
|
+
$$renderer2.push(`<!---->${escape_html(data?.label)} `);
|
|
219
|
+
Handle($$renderer2, { type: "source", position: sourcePosition });
|
|
220
|
+
$$renderer2.push(`<!---->`);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
function OutputNode($$renderer, $$props) {
|
|
224
|
+
$$renderer.component(($$renderer2) => {
|
|
225
|
+
let { data = { label: "Node" }, targetPosition = Position.Top } = $$props;
|
|
226
|
+
$$renderer2.push(`<!---->${escape_html(data?.label)} `);
|
|
227
|
+
Handle($$renderer2, { type: "target", position: targetPosition });
|
|
228
|
+
$$renderer2.push(`<!---->`);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
function GroupNode($$renderer, $$props) {
|
|
232
|
+
}
|
|
233
|
+
function hideOnSSR() {
|
|
234
|
+
let hide = typeof window === "undefined";
|
|
235
|
+
return {
|
|
236
|
+
get value() {
|
|
237
|
+
return hide;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
const isNode = (element) => isNodeBase(element);
|
|
242
|
+
const isEdge = (element) => isEdgeBase(element);
|
|
243
|
+
function toPxString(value) {
|
|
244
|
+
return value === void 0 ? void 0 : `${value}px`;
|
|
245
|
+
}
|
|
246
|
+
function EdgeLabel($$renderer, $$props) {
|
|
247
|
+
$$renderer.component(($$renderer2) => {
|
|
248
|
+
let {
|
|
249
|
+
x = 0,
|
|
250
|
+
y = 0,
|
|
251
|
+
width,
|
|
252
|
+
height,
|
|
253
|
+
selectEdgeOnClick = false,
|
|
254
|
+
transparent = false,
|
|
255
|
+
class: className,
|
|
256
|
+
children,
|
|
257
|
+
$$slots,
|
|
258
|
+
$$events,
|
|
259
|
+
...rest
|
|
260
|
+
} = $$props;
|
|
261
|
+
const store = useStore();
|
|
262
|
+
const edgeId = getEdgeIdContext("EdgeLabel must be used within a Custom Edge component");
|
|
263
|
+
let z = (() => {
|
|
264
|
+
return store.visible.edges.get(edgeId)?.zIndex;
|
|
265
|
+
})();
|
|
266
|
+
$$renderer2.push(`<div${attributes(
|
|
267
|
+
{
|
|
268
|
+
class: clsx(["svelte-flow__edge-label", { transparent }, className]),
|
|
269
|
+
tabindex: "-1",
|
|
270
|
+
...rest
|
|
271
|
+
},
|
|
272
|
+
"svelte-13xe97i",
|
|
273
|
+
void 0,
|
|
274
|
+
{
|
|
275
|
+
display: hideOnSSR().value ? "none" : void 0,
|
|
276
|
+
cursor: selectEdgeOnClick ? "pointer" : void 0,
|
|
277
|
+
transform: `translate(-50%, -50%) translate(${stringify(x)}px,${stringify(y)}px)`,
|
|
278
|
+
"pointer-events": "all",
|
|
279
|
+
width: toPxString(width),
|
|
280
|
+
height: toPxString(height),
|
|
281
|
+
"z-index": z
|
|
282
|
+
}
|
|
283
|
+
)}>`);
|
|
284
|
+
children?.($$renderer2);
|
|
285
|
+
$$renderer2.push(`<!----></div>`);
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function BaseEdge($$renderer, $$props) {
|
|
289
|
+
let {
|
|
290
|
+
id,
|
|
291
|
+
path,
|
|
292
|
+
label,
|
|
293
|
+
labelX,
|
|
294
|
+
labelY,
|
|
295
|
+
labelStyle,
|
|
296
|
+
markerStart,
|
|
297
|
+
markerEnd,
|
|
298
|
+
style,
|
|
299
|
+
interactionWidth = 20,
|
|
300
|
+
class: className,
|
|
301
|
+
$$slots,
|
|
302
|
+
$$events,
|
|
303
|
+
...rest
|
|
304
|
+
} = $$props;
|
|
305
|
+
$$renderer.push(`<path${attr("id", id)}${attr("d", path)}${attr_class(clsx(["svelte-flow__edge-path", className]))}${attr("marker-start", markerStart)}${attr("marker-end", markerEnd)} fill="none"${attr_style(style)}></path>`);
|
|
306
|
+
if (interactionWidth > 0) {
|
|
307
|
+
$$renderer.push("<!--[-->");
|
|
308
|
+
$$renderer.push(`<path${attributes(
|
|
309
|
+
{
|
|
310
|
+
d: path,
|
|
311
|
+
"stroke-opacity": 0,
|
|
312
|
+
"stroke-width": interactionWidth,
|
|
313
|
+
fill: "none",
|
|
314
|
+
class: "svelte-flow__edge-interaction",
|
|
315
|
+
...rest
|
|
316
|
+
},
|
|
317
|
+
void 0,
|
|
318
|
+
void 0,
|
|
319
|
+
void 0,
|
|
320
|
+
3
|
|
321
|
+
)}></path>`);
|
|
322
|
+
} else {
|
|
323
|
+
$$renderer.push("<!--[!-->");
|
|
324
|
+
}
|
|
325
|
+
$$renderer.push(`<!--]-->`);
|
|
326
|
+
if (label) {
|
|
327
|
+
$$renderer.push("<!--[-->");
|
|
328
|
+
EdgeLabel($$renderer, {
|
|
329
|
+
x: labelX,
|
|
330
|
+
y: labelY,
|
|
331
|
+
style: labelStyle,
|
|
332
|
+
selectEdgeOnClick: true,
|
|
333
|
+
children: ($$renderer2) => {
|
|
334
|
+
$$renderer2.push(`<!---->${escape_html(label)}`);
|
|
335
|
+
},
|
|
336
|
+
$$slots: { default: true }
|
|
337
|
+
});
|
|
338
|
+
} else {
|
|
339
|
+
$$renderer.push("<!--[!-->");
|
|
340
|
+
}
|
|
341
|
+
$$renderer.push(`<!--]-->`);
|
|
342
|
+
}
|
|
343
|
+
function BezierEdge($$renderer, $$props) {
|
|
344
|
+
$$renderer.component(($$renderer2) => {
|
|
345
|
+
let {
|
|
346
|
+
id,
|
|
347
|
+
interactionWidth,
|
|
348
|
+
label,
|
|
349
|
+
labelStyle,
|
|
350
|
+
markerEnd,
|
|
351
|
+
markerStart,
|
|
352
|
+
pathOptions,
|
|
353
|
+
sourcePosition,
|
|
354
|
+
sourceX,
|
|
355
|
+
sourceY,
|
|
356
|
+
style,
|
|
357
|
+
targetPosition,
|
|
358
|
+
targetX,
|
|
359
|
+
targetY
|
|
360
|
+
} = $$props;
|
|
361
|
+
let [path, labelX, labelY] = getBezierPath({
|
|
362
|
+
sourceX,
|
|
363
|
+
sourceY,
|
|
364
|
+
targetX,
|
|
365
|
+
targetY,
|
|
366
|
+
sourcePosition,
|
|
367
|
+
targetPosition,
|
|
368
|
+
curvature: pathOptions?.curvature
|
|
369
|
+
});
|
|
370
|
+
BaseEdge($$renderer2, {
|
|
371
|
+
id,
|
|
372
|
+
path,
|
|
373
|
+
labelX,
|
|
374
|
+
labelY,
|
|
375
|
+
label,
|
|
376
|
+
labelStyle,
|
|
377
|
+
markerStart,
|
|
378
|
+
markerEnd,
|
|
379
|
+
interactionWidth,
|
|
380
|
+
style
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
function SmoothStepEdgeInternal($$renderer, $$props) {
|
|
385
|
+
$$renderer.component(($$renderer2) => {
|
|
386
|
+
let {
|
|
387
|
+
interactionWidth,
|
|
388
|
+
label,
|
|
389
|
+
labelStyle,
|
|
390
|
+
style,
|
|
391
|
+
markerEnd,
|
|
392
|
+
markerStart,
|
|
393
|
+
sourcePosition,
|
|
394
|
+
sourceX,
|
|
395
|
+
sourceY,
|
|
396
|
+
targetPosition,
|
|
397
|
+
targetX,
|
|
398
|
+
targetY
|
|
399
|
+
} = $$props;
|
|
400
|
+
let [path, labelX, labelY] = getSmoothStepPath({
|
|
401
|
+
sourceX,
|
|
402
|
+
sourceY,
|
|
403
|
+
targetX,
|
|
404
|
+
targetY,
|
|
405
|
+
sourcePosition,
|
|
406
|
+
targetPosition
|
|
407
|
+
});
|
|
408
|
+
BaseEdge($$renderer2, {
|
|
409
|
+
path,
|
|
410
|
+
labelX,
|
|
411
|
+
labelY,
|
|
412
|
+
label,
|
|
413
|
+
labelStyle,
|
|
414
|
+
markerStart,
|
|
415
|
+
markerEnd,
|
|
416
|
+
interactionWidth,
|
|
417
|
+
style
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
function StraightEdgeInternal($$renderer, $$props) {
|
|
422
|
+
$$renderer.component(($$renderer2) => {
|
|
423
|
+
let {
|
|
424
|
+
sourceX,
|
|
425
|
+
sourceY,
|
|
426
|
+
targetX,
|
|
427
|
+
targetY,
|
|
428
|
+
label,
|
|
429
|
+
labelStyle,
|
|
430
|
+
markerStart,
|
|
431
|
+
markerEnd,
|
|
432
|
+
interactionWidth,
|
|
433
|
+
style
|
|
434
|
+
} = $$props;
|
|
435
|
+
let [path, labelX, labelY] = getStraightPath({ sourceX, sourceY, targetX, targetY });
|
|
436
|
+
BaseEdge($$renderer2, {
|
|
437
|
+
path,
|
|
438
|
+
labelX,
|
|
439
|
+
labelY,
|
|
440
|
+
label,
|
|
441
|
+
labelStyle,
|
|
442
|
+
markerStart,
|
|
443
|
+
markerEnd,
|
|
444
|
+
interactionWidth,
|
|
445
|
+
style
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
function StepEdgeInternal($$renderer, $$props) {
|
|
450
|
+
$$renderer.component(($$renderer2) => {
|
|
451
|
+
let {
|
|
452
|
+
sourceX,
|
|
453
|
+
sourceY,
|
|
454
|
+
sourcePosition,
|
|
455
|
+
targetX,
|
|
456
|
+
targetY,
|
|
457
|
+
targetPosition,
|
|
458
|
+
label,
|
|
459
|
+
labelStyle,
|
|
460
|
+
markerStart,
|
|
461
|
+
markerEnd,
|
|
462
|
+
interactionWidth,
|
|
463
|
+
style
|
|
464
|
+
} = $$props;
|
|
465
|
+
let [path, labelX, labelY] = getSmoothStepPath({
|
|
466
|
+
sourceX,
|
|
467
|
+
sourceY,
|
|
468
|
+
targetX,
|
|
469
|
+
targetY,
|
|
470
|
+
sourcePosition,
|
|
471
|
+
targetPosition,
|
|
472
|
+
borderRadius: 0
|
|
473
|
+
});
|
|
474
|
+
BaseEdge($$renderer2, {
|
|
475
|
+
path,
|
|
476
|
+
labelX,
|
|
477
|
+
labelY,
|
|
478
|
+
label,
|
|
479
|
+
labelStyle,
|
|
480
|
+
markerStart,
|
|
481
|
+
markerEnd,
|
|
482
|
+
interactionWidth,
|
|
483
|
+
style
|
|
484
|
+
});
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
class MediaQuery {
|
|
488
|
+
current;
|
|
489
|
+
/**
|
|
490
|
+
* @param {string} query
|
|
491
|
+
* @param {boolean} [matches]
|
|
492
|
+
*/
|
|
493
|
+
constructor(query, matches = false) {
|
|
494
|
+
this.current = matches;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
function getVisibleNodes(nodeLookup, transform, width, height) {
|
|
498
|
+
const visibleNodes = /* @__PURE__ */ new Map();
|
|
499
|
+
getNodesInside(nodeLookup, { x: 0, y: 0, width, height }, transform, true).forEach((node) => {
|
|
500
|
+
visibleNodes.set(node.id, node);
|
|
501
|
+
});
|
|
502
|
+
return visibleNodes;
|
|
503
|
+
}
|
|
504
|
+
function getLayoutedEdges(options) {
|
|
505
|
+
const { edges, defaultEdgeOptions, nodeLookup, previousEdges, connectionMode, onerror, onlyRenderVisible, elevateEdgesOnSelect, zIndexMode } = options;
|
|
506
|
+
const layoutedEdges = /* @__PURE__ */ new Map();
|
|
507
|
+
for (const edge of edges) {
|
|
508
|
+
const sourceNode = nodeLookup.get(edge.source);
|
|
509
|
+
const targetNode = nodeLookup.get(edge.target);
|
|
510
|
+
if (!sourceNode || !targetNode) {
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
if (onlyRenderVisible) {
|
|
514
|
+
const { visibleNodes, transform, width, height } = options;
|
|
515
|
+
if (isEdgeVisible({
|
|
516
|
+
sourceNode,
|
|
517
|
+
targetNode,
|
|
518
|
+
width,
|
|
519
|
+
height,
|
|
520
|
+
transform
|
|
521
|
+
})) {
|
|
522
|
+
visibleNodes.set(sourceNode.id, sourceNode);
|
|
523
|
+
visibleNodes.set(targetNode.id, targetNode);
|
|
524
|
+
} else {
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
const previous = previousEdges.get(edge.id);
|
|
529
|
+
if (previous && edge === previous.edge && sourceNode == previous.sourceNode && targetNode == previous.targetNode) {
|
|
530
|
+
layoutedEdges.set(edge.id, previous);
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
const edgePosition = getEdgePosition({
|
|
534
|
+
id: edge.id,
|
|
535
|
+
sourceNode,
|
|
536
|
+
targetNode,
|
|
537
|
+
sourceHandle: edge.sourceHandle || null,
|
|
538
|
+
targetHandle: edge.targetHandle || null,
|
|
539
|
+
connectionMode,
|
|
540
|
+
onError: onerror
|
|
541
|
+
});
|
|
542
|
+
if (edgePosition) {
|
|
543
|
+
layoutedEdges.set(edge.id, {
|
|
544
|
+
...defaultEdgeOptions,
|
|
545
|
+
...edge,
|
|
546
|
+
...edgePosition,
|
|
547
|
+
zIndex: getElevatedEdgeZIndex({
|
|
548
|
+
selected: edge.selected,
|
|
549
|
+
zIndex: edge.zIndex ?? defaultEdgeOptions.zIndex,
|
|
550
|
+
sourceNode,
|
|
551
|
+
targetNode,
|
|
552
|
+
elevateOnSelect: elevateEdgesOnSelect,
|
|
553
|
+
zIndexMode
|
|
554
|
+
}),
|
|
555
|
+
sourceNode,
|
|
556
|
+
targetNode,
|
|
557
|
+
edge
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
return layoutedEdges;
|
|
562
|
+
}
|
|
563
|
+
const initialNodeTypes = {
|
|
564
|
+
input: InputNode,
|
|
565
|
+
output: OutputNode,
|
|
566
|
+
default: DefaultNode,
|
|
567
|
+
group: GroupNode
|
|
568
|
+
};
|
|
569
|
+
const initialEdgeTypes = {
|
|
570
|
+
straight: StraightEdgeInternal,
|
|
571
|
+
smoothstep: SmoothStepEdgeInternal,
|
|
572
|
+
default: BezierEdge,
|
|
573
|
+
step: StepEdgeInternal
|
|
574
|
+
};
|
|
575
|
+
function getInitialViewport(_nodesInitialized, fitView, initialViewport, width, height, nodeLookup) {
|
|
576
|
+
if (fitView && !initialViewport && width && height) {
|
|
577
|
+
const bounds = getInternalNodesBounds(nodeLookup, {
|
|
578
|
+
filter: (node) => !!((node.width || node.initialWidth) && (node.height || node.initialHeight))
|
|
579
|
+
});
|
|
580
|
+
return getViewportForBounds(bounds, width, height, 0.5, 2, 0.1);
|
|
581
|
+
} else {
|
|
582
|
+
return initialViewport ?? { x: 0, y: 0, zoom: 1 };
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
function getInitialStore(signals) {
|
|
586
|
+
class SvelteFlowStore {
|
|
587
|
+
#flowId = derived(() => signals.props.id ?? "1");
|
|
588
|
+
get flowId() {
|
|
589
|
+
return this.#flowId();
|
|
590
|
+
}
|
|
591
|
+
set flowId($$value) {
|
|
592
|
+
return this.#flowId($$value);
|
|
593
|
+
}
|
|
594
|
+
domNode = null;
|
|
595
|
+
panZoom = null;
|
|
596
|
+
width = signals.width ?? 0;
|
|
597
|
+
height = signals.height ?? 0;
|
|
598
|
+
zIndexMode = signals.props.zIndexMode ?? "basic";
|
|
599
|
+
#nodesInitialized = derived(() => {
|
|
600
|
+
const nodesInitialized = adoptUserNodes(signals.nodes, this.nodeLookup, this.parentLookup, {
|
|
601
|
+
nodeExtent: this.nodeExtent,
|
|
602
|
+
nodeOrigin: this.nodeOrigin,
|
|
603
|
+
elevateNodesOnSelect: signals.props.elevateNodesOnSelect ?? true,
|
|
604
|
+
checkEquality: true,
|
|
605
|
+
zIndexMode: this.zIndexMode
|
|
606
|
+
});
|
|
607
|
+
if (this.fitViewQueued && nodesInitialized) {
|
|
608
|
+
if (this.fitViewOptions?.duration) {
|
|
609
|
+
this.resolveFitView();
|
|
610
|
+
} else {
|
|
611
|
+
queueMicrotask(() => {
|
|
612
|
+
this.resolveFitView();
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return nodesInitialized;
|
|
617
|
+
});
|
|
618
|
+
get nodesInitialized() {
|
|
619
|
+
return this.#nodesInitialized();
|
|
620
|
+
}
|
|
621
|
+
set nodesInitialized($$value) {
|
|
622
|
+
return this.#nodesInitialized($$value);
|
|
623
|
+
}
|
|
624
|
+
#viewportInitialized = derived(() => this.panZoom !== null);
|
|
625
|
+
get viewportInitialized() {
|
|
626
|
+
return this.#viewportInitialized();
|
|
627
|
+
}
|
|
628
|
+
set viewportInitialized($$value) {
|
|
629
|
+
return this.#viewportInitialized($$value);
|
|
630
|
+
}
|
|
631
|
+
#_edges = derived(() => {
|
|
632
|
+
updateConnectionLookup(this.connectionLookup, this.edgeLookup, signals.edges);
|
|
633
|
+
return signals.edges;
|
|
634
|
+
});
|
|
635
|
+
get _edges() {
|
|
636
|
+
return this.#_edges();
|
|
637
|
+
}
|
|
638
|
+
set _edges($$value) {
|
|
639
|
+
return this.#_edges($$value);
|
|
640
|
+
}
|
|
641
|
+
get nodes() {
|
|
642
|
+
this.nodesInitialized;
|
|
643
|
+
return signals.nodes;
|
|
644
|
+
}
|
|
645
|
+
set nodes(nodes) {
|
|
646
|
+
signals.nodes = nodes;
|
|
647
|
+
}
|
|
648
|
+
get edges() {
|
|
649
|
+
return this._edges;
|
|
650
|
+
}
|
|
651
|
+
set edges(edges) {
|
|
652
|
+
signals.edges = edges;
|
|
653
|
+
}
|
|
654
|
+
_prevSelectedNodes = [];
|
|
655
|
+
_prevSelectedNodeIds = /* @__PURE__ */ new Set();
|
|
656
|
+
#selectedNodes = derived(() => {
|
|
657
|
+
const selectedNodesCount = this._prevSelectedNodeIds.size;
|
|
658
|
+
const selectedNodeIds = /* @__PURE__ */ new Set();
|
|
659
|
+
const selectedNodes = this.nodes.filter((node) => {
|
|
660
|
+
if (node.selected) {
|
|
661
|
+
selectedNodeIds.add(node.id);
|
|
662
|
+
this._prevSelectedNodeIds.delete(node.id);
|
|
663
|
+
}
|
|
664
|
+
return node.selected;
|
|
665
|
+
});
|
|
666
|
+
if (selectedNodesCount !== selectedNodeIds.size || this._prevSelectedNodeIds.size > 0) {
|
|
667
|
+
this._prevSelectedNodes = selectedNodes;
|
|
668
|
+
}
|
|
669
|
+
this._prevSelectedNodeIds = selectedNodeIds;
|
|
670
|
+
return this._prevSelectedNodes;
|
|
671
|
+
});
|
|
672
|
+
get selectedNodes() {
|
|
673
|
+
return this.#selectedNodes();
|
|
674
|
+
}
|
|
675
|
+
set selectedNodes($$value) {
|
|
676
|
+
return this.#selectedNodes($$value);
|
|
677
|
+
}
|
|
678
|
+
_prevSelectedEdges = [];
|
|
679
|
+
_prevSelectedEdgeIds = /* @__PURE__ */ new Set();
|
|
680
|
+
#selectedEdges = derived(() => {
|
|
681
|
+
const selectedEdgesCount = this._prevSelectedEdgeIds.size;
|
|
682
|
+
const selectedEdgeIds = /* @__PURE__ */ new Set();
|
|
683
|
+
const selectedEdges = this.edges.filter((edge) => {
|
|
684
|
+
if (edge.selected) {
|
|
685
|
+
selectedEdgeIds.add(edge.id);
|
|
686
|
+
this._prevSelectedEdgeIds.delete(edge.id);
|
|
687
|
+
}
|
|
688
|
+
return edge.selected;
|
|
689
|
+
});
|
|
690
|
+
if (selectedEdgesCount !== selectedEdgeIds.size || this._prevSelectedEdgeIds.size > 0) {
|
|
691
|
+
this._prevSelectedEdges = selectedEdges;
|
|
692
|
+
}
|
|
693
|
+
this._prevSelectedEdgeIds = selectedEdgeIds;
|
|
694
|
+
return this._prevSelectedEdges;
|
|
695
|
+
});
|
|
696
|
+
get selectedEdges() {
|
|
697
|
+
return this.#selectedEdges();
|
|
698
|
+
}
|
|
699
|
+
set selectedEdges($$value) {
|
|
700
|
+
return this.#selectedEdges($$value);
|
|
701
|
+
}
|
|
702
|
+
selectionChangeHandlers = /* @__PURE__ */ new Map();
|
|
703
|
+
nodeLookup = /* @__PURE__ */ new Map();
|
|
704
|
+
parentLookup = /* @__PURE__ */ new Map();
|
|
705
|
+
connectionLookup = /* @__PURE__ */ new Map();
|
|
706
|
+
edgeLookup = /* @__PURE__ */ new Map();
|
|
707
|
+
_prevVisibleEdges = /* @__PURE__ */ new Map();
|
|
708
|
+
#visible = derived(() => {
|
|
709
|
+
const {
|
|
710
|
+
// We need to access this._nodes to trigger on changes
|
|
711
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
712
|
+
nodes,
|
|
713
|
+
_edges: edges,
|
|
714
|
+
_prevVisibleEdges: previousEdges,
|
|
715
|
+
nodeLookup,
|
|
716
|
+
connectionMode,
|
|
717
|
+
onerror,
|
|
718
|
+
onlyRenderVisibleElements,
|
|
719
|
+
defaultEdgeOptions,
|
|
720
|
+
zIndexMode
|
|
721
|
+
} = this;
|
|
722
|
+
let visibleNodes;
|
|
723
|
+
let visibleEdges;
|
|
724
|
+
const options = {
|
|
725
|
+
edges,
|
|
726
|
+
defaultEdgeOptions,
|
|
727
|
+
previousEdges,
|
|
728
|
+
nodeLookup,
|
|
729
|
+
connectionMode,
|
|
730
|
+
elevateEdgesOnSelect: signals.props.elevateEdgesOnSelect ?? true,
|
|
731
|
+
zIndexMode,
|
|
732
|
+
onerror
|
|
733
|
+
};
|
|
734
|
+
if (onlyRenderVisibleElements) {
|
|
735
|
+
const { viewport, width, height } = this;
|
|
736
|
+
const transform = [viewport.x, viewport.y, viewport.zoom];
|
|
737
|
+
visibleNodes = getVisibleNodes(nodeLookup, transform, width, height);
|
|
738
|
+
visibleEdges = getLayoutedEdges({
|
|
739
|
+
...options,
|
|
740
|
+
onlyRenderVisible: true,
|
|
741
|
+
visibleNodes,
|
|
742
|
+
transform,
|
|
743
|
+
width,
|
|
744
|
+
height
|
|
745
|
+
});
|
|
746
|
+
} else {
|
|
747
|
+
visibleNodes = this.nodeLookup;
|
|
748
|
+
visibleEdges = getLayoutedEdges(options);
|
|
749
|
+
}
|
|
750
|
+
return { nodes: visibleNodes, edges: visibleEdges };
|
|
751
|
+
});
|
|
752
|
+
get visible() {
|
|
753
|
+
return this.#visible();
|
|
754
|
+
}
|
|
755
|
+
set visible($$value) {
|
|
756
|
+
return this.#visible($$value);
|
|
757
|
+
}
|
|
758
|
+
#nodesDraggable = derived(() => signals.props.nodesDraggable ?? true);
|
|
759
|
+
get nodesDraggable() {
|
|
760
|
+
return this.#nodesDraggable();
|
|
761
|
+
}
|
|
762
|
+
set nodesDraggable($$value) {
|
|
763
|
+
return this.#nodesDraggable($$value);
|
|
764
|
+
}
|
|
765
|
+
#nodesConnectable = derived(() => signals.props.nodesConnectable ?? true);
|
|
766
|
+
get nodesConnectable() {
|
|
767
|
+
return this.#nodesConnectable();
|
|
768
|
+
}
|
|
769
|
+
set nodesConnectable($$value) {
|
|
770
|
+
return this.#nodesConnectable($$value);
|
|
771
|
+
}
|
|
772
|
+
#elementsSelectable = derived(() => signals.props.elementsSelectable ?? true);
|
|
773
|
+
get elementsSelectable() {
|
|
774
|
+
return this.#elementsSelectable();
|
|
775
|
+
}
|
|
776
|
+
set elementsSelectable($$value) {
|
|
777
|
+
return this.#elementsSelectable($$value);
|
|
778
|
+
}
|
|
779
|
+
#nodesFocusable = derived(() => signals.props.nodesFocusable ?? true);
|
|
780
|
+
get nodesFocusable() {
|
|
781
|
+
return this.#nodesFocusable();
|
|
782
|
+
}
|
|
783
|
+
set nodesFocusable($$value) {
|
|
784
|
+
return this.#nodesFocusable($$value);
|
|
785
|
+
}
|
|
786
|
+
#edgesFocusable = derived(() => signals.props.edgesFocusable ?? true);
|
|
787
|
+
get edgesFocusable() {
|
|
788
|
+
return this.#edgesFocusable();
|
|
789
|
+
}
|
|
790
|
+
set edgesFocusable($$value) {
|
|
791
|
+
return this.#edgesFocusable($$value);
|
|
792
|
+
}
|
|
793
|
+
#disableKeyboardA11y = derived(() => signals.props.disableKeyboardA11y ?? false);
|
|
794
|
+
get disableKeyboardA11y() {
|
|
795
|
+
return this.#disableKeyboardA11y();
|
|
796
|
+
}
|
|
797
|
+
set disableKeyboardA11y($$value) {
|
|
798
|
+
return this.#disableKeyboardA11y($$value);
|
|
799
|
+
}
|
|
800
|
+
#minZoom = derived(() => signals.props.minZoom ?? 0.5);
|
|
801
|
+
get minZoom() {
|
|
802
|
+
return this.#minZoom();
|
|
803
|
+
}
|
|
804
|
+
set minZoom($$value) {
|
|
805
|
+
return this.#minZoom($$value);
|
|
806
|
+
}
|
|
807
|
+
#maxZoom = derived(() => signals.props.maxZoom ?? 2);
|
|
808
|
+
get maxZoom() {
|
|
809
|
+
return this.#maxZoom();
|
|
810
|
+
}
|
|
811
|
+
set maxZoom($$value) {
|
|
812
|
+
return this.#maxZoom($$value);
|
|
813
|
+
}
|
|
814
|
+
#nodeOrigin = derived(() => signals.props.nodeOrigin ?? [0, 0]);
|
|
815
|
+
get nodeOrigin() {
|
|
816
|
+
return this.#nodeOrigin();
|
|
817
|
+
}
|
|
818
|
+
set nodeOrigin($$value) {
|
|
819
|
+
return this.#nodeOrigin($$value);
|
|
820
|
+
}
|
|
821
|
+
#nodeExtent = derived(() => signals.props.nodeExtent ?? infiniteExtent);
|
|
822
|
+
get nodeExtent() {
|
|
823
|
+
return this.#nodeExtent();
|
|
824
|
+
}
|
|
825
|
+
set nodeExtent($$value) {
|
|
826
|
+
return this.#nodeExtent($$value);
|
|
827
|
+
}
|
|
828
|
+
#translateExtent = derived(() => signals.props.translateExtent ?? infiniteExtent);
|
|
829
|
+
get translateExtent() {
|
|
830
|
+
return this.#translateExtent();
|
|
831
|
+
}
|
|
832
|
+
set translateExtent($$value) {
|
|
833
|
+
return this.#translateExtent($$value);
|
|
834
|
+
}
|
|
835
|
+
#defaultEdgeOptions = derived(() => signals.props.defaultEdgeOptions ?? {});
|
|
836
|
+
get defaultEdgeOptions() {
|
|
837
|
+
return this.#defaultEdgeOptions();
|
|
838
|
+
}
|
|
839
|
+
set defaultEdgeOptions($$value) {
|
|
840
|
+
return this.#defaultEdgeOptions($$value);
|
|
841
|
+
}
|
|
842
|
+
#nodeDragThreshold = derived(() => signals.props.nodeDragThreshold ?? 1);
|
|
843
|
+
get nodeDragThreshold() {
|
|
844
|
+
return this.#nodeDragThreshold();
|
|
845
|
+
}
|
|
846
|
+
set nodeDragThreshold($$value) {
|
|
847
|
+
return this.#nodeDragThreshold($$value);
|
|
848
|
+
}
|
|
849
|
+
#autoPanOnNodeDrag = derived(() => signals.props.autoPanOnNodeDrag ?? true);
|
|
850
|
+
get autoPanOnNodeDrag() {
|
|
851
|
+
return this.#autoPanOnNodeDrag();
|
|
852
|
+
}
|
|
853
|
+
set autoPanOnNodeDrag($$value) {
|
|
854
|
+
return this.#autoPanOnNodeDrag($$value);
|
|
855
|
+
}
|
|
856
|
+
#autoPanOnConnect = derived(() => signals.props.autoPanOnConnect ?? true);
|
|
857
|
+
get autoPanOnConnect() {
|
|
858
|
+
return this.#autoPanOnConnect();
|
|
859
|
+
}
|
|
860
|
+
set autoPanOnConnect($$value) {
|
|
861
|
+
return this.#autoPanOnConnect($$value);
|
|
862
|
+
}
|
|
863
|
+
#autoPanOnNodeFocus = derived(() => signals.props.autoPanOnNodeFocus ?? true);
|
|
864
|
+
get autoPanOnNodeFocus() {
|
|
865
|
+
return this.#autoPanOnNodeFocus();
|
|
866
|
+
}
|
|
867
|
+
set autoPanOnNodeFocus($$value) {
|
|
868
|
+
return this.#autoPanOnNodeFocus($$value);
|
|
869
|
+
}
|
|
870
|
+
#autoPanSpeed = derived(() => signals.props.autoPanSpeed ?? 15);
|
|
871
|
+
get autoPanSpeed() {
|
|
872
|
+
return this.#autoPanSpeed();
|
|
873
|
+
}
|
|
874
|
+
set autoPanSpeed($$value) {
|
|
875
|
+
return this.#autoPanSpeed($$value);
|
|
876
|
+
}
|
|
877
|
+
#connectionDragThreshold = derived(() => signals.props.connectionDragThreshold ?? 1);
|
|
878
|
+
get connectionDragThreshold() {
|
|
879
|
+
return this.#connectionDragThreshold();
|
|
880
|
+
}
|
|
881
|
+
set connectionDragThreshold($$value) {
|
|
882
|
+
return this.#connectionDragThreshold($$value);
|
|
883
|
+
}
|
|
884
|
+
fitViewQueued = signals.props.fitView ?? false;
|
|
885
|
+
fitViewOptions = signals.props.fitViewOptions;
|
|
886
|
+
fitViewResolver = null;
|
|
887
|
+
#snapGrid = derived(() => signals.props.snapGrid ?? null);
|
|
888
|
+
get snapGrid() {
|
|
889
|
+
return this.#snapGrid();
|
|
890
|
+
}
|
|
891
|
+
set snapGrid($$value) {
|
|
892
|
+
return this.#snapGrid($$value);
|
|
893
|
+
}
|
|
894
|
+
dragging = false;
|
|
895
|
+
selectionRect = null;
|
|
896
|
+
selectionKeyPressed = false;
|
|
897
|
+
multiselectionKeyPressed = false;
|
|
898
|
+
deleteKeyPressed = false;
|
|
899
|
+
panActivationKeyPressed = false;
|
|
900
|
+
zoomActivationKeyPressed = false;
|
|
901
|
+
selectionRectMode = null;
|
|
902
|
+
ariaLiveMessage = "";
|
|
903
|
+
#selectionMode = derived(() => signals.props.selectionMode ?? SelectionMode.Partial);
|
|
904
|
+
get selectionMode() {
|
|
905
|
+
return this.#selectionMode();
|
|
906
|
+
}
|
|
907
|
+
set selectionMode($$value) {
|
|
908
|
+
return this.#selectionMode($$value);
|
|
909
|
+
}
|
|
910
|
+
#nodeTypes = derived(() => ({ ...initialNodeTypes, ...signals.props.nodeTypes }));
|
|
911
|
+
get nodeTypes() {
|
|
912
|
+
return this.#nodeTypes();
|
|
913
|
+
}
|
|
914
|
+
set nodeTypes($$value) {
|
|
915
|
+
return this.#nodeTypes($$value);
|
|
916
|
+
}
|
|
917
|
+
#edgeTypes = derived(() => ({ ...initialEdgeTypes, ...signals.props.edgeTypes }));
|
|
918
|
+
get edgeTypes() {
|
|
919
|
+
return this.#edgeTypes();
|
|
920
|
+
}
|
|
921
|
+
set edgeTypes($$value) {
|
|
922
|
+
return this.#edgeTypes($$value);
|
|
923
|
+
}
|
|
924
|
+
#noPanClass = derived(() => signals.props.noPanClass ?? "nopan");
|
|
925
|
+
get noPanClass() {
|
|
926
|
+
return this.#noPanClass();
|
|
927
|
+
}
|
|
928
|
+
set noPanClass($$value) {
|
|
929
|
+
return this.#noPanClass($$value);
|
|
930
|
+
}
|
|
931
|
+
#noDragClass = derived(() => signals.props.noDragClass ?? "nodrag");
|
|
932
|
+
get noDragClass() {
|
|
933
|
+
return this.#noDragClass();
|
|
934
|
+
}
|
|
935
|
+
set noDragClass($$value) {
|
|
936
|
+
return this.#noDragClass($$value);
|
|
937
|
+
}
|
|
938
|
+
#noWheelClass = derived(() => signals.props.noWheelClass ?? "nowheel");
|
|
939
|
+
get noWheelClass() {
|
|
940
|
+
return this.#noWheelClass();
|
|
941
|
+
}
|
|
942
|
+
set noWheelClass($$value) {
|
|
943
|
+
return this.#noWheelClass($$value);
|
|
944
|
+
}
|
|
945
|
+
#ariaLabelConfig = derived(() => mergeAriaLabelConfig(signals.props.ariaLabelConfig));
|
|
946
|
+
get ariaLabelConfig() {
|
|
947
|
+
return this.#ariaLabelConfig();
|
|
948
|
+
}
|
|
949
|
+
set ariaLabelConfig($$value) {
|
|
950
|
+
return this.#ariaLabelConfig($$value);
|
|
951
|
+
}
|
|
952
|
+
_viewport = getInitialViewport(this.nodesInitialized, signals.props.fitView, signals.props.initialViewport, this.width, this.height, this.nodeLookup);
|
|
953
|
+
get viewport() {
|
|
954
|
+
return signals.viewport ?? this._viewport;
|
|
955
|
+
}
|
|
956
|
+
set viewport(newViewport) {
|
|
957
|
+
if (signals.viewport) {
|
|
958
|
+
signals.viewport = newViewport;
|
|
959
|
+
}
|
|
960
|
+
this._viewport = newViewport;
|
|
961
|
+
}
|
|
962
|
+
// _connection is viewport independent and originating from XYHandle
|
|
963
|
+
_connection = initialConnection;
|
|
964
|
+
#connection = derived(
|
|
965
|
+
// We derive a viewport dependent connection here
|
|
966
|
+
() => {
|
|
967
|
+
if (!this._connection.inProgress) {
|
|
968
|
+
return this._connection;
|
|
969
|
+
}
|
|
970
|
+
return {
|
|
971
|
+
...this._connection,
|
|
972
|
+
to: pointToRendererPoint(this._connection.to, [this.viewport.x, this.viewport.y, this.viewport.zoom])
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
);
|
|
976
|
+
get connection() {
|
|
977
|
+
return this.#connection();
|
|
978
|
+
}
|
|
979
|
+
set connection($$value) {
|
|
980
|
+
return this.#connection($$value);
|
|
981
|
+
}
|
|
982
|
+
#connectionMode = derived(() => signals.props.connectionMode ?? ConnectionMode.Strict);
|
|
983
|
+
get connectionMode() {
|
|
984
|
+
return this.#connectionMode();
|
|
985
|
+
}
|
|
986
|
+
set connectionMode($$value) {
|
|
987
|
+
return this.#connectionMode($$value);
|
|
988
|
+
}
|
|
989
|
+
#connectionRadius = derived(() => signals.props.connectionRadius ?? 20);
|
|
990
|
+
get connectionRadius() {
|
|
991
|
+
return this.#connectionRadius();
|
|
992
|
+
}
|
|
993
|
+
set connectionRadius($$value) {
|
|
994
|
+
return this.#connectionRadius($$value);
|
|
995
|
+
}
|
|
996
|
+
#isValidConnection = derived(() => signals.props.isValidConnection ?? (() => true));
|
|
997
|
+
get isValidConnection() {
|
|
998
|
+
return this.#isValidConnection();
|
|
999
|
+
}
|
|
1000
|
+
set isValidConnection($$value) {
|
|
1001
|
+
return this.#isValidConnection($$value);
|
|
1002
|
+
}
|
|
1003
|
+
#selectNodesOnDrag = derived(() => signals.props.selectNodesOnDrag ?? true);
|
|
1004
|
+
get selectNodesOnDrag() {
|
|
1005
|
+
return this.#selectNodesOnDrag();
|
|
1006
|
+
}
|
|
1007
|
+
set selectNodesOnDrag($$value) {
|
|
1008
|
+
return this.#selectNodesOnDrag($$value);
|
|
1009
|
+
}
|
|
1010
|
+
#defaultMarkerColor = derived(() => signals.props.defaultMarkerColor === void 0 ? "#b1b1b7" : signals.props.defaultMarkerColor);
|
|
1011
|
+
get defaultMarkerColor() {
|
|
1012
|
+
return this.#defaultMarkerColor();
|
|
1013
|
+
}
|
|
1014
|
+
set defaultMarkerColor($$value) {
|
|
1015
|
+
return this.#defaultMarkerColor($$value);
|
|
1016
|
+
}
|
|
1017
|
+
#markers = derived(() => {
|
|
1018
|
+
return createMarkerIds(signals.edges, {
|
|
1019
|
+
defaultColor: this.defaultMarkerColor,
|
|
1020
|
+
id: this.flowId,
|
|
1021
|
+
defaultMarkerStart: this.defaultEdgeOptions.markerStart,
|
|
1022
|
+
defaultMarkerEnd: this.defaultEdgeOptions.markerEnd
|
|
1023
|
+
});
|
|
1024
|
+
});
|
|
1025
|
+
get markers() {
|
|
1026
|
+
return this.#markers();
|
|
1027
|
+
}
|
|
1028
|
+
set markers($$value) {
|
|
1029
|
+
return this.#markers($$value);
|
|
1030
|
+
}
|
|
1031
|
+
#onlyRenderVisibleElements = derived(() => signals.props.onlyRenderVisibleElements ?? false);
|
|
1032
|
+
get onlyRenderVisibleElements() {
|
|
1033
|
+
return this.#onlyRenderVisibleElements();
|
|
1034
|
+
}
|
|
1035
|
+
set onlyRenderVisibleElements($$value) {
|
|
1036
|
+
return this.#onlyRenderVisibleElements($$value);
|
|
1037
|
+
}
|
|
1038
|
+
#onerror = derived(() => signals.props.onflowerror ?? devWarn);
|
|
1039
|
+
get onerror() {
|
|
1040
|
+
return this.#onerror();
|
|
1041
|
+
}
|
|
1042
|
+
set onerror($$value) {
|
|
1043
|
+
return this.#onerror($$value);
|
|
1044
|
+
}
|
|
1045
|
+
#ondelete = derived(() => signals.props.ondelete);
|
|
1046
|
+
get ondelete() {
|
|
1047
|
+
return this.#ondelete();
|
|
1048
|
+
}
|
|
1049
|
+
set ondelete($$value) {
|
|
1050
|
+
return this.#ondelete($$value);
|
|
1051
|
+
}
|
|
1052
|
+
#onbeforedelete = derived(() => signals.props.onbeforedelete);
|
|
1053
|
+
get onbeforedelete() {
|
|
1054
|
+
return this.#onbeforedelete();
|
|
1055
|
+
}
|
|
1056
|
+
set onbeforedelete($$value) {
|
|
1057
|
+
return this.#onbeforedelete($$value);
|
|
1058
|
+
}
|
|
1059
|
+
#onbeforeconnect = derived(() => signals.props.onbeforeconnect);
|
|
1060
|
+
get onbeforeconnect() {
|
|
1061
|
+
return this.#onbeforeconnect();
|
|
1062
|
+
}
|
|
1063
|
+
set onbeforeconnect($$value) {
|
|
1064
|
+
return this.#onbeforeconnect($$value);
|
|
1065
|
+
}
|
|
1066
|
+
#onconnect = derived(() => signals.props.onconnect);
|
|
1067
|
+
get onconnect() {
|
|
1068
|
+
return this.#onconnect();
|
|
1069
|
+
}
|
|
1070
|
+
set onconnect($$value) {
|
|
1071
|
+
return this.#onconnect($$value);
|
|
1072
|
+
}
|
|
1073
|
+
#onconnectstart = derived(() => signals.props.onconnectstart);
|
|
1074
|
+
get onconnectstart() {
|
|
1075
|
+
return this.#onconnectstart();
|
|
1076
|
+
}
|
|
1077
|
+
set onconnectstart($$value) {
|
|
1078
|
+
return this.#onconnectstart($$value);
|
|
1079
|
+
}
|
|
1080
|
+
#onconnectend = derived(() => signals.props.onconnectend);
|
|
1081
|
+
get onconnectend() {
|
|
1082
|
+
return this.#onconnectend();
|
|
1083
|
+
}
|
|
1084
|
+
set onconnectend($$value) {
|
|
1085
|
+
return this.#onconnectend($$value);
|
|
1086
|
+
}
|
|
1087
|
+
#onbeforereconnect = derived(() => signals.props.onbeforereconnect);
|
|
1088
|
+
get onbeforereconnect() {
|
|
1089
|
+
return this.#onbeforereconnect();
|
|
1090
|
+
}
|
|
1091
|
+
set onbeforereconnect($$value) {
|
|
1092
|
+
return this.#onbeforereconnect($$value);
|
|
1093
|
+
}
|
|
1094
|
+
#onreconnect = derived(() => signals.props.onreconnect);
|
|
1095
|
+
get onreconnect() {
|
|
1096
|
+
return this.#onreconnect();
|
|
1097
|
+
}
|
|
1098
|
+
set onreconnect($$value) {
|
|
1099
|
+
return this.#onreconnect($$value);
|
|
1100
|
+
}
|
|
1101
|
+
#onreconnectstart = derived(() => signals.props.onreconnectstart);
|
|
1102
|
+
get onreconnectstart() {
|
|
1103
|
+
return this.#onreconnectstart();
|
|
1104
|
+
}
|
|
1105
|
+
set onreconnectstart($$value) {
|
|
1106
|
+
return this.#onreconnectstart($$value);
|
|
1107
|
+
}
|
|
1108
|
+
#onreconnectend = derived(() => signals.props.onreconnectend);
|
|
1109
|
+
get onreconnectend() {
|
|
1110
|
+
return this.#onreconnectend();
|
|
1111
|
+
}
|
|
1112
|
+
set onreconnectend($$value) {
|
|
1113
|
+
return this.#onreconnectend($$value);
|
|
1114
|
+
}
|
|
1115
|
+
#clickConnect = derived(() => signals.props.clickConnect ?? true);
|
|
1116
|
+
get clickConnect() {
|
|
1117
|
+
return this.#clickConnect();
|
|
1118
|
+
}
|
|
1119
|
+
set clickConnect($$value) {
|
|
1120
|
+
return this.#clickConnect($$value);
|
|
1121
|
+
}
|
|
1122
|
+
#onclickconnectstart = derived(() => signals.props.onclickconnectstart);
|
|
1123
|
+
get onclickconnectstart() {
|
|
1124
|
+
return this.#onclickconnectstart();
|
|
1125
|
+
}
|
|
1126
|
+
set onclickconnectstart($$value) {
|
|
1127
|
+
return this.#onclickconnectstart($$value);
|
|
1128
|
+
}
|
|
1129
|
+
#onclickconnectend = derived(() => signals.props.onclickconnectend);
|
|
1130
|
+
get onclickconnectend() {
|
|
1131
|
+
return this.#onclickconnectend();
|
|
1132
|
+
}
|
|
1133
|
+
set onclickconnectend($$value) {
|
|
1134
|
+
return this.#onclickconnectend($$value);
|
|
1135
|
+
}
|
|
1136
|
+
clickConnectStartHandle = null;
|
|
1137
|
+
#onselectiondrag = derived(() => signals.props.onselectiondrag);
|
|
1138
|
+
get onselectiondrag() {
|
|
1139
|
+
return this.#onselectiondrag();
|
|
1140
|
+
}
|
|
1141
|
+
set onselectiondrag($$value) {
|
|
1142
|
+
return this.#onselectiondrag($$value);
|
|
1143
|
+
}
|
|
1144
|
+
#onselectiondragstart = derived(() => signals.props.onselectiondragstart);
|
|
1145
|
+
get onselectiondragstart() {
|
|
1146
|
+
return this.#onselectiondragstart();
|
|
1147
|
+
}
|
|
1148
|
+
set onselectiondragstart($$value) {
|
|
1149
|
+
return this.#onselectiondragstart($$value);
|
|
1150
|
+
}
|
|
1151
|
+
#onselectiondragstop = derived(() => signals.props.onselectiondragstop);
|
|
1152
|
+
get onselectiondragstop() {
|
|
1153
|
+
return this.#onselectiondragstop();
|
|
1154
|
+
}
|
|
1155
|
+
set onselectiondragstop($$value) {
|
|
1156
|
+
return this.#onselectiondragstop($$value);
|
|
1157
|
+
}
|
|
1158
|
+
resolveFitView = async () => {
|
|
1159
|
+
if (!this.panZoom) {
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
await fitViewport(
|
|
1163
|
+
{
|
|
1164
|
+
nodes: this.nodeLookup,
|
|
1165
|
+
width: this.width,
|
|
1166
|
+
height: this.height,
|
|
1167
|
+
panZoom: this.panZoom,
|
|
1168
|
+
minZoom: this.minZoom,
|
|
1169
|
+
maxZoom: this.maxZoom
|
|
1170
|
+
},
|
|
1171
|
+
this.fitViewOptions
|
|
1172
|
+
);
|
|
1173
|
+
this.fitViewResolver?.resolve(true);
|
|
1174
|
+
this.fitViewQueued = false;
|
|
1175
|
+
this.fitViewOptions = void 0;
|
|
1176
|
+
this.fitViewResolver = null;
|
|
1177
|
+
};
|
|
1178
|
+
_prefersDark = new MediaQuery("(prefers-color-scheme: dark)", signals.props.colorModeSSR === "dark");
|
|
1179
|
+
#colorMode = derived(() => signals.props.colorMode === "system" ? this._prefersDark.current ? "dark" : "light" : signals.props.colorMode ?? "light");
|
|
1180
|
+
get colorMode() {
|
|
1181
|
+
return this.#colorMode();
|
|
1182
|
+
}
|
|
1183
|
+
set colorMode($$value) {
|
|
1184
|
+
return this.#colorMode($$value);
|
|
1185
|
+
}
|
|
1186
|
+
constructor() {
|
|
1187
|
+
if (process.env.NODE_ENV === "development") {
|
|
1188
|
+
warnIfDeeplyReactive(signals.nodes, "nodes");
|
|
1189
|
+
warnIfDeeplyReactive(signals.edges, "edges");
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
resetStoreValues() {
|
|
1193
|
+
this.dragging = false;
|
|
1194
|
+
this.selectionRect = null;
|
|
1195
|
+
this.selectionRectMode = null;
|
|
1196
|
+
this.selectionKeyPressed = false;
|
|
1197
|
+
this.multiselectionKeyPressed = false;
|
|
1198
|
+
this.deleteKeyPressed = false;
|
|
1199
|
+
this.panActivationKeyPressed = false;
|
|
1200
|
+
this.zoomActivationKeyPressed = false;
|
|
1201
|
+
this._connection = initialConnection;
|
|
1202
|
+
this.clickConnectStartHandle = null;
|
|
1203
|
+
this.viewport = signals.props.initialViewport ?? { x: 0, y: 0, zoom: 1 };
|
|
1204
|
+
this.ariaLiveMessage = "";
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
return new SvelteFlowStore();
|
|
1208
|
+
}
|
|
1209
|
+
function warnIfDeeplyReactive(array, name) {
|
|
1210
|
+
try {
|
|
1211
|
+
if (array && array.length > 0) {
|
|
1212
|
+
structuredClone(array[0]);
|
|
1213
|
+
}
|
|
1214
|
+
} catch {
|
|
1215
|
+
console.warn(`Use $state.raw for ${name} to prevent performance issues.`);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
function useStore() {
|
|
1219
|
+
const storeContext = getContext(key);
|
|
1220
|
+
if (!storeContext) {
|
|
1221
|
+
throw new Error("To call useStore outside of <SvelteFlow /> you need to wrap your component in a <SvelteFlowProvider />");
|
|
1222
|
+
}
|
|
1223
|
+
return storeContext.getStore();
|
|
1224
|
+
}
|
|
1225
|
+
const key = /* @__PURE__ */ Symbol();
|
|
1226
|
+
function createStore(signals) {
|
|
1227
|
+
const store = getInitialStore(signals);
|
|
1228
|
+
function setNodeTypes(nodeTypes) {
|
|
1229
|
+
store.nodeTypes = {
|
|
1230
|
+
...initialNodeTypes,
|
|
1231
|
+
...nodeTypes
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
function setEdgeTypes(edgeTypes) {
|
|
1235
|
+
store.edgeTypes = {
|
|
1236
|
+
...initialEdgeTypes,
|
|
1237
|
+
...edgeTypes
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
function addEdge$1(edgeParams) {
|
|
1241
|
+
store.edges = addEdge(edgeParams, store.edges);
|
|
1242
|
+
}
|
|
1243
|
+
const updateNodePositions = (nodeDragItems, dragging = false) => {
|
|
1244
|
+
store.nodes = store.nodes.map((node) => {
|
|
1245
|
+
if (store.connection.inProgress && store.connection.fromNode.id === node.id) {
|
|
1246
|
+
const internalNode = store.nodeLookup.get(node.id);
|
|
1247
|
+
if (internalNode) {
|
|
1248
|
+
store.connection = {
|
|
1249
|
+
...store.connection,
|
|
1250
|
+
from: getHandlePosition(internalNode, store.connection.fromHandle, Position.Left, true)
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
const dragItem = nodeDragItems.get(node.id);
|
|
1255
|
+
return dragItem ? { ...node, position: dragItem.position, dragging } : node;
|
|
1256
|
+
});
|
|
1257
|
+
};
|
|
1258
|
+
function updateNodeInternals$1(updates) {
|
|
1259
|
+
const { changes, updatedInternals } = updateNodeInternals(updates, store.nodeLookup, store.parentLookup, store.domNode, store.nodeOrigin, store.nodeExtent, store.zIndexMode);
|
|
1260
|
+
if (!updatedInternals) {
|
|
1261
|
+
return;
|
|
1262
|
+
}
|
|
1263
|
+
updateAbsolutePositions(store.nodeLookup, store.parentLookup, {
|
|
1264
|
+
nodeOrigin: store.nodeOrigin,
|
|
1265
|
+
nodeExtent: store.nodeExtent,
|
|
1266
|
+
zIndexMode: store.zIndexMode
|
|
1267
|
+
});
|
|
1268
|
+
if (store.fitViewQueued) {
|
|
1269
|
+
store.resolveFitView();
|
|
1270
|
+
}
|
|
1271
|
+
const newNodes = /* @__PURE__ */ new Map();
|
|
1272
|
+
for (const change of changes) {
|
|
1273
|
+
const userNode = store.nodeLookup.get(change.id)?.internals.userNode;
|
|
1274
|
+
if (!userNode) {
|
|
1275
|
+
continue;
|
|
1276
|
+
}
|
|
1277
|
+
const node = { ...userNode };
|
|
1278
|
+
switch (change.type) {
|
|
1279
|
+
case "dimensions": {
|
|
1280
|
+
const measured = { ...node.measured, ...change.dimensions };
|
|
1281
|
+
if (change.setAttributes) {
|
|
1282
|
+
node.width = change.dimensions?.width ?? node.width;
|
|
1283
|
+
node.height = change.dimensions?.height ?? node.height;
|
|
1284
|
+
}
|
|
1285
|
+
node.measured = measured;
|
|
1286
|
+
break;
|
|
1287
|
+
}
|
|
1288
|
+
case "position":
|
|
1289
|
+
node.position = change.position ?? node.position;
|
|
1290
|
+
break;
|
|
1291
|
+
}
|
|
1292
|
+
newNodes.set(change.id, node);
|
|
1293
|
+
}
|
|
1294
|
+
store.nodes = store.nodes.map((node) => newNodes.get(node.id) ?? node);
|
|
1295
|
+
}
|
|
1296
|
+
function fitView(options) {
|
|
1297
|
+
const fitViewResolver = store.fitViewResolver ?? Promise.withResolvers();
|
|
1298
|
+
store.fitViewQueued = true;
|
|
1299
|
+
store.fitViewOptions = options;
|
|
1300
|
+
store.fitViewResolver = fitViewResolver;
|
|
1301
|
+
store.nodes = [...store.nodes];
|
|
1302
|
+
return fitViewResolver.promise;
|
|
1303
|
+
}
|
|
1304
|
+
async function setCenter(x, y, options) {
|
|
1305
|
+
const nextZoom = typeof options?.zoom !== "undefined" ? options.zoom : store.maxZoom;
|
|
1306
|
+
const currentPanZoom = store.panZoom;
|
|
1307
|
+
if (!currentPanZoom) {
|
|
1308
|
+
return Promise.resolve(false);
|
|
1309
|
+
}
|
|
1310
|
+
await currentPanZoom.setViewport({
|
|
1311
|
+
x: store.width / 2 - x * nextZoom,
|
|
1312
|
+
y: store.height / 2 - y * nextZoom,
|
|
1313
|
+
zoom: nextZoom
|
|
1314
|
+
}, { duration: options?.duration, ease: options?.ease, interpolate: options?.interpolate });
|
|
1315
|
+
return Promise.resolve(true);
|
|
1316
|
+
}
|
|
1317
|
+
function zoomBy(factor, options) {
|
|
1318
|
+
const panZoom = store.panZoom;
|
|
1319
|
+
if (!panZoom) {
|
|
1320
|
+
return Promise.resolve(false);
|
|
1321
|
+
}
|
|
1322
|
+
return panZoom.scaleBy(factor, options);
|
|
1323
|
+
}
|
|
1324
|
+
function zoomIn(options) {
|
|
1325
|
+
return zoomBy(1.2, options);
|
|
1326
|
+
}
|
|
1327
|
+
function zoomOut(options) {
|
|
1328
|
+
return zoomBy(1 / 1.2, options);
|
|
1329
|
+
}
|
|
1330
|
+
function setMinZoom(minZoom) {
|
|
1331
|
+
const panZoom = store.panZoom;
|
|
1332
|
+
if (panZoom) {
|
|
1333
|
+
panZoom.setScaleExtent([minZoom, store.maxZoom]);
|
|
1334
|
+
store.minZoom = minZoom;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
function setMaxZoom(maxZoom) {
|
|
1338
|
+
const panZoom = store.panZoom;
|
|
1339
|
+
if (panZoom) {
|
|
1340
|
+
panZoom.setScaleExtent([store.minZoom, maxZoom]);
|
|
1341
|
+
store.maxZoom = maxZoom;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
function setTranslateExtent(extent) {
|
|
1345
|
+
const panZoom = store.panZoom;
|
|
1346
|
+
if (panZoom) {
|
|
1347
|
+
panZoom.setTranslateExtent(extent);
|
|
1348
|
+
store.translateExtent = extent;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
function deselect(elements, elementsToDeselect = null) {
|
|
1352
|
+
let deselected = false;
|
|
1353
|
+
const newElements = elements.map((element) => {
|
|
1354
|
+
const shouldDeselect = elementsToDeselect ? elementsToDeselect.has(element.id) : true;
|
|
1355
|
+
if (shouldDeselect && element.selected) {
|
|
1356
|
+
deselected = true;
|
|
1357
|
+
return { ...element, selected: false };
|
|
1358
|
+
}
|
|
1359
|
+
return element;
|
|
1360
|
+
});
|
|
1361
|
+
return [deselected, newElements];
|
|
1362
|
+
}
|
|
1363
|
+
function unselectNodesAndEdges(params) {
|
|
1364
|
+
const nodesToDeselect = params?.nodes ? new Set(params.nodes.map((node) => node.id)) : null;
|
|
1365
|
+
const [nodesDeselected, newNodes] = deselect(store.nodes, nodesToDeselect);
|
|
1366
|
+
if (nodesDeselected) {
|
|
1367
|
+
store.nodes = newNodes;
|
|
1368
|
+
}
|
|
1369
|
+
const edgesToDeselect = params?.edges ? new Set(params.edges.map((node) => node.id)) : null;
|
|
1370
|
+
const [edgesDeselected, newEdges] = deselect(store.edges, edgesToDeselect);
|
|
1371
|
+
if (edgesDeselected) {
|
|
1372
|
+
store.edges = newEdges;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
function addSelectedNodes(ids) {
|
|
1376
|
+
const isMultiSelection = store.multiselectionKeyPressed;
|
|
1377
|
+
store.nodes = store.nodes.map((node) => {
|
|
1378
|
+
const nodeWillBeSelected = ids.includes(node.id);
|
|
1379
|
+
const selected = isMultiSelection ? node.selected || nodeWillBeSelected : nodeWillBeSelected;
|
|
1380
|
+
if (!!node.selected !== selected) {
|
|
1381
|
+
return { ...node, selected };
|
|
1382
|
+
}
|
|
1383
|
+
return node;
|
|
1384
|
+
});
|
|
1385
|
+
if (!isMultiSelection) {
|
|
1386
|
+
unselectNodesAndEdges({ nodes: [] });
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
function addSelectedEdges(ids) {
|
|
1390
|
+
const isMultiSelection = store.multiselectionKeyPressed;
|
|
1391
|
+
store.edges = store.edges.map((edge) => {
|
|
1392
|
+
const edgeWillBeSelected = ids.includes(edge.id);
|
|
1393
|
+
const selected = isMultiSelection ? edge.selected || edgeWillBeSelected : edgeWillBeSelected;
|
|
1394
|
+
if (!!edge.selected !== selected) {
|
|
1395
|
+
return { ...edge, selected };
|
|
1396
|
+
}
|
|
1397
|
+
return edge;
|
|
1398
|
+
});
|
|
1399
|
+
if (!isMultiSelection) {
|
|
1400
|
+
unselectNodesAndEdges({ edges: [] });
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
function handleNodeSelection(id, unselect, nodeRef) {
|
|
1404
|
+
const node = store.nodeLookup.get(id);
|
|
1405
|
+
if (!node) {
|
|
1406
|
+
console.warn("012", errorMessages["error012"](id));
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1409
|
+
store.selectionRect = null;
|
|
1410
|
+
store.selectionRectMode = null;
|
|
1411
|
+
if (!node.selected) {
|
|
1412
|
+
addSelectedNodes([id]);
|
|
1413
|
+
} else if (unselect || node.selected && store.multiselectionKeyPressed) {
|
|
1414
|
+
unselectNodesAndEdges({ nodes: [node], edges: [] });
|
|
1415
|
+
requestAnimationFrame(() => nodeRef?.blur());
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
function handleEdgeSelection(id) {
|
|
1419
|
+
const edge = store.edgeLookup.get(id);
|
|
1420
|
+
if (!edge) {
|
|
1421
|
+
console.warn("012", errorMessages["error012"](id));
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1424
|
+
const selectable = edge.selectable || store.elementsSelectable && typeof edge.selectable === "undefined";
|
|
1425
|
+
if (selectable) {
|
|
1426
|
+
store.selectionRect = null;
|
|
1427
|
+
store.selectionRectMode = null;
|
|
1428
|
+
if (!edge.selected) {
|
|
1429
|
+
addSelectedEdges([id]);
|
|
1430
|
+
} else if (edge.selected && store.multiselectionKeyPressed) {
|
|
1431
|
+
unselectNodesAndEdges({ nodes: [], edges: [edge] });
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
function moveSelectedNodes(direction, factor) {
|
|
1436
|
+
const { nodeExtent, snapGrid, nodeOrigin, nodeLookup, nodesDraggable, onerror } = store;
|
|
1437
|
+
const nodeUpdates = /* @__PURE__ */ new Map();
|
|
1438
|
+
const xVelo = snapGrid?.[0] ?? 5;
|
|
1439
|
+
const yVelo = snapGrid?.[1] ?? 5;
|
|
1440
|
+
const xDiff = direction.x * xVelo * factor;
|
|
1441
|
+
const yDiff = direction.y * yVelo * factor;
|
|
1442
|
+
for (const node of nodeLookup.values()) {
|
|
1443
|
+
const isSelected = node.selected && (node.draggable || nodesDraggable && typeof node.draggable === "undefined");
|
|
1444
|
+
if (!isSelected) {
|
|
1445
|
+
continue;
|
|
1446
|
+
}
|
|
1447
|
+
let nextPosition = {
|
|
1448
|
+
x: node.internals.positionAbsolute.x + xDiff,
|
|
1449
|
+
y: node.internals.positionAbsolute.y + yDiff
|
|
1450
|
+
};
|
|
1451
|
+
if (snapGrid) {
|
|
1452
|
+
nextPosition = snapPosition(nextPosition, snapGrid);
|
|
1453
|
+
}
|
|
1454
|
+
const { position, positionAbsolute } = calculateNodePosition({
|
|
1455
|
+
nodeId: node.id,
|
|
1456
|
+
nextPosition,
|
|
1457
|
+
nodeLookup,
|
|
1458
|
+
nodeExtent,
|
|
1459
|
+
nodeOrigin,
|
|
1460
|
+
onError: onerror
|
|
1461
|
+
});
|
|
1462
|
+
node.position = position;
|
|
1463
|
+
node.internals.positionAbsolute = positionAbsolute;
|
|
1464
|
+
nodeUpdates.set(node.id, node);
|
|
1465
|
+
}
|
|
1466
|
+
updateNodePositions(nodeUpdates);
|
|
1467
|
+
}
|
|
1468
|
+
function panBy$1(delta) {
|
|
1469
|
+
return panBy({
|
|
1470
|
+
delta,
|
|
1471
|
+
panZoom: store.panZoom,
|
|
1472
|
+
transform: [store.viewport.x, store.viewport.y, store.viewport.zoom],
|
|
1473
|
+
translateExtent: store.translateExtent,
|
|
1474
|
+
width: store.width,
|
|
1475
|
+
height: store.height
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
const updateConnection = (newConnection) => {
|
|
1479
|
+
store._connection = { ...newConnection };
|
|
1480
|
+
};
|
|
1481
|
+
function cancelConnection() {
|
|
1482
|
+
store._connection = initialConnection;
|
|
1483
|
+
}
|
|
1484
|
+
function reset() {
|
|
1485
|
+
store.resetStoreValues();
|
|
1486
|
+
unselectNodesAndEdges();
|
|
1487
|
+
}
|
|
1488
|
+
const storeWithActions = Object.assign(store, {
|
|
1489
|
+
setNodeTypes,
|
|
1490
|
+
setEdgeTypes,
|
|
1491
|
+
addEdge: addEdge$1,
|
|
1492
|
+
updateNodePositions,
|
|
1493
|
+
updateNodeInternals: updateNodeInternals$1,
|
|
1494
|
+
zoomIn,
|
|
1495
|
+
zoomOut,
|
|
1496
|
+
fitView,
|
|
1497
|
+
setCenter,
|
|
1498
|
+
setMinZoom,
|
|
1499
|
+
setMaxZoom,
|
|
1500
|
+
setTranslateExtent,
|
|
1501
|
+
unselectNodesAndEdges,
|
|
1502
|
+
addSelectedNodes,
|
|
1503
|
+
addSelectedEdges,
|
|
1504
|
+
handleNodeSelection,
|
|
1505
|
+
handleEdgeSelection,
|
|
1506
|
+
moveSelectedNodes,
|
|
1507
|
+
panBy: panBy$1,
|
|
1508
|
+
updateConnection,
|
|
1509
|
+
cancelConnection,
|
|
1510
|
+
reset
|
|
1511
|
+
});
|
|
1512
|
+
return storeWithActions;
|
|
1513
|
+
}
|
|
1514
|
+
function Zoom($$renderer, $$props) {
|
|
1515
|
+
$$renderer.component(($$renderer2) => {
|
|
1516
|
+
let {
|
|
1517
|
+
store = void 0,
|
|
1518
|
+
panOnScrollMode,
|
|
1519
|
+
preventScrolling,
|
|
1520
|
+
zoomOnScroll,
|
|
1521
|
+
zoomOnDoubleClick,
|
|
1522
|
+
zoomOnPinch,
|
|
1523
|
+
panOnDrag,
|
|
1524
|
+
panOnScroll,
|
|
1525
|
+
panOnScrollSpeed,
|
|
1526
|
+
paneClickDistance,
|
|
1527
|
+
selectionOnDrag,
|
|
1528
|
+
onmovestart,
|
|
1529
|
+
onmove,
|
|
1530
|
+
onmoveend,
|
|
1531
|
+
oninit,
|
|
1532
|
+
children
|
|
1533
|
+
} = $$props;
|
|
1534
|
+
store.panActivationKeyPressed || panOnDrag;
|
|
1535
|
+
store.panActivationKeyPressed || panOnScroll;
|
|
1536
|
+
const { viewport: initialViewport } = store;
|
|
1537
|
+
$$renderer2.push(`<div class="svelte-flow__zoom svelte-flow__container">`);
|
|
1538
|
+
children($$renderer2);
|
|
1539
|
+
$$renderer2.push(`<!----></div>`);
|
|
1540
|
+
bind_props($$props, { store });
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
function Pane($$renderer, $$props) {
|
|
1544
|
+
$$renderer.component(($$renderer2) => {
|
|
1545
|
+
let {
|
|
1546
|
+
store = void 0,
|
|
1547
|
+
panOnDrag = true,
|
|
1548
|
+
paneClickDistance = 1,
|
|
1549
|
+
selectionOnDrag,
|
|
1550
|
+
onpaneclick,
|
|
1551
|
+
onpanecontextmenu,
|
|
1552
|
+
onselectionstart,
|
|
1553
|
+
onselectionend,
|
|
1554
|
+
children
|
|
1555
|
+
} = $$props;
|
|
1556
|
+
let panOnDragActive = store.panActivationKeyPressed || panOnDrag;
|
|
1557
|
+
let isSelecting = store.selectionKeyPressed || !!store.selectionRect || selectionOnDrag && panOnDragActive !== true;
|
|
1558
|
+
store.elementsSelectable && (isSelecting || store.selectionRectMode === "user");
|
|
1559
|
+
$$renderer2.push(`<div${attr_class("svelte-flow__pane svelte-flow__container", void 0, {
|
|
1560
|
+
"draggable": panOnDrag === true || Array.isArray(panOnDrag) && panOnDrag.includes(0),
|
|
1561
|
+
"dragging": store.dragging,
|
|
1562
|
+
"selection": isSelecting
|
|
1563
|
+
})}>`);
|
|
1564
|
+
children($$renderer2);
|
|
1565
|
+
$$renderer2.push(`<!----></div>`);
|
|
1566
|
+
bind_props($$props, { store });
|
|
1567
|
+
});
|
|
1568
|
+
}
|
|
1569
|
+
function Viewport($$renderer, $$props) {
|
|
1570
|
+
$$renderer.component(($$renderer2) => {
|
|
1571
|
+
let { store = void 0, children } = $$props;
|
|
1572
|
+
$$renderer2.push(`<div class="svelte-flow__viewport xyflow__viewport svelte-flow__container"${attr_style("", {
|
|
1573
|
+
transform: `translate(${stringify(store.viewport.x)}px, ${stringify(store.viewport.y)}px) scale(${stringify(store.viewport.zoom)})`
|
|
1574
|
+
})}>`);
|
|
1575
|
+
children($$renderer2);
|
|
1576
|
+
$$renderer2.push(`<!----></div>`);
|
|
1577
|
+
bind_props($$props, { store });
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
function A11yDescriptions($$renderer, $$props) {
|
|
1581
|
+
$$renderer.component(($$renderer2) => {
|
|
1582
|
+
let { store } = $$props;
|
|
1583
|
+
$$renderer2.push(`<div${attr("id", `${ARIA_NODE_DESC_KEY}-${store.flowId}`)} class="a11y-hidden svelte-y5ec76">${escape_html(store.disableKeyboardA11y ? store.ariaLabelConfig["node.a11yDescription.default"] : store.ariaLabelConfig["node.a11yDescription.keyboardDisabled"])}</div> <div${attr("id", `${ARIA_EDGE_DESC_KEY}-${store.flowId}`)} class="a11y-hidden svelte-y5ec76">${escape_html(store.ariaLabelConfig["edge.a11yDescription.default"])}</div> `);
|
|
1584
|
+
if (!store.disableKeyboardA11y) {
|
|
1585
|
+
$$renderer2.push("<!--[-->");
|
|
1586
|
+
$$renderer2.push(`<div${attr("id", `${ARIA_LIVE_MESSAGE}-${store.flowId}`)} aria-live="assertive" aria-atomic="true" class="a11y-live-msg svelte-y5ec76">${escape_html(store.ariaLiveMessage)}</div>`);
|
|
1587
|
+
} else {
|
|
1588
|
+
$$renderer2.push("<!--[!-->");
|
|
1589
|
+
}
|
|
1590
|
+
$$renderer2.push(`<!--]-->`);
|
|
1591
|
+
});
|
|
1592
|
+
}
|
|
1593
|
+
const ARIA_NODE_DESC_KEY = "svelte-flow__node-desc";
|
|
1594
|
+
const ARIA_EDGE_DESC_KEY = "svelte-flow__edge-desc";
|
|
1595
|
+
const ARIA_LIVE_MESSAGE = "svelte-flow__aria-live";
|
|
1596
|
+
function NodeWrapper($$renderer, $$props) {
|
|
1597
|
+
$$renderer.component(($$renderer2) => {
|
|
1598
|
+
let {
|
|
1599
|
+
store = void 0,
|
|
1600
|
+
node,
|
|
1601
|
+
resizeObserver,
|
|
1602
|
+
nodeClickDistance,
|
|
1603
|
+
onnodeclick,
|
|
1604
|
+
onnodedrag,
|
|
1605
|
+
onnodedragstart,
|
|
1606
|
+
onnodedragstop,
|
|
1607
|
+
onnodepointerenter,
|
|
1608
|
+
onnodepointerleave,
|
|
1609
|
+
onnodepointermove,
|
|
1610
|
+
onnodecontextmenu
|
|
1611
|
+
} = $$props;
|
|
1612
|
+
let {
|
|
1613
|
+
data = {},
|
|
1614
|
+
selected = false,
|
|
1615
|
+
draggable: _draggable,
|
|
1616
|
+
selectable: _selectable,
|
|
1617
|
+
deletable = true,
|
|
1618
|
+
connectable: _connectable,
|
|
1619
|
+
focusable: _focusable,
|
|
1620
|
+
hidden = false,
|
|
1621
|
+
dragging = false,
|
|
1622
|
+
style = "",
|
|
1623
|
+
class: className,
|
|
1624
|
+
type = "default",
|
|
1625
|
+
parentId,
|
|
1626
|
+
sourcePosition,
|
|
1627
|
+
targetPosition,
|
|
1628
|
+
measured: { width: measuredWidth, height: measuredHeight } = { width: 0, height: 0 },
|
|
1629
|
+
initialWidth,
|
|
1630
|
+
initialHeight,
|
|
1631
|
+
width,
|
|
1632
|
+
height,
|
|
1633
|
+
dragHandle,
|
|
1634
|
+
internals: {
|
|
1635
|
+
z: zIndex = 0,
|
|
1636
|
+
positionAbsolute: { x: positionX, y: positionY },
|
|
1637
|
+
userNode
|
|
1638
|
+
}
|
|
1639
|
+
} = node;
|
|
1640
|
+
let { id } = node;
|
|
1641
|
+
let draggable = _draggable ?? store.nodesDraggable;
|
|
1642
|
+
let selectable = _selectable ?? store.elementsSelectable;
|
|
1643
|
+
let connectable = _connectable ?? store.nodesConnectable;
|
|
1644
|
+
let hasDimensions = nodeHasDimensions(node);
|
|
1645
|
+
!!node.internals.handleBounds;
|
|
1646
|
+
let focusable = _focusable ?? store.nodesFocusable;
|
|
1647
|
+
function isInParentLookup(id2) {
|
|
1648
|
+
return store.parentLookup.has(id2);
|
|
1649
|
+
}
|
|
1650
|
+
let isParent = isInParentLookup(id);
|
|
1651
|
+
let NodeComponent = store.nodeTypes[type] ?? DefaultNode;
|
|
1652
|
+
store.ariaLabelConfig;
|
|
1653
|
+
let connectableContext = {
|
|
1654
|
+
get value() {
|
|
1655
|
+
return connectable;
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
setNodeIdContext(id);
|
|
1659
|
+
setNodeConnectableContext(connectableContext);
|
|
1660
|
+
if (process.env.NODE_ENV === "development") ;
|
|
1661
|
+
let nodeStyle = (() => {
|
|
1662
|
+
const w = measuredWidth === void 0 ? width ?? initialWidth : width;
|
|
1663
|
+
const h = measuredHeight === void 0 ? height ?? initialHeight : height;
|
|
1664
|
+
if (w === void 0 && h === void 0 && style === void 0) {
|
|
1665
|
+
return void 0;
|
|
1666
|
+
}
|
|
1667
|
+
return `${style};${w ? `width:${toPxString(w)};` : ""}${h ? `height:${toPxString(h)};` : ""}`;
|
|
1668
|
+
})();
|
|
1669
|
+
onDestroy(() => {
|
|
1670
|
+
});
|
|
1671
|
+
if (!hidden) {
|
|
1672
|
+
$$renderer2.push("<!--[-->");
|
|
1673
|
+
$$renderer2.push(`<div${attributes(
|
|
1674
|
+
{
|
|
1675
|
+
"data-id": id,
|
|
1676
|
+
class: clsx(["svelte-flow__node", `svelte-flow__node-${type}`, className]),
|
|
1677
|
+
style: nodeStyle,
|
|
1678
|
+
tabindex: focusable ? 0 : void 0,
|
|
1679
|
+
role: node.ariaRole ?? (focusable ? "group" : void 0),
|
|
1680
|
+
"aria-roledescription": "node",
|
|
1681
|
+
"aria-describedby": store.disableKeyboardA11y ? void 0 : `${ARIA_NODE_DESC_KEY}-${store.flowId}`,
|
|
1682
|
+
...node.domAttributes
|
|
1683
|
+
},
|
|
1684
|
+
void 0,
|
|
1685
|
+
{
|
|
1686
|
+
dragging,
|
|
1687
|
+
selected,
|
|
1688
|
+
draggable,
|
|
1689
|
+
connectable,
|
|
1690
|
+
selectable,
|
|
1691
|
+
nopan: draggable,
|
|
1692
|
+
parent: isParent
|
|
1693
|
+
},
|
|
1694
|
+
{
|
|
1695
|
+
"z-index": zIndex,
|
|
1696
|
+
transform: `translate(${stringify(positionX)}px, ${stringify(positionY)}px)`,
|
|
1697
|
+
visibility: hasDimensions ? "visible" : "hidden"
|
|
1698
|
+
}
|
|
1699
|
+
)}>`);
|
|
1700
|
+
$$renderer2.push("<!---->");
|
|
1701
|
+
NodeComponent?.($$renderer2, {
|
|
1702
|
+
data,
|
|
1703
|
+
id,
|
|
1704
|
+
selected,
|
|
1705
|
+
selectable,
|
|
1706
|
+
deletable,
|
|
1707
|
+
sourcePosition,
|
|
1708
|
+
targetPosition,
|
|
1709
|
+
zIndex,
|
|
1710
|
+
dragging,
|
|
1711
|
+
draggable,
|
|
1712
|
+
dragHandle,
|
|
1713
|
+
parentId,
|
|
1714
|
+
type,
|
|
1715
|
+
isConnectable: connectable,
|
|
1716
|
+
positionAbsoluteX: positionX,
|
|
1717
|
+
positionAbsoluteY: positionY,
|
|
1718
|
+
width,
|
|
1719
|
+
height
|
|
1720
|
+
});
|
|
1721
|
+
$$renderer2.push(`<!----></div>`);
|
|
1722
|
+
} else {
|
|
1723
|
+
$$renderer2.push("<!--[!-->");
|
|
1724
|
+
}
|
|
1725
|
+
$$renderer2.push(`<!--]-->`);
|
|
1726
|
+
bind_props($$props, { store });
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
function NodeRenderer($$renderer, $$props) {
|
|
1730
|
+
$$renderer.component(($$renderer2) => {
|
|
1731
|
+
let {
|
|
1732
|
+
store = void 0,
|
|
1733
|
+
nodeClickDistance,
|
|
1734
|
+
onnodeclick,
|
|
1735
|
+
onnodecontextmenu,
|
|
1736
|
+
onnodepointerenter,
|
|
1737
|
+
onnodepointermove,
|
|
1738
|
+
onnodepointerleave,
|
|
1739
|
+
onnodedrag,
|
|
1740
|
+
onnodedragstart,
|
|
1741
|
+
onnodedragstop
|
|
1742
|
+
} = $$props;
|
|
1743
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver((entries) => {
|
|
1744
|
+
const updates = /* @__PURE__ */ new Map();
|
|
1745
|
+
entries.forEach((entry) => {
|
|
1746
|
+
const id = entry.target.getAttribute("data-id");
|
|
1747
|
+
updates.set(id, { id, nodeElement: entry.target, force: true });
|
|
1748
|
+
});
|
|
1749
|
+
store.updateNodeInternals(updates);
|
|
1750
|
+
});
|
|
1751
|
+
onDestroy(() => {
|
|
1752
|
+
resizeObserver?.disconnect();
|
|
1753
|
+
});
|
|
1754
|
+
let $$settled = true;
|
|
1755
|
+
let $$inner_renderer;
|
|
1756
|
+
function $$render_inner($$renderer3) {
|
|
1757
|
+
$$renderer3.push(`<div class="svelte-flow__nodes"><!--[-->`);
|
|
1758
|
+
const each_array = ensure_array_like(store.visible.nodes.values());
|
|
1759
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
1760
|
+
let node = each_array[$$index];
|
|
1761
|
+
NodeWrapper($$renderer3, {
|
|
1762
|
+
node,
|
|
1763
|
+
resizeObserver,
|
|
1764
|
+
nodeClickDistance,
|
|
1765
|
+
onnodeclick,
|
|
1766
|
+
onnodepointerenter,
|
|
1767
|
+
onnodepointermove,
|
|
1768
|
+
onnodepointerleave,
|
|
1769
|
+
onnodedrag,
|
|
1770
|
+
onnodedragstart,
|
|
1771
|
+
onnodedragstop,
|
|
1772
|
+
onnodecontextmenu,
|
|
1773
|
+
get store() {
|
|
1774
|
+
return store;
|
|
1775
|
+
},
|
|
1776
|
+
set store($$value) {
|
|
1777
|
+
store = $$value;
|
|
1778
|
+
$$settled = false;
|
|
1779
|
+
}
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
$$renderer3.push(`<!--]--></div>`);
|
|
1783
|
+
}
|
|
1784
|
+
do {
|
|
1785
|
+
$$settled = true;
|
|
1786
|
+
$$inner_renderer = $$renderer2.copy();
|
|
1787
|
+
$$render_inner($$inner_renderer);
|
|
1788
|
+
} while (!$$settled);
|
|
1789
|
+
$$renderer2.subsume($$inner_renderer);
|
|
1790
|
+
bind_props($$props, { store });
|
|
1791
|
+
});
|
|
1792
|
+
}
|
|
1793
|
+
function EdgeWrapper($$renderer, $$props) {
|
|
1794
|
+
$$renderer.component(($$renderer2) => {
|
|
1795
|
+
const {
|
|
1796
|
+
edge,
|
|
1797
|
+
store = void 0,
|
|
1798
|
+
onedgeclick,
|
|
1799
|
+
onedgecontextmenu,
|
|
1800
|
+
onedgepointerenter,
|
|
1801
|
+
onedgepointerleave
|
|
1802
|
+
} = $$props;
|
|
1803
|
+
let {
|
|
1804
|
+
id,
|
|
1805
|
+
source,
|
|
1806
|
+
target,
|
|
1807
|
+
sourceX,
|
|
1808
|
+
sourceY,
|
|
1809
|
+
targetX,
|
|
1810
|
+
targetY,
|
|
1811
|
+
sourcePosition,
|
|
1812
|
+
targetPosition,
|
|
1813
|
+
animated = false,
|
|
1814
|
+
selected = false,
|
|
1815
|
+
label,
|
|
1816
|
+
labelStyle,
|
|
1817
|
+
data = {},
|
|
1818
|
+
style,
|
|
1819
|
+
interactionWidth,
|
|
1820
|
+
type = "default",
|
|
1821
|
+
sourceHandle,
|
|
1822
|
+
targetHandle,
|
|
1823
|
+
markerStart,
|
|
1824
|
+
markerEnd,
|
|
1825
|
+
selectable: _selectable,
|
|
1826
|
+
focusable: _focusable,
|
|
1827
|
+
deletable = true,
|
|
1828
|
+
hidden,
|
|
1829
|
+
zIndex,
|
|
1830
|
+
class: className,
|
|
1831
|
+
ariaLabel
|
|
1832
|
+
} = edge;
|
|
1833
|
+
setEdgeIdContext(id);
|
|
1834
|
+
let selectable = _selectable ?? store.elementsSelectable;
|
|
1835
|
+
let focusable = _focusable ?? store.edgesFocusable;
|
|
1836
|
+
let EdgeComponent = store.edgeTypes[type] ?? BezierEdge;
|
|
1837
|
+
let markerStartUrl = markerStart ? `url('#${getMarkerId(markerStart, store.flowId)}')` : void 0;
|
|
1838
|
+
let markerEndUrl = markerEnd ? `url('#${getMarkerId(markerEnd, store.flowId)}')` : void 0;
|
|
1839
|
+
if (!hidden) {
|
|
1840
|
+
$$renderer2.push("<!--[-->");
|
|
1841
|
+
$$renderer2.push(`<svg class="svelte-flow__edge-wrapper"${attr_style("", { "z-index": zIndex })}><g${attributes(
|
|
1842
|
+
{
|
|
1843
|
+
class: clsx(["svelte-flow__edge", className]),
|
|
1844
|
+
"data-id": id,
|
|
1845
|
+
"aria-label": ariaLabel === null ? void 0 : ariaLabel ? ariaLabel : `Edge from ${source} to ${target}`,
|
|
1846
|
+
"aria-describedby": focusable ? `${ARIA_EDGE_DESC_KEY}-${store.flowId}` : void 0,
|
|
1847
|
+
role: edge.ariaRole ?? (focusable ? "group" : "img"),
|
|
1848
|
+
"aria-roledescription": "edge",
|
|
1849
|
+
tabindex: focusable ? 0 : void 0,
|
|
1850
|
+
...edge.domAttributes
|
|
1851
|
+
},
|
|
1852
|
+
void 0,
|
|
1853
|
+
{ animated, selected, selectable },
|
|
1854
|
+
void 0,
|
|
1855
|
+
3
|
|
1856
|
+
)}>`);
|
|
1857
|
+
$$renderer2.push("<!---->");
|
|
1858
|
+
EdgeComponent?.($$renderer2, {
|
|
1859
|
+
id,
|
|
1860
|
+
source,
|
|
1861
|
+
target,
|
|
1862
|
+
sourceX,
|
|
1863
|
+
sourceY,
|
|
1864
|
+
targetX,
|
|
1865
|
+
targetY,
|
|
1866
|
+
sourcePosition,
|
|
1867
|
+
targetPosition,
|
|
1868
|
+
animated,
|
|
1869
|
+
selected,
|
|
1870
|
+
label,
|
|
1871
|
+
labelStyle,
|
|
1872
|
+
data,
|
|
1873
|
+
style,
|
|
1874
|
+
interactionWidth,
|
|
1875
|
+
selectable,
|
|
1876
|
+
deletable,
|
|
1877
|
+
type,
|
|
1878
|
+
sourceHandleId: sourceHandle,
|
|
1879
|
+
targetHandleId: targetHandle,
|
|
1880
|
+
markerStart: markerStartUrl,
|
|
1881
|
+
markerEnd: markerEndUrl
|
|
1882
|
+
});
|
|
1883
|
+
$$renderer2.push(`<!----></g></svg>`);
|
|
1884
|
+
} else {
|
|
1885
|
+
$$renderer2.push("<!--[!-->");
|
|
1886
|
+
}
|
|
1887
|
+
$$renderer2.push(`<!--]-->`);
|
|
1888
|
+
bind_props($$props, { store });
|
|
1889
|
+
});
|
|
1890
|
+
}
|
|
1891
|
+
function MarkerDefinition($$renderer, $$props) {
|
|
1892
|
+
$$renderer.component(($$renderer2) => {
|
|
1893
|
+
const store = useStore();
|
|
1894
|
+
$$renderer2.push(`<defs><!--[-->`);
|
|
1895
|
+
const each_array = ensure_array_like(store.markers);
|
|
1896
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
1897
|
+
let marker = each_array[$$index];
|
|
1898
|
+
Marker($$renderer2, spread_props([marker]));
|
|
1899
|
+
}
|
|
1900
|
+
$$renderer2.push(`<!--]--></defs>`);
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
function Marker($$renderer, $$props) {
|
|
1904
|
+
$$renderer.component(($$renderer2) => {
|
|
1905
|
+
let {
|
|
1906
|
+
id,
|
|
1907
|
+
type,
|
|
1908
|
+
width = 12.5,
|
|
1909
|
+
height = 12.5,
|
|
1910
|
+
markerUnits = "strokeWidth",
|
|
1911
|
+
orient = "auto-start-reverse",
|
|
1912
|
+
color = "none",
|
|
1913
|
+
strokeWidth
|
|
1914
|
+
} = $$props;
|
|
1915
|
+
$$renderer2.push(`<marker class="svelte-flow__arrowhead"${attr("id", id)}${attr("markerWidth", `${width}`)}${attr("markerHeight", `${height}`)} viewBox="-10 -10 20 20"${attr("markerUnits", markerUnits)}${attr("orient", orient)} refX="0" refY="0">`);
|
|
1916
|
+
if (type === MarkerType.Arrow) {
|
|
1917
|
+
$$renderer2.push("<!--[-->");
|
|
1918
|
+
$$renderer2.push(`<polyline class="arrow" fill="none" stroke-linecap="round" stroke-linejoin="round"${attr("stroke-width", strokeWidth)} points="-5,-4 0,0 -5,4"${attr_style("", { stroke: color })}></polyline>`);
|
|
1919
|
+
} else if (type === MarkerType.ArrowClosed) {
|
|
1920
|
+
$$renderer2.push("<!--[1-->");
|
|
1921
|
+
$$renderer2.push(`<polyline class="arrowclosed" stroke-linecap="round" stroke-linejoin="round"${attr("stroke-width", strokeWidth)} points="-5,-4 0,0 -5,4 -5,-4"${attr_style("", { stroke: color, fill: color })}></polyline>`);
|
|
1922
|
+
} else {
|
|
1923
|
+
$$renderer2.push("<!--[!-->");
|
|
1924
|
+
}
|
|
1925
|
+
$$renderer2.push(`<!--]--></marker>`);
|
|
1926
|
+
});
|
|
1927
|
+
}
|
|
1928
|
+
function EdgeRenderer($$renderer, $$props) {
|
|
1929
|
+
$$renderer.component(($$renderer2) => {
|
|
1930
|
+
let {
|
|
1931
|
+
store = void 0,
|
|
1932
|
+
onedgeclick,
|
|
1933
|
+
onedgecontextmenu,
|
|
1934
|
+
onedgepointerenter,
|
|
1935
|
+
onedgepointerleave
|
|
1936
|
+
} = $$props;
|
|
1937
|
+
let $$settled = true;
|
|
1938
|
+
let $$inner_renderer;
|
|
1939
|
+
function $$render_inner($$renderer3) {
|
|
1940
|
+
$$renderer3.push(`<div class="svelte-flow__edges"><svg class="svelte-flow__marker">`);
|
|
1941
|
+
MarkerDefinition($$renderer3);
|
|
1942
|
+
$$renderer3.push(`<!----></svg> <!--[-->`);
|
|
1943
|
+
const each_array = ensure_array_like(store.visible.edges.values());
|
|
1944
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
1945
|
+
let edge = each_array[$$index];
|
|
1946
|
+
EdgeWrapper($$renderer3, {
|
|
1947
|
+
edge,
|
|
1948
|
+
onedgeclick,
|
|
1949
|
+
onedgecontextmenu,
|
|
1950
|
+
onedgepointerenter,
|
|
1951
|
+
onedgepointerleave,
|
|
1952
|
+
get store() {
|
|
1953
|
+
return store;
|
|
1954
|
+
},
|
|
1955
|
+
set store($$value) {
|
|
1956
|
+
store = $$value;
|
|
1957
|
+
$$settled = false;
|
|
1958
|
+
}
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
1961
|
+
$$renderer3.push(`<!--]--></div>`);
|
|
1962
|
+
}
|
|
1963
|
+
do {
|
|
1964
|
+
$$settled = true;
|
|
1965
|
+
$$inner_renderer = $$renderer2.copy();
|
|
1966
|
+
$$render_inner($$inner_renderer);
|
|
1967
|
+
} while (!$$settled);
|
|
1968
|
+
$$renderer2.subsume($$inner_renderer);
|
|
1969
|
+
bind_props($$props, { store });
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
function Selection($$renderer, $$props) {
|
|
1973
|
+
$$renderer.component(($$renderer2) => {
|
|
1974
|
+
let { x = 0, y = 0, width = 0, height = 0, isVisible = true } = $$props;
|
|
1975
|
+
if (isVisible) {
|
|
1976
|
+
$$renderer2.push("<!--[-->");
|
|
1977
|
+
$$renderer2.push(`<div class="svelte-flow__selection svelte-9do1ra"${attr_style("", {
|
|
1978
|
+
width: typeof width === "string" ? width : toPxString(width),
|
|
1979
|
+
height: typeof height === "string" ? height : toPxString(height),
|
|
1980
|
+
transform: `translate(${x}px, ${y}px)`
|
|
1981
|
+
})}></div>`);
|
|
1982
|
+
} else {
|
|
1983
|
+
$$renderer2.push("<!--[!-->");
|
|
1984
|
+
}
|
|
1985
|
+
$$renderer2.push(`<!--]-->`);
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
function NodeSelection($$renderer, $$props) {
|
|
1989
|
+
$$renderer.component(($$renderer2) => {
|
|
1990
|
+
let {
|
|
1991
|
+
store = void 0,
|
|
1992
|
+
onnodedrag,
|
|
1993
|
+
onnodedragstart,
|
|
1994
|
+
onnodedragstop,
|
|
1995
|
+
onselectionclick,
|
|
1996
|
+
onselectioncontextmenu
|
|
1997
|
+
} = $$props;
|
|
1998
|
+
let bounds = (() => {
|
|
1999
|
+
if (store.selectionRectMode === "nodes") {
|
|
2000
|
+
store.nodes;
|
|
2001
|
+
const nodeBounds = getInternalNodesBounds(store.nodeLookup, { filter: (node) => !!node.selected });
|
|
2002
|
+
if (nodeBounds.width > 0 && nodeBounds.height > 0) {
|
|
2003
|
+
return nodeBounds;
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
return null;
|
|
2007
|
+
})();
|
|
2008
|
+
if (store.selectionRectMode === "nodes" && bounds && isNumeric(bounds.x) && isNumeric(bounds.y)) {
|
|
2009
|
+
$$renderer2.push("<!--[-->");
|
|
2010
|
+
$$renderer2.push(`<div${attr_class(clsx(["svelte-flow__selection-wrapper", store.noPanClass]), "svelte-xt75e")}${attr("role", store.disableKeyboardA11y ? void 0 : "button")}${attr("tabindex", store.disableKeyboardA11y ? void 0 : -1)}${attr_style("", {
|
|
2011
|
+
width: toPxString(bounds.width),
|
|
2012
|
+
height: toPxString(bounds.height),
|
|
2013
|
+
transform: `translate(${stringify(bounds.x)}px, ${stringify(bounds.y)}px)`
|
|
2014
|
+
})}>`);
|
|
2015
|
+
Selection($$renderer2, { width: "100%", height: "100%", x: 0, y: 0 });
|
|
2016
|
+
$$renderer2.push(`<!----></div>`);
|
|
2017
|
+
} else {
|
|
2018
|
+
$$renderer2.push("<!--[!-->");
|
|
2019
|
+
}
|
|
2020
|
+
$$renderer2.push(`<!--]-->`);
|
|
2021
|
+
bind_props($$props, { store });
|
|
2022
|
+
});
|
|
2023
|
+
}
|
|
2024
|
+
function useSvelteFlow() {
|
|
2025
|
+
const store = useStore();
|
|
2026
|
+
const getNodeRect = (node) => {
|
|
2027
|
+
const nodeToUse = isNode(node) ? node : store.nodeLookup.get(node.id);
|
|
2028
|
+
const position = nodeToUse.parentId ? evaluateAbsolutePosition(nodeToUse.position, nodeToUse.measured, nodeToUse.parentId, store.nodeLookup, store.nodeOrigin) : nodeToUse.position;
|
|
2029
|
+
const nodeWithPosition = {
|
|
2030
|
+
...nodeToUse,
|
|
2031
|
+
position,
|
|
2032
|
+
width: nodeToUse.measured?.width ?? nodeToUse.width,
|
|
2033
|
+
height: nodeToUse.measured?.height ?? nodeToUse.height
|
|
2034
|
+
};
|
|
2035
|
+
return nodeToRect(nodeWithPosition);
|
|
2036
|
+
};
|
|
2037
|
+
function updateNode(id, nodeUpdate, options = { replace: false }) {
|
|
2038
|
+
store.nodes = run(() => store.nodes).map((node) => {
|
|
2039
|
+
if (node.id === id) {
|
|
2040
|
+
const nextNode = typeof nodeUpdate === "function" ? nodeUpdate(node) : nodeUpdate;
|
|
2041
|
+
return options?.replace && isNode(nextNode) ? nextNode : { ...node, ...nextNode };
|
|
2042
|
+
}
|
|
2043
|
+
return node;
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
function updateEdge(id, edgeUpdate, options = { replace: false }) {
|
|
2047
|
+
store.edges = run(() => store.edges).map((edge) => {
|
|
2048
|
+
if (edge.id === id) {
|
|
2049
|
+
const nextEdge = typeof edgeUpdate === "function" ? edgeUpdate(edge) : edgeUpdate;
|
|
2050
|
+
return options.replace && isEdge(nextEdge) ? nextEdge : { ...edge, ...nextEdge };
|
|
2051
|
+
}
|
|
2052
|
+
return edge;
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
const getInternalNode = (id) => store.nodeLookup.get(id);
|
|
2056
|
+
return {
|
|
2057
|
+
zoomIn: store.zoomIn,
|
|
2058
|
+
zoomOut: store.zoomOut,
|
|
2059
|
+
getInternalNode,
|
|
2060
|
+
getNode: (id) => getInternalNode(id)?.internals.userNode,
|
|
2061
|
+
getNodes: (ids) => ids === void 0 ? store.nodes : getElements(store.nodeLookup, ids),
|
|
2062
|
+
getEdge: (id) => store.edgeLookup.get(id),
|
|
2063
|
+
getEdges: (ids) => ids === void 0 ? store.edges : getElements(store.edgeLookup, ids),
|
|
2064
|
+
setZoom: (zoomLevel, options) => {
|
|
2065
|
+
const panZoom = store.panZoom;
|
|
2066
|
+
return panZoom ? panZoom.scaleTo(zoomLevel, { duration: options?.duration }) : Promise.resolve(false);
|
|
2067
|
+
},
|
|
2068
|
+
getZoom: () => store.viewport.zoom,
|
|
2069
|
+
setViewport: async (nextViewport, options) => {
|
|
2070
|
+
const currentViewport = store.viewport;
|
|
2071
|
+
if (!store.panZoom) {
|
|
2072
|
+
return Promise.resolve(false);
|
|
2073
|
+
}
|
|
2074
|
+
await store.panZoom.setViewport(
|
|
2075
|
+
{
|
|
2076
|
+
x: nextViewport.x ?? currentViewport.x,
|
|
2077
|
+
y: nextViewport.y ?? currentViewport.y,
|
|
2078
|
+
zoom: nextViewport.zoom ?? currentViewport.zoom
|
|
2079
|
+
},
|
|
2080
|
+
options
|
|
2081
|
+
);
|
|
2082
|
+
return Promise.resolve(true);
|
|
2083
|
+
},
|
|
2084
|
+
getViewport: () => snapshot(store.viewport),
|
|
2085
|
+
setCenter: async (x, y, options) => store.setCenter(x, y, options),
|
|
2086
|
+
fitView: (options) => store.fitView(options),
|
|
2087
|
+
fitBounds: async (bounds, options) => {
|
|
2088
|
+
if (!store.panZoom) {
|
|
2089
|
+
return Promise.resolve(false);
|
|
2090
|
+
}
|
|
2091
|
+
const viewport = getViewportForBounds(bounds, store.width, store.height, store.minZoom, store.maxZoom, options?.padding ?? 0.1);
|
|
2092
|
+
await store.panZoom.setViewport(viewport, {
|
|
2093
|
+
duration: options?.duration,
|
|
2094
|
+
ease: options?.ease,
|
|
2095
|
+
interpolate: options?.interpolate
|
|
2096
|
+
});
|
|
2097
|
+
return Promise.resolve(true);
|
|
2098
|
+
},
|
|
2099
|
+
/**
|
|
2100
|
+
* Partial is defined as "the 2 nodes/areas are intersecting partially".
|
|
2101
|
+
* If a is contained in b or b is contained in a, they are both
|
|
2102
|
+
* considered fully intersecting.
|
|
2103
|
+
*/
|
|
2104
|
+
getIntersectingNodes: (nodeOrRect, partially = true, nodesToIntersect) => {
|
|
2105
|
+
const isRect = isRectObject(nodeOrRect);
|
|
2106
|
+
const nodeRect = isRect ? nodeOrRect : getNodeRect(nodeOrRect);
|
|
2107
|
+
if (!nodeRect) {
|
|
2108
|
+
return [];
|
|
2109
|
+
}
|
|
2110
|
+
return (nodesToIntersect || store.nodes).filter((n) => {
|
|
2111
|
+
const internalNode = store.nodeLookup.get(n.id);
|
|
2112
|
+
if (!internalNode || !isRect && n.id === nodeOrRect.id) {
|
|
2113
|
+
return false;
|
|
2114
|
+
}
|
|
2115
|
+
const currNodeRect = nodeToRect(internalNode);
|
|
2116
|
+
const overlappingArea = getOverlappingArea(currNodeRect, nodeRect);
|
|
2117
|
+
const partiallyVisible = partially && overlappingArea > 0;
|
|
2118
|
+
return partiallyVisible || overlappingArea >= currNodeRect.width * currNodeRect.height || overlappingArea >= nodeRect.width * nodeRect.height;
|
|
2119
|
+
});
|
|
2120
|
+
},
|
|
2121
|
+
isNodeIntersecting: (nodeOrRect, area, partially = true) => {
|
|
2122
|
+
const isRect = isRectObject(nodeOrRect);
|
|
2123
|
+
const nodeRect = isRect ? nodeOrRect : getNodeRect(nodeOrRect);
|
|
2124
|
+
if (!nodeRect) {
|
|
2125
|
+
return false;
|
|
2126
|
+
}
|
|
2127
|
+
const overlappingArea = getOverlappingArea(nodeRect, area);
|
|
2128
|
+
const partiallyVisible = partially && overlappingArea > 0;
|
|
2129
|
+
return partiallyVisible || overlappingArea >= area.width * area.height || overlappingArea >= nodeRect.width * nodeRect.height;
|
|
2130
|
+
},
|
|
2131
|
+
deleteElements: async ({ nodes: nodesToRemove = [], edges: edgesToRemove = [] }) => {
|
|
2132
|
+
const { nodes: matchingNodes, edges: matchingEdges } = await getElementsToRemove({
|
|
2133
|
+
nodesToRemove,
|
|
2134
|
+
edgesToRemove,
|
|
2135
|
+
nodes: store.nodes,
|
|
2136
|
+
edges: store.edges,
|
|
2137
|
+
onBeforeDelete: store.onbeforedelete
|
|
2138
|
+
});
|
|
2139
|
+
if (matchingNodes) {
|
|
2140
|
+
store.nodes = run(() => store.nodes).filter((node) => !matchingNodes.some(({ id }) => id === node.id));
|
|
2141
|
+
}
|
|
2142
|
+
if (matchingEdges) {
|
|
2143
|
+
store.edges = run(() => store.edges).filter((edge) => !matchingEdges.some(({ id }) => id === edge.id));
|
|
2144
|
+
}
|
|
2145
|
+
if (matchingNodes.length > 0 || matchingEdges.length > 0) {
|
|
2146
|
+
store.ondelete?.({ nodes: matchingNodes, edges: matchingEdges });
|
|
2147
|
+
}
|
|
2148
|
+
return { deletedNodes: matchingNodes, deletedEdges: matchingEdges };
|
|
2149
|
+
},
|
|
2150
|
+
screenToFlowPosition: (position, options = { snapToGrid: true }) => {
|
|
2151
|
+
if (!store.domNode) {
|
|
2152
|
+
return position;
|
|
2153
|
+
}
|
|
2154
|
+
const _snapGrid = options.snapToGrid ? store.snapGrid : false;
|
|
2155
|
+
const { x, y, zoom } = store.viewport;
|
|
2156
|
+
const { x: domX, y: domY } = store.domNode.getBoundingClientRect();
|
|
2157
|
+
const correctedPosition = { x: position.x - domX, y: position.y - domY };
|
|
2158
|
+
return pointToRendererPoint(correctedPosition, [x, y, zoom], _snapGrid !== null, _snapGrid || [1, 1]);
|
|
2159
|
+
},
|
|
2160
|
+
/**
|
|
2161
|
+
*
|
|
2162
|
+
* @param position
|
|
2163
|
+
* @returns
|
|
2164
|
+
*/
|
|
2165
|
+
flowToScreenPosition: (position) => {
|
|
2166
|
+
if (!store.domNode) {
|
|
2167
|
+
return position;
|
|
2168
|
+
}
|
|
2169
|
+
const { x, y, zoom } = store.viewport;
|
|
2170
|
+
const { x: domX, y: domY } = store.domNode.getBoundingClientRect();
|
|
2171
|
+
const rendererPosition = rendererPointToPoint(position, [x, y, zoom]);
|
|
2172
|
+
return { x: rendererPosition.x + domX, y: rendererPosition.y + domY };
|
|
2173
|
+
},
|
|
2174
|
+
toObject: () => {
|
|
2175
|
+
return structuredClone({
|
|
2176
|
+
nodes: [...store.nodes],
|
|
2177
|
+
edges: [...store.edges],
|
|
2178
|
+
viewport: { ...store.viewport }
|
|
2179
|
+
});
|
|
2180
|
+
},
|
|
2181
|
+
updateNode,
|
|
2182
|
+
updateNodeData: (id, dataUpdate, options) => {
|
|
2183
|
+
const node = store.nodeLookup.get(id)?.internals.userNode;
|
|
2184
|
+
if (!node) {
|
|
2185
|
+
return;
|
|
2186
|
+
}
|
|
2187
|
+
const nextData = typeof dataUpdate === "function" ? dataUpdate(node) : dataUpdate;
|
|
2188
|
+
updateNode(id, (node2) => ({
|
|
2189
|
+
...node2,
|
|
2190
|
+
data: options?.replace ? nextData : { ...node2.data, ...nextData }
|
|
2191
|
+
}));
|
|
2192
|
+
},
|
|
2193
|
+
updateEdge,
|
|
2194
|
+
getNodesBounds: (nodes) => {
|
|
2195
|
+
return getNodesBounds(nodes, { nodeLookup: store.nodeLookup, nodeOrigin: store.nodeOrigin });
|
|
2196
|
+
},
|
|
2197
|
+
getHandleConnections: ({ type, id, nodeId }) => Array.from(store.connectionLookup.get(`${nodeId}-${type}-${id ?? null}`)?.values() ?? [])
|
|
2198
|
+
};
|
|
2199
|
+
}
|
|
2200
|
+
function getElements(lookup, ids) {
|
|
2201
|
+
const result = [];
|
|
2202
|
+
for (const id of ids) {
|
|
2203
|
+
const item = lookup.get(id);
|
|
2204
|
+
if (item) {
|
|
2205
|
+
const element = "internals" in item ? item.internals?.userNode : item;
|
|
2206
|
+
result.push(element);
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
return result;
|
|
2210
|
+
}
|
|
2211
|
+
function KeyHandler($$renderer, $$props) {
|
|
2212
|
+
$$renderer.component(($$renderer2) => {
|
|
2213
|
+
let {
|
|
2214
|
+
store = void 0,
|
|
2215
|
+
selectionKey = "Shift",
|
|
2216
|
+
multiSelectionKey = isMacOs() ? "Meta" : "Control",
|
|
2217
|
+
deleteKey = "Backspace",
|
|
2218
|
+
panActivationKey = " ",
|
|
2219
|
+
zoomActivationKey = isMacOs() ? "Meta" : "Control"
|
|
2220
|
+
} = $$props;
|
|
2221
|
+
useSvelteFlow();
|
|
2222
|
+
bind_props($$props, { store });
|
|
2223
|
+
});
|
|
2224
|
+
}
|
|
2225
|
+
function ConnectionLine($$renderer, $$props) {
|
|
2226
|
+
$$renderer.component(($$renderer2) => {
|
|
2227
|
+
let { store = void 0, type, containerStyle, style, LineComponent } = $$props;
|
|
2228
|
+
let path = (() => {
|
|
2229
|
+
if (!store.connection.inProgress) {
|
|
2230
|
+
return "";
|
|
2231
|
+
}
|
|
2232
|
+
const pathParams = {
|
|
2233
|
+
sourceX: store.connection.from.x,
|
|
2234
|
+
sourceY: store.connection.from.y,
|
|
2235
|
+
sourcePosition: store.connection.fromPosition,
|
|
2236
|
+
targetX: store.connection.to.x,
|
|
2237
|
+
targetY: store.connection.to.y,
|
|
2238
|
+
targetPosition: store.connection.toPosition
|
|
2239
|
+
};
|
|
2240
|
+
switch (type) {
|
|
2241
|
+
case ConnectionLineType.Bezier: {
|
|
2242
|
+
const [path2] = getBezierPath(pathParams);
|
|
2243
|
+
return path2;
|
|
2244
|
+
}
|
|
2245
|
+
case ConnectionLineType.Straight: {
|
|
2246
|
+
const [path2] = getStraightPath(pathParams);
|
|
2247
|
+
return path2;
|
|
2248
|
+
}
|
|
2249
|
+
case ConnectionLineType.Step:
|
|
2250
|
+
case ConnectionLineType.SmoothStep: {
|
|
2251
|
+
const [path2] = getSmoothStepPath({
|
|
2252
|
+
...pathParams,
|
|
2253
|
+
borderRadius: type === ConnectionLineType.Step ? 0 : void 0
|
|
2254
|
+
});
|
|
2255
|
+
return path2;
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
})();
|
|
2259
|
+
if (store.connection.inProgress) {
|
|
2260
|
+
$$renderer2.push("<!--[-->");
|
|
2261
|
+
$$renderer2.push(`<svg${attr("width", store.width)}${attr("height", store.height)} class="svelte-flow__connectionline"${attr_style(containerStyle)}><g${attr_class(clsx([
|
|
2262
|
+
"svelte-flow__connection",
|
|
2263
|
+
getConnectionStatus(store.connection.isValid)
|
|
2264
|
+
]))}>`);
|
|
2265
|
+
if (LineComponent) {
|
|
2266
|
+
$$renderer2.push("<!--[-->");
|
|
2267
|
+
$$renderer2.push("<!---->");
|
|
2268
|
+
LineComponent?.($$renderer2, {});
|
|
2269
|
+
$$renderer2.push(`<!---->`);
|
|
2270
|
+
} else {
|
|
2271
|
+
$$renderer2.push("<!--[!-->");
|
|
2272
|
+
$$renderer2.push(`<path${attr("d", path)}${attr_style(style)} fill="none" class="svelte-flow__connection-path"></path>`);
|
|
2273
|
+
}
|
|
2274
|
+
$$renderer2.push(`<!--]--></g></svg>`);
|
|
2275
|
+
} else {
|
|
2276
|
+
$$renderer2.push("<!--[!-->");
|
|
2277
|
+
}
|
|
2278
|
+
$$renderer2.push(`<!--]-->`);
|
|
2279
|
+
bind_props($$props, { store });
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
function Panel($$renderer, $$props) {
|
|
2283
|
+
$$renderer.component(($$renderer2) => {
|
|
2284
|
+
let {
|
|
2285
|
+
position = "top-right",
|
|
2286
|
+
style,
|
|
2287
|
+
class: className,
|
|
2288
|
+
children,
|
|
2289
|
+
$$slots,
|
|
2290
|
+
$$events,
|
|
2291
|
+
...rest
|
|
2292
|
+
} = $$props;
|
|
2293
|
+
let positionClasses = `${position}`.split("-");
|
|
2294
|
+
$$renderer2.push(`<div${attributes({
|
|
2295
|
+
class: clsx(["svelte-flow__panel", className, ...positionClasses]),
|
|
2296
|
+
style,
|
|
2297
|
+
...rest
|
|
2298
|
+
})}>`);
|
|
2299
|
+
children?.($$renderer2);
|
|
2300
|
+
$$renderer2.push(`<!----></div>`);
|
|
2301
|
+
});
|
|
2302
|
+
}
|
|
2303
|
+
function Attribution($$renderer, $$props) {
|
|
2304
|
+
$$renderer.component(($$renderer2) => {
|
|
2305
|
+
let { proOptions, position = "bottom-right" } = $$props;
|
|
2306
|
+
if (!proOptions?.hideAttribution) {
|
|
2307
|
+
$$renderer2.push("<!--[-->");
|
|
2308
|
+
Panel($$renderer2, {
|
|
2309
|
+
position,
|
|
2310
|
+
class: "svelte-flow__attribution",
|
|
2311
|
+
"data-message": "Feel free to remove the attribution or check out how you could support us: https://svelteflow.dev/support-us",
|
|
2312
|
+
children: ($$renderer3) => {
|
|
2313
|
+
$$renderer3.push(`<a href="https://svelteflow.dev" target="_blank" rel="noopener noreferrer" aria-label="Svelte Flow attribution">Svelte Flow</a>`);
|
|
2314
|
+
},
|
|
2315
|
+
$$slots: { default: true }
|
|
2316
|
+
});
|
|
2317
|
+
} else {
|
|
2318
|
+
$$renderer2.push("<!--[!-->");
|
|
2319
|
+
}
|
|
2320
|
+
$$renderer2.push(`<!--]-->`);
|
|
2321
|
+
});
|
|
2322
|
+
}
|
|
2323
|
+
function Wrapper($$renderer, $$props) {
|
|
2324
|
+
$$renderer.component(($$renderer2) => {
|
|
2325
|
+
let {
|
|
2326
|
+
width,
|
|
2327
|
+
height,
|
|
2328
|
+
colorMode,
|
|
2329
|
+
domNode = void 0,
|
|
2330
|
+
clientWidth = void 0,
|
|
2331
|
+
clientHeight = void 0,
|
|
2332
|
+
children,
|
|
2333
|
+
rest
|
|
2334
|
+
} = $$props;
|
|
2335
|
+
let {
|
|
2336
|
+
id,
|
|
2337
|
+
class: className,
|
|
2338
|
+
nodeTypes,
|
|
2339
|
+
edgeTypes,
|
|
2340
|
+
colorMode: _colorMode,
|
|
2341
|
+
isValidConnection,
|
|
2342
|
+
onmove,
|
|
2343
|
+
onmovestart,
|
|
2344
|
+
onmoveend,
|
|
2345
|
+
onflowerror,
|
|
2346
|
+
ondelete,
|
|
2347
|
+
onbeforedelete,
|
|
2348
|
+
onbeforeconnect,
|
|
2349
|
+
onconnect,
|
|
2350
|
+
onconnectstart,
|
|
2351
|
+
onconnectend,
|
|
2352
|
+
onbeforereconnect,
|
|
2353
|
+
onreconnect,
|
|
2354
|
+
onreconnectstart,
|
|
2355
|
+
onreconnectend,
|
|
2356
|
+
onclickconnectstart,
|
|
2357
|
+
onclickconnectend,
|
|
2358
|
+
oninit,
|
|
2359
|
+
onselectionchange,
|
|
2360
|
+
onselectiondragstart,
|
|
2361
|
+
onselectiondrag,
|
|
2362
|
+
onselectiondragstop,
|
|
2363
|
+
onselectionstart,
|
|
2364
|
+
onselectionend,
|
|
2365
|
+
clickConnect,
|
|
2366
|
+
fitView,
|
|
2367
|
+
fitViewOptions,
|
|
2368
|
+
nodeOrigin,
|
|
2369
|
+
nodeDragThreshold,
|
|
2370
|
+
connectionDragThreshold,
|
|
2371
|
+
minZoom,
|
|
2372
|
+
maxZoom,
|
|
2373
|
+
initialViewport,
|
|
2374
|
+
connectionRadius,
|
|
2375
|
+
connectionMode,
|
|
2376
|
+
selectionMode,
|
|
2377
|
+
selectNodesOnDrag,
|
|
2378
|
+
snapGrid,
|
|
2379
|
+
defaultMarkerColor,
|
|
2380
|
+
translateExtent,
|
|
2381
|
+
nodeExtent,
|
|
2382
|
+
onlyRenderVisibleElements,
|
|
2383
|
+
autoPanOnConnect,
|
|
2384
|
+
autoPanOnNodeDrag,
|
|
2385
|
+
colorModeSSR,
|
|
2386
|
+
defaultEdgeOptions,
|
|
2387
|
+
elevateNodesOnSelect,
|
|
2388
|
+
elevateEdgesOnSelect,
|
|
2389
|
+
nodesDraggable,
|
|
2390
|
+
autoPanOnNodeFocus,
|
|
2391
|
+
nodesConnectable,
|
|
2392
|
+
elementsSelectable,
|
|
2393
|
+
nodesFocusable,
|
|
2394
|
+
edgesFocusable,
|
|
2395
|
+
disableKeyboardA11y,
|
|
2396
|
+
noDragClass,
|
|
2397
|
+
noPanClass,
|
|
2398
|
+
noWheelClass,
|
|
2399
|
+
ariaLabelConfig,
|
|
2400
|
+
autoPanSpeed,
|
|
2401
|
+
panOnScrollSpeed,
|
|
2402
|
+
zIndexMode,
|
|
2403
|
+
...divAttributes
|
|
2404
|
+
} = rest;
|
|
2405
|
+
$$renderer2.push(`<div${attributes(
|
|
2406
|
+
{
|
|
2407
|
+
class: clsx([
|
|
2408
|
+
"svelte-flow",
|
|
2409
|
+
"svelte-flow__container",
|
|
2410
|
+
className,
|
|
2411
|
+
colorMode
|
|
2412
|
+
]),
|
|
2413
|
+
"data-testid": "svelte-flow__wrapper",
|
|
2414
|
+
role: "application",
|
|
2415
|
+
...divAttributes
|
|
2416
|
+
},
|
|
2417
|
+
"svelte-16cj6ux",
|
|
2418
|
+
void 0,
|
|
2419
|
+
{ width: toPxString(width), height: toPxString(height) }
|
|
2420
|
+
)}>`);
|
|
2421
|
+
children?.($$renderer2);
|
|
2422
|
+
$$renderer2.push(`<!----></div>`);
|
|
2423
|
+
bind_props($$props, { domNode, clientWidth, clientHeight });
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
function SvelteFlow($$renderer, $$props) {
|
|
2427
|
+
$$renderer.component(($$renderer2) => {
|
|
2428
|
+
let {
|
|
2429
|
+
width,
|
|
2430
|
+
height,
|
|
2431
|
+
proOptions,
|
|
2432
|
+
selectionKey,
|
|
2433
|
+
deleteKey,
|
|
2434
|
+
panActivationKey,
|
|
2435
|
+
multiSelectionKey,
|
|
2436
|
+
zoomActivationKey,
|
|
2437
|
+
paneClickDistance = 1,
|
|
2438
|
+
nodeClickDistance = 1,
|
|
2439
|
+
onmovestart,
|
|
2440
|
+
onmoveend,
|
|
2441
|
+
onmove,
|
|
2442
|
+
oninit,
|
|
2443
|
+
onnodeclick,
|
|
2444
|
+
onnodecontextmenu,
|
|
2445
|
+
onnodedrag,
|
|
2446
|
+
onnodedragstart,
|
|
2447
|
+
onnodedragstop,
|
|
2448
|
+
onnodepointerenter,
|
|
2449
|
+
onnodepointermove,
|
|
2450
|
+
onnodepointerleave,
|
|
2451
|
+
onselectionclick,
|
|
2452
|
+
onselectioncontextmenu,
|
|
2453
|
+
onselectionstart,
|
|
2454
|
+
onselectionend,
|
|
2455
|
+
onedgeclick,
|
|
2456
|
+
onedgecontextmenu,
|
|
2457
|
+
onedgepointerenter,
|
|
2458
|
+
onedgepointerleave,
|
|
2459
|
+
onpaneclick,
|
|
2460
|
+
onpanecontextmenu,
|
|
2461
|
+
panOnScrollMode = PanOnScrollMode.Free,
|
|
2462
|
+
preventScrolling = true,
|
|
2463
|
+
zoomOnScroll = true,
|
|
2464
|
+
zoomOnDoubleClick = true,
|
|
2465
|
+
zoomOnPinch = true,
|
|
2466
|
+
panOnScroll = false,
|
|
2467
|
+
panOnScrollSpeed = 0.5,
|
|
2468
|
+
panOnDrag = true,
|
|
2469
|
+
selectionOnDrag = false,
|
|
2470
|
+
connectionLineComponent,
|
|
2471
|
+
connectionLineStyle,
|
|
2472
|
+
connectionLineContainerStyle,
|
|
2473
|
+
connectionLineType = ConnectionLineType.Bezier,
|
|
2474
|
+
attributionPosition,
|
|
2475
|
+
children,
|
|
2476
|
+
nodes = [],
|
|
2477
|
+
edges = [],
|
|
2478
|
+
viewport = void 0,
|
|
2479
|
+
$$slots,
|
|
2480
|
+
$$events,
|
|
2481
|
+
...props
|
|
2482
|
+
} = $$props;
|
|
2483
|
+
let store = createStore({
|
|
2484
|
+
props,
|
|
2485
|
+
width,
|
|
2486
|
+
height,
|
|
2487
|
+
get nodes() {
|
|
2488
|
+
return nodes;
|
|
2489
|
+
},
|
|
2490
|
+
set nodes(newNodes) {
|
|
2491
|
+
nodes = newNodes;
|
|
2492
|
+
},
|
|
2493
|
+
get edges() {
|
|
2494
|
+
return edges;
|
|
2495
|
+
},
|
|
2496
|
+
set edges(newEdges) {
|
|
2497
|
+
edges = newEdges;
|
|
2498
|
+
},
|
|
2499
|
+
get viewport() {
|
|
2500
|
+
return viewport;
|
|
2501
|
+
},
|
|
2502
|
+
set viewport(newViewport) {
|
|
2503
|
+
viewport = newViewport;
|
|
2504
|
+
}
|
|
2505
|
+
});
|
|
2506
|
+
const providerContext = getContext(key);
|
|
2507
|
+
if (providerContext && providerContext.setStore) {
|
|
2508
|
+
providerContext.setStore(store);
|
|
2509
|
+
}
|
|
2510
|
+
setContext(key, {
|
|
2511
|
+
provider: false,
|
|
2512
|
+
getStore() {
|
|
2513
|
+
return store;
|
|
2514
|
+
}
|
|
2515
|
+
});
|
|
2516
|
+
onDestroy(() => {
|
|
2517
|
+
store.reset();
|
|
2518
|
+
});
|
|
2519
|
+
let $$settled = true;
|
|
2520
|
+
let $$inner_renderer;
|
|
2521
|
+
function $$render_inner($$renderer3) {
|
|
2522
|
+
Wrapper($$renderer3, {
|
|
2523
|
+
colorMode: store.colorMode,
|
|
2524
|
+
width,
|
|
2525
|
+
height,
|
|
2526
|
+
rest: props,
|
|
2527
|
+
get domNode() {
|
|
2528
|
+
return store.domNode;
|
|
2529
|
+
},
|
|
2530
|
+
set domNode($$value) {
|
|
2531
|
+
store.domNode = $$value;
|
|
2532
|
+
$$settled = false;
|
|
2533
|
+
},
|
|
2534
|
+
get clientWidth() {
|
|
2535
|
+
return store.width;
|
|
2536
|
+
},
|
|
2537
|
+
set clientWidth($$value) {
|
|
2538
|
+
store.width = $$value;
|
|
2539
|
+
$$settled = false;
|
|
2540
|
+
},
|
|
2541
|
+
get clientHeight() {
|
|
2542
|
+
return store.height;
|
|
2543
|
+
},
|
|
2544
|
+
set clientHeight($$value) {
|
|
2545
|
+
store.height = $$value;
|
|
2546
|
+
$$settled = false;
|
|
2547
|
+
},
|
|
2548
|
+
children: ($$renderer4) => {
|
|
2549
|
+
KeyHandler($$renderer4, {
|
|
2550
|
+
selectionKey,
|
|
2551
|
+
deleteKey,
|
|
2552
|
+
panActivationKey,
|
|
2553
|
+
multiSelectionKey,
|
|
2554
|
+
zoomActivationKey,
|
|
2555
|
+
get store() {
|
|
2556
|
+
return store;
|
|
2557
|
+
},
|
|
2558
|
+
set store($$value) {
|
|
2559
|
+
store = $$value;
|
|
2560
|
+
$$settled = false;
|
|
2561
|
+
}
|
|
2562
|
+
});
|
|
2563
|
+
$$renderer4.push(`<!----> `);
|
|
2564
|
+
Zoom($$renderer4, {
|
|
2565
|
+
panOnScrollMode,
|
|
2566
|
+
preventScrolling,
|
|
2567
|
+
zoomOnScroll,
|
|
2568
|
+
zoomOnDoubleClick,
|
|
2569
|
+
zoomOnPinch,
|
|
2570
|
+
panOnScroll,
|
|
2571
|
+
panOnScrollSpeed,
|
|
2572
|
+
panOnDrag,
|
|
2573
|
+
paneClickDistance,
|
|
2574
|
+
selectionOnDrag,
|
|
2575
|
+
onmovestart,
|
|
2576
|
+
onmove,
|
|
2577
|
+
onmoveend,
|
|
2578
|
+
oninit,
|
|
2579
|
+
get store() {
|
|
2580
|
+
return store;
|
|
2581
|
+
},
|
|
2582
|
+
set store($$value) {
|
|
2583
|
+
store = $$value;
|
|
2584
|
+
$$settled = false;
|
|
2585
|
+
},
|
|
2586
|
+
children: ($$renderer5) => {
|
|
2587
|
+
Pane($$renderer5, {
|
|
2588
|
+
onpaneclick,
|
|
2589
|
+
onpanecontextmenu,
|
|
2590
|
+
onselectionstart,
|
|
2591
|
+
onselectionend,
|
|
2592
|
+
panOnDrag,
|
|
2593
|
+
paneClickDistance,
|
|
2594
|
+
selectionOnDrag,
|
|
2595
|
+
get store() {
|
|
2596
|
+
return store;
|
|
2597
|
+
},
|
|
2598
|
+
set store($$value) {
|
|
2599
|
+
store = $$value;
|
|
2600
|
+
$$settled = false;
|
|
2601
|
+
},
|
|
2602
|
+
children: ($$renderer6) => {
|
|
2603
|
+
Viewport($$renderer6, {
|
|
2604
|
+
get store() {
|
|
2605
|
+
return store;
|
|
2606
|
+
},
|
|
2607
|
+
set store($$value) {
|
|
2608
|
+
store = $$value;
|
|
2609
|
+
$$settled = false;
|
|
2610
|
+
},
|
|
2611
|
+
children: ($$renderer7) => {
|
|
2612
|
+
$$renderer7.push(`<div class="svelte-flow__viewport-back svelte-flow__container"></div> `);
|
|
2613
|
+
EdgeRenderer($$renderer7, {
|
|
2614
|
+
onedgeclick,
|
|
2615
|
+
onedgecontextmenu,
|
|
2616
|
+
onedgepointerenter,
|
|
2617
|
+
onedgepointerleave,
|
|
2618
|
+
get store() {
|
|
2619
|
+
return store;
|
|
2620
|
+
},
|
|
2621
|
+
set store($$value) {
|
|
2622
|
+
store = $$value;
|
|
2623
|
+
$$settled = false;
|
|
2624
|
+
}
|
|
2625
|
+
});
|
|
2626
|
+
$$renderer7.push(`<!----> <div class="svelte-flow__edge-labels svelte-flow__container"></div> `);
|
|
2627
|
+
ConnectionLine($$renderer7, {
|
|
2628
|
+
type: connectionLineType,
|
|
2629
|
+
LineComponent: connectionLineComponent,
|
|
2630
|
+
containerStyle: connectionLineContainerStyle,
|
|
2631
|
+
style: connectionLineStyle,
|
|
2632
|
+
get store() {
|
|
2633
|
+
return store;
|
|
2634
|
+
},
|
|
2635
|
+
set store($$value) {
|
|
2636
|
+
store = $$value;
|
|
2637
|
+
$$settled = false;
|
|
2638
|
+
}
|
|
2639
|
+
});
|
|
2640
|
+
$$renderer7.push(`<!----> `);
|
|
2641
|
+
NodeRenderer($$renderer7, {
|
|
2642
|
+
nodeClickDistance,
|
|
2643
|
+
onnodeclick,
|
|
2644
|
+
onnodecontextmenu,
|
|
2645
|
+
onnodepointerenter,
|
|
2646
|
+
onnodepointermove,
|
|
2647
|
+
onnodepointerleave,
|
|
2648
|
+
onnodedrag,
|
|
2649
|
+
onnodedragstart,
|
|
2650
|
+
onnodedragstop,
|
|
2651
|
+
get store() {
|
|
2652
|
+
return store;
|
|
2653
|
+
},
|
|
2654
|
+
set store($$value) {
|
|
2655
|
+
store = $$value;
|
|
2656
|
+
$$settled = false;
|
|
2657
|
+
}
|
|
2658
|
+
});
|
|
2659
|
+
$$renderer7.push(`<!----> `);
|
|
2660
|
+
NodeSelection($$renderer7, {
|
|
2661
|
+
onselectionclick,
|
|
2662
|
+
onselectioncontextmenu,
|
|
2663
|
+
onnodedrag,
|
|
2664
|
+
onnodedragstart,
|
|
2665
|
+
onnodedragstop,
|
|
2666
|
+
get store() {
|
|
2667
|
+
return store;
|
|
2668
|
+
},
|
|
2669
|
+
set store($$value) {
|
|
2670
|
+
store = $$value;
|
|
2671
|
+
$$settled = false;
|
|
2672
|
+
}
|
|
2673
|
+
});
|
|
2674
|
+
$$renderer7.push(`<!----> <div class="svelte-flow__viewport-front svelte-flow__container"></div>`);
|
|
2675
|
+
},
|
|
2676
|
+
$$slots: { default: true }
|
|
2677
|
+
});
|
|
2678
|
+
$$renderer6.push(`<!----> `);
|
|
2679
|
+
Selection($$renderer6, {
|
|
2680
|
+
isVisible: !!(store.selectionRect && store.selectionRectMode === "user"),
|
|
2681
|
+
width: store.selectionRect?.width,
|
|
2682
|
+
height: store.selectionRect?.height,
|
|
2683
|
+
x: store.selectionRect?.x,
|
|
2684
|
+
y: store.selectionRect?.y
|
|
2685
|
+
});
|
|
2686
|
+
$$renderer6.push(`<!---->`);
|
|
2687
|
+
},
|
|
2688
|
+
$$slots: { default: true }
|
|
2689
|
+
});
|
|
2690
|
+
},
|
|
2691
|
+
$$slots: { default: true }
|
|
2692
|
+
});
|
|
2693
|
+
$$renderer4.push(`<!----> `);
|
|
2694
|
+
Attribution($$renderer4, { proOptions, position: attributionPosition });
|
|
2695
|
+
$$renderer4.push(`<!----> `);
|
|
2696
|
+
A11yDescriptions($$renderer4, { store });
|
|
2697
|
+
$$renderer4.push(`<!----> `);
|
|
2698
|
+
children?.($$renderer4);
|
|
2699
|
+
$$renderer4.push(`<!---->`);
|
|
2700
|
+
},
|
|
2701
|
+
$$slots: { default: true }
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
do {
|
|
2705
|
+
$$settled = true;
|
|
2706
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2707
|
+
$$render_inner($$inner_renderer);
|
|
2708
|
+
} while (!$$settled);
|
|
2709
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2710
|
+
bind_props($$props, { nodes, edges, viewport });
|
|
2711
|
+
});
|
|
2712
|
+
}
|
|
2713
|
+
function SvelteFlowProvider($$renderer, $$props) {
|
|
2714
|
+
$$renderer.component(($$renderer2) => {
|
|
2715
|
+
let { children } = $$props;
|
|
2716
|
+
let store = createStore({ props: {}, nodes: [], edges: [] });
|
|
2717
|
+
setContext(key, {
|
|
2718
|
+
provider: true,
|
|
2719
|
+
getStore() {
|
|
2720
|
+
return store;
|
|
2721
|
+
},
|
|
2722
|
+
setStore: (newStore) => {
|
|
2723
|
+
store = newStore;
|
|
2724
|
+
}
|
|
2725
|
+
});
|
|
2726
|
+
onDestroy(() => {
|
|
2727
|
+
store.reset();
|
|
2728
|
+
});
|
|
2729
|
+
children?.($$renderer2);
|
|
2730
|
+
$$renderer2.push(`<!---->`);
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
function ControlButton($$renderer, $$props) {
|
|
2734
|
+
let {
|
|
2735
|
+
class: className,
|
|
2736
|
+
bgColor,
|
|
2737
|
+
bgColorHover,
|
|
2738
|
+
color,
|
|
2739
|
+
colorHover,
|
|
2740
|
+
borderColor,
|
|
2741
|
+
onclick,
|
|
2742
|
+
children,
|
|
2743
|
+
$$slots,
|
|
2744
|
+
$$events,
|
|
2745
|
+
...restProps
|
|
2746
|
+
} = $$props;
|
|
2747
|
+
$$renderer.push(`<button${attributes(
|
|
2748
|
+
{
|
|
2749
|
+
type: "button",
|
|
2750
|
+
class: clsx(["svelte-flow__controls-button", className]),
|
|
2751
|
+
...restProps
|
|
2752
|
+
},
|
|
2753
|
+
void 0,
|
|
2754
|
+
void 0,
|
|
2755
|
+
{
|
|
2756
|
+
"--xy-controls-button-background-color-props": bgColor,
|
|
2757
|
+
"--xy-controls-button-background-color-hover-props": bgColorHover,
|
|
2758
|
+
"--xy-controls-button-color-props": color,
|
|
2759
|
+
"--xy-controls-button-color-hover-props": colorHover,
|
|
2760
|
+
"--xy-controls-button-border-color-props": borderColor
|
|
2761
|
+
}
|
|
2762
|
+
)}>`);
|
|
2763
|
+
children?.($$renderer);
|
|
2764
|
+
$$renderer.push(`<!----></button>`);
|
|
2765
|
+
}
|
|
2766
|
+
function Plus($$renderer) {
|
|
2767
|
+
$$renderer.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"></path></svg>`);
|
|
2768
|
+
}
|
|
2769
|
+
function Minus($$renderer) {
|
|
2770
|
+
$$renderer.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 5"><path d="M0 0h32v4.2H0z"></path></svg>`);
|
|
2771
|
+
}
|
|
2772
|
+
function Fit($$renderer) {
|
|
2773
|
+
$$renderer.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 30"><path d="M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"></path></svg>`);
|
|
2774
|
+
}
|
|
2775
|
+
function Lock($$renderer) {
|
|
2776
|
+
$$renderer.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 32"><path d="M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"></path></svg>`);
|
|
2777
|
+
}
|
|
2778
|
+
function Unlock($$renderer) {
|
|
2779
|
+
$$renderer.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 32"><path d="M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"></path></svg>`);
|
|
2780
|
+
}
|
|
2781
|
+
function Controls($$renderer, $$props) {
|
|
2782
|
+
$$renderer.component(($$renderer2) => {
|
|
2783
|
+
let {
|
|
2784
|
+
position = "bottom-left",
|
|
2785
|
+
orientation = "vertical",
|
|
2786
|
+
showZoom = true,
|
|
2787
|
+
showFitView = true,
|
|
2788
|
+
showLock = true,
|
|
2789
|
+
style,
|
|
2790
|
+
class: className,
|
|
2791
|
+
buttonBgColor,
|
|
2792
|
+
buttonBgColorHover,
|
|
2793
|
+
buttonColor,
|
|
2794
|
+
buttonColorHover,
|
|
2795
|
+
buttonBorderColor,
|
|
2796
|
+
fitViewOptions,
|
|
2797
|
+
children,
|
|
2798
|
+
before,
|
|
2799
|
+
after,
|
|
2800
|
+
$$slots,
|
|
2801
|
+
$$events,
|
|
2802
|
+
...rest
|
|
2803
|
+
} = $$props;
|
|
2804
|
+
let store = useStore();
|
|
2805
|
+
const buttonProps = {
|
|
2806
|
+
bgColor: buttonBgColor,
|
|
2807
|
+
bgColorHover: buttonBgColorHover,
|
|
2808
|
+
color: buttonColor,
|
|
2809
|
+
colorHover: buttonColorHover,
|
|
2810
|
+
borderColor: buttonBorderColor
|
|
2811
|
+
};
|
|
2812
|
+
let isInteractive = store.nodesDraggable || store.nodesConnectable || store.elementsSelectable;
|
|
2813
|
+
let minZoomReached = store.viewport.zoom <= store.minZoom;
|
|
2814
|
+
let maxZoomReached = store.viewport.zoom >= store.maxZoom;
|
|
2815
|
+
let ariaLabelConfig = store.ariaLabelConfig;
|
|
2816
|
+
let orientationClass = orientation === "horizontal" ? "horizontal" : "vertical";
|
|
2817
|
+
const onZoomInHandler = () => {
|
|
2818
|
+
store.zoomIn();
|
|
2819
|
+
};
|
|
2820
|
+
const onZoomOutHandler = () => {
|
|
2821
|
+
store.zoomOut();
|
|
2822
|
+
};
|
|
2823
|
+
const onFitViewHandler = () => {
|
|
2824
|
+
store.fitView(fitViewOptions);
|
|
2825
|
+
};
|
|
2826
|
+
const onToggleInteractivity = () => {
|
|
2827
|
+
let interactive = !isInteractive;
|
|
2828
|
+
store.nodesDraggable = interactive;
|
|
2829
|
+
store.nodesConnectable = interactive;
|
|
2830
|
+
store.elementsSelectable = interactive;
|
|
2831
|
+
};
|
|
2832
|
+
Panel($$renderer2, spread_props([
|
|
2833
|
+
{
|
|
2834
|
+
class: ["svelte-flow__controls", orientationClass, className],
|
|
2835
|
+
position,
|
|
2836
|
+
"data-testid": "svelte-flow__controls",
|
|
2837
|
+
"aria-label": ariaLabelConfig["controls.ariaLabel"],
|
|
2838
|
+
style
|
|
2839
|
+
},
|
|
2840
|
+
rest,
|
|
2841
|
+
{
|
|
2842
|
+
children: ($$renderer3) => {
|
|
2843
|
+
if (before) {
|
|
2844
|
+
$$renderer3.push("<!--[-->");
|
|
2845
|
+
before($$renderer3);
|
|
2846
|
+
$$renderer3.push(`<!---->`);
|
|
2847
|
+
} else {
|
|
2848
|
+
$$renderer3.push("<!--[!-->");
|
|
2849
|
+
}
|
|
2850
|
+
$$renderer3.push(`<!--]--> `);
|
|
2851
|
+
if (showZoom) {
|
|
2852
|
+
$$renderer3.push("<!--[-->");
|
|
2853
|
+
ControlButton($$renderer3, spread_props([
|
|
2854
|
+
{
|
|
2855
|
+
onclick: onZoomInHandler,
|
|
2856
|
+
class: "svelte-flow__controls-zoomin",
|
|
2857
|
+
title: ariaLabelConfig["controls.zoomIn.ariaLabel"],
|
|
2858
|
+
"aria-label": ariaLabelConfig["controls.zoomIn.ariaLabel"],
|
|
2859
|
+
disabled: maxZoomReached
|
|
2860
|
+
},
|
|
2861
|
+
buttonProps,
|
|
2862
|
+
{
|
|
2863
|
+
children: ($$renderer4) => {
|
|
2864
|
+
Plus($$renderer4);
|
|
2865
|
+
},
|
|
2866
|
+
$$slots: { default: true }
|
|
2867
|
+
}
|
|
2868
|
+
]));
|
|
2869
|
+
$$renderer3.push(`<!----> `);
|
|
2870
|
+
ControlButton($$renderer3, spread_props([
|
|
2871
|
+
{
|
|
2872
|
+
onclick: onZoomOutHandler,
|
|
2873
|
+
class: "svelte-flow__controls-zoomout",
|
|
2874
|
+
title: ariaLabelConfig["controls.zoomOut.ariaLabel"],
|
|
2875
|
+
"aria-label": ariaLabelConfig["controls.zoomOut.ariaLabel"],
|
|
2876
|
+
disabled: minZoomReached
|
|
2877
|
+
},
|
|
2878
|
+
buttonProps,
|
|
2879
|
+
{
|
|
2880
|
+
children: ($$renderer4) => {
|
|
2881
|
+
Minus($$renderer4);
|
|
2882
|
+
},
|
|
2883
|
+
$$slots: { default: true }
|
|
2884
|
+
}
|
|
2885
|
+
]));
|
|
2886
|
+
$$renderer3.push(`<!---->`);
|
|
2887
|
+
} else {
|
|
2888
|
+
$$renderer3.push("<!--[!-->");
|
|
2889
|
+
}
|
|
2890
|
+
$$renderer3.push(`<!--]--> `);
|
|
2891
|
+
if (showFitView) {
|
|
2892
|
+
$$renderer3.push("<!--[-->");
|
|
2893
|
+
ControlButton($$renderer3, spread_props([
|
|
2894
|
+
{
|
|
2895
|
+
class: "svelte-flow__controls-fitview",
|
|
2896
|
+
onclick: onFitViewHandler,
|
|
2897
|
+
title: ariaLabelConfig["controls.fitView.ariaLabel"],
|
|
2898
|
+
"aria-label": ariaLabelConfig["controls.fitView.ariaLabel"]
|
|
2899
|
+
},
|
|
2900
|
+
buttonProps,
|
|
2901
|
+
{
|
|
2902
|
+
children: ($$renderer4) => {
|
|
2903
|
+
Fit($$renderer4);
|
|
2904
|
+
},
|
|
2905
|
+
$$slots: { default: true }
|
|
2906
|
+
}
|
|
2907
|
+
]));
|
|
2908
|
+
} else {
|
|
2909
|
+
$$renderer3.push("<!--[!-->");
|
|
2910
|
+
}
|
|
2911
|
+
$$renderer3.push(`<!--]--> `);
|
|
2912
|
+
if (showLock) {
|
|
2913
|
+
$$renderer3.push("<!--[-->");
|
|
2914
|
+
ControlButton($$renderer3, spread_props([
|
|
2915
|
+
{
|
|
2916
|
+
class: "svelte-flow__controls-interactive",
|
|
2917
|
+
onclick: onToggleInteractivity,
|
|
2918
|
+
title: ariaLabelConfig["controls.interactive.ariaLabel"],
|
|
2919
|
+
"aria-label": ariaLabelConfig["controls.interactive.ariaLabel"]
|
|
2920
|
+
},
|
|
2921
|
+
buttonProps,
|
|
2922
|
+
{
|
|
2923
|
+
children: ($$renderer4) => {
|
|
2924
|
+
if (isInteractive) {
|
|
2925
|
+
$$renderer4.push("<!--[-->");
|
|
2926
|
+
Unlock($$renderer4);
|
|
2927
|
+
} else {
|
|
2928
|
+
$$renderer4.push("<!--[!-->");
|
|
2929
|
+
Lock($$renderer4);
|
|
2930
|
+
}
|
|
2931
|
+
$$renderer4.push(`<!--]-->`);
|
|
2932
|
+
},
|
|
2933
|
+
$$slots: { default: true }
|
|
2934
|
+
}
|
|
2935
|
+
]));
|
|
2936
|
+
} else {
|
|
2937
|
+
$$renderer3.push("<!--[!-->");
|
|
2938
|
+
}
|
|
2939
|
+
$$renderer3.push(`<!--]--> `);
|
|
2940
|
+
if (children) {
|
|
2941
|
+
$$renderer3.push("<!--[-->");
|
|
2942
|
+
children($$renderer3);
|
|
2943
|
+
$$renderer3.push(`<!---->`);
|
|
2944
|
+
} else {
|
|
2945
|
+
$$renderer3.push("<!--[!-->");
|
|
2946
|
+
}
|
|
2947
|
+
$$renderer3.push(`<!--]--> `);
|
|
2948
|
+
if (after) {
|
|
2949
|
+
$$renderer3.push("<!--[-->");
|
|
2950
|
+
after($$renderer3);
|
|
2951
|
+
$$renderer3.push(`<!---->`);
|
|
2952
|
+
} else {
|
|
2953
|
+
$$renderer3.push("<!--[!-->");
|
|
2954
|
+
}
|
|
2955
|
+
$$renderer3.push(`<!--]-->`);
|
|
2956
|
+
},
|
|
2957
|
+
$$slots: { default: true }
|
|
2958
|
+
}
|
|
2959
|
+
]));
|
|
2960
|
+
});
|
|
2961
|
+
}
|
|
2962
|
+
var BackgroundVariant;
|
|
2963
|
+
(function(BackgroundVariant2) {
|
|
2964
|
+
BackgroundVariant2["Lines"] = "lines";
|
|
2965
|
+
BackgroundVariant2["Dots"] = "dots";
|
|
2966
|
+
BackgroundVariant2["Cross"] = "cross";
|
|
2967
|
+
})(BackgroundVariant || (BackgroundVariant = {}));
|
|
2968
|
+
function DotPattern($$renderer, $$props) {
|
|
2969
|
+
let { radius, class: className } = $$props;
|
|
2970
|
+
$$renderer.push(`<circle${attr("cx", radius)}${attr("cy", radius)}${attr("r", radius)}${attr_class(clsx(["svelte-flow__background-pattern", "dots", className]))}></circle>`);
|
|
2971
|
+
}
|
|
2972
|
+
function LinePattern($$renderer, $$props) {
|
|
2973
|
+
$$renderer.component(($$renderer2) => {
|
|
2974
|
+
let { lineWidth, dimensions, variant, class: className } = $$props;
|
|
2975
|
+
$$renderer2.push(`<path${attr("stroke-width", lineWidth)}${attr("d", `M${dimensions[0] / 2} 0 V${dimensions[1]} M0 ${dimensions[1] / 2} H${dimensions[0]}`)}${attr_class(clsx(["svelte-flow__background-pattern", variant, className]))}></path>`);
|
|
2976
|
+
});
|
|
2977
|
+
}
|
|
2978
|
+
const defaultSize = {
|
|
2979
|
+
[BackgroundVariant.Dots]: 1,
|
|
2980
|
+
[BackgroundVariant.Lines]: 1,
|
|
2981
|
+
[BackgroundVariant.Cross]: 6
|
|
2982
|
+
};
|
|
2983
|
+
function Background($$renderer, $$props) {
|
|
2984
|
+
$$renderer.component(($$renderer2) => {
|
|
2985
|
+
let {
|
|
2986
|
+
id,
|
|
2987
|
+
variant = BackgroundVariant.Dots,
|
|
2988
|
+
gap = 20,
|
|
2989
|
+
size,
|
|
2990
|
+
lineWidth = 1,
|
|
2991
|
+
bgColor,
|
|
2992
|
+
patternColor,
|
|
2993
|
+
patternClass,
|
|
2994
|
+
class: className
|
|
2995
|
+
} = $$props;
|
|
2996
|
+
let store = useStore();
|
|
2997
|
+
let isDots = variant === BackgroundVariant.Dots;
|
|
2998
|
+
let isCross = variant === BackgroundVariant.Cross;
|
|
2999
|
+
let gapXY = Array.isArray(gap) ? gap : [gap, gap];
|
|
3000
|
+
let patternId = `background-pattern-${store.flowId}-${id ?? ""}`;
|
|
3001
|
+
let scaledGap = [
|
|
3002
|
+
gapXY[0] * store.viewport.zoom || 1,
|
|
3003
|
+
gapXY[1] * store.viewport.zoom || 1
|
|
3004
|
+
];
|
|
3005
|
+
let scaledSize = (size ?? defaultSize[variant]) * store.viewport.zoom;
|
|
3006
|
+
let patternDimensions = isCross ? [scaledSize, scaledSize] : scaledGap;
|
|
3007
|
+
let patternOffset = isDots ? [scaledSize / 2, scaledSize / 2] : [patternDimensions[0] / 2, patternDimensions[1] / 2];
|
|
3008
|
+
$$renderer2.push(`<svg${attr_class(clsx([
|
|
3009
|
+
"svelte-flow__background",
|
|
3010
|
+
"svelte-flow__container",
|
|
3011
|
+
className
|
|
3012
|
+
]))} data-testid="svelte-flow__background"${attr_style("", {
|
|
3013
|
+
"--xy-background-color-props": bgColor,
|
|
3014
|
+
"--xy-background-pattern-color-props": patternColor
|
|
3015
|
+
})}><pattern${attr("id", patternId)}${attr("x", store.viewport.x % scaledGap[0])}${attr("y", store.viewport.y % scaledGap[1])}${attr("width", scaledGap[0])}${attr("height", scaledGap[1])} patternUnits="userSpaceOnUse"${attr("patternTransform", `translate(-${patternOffset[0]},-${patternOffset[1]})`)}>`);
|
|
3016
|
+
if (isDots) {
|
|
3017
|
+
$$renderer2.push("<!--[-->");
|
|
3018
|
+
DotPattern($$renderer2, { radius: scaledSize / 2, class: patternClass });
|
|
3019
|
+
} else {
|
|
3020
|
+
$$renderer2.push("<!--[!-->");
|
|
3021
|
+
LinePattern($$renderer2, {
|
|
3022
|
+
dimensions: patternDimensions,
|
|
3023
|
+
variant,
|
|
3024
|
+
lineWidth,
|
|
3025
|
+
class: patternClass
|
|
3026
|
+
});
|
|
3027
|
+
}
|
|
3028
|
+
$$renderer2.push(`<!--]--></pattern><rect x="0" y="0" width="100%" height="100%"${attr("fill", `url(#${patternId})`)}></rect></svg>`);
|
|
3029
|
+
});
|
|
3030
|
+
}
|
|
3031
|
+
function useInternalNode(id) {
|
|
3032
|
+
const { nodeLookup, nodes } = useStore();
|
|
3033
|
+
const node = (() => {
|
|
3034
|
+
return nodeLookup.get(id);
|
|
3035
|
+
})();
|
|
3036
|
+
return {
|
|
3037
|
+
get current() {
|
|
3038
|
+
return node;
|
|
3039
|
+
}
|
|
3040
|
+
};
|
|
3041
|
+
}
|
|
3042
|
+
function MinimapNode($$renderer, $$props) {
|
|
3043
|
+
$$renderer.component(($$renderer2) => {
|
|
3044
|
+
let {
|
|
3045
|
+
id,
|
|
3046
|
+
x: xProp,
|
|
3047
|
+
y: yProp,
|
|
3048
|
+
width: widthProp,
|
|
3049
|
+
height: heightProp,
|
|
3050
|
+
borderRadius = 5,
|
|
3051
|
+
color,
|
|
3052
|
+
shapeRendering,
|
|
3053
|
+
strokeColor,
|
|
3054
|
+
strokeWidth = 2,
|
|
3055
|
+
selected,
|
|
3056
|
+
class: className,
|
|
3057
|
+
nodeComponent
|
|
3058
|
+
} = $$props;
|
|
3059
|
+
let internalNode = useInternalNode(id);
|
|
3060
|
+
let { width, height, x, y } = (() => {
|
|
3061
|
+
if (!internalNode.current) {
|
|
3062
|
+
return { width: 0, height: 0, x: 0, y: 0 };
|
|
3063
|
+
}
|
|
3064
|
+
const { width: width2, height: height2 } = getNodeDimensions(internalNode.current);
|
|
3065
|
+
return {
|
|
3066
|
+
width: widthProp ?? width2,
|
|
3067
|
+
height: heightProp ?? height2,
|
|
3068
|
+
x: xProp ?? internalNode.current.internals.positionAbsolute.x,
|
|
3069
|
+
y: yProp ?? internalNode.current.internals.positionAbsolute.y
|
|
3070
|
+
};
|
|
3071
|
+
})();
|
|
3072
|
+
if (nodeComponent) {
|
|
3073
|
+
$$renderer2.push("<!--[-->");
|
|
3074
|
+
const CustomComponent = nodeComponent;
|
|
3075
|
+
$$renderer2.push("<!---->");
|
|
3076
|
+
CustomComponent?.($$renderer2, {
|
|
3077
|
+
id,
|
|
3078
|
+
x,
|
|
3079
|
+
y,
|
|
3080
|
+
width,
|
|
3081
|
+
height,
|
|
3082
|
+
borderRadius,
|
|
3083
|
+
class: className,
|
|
3084
|
+
color,
|
|
3085
|
+
shapeRendering,
|
|
3086
|
+
strokeColor,
|
|
3087
|
+
strokeWidth,
|
|
3088
|
+
selected
|
|
3089
|
+
});
|
|
3090
|
+
$$renderer2.push(`<!---->`);
|
|
3091
|
+
} else {
|
|
3092
|
+
$$renderer2.push("<!--[!-->");
|
|
3093
|
+
$$renderer2.push(`<rect${attr_class(clsx(["svelte-flow__minimap-node", className]), void 0, { "selected": selected })}${attr("x", x)}${attr("y", y)}${attr("rx", borderRadius)}${attr("ry", borderRadius)}${attr("width", width)}${attr("height", height)}${attr("shape-rendering", shapeRendering)}${attr_style("", {
|
|
3094
|
+
fill: color,
|
|
3095
|
+
stroke: strokeColor,
|
|
3096
|
+
"stroke-width": strokeWidth
|
|
3097
|
+
})}></rect>`);
|
|
3098
|
+
}
|
|
3099
|
+
$$renderer2.push(`<!--]-->`);
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3102
|
+
const getAttrFunction = (func) => func instanceof Function ? func : () => func;
|
|
3103
|
+
function Minimap($$renderer, $$props) {
|
|
3104
|
+
$$renderer.component(($$renderer2) => {
|
|
3105
|
+
let {
|
|
3106
|
+
position = "bottom-right",
|
|
3107
|
+
ariaLabel,
|
|
3108
|
+
nodeStrokeColor = "transparent",
|
|
3109
|
+
nodeColor,
|
|
3110
|
+
nodeClass = "",
|
|
3111
|
+
nodeBorderRadius = 5,
|
|
3112
|
+
nodeStrokeWidth = 2,
|
|
3113
|
+
nodeComponent,
|
|
3114
|
+
bgColor,
|
|
3115
|
+
maskColor,
|
|
3116
|
+
maskStrokeColor,
|
|
3117
|
+
maskStrokeWidth,
|
|
3118
|
+
width = 200,
|
|
3119
|
+
height = 150,
|
|
3120
|
+
pannable = true,
|
|
3121
|
+
zoomable = true,
|
|
3122
|
+
inversePan,
|
|
3123
|
+
zoomStep,
|
|
3124
|
+
class: className,
|
|
3125
|
+
$$slots,
|
|
3126
|
+
$$events,
|
|
3127
|
+
...rest
|
|
3128
|
+
} = $$props;
|
|
3129
|
+
let store = useStore();
|
|
3130
|
+
let ariaLabelConfig = store.ariaLabelConfig;
|
|
3131
|
+
const shapeRendering = (
|
|
3132
|
+
// @ts-expect-error - TS doesn't know about chrome
|
|
3133
|
+
typeof window === "undefined" || !!window.chrome ? "crispEdges" : "geometricPrecision"
|
|
3134
|
+
);
|
|
3135
|
+
let labelledBy = `svelte-flow__minimap-desc-${store.flowId}`;
|
|
3136
|
+
let viewBB = {
|
|
3137
|
+
x: -store.viewport.x / store.viewport.zoom,
|
|
3138
|
+
y: -store.viewport.y / store.viewport.zoom,
|
|
3139
|
+
width: store.width / store.viewport.zoom,
|
|
3140
|
+
height: store.height / store.viewport.zoom
|
|
3141
|
+
};
|
|
3142
|
+
let boundingRect = getBoundsOfRects(getInternalNodesBounds(store.nodeLookup, { filter: (n) => !n.hidden }), viewBB);
|
|
3143
|
+
let scaledWidth = boundingRect.width / width;
|
|
3144
|
+
let scaledHeight = boundingRect.height / height;
|
|
3145
|
+
let viewScale = Math.max(scaledWidth, scaledHeight);
|
|
3146
|
+
let viewWidth = viewScale * width;
|
|
3147
|
+
let viewHeight = viewScale * height;
|
|
3148
|
+
let offset = 5 * viewScale;
|
|
3149
|
+
let x = boundingRect.x - (viewWidth - boundingRect.width) / 2 - offset;
|
|
3150
|
+
let y = boundingRect.y - (viewHeight - boundingRect.height) / 2 - offset;
|
|
3151
|
+
let viewboxWidth = viewWidth + offset * 2;
|
|
3152
|
+
let viewboxHeight = viewHeight + offset * 2;
|
|
3153
|
+
css_props($$renderer2, true, { "--xy-minimap-background-color-props": bgColor }, () => {
|
|
3154
|
+
Panel($$renderer2, spread_props([
|
|
3155
|
+
{
|
|
3156
|
+
position,
|
|
3157
|
+
class: ["svelte-flow__minimap", className],
|
|
3158
|
+
"data-testid": "svelte-flow__minimap"
|
|
3159
|
+
},
|
|
3160
|
+
rest,
|
|
3161
|
+
{
|
|
3162
|
+
children: ($$renderer3) => {
|
|
3163
|
+
if (store.panZoom) {
|
|
3164
|
+
$$renderer3.push("<!--[-->");
|
|
3165
|
+
$$renderer3.push(`<svg${attr("width", width)}${attr("height", height)}${attr("viewBox", `${stringify(x)} ${stringify(y)} ${stringify(viewboxWidth)} ${stringify(viewboxHeight)}`)} class="svelte-flow__minimap-svg" role="img"${attr("aria-labelledby", labelledBy)}${attr_style("", {
|
|
3166
|
+
"--xy-minimap-mask-background-color-props": maskColor,
|
|
3167
|
+
"--xy-minimap-mask-stroke-color-props": maskStrokeColor,
|
|
3168
|
+
"--xy-minimap-mask-stroke-width-props": maskStrokeWidth ? maskStrokeWidth * viewScale : void 0
|
|
3169
|
+
})}>`);
|
|
3170
|
+
if (ariaLabel ?? ariaLabelConfig["minimap.ariaLabel"]) {
|
|
3171
|
+
$$renderer3.push("<!--[-->");
|
|
3172
|
+
$$renderer3.push(`<title${attr("id", labelledBy)}>${escape_html(ariaLabel ?? ariaLabelConfig["minimap.ariaLabel"])}</title>`);
|
|
3173
|
+
} else {
|
|
3174
|
+
$$renderer3.push("<!--[!-->");
|
|
3175
|
+
}
|
|
3176
|
+
$$renderer3.push(`<!--]--><!--[-->`);
|
|
3177
|
+
const each_array = ensure_array_like(store.nodes);
|
|
3178
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
3179
|
+
let userNode = each_array[$$index];
|
|
3180
|
+
const node = store.nodeLookup.get(userNode.id);
|
|
3181
|
+
if (node && nodeHasDimensions(node) && !node.hidden) {
|
|
3182
|
+
$$renderer3.push("<!--[-->");
|
|
3183
|
+
MinimapNode($$renderer3, {
|
|
3184
|
+
id: node.id,
|
|
3185
|
+
selected: node.selected,
|
|
3186
|
+
nodeComponent,
|
|
3187
|
+
color: nodeColor === void 0 ? void 0 : getAttrFunction(nodeColor)(userNode),
|
|
3188
|
+
borderRadius: nodeBorderRadius,
|
|
3189
|
+
strokeColor: getAttrFunction(nodeStrokeColor)(userNode),
|
|
3190
|
+
strokeWidth: nodeStrokeWidth,
|
|
3191
|
+
shapeRendering,
|
|
3192
|
+
class: getAttrFunction(nodeClass)(userNode)
|
|
3193
|
+
});
|
|
3194
|
+
} else {
|
|
3195
|
+
$$renderer3.push("<!--[!-->");
|
|
3196
|
+
}
|
|
3197
|
+
$$renderer3.push(`<!--]-->`);
|
|
3198
|
+
}
|
|
3199
|
+
$$renderer3.push(`<!--]--><path class="svelte-flow__minimap-mask"${attr("d", `M${stringify(x - offset)},${stringify(y - offset)}h${stringify(viewboxWidth + offset * 2)}v${stringify(viewboxHeight + offset * 2)}h${stringify(-viewboxWidth - offset * 2)}z
|
|
3200
|
+
M${stringify(viewBB.x)},${stringify(viewBB.y)}h${stringify(viewBB.width)}v${stringify(viewBB.height)}h${stringify(-viewBB.width)}z`)} fill-rule="evenodd" pointer-events="none"></path></svg>`);
|
|
3201
|
+
} else {
|
|
3202
|
+
$$renderer3.push("<!--[!-->");
|
|
3203
|
+
}
|
|
3204
|
+
$$renderer3.push(`<!--]-->`);
|
|
3205
|
+
},
|
|
3206
|
+
$$slots: { default: true }
|
|
3207
|
+
}
|
|
3208
|
+
]));
|
|
3209
|
+
});
|
|
3210
|
+
});
|
|
3211
|
+
}
|
|
3212
|
+
function useNodes() {
|
|
3213
|
+
const store = useStore();
|
|
3214
|
+
return {
|
|
3215
|
+
get current() {
|
|
3216
|
+
return store.nodes;
|
|
3217
|
+
},
|
|
3218
|
+
set current(nodes) {
|
|
3219
|
+
store.nodes = nodes;
|
|
3220
|
+
},
|
|
3221
|
+
update(updateFn) {
|
|
3222
|
+
store.nodes = updateFn(store.nodes);
|
|
3223
|
+
},
|
|
3224
|
+
set(nodes) {
|
|
3225
|
+
store.nodes = nodes;
|
|
3226
|
+
}
|
|
3227
|
+
};
|
|
3228
|
+
}
|
|
3229
|
+
function useEdges() {
|
|
3230
|
+
const store = useStore();
|
|
3231
|
+
return {
|
|
3232
|
+
get current() {
|
|
3233
|
+
return store.edges;
|
|
3234
|
+
},
|
|
3235
|
+
set current(edges) {
|
|
3236
|
+
store.edges = edges;
|
|
3237
|
+
},
|
|
3238
|
+
update(updateFn) {
|
|
3239
|
+
store.edges = updateFn(store.edges);
|
|
3240
|
+
},
|
|
3241
|
+
set(edges) {
|
|
3242
|
+
store.edges = edges;
|
|
3243
|
+
}
|
|
3244
|
+
};
|
|
3245
|
+
}
|
|
3246
|
+
const ServiceType = {
|
|
3247
|
+
// Compute
|
|
3248
|
+
EC2: "EC2",
|
|
3249
|
+
ECS: "ECS",
|
|
3250
|
+
EKS: "EKS",
|
|
3251
|
+
LAMBDA: "LAMBDA",
|
|
3252
|
+
FARGATE: "FARGATE",
|
|
3253
|
+
BATCH: "BATCH",
|
|
3254
|
+
ELASTIC_BEANSTALK: "ELASTIC_BEANSTALK",
|
|
3255
|
+
APP_RUNNER: "APP_RUNNER",
|
|
3256
|
+
// Containers
|
|
3257
|
+
ECR: "ECR",
|
|
3258
|
+
ECS_ANYWHERE: "ECS_ANYWHERE",
|
|
3259
|
+
EKS_ANYWHERE: "EKS_ANYWHERE",
|
|
3260
|
+
// Storage
|
|
3261
|
+
S3: "S3",
|
|
3262
|
+
EFS: "EFS",
|
|
3263
|
+
EBS: "EBS",
|
|
3264
|
+
FSX: "FSX",
|
|
3265
|
+
STORAGE_GATEWAY: "STORAGE_GATEWAY",
|
|
3266
|
+
BACKUP: "BACKUP",
|
|
3267
|
+
S3_GLACIER: "S3_GLACIER",
|
|
3268
|
+
// Database
|
|
3269
|
+
RDS: "RDS",
|
|
3270
|
+
DYNAMODB: "DYNAMODB",
|
|
3271
|
+
ELASTICACHE: "ELASTICACHE",
|
|
3272
|
+
VALKEY: "VALKEY",
|
|
3273
|
+
AURORA: "AURORA",
|
|
3274
|
+
NEPTUNE: "NEPTUNE",
|
|
3275
|
+
DOCUMENTDB: "DOCUMENTDB",
|
|
3276
|
+
KEYSPACES: "KEYSPACES",
|
|
3277
|
+
TIMESTREAM: "TIMESTREAM",
|
|
3278
|
+
MEMORYDB: "MEMORYDB",
|
|
3279
|
+
QLDB: "QLDB",
|
|
3280
|
+
// Networking & Content Delivery
|
|
3281
|
+
VPC: "VPC",
|
|
3282
|
+
CLOUDFRONT: "CLOUDFRONT",
|
|
3283
|
+
ROUTE53: "ROUTE53",
|
|
3284
|
+
API_GATEWAY: "API_GATEWAY",
|
|
3285
|
+
DIRECT_CONNECT: "DIRECT_CONNECT",
|
|
3286
|
+
APP_MESH: "APP_MESH",
|
|
3287
|
+
CLOUD_MAP: "CLOUD_MAP",
|
|
3288
|
+
GLOBAL_ACCELERATOR: "GLOBAL_ACCELERATOR",
|
|
3289
|
+
// Load Balancers
|
|
3290
|
+
ALB: "ALB",
|
|
3291
|
+
NLB: "NLB",
|
|
3292
|
+
ELB: "ELB",
|
|
3293
|
+
ELASTIC_LOAD_BALANCING: "ELASTIC_LOAD_BALANCING",
|
|
3294
|
+
// Messaging & Integration
|
|
3295
|
+
SQS: "SQS",
|
|
3296
|
+
SNS: "SNS",
|
|
3297
|
+
EVENTBRIDGE: "EVENTBRIDGE",
|
|
3298
|
+
EVENTBRIDGE_RULE: "EVENTBRIDGE_RULE",
|
|
3299
|
+
STEP_FUNCTIONS: "STEP_FUNCTIONS",
|
|
3300
|
+
SWF: "SWF",
|
|
3301
|
+
MQ: "MQ",
|
|
3302
|
+
APPSYNC: "APPSYNC",
|
|
3303
|
+
// Analytics
|
|
3304
|
+
KINESIS: "KINESIS",
|
|
3305
|
+
KINESIS_FIREHOSE: "KINESIS_FIREHOSE",
|
|
3306
|
+
KINESIS_ANALYTICS: "KINESIS_ANALYTICS",
|
|
3307
|
+
ATHENA: "ATHENA",
|
|
3308
|
+
EMR: "EMR",
|
|
3309
|
+
GLUE: "GLUE",
|
|
3310
|
+
REDSHIFT: "REDSHIFT",
|
|
3311
|
+
QUICKSIGHT: "QUICKSIGHT",
|
|
3312
|
+
OPENSEARCH: "OPENSEARCH",
|
|
3313
|
+
MSK: "MSK",
|
|
3314
|
+
// Security & Identity
|
|
3315
|
+
IAM: "IAM",
|
|
3316
|
+
COGNITO: "COGNITO",
|
|
3317
|
+
SECRETS_MANAGER: "SECRETS_MANAGER",
|
|
3318
|
+
KMS: "KMS",
|
|
3319
|
+
WAF: "WAF",
|
|
3320
|
+
SHIELD: "SHIELD",
|
|
3321
|
+
GUARDDUTY: "GUARDDUTY",
|
|
3322
|
+
INSPECTOR: "INSPECTOR",
|
|
3323
|
+
MACIE: "MACIE",
|
|
3324
|
+
SECURITY_HUB: "SECURITY_HUB",
|
|
3325
|
+
CERTIFICATE_MANAGER: "CERTIFICATE_MANAGER",
|
|
3326
|
+
FIREWALL_MANAGER: "FIREWALL_MANAGER",
|
|
3327
|
+
NETWORK_FIREWALL: "NETWORK_FIREWALL",
|
|
3328
|
+
// Management & Governance
|
|
3329
|
+
CLOUDWATCH: "CLOUDWATCH",
|
|
3330
|
+
CLOUDTRAIL: "CLOUDTRAIL",
|
|
3331
|
+
CONFIG: "CONFIG",
|
|
3332
|
+
SYSTEMS_MANAGER: "SYSTEMS_MANAGER",
|
|
3333
|
+
CLOUDFORMATION: "CLOUDFORMATION",
|
|
3334
|
+
ORGANIZATIONS: "ORGANIZATIONS",
|
|
3335
|
+
CONTROL_TOWER: "CONTROL_TOWER",
|
|
3336
|
+
TRUSTED_ADVISOR: "TRUSTED_ADVISOR",
|
|
3337
|
+
// Developer Tools
|
|
3338
|
+
CODECOMMIT: "CODECOMMIT",
|
|
3339
|
+
CODEBUILD: "CODEBUILD",
|
|
3340
|
+
CODEDEPLOY: "CODEDEPLOY",
|
|
3341
|
+
CODEPIPELINE: "CODEPIPELINE",
|
|
3342
|
+
CODEARTIFACT: "CODEARTIFACT",
|
|
3343
|
+
CLOUD9: "CLOUD9",
|
|
3344
|
+
X_RAY: "X_RAY",
|
|
3345
|
+
// Machine Learning
|
|
3346
|
+
SAGEMAKER: "SAGEMAKER",
|
|
3347
|
+
COMPREHEND: "COMPREHEND",
|
|
3348
|
+
REKOGNITION: "REKOGNITION",
|
|
3349
|
+
TEXTRACT: "TEXTRACT",
|
|
3350
|
+
TRANSLATE: "TRANSLATE",
|
|
3351
|
+
TRANSCRIBE: "TRANSCRIBE",
|
|
3352
|
+
POLLY: "POLLY",
|
|
3353
|
+
LEX: "LEX",
|
|
3354
|
+
// Migration & Transfer
|
|
3355
|
+
DMS: "DMS",
|
|
3356
|
+
TRANSFER_FAMILY: "TRANSFER_FAMILY",
|
|
3357
|
+
MIGRATION_HUB: "MIGRATION_HUB",
|
|
3358
|
+
DATASYNC: "DATASYNC",
|
|
3359
|
+
SNOWBALL: "SNOWBALL",
|
|
3360
|
+
// Application Integration
|
|
3361
|
+
AMPLIFY: "AMPLIFY"
|
|
3362
|
+
};
|
|
3363
|
+
const SERVICE_TYPE_TO_ICON = {
|
|
3364
|
+
[ServiceType.EC2]: "Compute/EC2.svg",
|
|
3365
|
+
[ServiceType.ECS]: "Containers/Elastic-Container-Service.svg",
|
|
3366
|
+
[ServiceType.EKS]: "Containers/Elastic-Kubernetes-Service.svg",
|
|
3367
|
+
[ServiceType.LAMBDA]: "Compute/Lambda.svg",
|
|
3368
|
+
[ServiceType.FARGATE]: "Compute/Fargate.svg",
|
|
3369
|
+
[ServiceType.BATCH]: "Compute/Batch.svg",
|
|
3370
|
+
[ServiceType.ELASTIC_BEANSTALK]: "Compute/Elastic-Beanstalk.svg",
|
|
3371
|
+
[ServiceType.APP_RUNNER]: "Containers/App-Runner.svg",
|
|
3372
|
+
[ServiceType.ECR]: "Containers/Elastic-Container-Registry.svg",
|
|
3373
|
+
[ServiceType.ECS_ANYWHERE]: "Containers/ECS-Anywhere.svg",
|
|
3374
|
+
[ServiceType.EKS_ANYWHERE]: "Containers/EKS-Anywhere.svg",
|
|
3375
|
+
[ServiceType.S3]: "Storage/Simple-Storage-Service.svg",
|
|
3376
|
+
[ServiceType.EFS]: "Storage/EFS.svg",
|
|
3377
|
+
[ServiceType.EBS]: "Storage/Elastic-Block-Store.svg",
|
|
3378
|
+
[ServiceType.FSX]: "Storage/FSx.svg",
|
|
3379
|
+
[ServiceType.STORAGE_GATEWAY]: "Storage/Storage-Gateway.svg",
|
|
3380
|
+
[ServiceType.BACKUP]: "Storage/Backup.svg",
|
|
3381
|
+
[ServiceType.S3_GLACIER]: "Storage/Simple-Storage-Service-Glacier.svg",
|
|
3382
|
+
[ServiceType.RDS]: "Database/RDS.svg",
|
|
3383
|
+
[ServiceType.DYNAMODB]: "Database/DynamoDB.svg",
|
|
3384
|
+
[ServiceType.ELASTICACHE]: "Database/ElastiCache.svg",
|
|
3385
|
+
[ServiceType.VALKEY]: "Database/ElastiCache.svg",
|
|
3386
|
+
[ServiceType.AURORA]: "Database/Aurora.svg",
|
|
3387
|
+
[ServiceType.NEPTUNE]: "Database/Neptune.svg",
|
|
3388
|
+
[ServiceType.DOCUMENTDB]: "Database/DocumentDB.svg",
|
|
3389
|
+
[ServiceType.KEYSPACES]: "Database/Keyspaces.svg",
|
|
3390
|
+
[ServiceType.TIMESTREAM]: "Database/Timestream.svg",
|
|
3391
|
+
[ServiceType.MEMORYDB]: "Database/MemoryDB-for-Redis.svg",
|
|
3392
|
+
[ServiceType.QLDB]: "Database/Quantum-Ledger-Database.svg",
|
|
3393
|
+
[ServiceType.VPC]: "Networking-Content-Delivery/Virtual-Private-Cloud.svg",
|
|
3394
|
+
[ServiceType.CLOUDFRONT]: "Networking-Content-Delivery/CloudFront.svg",
|
|
3395
|
+
[ServiceType.ROUTE53]: "Networking-Content-Delivery/Route-53.svg",
|
|
3396
|
+
[ServiceType.API_GATEWAY]: "App-Integration/API-Gateway.svg",
|
|
3397
|
+
[ServiceType.DIRECT_CONNECT]: "Networking-Content-Delivery/Direct-Connect.svg",
|
|
3398
|
+
[ServiceType.APP_MESH]: "Networking-Content-Delivery/App-Mesh.svg",
|
|
3399
|
+
[ServiceType.CLOUD_MAP]: "Networking-Content-Delivery/Cloud-Map.svg",
|
|
3400
|
+
[ServiceType.GLOBAL_ACCELERATOR]: "Networking-Content-Delivery/Global-Accelerator.svg",
|
|
3401
|
+
[ServiceType.ALB]: "Networking-Content-Delivery/Elastic-Load-Balancing.svg",
|
|
3402
|
+
[ServiceType.NLB]: "Networking-Content-Delivery/Elastic-Load-Balancing.svg",
|
|
3403
|
+
[ServiceType.ELB]: "Networking-Content-Delivery/Elastic-Load-Balancing.svg",
|
|
3404
|
+
[ServiceType.ELASTIC_LOAD_BALANCING]: "Networking-Content-Delivery/Elastic-Load-Balancing.svg",
|
|
3405
|
+
[ServiceType.SQS]: "App-Integration/Simple-Queue-Service.svg",
|
|
3406
|
+
[ServiceType.SNS]: "App-Integration/Simple-Notification-Service.svg",
|
|
3407
|
+
[ServiceType.EVENTBRIDGE]: "App-Integration/EventBridge.svg",
|
|
3408
|
+
[ServiceType.EVENTBRIDGE_RULE]: "App-Integration/EventBridge.svg",
|
|
3409
|
+
[ServiceType.STEP_FUNCTIONS]: "App-Integration/Step-Functions.svg",
|
|
3410
|
+
[ServiceType.SWF]: "App-Integration/Step-Functions.svg",
|
|
3411
|
+
[ServiceType.MQ]: "App-Integration/MQ.svg",
|
|
3412
|
+
[ServiceType.APPSYNC]: "Front-End-Web-Mobile/AppSync.svg",
|
|
3413
|
+
[ServiceType.KINESIS]: "Analytics/Kinesis.svg",
|
|
3414
|
+
[ServiceType.KINESIS_FIREHOSE]: "Analytics/Kinesis-Firehose.svg",
|
|
3415
|
+
[ServiceType.KINESIS_ANALYTICS]: "Analytics/Kinesis-Data-Analytics.svg",
|
|
3416
|
+
[ServiceType.ATHENA]: "Analytics/Athena.svg",
|
|
3417
|
+
[ServiceType.EMR]: "Analytics/EMR.svg",
|
|
3418
|
+
[ServiceType.GLUE]: "Analytics/Glue.svg",
|
|
3419
|
+
[ServiceType.REDSHIFT]: "Analytics/Redshift.svg",
|
|
3420
|
+
[ServiceType.QUICKSIGHT]: "Analytics/QuickSight.svg",
|
|
3421
|
+
[ServiceType.OPENSEARCH]: "Analytics/OpenSearch-Service.svg",
|
|
3422
|
+
[ServiceType.MSK]: "Analytics/Managed-Streaming-for-Apache-Kafka.svg",
|
|
3423
|
+
[ServiceType.IAM]: "Security-Identity-Compliance/Identity-and-Access-Management.svg",
|
|
3424
|
+
[ServiceType.COGNITO]: "Security-Identity-Compliance/Cognito.svg",
|
|
3425
|
+
[ServiceType.SECRETS_MANAGER]: "Security-Identity-Compliance/Secrets-Manager.svg",
|
|
3426
|
+
[ServiceType.KMS]: "Security-Identity-Compliance/Key-Management-Service.svg",
|
|
3427
|
+
[ServiceType.WAF]: "Security-Identity-Compliance/WAF.svg",
|
|
3428
|
+
[ServiceType.SHIELD]: "Security-Identity-Compliance/Shield.svg",
|
|
3429
|
+
[ServiceType.GUARDDUTY]: "Security-Identity-Compliance/GuardDuty.svg",
|
|
3430
|
+
[ServiceType.INSPECTOR]: "Security-Identity-Compliance/Inspector.svg",
|
|
3431
|
+
[ServiceType.MACIE]: "Security-Identity-Compliance/Macie.svg",
|
|
3432
|
+
[ServiceType.SECURITY_HUB]: "Security-Identity-Compliance/Security-Hub.svg",
|
|
3433
|
+
[ServiceType.CERTIFICATE_MANAGER]: "Security-Identity-Compliance/Certificate-Manager.svg",
|
|
3434
|
+
[ServiceType.FIREWALL_MANAGER]: "Security-Identity-Compliance/Firewall-Manager.svg",
|
|
3435
|
+
[ServiceType.NETWORK_FIREWALL]: "Security-Identity-Compliance/Network-Firewall.svg",
|
|
3436
|
+
[ServiceType.CLOUDWATCH]: "Management-Governance/CloudWatch.svg",
|
|
3437
|
+
[ServiceType.CLOUDTRAIL]: "Management-Governance/CloudTrail.svg",
|
|
3438
|
+
[ServiceType.CONFIG]: "Management-Governance/Config.svg",
|
|
3439
|
+
[ServiceType.SYSTEMS_MANAGER]: "Management-Governance/Systems-Manager.svg",
|
|
3440
|
+
[ServiceType.CLOUDFORMATION]: "Management-Governance/CloudFormation.svg",
|
|
3441
|
+
[ServiceType.ORGANIZATIONS]: "Management-Governance/Organizations.svg",
|
|
3442
|
+
[ServiceType.CONTROL_TOWER]: "Management-Governance/Control-Tower.svg",
|
|
3443
|
+
[ServiceType.TRUSTED_ADVISOR]: "Management-Governance/Trusted-Advisor.svg",
|
|
3444
|
+
[ServiceType.CODECOMMIT]: "Developer-Tools/CodeCommit.svg",
|
|
3445
|
+
[ServiceType.CODEBUILD]: "Developer-Tools/CodeBuild.svg",
|
|
3446
|
+
[ServiceType.CODEDEPLOY]: "Developer-Tools/CodeDeploy.svg",
|
|
3447
|
+
[ServiceType.CODEPIPELINE]: "Developer-Tools/CodePipeline.svg",
|
|
3448
|
+
[ServiceType.CODEARTIFACT]: "Developer-Tools/CodeArtifact.svg",
|
|
3449
|
+
[ServiceType.CLOUD9]: "Developer-Tools/Cloud9.svg",
|
|
3450
|
+
[ServiceType.X_RAY]: "Developer-Tools/X-Ray.svg",
|
|
3451
|
+
[ServiceType.SAGEMAKER]: "Machine-Learning/SageMaker.svg",
|
|
3452
|
+
[ServiceType.COMPREHEND]: "Machine-Learning/Comprehend.svg",
|
|
3453
|
+
[ServiceType.REKOGNITION]: "Machine-Learning/Rekognition.svg",
|
|
3454
|
+
[ServiceType.TEXTRACT]: "Machine-Learning/Textract.svg",
|
|
3455
|
+
[ServiceType.TRANSLATE]: "Machine-Learning/Translate.svg",
|
|
3456
|
+
[ServiceType.TRANSCRIBE]: "Machine-Learning/Transcribe.svg",
|
|
3457
|
+
[ServiceType.POLLY]: "Machine-Learning/Polly.svg",
|
|
3458
|
+
[ServiceType.LEX]: "Machine-Learning/Lex.svg",
|
|
3459
|
+
[ServiceType.DMS]: "Migration-Transfer/Database-Migration-Service.svg",
|
|
3460
|
+
[ServiceType.TRANSFER_FAMILY]: "Migration-Transfer/Transfer-Family.svg",
|
|
3461
|
+
[ServiceType.MIGRATION_HUB]: "Migration-Transfer/Migration-Hub.svg",
|
|
3462
|
+
[ServiceType.DATASYNC]: "Migration-Transfer/DataSync.svg",
|
|
3463
|
+
[ServiceType.SNOWBALL]: "Migration-Transfer/Snowball.svg",
|
|
3464
|
+
[ServiceType.AMPLIFY]: "Front-End-Web-Mobile/Amplify.svg"
|
|
3465
|
+
};
|
|
3466
|
+
function getAwsIconPath(serviceType) {
|
|
3467
|
+
if (!serviceType) {
|
|
3468
|
+
return null;
|
|
3469
|
+
}
|
|
3470
|
+
const file = SERVICE_TYPE_TO_ICON[serviceType];
|
|
3471
|
+
return file ? `/icons/aws/${file}` : null;
|
|
3472
|
+
}
|
|
3473
|
+
function ExternalNode($$renderer, $$props) {
|
|
3474
|
+
$$renderer.component(($$renderer2) => {
|
|
3475
|
+
let { data } = $$props;
|
|
3476
|
+
let initials = data.label ? data.label.split(" ").map((part) => part[0]).join("").slice(0, 3).toUpperCase() : "Svc";
|
|
3477
|
+
let iconPath = getAwsIconPath(data.serviceType);
|
|
3478
|
+
Handle($$renderer2, { type: "target", position: Position.Left, id: "input" });
|
|
3479
|
+
$$renderer2.push(`<!----> `);
|
|
3480
|
+
Handle($$renderer2, { type: "source", position: Position.Right, id: "output" });
|
|
3481
|
+
$$renderer2.push(`<!----> <div class="flex items-center gap-3" role="navigation">`);
|
|
3482
|
+
if (iconPath) {
|
|
3483
|
+
$$renderer2.push("<!--[-->");
|
|
3484
|
+
$$renderer2.push(`<img${attr("src", iconPath)}${attr("alt", data.label)} class="h-10 w-10 rounded-lg bg-white/5 object-contain" loading="lazy"/>`);
|
|
3485
|
+
} else {
|
|
3486
|
+
$$renderer2.push("<!--[!-->");
|
|
3487
|
+
$$renderer2.push(`<div class="flex h-10 w-10 items-center justify-center rounded-lg bg-gray-800 text-xs font-semibold">${escape_html(initials)}</div>`);
|
|
3488
|
+
}
|
|
3489
|
+
$$renderer2.push(`<!--]--> <div class="flex-1"><div class="text-sm font-semibold">${escape_html(data.label)}</div></div></div>`);
|
|
3490
|
+
});
|
|
3491
|
+
}
|
|
3492
|
+
function MainGroupNode($$renderer, $$props) {
|
|
3493
|
+
$$renderer.component(($$renderer2) => {
|
|
3494
|
+
let { data, selected = false } = $$props;
|
|
3495
|
+
Handle($$renderer2, { type: "target", position: Position.Left, id: "input" });
|
|
3496
|
+
$$renderer2.push(`<!----> `);
|
|
3497
|
+
Handle($$renderer2, { type: "source", position: Position.Right, id: "output" });
|
|
3498
|
+
$$renderer2.push(`<!----> <div class="relative" aria-label="Group node" aria-roledescription="Group node">${escape_html(data.label)}</div>`);
|
|
3499
|
+
});
|
|
3500
|
+
}
|
|
3501
|
+
function ServiceNode($$renderer, $$props) {
|
|
3502
|
+
$$renderer.component(($$renderer2) => {
|
|
3503
|
+
let { data } = $$props;
|
|
3504
|
+
let initials = data.label ? data.label.split(" ").map((part) => part[0]).join("").slice(0, 3).toUpperCase() : "Svc";
|
|
3505
|
+
let iconPath = getAwsIconPath(data.serviceType);
|
|
3506
|
+
Handle($$renderer2, { type: "target", position: Position.Left, id: "input" });
|
|
3507
|
+
$$renderer2.push(`<!----> `);
|
|
3508
|
+
Handle($$renderer2, { type: "source", position: Position.Right, id: "output" });
|
|
3509
|
+
$$renderer2.push(`<!----> <div class="flex items-center gap-3">`);
|
|
3510
|
+
if (iconPath) {
|
|
3511
|
+
$$renderer2.push("<!--[-->");
|
|
3512
|
+
$$renderer2.push(`<img${attr("src", iconPath)}${attr("alt", data.label)} class="h-10 w-10 rounded-lg bg-white/5 object-contain" loading="lazy"/>`);
|
|
3513
|
+
} else {
|
|
3514
|
+
$$renderer2.push("<!--[!-->");
|
|
3515
|
+
$$renderer2.push(`<div class="flex h-10 w-10 items-center justify-center rounded-lg bg-gray-800 text-xs font-semibold">${escape_html(initials)}</div>`);
|
|
3516
|
+
}
|
|
3517
|
+
$$renderer2.push(`<!--]--> <div class="flex-1"><div class="text-sm font-semibold">${escape_html(data.label)}</div></div></div>`);
|
|
3518
|
+
});
|
|
3519
|
+
}
|
|
3520
|
+
function ServiceGroupNode($$renderer, $$props) {
|
|
3521
|
+
$$renderer.component(($$renderer2) => {
|
|
3522
|
+
let { data, width, height, selected = false } = $$props;
|
|
3523
|
+
$$renderer2.push(`<div class="custom-group-node"${attr_style("", {
|
|
3524
|
+
width: `${stringify(width)}px`,
|
|
3525
|
+
height: `${stringify(height)}px`
|
|
3526
|
+
})}><div class="big-title">${escape_html(data.label)}</div></div>`);
|
|
3527
|
+
});
|
|
3528
|
+
}
|
|
3529
|
+
function SnakeEdge($$renderer, $$props) {
|
|
3530
|
+
$$renderer.component(($$renderer2) => {
|
|
3531
|
+
var $$store_subs;
|
|
3532
|
+
let {
|
|
3533
|
+
id,
|
|
3534
|
+
data,
|
|
3535
|
+
source,
|
|
3536
|
+
target,
|
|
3537
|
+
sourceHandleId,
|
|
3538
|
+
targetHandleId,
|
|
3539
|
+
sourceX,
|
|
3540
|
+
sourceY,
|
|
3541
|
+
sourcePosition,
|
|
3542
|
+
targetX,
|
|
3543
|
+
targetY,
|
|
3544
|
+
targetPosition,
|
|
3545
|
+
label,
|
|
3546
|
+
style,
|
|
3547
|
+
selected
|
|
3548
|
+
} = $$props;
|
|
3549
|
+
const nodes = useNodes();
|
|
3550
|
+
const edges = useEdges();
|
|
3551
|
+
let isConnectedNodeSelected = (() => {
|
|
3552
|
+
const sourceNode = nodes.current.find((n) => n.id === source);
|
|
3553
|
+
const targetNode = nodes.current.find((n) => n.id === target);
|
|
3554
|
+
return sourceNode?.selected || targetNode?.selected;
|
|
3555
|
+
})();
|
|
3556
|
+
let isEffectivelySelected = selected || isConnectedNodeSelected;
|
|
3557
|
+
calculateEdgeOffset(id, nodes.current, edges.current, true);
|
|
3558
|
+
calculateEdgeOffset(id, nodes.current, edges.current, false);
|
|
3559
|
+
onDestroy(() => {
|
|
3560
|
+
routingStore.unregisterEdge(id);
|
|
3561
|
+
});
|
|
3562
|
+
let pts = store_get($$store_subs ??= {}, "$routingStore", routingStore)[id] || [];
|
|
3563
|
+
let edgePathData = (() => {
|
|
3564
|
+
if (!pts || pts.length === 0) {
|
|
3565
|
+
return {
|
|
3566
|
+
path: `M ${sourceX} ${sourceY} L ${targetX} ${targetY}`,
|
|
3567
|
+
labelX: (sourceX + targetX) / 2,
|
|
3568
|
+
labelY: (sourceY + targetY) / 2
|
|
3569
|
+
};
|
|
3570
|
+
}
|
|
3571
|
+
let d = `M ${pts[0].x} ${pts[0].y}`;
|
|
3572
|
+
const radius = 8;
|
|
3573
|
+
for (let i = 0; i < pts.length - 1; i++) {
|
|
3574
|
+
const p = pts[i];
|
|
3575
|
+
const next = pts[i + 1];
|
|
3576
|
+
const prev = i > 0 ? pts[i - 1] : null;
|
|
3577
|
+
if (prev && next) {
|
|
3578
|
+
const dPrev = { x: p.x - prev.x, y: p.y - prev.y };
|
|
3579
|
+
const dNext = { x: next.x - p.x, y: next.y - p.y };
|
|
3580
|
+
const lenPrev = Math.hypot(dPrev.x, dPrev.y);
|
|
3581
|
+
const lenNext = Math.hypot(dNext.x, dNext.y);
|
|
3582
|
+
const actualRadius = Math.min(radius, lenPrev / 2, lenNext / 2);
|
|
3583
|
+
const startPoint = {
|
|
3584
|
+
x: p.x - dPrev.x / lenPrev * actualRadius,
|
|
3585
|
+
y: p.y - dPrev.y / lenPrev * actualRadius
|
|
3586
|
+
};
|
|
3587
|
+
const endPoint = {
|
|
3588
|
+
x: p.x + dNext.x / lenNext * actualRadius,
|
|
3589
|
+
y: p.y + dNext.y / lenNext * actualRadius
|
|
3590
|
+
};
|
|
3591
|
+
d += ` L ${startPoint.x} ${startPoint.y} Q ${p.x} ${p.y} ${endPoint.x} ${endPoint.y}`;
|
|
3592
|
+
} else if (i > 0) {
|
|
3593
|
+
d += ` L ${p.x} ${p.y}`;
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3596
|
+
d += ` L ${pts[pts.length - 1].x} ${pts[pts.length - 1].y}`;
|
|
3597
|
+
let longestLen = -1;
|
|
3598
|
+
let labelPos2 = { x: (sourceX + targetX) / 2, y: (sourceY + targetY) / 2 };
|
|
3599
|
+
for (let i = 0; i < pts.length - 1; i++) {
|
|
3600
|
+
const dx = pts[i + 1].x - pts[i].x;
|
|
3601
|
+
const dy = pts[i + 1].y - pts[i].y;
|
|
3602
|
+
const len = Math.hypot(dx, dy);
|
|
3603
|
+
if (len > longestLen) {
|
|
3604
|
+
longestLen = len;
|
|
3605
|
+
labelPos2 = { x: pts[i].x + dx / 2, y: pts[i].y + dy / 2 };
|
|
3606
|
+
}
|
|
3607
|
+
}
|
|
3608
|
+
return { path: d, labelX: labelPos2.x, labelY: labelPos2.y };
|
|
3609
|
+
})();
|
|
3610
|
+
let path = edgePathData.path;
|
|
3611
|
+
let labelPos = { x: edgePathData.labelX, y: edgePathData.labelY };
|
|
3612
|
+
let incomingOrOutgoingOrInternal = (() => {
|
|
3613
|
+
const urlGroupId = page.params.groupId;
|
|
3614
|
+
if (!urlGroupId) {
|
|
3615
|
+
return null;
|
|
3616
|
+
}
|
|
3617
|
+
const sourceGroup = source.split("::")[1];
|
|
3618
|
+
const targetGroup = target.split("::")[1];
|
|
3619
|
+
if (sourceGroup === targetGroup) {
|
|
3620
|
+
return "internal";
|
|
3621
|
+
} else if (sourceHandleId === "output" && sourceGroup === urlGroupId) {
|
|
3622
|
+
return "outgoing";
|
|
3623
|
+
} else if (targetHandleId === "input" && targetGroup === urlGroupId) {
|
|
3624
|
+
return "incoming";
|
|
3625
|
+
} else {
|
|
3626
|
+
return "internal";
|
|
3627
|
+
}
|
|
3628
|
+
})();
|
|
3629
|
+
BaseEdge($$renderer2, {
|
|
3630
|
+
class: `${isEffectivelySelected ? "snake-edge-path selected" : "snake-edge-path"} ${incomingOrOutgoingOrInternal ?? ""}`,
|
|
3631
|
+
id,
|
|
3632
|
+
path,
|
|
3633
|
+
style
|
|
3634
|
+
});
|
|
3635
|
+
$$renderer2.push(`<!----> `);
|
|
3636
|
+
if (label) {
|
|
3637
|
+
$$renderer2.push("<!--[-->");
|
|
3638
|
+
EdgeLabel($$renderer2, {
|
|
3639
|
+
children: ($$renderer3) => {
|
|
3640
|
+
$$renderer3.push(`<div${attr_class("edge-label", void 0, { "selected": isEffectivelySelected })}${attr_style("", {
|
|
3641
|
+
transform: `translate(-50%, -50%) translate(${stringify(labelPos.x)}px, ${stringify(labelPos.y)}px)`
|
|
3642
|
+
})}>${escape_html(label)}</div>`);
|
|
3643
|
+
},
|
|
3644
|
+
$$slots: { default: true }
|
|
3645
|
+
});
|
|
3646
|
+
} else {
|
|
3647
|
+
$$renderer2.push("<!--[!-->");
|
|
3648
|
+
}
|
|
3649
|
+
$$renderer2.push(`<!--]-->`);
|
|
3650
|
+
if ($$store_subs) unsubscribe_stores($$store_subs);
|
|
3651
|
+
});
|
|
3652
|
+
}
|
|
3653
|
+
function FlowCanvas($$renderer, $$props) {
|
|
3654
|
+
$$renderer.component(($$renderer2) => {
|
|
3655
|
+
var $$store_subs;
|
|
3656
|
+
let { graph = null } = $$props;
|
|
3657
|
+
const nodeTypes = {
|
|
3658
|
+
mainGroup: MainGroupNode,
|
|
3659
|
+
service: ServiceNode,
|
|
3660
|
+
external: ExternalNode,
|
|
3661
|
+
serviceGroup: ServiceGroupNode
|
|
3662
|
+
};
|
|
3663
|
+
const edgeTypes = { snake: SnakeEdge };
|
|
3664
|
+
let nodes = [];
|
|
3665
|
+
let edges = [];
|
|
3666
|
+
let emptyStateLabel = "No diagram available.";
|
|
3667
|
+
let hasGraphData = !!graph && graph.serviceNodes.length > 0;
|
|
3668
|
+
function goHome() {
|
|
3669
|
+
goto();
|
|
3670
|
+
}
|
|
3671
|
+
let $$settled = true;
|
|
3672
|
+
let $$inner_renderer;
|
|
3673
|
+
function $$render_inner($$renderer3) {
|
|
3674
|
+
$$renderer3.push(`<div data-testid="flow-canvas" class="flex h-full flex-auto flex-col overflow-hidden rounded-2xl border border-white/5 bg-black/20 shadow-xl">`);
|
|
3675
|
+
if (hasGraphData) {
|
|
3676
|
+
$$renderer3.push("<!--[-->");
|
|
3677
|
+
SvelteFlow($$renderer3, {
|
|
3678
|
+
nodeTypes,
|
|
3679
|
+
edgeTypes,
|
|
3680
|
+
nodesDraggable: true,
|
|
3681
|
+
nodesConnectable: false,
|
|
3682
|
+
panOnDrag: true,
|
|
3683
|
+
zoomOnScroll: true,
|
|
3684
|
+
selectionOnDrag: false,
|
|
3685
|
+
colorMode: theme.isDark ? "dark" : "light",
|
|
3686
|
+
fitView: true,
|
|
3687
|
+
fitViewOptions: { padding: 0.2 },
|
|
3688
|
+
get nodes() {
|
|
3689
|
+
return nodes;
|
|
3690
|
+
},
|
|
3691
|
+
set nodes($$value) {
|
|
3692
|
+
nodes = $$value;
|
|
3693
|
+
$$settled = false;
|
|
3694
|
+
},
|
|
3695
|
+
get edges() {
|
|
3696
|
+
return edges;
|
|
3697
|
+
},
|
|
3698
|
+
set edges($$value) {
|
|
3699
|
+
edges = $$value;
|
|
3700
|
+
$$settled = false;
|
|
3701
|
+
},
|
|
3702
|
+
children: ($$renderer4) => {
|
|
3703
|
+
Background($$renderer4, {
|
|
3704
|
+
bgColor: theme.isDark ? "#1f2937" : "#e5e7eb",
|
|
3705
|
+
variant: BackgroundVariant.Dots,
|
|
3706
|
+
gap: 24
|
|
3707
|
+
});
|
|
3708
|
+
$$renderer4.push(`<!----> `);
|
|
3709
|
+
Minimap($$renderer4, {
|
|
3710
|
+
nodeColor: (n) => {
|
|
3711
|
+
if (n.type === "group") return "#2563eb";
|
|
3712
|
+
if (n.type === "service") return "#16a34a";
|
|
3713
|
+
if (n.type === "external") return "#d97706";
|
|
3714
|
+
return "#9ca3af";
|
|
3715
|
+
},
|
|
3716
|
+
position: "bottom-left"
|
|
3717
|
+
});
|
|
3718
|
+
$$renderer4.push(`<!----> `);
|
|
3719
|
+
Controls($$renderer4, {
|
|
3720
|
+
position: "top-left",
|
|
3721
|
+
children: ($$renderer5) => {
|
|
3722
|
+
ControlButton($$renderer5, {
|
|
3723
|
+
onclick: goHome,
|
|
3724
|
+
title: "Go Home",
|
|
3725
|
+
"aria-label": "Go to home page",
|
|
3726
|
+
children: ($$renderer6) => {
|
|
3727
|
+
Icon($$renderer6, { icon: "mdi:home" });
|
|
3728
|
+
},
|
|
3729
|
+
$$slots: { default: true }
|
|
3730
|
+
});
|
|
3731
|
+
},
|
|
3732
|
+
$$slots: { default: true }
|
|
3733
|
+
});
|
|
3734
|
+
$$renderer4.push(`<!----> `);
|
|
3735
|
+
Panel($$renderer4, {
|
|
3736
|
+
position: "bottom-right",
|
|
3737
|
+
children: ($$renderer5) => {
|
|
3738
|
+
if (store_get($$store_subs ??= {}, "$showLegend", showLegend) && false) ;
|
|
3739
|
+
else {
|
|
3740
|
+
$$renderer5.push("<!--[!-->");
|
|
3741
|
+
}
|
|
3742
|
+
$$renderer5.push(`<!--]-->`);
|
|
3743
|
+
},
|
|
3744
|
+
$$slots: { default: true }
|
|
3745
|
+
});
|
|
3746
|
+
$$renderer4.push(`<!---->`);
|
|
3747
|
+
},
|
|
3748
|
+
$$slots: { default: true }
|
|
3749
|
+
});
|
|
3750
|
+
} else {
|
|
3751
|
+
$$renderer3.push("<!--[!-->");
|
|
3752
|
+
$$renderer3.push(`<div class="flex h-full flex-col items-center justify-center gap-2 text-sm text-gray-400 dark:text-gray-300"><span class="text-3xl" aria-hidden="true">🌀</span> <span>${escape_html(emptyStateLabel)}</span></div>`);
|
|
3753
|
+
}
|
|
3754
|
+
$$renderer3.push(`<!--]--> `);
|
|
3755
|
+
{
|
|
3756
|
+
$$renderer3.push("<!--[-->");
|
|
3757
|
+
$$renderer3.push(`<div data-testid="flow-loading-overlay" class="pointer-events-none absolute inset-0 flex items-center justify-center bg-white/80 text-sm text-gray-700 dark:bg-black/70 dark:text-gray-200 backdrop-blur">Rendering diagram…</div>`);
|
|
3758
|
+
}
|
|
3759
|
+
$$renderer3.push(`<!--]--> `);
|
|
3760
|
+
{
|
|
3761
|
+
$$renderer3.push("<!--[!-->");
|
|
3762
|
+
}
|
|
3763
|
+
$$renderer3.push(`<!--]--></div>`);
|
|
3764
|
+
}
|
|
3765
|
+
do {
|
|
3766
|
+
$$settled = true;
|
|
3767
|
+
$$inner_renderer = $$renderer2.copy();
|
|
3768
|
+
$$render_inner($$inner_renderer);
|
|
3769
|
+
} while (!$$settled);
|
|
3770
|
+
$$renderer2.subsume($$inner_renderer);
|
|
3771
|
+
if ($$store_subs) unsubscribe_stores($$store_subs);
|
|
3772
|
+
});
|
|
3773
|
+
}
|
|
3774
|
+
function GenericSidebarCard($$renderer, $$props) {
|
|
3775
|
+
const {
|
|
3776
|
+
title,
|
|
3777
|
+
subtitle,
|
|
3778
|
+
description,
|
|
3779
|
+
children,
|
|
3780
|
+
iconPath,
|
|
3781
|
+
iconAlt,
|
|
3782
|
+
classes
|
|
3783
|
+
} = $$props;
|
|
3784
|
+
$$renderer.push(`<div${attr_class(`sidebar-card ${stringify(classes)}`)}><div class="flex items-start justify-between"><div class="flex flex-col"><div class="sidebar-card-title">${escape_html(title)}</div> `);
|
|
3785
|
+
if (subtitle) {
|
|
3786
|
+
$$renderer.push("<!--[-->");
|
|
3787
|
+
$$renderer.push(`<h3 class="sidebar-card-subtitle">${escape_html(subtitle)}</h3>`);
|
|
3788
|
+
} else {
|
|
3789
|
+
$$renderer.push("<!--[!-->");
|
|
3790
|
+
}
|
|
3791
|
+
$$renderer.push(`<!--]--></div> `);
|
|
3792
|
+
if (iconPath) {
|
|
3793
|
+
$$renderer.push("<!--[-->");
|
|
3794
|
+
$$renderer.push(`<img${attr("src", iconPath)}${attr("alt", iconAlt)} class="h-10 w-10 rounded-lg bg-white/5 object-contain"/>`);
|
|
3795
|
+
} else if (iconAlt) {
|
|
3796
|
+
$$renderer.push("<!--[1-->");
|
|
3797
|
+
$$renderer.push(`<div class="flex h-10 w-10 items-center justify-center rounded-lg bg-gray-800 text-xs font-semibold text-gray-200">${escape_html(iconAlt)}</div>`);
|
|
3798
|
+
} else {
|
|
3799
|
+
$$renderer.push("<!--[!-->");
|
|
3800
|
+
}
|
|
3801
|
+
$$renderer.push(`<!--]--></div> `);
|
|
3802
|
+
if (description) {
|
|
3803
|
+
$$renderer.push("<!--[-->");
|
|
3804
|
+
$$renderer.push(`<p class="sidebar-card-contents">${escape_html(description)}</p>`);
|
|
3805
|
+
} else {
|
|
3806
|
+
$$renderer.push("<!--[!-->");
|
|
3807
|
+
}
|
|
3808
|
+
$$renderer.push(`<!--]--> `);
|
|
3809
|
+
if (children) {
|
|
3810
|
+
$$renderer.push("<!--[-->");
|
|
3811
|
+
children($$renderer);
|
|
3812
|
+
$$renderer.push(`<!---->`);
|
|
3813
|
+
} else {
|
|
3814
|
+
$$renderer.push("<!--[!-->");
|
|
3815
|
+
}
|
|
3816
|
+
$$renderer.push(`<!--]--></div>`);
|
|
3817
|
+
}
|
|
3818
|
+
function GroupDetailSidebar($$renderer, $$props) {
|
|
3819
|
+
$$renderer.component(($$renderer2) => {
|
|
3820
|
+
const { groupMap, groups } = $$props;
|
|
3821
|
+
const nodes = useNodes();
|
|
3822
|
+
let selectedNodeId = nodes.current.find((n) => n.selected)?.id ?? null;
|
|
3823
|
+
let groupId = selectedNodeId ? groupMap[selectedNodeId] ?? null : null;
|
|
3824
|
+
let groupInfo = groupId ? groups[groupId] ?? null : null;
|
|
3825
|
+
$$renderer2.push(`<aside data-testid="group-sidebar" class="flex h-full flex-col basis-1/6 border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-slate-800 text-gray-900 dark:text-gray-100 overflow-hidden rounded-2xl border shadow-xl p-3">`);
|
|
3826
|
+
if (!groupInfo) {
|
|
3827
|
+
$$renderer2.push("<!--[-->");
|
|
3828
|
+
GenericSidebarCard($$renderer2, {
|
|
3829
|
+
title: "No Group Selected",
|
|
3830
|
+
description: "Select a group to view details."
|
|
3831
|
+
});
|
|
3832
|
+
} else {
|
|
3833
|
+
$$renderer2.push("<!--[!-->");
|
|
3834
|
+
GenericSidebarCard($$renderer2, {
|
|
3835
|
+
title: "Group",
|
|
3836
|
+
subtitle: groupInfo.name,
|
|
3837
|
+
description: groupInfo.description
|
|
3838
|
+
});
|
|
3839
|
+
$$renderer2.push(`<!----> `);
|
|
3840
|
+
if (groupInfo.teamId) {
|
|
3841
|
+
$$renderer2.push("<!--[-->");
|
|
3842
|
+
$$renderer2.push(`<div class="mt-4">`);
|
|
3843
|
+
TeamContactCard($$renderer2, { teamId: groupInfo.teamId });
|
|
3844
|
+
$$renderer2.push(`<!----></div>`);
|
|
3845
|
+
} else {
|
|
3846
|
+
$$renderer2.push("<!--[!-->");
|
|
3847
|
+
}
|
|
3848
|
+
$$renderer2.push(`<!--]-->`);
|
|
3849
|
+
}
|
|
3850
|
+
$$renderer2.push(`<!--]--></aside>`);
|
|
3851
|
+
});
|
|
3852
|
+
}
|
|
3853
|
+
function LoadingSpinner($$renderer, $$props) {
|
|
3854
|
+
let { message = "Loading..." } = $$props;
|
|
3855
|
+
$$renderer.push(`<div class="flex h-full w-full items-center justify-center p-8 text-center"><div><div class="mx-auto h-16 w-16 animate-spin rounded-full border-4 border-gray-200 border-t-blue-500 dark:border-gray-700 dark:border-t-blue-400"></div> <p class="mt-4 text-base text-gray-500 dark:text-gray-400">${escape_html(message)}</p></div></div>`);
|
|
3856
|
+
}
|
|
3857
|
+
function TeamContactCard($$renderer, $$props) {
|
|
3858
|
+
$$renderer.component(($$renderer2) => {
|
|
3859
|
+
{
|
|
3860
|
+
$$renderer2.push("<!--[!-->");
|
|
3861
|
+
}
|
|
3862
|
+
$$renderer2.push(`<!--]--> `);
|
|
3863
|
+
{
|
|
3864
|
+
$$renderer2.push("<!--[!-->");
|
|
3865
|
+
}
|
|
3866
|
+
$$renderer2.push(`<!--]-->`);
|
|
3867
|
+
});
|
|
3868
|
+
}
|
|
3869
|
+
const sanitizeRegEx = /[^a-zA-Z0-9_]/g;
|
|
3870
|
+
const sanitizeNodeId = (value, prefix = "node") => {
|
|
3871
|
+
const safe = (value || prefix).replace(sanitizeRegEx, "_");
|
|
3872
|
+
return `${prefix}::${safe}`;
|
|
3873
|
+
};
|
|
3874
|
+
const formatConnectionLabel = (connectionCount) => connectionCount === 1 ? "1 connection" : `${connectionCount} connections`;
|
|
3875
|
+
const createGraphSignature = (namespace, payload) => `${namespace}:${JSON.stringify(payload)}`;
|
|
3876
|
+
function buildGroupOverviewGraph(groups, connections = []) {
|
|
3877
|
+
if (!groups || Object.keys(groups).length === 0) {
|
|
3878
|
+
return { graph: null, nodeToGroupMap: {} };
|
|
3879
|
+
}
|
|
3880
|
+
const nodes = Object.entries(groups).map(([groupId, groupInfo]) => ({
|
|
3881
|
+
id: sanitizeNodeId(groupId, "mainGroup"),
|
|
3882
|
+
type: "mainGroup",
|
|
3883
|
+
data: {
|
|
3884
|
+
label: groupInfo.name,
|
|
3885
|
+
subLabel: groupInfo.description ?? groupId,
|
|
3886
|
+
groupId,
|
|
3887
|
+
kind: "mainGroup"
|
|
3888
|
+
},
|
|
3889
|
+
width: 120,
|
|
3890
|
+
height: 80,
|
|
3891
|
+
position: { x: 0, y: 0 }
|
|
3892
|
+
}));
|
|
3893
|
+
const edges = connections.map((connection, index) => {
|
|
3894
|
+
const sourceId = sanitizeNodeId(connection.sourceGroup, "mainGroup");
|
|
3895
|
+
const targetId = sanitizeNodeId(connection.targetGroup, "mainGroup");
|
|
3896
|
+
return {
|
|
3897
|
+
id: `edge_${sourceId}_${targetId}_${index}`,
|
|
3898
|
+
source: sourceId,
|
|
3899
|
+
sourceHandle: "output",
|
|
3900
|
+
target: targetId,
|
|
3901
|
+
targetHandle: "input",
|
|
3902
|
+
type: "snake",
|
|
3903
|
+
label: formatConnectionLabel(connection.connectionCount),
|
|
3904
|
+
data: {
|
|
3905
|
+
label: formatConnectionLabel(connection.connectionCount)
|
|
3906
|
+
}
|
|
3907
|
+
};
|
|
3908
|
+
});
|
|
3909
|
+
const signature = createGraphSignature("group-overview", {
|
|
3910
|
+
groups: nodes.map((node) => node.data.groupId).sort(),
|
|
3911
|
+
connections: connections.map((connection) => ({
|
|
3912
|
+
sourceGroup: connection.sourceGroup,
|
|
3913
|
+
targetGroup: connection.targetGroup,
|
|
3914
|
+
connectionCount: connection.connectionCount
|
|
3915
|
+
}))
|
|
3916
|
+
});
|
|
3917
|
+
const graph = { groupNodes: [], serviceNodes: nodes, edges, signature };
|
|
3918
|
+
const nodeToGroupMap = nodes.reduce((lookup, node) => {
|
|
3919
|
+
if (node.data.groupId) {
|
|
3920
|
+
lookup[node.id] = node.data.groupId;
|
|
3921
|
+
}
|
|
3922
|
+
return lookup;
|
|
3923
|
+
}, {});
|
|
3924
|
+
console.debug(graph);
|
|
3925
|
+
return { graph, nodeToGroupMap };
|
|
3926
|
+
}
|
|
3927
|
+
function _page($$renderer, $$props) {
|
|
3928
|
+
$$renderer.component(($$renderer2) => {
|
|
3929
|
+
let { data } = $$props;
|
|
3930
|
+
const groups = data.groups;
|
|
3931
|
+
const groupConnections = data.groupConnections;
|
|
3932
|
+
const errorMessage = data.errorMessage;
|
|
3933
|
+
let { graphInput, nodeGroupMap } = (() => {
|
|
3934
|
+
if (groups && groupConnections) {
|
|
3935
|
+
const { graph, nodeToGroupMap } = buildGroupOverviewGraph(groups, groupConnections);
|
|
3936
|
+
console.debug("[overview.svelte] built flow graph", {
|
|
3937
|
+
groups: Object.keys(groups).length,
|
|
3938
|
+
connections: groupConnections.length,
|
|
3939
|
+
nodeCount: Object.keys(nodeToGroupMap).length,
|
|
3940
|
+
hasGraph: !!graph
|
|
3941
|
+
});
|
|
3942
|
+
return { graphInput: graph, nodeGroupMap: nodeToGroupMap };
|
|
3943
|
+
}
|
|
3944
|
+
return { graphInput: null, nodeGroupMap: {} };
|
|
3945
|
+
})();
|
|
3946
|
+
let isLoading = !groups || !groupConnections;
|
|
3947
|
+
async function refreshData() {
|
|
3948
|
+
await invalidateAll();
|
|
3949
|
+
}
|
|
3950
|
+
head("1uha8ag", $$renderer2, ($$renderer3) => {
|
|
3951
|
+
$$renderer3.title(($$renderer4) => {
|
|
3952
|
+
$$renderer4.push(`<title>Resource Mapper – Overview</title>`);
|
|
3953
|
+
});
|
|
3954
|
+
});
|
|
3955
|
+
if (errorMessage) {
|
|
3956
|
+
$$renderer2.push("<!--[-->");
|
|
3957
|
+
ErrorDisplay($$renderer2, {
|
|
3958
|
+
title: "Error loading groups",
|
|
3959
|
+
message: "Failed to load the group overview diagram.",
|
|
3960
|
+
checkList: [
|
|
3961
|
+
"Ensure YAML data exists under /data/services",
|
|
3962
|
+
"Check the browser console for more details"
|
|
3963
|
+
],
|
|
3964
|
+
technicalDetails: errorMessage,
|
|
3965
|
+
onRetry: refreshData
|
|
3966
|
+
});
|
|
3967
|
+
} else if (isLoading) {
|
|
3968
|
+
$$renderer2.push("<!--[1-->");
|
|
3969
|
+
LoadingSpinner($$renderer2, { message: "Loading group overview..." });
|
|
3970
|
+
} else {
|
|
3971
|
+
$$renderer2.push("<!--[!-->");
|
|
3972
|
+
$$renderer2.push(`<div class="flex h-full w-full gap-1 lg:flex-row">`);
|
|
3973
|
+
SvelteFlowProvider($$renderer2, {
|
|
3974
|
+
children: ($$renderer3) => {
|
|
3975
|
+
FlowCanvas($$renderer3, { graph: graphInput });
|
|
3976
|
+
$$renderer3.push(`<!----> `);
|
|
3977
|
+
GroupDetailSidebar($$renderer3, {
|
|
3978
|
+
groupMap: nodeGroupMap,
|
|
3979
|
+
groups: groups ?? {}
|
|
3980
|
+
});
|
|
3981
|
+
$$renderer3.push(`<!---->`);
|
|
3982
|
+
}
|
|
3983
|
+
});
|
|
3984
|
+
$$renderer2.push(`<!----></div>`);
|
|
3985
|
+
}
|
|
3986
|
+
$$renderer2.push(`<!--]-->`);
|
|
3987
|
+
});
|
|
3988
|
+
}
|
|
3989
|
+
export {
|
|
3990
|
+
_page as default
|
|
3991
|
+
};
|