@pyreon/flow 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5386,7 +5386,7 @@ var drawChart = (function (exports) {
5386
5386
  </script>
5387
5387
  <script>
5388
5388
  /*<!--*/
5389
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"home/runner/work/fundamentals/fundamentals/node_modules/.bun/@pyreon+core@0.6.0/node_modules/@pyreon/core/lib/jsx-runtime.js","uid":"afcd355c-1"},{"name":"src","children":[{"name":"components","children":[{"uid":"afcd355c-3","name":"background.tsx"},{"uid":"afcd355c-5","name":"controls.tsx"},{"uid":"afcd355c-11","name":"flow-component.tsx"},{"uid":"afcd355c-13","name":"handle.tsx"},{"uid":"afcd355c-15","name":"minimap.tsx"},{"uid":"afcd355c-17","name":"node-resizer.tsx"},{"uid":"afcd355c-19","name":"node-toolbar.tsx"},{"uid":"afcd355c-21","name":"panel.tsx"}]},{"uid":"afcd355c-7","name":"types.ts"},{"uid":"afcd355c-9","name":"edges.ts"},{"uid":"afcd355c-23","name":"layout.ts"},{"uid":"afcd355c-25","name":"flow.ts"},{"uid":"afcd355c-27","name":"styles.ts"},{"uid":"afcd355c-29","name":"index.ts"}]}]},{"name":"chunk-C8JhGJ3N.js","children":[{"name":"\u0000rolldown/runtime.js","uid":"afcd355c-31"}]},{"name":"elk.bundled-B9dPTHTZ.js","children":[{"name":"home/runner/work/fundamentals/fundamentals/node_modules/.bun/elkjs@0.9.3/node_modules/elkjs/lib/elk.bundled.js","uid":"afcd355c-33"}]}],"isRoot":true},"nodeParts":{"afcd355c-1":{"renderedLength":1776,"gzipLength":893,"brotliLength":0,"metaUid":"afcd355c-0"},"afcd355c-3":{"renderedLength":3012,"gzipLength":718,"brotliLength":0,"metaUid":"afcd355c-2"},"afcd355c-5":{"renderedLength":4163,"gzipLength":1237,"brotliLength":0,"metaUid":"afcd355c-4"},"afcd355c-7":{"renderedLength":229,"gzipLength":166,"brotliLength":0,"metaUid":"afcd355c-6"},"afcd355c-9":{"renderedLength":7630,"gzipLength":1900,"brotliLength":0,"metaUid":"afcd355c-8"},"afcd355c-11":{"renderedLength":19141,"gzipLength":4980,"brotliLength":0,"metaUid":"afcd355c-10"},"afcd355c-13":{"renderedLength":1279,"gzipLength":655,"brotliLength":0,"metaUid":"afcd355c-12"},"afcd355c-15":{"renderedLength":3420,"gzipLength":1311,"brotliLength":0,"metaUid":"afcd355c-14"},"afcd355c-17":{"renderedLength":3784,"gzipLength":1418,"brotliLength":0,"metaUid":"afcd355c-16"},"afcd355c-19":{"renderedLength":1591,"gzipLength":775,"brotliLength":0,"metaUid":"afcd355c-18"},"afcd355c-21":{"renderedLength":788,"gzipLength":441,"brotliLength":0,"metaUid":"afcd355c-20"},"afcd355c-23":{"renderedLength":2455,"gzipLength":1081,"brotliLength":0,"metaUid":"afcd355c-22"},"afcd355c-25":{"renderedLength":23646,"gzipLength":5648,"brotliLength":0,"metaUid":"afcd355c-24"},"afcd355c-27":{"renderedLength":3591,"gzipLength":872,"brotliLength":0,"metaUid":"afcd355c-26"},"afcd355c-29":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"afcd355c-28"},"afcd355c-31":{"renderedLength":1611,"gzipLength":789,"brotliLength":0,"metaUid":"afcd355c-30"},"afcd355c-33":{"renderedLength":2547651,"gzipLength":525812,"brotliLength":0,"metaUid":"afcd355c-32"}},"nodeMetas":{"afcd355c-0":{"id":"/home/runner/work/fundamentals/fundamentals/node_modules/.bun/@pyreon+core@0.6.0/node_modules/@pyreon/core/lib/jsx-runtime.js","moduleParts":{"index.js":"afcd355c-1"},"imported":[],"importedBy":[{"uid":"afcd355c-2"},{"uid":"afcd355c-4"},{"uid":"afcd355c-10"},{"uid":"afcd355c-12"},{"uid":"afcd355c-14"},{"uid":"afcd355c-16"},{"uid":"afcd355c-18"},{"uid":"afcd355c-20"}]},"afcd355c-2":{"id":"/src/components/background.tsx","moduleParts":{"index.js":"afcd355c-3"},"imported":[{"uid":"afcd355c-0"}],"importedBy":[{"uid":"afcd355c-28"}]},"afcd355c-4":{"id":"/src/components/controls.tsx","moduleParts":{"index.js":"afcd355c-5"},"imported":[{"uid":"afcd355c-0"}],"importedBy":[{"uid":"afcd355c-28"}]},"afcd355c-6":{"id":"/src/types.ts","moduleParts":{"index.js":"afcd355c-7"},"imported":[],"importedBy":[{"uid":"afcd355c-28"},{"uid":"afcd355c-10"},{"uid":"afcd355c-8"}]},"afcd355c-8":{"id":"/src/edges.ts","moduleParts":{"index.js":"afcd355c-9"},"imported":[{"uid":"afcd355c-6"}],"importedBy":[{"uid":"afcd355c-28"},{"uid":"afcd355c-10"}]},"afcd355c-10":{"id":"/src/components/flow-component.tsx","moduleParts":{"index.js":"afcd355c-11"},"imported":[{"uid":"afcd355c-34"},{"uid":"afcd355c-8"},{"uid":"afcd355c-6"},{"uid":"afcd355c-0"}],"importedBy":[{"uid":"afcd355c-28"}]},"afcd355c-12":{"id":"/src/components/handle.tsx","moduleParts":{"index.js":"afcd355c-13"},"imported":[{"uid":"afcd355c-0"}],"importedBy":[{"uid":"afcd355c-28"}]},"afcd355c-14":{"id":"/src/components/minimap.tsx","moduleParts":{"index.js":"afcd355c-15"},"imported":[{"uid":"afcd355c-0"}],"importedBy":[{"uid":"afcd355c-28"}]},"afcd355c-16":{"id":"/src/components/node-resizer.tsx","moduleParts":{"index.js":"afcd355c-17"},"imported":[{"uid":"afcd355c-0"}],"importedBy":[{"uid":"afcd355c-28"}]},"afcd355c-18":{"id":"/src/components/node-toolbar.tsx","moduleParts":{"index.js":"afcd355c-19"},"imported":[{"uid":"afcd355c-0"}],"importedBy":[{"uid":"afcd355c-28"}]},"afcd355c-20":{"id":"/src/components/panel.tsx","moduleParts":{"index.js":"afcd355c-21"},"imported":[{"uid":"afcd355c-0"}],"importedBy":[{"uid":"afcd355c-28"}]},"afcd355c-22":{"id":"/src/layout.ts","moduleParts":{"index.js":"afcd355c-23"},"imported":[{"uid":"afcd355c-32","dynamic":true}],"importedBy":[{"uid":"afcd355c-28"},{"uid":"afcd355c-24"}]},"afcd355c-24":{"id":"/src/flow.ts","moduleParts":{"index.js":"afcd355c-25"},"imported":[{"uid":"afcd355c-34"},{"uid":"afcd355c-22"}],"importedBy":[{"uid":"afcd355c-28"}]},"afcd355c-26":{"id":"/src/styles.ts","moduleParts":{"index.js":"afcd355c-27"},"imported":[],"importedBy":[{"uid":"afcd355c-28"}]},"afcd355c-28":{"id":"/src/index.ts","moduleParts":{"index.js":"afcd355c-29"},"imported":[{"uid":"afcd355c-2"},{"uid":"afcd355c-4"},{"uid":"afcd355c-10"},{"uid":"afcd355c-12"},{"uid":"afcd355c-14"},{"uid":"afcd355c-16"},{"uid":"afcd355c-18"},{"uid":"afcd355c-20"},{"uid":"afcd355c-8"},{"uid":"afcd355c-24"},{"uid":"afcd355c-22"},{"uid":"afcd355c-26"},{"uid":"afcd355c-6"}],"importedBy":[],"isEntry":true},"afcd355c-30":{"id":"\u0000rolldown/runtime.js","moduleParts":{"chunk-C8JhGJ3N.js":"afcd355c-31"},"imported":[],"importedBy":[]},"afcd355c-32":{"id":"/home/runner/work/fundamentals/fundamentals/node_modules/.bun/elkjs@0.9.3/node_modules/elkjs/lib/elk.bundled.js","moduleParts":{"elk.bundled-B9dPTHTZ.js":"afcd355c-33"},"imported":[],"importedBy":[{"uid":"afcd355c-22"}]},"afcd355c-34":{"id":"@pyreon/reactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"afcd355c-10"},{"uid":"afcd355c-24"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
5389
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"home/runner/work/fundamentals/fundamentals/node_modules/.bun/@pyreon+core@0.7.3/node_modules/@pyreon/core/lib/jsx-runtime.js","uid":"c8b8ebd3-1"},{"name":"src","children":[{"name":"components","children":[{"uid":"c8b8ebd3-3","name":"background.tsx"},{"uid":"c8b8ebd3-5","name":"controls.tsx"},{"uid":"c8b8ebd3-11","name":"flow-component.tsx"},{"uid":"c8b8ebd3-13","name":"handle.tsx"},{"uid":"c8b8ebd3-15","name":"minimap.tsx"},{"uid":"c8b8ebd3-17","name":"node-resizer.tsx"},{"uid":"c8b8ebd3-19","name":"node-toolbar.tsx"},{"uid":"c8b8ebd3-21","name":"panel.tsx"}]},{"uid":"c8b8ebd3-7","name":"types.ts"},{"uid":"c8b8ebd3-9","name":"edges.ts"},{"uid":"c8b8ebd3-23","name":"layout.ts"},{"uid":"c8b8ebd3-25","name":"flow.ts"},{"uid":"c8b8ebd3-27","name":"styles.ts"},{"uid":"c8b8ebd3-29","name":"index.ts"}]}]},{"name":"chunk-C8JhGJ3N.js","children":[{"name":"\u0000rolldown/runtime.js","uid":"c8b8ebd3-31"}]},{"name":"elk.bundled-B9dPTHTZ.js","children":[{"name":"home/runner/work/fundamentals/fundamentals/node_modules/.bun/elkjs@0.9.3/node_modules/elkjs/lib/elk.bundled.js","uid":"c8b8ebd3-33"}]}],"isRoot":true},"nodeParts":{"c8b8ebd3-1":{"renderedLength":1776,"gzipLength":895,"brotliLength":0,"metaUid":"c8b8ebd3-0"},"c8b8ebd3-3":{"renderedLength":3012,"gzipLength":718,"brotliLength":0,"metaUid":"c8b8ebd3-2"},"c8b8ebd3-5":{"renderedLength":4163,"gzipLength":1237,"brotliLength":0,"metaUid":"c8b8ebd3-4"},"c8b8ebd3-7":{"renderedLength":229,"gzipLength":166,"brotliLength":0,"metaUid":"c8b8ebd3-6"},"c8b8ebd3-9":{"renderedLength":7630,"gzipLength":1900,"brotliLength":0,"metaUid":"c8b8ebd3-8"},"c8b8ebd3-11":{"renderedLength":19265,"gzipLength":5016,"brotliLength":0,"metaUid":"c8b8ebd3-10"},"c8b8ebd3-13":{"renderedLength":1279,"gzipLength":655,"brotliLength":0,"metaUid":"c8b8ebd3-12"},"c8b8ebd3-15":{"renderedLength":3420,"gzipLength":1311,"brotliLength":0,"metaUid":"c8b8ebd3-14"},"c8b8ebd3-17":{"renderedLength":3784,"gzipLength":1418,"brotliLength":0,"metaUid":"c8b8ebd3-16"},"c8b8ebd3-19":{"renderedLength":1591,"gzipLength":775,"brotliLength":0,"metaUid":"c8b8ebd3-18"},"c8b8ebd3-21":{"renderedLength":788,"gzipLength":441,"brotliLength":0,"metaUid":"c8b8ebd3-20"},"c8b8ebd3-23":{"renderedLength":2455,"gzipLength":1081,"brotliLength":0,"metaUid":"c8b8ebd3-22"},"c8b8ebd3-25":{"renderedLength":23912,"gzipLength":5732,"brotliLength":0,"metaUid":"c8b8ebd3-24"},"c8b8ebd3-27":{"renderedLength":3591,"gzipLength":872,"brotliLength":0,"metaUid":"c8b8ebd3-26"},"c8b8ebd3-29":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"c8b8ebd3-28"},"c8b8ebd3-31":{"renderedLength":1611,"gzipLength":789,"brotliLength":0,"metaUid":"c8b8ebd3-30"},"c8b8ebd3-33":{"renderedLength":2547651,"gzipLength":525812,"brotliLength":0,"metaUid":"c8b8ebd3-32"}},"nodeMetas":{"c8b8ebd3-0":{"id":"/home/runner/work/fundamentals/fundamentals/node_modules/.bun/@pyreon+core@0.7.3/node_modules/@pyreon/core/lib/jsx-runtime.js","moduleParts":{"index.js":"c8b8ebd3-1"},"imported":[],"importedBy":[{"uid":"c8b8ebd3-2"},{"uid":"c8b8ebd3-4"},{"uid":"c8b8ebd3-10"},{"uid":"c8b8ebd3-12"},{"uid":"c8b8ebd3-14"},{"uid":"c8b8ebd3-16"},{"uid":"c8b8ebd3-18"},{"uid":"c8b8ebd3-20"}]},"c8b8ebd3-2":{"id":"/src/components/background.tsx","moduleParts":{"index.js":"c8b8ebd3-3"},"imported":[{"uid":"c8b8ebd3-0"}],"importedBy":[{"uid":"c8b8ebd3-28"}]},"c8b8ebd3-4":{"id":"/src/components/controls.tsx","moduleParts":{"index.js":"c8b8ebd3-5"},"imported":[{"uid":"c8b8ebd3-0"}],"importedBy":[{"uid":"c8b8ebd3-28"}]},"c8b8ebd3-6":{"id":"/src/types.ts","moduleParts":{"index.js":"c8b8ebd3-7"},"imported":[],"importedBy":[{"uid":"c8b8ebd3-28"},{"uid":"c8b8ebd3-10"},{"uid":"c8b8ebd3-8"}]},"c8b8ebd3-8":{"id":"/src/edges.ts","moduleParts":{"index.js":"c8b8ebd3-9"},"imported":[{"uid":"c8b8ebd3-6"}],"importedBy":[{"uid":"c8b8ebd3-28"},{"uid":"c8b8ebd3-10"}]},"c8b8ebd3-10":{"id":"/src/components/flow-component.tsx","moduleParts":{"index.js":"c8b8ebd3-11"},"imported":[{"uid":"c8b8ebd3-34"},{"uid":"c8b8ebd3-8"},{"uid":"c8b8ebd3-6"},{"uid":"c8b8ebd3-0"}],"importedBy":[{"uid":"c8b8ebd3-28"}]},"c8b8ebd3-12":{"id":"/src/components/handle.tsx","moduleParts":{"index.js":"c8b8ebd3-13"},"imported":[{"uid":"c8b8ebd3-0"}],"importedBy":[{"uid":"c8b8ebd3-28"}]},"c8b8ebd3-14":{"id":"/src/components/minimap.tsx","moduleParts":{"index.js":"c8b8ebd3-15"},"imported":[{"uid":"c8b8ebd3-0"}],"importedBy":[{"uid":"c8b8ebd3-28"}]},"c8b8ebd3-16":{"id":"/src/components/node-resizer.tsx","moduleParts":{"index.js":"c8b8ebd3-17"},"imported":[{"uid":"c8b8ebd3-0"}],"importedBy":[{"uid":"c8b8ebd3-28"}]},"c8b8ebd3-18":{"id":"/src/components/node-toolbar.tsx","moduleParts":{"index.js":"c8b8ebd3-19"},"imported":[{"uid":"c8b8ebd3-0"}],"importedBy":[{"uid":"c8b8ebd3-28"}]},"c8b8ebd3-20":{"id":"/src/components/panel.tsx","moduleParts":{"index.js":"c8b8ebd3-21"},"imported":[{"uid":"c8b8ebd3-0"}],"importedBy":[{"uid":"c8b8ebd3-28"}]},"c8b8ebd3-22":{"id":"/src/layout.ts","moduleParts":{"index.js":"c8b8ebd3-23"},"imported":[{"uid":"c8b8ebd3-32","dynamic":true}],"importedBy":[{"uid":"c8b8ebd3-28"},{"uid":"c8b8ebd3-24"}]},"c8b8ebd3-24":{"id":"/src/flow.ts","moduleParts":{"index.js":"c8b8ebd3-25"},"imported":[{"uid":"c8b8ebd3-34"},{"uid":"c8b8ebd3-22"}],"importedBy":[{"uid":"c8b8ebd3-28"}]},"c8b8ebd3-26":{"id":"/src/styles.ts","moduleParts":{"index.js":"c8b8ebd3-27"},"imported":[],"importedBy":[{"uid":"c8b8ebd3-28"}]},"c8b8ebd3-28":{"id":"/src/index.ts","moduleParts":{"index.js":"c8b8ebd3-29"},"imported":[{"uid":"c8b8ebd3-2"},{"uid":"c8b8ebd3-4"},{"uid":"c8b8ebd3-10"},{"uid":"c8b8ebd3-12"},{"uid":"c8b8ebd3-14"},{"uid":"c8b8ebd3-16"},{"uid":"c8b8ebd3-18"},{"uid":"c8b8ebd3-20"},{"uid":"c8b8ebd3-8"},{"uid":"c8b8ebd3-24"},{"uid":"c8b8ebd3-22"},{"uid":"c8b8ebd3-26"},{"uid":"c8b8ebd3-6"}],"importedBy":[],"isEntry":true},"c8b8ebd3-30":{"id":"\u0000rolldown/runtime.js","moduleParts":{"chunk-C8JhGJ3N.js":"c8b8ebd3-31"},"imported":[],"importedBy":[]},"c8b8ebd3-32":{"id":"/home/runner/work/fundamentals/fundamentals/node_modules/.bun/elkjs@0.9.3/node_modules/elkjs/lib/elk.bundled.js","moduleParts":{"elk.bundled-B9dPTHTZ.js":"c8b8ebd3-33"},"imported":[],"importedBy":[{"uid":"c8b8ebd3-22"}]},"c8b8ebd3-34":{"id":"@pyreon/reactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"c8b8ebd3-10"},{"uid":"c8b8ebd3-24"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
5390
5390
 
5391
5391
  const run = () => {
5392
5392
  const width = window.innerWidth;
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { r as __toESM } from "./chunk-C8JhGJ3N.js";
2
2
  import { batch, computed, signal } from "@pyreon/reactivity";
3
3
 
4
- //#region ../../node_modules/.bun/@pyreon+core@0.6.0/node_modules/@pyreon/core/lib/jsx-runtime.js
4
+ //#region ../../node_modules/.bun/@pyreon+core@0.7.3/node_modules/@pyreon/core/lib/jsx-runtime.js
5
5
  /** Marker for fragment nodes — renders children without a wrapper element */
6
6
  const Fragment = Symbol("Pyreon.Fragment");
7
7
  /**
@@ -1006,8 +1006,8 @@ function Flow(props) {
1006
1006
  if (instance.isValidConnection(connection)) instance.addEdge({
1007
1007
  source: connection.source,
1008
1008
  target: connection.target,
1009
- sourceHandle: connection.sourceHandle,
1010
- targetHandle: connection.targetHandle
1009
+ ...connection.sourceHandle != null ? { sourceHandle: connection.sourceHandle } : {},
1010
+ ...connection.targetHandle != null ? { targetHandle: connection.targetHandle } : {}
1011
1011
  });
1012
1012
  }
1013
1013
  }
@@ -1126,7 +1126,7 @@ function Flow(props) {
1126
1126
  /* @__PURE__ */ jsx(EdgeLayer, {
1127
1127
  instance,
1128
1128
  connectionState: () => connectionState(),
1129
- edgeTypes
1129
+ ...edgeTypes != null ? { edgeTypes } : {}
1130
1130
  }),
1131
1131
  () => {
1132
1132
  const sel = selectionBox();
@@ -1721,8 +1721,8 @@ function createFlow(config = {}) {
1721
1721
  const connection = {
1722
1722
  source: edge.source,
1723
1723
  target: edge.target,
1724
- sourceHandle: edge.sourceHandle,
1725
- targetHandle: edge.targetHandle
1724
+ ...edge.sourceHandle != null ? { sourceHandle: edge.sourceHandle } : {},
1725
+ ...edge.targetHandle != null ? { targetHandle: edge.targetHandle } : {}
1726
1726
  };
1727
1727
  for (const cb of connectListeners) cb(connection);
1728
1728
  }
@@ -1972,12 +1972,14 @@ function createFlow(config = {}) {
1972
1972
  }
1973
1973
  });
1974
1974
  }
1975
- const newEdges = clipboard.edges.map((e) => ({
1976
- ...e,
1977
- id: void 0,
1978
- source: idMap.get(e.source) ?? e.source,
1979
- target: idMap.get(e.target) ?? e.target
1980
- }));
1975
+ const newEdges = clipboard.edges.map((e) => {
1976
+ const { id: _id, ...rest } = e;
1977
+ return {
1978
+ ...rest,
1979
+ source: idMap.get(e.source) ?? e.source,
1980
+ target: idMap.get(e.target) ?? e.target
1981
+ };
1982
+ });
1981
1983
  batch(() => {
1982
1984
  for (const node of newNodes) addNode(node);
1983
1985
  for (const edge of newEdges) addEdge(edge);
@@ -2112,13 +2114,16 @@ function createFlow(config = {}) {
2112
2114
  function reconnectEdge(targetEdgeId, newConnection) {
2113
2115
  edges.update((eds) => eds.map((e) => {
2114
2116
  if (e.id !== targetEdgeId) return e;
2115
- return {
2117
+ const updated = {
2116
2118
  ...e,
2117
2119
  source: newConnection.source ?? e.source,
2118
- target: newConnection.target ?? e.target,
2119
- sourceHandle: newConnection.sourceHandle ?? e.sourceHandle,
2120
- targetHandle: newConnection.targetHandle ?? e.targetHandle
2120
+ target: newConnection.target ?? e.target
2121
2121
  };
2122
+ const sh = newConnection.sourceHandle ?? e.sourceHandle;
2123
+ const th = newConnection.targetHandle ?? e.targetHandle;
2124
+ if (sh != null) updated.sourceHandle = sh;
2125
+ if (th != null) updated.targetHandle = th;
2126
+ return updated;
2122
2127
  }));
2123
2128
  }
2124
2129
  function addEdgeWaypoint(edgeIdentifier, point, index) {
@@ -2138,10 +2143,11 @@ function createFlow(config = {}) {
2138
2143
  if (e.id !== edgeIdentifier) return e;
2139
2144
  const waypoints = [...e.waypoints ?? []];
2140
2145
  waypoints.splice(index, 1);
2141
- return {
2142
- ...e,
2143
- waypoints: waypoints.length > 0 ? waypoints : void 0
2144
- };
2146
+ const { waypoints: _wp, ...rest } = e;
2147
+ return waypoints.length > 0 ? {
2148
+ ...rest,
2149
+ waypoints
2150
+ } : rest;
2145
2151
  }));
2146
2152
  }
2147
2153
  function updateEdgeWaypoint(edgeIdentifier, index, point) {