pydzn 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.
pydzn-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
pydzn-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.4
2
+ Name: pydzn
3
+ Version: 0.1.0
4
+ Summary: Tiny design-system utilities (Tailwind-like), composable HTML components, and a grid layout builder for Python/Jinja apps.
5
+ Author-email: Your Name <you@example.com>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/anthonyrka/pydzn
8
+ Project-URL: Repository, https://github.com/anthonyrka/pydzn
9
+ Project-URL: Issues, https://github.com/anthonyrka/pydzn/issues
10
+ Keywords: design-system,css,utility-classes,jinja2,components,grid,htmx
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Framework :: Flask
20
+ Classifier: Topic :: Internet :: WWW/HTTP
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: Jinja2>=3.1
26
+ Provides-Extra: flask
27
+ Requires-Dist: Flask>=2.3; extra == "flask"
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=8; extra == "dev"
30
+ Requires-Dist: ruff>=0.5; extra == "dev"
31
+ Requires-Dist: black>=24; extra == "dev"
32
+ Requires-Dist: mypy>=1.10; extra == "dev"
33
+ Requires-Dist: build>=1.2; extra == "dev"
34
+ Requires-Dist: twine>=5; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # pydzn
38
+ Python web components for server-side rendering
pydzn-0.1.0/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # pydzn
2
+ Python web components for server-side rendering
@@ -0,0 +1,84 @@
1
+ [build-system]
2
+ requires = ["setuptools>=69", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pydzn"
7
+ version = "0.1.0"
8
+ description = "Tiny design-system utilities (Tailwind-like), composable HTML components, and a grid layout builder for Python/Jinja apps."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "Apache-2.0" }
12
+ authors = [
13
+ { name = "Your Name", email = "you@example.com" }
14
+ ]
15
+ keywords = ["design-system", "css", "utility-classes", "jinja2", "components", "grid", "htmx"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: Apache Software License",
20
+ "Programming Language :: Python",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Framework :: Flask",
26
+ "Topic :: Internet :: WWW/HTTP",
27
+ "Topic :: Software Development :: Libraries :: Python Modules"
28
+ ]
29
+
30
+ dependencies = [
31
+ "Jinja2>=3.1",
32
+ ]
33
+
34
+ [project.optional-dependencies]
35
+ flask = ["Flask>=2.3"]
36
+ dev = [
37
+ "pytest>=8",
38
+ "ruff>=0.5",
39
+ "black>=24",
40
+ "mypy>=1.10",
41
+ "build>=1.2",
42
+ "twine>=5"
43
+ ]
44
+
45
+ [project.urls]
46
+ Homepage = "https://github.com/anthonyrka/pydzn"
47
+ Repository = "https://github.com/anthonyrka/pydzn"
48
+ Issues = "https://github.com/anthonyrka/pydzn/issues"
49
+
50
+ [tool.setuptools]
51
+ package-dir = {"" = "src"}
52
+ include-package-data = true
53
+
54
+ [tool.setuptools.packages.find]
55
+ where = ["src"]
56
+ # If your package is exactly "pydzn" at src/pydzn, this will find it (and subpackages).
57
+
58
+ [tool.setuptools.package-data]
59
+ # Ship component assets next to their modules so BaseComponent can find template.html/styles.css
60
+ pydzn = [
61
+ "**/*.html",
62
+ "**/*.css",
63
+ "**/*.js",
64
+ "py.typed"
65
+ ]
66
+
67
+ # --- Optional tooling config (nice defaults) ---
68
+
69
+ [tool.black]
70
+ target-version = ["py310"]
71
+ line-length = 100
72
+
73
+ [tool.ruff]
74
+ line-length = 100
75
+ target-version = "py310"
76
+ select = ["E","F","I","W"]
77
+ exclude = ["build/", "dist/", ".venv/"]
78
+
79
+ [tool.mypy]
80
+ python_version = "3.10"
81
+ pretty = true
82
+ show_error_codes = true
83
+ strict = false
84
+ ignore_missing_imports = true
pydzn-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,153 @@
1
+ from abc import ABC, abstractmethod
2
+ import secrets
3
+ import re
4
+ import html as _html
5
+ import json
6
+ import inspect
7
+ from pathlib import Path
8
+ from jinja2 import Environment, FileSystemLoader, select_autoescape
9
+ from .base_agent import BaseAssistant
10
+ from .dzn import register_dzn_classes
11
+
12
+
13
+ class BaseComponent(ABC):
14
+ """
15
+ Abstract base for file-based HTML components using Jinja2.
16
+
17
+ Each component subclass must:
18
+ 1. Reside alongside a `template.html` file (or override `template_name`).
19
+ 2. Implement the `context()` method to supply template variables.
20
+
21
+ The constructor now accepts optional HTML attributes that get rendered
22
+ into the top-level tag under the variable `attrs`.
23
+ """
24
+ template_name: str = "template.html"
25
+ _asset_candidates = ("styles.css", "component.js")
26
+
27
+ def __init__(
28
+ self,
29
+ children: str | None = None,
30
+ tag: str = "div",
31
+ id: str | None = None,
32
+ styles: dict | None = None,
33
+ dzn: str | None = None,
34
+ **html_attrs,
35
+ ):
36
+ # Content & basic props
37
+ self.children = children or ""
38
+ self.tag = tag
39
+ self.html_attrs = html_attrs or {}
40
+ self.styles = dict(styles or {})
41
+ self.error_status = None
42
+
43
+ # merge dzn utility classes into class attr + register them
44
+ if dzn:
45
+ self.html_attrs["class"] = self._merge_classes(self.html_attrs.get("class", ""), dzn)
46
+ register_dzn_classes(dzn)
47
+
48
+ # Locate component dir/name
49
+ module_path = inspect.getfile(self.__class__)
50
+ base_dir = Path(module_path).resolve().parent
51
+ self.component_dir: Path = base_dir
52
+ self.component_name: str = base_dir.name
53
+
54
+ # Decide on id: explicit arg > html_attrs["id"] > generated
55
+ provided_id = id or self.html_attrs.get("id")
56
+ final_id = provided_id or self._gen_id(prefix=self.component_name)
57
+ self.html_attrs["id"] = str(final_id)
58
+ self.id = self.html_attrs["id"]
59
+
60
+ # Discover adjacent assets
61
+ discovered = [fname for fname in self._asset_candidates
62
+ if (self.component_dir / fname).exists()]
63
+ self.assets: list[str] = discovered
64
+
65
+ # Jinja env
66
+ self.env = Environment(
67
+ loader=FileSystemLoader(str(base_dir)),
68
+ autoescape=select_autoescape(["html", "xml"]),
69
+ trim_blocks=True,
70
+ lstrip_blocks=True,
71
+ )
72
+
73
+ def _update_error_status(self, error_body: dict, error_status_code: int):
74
+ self.error_status = (
75
+ json.dumps(error_body),
76
+ error_status_code,
77
+ {
78
+ "Content-Type": "application/json",
79
+ "HX-Trigger": json.dumps(
80
+ {"showMessage": error_body["message"]
81
+ })
82
+ })
83
+ return self.error_status
84
+
85
+ def set_style(self, key: str, value) -> None:
86
+ """Set/override a single CSS property. Pass None/False to remove it."""
87
+ k = key.replace("_", "-") # allow background_color → background-color
88
+ if value in (None, False):
89
+ self.styles.pop(k, None)
90
+ else:
91
+ self.styles[k] = str(value)
92
+
93
+ def _style_string(self) -> str:
94
+ """Merge any existing 'style' attr with styles dict; return final string or ''."""
95
+ parts = []
96
+ inline = self.html_attrs.get("style")
97
+ if inline:
98
+ parts.append(str(inline).rstrip().rstrip(";"))
99
+ if self.styles:
100
+ dict_str = "; ".join(f"{k}: {v}" for k, v in self.styles.items())
101
+ if dict_str:
102
+ parts.append(dict_str)
103
+ return "; ".join(parts) if parts else ""
104
+
105
+ def _merge_classes(self, base: str, extra: str) -> str:
106
+ seen, out = set(), []
107
+ for c in (base.split() + extra.split()):
108
+ if c and c not in seen:
109
+ seen.add(c); out.append(c)
110
+ return " ".join(out)
111
+
112
+ def _gen_id(self, prefix: str | None = None) -> str:
113
+ """Generate a short, readable, unique-ish id."""
114
+ # sanitize prefix to valid id-ish token
115
+ base = re.sub(r"[^a-zA-Z0-9_-]+", "-", (prefix or "x"))
116
+ token = secrets.token_hex(4) # 8 hex chars
117
+ return f"{base}-{token}"
118
+
119
+ @abstractmethod
120
+ def context(self) -> dict:
121
+ """
122
+ Return dict of template variables for rendering.
123
+ """
124
+ pass
125
+
126
+ def render(self) -> str:
127
+ """
128
+ Render `template_name` with the provided context,
129
+ injecting any HTML attributes into the variable `attrs`.
130
+ Templates should use `{{ attrs|safe }}` on their top-level tag.
131
+ """
132
+ # Build attribute string
133
+ attr_parts = []
134
+ for k, v in self.html_attrs.items():
135
+ if k == "style":
136
+ continue
137
+ attr_parts.append(f'{k}="{_html.escape(str(v), quote=True)}"')
138
+
139
+ # Merge style attr + styles dict; only add if non-empty
140
+ style_str = self._style_string()
141
+ if style_str:
142
+ attr_parts.append(f'style="{_html.escape(style_str, quote=True)}"')
143
+
144
+ attrs = " ".join(attr_parts)
145
+
146
+ # Context
147
+ ctx = self.context().copy()
148
+ ctx["attrs"] = attrs
149
+ ctx["children"] = self.children
150
+ ctx["tag"] = self.tag
151
+
152
+ tpl = self.env.get_template(self.template_name)
153
+ return tpl.render(**ctx)
File without changes
File without changes
@@ -0,0 +1,27 @@
1
+ from src.base_component import BaseComponent
2
+
3
+ class Button(BaseComponent):
4
+ """
5
+ Renders a button element.
6
+ Expects `template.html`
7
+ """
8
+
9
+ DEFAULT_DZN = (
10
+ "px-5 py-2 rounded-sm border-2 border-blue-500 "
11
+ "shadow-sm hover:shadow-md bg-[transparent] text-[#2563eb] "
12
+ )
13
+
14
+ def __init__(self, text: str = "", children: str | None = None,
15
+ tag: str = "button", dzn: str | None = None, **attrs):
16
+ # 2) Accept dzn both as a named arg and as a stray attribute (attrs["dzn"])
17
+ user_dzn = dzn or attrs.pop("dzn", None)
18
+
19
+ # 3) Merge: default + user-provided (so user can extend the default easily)
20
+ effective_dzn = (self.DEFAULT_DZN + " " + user_dzn).strip() if user_dzn else self.DEFAULT_DZN
21
+
22
+ # 4) Pass the merged dzn to BaseComponent (it will register + merge into class)
23
+ super().__init__(children=children, tag=tag, dzn=effective_dzn, **attrs)
24
+ self.text = text
25
+
26
+ def context(self) -> dict:
27
+ return {"text": self.text}
@@ -0,0 +1,3 @@
1
+ <{{ tag }}{% if attrs %} {{ attrs|safe }}{% endif %}>
2
+ {{ text }}{{ children|safe }}
3
+ </{{ tag }}>
@@ -0,0 +1,286 @@
1
+ from __future__ import annotations
2
+ import re
3
+ from typing import Iterable
4
+
5
+ # --- tokens (extend as needed) ---
6
+ TOKENS = {
7
+ "space": {
8
+ "0": "0",
9
+ "1": ".25rem", "2": ".5rem", "3": ".75rem", "4": "1rem",
10
+ "5": "1.25rem", "6": "1.5rem", "7": "1.75rem", "8": "2rem",
11
+ "9": "2.25rem", "10": "2.5rem", "11": "2.75rem","12": "3rem",
12
+ "14": "3.5rem", "16": "4rem", "20": "5rem", "24": "6rem",
13
+ "28": "7rem", "32": "8rem"
14
+ },
15
+ "radius": {
16
+ "none": "0", "sm": "8px", "md": "12px", "lg": "16px",
17
+ "xl": "20px", "2xl": "24px", "3xl": "32px", "full": "9999px"
18
+ },
19
+ "shadow": {
20
+ "none": "none",
21
+ "sm": "0 1px 3px rgba(0,0,0,.08)",
22
+ "md": "0 2px 6px rgba(0,0,0,.10)",
23
+ "lg": "0 6px 18px rgba(0,0,0,.12)",
24
+ "xl": "0 12px 32px rgba(0,0,0,.14)",
25
+ "2xl": "0 20px 56px rgba(0,0,0,.16)",
26
+ "3xl": "0 32px 80px rgba(0,0,0,.18)",
27
+ "inner":"inset 0 2px 6px rgba(0,0,0,.12)"
28
+ },
29
+ "border_width": { "0": "0", "DEFAULT": "1px", "2": "2px", "4": "4px", "8": "8px" },
30
+ "border_color": {
31
+ "subtle": "rgba(15,23,42,.06)",
32
+ "transparent": "transparent",
33
+ "black": "rgba(0,0,0,1)",
34
+ "white": "rgba(255,255,255,1)",
35
+ "slate-200": "rgb(226,232,240)",
36
+ "slate-300": "rgb(203,213,225)",
37
+ "slate-400": "rgb(148,163,184)",
38
+ "blue-500": "rgb(59,130,246)",
39
+ "red-500": "rgb(239,68,68)",
40
+ "green-500": "rgb(34,197,94)"
41
+ }
42
+ }
43
+
44
+ # --- responsive breakpoints ---
45
+ BPS = {
46
+ "sm": "(min-width: 640px)",
47
+ "md": "(min-width: 768px)",
48
+ "lg": "(min-width: 1024px)",
49
+ }
50
+
51
+ _used: set[str] = set()
52
+
53
+ def register_dzn_classes(classes: str | Iterable[str]) -> None:
54
+ if isinstance(classes, str):
55
+ _used.update(c for c in classes.split() if c)
56
+ else:
57
+ _used.update(classes)
58
+
59
+ # --- selector escaping for arbitrary utilities ---
60
+ def css_escape_class(cls: str) -> str:
61
+ # Escape any char not [a-zA-Z0-9_-] so the selector matches the literal class in HTML
62
+ return re.sub(r'([^a-zA-Z0-9_-])', r'\\\1', cls)
63
+
64
+ # --- emit helpers ---
65
+ def rule(selector: str, body: str) -> str:
66
+ return f".{selector}{{{body}}}"
67
+
68
+ def emit_base(name: str) -> str | None:
69
+ match name:
70
+ # layout
71
+ case "flex": return rule(name, "display:flex")
72
+ case "flex-col": return rule(name, "flex-direction:column")
73
+ case "items-center": return rule(name, "align-items:center")
74
+ case "justify-center": return rule(name, "justify-content:center")
75
+ case "text-center": return rule(name, "text-align:center")
76
+
77
+ # border (longhand for predictable overrides)
78
+ case "border":
79
+ return rule(name,
80
+ f"border-style:solid;"
81
+ f"border-width:{TOKENS['border_width']['DEFAULT']};"
82
+ f"border-color:{TOKENS['border_color']['subtle']}"
83
+ )
84
+
85
+ # quick border colors
86
+ case "border-subtle": return rule(name, f"border-color:{TOKENS['border_color']['subtle']}")
87
+ case "border-transparent": return rule(name, f"border-color:{TOKENS['border_color']['transparent']}")
88
+ case "border-black": return rule(name, f"border-color:{TOKENS['border_color']['black']}")
89
+ case "border-white": return rule(name, f"border-color:{TOKENS['border_color']['white']}")
90
+
91
+ # radius
92
+ case "rounded": return rule(name, "border-radius:12px")
93
+ case "rounded-none": return rule(name, "border-radius:0")
94
+
95
+ # shadows
96
+ case "shadow-none": return rule(name, f"box-shadow:{TOKENS['shadow']['none']}")
97
+ case "shadow-sm": return rule(name, f"box-shadow:{TOKENS['shadow']['sm']}")
98
+ case "shadow": return rule(name, f"box-shadow:{TOKENS['shadow']['md']}")
99
+ case "shadow-md": return rule(name, f"box-shadow:{TOKENS['shadow']['md']}")
100
+ case "shadow-lg": return rule(name, f"box-shadow:{TOKENS['shadow']['lg']}")
101
+ case "shadow-xl": return rule(name, f"box-shadow:{TOKENS['shadow']['xl']}")
102
+ case "shadow-2xl": return rule(name, f"box-shadow:{TOKENS['shadow']['2xl']}")
103
+ case "shadow-3xl": return rule(name, f"box-shadow:{TOKENS['shadow']['3xl']}")
104
+ case "shadow-inner": return rule(name, f"box-shadow:{TOKENS['shadow']['inner']}")
105
+
106
+ # visibility
107
+ case "hidden": return rule(name, "display:none")
108
+ case "block": return rule(name, "display:block") # handy for toggling back
109
+ case "inline-block": return rule(name, "display:inline-block")
110
+ case "invisible": return rule(name, "visibility:hidden") # keeps layout
111
+ case "visible": return rule(name, "visibility:visible")
112
+
113
+ # positioning
114
+ case "fixed": return rule(name, "position:fixed")
115
+ case "absolute": return rule(name, "position:absolute")
116
+ case "relative": return rule(name, "position:relative")
117
+ case "top-0": return rule(name, "top:0")
118
+ case "right-0": return rule(name, "right:0")
119
+ case "bottom-0": return rule(name, "bottom:0")
120
+ case "left-0": return rule(name, "left:0")
121
+ case "inset-0": return rule(name, "top:0;right:0;bottom:0;left:0")
122
+
123
+ case "flex-1": return rule(name, "flex:1 1 0%")
124
+ case "grow": return rule(name, "flex-grow:1")
125
+ case "shrink-0": return rule(name, "flex-shrink:0")
126
+
127
+ case "grid": return rule(name, "display:grid")
128
+
129
+ case "border-solid": return rule(name, "border-style:solid")
130
+ case "border-dashed": return rule(name, "border-style:dashed")
131
+ case "border-dotted": return rule(name, "border-style:dotted")
132
+
133
+ case "aspect-square": return rule(name, "aspect-ratio:1/1")
134
+
135
+ return None
136
+
137
+ def emit_scale(name: str) -> str | None:
138
+ # spacing
139
+ if m := re.fullmatch(r"gap-(\d+)", name):
140
+ if (val := TOKENS["space"].get(m.group(1))) is not None:
141
+ return rule(name, f"gap:{val}")
142
+ if m := re.fullmatch(r"p-(\d+)", name):
143
+ if (val := TOKENS["space"].get(m.group(1))) is not None:
144
+ return rule(name, f"padding:{val}")
145
+ if m := re.fullmatch(r"px-(\d+)", name):
146
+ if (val := TOKENS["space"].get(m.group(1))) is not None:
147
+ return rule(name, f"padding-left:{val};padding-right:{val}")
148
+ if m := re.fullmatch(r"py-(\d+)", name):
149
+ if (val := TOKENS["space"].get(m.group(1))) is not None:
150
+ return rule(name, f"padding-top:{val};padding-bottom:{val}")
151
+
152
+ # border widths
153
+ if m := re.fullmatch(r"border-(0|2|4|8)", name):
154
+ w = TOKENS["border_width"][m.group(1)]
155
+ return rule(name, f"border-width:{w}")
156
+ if m := re.fullmatch(r"border-(x|y)(?:-(0|2|4|8))?", name):
157
+ axis, wkey = m.group(1), m.group(2) or "DEFAULT"
158
+ w = TOKENS["border_width"][wkey]
159
+ if axis == "x":
160
+ return rule(name, f"border-left-width:{w};border-right-width:{w}")
161
+ else:
162
+ return rule(name, f"border-top-width:{w};border-bottom-width:{w}")
163
+ if m := re.fullmatch(r"border-(t|r|b|l)(?:-(0|2|4|8))?", name):
164
+ side, wkey = m.group(1), m.group(2) or "DEFAULT"
165
+ w = TOKENS["border_width"][wkey]
166
+ prop = {"t":"top","r":"right","b":"bottom","l":"left"}[side]
167
+ return rule(name, f"border-{prop}-width:{w}")
168
+
169
+ # border colors by token (e.g., border-slate-300)
170
+ if m := re.fullmatch(r"border-([a-z0-9-]+)", name):
171
+ col = TOKENS["border_color"].get(m.group(1))
172
+ if col is not None:
173
+ return rule(name, f"border-color:{col}")
174
+
175
+ # rounded scale
176
+ if m := re.fullmatch(r"rounded-([a-z0-9]+)", name):
177
+ key = m.group(1); val = TOKENS["radius"].get(key)
178
+ if val is not None:
179
+ return rule(name, f"border-radius:{val}")
180
+ if m := re.fullmatch(r"rounded-(t|r|b|l)-([a-z0-9]+)", name):
181
+ side, key = m.group(1), m.group(2)
182
+ val = TOKENS["radius"].get(key)
183
+ if val is None:
184
+ return None
185
+ if side == "t":
186
+ body = f"border-top-left-radius:{val};border-top-right-radius:{val}"
187
+ elif side == "r":
188
+ body = f"border-top-right-radius:{val};border-bottom-right-radius:{val}"
189
+ elif side == "b":
190
+ body = f"border-bottom-right-radius:{val};border-bottom-left-radius:{val}"
191
+ else:
192
+ body = f"border-top-left-radius:{val};border-bottom-left-radius:{val}"
193
+ return rule(name, body)
194
+ if m := re.fullmatch(r"rounded-(tl|tr|br|bl)-([a-z0-9]+)", name):
195
+ corner, key = m.group(1), m.group(2)
196
+ val = TOKENS["radius"].get(key)
197
+ if val is None:
198
+ return None
199
+ prop = {"tl":"top-left","tr":"top-right","br":"bottom-right","bl":"bottom-left"}[corner]
200
+ return rule(name, f"border-{prop}-radius:{val}")
201
+
202
+ return None
203
+
204
+ def emit_arbitrary(name: str) -> str | None:
205
+ esel = css_escape_class(name)
206
+
207
+ # width
208
+ if m := re.fullmatch(r"w-\[(.+?)\]", name):
209
+ return rule(esel, f"width:{m.group(1)}")
210
+
211
+ # padding
212
+ if m := re.fullmatch(r"p-\[(.+?)\]", name):
213
+ return rule(esel, f"padding:{m.group(1)}")
214
+ if m := re.fullmatch(r"px-\[(.+?)\]", name):
215
+ v = m.group(1); return rule(esel, f"padding-left:{v};padding-right:{v}")
216
+ if m := re.fullmatch(r"py-\[(.+?)\]", name):
217
+ v = m.group(1); return rule(esel, f"padding-top:{v};padding-bottom:{v}")
218
+
219
+ # gap
220
+ if m := re.fullmatch(r"gap-\[(.+?)\]", name):
221
+ return rule(esel, f"gap:{m.group(1)}")
222
+
223
+ # border width arbitrary
224
+ if m := re.fullmatch(r"border-\[(.+?)\]", name):
225
+ return rule(esel, f"border-width:{m.group(1)}")
226
+
227
+ # rounded arbitrary
228
+ if m := re.fullmatch(r"rounded-\[(.+?)\]", name):
229
+ return rule(esel, f"border-radius:{m.group(1)}")
230
+
231
+ # shadow arbitrary (underscores become spaces)
232
+ if m := re.fullmatch(r"shadow-\[(.+?)\]", name):
233
+ return rule(esel, f"box-shadow:{m.group(1).replace('_',' ')}")
234
+
235
+ # colors
236
+ if m := re.fullmatch(r"bg-\[(.+?)\]", name):
237
+ return rule(esel, f"background:{m.group(1).replace('_',' ')}")
238
+ if m := re.fullmatch(r"text-\[(.+?)\]", name):
239
+ return rule(esel, f"color:{m.group(1).replace('_',' ')}")
240
+
241
+ # size
242
+ if m := re.fullmatch(r"h-\[(.+?)\]", name):
243
+ return rule(css_escape_class(name), f"height:{m.group(1)}")
244
+
245
+ # grid template columns: grid-cols-[280px_1fr] (underscores -> spaces)
246
+ if m := re.fullmatch(r"grid-cols-\[(.+?)\]", name):
247
+ v = m.group(1).replace("_", " ")
248
+ return rule(css_escape_class(name), f"grid-template-columns:{v}")
249
+
250
+ # grid template rows: grid-rows-[auto_1fr] (underscores -> spaces)
251
+ if m := re.fullmatch(r"grid-rows-\[(.+?)\]", name):
252
+ v = m.group(1).replace("_", " ")
253
+ return rule(css_escape_class(name), f"grid-template-rows:{v}")
254
+
255
+ return None
256
+
257
+ # --- variants ---
258
+ def wrap_variant(sel: str, css: str, variant: str) -> str:
259
+ esel = css_escape_class(sel)
260
+ if variant in BPS:
261
+ return f"@media {BPS[variant]}{{{css}}}"
262
+ if variant == "hover":
263
+ return css.replace(f".{esel}{{", f".{variant}\\:{esel}:hover{{")
264
+ if variant == "focus":
265
+ return css.replace(f".{esel}{{", f".{variant}\\:{esel}:focus{{")
266
+ return css
267
+
268
+ def emit_one(cls: str) -> str | None:
269
+ parts = cls.split(":")
270
+ base = parts[-1]
271
+ variants = parts[:-1]
272
+
273
+ css = emit_base(base) or emit_scale(base) or emit_arbitrary(base)
274
+ if not css:
275
+ return None
276
+ for v in reversed(variants):
277
+ css = wrap_variant(base, css, v)
278
+ return css
279
+
280
+ def compile_used_css() -> str:
281
+ out: list[str] = []
282
+ for cls in sorted(_used):
283
+ css = emit_one(cls)
284
+ if css:
285
+ out.append(css)
286
+ return "\n".join(out)
@@ -0,0 +1,255 @@
1
+ from __future__ import annotations
2
+ from dataclasses import dataclass
3
+ from typing import Dict, List, Optional, Union, Tuple
4
+ import html
5
+ from src.dzn import register_dzn_classes
6
+
7
+
8
+ CSSVal = Union[int, str]
9
+
10
+
11
+ def _css_px(v: CSSVal) -> str:
12
+ if isinstance(v, int):
13
+ return f"{v}px"
14
+ return str(v)
15
+
16
+ def _join_tokens(parts: List[str]) -> str:
17
+ # DZN arbitrary classes use "_" instead of spaces inside [...]
18
+ return "_".join(p.replace(" ", "_") for p in parts)
19
+
20
+ def _grid_cols_class(named_cols: List[Tuple[str, str]]) -> str:
21
+ return f"grid-cols-[{_join_tokens([w for _, w in named_cols])}]"
22
+
23
+ def _grid_rows_class(named_rows: List[Tuple[str, str]]) -> str:
24
+ return f"grid-rows-[{_join_tokens([h for _, h in named_rows])}]"
25
+
26
+ @dataclass
27
+ class _Region:
28
+ name: str
29
+ col_name: str
30
+ row_name: Optional[str] # if None, will resolve to first row
31
+ col_span: int = 1
32
+ row_span: Optional[int] = 1 # if None => span all rows
33
+ dzn: str = ""
34
+
35
+ # placement resolved at build-time (indexes)
36
+ _col_index: int = 1
37
+ _row_index: int = 1
38
+ _row_span_resolved: int = 1
39
+
40
+ def placement_style(self) -> str:
41
+ gc = f"{self._col_index} / span {self.col_span}"
42
+ gr = f"{self._row_index} / span {self._row_span_resolved}"
43
+ return f"grid-column:{gc};grid-row:{gr};"
44
+
45
+ class GridLayoutBuilder:
46
+ """
47
+ Intuitive rows/columns named builder.
48
+
49
+ You define tracks by NAME (order preserved), then drop regions by name:
50
+
51
+ DashboardLayout = (
52
+ layout_builder()
53
+ .columns(sidebar=280, main="1fr")
54
+ .rows(hero="auto", content="1fr")
55
+ .region("sidebar", col="sidebar", row=None, row_span=None) # spans all rows
56
+ .region("hero", col="main", row="hero")
57
+ .region("content", col="main", row="content")
58
+ .build(name="DashboardLayout")
59
+ )
60
+
61
+ Then use on any page:
62
+
63
+ html = DashboardLayout(debug=True).render(
64
+ sidebar=sidebar_html,
65
+ hero=hero_html,
66
+ content=content_html
67
+ )
68
+ """
69
+
70
+ def __init__(self):
71
+ self._named_cols: List[Tuple[str, str]] = [("main", "1fr")]
72
+ self._named_rows: List[Tuple[str, str]] = [("content", "1fr")]
73
+ self._regions: List[_Region] = []
74
+ self._outer_dzn: str = "" # keep empty by default (no forced classes)
75
+ self._height_css: str = "100vh" # default grid height
76
+
77
+ # ---------------- tracks (named & ordered) ----------------
78
+ def columns(self, **spec: CSSVal) -> "GridLayoutBuilder":
79
+ """
80
+ Define columns with names, in the order you pass them:
81
+ .columns(sidebar=280, main="1fr")
82
+ """
83
+ if not spec:
84
+ raise ValueError("columns(): provide at least one named column")
85
+ self._named_cols = [(k, _css_px(v)) for k, v in spec.items()]
86
+ return self
87
+
88
+ def rows(self, **spec: CSSVal) -> "GridLayoutBuilder":
89
+ """
90
+ Define rows with names, in the order you pass them:
91
+ .rows(hero="auto", content="1fr")
92
+ """
93
+ if not spec:
94
+ raise ValueError("rows(): provide at least one named row")
95
+ self._named_rows = [(k, _css_px(v)) for k, v in spec.items()]
96
+ return self
97
+
98
+ def add_column(self, name: str, width: CSSVal) -> "GridLayoutBuilder":
99
+ self._named_cols.append((name, _css_px(width)))
100
+ return self
101
+
102
+ def add_row(self, name: str, height: CSSVal) -> "GridLayoutBuilder":
103
+ self._named_rows.append((name, _css_px(height)))
104
+ return self
105
+
106
+ def fill_height(self, css_value: str = "100vh") -> "GridLayoutBuilder":
107
+ self._height_css = css_value
108
+ return self
109
+
110
+ # ---------------- convenience shapes ----------------
111
+ def with_sidebar(self, *, width: CSSVal = 280, position: str = "left") -> "GridLayoutBuilder":
112
+ """
113
+ Quick two-column pattern with sidebar + main.
114
+ Rows untouched; add rows() or add_row() after if you want multiple rows.
115
+ """
116
+ pos = "right" if str(position).lower() == "right" else "left"
117
+ if pos == "left":
118
+ self._named_cols = [("sidebar", _css_px(width)), ("main", "1fr")]
119
+ else:
120
+ self._named_cols = [("main", "1fr"), ("sidebar", _css_px(width))]
121
+ return self
122
+
123
+ # ---------------- regions ----------------
124
+ def region(
125
+ self,
126
+ name: str,
127
+ *,
128
+ col: str,
129
+ row: Optional[str],
130
+ col_span: int = 1,
131
+ row_span: Optional[int] = 1, # None = span all rows
132
+ dzn: str = "",
133
+ ) -> "GridLayoutBuilder":
134
+ """
135
+ Add a region by track names. Example:
136
+ .region("sidebar", col="sidebar", row=None, row_span=None) # full height
137
+ .region("hero", col="main", row="hero")
138
+ .region("content", col="main", row="content")
139
+ """
140
+ self._regions.append(
141
+ _Region(
142
+ name=name,
143
+ col_name=col,
144
+ row_name=row,
145
+ col_span=col_span,
146
+ row_span=row_span,
147
+ dzn=dzn,
148
+ )
149
+ )
150
+ return self
151
+
152
+ # ---------------- build ----------------
153
+ def build(self, *, name: str = "BuiltGridLayout"):
154
+ # Prepare grid class names (optional styling)
155
+ grid_cols = _grid_cols_class(self._named_cols)
156
+ grid_rows = _grid_rows_class(self._named_rows)
157
+ register_dzn_classes([grid_cols, grid_rows]) # let /_dzn.css emit helpers if needed
158
+ register_dzn_classes(["grid"]) # if you have .grid { display:grid } in dzn
159
+
160
+ # name→index maps
161
+ col_index: Dict[str, int] = {n: i + 1 for i, (n, _) in enumerate(self._named_cols)}
162
+ row_index: Dict[str, int] = {n: i + 1 for i, (n, _) in enumerate(self._named_rows)}
163
+ total_rows = len(self._named_rows)
164
+
165
+ # resolve placements (indices, spans)
166
+ resolved: Dict[str, _Region] = {}
167
+ order: List[str] = []
168
+ for r in self._regions:
169
+ if r.col_name not in col_index:
170
+ raise ValueError(f"Unknown column '{r.col_name}' for region '{r.name}'")
171
+ r._col_index = col_index[r.col_name]
172
+
173
+ if r.row_name is None:
174
+ r._row_index = 1
175
+ r._row_span_resolved = total_rows if r.row_span is None else r.row_span
176
+ else:
177
+ if r.row_name not in row_index:
178
+ raise ValueError(f"Unknown row '{r.row_name}' for region '{r.name}'")
179
+ r._row_index = row_index[r.row_name]
180
+ r._row_span_resolved = total_rows - (r._row_index - 1) if r.row_span is None else r.row_span
181
+
182
+ resolved[r.name] = r
183
+ order.append(r.name)
184
+
185
+ height_css = self._height_css
186
+
187
+ class _Layout:
188
+ __slots__ = ("_grid_cols", "_grid_rows", "_regions", "_order",
189
+ "_outer_dzn", "_region_dzn", "_debug")
190
+
191
+ def __init__(
192
+ self,
193
+ *,
194
+ outer_dzn: str = "",
195
+ region_dzn: Optional[Dict[str, str]] = None,
196
+ debug: bool = False,
197
+ ):
198
+ self._grid_cols = grid_cols
199
+ self._grid_rows = grid_rows
200
+ self._regions = resolved
201
+ self._order = order
202
+ self._outer_dzn = outer_dzn or ""
203
+ self._region_dzn = region_dzn or {}
204
+ self._debug = bool(debug)
205
+
206
+ if self._outer_dzn:
207
+ register_dzn_classes(self._outer_dzn)
208
+ if self._region_dzn:
209
+ register_dzn_classes(" ".join(self._region_dzn.values()))
210
+
211
+ def render(self, **slots: str) -> str:
212
+ # outer wrapper (no template)
213
+ outer_attr = f' class="{html.escape(self._outer_dzn)}"' if self._outer_dzn else ""
214
+ # ensure grid without relying on dzn
215
+ grid_style = f"display:grid;min-height:{html.escape(height_css)};"
216
+ grid_class = f"{self._grid_cols} {self._grid_rows}".strip()
217
+
218
+ out: List[str] = []
219
+ out.append(f"<div{outer_attr}>")
220
+ out.append(f' <div class="{html.escape(grid_class)}" style="{grid_style}">')
221
+
222
+ for name in self._order:
223
+ R = self._regions[name]
224
+ slot_html = slots.get(name, "") or ""
225
+ region_cls = " ".join(c for c in [R.dzn, self._region_dzn.get(name, "")] if c).strip()
226
+ region_cls_attr = f' class="{html.escape(region_cls)}"' if region_cls else ""
227
+ region_style_attr = f' style="{html.escape(R.placement_style())}"'
228
+
229
+ if self._debug:
230
+ dbg = "outline:1px dashed rgba(220,38,38,.55);outline-offset:-1px;"
231
+ region_style_attr = region_style_attr[:-1] + dbg + '"' # append
232
+
233
+ out.append(f' <div data-region="{html.escape(name)}"{region_cls_attr}{region_style_attr}>')
234
+
235
+ if self._debug:
236
+ out.append(
237
+ ' <div style="font:11px/1.2 system-ui, -apple-system, Segoe UI, Roboto;'
238
+ 'color:rgba(220,38,38,.8);padding:2px 4px;display:inline-block;">'
239
+ f'{html.escape(name)}</div>'
240
+ )
241
+
242
+ if slot_html:
243
+ out.append(f" {slot_html}")
244
+ out.append(" </div>")
245
+
246
+ out.append(" </div>")
247
+ out.append("</div>")
248
+ return "\n".join(out)
249
+
250
+ _Layout.__name__ = name
251
+ return _Layout
252
+
253
+
254
+ def layout_builder() -> GridLayoutBuilder:
255
+ return GridLayoutBuilder()
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.4
2
+ Name: pydzn
3
+ Version: 0.1.0
4
+ Summary: Tiny design-system utilities (Tailwind-like), composable HTML components, and a grid layout builder for Python/Jinja apps.
5
+ Author-email: Your Name <you@example.com>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/anthonyrka/pydzn
8
+ Project-URL: Repository, https://github.com/anthonyrka/pydzn
9
+ Project-URL: Issues, https://github.com/anthonyrka/pydzn/issues
10
+ Keywords: design-system,css,utility-classes,jinja2,components,grid,htmx
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Framework :: Flask
20
+ Classifier: Topic :: Internet :: WWW/HTTP
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: Jinja2>=3.1
26
+ Provides-Extra: flask
27
+ Requires-Dist: Flask>=2.3; extra == "flask"
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=8; extra == "dev"
30
+ Requires-Dist: ruff>=0.5; extra == "dev"
31
+ Requires-Dist: black>=24; extra == "dev"
32
+ Requires-Dist: mypy>=1.10; extra == "dev"
33
+ Requires-Dist: build>=1.2; extra == "dev"
34
+ Requires-Dist: twine>=5; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # pydzn
38
+ Python web components for server-side rendering
@@ -0,0 +1,16 @@
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
@@ -0,0 +1,12 @@
1
+ Jinja2>=3.1
2
+
3
+ [dev]
4
+ pytest>=8
5
+ ruff>=0.5
6
+ black>=24
7
+ mypy>=1.10
8
+ build>=1.2
9
+ twine>=5
10
+
11
+ [flask]
12
+ Flask>=2.3
@@ -0,0 +1 @@
1
+ pydzn