fjkit 0.1.0.dev0__tar.gz → 0.1.1__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.1.0.dev0 → fjkit-0.1.1}/PKG-INFO +24 -7
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/README.md +23 -6
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/README.md +5 -6
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/assets/components.js +20 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/assets/learn.js +9 -7
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/build.py +44 -3
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/build_data.py +14 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/cheatsheet.py +45 -3
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/templates/base.html +12 -6
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/templates/cheatsheet.html +4 -2
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/templates/components.html +108 -116
- fjkit-0.1.1/docs/workbench/templates/introduction.html +166 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/templates/learn.html +127 -74
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/templates/plugins.html +277 -260
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/templates/zh/cheatsheet.html +4 -2
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/templates/zh/components.html +93 -102
- fjkit-0.1.1/docs/workbench/templates/zh/introduction.html +158 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/templates/zh/learn.html +120 -68
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/templates/zh/plugins.html +267 -252
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/pyproject.toml +2 -2
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/scripts/vendor_ui.py +17 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/auth/plugin.py +20 -9
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/auth/stores.py +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/auth/types.py +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/cli/build_css.py +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/htmx.py +23 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/plugins.py +98 -20
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/rendering.py +34 -9
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/dist/fjkit-luma.css +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/dist/fjkit-lyra.css +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/dist/fjkit-maia.css +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/dist/fjkit-mira.css +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/dist/fjkit-nova.css +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/dist/fjkit-rhea.css +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/dist/fjkit-sera.css +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/dist/fjkit-vega.css +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/js/multiselect.js +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/js/reveal.js +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/js/select.js +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/src/fjkit.css +61 -31
- fjkit-0.1.1/src/fjkit/static/vendor/htmx/idiomorph-ext.min.js +1 -0
- fjkit-0.1.1/src/fjkit/templates/errors/page.html +99 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/data.html +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/disclosure.html +11 -6
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/feedback.html +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/form.html +2 -2
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/layout.html +67 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/shell.html +89 -16
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/sidebar.html +3 -3
- fjkit-0.1.1/src/fjkit/templates/ui/swap.html +58 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/table.html +1 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/tabs.html +19 -3
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templating.py +32 -3
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/vendored.py +20 -2
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/tests/test_auth.py +5 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/tests/test_components.py +287 -3
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/tests/test_docs_site.py +2 -2
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/tests/test_errors.py +20 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/tests/test_mounting.py +60 -1
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/tests/test_plugins.py +53 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/tests/test_rendering.py +48 -3
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/tests/test_style_packs.py +1 -1
- fjkit-0.1.0.dev0/docs/workbench/data.json +0 -1
- fjkit-0.1.0.dev0/docs/workbench/templates/introduction.html +0 -109
- fjkit-0.1.0.dev0/docs/workbench/templates/zh/introduction.html +0 -101
- fjkit-0.1.0.dev0/src/fjkit/templates/errors/page.html +0 -92
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/.gitignore +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/LICENSE +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/assets/brand.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/assets/common.js +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/assets/mock-server.js +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/templates/_diagram.html +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/templates/_parts.html +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/docs/workbench/templates/_shell_diagram.html +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/scripts/vendor_icons.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/__init__.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/auth/__init__.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/auth/csrf.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/auth/errors.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/auth/sources.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/cli/__init__.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/cli/check.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/cli/eject.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/cli/ejected.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/cli/vocabulary.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/config.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/errors.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/flash.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/forms.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/icons.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/messages.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/mounting.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/py.typed +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/signing.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/brand/torii-bolt.png +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/icons/lucide.json +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/js/errors.js +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/base/base.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/basecoat-base.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/basecoat-components.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/basecoat-luma.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/basecoat-lyra.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/basecoat-maia.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/basecoat-mira.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/basecoat-nova.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/basecoat-rhea.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/basecoat-sera.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/basecoat-vega.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/basecoat.all.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/basecoat.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/accordion.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/alert.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/avatar.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/badge.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/breadcrumb.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/button-group.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/button.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/card.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/chart.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/checkbox.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/collapsible.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/combobox.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/command.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/dialog.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/drawer.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/dropdown-menu.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/empty.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/field.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/form.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/input-group.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/input.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/item.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/kbd.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/label.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/native-select.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/popover.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/progress.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/radio.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/range.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/scrollbar.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/select.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/sidebar.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/skeleton.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/switch.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/table.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/tabs.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/textarea.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/toast.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/components/tooltip.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/js/all.min.js +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/styles/luma.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/styles/lyra.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/styles/maia.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/styles/mira.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/styles/nova.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/styles/rhea.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/styles/sera.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/basecoat/styles/vega.css +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/htmx/htmx.min.js +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/static/vendor/htmx/json-enc.js +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/styles.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/attrs.html +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/button.html +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/icon.html +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/nav.html +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/src/fjkit/templates/ui/overlay.html +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/tests/conftest.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/tests/test_flash.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/tests/test_messages.py +0 -0
- {fjkit-0.1.0.dev0 → fjkit-0.1.1}/tests/test_vocabulary.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fjkit
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
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/
|
|
@@ -47,18 +47,31 @@ uv add fjkit
|
|
|
47
47
|
|
|
48
48
|
## A working page
|
|
49
49
|
|
|
50
|
+
`app/main.py`:
|
|
51
|
+
|
|
50
52
|
```python
|
|
51
53
|
from pathlib import Path
|
|
52
54
|
|
|
53
55
|
from fastapi import FastAPI
|
|
54
|
-
from fjkit import FjkitConfig, mount_fjkit
|
|
55
|
-
|
|
56
|
-
config = FjkitConfig(template_dir=Path(__file__).parent / "templates")
|
|
56
|
+
from fjkit import FjkitConfig, mount_fjkit, render
|
|
57
|
+
from pydantic import BaseModel
|
|
57
58
|
|
|
58
59
|
app = FastAPI()
|
|
59
|
-
mount_fjkit(app,
|
|
60
|
+
mount_fjkit(app, FjkitConfig(template_dir=Path(__file__).parent / "templates"))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class Overview(BaseModel):
|
|
64
|
+
done: int
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@app.get("/")
|
|
68
|
+
@render("overview.html")
|
|
69
|
+
def overview() -> Overview:
|
|
70
|
+
return Overview(done=18)
|
|
60
71
|
```
|
|
61
72
|
|
|
73
|
+
`app/templates/overview.html`:
|
|
74
|
+
|
|
62
75
|
```jinja
|
|
63
76
|
{% extends "ui/shell.html" %}
|
|
64
77
|
{% from "ui/layout.html" import page_header, grid %}
|
|
@@ -67,11 +80,15 @@ mount_fjkit(app, config)
|
|
|
67
80
|
{% block content %}
|
|
68
81
|
{{ page_header("Overview", "How the board is doing") }}
|
|
69
82
|
{% call grid(cols=4) %}
|
|
70
|
-
{{ stat("
|
|
83
|
+
{{ stat("Done", done, tone="success", icon_name="check") }}
|
|
71
84
|
{% endcall %}
|
|
72
85
|
{% endblock %}
|
|
73
86
|
```
|
|
74
87
|
|
|
88
|
+
Run `uv run fastapi dev app/main.py` and open <http://127.0.0.1:8000>.
|
|
89
|
+
`@render` goes below `@app.get` and passes the returned model's fields to the
|
|
90
|
+
template.
|
|
91
|
+
|
|
75
92
|
## Rebranding
|
|
76
93
|
|
|
77
94
|
One knob, plain CSS, no build:
|
|
@@ -112,7 +129,7 @@ uv run fjkit check app/templates
|
|
|
112
129
|
|
|
113
130
|
**[Docs](https://liweicheng00.github.io/fjkit/)**
|
|
114
131
|
|
|
115
|
-
Status:
|
|
132
|
+
Status: 0.1.0. Macro signatures can change before 1.0.
|
|
116
133
|
|
|
117
134
|
## License
|
|
118
135
|
|
|
@@ -20,18 +20,31 @@ uv add fjkit
|
|
|
20
20
|
|
|
21
21
|
## A working page
|
|
22
22
|
|
|
23
|
+
`app/main.py`:
|
|
24
|
+
|
|
23
25
|
```python
|
|
24
26
|
from pathlib import Path
|
|
25
27
|
|
|
26
28
|
from fastapi import FastAPI
|
|
27
|
-
from fjkit import FjkitConfig, mount_fjkit
|
|
28
|
-
|
|
29
|
-
config = FjkitConfig(template_dir=Path(__file__).parent / "templates")
|
|
29
|
+
from fjkit import FjkitConfig, mount_fjkit, render
|
|
30
|
+
from pydantic import BaseModel
|
|
30
31
|
|
|
31
32
|
app = FastAPI()
|
|
32
|
-
mount_fjkit(app,
|
|
33
|
+
mount_fjkit(app, FjkitConfig(template_dir=Path(__file__).parent / "templates"))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class Overview(BaseModel):
|
|
37
|
+
done: int
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@app.get("/")
|
|
41
|
+
@render("overview.html")
|
|
42
|
+
def overview() -> Overview:
|
|
43
|
+
return Overview(done=18)
|
|
33
44
|
```
|
|
34
45
|
|
|
46
|
+
`app/templates/overview.html`:
|
|
47
|
+
|
|
35
48
|
```jinja
|
|
36
49
|
{% extends "ui/shell.html" %}
|
|
37
50
|
{% from "ui/layout.html" import page_header, grid %}
|
|
@@ -40,11 +53,15 @@ mount_fjkit(app, config)
|
|
|
40
53
|
{% block content %}
|
|
41
54
|
{{ page_header("Overview", "How the board is doing") }}
|
|
42
55
|
{% call grid(cols=4) %}
|
|
43
|
-
{{ stat("
|
|
56
|
+
{{ stat("Done", done, tone="success", icon_name="check") }}
|
|
44
57
|
{% endcall %}
|
|
45
58
|
{% endblock %}
|
|
46
59
|
```
|
|
47
60
|
|
|
61
|
+
Run `uv run fastapi dev app/main.py` and open <http://127.0.0.1:8000>.
|
|
62
|
+
`@render` goes below `@app.get` and passes the returned model's fields to the
|
|
63
|
+
template.
|
|
64
|
+
|
|
48
65
|
## Rebranding
|
|
49
66
|
|
|
50
67
|
One knob, plain CSS, no build:
|
|
@@ -85,7 +102,7 @@ uv run fjkit check app/templates
|
|
|
85
102
|
|
|
86
103
|
**[Docs](https://liweicheng00.github.io/fjkit/)**
|
|
87
104
|
|
|
88
|
-
Status:
|
|
105
|
+
Status: 0.1.0. Macro signatures can change before 1.0.
|
|
89
106
|
|
|
90
107
|
## License
|
|
91
108
|
|
|
@@ -23,9 +23,9 @@ which is what GitHub Pages serves (*Settings → Pages → Deploy from a branch
|
|
|
23
23
|
|
|
24
24
|
| Output | Page | Covers |
|
|
25
25
|
|---|---|---|
|
|
26
|
-
| `docs/index.html` | Introduction | the landing page — what fjkit is, who it is for,
|
|
27
|
-
| `docs/learn.html` | Learn | wiring, the htmx exchange, hx-target/hx-swap/hx-trigger, partials, `hx-swap-oob`, `hx-indicator
|
|
28
|
-
| `docs/plugins.html` | Plugins | the
|
|
26
|
+
| `docs/index.html` | Introduction | the landing page — what fjkit is, a first page in four steps, who it is for, what ships in the wheel, and which page answers which question |
|
|
27
|
+
| `docs/learn.html` | Learn | fourteen lessons in three rail groups: start here (wiring, the htmx exchange, hx-target/hx-swap/hx-trigger, partials), advanced htmx (`hx-swap-oob`, `HX-Trigger`, page state, `hx-indicator`, patterns), and forms, messages, theming and `fjkit check` |
|
|
28
|
+
| `docs/plugins.html` | Plugins | the ready-made plugins first (auth, flash, API console, charts, admin), then the seam for writing one — middleware, exception handlers and template globals in one registered object |
|
|
29
29
|
| `docs/components.html` | Components | every macro, live, with the Jinja call and the HTML it emits — one section per file in `src/fjkit/templates/ui/`, in the order the directory lists them |
|
|
30
30
|
| `docs/cheatsheet.html` | Cheatsheet | the index — every macro with its full signature, whether it is called with a block and what goes inside it, plus the shell's blocks, the template globals and the htmx attributes. Rows come from `workbench/cheatsheet.py`, one source for both languages |
|
|
31
31
|
| `docs/assets/dist/`, `docs/assets/vendor/` | — | the default pack's `fjkit-vega.css`, htmx and Basecoat's JS, byte-identical to the wheel |
|
|
@@ -93,7 +93,7 @@ the package.
|
|
|
93
93
|
|
|
94
94
|
| Yours | Touches |
|
|
95
95
|
|---|---|
|
|
96
|
-
| `
|
|
96
|
+
| `routers/*.py` | imports `render` |
|
|
97
97
|
| `templates/base.html` | extends `ui/shell.html` |
|
|
98
98
|
| `templates/<feature>/*.html` | `{% from "ui/*.html" import … %}` |
|
|
99
99
|
| your own `brand.css` | overrides the `--primary` tokens |
|
|
@@ -123,5 +123,4 @@ uv run fjkit eject <component> # copy a component into your app to edit it
|
|
|
123
123
|
uv run pytest
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
Status:
|
|
127
|
-
frozen until 1.0.
|
|
126
|
+
Status: 0.1.0. Signatures can change before 1.0.
|
|
@@ -747,6 +747,25 @@ const SHOWCASE = {
|
|
|
747
747
|
caption: "Basecoat owns which tab is selected, the roving tabindex and the arrow keys. The ids tie a tab to its panel — pass them once, in the list.",
|
|
748
748
|
},
|
|
749
749
|
|
|
750
|
+
tabs_segmented: {
|
|
751
|
+
html: () => DATA.gallery.tabs_segmented,
|
|
752
|
+
jinja: `{% from "ui/tabs.html" import tabs, tab_panel %}
|
|
753
|
+
|
|
754
|
+
{% call tabs([{"id": "draft", "label": "Draft"},
|
|
755
|
+
{"id": "history", "label": "History"}], label="Document") %}
|
|
756
|
+
{% call tab_panel("draft") %}
|
|
757
|
+
{% call tabs([{"id": "generate", "label": "Generate"},
|
|
758
|
+
{"id": "review", "label": "Review my draft"}],
|
|
759
|
+
label="Mode", variant="segmented") %}
|
|
760
|
+
{% call tab_panel("generate") %}…{% endcall %}
|
|
761
|
+
{% call tab_panel("review") %}…{% endcall %}
|
|
762
|
+
{% endcall %}
|
|
763
|
+
{% endcall %}
|
|
764
|
+
{% call tab_panel("history") %}…{% endcall %}
|
|
765
|
+
{% endcall %}`,
|
|
766
|
+
caption: "variant is shape here, not a colour role: underline (the default) or segmented, the style pack's own pill strip, so it follows a rebrand. Use it for a group nested inside a tab panel, where a second underline strip would read as a second level of navigation. Both panels stay in the DOM and only toggle hidden, so a half-filled form in the other mode keeps its input.",
|
|
767
|
+
},
|
|
768
|
+
|
|
750
769
|
code_block: {
|
|
751
770
|
html: () => DATA.gallery.code_block,
|
|
752
771
|
jinja: `{% from "ui/data.html" import code_block %}
|
|
@@ -1032,7 +1051,7 @@ const SNIPPET = {
|
|
|
1032
1051
|
/* Read out of shell.html at build time, so this list cannot offer a block
|
|
1033
1052
|
the shell stopped having. */
|
|
1034
1053
|
code: () => DATA.shell.blocks.map((name) => `{% block ${name} %}`).join("\n"),
|
|
1035
|
-
caption: "Read out of shell.html at build time, so this cannot list a block the shell stopped having. Fill sidebar and the skeleton becomes a side column plus a thin top bar — the shell tests the block for emptiness and grows a sidebar_trigger in the header on its own.",
|
|
1054
|
+
caption: "Read out of shell.html at build time, so this cannot list a block the shell stopped having. Fill sidebar and the skeleton becomes a side column plus a thin top bar — the shell tests the block for emptiness and grows a sidebar_trigger in the header on its own. The header stays pinned to the top while the page scrolls — with a sidebar, across the full width and above the rail. For a header in the flow, override the header block.",
|
|
1036
1055
|
},
|
|
1037
1056
|
|
|
1038
1057
|
sidebar: {
|
|
@@ -36,13 +36,15 @@ mount_fjkit(app, config)`,
|
|
|
36
36
|
{% endblock %}`,
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
file: "app/
|
|
39
|
+
file: "app/routers/tasks.py",
|
|
40
40
|
lang: "python",
|
|
41
|
-
why: "Routers read the request, call the service and name a template. The handler returns data: @render turns it into the page, and FastAPI reads the return annotation for response_model, so one declaration describes both the page and the JSON.
|
|
42
|
-
code: `
|
|
41
|
+
why: "Routers read the request, call the service and name a template. The handler returns data: @render turns it into the page, and FastAPI reads the return annotation for response_model, so one declaration describes both the page and the JSON. The rows come from app/services, and the shape — response model, option lists, variant maps — from app/schemas. The router computes nothing.",
|
|
42
|
+
code: `from app.dependencies import TaskServiceDep
|
|
43
|
+
from app.schemas.tasks import STATUS_FILTERS, BoardResponse
|
|
44
|
+
from app.services import tasks as task_service
|
|
45
|
+
from app.services.tasks import TaskService
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
STATUS_FILTERS = [(None, "All")] + [(s, s.value.capitalize()) for s in Status]
|
|
47
|
+
router = APIRouter(tags=["tasks"])
|
|
46
48
|
|
|
47
49
|
def board(service: TaskService) -> BoardResponse:
|
|
48
50
|
"""Everything tasks/_board.html reads, in one place.
|
|
@@ -53,7 +55,7 @@ def board(service: TaskService) -> BoardResponse:
|
|
|
53
55
|
"""
|
|
54
56
|
return BoardResponse(
|
|
55
57
|
tasks=service.list(),
|
|
56
|
-
stats=
|
|
58
|
+
stats=task_service.stats(service.list()),
|
|
57
59
|
status_filters=STATUS_FILTERS,
|
|
58
60
|
)
|
|
59
61
|
|
|
@@ -62,7 +64,7 @@ def board(service: TaskService) -> BoardResponse:
|
|
|
62
64
|
# CPU-bound, so Starlette runs this in the threadpool.
|
|
63
65
|
@router.get("/tasks", name="tasks_page")
|
|
64
66
|
@render("tasks/page.html", partial="tasks/_board.html")
|
|
65
|
-
def tasks_page(service:
|
|
67
|
+
def tasks_page(service: TaskServiceDep) -> BoardResponse:
|
|
66
68
|
return board(service)`,
|
|
67
69
|
},
|
|
68
70
|
{
|
|
@@ -32,8 +32,8 @@ classes and no hand-written chrome — `tests/test_docs_site.py` runs
|
|
|
32
32
|
`fjkit check` over `templates/` and fails the build if any appears. Whatever
|
|
33
33
|
the kit cannot say shows up here first.
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
Three adaptations turn a server-rendered app into a static site, none of them a
|
|
36
|
+
fork of the shell. The first two are knobs `FjkitConfig` already has:
|
|
37
37
|
|
|
38
38
|
* `static_url="assets"` — `fjkit_static('dist/fjkit-<pack>.css')` resolves to a
|
|
39
39
|
path next to the page instead of to a mounted route. The static tree is
|
|
@@ -43,6 +43,10 @@ Two adaptations turn a server-rendered app into a static site, both using knobs
|
|
|
43
43
|
`(request, name)` signature and read `request.route`, a plain object the
|
|
44
44
|
page's context supplies. Route *names* stay the currency, so `nav_links`
|
|
45
45
|
and `sidebar_link` work unmodified.
|
|
46
|
+
* `fjkit_static` is replaced after the Environment is built, to stamp each
|
|
47
|
+
asset with a hash of the copy under `docs/assets/` instead of its mtime. The
|
|
48
|
+
output is committed and CI rebuilds it to check it is current; a checkout
|
|
49
|
+
resets every mtime, so an mtime stamp could never match.
|
|
46
50
|
|
|
47
51
|
Everything else is the package: the shell's `<head>`, its theme flash-guard,
|
|
48
52
|
Basecoat's JS (which initialises the sidebar, the tab strips and the range
|
|
@@ -52,6 +56,7 @@ sliders on these pages), and every component preview — all rendered by
|
|
|
52
56
|
|
|
53
57
|
from __future__ import annotations
|
|
54
58
|
|
|
59
|
+
import hashlib
|
|
55
60
|
import json
|
|
56
61
|
import shutil
|
|
57
62
|
import subprocess
|
|
@@ -395,6 +400,16 @@ def url_for(request, name: str, /, **path_params) -> str:
|
|
|
395
400
|
return prefix + ROUTES[route] + (f"#{fragment}" if fragment else "")
|
|
396
401
|
|
|
397
402
|
|
|
403
|
+
#: Where `repo()` points. A reader who installed the wheel has no checkout, so a
|
|
404
|
+
#: repository path on the site is a link, never bare text.
|
|
405
|
+
REPO_URL = "https://github.com/liweicheng00/fjkit/tree/main/"
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
def repo(path: str) -> str:
|
|
409
|
+
"""Link a repository path, such as `examples/fjkit-demo/`, on GitHub."""
|
|
410
|
+
return REPO_URL + path.lstrip("/")
|
|
411
|
+
|
|
412
|
+
|
|
398
413
|
def is_active(request, name: str) -> bool:
|
|
399
414
|
"""Report whether `name` is the page being rendered.
|
|
400
415
|
|
|
@@ -407,6 +422,31 @@ def is_active(request, name: str) -> bool:
|
|
|
407
422
|
return getattr(request, "route", None) == name
|
|
408
423
|
|
|
409
424
|
|
|
425
|
+
def content_stamped(prefix: str):
|
|
426
|
+
"""Build the site's `fjkit_static`: the kit's URL, stamped with a hash of
|
|
427
|
+
the file's bytes rather than its mtime.
|
|
428
|
+
|
|
429
|
+
The kit's reasons for an mtime hold in an app and fail here. `docs/` is
|
|
430
|
+
committed, and CI rebuilds it to check it is current; a fresh checkout gives
|
|
431
|
+
every file a new mtime, so the rebuild would never match. A hash depends
|
|
432
|
+
only on the content, and still changes when the content does.
|
|
433
|
+
|
|
434
|
+
It reads the copies under `docs/assets/`, which `build()` writes before any
|
|
435
|
+
page renders. That covers the site's own scripts as well, which the kit's
|
|
436
|
+
version stamps with the fjkit version because they are not in its tree.
|
|
437
|
+
"""
|
|
438
|
+
base = prefix.rstrip("/")
|
|
439
|
+
stamps: dict[str, str] = {}
|
|
440
|
+
|
|
441
|
+
def fjkit_static(path: str) -> str:
|
|
442
|
+
clean = path.lstrip("/")
|
|
443
|
+
if clean not in stamps:
|
|
444
|
+
stamps[clean] = hashlib.sha256((OUT_ASSETS / clean).read_bytes()).hexdigest()[:12]
|
|
445
|
+
return f"{base}/{clean}?v={stamps[clean]}"
|
|
446
|
+
|
|
447
|
+
return fjkit_static
|
|
448
|
+
|
|
449
|
+
|
|
410
450
|
def build() -> int:
|
|
411
451
|
for path, _, hint in VENDORED:
|
|
412
452
|
if not path.exists():
|
|
@@ -449,9 +489,10 @@ def build() -> int:
|
|
|
449
489
|
# into `assets/dist/` come from one word.
|
|
450
490
|
style=DOCS_STYLE,
|
|
451
491
|
auto_reload=False,
|
|
452
|
-
globals={"url_for": url_for, "is_active": is_active},
|
|
492
|
+
globals={"url_for": url_for, "is_active": is_active, "repo": repo},
|
|
453
493
|
)
|
|
454
494
|
)
|
|
495
|
+
env.globals["fjkit_static"] = content_stamped(lang["static"])
|
|
455
496
|
out_dir = OUT / lang["dir"] if lang["dir"] else OUT
|
|
456
497
|
out_dir.mkdir(parents=True, exist_ok=True)
|
|
457
498
|
strings = STRINGS[lang["code"]]
|
|
@@ -432,7 +432,7 @@ live = {
|
|
|
432
432
|
|
|
433
433
|
# ---------------------------------------------------------------- gallery
|
|
434
434
|
# The macros with nothing to turn: one rendered example each, which is what
|
|
435
|
-
# CHARTER §
|
|
435
|
+
# CHARTER §5 item 8 asks of every component. Rendered here rather than written
|
|
436
436
|
# into components.js, for the reason every other preview is: the page must not
|
|
437
437
|
# be able to show markup the kit does not emit.
|
|
438
438
|
FEEDBACK = '{% from "ui/feedback.html" import spinner, dialog, alert, skeleton %}'
|
|
@@ -473,6 +473,19 @@ gallery = {
|
|
|
473
473
|
'{% call tab_panel("g-b") %}<p>What has happened to it.</p>{% endcall %}'
|
|
474
474
|
"{% endcall %}"
|
|
475
475
|
),
|
|
476
|
+
"tabs_segmented": render(
|
|
477
|
+
f'{TABS}{{% call tabs([{{"id": "gs-draft", "label": "Draft"}}, '
|
|
478
|
+
'{"id": "gs-history", "label": "History"}], label="Document") %}'
|
|
479
|
+
'{% call tab_panel("gs-draft") %}'
|
|
480
|
+
'{% call tabs([{"id": "gs-generate", "label": "Generate"}, '
|
|
481
|
+
'{"id": "gs-review", "label": "Review my draft"}], label="Mode", variant="segmented") %}'
|
|
482
|
+
'{% call tab_panel("gs-generate") %}<p>Describe the document and get a first draft.</p>{% endcall %}'
|
|
483
|
+
'{% call tab_panel("gs-review") %}<p>Paste a draft and get it checked.</p>{% endcall %}'
|
|
484
|
+
"{% endcall %}"
|
|
485
|
+
"{% endcall %}"
|
|
486
|
+
'{% call tab_panel("gs-history") %}<p>Every earlier version.</p>{% endcall %}'
|
|
487
|
+
"{% endcall %}"
|
|
488
|
+
),
|
|
476
489
|
"code_block": render(
|
|
477
490
|
f'{CONTENT}{{{{ code_block("{{{{ button(\'Add\', variant=\'primary\') }}}}", label="Jinja") }}}}'
|
|
478
491
|
),
|
|
@@ -112,6 +112,23 @@ GROUPS = [
|
|
|
112
112
|
),
|
|
113
113
|
],
|
|
114
114
|
},
|
|
115
|
+
{
|
|
116
|
+
"name": "ui/swap.html",
|
|
117
|
+
"macros": [
|
|
118
|
+
_m(
|
|
119
|
+
"morph_scripts()",
|
|
120
|
+
en="Loads the idiomorph extension, which adds the morph:* swap styles: the "
|
|
121
|
+
"reply patches the DOM instead of replacing it, so focus, scroll position, "
|
|
122
|
+
"an open details and a ticked box survive a sort. Two halves — the element "
|
|
123
|
+
'whose swaps should morph declares hx-ext="morph", and the swap itself is '
|
|
124
|
+
'swap="morph:outerHTML". Per page, never the shell.',
|
|
125
|
+
zh="載入 idiomorph 擴充,提供 morph:* 這組 swap:回應是去 patch DOM "
|
|
126
|
+
"而不是換掉它,所以焦點、捲動位置、展開的 details 與勾好的核取方塊"
|
|
127
|
+
"都撐得過一次排序。分兩半——要 morph 的元素自己宣告 "
|
|
128
|
+
'hx-ext="morph",swap 本身寫 swap="morph:outerHTML"。逐頁載入,不進 shell。',
|
|
129
|
+
),
|
|
130
|
+
],
|
|
131
|
+
},
|
|
115
132
|
],
|
|
116
133
|
},
|
|
117
134
|
{
|
|
@@ -168,6 +185,17 @@ GROUPS = [
|
|
|
168
185
|
zh="這個檔案其他 macro 給不了的寬度上限。width 只有 xs、sm、md、lg、xl、"
|
|
169
186
|
"prose——登入卡片、設定表單、純文字頁面。只做水平置中。",
|
|
170
187
|
),
|
|
188
|
+
_m(
|
|
189
|
+
'fill(justify="center", align=none, gap=6)',
|
|
190
|
+
block="children",
|
|
191
|
+
en="The other axis. It takes the height the shell already gave main and "
|
|
192
|
+
"places the children in it, so justify reads vertically here — center for "
|
|
193
|
+
"a sign-in card, end for a footer that sits on the fold. Nest a centered "
|
|
194
|
+
"inside it when the page wants both.",
|
|
195
|
+
zh="另一個軸。它接下 shell 已經配給 main 的高度,再把子元素放進去,"
|
|
196
|
+
"所以這裡的 justify 讀的是垂直方向——登入卡片用 center,"
|
|
197
|
+
"貼在畫面底部的區塊用 end。兩個方向都要時,把 centered 包在它裡面。",
|
|
198
|
+
),
|
|
171
199
|
_m(
|
|
172
200
|
"page_header(title, description=none)",
|
|
173
201
|
block="actions",
|
|
@@ -572,13 +600,25 @@ GROUPS = [
|
|
|
572
600
|
"name": "ui/tabs.html",
|
|
573
601
|
"macros": [
|
|
574
602
|
_m(
|
|
575
|
-
'tabs(items, label="Tabs", selected=none, orientation="horizontal"
|
|
603
|
+
'tabs(items, label="Tabs", selected=none, orientation="horizontal",\n'
|
|
604
|
+
' variant="underline")',
|
|
576
605
|
block="tab_panel()",
|
|
577
606
|
en="items is a list of {id, label}. selected names the tab that starts "
|
|
578
607
|
"open, so the server decides it rather than a script after paint.",
|
|
579
608
|
zh="items 是 {id, label} 的清單。selected 指名一開始就打開的分頁,"
|
|
580
609
|
"由伺服器決定,而不是繪製後由腳本決定。",
|
|
581
610
|
),
|
|
611
|
+
_m(
|
|
612
|
+
'tabs(items, label="Mode", variant="segmented")',
|
|
613
|
+
block="tab_panel()",
|
|
614
|
+
en="A pill strip, for a tab group nested inside a tab panel, so it reads "
|
|
615
|
+
"as a mode switch rather than a second level of navigation. variant here is "
|
|
616
|
+
"shape, not a colour role: underline | segmented, and anything else is "
|
|
617
|
+
"underline.",
|
|
618
|
+
zh="膠囊形的分頁列,用於放在分頁面板內的第二組分頁,讓它看起來是模式切換,"
|
|
619
|
+
"而不是第二層導覽。這裡的 variant 是形狀,不是顏色角色:underline | segmented,"
|
|
620
|
+
"其他值一律視為 underline。",
|
|
621
|
+
),
|
|
582
622
|
_m(
|
|
583
623
|
"tab_panel(id, lazy=none, on=none, include=none)",
|
|
584
624
|
block="body",
|
|
@@ -818,8 +858,10 @@ SHELL_BLOCKS = [
|
|
|
818
858
|
},
|
|
819
859
|
{
|
|
820
860
|
"name": "header",
|
|
821
|
-
"en": "The whole header bar, when the pieces above are not enough."
|
|
822
|
-
"
|
|
861
|
+
"en": "The whole header bar, when the pieces above are not enough. The default is pinned "
|
|
862
|
+
"to the top; override this block for a header that stays in the flow.",
|
|
863
|
+
"zh": "整條標頭;上面那幾個插槽不夠用時才動它。預設的標頭固定在頂端;"
|
|
864
|
+
"需要不固定的標頭時,覆寫這個 block。",
|
|
823
865
|
},
|
|
824
866
|
{
|
|
825
867
|
"name": "header_actions",
|
|
@@ -68,13 +68,19 @@
|
|
|
68
68
|
and numbers nothing, and a trailing "Read next" band carries no number
|
|
69
69
|
either — hence `.get`, because the Environment is StrictUndefined.
|
|
70
70
|
`test_docs_site.py` compares the two lists and fails when they disagree.
|
|
71
|
+
|
|
72
|
+
`group` is optional too. A long page tags each section with the stage it
|
|
73
|
+
belongs to, and the rail shows one heading per stage, in first-seen order;
|
|
74
|
+
a page that tags nothing gets the single "On this page" group.
|
|
71
75
|
#}
|
|
72
|
-
{%
|
|
73
|
-
{%
|
|
74
|
-
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
{% for group in sections | map(attribute="group", default="") | unique %}
|
|
77
|
+
{% call sidebar_group(group or t.sections_group) %}
|
|
78
|
+
{% for section in sections if section.get("group", "") == group %}
|
|
79
|
+
{{ sidebar_link(request, page.route ~ "#" ~ section.id,
|
|
80
|
+
(section.get("num") ~ " · " ~ section.title) if section.get("num") else section.title) }}
|
|
81
|
+
{% endfor %}
|
|
82
|
+
{% endcall %}
|
|
83
|
+
{% endfor %}
|
|
78
84
|
|
|
79
85
|
{#
|
|
80
86
|
The same page in the other language, never that language's landing page:
|
|
@@ -183,11 +183,13 @@
|
|
|
183
183
|
|
|
184
184
|
{% set d_learn %}<a href="{{ url_for(request, "learn") }}">how the pieces fit, and what htmx sends</a>{% endset %}
|
|
185
185
|
{% set d_components %}<a href="{{ url_for(request, "components") }}">every macro running, with the knobs turned</a>{% endset %}
|
|
186
|
+
{% set d_demo %}<a href="{{ repo("examples/fjkit-demo") }}">these macros inside a working app</a>{% endset %}
|
|
187
|
+
{% set d_tokens %}<a href="{{ repo("packages/fjkit/src/fjkit/static/src/fjkit.css") }}">the token table behind every variant</a>{% endset %}
|
|
186
188
|
{{ defs("Read next", [
|
|
187
189
|
("Learn", d_learn),
|
|
188
190
|
("Components", d_components),
|
|
189
|
-
("examples/fjkit-demo/",
|
|
190
|
-
("src/fjkit/static/src/fjkit.css",
|
|
191
|
+
("examples/fjkit-demo/", d_demo),
|
|
192
|
+
("src/fjkit/static/src/fjkit.css", d_tokens),
|
|
191
193
|
]) }}
|
|
192
194
|
{% endcall %}
|
|
193
195
|
{% endcall %}
|