Skip to content

fix(sheet): define variant-only colors, pick color schemes by name and check token names - #698

Merged
owjs3901 merged 1 commit into
mainfrom
fix/theme-output
Sep 30, 2026
Merged

owjs3901 merged 1 commit into
mainfrom
fix/theme-output

Conversation

@owjs3901

Copy link
Copy Markdown
Contributor

전수조사 #682의 작업 묶음 E(#685) 중 theme 출력 부분을 해결합니다: CSS-03, CSS-04, CSS-05, CSS-06, CSS-07, 그리고 조사 후 새로 찾은 버그 2건.

문제

  • CSS-03: 기본 theme에 없는 색 token이 그 theme에도 정의되지 않았습니다. 타입은 있는데 CSS 변수가 없는 상태였습니다.
  • CSS-04: default가 아닌 theme은 이름과 상관없이 모두 color-scheme:dark였습니다. blue theme을 켜면 폼과 스크롤바까지 어두워졌습니다.
  • CSS-05: a-b와 a.b처럼 같은 CSS 변수가 되는 token이 조용히 하나로 합쳐졌습니다.
  • CSS-06: ${bad}나 a b처럼 브라우저가 버리는 token 이름을 그대로 출력했습니다.
  • CSS-07: 문서에 있는 typography의 fontStyle, textTransform이 무시되었습니다. bindings 테스트 데이터의 fontStyle: "normal"도 버려지고 있었습니다.
  • 새로 찾은 버그
    • $text-primary처럼 대시가 들어간 token이 var(--text)-primary로 깨졌습니다.
    • 점이 들어간 length/shadow 이름은 --len.only로 선언되는데 참조는 var(--len-only)여서 어긋났습니다.

변경

  • 다크 판정: 이름이 dark인 theme만 다크로 봅니다. 다른 이름은 devup.json의 새 설정 theme.colorScheme({ "midnight": "dark" })으로 지정합니다.
  • light-dark() 사용 조건: "라이트 기본 + 다크 theme 하나"일 때만 씁니다. 그 밖의 조합은 theme별로 다른 값과 그 theme에만 있는 token을 출력합니다. 기존에 가장 흔한 default + dark 조합의 출력은 그대로입니다.
  • token 이름 검사
    • 등록할 때 이름이 $token 문법으로 참조 가능한지 확인합니다. 문법은 영숫자나 _로 시작하고 영숫자, -, _, .만 씁니다.
    • 한 theme 안에서 두 token이 같은 CSS 변수가 되는지도 확인합니다.
    • 문제가 있으면 theme.colors.<variant>: ...처럼 위치를 붙여 registerTheme 오류로 알립니다.
  • theme 이름 인용: CSS 식별자가 아닌 이름은 [data-theme="high contrast"]처럼 따옴표로 감쌉니다.
  • typography: fontStyle과 textTransform을 출력합니다(반응형 포함).
  • VAR_RE: \$\w[\w.-]*로 바꿔 대시 token을 참조할 수 있게 했습니다. $-는 기존대로 token이 아닙니다.
  • 점 표기 length/shadow: 이름의 점을 대시로 바꿔 선언합니다(색과 같은 규칙).
  • 변수 순서: 색 map을 std HashMap에서 BTreeMap으로 바꿨습니다. native에서 실행마다 달라질 수 있던 변수 순서가 고정됩니다.
  • TS DevupTheme에 colorScheme, breakpoints, textTransform을 추가하고, colors 문서와 Patch changepack을 갱신했습니다.

새로 생기는 오류

  • registerTheme: 참조할 수 없는 token 이름, 그리고 한 theme 안에서 같은 CSS 변수가 되는 두 token
  • 오류 메시지에 theme 경로와 해결 방법(이름 규칙 또는 둘 중 하나의 이름 변경)이 들어갑니다.

검증

  • cargo clippy --workspace --all-targets -D warnings, cargo test --workspace 통과
  • 새 테스트: color scheme, theme에만 있는 token, 인용, 이름 검사, 점 표기 length/shadow, typography, 대시 token
  • WASM을 다시 빌드해 bun test 5474개 통과(커버리지 100%)
  • 실제 WASM 확인
    • 조사 재현 theme 3종: blue와 solarized는 라이트, theme에만 있는 token이 정의됨, font-style과 text-transform 출력
    • 잘못된 이름은 경로가 붙은 오류로 보고됨
    • $text-primary는 var(--text-primary)로, 점 표기 length는 --len-only로 선언과 참조가 일치함

…d check token names

A color only one variant defines was never emitted, every non-default variant forced color-scheme:dark, typography dropped fontStyle and textTransform, $tokens with dashes broke into var(--text)-primary, dotted length and shadow names were declared with dots but referenced with dashes, and colliding or unreachable token names silently produced CSS the browser drops. Refs #685.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@github-actions

Copy link
Copy Markdown
Contributor

Changepacks

@devup-ui/wasm@1.0.82 → 1.0.83 - bindings/devup-ui-wasm/package.json

Patch

  • Theme CSS: a color only one variant defines is defined in that variant; a variant renders dark only when it is named dark or listed as dark in the new theme.colorScheme, others light, and light-dark() only encodes a light default with one dark variant; theme names that are not CSS identifiers are quoted in [data-theme]; typography emits fontStyle and textTransform; color variables come out in a fixed order. $tokens with dashes (text-primary) resolve instead of breaking into var(--text)-primary, and dotted length and shadow names are declared with dashes like their references. registerTheme reports, with the theme path, a token name the $token syntax cannot reach and two tokens of a variant that become the same CSS variable (a-b and a.b)

@devup-ui/bun-plugin@1.0.21 → 1.0.22 - packages/bun-plugin/package.json

Patch

  • Auto-update: depends on '@devup-ui/plugin-utils' via a local workspace dependency

@devup-ui/components@0.1.59 → 0.1.60 - packages/components/package.json

Patch

  • Auto-update: depends on '@devup-ui/vite-plugin' via a local workspace dependency

@devup-ui/next-plugin@1.0.89 → 1.0.90 - packages/next-plugin/package.json

Patch

  • Auto-update: depends on '@devup-ui/plugin-utils' via a local workspace dependency

@devup-ui/plugin-utils@1.0.16 → 1.0.17 - packages/plugin-utils/package.json

Patch

  • Theme CSS: a color only one variant defines is defined in that variant; a variant renders dark only when it is named dark or listed as dark in the new theme.colorScheme, others light, and light-dark() only encodes a light default with one dark variant; theme names that are not CSS identifiers are quoted in [data-theme]; typography emits fontStyle and textTransform; color variables come out in a fixed order. $tokens with dashes (text-primary) resolve instead of breaking into var(--text)-primary, and dotted length and shadow names are declared with dashes like their references. registerTheme reports, with the theme path, a token name the $token syntax cannot reach and two tokens of a variant that become the same CSS variable (a-b and a.b)

@devup-ui/rsbuild-plugin@1.0.66 → 1.0.67 - packages/rsbuild-plugin/package.json

Patch

  • Auto-update: depends on '@devup-ui/plugin-utils' via a local workspace dependency

@devup-ui/vite-plugin@1.0.72 → 1.0.73 - packages/vite-plugin/package.json

Patch

  • Auto-update: depends on '@devup-ui/plugin-utils' via a local workspace dependency

@devup-ui/webpack-plugin@1.0.70 → 1.0.71 - packages/webpack-plugin/package.json

Patch

  • Auto-update: depends on '@devup-ui/plugin-utils' via a local workspace dependency

@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
libs/sheet/src/lib.rs 100.00% <ø> (ø)
libs/sheet/src/theme.rs 100.00% <100.00%> (ø)
packages/plugin-utils/src/types.ts 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@owjs3901
owjs3901 merged commit 7c3ad4d into main Sep 30, 2026
4 checks passed
@owjs3901
owjs3901 deleted the fix/theme-output branch September 30, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant