forge
Explore
Log in

Don't you dare go Hollow

The room speaks in its own type and its badges get terse

Browse files at this commit

d5dd5fc620e93082b78dc4abb467abec59db1b1aAhmet Kaan GümüşParent: 25a08e3
  • style
    • the room speaks in its own type and its badges get terse
Show full message
💄 style(ui): the room speaks in its own type and its badges get terse

Every chord badge read like a sentence — "x or delete", "z or ctrl+z" —
stacked under a glyph the width of two characters, so the spine had to
stretch down the whole window to fit. A badge shows the primary stroke,
compact: x, z, del, ^o. The overlay still tells the whole truth, which is
where alternatives belong. With the badges short the groups close up to the
rhythm the mock draws.

The type the last commit bundled was never actually asked for: most text
carried no family or size at all, so the room rendered in whatever the
toolkit defaults to, which is why the import verbs came out twice their
size. Every string in the stance now asks the type scale for its role —
Archivo for what the room says, mono for what the film says.

The contact strip could not span the band because the band's own row
refused to claim the width, so the strip's flex had nothing to grow into.
It fills the space between the readout and the chip now.
crates/app/src/keymap.rsmodified+48 -0
@@ -877,6 +877,26 @@ impl Chord {
877877 }
878878 }
879879
880+ /// The spelling a badge with room for one token reads (MOCK-SPEC.md
881+ /// "Spine": `del`, `z`, not `x or delete`, `ctrl+z`): `^` in place of
882+ /// `ctrl+`, and the handful of key names whose everyday short form isn't
883+ /// gpui's own (`delete` -> `del`, `escape` -> `esc`, `space` -> `spc`).
884+ /// [`Chord::pretty`] stays the keys overlay's own spelling -- this is for
885+ /// a glyph badge, not the full truth.
886+ pub fn compact(&self) -> String {
887+ let key = match self.key.as_str() {
888+ "escape" => "esc",
889+ "delete" => "del",
890+ "space" => "spc",
891+ other => other,
892+ };
893+ if self.ctrl {
894+ format!("^{key}")
895+ } else {
896+ key.to_string()
897+ }
898+ }
899+
880900 /// Whether the file can carry this stroke and read it back as itself. gpui
881901 /// reports strokes this format cannot spell -- shift+= arrives as the key
882902 /// `"+"`, which is the chord grammar's own separator -- and binding one
@@ -1215,6 +1235,20 @@ impl Keymap {
12151235 }
12161236 }
12171237
1238+ /// The primary chord for `action`, compact ([`Chord::compact`]) -- a
1239+ /// badge that has room for one token, not [`Keymap::display`]'s sentence.
1240+ /// The first bound stroke wins (`defaults`' own insertion order, and
1241+ /// `rebind_action`'s "makes `chord` the whole of what reaches `action`"
1242+ /// leaves at most one anyway); an action with no stroke reads `--`
1243+ /// rather than the unbound sentence, since a badge is not a warning.
1244+ pub fn chord(&self, action: ActionId) -> String {
1245+ self.bindings
1246+ .iter()
1247+ .find(|b| b.action == action)
1248+ .map(|b| b.chord.compact())
1249+ .unwrap_or_else(|| "--".to_string())
1250+ }
1251+
12181252 /// Every binding, in display order.
12191253 pub fn entries(&self) -> &[Binding] {
12201254 &self.bindings
@@ -1742,6 +1776,20 @@ mod tests {
17421776 assert_eq!(k.display(ActionId::ZoomIn), "ctrl+=");
17431777 }
17441778
1779+ /// [`Keymap::chord`] is the badge's one token, not [`Keymap::display`]'s
1780+ /// sentence: the primary (first-bound) stroke only, `^` for ctrl, and the
1781+ /// short names a glyph badge actually has room for.
1782+ #[test]
1783+ fn chord_is_the_primary_stroke_compact() {
1784+ let k = Keymap::defaults();
1785+ assert_eq!(k.chord(ActionId::Delete), "x");
1786+ assert_eq!(k.chord(ActionId::Undo), "z");
1787+ assert_eq!(k.chord(ActionId::AddFiles), "^o");
1788+ assert_eq!(k.chord(ActionId::CancelExport), "^esc");
1789+ assert_eq!(k.chord(ActionId::Play), "spc");
1790+ assert_eq!(whole("edith-keys 1\n").chord(ActionId::Cut), "--");
1791+ }
1792+
17451793 /// The one row of [`FIXED`] that speaks for a whole table elsewhere: it
17461794 /// named six keys for seven codecs, and OGG's `o` was a stroke the card
17471795 /// never mentioned. The chord is generated from `FORMATS` now, and this
crates/app/src/ui/bench_stance.rsmodified+27 -6
@@ -28,6 +28,7 @@
2828 //! answer for.
2929
3030 use crate::*;
31+use crate::ui::type_scale::{self, Typeset};
3132
3233 /// The pinned ruler's own height, above the lane stack -- tall enough for a
3334 /// tick line plus a mono `MM:SS` label under it (DESIGN §5's "tick marks with
@@ -275,12 +276,22 @@ fn clip_box(
275276 .gap(px(4.))
276277 .bg(rgba(DARK_SEAM()))
277278 .when_some(label, |d, label| {
278- d.child(div().min_w(px(0.)).truncate().text_size(px(9.5)).text_color(rgb(INK1())).child(label))
279+ d.child(
280+ div()
281+ .min_w(px(0.))
282+ .truncate()
283+ .type_style(type_scale::mono(
284+ type_scale::CHORD_METADATA_MIN_PX,
285+ gpui::FontWeight::MEDIUM,
286+ ))
287+ .text_color(rgb(INK1()))
288+ .child(label),
289+ )
279290 })
280291 .child(
281292 div()
282293 .flex_none()
283- .text_size(px(9.))
294+ .type_style(type_scale::mono(9., gpui::FontWeight::MEDIUM))
284295 .text_color(rgb(INK3()))
285296 .child(readout),
286297 ),
@@ -296,7 +307,7 @@ fn clip_box(
296307 .right_0()
297308 .px(px(3.))
298309 .bg(rgb(DARK_RAISED()))
299- .text_size(px(9.))
310+ .type_style(type_scale::mono(9., gpui::FontWeight::MEDIUM))
300311 .text_color(rgb(INK2()))
301312 .child(format!("{speed}")),
302313 )
@@ -360,7 +371,11 @@ fn lane_row(
360371 .justify_center()
361372 .gap(px(2.))
362373 .bg(rgb(DARK_PANEL()))
363- .text_size(px(9.5))
374+ // MOCK-SPEC.md "Bench": "V1, A1 in mono".
375+ .type_style(type_scale::mono(
376+ type_scale::CHORD_METADATA_MIN_PX,
377+ gpui::FontWeight::MEDIUM,
378+ ))
364379 .text_color(rgb(INK2()))
365380 .child(lane.label())
366381 .child(div().flex_none().w(px(4.)).h(px(4.)).rounded(px(2.)).bg(rgb(dot))),
@@ -462,7 +477,10 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>)
462477 .child(div().w(px(1.)).h(px(4.)).bg(rgb(INK3())))
463478 .child(
464479 div()
465- .text_size(px(8.))
480+ .type_style(type_scale::mono(
481+ type_scale::FLOOR_PX,
482+ gpui::FontWeight::MEDIUM,
483+ ))
466484 .text_color(rgb(INK3()))
467485 .child(label),
468486 ),
@@ -492,7 +510,10 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>)
492510 .items_center()
493511 .px(px(4.))
494512 .bg(rgb(DARK_CANVAS()))
495- .text_size(px(10.))
513+ .type_style(type_scale::mono(
514+ type_scale::CHORD_METADATA_MAX_PX,
515+ gpui::FontWeight::MEDIUM,
516+ ))
496517 .text_color(rgb(INK1()))
497518 .child(playhead_tc),
498519 ),
crates/app/src/ui/dock_stance.rsmodified+62 -34
@@ -12,6 +12,8 @@
1212 //! [`clip_middle`]...), only the anatomy around them is new.
1313
1414 use crate::*;
15+use crate::ui::type_scale::{self, head, label, mono};
16+use gpui::FontWeight;
1517
1618 /// Where the dock tab pick lives: one word beside the theme and the
1719 /// keybindings (`ui::theme::config_path`/`save`/`load` is the exact pattern
@@ -73,7 +75,7 @@ impl DockSort {
7375 /// hover instead of disappearing (§8).
7476 fn ghost_verb(
7577 id: &'static str,
76- label: &'static str,
78+ verb_label: &'static str,
7779 action: ActionId,
7880 active: bool,
7981 hint: &str,
@@ -88,6 +90,8 @@ fn ghost_verb(
8890 }
8991 .into();
9092 let on = enabled.yes();
93+ let label_style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);
94+ let chord_style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM);
9195 div()
9296 .id(id)
9397 .flex_none()
@@ -98,7 +102,6 @@ fn ghost_verb(
98102 .px(px(8.))
99103 .rounded(px(3.))
100104 .when(active, |d| d.bg(rgb(DARK_RAISED())))
101- .text_color(rgb(if active { INK1() } else { INK2() }))
102105 .tooltip(move |_, cx| cx.new(|_| Tip(say.clone())).into())
103106 .when(!on, |d| d.opacity(0.4).cursor_not_allowed())
104107 .when(on, |d| {
@@ -106,11 +109,18 @@ fn ghost_verb(
106109 .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1())))
107110 .on_click(on_click)
108111 })
109- .child(label)
112+ .child(
113+ div()
114+ .font(label_style.font)
115+ .text_size(label_style.size)
116+ .text_color(rgb(if active { INK1() } else { INK2() }))
117+ .child(verb_label),
118+ )
110119 .child(
111120 div()
112121 .flex_none()
113- .text_size(px(9.5))
122+ .font(chord_style.font)
123+ .text_size(chord_style.size)
114124 .text_color(rgb(if active { INK1() } else { INK3() }))
115125 .child(key),
116126 )
@@ -124,7 +134,8 @@ fn ghost_verb(
124134 /// DESIGN §11's frequency check puts a lift and a mark far ahead of a tab
125135 /// switch -- wearing a chord this room does not answer to would be exactly
126136 /// the lie DESIGN §4 forbids, so the letters go instead.
127-fn dock_tab(id: &'static str, label: &'static str, active: bool, cx: &mut Context<Player>) -> impl IntoElement {
137+fn dock_tab(id: &'static str, label_text: &'static str, active: bool, cx: &mut Context<Player>) -> impl IntoElement {
138+ let style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);
128139 div()
129140 .id(id)
130141 .flex_1()
@@ -135,27 +146,28 @@ fn dock_tab(id: &'static str, label: &'static str, active: bool, cx: &mut Contex
135146 .pt(px(6.))
136147 .pb(px(6.))
137148 .when(active, |d| d.border_t_1().border_color(rgb(INK1())))
138- .text_size(px(10.5))
139- .text_color(rgb(if active { INK1() } else { INK3() }))
140149 .cursor_pointer()
141150 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
142- this.dock_src_active = label == "SOURCES";
151+ this.dock_src_active = label_text == "SOURCES";
143152 save(this.dock_src_active);
144153 cx.notify();
145154 }))
146155 .child(
147156 div()
148- .text_size(px(10.5))
157+ .font(style.font)
158+ .text_size(style.size)
149159 .text_color(rgb(if active { INK1() } else { INK3() }))
150- .child(label),
160+ .child(label_text),
151161 )
152162 }
153163
154164 /// A 9px uppercase Archivo section head, `ink3` (DESIGN §3).
155165 fn section_head(text: impl Into<SharedString>) -> impl IntoElement {
166+ let style = head();
156167 div()
157168 .flex_none()
158- .text_size(px(9.))
169+ .font(style.font)
170+ .text_size(style.size)
159171 .text_color(rgb(INK3()))
160172 .child(text.into())
161173 }
@@ -271,31 +283,37 @@ fn source_row(player: &Player, i: usize, row: &Row, placed: usize, picked: bool,
271283 )
272284 }),
273285 )
274- .child(
286+ .child({
287+ let style = mono(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);
275288 div()
276289 .flex_1()
277290 .min_w(px(0.))
278291 .truncate()
279- .text_size(px(10.5))
292+ .font(style.font)
293+ .text_size(style.size)
280294 .text_color(rgb(INK1()))
281- .child(name),
282- )
283- .child(
295+ .child(name)
296+ })
297+ .child({
298+ let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM);
284299 div()
285300 .flex_none()
286- .text_size(px(9.5))
301+ .font(style.font)
302+ .text_size(style.size)
287303 .text_color(rgb(INK3()))
288- .child(usage),
289- ),
304+ .child(usage)
305+ }),
290306 )
291- .child(
307+ .child({
308+ let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM);
292309 div()
293310 .pl(px(14.))
294311 .truncate()
295- .text_size(px(9.5))
312+ .font(style.font)
313+ .text_size(style.size)
296314 .text_color(rgb(INK3()))
297- .child(under),
298- )
315+ .child(under)
316+ })
299317 }
300318
301319 /// The Sources tab, built off MOCK-SPEC.md's "Dock" section: count line,
@@ -345,12 +363,14 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
345363 .p(px(8.))
346364 .overflow_y_scroll()
347365 .child(section_head(format!("SOURCES · {total} · {unused_count} UNUSED")))
348- .child(
366+ .child({
367+ let style = mono(type_scale::CHORD_METADATA_MAX_PX, FontWeight::MEDIUM);
349368 div()
350369 .id("dock-filter")
351370 .flex_none()
352371 .cursor_text()
353- .text_size(px(10.))
372+ .font(style.font)
373+ .text_size(style.size)
354374 .text_color(rgb(if player.dock_filter_edit { INK1() } else { INK3() }))
355375 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
356376 this.dock_filter_edit = true;
@@ -359,8 +379,8 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
359379 .child(match player.dock_filter.is_empty() {
360380 true => "⌕ type to filter — name, codec, unused…".to_string(),
361381 false => format!("⌕ {filter_text}"),
362- }),
363- )
382+ })
383+ })
364384 .child(
365385 div()
366386 .flex_none()
@@ -368,13 +388,15 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
368388 .gap(px(4.))
369389 .children(DockSort::ALL.map(|sort| {
370390 let on = sort == player.dock_sort;
391+ let style = label(9.5, FontWeight::MEDIUM);
371392 div()
372393 .id(("dock-sort", sort as usize))
373394 .flex_none()
374395 .px(px(6.))
375396 .py(px(2.))
376397 .rounded(px(3.))
377- .text_size(px(9.5))
398+ .font(style.font)
399+ .text_size(style.size)
378400 .when(on, |d| d.bg(rgb(DARK_RAISED())).text_color(rgb(INK1())))
379401 .when(!on, |d| d.text_color(rgb(INK3())))
380402 .cursor_pointer()
@@ -396,9 +418,11 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
396418 .gap(px(2.))
397419 .overflow_y_scroll()
398420 .when(rows.is_empty(), |d| {
421+ let style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);
399422 d.child(
400423 div()
401- .text_size(px(10.5))
424+ .font(style.font)
425+ .text_size(style.size)
402426 .text_color(rgb(INK3()))
403427 .child(match player.dock_filter.is_empty() {
404428 true => "No sources yet — Add files, or drop one on the window".to_string(),
@@ -443,16 +467,18 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
443467 cx.listener(|this, _: &ClickEvent, _, cx| this.paste_file_path(cx)),
444468 )),
445469 )
446- .child(
470+ .child({
471+ let style = mono(9., FontWeight::MEDIUM);
447472 div()
448473 .flex_none()
449- .text_size(px(9.))
474+ .font(style.font)
475+ .text_size(style.size)
450476 .text_color(rgb(INK3()))
451477 .child(
452478 "drag a row to a lane · ↵ add at playhead · double-click plays in screen · \
453479 right-click the dot to re-ink a source (rare — lives out of the way)",
454- ),
455- )
480+ )
481+ })
456482 }
457483
458484 /// The Clip tab: the four verbs DESIGN §5 names, as ghosts, over whichever
@@ -534,12 +560,14 @@ fn clip_tab(player: &Player, width: f32, window_h: Pixels, cx: &mut Context<Play
534560 // A plate, not bare space: DESIGN §11's "states" checklist --
535561 // nothing picked reads as a hint, not as a hole in the panel.
536562 .when(none_open, |d| {
563+ let style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);
537564 d.child(
538565 div()
539566 .rounded(px(2.))
540567 .bg(rgb(DARK_CANVAS()))
541568 .p(px(8.))
542- .text_size(px(10.5))
569+ .font(style.font)
570+ .text_size(style.size)
543571 .text_color(rgb(INK3()))
544572 .child("pick a verb above"),
545573 )
crates/app/src/ui/spine_stance.rsmodified+31 -23
@@ -3,29 +3,26 @@
33 //! not the flat ungrouped list of glyph-beside-chord rows the shipped room
44 //! drew. `stance.rs::spine()` keeps the panel frame (width, surface,
55 //! border); this module owns the rows inside it.
6-//!
7-//! corner-cut: sizes below are plain `px()` literals matching DESIGN §3's
8-//! scale (13px glyph, 9.5px chord, 9px head) rather than calls into a
9-//! `ui::type_scale` API -- that module had not landed in this tree at the
10-//! time this was written. Ceiling: swap these three constants for its
11-//! tokens once it lands; nothing else here would change.
126
137 use crate::*;
8+use crate::ui::type_scale::{self, Typeset};
149
10+/// The glyph icon itself: DESIGN §3 names no separate role for it, so this
11+/// keeps the size the module has always drawn it at (13px, the same number
12+/// as the hero timecode by coincidence, not by role) and routes only the
13+/// font family through [`type_scale`] (Archivo -- the glyph is a verb, the
14+/// room's voice, not something the film says).
1515 const GLYPH_SIZE: f32 = 13.;
16-const CHORD_SIZE: f32 = 9.5;
17-const HEAD_SIZE: f32 = 9.;
1816
19-/// A group head: 9px uppercase Archivo 700(-weight token, same as every
20-/// other section head in the stance) in `ink3`, +0.14em tracking (DESIGN
21-/// §3) -- reused as its own small fn rather than `stance::section_head`
17+/// A group head: 9px uppercase Archivo 700 in `ink3`, +0.14em tracking
18+/// (DESIGN §3) -- reused as its own small fn rather than `stance::section_head`
2219 /// because that one is private to its module and carries a different
2320 /// vertical rhythm (a region label, not a spine group head).
2421 fn group_head(label: &str) -> impl IntoElement {
2522 div()
2623 .flex_none()
27- .pt(px(6.))
28- .text_size(px(HEAD_SIZE))
24+ .pt(px(10.))
25+ .type_style(type_scale::head())
2926 .text_color(rgb(INK3()))
3027 .child(label.to_uppercase())
3128 }
@@ -46,12 +43,17 @@ fn glyph(
4643 cx: &mut Context<Player>,
4744 ) -> impl IntoElement + use<> {
4845 let enabled = player.enable(action, None);
49- let key = player.keymap.display(action);
46+ // The badge shows the primary chord only (FAULT 1: a chord badge is a
47+ // compact token, not a sentence); the tooltip keeps every stroke an
48+ // action answers to, and the keys overlay ([`crate::ui::stance`]) is
49+ // still where the full truth lives.
50+ let full = player.keymap.display(action);
5051 let say: SharedString = match enabled.why() {
51- Some(why) => format!("{key} — {why}"),
52- None => format!("{key} — {}", action.label()),
52+ Some(why) => format!("{full} — {why}"),
53+ None => format!("{full} — {}", action.label()),
5354 }
5455 .into();
56+ let compact = player.keymap.chord(action);
5557 let on = enabled.yes();
5658 div()
5759 .id(id)
@@ -59,9 +61,9 @@ fn glyph(
5961 .flex()
6062 .flex_col()
6163 .items_center()
62- .gap(px(2.))
64+ .gap(px(1.))
6365 .px(px(4.))
64- .py(px(4.))
66+ .py(px(2.))
6567 .rounded(px(3.))
6668 .when(active, |d| d.bg(rgb(DARK_RAISED())))
6769 .tooltip(move |_, cx| cx.new(|_| Tip(say.clone())).into())
@@ -75,15 +77,18 @@ fn glyph(
7577 })
7678 .child(
7779 div()
78- .text_size(px(GLYPH_SIZE))
80+ .type_style(type_scale::label(GLYPH_SIZE, gpui::FontWeight::MEDIUM))
7981 .text_color(rgb(if active { INK1() } else { INK2() }))
8082 .child(glyph),
8183 )
8284 .child(
8385 div()
84- .text_size(px(CHORD_SIZE))
86+ .type_style(type_scale::mono(
87+ type_scale::CHORD_METADATA_MIN_PX,
88+ gpui::FontWeight::MEDIUM,
89+ ))
8590 .text_color(rgb(INK3()))
86- .child(key),
91+ .child(compact),
8792 )
8893 }
8994
@@ -96,7 +101,7 @@ fn pair(left: impl IntoElement, right: impl IntoElement) -> impl IntoElement {
96101 .flex()
97102 .items_center()
98103 .justify_center()
99- .gap(px(10.))
104+ .gap(px(6.))
100105 .child(left)
101106 .child(right)
102107 }
@@ -123,7 +128,10 @@ pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElem
123128 .flex()
124129 .flex_col()
125130 .items_center()
126- .gap(px(10.))
131+ // FAULT 2: rows close under their group head, real space (the group
132+ // head's own `pt`) only between one group and the next -- not one
133+ // uniform gap stretching every row down the window.
134+ .gap(px(2.))
127135 .overflow_y_scroll()
128136 .child(group_head("edit"))
129137 .child(glyph("spine-split", "||", ActionId::Cut, false, player, cx))
crates/app/src/ui/stance.rsmodified+86 -16
@@ -13,6 +13,7 @@ use crate::ui::bench_stance;
1313 use crate::ui::dock_stance;
1414 use crate::ui::timeband_stance;
1515 use crate::ui::spine_stance;
16+use crate::ui::type_scale::{self, Typeset};
1617
1718 /// Left rail, full height (DESIGN §5).
1819 const SPINE_W: f32 = 56.;
@@ -35,7 +36,7 @@ const DOCK_W: f32 = 280.;
3536 fn section_head(label: &str) -> impl IntoElement {
3637 div()
3738 .flex_none()
38- .text_size(px(9.))
39+ .type_style(type_scale::head())
3940 .text_color(rgb(INK3()))
4041 .child(label.to_uppercase())
4142 }
@@ -52,14 +53,19 @@ fn ghost(player: &Player, glyph: &str, action: ActionId) -> impl IntoElement {
5253 .gap(px(2.))
5354 .py(px(6.))
5455 .rounded(px(3.))
55- .text_size(px(13.))
56+ .type_style(type_scale::label(13., gpui::FontWeight::MEDIUM))
5657 .text_color(rgb(INK2()))
5758 .child(glyph.to_string())
5859 .child(
5960 div()
60- .text_size(px(9.5))
61+ .type_style(type_scale::mono(
62+ type_scale::CHORD_METADATA_MIN_PX,
63+ gpui::FontWeight::MEDIUM,
64+ ))
6165 .text_color(rgb(INK3()))
62- .child(player.keymap.display(action)),
66+ // FAULT 1: the badge shows the primary chord, compact --
67+ // same rule as every glyph in `spine_stance`.
68+ .child(player.keymap.chord(action)),
6369 )
6470 }
6571
@@ -112,7 +118,7 @@ fn keys_overlay(player: &Player) -> impl IntoElement {
112118 KeyRow::Head(category) => div()
113119 .flex_none()
114120 .pt(px(4.))
115- .text_size(px(9.))
121+ .type_style(type_scale::head())
116122 .text_color(rgb(INK3()))
117123 .child(category.label().to_uppercase())
118124 .into_any_element(),
@@ -120,9 +126,27 @@ fn keys_overlay(player: &Player) -> impl IntoElement {
120126 .flex()
121127 .justify_between()
122128 .gap(px(12.))
123- .text_size(px(9.5))
124- .child(div().text_color(rgb(INK2())).child(action.label()))
125- .child(div().text_color(rgb(INK3())).child(player.keymap.display(action)))
129+ .child(
130+ div()
131+ .type_style(type_scale::label(
132+ type_scale::CHORD_METADATA_MIN_PX,
133+ gpui::FontWeight::MEDIUM,
134+ ))
135+ .text_color(rgb(INK2()))
136+ .child(action.label()),
137+ )
138+ .child(
139+ div()
140+ .type_style(type_scale::mono(
141+ type_scale::CHORD_METADATA_MIN_PX,
142+ gpui::FontWeight::MEDIUM,
143+ ))
144+ .text_color(rgb(INK3()))
145+ // The keys overlay is the full-truth surface
146+ // (FAULT 1): every chord an action answers to,
147+ // not the badge's primary-only compact form.
148+ .child(player.keymap.display(action)),
149+ )
126150 .into_any_element(),
127151 KeyRow::Fixed(i) => {
128152 let f = &keymap::FIXED[i];
@@ -130,9 +154,24 @@ fn keys_overlay(player: &Player) -> impl IntoElement {
130154 .flex()
131155 .justify_between()
132156 .gap(px(12.))
133- .text_size(px(9.5))
134- .child(div().text_color(rgb(INK2())).child(f.label))
135- .child(div().text_color(rgb(INK3())).child(f.chord.clone()))
157+ .child(
158+ div()
159+ .type_style(type_scale::label(
160+ type_scale::CHORD_METADATA_MIN_PX,
161+ gpui::FontWeight::MEDIUM,
162+ ))
163+ .text_color(rgb(INK2()))
164+ .child(f.label),
165+ )
166+ .child(
167+ div()
168+ .type_style(type_scale::mono(
169+ type_scale::CHORD_METADATA_MIN_PX,
170+ gpui::FontWeight::MEDIUM,
171+ ))
172+ .text_color(rgb(INK3()))
173+ .child(f.chord.clone()),
174+ )
136175 .into_any_element()
137176 }
138177 })),
@@ -278,7 +317,7 @@ fn notice_plate(message: SharedString) -> impl IntoElement {
278317 // shape as the legacy notice bar's own tone stripe (`notice_bar`).
279318 .border_l(px(3.))
280319 .border_color(rgb(notice_severity(&message)))
281- .text_size(px(10.))
320+ .type_style(type_scale::label(10., gpui::FontWeight::MEDIUM))
282321 .text_color(rgb(INK1()))
283322 .child(message)
284323 }
@@ -308,18 +347,49 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement {
308347 .gap(px(14.))
309348 .px(px(12.))
310349 .child(section_head("ledger"))
311- .child(div().text_size(px(9.5)).text_color(rgb(INK1())).child(identity))
350+ // MOCK-SPEC.md "Ledger": "All mono" -- project identity, last
351+ // action, export progress and position are all what the film/project
352+ // says, not the room's own voice.
353+ .child(
354+ div()
355+ .type_style(type_scale::mono(
356+ type_scale::CHORD_METADATA_MIN_PX,
357+ gpui::FontWeight::MEDIUM,
358+ ))
359+ .text_color(rgb(INK1()))
360+ .child(identity),
361+ )
312362 .child(
313363 div()
314364 .flex_1()
315365 .min_w(px(0.))
316366 .truncate()
317- .text_size(px(9.5))
367+ .type_style(type_scale::mono(
368+ type_scale::CHORD_METADATA_MIN_PX,
369+ gpui::FontWeight::MEDIUM,
370+ ))
318371 .text_color(rgb(INK3()))
319372 .child(last_action),
320373 )
321- .children(export.map(|e| div().text_size(px(9.5)).text_color(rgb(INK2())).child(e)))
322- .child(div().flex_none().text_size(px(9.5)).text_color(rgb(INK2())).child(tc))
374+ .children(export.map(|e| {
375+ div()
376+ .type_style(type_scale::mono(
377+ type_scale::CHORD_METADATA_MIN_PX,
378+ gpui::FontWeight::MEDIUM,
379+ ))
380+ .text_color(rgb(INK2()))
381+ .child(e)
382+ }))
383+ .child(
384+ div()
385+ .flex_none()
386+ .type_style(type_scale::mono(
387+ type_scale::CHORD_METADATA_MIN_PX,
388+ gpui::FontWeight::MEDIUM,
389+ ))
390+ .text_color(rgb(INK2()))
391+ .child(tc),
392+ )
323393 }
324394
325395 /// The dock: the only side panel, right, fixed width, carrying the Src/Clip
crates/app/src/ui/timeband_stance.rsmodified+44 -13
@@ -8,9 +8,12 @@
88 //! (MOCK-SPEC.md) reads closer to ~20px. Kept at 13px here -- the binding
99 //! contract's own number, already what `stance.rs::time_band()` shipped --
1010 //! rather than silently picking the mock's, and named here per this task's
11-//! own instruction to say so when the two disagree.
11+//! own instruction to say so when the two disagree. Every size in this
12+//! module now comes from `ui::type_scale` (role, not a bare `px()` literal).
1213
1314 use crate::*;
15+use crate::ui::type_scale::{self, label, mono};
16+use gpui::FontWeight;
1417
1518 thread_local! {
1619 // corner-cut: every other drag surface in this codebase (the bench
@@ -30,18 +33,24 @@ thread_local! {
3033 /// fires it -- the same shape `stance::ghost` draws for the spine, kept local
3134 /// here so this module owns its own region end to end.
3235 fn ghost(player: &Player, glyph: &str, action: ActionId) -> impl IntoElement {
36+ let glyph_style = label(type_scale::HERO_TIMECODE_PX, FontWeight::MEDIUM);
37+ // The chord names a key, so DESIGN §3's mono rule ("if a string is about
38+ // ... a key, it is mono") applies here same as everywhere else in the band.
39+ let chord_style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM);
3340 div()
3441 .flex_none()
3542 .flex()
3643 .flex_col()
3744 .items_center()
3845 .gap(px(1.))
39- .text_size(px(13.))
46+ .font(glyph_style.font)
47+ .text_size(glyph_style.size)
4048 .text_color(rgb(INK2()))
4149 .child(glyph.to_string())
4250 .child(
4351 div()
44- .text_size(px(9.))
52+ .font(chord_style.font)
53+ .text_size(chord_style.size)
4554 .text_color(rgb(INK3()))
4655 .child(player.keymap.display(action)),
4756 )
@@ -52,10 +61,12 @@ fn ghost(player: &Player, glyph: &str, action: ActionId) -> impl IntoElement {
5261 /// rather than painted whole, so the colons can read a shade quieter than
5362 /// the numbers either side of them.
5463 fn hero_timecode(tc: &str) -> impl IntoElement {
64+ let style = mono(type_scale::HERO_TIMECODE_PX, FontWeight::BOLD);
5565 div()
5666 .flex_none()
5767 .flex()
58- .text_size(px(13.))
68+ .font(style.font)
69+ .text_size(style.size)
5970 .children(tc.chars().map(|c| {
6071 let ink = if c == ':' { INK3() } else { INK1() };
6172 div().text_color(rgb(ink)).child(c.to_string())
@@ -99,6 +110,7 @@ fn cut_readout(player: &Player) -> impl IntoElement {
99110 ))
100111 });
101112 let roll_on = player.loop_trim.is_some();
113+ let style = mono(type_scale::CHORD_METADATA_MAX_PX, FontWeight::MEDIUM);
102114 div()
103115 .id("stance-cut-readout")
104116 .flex_none()
@@ -108,7 +120,8 @@ fn cut_readout(player: &Player) -> impl IntoElement {
108120 .py(px(4.))
109121 .rounded(px(2.))
110122 .bg(rgb(DARK_CANVAS()))
111- .text_size(px(10.5))
123+ .font(style.font)
124+ .text_size(style.size)
112125 .child(val(odometer))
113126 .when_some(deltas, |el, (in_d, out_d)| {
114127 el.child(sep())
@@ -278,16 +291,20 @@ fn contact_strip(player: &Player, cx: &mut Context<Player>) -> impl IntoElement
278291 /// by [`super::stance::render`] the same way the keys overlay is.
279292 fn export_chip(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
280293 let exporting = player.exporting().is_some();
294+ let label_style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);
295+ let chord_style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM);
281296 div()
282297 .id("stance-export")
283298 .flex_none()
299+ .flex()
300+ .items_center()
301+ .gap(px(6.))
284302 .px(px(10.))
285303 .py(px(6.))
286304 .rounded(px(3.))
287305 .border_1()
288306 .border_color(rgb(DARK_HAIRLINE()))
289307 .bg(rgb(DARK_RAISED()))
290- .text_size(px(10.5))
291308 .text_color(rgb(INK1()))
292309 .cursor_pointer()
293310 .hover(|s| s.bg(rgb(DARK_PANEL())))
@@ -299,11 +316,19 @@ fn export_chip(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
299316 }
300317 cx.notify();
301318 }))
302- .child(format!(
303- "{} {}",
304- if exporting { "Exporting" } else { "Export" },
305- player.keymap.display(ActionId::Export)
306- ))
319+ .child(
320+ div()
321+ .font(label_style.font)
322+ .text_size(label_style.size)
323+ .child(if exporting { "Exporting" } else { "Export" }),
324+ )
325+ .child(
326+ div()
327+ .font(chord_style.font)
328+ .text_size(chord_style.size)
329+ .text_color(rgb(INK3()))
330+ .child(player.keymap.display(ActionId::Export)),
331+ )
307332 }
308333
309334 /// The whole band, left to right per MOCK-SPEC: hero timecode, ghost
@@ -312,8 +337,14 @@ fn export_chip(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
312337 pub(crate) fn render(player: &mut Player, position: f64, cx: &mut Context<Player>) -> impl IntoElement {
313338 let tc = timecode(position, player.active_fps());
314339 div()
315- .id("stance-time-band")
316- .flex_none()
340+ .id("stance-time-band-row")
341+ // FAULT 1 fix: this div used to be `flex_none`, which sized it to its
342+ // own content inside `stance.rs::time_band()`'s row -- leaving the
343+ // contact strip's `flex_1` nothing to grow into (its "free space" was
344+ // zero, since the parent itself never claimed the band's full width).
345+ // `flex_1` here is what actually lets the strip fill the band.
346+ .flex_1()
347+ .min_w(px(0.))
317348 .h_full()
318349 .flex()
319350 .items_center()
crates/app/src/ui/type_scale.rsmodified+13 -1
@@ -27,7 +27,7 @@
2727 // crate's only caller of the public API is `main.rs`'s `register`.
2828 #![allow(dead_code)]
2929
30-use gpui::{App, Font, FontFeatures, FontWeight, Pixels, SharedString, font, px};
30+use gpui::{App, Font, FontFeatures, FontWeight, Pixels, SharedString, Styled, font, px};
3131 use std::borrow::Cow;
3232
3333 /// Archivo: labels, verbs, section heads.
@@ -113,6 +113,18 @@ pub fn head() -> TypeStyle {
113113 label(SECTION_HEAD_PX, FontWeight::BOLD)
114114 }
115115
116+/// Applies a [`TypeStyle`] to any styled element in one call --
117+/// `div().type_style(mono(9.5, FontWeight::MEDIUM))` instead of the
118+/// `.font(style.font).text_size(style.size)` pair spelled out at every call
119+/// site. Blanket-implemented over `Styled` so every element in the room gets
120+/// it for free.
121+pub trait Typeset: Styled + Sized {
122+ fn type_style(self, style: TypeStyle) -> Self {
123+ self.font(style.font).text_size(style.size)
124+ }
125+}
126+impl<T: Styled> Typeset for T {}
127+
116128 /// One face's worth of TTFs to embed, `(bytes, name)` for the doc comment
117129 /// above `register` to explain if a load ever fails.
118130 const EMBEDDED: &[(&[u8], &str)] = &[