-
Notifications
You must be signed in to change notification settings - Fork 54
refactor(spx-gui): migrate XBuilder frontend styling to Tailwind CSS #3002
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
Merged
Merged
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
13b072a
sv
cn0809 5f1336f
disable tailwind preflight
cn0809 f4776a4
fix: theme leading/text variables & tailwind utilities confliction w…
cn0809 a29a896
batch migration task 1
cn0809 187b3b5
batch migration task 2 - asset
cn0809 02fc528
copilot
cn0809 45de467
editor - wip
cn0809 3162053
almost done
cn0809 e9147cd
details
cn0809 c805022
move UI component base styles into Tailwind component layer
cn0809 6186c06
move template root comment outside
cn0809 91a979e
fix incompatible css nesting & some details
cn0809 2dcea76
update doc
cn0809 4de24d9
refine tailwind flex utility usage and styling guidelines
cn0809 f66966c
fix: missing navbar background image
cn0809 296ad01
fix: css layer order messed up in split css chunk
cn0809 4be17fd
fix: utilities not work for UITextInput/UIDivider/UIRadioGroup
cn0809 4211331
draft: vue 3+ tailwind 4 component guildelines
cn0809 839a15f
migrate UIButton to recipe-based tailwind styling
cn0809 f5b456d
fix: unexpected twMerge result due to non-standard tailwind tokens
cn0809 3c53ec0
migrate UI components to tailwind v4 & remove scss deps
cn0809 3bbc569
support custom text-size utilities in twMerge
cn0809 da499a5
move input layout classes to native wrappers & update docs
cn0809 fe74845
Use naive-ui with layer support (#2)
nighca bd9c494
text-body -> text-base & remove redundant descriptions in docs
cn0809 166d8ad
simplify root class merging in UI components
cn0809 1e85dc5
remove redundant layer order declarations
cn0809 3b5b7f0
fix: restore loading compatibility hooks for project runner
cn0809 76f1026
align component styles with css layers and root class merging
cn0809 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| { | ||
| "recommendations": [ | ||
| "Vue.volar", | ||
| "vue.volar", | ||
| "dbaeumer.vscode-eslint", | ||
| "esbenp.prettier-vscode" | ||
| "esbenp.prettier-vscode", | ||
| "bradlc.vscode-tailwindcss" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,6 +80,55 @@ When working with backend unique string identifiers such as `username`, project | |
|
|
||
| * Generate accessibility info for interactive elements using `v-radar` directive. | ||
|
|
||
| ## Styling Preferences | ||
|
|
||
| ### Defaults | ||
|
|
||
| * Use Tailwind as the default for local layout and surface styling. | ||
| * Keep styles local to the page/feature/component. Do not move local styles into `src/app.css`. | ||
| * Prefer readable template utilities and remove redundant local style blocks when they no longer improve clarity. | ||
| * Prefer direct template utilities over local `@apply` blocks when the styles are only used by one or two template nodes. | ||
| * If local authored styles are still needed, use plain CSS. | ||
|
|
||
| ### Boundaries and Source of Truth | ||
|
|
||
| * Keep `src/app.css` limited to Tailwind entry setup, theme bridge, and rare project-wide utilities. | ||
| * Keep `src/components/ui/global.css` and `src/components/ui/reset.css` as the base reset/foundation layer (Tailwind preflight stays disabled). | ||
| * Keep `--ui-*` tokens as the source of truth. | ||
| * In Tailwind classes, prefer bridged semantic tokens (for example `text-text`, `text-title`, `bg-primary-100`). | ||
| * In local CSS, prefer direct `--ui-*` variables instead of bridged Tailwind variables. | ||
|
|
||
| ### Responsive and Theme Rules | ||
|
|
||
| * Keep breakpoints in `src/app.css` aligned with `src/components/ui/responsive.ts`. | ||
| * Use only `tablet`, `desktop`, and `desktop-large` responsive names. | ||
| * Prefer responsive CSS/Tailwind variants over `useResponsive()`; keep `useResponsive()` for non-style runtime logic. | ||
| * Keep Tailwind theme namespaces reset to project tokens only (color, shadow, font, text, radius, etc.). | ||
|
|
||
| ### When Local CSS Is Better | ||
|
|
||
| * Keep local CSS for `:deep(...)`, generated content, third-party DOM overrides, and complex stateful widgets. | ||
| * Keep a small local CSS rule for structural selectors that are awkward in template logic (for example nested `:last-child` rules) instead of encoding them with hard-to-read dynamic class expressions. | ||
| * Prefer plain local CSS over complex Tailwind descendant/arbitrary selectors for cross-component or slot-content styling. | ||
| * Preserve semantic hook classes used by parent selectors or slots (for example `.corner-menu`, `.course-item-mini`). | ||
| * For newly added components, avoid introducing `:deep(...)` selectors and cross-file hook classes when possible, since they increase maintenance cost. | ||
| * Do not force full Tailwind conversion when a small local style block is clearer. | ||
|
|
||
| ### Practical Styling Notes | ||
|
|
||
| * Prefer standard Tailwind utility names when practical. For example, use `rounded-md` instead of a project-local alias like `rounded-2`; this keeps overrides more predictable because `tailwind-merge` understands standard utility groups better. | ||
|
nighca marked this conversation as resolved.
Outdated
|
||
| * For root-class overrides and utility conflicts: | ||
| - For business components, external root `class` overrides are allowed by default. If utility conflicts need an explicit winner, prefer adding Tailwind's important modifier at the usage site (for example `rounded-md!`, `w-32!`) instead of expanding the component API. This keeps intent explicit, usage concise, and matches the fact that business components rarely need nested override chains. | ||
| - For most UI components, `twMerge` and `@layer components` are set up so external utilities or custom classes can override root classes in the common case without special handling, though edge cases can still exist. | ||
| - For the Naive UI-root components listed in `src/components/ui/README.md`, avoid relying on external `class` for styling-critical overrides when possible; the final result is often hard to predict. | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. root class 覆盖规则更新到这里了 |
||
| * Avoid non-equivalent Tailwind simplifications for flex values. In particular, `flex: 1 1 0` is not equivalent to Tailwind `flex-1` (`flex: 1 1 0%`), so do not simplify between them unless the layout behavior has been verified. Likewise, do not simplify `flex: 0 0 auto` to `shrink-0`; use the equivalent `flex-none` when that shorthand is desired. | ||
| * Prefer `style` / `:style` for one-off values when clearer than Tailwind arbitrary utilities. For example, prefer `style="box-shadow: 0 24px 32px -16px rgba(0, 0, 0, 0.1)"` over a long arbitrary utility such as `shadow-[0_24px_32px_-16px_rgba(0,0,0,0.1)]`. | ||
| * For important/non-obvious background assets, prefer TS imports and inline `backgroundImage` binding. | ||
| * Keep fixed utility classes in `class`; reserve `:class` for stateful/dynamic parts only. | ||
| * In plain `<style scoped>`, flatten `:deep(...)` selectors (for example `.preview :deep(svg)`) so the final selector structure and specificity stay obvious. | ||
| * Do not use native CSS nesting in plain `<style>` / `<style scoped>` blocks; use flat selectors to avoid browser compatibility issues. | ||
| * Keep single-use values local; only add setup variables when reused/computed or clearly improving readability. | ||
|
|
||
| ### Menu Item Text Guidelines | ||
|
|
||
| When creating or modifying menu items, follow these UI guidelines for ellipses: | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.