-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
fix: ThemeContext instances being inconsistent when using antd es or lib package #88
Conversation
WalkthroughWalkthrough最近的更改涉及对 Changes
Sequence Diagram(s)sequenceDiagram
participant Git
participant ProjectFiles
Git->>ProjectFiles: 检查文件
ProjectFiles-->>Git: 返回被忽略的文件
Git->>ProjectFiles: 更新版本控制状态
Note Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Deploying x with Cloudflare Pages
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #88 +/- ##
=======================================
Coverage 98.93% 98.94%
=======================================
Files 26 27 +1
Lines 377 378 +1
Branches 109 107 -2
=======================================
+ Hits 373 374 +1
Misses 4 4 ☔ View full report in Codecov by Sentry. |
@@ -19,8 +19,8 @@ export const { genStyleHooks, genComponentStyleHook, genSubStyleComponent } = ge | |||
}; | |||
}, | |||
useToken: () => { | |||
const [theme, token, hashId, realToken, cssVar] = useAntdToken(); | |||
return { theme, token, hashId, realToken, cssVar }; | |||
const [theme, realToken, hashId, token, cssVar] = useInternalToken(); |
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.
这里为什么要把命名反过来,token 指的是开发应该直接在代码里用的,有可能是 cssvar,realToken 指的是纯数值。
如果这个语义有歧义感觉可以换一个更好的命名方法
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.
这里之前赋值其实是反的,所以改过来了。
PS:有可能迁移antd 样式工具的时候就搞乱了,这块我再整理下
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.
* chore: update build scripts * chore: clean up * chore: clean up eslint * chore: clean up eslint * chore: remove useless code * chore: fix lint * chore: support ts def * chore: use latest es * ci: add dekko test * chore: unique script * chore: umd * chore: external * chore: update * chore: fix lint * chore: fix lint * chore: update father * ci: adjust connect * chore: fix ci * chore: trigger ci * chore: trigger ci * chore: add legacy-peer-deps=true
本 PR 主要修复:使用
antd/es
或antd/lib
包时,引用的 ThemeContext 实例不一致,导致主题 token 无法按预期工作Summary by CodeRabbit
新功能
useToken
钩子,以改善主题管理,便于访问主题令牌和 CSS 变量。改进
calc
方法改进了动态样式的 CSS 属性计算。重构
其他
.gitignore
文件,添加了对新文件和目录的忽略规则,以优化版本控制管理。