Skip to content

Commit 21b8ff3

Browse files
committed
refactor(ui): unify type scale and shell density
- Add a token-driven type scale in index.css (--font-size-caption/dense/ body/form/title/page-title = 11/12/13/14/16/20px) and map the two missing sizes as text-caption / text-body in uno.config.ts - Replace every bare px/rem font-size in components with scale tokens (136 declarations across 52 files) and collapse text-[8/9/10/11px] into text-caption, removing sub-11px state text - Fix base components: CardTitle 24px -> 16px, dialog/alert titles 18px -> 16px, button size variants now xs=24px / sm=28px / default 32px / lg=36px with matching icon-sm / icon-xs - Compact the shell: navigation rail 64 -> 56px with 36x36 entries, object tree text 14 -> 12px on uniform 24px rows, connection selector rows at 13px, status dots unified (8px inline / 10px standalone), vendor logos fixed to 14/16/20px - Unify workspace chrome: grid toolbar fixed at 36px like the result toolbar, dropdown menu icons on the shared 16px size, JSON row action raised to a 24px target - AI / transfer surfaces mapped onto the scale with an ordered markdown heading hierarchy (20/16/14/13/12/11px) - Document the scale, icon scale, and density rules in DESIGN.md
1 parent 7a6018d commit 21b8ff3

69 files changed

Lines changed: 411 additions & 389 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎DESIGN.md‎

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,20 @@ Preserve established icon and data colors during surface or theme refactors. Use
136136

137137
### Fonts and hierarchy
138138

139-
The global body size is currently 14px, and `src/assets/index.css` does not define a custom brand font. Keep system sans-serif fonts with platform Chinese fallbacks. Do not introduce decorative fonts or remote font dependencies for the client. Keep Monaco's monospace editor font; SQL, types, object identifiers, and code snippets may use the existing `font-mono` utility.
139+
The global body size is `var(--font-size-form)` (14px), and `src/assets/index.css` does not define a custom brand font. Keep system sans-serif fonts with platform Chinese fallbacks. Do not introduce decorative fonts or remote font dependencies for the client. Keep Monaco's monospace editor font; SQL, types, object identifiers, and code snippets may use the existing `font-mono` utility.
140+
141+
The type scale is token-driven. `index.css` defines `--font-size-caption / dense / body / form / title / page-title` (11 / 12 / 13 / 14 / 16 / 20px); `uno.config.ts` maps the two sizes missing from the default scale (`text-caption` = 11px, `text-body` = 13px), and the rest reuse default utilities (`text-xs` = 12, `text-sm` = 14, `text-base` = 16, `text-xl` = 20). Business components must use these utilities or the CSS variables — never a bare px/rem font size. Monaco's editor font size remains a user setting.
140142

141143
The following hierarchy constrains new UI; it does not require rewriting all existing page titles.
142144

143-
| Role | Size / weight | Usage |
145+
| Role | Token / utility | Usage |
144146
| --- | --- | --- |
145-
| Page title | 20–24px / 600 | Standalone pages such as Connections and Settings; do not add large headings to editor workspaces |
146-
| Dialog / section title | 14–18px / 500–600 | Dialog titles and major groups |
147-
| Body / form | 14px / 400 | Descriptions, inputs, buttons; matches the current `text-sm` |
148-
| Dense data / supporting labels | 12px / 400–500 | Result grids, object trees, toolbars, status bars |
147+
| Page title | `text-xl` (20px / 600) | Standalone pages such as Connections and Settings; do not add large headings to editor workspaces |
148+
| Dialog / panel / card title | `text-base` (16px / 600) | Dialog titles, side-panel headers, card and section titles |
149+
| Body / form | `text-sm` (14px / 400) | Descriptions, inputs, buttons |
150+
| Sidebar lists and menus | `text-body` (13px / 400–500) | Connection selector rows, saved-query names, dropdown items outside dense surfaces |
151+
| Dense data / supporting labels | `text-xs` (12px / 400–500) | Result grids, object trees, query tabs, toolbars, status bars |
152+
| Captions and badges | `text-caption` (11px / 500) | Attribute badges, timestamps, task counters; the readable lower bound — 9–10px text is forbidden |
149153

