Skip to content

AI media harness for planning, generating, and editing locally

TypeScript
9.9 KB
Raw Blame
/* ============================================================================
   library.css — the project library (App.tsx, ProjectCard.tsx) and the New
   project / Project settings dialog (PromptComposer.tsx).

   The library is a Windows page, not a website: it fills the window edge to
   edge (--space-6 at the sides) under the title bar, with a 28px "Projects"
   title on the pane, then a chrome strip holding the command bar (New project
   in accent, Open…, the view toggle, the search box at the trailing end) and
   the "All projects" row, then an auto-fill grid of plain tiles scrolling on
   the pane. There is no centred 1180px column, no frosted sticky header, and
   no generated cover art: a tile shows the project's real first frame, or a
   neutral glyph.

   Tile rhythm: 4px corners like every card, thumbnail at 16:9, then a 14px
   name and a 12px caption. `.project-skeleton` reproduces the same thumbnail ratio and
   text height so the grid does not jump when loading finishes.
   ========================================================================== */

.library {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  border-top: 1px solid var(--stroke-card);
  background: var(--surface-pane);
}

.library__head {
  flex: none;
  padding: var(--space-5) var(--space-6) var(--space-4);
}

/* Fluent Title: 28/36 semibold in the Display cut. */
.library__title {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
}

.library__infobars {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-3);
}

.library__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}

/* The commands sit at the end of the title's line. */
.library__commands {
  min-height: var(--command-row);
  margin: 0 calc(-1 * var(--space-1)) 0 auto;
  padding: 0;
}

.library__commands .ui-command-bar__primary {
  gap: var(--space-1);
}

/* --- List strip ---------------------------------------------------------------
   Chrome, like every toolbar: the "All projects" heading and, at its end, the
   grid/list toggle, with divider edges above and below. */

.library__bar {
  flex: none;
  min-height: var(--command-row);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-5) 0 var(--space-6);
  border-top: 1px solid var(--stroke-divider);
  border-bottom: 1px solid var(--stroke-divider);
  background: var(--surface-chrome);
}

.library__layout {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

/* The tiles scroll here, under the strip. A flex column so the compact empty
   state can centre itself in what is left. */
.library__section {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: var(--space-4) var(--space-6) var(--space-6);
}

/* "All projects" with its count in secondary text: the strip's second row. */
.library__subtitle {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-normal);
}

.library__count {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
}

/* --- Grid ------------------------------------------------------------------ */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-3);
  outline: none;
}

.project-grid--list {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1);
}

/* --- Tile -------------------------------------------------------------------
   A GridView item: a 1px stroke and 4px corners like every card. Rest, hover
   and selection (accent-soft plus the accent ring) are the shared
   .ui-selectable--card rule in ui.css, so nothing here sets a fill. */

.project-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-2);
  border: 1px solid var(--stroke-card);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}

.project-card:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-outer);
  outline-offset: 1px;
}

.project-card__thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background-color: var(--panel-3);
  background-size: cover;
  background-position: center;
  color: var(--text-secondary);
}

.project-card__glyph {
  opacity: 0.8;
}

/* The first visual clip supplies the picture. A file that cannot be read
   leaves MediaThumbnail's placeholder, which stays hidden so the glyph under
   it shows instead. */
.project-card__thumb > .media-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}

.project-card__thumb > .media-thumb:not(.media-thumb--poster) {
  display: none;
}

.project-card__thumb > .media-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* The frame shape, as a small solid chip in the corner: a palette plate, not
   ink laid over the picture. */
.project-card__chip {
  position: absolute;
  z-index: 1;
  left: var(--space-1);
  bottom: var(--space-1);
  padding: 0 var(--space-1);
  border-radius: var(--radius-sm);
  background: var(--layer);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  font-variant-numeric: tabular-nums;
}

.project-card__text {
  display: grid;
  gap: 0;
  min-width: 0;
  padding: 0 var(--space-6) 0 var(--space-1);
}

.project-card__name,
.project-card__path,
.project-card__meta {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.project-card__name {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

.project-card__path,
.project-card__meta {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
}

/* ⋯ sits over the text row's trailing end; it is not a tab stop (Shift+F10
   or the Menu key opens the same menu from the keyboard). */
.project-card__more {
  position: absolute;
  right: var(--space-1);
  bottom: var(--space-2);
  opacity: 0;
  transition: opacity var(--motion-fast) linear, background-color var(--motion-fast) linear;
}

.project-card:hover .project-card__more,
.project-card[aria-selected="true"] .project-card__more,
.project-card:focus-within .project-card__more {
  opacity: 1;
}

/* List layout: a row — small thumbnail, name over path over caption. */
.project-card--list {
  grid-template-columns: 96px minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-2);
}

.project-card--list .project-card__glyph {
  width: 20px;
  height: 20px;
}

.project-card--list .project-card__chip {
  display: none;
}

.project-card--list .project-card__more {
  top: 50%;
  bottom: auto;
  margin-top: calc(-1 * var(--icon-button) / 2);
}

/* --- Loading ------------------------------------------------------------------ */

.project-skeleton {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--stroke-card);
  border-radius: var(--radius-sm);
}

.project-skeleton i {
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  background: var(--panel-3);
}

.project-skeleton span,
.project-skeleton small {
  display: block;
  height: 12px;
  margin-left: var(--space-1);
  border-radius: var(--radius-sm);
  background: var(--panel-3);
}

.project-skeleton span {
  width: 60%;
  margin-top: 4px;
}

.project-skeleton small {
  width: 40%;
  margin-bottom: 2px;
}

.project-grid--list .project-skeleton {
  grid-template-columns: 96px minmax(0, 1fr);
}

/* --- Empty ---------------------------------------------------------------------
   The first-run hero, the one large empty state in the app (a search with no
   results uses the compact shared EmptyState). No box, no dashed border (that
   reads as a file drop zone): a 48px glyph, a 20px line, one sentence and the
   two ways forward side by side. */

.library-empty {
  display: grid;
  justify-items: center;
  gap: 0;
  padding: var(--space-8) var(--space-5);
  color: var(--text-secondary);
  text-align: center;
}

.library-empty h3 {
  margin: var(--space-4) 0 var(--space-1);
  color: var(--text-primary);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: 1.4;                    /* 28/20, Fluent Subtitle */
}

.library-empty p {
  margin: 0;
  max-width: 48ch;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

.library-empty__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

/* --- New project / Project settings (a ContentDialog) --------------------------- */

.composer__form {
  display: grid;
  gap: var(--space-4);
}

.composer__field {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.composer__field > label {
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

.composer__field .text-field,
.composer__field .ui-combo {
  width: 100%;
  min-width: 0;
}

.composer__folder-row {
  display: flex;
  gap: var(--space-2);
  min-width: 0;
}

.composer__folder-row .text-field {
  flex: 1 1 auto;
  color: var(--text-secondary);
}

.composer__folder-row button {
  flex: none;
}

.composer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}

/* A path quoted in a dialog: body text, not a code block, and free to wrap. */
.dialog-path {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}