hedron-core 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.
Files changed (29) hide show
  1. hedron_core-0.1.0/.gitignore +20 -0
  2. hedron_core-0.1.0/CHANGELOG.md +33 -0
  3. hedron_core-0.1.0/LICENSE +21 -0
  4. hedron_core-0.1.0/PKG-INFO +80 -0
  5. hedron_core-0.1.0/README.md +50 -0
  6. hedron_core-0.1.0/pyproject.toml +63 -0
  7. hedron_core-0.1.0/src/hedron_core/__init__.py +186 -0
  8. hedron_core-0.1.0/src/hedron_core/_html_meta.py +366 -0
  9. hedron_core-0.1.0/src/hedron_core/_nodes.py +72 -0
  10. hedron_core-0.1.0/src/hedron_core/_serializer.py +168 -0
  11. hedron_core-0.1.0/src/hedron_core/builtins/__init__.py +74 -0
  12. hedron_core-0.1.0/src/hedron_core/builtins/_base.py +25 -0
  13. hedron_core-0.1.0/src/hedron_core/builtins/content.py +211 -0
  14. hedron_core-0.1.0/src/hedron_core/builtins/controls.py +100 -0
  15. hedron_core-0.1.0/src/hedron_core/builtins/document.py +108 -0
  16. hedron_core-0.1.0/src/hedron_core/builtins/forms.py +455 -0
  17. hedron_core-0.1.0/src/hedron_core/builtins/landmarks.py +61 -0
  18. hedron_core-0.1.0/src/hedron_core/builtins/layout.py +158 -0
  19. hedron_core-0.1.0/src/hedron_core/builtins/surfaces.py +132 -0
  20. hedron_core-0.1.0/src/hedron_core/component.py +178 -0
  21. hedron_core-0.1.0/src/hedron_core/diagnostics.py +100 -0
  22. hedron_core-0.1.0/src/hedron_core/field.py +145 -0
  23. hedron_core-0.1.0/src/hedron_core/html.py +194 -0
  24. hedron_core-0.1.0/src/hedron_core/identifiers.py +47 -0
  25. hedron_core-0.1.0/src/hedron_core/models.py +200 -0
  26. hedron_core-0.1.0/src/hedron_core/py.typed +0 -0
  27. hedron_core-0.1.0/src/hedron_core/registry.py +140 -0
  28. hedron_core-0.1.0/src/hedron_core/rendering.py +279 -0
  29. hedron_core-0.1.0/src/hedron_core/security.py +344 -0
