fjkit 0.3.0__tar.gz → 0.4.2__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.
- {fjkit-0.3.0 → fjkit-0.4.2}/PKG-INFO +2 -2
- {fjkit-0.3.0 → fjkit-0.4.2}/README.md +1 -1
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/README.md +2 -2
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/assets/brand.css +20 -1
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/assets/components.js +13 -13
- fjkit-0.4.2/docs/workbench/assets/demo-dark.jpg +0 -0
- fjkit-0.4.2/docs/workbench/assets/demo-light.jpg +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/assets/learn.js +6 -6
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/build.py +84 -6
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/cheatsheet.py +51 -23
- fjkit-0.4.2/docs/workbench/templates/_architecture.html +129 -0
- fjkit-0.4.2/docs/workbench/templates/architecture.html +189 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/cheatsheet.html +10 -10
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/components.html +23 -24
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/introduction.html +62 -8
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/learn.html +69 -67
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/plugins.html +52 -38
- fjkit-0.4.2/docs/workbench/templates/why.html +92 -0
- fjkit-0.4.2/docs/workbench/templates/zh/architecture.html +182 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/zh/components.html +1 -1
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/zh/introduction.html +50 -2
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/zh/learn.html +5 -3
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/zh/plugins.html +19 -5
- fjkit-0.4.2/docs/workbench/templates/zh/why.html +87 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/pyproject.toml +1 -1
- {fjkit-0.3.0 → fjkit-0.4.2}/scripts/vendor_ui.py +10 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/auth/plugin.py +92 -13
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/cli/build_css.py +10 -1
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/cli/check.py +39 -23
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/cli/eject.py +174 -54
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/cli/ejected.py +6 -1
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/config.py +7 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/errors.py +68 -26
- fjkit-0.4.2/src/fjkit/sse.py +188 -0
- fjkit-0.4.2/src/fjkit/static/dist/fjkit-luma.css +2 -0
- fjkit-0.4.2/src/fjkit/static/dist/fjkit-lyra.css +2 -0
- fjkit-0.4.2/src/fjkit/static/dist/fjkit-maia.css +2 -0
- fjkit-0.4.2/src/fjkit/static/dist/fjkit-mira.css +2 -0
- fjkit-0.4.2/src/fjkit/static/dist/fjkit-nova.css +2 -0
- fjkit-0.4.2/src/fjkit/static/dist/fjkit-rhea.css +2 -0
- fjkit-0.4.2/src/fjkit/static/dist/fjkit-sera.css +2 -0
- fjkit-0.4.2/src/fjkit/static/dist/fjkit-vega.css +2 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/js/resize.js +36 -10
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/js/reveal.js +8 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/src/fjkit.css +31 -14
- fjkit-0.4.2/src/fjkit/static/vendor/htmx/sse.min.js +1 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/data.html +31 -6
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/form.html +11 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/sidebar.html +37 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/swap.html +36 -1
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/table.html +22 -4
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templating.py +22 -3
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/vendored.py +17 -1
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/test_auth.py +156 -9
- fjkit-0.4.2/tests/test_authority.py +75 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/test_components.py +133 -1
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/test_docs_site.py +58 -1
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/test_errors.py +91 -0
- fjkit-0.4.2/tests/test_readme.py +146 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/test_rendering.py +3 -3
- fjkit-0.4.2/tests/test_sse.py +206 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/test_style_packs.py +13 -1
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/test_vocabulary.py +121 -0
- fjkit-0.3.0/src/fjkit/static/dist/fjkit-luma.css +0 -2
- fjkit-0.3.0/src/fjkit/static/dist/fjkit-lyra.css +0 -2
- fjkit-0.3.0/src/fjkit/static/dist/fjkit-maia.css +0 -2
- fjkit-0.3.0/src/fjkit/static/dist/fjkit-mira.css +0 -2
- fjkit-0.3.0/src/fjkit/static/dist/fjkit-nova.css +0 -2
- fjkit-0.3.0/src/fjkit/static/dist/fjkit-rhea.css +0 -2
- fjkit-0.3.0/src/fjkit/static/dist/fjkit-sera.css +0 -2
- fjkit-0.3.0/src/fjkit/static/dist/fjkit-vega.css +0 -2
- {fjkit-0.3.0 → fjkit-0.4.2}/.gitignore +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/LICENSE +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/assets/common.js +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/assets/mock-server.js +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/build_data.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/_diagram.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/_parts.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/_shell_diagram.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/base.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/docs/workbench/templates/zh/cheatsheet.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/scripts/vendor_icons.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/__init__.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/auth/__init__.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/auth/csrf.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/auth/errors.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/auth/sources.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/auth/stores.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/auth/types.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/cli/__init__.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/cli/vocabulary.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/flash.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/forms.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/htmx.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/icons.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/messages.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/mounting.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/plugins.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/py.typed +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/rendering.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/signing.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/brand/torii-bolt.png +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/icons/lucide.json +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/js/errors.js +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/js/multiselect.js +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/js/select.js +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/base/base.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/basecoat-base.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/basecoat-components.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/basecoat-luma.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/basecoat-lyra.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/basecoat-maia.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/basecoat-mira.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/basecoat-nova.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/basecoat-rhea.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/basecoat-sera.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/basecoat-vega.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/basecoat.all.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/basecoat.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/accordion.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/alert.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/avatar.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/badge.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/breadcrumb.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/button-group.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/button.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/card.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/chart.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/checkbox.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/collapsible.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/combobox.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/command.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/dialog.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/drawer.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/dropdown-menu.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/empty.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/field.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/form.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/input-group.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/input.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/item.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/kbd.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/label.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/native-select.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/popover.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/progress.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/radio.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/range.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/scrollbar.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/select.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/sidebar.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/skeleton.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/switch.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/table.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/tabs.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/textarea.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/toast.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/components/tooltip.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/js/all.min.js +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/styles/luma.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/styles/lyra.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/styles/maia.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/styles/mira.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/styles/nova.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/styles/rhea.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/styles/sera.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/basecoat/styles/vega.css +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/htmx/htmx.min.js +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/htmx/idiomorph-ext.min.js +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/static/vendor/htmx/json-enc.js +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/styles.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/errors/page.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/attrs.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/button.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/disclosure.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/feedback.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/icon.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/layout.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/nav.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/overlay.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/shell.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/src/fjkit/templates/ui/tabs.html +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/conftest.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/test_color_scheme.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/test_flash.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/test_messages.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/test_mounting.py +0 -0
- {fjkit-0.3.0 → fjkit-0.4.2}/tests/test_plugins.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fjkit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Server-rendered UI kit for FastAPI — Jinja2 + Basecoat + htmx, no front-end build
|
|
5
5
|
Project-URL: Homepage, https://liweicheng00.github.io/fjkit/
|
|
6
6
|
Project-URL: Documentation, https://liweicheng00.github.io/fjkit/
|
|
@@ -129,7 +129,7 @@ uv run fjkit check app/templates
|
|
|
129
129
|
|
|
130
130
|
**[Docs](https://liweicheng00.github.io/fjkit/)**
|
|
131
131
|
|
|
132
|
-
Status: 0.
|
|
132
|
+
Status: 0.4.2. Macro signatures can change before 1.0.
|
|
133
133
|
|
|
134
134
|
## License
|
|
135
135
|
|
|
@@ -111,8 +111,8 @@ your app.
|
|
|
111
111
|
| A macro cannot be misused | signatures take closed enumerations and never a class string |
|
|
112
112
|
| Page and htmx swap cannot drift | one partial, embedded by the page and returned by the endpoints |
|
|
113
113
|
|
|
114
|
-
The diagrams behind these decisions are
|
|
115
|
-
|
|
114
|
+
The diagrams behind these decisions are the site's Architecture page —
|
|
115
|
+
`templates/architecture.html`, beside this file.
|
|
116
116
|
|
|
117
117
|
## Commands
|
|
118
118
|
|
|
@@ -111,13 +111,32 @@ main .card > footer:first-child {
|
|
|
111
111
|
.code-block [data-t="a"] { color: var(--info); }
|
|
112
112
|
|
|
113
113
|
/*
|
|
114
|
-
* GAP 2 — a diagram
|
|
114
|
+
* GAP 2 — a figure surface: a diagram, and now a screenshot.
|
|
115
115
|
*
|
|
116
116
|
* `_diagram.html` is an SVG, and no component library should be drawing one.
|
|
117
117
|
* What is missing is only the frame and the "stage lighting" the request demo
|
|
118
118
|
* drives — both keyed off `data-lit`, so the markup carries no class either
|
|
119
119
|
* way. Arguably a `figure()` macro; more likely this stays an app's problem.
|
|
120
|
+
*
|
|
121
|
+
* The Introduction page added the second half of the same gap: a raster figure.
|
|
122
|
+
* A UI kit whose landing page shows nothing it rendered is asking to be taken
|
|
123
|
+
* on trust, so the page carries a screenshot of `examples/fjkit-demo` — and
|
|
124
|
+
* carries it twice, because the claim being illustrated includes dark mode and
|
|
125
|
+
* one picture can only make half of it. Measured: 47 KB each, 94 KB for the
|
|
126
|
+
* pair, on one page. `data-figure` names which scheme a file is for, so the
|
|
127
|
+
* markup stays class-free; `.dark` on the right of the selector is the kit's
|
|
128
|
+
* own theme hook, documented in `ui/shell.html`, not a class this site coined.
|
|
129
|
+
*
|
|
130
|
+
* What a `figure()` macro would own: these four rules and the caption. What it
|
|
131
|
+
* would not solve: both files download whichever scheme is showing. Fixing
|
|
132
|
+
* that needs `<picture>`, and `<picture>` keys off the media query while the
|
|
133
|
+
* toggle keys off the class, so the two disagree the moment a visitor toggles.
|
|
120
134
|
*/
|
|
135
|
+
img[data-figure] { display: block; width: 100%; height: auto; }
|
|
136
|
+
img[data-figure="dark"] { display: none; }
|
|
137
|
+
.dark img[data-figure="light"] { display: none; }
|
|
138
|
+
.dark img[data-figure="dark"] { display: block; }
|
|
139
|
+
|
|
121
140
|
svg[role="img"] {
|
|
122
141
|
display: block;
|
|
123
142
|
width: 100%;
|
|
@@ -291,7 +291,7 @@ const MACROS = {
|
|
|
291
291
|
: "";
|
|
292
292
|
return `{% from "ui/data.html" import card %}\n\n${pre}{% call card(${args}) %}\n <p>${p.body}</p>\n{% endcall %}`;
|
|
293
293
|
},
|
|
294
|
-
caption: "actions takes pre-rendered markup rather than a second slot
|
|
294
|
+
caption: "actions takes pre-rendered markup rather than a second slot. A two-slot call block runs its body once per slot, which is wrong for a heavy body. padded=false lets a table sit flush against the edges.",
|
|
295
295
|
},
|
|
296
296
|
|
|
297
297
|
table: {
|
|
@@ -664,7 +664,7 @@ const SHOWCASE = {
|
|
|
664
664
|
required=true, revealable=true) }}
|
|
665
665
|
|
|
666
666
|
{% block scripts %}{{ reveal_scripts() }}{% endblock %}`,
|
|
667
|
-
caption: "Live on this page — click Show. The button is markup and the script is four lines. Two things make it correct: the
|
|
667
|
+
caption: "Live on this page — click Show. The button is markup and the script is four lines. Two things make it correct: the script delegates the listener from document, because a 422 is most likely to swap out the form a password sits in and take a listener bound to the old button with it; and it finds the input through aria-controls, so nothing hard-codes the id the macro chose. reveal_scripts() is per page, never in the shell.",
|
|
668
668
|
},
|
|
669
669
|
|
|
670
670
|
section: {
|
|
@@ -719,7 +719,7 @@ const SHOWCASE = {
|
|
|
719
719
|
{% call list_item() %}Templates are compiled once per process.{% endcall %}
|
|
720
720
|
{% call list_item() %}A row costs a function call, not a lookup.{% endcall %}
|
|
721
721
|
{% endcall %}`,
|
|
722
|
-
caption: "Two blocks rather than a list argument, because an item is markup
|
|
722
|
+
caption: "Two blocks rather than a list argument, because an item is markup. It can hold a badge, a link or a kbd without the caller escaping anything.",
|
|
723
723
|
},
|
|
724
724
|
|
|
725
725
|
inline: {
|
|
@@ -824,7 +824,7 @@ const SHOWCASE = {
|
|
|
824
824
|
{% endcall %}
|
|
825
825
|
{{ progress(0, label="Upload", id="bar") }}
|
|
826
826
|
{% endcall %}`,
|
|
827
|
-
caption: "encoding=\"multipart\" is not optional — without it the route
|
|
827
|
+
caption: "encoding=\"multipart\" is not optional — without it the route gets the file's name as a string, and the POST succeeds having saved nothing. progress names the bar; htmx reports what it has sent and the form macro writes the number into the width, aria-valuenow and the printed percentage. No JavaScript file is added. file_field takes no value: a browser will not let a page refill a file input, so a 422 redraw returns this box empty while every other field keeps what was typed.",
|
|
828
828
|
},
|
|
829
829
|
|
|
830
830
|
description_list: {
|
|
@@ -836,7 +836,7 @@ const SHOWCASE = {
|
|
|
836
836
|
{{ description_item("Owner", "Ada Lovelace") }}
|
|
837
837
|
{% call description_item("Notes") %}<p>Two lines fit here without a clamp.</p>{% endcall %}
|
|
838
838
|
{% endcall %}`,
|
|
839
|
-
caption: "A native <dl>, so each value
|
|
839
|
+
caption: "A native <dl>, so a screen reader announces each value as the definition of its term — the relationship item_list does not carry. layout=\"rows\" puts the term beside the value once there is room for two columns; layout=\"stacked\" keeps it above at every width.",
|
|
840
840
|
},
|
|
841
841
|
|
|
842
842
|
alert: {
|
|
@@ -880,7 +880,7 @@ const SHOWCASE = {
|
|
|
880
880
|
("board", "Board"),
|
|
881
881
|
("settings", "Settings")]) }}
|
|
882
882
|
{% endblock %}`,
|
|
883
|
-
caption: "Route names, not URLs
|
|
883
|
+
caption: "Route names, not URLs. The active state compares routes rather than string-matching paths, so it stays right when a URL grows a query string. Past about six destinations this is the wrong component — fill the shell's sidebar block instead.",
|
|
884
884
|
},
|
|
885
885
|
|
|
886
886
|
theme_toggle: {
|
|
@@ -898,7 +898,7 @@ const SHOWCASE = {
|
|
|
898
898
|
{{ breadcrumb([("Board", "/"),
|
|
899
899
|
("Tasks", "/tasks"),
|
|
900
900
|
("Ship the vocabulary", none)]) }}`,
|
|
901
|
-
caption: "A pair whose href is none is the current page
|
|
901
|
+
caption: "A pair whose href is none is the current page. It renders as a span with aria-current, not a link. That is the shape of the argument, so a trail cannot be built with the current page linked to itself.",
|
|
902
902
|
},
|
|
903
903
|
|
|
904
904
|
avatar: {
|
|
@@ -942,7 +942,7 @@ const SHOWCASE = {
|
|
|
942
942
|
{% endcall %}
|
|
943
943
|
{% call collapsible("Can I edit a component?") %}…{% endcall %}
|
|
944
944
|
{% endcall %}`,
|
|
945
|
-
caption: "A native <details
|
|
945
|
+
caption: "A native <details>. Open state, keyboard operation and the disclosure role all come from the element. accordion adds the class Basecoat watches to close the siblings; multiple withholds it, so allowing several open panels ships no JS rather than JS asked to do nothing.",
|
|
946
946
|
},
|
|
947
947
|
|
|
948
948
|
tooltip: {
|
|
@@ -952,7 +952,7 @@ const SHOWCASE = {
|
|
|
952
952
|
{% call tooltip("Saves without leaving the page", side="top") %}
|
|
953
953
|
{{ button("Save", variant="outline") }}
|
|
954
954
|
{% endcall %}`,
|
|
955
|
-
caption: "Drawn from a data-tooltip attribute and CSS content() — no second element, no JavaScript. That also means the text is not in the accessibility tree
|
|
955
|
+
caption: "Drawn from a data-tooltip attribute and CSS content() — no second element, no JavaScript. That also means the text is not in the accessibility tree. A tooltip is a hint, never the only label a control has.",
|
|
956
956
|
},
|
|
957
957
|
|
|
958
958
|
popover: {
|
|
@@ -979,7 +979,7 @@ const SHOWCASE = {
|
|
|
979
979
|
{{ menu_item("Wrap long lines", checked=true) }}
|
|
980
980
|
{{ menu_item("Log out", variant="destructive") }}
|
|
981
981
|
{% endcall %}`,
|
|
982
|
-
caption: "menu_item switches role with the state it reports: menuitemcheckbox when
|
|
982
|
+
caption: "menu_item switches role with the state it reports: menuitemcheckbox when you pass checked, menuitemradio for radio. A menu is not a select — it runs commands and leaves nothing in a form submission.",
|
|
983
983
|
},
|
|
984
984
|
|
|
985
985
|
select_menu: {
|
|
@@ -988,7 +988,7 @@ const SHOWCASE = {
|
|
|
988
988
|
|
|
989
989
|
{{ select_menu("theme", [("light", "Light"), ("dark", "Dark")],
|
|
990
990
|
selected="dark", label="Theme") }}`,
|
|
991
|
-
caption: "Prefer select_field. A native <select> is correct
|
|
991
|
+
caption: "Prefer select_field. A native <select> is correct with no work and costs one element; this is thirty and needs JS. Reach for it when a row needs markup an <option> cannot hold. The value sits in a hidden input, pre-filled so an untouched form still posts.",
|
|
992
992
|
},
|
|
993
993
|
|
|
994
994
|
combobox: {
|
|
@@ -1019,7 +1019,7 @@ const SHOWCASE = {
|
|
|
1019
1019
|
|
|
1020
1020
|
{{ combobox("labels", label_options, selected=task.labels,
|
|
1021
1021
|
multiple=true, placeholder="Add a label", label="Labels") }}`,
|
|
1022
|
-
caption: "Same hidden input and the same script as select_menu; what differs is where the selection
|
|
1022
|
+
caption: "Same hidden input and the same script as select_menu; what differs is where the selection appears — Basecoat draws it as chips from JS, so this preview starts empty while the select's does not. Both are worth their cost only past about a dozen options; below that a checkbox group in a fieldset posts the same thing and needs no script at all.",
|
|
1023
1023
|
},
|
|
1024
1024
|
|
|
1025
1025
|
drawer: {
|
|
@@ -1099,7 +1099,7 @@ const SNIPPET = {
|
|
|
1099
1099
|
{% endcall %}
|
|
1100
1100
|
{% endcall %}
|
|
1101
1101
|
{% endblock %}`,
|
|
1102
|
-
caption: "The rail on the left of this page is this call. Route names again, so the current page
|
|
1102
|
+
caption: "The rail on the left of this page is this call. Route names again, so comparing routes decides the current page; open=false is the desktop starting state only, because a narrow screen renders the panel as a full-screen overlay and a page that opens under its own navigation is a bug. sidebar_submenu is a <details>, so the open state and the keyboard are the browser's.",
|
|
1103
1103
|
},
|
|
1104
1104
|
|
|
1105
1105
|
toaster: {
|
|
Binary file
|
|
Binary file
|
|
@@ -3,7 +3,7 @@ const WIRING = [
|
|
|
3
3
|
{
|
|
4
4
|
file: "app/main.py",
|
|
5
5
|
lang: "python",
|
|
6
|
-
why: "Two calls. FjkitConfig holds every
|
|
6
|
+
why: "Two calls. FjkitConfig holds every setting; mount_fjkit serves the kit's assets from inside the installed package and compiles the environment once, at construction.",
|
|
7
7
|
code: `from fastapi import FastAPI
|
|
8
8
|
from fjkit import FjkitConfig, mount_fjkit
|
|
9
9
|
|
|
@@ -528,7 +528,7 @@ const PATTERNS = [
|
|
|
528
528
|
tag: 'hx-trigger="keyup changed delay:400ms"',
|
|
529
529
|
doc: { label: "examples/active-search", href: "https://htmx.org/examples/active-search/" },
|
|
530
530
|
when: "<b>A list narrows while the user types</b> — and you want one request, not one per keystroke.",
|
|
531
|
-
caption: "changed drops the request when the value did not
|
|
531
|
+
caption: "changed drops the request when the value did not move: arrows, modifiers, a retyped character. delay:400ms restarts the countdown on every keystroke, so a fast typist sends one request instead of twelve. The extra search event catches the native clear button that type=\"search\" gets for free.",
|
|
532
532
|
files: [
|
|
533
533
|
{
|
|
534
534
|
label: "tasks/_search.html",
|
|
@@ -644,7 +644,7 @@ def board(service, status=None, owner=None) -> BoardResponse:
|
|
|
644
644
|
aria_label="Delete " ~ task.title,
|
|
645
645
|
hx_delete=url_for(request, "tasks_delete", task_id=task.id) ~ filter_query,
|
|
646
646
|
hx_target="#board", hx_swap="outerHTML",
|
|
647
|
-
hx_confirm="Delete
|
|
647
|
+
hx_confirm="Delete '" ~ task.title ~ "'?") }}`,
|
|
648
648
|
},
|
|
649
649
|
{
|
|
650
650
|
label: "router.py",
|
|
@@ -665,7 +665,7 @@ def delete_task(service: ServiceDep, task_id: int,
|
|
|
665
665
|
tag: 'hx-trigger="load delay:2s"',
|
|
666
666
|
doc: { label: "docs/#polling", href: "https://htmx.org/docs/#polling" },
|
|
667
667
|
when: "<b>A job, an import, a build.</b> Refresh while it runs, and stop when it finishes.",
|
|
668
|
-
caption: "Polling that ends when the work does
|
|
668
|
+
caption: "Polling that ends when the work does. While the job runs the partial re-arms itself, and the finished render carries no hx-trigger, so the last response is the one that stopped asking. hx-trigger=\"every 2s\" never stops on its own — the server has to answer 286, htmx's stop-polling status, or something has to remove the element. Either shape costs one request per interval per open tab, so keep the handler cheap and the interval honest. Below a couple of seconds, reach for SSE instead.",
|
|
669
669
|
files: [
|
|
670
670
|
{
|
|
671
671
|
label: "jobs/_job.html",
|
|
@@ -730,7 +730,7 @@ def tasks_report(service: ServiceDep) -> ReportResponse:
|
|
|
730
730
|
tag: 'hx-target="closest tr"',
|
|
731
731
|
doc: { label: "examples/click-to-load", href: "https://htmx.org/examples/click-to-load/" },
|
|
732
732
|
when: "<b>A long list, one page at a time</b> — with no page number living in the browser.",
|
|
733
|
-
caption: "The sentinel row replaces itself with the next page, which carries the next sentinel — or nothing, when the rows run out.
|
|
733
|
+
caption: "The sentinel row replaces itself with the next page, which carries the next sentinel — or nothing, when the rows run out. The client counts nothing. The only thing that advances is the cursor the server sent. Swap the trigger to revealed and the same endpoint becomes infinite scroll; keep the button and the list stays reachable from the keyboard.",
|
|
734
734
|
files: [
|
|
735
735
|
{
|
|
736
736
|
label: "tasks/_rows.html",
|
|
@@ -844,7 +844,7 @@ def update_task(service: ServiceDep, task_id: int, title: Annotated[str, Form()]
|
|
|
844
844
|
tag: "change — and hx-include",
|
|
845
845
|
doc: { label: "examples/value-select", href: "https://htmx.org/examples/value-select/" },
|
|
846
846
|
when: "<b>Pick a project, and the owner list narrows</b> to the people on it.",
|
|
847
|
-
caption: "A select fires on change by default, so there is no hx-trigger to write, and htmx sends the value of the element that fired — the query parameter is
|
|
847
|
+
caption: "A select fires on change by default, so there is no hx-trigger to write, and htmx sends the value of the element that fired — the query parameter is the field's name. When the endpoint needs more than that one field, hx-include names the rest. The options are (value, label) pairs built in the service; the template never maps a domain value to a label.",
|
|
848
848
|
files: [
|
|
849
849
|
{
|
|
850
850
|
label: "tasks/_form.html",
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
"""Build the documentation site:
|
|
1
|
+
"""Build the documentation site: seven pages in two languages, rendered by fjkit.
|
|
2
2
|
|
|
3
3
|
uv run python packages/fjkit/docs/workbench/build.py
|
|
4
4
|
|
|
5
5
|
Output, all under `docs/` at the repo root, which is what GitHub Pages serves:
|
|
6
6
|
|
|
7
7
|
index.html Introduction — what the kit is, who it is for, what it is not
|
|
8
|
+
why.html Why fjkit — the three approaches, and what this one costs
|
|
9
|
+
architecture.html Architecture — the closed decisions, as pictures
|
|
8
10
|
learn.html Learn — the narrative: wiring, htmx, theming, the gate
|
|
9
11
|
plugins.html Plugins — the extension seam, and the session plugin
|
|
10
12
|
components.html Components — every macro, live, with the code that made it,
|
|
11
13
|
one section per file in templates/ui/
|
|
12
14
|
cheatsheet.html Cheatsheet — the index: every macro in one table each, with
|
|
13
15
|
the block it takes stated rather than encoded
|
|
14
|
-
zh/ the same
|
|
16
|
+
zh/ the same seven pages in Chinese, from `templates/zh/`
|
|
15
17
|
assets/dist/ fjkit.css, exactly as the wheel ships it
|
|
16
18
|
assets/vendor/ htmx and Basecoat's JS, exactly as the wheel ships them
|
|
17
19
|
assets/js/ errors.js, the kit's own script the shell loads
|
|
@@ -56,6 +58,7 @@ sliders on these pages), and every component preview — all rendered by
|
|
|
56
58
|
|
|
57
59
|
from __future__ import annotations
|
|
58
60
|
|
|
61
|
+
import gzip
|
|
59
62
|
import hashlib
|
|
60
63
|
import json
|
|
61
64
|
import shutil
|
|
@@ -93,7 +96,7 @@ OUT_ASSETS = OUT / "assets"
|
|
|
93
96
|
|
|
94
97
|
DEMO = REPO / "examples" / "fjkit-demo"
|
|
95
98
|
|
|
96
|
-
#: The
|
|
99
|
+
#: The pages, in reading order. The sidebar and `url_for` are both built
|
|
97
100
|
#: from this, so a page added here appears in the others' navigation and becomes
|
|
98
101
|
#: addressable by name without touching a template. The first entry is
|
|
99
102
|
#: `index.html`, which is what GitHub Pages serves to someone arriving with no
|
|
@@ -124,6 +127,48 @@ PAGES = [
|
|
|
124
127
|
),
|
|
125
128
|
},
|
|
126
129
|
},
|
|
130
|
+
{
|
|
131
|
+
"route": "why",
|
|
132
|
+
"file": "why.html",
|
|
133
|
+
"icon": "scale",
|
|
134
|
+
"en": {
|
|
135
|
+
"label": "Why fjkit",
|
|
136
|
+
"title": "Why fjkit, and when not",
|
|
137
|
+
"description": (
|
|
138
|
+
"Three ways to put a UI on a FastAPI app, what each one costs, and what this one "
|
|
139
|
+
"gives up in exchange."
|
|
140
|
+
),
|
|
141
|
+
},
|
|
142
|
+
"zh": {
|
|
143
|
+
"label": "為什麼用",
|
|
144
|
+
"title": "為什麼選 fjkit,以及什麼時候不要",
|
|
145
|
+
"description": (
|
|
146
|
+
"幫 FastAPI app 做介面的三種做法各自的代價,以及這個做法換來什麼又放棄什麼。"
|
|
147
|
+
),
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"route": "architecture",
|
|
152
|
+
"file": "architecture.html",
|
|
153
|
+
"icon": "layers",
|
|
154
|
+
"en": {
|
|
155
|
+
"label": "Architecture",
|
|
156
|
+
"title": "How fjkit is put together",
|
|
157
|
+
"description": (
|
|
158
|
+
"The five closed architecture decisions as pictures: the package boundary, template "
|
|
159
|
+
"resolution and eject, when the build runs, one partial with two entry points, and "
|
|
160
|
+
"the loop that grows the vocabulary."
|
|
161
|
+
),
|
|
162
|
+
},
|
|
163
|
+
"zh": {
|
|
164
|
+
"label": "架構",
|
|
165
|
+
"title": "fjkit 是怎麼組起來的",
|
|
166
|
+
"description": (
|
|
167
|
+
"五個已經定案的架構決定,用圖說明:套件邊界、模板解析與 eject、build 發生的時機、"
|
|
168
|
+
"一份 partial 兩個入口,以及那條讓詞彙表長大的迴圈。"
|
|
169
|
+
),
|
|
170
|
+
},
|
|
171
|
+
},
|
|
127
172
|
{
|
|
128
173
|
"route": "learn",
|
|
129
174
|
"file": "learn.html",
|
|
@@ -133,7 +178,7 @@ PAGES = [
|
|
|
133
178
|
"title": "Learn fjkit",
|
|
134
179
|
"description": (
|
|
135
180
|
"Build a FastAPI interface without a front-end toolchain: how the kit is wired, what "
|
|
136
|
-
"htmx actually sends, what a rejected form does, a
|
|
181
|
+
"htmx actually sends, what a rejected form does, a token override that repaints the "
|
|
137
182
|
"page, and the vocabulary checker."
|
|
138
183
|
),
|
|
139
184
|
},
|
|
@@ -298,7 +343,7 @@ STRINGS = {
|
|
|
298
343
|
#: gaps are filled with `kbd()`, which yields Markup, and splitting the
|
|
299
344
|
#: sentence keeps the template free of `|safe`.
|
|
300
345
|
"footer_note": [
|
|
301
|
-
"This site is a fjkit app
|
|
346
|
+
"This site is a fjkit app. It extends ",
|
|
302
347
|
" and passes ",
|
|
303
348
|
", so it cannot show you a component the package does not ship.",
|
|
304
349
|
],
|
|
@@ -424,6 +469,39 @@ def is_active(request, name: str) -> bool:
|
|
|
424
469
|
return getattr(request, "route", None) == name
|
|
425
470
|
|
|
426
471
|
|
|
472
|
+
def css_size() -> SimpleNamespace:
|
|
473
|
+
"""The stylesheet's measured size, and the budget it is held to.
|
|
474
|
+
|
|
475
|
+
These three numbers were written by hand on the Introduction page and in
|
|
476
|
+
`notes/architecture.md`, and both copies were wrong: the page claimed 23.9 KB
|
|
477
|
+
gzip against a real 25.5, which is outside the range `CHARTER.md` §4.1 had
|
|
478
|
+
already recorded. Nothing read them, so nothing said so.
|
|
479
|
+
|
|
480
|
+
Measured here, from the same file the site links to, the way the footer's
|
|
481
|
+
version stamp is. A number a reader can check should not be a number anyone
|
|
482
|
+
types.
|
|
483
|
+
"""
|
|
484
|
+
from fjkit.cli.build_css import GZIP_BUDGET
|
|
485
|
+
|
|
486
|
+
raw = CSS.read_bytes()
|
|
487
|
+
return SimpleNamespace(
|
|
488
|
+
raw_kb=f"{len(raw) / 1024:.0f}",
|
|
489
|
+
gzip_kb=f"{len(gzip.compress(raw)) / 1024:.1f}",
|
|
490
|
+
budget_kb=f"{GZIP_BUDGET / 1024:.0f}",
|
|
491
|
+
pack=DOCS_STYLE,
|
|
492
|
+
)
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
def site_globals() -> dict:
|
|
496
|
+
"""Every template global the site needs, in one place.
|
|
497
|
+
|
|
498
|
+
`build()` and `tests/test_docs_site.py::test_the_site_builds` both construct
|
|
499
|
+
an `Environment`, and a global added to one and not the other makes the test
|
|
500
|
+
pass against a site that cannot build.
|
|
501
|
+
"""
|
|
502
|
+
return {"url_for": url_for, "is_active": is_active, "repo": repo, "css": css_size()}
|
|
503
|
+
|
|
504
|
+
|
|
427
505
|
def content_stamped(prefix: str):
|
|
428
506
|
"""Build the site's `fjkit_static`: the kit's URL, stamped with a hash of
|
|
429
507
|
the file's bytes rather than its mtime.
|
|
@@ -491,7 +569,7 @@ def build() -> int:
|
|
|
491
569
|
# into `assets/dist/` come from one word.
|
|
492
570
|
style=DOCS_STYLE,
|
|
493
571
|
auto_reload=False,
|
|
494
|
-
globals=
|
|
572
|
+
globals=site_globals(),
|
|
495
573
|
)
|
|
496
574
|
)
|
|
497
575
|
env.globals["fjkit_static"] = content_stamped(lang["static"])
|
|
@@ -117,7 +117,7 @@ GROUPS = [
|
|
|
117
117
|
"macros": [
|
|
118
118
|
_m(
|
|
119
119
|
"morph_scripts()",
|
|
120
|
-
en="Loads the idiomorph extension, which adds the morph:* swap styles
|
|
120
|
+
en="Loads the idiomorph extension, which adds the morph:* swap styles. The "
|
|
121
121
|
"reply patches the DOM instead of replacing it, so focus, scroll position, "
|
|
122
122
|
"an open details and a ticked box survive a sort. Two halves — the element "
|
|
123
123
|
'whose swaps should morph declares hx-ext="morph", and the swap itself is '
|
|
@@ -127,6 +127,18 @@ GROUPS = [
|
|
|
127
127
|
"都撐得過一次排序。分兩半——要 morph 的元素自己宣告 "
|
|
128
128
|
'hx-ext="morph",swap 本身寫 swap="morph:outerHTML"。逐頁載入,不進 shell。',
|
|
129
129
|
),
|
|
130
|
+
_m(
|
|
131
|
+
"sse_scripts()",
|
|
132
|
+
en="Loads htmx's sse extension, so a reply can arrive in pieces over one "
|
|
133
|
+
'connection: hx-ext="sse" and sse-connect on the container, sse-swap on '
|
|
134
|
+
"each element an event fills, sse-close naming the event that ends it. "
|
|
135
|
+
"The server side is templates.events(), which always sends that event — "
|
|
136
|
+
"without it the extension reconnects forever. Per page, never the shell.",
|
|
137
|
+
zh="載入 htmx 的 sse 擴充,讓一段回覆經由同一條連線分段抵達:容器寫 "
|
|
138
|
+
'hx-ext="sse" 與 sse-connect,每個要被事件填入的元素寫 sse-swap,'
|
|
139
|
+
"sse-close 指定結束串流的事件名稱。伺服器端是 templates.events(),"
|
|
140
|
+
"它一定會送出這個結束事件——少了它,擴充會無限重連。逐頁載入,不進 shell。",
|
|
141
|
+
),
|
|
130
142
|
],
|
|
131
143
|
},
|
|
132
144
|
],
|
|
@@ -171,7 +183,7 @@ GROUPS = [
|
|
|
171
183
|
_m(
|
|
172
184
|
'split(aside="md", gap=6)',
|
|
173
185
|
block="slots",
|
|
174
|
-
en="Called as {% call(slot) split() %}, and the
|
|
186
|
+
en="Called as {% call(slot) split() %}, and the macro renders the block twice — "
|
|
175
187
|
'once with slot="main", once with slot="aside".',
|
|
176
188
|
zh="用 {% call(slot) split() %} 呼叫,區塊會被渲染兩次——"
|
|
177
189
|
'slot="main" 一次,slot="aside" 一次。',
|
|
@@ -241,6 +253,13 @@ GROUPS = [
|
|
|
241
253
|
zh="route 是路由名稱,不是網址。作用中狀態由 is_active 決定,"
|
|
242
254
|
"連結不可能跟所在頁面對不上。",
|
|
243
255
|
),
|
|
256
|
+
_m(
|
|
257
|
+
"sidebar_item(label, href, active=false, icon_name=none, lead=none)",
|
|
258
|
+
en="For a URL that is not one route, such as the same route with a different "
|
|
259
|
+
"parameter per row. lead puts a badge in a fixed-width cell so labels align.",
|
|
260
|
+
zh="給不是單一路由的網址用:同一條路由、每列帶不同參數。"
|
|
261
|
+
"lead 把徽章放進固定寬度的格子,讓標籤對齊。",
|
|
262
|
+
),
|
|
244
263
|
_m("sidebar_submenu(label, icon_name=none, open=false)", block="sidebar_link()"),
|
|
245
264
|
_m(
|
|
246
265
|
'sidebar_trigger(target="sidebar", label="Toggle navigation")',
|
|
@@ -307,12 +326,19 @@ GROUPS = [
|
|
|
307
326
|
_m('bullet_list(tone="muted")', block="list_item()"),
|
|
308
327
|
_m("list_item()", block="text"),
|
|
309
328
|
_m("item_list()", block="item()"),
|
|
310
|
-
_m(
|
|
329
|
+
_m(
|
|
330
|
+
"description_list(layout=\"rows\")",
|
|
331
|
+
block="description_item()",
|
|
332
|
+
en="layout: rows | stacked | inline. inline is a few short facts on one "
|
|
333
|
+
"wrapping line, in small type.",
|
|
334
|
+
zh="layout:rows | stacked | inline。inline 把幾個短事實排在一行、"
|
|
335
|
+
"可換行,字級較小。",
|
|
336
|
+
),
|
|
311
337
|
_m(
|
|
312
338
|
"description_item(term, value=none)",
|
|
313
339
|
block="value",
|
|
314
340
|
optional=True,
|
|
315
|
-
en="A native <dl
|
|
341
|
+
en="A native <dl>. A screen reader announces the value as the definition of its term. "
|
|
316
342
|
"item_list is a list of things; this is a list of facts about one.",
|
|
317
343
|
zh="原生的 <dl>:值會被朗讀成該詞條的定義。item_list 是一串東西的清單,"
|
|
318
344
|
"這個是同一個東西的一串事實。",
|
|
@@ -327,7 +353,7 @@ GROUPS = [
|
|
|
327
353
|
_m(
|
|
328
354
|
"avatar(name, src=none, size=\"\", initials=none, badge_tone=none,\n"
|
|
329
355
|
" badge_icon=none)",
|
|
330
|
-
en="
|
|
356
|
+
en="The macro derives the initials from name unless you override them.",
|
|
331
357
|
zh="沒有另外指定時,縮寫由 name 推導。",
|
|
332
358
|
),
|
|
333
359
|
_m("avatar_group(overflow=none, label=none)", block="avatar()"),
|
|
@@ -338,7 +364,7 @@ GROUPS = [
|
|
|
338
364
|
zh="它自己帶捲動區與可聚焦性,溢出的程式碼用鍵盤也到得了。",
|
|
339
365
|
),
|
|
340
366
|
_m(
|
|
341
|
-
|
|
367
|
+
'caption(text=none, size="sm", tone="muted", icon_name=none)',
|
|
342
368
|
block="text",
|
|
343
369
|
optional=True,
|
|
344
370
|
en="A muted line that stands on its own. card, section and page_header "
|
|
@@ -364,7 +390,7 @@ GROUPS = [
|
|
|
364
390
|
"case; pass rows=none to always render the body yourself. A column with "
|
|
365
391
|
"a sort_url becomes a sortable header, and target turns those links into "
|
|
366
392
|
"htmx swaps. resizable=true puts a drag handle on each labelled column "
|
|
367
|
-
"and needs an id=, the key the widths
|
|
393
|
+
"and needs an id=, the key it stores the widths under. Columns sharing a "
|
|
368
394
|
"group get one heading above them in a second header row.",
|
|
369
395
|
zh="columns 是 dict 的清單——label,可選 align、width、sort、sort_url、select 或 group。"
|
|
370
396
|
"傳了 rows,空資料的情況就歸 macro 管;傳 rows=none 則永遠自己渲染 body。"
|
|
@@ -377,7 +403,7 @@ GROUPS = [
|
|
|
377
403
|
block="content",
|
|
378
404
|
optional=True,
|
|
379
405
|
en="Pass value for text, or omit it and use a block for markup. tone is a "
|
|
380
|
-
"closed lookup, so
|
|
406
|
+
"closed lookup, so you cannot pass a colour through.",
|
|
381
407
|
zh="文字用 value,標記則省略 value 改用區塊。tone 是封閉查表,顏色傳不進來。",
|
|
382
408
|
),
|
|
383
409
|
_m(
|
|
@@ -397,7 +423,7 @@ GROUPS = [
|
|
|
397
423
|
_m(
|
|
398
424
|
'select_count(name="selected", label="{n} selected",\n'
|
|
399
425
|
' zero="None selected")',
|
|
400
|
-
en="The live readout of how many rows are picked.
|
|
426
|
+
en="The live readout of how many rows are picked. You write both strings in "
|
|
401
427
|
"the markup, so a translated page translates them. Pass zero=none and it "
|
|
402
428
|
"hides while nothing is selected.",
|
|
403
429
|
zh="即時顯示選了幾列。兩個字串都寫在標記裡,所以翻譯頁面能翻譯它們。"
|
|
@@ -423,9 +449,9 @@ GROUPS = [
|
|
|
423
449
|
' param="per_page", keep=none, target=none,\n'
|
|
424
450
|
' label="Rows per page", apply_label="Apply")',
|
|
425
451
|
en="A GET form, because a select on its own cannot act on a change. url must "
|
|
426
|
-
"carry no query string — a native submit throws it away — so filters
|
|
452
|
+
"carry no query string — a native submit throws it away — so pass the filters "
|
|
427
453
|
"in keep as hidden fields. Never the page number. With a target the select "
|
|
428
|
-
"applies itself and the submit button
|
|
454
|
+
"applies itself, and the submit button renders only without scripting.",
|
|
429
455
|
zh="一個 GET form,因為單獨一個 select 沒有辦法對變更做出反應。"
|
|
430
456
|
"url 不能帶 query string——原生送出會把它整段丟掉——所以篩選要放在 keep,"
|
|
431
457
|
"以 hidden 欄位傳遞,但絕不放頁碼。給了 target,select 自己就會套用,"
|
|
@@ -483,8 +509,10 @@ GROUPS = [
|
|
|
483
509
|
_m(
|
|
484
510
|
'field_row(template="two", gap=3)',
|
|
485
511
|
block="fields",
|
|
486
|
-
en="Two or three fields on one line, collapsing to one column when narrow."
|
|
487
|
-
|
|
512
|
+
en="Two or three fields on one line, collapsing to one column when narrow. "
|
|
513
|
+
"template=\"inline\" gives each short field a fixed 16rem cell instead.",
|
|
514
|
+
zh="一行放兩到三個欄位,窄螢幕收成一欄。"
|
|
515
|
+
"template=\"inline\" 改為每個短欄位固定 16rem 一格。",
|
|
488
516
|
),
|
|
489
517
|
_m(
|
|
490
518
|
"fieldset(legend=none, hint=none)",
|
|
@@ -497,7 +525,7 @@ GROUPS = [
|
|
|
497
525
|
" required=false, hint=none, error=none, id=none)",
|
|
498
526
|
en="type is where dates live: date, time, datetime-local, month and week "
|
|
499
527
|
"are native inputs, and there is no date_field because a macro around one "
|
|
500
|
-
"would add a name and nothing else. min/max/step
|
|
528
|
+
"would add a name and nothing else. min/max/step pass through as attributes. "
|
|
501
529
|
"Not file — an upload cannot be restored from value after a 422.",
|
|
502
530
|
zh="日期就在 type 裡:date、time、datetime-local、month、week 都是原生 "
|
|
503
531
|
"input,沒有 date_field,因為包一層只多一個名字。min/max/step 當一般屬性傳。"
|
|
@@ -510,10 +538,10 @@ GROUPS = [
|
|
|
510
538
|
_m(
|
|
511
539
|
"file_field(name, label=none, accept=none, multiple=false,\n"
|
|
512
540
|
" required=false, hint=none, error=none, id=none)",
|
|
513
|
-
en="No value parameter
|
|
514
|
-
"
|
|
515
|
-
"still typed in. The form needs encoding=\"multipart\" or the route
|
|
516
|
-
"
|
|
541
|
+
en="No value parameter, because a browser will not let a page refill a file "
|
|
542
|
+
"input. A 422 redraw comes back with this box empty and every other field "
|
|
543
|
+
"still typed in. The form needs encoding=\"multipart\" or the route gets "
|
|
544
|
+
"the file's name as a string.",
|
|
517
545
|
zh="沒有 value 參數:瀏覽器不允許頁面替 file input 填回內容,"
|
|
518
546
|
"所以 422 重畫時這一格是空的,其他欄位仍保留輸入。表單必須加 "
|
|
519
547
|
"encoding=\"multipart\",否則路由收到的是檔名字串。",
|
|
@@ -643,9 +671,9 @@ GROUPS = [
|
|
|
643
671
|
'tab_panel("detail", lazy=url_for(request, "detail"),\n'
|
|
644
672
|
' on=["task-selected"], include="[name=task_id]")',
|
|
645
673
|
block="the placeholder, or the open tab's body",
|
|
646
|
-
en="lazy is a URL
|
|
674
|
+
en="lazy is a URL. The panel fetches its own body when its tab is shown, "
|
|
647
675
|
"and the block is what stands in until it arrives. The open tab is the "
|
|
648
|
-
"exception
|
|
676
|
+
"exception. It does not fetch at load, so its block is the real body, "
|
|
649
677
|
"rendered by the page from the partial lazy returns. on lists the "
|
|
650
678
|
"broadcasts it follows while it is visible, include the selector for "
|
|
651
679
|
"what it sends. Not revealed — a panel hidden by display:none reports "
|
|
@@ -719,8 +747,8 @@ GROUPS = [
|
|
|
719
747
|
" visible_label=none, hint=none, error=none,\n"
|
|
720
748
|
' search=none, search_param="q", search_delay=250)',
|
|
721
749
|
en="select_menu with a filter box. Same multiple=true rule, same "
|
|
722
|
-
"visible_label. search=<url> moves the filter to the server
|
|
723
|
-
"
|
|
750
|
+
"visible_label. search=<url> moves the filter to the server. The route receives "
|
|
751
|
+
"?q=<typed> and answers with option rows only. To act on a pick, "
|
|
724
752
|
"listen for change on the root — hx_trigger=\"change target:#<id>\" — "
|
|
725
753
|
"because that is where Basecoat dispatches it.",
|
|
726
754
|
zh="加了篩選框的 select_menu。multiple=true 的規則相同,visible_label 也相同。"
|
|
@@ -991,7 +1019,7 @@ HTMX = [
|
|
|
991
1019
|
'hx-swap="beforeend" append (afterbegin prepends)\n'
|
|
992
1020
|
'hx-swap="afterend" insert after (beforebegin: before)\n'
|
|
993
1021
|
'hx-swap="delete" remove it (none: change nothing)',
|
|
994
|
-
"en": "Modifiers
|
|
1022
|
+
"en": "Modifiers attach to the same string: swap:200ms, settle:100ms, scroll:top.",
|
|
995
1023
|
"zh": "修飾詞接在同一個字串上:swap:200ms、settle:100ms、scroll:top。",
|
|
996
1024
|
},
|
|
997
1025
|
],
|