g3-toolkit API Reference
    Preparing search index...

    Interface CytoscapeCanvasProps

    interface CytoscapeCanvasProps {
        animate?: boolean;
        animationDuration?: number;
        className?: string;
        containment?: ContainmentOptions;
        edgeStyle?: "taxi" | "straight" | "bezier";
        encodingSpec?: EncodingSpec;
        hidden?: ReadonlySet<string>;
        layout?: string;
        layoutOptions?: Record<string, unknown>;
        menuManager?: ContextMenuManager;
        onReady?: (cy: Core) => void;
        structural?: { geometry: StructuralGeometry; input: StructuralGraphInput };
        structuralDecorations?: StructuralDecorations;
        structuralEdgeLayer?: "cytoscape" | "svg-overlay";
        stylesheet?: CyStylesheet[];
        ugm: UGM;
    }
    Index

    Properties

    animate?: boolean

    F1: Animate layout transitions. Default true.

    animationDuration?: number

    F1: Animation duration in ms. Default 400.

    className?: string

    CSS class for the container div.

    containment?: ContainmentOptions

    Compound containers (slice 1, round 17): edges of the named type become parent assignments rendered as UML-style labeled containers; fcose is compound-aware, so force layout respects containment. Must be referentially stable, like ugm.

    edgeStyle?: "taxi" | "straight" | "bezier"

    F8: Edge curve style override. When set, applies the given style to ALL edges regardless of their topology. When NOT set (default), edges auto-select straight vs bezier based on whether the curve is actually needed (see bugfix 21 in ugmToCytoscapeElements): straight for the common single-edge case, bezier for self-loops, parallel multi-edges, and bidirectional pairs.

    encodingSpec?: EncodingSpec

    Optional encoding spec; when present, element visual data is patched through applyEncodingSpec on mount and on every spec change (roadmap/design/encoding-controls.md application milestone). Spec changes RESTYLE ONLY: element data patches do not re-run layout, so visual edits never move nodes (given a stable ugm reference, above).

    hidden?: ReadonlySet<string>

    Node ids to hide on the canvas (a visibility filter). Hidden nodes get a g3t-hidden class (display: none), so Cytoscape drops them from layout and auto-hides their incident edges, WITHOUT a re-init: applied as a batched class toggle, so positions and the instance survive. Use this for type/facet filtering instead of feeding a pre-filtered UGM (which would re-create the instance and re-run layout on every toggle). Must be referentially stable across renders where it has not changed; rebuild it only when the hidden set does.

    layout?: string

    Optional layout name (default: "fcose" if available, else "cose").

    layoutOptions?: Record<string, unknown>

    Extra options merged into the layout object AFTER the built-in tuning, so callers can adjust spacing and fit (review 5.11: idealEdgeLength, nodeRepulsion, padding, ...) without forking the canvas. Keyed by CONTENT (like structuralDecorations), so an inline literal does not re-init the instance every render; a content change re-runs layout. Structural (preset) scenes ignore the fit-related keys: the camera policy there is explicit.

    menuManager?: ContextMenuManager

    Optional ContextMenuManager. If omitted, a default is created whose base menu is FUNCTIONAL with zero config: one copy item wired to the clipboard, labeled "Copy IRI" or "Copy ID" from the element's id shape. "Inspect properties" appears only when a manager built with createDefaultMenuManager({ onInspect }) is passed (an unwired Inspect is omitted, never rendered dead); app-specific items go through manager.register().

    onReady?: (cy: Core) => void

    Callback when the Cytoscape core is ready.

    structural?: { geometry: StructuralGeometry; input: StructuralGraphInput }

    Structural scene (Group A slice A2, R1.18): when present, the canvas renders the laid-out structural geometry INSTEAD of the UGM projection, with layout "preset" (positions come from the document; force layouts never run over a structural scene). Rows are selectable elements; give rows the source element's id and selection/inspector machinery applies unmodified. Must be referentially stable, like ugm.

    structuralDecorations?: StructuralDecorations

    Optional render-time decorations for a structural scene (SHACL B3: closed-shape borders, per-row validation severity). Ignored unless structural is set.

    structuralEdgeLayer?: "cytoscape" | "svg-overlay"

    Which layer draws ROUTED structural edges (G3L:RND-002, the ruled per-surface opt-in). "cytoscape" (default): the shipped segments projection. "svg-overlay": an SVG layer above the canvas draws the true absolute polylines (arrowheads, dashes, labels included); the underlying Cytoscape edges stay mounted but fully transparent so hover/context-menu interaction is UNCHANGED (parity by construction). Declared-port edges keep their Cytoscape taxi rendering in both modes (the ruled perpendicular-exit behavior). Ignored unless structural is set.

    stylesheet?: CyStylesheet[]

    Optional additional stylesheet rules to merge.

    ugm: UGM

    The UGM instance to render. MUST be referentially stable across renders: a new identity means "different graph" and triggers a full re-init INCLUDING layout. Memoize in the parent; do not rebuild per render.