@ankhorage/zora 27.2.5 → 27.3.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.d.ts +4 -0
  4. package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.d.ts.map +1 -1
  5. package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.js +7 -1
  6. package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.js.map +1 -1
  7. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.d.ts.map +1 -1
  8. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js +24 -3
  9. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js.map +1 -1
  10. package/dist/features/graph-view/adapters/inbound/web-artifact/getGraphGeometryKey.d.ts +1 -1
  11. package/dist/features/graph-view/adapters/inbound/web-artifact/getGraphGeometryKey.d.ts.map +1 -1
  12. package/dist/features/graph-view/adapters/inbound/web-artifact/getGraphGeometryKey.js +8 -3
  13. package/dist/features/graph-view/adapters/inbound/web-artifact/getGraphGeometryKey.js.map +1 -1
  14. package/dist/features/graph-view/adapters/inbound/web-artifact/hasGraphLayoutChanged.d.ts +1 -1
  15. package/dist/features/graph-view/adapters/inbound/web-artifact/hasGraphLayoutChanged.d.ts.map +1 -1
  16. package/dist/features/graph-view/adapters/inbound/web-artifact/hasGraphLayoutChanged.js +4 -3
  17. package/dist/features/graph-view/adapters/inbound/web-artifact/hasGraphLayoutChanged.js.map +1 -1
  18. package/dist/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.d.ts +9 -0
  19. package/dist/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.d.ts.map +1 -0
  20. package/dist/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.js +30 -0
  21. package/dist/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.js.map +1 -0
  22. package/dist/features/graph-view/public.d.ts +1 -1
  23. package/dist/features/graph-view/public.d.ts.map +1 -1
  24. package/dist/features/graph-view/public.js.map +1 -1
  25. package/dist/types/graph-view.d.ts +7 -0
  26. package/dist/types/graph-view.d.ts.map +1 -1
  27. package/dist/types/graph-view.js.map +1 -1
  28. package/dist/types/graphViewRuntime.d.ts +2 -1
  29. package/dist/types/graphViewRuntime.d.ts.map +1 -1
  30. package/dist/types/graphViewRuntime.js.map +1 -1
  31. package/package.json +2 -2
  32. package/src/features/graph-view/adapters/inbound/web-artifact/GraphView.tsx +7 -0
  33. package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.test.ts +77 -0
  34. package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.ts +36 -3
  35. package/src/features/graph-view/adapters/inbound/web-artifact/getGraphGeometryKey.ts +16 -12
  36. package/src/features/graph-view/adapters/inbound/web-artifact/hasGraphLayoutChanged.ts +4 -2
  37. package/src/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.ts +37 -0
  38. package/src/features/graph-view/public.ts +1 -0
  39. package/src/types/graph-view.ts +7 -0
  40. package/src/types/graphViewRuntime.ts +2 -0
  41. package/web-dist/components/graph-view/GraphView.d.ts +5 -1
  42. package/web-dist/components/graph-view/GraphView.js +50 -10
  43. package/web-dist/components/graph-view/GraphView.types-0.d.ts +7 -0
