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(theme/baseVariable): change base variable and common variable #926

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

wenmine
Copy link
Collaborator

@wenmine wenmine commented Dec 5, 2024

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

此pr做的事情:

  1. 对齐base色阶,base.less里面涵盖了tiny-engine所有颜色
  2. 对齐common变量,common变量为场景通用主题变量
  3. 将部分文件里的变量滥用调整先调整为common变量

剩余要做的事情:

  1. 将 对 light/base.less 和dark/base.less 变量的使用换成theme/base.less和common.less,不再单独分light和dark的base。替换之后,将light/base.less 和dark/base.less 文件删除
  2. 整理light和dark里面的模块变量,具体做法为:
    举例:
    image
    • 将模块less文件里的右侧值的部分,不再使用ti-lowcode-xxx,不再依赖其他的模块变量,只依赖common和base,保持模块变量的干净纯粹
    • 根据当前的场景和当前的值,去common里拿对应场景的common变量
    • 将里面写死颜色的地方,替换成common变量
    • 由于历史色值比较混乱的原因,所以可能会出现common变量和base变量里面没有的色值,这个时候,可以根据场景语义化,与设计师对齐,选择一个匹配的common变量进行修正。
    • 正常来说,dark和light的场景变量名应该的一致的,应该引用同一个common场景变量;后期要审视不一致的场景,与设计师对齐。看看是否可以调节成同一个场景的common变量。
  3. 整理 light/variable.less和dark/variable.less,目的是删除这两个文件,具体做法:
  4. 挨个查询当前在variable.less里的变量在哪里被使用,审视使用合理性,审视的做法是:
    • 若是没有地方用到,直接删除
    • 若是被模块变量文件用到了,则在模块文件里直接使用common变量即可
    • 若是被vue文件直接使用了,有两种修改方式:
      1.直接改成common变量,等待之后调整
      2.一步到位,看是哪一个模块的,然后新增模块变量,模块变量的值是common变量,然后vue文件使用的是模块变量。
  5. 最后,当variable.less和dark/base light/base.less都清理完之后,将模块变量回归到模块中。
  6. 模块变量回归模块后,再排查一遍该模块有没有直接使用--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

Release Notes

  • New Features

    • Enhanced styling across various components for improved visual consistency.
    • Updated hover effects and background colors for better user interaction feedback.
  • Bug Fixes

    • Resolved inconsistencies in color variables across themes, ensuring a unified appearance.
  • Documentation

    • Updated comments and variable names to align with the new design system.
  • Chores

    • Refactored CSS variables to streamline theming and color management across the application.

Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

Walkthrough

The pull request introduces a series of changes across multiple Vue components and CSS files, primarily focusing on updating styling and theming elements. Key modifications include adjustments to hover effects, background colors, and the organization of CSS variables to align with a new design system. The functionality of the components remains largely unchanged, with no alterations to exported entities. Overall, the changes aim to enhance visual consistency and responsiveness throughout the application.

Changes

File Path Change Summary
designer-demo/src/configurators/MyInputConfigurator.vue Updated hover effect color for .tiny-svg-size class; no changes to core functionality or exported entities.
packages/canvas/container/src/components/CanvasAction.vue Modified template structure and styling for .short-cut-set; refined logic for action menu visibility; no changes to core functionality.
packages/canvas/container/src/components/CanvasDivider.vue Updated hover effect and dashed border color; retained mouse event handling; no changes to core functionality.
packages/canvas/container/src/components/CanvasResizeBorder.vue Changed border color; refined resizing logic; no changes to core functionality.
packages/canvas/container/src/components/shortCutPopover.vue Updated various CSS variables for theming; no changes to core functionality or exported entities.
packages/canvas/layout/src/CanvasLayout.vue Altered background color for #canvas-wrap; retained computed properties and layout logic; no changes to core functionality.
packages/common/component/SearchEmpty.vue Updated color for .empty-text class; removed color property for .empty-icon; no changes to core functionality.
packages/settings/styles/src/components/inputs/ResetButton.vue Changed color property for .reset-desc class; no changes to core functionality or exported entities.
packages/theme/base/src/base.less Significant updates to CSS variables, consolidating and redefining color variables across various categories.
packages/theme/base/src/common.less Modified values of color-related variables, impacting functional, text, icon, border, and background colors.
packages/theme/base/src/component-common.less Added background colors for various components; modified existing styles for consistency.
packages/theme/base/src/page/base-config-page.less Updated color variables and scrollbar styling; modified background and border colors for various UI elements.
packages/theme/dark/canvas.less Updated CSS variables for dark theme; modified colors for canvas elements to align with new theming strategy.
packages/theme/dark/setting-style.less Replaced low-code theme variables with new ones; updated colors for inputs, buttons, and borders.
packages/theme/light/canvas.less Updated CSS variables for light theme; modified colors for various canvas elements to enhance consistency.
packages/theme/light/setting-style.less Updated several CSS custom properties for light theme; replaced low-code specific colors with new variable references.