150154
- Use roughly 1.4–1.6 line height for ordinary text. Code follows editor settings; fixed-height table rows must not clip text.
151155
- Do not use 9–10px text for states, prices, field meanings, or instructions users must read. Adjust the layout first when space is tight.
@@ -163,11 +167,12 @@ Retain the existing app shell: top window bar → left feature navigation → cu
163167
| --- | --- | --- |
164168
| Initial window | 1600 × 1000 | `src-tauri/tauri.conf.json`; not a minimum window size |
165169
| Window bar | 40px | `h-10` in `AppHeader.vue` |
166-
| Feature navigation | 64px wide, 40 × 40px entries | `AppSidebar.vue` |
170+
| Feature navigation | 56px wide, 36 × 36px entries, 20px icons | `AppSidebar.vue` |
167171
| Query sidebar | Initially 250px, resize range 200–400px | `QueriesPage.vue` |
172+
| Object tree rows | 24px row height, 12px text, 14px icons | `SchemaTree.vue` |
168173
| Query tabs | 35px high, maximum 200px per tab | `QueryTabs.vue` |
169-
| Result toolbar | 36px high | `QueryResultPanel.vue` |
170-
| Standard buttons / inputs | 32px high | `ui/button`, `ui/input` |
174+
| Result toolbar | 36px high (result panel and grid toolbars share this) | `QueryResultPanel.vue`, `DataGrid.vue` |
175+
| Standard buttons / inputs | 32px high; 24 / 28 / 36px via `xs` / `sm` / `lg` | `ui/button`, `ui/input` |
171176
| Virtual result rows | 32px estimated height | `grid/DataGrid.vue`; not a shared height for every table |
172177

