Skip to content

Commit 0583e20

Browse files
authored
improvement(emcn): let every primitive inherit the document font weight (#6291)
* improvement(emcn): let every primitive inherit the document font weight #6241 flattened the type scale by deleting the tailwind `fontWeight` override that remapped `font-medium` to 440/480. Nothing was restyled, but the utility's meaning changed: every one of ~505 call sites written when `font-medium` sat ~10 units above body snapped to a stock 500 against a body that also dropped 430 -> 400. The tab strip and table header Emir reported are two symptoms. The same PR added the "Font Weight" section to sim-styling.md declaring the end state (400 default, weight class only to step up) without migrating the codebase to it, so the rule and its violations shipped together and no gate could flag it. Removes the hardcoded weight from the ~20 pre-chip emcn primitives so they inherit 400, matching the chip family that was already correct. Deletes the three `font-normal` overrides that existed only to undo those defaults (`TabStrip`, `ChipCombobox`, `ChipModalField`) — their TSDoc said as much. `<th>` needed care in the other direction: Preflight resets h1-h6 but not `th`, so a header keeps the UA bold 700 and `font-medium` was holding it *down*. Deleting it made headers heavier. Rather than neutralize per call site — the codebase had already accumulated 12 such workarounds — globals.css completes Preflight with `th { font-weight: inherit }`, and the 8 now-dead `font-normal` workarounds come out. The rule keeps no element-level exceptions. Two width-measurement mirrors had to move with the text they measure: table-grid's auto-fit canvas and tag-input's hidden sizing span. Left stale, both would mis-measure. Also: drops an inline `font-weight:500` from the header drag ghost, normalizes `text-[13px]`/`text-[11px]` to `text-small`/`text-xs`, aligns the landing table previews that clone the product header, documents AvatarFallback's deliberate step-up, and corrects the stale AGENTS.md line claiming Button owns a weight. Verified: typecheck 0, lint clean, full vitest run identical to origin/staging across three runs (158 failed suites / 1 failed test / 16350 passing — all pre-existing: a PostCSS env error and a missing `rg` binary). * fix(tables): align the workflow-group drag ghost with the label it previews Cursor Bugbot caught the sibling of the ghost fixed in column-header-menu: this one kept an inline `font-weight:500` after the band label dropped to the inherited 400, so the drag preview no longer matched the text it represents — the same mirror drift this PR fixes for the width-measurement spans. It was drifted on size too: hardcoded `font-size:13px` against a label that is `text-xs` (11px), so it never matched. Both now come from the token the label uses, which also clears the inline fontWeight the styling rule bans. * fix(toolbar): stop the block drag preview hardcoding a weight its label does not use Third instance of the same mirror drift, found by sweeping rather than waiting for it to be reported. The toolbar item label renders at the inherited 400 (its container is `chipVariants`, which is weight-free), but the drag preview hardcoded `font-weight: 500` — so the preview never matched the item it previews, before or after this PR. Drops the weight only. The 16px is left alone: a drag preview reading larger than its source is a deliberate affordance, not a mismatch. Not fixed here, deliberately: the `font-weight: 500` in code-editor.tsx's highlight layer. That HTML is rendered in registration with a transparent textarea, so weight affects glyph advance widths and the caret alignment — it needs live in-editor verification, unlike a detached drag ghost. Its two placeholder branches already disagree on weight, so it wants its own change. * revert(canvas): drop the workflow-editor panel changes from this PR The canvas panel is under active modification elsewhere, so this PR stays out of it. Reverts the toolbar search input, the sub-block table cell and its overlay mirror, the messages-input textarea and its mirror, and the block drag preview — all back to staging verbatim. Cursor Bugbot was right about that last one and I was wrong: the preview mirrors the drag DESTINATION (its TSDoc says "looks like a workflow block", and 250px/16px are block-card dimensions), not the toolbar chip I had compared it against. workflow-block-view renders the title `font-medium text-md`, so its 500 was correct. Moot now that the file is reverted, but worth recording so the next sweep does not repeat the mistake. The globals `th` rule still covers the sub-block table header without a call-site class; the explicit font-medium there simply wins over it, exactly as staging renders today.
1 parent 402f862 commit 0583e20

33 files changed

Lines changed: 101 additions & 113 deletions

File tree

apps/sim/app/(landing)/components/landing-preview/components/landing-preview-logs/landing-preview-logs.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,7 @@ export function LandingPreviewLogs() {
236236
<thead className='border-[var(--border)] border-b'>
237237
<tr>
238238
{COL_HEADERS.map(({ key, label }) => (
239-
<th
240-
key={key}
241-
className='h-10 px-6 py-1.5 text-left align-middle font-normal text-caption'
242-
>
239+
<th key={key} className='h-10 px-6 py-1.5 text-left align-middle text-caption'>
243240
<button
244241
type='button'
245242
onClick={() => handleSort(key)}

apps/sim/app/(landing)/components/landing-preview/components/landing-preview-resource/landing-preview-resource.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,7 @@ export function LandingPreviewResource({
131131
<thead className='border-[var(--border)] border-b'>
132132
<tr>
133133
{columns.map((col) => (
134-
<th
135-
key={col.id}
136-
className='h-10 px-6 py-1.5 text-left align-middle font-normal text-caption'
137-
>
134+
<th key={col.id} className='h-10 px-6 py-1.5 text-left align-middle text-caption'>
138135
<button
139136
type='button'
140137
onClick={() => handleSortClick(col.id)}

apps/sim/app/(landing)/components/landing-preview/components/landing-preview-tables/landing-preview-tables.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ function SpreadsheetView({ tableId, tableName, onBack }: SpreadsheetViewProps) {
467467
<th key={col.id} className={CELL_HEADER}>
468468
<div className='flex h-full w-full min-w-0 items-center px-2 py-[7px]'>
469469
<Icon className='size-3 shrink-0 text-[var(--text-icon)]' />
470-
<span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap font-medium text-[var(--text-primary)] text-small'>
470+
<span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap text-[var(--text-primary)] text-small'>
471471
{col.label}
472472
</span>
473473
<ChevronDown className='ml-auto size-[14px] shrink-0 text-[var(--text-muted)]' />

apps/sim/app/(landing)/knowledge/components/knowledge-hero-loop.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export function KnowledgeHeroLoop() {
214214
{COL_HEADERS.map((header) => (
215215
<th
216216
key={header}
217-
className='h-10 px-6 py-1.5 text-left align-middle font-normal text-[var(--text-muted)] text-caption'
217+
className='h-10 px-6 py-1.5 text-left align-middle text-[var(--text-muted)] text-caption'
218218
>
219219
{header}
220220
</th>

apps/sim/app/(landing)/logs/components/logs-hero-loop.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ export function LogsHeroLoop() {
335335
{COL_HEADERS.map((label) => (
336336
<th
337337
key={label}
338-
className='h-10 px-6 py-1.5 text-left align-middle font-normal text-[var(--text-muted)] text-caption'
338+
className='h-10 px-6 py-1.5 text-left align-middle text-[var(--text-muted)] text-caption'
339339
>
340340
{label}
341341
</th>

apps/sim/app/(landing)/tables/components/tables-hero-loop.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ function TablesGridPane({ rowCount, filledCount }: TablesGridPaneProps) {
316316
<th key={column.id} className={CELL_HEADER}>
317317
<div className='flex h-full w-full min-w-0 items-center px-2 py-[7px]'>
318318
<Icon className='size-3 shrink-0 text-[var(--text-icon)]' />
319-
<span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap font-medium text-[var(--text-primary)] text-small'>
319+
<span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap text-[var(--text-primary)] text-small'>
320320
{column.label}
321321
</span>
322322
<ChevronDown className='ml-auto size-[14px] shrink-0 text-[var(--text-muted)]' />

apps/sim/app/_styles/globals.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,15 @@ html.sidebar-booting .sidebar-shell-inner {
658658
letter-spacing: 0.28px;
659659
}
660660

661+
/* Completes Preflight, which resets h1-h6 to `inherit` but leaves `th` at the
662+
UA `bold`. Without this a table header, and every label, input, and button
663+
inside it, silently renders at 700 — so `font-medium` on a header reads as
664+
a step DOWN, and removing it makes the header heavier. Normalized here once
665+
rather than neutralized at each `<th>`. */
666+
th {
667+
font-weight: inherit;
668+
}
669+
661670
/* Ensure visible text caret across inputs and editors */
662671
input,
663672
textarea,

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/new-column-dropdown/new-column-dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function NewColumnDropdown({
7171
onClick={blocked ? onBlocked : undefined}
7272
>
7373
<Plus className='size-[14px] shrink-0 text-[var(--text-icon)]' />
74-
<span className='font-medium text-[var(--text-body)] text-small'>New column</span>
74+
<span className='text-[var(--text-body)] text-small'>New column</span>
7575
</button>
7676
)
7777

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/headers/column-header-menu.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ export const ColumnHeaderMenu = React.memo(function ColumnHeaderMenu({
162162

163163
const ghost = document.createElement('div')
164164
ghost.textContent = ghostLabel
165+
ghost.className = 'text-small'
165166
ghost.style.cssText =
166-
'position:absolute;top:-9999px;padding:4px 8px;background:var(--bg);border:1px solid var(--border);border-radius:4px;font-size:13px;font-weight:500;white-space:nowrap;color:var(--text-primary)'
167+
'position:absolute;top:-9999px;padding:4px 8px;background:var(--bg);border:1px solid var(--border);border-radius:4px;white-space:nowrap;color:var(--text-primary)'
167168
document.body.appendChild(ghost)
168169
e.dataTransfer.setDragImage(ghost, ghost.offsetWidth / 2, ghost.offsetHeight / 2)
169170
requestAnimationFrame(() => ghost.parentNode?.removeChild(ghost))
@@ -284,7 +285,7 @@ export const ColumnHeaderMenu = React.memo(function ColumnHeaderMenu({
284285
if (e.key === 'Escape') onRenameCancel()
285286
}}
286287
onBlur={onRenameSubmit}
287-
className='ml-1.5 min-w-0 flex-1 border-0 bg-transparent p-0 font-medium text-[var(--text-primary)] text-small outline-none focus:outline-none focus:ring-0'
288+
className='ml-1.5 min-w-0 flex-1 border-0 bg-transparent p-0 text-[var(--text-primary)] text-small outline-none focus:outline-none focus:ring-0'
288289
/>
289290
</div>
290291
) : readOnly ? (
@@ -295,7 +296,7 @@ export const ColumnHeaderMenu = React.memo(function ColumnHeaderMenu({
295296
blockIconInfo={sourceInfo?.blockIconInfo}
296297
blockMissing={blockMissing}
297298
/>
298-
<span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap font-medium text-[13px] text-[var(--text-primary)]'>
299+
<span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap text-[var(--text-primary)] text-small'>
299300
{column.workflowGroupId ? column.headerLabel : column.name}
300301
</span>
301302
</div>
@@ -313,7 +314,7 @@ export const ColumnHeaderMenu = React.memo(function ColumnHeaderMenu({
313314
blockIconInfo={sourceInfo?.blockIconInfo}
314315
blockMissing={blockMissing}
315316
/>
316-
<span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap font-medium text-[var(--text-primary)] text-small'>
317+
<span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap text-[var(--text-primary)] text-small'>
317318
{column.workflowGroupId ? column.headerLabel : column.name}
318319
</span>
319320
</button>

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/headers/workflow-group-meta-cell.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,9 @@ export function WorkflowGroupMetaCell({
368368

369369
const ghost = document.createElement('div')
370370
ghost.textContent = name
371+
ghost.className = 'text-xs'
371372
ghost.style.cssText =
372-
'position:absolute;top:-9999px;padding:4px 8px;background:var(--bg);border:1px solid var(--border);border-radius:4px;font-size:13px;font-weight:500;white-space:nowrap;color:var(--text-primary)'
373+
'position:absolute;top:-9999px;padding:4px 8px;background:var(--bg);border:1px solid var(--border);border-radius:4px;white-space:nowrap;color:var(--text-primary)'
373374
document.body.appendChild(ghost)
374375
e.dataTransfer.setDragImage(ghost, ghost.offsetWidth / 2, ghost.offsetHeight / 2)
375376
requestAnimationFrame(() => ghost.parentNode?.removeChild(ghost))
@@ -438,9 +439,7 @@ export function WorkflowGroupMetaCell({
438439
) : (
439440
<Workflow className='size-[12px] shrink-0 text-[var(--text-icon)]' />
440441
)}
441-
<span className='min-w-0 truncate font-medium text-[11px] text-[var(--text-secondary)]'>
442-
{name}
443-
</span>
442+
<span className='min-w-0 truncate text-[var(--text-secondary)] text-xs'>{name}</span>
444443
{onRunColumn && (
445444
<DropdownMenu open={runMenuOpen} onOpenChange={setRunMenuOpen}>
446445
<DropdownMenuTrigger asChild>

0 commit comments

Comments
 (0)