11cd62a3b9
Replace all tuple[str, str] annotations with purpose-specific names: - LabeledOption = tuple[str, str] for (value, label) pairs used in FilterChoice, FilterSelect params, _modifier_options, _find_label, and _extract_labeled. - RangeValues(min, max) NamedTuple for _parse_range return values, making the two fields self-documenting at every call site. Export LabeledOption from common.components alongside SearchSelectOption. Document the "name compound types explicitly" convention in CLAUDE.md. https://claude.ai/code/session_01EyAJcMoDktLrY9tSbdHViA
117 lines
2.1 KiB
Python
117 lines
2.1 KiB
Python
"""Server-side HTML component library.
|
|
|
|
Split into core / primitives / domain / filters submodules; this package
|
|
re-exports the public API so ``from common.components import X`` keeps working.
|
|
"""
|
|
|
|
from common.utils import truncate
|
|
|
|
from common.components.core import (
|
|
Component,
|
|
HTMLAttribute,
|
|
HTMLTag,
|
|
_render_element,
|
|
randomid,
|
|
)
|
|
from common.components.primitives import (
|
|
A,
|
|
AddForm,
|
|
Button,
|
|
ButtonGroup,
|
|
CsrfInput,
|
|
Div,
|
|
ExternalScript,
|
|
H1,
|
|
Icon,
|
|
Input,
|
|
Modal,
|
|
ModuleScript,
|
|
Pill,
|
|
Popover,
|
|
PopoverTruncated,
|
|
SearchField,
|
|
SimpleTable,
|
|
Span,
|
|
Label,
|
|
TableHeader,
|
|
TableRow,
|
|
TableTd,
|
|
Template,
|
|
YearPicker,
|
|
paginated_table_content,
|
|
)
|
|
from common.components.search_select import (
|
|
FilterSelect,
|
|
LabeledOption,
|
|
SearchSelect,
|
|
SearchSelectOption,
|
|
searchselect_selected,
|
|
)
|
|
from common.components.domain import (
|
|
GameLink,
|
|
GameStatus,
|
|
GameStatusSelector,
|
|
LinkedPurchase,
|
|
NameWithIcon,
|
|
PriceConverted,
|
|
PurchasePrice,
|
|
SessionDeviceSelector,
|
|
_resolve_name_with_icon,
|
|
)
|
|
from common.components.filters import (
|
|
FilterBar,
|
|
PurchaseFilterBar,
|
|
SessionFilterBar,
|
|
)
|
|
|
|
__all__ = [
|
|
"truncate",
|
|
"Component",
|
|
"HTMLAttribute",
|
|
"HTMLTag",
|
|
"_render_element",
|
|
"randomid",
|
|
"A",
|
|
"AddForm",
|
|
"Button",
|
|
"ButtonGroup",
|
|
"CsrfInput",
|
|
"Div",
|
|
"ExternalScript",
|
|
"H1",
|
|
"Icon",
|
|
"Input",
|
|
"Modal",
|
|
"ModuleScript",
|
|
"Pill",
|
|
"Popover",
|
|
"PopoverTruncated",
|
|
"SearchField",
|
|
"FilterSelect",
|
|
"LabeledOption",
|
|
"SearchSelect",
|
|
"SearchSelectOption",
|
|
"searchselect_selected",
|
|
"SimpleTable",
|
|
"Span",
|
|
"Label",
|
|
"TableHeader",
|
|
"TableRow",
|
|
"TableTd",
|
|
"Template",
|
|
"YearPicker",
|
|
"paginated_table_content",
|
|
"GameLink",
|
|
"GameStatus",
|
|
"GameStatusSelector",
|
|
"LinkedPurchase",
|
|
"NameWithIcon",
|
|
"PriceConverted",
|
|
"PurchasePrice",
|
|
"SessionDeviceSelector",
|
|
"_resolve_name_with_icon",
|
|
"FilterBar",
|
|
"PurchaseFilterBar",
|
|
"SessionFilterBar",
|
|
]
|