@petrarca/sonnet-graph 0.4.0 → 0.4.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/dist/index.d.ts CHANGED
@@ -494,6 +494,18 @@ declare const useGraphFocus: zustand.UseBoundStore<zustand.StoreApi<GraphFocusSt
494
494
  * - GraphFilter (label filters)
495
495
  */
496
496
 
497
+ /** Options for bounded node expansion. */
498
+ interface ExpandOptions {
499
+ direction?: "both" | "out" | "in";
500
+ relTypes?: string[];
501
+ limit?: number;
502
+ }
503
+ /** Result shape returned by the expand backend call. */
504
+ interface ExpandResult {
505
+ nodes: RawGraphNode[];
506
+ edges: RawGraphEdge[];
507
+ has_more: boolean;
508
+ }
497
509
  /**
498
510
  * Store dependencies for GraphExploration.
499
511
  * Allows workspace-specific or global store injection.
@@ -503,10 +515,8 @@ interface GraphExplorationDeps {
503
515
  selection: UseBoundStore<StoreApi<SelectionStore>>;
504
516
  graphFocus: UseBoundStore<StoreApi<GraphFocusStore>>;
505
517
  graphFilter: UseBoundStore<StoreApi<GraphFilterStore>>;
506
- expandNode: (id: number) => Promise<{
507
- nodes: RawGraphNode[];
508
- edges: RawGraphEdge[];
509
- }>;
518
+ expandNode: (id: number, options?: ExpandOptions) => Promise<ExpandResult>;
519
+ getNodeEdgeTypes?: (id: number) => Promise<string[]>;
510
520
  getNodes: (ids: number[]) => Promise<RawGraphNode[]>;
511
521
  getLabelDisplayMap?: () => LabelDisplayMap;
512
522
  }
@@ -614,9 +624,10 @@ interface GraphExplorationStore {
614
624
  * Expand a node by fetching connected nodes/edges from backend
615
625
  * and merging them into the graph data.
616
626
  * @param nodeId - ID of the node to expand
627
+ * @param options - Optional expand parameters (direction, relTypes, limit)
617
628
  * @returns Promise that resolves when expansion is complete
618
629
  */
619
- expandNode: (nodeId: string) => Promise<void>;
630
+ expandNode: (nodeId: string, options?: ExpandOptions) => Promise<void>;
620
631
  /**
621
632
  * Add a node to the graph by ID.
622
633
  * If the node already exists in the graph, just focuses it (if autoFocus=true).
@@ -834,8 +845,10 @@ interface GraphVisualizerProps {
834
845
  onCopyNode?: (node: VisualGraphNode) => void;
835
846
  /** Extra toolbar content (e.g. clipboard UI) injected into the renderer toolbar. */
836
847
  extraToolbarContent?: ReactNode;
848
+ /** Fetch distinct edge types for a node (for expand options panel). */
849
+ getNodeEdgeTypes?: (id: number) => Promise<string[]>;
837
850
  }
838
- declare function GraphVisualizer({ onCopyNode, extraToolbarContent, }: GraphVisualizerProps): react_jsx_runtime.JSX.Element;
851
+ declare function GraphVisualizer({ onCopyNode, extraToolbarContent, getNodeEdgeTypes, }: GraphVisualizerProps): react_jsx_runtime.JSX.Element;
839
852
 
840
853
  interface ActionPanelProps {
841
854
  /** Optional actions rendered at the top of the panel (e.g. CRUD buttons) */
@@ -866,4 +879,4 @@ interface GraphA11yListProps {
866
879
  }
867
880
  declare function GraphA11yList({ visible, rowHeight, maxHeight, className, }: GraphA11yListProps): react_jsx_runtime.JSX.Element;
868
881
 
869
- export { ActionPanel, type ActionPanelState, type ActionPanelStore, type ColorPalette, EMPTY_NORMALIZED, EdgeInfoCard, type EdgeVisual, GraphA11yList, type GraphA11yListProps, type GraphDataHook, type GraphDataStore, type GraphDisplayConfig, type GraphExplorationDeps, type GraphExplorationStore, type GraphFilterStore, type GraphFocusAction, type GraphFocusStore, type GraphProperties, type GraphProperty, type GraphRenderer, GraphRendererProvider, type GraphStatistics, type WorkspaceStores as GraphStoreBundle, GraphStoresContext, GraphVisualizer, type GraphVisualizerProps, type LabelDisplayMap, type LiveGraphDataResult, NodeInfoCard, type NodeVisual, type NormalizedGraph, Overview, type RawGraphEdge, type RawGraphNode, type SelectionStore, type StoreFactory, type VisualGraphEdge, type VisualGraphNode, type VisualGraphNormalized, type WorkspaceStores, buildColorPalette, buildColorPaletteFromNodes, createActionPanelStore, createGraphDataStore, createGraphExplorationStore, createGraphFilterStore, createGraphFocusStore, createSelectionStore, enrichEdge, enrichEdges, enrichNode, enrichNodes, extractDisplayLabel, isRawGraphNode, isVisualEdge, isVisualNode, normalizeGraph, toCytoscapeEdge, toCytoscapeNode, toReagraphEdge, toReagraphNode, useActionPanelStore, useCytoscapeData, useGraphFocus, useGraphRenderer, useLiveGraphData, useReagraphData, useWorkspaceGraphData, useWorkspaceGraphExploration, useWorkspaceGraphFilter, useWorkspaceSelection };
882
+ export { ActionPanel, type ActionPanelState, type ActionPanelStore, type ColorPalette, EMPTY_NORMALIZED, EdgeInfoCard, type EdgeVisual, type ExpandOptions, type ExpandResult, GraphA11yList, type GraphA11yListProps, type GraphDataHook, type GraphDataStore, type GraphDisplayConfig, type GraphExplorationDeps, type GraphExplorationStore, type GraphFilterStore, type GraphFocusAction, type GraphFocusStore, type GraphProperties, type GraphProperty, type GraphRenderer, GraphRendererProvider, type GraphStatistics, type WorkspaceStores as GraphStoreBundle, GraphStoresContext, GraphVisualizer, type GraphVisualizerProps, type LabelDisplayMap, type LiveGraphDataResult, NodeInfoCard, type NodeVisual, type NormalizedGraph, Overview, type RawGraphEdge, type RawGraphNode, type SelectionStore, type StoreFactory, type VisualGraphEdge, type VisualGraphNode, type VisualGraphNormalized, type WorkspaceStores, buildColorPalette, buildColorPaletteFromNodes, createActionPanelStore, createGraphDataStore, createGraphExplorationStore, createGraphFilterStore, createGraphFocusStore, createSelectionStore, enrichEdge, enrichEdges, enrichNode, enrichNodes, extractDisplayLabel, isRawGraphNode, isVisualEdge, isVisualNode, normalizeGraph, toCytoscapeEdge, toCytoscapeNode, toReagraphEdge, toReagraphNode, useActionPanelStore, useCytoscapeData, useGraphFocus, useGraphRenderer, useLiveGraphData, useReagraphData, useWorkspaceGraphData, useWorkspaceGraphExploration, useWorkspaceGraphFilter, useWorkspaceSelection };