scrolly 0.1.0__tar.gz

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.
Files changed (45) hide show
  1. scrolly-0.1.0/.gitignore +41 -0
  2. scrolly-0.1.0/LICENSE +21 -0
  3. scrolly-0.1.0/PKG-INFO +65 -0
  4. scrolly-0.1.0/README.md +34 -0
  5. scrolly-0.1.0/pyproject.toml +78 -0
  6. scrolly-0.1.0/scrolly/__init__.py +3 -0
  7. scrolly-0.1.0/scrolly/_cli/__init__.py +0 -0
  8. scrolly-0.1.0/scrolly/_cli/_cli.py +120 -0
  9. scrolly-0.1.0/scrolly/deck/__init__.py +43 -0
  10. scrolly-0.1.0/scrolly/deck/inference.py +61 -0
  11. scrolly-0.1.0/scrolly/deck/model.py +103 -0
  12. scrolly-0.1.0/scrolly/deck/parser.py +168 -0
  13. scrolly-0.1.0/scrolly/deck/schema.py +104 -0
  14. scrolly-0.1.0/scrolly/deck/validator.py +94 -0
  15. scrolly-0.1.0/scrolly/errors.py +34 -0
  16. scrolly-0.1.0/scrolly/pipeline/__init__.py +6 -0
  17. scrolly-0.1.0/scrolly/pipeline/assets.py +119 -0
  18. scrolly-0.1.0/scrolly/pipeline/orchestrator.py +90 -0
  19. scrolly-0.1.0/scrolly/pipeline/writer.py +38 -0
  20. scrolly-0.1.0/scrolly/render/__init__.py +6 -0
  21. scrolly-0.1.0/scrolly/render/assembler.py +69 -0
  22. scrolly-0.1.0/scrolly/render/assets/canvas.css +770 -0
  23. scrolly-0.1.0/scrolly/render/assets/canvas.js +1324 -0
  24. scrolly-0.1.0/scrolly/render/bundled_assets.py +55 -0
  25. scrolly-0.1.0/scrolly/render/fan.py +110 -0
  26. scrolly-0.1.0/scrolly/render/nav_data.py +138 -0
  27. scrolly-0.1.0/scrolly/render/templates/index.html.j2 +86 -0
  28. scrolly-0.1.0/scrolly/slide/__init__.py +50 -0
  29. scrolly-0.1.0/scrolly/slide/compilers/__init__.py +0 -0
  30. scrolly-0.1.0/scrolly/slide/compilers/storyboard.py +102 -0
  31. scrolly-0.1.0/scrolly/slide/html.py +47 -0
  32. scrolly-0.1.0/scrolly/slide/ir/__init__.py +28 -0
  33. scrolly-0.1.0/scrolly/slide/ir/_framework/__init__.py +0 -0
  34. scrolly-0.1.0/scrolly/slide/ir/_framework/animation.py +43 -0
  35. scrolly-0.1.0/scrolly/slide/ir/_framework/base.py +35 -0
  36. scrolly-0.1.0/scrolly/slide/ir/_framework/element.py +80 -0
  37. scrolly-0.1.0/scrolly/slide/ir/_framework/utils.py +98 -0
  38. scrolly-0.1.0/scrolly/slide/ir/scrollimation.py +93 -0
  39. scrolly-0.1.0/scrolly/slide/ir/static.py +176 -0
  40. scrolly-0.1.0/scrolly/slide/ir/storyboard.py +86 -0
  41. scrolly-0.1.0/scrolly/slide/processor.py +35 -0
  42. scrolly-0.1.0/scrolly/slide/registry.py +100 -0
  43. scrolly-0.1.0/scrolly/slide/renderers/__init__.py +0 -0
  44. scrolly-0.1.0/scrolly/slide/renderers/scrollimation.py +295 -0
  45. scrolly-0.1.0/scrolly/slide/renderers/static.py +80 -0
@@ -0,0 +1,41 @@
1
+ # Python
2
+ __pycache__/
3
+ *.egg-info/
4
+ dist/
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+
8
+ # Coverage
9
+ htmlcov/
10
+ .coverage
11
+ reports/
12
+
13
+ # Virtual environments
14
+ .venv/
15
+
16
+ # Node
17
+ node_modules/
18
+
19
+ # Private dev docs
20
+ design/
21
+ .local/
22
+
23
+ # IDE
24
+ .idea/
25
+ .vscode/
26
+
27
+ # OS
28
+ .DS_Store
29
+ ._*
30
+ Thumbs.db
31
+ Desktop.ini
32
+
33
+ # AI assistants
34
+ .claude/
35
+ CLAUDE.md
36
+ AGENTS.md
37
+ .cursor/
38
+ .cursorrules
39
+ .aider*
40
+ .copilot/
41
+ .github/copilot-instructions.md
scrolly-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026, Bert Pluymers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
scrolly-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: scrolly
3
+ Version: 0.1.0
4
+ Summary: CLI that compiles a JSON5 deck + slide files into a self-contained 2D-canvas HTML presentation.
5
+ Project-URL: Source, https://github.com/bertpl/scrolly
6
+ Project-URL: Changelog, https://github.com/bertpl/scrolly/blob/main/CHANGELOG.md
7
+ Project-URL: Issues, https://github.com/bertpl/scrolly/issues
8
+ Author-email: Bert Pluymers <bert.pluymers@gmail.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: cli,html,presentation,scrollytelling,slides
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: End Users/Desktop
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Multimedia :: Graphics :: Presentation
21
+ Classifier: Topic :: Text Processing :: Markup :: HTML
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: click>=8.2.0
24
+ Requires-Dist: jinja2>=3.1
25
+ Requires-Dist: json5>=0.13.0
26
+ Requires-Dist: markdown>=3.4
27
+ Requires-Dist: pydantic>=2.0
28
+ Requires-Dist: pyyaml>=6.0
29
+ Requires-Dist: rich>=13.0.0
30
+ Description-Content-Type: text/markdown
31
+
32
+ # scrolly
33
+
34
+ Compile a JSON5 deck into a self-contained, scrollable 2D-canvas HTML presentation.
35
+
36
+ [![CI](https://github.com/bertpl/scrolly/actions/workflows/push_to_main.yml/badge.svg)](https://github.com/bertpl/scrolly/actions/workflows/push_to_main.yml)
37
+ [![PyPI](https://img.shields.io/pypi/v/scrolly.svg)](https://pypi.org/project/scrolly/)
38
+ [![Python](https://img.shields.io/pypi/pyversions/scrolly.svg)](https://pypi.org/project/scrolly/)
39
+ [![License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/bertpl/scrolly/blob/main/LICENSE)
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install scrolly
45
+ ```
46
+
47
+ Or with [uv](https://docs.astral.sh/uv/):
48
+
49
+ ```bash
50
+ uv tool install scrolly
51
+ ```
52
+
53
+ ## Quickstart
54
+
55
+ ```bash
56
+ scrolly build examples/worked-example/deck.deck.json --out /tmp/scrolly-out --force
57
+ open /tmp/scrolly-out/index.html
58
+ ```
59
+
60
+ See [`examples/worked-example/`](examples/worked-example/) for a reference deck
61
+ demonstrating all supported slide types.
62
+
63
+ ## License
64
+
65
+ [MIT](https://github.com/bertpl/scrolly/blob/main/LICENSE).
@@ -0,0 +1,34 @@
1
+ # scrolly
2
+
3
+ Compile a JSON5 deck into a self-contained, scrollable 2D-canvas HTML presentation.
4
+
5
+ [![CI](https://github.com/bertpl/scrolly/actions/workflows/push_to_main.yml/badge.svg)](https://github.com/bertpl/scrolly/actions/workflows/push_to_main.yml)
6
+ [![PyPI](https://img.shields.io/pypi/v/scrolly.svg)](https://pypi.org/project/scrolly/)
7
+ [![Python](https://img.shields.io/pypi/pyversions/scrolly.svg)](https://pypi.org/project/scrolly/)
8
+ [![License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/bertpl/scrolly/blob/main/LICENSE)
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pip install scrolly
14
+ ```
15
+
16
+ Or with [uv](https://docs.astral.sh/uv/):
17
+
18
+ ```bash
19
+ uv tool install scrolly
20
+ ```
21
+
22
+ ## Quickstart
23
+
24
+ ```bash
25
+ scrolly build examples/worked-example/deck.deck.json --out /tmp/scrolly-out --force
26
+ open /tmp/scrolly-out/index.html
27
+ ```
28
+
29
+ See [`examples/worked-example/`](examples/worked-example/) for a reference deck
30
+ demonstrating all supported slide types.
31
+
32
+ ## License
33
+
34
+ [MIT](https://github.com/bertpl/scrolly/blob/main/LICENSE).
@@ -0,0 +1,78 @@
1
+ [project]
2
+ name = "scrolly"
3
+ version = "0.1.0"
4
+ description = "CLI that compiles a JSON5 deck + slide files into a self-contained 2D-canvas HTML presentation."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ authors = [
8
+ { name = "Bert Pluymers", email = "bert.pluymers@gmail.com" }
9
+ ]
10
+ requires-python = ">=3.11"
11
+ keywords = ["presentation", "slides", "scrollytelling", "html", "cli"]
12
+ classifiers = [
13
+ "Development Status :: 4 - Beta",
14
+ "Intended Audience :: Developers",
15
+ "Intended Audience :: End Users/Desktop",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Programming Language :: Python :: 3.14",
21
+ "Topic :: Multimedia :: Graphics :: Presentation",
22
+ "Topic :: Text Processing :: Markup :: HTML",
23
+ ]
24
+ dependencies = [
25
+ "click>=8.2.0",
26
+ "json5>=0.13.0",
27
+ "jinja2>=3.1",
28
+ "pyyaml>=6.0",
29
+ "markdown>=3.4",
30
+ "pydantic>=2.0",
31
+ "rich>=13.0.0",
32
+ ]
33
+
34
+ [dependency-groups]
35
+ dev = [
36
+ "pytest>=9.0",
37
+ "pytest-cov>=6.0",
38
+ "ruff>=0.14.0",
39
+ "pre-commit>=4.0",
40
+ ]
41
+
42
+ [project.scripts]
43
+ scrolly = "scrolly._cli._cli:cli"
44
+
45
+ [project.urls]
46
+ Source = "https://github.com/bertpl/scrolly"
47
+ Changelog = "https://github.com/bertpl/scrolly/blob/main/CHANGELOG.md"
48
+ Issues = "https://github.com/bertpl/scrolly/issues"
49
+
50
+ [build-system]
51
+ requires = ["hatchling"]
52
+ build-backend = "hatchling.build"
53
+
54
+ [tool.hatch.build.targets.sdist]
55
+ packages = ["scrolly"]
56
+
57
+ [tool.hatch.build.targets.wheel]
58
+ packages = ["scrolly"]
59
+
60
+ [tool.ruff]
61
+ line-length = 120
62
+ target-version = "py311"
63
+
64
+ [tool.ruff.lint]
65
+ select = ["I"]
66
+
67
+ [tool.pytest.ini_options]
68
+ testpaths = ["tests/python"]
69
+
70
+ [tool.coverage.run]
71
+ source = ["scrolly"]
72
+
73
+ [tool.coverage.report]
74
+ precision = 2
75
+ exclude_also = [
76
+ "@abstractmethod",
77
+ "@abc.abstractmethod",
78
+ ]
@@ -0,0 +1,3 @@
1
+ from importlib.metadata import version
2
+
3
+ __version__ = version("scrolly")
File without changes
@@ -0,0 +1,120 @@
1
+ import json
2
+ import sys
3
+ from pathlib import Path
4
+
5
+ import click
6
+ from rich.console import Console
7
+
8
+ from scrolly import __version__
9
+ from scrolly.errors import ScrollyError
10
+ from scrolly.pipeline import build_deck, validate_deck_sources
11
+
12
+ _err_console = Console(stderr=True, highlight=False)
13
+
14
+
15
+ @click.group()
16
+ @click.version_option(__version__, prog_name="scrolly")
17
+ def cli() -> None:
18
+ """scrolly — compile a JSON5 deck into a self-contained 2D-canvas HTML presentation."""
19
+
20
+
21
+ @cli.command()
22
+ @click.argument("deck_path", type=click.Path(exists=True, dir_okay=False, path_type=Path))
23
+ @click.option(
24
+ "--out",
25
+ "out_dir",
26
+ required=True,
27
+ type=click.Path(file_okay=False, path_type=Path),
28
+ help="Output directory.",
29
+ )
30
+ @click.option("--force", is_flag=True, help="Overwrite a non-empty output directory.")
31
+ @click.option("--no-inline", is_flag=True, help="Write assets as separate files instead of inlining.")
32
+ def build(deck_path: Path, out_dir: Path, force: bool, no_inline: bool) -> None:
33
+ """Build a deck into a self-contained HTML presentation."""
34
+ try:
35
+ deck = build_deck(deck_path, out_dir, force=force, inline=not no_inline)
36
+ except ScrollyError as e:
37
+ _err_console.print(f"[red]error:[/red] {e}")
38
+ sys.exit(1)
39
+
40
+ click.echo(f"Built '{deck.title or '(untitled)'}': {len(deck.slides)} slides, {len(deck.edges)} edges → {out_dir}")
41
+
42
+
43
+ @cli.command()
44
+ @click.argument("type_name", required=False)
45
+ def schema(type_name: str | None) -> None:
46
+ """Show source file schemas. Lists types when called without an argument."""
47
+ from scrolly.deck import deck_source_schema
48
+ from scrolly.slide import registered_ir_types
49
+
50
+ ir_types = registered_ir_types()
51
+
52
+ if type_name is None:
53
+ click.echo("Available schemas:\n")
54
+ click.echo(f" {'deck':<17}{'.deck.json':<24}Deck structure (slides + edges)")
55
+ for name in sorted(ir_types):
56
+ cls = ir_types[name]
57
+ click.echo(f" {name:<17}{cls.SUFFIX:<24}{cls.DESCRIPTION}")
58
+ return
59
+
60
+ if type_name == "deck":
61
+ click.echo(json.dumps(deck_source_schema(), indent=2))
62
+ return
63
+
64
+ if type_name not in ir_types:
65
+ known = ", ".join(sorted(["deck", *ir_types]))
66
+ _err_console.print(f"[red]error:[/red] unknown type '{type_name}' (known: {known})")
67
+ sys.exit(1)
68
+
69
+ click.echo(json.dumps(ir_types[type_name].source_schema(), indent=2))
70
+
71
+
72
+ @cli.command()
73
+ @click.argument("deck_path", type=click.Path(exists=True, dir_okay=False, path_type=Path))
74
+ def validate(deck_path: Path) -> None:
75
+ """Validate a deck and all its slide sources without building."""
76
+ try:
77
+ deck = validate_deck_sources(deck_path)
78
+ except ScrollyError as e:
79
+ _err_console.print(f"[red]error:[/red] {e}")
80
+ sys.exit(1)
81
+
82
+ click.echo(f"Valid: {len(deck.slides)} slides, {len(deck.edges)} edges")
83
+
84
+
85
+ _INIT_DECK = """\
86
+ {
87
+ title: "My Deck",
88
+ slides: [
89
+ { id: "intro", position: [0, 0], source: "slides/intro.static.md" },
90
+ ],
91
+ edges: [],
92
+ }
93
+ """
94
+
95
+ _INIT_SLIDE = """\
96
+ ---
97
+ initial_scroll_position: 0
98
+ ---
99
+
100
+ # My Deck
101
+
102
+ Welcome to your new presentation.
103
+ """
104
+
105
+
106
+ @cli.command()
107
+ @click.argument("dir_path", type=click.Path(path_type=Path))
108
+ def init(dir_path: Path) -> None:
109
+ """Scaffold a minimal deck in DIR_PATH."""
110
+ if dir_path.exists() and any(dir_path.iterdir()):
111
+ _err_console.print(f"[red]error:[/red] directory is not empty: {dir_path}")
112
+ sys.exit(1)
113
+
114
+ slides_dir = dir_path / "slides"
115
+ slides_dir.mkdir(parents=True, exist_ok=True)
116
+
117
+ (dir_path / "deck.deck.json").write_text(_INIT_DECK)
118
+ (slides_dir / "intro.static.md").write_text(_INIT_SLIDE)
119
+
120
+ click.echo(f"Created deck in {dir_path}")
@@ -0,0 +1,43 @@
1
+ """Deck model, parsing, validation, and inference (Layer A).
2
+
3
+ Pipeline:
4
+ raw_deck = parse_deck(path)
5
+ validate_raw_deck(raw_deck)
6
+ deck = infer_edges(raw_deck)
7
+ validate_deck(deck)
8
+ """
9
+
10
+ from scrolly.deck.inference import infer_edges
11
+ from scrolly.deck.model import (
12
+ Deck,
13
+ Edge,
14
+ Endpoint,
15
+ Position,
16
+ RawDeck,
17
+ RawEdge,
18
+ RawEndpoint,
19
+ Side,
20
+ Slide,
21
+ SlideGroup,
22
+ )
23
+ from scrolly.deck.parser import parse_deck
24
+ from scrolly.deck.schema import deck_source_schema
25
+ from scrolly.deck.validator import validate_deck, validate_raw_deck
26
+
27
+ __all__ = [
28
+ "Deck",
29
+ "Edge",
30
+ "Endpoint",
31
+ "SlideGroup",
32
+ "Position",
33
+ "RawDeck",
34
+ "RawEdge",
35
+ "RawEndpoint",
36
+ "Side",
37
+ "Slide",
38
+ "deck_source_schema",
39
+ "infer_edges",
40
+ "parse_deck",
41
+ "validate_deck",
42
+ "validate_raw_deck",
43
+ ]
@@ -0,0 +1,61 @@
1
+ """Fill in omitted edge sides by inferring from slide positions.
2
+
3
+ An endpoint with `side=None` has its side inferred from where the other
4
+ endpoint's slide sits relative to this one on the grid:
5
+
6
+ dx > 0 → right dx < 0 → left
7
+ dy > 0 → bottom dy < 0 → top
8
+
9
+ If the two slides are diagonal (dx ≠ 0 and dy ≠ 0), there is no unique
10
+ side and a `DeckInferenceError` is raised.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ from scrolly.deck.model import Deck, Edge, Endpoint, Position, RawDeck, Side
16
+ from scrolly.errors import DeckInferenceError
17
+
18
+
19
+ def infer_edges(deck: RawDeck) -> Deck:
20
+ """Return a `Deck` with every edge's sides fully specified."""
21
+ positions = {slide.id: slide.position for slide in deck.slides}
22
+ inferred: list[Edge] = []
23
+
24
+ for idx, edge in enumerate(deck.edges):
25
+ a_pos = positions[edge.a.slide_id]
26
+ b_pos = positions[edge.b.slide_id]
27
+
28
+ a_side = edge.a.side or _infer_side(a_pos, b_pos, idx, edge.a.slide_id, edge.b.slide_id)
29
+ b_side = edge.b.side or _infer_side(b_pos, a_pos, idx, edge.b.slide_id, edge.a.slide_id)
30
+
31
+ inferred.append(
32
+ Edge(
33
+ a=Endpoint(slide_id=edge.a.slide_id, side=a_side),
34
+ b=Endpoint(slide_id=edge.b.slide_id, side=b_side),
35
+ )
36
+ )
37
+
38
+ return Deck(title=deck.title, slides=deck.slides, edges=tuple(inferred), groups=deck.groups)
39
+
40
+
41
+ def _infer_side(
42
+ from_pos: Position,
43
+ to_pos: Position,
44
+ edge_idx: int,
45
+ from_id: str,
46
+ to_id: str,
47
+ ) -> Side:
48
+ """Return the side of `from_pos`'s slide that faces `to_pos`'s slide."""
49
+ dx = to_pos.x - from_pos.x
50
+ dy = to_pos.y - from_pos.y
51
+
52
+ if dx != 0 and dy == 0:
53
+ return Side.RIGHT if dx > 0 else Side.LEFT
54
+ if dy != 0 and dx == 0:
55
+ return Side.BOTTOM if dy > 0 else Side.TOP
56
+
57
+ # Diagonal or same cell — no unique side.
58
+ raise DeckInferenceError(
59
+ f"edges[{edge_idx}]: cannot infer side for '{from_id}' — "
60
+ f"'{from_id}' and '{to_id}' are not on the same row or column"
61
+ )
@@ -0,0 +1,103 @@
1
+ """Data model for the deck (Layer A).
2
+
3
+ The parser produces a `RawDeck` (edges may have omitted sides). The inference
4
+ step fills in omitted sides and produces a `Deck` (every edge side is known).
5
+ Downstream layers work exclusively with the fully-specified `Deck`.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from dataclasses import dataclass
11
+ from enum import Enum
12
+ from pathlib import Path
13
+
14
+
15
+ class Side(Enum):
16
+ """One of the four sides of a slide. Edges attach to sides."""
17
+
18
+ TOP = "top"
19
+ BOTTOM = "bottom"
20
+ LEFT = "left"
21
+ RIGHT = "right"
22
+
23
+
24
+ @dataclass(frozen=True)
25
+ class Position:
26
+ """Integer grid position. x increases left → right, y increases top → bottom."""
27
+
28
+ x: int
29
+ y: int
30
+
31
+
32
+ @dataclass(frozen=True)
33
+ class Slide:
34
+ """One slide on the canvas.
35
+
36
+ The slide's *type* (which renderer handles it) is encoded in the
37
+ `source` filename's suffix and resolved at render time via
38
+ `scrolly.slide.get_renderer_for_path`. No `type` field on the model.
39
+ """
40
+
41
+ id: str
42
+ position: Position
43
+ source: Path
44
+
45
+
46
+ @dataclass(frozen=True)
47
+ class RawEndpoint:
48
+ """Edge endpoint pre-inference — the side may be omitted."""
49
+
50
+ slide_id: str
51
+ side: Side | None
52
+
53
+
54
+ @dataclass(frozen=True)
55
+ class Endpoint:
56
+ """Edge endpoint post-inference — the side is always known."""
57
+
58
+ slide_id: str
59
+ side: Side
60
+
61
+
62
+ @dataclass(frozen=True)
63
+ class RawEdge:
64
+ """Undirected edge between two slides, pre-inference."""
65
+
66
+ a: RawEndpoint
67
+ b: RawEndpoint
68
+
69
+
70
+ @dataclass(frozen=True)
71
+ class Edge:
72
+ """Undirected edge between two slides, fully specified."""
73
+
74
+ a: Endpoint
75
+ b: Endpoint
76
+
77
+
78
+ @dataclass(frozen=True)
79
+ class SlideGroup:
80
+ """A named group of slides, visualised as a background rectangle in deck view."""
81
+
82
+ label: str
83
+ slide_ids: tuple[str, ...]
84
+
85
+
86
+ @dataclass(frozen=True)
87
+ class RawDeck:
88
+ """Deck as parsed from disk, with edges potentially missing side info."""
89
+
90
+ title: str | None
91
+ slides: tuple[Slide, ...]
92
+ edges: tuple[RawEdge, ...]
93
+ groups: tuple[SlideGroup, ...] = ()
94
+
95
+
96
+ @dataclass(frozen=True)
97
+ class Deck:
98
+ """Deck after inference, with every edge side fully specified."""
99
+
100
+ title: str | None
101
+ slides: tuple[Slide, ...]
102
+ edges: tuple[Edge, ...]
103
+ groups: tuple[SlideGroup, ...] = ()