Chart builder: field-first shelf + value-or-field channels

This commit is contained in:
2026-06-11 23:56:40 +03:00
parent 9ebe398e75
commit 4dcff4601d
11 changed files with 1192 additions and 184 deletions
+342 -57
View File
@@ -390,18 +390,6 @@
color: var(--text-secondary);
}
.channels {
display: flex;
flex-direction: column;
gap: var(--space-3);
}
.channelsHeader {
display: flex;
align-items: baseline;
justify-content: space-between;
}
.swap {
border: none;
background: transparent;
@@ -422,56 +410,13 @@
outline-offset: 1px;
}
/* Each channel is a small block: a top row (label + column) and, when mapped, a
controls row (N|O|Q|T type + contextual transforms). */
.channel {
display: flex;
flex-direction: column;
gap: var(--space-2);
padding: var(--space-3);
border: var(--border-width) solid var(--border);
border-radius: var(--radius);
}
.channelTop {
display: grid;
grid-template-columns: 44px 1fr;
align-items: center;
gap: var(--space-2);
}
/* Channel name label (Marks card rows + the on-chart Columns/Rows shelves). */
.channelLabel {
font-size: 12px;
font-weight: 600;
color: var(--text);
}
.channelControls {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--space-2);
padding-left: 52px;
}
.select {
padding: var(--space-2) var(--space-3);
border: var(--border-width) solid var(--border-strong);
border-radius: var(--radius);
background: var(--bg);
color: var(--text);
font: inherit;
font-size: 13px;
width: 100%;
}
/* The N|O|Q|T type control: monospace abbreviations so the four segments line up. */
.typeSeg button {
font-family: var(--font-mono);
font-size: 11px;
padding: var(--space-1) var(--space-2);
}
.transform {
display: inline-flex;
align-items: center;
@@ -506,7 +451,6 @@
gap: var(--space-5);
}
.select:focus-visible,
.mini:focus-visible,
.dimInput:focus-visible {
outline: 2px solid var(--focus);
@@ -672,9 +616,19 @@
/* ── Right: live preview ─────────────────────────────────────────────── */
/* Right side = on-chart shelves stacked above the live preview (spec §06). */
.previewSide {
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
background: var(--bg);
}
.previewPane {
display: flex;
flex-direction: column;
flex: 1;
padding: var(--space-5);
min-width: 0;
min-height: 0;
@@ -741,3 +695,334 @@
white-space: pre-wrap;
word-break: break-word;
}
/* ── Encoding: field shelf + Tableau-style shelves/pills (spec §06 → Encoding) ─── */
/* Field shelf — the dataset's columns as clickable, type-glyphed chips (field-first). */
.fieldShelf {
display: flex;
flex-direction: column;
gap: var(--space-2);
}
.shelfGroupHead {
margin-top: var(--space-2);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--text-secondary);
}
.shelfList {
display: flex;
flex-direction: column;
gap: 2px;
}
.shelfField {
display: flex;
align-items: center;
gap: var(--space-2);
width: 100%;
padding: var(--space-2) var(--space-3);
border: var(--border-width) solid var(--border);
border-radius: var(--radius);
background: var(--bg);
color: var(--text);
font: inherit;
font-size: 13px;
text-align: left;
cursor: pointer;
}
.shelfField:hover {
border-color: var(--accent);
background: var(--layer-01);
}
.shelfField:focus-visible {
outline: 2px solid var(--focus);
outline-offset: 1px;
}
.shelfFieldUsed {
opacity: 0.55;
}
.shelfGlyph {
min-width: 22px;
padding: 1px var(--space-2);
border: var(--border-width) solid var(--border-strong);
background: var(--layer-01);
color: var(--text-secondary);
font-family: var(--font-mono);
font-size: 11px;
text-align: center;
}
.shelfFieldName {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Marks card — the non-positional encodings (Colour, Size). */
.marksCard {
display: flex;
flex-direction: column;
gap: var(--space-3);
padding: var(--space-3);
border: var(--border-width) solid var(--border);
border-radius: var(--radius);
}
.marksRow {
display: grid;
grid-template-columns: 44px 1fr;
align-items: start;
gap: var(--space-2);
}
/* Pill — a bound channel (field/count or constant). */
.pillWrap {
display: flex;
flex-direction: column;
gap: var(--space-2);
min-width: 0;
}
.pill {
display: inline-flex;
align-items: center;
max-width: 100%;
background: var(--accent);
color: var(--accent-contrast);
border-radius: var(--radius);
}
.pillConst {
background: var(--layer-02);
color: var(--text);
}
.pillType {
padding: var(--space-2);
border: none;
background: color-mix(in srgb, #000 18%, var(--accent));
color: var(--accent-contrast);
font-family: var(--font-mono);
font-size: 11px;
line-height: 1;
cursor: pointer;
}
.pillType:hover:not(:disabled) {
background: color-mix(in srgb, #000 30%, var(--accent));
}
.pillType:disabled {
cursor: default;
opacity: 0.85;
}
.pillType:focus-visible {
outline: 2px solid var(--accent-contrast);
outline-offset: -2px;
}
.pillTag {
padding: var(--space-2);
color: var(--text-secondary);
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.03em;
}
.pillName {
min-width: 0;
padding: var(--space-2) var(--space-3);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 12px;
}
.pillRemove {
display: inline-flex;
align-items: center;
justify-content: center;
padding: var(--space-2);
border: none;
background: transparent;
color: inherit;
cursor: pointer;
}
.pillRemove:hover {
background: color-mix(in srgb, var(--text) 14%, transparent);
}
.pillRemove:focus-visible {
outline: 2px solid var(--focus);
outline-offset: -2px;
}
.constColor {
width: 28px;
height: 22px;
margin: 0 var(--space-2);
padding: 0;
border: var(--border-width) solid var(--border-strong);
background: var(--bg);
cursor: pointer;
}
.constNumber {
width: 64px;
margin: 0 var(--space-2);
padding: var(--space-1) var(--space-2);
border: var(--border-width) solid var(--border-strong);
border-radius: var(--radius);
background: var(--bg);
color: var(--text);
font: inherit;
font-size: 12px;
}
.pillControls {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--space-2);
}
/* Empty assign target — armed by click, then filled by a clicked field. */
.slot {
display: flex;
align-items: center;
gap: var(--space-2);
min-height: 32px;
padding: var(--space-1) var(--space-2);
border: var(--border-width) dashed var(--border-strong);
background: var(--layer-01);
}
.slotActive {
border-style: solid;
border-color: var(--accent);
box-shadow: inset 0 0 0 1px var(--accent);
}
.slotAssign {
flex: 1;
min-width: 0;
padding: var(--space-1);
border: none;
background: transparent;
color: var(--text-placeholder);
font: inherit;
font-size: 12px;
text-align: left;
cursor: pointer;
}
.slotAssign:hover {
color: var(--text-secondary);
}
.slotAssign:focus-visible {
outline: 2px solid var(--focus);
outline-offset: 1px;
}
.slotConst {
padding: var(--space-1);
border: none;
background: none;
color: var(--accent);
font: inherit;
font-size: 11px;
white-space: nowrap;
text-decoration: underline;
cursor: pointer;
}
.slotConst:hover {
color: var(--accent-hover);
}
.slotConst:focus-visible {
outline: 2px solid var(--focus);
outline-offset: 1px;
}
/* On-chart Columns / Rows shelves (X/Y), stacked above the preview. */
.shelves {
display: flex;
flex-direction: column;
gap: var(--space-3);
padding: var(--space-5) var(--space-5) 0;
}
.shelvesHead {
display: flex;
align-items: baseline;
justify-content: space-between;
}
.shelfStrip {
display: flex;
align-items: stretch;
min-height: 42px;
border: var(--border-width) solid var(--border);
}
.shelfName {
flex: 0 0 84px;
display: flex;
align-items: center;
padding: 0 var(--space-3);
border-right: var(--border-width) solid var(--border);
background: var(--layer-01);
color: var(--text-secondary);
font-size: 12px;
}
.shelfSlots {
flex: 1;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--space-3);
min-width: 0;
padding: var(--space-2) var(--space-3);
}
.shelfSlots .slot,
.shelfSlots .pillWrap {
min-width: 190px;
}
/* Reserved faceting placeholder (Phase 4) — non-interactive, signals where it'll live. */
.facetSlot {
display: flex;
align-items: center;
gap: var(--space-2);
min-width: 150px;
min-height: 32px;
padding: var(--space-1) var(--space-3);
border: var(--border-width) dashed var(--border);
color: var(--text-placeholder);
font-size: 12px;
user-select: none;
}
.facetTag {
padding: 0 var(--space-2);
border: var(--border-width) solid var(--border);
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.03em;
}