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

feat: variable convergence(block, i18n, bridge, datasource, help, robot) #1078

Merged
merged 16 commits into from
Feb 13, 2025

Conversation

xuanlid
Copy link
Contributor

@xuanlid xuanlid commented Jan 26, 2025

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

主要修改:国际化,区块管理,资源管理,数据源,帮助与指引,AI对话框
AI对话框亮暗色保持一致,less文件中使用的是色值

a.检查每个模块插件包,用到的色值全都改成模块变量
b.检查模块变量有没有被非该模块的vue文件使用,修改非该模块的vue文件使用的变量
c.将模块变量回归到各个模块里面
d.模块变量回归模块后,再排查一遍该模块有没有直接使用--te-common的,有的话,需要转成模块变量。去保证整个链路是这样的: base/common less -> module less -> vue文件

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Style

    • Refreshed the user interface across multiple plugins by updating color schemes, borders, backgrounds, and typography for alerts, buttons, and panels.
    • Introduced new design tokens and custom properties that ensure a cohesive visual experience.
  • Chore

    • Integrated updated stylesheet dependencies, ensuring the new theming is consistently applied across the application.

Copy link
Contributor

coderabbitai bot commented Jan 26, 2025

Walkthrough

This pull request updates the styling across multiple plugins and theme files by transitioning CSS variable names from the previous --ti-... format to a new --te-... format. It adds new CSS custom properties and adjusts existing style rules—such as colors, borders, backgrounds, hover effects, and shadows—for components in the block, bridge, help, datasource, i18n, robot, and base theme modules. Several entry files now import a shared LESS stylesheet (vars.less) to incorporate these changes. No functional or control flow modifications are introduced.

Changes

Files/Group Change Summary
Block Plugin
(e.g., packages/plugins/block/index.js, src/Block*.vue, src/styles/vars.less)
Added import for ./src/styles/vars.less; updated CSS styles for components—modifying color, border, background, and hover states; renamed variables from --ti-lowcode-... to --te-block-...; removed obsolete styles in BlockPropertyList.vue.
Bridge Plugin
(e.g., packages/plugins/bridge/index.js, src/BridgeManage.vue, src/BridgeSetting.vue, src/Main.vue, src/styles/vars.less)
Added stylesheet import; modified border, text, and background colors; updated CSS variable references; added the bridge-manage class to the <plugin-panel> element; introduced new CSS custom properties for bridge management.
Help Plugin
(e.g., packages/plugins/help/index.js, src/HelpIcon.vue, src/styles/vars.less)
Added import for ./src/styles/vars.less; updated color variable references in components by replacing the prefix with --te-; introduced new CSS custom properties for help-guide and help-box styling.
Datasource Plugin
(e.g., packages/plugins/datasource/index.js, multiple src/DataSource*.vue, src/styles/vars.less)
Added import for ./src/styles/vars.less; revised extensive CSS variable references from --ti-lowcode to --te-datasource in fields, lists, forms, remote adapters, etc.; added new datasource-specific custom properties under the .datasource class.
i18n Plugin
(e.g., packages/plugins/i18n/index.js, src/Main.vue, src/styles/vars.less)
Added import for ./src/styles/vars.less; updated styling for panels, loading icons, tables, and buttons using new variables; removed deprecated scrollbar and popover styles; introduced new CSS custom properties for internationalization contexts.
Theme Base
(e.g., packages/theme/base/src/component-common.less, base.less, common.less)
Added a new .popper__arrow class with matching background color; adjusted grid resizable margin; introduced new CSS variables for box shadows, scroll bar backgrounds, and panel shadows.
Robot Plugin
(e.g., packages/plugins/robot/index.js, src/Main.vue, src/styles/vars.less)
Added import for ./src/styles/vars.less; comprehensively updated chat interface styles by switching CSS variables from --ti-lowcode to --te-chat-...; introduced new custom properties for chat model styling including text, backgrounds, borders, and popover elements.

Possibly related PRs

Suggested reviewers

  • hexqi
  • lichunn

Poem

I'm a rabbit in the code garden, hopping with delight,
Watching colors transform, as themes take flight.
With variables now shining in a fresh, new light,
CSS magic is woven from day to night.
Carrots and code—oh, what a sight! 🥕✨


📜 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 b9e0c1d and cec6fe1.

