Skip to content

refactor(ui): sweep text-[10-13px] arbitrary sizes onto the mg-type-* scale#8077

Merged
JSONbored merged 1 commit into
mainfrom
type-scale-tokens-7844
Jul 24, 2026
Merged

refactor(ui): sweep text-[10-13px] arbitrary sizes onto the mg-type-* scale#8077
JSONbored merged 1 commit into
mainfrom
type-scale-tokens-7844

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Follow-up to #8053 (the caption/data type-scale tokens). Sweeps every text-[10px]/[11px]/[12px]/[13px] site across both packages onto the new .mg-type-caption/-caption-lg/-data/-data-sm utilities.

Conversion rules

  • text-[12px]mg-type-caption, text-[13px]mg-type-caption-lg — unconditional, both packages. Neither utility touches font-family, so any existing font-mono class on the same element stays valid and unaffected.
  • text-[10px]/[11px]mg-type-data-sm/mg-type-data — only where font-mono co-occurs on the same class string (the mono-context detection the issue's classification pass calls for). The now-redundant font-mono utility is dropped since the token already sets that font-family.
  • text-[10px]/[11px] without font-mono — left untouched. No token in this scale covers a sans 10/11px tier; forcing them into caption (a size up) or data/data-sm (which would wrongly switch them to mono) would both be real visual regressions. This is the issue's own "genuine exception" bucket — the warn-tier guardrail from feat(ui): author the caption/data type-scale tier (batch 1 of #7844) #8053 still flags these as a residual worklist, same convention every other token rule in this codebase already uses.

Result

  • apps/ui bare-arbitrary-text-size warnings: 1,181 → 301 (-74.5%, past the issue's ≥60% target)
  • packages/ui-kit: 52 → 44
  • text-[12px]/text-[13px] count: 0 outside documented exceptions (there are none — both sizes convert unconditionally)

Verification

  • tsc --noEmit clean in both packages
  • eslint . (full package) — 0 errors in both
  • prettier --check . clean (37 files needed a targeted --write after the sweep shortened lines enough to change wrapping — no semantic changes, pure reformat)
  • vitest run — 191 files / 1465 tests in apps/ui, 16 files / 88 tests in ui-kit, all passing
  • packages/ui-kit rebuilt (dist/index.{js,cjs,css})
  • Live preview: getComputedStyle confirms all four mg-type-* classes resolve to their intended font-size/line-height/font-family on real rendered content (a subnet detail page); visual spot-check showed no layout regression

Closes #7844

… scale

Converts every text-[12px]/[13px] site (both packages, unconditional -- the
caption/caption-lg tiers don't touch font-family, so any existing font-mono
class stays valid alongside them) and every mono-context text-[10px]/[11px]
site (detected by font-mono co-occurring on the same class string; the
redundant font-mono utility is dropped since mg-type-data/data-sm already
set that font-family) onto the four utilities #8053 authored.

Non-mono text-[10px]/[11px] sites are left untouched -- no token exists for
a sans 10/11px tier in this design system, and forcing them into caption
(12px, a size up) or data/data-sm (which would incorrectly switch them to
mono) would both be real visual regressions. These are the "genuine
exception" bucket the issue's own classification pass calls for; the
warn-tier guardrail added in #8053 continues to flag them as a residual
worklist, same convention every other token rule in this codebase uses.

Result: apps/ui's bare-arbitrary-text-size warning count drops from the
1,181 baseline to 301 (-74.5%, well past the issue's >=60% target).
ui-kit drops from 52 to 44.

Verified: tsc clean, eslint 0 errors, prettier clean, vitest green (1465
tests in apps/ui, 88 in ui-kit) in both packages; packages/ui-kit rebuilt.
Live preview: getComputedStyle confirms all four mg-type-* classes resolve
to their intended font-size/line-height/font-family on real rendered
content (a subnet detail page), and a visual spot-check showed no layout
regression.

Closes #7844
@superagent-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
metagraphed-ui aa0dd61 Commit Preview URL

Branch Preview URL
Jul 24 2026, 10:01 PM

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.68%. Comparing base (ac29181) to head (aa0dd61).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8077   +/-   ##
=======================================
  Coverage   97.68%   97.68%           
=======================================
  Files         220      220           
  Lines       27246    27246           
  Branches    10805    10805           
=======================================
  Hits        26614    26614           
  Misses        140      140           
  Partials      492      492           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit 2875721 into main Jul 24, 2026
11 checks passed
@JSONbored
JSONbored deleted the type-scale-tokens-7844 branch July 24, 2026 22:13
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix or unsolicited PR — scores a 0.05x multiplier. label Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix or unsolicited PR — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Design tokens 5/5: extend the mg-type-* scale to caption/data text (292+ sites)

1 participant