Two more half-contract leaks surfaced by sweeping shared chrome class
usage across tools:
1. form/ had its own design-token namespace (--color-primary,
--color-bg, --color-text, --color-border, --color-bg-alt,
--color-text-muted) defined nowhere but fallback'd to hardcoded
hex values different from shared (#1e3a5f vs shared's #2a5a8a).
Form's buttons, inputs, fieldsets, array-row borders, and status
colors all rendered with subtly different palette than the rest
of the suite.
Form also redefined .btn, .btn-primary, and a (form-local)
.btn-small class — the redefinition shadowed shared/base.css's
button system entirely. Form's JS used 'btn btn-small' for the
add/remove row buttons in form-array widgets.
Fixes:
- form/css/form.css: rename every --color-* reference to the
matching shared token (--primary, --bg, --bg-secondary, --text,
--text-muted, --border, --radius, --danger, --success).
- form/css/form.css: delete the .btn / .btn-primary / .btn-small
blocks entirely. Shared covers .btn / .btn-primary /
.btn-secondary / .btn-sm / .btn-lg / .btn-link.
- form/js/array.js: switch the row add/remove buttons to
'btn btn-sm btn-secondary' so they pick up shared's sizing
and outline variant.
- tests/form-safety.spec.js: update the selector
button.btn-small → button.btn-sm.
2. browse/ had .hidden { display: none !important; } — exact
duplicate of shared/base.css's rule. Delete the redundant copy
(left a one-line comment pointer in case anyone wonders why
it's missing from the local sheet).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
198 lines
3.9 KiB
CSS
198 lines
3.9 KiB
CSS
/* form/ — ZDDC generic form renderer.
|
|
Form-specific layout only; theme tokens (--primary, --bg, --text,
|
|
--border, --bg-secondary, --text-muted, --font-mono, --radius) come
|
|
from shared/base.css. Button styles (.btn, .btn-primary,
|
|
.btn-secondary, .btn-sm) likewise inherit from shared. */
|
|
|
|
.form-main {
|
|
max-width: 800px;
|
|
margin: 1.5rem auto;
|
|
padding: 0 1rem 4rem;
|
|
}
|
|
|
|
.form-status {
|
|
padding: 0.75rem 1rem;
|
|
margin-bottom: 1rem;
|
|
border-radius: var(--radius);
|
|
border: 1px solid var(--border);
|
|
}
|
|
|
|
.form-status.is-error {
|
|
background: var(--bg-secondary);
|
|
border-color: var(--danger);
|
|
color: var(--danger);
|
|
}
|
|
|
|
.form-status.is-success {
|
|
background: var(--bg-secondary);
|
|
border-color: var(--success);
|
|
color: var(--success);
|
|
}
|
|
|
|
.form-root {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.form-field {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.form-field__label {
|
|
font-weight: 600;
|
|
font-size: 0.95rem;
|
|
}
|
|
|
|
.form-field__label .required-mark {
|
|
color: var(--danger);
|
|
margin-left: 0.15rem;
|
|
}
|
|
|
|
.form-field__description {
|
|
font-size: 0.85rem;
|
|
color: var(--text-muted);
|
|
}
|
|
|
|
.form-field__error {
|
|
font-size: 0.85rem;
|
|
color: var(--danger);
|
|
margin-top: 0.15rem;
|
|
}
|
|
|
|
.form-field__help {
|
|
font-size: 0.8rem;
|
|
color: var(--text-muted);
|
|
font-style: italic;
|
|
}
|
|
|
|
.form-field__input,
|
|
.form-field__textarea,
|
|
.form-field__select {
|
|
padding: 0.5rem 0.65rem;
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
background: var(--bg);
|
|
color: var(--text);
|
|
font: inherit;
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.form-field__textarea {
|
|
min-height: 5em;
|
|
resize: vertical;
|
|
}
|
|
|
|
.form-field__input:focus,
|
|
.form-field__textarea:focus,
|
|
.form-field__select:focus {
|
|
outline: 2px solid var(--primary);
|
|
outline-offset: -1px;
|
|
}
|
|
|
|
.form-field--invalid .form-field__input,
|
|
.form-field--invalid .form-field__textarea,
|
|
.form-field--invalid .form-field__select {
|
|
border-color: var(--danger);
|
|
}
|
|
|
|
.form-field__radio-group,
|
|
.form-field__checkbox-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.form-field__radio-group label,
|
|
.form-field__checkbox-group label {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-weight: 400;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.form-fieldset {
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
padding: 0.75rem 1rem 1rem;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.form-fieldset__legend {
|
|
font-weight: 600;
|
|
padding: 0 0.4rem;
|
|
}
|
|
|
|
.form-array {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.form-array__row {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
align-items: flex-start;
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
padding: 0.5rem;
|
|
background: var(--bg-secondary);
|
|
}
|
|
|
|
.form-array__row-body {
|
|
flex: 1 1 auto;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.form-array__row-actions {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.form-array__add {
|
|
align-self: flex-start;
|
|
}
|
|
|
|
.form-actions {
|
|
margin-top: 1.5rem;
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
/* Standalone welcome — shown when form.html is opened directly (no
|
|
server-injected #form-context). */
|
|
.form-welcome {
|
|
max-width: 36rem;
|
|
margin: 2rem auto;
|
|
padding: 1.5rem 1.75rem;
|
|
background: var(--bg);
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
}
|
|
.form-welcome h2 {
|
|
margin-bottom: 0.5rem;
|
|
font-size: 1.25rem;
|
|
}
|
|
.form-welcome h3 {
|
|
margin: 1rem 0 0.35rem;
|
|
font-size: 0.95rem;
|
|
}
|
|
.form-welcome p { margin-bottom: 0.75rem; line-height: 1.5; }
|
|
.form-welcome ol { margin: 0 0 0.75rem 1.25rem; }
|
|
.form-welcome li { margin-bottom: 0.35rem; }
|
|
.form-welcome code {
|
|
font-family: var(--font-mono);
|
|
font-size: 0.85em;
|
|
background: var(--bg-secondary);
|
|
padding: 0.05em 0.3em;
|
|
border-radius: 3px;
|
|
}
|