Skip to content

feat: Primitive/Radius/Dimension 토큰 추가 및 Spacing 갱신#486

Merged
knine79 merged 6 commits into
release/4.0.0from
feat/add-tokens
May 26, 2026
Merged

feat: Primitive/Radius/Dimension 토큰 추가 및 Spacing 갱신#486
knine79 merged 6 commits into
release/4.0.0from
feat/add-tokens

Conversation

@dididoeun
Copy link
Copy Markdown
Collaborator

개요

  • 이슈 링크 :

Figma "2 Typo / Grid / Number" 라이브러리 variables 정의를 SwiftUI 토큰으로 이식. 컴포넌트에 적용하는 용도의 디자인 토큰 4종(Primitive, Radius, Spacing, Dimension)을 도입합니다. 컴포넌트별 토큰 적용은 별도 브랜치에서 진행 예정.

수정사항

  • Primitive (신규, 21개): 0,1,2,4,6,8,10,12,14,16,18,20,24,32,40,48,56,64,72,80,9999
  • Radius (신규, 9개, scope CORNER_RADIUS): 0,4,8,10,12,14,16,20,24
  • Dimension (신규, 10개, scope WIDTH_HEIGHT): 14,16,18,20,24,32,40,48,56,64
  • Spacing (갱신, 19개, scope GAP): pt01~pt80s0~s80 (BREAKING — release/4.0.0 메이저 적합)
  • CGFloat/Float extension에 .primitive / .radius / .spacing / .dimension 헬퍼 추가
  • make 실행으로 documentation·MCP 데이터 동기화

미리보기

N/A (enum 토큰 — UI 컴포넌트 변경 없음. 컴포넌트 적용은 별도 PR 예정)

Figma "2 Typo / Grid / Number" variables 정의를 SwiftUI 토큰으로 이식.

- Primitive: 0,1,2,4,6,8,10,12,14,16,18,20,24,32,40,48,56,64,72,80,9999 (21개)
- Radius: 0,4,8,10,12,14,16,20,24 (9개, scope CORNER_RADIUS)
- Dimension: 14,16,18,20,24,32,40,48,56,64 (10개, scope WIDTH_HEIGHT)
- Spacing: pt01~pt80 → s0~s80 으로 Figma 정합 (BREAKING)

CGFloat/Float 확장에 .primitive/.radius/.spacing/.dimension 헬퍼 제공.
make 실행으로 documentation·MCP 데이터 동기화 포함.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dididoeun dididoeun self-assigned this May 22, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Review Change Stack

Warning

Review limit reached

@knine79, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 29 minutes and 16 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8e105270-c628-43a1-bcc7-0ec45294ecd9

📥 Commits

Reviewing files that changed from the base of the PR and between 0dd8cbf and e119ded.

📒 Files selected for processing (1)
  • scripts/build_mcp_data.js

워크스루

이 PR은 Montage 디자인 시스템의 토큰 아키텍처를 재설계합니다. 새로운 Primitive 기반 계층 위에 Dimension과 Radius 토큰을 추가하고, 기존 Spacing과 Opacity를 열거형 케이스 기반에서 정적 프로퍼티 기반으로 마이그레이션하여 토큰 접근성을 개선합니다.

변경 사항

토큰 시스템 개선

