@ankhorage/zora 22.0.82 → 22.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 22.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 903db75: Update dependencies: `@ankhorage/utility`.
8
+
9
+ ## 22.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 7439ab2: Expose rendered GraphView node measurements through the public controller so consumers can compare selected node geometry with the viewport without accessing the backing renderer.
14
+
3
15
  ## 22.0.82
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/zora
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v22.0.82](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v22.1.1](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
7
7
 
8
8
  Opinionated React Native and React Native Web UI kit built on @ankhorage/surface.
9
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"createGraphController.d.ts","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/createGraphController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAChG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAGhF,kGAAkG;AAClG,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,IAAI,EACR,aAAa,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAClC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI;;qBA8CjC,kBAAkB;gBASvB,OAAO;EAwBtB"}
1
+ {"version":3,"file":"createGraphController.d.ts","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/createGraphController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EAEpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAGhF,kGAAkG;AAClG,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,IAAI,EACR,aAAa,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAClC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI;;qBAiDjC,kBAAkB;gBASvB,OAAO;EAwBtB"}
@@ -22,6 +22,9 @@ export function createGraphController(cy, fitPaddingRef, optimizeFit) {
22
22
  padding: options?.padding ?? fitPaddingRef.current,
23
23
  }, state.fitZoom);
24
24
  },
25
+ measureNodes(nodeIds) {
26
+ return measureRenderedNodes(cy, nodeIds);
27
+ },
25
28
  getViewport() {
26
29
  return { pan: cy.pan(), zoom: cy.zoom() / state.scale };
27
30
  },
@@ -76,6 +79,26 @@ export function createGraphController(cy, fitPaddingRef, optimizeFit) {
76
79
  },
77
80
  };
78
81
  }
82
+ /*** Measure rendered node geometry for public consumers while keeping Cytoscape private. */
83
+ function measureRenderedNodes(cy, nodeIds) {
84
+ const viewport = { width: cy.width(), height: cy.height() };
85
+ if (viewport.width <= 0 || viewport.height <= 0 || nodeIds.length === 0)
86
+ return null;
87
+ const nodes = [...new Set(nodeIds)].flatMap((id) => {
88
+ const node = cy.getElementById(id);
89
+ if (!node.isNode())
90
+ return [];
91
+ const bounds = node.renderedBoundingBox();
92
+ return [
93
+ {
94
+ id,
95
+ position: node.renderedPosition(),
96
+ size: { width: bounds.w, height: bounds.h },
97
+ },
98
+ ];
99
+ });
100
+ return nodes.length === 0 ? null : { nodes, viewport };
101
+ }
79
102
  /*** Keep pointer, wheel, and programmatic zoom on the same limits in the engine's native units. */
