export type ForceGraphTone = "category1" | "category2" | "category3" | "category4" | "category5" | "category6" | "category7" | "category8"; export type ForceGraphNodeShape = "dot" | "circle" | "diamond" | "star" | "hexagon" | "box" | "square" | "roundedbox" | "triangle"; /** Stroke dash style for typed edges. */ export type ForceGraphEdgeDash = "solid" | "dashed" | "dotted" | "long-dash"; export type ForceGraphNode = { /** Stable identifier; referenced by edges. */ id: string; /** Visible label (falls back to id). */ label?: string; /** * Grouping key (e.g. node type or community). Nodes sharing a group get * the same tone when `tone` is not set explicitly. */ group?: string | number; /** Explicit data-vis tone; overrides the group-derived tone. */ tone?: ForceGraphTone; /** Relative node radius weight (defaults to 1). */ weight?: number; /** Pin the node to a fixed position (ignored by the simulation). */ fx?: number; fy?: number; /** * Visual shape for the node. Defaults to 'dot' (circle). * Supported: 'dot'|'circle', 'diamond', 'star', 'hexagon', 'box'|'square', 'triangle'. */ shape?: ForceGraphNodeShape; }; export type ForceGraphEdge = { /** Source node id. */ source: string; /** Target node id. */ target: string; /** Optional relation label, surfaced in the tooltip on hover/focus. */ relation?: string; /** * When true the link renders as a dashed/faded "weak" link. Lets callers * map a confidence dimension onto link strength without extra props. * Equivalent to `dash: "dashed"` plus a faded stroke (kept for back-compat). */ weak?: boolean; /** * Typed dash pattern for the stroke. Independent of `weak`. * "solid" = none, "dashed" = "6 4", "dotted" = "1 4", "long-dash" = "12 6". * When omitted, falls back to the `weak` styling. */ dash?: ForceGraphEdgeDash; /** * Emphasise the edge (e.g. a reconciliation/match relation) with a thicker, * fully-opaque stroke. Defaults to false. */ emphasis?: boolean; /** Explicit stroke width override in px. Takes precedence over `emphasis`. */ width?: number; }; export type ForceGraphLegendEntry = { /** Label shown in the legend. */ label: string; /** Shape for this entry (node legend). Absent = line-style legend entry. */ shape?: ForceGraphNodeShape; /** Tone for this entry. Defaults to category1. */ tone?: ForceGraphTone; /** When true, renders as a dashed line (edge legend). */ weak?: boolean; /** * Typed dash pattern for an edge legend swatch. Independent of `weak`. * When set, the swatch line uses the matching dash-array. */ dash?: ForceGraphEdgeDash; }; /** * Maps a dash style (or the legacy `weak` flag) to an SVG stroke-dasharray. * Returns null for a solid stroke. */ export declare function edgeDashArray(dash: ForceGraphEdgeDash | undefined, weak?: boolean): string | null; export declare function nodeShapePath(shape: ForceGraphNodeShape | undefined, r: number): string | null; type ForceGraphProps = { nodes: ForceGraphNode[]; edges: ForceGraphEdge[]; /** Accessible name for the figure (required). */ label: string; width?: number; height?: number; /** Base node radius in px (scaled by node.weight). */ nodeRadius?: number; /** Show text labels next to nodes. */ showLabels?: boolean; /** * Number of cooling ticks. The simulation runs a synchronous warmup then * animates the remainder unless reduced motion is requested. */ iterations?: number; /** * IDs of currently selected nodes. Highlighted visually without * re-running the layout. Defaults to []. */ selectedIds?: string[]; /** * ID of the node to focus/centre visually (ring highlight). Does not * re-run the layout. Defaults to null. */ focusId?: string | null; /** * Called when the user clicks (or presses Space/Enter) a node. * Fires with the node's stable id. */ onSelect?: (id: string) => void; /** * Called when the user activates a node (double-click or Enter key while * keyboard-focused). Intended to open a detail panel. * Fires with the node's stable id. */ onOpenEntity?: (id: string) => void; /** * Called when the user hovers an edge. * Fires with the edge object (source/target/relation/weak). */ onEdgeHover?: (edge: ForceGraphEdge) => void; /** * Legend entries rendered as a corner overlay. * Each entry has a label + optional shape (node) or weak (edge). */ legend?: ForceGraphLegendEntry[]; /** * Edge curvature, 0..1. 0 = straight (back-compat). Larger values * bow each edge into a quadratic , offset perpendicular to the chord * by `edgeCurve * dist * factor`. Defaults to a light 0.15. */ edgeCurve?: number; /** * Repulsion multiplier controlling how spread out the layout is. * >1 = graphe plus aéré, <1 = plus compact ; multiplie la force de * répulsion sans toucher au fit-to-content. Defaults to 1. Clamped to * [0.1, 10] internally to avoid layout explosions/collapses. */ repulsion?: number; /** * Called when the user hovers (or keyboard-focuses) a node, and again with * null when the hover/focus ends. Intended for syncing an external panel. */ onNodeHover?: (node: ForceGraphNode | null) => void; /** * Reconciliation merge animation (CLIENT-ONLY — driven by `$effect`, which * never runs during SSR, so no merge is animated or resolved server-side). * * Pass a `{ id, from, into }` where both `from` and `into` exist in `nodes`: * the `from` node animates toward the position of `into` while fading out * (the node and its incident edges), then `onMergeComplete(pair)` fires * exactly ONCE for that `id`. Purely visual — the component never mutates the * data; the consumer removes `from` from `nodes` after the callback. * * Idempotent on `id`: re-passing the SAME `id` (even with a new identity for * the object) is a no-op — the animation/callback are not replayed. Passing a * NEW `id` (re)plays the merge, even for the same `from`/`into` pair. After * completion the `from` node stays MASKED (hidden) until the consumer removes * it or a new `mergePair` is supplied, so it does not flash back when the * prop returns to null. Pass null (the default) for no merge in flight. */ mergePair?: { id: string; from: string; into: string; } | null; /** * Fired once the merge animation for the current `mergePair` completes (or * immediately, on a microtask, under reduced motion). Fires at most ONCE per * `id`. Receives the same pair so the consumer can drop `from` from the data. */ onMergeComplete?: (pair: { id: string; from: string; into: string; }) => void; /** Accessible label for the reset-view button (shown when zoomed/panned). */ resetViewLabel?: string; /** Accessible label for the legend overlay. */ legendLabel?: string; class?: string; }; declare const ForceGraph: import("svelte").Component; type ForceGraph = ReturnType; export default ForceGraph; //# sourceMappingURL=ForceGraph.svelte.d.ts.map