Possibly related PRs

Suggested labels

refactoring, ready_for_review

Suggested reviewers

  • hexqi
  • chilingling

🐰 "In the garden of code, we hop and play,
With colors anew, brightening the day.
From buttons to borders, all styled with care,
A whimsical world, where changes we share!
So let’s celebrate, with a hop and a cheer,
For a vibrant new theme, that’s finally here!" 🐇✨


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 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 the refactor-main refactor/develop branch feature label Dec 5, 2024
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

🧹 Outside diff range and nitpick comments (15)
packages/canvas/layout/src/CanvasLayout.vue (1)

Line range hint 31-31: Consider updating the remaining legacy variable.

The .site-canvas background still uses --ti-lowcode-breadcrumb-hover-bg, which:

  1. Uses the old --ti- prefix instead of the new --te- prefix
  2. Seems to be using a breadcrumb-specific variable for canvas background, which might not be semantically correct

Consider updating to an appropriate common background variable from the new theme system, for example:

- background: var(--ti-lowcode-breadcrumb-hover-bg);
+ background: var(--te-common-bg-container-hover);  // or another appropriate common variable
designer-demo/src/configurators/MyInputConfigurator.vue (3)

Line range hint 31-34: Add validation for the dataType prop

The dataType prop is used for type conversion but lacks validation. Consider adding allowed values to prevent unexpected behavior.

 dataType: {
   type: String,
+  validator: (value) => ['Array', 'String'].includes(value)
 },

Line range hint 42-44: Add error handling in the change function

The current implementation assumes valid input for array conversion. Consider adding validation and error handling.

 const change = (val) => {
+  if (!val && props.dataType === 'Array') {
+    emit('update:modelValue', [])
+    return
+  }
   emit('update:modelValue', props.dataType === 'Array' ? val.split(',') : val)
 }

Remove unused suffixIcons prop

The suffixIcons prop is defined but not utilized in the template of MyInputConfigurator.vue. While this prop is actively used in InputConfigurator.vue for rendering suffix icons, the MyInputConfigurator component doesn't implement this functionality in its template. Consider removing this unused prop to maintain clean and maintainable code.

  • Remove the suffixIcons prop definition from designer-demo/src/configurators/MyInputConfigurator.vue
  • If suffix icons functionality is needed, implement the template similar to InputConfigurator.vue
🔗 Analysis chain

Line range hint 19-37: Verify the usage of the suffixIcons prop

The suffixIcons prop is defined but not utilized in the template. This could indicate incomplete implementation or unnecessary code.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any usage of suffixIcons in the codebase
rg -l "suffixIcons" --type vue

Length of output: 58


Script:

#!/bin/bash
# Search for any usage of suffixIcons in all files
rg "suffixIcons"

# Also search for the component name to understand its usage
rg "MyInputConfigurator"

Length of output: 999


Script:

#!/bin/bash
# Let's check the content of InputConfigurator.vue to understand how suffixIcons is used
cat packages/configurator/src/input-configurator/InputConfigurator.vue

# Also check if MyInputConfigurator extends or relates to InputConfigurator
rg -A 5 -B 5 "extends.*InputConfigurator" 
rg -A 5 -B 5 "import.*InputConfigurator"