80
103
  function applyZoomLimits(cy, state) {
81
104
  const min = state.min * state.scale;
@@ -1 +1 @@
1
- {"version":3,"file":"createGraphController.js","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/createGraphController.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,kGAAkG;AAClG,MAAM,UAAU,qBAAqB,CACnC,EAAQ,EACR,aAAkC,EAClC,WAAoD;IAEpD,MAAM,KAAK,GAAG;QACZ,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,KAAK;QACf,GAAG,EAAE,IAAI;QACT,GAAG,EAAE,CAAC;QACN,YAAY,EAAE,CAAC;QACf,OAAO,EAAE,QAAQ;QACjB,YAAY,EAAE,CAAC;QACf,OAAO,EAAE,QAAQ;KAClB,CAAC;IACF,MAAM,UAAU,GAAwB;QACtC,GAAG,CAAC,OAAO;YACT,IAAI,OAAO,EAAE,eAAe,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,CAAC;gBACxE,WAAW,CAAC,OAAO,CAAC,CAAC;gBACrB,OAAO;YACT,CAAC;YACD,gBAAgB,CACd,EAAE,EACF;gBACE,OAAO,EAAE,OAAO,EAAE,OAAO;gBACzB,OAAO,EAAE,OAAO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OAAO,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,CAAC;IACxC,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC;IACvC,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC;IACzC,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAC1E,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,+EAA+E;AAC/E,SAAS,eAAe,CAAC,EAAQ,EAAE,IAAY;IAC7C,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import type { Core } from 'cytoscape';\n\nimport type { GraphViewController, GraphViewFitOptions } from '../../../../../types/graph-view';\nimport type { GraphRuntimeUpdate } from '../../../../../types/graphViewRuntime';\nimport { fitGraphViewport } from './fitGraphViewport';\n\n/*** Own viewport units and limits alongside the public controller, without exposing Cytoscape. */\nexport function createGraphController(\n cy: Core,\n fitPaddingRef: { current: number },\n optimizeFit?: (options: GraphViewFitOptions) => void,\n) {\n const state = {\n scale: 1,\n relative: false,\n min: 0.05,\n max: 2,\n readableSize: 0,\n fitSize: Infinity,\n readableZoom: 0,\n fitZoom: Infinity,\n };\n const controller: GraphViewController = {\n fit(options) {\n if (options?.optimizeSpacing && !options.nodeIds?.length && optimizeFit) {\n optimizeFit(options);\n return;\n }\n fitGraphViewport(\n cy,\n {\n nodeIds: options?.nodeIds,\n padding: options?.padding ?? fitPaddingRef.current,\n },\n state.fitZoom,\n );\n },\n getViewport() {\n return { pan: cy.pan(), zoom: cy.zoom() / state.scale };\n },\n getZoomRange() {\n return { min: cy.minZoom() / state.scale, max: cy.maxZoom() / state.scale };\n },\n setPan(pan) {\n cy.pan(pan);\n },\n setZoom(zoom) {\n setCenteredZoom(cy, zoom * state.scale);\n },\n zoomBy(factor) {\n setCenteredZoom(cy, cy.zoom() * factor);\n },\n };\n\n return {\n controller,\n configure(input: GraphRuntimeUpdate) {\n state.relative = input.zoomMode === 'fit-relative';\n state.min = input.minZoom ?? 0.05;\n state.max = input.maxZoom ?? 2;\n state.readableSize = positiveSize(input.minReadableLabelSize, 0);\n state.fitSize = positiveSize(input.maxFitLabelSize, Infinity);\n if (!state.relative) state.scale = 1;\n applyZoomLimits(cy, state);\n },\n settle(fit: boolean) {\n const logicalZoom = cy.zoom() / state.scale;\n const fonts = cy\n .nodes()\n .filter((node) => !node.isParent() && Boolean(node.style('label')))\n .map((node) => Number.parseFloat(String(node.style('font-size'))))\n .filter((size) => Number.isFinite(size) && size > 0);\n state.readableZoom = fonts.length\n ? state.readableSize / fonts.reduce((minimum, size) => Math.min(minimum, size), Infinity)\n : 0;\n state.fitZoom = fonts.length\n ? state.fitSize / fonts.reduce((maximum, size) => Math.max(maximum, size), 0)\n : Infinity;\n state.scale = state.relative\n ? Math.min(getNodeFitZoom(cy, fitPaddingRef.current), state.fitZoom)\n : 1;\n applyZoomLimits(cy, state);\n if (fit) controller.fit();\n else if (state.relative) {\n setCenteredZoom(cy, logicalZoom * state.scale);\n cy.center(cy.nodes());\n }\n },\n };\n}\n\n/*** Keep pointer, wheel, and programmatic zoom on the same limits in the engine's native units. */\nfunction applyZoomLimits(\n cy: Core,\n state: {\n readonly min: number;\n readonly max: number;\n readonly scale: number;\n readonly readableZoom: number;\n },\n) {\n const min = state.min * state.scale;\n cy.minZoom(Math.min(cy.minZoom(), min));\n cy.maxZoom(Math.max(min, state.max * state.scale, state.readableZoom));\n cy.minZoom(min);\n}\n\n/*** Ignore invalid optional typography targets at the public configuration boundary. */\nfunction positiveSize(value: number | undefined, fallback: number): number {\n return value !== undefined && Number.isFinite(value) && value > 0 ? value : fallback;\n}\n\n/***\n * Recompute the fit reference only after layout or resize, never on every pan/zoom event.\n * Cache the geometry-derived scale in the viewport owner; labels are included, edges excluded.\n */\nfunction getNodeFitZoom(cy: Core, padding: number): number {\n if (cy.nodes().empty()) return 1;\n const bounds = cy.nodes().boundingBox();\n const width = cy.width() - 2 * padding;\n const height = cy.height() - 2 * padding;\n if (width <= 0 || height <= 0 || bounds.w <= 0 || bounds.h <= 0) return 1;\n return Math.min(width / bounds.w, height / bounds.h);\n}\n\n/*** Zoom around the visible viewport center instead of its top-left corner. */\nfunction setCenteredZoom(cy: Core, zoom: number) {\n cy.zoom({ level: zoom, renderedPosition: { x: cy.width() / 2, y: cy.height() / 2 } });\n}\n"]}
1
+ {"version":3,"file":"createGraphController.js","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/createGraphController.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,kGAAkG;AAClG,MAAM,UAAU,qBAAqB,CACnC,EAAQ,EACR,aAAkC,EAClC,WAAoD;IAEpD,MAAM,KAAK,GAAG;QACZ,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,KAAK;QACf,GAAG,EAAE,IAAI;QACT,GAAG,EAAE,CAAC;QACN,YAAY,EAAE,CAAC;QACf,OAAO,EAAE,QAAQ;QACjB,YAAY,EAAE,CAAC;QACf,OAAO,EAAE,QAAQ;KAClB,CAAC;IACF,MAAM,UAAU,GAAwB;QACtC,GAAG,CAAC,OAAO;YACT,IAAI,OAAO,EAAE,eAAe,IAAI,CAAC,OAAO,CAAC,OAAO,EA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AC,KAAK,EAAE;QAAE,OAAO,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,CAAC;IACxC,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC;IACvC,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC;IACzC,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAC1E,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,+EAA+E;AAC/E,SAAS,eAAe,CAAC,EAAQ,EAAE,IAAY;IAC7C,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import type { Core } from 'cytoscape';\n\nimport type {\n GraphViewController,\n GraphViewFitOptions,\n GraphViewMeasurement,\n} from '../../../../../types/graph-view';\nimport type { GraphRuntimeUpdate } from '../../../../../types/graphViewRuntime';\nimport { fitGraphViewport } from './fitGraphViewport';\n\n/*** Own viewport units and limits alongside the public controller, without exposing Cytoscape. */\nexport function createGraphController(\n cy: Core,\n fitPaddingRef: { current: number },\n optimizeFit?: (options: GraphViewFitOptions) => void,\n) {\n const state = {\n scale: 1,\n relative: false,\n min: 0.05,\n max: 2,\n readableSize: 0,\n fitSize: Infinity,\n readableZoom: 0,\n fitZoom: Infinity,\n };\n const controller: GraphViewController = {\n fit(options) {\n if (options?.optimizeSpacing && !options.nodeIds?.length && optimizeFit) {\n optimizeFit(options);\n return;\n }\n fitGraphViewport(\n cy,\n {\n nodeIds: options?.nodeIds,\n padding: options?.padding ?? fitPaddingRef.current,\n },\n state.fitZoom,\n );\n },\n measureNodes(nodeIds) {\n return measureRenderedNodes(cy, nodeIds);\n },\n getViewport() {\n return { pan: cy.pan(), zoom: cy.zoom() / state.scale };\n },\n getZoomRange() {\n return { min: cy.minZoom() / state.scale, max: cy.maxZoom() / state.scale };\n },\n setPan(pan) {\n cy.pan(pan);\n },\n setZoom(zoom) {\n setCenteredZoom(cy, zoom * state.scale);\n },\n zoomBy(factor) {\n setCenteredZoom(cy, cy.zoom() * factor);\n },\n };\n\n return {\n controller,\n configure(input: GraphRuntimeUpdate) {\n state.relative = input.zoomMode === 'fit-relative';\n state.min = input.minZoom ?? 0.05;\n state.max = input.maxZoom ?? 2;\n state.readableSize = positiveSize(input.minReadableLabelSize, 0);\n state.fitSize = positiveSize(input.maxFitLabelSize, Infinity);\n if (!state.relative) state.scale = 1;\n applyZoomLimits(cy, state);\n },\n settle(fit: boolean) {\n const logicalZoom = cy.zoom() / state.scale;\n const fonts = cy\n .nodes()\n .filter((node) => !node.isParent() && Boolean(node.style('label')))\n .map((node) => Number.parseFloat(String(node.style('font-size'))))\n .filter((size) => Number.isFinite(size) && size > 0);\n state.readableZoom = fonts.length\n ? state.readableSize / fonts.reduce((minimum, size) => Math.min(minimum, size), Infinity)\n : 0;\n state.fitZoom = fonts.length\n ? state.fitSize / fonts.reduce((maximum, size) => Math.max(maximum, size), 0)\n : Infinity;\n state.scale = state.relative\n ? Math.min(getNodeFitZoom(cy, fitPaddingRef.current), state.fitZoom)\n : 1;\n applyZoomLimits(cy, state);\n if (fit) controller.fit();\n else if (state.relative) {\n setCenteredZoom(cy, logicalZoom * state.scale);\n cy.center(cy.nodes());\n }\n },\n };\n}\n\n/*** Measure rendered node geometry for public consumers while keeping Cytoscape private. */\nfunction measureRenderedNodes(cy: Core, nodeIds: readonly string[]): GraphViewMeasurement | null {\n const viewport = { width: cy.width(), height: cy.height() };\n if (viewport.width <= 0 || viewport.height <= 0 || nodeIds.length === 0) return null;\n\n const nodes = [...new Set(nodeIds)].flatMap((id) => {\n const node = cy.getElementById(id);\n if (!node.isNode()) return [];\n\n const bounds = node.renderedBoundingBox();\n return [\n {\n id,\n position: node.renderedPosition(),\n size: { width: bounds.w, height: bounds.h },\n },\n ];\n });\n return nodes.length === 0 ? null : { nodes, viewport };\n}\n\n/*** Keep pointer, wheel, and programmatic zoom on the same limits in the engine's native units. */\nfunction applyZoomLimits(\n cy: Core,\n state: {\n readonly min: number;\n readonly max: number;\n readonly scale: number;\n readonly readableZoom: number;\n },\n) {\n const min = state.min * state.scale;\n cy.minZoom(Math.min(cy.minZoom(), min));\n cy.maxZoom(Math.max(min, state.max * state.scale, state.readableZoom));\n cy.minZoom(min);\n}\n\n/*** Ignore invalid optional typography targets at the public configuration boundary. */\nfunction positiveSize(value: number | undefined, fallback: number): number {\n return value !== undefined && Number.isFinite(value) && value > 0 ? value : fallback;\n}\n\n/***\n * Recompute the fit reference only after layout or resize, never on every pan/zoom event.\n * Cache the geometry-derived scale in the viewport owner; labels are included, edges excluded.\n */\nfunction getNodeFitZoom(cy: Core, padding: number): number {\n if (cy.nodes().empty()) return 1;\n const bounds = cy.nodes().boundingBox();\n const width = cy.width() - 2 * padding;\n const height = cy.height() - 2 * padding;\n if (width <= 0 || height <= 0 || bounds.w <= 0 || bounds.h <= 0) return 1;\n return Math.min(width / bounds.w, height / bounds.h);\n}\n\n/*** Zoom around the visible viewport center instead of its top-left corner. */\nfunction setCenteredZoom(cy: Core, zoom: number) {\n cy.zoom({ level: zoom, renderedPosition: { x: cy.width() / 2, y: cy.height() / 2 } });\n}\n"]}
@@ -1,3 +1,3 @@
1
- export type { GraphViewCallbacks, GraphViewController, GraphViewEdge, GraphViewElementEvent, GraphViewElementEventType, GraphViewFitOptions, GraphViewLayoutName, GraphViewNode, GraphViewNodeRenderContext, GraphViewPoint, GraphViewProps, GraphViewRenderedNode, GraphViewSize, GraphViewStyleRule, GraphViewViewport, } from '../../types/graph-view';
1
+ export type { GraphViewCallbacks, GraphViewController, GraphViewEdge, GraphViewElementEvent, GraphViewElementEventType, GraphViewFitOptions, GraphViewLayoutName, GraphViewMeasurement, GraphViewNode, GraphViewNodeMeasurement, GraphViewNodeRenderContext, GraphViewPoint, GraphViewProps, GraphViewRenderedNode, GraphViewSize, GraphViewStyleRule, GraphViewViewport, } from '../../types/graph-view';
2
2
  export { GraphView } from './adapters/inbound/web-artifact/GraphView';
