Skip to content
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

Merged
merged 7 commits into from
Aug 29, 2024

Conversation

YumoImer
Copy link
Collaborator

@YumoImer YumoImer commented Aug 26, 2024

本 PR 主要修复:使用 antd/esantd/lib 包时,引用的 ThemeContext 实例不一致,导致主题 token 无法按预期工作

Summary by CodeRabbit

  • 新功能

    • 引入了自定义的 useToken 钩子,以改善主题管理,便于访问主题令牌和 CSS 变量。
  • 改进

    • 更新到最新版本的 Ant Design 库,可能增强了 UI 组件和样式。
    • 通过添加额外的类型来增强模块导出,以提高类型安全性和可用性。
    • 通过添加 calc 方法改进了动态样式的 CSS 属性计算。
  • 重构

    • 精简了主题管理流程,减少对外部库导入的依赖,集中访问令牌。
    • 更新设计令牌的上下文使用,以确保与新主题结构的兼容性。
  • 其他

    • 更新了 .gitignore 文件,添加了对新文件和目录的忽略规则,以优化版本控制管理。

@YumoImer YumoImer requested a review from a team August 26, 2024 09:34
Copy link

github-actions bot commented Aug 26, 2024

Preview is ready

Copy link
Contributor

coderabbitai bot commented Aug 26, 2024

Walkthrough

Walkthrough

最近的更改涉及对 .gitignore 文件的更新,添加了新的文件和目录以排除在版本控制之外。此外,现有的条目保持不变,确保管理版本控制时不会跟踪与构建工件或文档相关的文件。这些修改增强了对项目文件的管理。

Changes

Files Change Summary
.gitignore 添加了“Docs templates”作为注释,并指定了额外的文件和目录以被 Git 忽略,包括 components/version/token.jsoncomponents/version/token-meta.jsonreport.html

Sequence Diagram(s)

sequenceDiagram
    participant Git
    participant ProjectFiles

    Git->>ProjectFiles: 检查文件
    ProjectFiles-->>Git: 返回被忽略的文件
    Git->>ProjectFiles: 更新版本控制状态
Loading

🐰 在草地上,我欢快地跳跃,
新的文件被忽略,真是太妙!
版本控制更清晰,管理更简单,
文档与构建,轻松不烦恼。
更新如此欢快,大家一起欢呼,
万岁新变化,真是太酷! 🥕✨


Note

Summarized by CodeRabbit Free

Your 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.

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

cloudflare-workers-and-pages bot commented Aug 26, 2024

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7838581
Status: ✅  Deploy successful!
Preview URL: https://3502722d.x-73x.pages.dev
Branch Preview URL: https://fix-import-antd.x-73x.pages.dev

View logs

Copy link

codecov bot commented Aug 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.94%. Comparing base (3bb49d7) to head (146e0d6).

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.
📢 Have feedback on the report? Share it here.

@@ -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();
Copy link
Member

Choose a reason for hiding this comment

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

这里为什么要把命名反过来,token 指的是开发应该直接在代码里用的,有可能是 cssvar,realToken 指的是纯数值。
如果这个语义有歧义感觉可以换一个更好的命名方法

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这里之前赋值其实是反的,所以改过来了。

PS:有可能迁移antd 样式工具的时候就搞乱了,这块我再整理下

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image

看了下,之前迁移的代码应该也写错了,感觉后续调整下 cssinjs-utils 来解决

zombieJ and others added 3 commits August 28, 2024 16:13
* 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
@YumoImer YumoImer merged commit da8afa7 into main Aug 29, 2024
10 of 11 checks passed
@YumoImer YumoImer deleted the fix/import-antd branch August 29, 2024 08:10
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.

3 participants