# Generated by spaday.cem from components.cem.json — do not edit by hand.
from __future__ import annotations
from typing import Any
from spaday.catalog import ComponentSchema, PropertySchema
from spaday.component import Child, Component
__all__ = ["SpadayDagre"]
[docs]
class SpadayDagre(Component):
"""Directed graph rendered as themed SVG, laid out by dagre from a serializable node/edge config. The host has no intrinsic height: give it or an ancestor an explicit height."""
tag = "spaday-dagre"
schema = ComponentSchema(
tag="spaday-dagre",
class_name="SpadayDagre",
summary="Directed graph rendered as themed SVG, laid out by dagre from a serializable node/edge config. The host has no intrinsic height: give it or an ancestor an explicit height.",
props=(
PropertySchema(
name="graph",
kind="json",
choices=(),
default=None,
description="The graph: {nodes: [{id, label, tooltip, width, height, class, shape, parent}], edges: [{source, target, label, tooltip, class}]}. A node's `parent` nests it inside that id's cluster (compound layout). Node, cluster, and edge tooltips show plain text on hover.",
),
PropertySchema(
name="layout",
kind="json",
choices=(),
default=None,
description="dagre layout options: rankdir (TB/BT/LR/RL), align, nodesep, edgesep, ranksep, marginx, marginy, ranker.",
),
PropertySchema(
name="zoomable",
kind="boolean",
choices=(),
default=None,
description="Wheel zoom (cursor-anchored), drag pan, and double-click reset; on by default.",
),
PropertySchema(
name="controls",
kind="boolean",
choices=(),
default=None,
description="Overlay pan arrows and a center reset control on the graph; off by default.",
),
PropertySchema(
name="transition",
kind="number",
choices=(),
default=None,
description="Re-layout transition duration in milliseconds (default 250); 0 disables, and reduced-motion preferences disable it automatically.",
),
PropertySchema(
name="maxLabelWidth",
kind="number",
choices=(),
default=None,
description="Cap on a node label's measured width in px: wider labels stop widening the node and render ellipsized, with the full label as a native tooltip. Unset keeps natural widths.",
),
PropertySchema(
name="emphasis",
kind="json",
choices=(),
default=None,
description="Node ids wearing the `.emphasis` class (a single id string is accepted; null clears). Toggled by class reconciliation on the rendered nodes — no re-layout, the graph prop is untouched — and re-applied after re-renders.",
),
PropertySchema(
name="focus",
kind="string",
choices=(),
default=None,
description="Bindable spelling of focusNode(): setting a node id pans/zooms it to the window center. The focusNode() method is the primary API.",
),
),
events=("dagre-node-click", "dagre-edge-click", "dagre-node-contextmenu", "dagre-edge-contextmenu"),
slots=(),
)
def __init__(
self,
*children: Child,
key: str | None = None,
graph: Any = None,
layout: Any = None,
zoomable: bool | None = None,
controls: bool | None = None,
transition: float | None = None,
maxLabelWidth: float | None = None,
emphasis: Any = None,
focus: str | None = None,
**props: Any,
) -> None:
super().__init__(
*children,
key=key,
props={
"graph": graph,
"layout": layout,
"zoomable": zoomable,
"controls": controls,
"transition": transition,
"maxLabelWidth": maxLabelWidth,
"emphasis": emphasis,
"focus": focus,
},
**props,
)