Skip to content

feat(theme): change incorrect css variables and delete the ‘less’ file #1121

Merged
hexqi merged 8 commits intoopentiny:refactor/developfrom
xuanlid:feat/deleteVars
Feb 18, 2025
Merged

feat(theme): change incorrect css variables and delete the ‘less’ file #1121
hexqi merged 8 commits intoopentiny:refactor/developfrom
xuanlid:feat/deleteVars

Conversation

@xuanlid
Copy link
Contributor

@xuanlid xuanlid commented Feb 14, 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

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
    • Updated layout constraints and refined color schemes to enhance visual consistency, including improved active state, button, and code editor styling.
    • Adjusted modal spacing and element padding with new CSS custom properties for a more uniform appearance.
    • Removed outdated CSS variables and classes related to dark and light themes, streamlining the styling process.
    • Introduced new CSS variables for modal padding and offsets to enhance styling capabilities.
    • Modified background colors for various components to align with updated design specifications.
    • Added a new CSS variable for the canvas container's background color in a "white" state.
  • Chores
    • Consolidated theme configurations by removing redundant styling files and outdated variables from dark and light modes.
    • Removed dependencies related to dark and light themes from multiple project files.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2025

Walkthrough

This pull request refines the CSS styles and variable usages across multiple components. It updates CSS variable names in several Vue components, replaces variable references with fixed values in certain cases, and removes numerous legacy and redundant Less files for both dark and light themes. The changes focus on the styling layers, ensuring design consistency and eliminating outdated configurations.

Changes

File(s) Change Summary
packages/layout/src/Main.vue Updated the min-width property from var(--base-min-width) to var(--te-base-min-width).
packages/plugins/tree/src/styles/vars.less Changed --te-tree-block-text-color from referencing a secondary prompt color to var(--te-common-text-purple).
packages/settings/design/src/App.vue,
packages/settings/design/src/components/PropertyCanvas.vue,
packages/settings/design/src/components/PropertyList.vue
Renamed several CSS variables (e.g., secondary text, hover background, mask bg) to a new naming convention and updated corresponding style references (including direct background-color assignment for .tiny-button).
packages/settings/design/src/components/ArrayConfigItemForm.vue Replaced CSS variable references for the code editor’s border and text color with direct fixed color assignments (#595959).
packages/settings/design/src/components/SettingPanel.vue Removed a CSS width rule for the tiny-switch and added a new property to the component.
packages/settings/styles/src/components/inputs/ModalMask.vue Replaced CSS variable references with fixed pixel values for padding, right, and left properties.
packages/settings/styles/src/components/typography/TypographyGroup.vue Removed a CSS rule that targeted the inner input padding of a select component.
packages/theme/base/src/base.less Added new CSS variables for modal padding and offsets.
Dark Theme Files
(packages/theme/dark/block.less, bridge.less, canvas.less, datasource.less, events.less, gpt-dialog.less, help.less, i18n.less, index.less, life-cycles.less, materials.less, metaComponent.less, pageManage.less, plugin-js.less, setting-style.less, settings.less, toolbar.less, tree.less, tutorial.less, variable.less)
Removed multiple Less files and import statements, eliminating legacy dark theme CSS configurations and variable definitions.
Light Theme Files
(packages/theme/light/block.less, bridge.less, canvas.less, datasource.less, events.less, gpt-dialog.less, help.less, i18n.less, index.less, life-cycles.less, materials.less, metaComponent.less, pageManage.less, plugin-js.less, setting-style.less, settings.less, toolbar.less, tree.less, tutorial.less, variable.less)
Removed multiple Less files and import statements, eliminating legacy light theme CSS configurations and variable definitions.

Sequence Diagram(s)

Possibly related PRs

  • feat: Modify css variables #1051: The changes in the main PR, which involve modifying a CSS property in Main.vue, are related to the updates in the retrieved PR that also focus on CSS variables, specifically the introduction of new variables and modifications to existing ones in base.less, indicating a direct connection in terms of styling adjustments.
  • feat(refactor/theme): change incorrect css variables to the common variables and delete theme/base.less #1049: The changes in the main PR, which involve modifying a CSS property in Main.vue, are related to the changes in the retrieved PR, which also focuses on updating CSS variables across various components, including those in CanvasDivider.vue, indicating a shared goal of standardizing CSS variable usage.
  • fix:Modify panel shadow color #943: The changes in the main PR, which involve modifying a CSS property in Main.vue, are related to the updates in the retrieved PR that also involve CSS variable modifications across various components, indicating a shared focus on styling adjustments.

Suggested labels

refactoring, enhancement

Suggested reviewers

  • lichunn
  • hexqi

Poem

I'm a bunny with hops so light,
Tweaking styles from morn 'til night.
CSS variables now sleek and new,
A garden of changes just for you.
Hop along, let designs delight!
🐇✨


📜 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 54da9fa and 1bcdd01.

📒 Files selected for processing (2)
  • packages/engine-cli/template/designer/package.json (1 hunks)
  • scripts/updateTemplate.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/engine-cli/template/designer/package.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (1)
scripts/updateTemplate.mjs (1)

65-65:

Details

❓ Verification inconclusive

LGTM! Verify theme-related functionality.

The removal of VITE_THEME=light environment variables aligns with the PR objectives of removing theme-related configurations.

Please ensure that:

  1. All theme-dependent components and styles work correctly without the environment variable.
  2. Documentation is updated to reflect this change.

Run this script to check for any remaining theme-related environment variables or configurations:

Also applies to: 67-67, 68-68


🏁 Script executed:

#!/bin/bash
# Description: Check for remaining theme-related configurations

# Search for VITE_THEME in configuration files
echo "Checking for VITE_THEME in configuration files..."
rg -l "VITE_THEME" --type json --type js

# Search for theme-related imports
echo "Checking for theme-related imports..."
rg -l "@opentiny/tiny-engine-theme" --type js

Length of output: 512


LGTM – Removal in updateTemplate.mjs aligns with the PR objectives.
The changes correctly remove the VITE_THEME=light variable from the defaultScripts object, helping to eliminate theme-related configurations in this part of the code. However, the shell script search revealed additional references to VITE_THEME (in files like designer-demo/engine.config.js, packages/engine-cli/src/commands/generateConfig.js, and packages/engine-cli/template/designer/engine.config.js) as well as theme-related imports (e.g., in packages/build/vite-config/src/vite-plugins/devAliasPlugin.js and packages/design-core/src/init.js).

Please ensure that all theme-dependent components and styles function correctly without these configurations, and confirm whether further removals or adjustments are required elsewhere in the repository to fully align with the PR’s goals.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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.

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/settings/design/src/components/PropertyList.vue (1)

97-97:

Details

❓ Verification inconclusive

Verify the new CSS variable definitions and update documentation.

The CSS variables have been updated to use the new te-setting-design prefix:

  • --te-setting-design-secondary-text-color
  • --te-setting-design-hover-bg-color

Let's verify these variables are properly defined:

Consider adding theme migration documentation if this change affects custom themes. This helps users understand:

  • The rationale behind the variable name changes
  • How to update their custom themes
  • The complete list of renamed variables

Would you like me to help draft the theme migration documentation?

Also applies to: 119-119


🏁 Script executed:

#!/bin/bash
# Search for the definition of new CSS variables
rg --type css --type less "te-setting-design-(secondary-text|hover-bg)-color"

# Search for any remaining old variable names to ensure complete migration
rg --type css --type less "ti-lowcode-common-(secondary-text|hover-bg)-color"

Length of output: 159


Action Required: Verify CSS Variable Definitions and Update Theme Documentation

The changes in lines 97 and 119 update the CSS variables to the new te-setting-design prefix. However, our automated search did not return any definitions for these variables. Please manually verify that:

  • The new variables:

    • --te-setting-design-secondary-text-color (line 97)
    • --te-setting-design-hover-bg-color (line 119)

    are defined in the codebase or imported via external theme/style files.

  • There are no remaining references to the old variable names (with the ti-lowcode-common prefix) that might cause inconsistencies.

Additionally, if the migration to these new variables impacts custom themes, consider updating the theme migration documentation to clearly communicate the changes and provide guidance for users updating their custom themes.

packages/theme/base/src/base.less (1)

321-324: Enhance documentation for the new "基础配置" section.

For consistency with other sections in the file, consider:

  1. Adding English translation alongside Chinese comments
  2. Including more detailed documentation about the purpose and usage of these base configurations

Apply this diff to improve documentation:

  /**
-  * 基础配置
+  * 基础配置 (Base Configuration)
+  * Contains fundamental layout settings used across components
+  * @property --te-base-min-width Minimum width for the application layout
   **/
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 66068fb and d0f7b36.

📒 Files selected for processing (50)
  • packages/layout/src/Main.vue (1 hunks)
  • packages/plugins/tree/src/styles/vars.less (1 hunks)
  • packages/settings/design/src/App.vue (3 hunks)
  • packages/settings/design/src/components/ArrayConfigItemForm.vue (1 hunks)
  • packages/settings/design/src/components/PropertyCanvas.vue (1 hunks)
  • packages/settings/design/src/components/PropertyList.vue (2 hunks)
  • packages/settings/design/src/components/SettingPanel.vue (0 hunks)
  • packages/settings/styles/src/components/inputs/ModalMask.vue (1 hunks)
  • packages/settings/styles/src/components/typography/TypographyGroup.vue (0 hunks)
  • packages/theme/base/src/base.less (1 hunks)
  • packages/theme/dark/block.less (0 hunks)
  • packages/theme/dark/bridge.less (0 hunks)
  • packages/theme/dark/canvas.less (0 hunks)
  • packages/theme/dark/datasource.less (0 hunks)
  • packages/theme/dark/events.less (0 hunks)
  • packages/theme/dark/gpt-dialog.less (0 hunks)
  • packages/theme/dark/help.less (0 hunks)
  • packages/theme/dark/i18n.less (0 hunks)
  • packages/theme/dark/index.less (0 hunks)
  • packages/theme/dark/life-cycles.less (0 hunks)
  • packages/theme/dark/materials.less (0 hunks)
  • packages/theme/dark/metaComponent.less (0 hunks)
  • packages/theme/dark/pageManage.less (0 hunks)
  • packages/theme/dark/plugin-js.less (0 hunks)
  • packages/theme/dark/setting-style.less (0 hunks)
  • packages/theme/dark/settings.less (0 hunks)
  • packages/theme/dark/toolbar.less (0 hunks)
  • packages/theme/dark/tree.less (0 hunks)
  • packages/theme/dark/tutorial.less (0 hunks)
  • packages/theme/dark/variable.less (0 hunks)
  • packages/theme/light/block.less (0 hunks)
  • packages/theme/light/bridge.less (0 hunks)
  • packages/theme/light/canvas.less (0 hunks)
  • packages/theme/light/datasource.less (0 hunks)
  • packages/theme/light/events.less (0 hunks)
  • packages/theme/light/gpt-dialog.less (0 hunks)
  • packages/theme/light/help.less (0 hunks)
  • packages/theme/light/i18n.less (0 hunks)
  • packages/theme/light/index.less (0 hunks)
  • packages/theme/light/life-cycles.less (0 hunks)
  • packages/theme/light/materials.less (0 hunks)
  • packages/theme/light/metaComponent.less (0 hunks)
  • packages/theme/light/pageManage.less (0 hunks)
  • packages/theme/light/plugin-js.less (0 hunks)
  • packages/theme/light/setting-style.less (0 hunks)
  • packages/theme/light/settings.less (0 hunks)
  • packages/theme/light/toolbar.less (0 hunks)
  • packages/theme/light/tree.less (0 hunks)
  • packages/theme/light/tutorial.less (0 hunks)
  • packages/theme/light/variable.less (0 hunks)
💤 Files with no reviewable changes (42)
  • packages/theme/light/plugin-js.less
  • packages/theme/light/tree.less
  • packages/theme/light/help.less
  • packages/theme/light/bridge.less
  • packages/theme/dark/settings.less
  • packages/theme/dark/canvas.less
  • packages/theme/dark/plugin-js.less
  • packages/theme/dark/toolbar.less
  • packages/theme/dark/block.less
  • packages/settings/styles/src/components/typography/TypographyGroup.vue
  • packages/theme/dark/tree.less
  • packages/theme/dark/help.less
  • packages/theme/light/settings.less
  • packages/theme/dark/i18n.less
  • packages/theme/light/block.less
  • packages/theme/dark/materials.less
  • packages/theme/light/metaComponent.less
  • packages/theme/light/datasource.less
  • packages/theme/dark/setting-style.less
  • packages/theme/dark/bridge.less
  • packages/theme/light/toolbar.less
  • packages/theme/light/life-cycles.less
  • packages/theme/dark/events.less
  • packages/theme/dark/datasource.less
  • packages/theme/light/tutorial.less
  • packages/theme/dark/tutorial.less
  • packages/theme/dark/gpt-dialog.less
  • packages/theme/light/events.less
  • packages/theme/dark/metaComponent.less
  • packages/theme/light/i18n.less
  • packages/theme/dark/life-cycles.less
  • packages/theme/dark/pageManage.less
  • packages/theme/dark/variable.less
  • packages/theme/light/pageManage.less
  • packages/theme/light/setting-style.less
  • packages/theme/light/variable.less
  • packages/settings/design/src/components/SettingPanel.vue
  • packages/theme/light/index.less
  • packages/theme/light/materials.less
  • packages/theme/light/canvas.less
  • packages/theme/dark/index.less
  • packages/theme/light/gpt-dialog.less
✅ Files skipped from review due to trivial changes (6)
  • packages/layout/src/Main.vue
  • packages/plugins/tree/src/styles/vars.less
  • packages/settings/design/src/components/ArrayConfigItemForm.vue
  • packages/settings/design/src/App.vue
  • packages/settings/styles/src/components/inputs/ModalMask.vue
  • packages/settings/design/src/components/PropertyCanvas.vue
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (1)
packages/theme/base/src/base.less (1)

324-324:

Details

❓ Verification inconclusive

Consider responsive design implications of fixed min-width.

While 1280px is a common desktop breakpoint, a fixed minimum width might cause issues on smaller screens. Consider:

  1. Using a responsive approach with media queries
  2. Documenting the rationale for this specific value

Let's check if this value is causing any responsive design issues:


🏁 Script executed:

#!/bin/bash
# Search for any existing responsive design patterns or media queries
rg -i "media|breakpoint|responsive" --type css

Length of output: 8264


Responsive Breakpoint Evaluation for Fixed Min-Width

In packages/theme/base/src/base.less at line 324, the variable --te-base-min-width: 1280px; is set as a fixed value. Our search shows that the codebase employs several media queries (e.g., in mockServer/src/assets/css/0.1.20/index.css) using various breakpoints. Please verify that a fixed min-width of 1280px is fully aligned with your overall responsive design strategy. If this value is an intentional design decision for desktop layouts, consider adding a comment that documents the rationale. Otherwise, refactoring to incorporate a responsive approach—potentially by leveraging media queries—might help avoid issues on smaller screens.

@hexqi hexqi added this to the v2.3.0 milestone Feb 17, 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 (1)
packages/build/vite-config/src/vite-plugins/devAliasPlugin.js (1)

53-53: Consider documenting theme migration strategy.

With the removal of dark and light themes, and only the base theme remaining, it would be helpful to document:

  1. How theme customization should now be handled
  2. Migration steps for projects using the removed themes
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4d07edf and 54da9fa.

📒 Files selected for processing (3)
  • designer-demo/package.json (1 hunks)
  • packages/build/vite-config/src/vite-plugins/devAliasPlugin.js (1 hunks)
  • packages/engine-cli/src/commands/generateConfig.js (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/engine-cli/src/commands/generateConfig.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • designer-demo/package.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (1)
packages/build/vite-config/src/vite-plugins/devAliasPlugin.js (1)

83-83:

Details

✅ Verification successful

Verify theme-related dependencies after alias removal.

The removal of theme-related aliases suggests a significant change in the theming approach. Please ensure that:

  1. All theme-related imports in the codebase have been updated
  2. No components are still trying to import the removed theme packages

🏁 Script executed:

#!/bin/bash
# Description: Search for any remaining references to the removed theme packages

echo "Searching for theme package imports..."
rg -l '@opentiny/tiny-engine-theme-dark|@opentiny/tiny-engine-theme-light'

echo "Checking package.json files for theme dependencies..."
find . -name 'package.json' -exec grep -l '"@opentiny/tiny-engine-theme-\(dark\|light\)"' {} \;

Length of output: 379


Theme removal verified and approved.

The alias refactor in packages/build/vite-config/src/vite-plugins/devAliasPlugin.js (line 83) cleanly removes theme-related mappings. Our search found no lingering imports or dependency declarations for @opentiny/tiny-engine-theme-dark and @opentiny/tiny-engine-theme-light in the codebase or in any package.json files. This confirms that the intended architectural changes to remove theme functionality have been successfully applied.

  • Confirmed removal of theme aliases and related code.
  • No residual dependencies or imports were detected.

@hexqi hexqi merged commit 1a55877 into opentiny:refactor/develop Feb 18, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants