Skip to content

Commit 9f0de53

Browse files
authored
fix(design-system): drop Progress's component-scoped custom property (#664)
The Progress fill used a component-private `--ul-progress-fill` custom property, re-pointed per `data-level` to map the three bands onto existing tokens. It's the only place the design system *declares* a `--ul-*` custom property outside `:root`, which claude.ai/design's `check_design_system` flags as a mis-scoped token. Thread the per-level color through `color` / `currentColor` instead: one source of truth still feeds both the fill and the dither cap, the render is unchanged, and no custom property is declared on a component selector. Add a `.design-sync/NOTES.md` convention so future syncs don't reintroduce the pattern or "fix" the finding by hoisting to `:root` (which the per-instance value can't support).
1 parent d75ec43 commit 9f0de53

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

.design-sync/NOTES.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ restage by hand (or copy from main) in those worktrees.
6464
- `cfg.cssEntry` = `dist/uploads-ui.css` — one self-contained stylesheet carrying
6565
the `:root` token layer + `@font-face` + every `ul-` component class. No separate
6666
tokens package/glob; tokens are inline there and ship via the `styles.css` closure.
67+
- **No component-scoped custom-property *declarations* — thread per-instance
68+
color through `color`/`currentColor` instead.** claude.ai/design's
69+
`check_design_system` treats every `--*` declaration as a design token and
70+
flags any declared outside a theme scope (`:root` / `[data-theme]`). A
71+
component that needs one color knob shared across an element and its
72+
pseudo-elements (e.g. Progress's fill + dither cap) must set `color:
73+
var(--token)` on the element (overriding per `[data-*]`) and consume it as
74+
`currentColor`**not** declare a `--ul-*` custom property on a component
75+
selector. Do **not** "fix" such a finding by hoisting the property to `:root`:
76+
the value varies per instance, so hoisting breaks it. Consume-with-fallback
77+
(`var(--ul-x, 116px)`, like `--ul-files-min-height`) is also fine — it's never
78+
*declared*, so it isn't flagged.
6779
- **`@kind` token annotations are load-bearing — do not strip them.** The token
6880
declarations in `src/styles.css` / `src/tokens.css` carry trailing comments the
6981
claude.ai/design compiler reads to classify tokens: `--sans`/`--mono`/`--pixel`

packages/ui/src/styles.css

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,15 @@
503503
);
504504
}
505505
.ul-progress__fill {
506-
--ul-progress-fill: var(--muted);
506+
/* Per-level fill color rides on `color` so the bar and its dither cap share
507+
* one token without declaring a component-scoped custom property (which the
508+
* claude.ai/design token compiler would flag as a mis-scoped token). */
509+
color: var(--muted);
507510
position: relative;
508511
height: 100%;
509512
width: 0%;
510513
max-width: 100%;
511-
background: var(--ul-progress-fill);
514+
background: currentColor;
512515
}
513516
/* Solid body + 1-bit dither on the last two pixels */
514517
.ul-progress__fill::after {
@@ -519,20 +522,20 @@
519522
background-color: var(--line);
520523
background-image: linear-gradient(
521524
45deg,
522-
var(--ul-progress-fill) 25%,
525+
currentColor 25%,
523526
transparent 25% 50%,
524-
var(--ul-progress-fill) 50% 75%,
527+
currentColor 50% 75%,
525528
transparent 75%
526529
);
527530
background-size: 2px 2px;
528531
image-rendering: pixelated;
529532
pointer-events: none;
530533
}
531534
.ul-progress__fill[data-level="high"] {
532-
--ul-progress-fill: var(--body);
535+
color: var(--body);
533536
}
534537
.ul-progress__fill[data-level="full"] {
535-
--ul-progress-fill: var(--accent);
538+
color: var(--accent);
536539
}
537540

538541
/* ── GalleryTile ───────────────────────────────────────────────────────── */

0 commit comments

Comments
 (0)