173178
### Spacing and containers
@@ -204,7 +209,9 @@ Keep `--radius: 0.5rem`: `lg` is 8px, `md` is 6px, and `sm` is 4px. Use `rounded
204209

205210
- Use corner radius to convey component hierarchy rather than inventing per-page values. Keep continuous straight edges for data grids, split panes, and editors.
206211
- Limit `rounded-full` to suitable elements such as avatars, small status dots, and existing badges. Do not make every button pill-shaped.
207-
- Toolbar icons are usually 14–16px and main navigation icons 20px; the visible icon is smaller than its hit target. Keep standard action targets at 32px. Compact grid actions should generally be at least 24px with sufficient spacing and keyboard access.
212+
- Icon scale: 12px for inline glyphs (chevrons, close buttons, badge icons), 14px for tree, tab, and compact toolbar icons, 16px for standard buttons, menu items, and input adornments, 20px for main navigation. Dropdown-menu icons inherit the shared `size-4` from `DropdownMenuItem`; do not override per menu. The visible icon is smaller than its hit target; keep standard action targets at 32px and compact grid actions at least 24px with sufficient spacing and keyboard access.
213+
- Database vendor logos use three sizes: 14px inside lists and tabs, 16px in dropdown selected states and forms, 20px on cards and landing states (`DbTypeIcon` defaults to 16).
214+
- Status dots use 8px (`h-2 w-2`) inline within rows and 10px (`h-2.5 w-2.5`) as a standalone indicator beside a control.
208215
- Reuse the component's existing Carbon / Lucide style. Do not add icon libraries for color or decoration, or mix emoji into an action group.
209216

210217
## Components
@@ -217,7 +224,7 @@ Interactive components must cover default, hover, focus-visible, active / select
217224

218225
### Buttons and toolbars
219226

220-
- `default`: the single primary action, retaining `bg-primary text-primary-foreground`. Current default height is 32px; large is 36px.
227+
- `default`: the single primary action, retaining `bg-primary text-primary-foreground`. Heights: `xs` 24px, `sm` 28px, default 32px, `lg` 36px; icon buttons mirror this via `icon-xs` / `icon-sm` / `icon`. Use `sm` for sidebar and toolbar rows instead of overriding heights per component.
221228
- `outline / secondary`: secondary actions; `ghost`: toolbar and infrequent actions; `link`: explicit text links.
222229
- `destructive`: genuinely destructive actions such as deletion. Ordinary disconnect and stop-query actions do not automatically become solid red buttons because they stop something.
223230
- Loading states prevent duplicate submission and keep readable labels. Provide cancellation for cancellable long tasks rather than disabling the entire panel.

‎src/assets/index.css‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,20 @@
9292
--syntax-comment: 112.50 7.55% 58.43%;
9393
}
9494

95+
:root {
96+
/* Type scale (see DESIGN.md Typography). text-caption / text-body map to
97+
--font-size-caption / --font-size-body via uno.config.ts; the other sizes
98+
reuse the default utilities text-xs (12) / text-sm (14) / text-base (16) /
99+
text-xl (20). Business components must use these variables or utilities
100+
instead of bare px/rem font sizes. */
101+
--font-size-caption: 11px;
102+
--font-size-dense: 12px;
103+
--font-size-body: 13px;
104+
--font-size-form: 14px;
105+
--font-size-title: 16px;
106+
--font-size-page-title: 20px;
107+
}
108+
95109
* {
96110
border-color: hsl(var(--border));
97111
}
@@ -107,7 +121,7 @@ body,
107121
body {
108122
background-color: hsl(var(--background));
109123
color: hsl(var(--foreground));
110-
font-size: 14px;
124+
font-size: var(--font-size-form);
111125
}
112126

113127
[data-tauri-drag-region] {

‎src/components/DeviceReplaceDialog.vue‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ function handleOpenChange(open: boolean) {
152152
}
153153
154154
.slot-usage {
155-
font-size: 13px;
155+
font-size: var(--font-size-body);
156156
color: hsl(var(--muted-foreground));
157157
margin-bottom: 12px;
158158
}
@@ -204,26 +204,26 @@ function handleOpenChange(open: boolean) {
204204
205205
.device-name {
206206
font-weight: 500;
207-
font-size: 14px;
207+
font-size: var(--font-size-form);
208208
overflow: hidden;
209209
text-overflow: ellipsis;
210210
white-space: nowrap;
211211
}
212212
213213
.current-tag {
214-
font-size: 12px;
214+
font-size: var(--font-size-dense);
215215
color: hsl(var(--muted-foreground));
216216
font-weight: 400;
217217
}
218218
219219
.device-info {
220-
font-size: 12px;
220+
font-size: var(--font-size-dense);
221221
color: hsl(var(--muted-foreground));
222222
margin-top: 2px;
223223
}
224224
225225
.replace-error {
226-
font-size: 13px;
226+
font-size: var(--font-size-body);
227227
color: hsl(var(--destructive-text));
228228
margin-top: 8px;
229229
}

‎src/components/SQLEditor.vue‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,11 @@ defineExpose({ getValue, setValue, handleFormat })
313313
gap: 16px;
314314
padding: 6px 12px;
315315
cursor: pointer;
316-
font-size: 13px;
316+
font-size: var(--font-size-body);
317317
}
318318
319319
.sql-context-menu li .shortcut {
320-
font-size: 11px;
320+
font-size: var(--font-size-dense);
321321
opacity: 0.5;
322322
white-space: nowrap;
323323
}

‎src/components/UpdateNotification.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const buttonsDisabled = computed(() =>
7878
</div>
7979

8080
<div class="flex-1 min-w-0">
81-
<div class="text-[16px] text-foreground font-bold mb-0.5">
81+
<div class="text-base text-foreground font-bold mb-0.5">
8282
{{ t('updater.updateAvailable') }}
8383
</div>
8484
<div class="text-sm text-muted-foreground">

‎src/components/agent-message-bubble.vue‎

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ function toolVerb(toolName: string, tc: AgentToolCall): string {
534534
max-width: 85%;
535535
padding: 10px 14px;
536536
border-radius: 12px;
537-
font-size: 14px;
537+
font-size: var(--font-size-form);
538538
line-height: 1.5;
539539
}
540540
@@ -595,7 +595,7 @@ function toolVerb(toolName: string, tc: AgentToolCall): string {
595595
}
596596
597597
.iteration-label {
598-
font-size: 10px;
598+
font-size: var(--font-size-caption);
599599
font-weight: 600;
600600
letter-spacing: 0.06em;
601601
text-transform: uppercase;
@@ -631,7 +631,7 @@ function toolVerb(toolName: string, tc: AgentToolCall): string {
631631
}
632632
633633
.activity-label {
634-
font-size: 13px;
634+
font-size: var(--font-size-body);
635635
color: hsl(var(--muted-foreground));
636636
white-space: nowrap;
637637
overflow: hidden;
@@ -656,7 +656,7 @@ function toolVerb(toolName: string, tc: AgentToolCall): string {
656656
}
657657
658658
.duration-badge {
659-
font-size: 10.5px;
659+
font-size: var(--font-size-caption);
660660
font-weight: 500;
661661
color: hsl(var(--muted-foreground));
662662
background: hsl(var(--muted));
@@ -673,7 +673,7 @@ function toolVerb(toolName: string, tc: AgentToolCall): string {
673673
}
674674
675675
.tool-name-badge {
676-
font-size: 11.5px;
676+
font-size: var(--font-size-dense);
677677
font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, monospace;
678678
color: hsl(var(--foreground) / 0.75);
679679
background: hsl(var(--muted));
@@ -688,7 +688,7 @@ function toolVerb(toolName: string, tc: AgentToolCall): string {
688688
}
689689
690690
.tool-verb-label {
691-
font-size: 12px;
691+
font-size: var(--font-size-dense);
692692
color: hsl(var(--muted-foreground));
693693
}
694694
@@ -719,7 +719,7 @@ function toolVerb(toolName: string, tc: AgentToolCall): string {
719719
}
720720
721721
.result-preview {
722-
font-size: 11.5px;
722+
font-size: var(--font-size-dense);
723723
color: hsl(var(--muted-foreground));
724724
white-space: nowrap;
725725
overflow: hidden;
@@ -748,7 +748,7 @@ function toolVerb(toolName: string, tc: AgentToolCall): string {
748748
.tool-result-pre {
749749
margin: 0;
750750
font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, monospace;
751-
font-size: 11px;
751+
font-size: var(--font-size-dense);
752752
line-height: 1.5;
753753
white-space: pre-wrap;
754754
word-break: break-all;
@@ -777,7 +777,7 @@ function toolVerb(toolName: string, tc: AgentToolCall): string {
777777
border-radius: 6px;
778778
background: hsl(var(--destructive-muted));
779779
color: hsl(var(--destructive-text));
780-
font-size: 13px;
780+
font-size: var(--font-size-body);
781781
overflow-wrap: anywhere;
782782
}
783783
@@ -802,7 +802,7 @@ details[open] .activity-chevron {
802802
.activity-body {
803803
margin: 0 0 4px 42px;
804804
padding: 6px 10px;
805-
font-size: 11.5px;
805+
font-size: var(--font-size-dense);
806806
line-height: 1.6;
807807
color: hsl(var(--muted-foreground));
808808
background: hsl(var(--muted) / 0.5);
@@ -859,7 +859,7 @@ details[open] .activity-chevron {
859859
860860
.activity-inline-content {
861861
padding: 4px 0 4px 20px;
862-
font-size: 13.5px;
862+
font-size: var(--font-size-body);
863863
line-height: 1.55;
864864
color: hsl(var(--foreground));
865865
}
@@ -881,7 +881,7 @@ details[open] .activity-chevron {
881881
}
882882
883883
.markdown-body :deep(pre code) {
884-
font-size: 12px;
884+
font-size: var(--font-size-dense);
885885
background: none;
886886
padding: 0;
887887
border: none;
@@ -892,7 +892,7 @@ details[open] .activity-chevron {
892892
border-collapse: collapse;
893893
width: 100%;
894894
margin: 8px 0;
895-
font-size: 12px;
895+
font-size: var(--font-size-dense);
896896
}
897897
898898
.markdown-body :deep(th),
@@ -926,38 +926,38 @@ details[open] .activity-chevron {
926926
}
927927
928928
.markdown-body :deep(h1) {
929-
font-size: 22px;
929+
font-size: var(--font-size-page-title);
930930
margin-top: 24px;
931931
margin-bottom: 12px;
932932
border-bottom: 1px solid hsl(var(--border));
933933
padding-bottom: 6px;
934934
}
935935
936936
.markdown-body :deep(h2) {
937-
font-size: 18px;
937+
font-size: var(--font-size-title);
938938
margin-top: 20px;
939939
margin-bottom: 10px;
940940
border-bottom: 1px solid hsl(var(--border));
941941
padding-bottom: 4px;
942942
}
943943
944944
.markdown-body :deep(h3) {
945-
font-size: 16px;
945+
font-size: var(--font-size-form);
946946
margin-top: 18px;
947947
}
948948
949949
.markdown-body :deep(h4) {
950-
font-size: 15px;
950+
font-size: var(--font-size-body);
951951
margin-top: 16px;
952952
}
953953
954954
.markdown-body :deep(h5) {
955-
font-size: 14px;
955+
font-size: var(--font-size-dense);
956956
margin-top: 14px;
957957
}
958958
959959
.markdown-body :deep(h6) {
960-
font-size: 13px;
960+
font-size: var(--font-size-caption);
961961
margin-top: 14px;
962962
color: hsl(var(--muted-foreground));
963963
}
@@ -1054,7 +1054,7 @@ details[open] .activity-chevron {
10541054
border: 1px solid hsl(var(--border) / 0.5);
10551055
border-radius: 8px;
10561056
max-width: fit-content;
1057-
font-size: 11.5px;
1057+
font-size: var(--font-size-dense);
10581058
color: hsl(var(--muted-foreground));
10591059
}
10601060
@@ -1075,7 +1075,7 @@ details[open] .activity-chevron {
10751075
align-items: center;
10761076
gap: 4px;
10771077
font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, monospace;
1078-
font-size: 11px;
1078+
font-size: var(--font-size-dense);
10791079
color: hsl(var(--foreground) / 0.75);
10801080
padding: 1px 8px;
10811081
background: hsl(var(--background));
@@ -1104,7 +1104,7 @@ details[open] .activity-chevron {
11041104
background: none;
11051105
border: none;
11061106
cursor: pointer;
1107-
font-size: 11px;
1107+
font-size: var(--font-size-dense);
11081108
color: hsl(var(--muted-foreground));
11091109
padding: 0;
11101110
margin-left: 4px;
@@ -1125,7 +1125,7 @@ details[open] .activity-chevron {
11251125
padding: 8px 12px;
11261126
background: hsl(var(--muted) / 0.4);
11271127
border-radius: 8px;
1128-
font-size: 12px;
1128+
font-size: var(--font-size-dense);
11291129
line-height: 1.55;
11301130
color: hsl(var(--foreground) / 0.85);
11311131
max-height: 240px;

‎src/components/chat-panel.vue‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ onBeforeUnmount(() => {
315315
<span class="i-carbon-pause-filled shrink-0 h-4 w-4" style="color: hsl(38 92% 50%);" />
316316
<div class="flex flex-col gap-0.5">
317317
<span class="text-xs font-medium">{{ stopMessage }}</span>
318-
<span class="text-[11px] text-muted-foreground">{{ t('dataStudio.agent.continueHint') }}</span>
318+
<span class="text-caption text-muted-foreground">{{ t('dataStudio.agent.continueHint') }}</span>
319319
</div>
320320
</div>
321321
<div class="flex shrink-0 gap-1.5">
@@ -455,7 +455,7 @@ onBeforeUnmount(() => {
455455
outline: none;
456456
background: transparent;
457457
color: hsl(var(--foreground));
458-
font-size: 13px;
458+
font-size: var(--font-size-body);
459459
resize: none;
460460
line-height: 1.5;
461461
}
@@ -550,13 +550,13 @@ onBeforeUnmount(() => {
550550
}
551551
552552
.loop-stopped-banner__message {
553-
font-size: 13px;
553+
font-size: var(--font-size-body);
554554
font-weight: 500;
555555
line-height: 1.4;
556556
}
557557
558558
.loop-stopped-banner__hint {
559-
font-size: 12px;
559+
font-size: var(--font-size-dense);
560560
color: hsl(var(--muted-foreground));
561561
line-height: 1.4;
562562
}
@@ -570,7 +570,7 @@ onBeforeUnmount(() => {
570570
571571
.loop-stopped-banner__action {
572572
padding: 4px 10px;
573-
font-size: 12px;
573+
font-size: var(--font-size-dense);
574574
font-weight: 600;
575575
border-radius: 6px;
576576
cursor: pointer;

0 commit comments

Comments
 (0)