📒 Files selected for processing (41)
  • packages/plugins/block/src/BlockConfig.vue (2 hunks)
  • packages/plugins/block/src/BlockEvent.vue (1 hunks)
  • packages/plugins/block/src/BlockEventList.vue (2 hunks)
  • packages/plugins/block/src/BlockGroupArrange.vue (1 hunks)
  • packages/plugins/block/src/BlockProperty.vue (1 hunks)
  • packages/plugins/block/src/BlockPropertyForm.vue (3 hunks)
  • packages/plugins/block/src/BlockSetting.vue (1 hunks)
  • packages/plugins/block/src/Main.vue (5 hunks)
  • packages/plugins/block/src/SaveNewBlock.vue (1 hunks)
  • packages/plugins/block/src/styles/vars.less (1 hunks)
  • packages/plugins/bridge/src/BridgeManage.vue (3 hunks)
  • packages/plugins/bridge/src/BridgeSetting.vue (4 hunks)
  • packages/plugins/bridge/src/styles/vars.less (1 hunks)
  • packages/plugins/datasource/src/DataSourceField.vue (5 hunks)
  • packages/plugins/datasource/src/DataSourceFieldCheck.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceFieldCheckMultipleLine.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceFieldCheckRanger.vue (2 hunks)
  • packages/plugins/datasource/src/DataSourceFieldForm.vue (4 hunks)
  • packages/plugins/datasource/src/DataSourceFieldList.vue (2 hunks)
  • packages/plugins/datasource/src/DataSourceFieldType.vue (4 hunks)
  • packages/plugins/datasource/src/DataSourceForm.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceList.vue (2 hunks)
  • packages/plugins/datasource/src/DataSourceRecordForm.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceRecordList.vue (5 hunks)
  • packages/plugins/datasource/src/DataSourceRecordUpload.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceRemoteAutoload.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceRemoteDataAdapter.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceRemoteDataResult.vue (3 hunks)
  • packages/plugins/datasource/src/DataSourceRemoteForm.vue (2 hunks)
  • packages/plugins/datasource/src/DataSourceRemoteMapping.vue (2 hunks)
  • packages/plugins/datasource/src/DataSourceRemotePanel.vue (2 hunks)
  • packages/plugins/datasource/src/DataSourceRemoteParameter.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceTemplate.vue (3 hunks)
  • packages/plugins/datasource/src/DataSourceType.vue (3 hunks)
  • packages/plugins/datasource/src/RemoteDataAdapterForm.vue (1 hunks)
  • packages/plugins/datasource/src/styles/vars.less (1 hunks)
  • packages/plugins/help/src/HelpIcon.vue (5 hunks)
  • packages/plugins/help/src/styles/vars.less (1 hunks)
  • packages/plugins/i18n/src/Main.vue (9 hunks)
  • packages/plugins/i18n/src/styles/vars.less (1 hunks)
  • packages/plugins/robot/src/styles/vars.less (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (41)
  • packages/plugins/block/src/SaveNewBlock.vue
  • packages/plugins/datasource/src/DataSourceRemoteDataAdapter.vue
  • packages/plugins/datasource/src/DataSourceForm.vue
  • packages/plugins/datasource/src/DataSourceRemotePanel.vue
  • packages/plugins/datasource/src/DataSourceFieldForm.vue
  • packages/plugins/datasource/src/DataSourceRemoteParameter.vue
  • packages/plugins/datasource/src/DataSourceRemoteAutoload.vue
  • packages/plugins/block/src/BlockConfig.vue
  • packages/plugins/datasource/src/DataSourceFieldCheck.vue
  • packages/plugins/datasource/src/DataSourceFieldCheckMultipleLine.vue
  • packages/plugins/block/src/BlockEvent.vue
  • packages/plugins/datasource/src/DataSourceRecordForm.vue
  • packages/plugins/bridge/src/BridgeManage.vue
  • packages/plugins/datasource/src/RemoteDataAdapterForm.vue
  • packages/plugins/datasource/src/DataSourceRecordUpload.vue
  • packages/plugins/datasource/src/DataSourceRemoteForm.vue
  • packages/plugins/help/src/HelpIcon.vue
  • packages/plugins/block/src/BlockProperty.vue
  • packages/plugins/datasource/src/DataSourceRemoteMapping.vue
  • packages/plugins/block/src/BlockSetting.vue
  • packages/plugins/block/src/BlockGroupArrange.vue
  • packages/plugins/datasource/src/DataSourceList.vue
  • packages/plugins/block/src/BlockEventList.vue
  • packages/plugins/datasource/src/DataSourceFieldList.vue
  • packages/plugins/block/src/BlockPropertyForm.vue
  • packages/plugins/datasource/src/DataSourceField.vue
  • packages/plugins/bridge/src/BridgeSetting.vue
  • packages/plugins/i18n/src/Main.vue
  • packages/plugins/datasource/src/DataSourceFieldCheckRanger.vue
  • packages/plugins/datasource/src/DataSourceTemplate.vue
  • packages/plugins/datasource/src/DataSourceRecordList.vue
  • packages/plugins/bridge/src/styles/vars.less
  • packages/plugins/block/src/Main.vue
  • packages/plugins/help/src/styles/vars.less
  • packages/plugins/datasource/src/DataSourceRemoteDataResult.vue
  • packages/plugins/datasource/src/DataSourceType.vue
  • packages/plugins/datasource/src/DataSourceFieldType.vue
  • packages/plugins/datasource/src/styles/vars.less
  • packages/plugins/robot/src/styles/vars.less
  • packages/plugins/i18n/src/styles/vars.less
  • packages/plugins/block/src/styles/vars.less
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@github-actions github-actions bot added enhancement New feature or request refactor-main refactor/develop branch feature labels Jan 26, 2025
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: 3

🧹 Nitpick comments (3)
packages/common/component/PluginBlockList.vue (1)

Line range hint 720-734: Remove redundant hover state color.

The setting menu now uses --te-common-text-primary for better visibility. However, the hover state at line 727 redundantly sets the same color, which is unnecessary.

  .list-item {
    box-sizing: border-box;
    cursor: pointer;
    &:hover {
-     color: var(--te-common-text-primary);
    }
    .list-item-icon {
      font-size: 14px;
      color: var(--te-common-icon-secondary);
    }
  }
packages/plugins/bridge/src/styles/vars.less (1)

2-2: Consider using English comments for better accessibility.

Replace the Chinese comment "资源管理" with its English equivalent "Resource Management" to improve accessibility for international developers.

-  // 资源管理
+  // Resource Management
packages/plugins/block/src/styles/vars.less (1)

1-41: Consider improving variable organization and documentation.

The variables are well-structured but could benefit from the following improvements:

  1. Group all panel-related variables together:
// Panel Header
--te-block-panel-header-*

// Panel Footer
--te-block-panel-footer-*
--te-block-panel-footer-btn-*
  1. Add more descriptive comments in English:
// Alert & Error Messages
--te-block-alert-color              // Used for general alerts
--te-block-error-tip-color          // Used for error messages

// Panel Components
--te-block-panel-header-*           // Styling for panel headers
--te-block-panel-footer-*           // Styling for panel footers
  1. Consider adding usage examples in comments for complex variables.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b9d61a and f17d03a.

📒 Files selected for processing (23)
  • packages/common/component/PluginBlockItemImg.vue (1 hunks)
  • packages/common/component/PluginBlockList.vue (4 hunks)
  • packages/plugins/block/index.js (1 hunks)
  • packages/plugins/block/src/BlockConfig.vue (2 hunks)
  • packages/plugins/block/src/BlockEvent.vue (1 hunks)
  • packages/plugins/block/src/BlockEventForm.vue (1 hunks)
  • packages/plugins/block/src/BlockEventList.vue (2 hunks)
  • packages/plugins/block/src/BlockGroupArrange.vue (1 hunks)
  • packages/plugins/block/src/BlockProperty.vue (1 hunks)
  • packages/plugins/block/src/BlockPropertyForm.vue (2 hunks)
  • packages/plugins/block/src/BlockPropertyList.vue (0 hunks)
  • packages/plugins/block/src/BlockSetting.vue (1 hunks)
  • packages/plugins/block/src/Main.vue (5 hunks)
  • packages/plugins/block/src/SaveNewBlock.vue (1 hunks)
  • packages/plugins/block/src/styles/vars.less (1 hunks)
  • packages/plugins/bridge/index.js (1 hunks)
  • packages/plugins/bridge/src/BridgeManage.vue (3 hunks)
  • packages/plugins/bridge/src/BridgeSetting.vue (4 hunks)
  • packages/plugins/bridge/src/styles/vars.less (1 hunks)
  • packages/plugins/help/index.js (1 hunks)
  • packages/plugins/help/src/HelpIcon.vue (5 hunks)
  • packages/plugins/help/src/styles/vars.less (1 hunks)
  • packages/theme/base/src/component-common.less (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/plugins/block/src/BlockPropertyList.vue
✅ Files skipped from review due to trivial changes (18)
  • packages/plugins/bridge/index.js
  • packages/plugins/block/src/BlockEvent.vue
  • packages/common/component/PluginBlockItemImg.vue
  • packages/plugins/help/index.js
  • packages/plugins/block/src/BlockSetting.vue
  • packages/plugins/block/src/SaveNewBlock.vue
  • packages/plugins/block/src/BlockProperty.vue
  • packages/plugins/block/src/BlockEventForm.vue
  • packages/plugins/block/index.js
  • packages/plugins/block/src/BlockConfig.vue
  • packages/plugins/help/src/HelpIcon.vue
  • packages/plugins/block/src/BlockGroupArrange.vue
  • packages/theme/base/src/component-common.less
  • packages/plugins/bridge/src/BridgeSetting.vue
  • packages/plugins/block/src/Main.vue
  • packages/plugins/bridge/src/BridgeManage.vue
  • packages/plugins/block/src/BlockPropertyForm.vue
  • packages/plugins/help/src/styles/vars.less
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (6)
packages/common/component/PluginBlockList.vue (3)

359-372: LGTM! Consistent use of new color variables.

The changes properly implement the new --te-common-* variables for the block shortcut preview panel, maintaining the visual hierarchy with appropriate use of primary/secondary text colors.


514-514: LGTM! Appropriate use of container background variable.

The active state now uses the semantic --te-common-bg-container variable, which better represents its purpose.


701-703: LGTM! Better readability with primary text color.

Using --te-common-text-primary for the description text improves readability in the small list view.

packages/plugins/bridge/src/styles/vars.less (1)

3-6: Well-organized list-related variables with proper theme integration.

Good job on organizing the list-related variables and maintaining theme consistency by properly referencing the common theme variables.

packages/plugins/block/src/BlockEventList.vue (1)

69-69: LGTM! Variable naming follows the module-specific convention.

The color variables have been properly converted to use module-specific variables, aligning with the PR's objective of variable convergence.

Let's verify that these variables are properly defined in the module's vars.less file:

Also applies to: 80-80, 84-84

✅ Verification successful

✓ Variables are properly defined and mapped to common theme variables

All three color variables are correctly defined in vars.less and appropriately mapped to their corresponding common theme variables.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new variables are properly defined
# Expected: All three variables should be defined in vars.less

rg --type less "te-block-event-list-(color|btn-border-color|btn-icon-color)" packages/plugins/block/src/styles/

Length of output: 452

packages/plugins/block/src/styles/vars.less (1)

2-40: Verify the existence of referenced common variables.

All variables reference --te-common-* variables. Let's verify these dependencies exist:

✅ Verification successful

All referenced common variables are properly defined

All --te-common-* variables referenced in vars.less are correctly defined in the base theme with both light and dark variants.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all referenced --te-common-* variables exist
# Expected: All common variables should be defined

# Extract all referenced common variables
echo "Checking for referenced common variables:"
rg --type less "var\(--te-common-[^)]+\)" packages/plugins/block/src/styles/vars.less -o | sort -u | sed 's/var(//;s/)//' > /tmp/referenced_vars.txt

# Search for their definitions
echo "Searching for variable definitions:"
rg --type less "^[^/]*--te-common-" packages/ -l

Length of output: 1885


Script:

#!/bin/bash
# Get list of referenced common variables
echo "Referenced common variables:"
rg --type less "var\(--te-common-[^)]+\)" packages/plugins/block/src/styles/vars.less -o | sort -u | sed 's/var(//;s/)//'

echo -e "\nSearching for variable definitions in theme files:"
# Search for definitions in theme base files first as they're most likely to contain common vars
for var in $(rg --type less "var\(--te-common-[^)]+\)" packages/plugins/block/src/styles/vars.less -o | sort -u | sed 's/var(//;s/)//')
do
  echo "Checking $var:"
  rg --type less "^\s*${var}:" packages/theme/
done

Length of output: 8318

packages/plugins/bridge/src/styles/vars.less Outdated Show resolved Hide resolved
packages/plugins/block/src/styles/vars.less Outdated Show resolved Hide resolved
@xuanlid xuanlid force-pushed the feat/themeDarkVars branch from f17d03a to 6b445b4 Compare January 26, 2025 07:32
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

🧹 Nitpick comments (13)
packages/theme/base/src/base.less (2)

245-245: LGTM! The new box shadow variable follows the existing pattern.

The new variable --te-base-box-shadow-rgba-4 maintains consistency with the existing box shadow variables while providing a stronger opacity option (0.2) for more prominent shadow effects.

However, consider adding a comment to document the intended use case for this specific opacity level, similar to how other sections have descriptive comments.

  --te-base-box-shadow-rgba-3: rgba(0, 0, 0, 0.1);
+ // Used for stronger elevation effects
  --te-base-box-shadow-rgba-4: rgba(0, 0, 0, 0.2);

242-245: Add a section comment for box shadow variables.

For consistency with other sections in the file, consider adding a descriptive comment for the box shadow variables group.

+ /**
+  * 1.6 Box Shadows
+  * RGBA values for creating elevation effects
+  */
  --te-base-box-shadow-rgba-1: rgba(25, 25, 25, 0.15);
  --te-base-box-shadow-rgba-2: rgba(0, 0, 0, 0.16);
  --te-base-box-shadow-rgba-3: rgba(0, 0, 0, 0.1);
  --te-base-box-shadow-rgba-4: rgba(0, 0, 0, 0.2);
packages/plugins/datasource/src/DataSourceRecordList.vue (2)

608-608: LGTM! Consistent module-specific variable naming.

The color variable updates follow a consistent pattern of using module-specific prefixes (--te-datasource-*), which aligns with the PR objectives.

Consider making some variable names more semantically specific:

-  color: var(--te-datasource-common-primary-text-color);
+  color: var(--te-datasource-download-link-color);
-  color: var(--te-datasource-list-item-icon-color);
+  color: var(--te-datasource-action-icon-color);

Also applies to: 620-620, 626-626, 638-638, 651-651, 655-656, 661-661, 669-669


Line range hint 472-484: Consider adding loading states and consistent error handling.

The component performs several async operations (save, fetch, validate) but doesn't show loading states or handle errors consistently. This might affect user experience during slow network conditions.

Consider:

  1. Adding loading states during async operations
  2. Implementing consistent error handling
  3. Showing appropriate error messages to users

Example implementation:

 const saveRecordList = () => {
+  state.loading = true
   grid.value.validate((valid) => {
     if (!valid) {
+      state.loading = false
       return
     }

     const totalData = state.totalData
     // ... existing code ...

     saveRecordFormData(data)
+      .catch(error => {
+        useNotify({
+          type: 'error',
+          message: '保存失败,请重试'
+        })
+      })
+      .finally(() => {
+        state.loading = false
+      })
   })
 }

Also applies to: 507-517

packages/theme/base/src/common.less (5)

57-58: LGTM! Consider translating comments to English for consistency.

The scroll bar color variables are well-defined and follow the established naming convention. The color choices provide good visual contrast between default and hover states.

Consider translating the Chinese comments to English for better international collaboration:

-  --te-common-bg-scroll: var(--te-base-gray-40); // 滚动条默认背景色#dbdbdb
-  --te-common-bg-scroll-hover: var(--te-base-gray-50); // 滚动条默认背景色#c2c2c2
+  --te-common-bg-scroll: var(--te-base-gray-40); // Default scrollbar background color #dbdbdb
+  --te-common-bg-scroll-hover: var(--te-base-gray-50); // Scrollbar hover background color #c2c2c2

60-60: LGTM! Consider translating the comment to English.

The panel shadow variable is well-defined with an appropriate opacity value for subtle depth in light theme.

Consider translating the Chinese comment to English:

-  --te-common-shadow-panel: var(--te-base-box-shadow-rgba-3); // 面板阴影 rgba(0, 0, 0, 0.1)
+  --te-common-shadow-panel: var(--te-base-box-shadow-rgba-3); // Panel shadow rgba(0, 0, 0, 0.1)

120-121: LGTM! Consider translating comments to English for consistency.

The dark theme scroll bar colors are well-chosen with appropriate contrast between states.

Consider translating the Chinese comments to English:

-  --te-common-bg-scroll: var(--te-base-gray-110); // 滚动条默认背景色#262626
-  --te-common-bg-scroll-hover: var(--te-base-gray-100); // 滚动条默认背景色#333333
+  --te-common-bg-scroll: var(--te-base-gray-110); // Default scrollbar background color #262626
+  --te-common-bg-scroll-hover: var(--te-base-gray-100); // Scrollbar hover background color #333333

123-123: LGTM! Consider translating the comment to English.

The dark theme panel shadow uses appropriate opacity for better visibility against dark backgrounds.

Consider translating the Chinese comment to English:

-  --te-common-shadow-panel: var(--te-base-box-shadow-rgba-4); // 面板阴影 rgba(0, 0, 0, 0.2)
+  --te-common-shadow-panel: var(--te-base-box-shadow-rgba-4); // Panel shadow rgba(0, 0, 0, 0.2)

Line range hint 57-123: Well-structured theme variable additions!

The new scroll bar and panel shadow variables are:

  • Consistently named following the --te-common-* pattern
  • Well-organized within light and dark theme sections
  • Using appropriate base tokens for colors and shadows
  • Providing good visual feedback through state changes

These changes align well with the PR's objective of improving module variable management.

Consider documenting these new variables in the theme documentation to help other developers understand their intended usage and the reasoning behind the chosen values.

packages/plugins/datasource/src/styles/vars.less (2)

1-37: Review variable naming patterns and potential optimizations

The variable definitions look good overall, but there are some opportunities for improvement:

  1. Inconsistent prefix patterns:

    • Some use common- prefix: --te-datasource-common-border-primary-color
    • Others are direct: --te-datasource-border-color
  2. Potential redundancies:

    • --te-datasource-border-color and --te-datasource-common-border-color both map to border variables
    • --te-datasource-color seems too generic and could be more specific

Consider:

  1. Standardizing the naming pattern by removing the common- prefix where it doesn't add semantic value
  2. Making generic variable names more specific to their usage
  3. Consolidating similar variables to reduce redundancy

Example consolidation:

- --te-datasource-border-color: var(--te-common-border-default);
- --te-datasource-common-border-color: var(--te-common-border-divider);
+ --te-datasource-border-default: var(--te-common-border-default);
+ --te-datasource-border-divider: var(--te-common-border-divider);

15-17: Consider semantic clarity in color variable names

The following variables could benefit from more descriptive names:

  • --te-datasource-common-text-color-5 is not semantically clear
  • --te-datasource-common-hover-bg-1 suggests there might be more numbered backgrounds

Consider renaming to reflect their purpose:

- --te-datasource-common-text-color-5: var(--te-common-text-weaken);
- --te-datasource-common-hover-bg-1: var(--te-common-bg-container);
+ --te-datasource-text-weaken: var(--te-common-text-weaken);
+ --te-datasource-hover-bg-container: var(--te-common-bg-container);
packages/plugins/i18n/src/styles/vars.less (1)

1-17: LGTM! Well-structured variable system with clear semantic mapping.

The CSS custom properties follow a consistent naming pattern and maintain a clear separation of concerns. They appropriately reference common variables, ensuring design consistency.

Consider adding English comments for better international collaboration.

The Chinese comments are clear, but adding English translations would improve collaboration with non-Chinese speaking developers.

 :root {
-  // 国际化表格加载中字体颜色
+  // Loading text color for i18n table (国际化表格加载中字体颜色)
   --te-i18n-loading-text-color: var(--te-common-text-weaken);
-  // 国际化表格加载中图标颜色
+  // Loading icon color for i18n table (国际化表格加载中图标颜色)
   --te-i18n-loading-svg-color: var(--te-common-icon-primary);
   // ... similar changes for other comments
 }
packages/plugins/i18n/src/Main.vue (1)

521-526: Consider consolidating duplicate color declarations.

The download button color is declared twice with the same variable.

 .download-btn {
   cursor: pointer;
   color: var(--te-i18n-button-color);
   svg {
     font-size: 16px;
   }
   .tiny-button.tiny-button--text {
-    color: var(--te-i18n-button-color);
+    color: inherit;
   }
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b445b4 and d3bf61d.

📒 Files selected for processing (30)
  • packages/plugins/datasource/index.js (1 hunks)
  • packages/plugins/datasource/src/DataSourceField.vue (5 hunks)
  • packages/plugins/datasource/src/DataSourceFieldCheck.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceFieldCheckMultipleLine.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceFieldCheckRanger.vue (2 hunks)
  • packages/plugins/datasource/src/DataSourceFieldForm.vue (4 hunks)
  • packages/plugins/datasource/src/DataSourceFieldList.vue (2 hunks)
  • packages/plugins/datasource/src/DataSourceFieldType.vue (4 hunks)
  • packages/plugins/datasource/src/DataSourceForm.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceList.vue (2 hunks)
  • packages/plugins/datasource/src/DataSourceRecordForm.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceRecordList.vue (5 hunks)
  • packages/plugins/datasource/src/DataSourceRecordUpload.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceRemoteAutoload.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceRemoteDataAdapter.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceRemoteDataResult.vue (3 hunks)
  • packages/plugins/datasource/src/DataSourceRemoteForm.vue (2 hunks)
  • packages/plugins/datasource/src/DataSourceRemoteMapping.vue (2 hunks)
  • packages/plugins/datasource/src/DataSourceRemotePanel.vue (2 hunks)
  • packages/plugins/datasource/src/DataSourceRemoteParameter.vue (1 hunks)
  • packages/plugins/datasource/src/DataSourceTemplate.vue (3 hunks)
  • packages/plugins/datasource/src/DataSourceType.vue (3 hunks)
  • packages/plugins/datasource/src/RemoteDataAdapterForm.vue (1 hunks)
  • packages/plugins/datasource/src/styles/vars.less (1 hunks)
  • packages/plugins/i18n/index.js (1 hunks)
  • packages/plugins/i18n/src/Main.vue (8 hunks)
  • packages/plugins/i18n/src/styles/vars.less (1 hunks)
  • packages/theme/base/src/base.less (1 hunks)
  • packages/theme/base/src/common.less (2 hunks)
  • packages/theme/base/src/component-common.less (2 hunks)
✅ Files skipped from review due to trivial changes (22)
  • packages/plugins/datasource/index.js
  • packages/plugins/i18n/index.js
  • packages/plugins/datasource/src/DataSourceFieldCheck.vue
  • packages/plugins/datasource/src/DataSourceFieldCheckMultipleLine.vue
  • packages/plugins/datasource/src/DataSourceForm.vue
  • packages/plugins/datasource/src/DataSourceFieldCheckRanger.vue
  • packages/plugins/datasource/src/DataSourceRemoteMapping.vue
  • packages/plugins/datasource/src/DataSourceRemoteDataAdapter.vue
  • packages/plugins/datasource/src/DataSourceFieldForm.vue
  • packages/plugins/datasource/src/DataSourceRemoteAutoload.vue
  • packages/plugins/datasource/src/DataSourceRemoteParameter.vue
  • packages/plugins/datasource/src/DataSourceField.vue
  • packages/plugins/datasource/src/DataSourceRecordUpload.vue
  • packages/plugins/datasource/src/DataSourceList.vue
  • packages/plugins/datasource/src/DataSourceRemoteForm.vue
  • packages/plugins/datasource/src/DataSourceRemotePanel.vue
  • packages/plugins/datasource/src/RemoteDataAdapterForm.vue
  • packages/plugins/datasource/src/DataSourceFieldList.vue
  • packages/plugins/datasource/src/DataSourceRecordForm.vue
  • packages/plugins/datasource/src/DataSourceTemplate.vue
  • packages/plugins/datasource/src/DataSourceFieldType.vue
  • packages/plugins/datasource/src/DataSourceType.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/theme/base/src/component-common.less
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (13)
packages/theme/base/src/base.less (1)

Line range hint 1-324: The naming convention aligns with the PR objectives.

The file consistently uses the --te-base-* prefix for all variables, which aligns with the PR's goal of transitioning from --ti-* and --te-common-* to --te-* variables.

packages/plugins/datasource/src/DataSourceRecordList.vue (1)

310-310: LGTM! Color variable update aligns with module-specific naming convention.

The change from a generic color variable to a module-specific one (--te-datasource-modal-text-color) improves the organization of styling variables.

packages/plugins/datasource/src/DataSourceRemoteDataResult.vue (4)

96-96: LGTM: Appropriate semantic mapping for tip text color

The change from --te-common-text-weaken to --te-datasource-common-tip-color aligns with the PR objective of converting common variables to module-specific ones while maintaining semantic meaning.


99-101: LGTM: Consistent variable naming for toolbar elements

The changes properly map toolbar-related styles to datasource-specific variables:

  • Breadcrumb color: --te-datasource-toolbar-breadcrumb-color
  • Tab borders: --te-datasource-tabs-border-color

118-118: LGTM: Appropriate button styling variable

The change to --te-datasource-common-btn-border-color maintains consistent button styling while properly scoping it to the datasource module.


128-128: LGTM: Consistent border styling

The change from --te-common-border-divider to --te-datasource-common-border-color appropriately scopes the border styling to the datasource module.

packages/plugins/datasource/src/styles/vars.less (1)

2-11: Verify color contrast accessibility

Several text colors are defined using secondary and weaken variants. Ensure these maintain sufficient contrast ratios for accessibility.

✅ Verification successful

Color contrast ratios meet accessibility standards

The color system uses carefully selected combinations that meet or exceed WCAG guidelines:

  • Light theme: Secondary text (#595959) maintains AA-level contrast on light backgrounds
  • Dark theme: Secondary text (#B3B3B3) maintains AA-level contrast on dark backgrounds
  • Primary text colors in both themes exceed AAA-level requirements
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for color contrast related tests or documentation
rg -i "contrast|a11y|accessibility" --type md

Length of output: 47


Script:

#!/bin/bash
# Search for common theme variable definitions
rg -l "te-common-text|te-common-border|te-common-color" --type css --type less

# Also check for any theme-related files
fd -e less -e css "theme|color|style" -d 3

Length of output: 1683


Script:

#!/bin/bash
# Check base theme and theme-specific color definitions
echo "=== Base Theme Common Variables ==="
cat packages/theme/base/src/common.less

echo -e "\n=== Dark Theme Variables ==="
cat packages/theme/dark/variable.less

echo -e "\n=== Light Theme Variables ==="
cat packages/theme/light/variable.less

Length of output: 24587

packages/plugins/i18n/src/Main.vue (6)

437-437: LGTM! Appropriate use of shadow variable.

The panel shadow correctly uses the new --te-i18n-panel-shadow-color variable.


456-460: LGTM! Consistent loading state styling.

Loading states appropriately use the new loading-specific variables for both SVG and text colors.


Line range hint 486-495: LGTM! Well-structured button styling.

Button and icon colors correctly use their respective variables, maintaining visual hierarchy.


538-544: LGTM! Consistent table styling.

Border and scrollbar colors appropriately use the new grid-specific variables.


563-563: LGTM! Proper grid operation icon styling.

Grid operation icons correctly use the designated variable for consistent styling.


511-511: Verify loading spinner color contrast.

The loading spinner uses --te-i18n-common-tip-text-color. Please ensure this provides sufficient contrast for accessibility.

✅ Verification successful

Loading spinner color follows design system's accessible color scheme

The spinner uses the design system's secondary text color (--te-common-text-secondary), which is specifically designed for UI elements requiring good contrast. It adapts appropriately for both light (#595959) and dark (#B3B3B3) themes, ensuring sufficient contrast in all contexts.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other uses of loading spinners to compare color contrast implementation
rg -l "stroke.*var\(--te.*\)" --type less

Length of output: 43


Script:

#!/bin/bash
# Search for the specific color variable definition and usage
rg --type-add 'styles:*.{css,less,scss,vue}' -t styles "te-i18n-common-tip-text-color"

# Search for loading spinner related code and styles
rg --type-add 'styles:*.{css,less,scss,vue}' -t styles "loading.*spinner|spinner.*loading"

# Look for theme or accessibility configuration files
fd -e js -e ts -e json "theme|color|accessibility|a11y"

Length of output: 2419


Script:

#!/bin/bash
# Search for the base text color variable
rg --type-add 'styles:*.{css,less,scss,vue}' -t styles "te-common-text-secondary"

# Look for any theme configuration files specifically
fd "theme" -e less

Length of output: 17736

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

🧹 Nitpick comments (1)
packages/plugins/robot/src/styles/vars.less (1)

32-35: Input Field Styling: Clarify Comment for Border

The input field background (--te-chat-model-input-bg) and border (--te-chat-model-input-border) variables are correctly defined. However, the comment on line 34 mistakenly repeats “输入框背景” instead of indicating that it styles the border. For improved clarity, consider updating the comment as follows:

-  // chatGPT聊天窗输入框背景
+  // chatGPT聊天窗输入框边框
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3bdcd3 and 2ebd80f.

📒 Files selected for processing (3)
  • packages/plugins/robot/index.js (1 hunks)
  • packages/plugins/robot/src/Main.vue (12 hunks)
  • packages/plugins/robot/src/styles/vars.less (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/plugins/robot/index.js
  • packages/plugins/robot/src/Main.vue
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (12)
packages/plugins/robot/src/styles/vars.less (12)

1-2: Global Variables Declaration: Proper Use of :root Selector

The use of the :root selector to encapsulate global CSS variables is appropriate and aligns with best practices for theming and variable management.


2-9: Text and Icon Color Variables

The variables for text color (--te-chat-model-text), icon color (--te-chat-model-icon), text border (--te-chat-model-text-border), and avatar border (--te-chat-model-avatar-border) are defined clearly with consistent naming conventions.


10-15: AI Chat Styling Variables

The definitions for AI chat background (--te-chat-model-ai-text-bg), border (--te-chat-model-ai-text-border), and text color (--te-chat-model-ai-text) are well structured and clearly commented.


16-21: AI Failure State Styling Variables

The variables for styling scenarios where the AI connection fails—namely, background (--te-chat-model-ai-fail-text-bg), border (--te-chat-model-ai-fail-text-border), and text color (--te-chat-model-ai-fail-text)—are appropriately defined, ensuring consistent feedback in error states.


22-27: User Chat Styling Variables

The user-specific chat styling variables (--te-chat-model-user-text-bg, --te-chat-model-user-text-border, and --te-chat-model-user-text) maintain a consistent design language with the rest of the theme.


28-31: Title and Common Icon Styling

The chat window title (--te-chat-model-title) and the basic icon (--te-chat-model-common-icon) are declared clearly. Their definitions support a cohesive visual identity for the interface.


36-43: Chat Send Button Styling

The declarations for the send button’s background gradients (--te-chat-model-button-bg-1, --te-chat-model-button-bg-2, --te-chat-model-button-bg-3), border (--te-chat-model-button-border), and text color (--te-chat-model-button-text) are clearly defined and follow a logical structure.


44-47: Background Gradient Variables

The top, middle, and bottom background colors (--te-chat-bg-top-color, --te-chat-bg-mid-color, --te-chat-bg-bottom-color) are appropriately specified to create smooth background gradients.


48-55: Chat Window and Tips Variables

Variables covering the chat window background (--te-chat-model-bg), helper text (--te-chat-model-helper-text), and tip styling (--te-chat-model-tips-text, --te-chat-model-tips-bg) are well organized and enhance the visual consistency of the interface.


56-60: Loading Indicator Styling

The properties for the loading indicator (--te-chat-loading-svg-color and --te-chat-loading-text-color) are defined with clear, contrasting colors to ensure visibility during load events.


61-65: Popover Styling Variables

The set of popover-related variables (--te-chat-model-popover-bg, --te-chat-model-popover-color, --te-chat-model-popover-active-bg, --te-chat-model-popover-active-color) is consistent and well-integrated within the overall theming strategy.


66-67: Closing the :root Block

The closing brace appropriately terminates the CSS variable declarations without any issues.

@xuanlid xuanlid changed the title feat: variable convergence feat: variable convergence(block, i18n, bridge, datasource, help, robot) Feb 5, 2025
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

🧹 Nitpick comments (2)
packages/plugins/bridge/src/styles/vars.less (1)

1-2: Translate Chinese comment to English.

For better international collaboration, consider translating the Chinese comment "资源管理" to English, e.g., "Resource Management".

.bridge-manage {
-  // 资源管理
+  // Resource Management
packages/plugins/datasource/src/styles/vars.less (1)

2-2: Consider grouping similar variables.

Several variables reference --te-common-text-primary:

  • --te-datasource-toolbar-icon-color
  • --te-datasource-toolbar-breadcrumb-color
  • --te-datasource-common-primary-text-color
  • --te-datasource-modal-text-color
  • --te-datasource-color
  • --te-datasource-list-item-text-color

Consider creating an intermediate variable for commonly used values to improve maintainability.

.datasource {
+  --te-datasource-text-primary: var(--te-common-text-primary);
-  --te-datasource-toolbar-icon-color: var(--te-common-text-primary);
+  --te-datasource-toolbar-icon-color: var(--te-datasource-text-primary);
   // ... other variables ...
-  --te-datasource-toolbar-breadcrumb-color: var(--te-common-text-primary);
+  --te-datasource-toolbar-breadcrumb-color: var(--te-datasource-text-primary);
   // ... continue updating other variables to use the intermediate variable
}

Also applies to: 4-4, 19-19, 26-26, 29-29, 32-32

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3259606 and f33c1db.

📒 Files selected for processing (12)
  • packages/plugins/block/src/BlockPropertyForm.vue (3 hunks)
  • packages/plugins/block/src/styles/vars.less (1 hunks)
  • packages/plugins/bridge/src/Main.vue (1 hunks)
  • packages/plugins/bridge/src/styles/vars.less (1 hunks)
  • packages/plugins/datasource/src/DataSourceRecordList.vue (5 hunks)
  • packages/plugins/datasource/src/Main.vue (1 hunks)
  • packages/plugins/datasource/src/styles/vars.less (1 hunks)
  • packages/plugins/help/src/styles/vars.less (1 hunks)
  • packages/plugins/i18n/src/styles/vars.less (1 hunks)
  • packages/plugins/robot/src/Main.vue (12 hunks)
  • packages/plugins/robot/src/styles/vars.less (1 hunks)
  • packages/theme/base/src/component-common.less (3 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/plugins/datasource/src/Main.vue
  • packages/plugins/bridge/src/Main.vue
🚧 Files skipped from review as they are similar to previous changes (8)
  • packages/plugins/robot/src/Main.vue
  • packages/theme/base/src/component-common.less
  • packages/plugins/block/src/BlockPropertyForm.vue
  • packages/plugins/help/src/styles/vars.less
  • packages/plugins/datasource/src/DataSourceRecordList.vue
  • packages/plugins/i18n/src/styles/vars.less
  • packages/plugins/robot/src/styles/vars.less
  • packages/plugins/block/src/styles/vars.less
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (4)
packages/plugins/bridge/src/styles/vars.less (2)

3-6: LGTM! Well-structured list-related variables.

The variables follow consistent naming patterns and properly reference common variables, aligning with the PR's objective of converting color values to module variables.


7-12: LGTM! Well-structured editor and setting variables.

The variables follow consistent naming patterns and properly reference common variables. The previous typo in the prefix has been correctly fixed.

packages/plugins/datasource/src/styles/vars.less (2)

1-37: Well-structured variable organization and naming!

The variables are well-organized with:

  • Clear scoping under .datasource class
  • Consistent --te-datasource- prefix
  • Semantic naming that reflects each variable's purpose

1-37: Implementation aligns perfectly with PR objectives!

The changes successfully:

  • Convert all color values to module variables
  • Properly scope variables under the datasource module
  • Reference common variables correctly without direct usage

chilingling
chilingling previously approved these changes Feb 12, 2025
@hexqi hexqi added this to the v2.3.0 milestone Feb 13, 2025
@hexqi hexqi merged commit fdfc1bb into opentiny:refactor/develop Feb 13, 2025
2 checks passed
@xuanlid xuanlid deleted the feat/themeDarkVars branch February 13, 2025 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor-main refactor/develop branch feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants