@skydesign/tf 0.2.3 → 0.3.3

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/dist/index.d.ts CHANGED
@@ -10,6 +10,9 @@ import { RefAttributes } from 'react';
10
10
  */
11
11
  export declare function createLayoutConfig(overrides?: Partial<LayoutConfig>): LayoutConfig;
12
12
 
13
+ /** Fill a partial option set with the shared defaults (same as GraphvizRenderer's props). */
14
+ export declare function createRenderOptions(overrides?: Partial<RenderOptions>): RenderOptions;
15
+
13
16
  /**
14
17
  * Decode a JSON string that may be single or double-encoded.
15
18
  * Tries direct parse first, then falls back to double-parse for double-encoded strings.
@@ -180,7 +183,10 @@ export declare interface GraphvizRendererProps {
180
183
  nodeWidth?: number;
181
184
  /** Custom node height in points (default: 64) */
182
185
  nodeHeight?: number;
183
- /** Custom spacing between node columns in points */
186
+ /**
187
+ * Custom spacing between node columns in points. Omit to auto-compute the
188
+ * tightest spacing that fits the widest edge label (minimal graph width).
189
+ */
184
190
  nodeColumnSpacing?: number;
185
191
  /** Forward click events to elements beneath the SVG (while preserving zoom/pan) */
186
192
  clickPassthrough?: boolean;
@@ -193,6 +199,11 @@ export declare interface GraphvizRendererProps {
193
199
  * static SVG pixel-for-pixel (no jump on handover).
194
200
  */
195
201
  initialTransform?: InitialTransform;
202
+ /**
203
+ * Show a draggable canvas overview (minimap) in the bottom-left corner.
204
+ * Dragging or clicking it pans the main canvas (default: false).
205
+ */
206
+ showMinimap?: boolean;
196
207
  }
197
208
 
198
209
  /**
@@ -233,13 +244,6 @@ export declare interface GraphvizRendererRef {
233
244
  highlightNextEdge: () => void;
234
245
  }
235
246
 
236
- /**
237
- * Render graph using custom SVG based on Graphviz JSON output
238
- * @param maxDepth - Edge depth to filter by (null = show all)
239
- * @param includeLesserDepths - If true, show depth <= maxDepth; if false, show only exact depth
240
- * @param config - Layout configuration
241
- * @returns Object containing zoom behavior and SVG references for imperative control
242
- */
243
247
  /** Pan/zoom transform: g = translate(x,y) scale(k). */
244
248
  export declare interface InitialTransform {
245
249
  x: number;
@@ -314,38 +318,69 @@ declare interface NodeMapping_2 {
314
318
  targetNodeId: string;
315
319
  }
316
320
 
317
- export declare function renderCustomGraph(container: HTMLDivElement, json: GraphvizJson, _nodeMapping?: Record<string, NodeMapping_2>, maxDepth?: number | null, includeLesserDepths?: boolean, config?: LayoutConfig, useOrthogonalRendering?: boolean, svgFontSize?: number, debug?: boolean, selectedEdgeId?: number | null, onEdgeSelect?: (edgeIndex: number | null) => void, nodeWidth?: number, nodeHeight?: number, nodeColumnSpacing?: number, enableWheelZoom?: boolean, extra?: RenderExtraOptions): {
318
- zoomBehavior: d3_2.ZoomBehavior<SVGSVGElement, unknown>;
319
- svgElement: SVGSVGElement;
320
- gElement: SVGGElement;
321
- baseFontSize: number;
322
- viewBoxWidth: number;
323
- edges: EdgeInfo[];
324
- initialTransform: InitialTransform;
325
- };
321
+ /**
322
+ * Render graph using custom SVG based on Graphviz JSON output.
323
+ * @returns Zoom behavior and SVG references for imperative control.
324
+ */
325
+ export declare function renderCustomGraph(container: HTMLDivElement, json: GraphvizJson, options: RenderOptions): RenderResult;
326
326
 
327
- export declare interface RenderExtraOptions {
327
+ /** Complete option set for renderCustomGraph. Build via {@link createRenderOptions}. */
328
+ export declare interface RenderOptions {
329
+ /** Edge-id → source/target mapping supplied by the consumer (reserved for future use). */
330
+ nodeMapping: Record<string, NodeMapping_2>;
331
+ /** Edge depth to filter by (null = show all). */
332
+ maxDepth: number | null;
333
+ /** If true, show depth <= maxDepth; if false, show only the exact depth. */
334
+ includeLesserDepths: boolean;
335
+ /** Layout configuration (spacing, arrow, label metrics). */
336
+ config: LayoutConfig;
337
+ /** Orthogonal edge routing (true) vs direct bezier connections (false). */
338
+ useOrthogonalRendering: boolean;
339
+ /** Base font size used for zoom-scale calculations. */
340
+ svgFontSize: number;
341
+ /** Render debug markers (base-edge highlighting, midpoints, bounds). */
342
+ debug: boolean;
343
+ /** Currently selected edge index, or null. */
344
+ selectedEdgeId: number | null;
345
+ /** Edge selection callback; undefined disables click-to-select. */
346
+ onEdgeSelect: ((edgeIndex: number | null) => void) | undefined;
347
+ /** Node box width in points; null keeps the graphviz-computed width. */
348
+ nodeWidth: number | null;
349
+ /** Node box height in points; null keeps the graphviz-computed height. */
350
+ nodeHeight: number | null;
351
+ /**
352
+ * Fixed column spacing in points; null (default) computes the tightest
353
+ * spacing that fits the widest edge label, minimizing total graph width.
354
+ */
355
+ nodeColumnSpacing: number | null;
356
+ /** Enable wheel/double-click zoom. */
357
+ enableWheelZoom: boolean;
328
358
  /**
329
359
  * Headless (Node / SSR) mode. Skips the d3-zoom attachment and never calls
330
360
  * `getBBox`/`getComputedTextLength`; bakes a deterministic initial transform
331
361
  * straight onto `<g>` so the SVG can be serialized to a string. Geometry is
332
362
  * fully determined by the graphviz JSON, so it matches the browser render.
333
363
  */
334
- headless?: boolean;
364
+ headless: boolean;
335
365
  /**
336
366
  * Use this exact initial transform instead of measuring the fit via
337
367
  * `getBBox`. Pass the `initialTransform` returned from a headless render so
338
368
  * the hydrated interactive graph lines up with the SSR'd SVG pixel-for-pixel
339
369
  * (no jump on handover). When omitted in non-headless mode, the legacy
340
- * getBBox-based fit is used (unchanged behavior for existing callers).
370
+ * getBBox-based fit is used.
341
371
  */
342
- initialTransform?: InitialTransform;
372
+ initialTransform: InitialTransform | undefined;
343
373
  }
344
374
 
345
- /**
346
- * Setup zoom and pan for graphviz native SVG rendering
347
- */
348
- export declare function setupZoomPan(container: HTMLDivElement): void;
375
+ declare interface RenderResult {
376
+ zoomBehavior: d3_2.ZoomBehavior<SVGSVGElement, unknown>;
377
+ svgElement: SVGSVGElement;
378
+ gElement: SVGGElement;
379
+ baseFontSize: number;
380
+ viewBoxWidth: number;
381
+ edges: EdgeInfo[];
382
+ initialTransform: InitialTransform;
383
+ }
349
384
 
350
385
  /**
351
386
  * Text element with optional color and background