Skip to content

AI media harness for planning, generating, and editing locally

TypeScript
5.0 KB
Raw Blame
/* ============================================================================
   Title bar — src/components/TitleBar.tsx.

   The window is frameless, so this row is the whole Windows caption: 48px
   tall, like Photos, Clipchamp and Terminal, where the app's own header and
   the caption are one strip. It is transparent on purpose: under Mica
   (window.css) the backdrop shows through it exactly as it does through a
   native caption, and on Windows 10 it sits on the solid ground.

   The three caption buttons follow Windows 11's own metrics — 46px wide, the
   full height of the bar, square, glyphs from Segoe Fluent Icons at 10px —
   and its colours: a subtle wash on hover, a lighter one pressed, and on the
   close button the system's #C42B1C with a white glyph in BOTH themes. That
   red is the only colour literal in this file; theme.test.ts exempts exactly
   those two rules and says why.

   No cursor rule anywhere: the caption is arrow-cursor territory, as in every
   native window.
   ========================================================================== */

.titlebar {
  display: flex;
  align-items: center;
  flex: none;
  height: var(--titlebar-height);
  min-width: 0;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  -webkit-user-select: none;
  user-select: none;
}

.titlebar__leading,
.titlebar__after-title,
.titlebar__actions {
  display: flex;
  align-items: center;
  flex: none;
  gap: var(--space-1);
  height: 100%;
}

.titlebar__leading {
  padding-left: var(--space-1);
}

.titlebar__actions {
  padding: 0 var(--space-2);
}

.titlebar__after-title {
  padding-right: var(--space-2);
}

.titlebar__identity {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  gap: var(--space-3);
  min-width: 0;
  padding: 0 var(--space-2) 0 var(--space-4);
}

/* A leading slot (Back) already provides the left inset. */
.titlebar__leading + .titlebar__identity {
  padding-left: var(--space-1);
}

.titlebar__icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
}

.titlebar__icon > img,
.titlebar__icon > svg {
  width: 16px;
  height: 16px;
}

.titlebar__title,
.titlebar__secondary {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.titlebar__title {
  flex: 0 1 auto;
  min-width: 0;
}

.titlebar__secondary {
  flex: 0 2 auto;
  min-width: 0;
  color: var(--text-secondary);
}

.titlebar__middle {
  display: flex;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
}

/* A window that is not the active one greys its caption. */
.titlebar--inactive .titlebar__title,
.titlebar--inactive .titlebar__secondary,
.titlebar--inactive .titlebar__caption {
  color: var(--text-muted);
}

.titlebar__captions {
  display: flex;
  flex: none;
  align-self: stretch;
}

.titlebar__caption {
  display: grid;
  place-items: center;
  width: 46px;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  font-family: "Segoe Fluent Icons", "Segoe MDL2 Assets", sans-serif;
  font-size: 10px;
  line-height: 1;
  transition: background-color var(--motion-fast) linear, color var(--motion-fast) linear;
}

.titlebar__caption:hover {
  background: var(--wash-2);
}

.titlebar__caption:active {
  background: var(--wash-1);
  color: var(--text-secondary);
}

.titlebar__caption--close:hover {
  background: #c42b1c;
  color: #ffffff;
}

.titlebar__caption--close:active {
  background: #c93f33;
  color: #ffffff;
}

/* --- What screens put in the bar -------------------------------------------
   App-wide commands (Settings, Work queue) and a project's own (Undo, Redo,
   Save, the agent pane) are 32px subtle buttons in the actions slot. A
   count rides on the top-right corner of its button as an InfoBadge; an
   update waiting shows as the badge's dot on the gear. */

.titlebar-command {
  position: relative;
}

.titlebar-command__badge {
  position: absolute;
  top: 0;
  right: calc(var(--space-1) / -2);
  pointer-events: none;
}

/* The dot sits inside the button's corner, clear of the 16px glyph. */
.titlebar-command__badge--dot {
  top: calc(var(--space-1) + 1px);
  right: calc(var(--space-1) + 1px);
}

/* The Agent toggle's on-state is the shared one (ui.css, "Toggle on-state"). */

.titlebar-separator {
  flex: none;
  width: 1px;
  height: 20px;
  margin: 0 var(--space-1);
  background: var(--stroke-card);
}

/* A search box in the title bar's middle, as in Windows Settings: centred,
   up to 360px, fully rounded, glyph leading. Round corners make the usual
   bottom focus line look clipped, so focus draws the accent all round. */
.titlebar-search {
  width: min(100%, 360px);
  margin-inline: auto;
  padding: 0 var(--space-3);
  border-bottom-color: var(--stroke-control);
  border-radius: var(--radius-pill);
}

.titlebar-search:focus-within {
  border-color: var(--field-focus-line);
  box-shadow: inset 0 0 0 1px var(--field-focus-line);
}