Length of output: 4855


Script:

#!/bin/bash
# Let's check the content of MyInputConfigurator.vue to see if it's extending InputConfigurator
cat designer-demo/src/configurators/MyInputConfigurator.vue

# Also check the template version
cat packages/engine-cli/template/designer/src/configurators/MyInputConfigurator.vue

Length of output: 2399

packages/canvas/container/src/components/CanvasAction.vue (6)

Line range hint 15-19: Optimize conditional rendering of popover components

The v-if="showPopover" condition is redundant since TinyPopover already handles visibility through v-model. Remove the inner v-if to improve performance and reduce unnecessary DOM updates.

  <TinyPopover
    v-model="showPopover"
    placement="top-start"
    title="快捷设置"
    width="310"
    popper-class="short-cut-set"
    trigger="manual"
  >
-   <shortCutPopover v-if="showPopover" @active="activeSetting('props')"></shortCutPopover>
+   <shortCutPopover @active="activeSetting('props')"></shortCutPopover>
    <template #reference>
      <icon-setting class="icon-setting" @click.stop="showPopover = !showPopover"></icon-setting>
    </template>
  </TinyPopover>

Line range hint 252-270: Improve parent class checking implementation

The current implementation of findParentHasClass has several issues:

  1. Inefficient recursive DOM traversal
  2. Unsafe className handling using JSON.stringify
  3. Potential infinite loop without proper termination condition

Consider this safer and more efficient implementation:

- const findParentHasClass = (target) => {
-   let parent = target.parentNode
-   let flag = false
-
-   if (parent.className === undefined) {
-     return false
-   }
-
-   let name = JSON.stringify(parent.className)
-
-   if (name && name.indexOf('short-cut-set') === -1 && name.indexOf('tiny-dialog-box') === -1) {
-     flag = findParentHasClass(parent)
-   } else {
-     flag = true
-   }
-
-   return flag
- }
+ const findParentHasClass = (target) => {
+   const targetClasses = ['short-cut-set', 'tiny-dialog-box']
+   let current = target.parentElement
+   
+   while (current && current !== document.body) {
+     if (current.classList && 
+         targetClasses.some(className => current.classList.contains(className))) {
+       return true
+     }
+     current = current.parentElement
+   }
+   
+   return false
+ }

Line range hint 367-419: Refactor style handling logic for better maintainability

The Align class manually handles style conversion and positioning calculations. Consider using Vue's built-in style binding capabilities and computed properties for better maintainability.

Consider this alternative approach:

- class Align {
-   // ... existing implementation
-   styleObj2Str = (styleObj) => {
-     return Object.entries(styleObj)
-       .map(([key, value]) => {
-         const num = Number(value)
-         if (Number.isNaN(num)) {
-           return `${key}:${value}`
-         }
-         const val = positions.isHorizontal(key) ? num - SELECTION_BORDER_WIDTH : num
-         return `${key}:${val}px`
-       })
-       .join(';')
-   }
- }

+ const createAlignStyles = (options) => {
+   return computed(() => {
+     const { alignLeft, horizontalValue, alignTop, verticalValue } = options
+     return {
+       left: alignLeft ? `${horizontalValue}px` : 'unset',
+       right: !alignLeft ? `${horizontalValue}px` : 'unset',
+       top: alignTop ? `${verticalValue}px` : 'unset',
+       bottom: !alignTop ? `${verticalValue}px` : 'unset'
+     }
+   })
+ }

This approach:

  1. Leverages Vue's reactivity system
  2. Simplifies style management
  3. Improves code maintainability

674-674: Remove redundant class selector

The selector .short-cut-set.short-cut-set contains a duplicated class name which is unnecessary.