@@ -0,0 +1,20 @@
1
+ .DS_Store
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ .eggs/
7
+ dist/
8
+ build/
9
+ .venv/
10
+ venv/
11
+ .env
12
+ .coverage
13
+ htmlcov/
14
+ .pytest_cache/
15
+ .mypy_cache/
16
+ .ruff_cache/
17
+ .hypothesis/
18
+ .tox/
19
+ .nox/
20
+ *.html.gz
@@ -0,0 +1,33 @@
1
+ # Changelog
2
+
3
+ All notable changes to `hedron-core` are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
7
+ with the Hedron coordinated release train (`0.N.0` for phase `0.N`).
8
+
9
+ ## [0.1.0] - 2026-08-03
10
+
11
+ Initial public release of the framework-neutral typed rendering core.
12
+
13
+ ### Added
14
+
15
+ - `Model`, `Props`, `FormModel`, `EventPayload`, and `Field` with construction-time
16
+ validation and supported-annotation guardrails.
17
+ - Trust boundary types: `Secret`, `TrustedHtml`, `SafeUrl`, and `UrlPurpose`.
18
+ - Component protocol, children/slots/fragments, deterministic identity, and sealable
19
+ registry.
20
+ - Private context-aware HTML serializer with XSS-hardening defaults (blocked active
21
+ tags/attrs, SafeUrl purpose checks, unknown-attribute rejection).
22
+ - `render(...) -> RenderResult` with PAGE and FRAGMENT modes and frozen result maps.
23
+ - Phase 0.1 built-ins for document, content, forms, layout, landmarks, surfaces,
24
+ and controls, including FormField accessibility contracts.
25
+ - Typed package marker (`py.typed`) and offline reference-app static rendering proof.
26
+
27
+ ### Security
28
+
29
+ - Contextual escaping for text and attributes.
30
+ - Secret redaction in diagnostics and identity records.
31
+ - Adversarial escaping corpus covering XSS smuggling paths exercised in CI.
32
+
33
+ [0.1.0]: https://github.com/eddiethedean/hedron/releases/tag/v0.1.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Odos Matthews
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,80 @@
1
+ Metadata-Version: 2.4
2
+ Name: hedron-core
3
+ Version: 0.1.0
4
+ Summary: Framework-neutral typed rendering core for Hedron
5
+ Project-URL: Homepage, https://github.com/eddiethedean/hedron
6
+ Project-URL: Repository, https://github.com/eddiethedean/hedron
7
+ Project-URL: Issues, https://github.com/eddiethedean/hedron/issues
8
+ Project-URL: Changelog, https://github.com/eddiethedean/hedron/blob/main/packages/hedron-core/CHANGELOG.md
9
+ Project-URL: Documentation, https://github.com/eddiethedean/hedron/tree/main/docs
10
+ Author-email: Odos Matthews <odosmatthews@gmail.com>
11
+ Maintainer-email: Odos Matthews <odosmatthews@gmail.com>
12
+ License-Expression: MIT
13
+ License-File: LICENSE
14
+ Keywords: components,html,htmx,pydantic,rendering,server-rendered,typed
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Classifier: Typing :: Typed
27
+ Requires-Python: <3.15,>=3.12
28
+ Requires-Dist: pydantic<2.14,>=2.13.4
29
+ Description-Content-Type: text/markdown
30
+
31
+ # hedron-core
32
+
33
+ Framework-neutral typed rendering core for Hedron (`0.1.0`).
34
+
35
+ Defines models, security boundary types, components, the HTML serializer, and
36
+ the public `render(...) -> RenderResult` API with **no** FastAPI, Flask, Django,
37
+ ASGI, or WSGI dependency.
38
+
39
+ ## Install
40
+
41
+ ```bash
42
+ pip install hedron-core
43
+ # or
44
+ uv add hedron-core
45
+ ```
46
+
47
+ Requires Python 3.12, 3.13, or 3.14.
48
+
49
+ ## Quick start
50
+
51
+ ```python
52
+ from hedron_core import Page, RenderContext, RenderMode, Text, render
53
+
54
+ result = render(
55
+ Page(Text("Hello, Hedron"), title="Demo"),
56
+ context=RenderContext.standalone(locale="en"),
57
+ mode=RenderMode.PAGE,
58
+ )
59
+ print(result.html)
60
+ ```
61
+
62
+ ## What this package includes
63
+
64
+ - `Model`, `Props`, `FormModel`, `EventPayload`, and `Field`
65
+ - Trust boundary types: `Secret`, `TrustedHtml`, `SafeUrl`, `UrlPurpose`
66
+ - Component protocol, registry, diagnostics, and deterministic identity
67
+ - Context-aware HTML serializer and `render(...) -> RenderResult`
68
+ - Phase 0.1 built-ins for pages, forms, layout, landmarks, and content
69
+
70
+ ## What it does not include
71
+
72
+ - HTTP routing, FastAPI/Flask/Django adapters, HTMX request handling
73
+ - HDN, scoped CSS, CLI, Component Explorer, charts, or data grids
74
+
75
+ Those arrive in later Hedron phases. See the [project README](https://github.com/eddiethedean/hedron)
76
+ and [roadmap](https://github.com/eddiethedean/hedron/blob/main/ROADMAP.md).
77
+
78
+ ## License
79
+
80
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,50 @@
1
+ # hedron-core
2
+
3
+ Framework-neutral typed rendering core for Hedron (`0.1.0`).
4
+
5
+ Defines models, security boundary types, components, the HTML serializer, and
6
+ the public `render(...) -> RenderResult` API with **no** FastAPI, Flask, Django,
7
+ ASGI, or WSGI dependency.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pip install hedron-core
13
+ # or
14
+ uv add hedron-core
15
+ ```
16
+
17
+ Requires Python 3.12, 3.13, or 3.14.
18
+
19
+ ## Quick start
20
+
21
+ ```python
22
+ from hedron_core import Page, RenderContext, RenderMode, Text, render
23
+
24
+ result = render(
25
+ Page(Text("Hello, Hedron"), title="Demo"),
26
+ context=RenderContext.standalone(locale="en"),
27
+ mode=RenderMode.PAGE,
28
+ )
29
+ print(result.html)
30
+ ```
31
+
32
+ ## What this package includes
33
+
34
+ - `Model`, `Props`, `FormModel`, `EventPayload`, and `Field`
35
+ - Trust boundary types: `Secret`, `TrustedHtml`, `SafeUrl`, `UrlPurpose`
36
+ - Component protocol, registry, diagnostics, and deterministic identity
37
+ - Context-aware HTML serializer and `render(...) -> RenderResult`
38
+ - Phase 0.1 built-ins for pages, forms, layout, landmarks, and content
39
+
40
+ ## What it does not include
41
+
42
+ - HTTP routing, FastAPI/Flask/Django adapters, HTMX request handling
43
+ - HDN, scoped CSS, CLI, Component Explorer, charts, or data grids
44
+
45
+ Those arrive in later Hedron phases. See the [project README](https://github.com/eddiethedean/hedron)
46
+ and [roadmap](https://github.com/eddiethedean/hedron/blob/main/ROADMAP.md).
47
+
48
+ ## License
49
+
50
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,63 @@
1
+ [project]
2
+ name = "hedron-core"
3
+ version = "0.1.0"
4
+ description = "Framework-neutral typed rendering core for Hedron"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12,<3.15"
7
+ license = "MIT"
8
+ license-files = ["LICENSE"]
9
+ authors = [
10
+ { name = "Odos Matthews", email = "odosmatthews@gmail.com" },
11
+ ]
12
+ maintainers = [
13
+ { name = "Odos Matthews", email = "odosmatthews@gmail.com" },
14
+ ]
15
+ keywords = [
16
+ "components",
17
+ "html",
18
+ "htmx",
19
+ "pydantic",
20
+ "rendering",
21
+ "server-rendered",
22
+ "typed",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 3 - Alpha",
26
+ "Intended Audience :: Developers",
27
+ "License :: OSI Approved :: MIT License",
28
+ "Programming Language :: Python",
29
+ "Programming Language :: Python :: 3",
30
+ "Programming Language :: Python :: 3 :: Only",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ "Programming Language :: Python :: 3.14",
34
+ "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
35
+ "Topic :: Software Development :: Libraries :: Python Modules",
36
+ "Typing :: Typed",
37
+ ]
38
+ dependencies = [
39
+ "pydantic>=2.13.4,<2.14",
40
+ ]
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/eddiethedean/hedron"
44
+ Repository = "https://github.com/eddiethedean/hedron"
45
+ Issues = "https://github.com/eddiethedean/hedron/issues"
46
+ Changelog = "https://github.com/eddiethedean/hedron/blob/main/packages/hedron-core/CHANGELOG.md"
47
+ Documentation = "https://github.com/eddiethedean/hedron/tree/main/docs"
48
+
49
+ [build-system]
50
+ requires = ["hatchling"]
51
+ build-backend = "hatchling.build"
52
+
53
+ [tool.hatch.build.targets.wheel]
54
+ packages = ["src/hedron_core"]
55
+
56
+ [tool.hatch.build.targets.sdist]
57
+ only-include = [
58
+ "src/hedron_core",
59
+ "README.md",
60
+ "CHANGELOG.md",
61
+ "LICENSE",
62
+ "pyproject.toml",
63
+ ]
@@ -0,0 +1,186 @@
1
+ """hedron-core: framework-neutral typed rendering core."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from hedron_core.builtins import (
6
+ Alert,
7
+ Aside,
8
+ Badge,
9
+ Button,
10
+ Card,
11
+ Checkbox,
12
+ CodeBlock,
13
+ Container,
14
+ DescriptionList,
15
+ Divider,
16
+ Footer,
17
+ Form,
18
+ FormErrors,
19
+ FormField,
20
+ Fragment,
21
+ Grid,
22
+ Head,
23
+ Header,
24
+ Heading,
25
+ IconButton,
26
+ Image,
27
+ Inline,
28
+ Label,
29
+ Link,
30
+ LinkButton,
31
+ List,
32
+ Main,
33
+ Nav,
34
+ Page,
35
+ RadioGroup,
36
+ Section,
37
+ Select,
38
+ Skeleton,
39
+ Stack,
40
+ SubmitButton,
41
+ Table,
42
+ Text,
43
+ TextArea,
44
+ TextInput,
45
+ Title,
46
+ )
47
+ from hedron_core.component import Component, ComponentNode, NodeLike
48
+ from hedron_core.diagnostics import Diagnostic, DiagnosticSeverity, HedronError
49
+ from hedron_core.field import Field
50
+ from hedron_core.html import html
51
+ from hedron_core.models import EventPayload, FormModel, Model, Props
52
+ from hedron_core.registry import get_registry, register_component, seal_registry
53
+ from hedron_core.rendering import AssetRef, RenderContext, RenderMode, RenderResult, render
54
+ from hedron_core.security import SafeUrl, Secret, TrustedHtml, UrlPurpose
55
+
56
+ __version__ = "0.1.0"
57
+
58
+ __all__ = [
59
+ "Alert",
60
+ "Aside",
61
+ "AssetRef",
62
+ "Badge",
63
+ "Button",
64
+ "Card",
65
+ "Checkbox",
66
+ "CodeBlock",
67
+ "Component",
68
+ "ComponentNode",
69
+ "Container",
70
+ "DescriptionList",
71
+ "Diagnostic",
72
+ "DiagnosticSeverity",
73
+ "Divider",
74
+ "EventPayload",
75
+ "Field",
76
+ "Footer",
77
+ "Form",
78
+ "FormErrors",
79
+ "FormField",
80
+ "FormModel",
81
+ "Fragment",
82
+ "Grid",
83
+ "Head",
84
+ "Header",
85
+ "Heading",
86
+ "HedronError",
87
+ "IconButton",
88
+ "Image",
89
+ "Inline",
90
+ "Label",
91
+ "Link",
92
+ "LinkButton",
93
+ "List",
94
+ "Main",
95
+ "Model",
96
+ "Nav",
97
+ "NodeLike",
98
+ "Page",
99
+ "Props",
100
+ "RadioGroup",
101
+ "RenderContext",
102
+ "RenderMode",
103
+ "RenderResult",
104
+ "SafeUrl",
105
+ "Secret",
106
+ "Section",
107
+ "Select",
108
+ "Skeleton",
109
+ "Stack",
110
+ "SubmitButton",
111
+ "Table",
112
+ "Text",
113
+ "TextArea",
114
+ "TextInput",
115
+ "Title",
116
+ "TrustedHtml",
117
+ "UrlPurpose",
118
+ "__version__",
119
+ "get_registry",
120
+ "html",
121
+ "register_component",
122
+ "render",
123
+ "seal_registry",
124
+ ]
125
+
126
+
127
+ def _register_builtins() -> None:
128
+ for cls in (
129
+ Page,
130
+ Fragment,
131
+ Head,
132
+ Title,
133
+ Header,
134
+ Main,
135
+ Nav,
136
+ Aside,
137
+ Footer,
138
+ Section,
139
+ Container,
140
+ Stack,
141
+ Inline,
142
+ Grid,
143
+ Divider,
144
+ Heading,
145
+ Text,
146
+ Link,
147
+ Image,
148
+ CodeBlock,
149
+ List,
150
+ DescriptionList,
151
+ Table,
152
+ Card,
153
+ Badge,
154
+ Alert,
155
+ Skeleton,
156
+ Button,
157
+ LinkButton,
158
+ IconButton,
159
+ Form,
160
+ FormField,
161
+ Label,
162
+ TextInput,
163
+ TextArea,
164
+ Select,
165
+ Checkbox,
166
+ RadioGroup,
167
+ SubmitButton,
168
+ FormErrors,
169
+ ):
170
+ logical = (
171
+ f"{getattr(cls, 'distribution', 'hedron-core')}:"
172
+ f"{cls.__module__}.{getattr(cls, 'logical_name', cls.__name__)}"
173
+ )
174
+ register_component(
175
+ logical_id=logical,
176
+ name=getattr(cls, "logical_name", cls.__name__) or cls.__name__,
177
+ module=cls.__module__,
178
+ distribution=getattr(cls, "distribution", "hedron-core"),
179
+ props_model=getattr(cls, "props_type", type(None)).__name__,
180
+ slots=getattr(cls, "slots", {}),
181
+ accessibility_notes="Uses native semantic HTML without JavaScript.",
182
+ )
183
+ # Do not seal on import — applications seal at lifespan; tests may register more.
184
+
185
+
186
+ _register_builtins()