oficina / sheets Public

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

Plain git — no account needed to clone.

Download

Download this file

1{{define "layout"}}<!doctype html>
2{{/* layout — every page's document: the head, the estilo bar and <main>.
3
4 The bar is estilo's (chrome.Bar, built once per request in
5 chrome.go), in place of the rastrillo topbar markup this file used to
6 write out itself: that bar was 45px signed out and 51px signed in,
7 because the Create and Import buttons were taller than it, so signing
8 in moved the whole page. estilo's is 52px at every width, signed in
9 or out, with the account always last in the same corner.
10
11 data-theme is written into the first bytes of the response, from a
12 cookie read server-side (chrome.Appearance). AGENTS.md: light/dark
13 must resolve before first paint, because cell fills resolve against
14 the theme and a late preference repaints every coloured cell. It is
15 ABSENT for "system", and that is the mechanism, not an omission:
16 theme.css's whole toggle is :root[data-theme="light"] and
17 :root[data-theme="dark"], and with no attribute the browser resolves
18 against the OS.
19
20 The <title> is built here and only here, "{part} · {part} · Sheets",
21 so no handler can drift from the suite's separator (spec §10). The
22 sign-in door's is rastrillo's for its state (Frame.Title), which
23 already names Sheets: "Sign in to Sheets".
24
25 <meta charset> comes first, before anything that could be read as
26 text. The stylesheets are in the suite's fixed order: tokens, theme,
27 brand, then estilo's base, menu and chrome, then the app's own. */}}
28<html lang="en" dir="ltr"{{with .Frame.Theme}} data-theme="{{.}}"{{end}}>
29<head>
30<meta charset="utf-8">
31<meta name="viewport" content="width=device-width, initial-scale=1">
32<title>{{with .Frame.Title}}{{.}}{{else}}{{range .Frame.TitleParts}}{{.}} · {{end}}{{.Frame.Chrome.App.Name}}{{end}}</title>
33<link rel="icon" type="image/png" sizes="32x32" href="{{asset "static/brand/icon-32.png"}}">
34<link rel="icon" type="image/svg+xml" href="{{asset "static/brand/icon.svg"}}">
35<link rel="apple-touch-icon" sizes="180x180" href="{{asset "static/brand/apple-touch-icon.png"}}">
36<link rel="stylesheet" href="{{asset "static/tokens.css"}}">
37<link rel="stylesheet" href="{{asset "static/estilo/busy.css"}}">
38<link rel="stylesheet" href="{{asset "static/theme.css"}}">
39<link rel="stylesheet" href="{{asset "static/brand/brand.css"}}">
40<link rel="stylesheet" href="{{asset "static/estilo/base.css"}}">
41<link rel="stylesheet" href="{{asset "static/estilo/menu.css"}}">
42<link rel="stylesheet" href="{{asset "static/estilo/chrome.css"}}">
43<link rel="stylesheet" href="{{asset "static/estilo/sky.css"}}">
44<link rel="stylesheet" href="{{asset "static/sheets.css"}}">
45{{/* First of every script: while a modal dialog is open, key and
46 clipboard events stop at the window before any page listener hears
47 them (static/modal.js). */}}
48<script defer src="{{asset "static/modal.js"}}"></script>
49<script defer src="{{asset "static/rastrillo.js"}}"></script>
50<script defer src="{{asset "static/estilo/busy.js"}}"></script>
51<script defer src="{{asset "static/estilo/chrome.js"}}"></script>
52{{iconAssets}}
53{{block "head" .}}{{end}}
54</head>
55<body>
56{{/* [estilo-shell] wraps every page. On the grid it is
57 estilo-shell="fill": exactly the viewport, the bar at its 52px and
58 the grid's <main> taking the rest (estilo chrome.css). That is why
59 the grid can fill the screen without this app subtracting a bar
60 height it would have to guess. The "main" block lets the grid page
61 supply its own <main>, without rst-page's padding and max width.
62 Every other page's <main> is Fiesta's stack (rst-stack): it spaces
63 the page's blocks, its header, headings, prose, forms and buttons,
64 by one table, so no page sets a margin between them by hand. */}}
65<div estilo-shell{{with .Frame.Shell}}="{{.}}"{{end}}>
66<a rst-skip href="#main">{{.Frame.Chrome.Labels.Skip}}</a>
67{{template "estilo-bar" .Frame.Chrome}}
68{{block "main" .}}<main rst-page rst-stack id="main">{{template "content" .}}</main>{{end}}
69</div>
70{{if .Frame.Shortcuts}}{{template "shortcuts-dialog" .Frame.Keys}}{{end}}
71</body>
72</html>
73{{end}}
74
75{{/* The keyboard shortcuts, opened from the account menu's Help
76 ("Keyboard shortcuts…"). It used to be the Help menu on the grid's
77 menu bar, a definition list inside a dropdown; Help moved into the
78 account menu with every other app's (spec §8.2), and a list of keys
79 is not a menu. A native <dialog>, so it sits in the top layer above
80 the bar (spec §5.3), and it opens with the platform's invoker
81 command, so no script is needed. The labels are this request's
82 platform's (menu.Shortcut): ⌘Z on a Mac, Ctrl+Z elsewhere. */}}
83{{define "shortcuts-dialog"}}<dialog id="sheets-shortcuts" data-shortcuts aria-labelledby="sheets-shortcuts-title">
84<form method="dialog">
85<h2 id="sheets-shortcuts-title">Keyboard shortcuts</h2>
86<dl>
87<dt><kbd>{{.undo}}</kbd></dt><dd>Undo your last edit</dd>
88<dt><kbd>{{.bold}}</kbd></dt><dd>Bold</dd>
89<dt><kbd>{{.italic}}</kbd></dt><dd>Italic</dd>
90<dt><kbd>{{.cut}}</kbd></dt><dd>Cut</dd>
91<dt><kbd>{{.copy}}</kbd></dt><dd>Copy</dd>
92<dt><kbd>{{.paste}}</kbd></dt><dd>Paste</dd>
93<dt><kbd>{{.filldown}}</kbd></dt><dd>Fill down</dd>
94<dt><kbd>{{.delete}}</kbd></dt><dd>Clear the selected cells</dd>
95<dt><kbd>{{.enter}}</kbd></dt><dd>Commit and move down</dd>
96<dt><kbd>{{.tab}}</kbd></dt><dd>Commit and move right</dd>
97<dt><kbd>{{.esc}}</kbd></dt><dd>Abandon the edit</dd>
98</dl>
99<div data-shortcuts-foot><button rst-btn="primary" type="submit" autofocus>Done</button></div>
100</form>
101</dialog>{{end}}
102
103{{define "contrast-notice"}}
104{{if .}}
105{{/* Spec §11.1: a retained fill can be unreadable, and that is
106 correct. We render an imported file as authored — silently
107 correcting it would lie about the document — so the obligation
108 that follows is to say so and leave the decision to the person.
109 This is that, and it is deliberately a notice rather than a
110 change to any cell. A warning (the shared chrome spec's §4): it
111 used to say rst-callout="warn", which is no rastrillo tone, so it
112 rendered as a neutral grey note. */}}
113<div rst-callout rst-tone="warning">
114<span rst-callout-ic aria-hidden="true">{{icon "alert-triangle"}}</span>
115<div rst-callout-body>
116<p><strong>Imported colours below the contrast floor.</strong>
117These cells came from a file pairing a fill and a text colour under
118WCAG AA's 4.5:1: {{range $i, $ref := .}}{{if $i}}, {{end}}<code>{{$ref}}</code>{{end}}</p>
119<p>They are shown exactly as the file wrote them. Changing a colour is
120yours to decide, not ours to do quietly.</p>
121</div>
122</div>
123{{end}}
124{{end}}
125