{{/* estilo-bar: the whole app header, one row at every width unless it is stacked. Data: chrome.Bar. Parse this package's templates together with menu.Templates() and the app's own layout. The skip link and
are the layout's; this is only the
. Stacked (Bar.Menubar set, estilo-bar~="stacked"): the title and the app's menu bar share [estilo-bar-stack], the title over the menus. From 800px that is the 56px header; below it the stack dissolves (display: contents) and the menus become a full-width second row, so the markup is the same at every width. Order in the end group is fixed in every app: the lead (Bar.Lead), actions, then Menu (narrow only) or a compact bar's trail, then the switcher, then the account. The account is always the last thing at the inline end. Compact (Bar.Compact set, estilo-bar~="compact"): below 704px the phone's one row, Back (the brand, with a chevron before it), the title or Compact.Title, the lead and Compact.Trail. A compact bar draws the Menu sheet only for its nav (Bar.Nav), before the trail, so the nav is never out of reach: the trail is the overflow for everything else, the actions included. The brand is a link to the app root, except on public read-only pages, where App.Home is empty and it is plain text. */}} {{define "estilo-bar"}}
{{- if .App.Home}} {{if .Compact}}{{template "estilo-icon-back"}}{{end}}{{.App.Name}} {{- else}} {{.App.Name}} {{- end}} {{- if .Menubar}}
{{- with .ContextEdit}} {{template "estilo-bar-title-fit" .}} {{- else}}{{with .Context}} {{.}} {{- end}}{{end}}
{{.Menubar}}
{{- else}} {{- with .ContextEdit}} {{template "estilo-bar-title" .}} {{- else}}{{with .Context}} {{.}} {{- end}}{{end}} {{- end}} {{- with .Compact}}{{with .Title}}
{{.}}
{{- end}}{{end}} {{- if .Nav}} {{- end}}
{{- with .Lead}}
{{.}}
{{- end}} {{- if .Actions}}
{{template "estilo-bar-actions" .}}
{{- end}} {{- $sheet := false}}{{range .Actions}}{{if not .WideOnly}}{{$sheet = true}}{{end}}{{end}} {{- if or .Nav (and (not .Compact) $sheet)}}
{{template "estilo-icon-menu"}}{{.Labels.Menu}}
{{- range .Nav}}{{.Label}}{{end}} {{- if and .Nav $sheet}}
{{end}} {{- range .Actions}}{{if not .WideOnly}}{{template "estilo-menu-item" .Item}}{{end}}{{end}}
{{- end}} {{- with .Compact}}
{{.Trail}}
{{- end}} {{- with .Switcher}} {{template "estilo-switcher" .}} {{- end}} {{- if .Account}} {{template "estilo-account" .Account}} {{- else}}{{with .SignIn}} {{.Label}} {{- end}}{{end}}
{{end}} {{/* estilo-bar-actions: the wide-screen actions, from Bar.Actions, each the element its Item names: a link, a one-button POST form, a button opening a dialog, or a toggle (aria-expanded, aria-controls) rendered disabled until the app's script binds it. The same items are rows in the narrow Menu sheet, so both stay one list; a WideOnly action is marked estilo-bar-wide, hidden below 64rem, and left out of the sheet. An app may redefine this after parsing to change how they are drawn, but the sheet always renders Bar.Actions. In a bar with a slot (Menubar or Lead) each action sits in its own
(display: contents), "primary" for the primary one and "wide" for a WideOnly one: the hooks the controls set is styled on, since estilo's CSS never selects rastrillo's rst- attributes (AGENTS.md, the prefix rule). A bar with no slot draws the actions bare, as it always has. */}} {{define "estilo-bar-actions"}}{{$controls := or .Menubar .Lead}}{{range .Actions}}{{if $controls}}
{{template "estilo-bar-action" .}}
{{else}}{{template "estilo-bar-action" .}}{{end}}{{end}}{{end}} {{define "estilo-bar-action"}}{{if .Action}}
{{else if .Dialog}}{{else if .Controls}}{{else}}{{template "estilo-bar-action-face" .}}{{end}}{{end}} {{/* estilo-bar-action-name and -face: what an action's control says. Most show their icon and label. An IconOnly one (Action.IconOnly) shows its icon alone, carries its label as aria-label, and shows the label and Key as a tooltip on hover and focus (rastrillo's rst-tip, drawn from the estilo-bar-icon box). KeyShortcuts, when set, is the control's aria-keyshortcuts. IconOnly with no Icon draws the label as usual: a control is never left empty. Neither writes a byte for an action that sets none of these. */}} {{define "estilo-bar-action-name"}}{{with .KeyShortcuts}} aria-keyshortcuts="{{.}}"{{end}}{{if and .IconOnly .Icon}} aria-label="{{.Label}}" estilo-bar-icon rst-tip data-tip="{{.Label}}{{with .Key}} {{.}}{{end}}"{{end}}{{end}} {{define "estilo-bar-action-face"}}{{.Icon}}{{if not (and .IconOnly .Icon)}}{{.Label}}{{end}}{{end}} {{/* estilo-bar-title: the open object's title, editable in place. A real form, so Enter renames with scripts off. The submit button is visually hidden until the form has focus. Data: chrome.TitleEdit. */}} {{define "estilo-bar-title"}}
{{end}} {{/* estilo-bar-title-fit: the same form in a stacked bar, where the field is as wide as its title: the size attribute (TitleEdit.Size) is the first paint's approximation, and chrome.js measures the field and corrects it. It differs from estilo-bar-title only by that attribute (TestTheFittedTitleIsTheTitlePlusASize). Data: chrome.TitleEdit. */}} {{define "estilo-bar-title-fit"}}
{{end}}