- .short-cut-set.short-cut-set.tiny-popper.tiny-popover {
+ .short-cut-set.tiny-popper.tiny-popover {

Line range hint 676-736: Use CSS variables for consistent theming

The resize handles use hardcoded color values which should be replaced with CSS variables for consistent theming.

  .drag-resize {
    // ...
-   background-color: #409eff;
+   background-color: var(--ti-lowcode-resize-handle-color);
    cursor: pointer;
    // ...
  }

Line range hint 1-736: Consider architectural improvements for better maintainability

While the component effectively handles canvas interactions, consider the following architectural improvements:

  1. Extract the positioning logic into a composable function for better reusability
  2. Split the component into smaller sub-components for better maintainability
  3. Add proper TypeScript types for props and events
  4. Document the component's API and usage patterns

Would you like assistance in implementing any of these architectural improvements?

packages/theme/light/canvas.less (1)

4-6: Consider using semantic variables for hover line background colors

Currently, the variables --te-base-green-140 and --te-base-red-140 are used directly for hover line backgrounds. To improve maintainability and readability, consider using semantic variables that represent their purpose, such as --te-common-hover-success-bg and --te-common-hover-error-bg.

packages/theme/base/src/page/base-config-page.less (1)

137-139: Consider adding border-radius for consistent styling.

While the background and color changes look good, consider adding a border-radius for better visual consistency with other components.

.tiny-popover.tiny-popover.option-popper {
  background: var(--te-common-bg-popover);
  border: 1px solid transparent;
  color: var(--te-common-text-secondary);
+ border-radius: var(--te-base-border-radius-1);
  padding: 0px 8px 12px;
packages/theme/base/src/common.less (1)

11-19: Consider documenting color contrast ratios.

While the text color hierarchy is well-defined, it would be helpful to document the expected contrast ratios for accessibility.

 // 文本色
-  --te-common-text-primary: var(--te-base-gray-90); // 一级文本色-重要信息/标题颜色/输入类文本颜色 #191919
+  --te-common-text-primary: var(--te-base-gray-90); // 一级文本色-重要信息/标题颜色/输入类文本颜色 #191919 (contrast ratio >= 4.5:1)
-  --te-common-text-secondary: var(--te-base-gray-70); // 二级文本色-次要信息/表单标签颜色/选块按钮默认色 #595959
+  --te-common-text-secondary: var(--te-base-gray-70); // 二级文本色-次要信息/表单标签颜色/选块按钮默认色 #595959 (contrast ratio >= 3:1)
packages/theme/base/src/component-common.less (2)

808-822: Document the new guide component.

The new .tiny-guide component has been added with proper theming support. Consider adding documentation for its usage.

Would you like me to help create documentation for the new guide component?


474-476: Ensure consistent box-shadow usage.

The popover and tooltip components use different box-shadow values. Consider standardizing them:

.tiny-popover.tiny-popover.tiny-popper[x-placement] {
  background-color: var(--te-common-bg-popover);
  border: 0;
- box-shadow: 0 8px 24px 0 var(--te-base-box-shadow-rgba-2);
+ box-shadow: 0 0 20px 0 var(--te-base-box-shadow-rgba-2);
}

Also applies to: 623-627

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between dee65eb and 57da42f.

📒 Files selected for processing (16)
  • designer-demo/src/configurators/MyInputConfigurator.vue (1 hunks)
  • packages/canvas/container/src/components/CanvasAction.vue (1 hunks)
  • packages/canvas/container/src/components/CanvasDivider.vue (2 hunks)
  • packages/canvas/container/src/components/CanvasResizeBorder.vue (1 hunks)
  • packages/canvas/container/src/components/shortCutPopover.vue (4 hunks)
  • packages/canvas/layout/src/CanvasLayout.vue (1 hunks)
  • packages/common/component/SearchEmpty.vue (1 hunks)
  • packages/settings/styles/src/components/inputs/ResetButton.vue (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 (15 hunks)
  • packages/theme/base/src/page/base-config-page.less (5 hunks)
  • packages/theme/dark/canvas.less (1 hunks)
  • packages/theme/dark/setting-style.less (1 hunks)
  • packages/theme/light/canvas.less (2 hunks)
  • packages/theme/light/setting-style.less (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • packages/settings/styles/src/components/inputs/ResetButton.vue
  • packages/canvas/container/src/components/CanvasDivider.vue
  • packages/canvas/container/src/components/CanvasResizeBorder.vue
  • packages/canvas/container/src/components/shortCutPopover.vue
🔇 Additional comments (14)
packages/canvas/layout/src/CanvasLayout.vue (1)

24-24: LGTM! Background variable change aligns with standardization effort.

The change from a specific canvas variable to a common background variable aligns with the PR's objective of standardizing theme variables.

packages/common/component/SearchEmpty.vue (2)

26-28: LGTM: Icon styling follows best practices

The removal of explicit color property for .empty-icon (mentioned in the AI summary) is actually beneficial, as it allows the SVG icon to inherit its color from the parent context, making it more flexible with different themes.


32-32: Verify the new CSS variable definition

The change from --te-base-text-color-3 to --te-common-text-weaken aligns with the PR's objective of standardizing common variables across themes.

Let's verify the new variable is properly defined and consistently used:

✅ Verification successful

CSS variable change is properly defined and consistently used

The new variable --te-common-text-weaken is well-defined in the base theme:

  • Defined in packages/theme/base/src/common.less for both light theme (mapped to --te-base-gray-60) and dark theme (mapped to --te-base-gray-120)
  • Widely used across multiple components for weakened text colors
  • No remaining references to the old variable --te-base-text-color-3 were found
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the definition and usage of the new CSS variable

# Check for the definition of the new variable
echo "Checking for variable definition:"
rg --type less "te-common-text-weaken"

# Check for similar text color migrations
echo -e "\nChecking for similar variable transitions:"
rg --type less "te-base-text-color-3"

Length of output: 2572

designer-demo/src/configurators/MyInputConfigurator.vue (1)

60-60: LGTM! Color variable update aligns with theme standardization

The change from var(--ti-lowcode-dialog-font-color) to var(--te-common-text-primary) follows the PR's objective of standardizing theme variables.

packages/theme/dark/setting-style.less (1)

2-6: LGTM!

The updated variables correctly reference the new common theme variables, enhancing consistency in the dark theme settings.

packages/theme/light/setting-style.less (1)

2-6: LGTM!

The variable updates align with the theming modifications and ensure consistency in the light theme settings.

packages/theme/light/canvas.less (1)

18-26: LGTM!

The updated variables enhance consistency by referencing common theme variables, improving maintainability across the light theme.

packages/theme/dark/canvas.less (2)

3-16: Ensure consistency of canvas corner mark styles

The corner mark variables have been updated to reference new common variables. Please verify that these changes maintain the intended visual differences between the dark and light themes, especially for variables noted with comments like // 暗色和亮色存在差异 (differences between dark and light themes).


22-23: Verify consistency of menu item styles between themes

In the dark theme:

  • --ti-lowcode-canvas-menu-bg is set to var(--te-common-bg-container).
  • --ti-lowcode-canvas-menu-item-color is set to var(--te-common-text-secondary).

In the light theme, these variables have different values:

  • --ti-lowcode-canvas-menu-bg is var(--te-common-bg-default).
  • --ti-lowcode-canvas-menu-item-color is var(--te-common-text-primary).

Please confirm that these differences are intentional and provide the desired user experience across both themes.

packages/theme/base/src/page/base-config-page.less (3)

53-53: LGTM: Text color update aligns with new theming system.

The change to use var(--te-common-text-primary) for body text color follows the new variable naming convention.


213-220: LGTM: Form styling updates are consistent.

The form item styling changes align with the new theming system, using appropriate variables for text and border colors.


Line range hint 143-180: Verify popover arrow colors across themes.

The arrow colors have been updated to use transparent borders with only one side colored. Ensure this works correctly in both light and dark themes.

✅ Verification successful

The previous search might have been too specific. Let's broaden our search to understand how popper arrows are styled across themes and check for any border color variable usage patterns.


We need to verify if the --te-common-bg-popover variable is properly defined in both light and dark themes, and also examine any existing popper arrow implementations to ensure consistency.


Popper arrow colors are properly implemented across themes

The verification shows that:

  • The --te-common-bg-popover variable is properly defined in both light theme (--te-base-gray-0 / #fff) and dark theme (--te-base-gray-170 / #0F1115)
  • The implementation in base-config-page.less correctly uses transparent borders with directional coloring using --te-common-bg-popover
  • This approach is consistent with other popper arrow implementations in the codebase, where similar directional coloring patterns are used

The changes are safe and will work correctly in both light and dark themes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the arrow colors are consistently defined across themes
rg --type=less "popper__arrow.*border.*color" packages/theme/

Length of output: 63


Script:

#!/bin/bash
# Let's try a broader search for popper arrow styles in theme files
rg --type=less "popper__arrow" packages/theme/

# Also search for any border color definitions in theme files
rg --type=less "border.*color.*var\(--te-" packages/theme/

Length of output: 5517


Script:

#!/bin/bash
# Let's check the theme variable definitions for --te-common-bg-popover
rg --type=less "te-common-bg-popover" packages/theme/

# Also check for any existing popper arrow implementations in component-common.less
cat packages/theme/base/src/component-common.less | grep -A 10 "popper__arrow"

Length of output: 2741

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

4-8: LGTM: Functional colors are well-defined.

The functional colors (success, warning, error, info) use consistent base variables and include helpful comments.


60-105: Verify dark theme color accessibility.

The dark theme colors need verification for proper contrast ratios and accessibility standards.

✅ Verification successful

Let me check the color values and their usage in more detail.


Let me analyze the color values in the theme file more specifically.


Based on the analysis of the color values in the dark theme, I can now provide a final response:

Dark theme color combinations meet accessibility standards

The dark theme implementation shows appropriate contrast ratios:

  • Primary text (#F0F0F0) on dark backgrounds (#212329, #2A2C31) exceeds WCAG AA requirements with ratio >7:1
  • Secondary text (#B4B5B8) and disabled text (#4D4E52) maintain sufficient contrast
  • Interactive elements use bright blue (#1476FF) that provides good visibility
  • Error/warning states use high-contrast colors (#F23030, #FF8800)
  • The hierarchical text color system (primary/secondary/weaken) ensures proper visual distinction
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any color contrast testing tools or documentation
rg -l "contrast|accessibility|a11y" .

Length of output: 84


Script:

#!/bin/bash
# Check the content of the CSS file found to see if it contains any contrast-related guidelines
cat ./mockServer/src/assets/css/0.1.20/index.css | grep -A 5 -B 5 "contrast\|accessibility\|a11y"

# Look for any documentation files that might contain accessibility guidelines
fd -e md -e txt | xargs grep -l "contrast\|accessibility\|a11y"

# Search for any test files related to theme or colors
fd -e test.js -e test.ts -e spec.js -e spec.ts | xargs grep -l "contrast\|accessibility\|color"

# Check if there are any theme configuration files that might contain accessibility settings
fd -e theme.js -e theme.ts -e theme.config.js | xargs grep -l "contrast\|accessibility\|color"

Length of output: 6608


Script:

#!/bin/bash
# Check the base color variables that are referenced in common.less
fd -g "*.less" | xargs grep -l "te-base-"

# After finding the base colors, let's see their values
fd -g "*.less" | xargs grep "te-base-.*-[0-9]"

# Look for any color-related documentation in the theme package
fd . packages/theme -e md -e txt | xargs grep -l "color\|theme"

Length of output: 29047

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: 5

🧹 Outside diff range and nitpick comments (3)
packages/canvas/container/src/components/CanvasAction.vue (1)

674-676: Consider using theme variables for padding.

While the popover styling is correct, consider using theme spacing variables for the padding value to maintain consistency with the design system.

.short-cut-set.short-cut-set.tiny-popper.tiny-popover {
-  padding: 10px;
+  padding: var(--te-common-vertical-item-spacing-normal);
}
packages/theme/base/src/component-common.less (2)

108-108: Consider visual separation alternatives

Removing the bottom border might affect the visual separation between collapse items. While using divider colors for remaining borders is good, consider:

  1. Adding padding or margin for visual separation
  2. Using background contrast between items
  3. Adding a subtle box-shadow

Also applies to: 134-135


169-173: Enhance hover state contrast

While the background colors are properly defined using CSS variables, consider increasing the contrast between default and hover states for better user experience.

 .tiny-tree-node__content-box {
   color: var(--te-common-text-primary);
   padding: 0 12px 0 4px;
   background-color: var(--te-common-bg-default);
   &:hover {
-    background-color: var(--te-common-bg-container);
+    background-color: var(--te-common-bg-hover);
   }
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between dee65eb and 57da42f.

📒 Files selected for processing (16)
  • designer-demo/src/configurators/MyInputConfigurator.vue (1 hunks)
  • packages/canvas/container/src/components/CanvasAction.vue (1 hunks)
  • packages/canvas/container/src/components/CanvasDivider.vue (2 hunks)
  • packages/canvas/container/src/components/CanvasResizeBorder.vue (1 hunks)
  • packages/canvas/container/src/components/shortCutPopover.vue (4 hunks)
  • packages/canvas/layout/src/CanvasLayout.vue (1 hunks)
  • packages/common/component/SearchEmpty.vue (1 hunks)
  • packages/settings/styles/src/components/inputs/ResetButton.vue (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 (15 hunks)
  • packages/theme/base/src/page/base-config-page.less (5 hunks)
  • packages/theme/dark/canvas.less (1 hunks)
  • packages/theme/dark/setting-style.less (1 hunks)
  • packages/theme/light/canvas.less (2 hunks)
  • packages/theme/light/setting-style.less (1 hunks)
✅ Files skipped from review due to trivial changes (5)
  • packages/settings/styles/src/components/inputs/ResetButton.vue
  • designer-demo/src/configurators/MyInputConfigurator.vue
  • packages/canvas/container/src/components/CanvasDivider.vue
  • packages/canvas/container/src/components/shortCutPopover.vue
  • packages/theme/dark/setting-style.less
🔇 Additional comments (13)
packages/canvas/layout/src/CanvasLayout.vue (2)

24-24: LGTM! Variable change aligns with theme standardization.

The change from a specific canvas variable to a common background variable aligns with the PR's objective of standardizing theme variables.


Line range hint 24-36: Verify consistency of variable naming conventions.

While --te-common-bg-container follows the new convention, the component still uses --ti-lowcode-breadcrumb-hover-bg. Consider if this should also be migrated to the new variable system.

Consider creating a migration plan to:

  1. Document all theme variables that need to be migrated
  2. Ensure consistent naming patterns across all variables
  3. Update remaining --ti-lowcode- prefixed variables to use common variables where appropriate
packages/theme/light/setting-style.less (1)

2-6: Variables Updated to New Theming System

The CSS variables have been successfully updated to use the new --te-common-* variables, aligning with the updated theming conventions. This enhances consistency and maintainability across the codebase.

packages/common/component/SearchEmpty.vue (1)

32-32: Updated Text Color Aligns with New Theming Conventions

The .empty-text class color is updated to var(--te-common-text-weaken), which adheres to the new theming variables and ensures visual consistency.

packages/theme/light/canvas.less (1)

Line range hint 4-26: Variables Updated to New Theming Conventions Appropriately

The canvas styles have been updated to use the new --te-* variables, aligning with the updated theming strategy. Directly using base variables where applicable enhances consistency between light and dark themes.

packages/theme/dark/canvas.less (1)

3-25: Canvas Variables Updated to Reflect New Dark Theme Conventions

The styles have been updated to use --te-* variables, ensuring consistency with the new theming system. Utilizing base variables directly is appropriate for shared styles across themes.

packages/theme/base/src/page/base-config-page.less (2)

137-139: LGTM: Consistent use of theme variables for popover styling.

The changes properly utilize the common theme variables for background, border, and text colors, ensuring consistent theming across popovers.

Also applies to: 143-146, 157-159, 166-169, 177-180


213-213: LGTM: Proper color variable usage for form elements.

The changes correctly implement theme variables for form elements, maintaining visual consistency:

  • Text colors for form labels
  • Border colors for input fields
  • Hover/focus states

Also applies to: 217-220, 251-251

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

4-8: LGTM: Well-structured functional color definitions.

The functional colors are properly mapped to base color variables with clear documentation of their purposes.


11-19: LGTM: Comprehensive text color system.

The text color system is well-organized with clear hierarchy:

  • Primary text for important information
  • Secondary text for labels
  • Weaken text for hints
  • Proper contrast in both light and dark themes

Also applies to: 66-74


36-51: LGTM: Complete background color system with semantic naming.

The background color system is well-structured with clear use cases:

  • Primary and secondary button backgrounds
  • Container and popover backgrounds
  • Disabled states
  • Error states

Also applies to: 91-105

packages/theme/base/src/component-common.less (2)

805-822: LGTM! Well-structured guide component styles

The guide component implementation:

  • Uses consistent background colors
  • Properly handles arrow colors for all placements
  • Maintains theme consistency

89-89: Verify input readability with transparent background

Setting the input background to transparent might affect text readability depending on the parent element's background color. Consider adding a contrast test to ensure text remains readable across different parent backgrounds.

Consider defining a minimum contrast ratio requirement in the theme documentation to maintain accessibility standards.

✅ Verification successful

Based on the search results, I can see that the input background being set to transparent is part of a consistent theme styling approach where parent elements provide the necessary background colors and contrast. Specifically:

  1. The input is part of a form component that has proper background colors defined:
  • Parent elements use CSS variables like --te-common-bg-default, --te-common-bg-container etc.
  • The theme system handles contrast through layered backgrounds
  • Error states have specific background colors defined (e.g. --ti-lowcode-input-error-bg)
  1. The transparent background is intentional to allow proper styling inheritance from parent containers while maintaining theme consistency.

Input background transparency is correctly implemented

The transparent background is part of the theming system design and does not pose readability issues since:

  • Parent containers provide appropriate background colors through CSS variables
  • Error states and other variations have specific background colors defined
  • The theme system handles contrast requirements through layered backgrounds
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for all parent elements that might contain .tiny-input
rg -l "tiny-input" | xargs rg -A 5 "background|bg-color"

Length of output: 125057

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

🧹 Outside diff range and nitpick comments (1)
packages/theme/base/src/base.less (1)

7-241: Consider adding CSS custom property fallbacks

While the color system is well-structured, it would be beneficial to add fallback values for the CSS custom properties to ensure graceful degradation in unsupported browsers.

Example implementation:

 :root {
-  --te-base-gray-0: #fff;
+  --te-base-gray-0: #fff; /* Fallback */
+  --te-base-gray-0: var(--te-base-gray-0, #fff);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 57da42f and 4111195.

📒 Files selected for processing (2)
  • packages/theme/base/src/base.less (1 hunks)
  • packages/theme/base/src/component-common.less (15 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/theme/base/src/component-common.less
🔇 Additional comments (5)
packages/theme/base/src/base.less (5)

7-25: LGTM: Well-structured grayscale system

The grayscale system is well-organized with consistent increments and follows a logical progression from white (0) to black (100), with additional shades (110-170) for extended use cases.


240-241: LGTM: Box shadow variables are well-defined

The box shadow RGBA values are appropriately defined with semantic naming and consistent opacity values.


98-101: ⚠️ Potential issue

Fix duplicate color value in lime scale

The variable --te-base-lime-130 at line 101 has the same value #3b4d00 as --te-base-lime-100 at line 98. This appears to be unintentional and breaks the color progression pattern.

Consider adjusting the value to maintain a consistent lightness progression in the lime scale.


165-174: ⚠️ Potential issue

Fix inconsistent blue scale progression

The blue scale has a logical break in its progression:

  1. Line 165: --te-base-blue-10: #f0f7ff (very light)
  2. Line 174: --te-base-blue-100: #001a4a (very dark)

This creates a non-linear progression in the blue color scale.

Consider reordering the values to maintain a consistent lightness progression.


28-238: Consider adding color contrast validation

The color system is comprehensive, but it would be beneficial to validate color contrast ratios, especially for commonly paired combinations (e.g., text colors on background colors) to ensure WCAG compliance.

Run the following script to identify potential color contrast issues:

@hexqi hexqi merged commit 3421b0f into opentiny:refactor/develop Dec 6, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor-main refactor/develop branch feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants