AI media harness for planning, generating, and editing locally
TypeScript
/* ============================================================================
references.css — the reference library (a command bar, an Icons or Details
view and a status bar), the reference inspector pane, and the add-reference
dialog.
Sizing contract (see tokens.css): no literal px type sizes, nothing below
--text-xs (12px), standard controls --control-md (32px), compact ones
--control-sm (24px).
========================================================================== */
/* The library, the splitter and the inspector. The inspector's width is the
user's (usePaneSize → --pane-references-inspector); there are no width
breakpoints, so a narrow window narrows the library instead. */
.references-view {
--pane-references-inspector: var(--pane-side-default); /* usePaneSize sets the real width inline */
height: 100%;
min-height: 0;
display: grid;
/* Floors on both sides so a narrow view (agent pane open) keeps the list. */
grid-template-columns: minmax(240px, 1fr) auto minmax(280px, var(--pane-references-inspector));
background: var(--surface-pane);
}
.references-main {
min-width: 0;
min-height: 0;
container: references-main / inline-size;
display: flex;
flex-direction: column;
}
/* Align the command bar with the inspector's selected-item header. */
.references-command {
flex: 0 0 auto;
height: var(--item-header);
border-bottom: 1px solid var(--stroke-divider);
background: var(--surface-chrome);
}
.references-main > .ui-infobar {
flex: 0 0 auto;
margin: var(--space-2) var(--space-3) 0;
}
/* The library is where the references are laid out, so it sits in the well.
The icon grid keeps its own gutter; the details table runs edge to edge so
its header strip does. */
.reference-library {
flex: 1 1 auto;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow-y: auto;
background: var(--surface-well);
}
/* --- Icons view ---------------------------------------------------------------
Auto-filling 160px-and-up tiles: a square picture and a 12px name. Rest, hover and
selection are the shared selectable-card rule (.ui-selectable--card): a
fill under the mouse, an accent fill and ring when selected.
========================================================================== */
.reference-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: var(--space-2);
padding: var(--space-2) var(--space-3);
}
.reference-tile {
min-width: 0;
display: flex;
flex-direction: column;
gap: var(--space-1);
padding: var(--space-1);
border: 1px solid transparent;
border-radius: var(--radius-sm);
color: var(--text-primary);
}
.reference-tile:focus-visible {
outline: 2px solid var(--focus-outer);
outline-offset: -2px;
box-shadow: inset 0 0 0 3px var(--focus-inner);
}
.reference-tile__name {
min-width: 0;
overflow: hidden;
font-size: var(--text-xs);
line-height: 16px;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
}
/* The picture: the user's own image (contain, so portrait and landscape stay
comparable), a video's first frame, a generated icon — or, for a written
definition with no file at all, a document glyph on a plain plate. */
.reference-art {
position: relative;
aspect-ratio: 1;
overflow: hidden;
display: grid;
place-items: center;
border-radius: 2px;
color: var(--text-muted);
background: var(--panel-3);
}
.reference-art--text {
color: var(--accent-bright);
}
.reference-art--text svg {
width: 64px;
height: 64px;
}
.reference-art--photo img {
width: 100%;
height: 100%;
object-fit: contain;
}
.reference-art--photo .media-thumb {
width: 100%;
height: 100%;
}
/* --- Details view ---------------------------------------------------------------
28px rows, sortable columns, the same fill/accent selection as the icons.
The column header is a chrome strip, pinned while the rows scroll.
========================================================================== */
.reference-details {
min-width: 0;
overflow-x: auto;
}
.reference-details table {
width: 100%;
border-collapse: separate;
border-spacing: 0 2px;
font-size: var(--text-xs);
line-height: 16px;
}
.reference-details th {
position: sticky;
top: 0;
z-index: 1;
padding: 0;
border-bottom: 1px solid var(--line);
background: var(--surface-chrome);
font-weight: var(--weight-regular);
text-align: left;
}
.reference-details th button {
width: 100%;
height: var(--section-row);
display: flex;
align-items: center;
gap: var(--space-1);
padding: 0 var(--space-2);
border: 0;
border-radius: 0;
color: var(--text-secondary);
background: none;
font: inherit;
font-weight: var(--weight-semibold);
text-align: left;
}
.reference-details th:first-child button,
.reference-details td:first-child {
padding-left: var(--space-3);
}
.reference-details th button:hover {
color: var(--text-primary);
background: var(--fill-subtle-hover);
}
.reference-details td {
height: 28px;
max-width: 0;
padding: 0 var(--space-2);
overflow: hidden;
color: var(--text-secondary);
text-overflow: ellipsis;
white-space: nowrap;
}
.reference-details td:first-child {
width: 40%;
border-radius: var(--radius-sm) 0 0 var(--radius-sm);
color: var(--text-primary);
}
.reference-details td:last-child {
border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.reference-details tbody tr:hover td {
background: var(--fill-subtle-hover);
}
.reference-details tbody tr.reference-row--selected td {
background: var(--accent-soft);
}
.reference-details tbody tr:focus-visible {
outline: 2px solid var(--focus-outer);
outline-offset: -2px;
}
.reference-row__name {
min-width: 0;
display: flex;
align-items: center;
gap: var(--space-2);
}
.reference-row__name > span:last-child {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.reference-row__icon {
flex: 0 0 auto;
display: grid;
color: var(--text-muted);
}
/* --- Reference inspector ------------------------------------------------------ */
.reference-inspector {
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
background: var(--panel);
}
/* Its sections run edge to edge, the first straight under the item header;
with nothing selected, the empty state centres in it. */
.reference-inspector__scroll {
min-height: 0;
flex: 1 1 auto;
display: flex;
flex-direction: column;
overflow-y: auto;
}
/* The editable name stays the pane's heading: an h2 around the input, laid
out as the input alone would be. */
.reference-inspector__name {
flex: 1;
min-width: 0;
display: flex;
margin: 0;
font: inherit;
}
/* The reference's art as the item header's 28px chip: the same picture the
tile shows, filling the chip, with no room for a caption. */
.reference-inspector .ui-item-header__chip .reference-art {
width: 100%;
height: 100%;
aspect-ratio: auto;
border-radius: 0;
}
.reference-inspector .ui-item-header__chip .reference-art > svg {
width: 16px;
height: 16px;
}
.reference-inspector .ui-item-header__chip .reference-image-fallback em {
display: none;
}
.reference-inspector .ui-item-header__chip .reference-image-fallback > svg {
width: 16px;
height: 16px;
}
/* The Preview section: the picture at a readable size, on a plate. Smaller
than the full-width art it replaced, now that the chip names the reference
at a glance: images and icons are held to 160px tall. */
.reference-detail-art {
position: relative;
height: 128px;
display: grid;
place-items: center;
overflow: hidden;
border-radius: var(--radius-sm);
background: var(--panel-3);
}
.reference-detail-art--photo img {
width: 100%;
height: 100%;
object-fit: contain;
padding: var(--space-2);
}
.reference-detail-art--photo .reference-detail-preset-icon {
width: 100%;
height: 100%;
aspect-ratio: 1;
padding: 0;
object-fit: contain;
}
.reference-detail-art.reference-detail-art--preset {
width: 100%; /* the selected reference's icon fills the pane's width */
height: auto;
aspect-ratio: 1;
justify-self: center;
}
.reference-detail-art--preset > .reference-image-fallback {
width: 100%;
height: 100%;
}
.reference-detail-art.reference-detail-art--images {
display: block;
height: auto;
}
.reference-detail-images {
width: 100%;
}
.reference-detail-art--photo .reference-detail-images img {
display: block;
width: 100%;
height: auto;
max-height: 480px; /* full width, but a tall portrait photo stops short of the whole pane */
padding: 0;
object-fit: contain;
}
.reference-detail-images .reference-image-fallback { min-height: 128px; }
/* A written definition: one 32px caption row with a document glyph. */
.reference-detail-art--text {
height: var(--control-md);
display: flex;
justify-content: flex-start;
gap: var(--space-2);
padding: 0 var(--space-1);
background: transparent;
}
.reference-detail-art--text > span {
display: grid;
color: var(--accent-bright);
}
.reference-detail-art em {
position: absolute;
z-index: 3;
left: var(--space-3);
right: var(--space-3);
bottom: var(--space-2);
overflow: hidden;
color: var(--text-secondary);
font-size: var(--text-xs);
font-style: normal;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
}
.reference-detail-art.reference-detail-art--text em {
position: static;
text-align: left;
}
.reference-detail-art .reference-image-remove {
position: absolute;
top: var(--space-2);
right: var(--space-2);
z-index: 3;
display: grid;
place-items: center;
width: var(--control-sm);
height: var(--control-sm);
padding: 0;
border: 1px solid var(--stroke-control);
border-radius: var(--radius-sm);
color: var(--text-primary);
background: var(--fill-control);
opacity: 0;
pointer-events: none;
transition: opacity var(--motion-fast) linear, background-color var(--motion-fast) linear;
}
.reference-detail-art--text .reference-image-remove {
top: calc(50% - var(--control-sm) / 2);
}
.reference-detail-art:hover .reference-image-remove,
.reference-detail-art:focus-within .reference-image-remove {
opacity: 1;
pointer-events: auto;
}
.reference-detail-art .reference-image-remove:hover:not(:disabled) {
background: var(--fill-control-hover);
}
@media (hover: none) {
.reference-detail-art .reference-image-remove {
opacity: 1;
pointer-events: auto;
}
}
.reference-image-controls {
display: flex;
align-items: center;
justify-content: center;
gap: var(--space-2);
}
.reference-image-controls > span {
color: var(--text-secondary);
font-size: var(--text-xs);
font-variant-numeric: tabular-nums;
}
/* Loading, or the file is not where the project says it is. Two states, said
plainly, rather than one placeholder that could mean either. */
.reference-image-fallback {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: var(--space-2);
width: 100%;
height: 100%;
color: var(--text-muted);
}
.reference-image-fallback em {
font-size: var(--text-xs);
font-style: normal;
line-height: var(--leading-snug);
}
/* A tile is too small for the words; the icon still tells the states apart. */
.reference-tile .reference-image-fallback em {
display: none;
}
/* The sections' bodies: each block used to draw its own bottom rule and
padding; the PropSection header above it now does both. */
.reference-fields {
padding-top: var(--space-1);
}
.reference-fields label {
display: block;
margin: 0;
}
.reference-fields textarea {
width: 100%;
height: 160px;
min-height: 96px;
padding: var(--space-2);
font-family: var(--font-sans);
line-height: var(--leading-normal);
resize: vertical;
}
.reference-fields > p {
margin: var(--space-2) 0 0;
color: var(--text-muted);
font-size: var(--text-xs);
}
/* Inspector rows: classification, location settings and refmod numbers are
PropRows (104px label, 24px control). */
.reference-type,
.reference-location-settings {
display: grid;
gap: 2px;
}
.reference-refmods,
.reference-refmods > div {
display: grid;
grid-template-columns: minmax(0, 1fr);
min-width: 0;
gap: 2px;
}
.reference-refmods {
gap: var(--space-2);
padding-top: var(--space-1);
}
.reference-refmods > div > b {
display: block;
min-width: 0;
overflow: hidden;
font-size: var(--text-xs);
text-overflow: ellipsis;
white-space: nowrap;
}
.reference-refmods p {
margin: 0;
color: var(--text-muted);
font-size: var(--text-xs);
}
.reference-used-by {
display: grid;
margin-left: calc(-1 * var(--space-2));
}
.reference-used-by > button {
display: grid;
grid-template-columns: minmax(0, 1fr) 16px;
align-items: center;
gap: var(--space-2);
width: 100%;
min-height: 28px;
padding: 0 var(--space-2);
border: 0;
border-radius: var(--radius-sm);
color: var(--text-secondary);
background: transparent;
text-align: left;
}
.reference-used-by > button:hover {
color: var(--text-primary);
background: var(--fill-subtle-hover);
}
.reference-used-by b {
min-width: 0;
overflow: hidden;
color: var(--text-primary);
font-size: var(--text-base);
font-weight: var(--weight-regular);
text-overflow: ellipsis;
white-space: nowrap;
}
.reference-used-by > p {
margin: 0;
padding: var(--space-1) var(--space-2);
color: var(--text-muted);
font-size: var(--text-xs);
}
/* --- Video reference ---------------------------------------------------------- */
.reference-video {
display: grid;
gap: var(--space-3);
padding: var(--space-1) 0;
}
.reference-video-dialog .reference-video {
padding: 0;
}
.reference-video-preview {
display: block;
width: 100%;
max-height: min(50vh, 460px);
background: var(--layer-alt);
border-radius: var(--radius-sm);
}
.reference-audio { display: grid; gap: var(--space-2); min-width: 0; }
.reference-audio audio { width: 100%; }
.reference-audio p { margin: 0; color: var(--text-muted); }
.reference-video > p { margin: 0; color: var(--text-muted); font-size: var(--text-xs); }
.reference-trim { display: grid; gap: var(--space-2); min-width: 0; }
.reference-trim__summary { display: flex; flex-direction: column; gap: 4px; font-variant-numeric: tabular-nums; }
.reference-trim__summary span, .reference-trim__ticks { color: var(--text-muted); font-size: var(--text-xs); }
.reference-trim__scroll { min-width: 0; overflow-x: auto; padding-bottom: var(--space-2); }
.reference-trim__track { width: 100%; padding: 2px 4px; }
.reference-trim__ticks { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.reference-trim__bar { position: relative; height: 40px; margin: 8px 7px 0; border-radius: var(--radius-sm); background: var(--panel-3); touch-action: none; user-select: none; }
.reference-trim__selection { position: absolute; top: 0; bottom: 0; display: flex; border: 2px solid var(--accent); border-radius: var(--radius-sm); background: var(--accent-soft); }
.reference-trim__selection button { touch-action: none; border: 0; padding: 0; }
.reference-trim__handle { position: absolute; top: -2px; bottom: -2px; width: 14px; border-radius: 3px; background: var(--accent); cursor: ew-resize; z-index: 1; }
.reference-trim__handle:first-child { left: -7px; }
.reference-trim__handle:last-child { right: -7px; }
.reference-trim__handle::after { content: ""; position: absolute; left: 6px; top: 11px; width: 2px; height: 14px; background: var(--panel-2); }
.reference-trim__move { width: 100%; min-width: 0; overflow: hidden; font-size: var(--text-xs); color: var(--text-primary); background: transparent; cursor: grab; }
.reference-trim__move:active { cursor: grabbing; }
.reference-trim__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.reference-frames { display: grid; gap: var(--space-3); min-width: 0; }
.reference-frames > p { margin: 0; }
.reference-frames > input { width: 100%; }
.reference-frames__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.reference-frames__actions input { width: 110px; }
.reference-frames__actions > span { color: var(--text-muted); font-size: var(--text-xs); }
.reference-frames__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-2); padding: 0; margin: 0; list-style: none; }
.reference-frames__list > li { position: relative; min-width: 0; }
.reference-frames__preview { display: grid; width: 100%; gap: var(--space-1); padding: var(--space-1); border: 1px solid var(--stroke-card); border-radius: var(--radius-sm); background: var(--layer-alt); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.reference-frames__preview img, .reference-frames__preview .reference-image-fallback { width: 100%; height: 90px; object-fit: contain; }
.reference-frames__list > li > .icon-button { position: absolute; top: var(--space-1); right: var(--space-1); background: var(--layer-alt); }
.reference-video p {
color: var(--text-muted);
font-size: var(--text-xs);
}
.reference-video label {
display: flex;
align-items: center;
gap: var(--space-2);
}
/* --- Add-reference dialog (a wide ContentDialog) --------------------------------
A type list on the left, and on the right a search box, the subcategory
SelectorBar and the presets. The dialog body scrolls the preset grid only. */
/* A 920px dialog would stretch New and Cancel to half its width each; keep
them button-sized at the right, as in a narrow dialog. */
.reference-preset-dialog .ui-dialog__footer {
display: flex;
justify-content: flex-end;
}
.reference-preset-dialog .ui-dialog__button {
width: 140px;
}
.reference-preset-dialog__lead {
margin: 0 0 var(--space-3);
color: var(--text-secondary);
}
.reference-preset-dialog__body {
height: min(480px, 56vh);
min-height: 0;
display: grid;
grid-template-columns: 168px minmax(0, 1fr);
gap: var(--space-3);
}
.reference-preset-dialog__body > nav {
display: flex;
flex-direction: column;
gap: 2px;
overflow-y: auto;
}
.reference-preset-dialog__body > nav button {
position: relative;
width: 100%;
min-height: var(--control-md);
display: flex;
align-items: center;
padding: 0 var(--space-3);
border: 0;
border-radius: var(--radius-sm);
color: var(--text-primary);
background: transparent;
font-size: var(--text-base);
text-align: left;
}
.reference-preset-dialog__body > nav button:hover {
background: var(--fill-subtle-hover);
}
/* Selected: a subtle fill and the 3×16px accent pill. */
.reference-preset-dialog__body > nav button.active {
background: var(--fill-subtle-hover);
}
.reference-preset-dialog__body > nav button.active::before {
content: "";
position: absolute;
left: 0;
top: calc(50% - 8px);
width: 3px;
height: 16px;
border-radius: 2px;
background: var(--accent);
}
.reference-preset-dialog__body > section {
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
gap: var(--space-2);
overflow-y: auto;
scrollbar-gutter: stable;
/* Keep the scrollbar in the dialog margin, clear of the cards. */
margin-inline-end: calc(-1 * var(--space-4));
padding-inline-end: var(--space-4);
}
/* Explicit styling keeps the thumb visible even when the platform normally
hides idle overlay scrollbars. overflow-y: auto limits it to overflowing lists. */
.reference-preset-dialog__body > section::-webkit-scrollbar {
width: 10px;
}
.reference-preset-dialog__body > section::-webkit-scrollbar-track {
background: transparent;
}
.reference-preset-dialog__body > section::-webkit-scrollbar-thumb {
min-height: 32px;
border: 2px solid transparent;
border-radius: 999px;
background: var(--text-muted);
background-clip: padding-box;
}
.reference-preset-dialog__body > section::-webkit-scrollbar-thumb:hover {
background-color: var(--text-secondary);
}
@supports not selector(::-webkit-scrollbar) {
.reference-preset-dialog__body > section {
scrollbar-width: thin;
scrollbar-color: var(--text-muted) transparent;
}
}
.reference-preset-search {
flex: 0 0 auto;
height: var(--field-height);
display: flex;
align-items: center;
gap: var(--space-2);
margin: 0;
padding: 0 var(--space-3);
border: 1px solid var(--stroke-control);
border-bottom-color: var(--stroke-strong);
border-radius: var(--radius-sm);
color: var(--text-muted);
background: var(--fill-control);
}
/* The wrapper is the text field, so it carries the TextBox underline. */
.reference-preset-search:focus-within {
border-bottom-color: var(--field-focus-line);
background: var(--fill-input-focus);
box-shadow: inset 0 -1px 0 var(--field-focus-line);
}
.reference-preset-search input {
min-width: 0;
flex: 1 1 auto;
border: 0;
outline: 0;
box-shadow: none; /* the wrapper draws the underline */
color: var(--text-primary);
background: transparent;
font: inherit;
}
.reference-subcategories {
flex: 0 0 auto;
flex-wrap: wrap;
}
.reference-preset-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: var(--space-2);
}
.reference-preset-card { position: relative; min-width: 0; }
.reference-preset-select {
width: 100%;
height: 100%;
min-height: 88px;
padding: var(--space-3);
border: 1px solid var(--stroke-card);
border-radius: var(--radius-sm);
color: var(--text-primary);
background: var(--card);
text-align: left;
overflow: hidden;
transition: var(--transition-control);
}
.reference-preset-select:hover {
background: var(--card-hover);
}
.reference-preset-select:active {
background: var(--card-pressed);
}
.reference-preset-select.reference-preset-card--with-icon {
display: grid;
grid-template-columns: 64px minmax(0, 1fr);
grid-template-rows: auto auto 1fr;
column-gap: var(--space-3);
align-content: center;
}
.reference-preset-icon {
width: 64px;
height: 64px;
grid-column: 1;
grid-row: 1 / 4;
align-self: center;
object-fit: cover;
object-position: center;
border-radius: var(--radius-sm);
}
.reference-preset-card--with-icon > small,
.reference-preset-card--with-icon > b,
.reference-preset-card--with-icon > span {
min-width: 0;
grid-column: 2;
}
.reference-preset-select > .reference-preset-icon { grid-column: 1; margin: 0; }
/* A sibling of the selection button: hovering this area never hovers the card. */
.reference-preset-generate {
position: absolute;
left: var(--space-3);
top: 50%;
transform: translateY(-50%);
width: 64px;
height: 64px;
display: grid;
place-items: center;
border: 1px solid var(--stroke-control);
border-radius: var(--radius-sm);
color: var(--text-primary);
background: var(--fill-control);
opacity: 0;
}
.reference-preset-generate:hover,
.reference-preset-generate:focus-visible { opacity: 1; }
.reference-preset-generate:disabled:hover { opacity: 1; cursor: progress; }
.reference-preset-grid b,
.reference-preset-grid span,
.reference-preset-grid small {
display: block;
}
.reference-preset-grid small {
margin-bottom: 2px;
color: var(--text-muted);
font-size: var(--text-xs);
}
.reference-preset-grid b {
overflow: hidden;
font-size: var(--text-base);
font-weight: var(--weight-semibold);
text-overflow: ellipsis;
white-space: nowrap;
}
.reference-preset-grid span {
display: -webkit-box;
margin-top: 2px;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
color: var(--text-secondary);
font-size: var(--text-xs);
line-height: 16px;
}
.reference-preset-grid > p {
color: var(--text-muted);
}
/* A narrow list (agent pane open in a small window): the command bar keeps
its icons and drops the labels; the tooltips still name each command. */
@container references-main (max-width: 400px) {
/* Visually hidden, not display:none — the label is the button's
accessible name. */
.references-command .ui-cmd--labelled .ui-cmd__label {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
.references-command .ui-cmd--labelled { padding-inline: var(--space-2); }
}