@@ -1 +1 @@
1
- {"version":3,"file":"graph-view.d.ts","sourceRoot":"","sources":["../../src/types/graph-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG,QAAQ,GAAG,YAAY,GAAG,KAAK,GAAG,MAAM,CAAC;AAC5F,MAAM,MAAM,yBAAyB,GACnC,OAAO,GAAG,cAAc,GAA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AqB,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;CAClE;AAED,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,cAAc,EACZ,aAAa,GACb,kBAAkB,GAClB,aAAa,GACb,SAAS,GACT,kBAAkB,GAClB,uBAAuB,CAC1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"graph-view.js","sourceRoot":"","sources":["../../src/types/graph-view.ts"],"names":[],"mappings":"","sourcesContent":["import type { SelectionIntent } from '@ankhorage/utility/selection';\nimport type React from 'react';\n\nexport type GraphViewLayoutName = 'breadthfirst' | 'circle' | 'concentric' | 'elk' | 'grid';\nexport type GraphViewElementEventType =\n 'press' | 'double-press' | 'select' | 'unselect' | 'pointer-enter' | 'pointer-leave';\n\nexport interface GraphViewNode {\n readonly id: string;\n readonly label?: string;\n readonly parentId?: string;\n readonly classes?: string;\n readonly data?: Readonly<Record<string, unknown>>;\n}\n\nexport interface GraphViewEdge {\n readonly id?: string;\n readonly source: string;\n readonly target: string;\n readonly classes?: string;\n readonly data?: Readonly<Record<string, unknown>>;\n}\n\nexport interface GraphViewStyleRule {\n readonly selector: string;\n readonly style: Readonly<Record<string, unknown>>;\n}\n\nexport interface GraphViewPoint {\n readonly x: number;\n readonly y: number;\n}\n\nexport interface GraphViewSize {\n readonly width: number;\n readonly height: number;\n}\n\nexport interface GraphViewNodeRenderContext {\n readonly hovered: boolean;\n readonly node: GraphViewNode;\n readonly selected: boolean;\n readonly zoom: number;\n}\n\nexport interface GraphViewRenderedNode {\n readonly hovered: boolean;\n readonly id: string;\n readonly position: GraphViewPoint;\n readonly selected: boolean;\n readonly zoom: number;\n}\n\nexport interface GraphViewNodeMeasurement {\n readonly id: string;\n readonly position: GraphViewPoint;\n readonly size: GraphViewSize;\n}\n\nexport interface GraphViewMeasurement {\n readonly nodes: readonly GraphViewNodeMeasurement[];\n readonly viewport: GraphViewSize;\n}\n\nexport interface GraphViewViewport {\n readonly zoom: number;\n readonly pan: GraphViewPoint;\n}\n\nexport interface GraphViewFitOptions {\n /**\n * Optimize effective rendered fit without rerunning the layout algorithm; whole-graph fits only.\n * Stops at the configured fit-size target and keeps semantic labels collision-safe.\n */\n readonly optimizeSpacing?: boolean;\n readonly nodeIds?: readonly string[];\n readonly padding?: number;\n}\n\nexport interface GraphViewElementEvent {\n readonly id: string;\n readonly type: GraphViewElementEventType;\n readonly selectionIntent?: SelectionIntent;\n}\n\nexport interface GraphViewController {\n fit(options?: GraphViewFitOptions): void;\n /** Measure rendered node geometry without exposing the backing graph engine. */\n measureNodes?(nodeIds: readonly string[]): GraphViewMeasurement | null;\n getViewport(): GraphViewViewport;\n getZoomRange(): { readonly min: number; readonly max: number };\n setPan(pan: GraphViewPoint): void;\n setZoom(zoom: number): void;\n zoomBy(factor: number): void;\n}\n\n/*** The browser lifecycle events carry only the existing public graph controller. */\nexport interface GraphViewDomControllerEventDetail {\n readonly controller: GraphViewController;\n}\n\nexport interface GraphViewProps {\n readonly nodes: readonly GraphViewNode[];\n readonly edges: readonly GraphViewEdge[];\n readonly layout?: GraphViewLayoutName;\n readonly layoutOptions?: Readonly<Record<string, unknown>>;\n readonly spacingFactor?: number;\n readonly styleRules?: readonly GraphViewStyleRule[];\n readonly selectedNodeIds?: readonly string[];\n readonly renderNode?: (context: GraphViewNodeRenderContext) => React.ReactNode;\n readonly getNodeSize?: (node: GraphViewNode) => GraphViewSize | undefined;\n readonly fitPadding?: number;\n readonly minZoom?: number;\n readonly maxZoom?: number;\n readonly minReadableLabelSize?: number;\n readonly maxFitLabelSize?: number;\n /** Zoom values and bounds use the full-node fit as 1 when fit-relative is selected. */\n readonly zoomMode?: 'absolute' | 'fit-relative';\n /** Measure plain labels before layout instead of estimating width from character count. */\n readonly sizeNodesToLabels?: boolean;\n readonly className?: string;\n readonly style?: React.CSSProperties;\n readonly ariaLabel?: string;\n readonly onReady?: (controller: GraphViewController) => void;\n readonly onLayoutComplete?: (controller: GraphViewController) => void;\n readonly onNodeEvent?: (event: GraphViewElementEvent) => void;\n readonly onEdgeEvent?: (event: GraphViewElementEvent) => void;\n readonly onViewportChange?: (viewport: GraphViewViewport) => void;\n readonly onSpacingFactorChange?: (spacingFactor: number) => void;\n}\n\nexport type GraphViewCallbacks = Pick<\n GraphViewProps,\n | 'onEdgeEvent'\n | 'onLayoutComplete'\n | 'onNodeEvent'\n | 'onReady'\n | 'onViewportChange'\n | 'onSpacingFactorChange'\n>;\n"]}
1
+ {"version":3,"file":"graph-view.js","sourceRoot":"","sources":["../../src/types/graph-view.ts"],"names":[],"mappings":"","sourcesContent":["import type { SelectionIntent } from '@ankhorage/utility/selection';\nimport type React from 'react';\n\nexport type GraphViewLayoutName = 'breadthfirst' | 'circle' | 'concentric' | 'elk' | 'grid';\nexport type GraphViewTopologyUpdatePolicy = 'preserve-positions';\nexport type GraphViewElementEventType =\n 'press' | 'double-press' | 'select' | 'unselect' | 'pointer-enter' | 'pointer-leave';\n\nexport interface GraphViewNode {\n readonly id: string;\n readonly label?: string;\n readonly parentId?: string;\n readonly classes?: string;\n readonly data?: Readonly<Record<string, unknown>>;\n}\n\nexport interface GraphViewEdge {\n readonly id?: string;\n readonly source: string;\n readonly target: string;\n readonly classes?: string;\n readonly data?: Readonly<Record<string, unknown>>;\n}\n\nexport interface GraphViewStyleRule {\n readonly selector: string;\n readonly style: Readonly<Record<string, unknown>>;\n}\n\nexport interface GraphViewPoint {\n readonly x: number;\n readonly y: number;\n}\n\nexport interface GraphViewSize {\n readonly width: number;\n readonly height: number;\n}\n\nexport interface GraphViewNodeRenderContext {\n readonly hovered: boolean;\n readonly node: GraphViewNode;\n readonly selected: boolean;\n readonly zoom: number;\n}\n\nexport interface GraphViewRenderedNode {\n readonly hovered: boolean;\n readonly id: string;\n readonly position: GraphViewPoint;\n readonly selected: boolean;\n readonly zoom: number;\n}\n\nexport interface GraphViewNodeMeasurement {\n readonly id: string;\n readonly position: GraphViewPoint;\n readonly size: GraphViewSize;\n}\n\nexport interface GraphViewMeasurement {\n readonly nodes: readonly GraphViewNodeMeasurement[];\n readonly viewport: GraphViewSize;\n}\n\nexport interface GraphViewViewport {\n readonly zoom: number;\n readonly pan: GraphViewPoint;\n}\n\nexport interface GraphViewFitOptions {\n /**\n * Optimize effective rendered fit without rerunning the layout algorithm; whole-graph fits only.\n * Stops at the configured fit-size target and keeps semantic labels collision-safe.\n */\n readonly optimizeSpacing?: boolean;\n readonly nodeIds?: readonly string[];\n readonly padding?: number;\n}\n\nexport interface GraphViewElementEvent {\n readonly id: string;\n readonly type: GraphViewElementEventType;\n readonly selectionIntent?: SelectionIntent;\n}\n\nexport interface GraphViewController {\n fit(options?: GraphViewFitOptions): void;\n /** Measure rendered node geometry without exposing the backing graph engine. */\n measureNodes?(nodeIds: readonly string[]): GraphViewMeasurement | null;\n getViewport(): GraphViewViewport;\n getZoomRange(): { readonly min: number; readonly max: number };\n setPan(pan: GraphViewPoint): void;\n setZoom(zoom: number): void;\n zoomBy(factor: number): void;\n}\n\n/*** The browser lifecycle events carry only the existing public graph controller. */\nexport interface GraphViewDomControllerEventDetail {\n readonly controller: GraphViewController;\n}\n\nexport interface GraphViewProps {\n readonly nodes: readonly GraphViewNode[];\n readonly edges: readonly GraphViewEdge[];\n readonly layout?: GraphViewLayoutName;\n readonly layoutOptions?: Readonly<Record<string, unknown>>;\n /**\n * Preserve the settled viewport and retained-node positions during controlled topology updates.\n * New nodes receive a deterministic initial position; call controller.fit() or change layout to\n * intentionally fit or relayout the graph. Without this opt-in, topology changes relayout.\n */\n readonly topologyUpdatePolicy?: GraphViewTopologyUpdatePolicy;\n readonly spacingFactor?: number;\n readonly styleRules?: readonly GraphViewStyleRule[];\n readonly selectedNodeIds?: readonly string[];\n readonly renderNode?: (context: GraphViewNodeRenderContext) => React.ReactNode;\n readonly getNodeSize?: (node: GraphViewNode) => GraphViewSize | undefined;\n readonly fitPadding?: number;\n readonly minZoom?: number;\n readonly maxZoom?: number;\n readonly minReadableLabelSize?: number;\n readonly maxFitLabelSize?: number;\n /** Zoom values and bounds use the full-node fit as 1 when fit-relative is selected. */\n readonly zoomMode?: 'absolute' | 'fit-relative';\n /** Measure plain labels before layout instead of estimating width from character count. */\n readonly sizeNodesToLabels?: boolean;\n readonly className?: string;\n readonly style?: React.CSSProperties;\n readonly ariaLabel?: string;\n readonly onReady?: (controller: GraphViewController) => void;\n readonly onLayoutComplete?: (controller: GraphViewController) => void;\n readonly onNodeEvent?: (event: GraphViewElementEvent) => void;\n readonly onEdgeEvent?: (event: GraphViewElementEvent) => void;\n readonly onViewportChange?: (viewport: GraphViewViewport) => void;\n readonly onSpacingFactorChange?: (spacingFactor: number) => void;\n}\n\nexport type GraphViewCallbacks = Pick<\n GraphViewProps,\n | 'onEdgeEvent'\n | 'onLayoutComplete'\n | 'onNodeEvent'\n | 'onReady'\n | 'onViewportChange'\n | 'onSpacingFactorChange'\n>;\n"]}
@@ -1,4 +1,4 @@
1
- import type { GraphViewEdge, GraphViewLayoutName, GraphViewNode, GraphViewStyleRule } from './graph-view';
1
+ import type { GraphViewEdge, GraphViewLayoutName, GraphViewNode, GraphViewStyleRule, GraphViewTopologyUpdatePolicy } from './graph-view';
2
2
  export interface GraphRuntimeUpdate {
3
3
  readonly edges: readonly GraphViewEdge[];
4
4
  readonly fitPadding?: number;
@@ -14,5 +14,6 @@ export interface GraphRuntimeUpdate {
14
14
  readonly richNodeRendering: boolean;
15
15
  readonly spacingFactor?: number;
16
16
  readonly styleRules?: readonly GraphViewStyleRule[];
17
+ readonly topologyUpdatePolicy?: GraphViewTopologyUpdatePolicy;
17
18
  }
18
19
  //# sourceMappingURL=graphViewRuntime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphViewRuntime.d.ts","sourceRoot":"","sources":["../../src/types/graphViewRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,kBAAkB;I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AC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC;IAChD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACpD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,6BAA6B,CAAC;CAC/D"}
@@ -1 +1 @@
1
- {"version":3,"file":"graphViewRuntime.js","sourceRoot":"","sources":["../../src/types/graphViewRuntime.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n GraphViewEdge,\n GraphViewLayoutName,\n GraphViewNode,\n GraphViewStyleRule,\n} from './graph-view';\n\nexport interface GraphRuntimeUpdate {\n readonly edges: readonly GraphViewEdge[];\n readonly fitPadding?: number;\n readonly layout?: GraphViewLayoutName;\n readonly layoutOptions?: Readonly<Record<string, unknown>>;\n readonly maxZoom?: number;\n readonly minReadableLabelSize?: number;\n readonly maxFitLabelSize?: number;\n readonly minZoom?: number;\n readonly zoomMode?: 'absolute' | 'fit-relative';\n readonly sizeNodesToLabels?: boolean;\n readonly nodes: readonly GraphViewNode[];\n readonly richNodeRendering: boolean;\n readonly spacingFactor?: number;\n readonly styleRules?: readonly GraphViewStyleRule[];\n}\n"]}
1
+ {"version":3,"file":"graphViewRuntime.js","sourceRoot":"","sources":["../../src/types/graphViewRuntime.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n GraphViewEdge,\n GraphViewLayoutName,\n GraphViewNode,\n GraphViewStyleRule,\n GraphViewTopologyUpdatePolicy,\n} from './graph-view';\n\nexport interface GraphRuntimeUpdate {\n readonly edges: readonly GraphViewEdge[];\n readonly fitPadding?: number;\n readonly layout?: GraphViewLayoutName;\n readonly layoutOptions?: Readonly<Record<string, unknown>>;\n readonly maxZoom?: number;\n readonly minReadableLabelSize?: number;\n readonly maxFitLabelSize?: number;\n readonly minZoom?: number;\n readonly zoomMode?: 'absolute' | 'fit-relative';\n readonly sizeNodesToLabels?: boolean;\n readonly nodes: readonly GraphViewNode[];\n readonly richNodeRendering: boolean;\n readonly spacingFactor?: number;\n readonly styleRules?: readonly GraphViewStyleRule[];\n readonly topologyUpdatePolicy?: GraphViewTopologyUpdatePolicy;\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/zora",
3
3
  "type": "module",
4
- "version": "27.2.5",
4
+ "version": "27.3.0",
5
5
  "description": "Opinionated React Native and React Native Web UI kit built on @ankhorage/surface.",
6
6
  "homepage": "https://github.com/ankhorage/zora#readme",
7
7
  "bugs": {
@@ -47,7 +47,7 @@
47
47
  "@ankhorage/game": "^0.1.4",
48
48
  "@ankhorage/grid-view": "^0.5.0",
49
49
  "@ankhorage/reader": "^0.1.3",
50
- "@ankhorage/runtime": "^5.4.9",
50
+ "@ankhorage/runtime": "^5.5.0",
51
51
  "@ankhorage/surface": "^9.5.15",
52
52
  "@ankhorage/utility": "^1.10.1",
53
53
  "expo-document-picker": "~57.0.3",
@@ -30,6 +30,10 @@ type GraphContainer = NonNullable<CytoscapeOptions['container']>;
30
30
  * Ordinary zoom never adjusts spacing or relayouts. Explicit optimization preserves layout ordering,
31
31
  * stops once effective fit reaches maxFitLabelSize, keeps labels and unrelated compound boundaries
32
32
  * collision-safe, and permits only a small rendered background-overlap fallback for dense graphs.
33
+ * topologyUpdatePolicy Use `preserve-positions` for controlled incremental topology changes. It
34
+ * retains settled nodes and the user viewport, and initially places new nodes on a deterministic
35
+ * local grid. Use an explicit controller fit or a layout change when a complete rearrangement is
36
+ * intentional.
33
37
  */
34
38
  export function GraphView(props: GraphViewProps) {
35
39
  const hostRef = React.useRef<HTMLDivElement | null>(null);
@@ -168,6 +172,7 @@ function useRuntimeGraphUpdate(
168
172
  renderNode,
169
173
  spacingFactor,
170
174
  styleRules,
175
+ topologyUpdatePolicy,
171
176
  } = props;
172
177
 
173
178
  React.useEffect(() => {
@@ -186,6 +191,7 @@ function useRuntimeGraphUpdate(
186
191
  richNodeRendering: renderNode !== undefined,
187
192
  spacingFactor,
188
193
  styleRules,
194
+ topologyUpdatePolicy,
189
195
  });
190
196
  }, [
191
197
  edges,
@@ -203,6 +209,7 @@ function useRuntimeGraphUpdate(
203
209
  runtimeRef,
204
210
  spacingFactor,
205
211
  styleRules,
212
+ topologyUpdatePolicy,
206
213
  ]);
207
214
  }
208
215
 
@@ -109,6 +109,52 @@ test('fits changed topology but preserves viewport and avoids relayout for highl
109
109
  }
110
110
  });
111
111
 
112
+ test('preserves a stable topology removal without relayout, fit, or retained-node movement', async () => {
113
+ const ready = Promise.withResolvers<GraphViewController>();
114
+ const calls = { sort: 0 };
115
+ const runtime = createGraphRuntime(undefined, { current: { onReady: ready.resolve } });
116
+ const nodes = Array.from({ length: 87 }, (_, index) => ({ id: `repository-${index}` }));
117
+ const input = {
118
+ nodes,
119
+ edges: nodes.slice(1).flatMap((node, index) => {
120
+ const source = nodes.at(index);
121
+ return source ? [{ id: `dependency-${index}`, source: source.id, target: node.id }] : [];
122
+ }),
123
+ layout: 'grid' as const,
124
+ layoutOptions: {
125
+ sort: () => {
126
+ calls.sort += 1;
127
+ return 0;
128
+ },
129
+ },
130
+ richNodeRendering: false,
131
+ topologyUpdatePolicy: 'preserve-positions' as const,
132
+ };
133
+ try {
134
+ runtime.update(input);
135
+ const controller = await ready.promise;
136
+ controller.setZoom(0.7);
137
+ controller.setPan({ x: 40, y: 30 });
138
+ runtime.setSelectedNodeIds(['repository-0']);
139
+ const retainedIds = nodes.slice(0, -1).map((node) => node.id);
140
+ const before = controller.measureNodes?.(retainedIds);
141
+ const viewport = controller.getViewport();
142
+ const sortCount = calls.sort;
143
+
144
+ runtime.update({
145
+ ...input,
146
+ nodes: nodes.slice(0, -1),
147
+ edges: input.edges.slice(0, -1),
148
+ });
149
+
150
+ expect(controller.measureNodes?.(retainedIds)).toEqual(before);
151
+ expect(controller.getViewport()).toEqual(viewport);
152
+ expect(calls.sort).toBe(sortCount);
153
+ } finally {
154
+ runtime.destroy();
155
+ }
156
+ });
157
+
112
158
  test('fits a changed layout algorithm even when visible topology is unchanged', async () => {
113
159
  const initial = Promise.withResolvers<GraphViewController>();
114
160
  const completed = Promise.withResolvers<GraphViewController>();
@@ -314,3 +360,34 @@ test('settles the pending initial layout when presentation changes before readin
314
360
  runtime.destroy();
315
361
  }
316
362
  });
363
+
364
+ test('lays out 0 → 1 → 5 topology updates before preserve-positions becomes active', async () => {
365
+ const ready = Promise.withResolvers<GraphViewController>();
366
+ const calls = { sort: 0 };
367
+ const runtime = createGraphRuntime(undefined, { current: { onReady: ready.resolve } });
368
+ const layoutOptions = {
369
+ sort: () => {
370
+ calls.sort += 1;
371
+ return 0;
372
+ },
373
+ };
374
+ const fiveNodes = Array.from({ length: 5 }, (_, index) => ({ id: `repository-${index}` }));
375
+ const input = {
376
+ edges: [],
377
+ layout: 'grid' as const,
378
+ layoutOptions,
379
+ richNodeRendering: false,
380
+ topologyUpdatePolicy: 'preserve-positions' as const,
381
+ };
382
+ try {
383
+ runtime.update({ ...input, nodes: [] });
384
+ runtime.update({ ...input, nodes: fiveNodes.slice(0, 1) });
385
+ runtime.update({ ...input, nodes: fiveNodes });
386
+ const controller = await ready.promise;
387
+
388
+ expect(calls.sort).toBeGreaterThan(0);
389
+ expect(controller.measureNodes?.(fiveNodes.map((node) => node.id))?.nodes).toHaveLength(5);
390
+ } finally {
391
+ runtime.destroy();
392
+ }
393
+ });
@@ -18,6 +18,7 @@ import { createGraphResizeObserver, type GraphResizeObserver } from './createGra
18
18
  import { getGraphGeometryKey } from './getGraphGeometryKey';
19
19
  import { getGraphTopologyKey } from './getGraphTopologyKey';
20
20
  import { hasGraphLayoutChanged } from './hasGraphLayoutChanged';
21
+ import { placeAddedGraphNodes } from './placeAddedGraphNodes';
21
22
  import { readGraphRenderedNodes } from './readGraphRenderedNodes';
22
23
  import { registerGraphLayouts } from './registerGraphLayouts';
23
24
  import { runGraphLayout } from './runGraphLayout';
@@ -172,9 +173,14 @@ function updateRuntime(state: GraphRuntimeState, input: GraphRuntimeUpdate) {
172
173
  state.latestUpdateRef.current = input;
173
174
  state.fitPaddingRef.current = input.fitPadding ?? 50;
174
175
  state.viewport.configure(input);
176
+ const preservesTopology = shouldPreserveTopology(state, previous, input);
177
+ const retainedNodeIds = getRetainedNodeIds(previous, input, preservesTopology);
178
+ const retainedGeometry =
179
+ retainedNodeIds === null ? null : getGraphGeometryKey(state.cy, retainedNodeIds);
175
180
  state.cy.batch(() => {
176
181
  if (previous?.nodes !== input.nodes || previous.edges !== input.edges) {
177
182
  syncGraphElements(state.cy, input.nodes, input.edges);
183
+ if (preservesTopology) placeAddedGraphNodes(state.cy, previous?.nodes ?? [], input.nodes);
178
184
  }
179
185
  if (
180
186
  previous?.styleRules !== input.styleRules ||
@@ -194,7 +200,11 @@ function updateRuntime(state: GraphRuntimeState, input: GraphRuntimeUpdate) {
194
200
  const geometry = getGraphGeometryKey(state.cy);
195
201
  // Keep native double-press targets stable for paint-only class changes. A class that changes
196
202
  // measured node dimensions remains a geometry change and must relayout.
197
- const relayout = hasGraphLayoutChanged(previous, input) || geometry !== state.geometryRef.current;
203
+ const geometryChanged =
204
+ retainedGeometry === null
205
+ ? geometry !== state.geometryRef.current
206
+ : retainedGeometry !== getGraphGeometryKey(state.cy, retainedNodeIds ?? undefined);
207
+ const relayout = hasGraphLayoutChanged(previous, input, preservesTopology) || geometryChanged;
198
208
  state.geometryRef.current = geometry;
199
209
  if (!relayout) {
200
210
  if (
@@ -208,8 +218,6 @@ function updateRuntime(state: GraphRuntimeState, input: GraphRuntimeUpdate) {
208
218
  state.viewport.settle(previous?.zoomMode !== input.zoomMode);
209
219
  }
210
220
  emitRenderedNodes(state);
211
- if (!state.layoutRunningRef.current && !state.pendingInitialFitRef.current)
212
- state.callbacksRef.current.onLayoutComplete?.(state.controller);
213
221
  return;
214
222
  }
215
223
  stopCurrentLayout(state);
@@ -218,6 +226,31 @@ function updateRuntime(state: GraphRuntimeState, input: GraphRuntimeUpdate) {
218
226
  startCurrentLayout(state, input);
219
227
  }
220
228
 
229
+ /*** Preserve only opt-in topology updates after the initial layout and fit have settled. */
230
+ function shouldPreserveTopology(
231
+ state: GraphRuntimeState,
232
+ previous: GraphRuntimeUpdate | null,
233
+ input: GraphRuntimeUpdate,
234
+ ): boolean {
235
+ return (
236
+ previous !== null &&
237
+ state.readyRef.current &&
238
+ !state.pendingInitialFitRef.current &&
239
+ input.topologyUpdatePolicy === 'preserve-positions'
240
+ );
241
+ }
242
+
243
+ /*** Limit stable-update geometry checks to nodes that existed before reconciliation. */
244
+ function getRetainedNodeIds(
245
+ previous: GraphRuntimeUpdate | null,
246
+ input: GraphRuntimeUpdate,
247
+ preservesTopology: boolean,
248
+ ): ReadonlySet<string> | null {
249
+ if (!preservesTopology || previous === null) return null;
250
+ const nextNodeIds = new Set(input.nodes.map((node) => node.id));
251
+ return new Set(previous.nodes.map((node) => node.id).filter((id) => nextNodeIds.has(id)));
252
+ }
253
+
221
254
  /*** Start a generation-safe layout whose completion is the only normal automatic fit trigger. */
222
255
  function startCurrentLayout(state: GraphRuntimeState, input: GraphRuntimeUpdate) {
223
256
  state.pendingInitialFitRef.current = false;
@@ -7,18 +7,22 @@ import type { Core } from 'cytoscape';
7
7
  * bounds follow child positions, so keying their measured bounds would feed layout output back
8
8
  * into input. Styled geometry tests and runtime interaction tests protect these distinctions.
9
9
  */
10
- export function getGraphGeometryKey(cy: Core): string {
10
+ export function getGraphGeometryKey(cy: Core, nodeIds?: ReadonlySet<string>): string {
11
11
  return JSON.stringify(
12
- cy.nodes().map((node) => {
13
- if (node.isParent()) return [node.id()];
14
- const labelBounds = node.boundingBox({
15
- includeEdges: false,
16
- includeLabels: true,
17
- includeNodes: false,
18
- includeOverlays: false,
19
- includeUnderlays: false,
20
- });
21
- return [node.id(), node.outerWidth(), node.outerHeight(), labelBounds.w, labelBounds.h];
22
- }),
12
+ cy
13
+ .nodes()
14
+ .map((node) => {
15
+ if (nodeIds !== undefined && !nodeIds.has(node.id())) return null;
16
+ if (node.isParent()) return [node.id()];
17
+ const labelBounds = node.boundingBox({
18
+ includeEdges: false,
19
+ includeLabels: true,
20
+ includeNodes: false,
21
+ includeOverlays: false,
22
+ includeUnderlays: false,
23
+ });
24
+ return [node.id(), node.outerWidth(), node.outerHeight(), labelBounds.w, labelBounds.h];
25
+ })
26
+ .filter((entry) => entry !== null),
23
27
  );
24
28
  }
@@ -10,6 +10,7 @@ import { getGraphTopologyKey } from './getGraphTopologyKey';
10
10
  export function hasGraphLayoutChanged(
11
11
  previous: GraphRuntimeUpdate | null,
12
12
  input: GraphRuntimeUpdate,
13
+ preservesTopology: boolean,
13
14
  ): boolean {
14
15
  return (
15
16
  previous === null ||
@@ -17,7 +18,8 @@ export function hasGraphLayoutChanged(
17
18
  previous.spacingFactor !== input.spacingFactor ||
18
19
  previous.layoutOptions !== input.layoutOptions ||
19
20
  previous.richNodeRendering !== input.richNodeRendering ||
20
- getGraphTopologyKey(previous.nodes, previous.edges) !==
21
- getGraphTopologyKey(input.nodes, input.edges)
21
+ (!preservesTopology &&
22
+ getGraphTopologyKey(previous.nodes, previous.edges) !==
23
+ getGraphTopologyKey(input.nodes, input.edges))
22
24
  );
23
25
  }
@@ -0,0 +1,37 @@
1
+ import type { Core } from 'cytoscape';
2
+
3
+ import type { GraphViewNode } from '../../../../../types/graph-view';
4
+
5
+ const GRID_GAP = 120;
6
+
7
+ /***
8
+ * Give stable-topology additions deterministic positions without moving settled nodes.
9
+ * This deliberately is not an incremental layout: callers can request a complete layout by
10
+ * changing the configured algorithm, while ordinary controlled additions keep the user viewport.
11
+ */
12
+ export function placeAddedGraphNodes(
13
+ cy: Core,
14
+ previousNodes: readonly GraphViewNode[],
15
+ nodes: readonly GraphViewNode[],
16
+ ) {
17
+ const previousNodeIds = new Set(previousNodes.map((node) => node.id));
18
+ const addedNodes = nodes
19
+ .filter((node) => !previousNodeIds.has(node.id))
20
+ .sort((left, right) => left.id.localeCompare(right.id));
21
+ if (addedNodes.length === 0) return;
22
+
23
+ const retainedNodes = cy
24
+ .nodes()
25
+ .filter((node) => previousNodeIds.has(node.id()) && !node.isParent());
26
+ const bounds = retainedNodes.boundingBox({ includeEdges: false, includeLabels: true });
27
+ const origin = retainedNodes.empty() ? { x: 0, y: 0 } : { x: bounds.x2 + GRID_GAP, y: bounds.y1 };
28
+ const columns = Math.ceil(Math.sqrt(addedNodes.length));
29
+ addedNodes.forEach((node, index) => {
30
+ const graphNode = cy.getElementById(node.id);
31
+ if (graphNode.empty() || graphNode.isParent()) return;
32
+ graphNode.position({
33
+ x: origin.x + (index % columns) * GRID_GAP,
34
+ y: origin.y + Math.floor(index / columns) * GRID_GAP,
35
+ });
36
+ });
37
+ }
@@ -16,6 +16,7 @@ export type {
16
16
  GraphViewRenderedNode,
17
17
  GraphViewSize,
18
18
  GraphViewStyleRule,
19
+ GraphViewTopologyUpdatePolicy,
19
20
  GraphViewViewport,
20
21
  } from '../../types/graph-view';
21
22
  export { GraphView } from './adapters/inbound/web-artifact/GraphView';
@@ -2,6 +2,7 @@ import type { SelectionIntent } from '@ankhorage/utility/selection';
2
2
  import type React from 'react';
3
3
 
4
4
  export type GraphViewLayoutName = 'breadthfirst' | 'circle' | 'concentric' | 'elk' | 'grid';
5
+ export type GraphViewTopologyUpdatePolicy = 'preserve-positions';
5
6
  export type GraphViewElementEventType =
6
7
  'press' | 'double-press' | 'select' | 'unselect' | 'pointer-enter' | 'pointer-leave';
7
8
 
@@ -104,6 +105,12 @@ export interface GraphViewProps {
104
105
  readonly edges: readonly GraphViewEdge[];
105
106
  readonly layout?: GraphViewLayoutName;
106
107
  readonly layoutOptions?: Readonly<Record<string, unknown>>;
108
+ /**
109
+ * Preserve the settled viewport and retained-node positions during controlled topology updates.
110
+ * New nodes receive a deterministic initial position; call controller.fit() or change layout to
111
+ * intentionally fit or relayout the graph. Without this opt-in, topology changes relayout.
112
+ */
113
+ readonly topologyUpdatePolicy?: GraphViewTopologyUpdatePolicy;
107
114
  readonly spacingFactor?: number;
108
115
  readonly styleRules?: readonly GraphViewStyleRule[];
109
116
  readonly selectedNodeIds?: readonly string[];
@@ -3,6 +3,7 @@ import type {
3
3
  GraphViewLayoutName,
4
4
  GraphViewNode,
5
5
  GraphViewStyleRule,
6
+ GraphViewTopologyUpdatePolicy,
6
7
  } from './graph-view';
7
8
 
8
9
  export interface GraphRuntimeUpdate {
@@ -20,4 +21,5 @@ export interface GraphRuntimeUpdate {
20
21
  readonly richNodeRendering: boolean;
21
22
  readonly spacingFactor?: number;
22
23
  readonly styleRules?: readonly GraphViewStyleRule[];
24
+ readonly topologyUpdatePolicy?: GraphViewTopologyUpdatePolicy;
23
25
  }
@@ -18,6 +18,10 @@ import type { GraphViewProps } from './GraphView.types-0';
18
18
  * Ordinary zoom never adjusts spacing or relayouts. Explicit optimization preserves layout ordering,
19
19
  * stops once effective fit reaches maxFitLabelSize, keeps labels and unrelated compound boundaries
20
20
  * collision-safe, and permits only a small rendered background-overlap fallback for dense graphs.
21
+ * topologyUpdatePolicy Use `preserve-positions` for controlled incremental topology changes. It
22
+ * retains settled nodes and the user viewport, and initially places new nodes on a deterministic
23
+ * local grid. Use an explicit controller fit or a layout change when a complete rearrangement is
24
+ * intentional.
21
25
  */
22
26
  export declare function GraphView(props: GraphViewProps): React.JSX.Element;
23
27
 
@@ -27,4 +31,4 @@ export declare namespace GraphView {
27
31
  readonly layoutComplete: "zora-graph-view-layout-complete";
28
32
  };
29
33
  }
30
- export type { GraphViewCallbacks, GraphViewController, GraphViewDomControllerEventDetail, GraphViewEdge, GraphViewElementEvent, GraphViewElementEventType, GraphViewFitOptions, GraphViewLayoutName, GraphViewMeasurement, GraphViewNode, GraphViewNodeMeasurement, GraphViewNodeRenderContext, GraphViewPoint, GraphViewProps, GraphViewRenderedNode, GraphViewSize, GraphViewStyleRule, GraphViewViewport } from './GraphView.types-0';
34
+ export type { GraphViewCallbacks, GraphViewController, GraphViewDomControllerEventDetail, GraphViewEdge, GraphViewElementEvent, GraphViewElementEventType, GraphViewFitOptions, GraphViewLayoutName, GraphViewMeasurement, GraphViewNode, GraphViewNodeMeasurement, GraphViewNodeRenderContext, GraphViewPoint, GraphViewProps, GraphViewRenderedNode, GraphViewSize, GraphViewStyleRule, GraphViewTopologyUpdatePolicy, GraphViewViewport } from './GraphView.types-0';
@@ -123426,8 +123426,10 @@ function readResizeObserverConstructor() {
123426
123426
  }
123427
123427
 
123428
123428
  // src/features/graph-view/adapters/inbound/web-artifact/getGraphGeometryKey.ts
123429
- function getGraphGeometryKey(cy) {
123429
+ function getGraphGeometryKey(cy, nodeIds) {
123430
123430
  return JSON.stringify(cy.nodes().map((node) => {
123431
+ if (nodeIds !== undefined && !nodeIds.has(node.id()))
123432
+ return null;
123431
123433
  if (node.isParent())
123432
123434
  return [node.id()];
123433
123435
  const labelBounds = node.boundingBox({
@@ -123438,7 +123440,7 @@ function getGraphGeometryKey(cy) {
123438
123440
  includeUnderlays: false
123439
123441
  });
123440
123442
  return [node.id(), node.outerWidth(), node.outerHeight(), labelBounds.w, labelBounds.h];
123441
- }));
123443
+ }).filter((entry) => entry !== null));
123442
123444
  }
123443
123445
 
123444
123446
  // src/features/graph-view/adapters/inbound/web-artifact/getGraphTopologyKey.ts
@@ -123450,8 +123452,30 @@ function getGraphTopologyKey(nodes, edges) {
123450
123452
  }
123451
123453
 
123452
123454
  // src/features/graph-view/adapters/inbound/web-artifact/hasGraphLayoutChanged.ts
123453
- function hasGraphLayoutChanged(previous, input) {
123454
- return previous === null || previous.layout !== input.layout || previous.spacingFactor !== input.spacingFactor || previous.layoutOptions !== input.layoutOptions || previous.richNodeRendering !== input.richNodeRendering || getGraphTopologyKey(previous.nodes, previous.edges) !== getGraphTopologyKey(input.nodes, input.edges);
123455
+ function hasGraphLayoutChanged(previous, input, preservesTopology) {
123456
+ return previous === null || previous.layout !== input.layout || previous.spacingFactor !== input.spacingFactor || previous.layoutOptions !== input.layoutOptions || previous.richNodeRendering !== input.richNodeRendering || !preservesTopology && getGraphTopologyKey(previous.nodes, previous.edges) !== getGraphTopologyKey(input.nodes, input.edges);
123457
+ }
123458
+
123459
+ // src/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.ts
123460
+ var GRID_GAP = 120;
123461
+ function placeAddedGraphNodes(cy, previousNodes, nodes) {
123462
+ const previousNodeIds = new Set(previousNodes.map((node) => node.id));
123463
+ const addedNodes = nodes.filter((node) => !previousNodeIds.has(node.id)).sort((left, right) => left.id.localeCompare(right.id));
123464
+ if (addedNodes.length === 0)
123465
+ return;
123466
+ const retainedNodes = cy.nodes().filter((node) => previousNodeIds.has(node.id()) && !node.isParent());
123467
+ const bounds = retainedNodes.boundingBox({ includeEdges: false, includeLabels: true });
123468
+ const origin = retainedNodes.empty() ? { x: 0, y: 0 } : { x: bounds.x2 + GRID_GAP, y: bounds.y1 };
123469
+ const columns = Math.ceil(Math.sqrt(addedNodes.length));
123470
+ addedNodes.forEach((node, index) => {
123471
+ const graphNode = cy.getElementById(node.id);
123472
+ if (graphNode.empty() || graphNode.isParent())
123473
+ return;
123474
+ graphNode.position({
123475
+ x: origin.x + index % columns * GRID_GAP,
123476
+ y: origin.y + Math.floor(index / columns) * GRID_GAP
123477
+ });
123478
+ });
123455
123479
  }
123456
123480
 
123457
123481
  // src/features/graph-view/adapters/inbound/web-artifact/readGraphRenderedNodes.ts
@@ -124078,9 +124102,14 @@ function updateRuntime(state, input) {
124078
124102
  state.latestUpdateRef.current = input;
124079
124103
  state.fitPaddingRef.current = input.fitPadding ?? 50;
124080
124104
  state.viewport.configure(input);
124105
+ const preservesTopology = shouldPreserveTopology(state, previous, input);
124106
+ const retainedNodeIds = getRetainedNodeIds(previous, input, preservesTopology);
124107
+ const retainedGeometry = retainedNodeIds === null ? null : getGraphGeometryKey(state.cy, retainedNodeIds);
124081
124108
  state.cy.batch(() => {
124082
124109
  if (previous?.nodes !== input.nodes || previous.edges !== input.edges) {
124083
124110
  syncGraphElements(state.cy, input.nodes, input.edges);
124111
+ if (preservesTopology)
124112
+ placeAddedGraphNodes(state.cy, previous?.nodes ?? [], input.nodes);
124084
124113
  }
124085
124114
  if (previous?.styleRules !== input.styleRules || previous?.richNodeRendering !== input.richNodeRendering) {
124086
124115
  state.loopSizer.reset();
@@ -124091,15 +124120,14 @@ function updateRuntime(state, input) {
124091
124120
  applyKnownNodeSizes(state);
124092
124121
  state.loopSizer.update();
124093
124122
  const geometry = getGraphGeometryKey(state.cy);
124094
- const relayout = hasGraphLayoutChanged(previous, input) || geometry !== state.geometryRef.current;
124123
+ const geometryChanged = retainedGeometry === null ? geometry !== state.geometryRef.current : retainedGeometry !== getGraphGeometryKey(state.cy, retainedNodeIds ?? undefined);
124124
+ const relayout = hasGraphLayoutChanged(previous, input, preservesTopology) || geometryChanged;
124095
124125
  state.geometryRef.current = geometry;
124096
124126
  if (!relayout) {
124097
124127
  if (previous?.zoomMode !== input.zoomMode || previous?.fitPadding !== input.fitPadding || previous?.minZoom !== input.minZoom || previous?.maxZoom !== input.maxZoom || previous?.minReadableLabelSize !== input.minReadableLabelSize || previous?.maxFitLabelSize !== input.maxFitLabelSize) {
124098
124128
  state.viewport.settle(previous?.zoomMode !== input.zoomMode);
124099
124129
  }
124100
124130
  emitRenderedNodes(state);
124101
- if (!state.layoutRunningRef.current && !state.pendingInitialFitRef.current)
124102
- state.callbacksRef.current.onLayoutComplete?.(state.controller);
124103
124131
  return;
124104
124132
  }
124105
124133
  stopCurrentLayout(state);
@@ -124107,6 +124135,15 @@ function updateRuntime(state, input) {
124107
124135
  state.optimizedSpacingRef.current = null;
124108
124136
  startCurrentLayout(state, input);
124109
124137
  }
124138
+ function shouldPreserveTopology(state, previous, input) {
124139
+ return previous !== null && state.readyRef.current && !state.pendingInitialFitRef.current && input.topologyUpdatePolicy === "preserve-positions";
124140
+ }
124141
+ function getRetainedNodeIds(previous, input, preservesTopology) {
124142
+ if (!preservesTopology || previous === null)
124143
+ return null;
124144
+ const nextNodeIds = new Set(input.nodes.map((node) => node.id));
124145
+ return new Set(previous.nodes.map((node) => node.id).filter((id) => nextNodeIds.has(id)));
124146
+ }
124110
124147
  function startCurrentLayout(state, input) {
124111
124148
  state.pendingInitialFitRef.current = false;
124112
124149
  const generation = state.generationRef.current + 1;
@@ -124495,7 +124532,8 @@ function useRuntimeGraphUpdate(runtimeRef, props) {
124495
124532
  nodes,
124496
124533
  renderNode,
124497
124534
  spacingFactor,
124498
- styleRules
124535
+ styleRules,
124536
+ topologyUpdatePolicy
124499
124537
  } = props;
124500
124538
  React2.useEffect(() => {
124501
124539
  runtimeRef.current?.update({
@@ -124512,7 +124550,8 @@ function useRuntimeGraphUpdate(runtimeRef, props) {
124512
124550
  nodes,
124513
124551
  richNodeRendering: renderNode !== undefined,
124514
124552
  spacingFactor,
124515
- styleRules
124553
+ styleRules,
124554
+ topologyUpdatePolicy
124516
124555
  });
124517
124556
  }, [
124518
124557
  edges,
@@ -124529,7 +124568,8 @@ function useRuntimeGraphUpdate(runtimeRef, props) {
124529
124568
  renderNode,
124530
124569
  runtimeRef,
124531
124570
  spacingFactor,
124532
- styleRules
124571
+ styleRules,
124572
+ topologyUpdatePolicy
124533
124573
  ]);
124534
124574
  }
124535
124575
  function useRuntimeSelection(runtimeRef, selectedNodeIds) {
@@ -1,6 +1,7 @@
1
1
  import type { SelectionIntent } from '@ankhorage/utility/selection';
2
2
  import type React from 'react';
3
3
  export type GraphViewLayoutName = 'breadthfirst' | 'circle' | 'concentric' | 'elk' | 'grid';
4
+ export type GraphViewTopologyUpdatePolicy = 'preserve-positions';
4
5
  export type GraphViewElementEventType = 'press' | 'double-press' | 'select' | 'unselect' | 'pointer-enter' | 'pointer-leave';
5
6
  export interface GraphViewNode {
6
7
  readonly id: string;
@@ -90,6 +91,12 @@ export interface GraphViewProps {
90
91
  readonly edges: readonly GraphViewEdge[];
91
92
  readonly layout?: GraphViewLayoutName;
92
93
  readonly layoutOptions?: Readonly<Record<string, unknown>>;
94
+ /**
95
+ * Preserve the settled viewport and retained-node positions during controlled topology updates.
96
+ * New nodes receive a deterministic initial position; call controller.fit() or change layout to
97
+ * intentionally fit or relayout the graph. Without this opt-in, topology changes relayout.
98
+ */
99
+ readonly topologyUpdatePolicy?: GraphViewTopologyUpdatePolicy;
93
100
  readonly spacingFactor?: number;
94
101
  readonly styleRules?: readonly GraphViewStyleRule[];
95
102
  readonly selectedNodeIds?: readonly string[];