3
3
  //# sourceMappingURL=public.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/graph-view/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,0BAA0B,EAC1B,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/graph-view/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,wBAAwB,EACxB,0BAA0B,EAC1B,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/graph-view/public.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC","sourcesContent":["export type {\n GraphViewCallbacks,\n GraphViewController,\n GraphViewEdge,\n GraphViewElementEvent,\n GraphViewElementEventType,\n GraphViewFitOptions,\n GraphViewLayoutName,\n GraphViewNode,\n GraphViewNodeRenderContext,\n GraphViewPoint,\n GraphViewProps,\n GraphViewRenderedNode,\n GraphViewSize,\n GraphViewStyleRule,\n GraphViewViewport,\n} from '../../types/graph-view';\nexport { GraphView } from './adapters/inbound/web-artifact/GraphView';\n"]}
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/graph-view/public.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC","sourcesContent":["export type {\n GraphViewCallbacks,\n GraphViewController,\n GraphViewEdge,\n GraphViewElementEvent,\n GraphViewElementEventType,\n GraphViewFitOptions,\n GraphViewLayoutName,\n GraphViewMeasurement,\n GraphViewNode,\n GraphViewNodeMeasurement,\n GraphViewNodeRenderContext,\n GraphViewPoint,\n GraphViewProps,\n GraphViewRenderedNode,\n GraphViewSize,\n GraphViewStyleRule,\n GraphViewViewport,\n} from '../../types/graph-view';\nexport { GraphView } from './adapters/inbound/web-artifact/GraphView';\n"]}
@@ -40,6 +40,15 @@ export interface GraphViewRenderedNode {
40
40
  readonly selected: boolean;
41
41
  readonly zoom: number;
42
42
  }