계층 / 파일 설명
Primitive 토큰 기반 계층
Sources/Montage/1 Components/9 Utilities/Primitive.swift, documentation/utilities/ios-utility-components/primitive.md
원시 스케일(080 + infinity)을 정의하는 Primitive 열거형과 CGFloat 확장 정적 프로퍼티(primitive0primitive80, primitiveInfinity)를 추가하여 상위 토큰의 기반을 제공합니다.
Dimension과 Radius 토큰 구현
Sources/Montage/1 Components/9 Utilities/Dimension.swift, Sources/Montage/1 Components/9 Utilities/Radius.swift, documentation/utilities/ios-utility-components/dimension.md, documentation/utilities/ios-utility-components/radius.md
고정 치수(dimension14dimension64) 및 모서리 반경(radius0radius24) 토큰을 Primitive 위에 구축하고, 각각의 개요, SwiftUI/UIKit 사용 예시, 네임스페이스 성격을 설명하는 가이드 문서를 작성합니다.
Opacity 토큰 마이그레이션
Sources/Montage/1 Components/9 Utilities/Opacity.swift, documentation/utilities/ios-utility-components/opacity.md
Opacity 열거형을 비활성화하고 CGFloat 확장에 opacity0~opacity100 정적 프로퍼티를 추가하여 불투명도 토큰 액세스를 개선합니다. 문서에서 예시를 정적 프로퍼티 기반으로 갱신합니다.
Spacing 토큰 마이그레이션
Sources/Montage/1 Components/9 Utilities/Spacing.swift, documentation/utilities/ios-utility-components/spacing.md
Spacing 열거형을 비활성화하고 CGFloat 확장에 spacing0~spacing80 정적 프로퍼티를 추가하여 포인트 값 기반 직접 액세스를 구현합니다. 모든 예시를 .spacingN 표기로 통일합니다.
Semantic 컬러 및 컴포넌트 업데이트
Sources/Montage/1 Components/9 Utilities/Color.swift, Sources/Montage/1 Components/4 Contents/ContentBadgeUIView.swift
Color.Semantic.resolve 메서드의 opacity 처리를 마이그레이션된 정적 프로퍼티(.opacityN)로 변경하고, 모든 Semantic 케이스의 알파 할당을 업데이트합니다. ContentBadgeUIView의 enclosureColor 계산도 동일하게 반영합니다.
CGFloat/Float 확장 메서드 문서
documentation/utilities/ios-extensions/corefoundation.md, documentation/utilities/ios-extensions/swift.md
dimension, primitive, radius 메서드 시그니처와 설명을 추가하고, spacing 메서드의 파라미터 레이블을 업데이트하며, 모든 Type Properties 문서를 보강합니다.
메타데이터 및 빌드 스크립트 업데이트
packages/montage-mcp/data/tokens.json, scripts/build_mcp_data.js, .gitignore
tokens.json에서 spacing/opacity/radius/dimension/primitive의 메타데이터를 갱신하고, build_mcp_data.js에서 새로운 토큰들을 tokens 카테고리로 라우팅하며, 빌드 로그를 .gitignore에 추가합니다.

예상 코드 리뷰 난이도

🎯 4 (복잡함) | ⏱️ ~45분

제안된 라벨

accepted, AI Review Completed

제안된 리뷰어

  • knine79
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 주요 변경 사항(Primitive/Radius/Dimension 토큰 추가 및 Spacing 갱신)을 명확하고 간결하게 요약합니다.
Description check ✅ Passed PR 설명이 변경 사항의 목적, 각 토큰의 상세 내용, BREAKING CHANGE 안내 등 관련 정보를 포함하고 있습니다.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-tokens

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dididoeun
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions github-actions Bot added the accepted This issue has been reviewed. label May 22, 2026
@knine79 knine79 added this to the 4.0.0 milestone May 22, 2026
knine79 added 4 commits May 26, 2026 17:17
- enum + static func 형태를 CGFloat static let 확장으로 교체 (예: .spacing(.s16) → .spacing16)

- Spacing/Radius/Dimension은 .primitive{N}을 참조하여 일관성 유지

- dimension28 및 primitive28 신규 추가

- primitive9999를 primitiveInfinity로 개명 (값은 .infinity)

- Float extension 제거 (CGFloat만 제공)

- DocC 페이지 식별을 위한 빈 enum placeholder 유지 (Spacing/Radius/Dimension/Primitive)

- 주석 단위 px → pt로 통일

BREAKING CHANGE: .spacing(.s16) 형태의 함수형 API 제거
- enum Opacity + static func 형태를 CGFloat static let 확장으로 교체 (예: .opacity(.p052) → .opacity52)

- 선행 0 표기 폐기: .p008 → .opacity8, .p100 → .opacity100

- Color.Semantic.resolve()를 CGFloat 직접 사용으로 마이그레이션 (.opacity() 래퍼 제거)

- ContentBadgeUIView 호출부 마이그레이션

- DocC 페이지 식별을 위한 빈 Opacity enum placeholder 유지

- Float extension 제거 (CGFloat만 제공)

BREAKING CHANGE: Opacity enum 케이스 (.p000 ~ .p100) 제거
디자이너 요청에 따라 36pt 토큰 추가.

Dimension은 .primitive36을 참조한다.
- Primitive: '원시 값 — Spacing/Radius/Dimension에 없는 값이 필요할 때만 직접 사용'

- Spacing: 'Npt의 간격' (spacing16은 '기본 간격')

- Radius: 'Npt의 모서리 반경' (radius0은 '직각')

- Dimension: 'Npt의 크기'

- Opacity: 'N%의 불투명도' (opacity0/100은 완전 투명/불투명 명시)
@github-actions github-actions Bot added in review This issue requires a review. and removed accepted This issue has been reviewed. labels May 26, 2026
@knine79
Copy link
Copy Markdown
Contributor

knine79 commented May 26, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/build_mcp_data.js (1)

296-305: 💤 Low value

seed tokens 객체에 새 토큰 타입 누락

