Coverage for src / lexigram / ui / cli / registry.py: 100%
10 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-10 04:11 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-10 04:11 +0800
1"""Component registry for lexigram-ui.
3Maps component names to their source paths and dependencies,
4mirroring ShadCN's registry concept for Python components.
5"""
7from __future__ import annotations
9from dataclasses import dataclass, field
12@dataclass
13class ComponentEntry:
14 """Metadata for a registrable UI component."""
16 name: str
17 description: str
18 source_path: str
19 dependencies: list[str] = field(default_factory=list)
20 requires: list[str] = field(default_factory=list)
23COMPONENT_REGISTRY: dict[str, ComponentEntry] = {
24 "button": ComponentEntry(
25 name="button",
26 description="Button component with semantic color variants",
27 source_path="lexigram/ui/atoms/button.py",
28 dependencies=["lexigram/ui/core/base.py"],
29 ),
30 "badge": ComponentEntry(
31 name="badge",
32 description="Badge/chip with semantic color variants",
33 source_path="lexigram/ui/atoms/badge.py",
34 dependencies=["lexigram/ui/core/base.py"],
35 ),
36 "card": ComponentEntry(
37 name="card",
38 description="Card container with header, content, footer",
39 source_path="lexigram/ui/molecules/card.py",
40 dependencies=["lexigram/ui/core/base.py"],
41 ),
42 "input": ComponentEntry(
43 name="input",
44 description="Text input with label, error, and help text",
45 source_path="lexigram/ui/atoms/inputs/text.py",
46 dependencies=[
47 "lexigram/ui/core/base.py",
48 "lexigram/ui/atoms/inputs/base.py",
49 ],
50 ),
51 "modal": ComponentEntry(
52 name="modal",
53 description="Modal dialog with backdrop and transitions",
54 source_path="lexigram/ui/molecules/modal.py",
55 dependencies=[
56 "lexigram/ui/core/base.py",
57 "lexigram/ui/atoms/button.py",
58 ],
59 ),
60 "select": ComponentEntry(
61 name="select",
62 description="Dropdown select input",
63 source_path="lexigram/ui/atoms/inputs/selection/select.py",
64 dependencies=[
65 "lexigram/ui/core/base.py",
66 "lexigram/ui/atoms/inputs/base.py",
67 ],
68 ),
69 "tabs": ComponentEntry(
70 name="tabs",
71 description="Tabbed interface",
72 source_path="lexigram/ui/molecules/tabs.py",
73 dependencies=["lexigram/ui/core/base.py"],
74 ),
75 "toast": ComponentEntry(
76 name="toast",
77 description="Toast notification",
78 source_path="lexigram/ui/molecules/toast.py",
79 dependencies=["lexigram/ui/core/base.py"],
80 ),
81 "tooltip": ComponentEntry(
82 name="tooltip",
83 description="CSS-only tooltip",
84 source_path="lexigram/ui/atoms/tooltip.py",
85 dependencies=["lexigram/ui/core/base.py"],
86 ),
87 "skeleton": ComponentEntry(
88 name="skeleton",
89 description="Loading skeleton placeholder",
90 source_path="lexigram/ui/atoms/skeleton.py",
91 dependencies=["lexigram/ui/core/base.py"],
92 ),
93 "form": ComponentEntry(
94 name="form",
95 description="Form with HTMX and validation",
96 source_path="lexigram/ui/organisms/forms.py",
97 dependencies=[
98 "lexigram/ui/core/base.py",
99 "lexigram/ui/atoms/button.py",
100 "lexigram/ui/molecules/form_field.py",
101 ],
102 ),
103 "pagination": ComponentEntry(
104 name="pagination",
105 description="Page navigation with next/previous",
106 source_path="lexigram/ui/molecules/pagination.py",
107 dependencies=["lexigram/ui/core/base.py"],
108 ),
109}