43
+ export interface GraphViewNodeMeasurement {
44
+ readonly id: string;
45
+ readonly position: GraphViewPoint;
46
+ readonly size: GraphViewSize;
47
+ }
48
+ export interface GraphViewMeasurement {
49
+ readonly nodes: readonly GraphViewNodeMeasurement[];
50
+ readonly viewport: GraphViewSize;
51
+ }
43
52
  export interface GraphViewViewport {
44
53
  readonly zoom: number;
45
54
  readonly pan: GraphViewPoint;
@@ -56,6 +65,8 @@ export interface GraphViewElementEvent {
56
65
  }
57
66
  export interface GraphViewController {
58
67
  fit(options?: GraphViewFitOptions): void;
68
+ /** Measure rendered node geometry without exposing the backing graph engine. */
69
+ measureNodes?(nodeIds: readonly string[]): GraphViewMeasurement | null;
59
70
  getViewport(): GraphViewViewport;
60
71
  getZoomRange(): {
61
72
  readonly min: number;
@@ -1 +1 @@
1
- {"version":3,"file":"graph-view.d.ts","sourceRoot":"","sources":["../../src/types/graph-view.ts"],"names":[],"mappings":"AAAA,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,GAAG,QAAQ,GAAG,UAAU,GAAG,eAAe,GAAG,eAAe,CAAC;AAEvF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B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,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,uFAAuF;IACvF,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC;IAChD,2FAA2F;IAC3F,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC7D,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACtE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC9D,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC9D,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAClE,QAAQ,CAAC,qBAAqB,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 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 GraphViewViewport {\n readonly zoom: number;\n readonly pan: GraphViewPoint;\n}\n\nexport interface GraphViewFitOptions {\n /** Optimize existing layout spacing without rerunning its algorithm; whole-graph fits only. */\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}\n\nexport interface GraphViewController {\n fit(options?: GraphViewFitOptions): void;\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\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 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 /** Optimize existing layout spacing without rerunning its algorithm; whole-graph fits only. */\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}\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\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"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/zora",
3
3
  "type": "module",
4
- "version": "22.0.82",
4
+ "version": "22.1.1",
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": {
@@ -45,7 +45,7 @@
45
45
  "@ankhorage/game": "^0.1.2",
46
46
  "@ankhorage/runtime": "^3.0.59",
47
47
  "@ankhorage/surface": "^9.1.112",
48
- "@ankhorage/utility": "^1.9.82",
48
+ "@ankhorage/utility": "^1.9.83",
49
49
  "expo-document-picker": "~57.0.3",
50
50
  "expo-image-picker": "~57.0.20",
51
51
  "chess.js": "^1.4.0"
@@ -124,7 +124,7 @@
124
124
  "version-packages": "ankhorage-changeset version"
125
125
  },
126
126
  "devDependencies": {
127
- "@ankhorage/devtools": "^2.1.6",
127
+ "@ankhorage/devtools": "^2.1.7",
128
128
  "@ankhorage/paradox": "^0.2.27",
129
129
  "@react-native-vector-icons/fontawesome": "^13.1.4",
130
130
  "@react-native-vector-icons/fontawesome5": "^13.1.4",
@@ -105,3 +105,42 @@ test('caps automatic label size for tiny graphs and expands manual zoom for larg
105
105
  cy.destroy();
106
106
  }
107
107
  });
108
+
109
+ test('measures requested rendered nodes without exposing Cytoscape', () => {
110
+ const cy = cytoscape({
111
+ headless: true,
112
+ styleEnabled: true,
113
+ layout: { name: 'preset' },
114
+ elements: [
115
+ { data: { id: 'a' }, position: { x: 40, y: 60 } },
116
+ { data: { id: 'b' }, position: { x: 240, y: 180 } },
117
+ ],
118
+ style: [{ selector: 'node', style: { width: 40, height: 30 } }],
119
+ });
120
+ cy.width = () => 800;
121
+ cy.height = () => 600;
122
+ const { controller } = createGraphController(cy, { current: 50 });
123
+
124
+ try {
125
+ const measurement = controller.measureNodes?.(['a', 'missing']);
126
+ const node = cy.getElementById('a');
127
+ const bounds = node.renderedBoundingBox();
128
+
129
+ expect(measurement).toEqual({
130
+ viewport: { width: 800, height: 600 },
131
+ nodes: [
132
+ {
133
+ id: 'a',
134
+ position: node.renderedPosition(),
135
+ size: { width: bounds.w, height: bounds.h },
136
+ },
137
+ ],
138
+ });
139
+ expect(controller.measureNodes?.([])).toBeNull();
140
+
141
+ cy.width = () => 0;
142
+ expect(controller.measureNodes?.(['a'])).toBeNull();
143
+ } finally {
144
+ cy.destroy();
145
+ }
146
+ });
@@ -1,6 +1,10 @@
1
1
  import type { Core } from 'cytoscape';
2
2
 
3
- import type { GraphViewController, GraphViewFitOptions } from '../../../../../types/graph-view';
3
+ import type {
4
+ GraphViewController,
5
+ GraphViewFitOptions,
6
+ GraphViewMeasurement,
7
+ } from '../../../../../types/graph-view';
4
8
  import type { GraphRuntimeUpdate } from '../../../../../types/graphViewRuntime';
5
9
  import { fitGraphViewport } from './fitGraphViewport';
6
10
 
@@ -35,6 +39,9 @@ export function createGraphController(
35
39
  state.fitZoom,
36
40
  );
37
41
  },
42
+ measureNodes(nodeIds) {
43
+ return measureRenderedNodes(cy, nodeIds);
44
+ },
38
45
  getViewport() {
39
46
  return { pan: cy.pan(), zoom: cy.zoom() / state.scale };
40
47
  },
@@ -89,6 +96,27 @@ export function createGraphController(
89
96
  };
90
97
  }
