@ghchinoy/litflow 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -1
- package/dist/litflow.js +11 -4
- package/dist/litflow.js.map +1 -1
- package/package.json +1 -1
- package/src/lit-flow.ts +12 -4
package/package.json
CHANGED
package/src/lit-flow.ts
CHANGED
|
@@ -897,10 +897,18 @@ export class LitFlow extends (SignalWatcher as <T extends Constructor<LitElement
|
|
|
897
897
|
|
|
898
898
|
// If strategy or direction changed, handles moved. Force re-measurement of all nodes.
|
|
899
899
|
if (changedProperties.has('layoutStrategy') || changedProperties.has('layoutDirection')) {
|
|
900
|
-
this.shadowRoot?.querySelectorAll('.xyflow__node')
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
900
|
+
const nodes = this.shadowRoot?.querySelectorAll('.xyflow__node');
|
|
901
|
+
if (nodes) {
|
|
902
|
+
(async () => {
|
|
903
|
+
const promises = Array.from(nodes).map((el) => {
|
|
904
|
+
const id = (el as HTMLElement).dataset.id;
|
|
905
|
+
return id ? this._updateNodeDimensions(id, el as HTMLElement) : Promise.resolve();
|
|
906
|
+
});
|
|
907
|
+
await Promise.all(promises);
|
|
908
|
+
// After all handles are measured, trigger an update to re-render edges with new handle positions
|
|
909
|
+
this.requestUpdate();
|
|
910
|
+
})();
|
|
911
|
+
}
|
|
904
912
|
}
|
|
905
913
|
|
|
906
914
|
this.dispatchEvent(new CustomEvent('layout-complete', {
|