TOKEN_NAMESradius, dimension, primitive가 추가되었지만, ensureFigmaMapping의 seed tokens 객체에는 반영되지 않았습니다. figma-mapping.json이 처음 생성될 때 일관성을 위해 추가하는 것이 좋습니다.

♻️ 제안 수정
   const seed = {
     version: 1,
     description:
       'Manual Figma component/token → Montage Swift mapping. Convention-based matching is the fallback; entries here override.',
     components: {},
-    tokens: { color: {}, typography: {}, spacing: {}, shadow: {}, opacity: {} },
+    tokens: { color: {}, typography: {}, spacing: {}, shadow: {}, opacity: {}, radius: {}, dimension: {}, primitive: {} },
   };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/build_mcp_data.js` around lines 296 - 305, The seed object created in
ensureFigmaMapping (used to write figma-mapping.json) is missing the newly added
token types; update the seed.tokens structure to include empty objects for
"radius", "dimension", and "primitive" (matching TOKEN_NAMES) so the initial
figma-mapping.json contains those keys and stays consistent with the rest of the
codebase.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Sources/Montage/1` Components/9 Utilities/Primitive.swift:
- Around line 72-73: primitiveInfinity currently exposes a non-finite CGFloat
(.infinity); change the public constant Primitive.primitiveInfinity in
Primitive.swift to a finite value matching the Figma token (use CGFloat(9999))
and update its doc comment to reflect the 9999 mapping; after making the change,
run the project make task to regenerate documentation and
THIRD_PARTY_LICENSES.md so docs stay in sync.

---

Nitpick comments:
In `@scripts/build_mcp_data.js`:
- Around line 296-305: The seed object created in ensureFigmaMapping (used to
write figma-mapping.json) is missing the newly added token types; update the
seed.tokens structure to include empty objects for "radius", "dimension", and
"primitive" (matching TOKEN_NAMES) so the initial figma-mapping.json contains
those keys and stays consistent with the rest of the codebase.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 090099fc-4f4d-4d22-9e57-cc20bcf550b0

📥 Commits

Reviewing files that changed from the base of the PR and between 562c245 and 0dd8cbf.

📒 Files selected for processing (17)
  • .gitignore
  • Sources/Montage/1 Components/4 Contents/ContentBadgeUIView.swift
  • Sources/Montage/1 Components/9 Utilities/Color.swift
  • Sources/Montage/1 Components/9 Utilities/Dimension.swift
  • Sources/Montage/1 Components/9 Utilities/Opacity.swift
  • Sources/Montage/1 Components/9 Utilities/Primitive.swift
  • Sources/Montage/1 Components/9 Utilities/Radius.swift
  • Sources/Montage/1 Components/9 Utilities/Spacing.swift
  • documentation/utilities/ios-extensions/corefoundation.md
  • documentation/utilities/ios-extensions/swift.md
  • documentation/utilities/ios-utility-components/dimension.md
  • documentation/utilities/ios-utility-components/opacity.md
  • documentation/utilities/ios-utility-components/primitive.md
  • documentation/utilities/ios-utility-components/radius.md
  • documentation/utilities/ios-utility-components/spacing.md
  • packages/montage-mcp/data/tokens.json
  • scripts/build_mcp_data.js
💤 Files with no reviewable changes (1)
  • documentation/utilities/ios-extensions/swift.md
✅ Files skipped from review due to trivial changes (1)
  • .gitignore

Comment thread Sources/Montage/1 Components/9 Utilities/Primitive.swift
@knine79 knine79 marked this pull request as ready for review May 26, 2026 10:27
@knine79 knine79 requested a review from a team as a code owner May 26, 2026 10:27
@knine79 knine79 requested review from deholic and removed request for a team May 26, 2026 10:27
@knine79 knine79 marked this pull request as draft May 26, 2026 10:28
@knine79 knine79 removed the request for review from deholic May 26, 2026 10:28
TOKEN_NAMES에는 radius/dimension/primitive를 추가했지만 ensureFigmaMapping의 seed tokens 객체에 반영되지 않아 figma-mapping.json 최초 생성 시 일관성이 깨질 수 있었음. CodeRabbit nitpick 반영.
@knine79 knine79 marked this pull request as ready for review May 26, 2026 10:42
@knine79 knine79 merged commit 1075a44 into release/4.0.0 May 26, 2026
3 checks passed
@knine79 knine79 deleted the feat/add-tokens branch May 26, 2026 10:43
@knine79 knine79 added accepted This issue has been reviewed. AI Review Completed and removed in review This issue requires a review. labels May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accepted This issue has been reviewed. AI Review Completed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants