fjkit 0.1.0.dev0__py3-none-any.whl
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/__init__.py +49 -0
- fjkit/auth/__init__.py +54 -0
- fjkit/auth/csrf.py +88 -0
- fjkit/auth/errors.py +31 -0
- fjkit/auth/plugin.py +496 -0
- fjkit/auth/sources.py +24 -0
- fjkit/auth/stores.py +141 -0
- fjkit/auth/types.py +141 -0
- fjkit/cli/__init__.py +67 -0
- fjkit/cli/build_css.py +135 -0
- fjkit/cli/check.py +193 -0
- fjkit/cli/eject.py +562 -0
- fjkit/cli/ejected.py +202 -0
- fjkit/cli/vocabulary.py +85 -0
- fjkit/config.py +130 -0
- fjkit/errors.py +156 -0
- fjkit/flash.py +189 -0
- fjkit/forms.py +145 -0
- fjkit/htmx.py +76 -0
- fjkit/icons.py +60 -0
- fjkit/messages.py +227 -0
- fjkit/mounting.py +72 -0
- fjkit/plugins.py +223 -0
- fjkit/py.typed +0 -0
- fjkit/rendering.py +554 -0
- fjkit/signing.py +63 -0
- fjkit/static/brand/torii-bolt.png +0 -0
- fjkit/static/dist/fjkit-luma.css +2 -0
- fjkit/static/dist/fjkit-lyra.css +2 -0
- fjkit/static/dist/fjkit-maia.css +2 -0
- fjkit/static/dist/fjkit-mira.css +2 -0
- fjkit/static/dist/fjkit-nova.css +2 -0
- fjkit/static/dist/fjkit-rhea.css +2 -0
- fjkit/static/dist/fjkit-sera.css +2 -0
- fjkit/static/dist/fjkit-vega.css +2 -0
- fjkit/static/icons/lucide.json +1 -0
- fjkit/static/js/errors.js +117 -0
- fjkit/static/js/multiselect.js +126 -0
- fjkit/static/js/reveal.js +51 -0
- fjkit/static/js/select.js +113 -0
- fjkit/static/src/fjkit.css +385 -0
- fjkit/static/vendor/basecoat/base/base.css +136 -0
- fjkit/static/vendor/basecoat/basecoat-base.css +2 -0
- fjkit/static/vendor/basecoat/basecoat-components.css +39 -0
- fjkit/static/vendor/basecoat/basecoat-luma.css +2 -0
- fjkit/static/vendor/basecoat/basecoat-lyra.css +2 -0
- fjkit/static/vendor/basecoat/basecoat-maia.css +2 -0
- fjkit/static/vendor/basecoat/basecoat-mira.css +2 -0
- fjkit/static/vendor/basecoat/basecoat-nova.css +2 -0
- fjkit/static/vendor/basecoat/basecoat-rhea.css +2 -0
- fjkit/static/vendor/basecoat/basecoat-sera.css +2 -0
- fjkit/static/vendor/basecoat/basecoat-vega.css +2 -0
- fjkit/static/vendor/basecoat/basecoat.all.css +1 -0
- fjkit/static/vendor/basecoat/basecoat.css +1 -0
- fjkit/static/vendor/basecoat/components/accordion.css +27 -0
- fjkit/static/vendor/basecoat/components/alert.css +38 -0
- fjkit/static/vendor/basecoat/components/avatar.css +47 -0
- fjkit/static/vendor/basecoat/components/badge.css +6 -0
- fjkit/static/vendor/basecoat/components/breadcrumb.css +30 -0
- fjkit/static/vendor/basecoat/components/button-group.css +54 -0
- fjkit/static/vendor/basecoat/components/button.css +6 -0
- fjkit/static/vendor/basecoat/components/card.css +26 -0
- fjkit/static/vendor/basecoat/components/chart.css +56 -0
- fjkit/static/vendor/basecoat/components/checkbox.css +12 -0
- fjkit/static/vendor/basecoat/components/collapsible.css +21 -0
- fjkit/static/vendor/basecoat/components/combobox.css +99 -0
- fjkit/static/vendor/basecoat/components/command.css +140 -0
- fjkit/static/vendor/basecoat/components/dialog.css +101 -0
- fjkit/static/vendor/basecoat/components/drawer.css +89 -0
- fjkit/static/vendor/basecoat/components/dropdown-menu.css +56 -0
- fjkit/static/vendor/basecoat/components/empty.css +26 -0
- fjkit/static/vendor/basecoat/components/field.css +82 -0
- fjkit/static/vendor/basecoat/components/form.css +9 -0
- fjkit/static/vendor/basecoat/components/input-group.css +74 -0
- fjkit/static/vendor/basecoat/components/input.css +32 -0
- fjkit/static/vendor/basecoat/components/item.css +50 -0
- fjkit/static/vendor/basecoat/components/kbd.css +6 -0
- fjkit/static/vendor/basecoat/components/label.css +13 -0
- fjkit/static/vendor/basecoat/components/native-select.css +12 -0
- fjkit/static/vendor/basecoat/components/popover.css +107 -0
- fjkit/static/vendor/basecoat/components/progress.css +14 -0
- fjkit/static/vendor/basecoat/components/radio.css +11 -0
- fjkit/static/vendor/basecoat/components/range.css +50 -0
- fjkit/static/vendor/basecoat/components/scrollbar.css +46 -0
- fjkit/static/vendor/basecoat/components/select.css +64 -0
- fjkit/static/vendor/basecoat/components/sidebar.css +101 -0
- fjkit/static/vendor/basecoat/components/skeleton.css +6 -0
- fjkit/static/vendor/basecoat/components/switch.css +8 -0
- fjkit/static/vendor/basecoat/components/table.css +34 -0
- fjkit/static/vendor/basecoat/components/tabs.css +31 -0
- fjkit/static/vendor/basecoat/components/textarea.css +7 -0
- fjkit/static/vendor/basecoat/components/toast.css +57 -0
- fjkit/static/vendor/basecoat/components/tooltip.css +82 -0
- fjkit/static/vendor/basecoat/js/all.min.js +1 -0
- fjkit/static/vendor/basecoat/styles/luma.css +1376 -0
- fjkit/static/vendor/basecoat/styles/lyra.css +1379 -0
- fjkit/static/vendor/basecoat/styles/maia.css +1364 -0
- fjkit/static/vendor/basecoat/styles/mira.css +1373 -0
- fjkit/static/vendor/basecoat/styles/nova.css +1387 -0
- fjkit/static/vendor/basecoat/styles/rhea.css +1381 -0
- fjkit/static/vendor/basecoat/styles/sera.css +1397 -0
- fjkit/static/vendor/basecoat/styles/vega.css +1386 -0
- fjkit/static/vendor/htmx/htmx.min.js +1 -0
- fjkit/static/vendor/htmx/json-enc.js +38 -0
- fjkit/styles.py +30 -0
- fjkit/templates/errors/page.html +92 -0
- fjkit/templates/ui/attrs.html +18 -0
- fjkit/templates/ui/button.html +64 -0
- fjkit/templates/ui/data.html +362 -0
- fjkit/templates/ui/disclosure.html +89 -0
- fjkit/templates/ui/feedback.html +313 -0
- fjkit/templates/ui/form.html +595 -0
- fjkit/templates/ui/icon.html +13 -0
- fjkit/templates/ui/layout.html +189 -0
- fjkit/templates/ui/nav.html +110 -0
- fjkit/templates/ui/overlay.html +624 -0
- fjkit/templates/ui/shell.html +170 -0
- fjkit/templates/ui/sidebar.html +170 -0
- fjkit/templates/ui/table.html +427 -0
- fjkit/templates/ui/tabs.html +133 -0
- fjkit/templating.py +365 -0
- fjkit/vendored.py +46 -0
- fjkit-0.1.0.dev0.dist-info/METADATA +119 -0
- fjkit-0.1.0.dev0.dist-info/RECORD +127 -0
- fjkit-0.1.0.dev0.dist-info/WHEEL +4 -0
- fjkit-0.1.0.dev0.dist-info/entry_points.txt +2 -0
- fjkit-0.1.0.dev0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
{#
|
|
2
|
+
Form controls.
|
|
3
|
+
|
|
4
|
+
Every field takes the same four presentation parameters — `label`, `hint`,
|
|
5
|
+
`error`, `id` — and wires them the same way: the control gets an id, the
|
|
6
|
+
label points at it, and `hint`/`error` render into one `<p>` the control
|
|
7
|
+
names in `aria-describedby`. An `error` replaces the hint rather than
|
|
8
|
+
stacking on it: two messages under one control is two things to read when
|
|
9
|
+
only one of them matters.
|
|
10
|
+
|
|
11
|
+
A rejected submit fills the same `<p>` from the browser — `js/errors.js`
|
|
12
|
+
reads FastAPI's 422 and writes each message under the control its `loc`
|
|
13
|
+
names. Pass `error=` for a message known at first paint.
|
|
14
|
+
#}
|
|
15
|
+
{% from "ui/attrs.html" import attrs %}
|
|
16
|
+
{% from "ui/button.html" import button %}
|
|
17
|
+
|
|
18
|
+
{#
|
|
19
|
+
form(action, method, target, swap) — the <form> element itself.
|
|
20
|
+
|
|
21
|
+
{% call form(action=url_for(request, "tasks_create"), target="#board") %}
|
|
22
|
+
{% call field_row("1fr auto") %}…{% endcall %}
|
|
23
|
+
{% endcall %}
|
|
24
|
+
|
|
25
|
+
`target` decides which kind of form this is, and decides all of it:
|
|
26
|
+
|
|
27
|
+
form(action=…, target="#board") -> hx-post + hx-target + hx-swap
|
|
28
|
+
form(action=…) -> action= + method=
|
|
29
|
+
|
|
30
|
+
The htmx form also sets `hx-disinherit="hx-target hx-swap"`: a control inside
|
|
31
|
+
it that fires its own request names its own target, or swaps into itself —
|
|
32
|
+
never into the form's target by inheritance.
|
|
33
|
+
|
|
34
|
+
A form with a target is an htmx form; one without is an ordinary POST needing
|
|
35
|
+
no JavaScript. Same macro and same fields either way, and that symmetry is
|
|
36
|
+
what makes progressive enhancement cheap. `hx-post` without a target would
|
|
37
|
+
swap the reply into the form itself, which a caller who omitted `target`
|
|
38
|
+
never meant.
|
|
39
|
+
|
|
40
|
+
`method` is where that symmetry runs out, and it runs out quietly. htmx
|
|
41
|
+
issues all five verbs; a browser issues two:
|
|
42
|
+
|
|
43
|
+
form(action=…, method="put", target="#form") -> hx-put
|
|
44
|
+
form(action=…, method="put") -> method="post"
|
|
45
|
+
|
|
46
|
+
The second is not a bug being papered over: every browser treats
|
|
47
|
+
`<form method="put">` as GET, which drops the body entirely. A save that
|
|
48
|
+
becomes a read is worse than a save that arrives as a POST. See
|
|
49
|
+
`_NATIVE_METHODS` below.
|
|
50
|
+
|
|
51
|
+
`encoding` decides what the submit carries, which is a different question
|
|
52
|
+
from what it targets:
|
|
53
|
+
|
|
54
|
+
form(action=…, target="#board") -> title=Ship+it
|
|
55
|
+
form(action=…, target="#board", encoding="json") -> {"title":"Ship it"}
|
|
56
|
+
|
|
57
|
+
JSON is for a route that declares its body as a model — `def create(payload:
|
|
58
|
+
TaskCreate)` — because FastAPI reads such a body as JSON and refuses a form
|
|
59
|
+
outright. Nothing else changes: the values arrive as strings either way,
|
|
60
|
+
pydantic's lax mode reads `"3"` as an int and `"on"` as `True`, and
|
|
61
|
+
`js/errors.js` draws a rejected submit under the fields with everything still
|
|
62
|
+
typed in them.
|
|
63
|
+
|
|
64
|
+
Three limits, all of them the extension's rather than this macro's:
|
|
65
|
+
|
|
66
|
+
- No `target`, no JSON. A browser submitting natively sends urlencoded or
|
|
67
|
+
multipart and nothing else, so `encoding="json"` on a form with no `target`
|
|
68
|
+
is ignored rather than silently changing what a no-JS submit posts.
|
|
69
|
+
- No nesting. Every field lands at the top level of the object, so
|
|
70
|
+
`name="items.0.title"` posts that string as a key. A model with a nested
|
|
71
|
+
shape needs a flat DTO in front of it.
|
|
72
|
+
- No file upload. `JSON.stringify` has nothing to say about a `File`.
|
|
73
|
+
|
|
74
|
+
The page also has to load the extension — `form_scripts()`, below.
|
|
75
|
+
|
|
76
|
+
`reset_on_success` resets only on success, and only since 0.3. It used to
|
|
77
|
+
emit an unconditional `this.reset()`, and `htmx:afterRequest` fires whether
|
|
78
|
+
or not the request succeeded, so a rejected submit cleared the box the person
|
|
79
|
+
had just typed into. Keeping what was typed is how a rejected form comes
|
|
80
|
+
back, and this parameter is what guards it.
|
|
81
|
+
#}
|
|
82
|
+
{#
|
|
83
|
+
`json` is an htmx extension and `multipart` is not — it is a property of the
|
|
84
|
+
request, which is why the two leave by different doors and there is no single
|
|
85
|
+
table. `multipart` also has to work with JavaScript off, so it is the one
|
|
86
|
+
encoding that reaches the native path as well.
|
|
87
|
+
#}
|
|
88
|
+
{% set _ENCODINGS = {"urlencoded": none, "json": "json-enc"} %}
|
|
89
|
+
|
|
90
|
+
{#
|
|
91
|
+
What each `method` is called on each path. The asymmetry is why there are two
|
|
92
|
+
tables and not one.
|
|
93
|
+
|
|
94
|
+
htmx issues any of the five. A browser submitting a form natively issues two:
|
|
95
|
+
anything else in a `<form method=…>` is treated as GET, which drops the body
|
|
96
|
+
— a save that silently becomes a read. So the native table answers `post` to
|
|
97
|
+
everything that is not a read, and a `method="put"` form with no `target`
|
|
98
|
+
posts rather than quietly losing what was typed. Use `_method`-style
|
|
99
|
+
tunnelling in the route where the server has to know.
|
|
100
|
+
#}
|
|
101
|
+
{% set _HX_METHODS = {
|
|
102
|
+
"get": "hx-get",
|
|
103
|
+
"post": "hx-post",
|
|
104
|
+
"put": "hx-put",
|
|
105
|
+
"patch": "hx-patch",
|
|
106
|
+
"delete": "hx-delete",
|
|
107
|
+
} %}
|
|
108
|
+
{% set _NATIVE_METHODS = {"get": "get", "post": "post", "put": "post", "patch": "post", "delete": "post"} %}
|
|
109
|
+
|
|
110
|
+
{% macro form(action=none, method="post", target=none, swap="outerHTML", reset_on_success=false, card=true, encoding="urlencoded", progress=none) -%}
|
|
111
|
+
{#
|
|
112
|
+
Only on the htmx path: `hx-ext` is an instruction to htmx, and a form
|
|
113
|
+
without a target is submitted by the browser, which has never heard of it.
|
|
114
|
+
#}
|
|
115
|
+
{%- set extension = _ENCODINGS.get(encoding) if target else none -%}
|
|
116
|
+
<form class="{{ "card" if card else "" }}"
|
|
117
|
+
{%- if action %}
|
|
118
|
+
{%- if target %} {{ _HX_METHODS.get(method, "hx-post") }}="{{ action }}"
|
|
119
|
+
{%- else %} action="{{ action }}" method="{{ _NATIVE_METHODS.get(method, "post") }}"
|
|
120
|
+
{%- endif %}
|
|
121
|
+
{%- endif %}
|
|
122
|
+
{#
|
|
123
|
+
`hx-target`/`hx-swap` are inherited by every descendant that makes its
|
|
124
|
+
own request. A delete button inside the form would silently take the
|
|
125
|
+
form's target and swap; `hx-disinherit` makes it say its own.
|
|
126
|
+
#}
|
|
127
|
+
{%- if target %} hx-target="{{ target }}" hx-swap="{{ swap }}" hx-disinherit="hx-target hx-swap"{% endif %}
|
|
128
|
+
{%- if extension %} hx-ext="{{ extension }}"{% endif %}
|
|
129
|
+
{#
|
|
130
|
+
Both spellings, because a multipart form has to post either way: htmx
|
|
131
|
+
reads `hx-encoding` and a browser submitting natively reads `enctype`,
|
|
132
|
+
and neither has heard of the other. Getting this wrong loses the file
|
|
133
|
+
rather than erroring — a urlencoded POST sends the file's *name*.
|
|
134
|
+
#}
|
|
135
|
+
{%- if encoding == "multipart" %} hx-encoding="multipart/form-data" enctype="multipart/form-data"{% endif %}
|
|
136
|
+
{%- if reset_on_success %} hx-on::after-request="if (event.detail.successful) this.reset()"{% endif %}
|
|
137
|
+
{#
|
|
138
|
+
`progress` is a selector for a `progress()` bar, and this is the only
|
|
139
|
+
JavaScript that makes an upload bar move. It is written here rather than
|
|
140
|
+
left to the caller for three reasons. `hx-on::xhr:progress` cannot be
|
|
141
|
+
passed through `**kwargs` in any readable way. `lengthComputable` is
|
|
142
|
+
false when the body has no known length, and reading `total` then divides
|
|
143
|
+
by zero and paints `NaN` — a bar that jumps to full and stays there. And
|
|
144
|
+
a bar writes the same number in three places, so updating one of them is
|
|
145
|
+
worse than updating none: a filled bar beside a label reading 0%, or a
|
|
146
|
+
filled bar that a screen reader is still told is empty.
|
|
147
|
+
|
|
148
|
+
It is an inline attribute, so no file is added and §4.2's per-page budget
|
|
149
|
+
is unchanged.
|
|
150
|
+
#}
|
|
151
|
+
{%- if progress %} hx-on::xhr:progress="if (event.detail.lengthComputable) { const p = Math.round(event.detail.loaded / event.detail.total * 100), b = document.querySelector('{{ progress }}'); b.querySelector('[role=progressbar]').setAttribute('aria-valuenow', p); b.querySelector('[data-progress-bar]').style.width = p + '%'; const n = b.querySelector('[data-progress-value]'); if (n) n.textContent = p + '%'; }"{% endif %}
|
|
152
|
+
{%- if kwargs %}{{ attrs(kwargs) }}{% endif %}>
|
|
153
|
+
{% if card %}<section>{{ caller() }}</section>{% else %}{{ caller() }}{% endif %}
|
|
154
|
+
</form>
|
|
155
|
+
{%- endmacro %}
|
|
156
|
+
|
|
157
|
+
{#
|
|
158
|
+
form_scripts() — the script a page loads to be allowed `encoding="json"`.
|
|
159
|
+
|
|
160
|
+
{% block scripts %}{{ form_scripts() }}{% endblock %}
|
|
161
|
+
|
|
162
|
+
Per page, never from the shell. CHARTER §7 budgets what a page downloads by
|
|
163
|
+
default and the answer has to stay "htmx and Basecoat", so the 1,012 bytes
|
|
164
|
+
only some forms need are opted into by the page that has one — the way
|
|
165
|
+
`chart_scripts()` opts into Plotly.
|
|
166
|
+
|
|
167
|
+
`defer` keeps it after htmx: deferred scripts run in document order, htmx is
|
|
168
|
+
deferred in the shell's head, and the extension calls `htmx.defineExtension`
|
|
169
|
+
as soon as it runs. An ordinary `<script>` here runs before the deferred htmx
|
|
170
|
+
and throws on an undefined global.
|
|
171
|
+
|
|
172
|
+
A form asking for `encoding="json"` on a page that forgot this posts
|
|
173
|
+
urlencoded to a route that only reads JSON, and the reply is a 422 nobody
|
|
174
|
+
can act on — see the skill's list of failures tests do not catch.
|
|
175
|
+
#}
|
|
176
|
+
{% macro form_scripts() -%}
|
|
177
|
+
<script defer src="{{ fjkit_static("vendor/htmx/json-enc.js") }}"></script>
|
|
178
|
+
{%- endmacro %}
|
|
179
|
+
|
|
180
|
+
{#
|
|
181
|
+
field_row(template) — fields side by side on wide screens, stacked on narrow.
|
|
182
|
+
|
|
183
|
+
`template` is a closed lookup key, not a raw grid-template string: an
|
|
184
|
+
interpolated `sm:grid-cols-[…]` would not exist in the stylesheet.
|
|
185
|
+
#}
|
|
186
|
+
{% set _ROWS = {
|
|
187
|
+
"wide-then-actions": "sm:grid-cols-[1fr_8.5rem_8.5rem_auto]",
|
|
188
|
+
"two": "sm:grid-cols-2",
|
|
189
|
+
"three": "sm:grid-cols-3",
|
|
190
|
+
"four": "sm:grid-cols-2 lg:grid-cols-4",
|
|
191
|
+
"field-and-button": "sm:grid-cols-[1fr_auto]",
|
|
192
|
+
} %}
|
|
193
|
+
|
|
194
|
+
{% macro field_row(template="two", gap=3) -%}
|
|
195
|
+
{%- set _GAP = {2: "gap-2", 3: "gap-3", 4: "gap-4"} -%}
|
|
196
|
+
<div class="grid {{ _GAP.get(gap, "gap-3") }} {{ _ROWS.get(template, "sm:grid-cols-2") }} sm:items-end">
|
|
197
|
+
{{- caller() -}}
|
|
198
|
+
</div>
|
|
199
|
+
{%- endmacro %}
|
|
200
|
+
|
|
201
|
+
{#
|
|
202
|
+
text_field(name, label, …) — label + control + hint, wired together by id.
|
|
203
|
+
|
|
204
|
+
`type` is the whole of fjkit's answer to dates, times and numbers, and there
|
|
205
|
+
is no `date_field` next to this one on purpose. `type="date"` is a native
|
|
206
|
+
`<input>`: the calendar, the keyboard handling, the locale-correct display of
|
|
207
|
+
a value that still travels as `YYYY-MM-DD`, and the screen-reader announcement
|
|
208
|
+
are all the browser's, in every browser this kit supports. A macro wrapping it
|
|
209
|
+
would add a name and nothing else, which is the case CHARTER §2.3 rejects, and
|
|
210
|
+
a scripted picker would trade all of that for a control whose accessibility
|
|
211
|
+
fjkit then owns — §2.4's first row.
|
|
212
|
+
|
|
213
|
+
The types that behave as a field here:
|
|
214
|
+
|
|
215
|
+
text email password url tel search number
|
|
216
|
+
date time datetime-local month week
|
|
217
|
+
|
|
218
|
+
`min`, `max` and `step` are not parameters; they reach the input through
|
|
219
|
+
`**kwargs` like any other attribute, so a date range is
|
|
220
|
+
`text_field("due", type="date", min="2026-01-01")`.
|
|
221
|
+
|
|
222
|
+
`file` is deliberately not in that list. An upload is not a value the field
|
|
223
|
+
round-trips — `value=""` cannot restore it after a 422 — and it needs
|
|
224
|
+
`form(encoding="multipart")` to reach the server at all.
|
|
225
|
+
|
|
226
|
+
Not an enumeration in code. Narrowing `type` to a list would turn every new
|
|
227
|
+
input type HTML gains into a fjkit release, and the failure it would prevent
|
|
228
|
+
— a typo'd type — is one the browser already handles by falling back to
|
|
229
|
+
`text`.
|
|
230
|
+
#}
|
|
231
|
+
{% macro text_field(name, label=none, value="", placeholder="", type="text", required=false, hint=none, error=none, id=none) -%}
|
|
232
|
+
{%- set field_id = id or ("f-" ~ name) -%}
|
|
233
|
+
<div class="field">
|
|
234
|
+
{% if label %}<label class="label" for="{{ field_id }}">{{ label }}</label>{% endif %}
|
|
235
|
+
<input class="input" type="{{ type }}" id="{{ field_id }}" name="{{ name }}"
|
|
236
|
+
value="{{ value }}" placeholder="{{ placeholder }}"
|
|
237
|
+
{%- if required %} required{% endif %}
|
|
238
|
+
{%- if error %} aria-invalid="true"{% endif %}
|
|
239
|
+
{%- if hint or error %} aria-describedby="{{ field_id }}-hint"{% endif %}
|
|
240
|
+
{%- if kwargs %}{{ attrs(kwargs) }}{% endif %}>
|
|
241
|
+
{{ _message(field_id, hint, error) }}
|
|
242
|
+
</div>
|
|
243
|
+
{%- endmacro %}
|
|
244
|
+
|
|
245
|
+
{#
|
|
246
|
+
select_field(name, label, options, selected)
|
|
247
|
+
|
|
248
|
+
`options` is a list of (value, label) pairs. The caller decides the labels, so
|
|
249
|
+
the macro never reaches into a domain enum it should not know about.
|
|
250
|
+
|
|
251
|
+
A native <select>: no JS, correct for keyboard and screen reader, and one
|
|
252
|
+
element against the ~30 a scripted listbox emits. Use `ui/overlay.html`'s
|
|
253
|
+
`combobox` for type-to-filter, and either that or `select_menu(multiple=true)`
|
|
254
|
+
for more than one value; both cost the page a script.
|
|
255
|
+
|
|
256
|
+
A checkbox group in a `fieldset` is the third answer and often the right one:
|
|
257
|
+
no JS at all, and it posts the same repeated field. It stops scaling at about
|
|
258
|
+
a dozen options, which is where the two above start.
|
|
259
|
+
#}
|
|
260
|
+
{#
|
|
261
|
+
file_field(name, label, …) — the one field `text_field` will not do.
|
|
262
|
+
|
|
263
|
+
`type="file"` is excluded from `text_field` because a file input breaks the
|
|
264
|
+
contract every other field on this page keeps: `value` cannot restore it. A
|
|
265
|
+
browser will not let a page set a file input's value — that would let a site
|
|
266
|
+
post a file nobody chose — so a 422 redraw comes back with the box empty
|
|
267
|
+
while every other field still holds what was typed. That is not a bug this
|
|
268
|
+
macro can fix; it is why the macro exists to say so.
|
|
269
|
+
|
|
270
|
+
What follows for a route: validate the file first, or accept that a rejected
|
|
271
|
+
submit asks for it again. `hint` is where to put that sentence for the person
|
|
272
|
+
filling the form in.
|
|
273
|
+
|
|
274
|
+
The form has to carry `encoding="multipart"`. Without it the request is
|
|
275
|
+
urlencoded and the server is handed the file's *name* as a string — a
|
|
276
|
+
successful POST that saved nothing, with no error anywhere.
|
|
277
|
+
|
|
278
|
+
`accept` is a filter in the file picker and nothing more. Every browser lets
|
|
279
|
+
a determined person pick something else, so the route validates the type
|
|
280
|
+
again; this only saves the honest majority from choosing a file that was
|
|
281
|
+
never going to work.
|
|
282
|
+
|
|
283
|
+
`multiple` posts the field repeatedly, which FastAPI reads as
|
|
284
|
+
`list[UploadFile]`. Singular is `UploadFile`, and the two signatures are not
|
|
285
|
+
interchangeable.
|
|
286
|
+
#}
|
|
287
|
+
{% macro file_field(name, label=none, accept=none, multiple=false, required=false, hint=none, error=none, id=none) -%}
|
|
288
|
+
{%- set field_id = id or ("f-" ~ name) -%}
|
|
289
|
+
<div class="field">
|
|
290
|
+
{% if label %}<label class="label" for="{{ field_id }}">{{ label }}</label>{% endif %}
|
|
291
|
+
<input class="input" type="file" id="{{ field_id }}" name="{{ name }}"
|
|
292
|
+
{%- if accept %} accept="{{ accept }}"{% endif %}
|
|
293
|
+
{%- if multiple %} multiple{% endif %}
|
|
294
|
+
{%- if required %} required{% endif %}
|
|
295
|
+
{%- if error %} aria-invalid="true"{% endif %}
|
|
296
|
+
{%- if hint or error %} aria-describedby="{{ field_id }}-hint"{% endif %}
|
|
297
|
+
{%- if kwargs %}{{ attrs(kwargs) }}{% endif %}>
|
|
298
|
+
{{ _message(field_id, hint, error) }}
|
|
299
|
+
</div>
|
|
300
|
+
{%- endmacro %}
|
|
301
|
+
|
|
302
|
+
{% macro select_field(name, label=none, options=(), selected=none, id=none, blank=none, hint=none, error=none) -%}
|
|
303
|
+
{%- set field_id = id or ("f-" ~ name) -%}
|
|
304
|
+
<div class="field">
|
|
305
|
+
{% if label %}<label class="label" for="{{ field_id }}">{{ label }}</label>{% endif %}
|
|
306
|
+
<select class="select" id="{{ field_id }}" name="{{ name }}"
|
|
307
|
+
{%- if error %} aria-invalid="true"{% endif %}
|
|
308
|
+
{%- if hint or error %} aria-describedby="{{ field_id }}-hint"{% endif %}
|
|
309
|
+
{%- if kwargs %}{{ attrs(kwargs) }}{% endif %}>
|
|
310
|
+
{% if blank is not none %}<option value="">{{ blank }}</option>{% endif %}
|
|
311
|
+
{% for value, text in options %}
|
|
312
|
+
<option value="{{ value }}"{% if value == selected %} selected{% endif %}>{{ text }}</option>
|
|
313
|
+
{% endfor %}
|
|
314
|
+
</select>
|
|
315
|
+
{{ _message(field_id, hint, error) }}
|
|
316
|
+
</div>
|
|
317
|
+
{%- endmacro %}
|
|
318
|
+
|
|
319
|
+
{#
|
|
320
|
+
_message(field_id, hint, error) — the single <p> under a control.
|
|
321
|
+
|
|
322
|
+
One paragraph, never two: an error replaces the hint. Every field points
|
|
323
|
+
`aria-describedby` at this id, and the id is derived from the control's
|
|
324
|
+
rather than passed in, so a caller cannot get the two out of step.
|
|
325
|
+
#}
|
|
326
|
+
{% macro _message(field_id, hint=none, error=none) -%}
|
|
327
|
+
{%- if error %}<p class="text-destructive text-xs" id="{{ field_id }}-hint">{{ error }}</p>
|
|
328
|
+
{%- elif hint %}<p class="text-muted-foreground text-xs" id="{{ field_id }}-hint">{{ hint }}</p>
|
|
329
|
+
{%- endif -%}
|
|
330
|
+
{%- endmacro %}
|
|
331
|
+
|
|
332
|
+
{#
|
|
333
|
+
textarea_field(name, label, …) — multi-line text.
|
|
334
|
+
|
|
335
|
+
No `rows` by default: the stylesheet sets `field-sizing-content` with a
|
|
336
|
+
minimum height, so the control grows with what is typed. Pass `rows` only to
|
|
337
|
+
fix a height against that.
|
|
338
|
+
#}
|
|
339
|
+
{% macro textarea_field(name, label=none, value="", placeholder="", rows=none, required=false, hint=none, error=none, id=none) -%}
|
|
340
|
+
{%- set field_id = id or ("f-" ~ name) -%}
|
|
341
|
+
<div class="field">
|
|
342
|
+
{% if label %}<label class="label" for="{{ field_id }}">{{ label }}</label>{% endif %}
|
|
343
|
+
<textarea class="textarea" id="{{ field_id }}" name="{{ name }}" placeholder="{{ placeholder }}"
|
|
344
|
+
{%- if rows %} rows="{{ rows }}"{% endif %}
|
|
345
|
+
{%- if required %} required{% endif %}
|
|
346
|
+
{%- if error %} aria-invalid="true"{% endif %}
|
|
347
|
+
{%- if hint or error %} aria-describedby="{{ field_id }}-hint"{% endif %}
|
|
348
|
+
{%- if kwargs %}{{ attrs(kwargs) }}{% endif %}>{{ value }}</textarea>
|
|
349
|
+
{{ _message(field_id, hint, error) }}
|
|
350
|
+
</div>
|
|
351
|
+
{%- endmacro %}
|
|
352
|
+
|
|
353
|
+
{#
|
|
354
|
+
checkbox_field(name, label, checked) — one box, label to its right.
|
|
355
|
+
|
|
356
|
+
{{ checkbox_field("notify", label="Email me when it moves",
|
|
357
|
+
hint="Only for tasks you own.") }}
|
|
358
|
+
|
|
359
|
+
An unchecked box sends nothing at all. A route that needs to tell "off" from
|
|
360
|
+
"absent" — a PATCH of a partial form — pairs this with a hidden field; a
|
|
361
|
+
plain create route reads the absence as false and is done.
|
|
362
|
+
#}
|
|
363
|
+
{% macro checkbox_field(name, label=none, checked=false, value="on", hint=none, error=none, id=none) -%}
|
|
364
|
+
{%- set field_id = id or ("f-" ~ name) -%}
|
|
365
|
+
<div class="field" data-orientation="horizontal">
|
|
366
|
+
<input class="input" type="checkbox" id="{{ field_id }}" name="{{ name }}" value="{{ value }}"
|
|
367
|
+
{%- if checked %} checked{% endif %}
|
|
368
|
+
{%- if error %} aria-invalid="true"{% endif %}
|
|
369
|
+
{%- if hint or error %} aria-describedby="{{ field_id }}-hint"{% endif %}
|
|
370
|
+
{%- if kwargs %}{{ attrs(kwargs) }}{% endif %}>
|
|
371
|
+
<section>
|
|
372
|
+
{% if label %}<label class="label" for="{{ field_id }}">{{ label }}</label>{% endif %}
|
|
373
|
+
{{ _message(field_id, hint, error) }}
|
|
374
|
+
</section>
|
|
375
|
+
</div>
|
|
376
|
+
{%- endmacro %}
|
|
377
|
+
|
|
378
|
+
{#
|
|
379
|
+
switch_field(name, label, checked) — the same checkbox, read as a setting.
|
|
380
|
+
|
|
381
|
+
Same element and same wire format as `checkbox_field`: the stylesheet and the
|
|
382
|
+
screen reader both key off `role="switch"`, so a route cannot tell the two
|
|
383
|
+
apart and does not need to. Label first, control at the far right — a switch
|
|
384
|
+
reads as a state being flipped rather than a box being ticked, and settings
|
|
385
|
+
rows align their controls on one edge.
|
|
386
|
+
#}
|
|
387
|
+
{% macro switch_field(name, label=none, checked=false, value="on", hint=none, error=none, id=none) -%}
|
|
388
|
+
{%- set field_id = id or ("f-" ~ name) -%}
|
|
389
|
+
<div class="field" data-orientation="horizontal">
|
|
390
|
+
<section>
|
|
391
|
+
{% if label %}<label class="label" for="{{ field_id }}">{{ label }}</label>{% endif %}
|
|
392
|
+
{{ _message(field_id, hint, error) }}
|
|
393
|
+
</section>
|
|
394
|
+
<input class="input" type="checkbox" role="switch" id="{{ field_id }}" name="{{ name }}" value="{{ value }}"
|
|
395
|
+
{%- if checked %} checked{% endif %}
|
|
396
|
+
{%- if error %} aria-invalid="true"{% endif %}
|
|
397
|
+
{%- if hint or error %} aria-describedby="{{ field_id }}-hint"{% endif %}
|
|
398
|
+
{%- if kwargs %}{{ attrs(kwargs) }}{% endif %}>
|
|
399
|
+
</div>
|
|
400
|
+
{%- endmacro %}
|
|
401
|
+
|
|
402
|
+
{#
|
|
403
|
+
radio_group(name, label, options, selected)
|
|
404
|
+
|
|
405
|
+
`options` is the same list of (value, label) pairs `select_field` takes, so
|
|
406
|
+
swapping one for the other is a one-word edit. Which one to use follows from
|
|
407
|
+
the options: a radio group shows them all at once and costs a line each, so
|
|
408
|
+
it wins up to about five and loses after that.
|
|
409
|
+
|
|
410
|
+
A real <fieldset>/<legend>, not a div with a label: that is what makes the
|
|
411
|
+
group announce itself as one control with N choices rather than N unrelated
|
|
412
|
+
boxes, and arrow-key navigation between them comes from the browser.
|
|
413
|
+
#}
|
|
414
|
+
{% macro radio_group(name, label=none, options=(), selected=none, hint=none, error=none, id=none) -%}
|
|
415
|
+
{%- set field_id = id or ("f-" ~ name) -%}
|
|
416
|
+
<fieldset class="fieldset">
|
|
417
|
+
{% if label %}<legend data-variant="label">{{ label }}</legend>{% endif %}
|
|
418
|
+
<div role="radiogroup" data-slot="radio-group"
|
|
419
|
+
{%- if error %} aria-invalid="true"{% endif %}
|
|
420
|
+
{%- if hint or error %} aria-describedby="{{ field_id }}-hint"{% endif %}
|
|
421
|
+
{%- if kwargs %}{{ attrs(kwargs) }}{% endif %}>
|
|
422
|
+
{% for option_value, text in options %}
|
|
423
|
+
{%- set option_id = field_id ~ "-" ~ loop.index0 %}
|
|
424
|
+
<div class="field" data-orientation="horizontal">
|
|
425
|
+
<input class="input" type="radio" id="{{ option_id }}" name="{{ name }}" value="{{ option_value }}"
|
|
426
|
+
{%- if option_value == selected %} checked{% endif %}>
|
|
427
|
+
<label class="label" for="{{ option_id }}">{{ text }}</label>
|
|
428
|
+
</div>
|
|
429
|
+
{% endfor %}
|
|
430
|
+
</div>
|
|
431
|
+
{{ _message(field_id, hint, error) }}
|
|
432
|
+
</fieldset>
|
|
433
|
+
{%- endmacro %}
|
|
434
|
+
|
|
435
|
+
{#
|
|
436
|
+
fieldset(legend, hint) — a named group of fields inside one form.
|
|
437
|
+
|
|
438
|
+
{% call fieldset("Notifications", hint="Applies to this board only.") %}
|
|
439
|
+
{{ switch_field("email", label="Email") }}
|
|
440
|
+
{{ switch_field("digest", label="Weekly digest") }}
|
|
441
|
+
{% endcall %}
|
|
442
|
+
|
|
443
|
+
Use it when a form has more than one subject. One fieldset wrapping a whole
|
|
444
|
+
form says nothing the <form> did not already say.
|
|
445
|
+
|
|
446
|
+
The legend is sized as a heading (`data-variant="legend"`), one step up from
|
|
447
|
+
the field labels under it. `radio_group` writes its own legend at
|
|
448
|
+
`data-variant="label"`, because there the legend is the field's label and has
|
|
449
|
+
to match every other label on the form.
|
|
450
|
+
#}
|
|
451
|
+
{% macro fieldset(legend=none, hint=none) -%}
|
|
452
|
+
<fieldset class="fieldset"{% if kwargs %}{{ attrs(kwargs) }}{% endif %}>
|
|
453
|
+
{% if legend %}<legend data-variant="legend">{{ legend }}</legend>{% endif %}
|
|
454
|
+
{% if hint %}<p class="text-muted-foreground text-xs">{{ hint }}</p>{% endif %}
|
|
455
|
+
{{ caller() }}
|
|
456
|
+
</fieldset>
|
|
457
|
+
{%- endmacro %}
|
|
458
|
+
|
|
459
|
+
{#
|
|
460
|
+
range_field(name, label, …) — a native <input type="range">.
|
|
461
|
+
|
|
462
|
+
Native, for the reason `select_field` is native: keyboard, screen reader and
|
|
463
|
+
touch behaviour arrive correct and free, where a scripted slider has to
|
|
464
|
+
re-implement all three and usually re-implements two.
|
|
465
|
+
|
|
466
|
+
Basecoat paints the filled part of the track from a `--slider-value` custom
|
|
467
|
+
property and updates it from its own JS as the thumb moves. The starting
|
|
468
|
+
value has to be set here, or the fill sits at upstream's 20% default until
|
|
469
|
+
the first drag — a bar that disagrees on first paint with the number beside
|
|
470
|
+
it.
|
|
471
|
+
|
|
472
|
+
`output` is a live region showing the current value, off by default: a slider
|
|
473
|
+
whose own text already reads "Volume 40%" does not need it, and a second
|
|
474
|
+
announcement on every keypress is noise.
|
|
475
|
+
#}
|
|
476
|
+
{% macro range_field(name, label=none, value=50, min=0, max=100, step=1, hint=none, error=none, id=none, output=false) -%}
|
|
477
|
+
{%- set field_id = id or ("f-" ~ name) -%}
|
|
478
|
+
{%- set span = (max - min) or 1 -%}
|
|
479
|
+
{%- set filled = (((value - min) / span) * 100) | round(2) -%}
|
|
480
|
+
<div class="field">
|
|
481
|
+
{% if label %}
|
|
482
|
+
<label class="label" for="{{ field_id }}">
|
|
483
|
+
{{ label }}
|
|
484
|
+
{%- if output %}<output for="{{ field_id }}" class="text-muted-foreground tabular-nums">{{ value }}</output>{% endif %}
|
|
485
|
+
</label>
|
|
486
|
+
{% endif %}
|
|
487
|
+
<input class="input" type="range" id="{{ field_id }}" name="{{ name }}"
|
|
488
|
+
value="{{ value }}" min="{{ min }}" max="{{ max }}" step="{{ step }}"
|
|
489
|
+
style="--slider-value: {{ filled }}%"
|
|
490
|
+
{%- if label and output %} oninput="this.parentElement.querySelector('output').value = this.value"{% endif %}
|
|
491
|
+
{%- if error %} aria-invalid="true"{% endif %}
|
|
492
|
+
{%- if hint or error %} aria-describedby="{{ field_id }}-hint"{% endif %}
|
|
493
|
+
{%- if kwargs %}{{ attrs(kwargs) }}{% endif %}>
|
|
494
|
+
{{ _message(field_id, hint, error) }}
|
|
495
|
+
</div>
|
|
496
|
+
{%- endmacro %}
|
|
497
|
+
|
|
498
|
+
{#
|
|
499
|
+
input_group_field(name, label, start, end, …) — an input with addons.
|
|
500
|
+
|
|
501
|
+
`start` and `end` are rendered markup, the same way `card` takes `actions`:
|
|
502
|
+
|
|
503
|
+
{% set count %}<span>{{ n }} results</span>{% endset %}
|
|
504
|
+
{{ input_group_field("q", "Search", end=count) }}
|
|
505
|
+
|
|
506
|
+
Slots rather than a caller block, because both are optional and a caller
|
|
507
|
+
cannot say "nothing here": `{% call %}` would render an empty addon, and an
|
|
508
|
+
empty addon still takes its padding.
|
|
509
|
+
|
|
510
|
+
Basecoat strips the border from the inner control and paints it on the group,
|
|
511
|
+
so the input deliberately carries no `class="input"` — giving it one draws a
|
|
512
|
+
second box inside the first.
|
|
513
|
+
|
|
514
|
+
`revealable` puts a Show/Hide toggle in the end group, for the one field that
|
|
515
|
+
always wants one:
|
|
516
|
+
|
|
517
|
+
{{ input_group_field("password", label="Password", type="password",
|
|
518
|
+
required=true, autocomplete="current-password",
|
|
519
|
+
revealable=true) }}
|
|
520
|
+
|
|
521
|
+
{% block scripts %}{{ reveal_scripts() }}{% endblock %}
|
|
522
|
+
|
|
523
|
+
It lives here rather than in `text_field` because the reveal has to sit inside
|
|
524
|
+
the input's box, and `.input-group` is the only markup in the kit with a place
|
|
525
|
+
for it: a plain `.input` followed by a button is two boxes.
|
|
526
|
+
|
|
527
|
+
`reveal_show` and `reveal_hide` are the button's two labels. They are
|
|
528
|
+
parameters rather than constants so that a Spanish sign-in page is not a fork
|
|
529
|
+
of the kit; the script reads both off the element and never holds an English
|
|
530
|
+
string.
|
|
531
|
+
|
|
532
|
+
A page that forgets `reveal_scripts()` gets a button that does nothing on
|
|
533
|
+
click. That is the loudest of this kit's missing-script failures and still
|
|
534
|
+
quiet: the field keeps working, and only the affordance is broken.
|
|
535
|
+
#}
|
|
536
|
+
{% macro input_group_field(name, label=none, value="", placeholder="", type="text", start=none, end=none, required=false, hint=none, error=none, id=none, revealable=false, reveal_show="Show", reveal_hide="Hide") -%}
|
|
537
|
+
{%- set field_id = id or ("f-" ~ name) -%}
|
|
538
|
+
<div class="field">
|
|
539
|
+
{% if label %}<label class="label" for="{{ field_id }}">{{ label }}</label>{% endif %}
|
|
540
|
+
<div class="input-group">
|
|
541
|
+
<input type="{{ type }}" id="{{ field_id }}" name="{{ name }}"
|
|
542
|
+
value="{{ value }}" placeholder="{{ placeholder }}"
|
|
543
|
+
{%- if required %} required{% endif %}
|
|
544
|
+
{%- if error %} aria-invalid="true"{% endif %}
|
|
545
|
+
{%- if hint or error %} aria-describedby="{{ field_id }}-hint"{% endif %}
|
|
546
|
+
{%- if kwargs %}{{ attrs(kwargs) }}{% endif %}>
|
|
547
|
+
{#
|
|
548
|
+
`data-align` decides the order rather than the source order — the CSS
|
|
549
|
+
sets `order-first` / `order-last` — so the input stays first in the
|
|
550
|
+
markup, where the label association reads naturally.
|
|
551
|
+
#}
|
|
552
|
+
{%- if start %}<span role="group" data-align="start">{{ start }}</span>{% endif %}
|
|
553
|
+
{#
|
|
554
|
+
The reveal button shares the end group with whatever the caller passed,
|
|
555
|
+
and comes after it: an addon is usually a unit (a currency, a count) and
|
|
556
|
+
the control that changes the field belongs next to the field's edge.
|
|
557
|
+
#}
|
|
558
|
+
{%- if end or revealable %}
|
|
559
|
+
<span role="group" data-align="end">
|
|
560
|
+
{{- end if end }}
|
|
561
|
+
{%- if revealable %}
|
|
562
|
+
{#
|
|
563
|
+
`type="button"`, or the first thing a reveal does is submit the form.
|
|
564
|
+
`aria-pressed` is the state — this is a toggle, not a command — and
|
|
565
|
+
`aria-controls` is how `js/reveal.js` finds the input without
|
|
566
|
+
knowing that ids here are `f-<name>`.
|
|
567
|
+
#}
|
|
568
|
+
{{ button(reveal_show, variant="ghost", size="xs",
|
|
569
|
+
aria_controls=field_id, aria_pressed="false",
|
|
570
|
+
data_fjkit_reveal=true, data_show=reveal_show, data_hide=reveal_hide) }}
|
|
571
|
+
{%- endif %}
|
|
572
|
+
</span>
|
|
573
|
+
{%- endif %}
|
|
574
|
+
</div>
|
|
575
|
+
{{ _message(field_id, hint, error) }}
|
|
576
|
+
</div>
|
|
577
|
+
{%- endmacro %}
|
|
578
|
+
|
|
579
|
+
{#
|
|
580
|
+
reveal_scripts() — the script behind `input_group_field(revealable=true)`.
|
|
581
|
+
|
|
582
|
+
Per page, never from the shell, for the reason `form_scripts()` and
|
|
583
|
+
`multiselect_scripts()` are: CHARTER §7 budgets what a page downloads by
|
|
584
|
+
default, and the answer has to stay "htmx and Basecoat". A sign-in page is
|
|
585
|
+
one page.
|
|
586
|
+
|
|
587
|
+
It buys a toggle that survives a rejected submit. The listener is on
|
|
588
|
+
`document`, so a button arriving in a swapped-in panel works as well as one
|
|
589
|
+
present at first paint — the case that matters, because the form a password
|
|
590
|
+
lives in is the form most likely to come back with a 422 and a fresh copy of
|
|
591
|
+
itself.
|
|
592
|
+
#}
|
|
593
|
+
{% macro reveal_scripts() -%}
|
|
594
|
+
<script defer src="{{ fjkit_static("js/reveal.js") }}"></script>
|
|
595
|
+
{%- endmacro %}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{#
|
|
2
|
+
icon(name, size, cls) — one inline Lucide glyph.
|
|
3
|
+
|
|
4
|
+
Path data comes from Python (`fjkit_icon_path`), not a Jinja dict: the full
|
|
5
|
+
set is ~1500 entries, and a literal that size compiles into every template
|
|
6
|
+
that imports this one.
|
|
7
|
+
|
|
8
|
+
`stroke="currentColor"` gives an icon the colour of its context, so icons
|
|
9
|
+
need no token of their own.
|
|
10
|
+
#}
|
|
11
|
+
{%- macro icon(name, size=16, cls="") -%}
|
|
12
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="{{ size }}" height="{{ size }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"{% if cls %} class="{{ cls }}"{% endif %} aria-hidden="true">{{ fjkit_icon_path(name) }}</svg>
|
|
13
|
+
{%- endmacro -%}
|