oficina / estilo Public

Clone
git clone https://amadan.net/oficina/estilo

Plain git — no account needed to clone.

Download

Download this file

1{{/* estilo-side: the app's side panel, one grid per row. In the rail
2 the labels stay in the accessibility tree and show as tooltips. One
3 shown row carries aria-current (side.Light): the page's own row, or
4 its place. A place holding a page that has its own row is drawn twice
5 (estilo-side-holds): unlit while the side is open, lit in the rail,
6 which hides the page rows; CSS shows one. The lit copy is [hidden]
7 too, so with no CSS at all only the page's row is lit; the rail's CSS
8 draws it all the same. The fold is two submit buttons, one per state;
9 CSS shows the one that fits what is on screen, so it works with
10 scripts off and with no cookie.
11
12 Data: side.Side. The frame around it and <main> is the app's:
13 <div estilo-side-frame="{{.State}}">. */}}
14{{define "estilo-side"}}<nav estilo-side aria-label="{{.Label}}">
15 {{- range .Places}}
16 {{- if .Holds}}
17 <a estilo-side-item estilo-side-holds="open" href="{{.Href}}">{{template "estilo-side-item-body" .}}</a>
18 <a estilo-side-item estilo-side-holds="rail" href="{{.Href}}" aria-current="page" hidden>{{template "estilo-side-item-body" .}}</a>
19 {{- else}}
20 {{template "estilo-side-item" .}}
21 {{- end}}
22 {{- end}}
23 {{- range .Sections}}{{if .Items}}
24 <h2 estilo-side-head>{{.Heading}}</h2>
25 {{- range .Items}}
26 <a estilo-side-item estilo-side-page href="{{.Href}}"{{if .Current}} aria-current="page"{{end}}>{{template "estilo-side-item-body" .}}</a>
27 {{- end}}
28 {{- end}}{{end}}
29 <div estilo-side-foot>
30 {{- .Foot}}
31 {{- with .Fold}}
32 {{template "estilo-side-fold" .}}
33 {{- end}}
34 </div>
35</nav>{{end}}
36
37{{/* estilo-side-item: one place row, a link. Data: side.Item. An app
38 drawing its own foot rows can use it too. */}}
39{{define "estilo-side-item"}}<a estilo-side-item href="{{.Href}}"{{if .Current}} aria-current="page"{{end}}>{{template "estilo-side-item-body" .}}</a>{{end}}
40{{define "estilo-side-item-body"}}{{.Icon}}<span estilo-side-label>{{.Label}}{{with .Locked}}<span estilo-visually-hidden>{{.}}</span>{{end}}</span>{{if .Locked}}<span estilo-side-lock aria-hidden="true">{{template "estilo-icon-lock"}}</span>{{end}}{{with .Key}}<kbd estilo-side-key aria-hidden="true">{{.}}</kbd>{{end}}{{end}}
41
42{{/* estilo-side-fold: Hide and Show, one per state. Each is a real
43 POST of state=rail or state=open; side.js, when present, folds in
44 place instead. Data: side.Fold. */}}
45{{define "estilo-side-fold"}}<form method="post" action="{{.Action}}" estilo-side-fold{{with .Cookie}} data-estilo-side-cookie="{{.}}"{{end}}>
46 <input type="hidden" name="return" value="{{.Return}}">
47 <button estilo-side-item type="submit" name="state" value="rail" estilo-side-fold-to="rail" data-estilo-side-fold>{{template "estilo-icon-panel-left"}}<span estilo-side-label>{{.Hide}}</span>{{with .Key}}<kbd estilo-side-key aria-hidden="true">{{.}}</kbd>{{end}}</button>
48 <button estilo-side-item type="submit" name="state" value="open" estilo-side-fold-to="open" data-estilo-side-fold>{{template "estilo-icon-panel-left"}}<span estilo-side-label>{{.Show}}</span></button>
49 </form>{{end}}
50
51{{/* The side's glyphs. Lucide "panel-left" and "lock" (ISC,
52 brand/LICENSE.lucide). Decorative: each sits beside a label. */}}
53{{define "estilo-icon-panel-left"}}<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/></svg>{{end}}
54{{define "estilo-icon-lock"}}<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>{{end}}
55