Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kimteayon
Copy link
Collaborator

@kimteayon kimteayon commented Dec 4, 2025

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

  • Describe the source of related requirements, such as links to relevant issue discussions.
  • For example: close #xxxx, fix #xxxx

💡 Background and Solution

  • The specific problem to be addressed.
  • List the final API implementation and usage if needed.
  • If there are UI/interaction changes, consider providing screenshots or GIFs.

📝 Change Log

Language Changelog
🇺🇸 English
🇨🇳 Chinese 修复 bubble typing token 配置无效问题

Summary by CodeRabbit

发布说明

  • 新功能

    • 气泡组件新增“自定义打字(typing with 💖)”效果选项
    • 支持通过主题为打字效果指定自定义内容(示例为 💖)
  • 改进

    • 打字动画在不同效果间行为更一致,保留间隔、步长与前缀
    • 打字光标默认样式调整为包含引号的呈现
    • 在新效果下页脚和交互行为保持可用并保留原有事件日志记录

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

📝 Walkthrough

Walkthrough

为 Bubble 添加可配置的打字光标:在演示中新增 custom-typing 效果并条件性使用 XProvider 将主题中 Bubble.typingContent 设置为 "💖";样式从 token 解构并使用该值作为打字光标内容,默认值更新为包含引号的字符串。

Changes

