Coverage for src / lexigram / contracts / admin / page_content.py: 100%

15 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-08-19 05:41 +0800

1"""Structured content for management pages contributed to the admin dashboard. 

2 

3Contributors return ``PageContent`` instead of raw HTML so the host owns all 

4page markup. ``body`` reuses the ``WidgetContent`` union — the same renderer 

5used for dashboard widgets renders page bodies. 

6""" 

7 

8from __future__ import annotations 

9 

10from dataclasses import dataclass 

11 

12from lexigram.contracts.admin.widget_content import WidgetContent 

13 

14 

15@dataclass(frozen=True) 

16class PaginationContent: 

17 """Pagination state for a structured management page.""" 

18 

19 page: int 

20 total: int 

21 per_page: int 

22 base_url: str 

23 

24 

25@dataclass(frozen=True) 

26class PageContent: 

27 """A management page contributed as structured content — never raw HTML.""" 

28 

29 title: str 

30 body: WidgetContent 

31 pagination: PaginationContent | None = None 

32 

33 

34__all__ = ["PageContent", "PaginationContent"]