91
98
 
99
+ /*** Measure rendered node geometry for public consumers while keeping Cytoscape private. */
100
+ function measureRenderedNodes(cy: Core, nodeIds: readonly string[]): GraphViewMeasurement | null {
101
+ const viewport = { width: cy.width(), height: cy.height() };
102
+ if (viewport.width <= 0 || viewport.height <= 0 || nodeIds.length === 0) return null;
103
+
104
+ const nodes = [...new Set(nodeIds)].flatMap((id) => {
105
+ const node = cy.getElementById(id);
106
+ if (!node.isNode()) return [];
107
+
108
+ const bounds = node.renderedBoundingBox();
109
+ return [
110
+ {
111
+ id,
112
+ position: node.renderedPosition(),
113
+ size: { width: bounds.w, height: bounds.h },
114
+ },
115
+ ];
116
+ });
117
+ return nodes.length === 0 ? null : { nodes, viewport };
118
+ }
119
+
92
120
  /*** Keep pointer, wheel, and programmatic zoom on the same limits in the engine's native units. */
93
121
  function applyZoomLimits(
94
122
  cy: Core,
@@ -6,7 +6,9 @@ export type {
6
6
  GraphViewElementEventType,
7
7
  GraphViewFitOptions,
8
8
  GraphViewLayoutName,
9
+ GraphViewMeasurement,
9
10
  GraphViewNode,
11
+ GraphViewNodeMeasurement,
10
12
  GraphViewNodeRenderContext,
11
13
  GraphViewPoint,
12
14
  GraphViewProps,
@@ -50,6 +50,17 @@ export interface GraphViewRenderedNode {
50
50
  readonly zoom: number;
51
51
  }
52
52
 
53
+ export interface GraphViewNodeMeasurement {
54
+ readonly id: string;
55
+ readonly position: GraphViewPoint;
56
+ readonly size: GraphViewSize;
57
+ }
58
+
59
+ export interface GraphViewMeasurement {
60
+ readonly nodes: readonly GraphViewNodeMeasurement[];
61
+ readonly viewport: GraphViewSize;
62
+ }
63
+
53
64
  export interface GraphViewViewport {
54
65
  readonly zoom: number;
55
66
  readonly pan: GraphViewPoint;
@@ -69,6 +80,8 @@ export interface GraphViewElementEvent {
69
80
 
70
81
  export interface GraphViewController {
71
82
  fit(options?: GraphViewFitOptions): void;
83
+ /** Measure rendered node geometry without exposing the backing graph engine. */
84
+ measureNodes?(nodeIds: readonly string[]): GraphViewMeasurement | null;
72
85
  getViewport(): GraphViewViewport;
73
86
  getZoomRange(): { readonly min: number; readonly max: number };
74
87
  setPan(pan: GraphViewPoint): void;
@@ -16,4 +16,4 @@ import type { GraphViewProps } from './GraphView.types-0';
16
16
  * cramped layouts but cannot repair non-uniform overlaps.
17
17
  */
18
18
  export declare function GraphView(props: GraphViewProps): React.JSX.Element;
19
- export type { GraphViewCallbacks, GraphViewController, GraphViewEdge, GraphViewElementEvent, GraphViewElementEventType, GraphViewFitOptions, GraphViewLayoutName, GraphViewNode, GraphViewNodeRenderContext, GraphViewPoint, GraphViewProps, GraphViewRenderedNode, GraphViewSize, GraphViewStyleRule, GraphViewViewport } from './GraphView.types-0';
19
+ export type { GraphViewCallbacks, GraphViewController, GraphViewEdge, GraphViewElementEvent, GraphViewElementEventType, GraphViewFitOptions, GraphViewLayoutName, GraphViewMeasurement, GraphViewNode, GraphViewNodeMeasurement, GraphViewNodeRenderContext, GraphViewPoint, GraphViewProps, GraphViewRenderedNode, GraphViewSize, GraphViewStyleRule, GraphViewViewport } from './GraphView.types-0';
@@ -122630,6 +122630,9 @@ function createGraphController(cy, fitPaddingRef, optimizeFit) {
122630
122630
  padding: options?.padding ?? fitPaddingRef.current
122631
122631
  }, state.fitZoom);
122632
122632
  },
122633
+ measureNodes(nodeIds) {
122634
+ return measureRenderedNodes(cy, nodeIds);
122635
+ },
122633
122636
  getViewport() {
122634
122637
  return { pan: cy.pan(), zoom: cy.zoom() / state.scale };
122635
122638
  },
@@ -122674,6 +122677,25 @@ function createGraphController(cy, fitPaddingRef, optimizeFit) {
122674
122677
  }
122675
122678
  };
122676
122679
  }
122680
+ function measureRenderedNodes(cy, nodeIds) {
122681
+ const viewport = { width: cy.width(), height: cy.height() };
122682
+ if (viewport.width <= 0 || viewport.height <= 0 || nodeIds.length === 0)
122683
+ return null;
122684
+ const nodes = [...new Set(nodeIds)].flatMap((id) => {
122685
+ const node = cy.getElementById(id);
122686
+ if (!node.isNode())
122687
+ return [];
122688
+ const bounds = node.renderedBoundingBox();
122689
+ return [
122690
+ {
122691
+ id,
122692
+ position: node.renderedPosition(),
122693
+ size: { width: bounds.w, height: bounds.h }
122694
+ }
122695
+ ];
122696
+ });
122697
+ return nodes.length === 0 ? null : { nodes, viewport };
122698
+ }
122677
122699
  function applyZoomLimits(cy, state) {
122678
122700
  const min = state.min * state.scale;
122679
122701
  cy.minZoom(Math.min(cy.minZoom(), min));
@@ -40,6 +40,15 @@ export interface GraphViewRenderedNode {
40
40
  readonly selected: boolean;
41
41
  readonly zoom: number;
42
42
  }
43
+ export interface GraphViewNodeMeasurement {
44
+ readonly id: string;
45
+ readonly position: GraphViewPoint;
46
+ readonly size: GraphViewSize;
47
+ }
48
+ export interface GraphViewMeasurement {
49
+ readonly nodes: readonly GraphViewNodeMeasurement[];
50
+ readonly viewport: GraphViewSize;
51
+ }
43
52
  export interface GraphViewViewport {
44
53
  readonly zoom: number;
45
54
  readonly pan: GraphViewPoint;
@@ -56,6 +65,8 @@ export interface GraphViewElementEvent {
56
65
  }
57
66
  export interface GraphViewController {
58
67
  fit(options?: GraphViewFitOptions): void;
68
+ /** Measure rendered node geometry without exposing the backing graph engine. */
69
+ measureNodes?(nodeIds: readonly string[]): GraphViewMeasurement | null;
59
70
  getViewport(): GraphViewViewport;
60
71
  getZoomRange(): {
61
72
  readonly min: number;