Files
openclaw/ui/src/styles/config.css
T
Vincent Koc 183db47e97 fix(ui): preserve schema-backed settings edits (#116282)
* fix(ui): harden schema-backed settings controls

Co-authored-by: wangmiao0668000666 <wang.miao86@xydigit.com>

* test(ui): match config secret label in Chromium

* chore(ui): remove release-owned changelog entry

* test(agents): mock incremental registry persistence

---------

Co-authored-by: wangmiao0668000666 <wang.miao86@xydigit.com>
2026-07-30 23:08:53 +08:00

958 lines
19 KiB
CSS

/* ===========================================
Config Page
===========================================
The schema-driven form itself renders through the settings design
language (settings-section/settings-group/settings-row; see
ui/src/styles/settings.css). This file keeps only the config page
chrome (tabs, actions, diff, raw editor) plus genuinely form-specific
pieces layered on top of the settings primitives. */
/* Mode Toggle */
.config-mode-toggle {
display: flex;
padding: 3px;
background: var(--bg-elevated);
border-radius: var(--radius-md);
border: 1px solid var(--border);
gap: 1px;
}
:root[data-theme-mode="light"] .config-mode-toggle {
background: white;
}
.config-mode-toggle__btn {
flex: 1;
padding: 6px 12px;
border: none;
border-radius: calc(var(--radius-md) - 3px);
background: transparent;
color: var(--muted);
font-size: 12px; /* was 11px */
font-weight: 600;
transition:
background var(--duration-fast) ease,
color var(--duration-fast) ease,
box-shadow var(--duration-fast) ease;
}
.config-mode-toggle__btn:hover:not(.active) {
color: var(--text);
background: var(--bg-hover);
}
.config-mode-toggle__btn.active {
background: var(--primary);
color: var(--primary-foreground);
box-shadow: 0 1px 3px var(--accent-subtle);
}
/* ===========================================
Lead column (toolbar / banner / nav above the form)
=========================================== */
/* Mirrors the .settings-page column so config chrome lines up with it. */
.config-lead {
width: 100%;
max-width: 760px;
margin: 0 auto;
padding: var(--space-3) var(--space-4) 0;
display: flex;
flex-direction: column;
gap: var(--space-3);
}
/* Toolbar: mode toggle / section tabs */
.config-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: var(--space-2) var(--space-3);
}
.config-show-advanced.active {
color: var(--accent);
border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
background: var(--accent-subtle);
}
/* Raw mode file operations (open / discard / save) */
.config-raw-actions {
display: flex;
align-items: center;
justify-content: flex-end;
flex-wrap: wrap;
gap: var(--space-2);
margin-bottom: var(--space-3);
}
.config-action-spinner {
display: inline-flex;
align-items: center;
justify-content: center;
width: 14px;
height: 14px;
}
.config-action-spinner svg {
width: 14px;
height: 14px;
animation: spin 0.7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
.config-action-spinner svg {
animation: none;
}
}
/* Diff Panel */
.config-diff {
margin: 12px 20px 0;
border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
border-radius: var(--radius-lg);
background: var(--accent-subtle);
overflow: hidden;
}
.config-diff__summary {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 16px;
font-size: 12px;
font-weight: 600;
color: var(--accent);
list-style: none;
}
.config-diff__summary::-webkit-details-marker {
display: none;
}
.config-diff__chevron {
width: 16px;
height: 16px;
transition: transform var(--duration-normal) var(--ease-out);
}
.config-diff__chevron svg {
width: 100%;
height: 100%;
}
.config-diff[open] .config-diff__chevron {
transform: rotate(180deg);
}
.config-diff__content {
padding: 0 16px 16px;
display: grid;
gap: 8px;
}
.config-diff__item {
display: flex;
align-items: baseline;
gap: 12px;
padding: 8px 12px;
border-radius: var(--radius-md);
background: var(--bg-elevated);
font-size: 11.5px;
font-family: var(--mono);
}
:root[data-theme-mode="light"] .config-diff__item {
background: white;
}
.config-diff__path {
font-weight: 600;
color: var(--text);
flex-shrink: 0;
}
.config-diff__values {
display: flex;
align-items: baseline;
gap: 10px;
min-width: 0;
flex-wrap: wrap;
}
.config-diff__from {
color: var(--danger);
opacity: 0.85;
}
.config-diff__arrow {
color: var(--muted);
}
.config-diff__to {
color: var(--ok);
}
/* Content Area */
.config-content {
flex: 1;
overflow-y: auto;
padding: 20px 22px;
min-width: 0;
scroll-behavior: smooth;
}
/* The schema form nests a full settings-page inside this scroller; both carry
top padding, which stacks into a dead band between the accordion nav and
the first section. Keep one spacing owner. */
.config-lead + .config-content {
padding-top: 0;
}
.config-content > .settings-page {
padding-top: 0;
}
.config-content-callout {
width: 100%;
max-width: 760px;
margin: 0 auto;
padding: var(--space-3) var(--space-4) 0;
}
.config-content-callout .callout {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: var(--space-3);
}
.config-content-callout__text {
min-width: 0;
flex: 1 1 420px;
}
/* ===========================================
Appearance custom pickers (theme + text scale)
=========================================== */
.settings-theme-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 12px;
width: 100%;
}
.settings-theme-card {
position: relative;
display: grid;
grid-template-columns: auto 1fr auto;
align-items: center;
gap: 10px;
min-height: 64px;
padding: 14px 16px;
border: 1px solid var(--border);
border-radius: var(--radius-lg);
background: var(--bg);
color: var(--text);
text-align: left;
transition:
border-color var(--duration-fast) ease,
background var(--duration-fast) ease;
}
.settings-theme-card:hover {
border-color: var(--border-strong);
background: var(--bg-hover);
}
.settings-theme-card--active {
border-color: color-mix(in srgb, var(--accent) 35%, transparent);
background: color-mix(in srgb, var(--accent) 10%, var(--bg-elevated));
box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent);
}
.settings-theme-card__icon,
.settings-theme-card__check {
display: inline-flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
color: var(--accent);
}
.settings-theme-card__icon svg,
.settings-theme-card__check svg {
width: 18px;
height: 18px;
stroke: currentColor;
fill: none;
}
.settings-theme-card__label {
font-size: 13px;
font-weight: 600;
color: var(--text);
}
.settings-theme-card--active .settings-theme-card__label {
color: var(--text-strong);
}
/* Real-palette preview chips. Colors mirror the :root[data-theme] blocks in
base.css (claw = the default :root palette); keep both in sync when
retuning a theme. The custom card reads the live variables instead — it is
only rendered with chips while the imported theme is active. */
.settings-theme-card__palette {
display: inline-flex;
align-items: center;
gap: 5px;
}
.settings-theme-card__chip {
width: 14px;
height: 14px;
border-radius: 50%;
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 18%, transparent);
}
.settings-theme-card__chip--bg {
background: var(--theme-chip-bg);
}
.settings-theme-card__chip--accent {
background: var(--theme-chip-accent);
}
.settings-theme-card__chip--accent-2 {
background: var(--theme-chip-accent-2);
}
.settings-theme-card--claw {
--theme-chip-bg: #0e1015;
--theme-chip-accent: #ff5c5c;
--theme-chip-accent-2: #14b8a6;
}
.settings-theme-card--knot {
--theme-chip-bg: #080808;
--theme-chip-accent: #e5243b;
--theme-chip-accent-2: #8b1a2b;
}
.settings-theme-card--dash {
--theme-chip-bg: #1a1210;
--theme-chip-accent: #b47840;
--theme-chip-accent-2: #a88050;
}
:root[data-theme-mode="light"] .settings-theme-card--claw {
--theme-chip-bg: #faf9f7;
--theme-chip-accent: #bd4531;
--theme-chip-accent-2: #0d9488;
}
:root[data-theme-mode="light"] .settings-theme-card--knot {
--theme-chip-bg: #f9f9fb;
--theme-chip-accent: #c41e30;
--theme-chip-accent-2: #7a1420;
}
:root[data-theme-mode="light"] .settings-theme-card--dash {
--theme-chip-bg: #f7f2ec;
--theme-chip-accent: #6e4828;
--theme-chip-accent-2: #6a4e30;
}
.settings-theme-card--custom {
--theme-chip-bg: var(--bg);
--theme-chip-accent: var(--accent);
--theme-chip-accent-2: var(--accent-2);
}
.settings-theme-import {
display: grid;
gap: 12px;
width: 100%;
}
.settings-theme-import__copy {
display: grid;
gap: 4px;
}
.settings-theme-import__title {
font-size: 13px;
font-weight: 650;
color: var(--text-strong);
}
.settings-theme-import__hint {
margin: 0;
font-size: 12px;
line-height: 1.45;
color: var(--muted);
}
.settings-theme-import__external {
display: inline-flex;
align-items: center;
gap: 6px;
width: max-content;
max-width: 100%;
color: var(--accent);
font-size: 12px;
font-weight: 600;
text-decoration: none;
}
.settings-theme-import__external:hover {
color: var(--accent-hover);
text-decoration: underline;
}
.settings-theme-import__external svg {
width: 14px;
height: 14px;
stroke: currentColor;
fill: none;
flex: 0 0 auto;
}
.settings-theme-import__inline-hint {
margin: 0;
font-size: 12px;
line-height: 1.5;
color: var(--muted);
}
.settings-theme-import__inline-hint strong {
color: var(--text);
}
.settings-theme-import__field {
display: grid;
gap: 6px;
}
.settings-theme-import__label {
font-size: 12px; /* was 11px */
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--muted);
}
.settings-theme-import__input {
width: 100%;
min-width: 0;
padding: 10px 12px;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--bg-elevated);
color: var(--text);
font: inherit;
}
.settings-theme-import__input::placeholder {
color: var(--muted);
}
.settings-theme-import__input:focus-visible {
outline: none;
border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
box-shadow: var(--focus-ring);
}
.settings-theme-import__actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.settings-theme-import__meta {
display: grid;
gap: 4px;
}
.settings-theme-import__meta-label {
font-size: 12px; /* was 11px */
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--muted);
}
.settings-theme-import__meta-value {
font-size: 12px;
color: var(--text);
overflow-wrap: anywhere;
}
.settings-theme-import__message {
padding: 10px 12px;
border-radius: var(--radius-md);
font-size: 12px;
line-height: 1.45;
}
.settings-theme-import__message--success {
background: var(--ok-subtle);
color: var(--text);
}
.settings-theme-import__message--error {
background: var(--danger-subtle);
color: var(--text);
}
.settings-text-scale {
display: grid;
gap: 8px;
width: 100%;
}
.settings-text-scale__options {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
gap: 8px;
}
.settings-text-scale__btn {
display: grid;
gap: 4px;
justify-items: start;
min-height: 58px;
padding: 10px 12px;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--card);
color: var(--text);
text-align: left;
transition:
border-color var(--duration-fast) ease,
background var(--duration-fast) ease;
}
.settings-text-scale__btn:hover {
border-color: var(--border-strong);
background: var(--bg-elevated);
}
.settings-text-scale__btn.active {
border-color: var(--accent);
background: var(--accent-subtle);
}
.settings-text-scale__sample {
font-weight: 650;
font-size: 13px;
line-height: 1.2;
}
.settings-text-scale__label {
color: var(--muted);
font-size: 12px; /* was 11px */
line-height: 1.2;
}
.settings-text-scale__btn.active .settings-text-scale__label {
color: var(--accent);
}
.config-raw-field textarea {
min-height: 500px;
font-family: var(--mono);
font-size: 13px;
line-height: 1.55;
}
.config-raw-field .config-raw-toggle {
width: 32px;
height: 32px;
padding: 6px;
min-width: 32px;
}
/* Loading State */
.config-loading {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 14px;
padding: 80px 24px;
color: var(--muted);
}
.config-loading__spinner {
width: 32px;
height: 32px;
border: 2.5px solid var(--border);
border-top-color: var(--accent);
border-radius: var(--radius-full);
animation: spin 0.7s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
/* ===========================================
Form specifics layered on settings rows
=========================================== */
/* Inline validation/unsupported-node message inside a settings-row. */
.cfg-field__error {
font-size: 12px;
color: var(--danger);
}
.cfg-structured-draft {
display: contents;
}
.cfg-structured-draft__error .settings-row__control {
width: 100%;
}
.cfg-json-editor {
display: flex;
flex: 1 1 auto;
flex-direction: column;
gap: 6px;
min-width: 0;
width: 100%;
}
.cfg-json-editor > .settings-input,
.cfg-json-editor > .settings-secret {
width: 100%;
}
.cfg-array .settings-row--stacked .settings-row__control {
width: 100%;
}
.cfg-array .settings-row--stacked .settings-row__control > input[type="number"] {
flex: 1 1 auto;
width: auto;
}
.cfg-collection-draft__controls {
display: grid;
gap: 8px;
width: 100%;
}
.cfg-collection-draft__actions {
display: flex;
justify-content: flex-end;
gap: 8px;
}
.config-content :is(input, textarea, select)[aria-invalid="true"] {
border-color: var(--danger);
}
/* Redacted click-to-reveal inputs/textareas. */
.cfg-redacted {
opacity: 0.7;
}
/* Hairline dividers around form sub-blocks (collapsible objects, arrays,
maps) so they chain with sibling settings-rows inside one group. */
.cfg-block + .cfg-block,
.settings-row + .cfg-block,
.cfg-block + .settings-row,
.settings-subrows + .cfg-block,
.cfg-block + .settings-subrows {
border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
/* Collapsible nested-object summary behaves like a nav row. */
.cfg-object__summary {
cursor: pointer;
list-style: none;
transition: background var(--duration-fast) ease;
}
.cfg-object__summary::-webkit-details-marker {
display: none;
}
.cfg-object__summary:hover {
background: var(--bg-hover);
}
.cfg-object[open] > .cfg-object__summary .cfg-object__chevron {
transform: rotate(180deg);
}
/* Hint tags (searchable via tag: filters). */
.cfg-tags {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.cfg-tag {
display: inline-flex;
align-items: center;
border: 1px solid var(--border);
border-radius: var(--radius-full);
padding: 2px 8px;
font-size: 12px; /* was 11px */
color: var(--muted);
background: var(--bg-elevated);
white-space: nowrap;
}
:root[data-theme-mode="light"] .cfg-tag {
background: white;
}
@media (hover: none) and (pointer: coarse) {
.settings-theme-import__input,
.config-raw-field textarea {
font-size: 16px;
}
}
/* MCP */
.mcp-page {
display: grid;
gap: 14px;
margin-top: 12px;
}
/* Memory */
.memory-page {
display: grid;
gap: 0;
}
.memory-page__panel {
display: grid;
gap: 14px;
}
.shell--settings .content:has(.settings-page) .content-header.hub-page-header {
max-width: 1120px;
}
.memory-page__panel .settings-page,
.memory-page__panel .config-lead,
.memory-page__panel .config-content-callout {
margin-inline: 0;
}
.memory-page__link {
color: var(--accent);
font-size: 12.5px;
white-space: nowrap;
}
.mcp-command-card__grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px;
width: 100%;
}
.mcp-command-card__grid code,
.mcp-server-row .settings-row__control code {
min-width: 0;
padding: 7px 9px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--bg-elevated);
color: var(--text);
font-family: var(--mono);
font-size: 11.5px;
overflow-wrap: anywhere;
}
.mcp-server-row__launch {
font-family: var(--mono);
}
/* Shared inline form stays in config.css because the app-wide stylesheet
* serves both the MCP settings page and the Plugins inventory. */
.mcp-server-form {
display: grid;
grid-template-columns: minmax(140px, 220px) minmax(150px, 190px) minmax(0, 1fr) auto;
gap: var(--space-2);
align-items: end;
padding: var(--space-3) var(--space-4);
border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.mcp-server-form label {
display: grid;
gap: 5px;
min-width: 0;
}
.mcp-server-form label span {
color: var(--muted);
font-size: var(--control-ui-text-xs);
font-weight: 580;
}
.mcp-server-form__actions {
display: flex;
gap: var(--space-2);
}
.mcp-server-message {
margin: var(--space-3) var(--space-4);
padding: var(--space-2) var(--space-3);
border-radius: var(--radius-md);
background: var(--ok-subtle);
color: var(--ok);
font-size: var(--control-ui-text-xs);
line-height: 1.45;
white-space: pre-wrap;
}
.mcp-server-message--error {
background: var(--danger-subtle);
color: var(--danger);
}
.mcp-server-loading {
padding: var(--space-4);
color: var(--muted);
font-size: var(--control-ui-text-sm);
}
/* Advanced Settings accordion navigation, rendered by view.ts. */
.config-accordion-nav {
margin-bottom: 20px;
}
.config-accordion-group {
border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
border-radius: var(--radius-md);
margin-bottom: 4px;
overflow: hidden;
transition: border-color var(--duration-fast) var(--ease-out);
}
.config-accordion-group:hover {
border-color: var(--border);
}
.config-accordion-group__header {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
padding: 12px 16px;
font-size: 0.8125rem;
font-weight: 650;
letter-spacing: -0.01em;
color: var(--text-strong);
background: color-mix(in srgb, var(--bg-elevated) 50%, var(--card) 50%);
border: none;
transition: background var(--duration-fast) var(--ease-out);
}
.config-accordion-group__header:hover,
.config-accordion-group__header--active {
background: var(--bg-hover);
}
.config-accordion-group__icon {
display: flex;
align-items: center;
color: var(--accent);
opacity: 0.7;
}
.config-accordion-group__icon svg {
width: 16px;
height: 16px;
}
.config-accordion-group__chevron {
margin-left: auto;
opacity: 0.35;
transition: transform var(--duration-normal) var(--ease-out);
}
.config-accordion-group__chevron--open {
transform: rotate(180deg);
}
.config-accordion-group__items {
border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
padding: 4px 0;
background: var(--card);
}
.config-accordion-group__item {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
padding: 9px 16px 9px 40px;
font-size: 0.8125rem;
font-weight: 450;
color: var(--muted);
background: none;
border: none;
transition:
background var(--duration-fast) var(--ease-out),
color var(--duration-fast) var(--ease-out);
}
.config-accordion-group__item:hover {
background: var(--bg-hover);
color: var(--text);
}
.config-accordion-group__item--active {
color: var(--accent);
font-weight: 600;
}
.config-accordion-group__item-icon {
display: flex;
align-items: center;
opacity: 0.45;
}
.config-accordion-group__item-icon svg {
width: 14px;
height: 14px;
}
@media (max-width: 820px) {
.mcp-command-card__grid {
grid-template-columns: 1fr;
}
.mcp-server-form {
grid-template-columns: minmax(0, 1fr);
align-items: stretch;
}
}
/* ===========================================
Mobile Responsiveness
=========================================== */
@media (max-width: 768px) {
.settings-theme-grid {
grid-template-columns: 1fr;
}
}