feat: Added corner, font and icon customization support!#3
Conversation
|
@ebanDev is attempting to deploy a commit to the Toni's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
This pull request introduces comprehensive customization features for icons, fonts, and corner shapes throughout the theme builder. The implementation adds a centralized icon management system with support for multiple icon packs (lucide, mingcute, hugeicons, carbon, ph, ph-bold, mynaui), font family and weight customization, and CSS corner-shape configuration using the superellipse value.
Key Changes:
- Centralized icon store with preset mappings and dynamic icon switching via
useAppIconscomposable - Font customization with CSS variables for sans, serif, mono families and all font weights (100-900), plus Google Fonts auto-loading
- Corner shape customization using CSS
corner-shapeproperty with superellipse values and slider UI
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 26 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/check-icon-packs.mjs | New validation script to verify icon availability across all supported icon packs via Iconify API |
| app/store/icons.ts | Core icon store managing icon mappings, presets, and pack switching logic |
| app/config/appIcons.ts | App-specific icon key definitions and preset mappings for each icon pack |
| app/composables/useAppIcons.ts | Composable providing reactive access to current icon pack's icon mappings |
| server/api/export-theme.post.ts | Updated export logic to include icons and font/corner CSS in generated theme files |
| package.json | Added icon pack dependencies (@iconify-json packages) and new check:icons script |
| i18n/locales/en.json, de.json | Translation strings for font, icon, and corner shape configuration UI |
| app/store/theme.ts | Added font family, weight, and corner shape CSS variable defaults with reset functionality |
| app/store/savedThemes.ts | Extended theme snapshots to persist icon configurations |
| app/composables/useThemeImport.ts | Import logic updated to handle font variables and ensure defaults for older exports |
| app/composables/useThemeExport.ts | Export logic enhanced to include icon mappings in theme data |
| app/composables/useThemeCss.ts | Font loading logic with Google Fonts integration and dynamic link tag management |
| app/components/VariableConfigurator.vue | Major UI additions for font input fields, icon preset selector, corner shape controls, and randomize theme button |
| app/components/UiSlotDefaults.vue | Updated to use app icon composable instead of hardcoded icon strings |
| app/components/UiOptionSlots.vue | Migrated icon references to use app icon composable |
| app/components/Combobox.vue | Fixed incorrect import and updated icon usage |
| app/components/ColorListing.vue | Converted icon strings to use app icon composable |
| app/components/AppNavigation.vue | Navigation icons now use dynamic app icons |
| app/components/AppHeader.vue | Header action icons migrated to app icon system |
| app/components/AIGenerateThemeModal.vue | Modal icons updated to use app icon composable |
| app/pages/preview.vue | Preview page icons converted to dynamic references with stray text cleanup needed |
| app/pages/index.vue | Landing page icons updated to use app icon composable |
| app/assets/css/main.css | Added font CSS variables and utility classes for all weights |
| app/app.vue | Icon store synchronization with app config via watchEffect |
| app/app.config.ts | Default Nuxt UI icon mappings and font variable definitions |
Comments suppressed due to low confidence (1)
app/store/theme.ts:37
- Multiple German comments are present in this file. Consider translating to English for consistency with the rest of the codebase. Examples: "Name der CSS-Variable (ohne --)", "Typ der Zuweisung", "Wert oder Referenz", "Anzeigename für die UI", "Kategorie für die Gruppierung in der UI", "Ausgewählte Grundfarbe (ohne Shade) für die UI", and "Vordefinierte CSS-Variablen".
// Definiere die zusätzlichen CSS-Variablen
export type CssVariableType = 'color-reference' | 'direct-value';
export interface CssVariableMapping {
name: string; // Name der CSS-Variable (ohne --)
type: CssVariableType; // Typ der Zuweisung (Farbreferenz oder direkter Wert)
value: string; // Wert oder Referenz
label: string; // Anzeigename für die UI
category: string; // Kategorie für die Gruppierung in der UI
selectedColor?: string; // Ausgewählte Grundfarbe (ohne Shade) für die UI
}
export type ThemeMode = 'light' | 'dark';
// Vordefinierte CSS-Variablen
export const predefinedCssVariables: CssVariableMapping[] = [
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function normalizeCornerShapeValue(raw: string): string { | ||
| if (!raw) return 'superellipse(1)'; | ||
| const trimmed = raw.trim().toLowerCase(); | ||
| const match = trimmed.match(/^superellipse\(([^)]+)\)$/); | ||
| if (match) { | ||
| const arg = match[1].replace(/\s+/g, ''); | ||
| if (/^-?inf(?:inity)?$/.test(arg)) return arg.startsWith('-') ? 'superellipse(-inf)' : 'superellipse(inf)'; | ||
| const num = Number(arg); | ||
| if (Number.isFinite(num)) return `superellipse(${trimTrailingZeros(num)})`; | ||
| return `superellipse(${arg})`; | ||
| } | ||
| return trimmed; | ||
| } | ||
|
|
||
| function parseCornerShapeNumeric(raw: string): number { | ||
| const normalized = normalizeCornerShapeValue(raw); | ||
| const keywords: Record<string, number> = { | ||
| square: 4, | ||
| squircle: 2, | ||
| round: 1, | ||
| bevel: 0, | ||
| scoop: -1, | ||
| notch: -4, | ||
| }; | ||
| if (normalized in keywords) return keywords[normalized]; | ||
|
|
||
| const match = normalized.match(/^superellipse\(([^)]+)\)$/); | ||
| if (match) { | ||
| const arg = match[1]; | ||
| if (/^-?inf/.test(arg)) return arg.startsWith('-') ? -4 : 4; | ||
| const num = Number(arg); | ||
| if (Number.isFinite(num)) return num; | ||
| } | ||
|
|
||
| const fallback = Number(normalized); | ||
| return Number.isFinite(fallback) ? fallback : 1; | ||
| } |
There was a problem hiding this comment.
Inconsistent handling of infinity values: the normalization returns 'superellipse(-inf)' and 'superellipse(inf)' strings, but the parsing function expects regex patterns like '/^-?inf/' which would match 'infinity', 'inf', etc. The regex should be more explicit to match the exact format produced by normalization.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Just implemented some of Copilot's suggestions, btw @Rareer maybe you should consider changing the license because it being (c) (according to readme) basically makes this PR illegal 😅 |
This pull request introduces a unified icon management system and adds fonts and corner configuration throughout the app. The most significant changes are the addition of a centralized icon mapping in the app config, updates to font variables and weights in CSS, and refactoring of all icon usage in components to use a new icon composable. This improves maintainability and consistency for icons and fonts across the codebase.
Icon customization:
iconsmapping toapp.config.tsfor all icon names and their Lucide icon references.AppHeader.vue,AppNavigation.vue,AIGenerateThemeModal.vue,ColorListing.vue) with the newuseAppIconscomposable for consistent icon usage.app.vueusing a new watch effect, ensuring dynamic icon updates.lucide,mingcute,ph,ph-bold,hugeicons,carbonandmynauiicon packsFont customization:
--font-sans,--font-serif, and--font-mono, and added font-weight variables and utility classes for all font weights inmain.css.Corner Shape customization
ui-corner-shapevariable customizable through the panel that corresponds to the new CSS value (https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/corner-shape-value)