Cohort / File(s) Summary
演示与主题集成
packages/x/components/bubble/demo/animation.tsx
引入 XProvider,在状态中新增 custom-typing 并增加对应单选项;当选中 custom-typing 时用 XProvider 包裹 Bubble 并通过 theme 设置 Bubble.typingContent = "💖";footer/Actions 在 provider 内渲染;保留并使用现有的 onTyping / onTypingComplete 回调;调整打字效果映射(fade-in 保持,其他均使用 typing)。
样式实现
packages/x/components/bubble/style/bubble.ts
从 token 解构 typingContent 并将伪元素(最后一个子元素的 typing 光标)内容由静态字符替换为 typingContent
样式配置 / 默认值
packages/x/components/bubble/style/index.ts
更新 typingContent 的默认值,从单个管道符 (`

Sequence Diagram(s)

sequenceDiagram
    participant Demo as Demo (animation.tsx)
    participant Provider as XProvider (theme)
    participant Bubble as Bubble component
    participant Styles as CSS / Token layer

    Demo->>Demo: 选择效果(e.g., "custom-typing")
    alt effect == custom-typing
        Demo->>Provider: 用 theme 包裹 Bubble({ Bubble: { typingContent: "💖" } })
        Provider->>Bubble: 提供主题 token(含 typingContent)
    else other effect
        Demo->>Bubble: 直接渲染 Bubble(无自定义 typingContent)
    end
    Bubble->>Styles: 读取 token.typingContent
    Styles-->>Bubble: 将伪元素 content 设置为 token.typingContent
    Bubble->>Demo: 渲染带/不带自定义光标的打字动画
    Demo->>Demo: footer/Actions 在 provider 内(若包裹)渲染并触发 onTyping / onTypingComplete
Loading

预计代码审查工作量

🎯 2 (简单) | ⏱️ ~10 分钟

  • 检查 animation.tsxXProvider 的条件包裹与 theme 传递逻辑。
  • 验证 typingContent 在样式中正确解构、转义并用于伪元素 content。
  • 确认打字效果映射与现有事件回调行为未被破坏。

🐰✨ 光标藏着小心意,💖

主题一披就会笑,
字句跳着碎步来,
屏幕里撒满爱意,
我在代码里翻跟头。

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确反映了主要变更内容:修复 bubble 组件中 typing token 配置失效的问题,与代码变更完全对应。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bubbletype

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a06b5cb and 4648c20.

📒 Files selected for processing (1)
  • packages/x/components/bubble/demo/animation.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/x/components/bubble/demo/animation.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: test
  • GitHub Check: build preview
  • GitHub Check: size
  • GitHub Check: Cloudflare Pages
  • GitHub Check: test

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.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

Preview is ready

@dosubot dosubot bot added the bug Something isn't working label Dec 4, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kimteayon, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where the Bubble component's typing token for the cursor was not effectively customizable. It introduces a mechanism to allow users to define the content of the typing cursor via a typingContent token, enhancing the component's flexibility. The changes also ensure consistent application of the bubble-typing CSS class and update the demo to illustrate this new customization capability.

Highlights

  • Typing Cursor Customization: The typing cursor within the Bubble component can now be customized using a typingContent token, allowing for flexible visual representations.
  • Demo Enhancement: The animation demo for the Bubble component has been updated to include an example of how to customize the typing cursor, specifically demonstrating the use of a heart emoji.
  • Consistent CSS Class Application: The bubble-typing CSS class is now consistently applied to the TypingContent component, ensuring proper styling regardless of the animation state.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 4, 2025

Deploying ant-design-x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4648c20
Status: ✅  Deploy successful!
Preview URL: https://b2ea764a.ant-design-x.pages.dev
Branch Preview URL: https://bubbletype.ant-design-x.pages.dev

View logs

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an issue with an invalid bubble typing token. The primary fix correctly formats the CSS content property for the typing cursor as a valid string. The changes also involve utilizing this token within the bubble's styling and adding a demonstration to verify the token override. My review has pinpointed an issue in TypingContent.tsx where a class is being applied unconditionally, which results in the typing cursor showing up incorrectly during the fade-in animation. I have provided a suggestion to conditionally apply the class to resolve this.

I am having trouble creating individual review comments. Click here to see my feedback.

packages/x/components/bubble/TypingContent.tsx (37)

high

Using true here causes the ${prefixCls}-typing class to be applied unconditionally. This leads to the typing cursor being displayed even when the fade-in effect is active, which is not the intended behavior. To ensure the typing cursor only appears for the 'typing' effect, this condition should be changed to isTyping. This change will ensure that the typing and fade-in classes are mutually exclusive, depending on the selected animation effect.

        [`${prefixCls}-typing`]: isTyping,

Copy link
Contributor

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbb72c9 and ab2054c.

📒 Files selected for processing (3)
  • packages/x/components/bubble/demo/animation.tsx (4 hunks)
  • packages/x/components/bubble/style/bubble.ts (2 hunks)
  • packages/x/components/bubble/style/index.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: afc163
Repo: ant-design/x PR: 0
File: :0-0
Timestamp: 2025-04-11T14:47:09.527Z
Learning: 当评审 ant-design/x 仓库中的 PR 时,需要用中文回复中文评论。该项目的文档支持中英双语。
Learnt from: afc163
Repo: ant-design/x PR: 0
File: :0-0
Timestamp: 2025-04-11T14:47:09.527Z
Learning: 当评审 ant-design/x 仓库中的 PR 时,需要用中文回复中文评论。该项目的文档支持中英双语。
📚 Learning: 2025-01-27T09:36:11.490Z
Learnt from: YumoImer
Repo: ant-design/x PR: 479
File: components/bubble/demo/debug-list.tsx:39-57
Timestamp: 2025-01-27T09:36:11.490Z
Learning: In the Bubble.List debug demo component, the different typing behavior between pushBubble (sets typing: true) and unshiftBubble (no typing property) operations is intentional to facilitate testing different scenarios.

Applied to files:

  • packages/x/components/bubble/demo/animation.tsx
  • packages/x/components/bubble/style/bubble.ts
  • packages/x/components/bubble/style/index.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build preview
  • GitHub Check: size
  • GitHub Check: test
  • GitHub Check: Cloudflare Pages
  • GitHub Check: test
🔇 Additional comments (4)
packages/x/components/bubble/style/index.ts (1)

11-15: 修复正确:CSS content 属性需要带引号的字符串。

typingContent 默认值设为 '"|"' 是正确的做法。因为在 CSS 中,content 属性需要带引号的字符串值(如 content: "|"),所以 token 值本身必须包含这些引号。

packages/x/components/bubble/style/bubble.ts (2)

45-56: 核心修复:正确从 token 中解构并使用 typingContent

typingContent 从 token 中解构出来,这是修复的关键步骤,使得 token 配置能够真正生效。


93-103: typing 光标样式配置正确。

使用 token 中的 typingContent 替代之前可能硬编码的值,使得用户可以通过 theme 配置自定义打字光标内容。

packages/x/components/bubble/demo/animation.tsx (1)

62-91: XProvider 集成和自定义 typing 内容演示实现正确。

通过 XProvider 的 theme 配置来覆盖 Bubble.typingContent,很好地展示了 token 配置的使用方式。条件逻辑清晰:当选择 custom-typing 时应用自定义心形光标,否则使用默认配置。

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

size-limit report 📦

Path Size
packages/x/dist/antdx.min.js 55.29 KB (+2 B 🔺)
packages/x-sdk/dist/x-sdk.min.js 7.3 KB
packages/x-markdown/dist/x-markdown.min.js 50.72 KB
packages/x-markdown/dist/plugins/code-high-light.min.js 313.54 KB
packages/x-markdown/dist/plugins/latex.min.js 61.95 KB
packages/x-markdown/dist/plugins/mermaid.min.js 882.78 KB

Copy link
Contributor

@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: 0

♻️ Duplicate comments (1)
packages/x/components/bubble/demo/animation.tsx (1)

78-82: typing.effect 映射可简化为直接复用状态值

当前写法:

effect: effect === 'fade-in' ? 'fade-in' : 'typing',

与下面这句是等价的,可以稍微精简一点:

effect: effect === 'fade-in' ? effect : 'typing',

属于纯样式/可读性优化,按需采纳即可。

🧹 Nitpick comments (1)
packages/x/components/bubble/demo/animation.tsx (1)

62-73: 确认 typingContent 的引号语义以及避免覆盖上层 Bubble 组件主题

这里的主题配置:

Bubble:
  effect === 'custom-typing'
    ? {
        typingContent: '"💖"',
      }
    : {},

有两个点建议确认一下:

  1. typingContent 目前传的是带引号的字符串(实际值为 "💖"):

    • 如果样式层是直接把该值作为 CSS content 使用(不再自动包引号),这种写法是合理的;
    • 如果实现中已经会为 typingContent 自动包一层引号,那么这里可能会导致实际渲染出来的内容带上多余的双引号。可以结合样式实现再核对一下。
  2. effect !== 'custom-typing' 时,这里仍然传入 components: { Bubble: {} }。如果 XProvider 的 theme 合并是浅覆盖,这个空对象有可能把外层对 Bubble 的组件级主题覆盖掉。为了更稳妥,可以只在 custom-typing 时才传入 components.Bubble,其他情况直接让其继承外层:

-        <XProvider
-          theme={{
-            components: {
-              Bubble:
-                effect === 'custom-typing'
-                  ? {
-                      typingContent: '"💖"',
-                    }
-                  : {},
-            },
-          }}
-        >
+        <XProvider
+          theme={
+            effect === 'custom-typing'
+              ? {
+                  components: {
+                    Bubble: {
+                      typingContent: '"💖"',
+                    },
+                  },
+                }
+              : undefined
+          }
+        >

如果确认 XProvidertheme={undefined} 时会正常继承外层配置,这样既能避免空对象覆盖问题,也让逻辑更清晰。

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab2054c and a06b5cb.

⛔ Files ignored due to path filters (2)
  • packages/x/components/bubble/__tests__/__snapshots__/demo-extend.test.ts.snap is excluded by !**/*.snap
  • packages/x/components/bubble/__tests__/__snapshots__/demo.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • packages/x/components/bubble/demo/animation.tsx (4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: afc163
Repo: ant-design/x PR: 0
File: :0-0
Timestamp: 2025-04-11T14:47:09.527Z
Learning: 当评审 ant-design/x 仓库中的 PR 时,需要用中文回复中文评论。该项目的文档支持中英双语。
Learnt from: afc163
Repo: ant-design/x PR: 0
File: :0-0
Timestamp: 2025-04-11T14:47:09.527Z
Learning: 当评审 ant-design/x 仓库中的 PR 时,需要用中文回复中文评论。该项目的文档支持中英双语。
Learnt from: YumoImer
Repo: ant-design/x PR: 479
File: components/bubble/demo/debug-list.tsx:39-57
Timestamp: 2025-01-27T09:36:11.490Z
Learning: In the Bubble.List debug demo component, the different typing behavior between pushBubble (sets typing: true) and unshiftBubble (no typing property) operations is intentional to facilitate testing different scenarios.
📚 Learning: 2025-01-27T09:36:11.490Z
Learnt from: YumoImer
Repo: ant-design/x PR: 479
File: components/bubble/demo/debug-list.tsx:39-57
Timestamp: 2025-01-27T09:36:11.490Z
Learning: In the Bubble.List debug demo component, the different typing behavior between pushBubble (sets typing: true) and unshiftBubble (no typing property) operations is intentional to facilitate testing different scenarios.

Applied to files:

  • packages/x/components/bubble/demo/animation.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: size
  • GitHub Check: test
  • GitHub Check: build preview
  • GitHub Check: test
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (1)
packages/x/components/bubble/demo/animation.tsx (1)

2-2: 新增 custom-typing 效果与状态/Radio 配置整体合理

引入 XProvider、扩展 effect 的字面量联合类型,并在 Radio.Group 中同步新增 "custom-typing" 选项三处逻辑是一致的,默认值和选项值对得上,切换动画效果的状态流转看起来是正确的。建议在文档站实际切一遍三种效果,确认没有遗漏的视觉/交互差异即可。

Also applies to: 26-26, 50-53

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.24%. Comparing base (4ea80bb) to head (4648c20).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1435   +/-   ##
=======================================
  Coverage   94.24%   94.24%           
=======================================
  Files         144      144           
  Lines        3703     3703           
  Branches     1038     1037    -1     
=======================================
  Hits         3490     3490           
  Misses        211      211           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 4, 2025
@kimteayon kimteayon merged commit b2d7f52 into main Dec 4, 2025
15 checks passed
@kimteayon kimteayon deleted the bubbletype branch December 4, 2025 06:15
@codecov
Copy link

codecov bot commented Dec 4, 2025

Bundle Report

Changes will increase total bundle size by 5.0MB (120.96%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
x-markdown-array-push 9.13MB 5.0MB (120.96%) ⬆️⚠️

Affected Assets, Files, and Routes:

view changes for bundle: x-markdown-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
mermaid.js (New) 9.13MB 9.13MB 100.0% 🚀
mermaid.min.js (Deleted) -4.13MB 0 bytes -100.0% 🗑️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants