Skip to content

AI media harness for planning, generating, and editing locally

TypeScript
6.1 KB
Raw Blame
/* --- Prompt field ------------------------------------------------------------
   A multi-line text field with references as smart chips inside the text, and
   a slim toolbar above it (PromptTextField.tsx). */

.prompt-field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }

.prompt-field__toolbar { display: flex; align-items: center; gap: var(--space-1); }

.prompt-field__tool {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: var(--control-sm);
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: transparent;
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  transition: var(--transition-control);
}
.prompt-field__tool:hover:not(:disabled) { color: var(--text-primary); background: var(--fill-subtle-hover); }
.prompt-field__tool:active:not(:disabled) { background: var(--fill-subtle-pressed); }
.prompt-field__tool[aria-expanded="true"] { color: var(--accent-on-soft); background: var(--accent-soft); }
.prompt-field__tool:disabled { color: var(--text-disabled); }

/* Scoped by .prompt-field so it outranks .text-field: this sheet is imported
   by the component, ahead of index.css, and would otherwise lose to its
   single-line padding and height. */
.prompt-field .prompt-field__input {
  width: 100%;
  /* A fixed height of `rows` lines, like the textarea it replaced: a longer
     prompt scrolls inside it, and the bottom edge still drags it taller. */
  height: calc(var(--prompt-rows, 4) * 1lh + 2 * var(--space-2) + 2px);
  min-height: calc(2lh + 2 * var(--space-2) + 2px);
  overflow-y: auto;
  resize: vertical;
  padding: var(--space-2);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--text-primary);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  cursor: text;
}
.prompt-field .prompt-field__input:focus {
  outline: none;
  border-bottom-color: var(--field-focus-line);
  box-shadow: inset 0 -1px 0 var(--field-focus-line);
}
.prompt-field__input:empty::before { content: attr(data-placeholder); color: var(--text-muted); pointer-events: none; }
.prompt-field--disabled .prompt-field__input { color: var(--text-disabled); background: var(--fill-control-disabled); cursor: default; }

/* An inline box on the words' own font and line: it shares their baseline
   and never changes the height of the line it sits in. Its padding and border
   paint around the name without moving anything. */
.prompt-chip {
  display: inline;
  margin-inline: 1px;
  padding: 0 var(--space-2);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-pill);
  color: var(--accent-on-soft);
  background: var(--accent-soft);
  font: inherit;
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
.prompt-chip:hover { background: var(--accent-soft-strong); }
.prompt-chip--missing { border-color: var(--danger-line); color: var(--danger); background: var(--danger-soft); text-decoration: line-through; }
.prompt-chip--missing:hover { background: var(--danger-soft-strong); }
.prompt-field--disabled .prompt-chip { cursor: default; opacity: 0.6; }

/* Match the platform's selection colors, including in high-contrast mode. */
.prompt-chip.prompt-chip--selected {
  color: var(--selection-text);
  background: var(--selection-bg);
  border-color: var(--selection-bg);
  opacity: 1;
}

.prompt-reference-picker { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2); }
.prompt-reference-picker__current { margin: 0; padding: var(--space-1) var(--space-2); color: var(--text-secondary); font-size: var(--text-xs); }
.prompt-reference-picker__list { display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; }
.prompt-reference-picker__option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 32px;
  padding: var(--space-1) var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: transparent;
  font-size: var(--text-base);
  text-align: start;
}
.prompt-reference-picker__option:hover:not(:disabled) { background: var(--fill-subtle-hover); }
.prompt-reference-picker__option:disabled { color: var(--text-disabled); }
/* Room for the reference's art — its picture or icon — or a glyph. */
.prompt-reference-picker__icon { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 32px; height: 32px; overflow: hidden; border-radius: var(--radius-sm); color: var(--text-secondary); }
.prompt-reference-picker__icon img { width: 100%; height: 100%; object-fit: cover; }
.prompt-reference-picker__icon > span:empty { width: 100%; height: 100%; }
.prompt-reference-picker__text { display: flex; flex-direction: column; min-width: 0; }
.prompt-reference-picker__text > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.prompt-reference-picker__text small { color: var(--text-muted); font-size: var(--text-xs); }
.prompt-reference-picker__empty { margin: 0; padding: var(--space-2); color: var(--text-muted); font-size: var(--text-xs); }
.prompt-reference-picker__remove { border-top: 1px solid var(--line); border-radius: 0; color: var(--danger); }

.reference-selector { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-width: 0; min-height: var(--control-md); padding: var(--space-1) var(--space-2); border: 1px solid var(--stroke-control); border-radius: var(--radius-sm); background: var(--fill-control); color: var(--text-primary); text-align: left; font: inherit; }
.reference-selector:hover:not(:disabled) { background: var(--fill-control-hover); }
.reference-selector:disabled { color: var(--text-disabled); background: var(--fill-control-disabled); }
.reference-selector--missing { color: var(--danger); }
.reference-selector__name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reference-selector__icon { display: grid; place-items: center; flex: 0 0 24px; width: 24px; height: 24px; overflow: hidden; border-radius: var(--radius-sm); }
.reference-selector__icon img { width: 100%; height: 100%; object-fit: cover; }