AI media harness for planning, generating, and editing locally
TypeScript
/* ============================================================================
image-editor.css — the image project's editor: the node tree, the canvas
with its tool strip, and the inspector. Both side panes are resizable
(usePaneSize → --pane-image-tree / --pane-image-inspector) instead of
stepping at width breakpoints.
========================================================================== */
.project-content--editor { padding: 0; overflow: hidden; }
.image-editor { --pane-image-tree: 240px; --pane-image-inspector: 300px; display: grid; grid-template-columns: minmax(140px, var(--pane-image-tree)) auto minmax(160px, 1fr) auto minmax(220px, var(--pane-image-inspector)); grid-template-rows: auto minmax(0, 1fr); height: 100%; min-height: 0; background: var(--layer); }
.image-tree, .image-inspector { min-width: 0; min-height: 0; overflow: auto; background: var(--panel); }
.image-tree { display: flex; flex-direction: column; }
.image-tree > .ui-pane-header, .image-inspector > .ui-item-header { flex-shrink: 0; }
.image-tree > [role="tree"] { flex: 1; overflow: auto; padding: var(--space-1) 0; }
.image-inspector { display: flex; flex-direction: column; overflow: hidden; }
.image-inspector > .inspector-actions { margin-top: auto; }
.image-pane-button.icon-button { width: var(--control-sm); height: var(--control-sm); }
/* --- Tree rows -----------------------------------------------------------------
28px rows inset 4px with 4px corners, a 20px chevron, 12px per level.
Selection is a subtle fill and the 3×16px accent pill; the drop indicators
are 2px accent bars (before/after) or an accent outline (inside). */
.image-tree__row { position: relative; display: flex; align-items: center; gap: 2px; height: 28px; margin: 2px var(--space-1); padding-right: var(--space-2); border-radius: var(--radius-sm); color: var(--text-primary); font-size: var(--text-base); transition: background-color var(--motion-fast) linear; }
.image-tree__row:hover { background: var(--fill-subtle-hover); }
.image-tree__row.selected { background: var(--fill-subtle-hover); }
.image-tree__row.selected::before { content: ""; position: absolute; left: 0; top: 6px; width: 3px; height: 16px; border-radius: 2px; background: var(--accent); }
.image-tree__row[draggable="true"] .image-tree__select { cursor: grab; }
.image-tree__row.dragging { opacity: 0.45; }
.image-tree__drop--inside { outline: 2px solid var(--accent); outline-offset: -2px; }
.image-tree__drop--before::after, .image-tree__drop--after::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; border-radius: 1px; background: var(--accent); pointer-events: none; }
.image-tree__drop--before::after { top: -2px; }
.image-tree__drop--after::after { bottom: -2px; }
.image-tree__chevron { display: grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); }
.image-tree__chevron:hover { background: var(--fill-subtle-hover); color: var(--text-primary); }
.image-tree__spacer { flex: 0 0 20px; }
.image-tree__select { display: flex; gap: var(--space-2); align-items: center; flex: 1; min-width: 0; height: 100%; padding: 0 var(--space-1); text-align: left; border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; font: inherit; }
.image-tree__icon { display: grid; flex: 0 0 auto; color: var(--text-secondary); }
.image-tree__select span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-editor .image-tree__rename { flex: 1; min-width: 0; width: 100%; height: var(--control-sm); padding: 0 var(--space-1); }
/* --- Canvas and its tool strip ------------------------------------------------ */
.image-center { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--layer); }
.image-canvas-tools { grid-column: 1 / -1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--space-2); height: var(--command-row); padding: 0 var(--space-2); border-bottom: 1px solid var(--line); }
.image-generate-button { flex-shrink: 0; white-space: nowrap; }
.image-generation-controls { display: flex; min-width: 0; }
.image-generation-controls > .image-generate-button { flex: 1; }
.image-generation-controls--split { border: 1px solid var(--button-primary-stroke); border-bottom-color: var(--button-primary-stroke-bottom); border-radius: var(--radius-sm); background: var(--button-primary-bg); }
.image-generation-controls--split:has(> .image-generate-button:disabled) { border-color: transparent; background: var(--button-primary-off-bg); }
.image-generation-controls--split > .primary-button { min-height: calc(var(--control-md) - 2px); border: 0; background: transparent; border-radius: 0; }
.image-generation-controls--split > .image-generate-button { border-radius: calc(var(--radius-sm) - 1px) 0 0 calc(var(--radius-sm) - 1px); }
.image-generation-controls--split > .image-generation-options { position: relative; flex: 0 0 var(--control-md); padding: 0; border-radius: 0 calc(var(--radius-sm) - 1px) calc(var(--radius-sm) - 1px) 0; }
.image-generation-options::before { content: ""; position: absolute; left: 0; top: 25%; bottom: 25%; width: 1px; background: currentColor; opacity: .22; }
.image-generation-controls--split > .primary-button:hover:not(:disabled), .image-generation-controls--split > .primary-button[aria-expanded="true"] { background: var(--button-primary-hover); }
.image-generation-controls--split > .primary-button:active:not(:disabled) { background: var(--button-primary-active); }
/* Options remain available to correct an invalid count, with neutral colors. */
.image-generation-controls--split:has(> .image-generate-button:disabled) > .image-generation-options { color: var(--button-primary-off-ink); background: var(--button-primary-off-bg); }
.image-generation-controls--split:has(> .image-generate-button:disabled) > .image-generation-options:is(:hover, [aria-expanded="true"]):not(:disabled) { background: var(--fill-subtle-hover); }
.image-generation-controls--split:has(> .image-generate-button:disabled) > .image-generation-options:active:not(:disabled) { background: var(--fill-subtle-pressed); }
.ui-flyout.image-generation-options-panel { box-sizing: border-box; padding: var(--space-1) var(--space-2); }
.image-generation-options-panel .ui-prop-row { min-height: var(--control-sm); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 0; }
.image-generation-options-panel p { margin: var(--space-2) 0 0; color: var(--text-secondary); font-size: var(--text-xs); }
.image-tools__start, .image-tools__center, .image-tools__end { min-width: 0; display: flex; align-items: center; gap: var(--space-1); }
.image-tools__end { justify-content: flex-end; }
.image-generator { flex-shrink: 1; }
/* Editable: typed percentages up to "800%" plus the 32px drop-down button. */
.image-zoom { width: 112px; min-width: 112px; }
.image-tools__separator { width: 1px; height: 20px; margin: 0 var(--space-1); background: var(--line); }
.image-tools__group { display: inline-flex; gap: 2px; }
/* 32px icon toggles; the checked tool is an accent-soft fill. */
.image-tool { display: grid; place-items: center; width: var(--icon-button); height: var(--icon-button); padding: 0; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--text-primary); background: transparent; transition: var(--transition-control); }
.image-tool:hover { background: var(--fill-subtle-hover); }
.image-tool:active { background: var(--fill-subtle-pressed); }
.image-tool--on, .image-tool--on:hover { border-color: var(--accent-line); color: var(--accent-on-soft); background: var(--accent-soft); }
.image-tool > span { display: grid; }
/* Fit leaves a 24px margin round the frame, so its edge reads as the canvas
edge instead of merging into the pane borders. */
.image-viewport { position: relative; flex: 1; min-height: 0; overflow: clip; container-type: size; user-select: none; background: var(--layer-alt); }
.image-viewport.panning, .image-viewport.panning * { cursor: grabbing; }
.image-frame { position: absolute; left: 50%; top: 50%; transform: translate(calc(-50% + var(--image-pan-x)), calc(-50% + var(--image-pan-y))); width: calc(min(100cqw - 48px, (100cqh - 48px) * var(--image-ratio)) * var(--image-zoom)); aspect-ratio: var(--image-ratio); background: var(--panel); box-shadow: 0 0 0 1px var(--line-solid); }
.image-frame > img { position: absolute; width: 100%; height: 100%; object-fit: contain; inset: 0; }
.image-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); text-align: center; padding: var(--space-4); color: var(--text-muted); }
.image-empty strong { color: var(--text-primary); font-size: var(--text-base); font-weight: var(--weight-semibold); }
.image-empty span { max-width: 300px; font-size: var(--text-xs); }
.image-overlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.image-overlay rect, .image-overlay polygon, .image-overlay path { fill: color-mix(in srgb, var(--accent) 8%, transparent); stroke: var(--accent); stroke-width: 1.5; cursor: move; }
.image-overlay .selected > rect, .image-overlay .selected > polygon, .image-overlay .selected > path { stroke-width: 3; }
.image-box-label { position: absolute; margin: var(--space-1); padding: 0 var(--space-1); border-radius: var(--radius-sm); color: var(--text-primary); background: var(--panel); font-size: var(--text-xs); pointer-events: none; }
.image-overlay .image-box-handle { fill: var(--accent); cursor: nwse-resize; }
.image-overlay.drawing, .image-overlay.drawing rect, .image-overlay.drawing polygon, .image-overlay.drawing path { cursor: crosshair; }
.image-overlay.lasso-add, .image-overlay.lasso-add * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36'%3E%3Cpath d='M16 6v7m0 6v7M6 16h7m6 0h7M25 21v8M21 25h8' fill='none' stroke='white' stroke-width='3'/%3E%3Cpath d='M16 6v7m0 6v7M6 16h7m6 0h7M25 21v8M21 25h8' fill='none' stroke='black'/%3E%3C/svg%3E") 16 16, crosshair; }
.image-overlay.lasso-subtract, .image-overlay.lasso-subtract * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36'%3E%3Cpath d='M16 6v7m0 6v7M6 16h7m6 0h7M21 25h8' fill='none' stroke='white' stroke-width='3'/%3E%3Cpath d='M16 6v7m0 6v7M6 16h7m6 0h7M21 25h8' fill='none' stroke='black'/%3E%3C/svg%3E") 16 16, crosshair; }
.extend-frame { background: transparent; box-shadow: none; }
.extend-source { position: absolute; }
.extend-source img { width: 100%; height: 100%; object-fit: fill; }
.extend-overlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.extend-generated { fill: color-mix(in srgb, var(--accent) 25%, transparent); }
.extend-excluded { fill: color-mix(in srgb, var(--layer-alt) 70%, transparent); }
.extend-original { fill: none; stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 4 4; }
.extend-box { fill: transparent; stroke: var(--accent); stroke-width: 2; cursor: move; }
.extend-handle { fill: var(--accent); stroke: var(--panel); stroke-width: 1; }
.extend-overlay[aria-disabled="true"] { pointer-events: none; opacity: 0.7; }
.extend-tool-active { display: flex; align-items: center; gap: var(--space-2); color: var(--accent-on-soft); padding: var(--space-1) var(--space-2); background: var(--accent-soft); border-radius: var(--radius-sm); }
.image-status { display: flex; flex-direction: column; justify-content: center; gap: var(--space-1); min-height: var(--control-sm); padding: 0 var(--space-3); color: var(--text-secondary); font-size: var(--text-xs); border-top: 1px solid var(--line); }
.image-center > .image-error { margin: var(--space-2); }
.image-results { display: flex; min-height: 82px; gap: var(--space-2); overflow-x: auto; padding: var(--space-2); border-top: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: transparent transparent; }
/* A thin scrollbar while the bar scrolls (the wheel scrolls it sideways in
code, which the platform's overlay scrollbar does not show for) or is hovered. */
.image-results:hover, .image-results.image-results--scrolling { scrollbar-color: var(--text-muted) transparent; }
.image-results button { position: relative; flex: 0 0 72px; height: 64px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: var(--radius-sm); background: var(--panel); }
.image-draft-badge { position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 3px; padding: 2px; background: var(--glass); color: var(--text-primary); font-size: var(--text-xs); }
.image-results button[aria-pressed="true"] { border-color: var(--accent); }
.image-results img { width: 100%; height: 100%; object-fit: cover; }
/* Back to the originals, at the leading edge of a family. */
.image-results button.image-results__back { flex: 0 0 32px; display: grid; place-items: center; border: 0; color: var(--text-secondary); background: transparent; }
.image-results button.image-results__back:hover { color: var(--text-primary); background: var(--fill-subtle-hover); }
/* How many images an original's family holds, itself included. */
.image-family-badge { position: absolute; top: 2px; right: 2px; min-width: 18px; padding: 0 4px; border-radius: var(--radius-pill); color: var(--on-accent); background: var(--accent); font-size: var(--text-xs); line-height: 18px; text-align: center; }
/* --- Inspector -------------------------------------------------------------------
Label + control pairs are PropRows; the free-text fields stay full width
with a 12px label above. */
/* Only the fields scroll; the selected-item header and action footer stay visible. */
.image-inspector__fields { flex: 1; min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2) 0 var(--space-3); }
/* Section headers reach the pane edges; standalone fields retain the same
inset as the shared property-section contents. */
.image-inspector__fields > :not(.ui-prop-section) { margin-inline: var(--space-3); }
.image-inspector__area { display: flex; flex-direction: column; gap: var(--space-1); color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.image-inspector__area textarea { width: 100%; height: auto; min-width: 0; padding: var(--space-2); font-weight: var(--weight-regular); line-height: var(--leading-normal); resize: vertical; }
.image-inspector__caption { margin: 0; color: var(--text-muted); font-size: var(--text-xs); }
.image-inspector .image-check { display: flex; align-items: center; gap: var(--space-2); min-height: 28px; font-size: var(--text-base); }
.image-palette { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.image-palette > div { display: flex; align-items: center; gap: 2px; }
.image-palette input[type="color"] { width: var(--control-sm); height: var(--control-sm); padding: 2px; border: 1px solid var(--stroke-control); border-radius: var(--radius-sm); background: var(--fill-control); }
/* The editable name is the inspector's heading: an h2 around the input, laid
out as the input alone would be (as .generator-panel__name). */
.image-inspector__name { flex: 1; min-width: 0; display: flex; margin: 0; font: inherit; }
.image-template-settings { overflow: hidden; }
.image-template-settings__form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.image-template-settings__fields { flex: 1; min-height: 0; overflow: auto; }
.image-template-settings__footer { flex-shrink: 0; display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border-top: 1px solid var(--line); }