-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add alpha
token to autocomplete suggestion of bezier-vscode
#2496
Add alpha
token to autocomplete suggestion of bezier-vscode
#2496
Conversation
🦋 Changeset detectedLatest commit: 170d739 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2496 +/- ##
=======================================
Coverage 82.27% 82.27%
=======================================
Files 143 143
Lines 2979 2979
Branches 917 917
=======================================
Hits 2451 2451
Misses 497 497
Partials 31 31 ☔ View full report in Codecov by Sentry. |
f422800
to
eefc967
Compare
'z-index': /z-index:/, | ||
} satisfies Record<TokenGroup, RegExp> | ||
} satisfies Record<Exclude<TokenGroup, 'dimension'>, RegExp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
마이너) FIXME 주석 추가해주시면 좋을 거 같습니다
packages/bezier-vscode/src/server.ts
Outdated
type TokenValue = string | number | Record<string, string | number> | ||
type TokenMap = Record<string, Record<string, TokenValue>> | ||
|
||
const assignToTokenMap = ( | ||
target: TokenMap, | ||
source: TokenMap, | ||
fn: Function = (v: TokenMap) => v | ||
) => { | ||
Object.entries(source).forEach(([category, tokenObject]) => { | ||
if (target[category] === undefined) { | ||
target[category] = {} | ||
} | ||
Object.entries(tokenObject).forEach(([name, value]) => { | ||
target[category][name] = fn(value) | ||
}) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type TokenValue = string | number | Record<string, string | number> | |
type TokenMap = Record<string, Record<string, TokenValue>> | |
const assignToTokenMap = ( | |
target: TokenMap, | |
source: TokenMap, | |
fn: Function = (v: TokenMap) => v | |
) => { | |
Object.entries(source).forEach(([category, tokenObject]) => { | |
if (target[category] === undefined) { | |
target[category] = {} | |
} | |
Object.entries(tokenObject).forEach(([name, value]) => { | |
target[category][name] = fn(value) | |
}) | |
}) | |
} | |
type TokenValue = string | number | |
type AlphaTokenValue = Record<string, TokenValue> | |
type TokenMap = Record<string, Record<string, TokenValue | AlphaTokenValue>> | |
const assignToTokenMap = ( | |
target: TokenMap, | |
source: TokenMap, | |
transformValue: (v: TokenValue | AlphaTokenValue) => TokenValue = (v) => | |
v as TokenValue | |
) => { | |
Object.entries(source).forEach(([category, tokenObject]) => { | |
if (target[category] === undefined) { | |
target[category] = {} | |
} | |
Object.entries(tokenObject).forEach(([name, value]) => { | |
target[category][name] = transformValue(value) | |
}) | |
}) |
버전 별 토큰에 alias를 적절히 붙이고, 타입 단언을 사용하더라도 의도를 더 드러내는 편이 좋을 거 같습니다!
packages/bezier-vscode/src/server.ts
Outdated
assignToTokenMap( | ||
alphaTokenMap, | ||
alphaTokens.lightTheme, | ||
(v: Record<string, string>) => v.value | ||
) | ||
assignToTokenMap( | ||
alphaTokenMap, | ||
alphaTokens.global, | ||
(v: Record<string, string>) => v.value | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assignToTokenMap( | |
alphaTokenMap, | |
alphaTokens.lightTheme, | |
(v: Record<string, string>) => v.value | |
) | |
assignToTokenMap( | |
alphaTokenMap, | |
alphaTokens.global, | |
(v: Record<string, string>) => v.value | |
) | |
assignToTokenMap( | |
alphaTokenMap, | |
alphaTokens.lightTheme, | |
(v) => (v as AlphaTokenValue).value | |
) | |
assignToTokenMap( | |
alphaTokenMap, | |
alphaTokens.global, | |
(v) => (v as AlphaTokenValue).value | |
) |
packages/bezier-vscode/src/server.ts
Outdated
'z-index': /z-index:/, | ||
} satisfies Record<TokenGroup, RegExp> | ||
// FIXME: dimension token should be supported later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dimension 토큰이 제거될 예정이라, 제거 이후 L94의 Exclude를 제거해도 된다는 식의 주석을 남기면 좋겠다는 코멘트였어요..!
2e31afa
to
170d739
Compare
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @channel.io/[email protected] ### Patch Changes - Improves the styling of the `ListItem` component based on whether it is interacted with or not. ([#2501](#2501)) by @sungik-choi ## [email protected] ### Minor Changes - Include `alpha` token for autocomplete suggestion. ([#2496](#2496)) by @yangwooseong ### Patch Changes - Fix bug where `bezier-vscode` is not running. ([#2499](#2499)) by @yangwooseong ## [email protected] ### Patch Changes - Updated dependencies - @channel.io/[email protected] Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Self Checklist
Related Issue
bezier-vscode
pacakge #2485Summary
Details
{ category: { [name]: value }
객체를 assignToTokenMap 함수를 통해 만든 다음에 딥 머지를 했습니다. 이 때 alpha token의 "dimension" category 는 바뀔 예정이라 제외했습니다.2024-11-12.10.26.31.mov
Breaking change? (Yes/No)
References