Metadata-Version: 2.5
Name: spaday-dagre
Version: 0.1.0
Summary: dagre graph rendering for spaday
Project-URL: Repository, https://github.com/1kbgz/spaday-dagre
Project-URL: Homepage, https://github.com/1kbgz/spaday-dagre
Author-email: 1kbgz <dev@1kbgz.com>
License: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.11
Requires-Dist: spaday<1.0,>=0.7
Provides-Extra: develop
Requires-Dist: build; extra == 'develop'
Requires-Dist: bump-my-version; extra == 'develop'
Requires-Dist: check-dist; extra == 'develop'
Requires-Dist: codespell; extra == 'develop'
Requires-Dist: hatch-js; extra == 'develop'
Requires-Dist: hatchling; extra == 'develop'
Requires-Dist: mdformat; extra == 'develop'
Requires-Dist: mdformat-tables>=1; extra == 'develop'
Requires-Dist: pytest; extra == 'develop'
Requires-Dist: pytest-cov; extra == 'develop'
Requires-Dist: ruff; extra == 'develop'
Requires-Dist: starlette; extra == 'develop'
Requires-Dist: twine; extra == 'develop'
Requires-Dist: ty; extra == 'develop'
Requires-Dist: uv; extra == 'develop'
Requires-Dist: uvicorn; extra == 'develop'
Requires-Dist: wheel; extra == 'develop'
Provides-Extra: examples
Requires-Dist: starlette; extra == 'examples'
Requires-Dist: uvicorn; extra == 'examples'
Description-Content-Type: text/markdown

# spaday-dagre

dagre graph rendering for spaday

[![Build Status](https://github.com/1kbgz/spaday-dagre/actions/workflows/build.yaml/badge.svg?branch=main&event=push)](https://github.com/1kbgz/spaday-dagre/actions/workflows/build.yaml)
[![codecov](https://codecov.io/gh/1kbgz/spaday-dagre/branch/main/graph/badge.svg)](https://codecov.io/gh/1kbgz/spaday-dagre)
[![License](https://img.shields.io/github/license/1kbgz/spaday-dagre)](https://github.com/1kbgz/spaday-dagre)
[![PyPI](https://img.shields.io/pypi/v/spaday-dagre.svg)](https://pypi.python.org/pypi/spaday-dagre)

## Overview

`spaday-dagre` renders directed graphs in [spaday](https://1kbgz.github.io/spaday/) from a
serializable node/edge config, laid out by [@dagrejs/dagre](https://github.com/dagrejs/dagre) and
drawn as light-DOM SVG. Colors ride the spaday shell's `--spa-*` tokens, so
`bind_root_class("wa-dark", ...)` re-themes the graph with the rest of the page, and application CSS
reaches every shape. `dagre-node-click` bubbles the node id (scalar `detail`, so
`SetField("selected", event_value())` just works); `dagre-edge-click` bubbles `{source, target}`.

## Quick example

```python
from spaday import element
from spaday.backends.starlette import serve
from spaday_dagre import Dagre, package

graph = Dagre(
    graph={
        "nodes": [{"id": "a", "label": "Alpha"}, {"id": "b"}],
        "edges": [{"source": "a", "target": "b", "label": "flow"}],
    },
    layout={"rankdir": "LR"},
)
app = serve(element("main").child(graph), packages=[package])
```

Node sizes default from label measurement; per-node `width`/`height`/`class` and per-edge
`label`/`class` override. `layout` passes through to dagre (`rankdir`, `align`, `nodesep`,
`ranksep`, `edgesep`, `marginx`/`marginy`, `ranker`). Installing the package registers the `dagre`
entry point, so `packages=["dagre"]` also works.

## Run the local example

```bash
python -m spaday_dagre.example
```

Open <http://127.0.0.1:8016>: a pipeline DAG with direction switching, node selection, and the
dark-mode toggle.

> [!NOTE]
> This library was generated using [copier](https://copier.readthedocs.io/en/stable/) from the [Base Python Project Template repository](https://github.com/python-project-templates/base).
