forge
Explore
Log in

Don't you dare go Hollow

forge

Clone
★ 0

0 watching0 forksRustAGPL-3.07.1 MiB490f099Tahinli7 hours ago322 commits

_palette.scss275 lines, 5.5 KiBHistoryRawDownload
1// Command palette (Ctrl+K): a panel over the page with a search row, one scrolling list grouped by
2// kind, a line for action results and empty states, and a footer of key chips. The panel and its
3// rows follow the card, the timeline's labels and the path bar's key chips.
4
5// The path bar's edit button (_shell.scss .pathbar-edit) opens it. The dialog is in the top layer,
6// so it sits over the page and the path bar without any positioning of its own.
7
8dialog.palette {
9 width: min(640px, calc(100vw - 32px));
10 max-height: min(70vh, 560px);
11 margin: 12vh auto 0;
12 padding: 0;
13 color: var(--text);
14 background: var(--surface);
15 border: 1px solid var(--border-strong);
16 border-radius: var(--radius-lg);
17 box-shadow: var(--pop-shadow);
18
19 &::backdrop {
20 background: color-mix(in srgb, var(--bg) 55%, transparent);
21 }
22
23 &[open] {
24 display: flex;
25 flex-direction: column;
26 }
27}
28
29.palette-box {
30 display: flex;
31 flex-direction: column;
32 min-height: 0;
33 flex: 1 1 auto;
34}
35
36// Opened from the path bar, the dialog sits under it: fixed, with its top and left set inline by
37// nav.js. The auto margins of a modal and its bottom inset are cleared so only those two apply.
38.palette.anchored {
39 margin: 0;
40 position: fixed;
41 inset: auto;
42}
43
44// The search row is part of the palette, not a field inside it: no box, only the divider below.
45.palette-search {
46 flex: none;
47 display: flex;
48 align-items: center;
49 gap: 10px;
50 height: 48px;
51 padding: 0 16px;
52 color: var(--muted);
53 border-bottom: 1px solid var(--border);
54
55 &:focus-within {
56 color: var(--accent);
57 }
58}
59
60.palette-input {
61 flex: 1 1 auto;
62 min-width: 0;
63 height: 48px;
64 padding: 0;
65 font: inherit;
66 font-size: 15px;
67 color: var(--text);
68 background: transparent;
69 border: 0;
70
71 &::placeholder {
72 color: var(--muted);
73 }
74
75 &:focus,
76 &:focus-visible {
77 outline: none;
78 box-shadow: none;
79 }
80}
81
82.palette-list {
83 flex: 1 1 auto;
84 min-height: 0;
85 margin: 0;
86 padding: 0 6px 6px;
87 overflow-y: auto;
88 list-style: none;
89 font-size: 14px;
90
91 li {
92 margin: 0;
93 }
94
95 // Group headings: the mono label of the timeline, held at the top while its rows scroll past.
96 .palette-head {
97 position: sticky;
98 top: 0;
99 z-index: 1;
100 height: 28px;
101 padding: 0 10px;
102 font-family: var(--mono);
103 font-size: 11px;
104 font-weight: 500;
105 line-height: 28px;
106 letter-spacing: 0.12em;
107 text-transform: uppercase;
108 color: var(--muted);
109 background: var(--surface);
110 }
111
112 // Rows: one line, 36px, an icon, the label, and the reason at the right.
113 li[role="option"] {
114 display: flex;
115 align-items: center;
116 gap: 10px;
117 height: 36px;
118 padding: 0 10px;
119 color: var(--text);
120 border-radius: var(--radius-md);
121 cursor: pointer;
122 min-width: 0;
123 }
124
125 // The selected row (keys or pointer): a surface step with a thin accent edge on the left.
126 li[aria-selected="true"] {
127 background: var(--surface-2);
128 box-shadow: inset 2px 0 var(--accent);
129 }
130
131 li[role="option"]:hover {
132 background: var(--surface-2);
133 }
134}
135
136.palette-ico {
137 flex: none;
138 width: 16px;
139 height: 16px;
140 fill: none;
141 stroke: var(--muted);
142 stroke-width: 1.8;
143 stroke-linecap: round;
144 stroke-linejoin: round;
145}
146
147// The label: a path muted, its last segment in the text colour, each ellipsised when they overflow.
148.palette-label {
149 flex: 1 1 auto;
150 display: flex;
151 min-width: 0;
152 white-space: nowrap;
153}
154
155.palette-path,
156.palette-name {
157 min-width: 0;
158 overflow: hidden;
159 text-overflow: ellipsis;
160 white-space: nowrap;
161}
162
163.palette-path {
164 flex: 0 1 auto;
165 color: var(--muted);
166}
167
168.palette-name {
169 flex: 0 1 auto;
170 color: var(--text);
171}
172
173.palette-tail {
174 font-weight: 500;
175}
176
177.palette-why {
178 flex: 0 1 auto;
179 max-width: 50%;
180 min-width: 0;
181 overflow: hidden;
182 color: var(--muted);
183 font-size: 12px;
184 text-align: right;
185 text-overflow: ellipsis;
186 white-space: nowrap;
187}
188
189// Where a search led: the setting it found, until the next key or click.
190.palette-hit {
191 outline: 2px solid var(--accent);
192 outline-offset: -2px;
193 border-radius: var(--radius-sm);
194}
195
196// A line above the key chips: a sent action's result, or the state of the list. Hidden otherwise.
197.palette-note {
198 flex: none;
199 margin: 0;
200 padding: 8px 16px;
201 border-top: 1px solid var(--border);
202
203 &[hidden] {
204 display: none;
205 }
206
207 // A sent action: done in the ok colour, a refusal in the failure colour.
208 &.is-ok {
209 color: var(--ok);
210 }
211
212 &.is-bad {
213 color: var(--bad);
214 }
215}
216
217// The footer's key chips, with the same key look as the path bar's Ctrl K.
218.palette-keys {
219 flex: none;
220 display: flex;
221 align-items: center;
222 gap: 16px;
223 height: 36px;
224 padding: 0 16px;
225 border-top: 1px solid var(--border);
226 font-size: 12px;
227 color: var(--muted);
228
229 > span {
230 display: inline-flex;
231 align-items: center;
232 gap: 6px;
233 white-space: nowrap;
234 }
235
236 kbd {
237 flex: none;
238 padding: 0 5px;
239 font-family: var(--mono);
240 font-size: 11px;
241 line-height: 18px;
242 color: var(--text-2);
243 background: var(--surface-2);
244 border: 1px solid var(--border-strong);
245 border-radius: var(--radius-sm);
246 }
247}
248
249// Phones: the palette spans the screen width and sits at the top, with larger rows to tap. The key
250// chips go: a phone has no keys.
251@media (max-width: 600px) {
252 dialog.palette {
253 width: calc(100vw - 16px);
254 max-height: calc(100vh - 16px);
255 margin: 8px auto 0;
256 }
257
258 .palette-input {
259 height: 52px;
260 font-size: 16px;
261 }
262
263 .palette-search {
264 height: 52px;
265 }
266
267 .palette-list li[role="option"] {
268 height: 44px;
269 padding: 0 12px;
270 }
271
272 .palette-keys {
273 display: none;
274 }
275}