{{/* The component kit: one {{define}} per partial of docs/plans/panel-redesign.md
§ Three layers. This is the only file besides layout.html in which an sp-
component class is written; a page calls a partial and passes the struct
that components.go declares for it (a page never builds the input with
dict), and it never rebuilds the markup. The reference for every partial in
every state is the mockup components page,
docs/assets/panel-redesign/panel/src/components.html — the markup here is
that markup, element for element and class for class, and the kit page
(GET /server/components, kit.html) renders it all from fixtures.
Go templates have no slots, so a component that wraps the page's own
content is an open/close pair: box_open … box_close, body_open …
body_close, record_open … record_close. Between the two the page writes
Bulma markup (a table in its table-container, a form) or calls another
partial. */}}
{{/* ---- inline content: the text a struct field carries */}}
{{/* inline renders a Text (components.go): plain text, links, code, mono
values, strong, emphasis, tags and line breaks, all escaped. It is how a
lead, a box's end slot or a fact's value can hold a link or a code span
without any field being trusted HTML. */}}
{{define "inline"}}{{range .}}{{if .Break}}
{{else if .Tag}}{{template "tag" .Tag}}{{else if .Href}}{{template "inline_leaf" .}}{{else}}{{template "inline_leaf" .}}{{end}}{{end}}{{end}}
{{define "inline_leaf"}}{{if .Code}}{{.Text}}{{else if .Mono}}{{.Text}}{{else if .Strong}}{{.Text}}{{else if .Em}}{{.Text}}{{else}}{{.Text}}{{end}}{{end}}
{{/* tag is a status tag (input: Tag). The colour comes from status_tag, the one
mapping of status to Bulma classes; the label defaults to the status. */}}
{{define "tag"}}{{if .Label}}{{.Label}}{{else}}{{.Status}}{{end}}{{end}}
{{/* kicker is the upper-case mono micro-label on its own (input: string).
page_head writes its own kicker as the line above the title. */}}
{{define "kicker"}}{{.}}{{end}}
{{/* action is a button in a page head or a box foot (input: Action): a link, or
a POST form with one submit button when Post is set — a state change is
never a link. */}}
{{define "action"}}{{if .Post}}
{{range $i, $c := .Crumbs}}{{if $i}} {{end}}{{if $c.Href}}{{$c.Label}}{{else}}{{$c.Label}}{{end}} /{{end}}
{{else if .Kicker}}{{.Kicker}}
{{end}}{{template "inline" .Lead}}
{{end}}{{range .}}{{if .Arrow}}{{else if .Tag}}{{template "tag" .Tag}}{{else}}{{.Text}}{{end}}{{end}}
{{end}} {{/* flash is the result of the last action, between page_head and the first box (input: Flash). A field's own error stays in help is-danger. */}} {{define "flash"}}{{template "inline" .Problem}}
{{end}}{{template "inline" .Help}}
{{end}}{{range $i, $l := .}}{{if $i}}
{{end}}{{if $l.Time}}{{$l.Time}} {{end}}{{if eq $l.Level "warn"}}{{$l.Text}}{{else if eq $l.Level "error"}}{{$l.Text}}{{else}}{{$l.Text}}{{end}}{{end}}{{end}}
{{/* empty_state says what is absent and why that is fine (input: EmptyState). */}}
{{define "empty_state"}}{{template "inline" .}}
{{end}}