feat: Component 토큰을 flat ShapeStyle/CGFloat 확장으로 노출#28
Merged
Conversation
- Tools/TokenGenerator.swift 의 Component 처리 로직을 nested enum → flat path 로 교체 · walkComponent → walkComponentFlat (pathPrefix 누적해서 camelCase 단일 이름 생성) · Component.button.primary.background.default → buttonPrimaryBackgroundDefault · Component.button.radius → buttonRadius - ShapeStyle+.swift 끝 섹션에 Component 색상 25종 추가 (Color.buttonPrimaryBackgroundDefault 등) - CGFloat+Component+.swift 신규 — Component 숫자 토큰 (buttonRadius) - 옛 ComponentToken nested enum 폐기 (ComponentToken.swift 삭제) · develop 전체에서 ComponentToken 직접 사용처가 ComponentToken.swift 외 0건 확인 후 폐기 사용 예 - .background(.buttonPrimaryBackgroundDefault) - .foregroundStyle(.buttonPrimaryTextDefault) - .clipShape(RoundedRectangle(cornerRadius: .buttonRadius))
#28 의 nested 폐기 결정을 번복. flat + nested 둘 다 유지하되, nested 가 flat 정의를 forwarding 하는 형태로 source-of-truth 를 단일화. - TokenGenerator.swift 에 walkComponentNested 추가 · 색상: public static var `default`: Color { .buttonPrimaryBackgroundDefault } · 숫자: public static var radius: CGFloat { .buttonRadius } - ComponentToken.swift 재생성 (옛 inline hex/brand alias 대신 flat 확장 참조) - 토큰 변경 시 flat 정의만 바뀌면 nested 도 자동 동기화 두 가지 사용 패턴 모두 가능 - .background(.buttonPrimaryBackgroundDefault) - .background(ComponentToken.Button.Primary.Background.default)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
`ComponentToken.Button.Primary.Background.default` 같은 중첩 enum 접근을 `Color.buttonPrimaryBackgroundDefault` 같은 flat ShapeStyle 확장으로 단순화합니다. brand/semantic 토큰과 동일한 사용 패턴.
```swift
// before
.background(ComponentToken.Button.Primary.Background.default)
// after
.background(.buttonPrimaryBackgroundDefault)
```
변경
Tools/TokenGenerator.swift
Generated 산출물
영향 범위
develop 전체에서 `ComponentToken.swift` 외 `ComponentToken` 직접 사용처 0건. 폐기에 따른 컴파일 영향 없음.
사용 예시
```swift
Text("확인")
.padding(.horizontal, .s16)
.padding(.vertical, .s8)
.background(.buttonPrimaryBackgroundDefault)
.foregroundStyle(.buttonPrimaryTextDefault)
.clipShape(RoundedRectangle(cornerRadius: .buttonRadius)) // 또는 .default
```
머지 후 흐름
이 PR 머지 후 design-tokens 의 토큰 변경 PR 이 자동으로 새 형태로 생성됩니다 (TokenGenerator.swift 가 업데이트됐으므로).