-
Notifications
You must be signed in to change notification settings - Fork 8.4k
feat: add global font size adjustment #6909
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
+112
−13
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
24b6e7a
feat: add global font size adjustment
0bc7169
feat: add global font size adjustment
c3a7562
Merge branch 'main' into milletpeak-fontsize
jinmao88 fb8f36e
Merge branch 'main' into milletpeak-fontsize
milletpeak cd7c11c
fix: run 'pnpm format' update various components and improve layout s…
c142af4
fix: update snapshot for defaultPreferences immutability test to refl…
aaf0274
feat: add menu font size variable and update related components
f7d9d1b
chore: update package.json and app.vue imports, and ensure global sty…
1f1ba16
Merge branch 'main' into milletpeak-fontsize
milletpeak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
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
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
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
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
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
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
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
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
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
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
62 changes: 62 additions & 0 deletions
62
packages/effects/layouts/src/widgets/preferences/blocks/theme/font-size.vue
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 |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| <script setup lang="ts"> | ||
| import { watch } from 'vue'; | ||
|
|
||
| import { $t } from '@vben/locales'; | ||
|
|
||
| import { | ||
| NumberField, | ||
| NumberFieldContent, | ||
| NumberFieldDecrement, | ||
| NumberFieldIncrement, | ||
| NumberFieldInput, | ||
| } from '@vben-core/shadcn-ui'; | ||
|
|
||
| defineOptions({ | ||
| name: 'PreferenceFontSize', | ||
| }); | ||
|
|
||
| const modelValue = defineModel<number>({ | ||
| default: 16, | ||
| }); | ||
|
|
||
| const min = 15; | ||
| const max = 22; | ||
| const step = 1; | ||
|
|
||
| // 限制输入值在 min 和 max 之间 | ||
| watch( | ||
| modelValue, | ||
| (newValue) => { | ||
| if (newValue < min) { | ||
| modelValue.value = min; | ||
| } else if (newValue > max) { | ||
| modelValue.value = max; | ||
| } | ||
| }, | ||
| { immediate: true }, | ||
| ); | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="flex w-full flex-col gap-4"> | ||
| <div class="flex items-center gap-2"> | ||
| <NumberField | ||
| v-model="modelValue" | ||
| :max="max" | ||
| :min="min" | ||
| :step="step" | ||
| class="w-full" | ||
| > | ||
| <NumberFieldContent> | ||
| <NumberFieldDecrement /> | ||
| <NumberFieldInput /> | ||
| <NumberFieldIncrement /> | ||
| </NumberFieldContent> | ||
| </NumberField> | ||
| <span class="text-muted-foreground whitespace-nowrap text-xs">px</span> | ||
| </div> | ||
| <div class="text-muted-foreground text-xs"> | ||
| {{ $t('preferences.theme.fontSizeTip') }} | ||
| </div> | ||
| </div> | ||
| </template> |
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Universal selector with
!importantposes significant risk.The rule
* { font-size: inherit !important; }is extremely aggressive and will forcibly override font sizes in all descendant elements, including:This could cause unexpected layout issues or break functionality in nested components.
Consider removing this rule or applying font-size inheritance more selectively:
If inheritance is truly needed, apply it only to specific elements or use a more targeted approach without
!important.📝 Committable suggestion
🤖 Prompt for AI Agents