pydzn 0.1.1__tar.gz → 0.1.3__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.
- {pydzn-0.1.1/src/pydzn.egg-info → pydzn-0.1.3}/PKG-INFO +1 -1
- {pydzn-0.1.1 → pydzn-0.1.3}/pyproject.toml +1 -5
- {pydzn-0.1.1 → pydzn-0.1.3}/src/pydzn/base_component.py +0 -1
- pydzn-0.1.3/src/pydzn/components/__init__.py +8 -0
- {pydzn-0.1.1 → pydzn-0.1.3}/src/pydzn/components/button/component.py +2 -1
- pydzn-0.1.3/src/pydzn/components/card/component.py +15 -0
- pydzn-0.1.3/src/pydzn/components/card/template.html +3 -0
- pydzn-0.1.3/src/pydzn/components/drawer/component.py +14 -0
- pydzn-0.1.3/src/pydzn/components/drawer/template.html +3 -0
- pydzn-0.1.3/src/pydzn/components/nav_item/component.py +56 -0
- pydzn-0.1.3/src/pydzn/components/nav_item/template.html +3 -0
- pydzn-0.1.3/src/pydzn/components/sidebar/component.py +15 -0
- pydzn-0.1.3/src/pydzn/components/sidebar/template.html +3 -0
- pydzn-0.1.3/src/pydzn/components/text/component.py +15 -0
- pydzn-0.1.3/src/pydzn/components/text/template.html +3 -0
- {pydzn-0.1.1 → pydzn-0.1.3}/src/pydzn/grid_builder.py +1 -1
- {pydzn-0.1.1 → pydzn-0.1.3/src/pydzn.egg-info}/PKG-INFO +1 -1
- pydzn-0.1.3/src/pydzn.egg-info/SOURCES.txt +26 -0
- pydzn-0.1.1/src/pydzn/components/button/__init__.py +0 -0
- pydzn-0.1.1/src/pydzn.egg-info/SOURCES.txt +0 -16
- {pydzn-0.1.1 → pydzn-0.1.3}/LICENSE +0 -0
- {pydzn-0.1.1 → pydzn-0.1.3}/README.md +0 -0
- {pydzn-0.1.1 → pydzn-0.1.3}/setup.cfg +0 -0
- {pydzn-0.1.1 → pydzn-0.1.3}/src/pydzn/__init__.py +0 -0
- {pydzn-0.1.1/src/pydzn/components → pydzn-0.1.3/src/pydzn/components/button}/__init__.py +0 -0
- {pydzn-0.1.1 → pydzn-0.1.3}/src/pydzn/components/button/template.html +0 -0
- {pydzn-0.1.1 → pydzn-0.1.3}/src/pydzn/dzn.py +0 -0
- {pydzn-0.1.1 → pydzn-0.1.3}/src/pydzn.egg-info/dependency_links.txt +0 -0
- {pydzn-0.1.1 → pydzn-0.1.3}/src/pydzn.egg-info/requires.txt +0 -0
- {pydzn-0.1.1 → pydzn-0.1.3}/src/pydzn.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pydzn
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
4
4
|
Summary: Tiny design-system utilities (Tailwind-like), composable HTML components, and a grid layout builder for Python/Jinja apps.
|
5
5
|
Author-email: Ryan Kirkish <ryan@foo.com>
|
6
6
|
License: Apache-2.0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "pydzn"
|
7
|
-
version = "0.1.
|
7
|
+
version = "0.1.3"
|
8
8
|
description = "Tiny design-system utilities (Tailwind-like), composable HTML components, and a grid layout builder for Python/Jinja apps."
|
9
9
|
readme = "README.md"
|
10
10
|
requires-python = ">=3.10"
|
@@ -53,10 +53,8 @@ include-package-data = true
|
|
53
53
|
|
54
54
|
[tool.setuptools.packages.find]
|
55
55
|
where = ["src"]
|
56
|
-
# If your package is exactly "pydzn" at src/pydzn, this will find it (and subpackages).
|
57
56
|
|
58
57
|
[tool.setuptools.package-data]
|
59
|
-
# Ship component assets next to their modules so BaseComponent can find template.html/styles.css
|
60
58
|
pydzn = [
|
61
59
|
"**/*.html",
|
62
60
|
"**/*.css",
|
@@ -64,8 +62,6 @@ pydzn = [
|
|
64
62
|
"py.typed"
|
65
63
|
]
|
66
64
|
|
67
|
-
# --- Optional tooling config (nice defaults) ---
|
68
|
-
|
69
65
|
[tool.black]
|
70
66
|
target-version = ["py310"]
|
71
67
|
line-length = 100
|
@@ -0,0 +1,15 @@
|
|
1
|
+
from pydzn.base_component import BaseComponent
|
2
|
+
|
3
|
+
|
4
|
+
class Card(BaseComponent):
|
5
|
+
"""
|
6
|
+
Renders a card element.
|
7
|
+
Expects `template.html`
|
8
|
+
"""
|
9
|
+
|
10
|
+
def __init__(self, children: str | None = None, tag: str = "div", **html_attrs):
|
11
|
+
super().__init__(children=children, tag=tag, **html_attrs)
|
12
|
+
|
13
|
+
|
14
|
+
def context(self) -> dict:
|
15
|
+
return {}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from pydzn.base_component import BaseComponent
|
2
|
+
|
3
|
+
|
4
|
+
class Drawer(BaseComponent):
|
5
|
+
"""
|
6
|
+
Renders a drawer element.
|
7
|
+
Expects `template.html`
|
8
|
+
"""
|
9
|
+
|
10
|
+
def __init__(self, children: str | None = None, tag: str = "div", **html_attrs):
|
11
|
+
super().__init__(children=children, tag=tag, **html_attrs)
|
12
|
+
|
13
|
+
def context(self) -> dict:
|
14
|
+
return {}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
from pydzn.base_component import BaseComponent
|
2
|
+
from pydzn.dzn import register_dzn_classes
|
3
|
+
|
4
|
+
|
5
|
+
class NavItem(BaseComponent):
|
6
|
+
"""
|
7
|
+
Minimal sidebar/nav item.
|
8
|
+
- No default styling; pass dzn yourself.
|
9
|
+
- Put label/content in `children` (e.g., render a Text component).
|
10
|
+
- Optional: `active=True` to start active; `group_toggle=True` to clear
|
11
|
+
siblings and apply `active_classes` on click (client-only).
|
12
|
+
"""
|
13
|
+
|
14
|
+
def __init__(
|
15
|
+
self,
|
16
|
+
*,
|
17
|
+
children: str | None = None,
|
18
|
+
tag: str = "div",
|
19
|
+
dzn: str | None = None,
|
20
|
+
active: bool = False,
|
21
|
+
active_classes: list[str] | tuple[str, ...] | None = None,
|
22
|
+
group_toggle: bool = False,
|
23
|
+
**attrs,
|
24
|
+
):
|
25
|
+
# No default design; just pass through what caller wants.
|
26
|
+
self._active_classes = list(active_classes or [])
|
27
|
+
|
28
|
+
# If we'll toggle classes at runtime, pre-register them so /_dzn.css emits rules.
|
29
|
+
if self._active_classes:
|
30
|
+
register_dzn_classes(self._active_classes)
|
31
|
+
|
32
|
+
# Start active = append active classes up front
|
33
|
+
effective_dzn = (dzn or "")
|
34
|
+
if active and self._active_classes:
|
35
|
+
effective_dzn = (effective_dzn + " " + " ".join(self._active_classes)).strip()
|
36
|
+
|
37
|
+
# Sensible a11y defaults (still “unstyled”)
|
38
|
+
attrs.setdefault("role", "button")
|
39
|
+
attrs.setdefault("tabindex", "0")
|
40
|
+
|
41
|
+
# Optional sibling-clearing active toggle, only if requested and not overridden
|
42
|
+
if group_toggle and "hx-on:click" not in attrs and self._active_classes:
|
43
|
+
# Build JS that removes active classes from siblings, adds to this.
|
44
|
+
rm = ",".join(f"'{c}'" for c in self._active_classes)
|
45
|
+
add = rm
|
46
|
+
attrs["hx-on:click"] = (
|
47
|
+
"var p=this.parentElement;"
|
48
|
+
f"for(const el of p.children){{el.classList.remove({rm});}}"
|
49
|
+
f"this.classList.add({add});"
|
50
|
+
)
|
51
|
+
|
52
|
+
super().__init__(children=children or "", tag=tag, dzn=effective_dzn, **attrs)
|
53
|
+
|
54
|
+
def context(self) -> dict:
|
55
|
+
# No label here; use children (e.g., a Text component) for content.
|
56
|
+
return {}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
from pydzn.base_component import BaseComponent
|
2
|
+
|
3
|
+
|
4
|
+
class Sidebar(BaseComponent):
|
5
|
+
"""
|
6
|
+
Minimal sidebar container.
|
7
|
+
Spans parent height; default subtle panel bg.
|
8
|
+
The layout decides which side shows the divider.
|
9
|
+
"""
|
10
|
+
|
11
|
+
def __init__(self, *, children: str | None = None, tag: str = "div", dzn: str | None = None, **attrs):
|
12
|
+
super().__init__(children=children or "", tag=tag, dzn=dzn, **attrs)
|
13
|
+
|
14
|
+
def context(self) -> dict:
|
15
|
+
return {}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
from pydzn.base_component import BaseComponent
|
2
|
+
|
3
|
+
|
4
|
+
class Text(BaseComponent):
|
5
|
+
"""
|
6
|
+
Renders a text element.
|
7
|
+
Expects `template.html`
|
8
|
+
"""
|
9
|
+
|
10
|
+
def __init__(self, text: str = "", children: str | None = None, tag: str = "div", **html_attrs):
|
11
|
+
super().__init__(children=children, tag=tag, **html_attrs)
|
12
|
+
self.text = text
|
13
|
+
|
14
|
+
def context(self) -> dict:
|
15
|
+
return {"text": self.text}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pydzn
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
4
4
|
Summary: Tiny design-system utilities (Tailwind-like), composable HTML components, and a grid layout builder for Python/Jinja apps.
|
5
5
|
Author-email: Ryan Kirkish <ryan@foo.com>
|
6
6
|
License: Apache-2.0
|
@@ -0,0 +1,26 @@
|
|
1
|
+
LICENSE
|
2
|
+
README.md
|
3
|
+
pyproject.toml
|
4
|
+
src/pydzn/__init__.py
|
5
|
+
src/pydzn/base_component.py
|
6
|
+
src/pydzn/dzn.py
|
7
|
+
src/pydzn/grid_builder.py
|
8
|
+
src/pydzn.egg-info/PKG-INFO
|
9
|
+
src/pydzn.egg-info/SOURCES.txt
|
10
|
+
src/pydzn.egg-info/dependency_links.txt
|
11
|
+
src/pydzn.egg-info/requires.txt
|
12
|
+
src/pydzn.egg-info/top_level.txt
|
13
|
+
src/pydzn/components/__init__.py
|
14
|
+
src/pydzn/components/button/__init__.py
|
15
|
+
src/pydzn/components/button/component.py
|
16
|
+
src/pydzn/components/button/template.html
|
17
|
+
src/pydzn/components/card/component.py
|
18
|
+
src/pydzn/components/card/template.html
|
19
|
+
src/pydzn/components/drawer/component.py
|
20
|
+
src/pydzn/components/drawer/template.html
|
21
|
+
src/pydzn/components/nav_item/component.py
|
22
|
+
src/pydzn/components/nav_item/template.html
|
23
|
+
src/pydzn/components/sidebar/component.py
|
24
|
+
src/pydzn/components/sidebar/template.html
|
25
|
+
src/pydzn/components/text/component.py
|
26
|
+
src/pydzn/components/text/template.html
|
File without changes
|
@@ -1,16 +0,0 @@
|
|
1
|
-
LICENSE
|
2
|
-
README.md
|
3
|
-
pyproject.toml
|
4
|
-
src/pydzn/__init__.py
|
5
|
-
src/pydzn/base_component.py
|
6
|
-
src/pydzn/dzn.py
|
7
|
-
src/pydzn/grid_builder.py
|
8
|
-
src/pydzn.egg-info/PKG-INFO
|
9
|
-
src/pydzn.egg-info/SOURCES.txt
|
10
|
-
src/pydzn.egg-info/dependency_links.txt
|
11
|
-
src/pydzn.egg-info/requires.txt
|
12
|
-
src/pydzn.egg-info/top_level.txt
|
13
|
-
src/pydzn/components/__init__.py
|
14
|
-
src/pydzn/components/button/__init__.py
|
15
|
-
src/pydzn/components/button/component.py
|
16
|
-
src/pydzn/components/button/template.html
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|