From 86b6c4f85b7b30bb4a13d57450a76bf4c28a3fff Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Wed, 23 Jul 2025 15:30:57 -0400 Subject: [PATCH] fix: inject Tailwind CSS into client entry point (#1537) Added a Vite plugin to automatically inject the Tailwind CSS import into the `unraid-components.client.js` entry file, enhancing the integration of Tailwind CSS within the application. This change improves the setup for styling components consistently across the project. ## Summary by CodeRabbit * **New Features** * Added automated validation to ensure Tailwind CSS styles are correctly included in the custom elements build output. * **Chores** * Updated the build process to include a CSS validation step after manifest generation. * Enhanced development build configuration to enable CSS source maps and optimize Tailwind CSS injection into web components. * Extended CSS theme with new responsive breakpoint variables. * Improved CSS class specificity in user profile, server state, and update modal components for consistent styling. * Removed redundant style blocks and global CSS imports from multiple components to streamline styling and reduce duplication. --- .claude/settings.local.json | 9 +- .../include/web-components-extractor.php | 1 + web/assets/main.css | 6 + web/components/Activation/WelcomeModal.ce.vue | 54 ------ web/components/ApiKeyPage.ce.vue | 5 - web/components/Auth.ce.vue | 6 - web/components/CallbackHandler.ce.vue | 6 - web/components/ColorSwitcher.ce.vue | 6 - .../ConnectSettings/ConnectSettings.ce.vue | 5 - web/components/DevSettings.vue | 6 - web/components/DowngradeOs.ce.vue | 6 - web/components/DownloadApiLogs.ce.vue | 6 - web/components/DummyServerSwitcher.vue | 6 - web/components/HeaderOsVersion.ce.vue | 7 - web/components/Logs/LogViewer.ce.vue | 6 - web/components/Modals.ce.vue | 54 ------ web/components/RClone/RCloneConfig.vue | 5 - web/components/Registration.ce.vue | 6 - web/components/SsoButton.ce.vue | 6 - web/components/ThemeSwitcher.ce.vue | 6 - web/components/UpdateOs.ce.vue | 54 ------ web/components/UpdateOs/ChangelogModal.vue | 6 +- .../UpdateOs/CheckUpdateResponseModal.vue | 17 +- web/components/UpdateOs/Downgrade.vue | 6 - web/components/UpdateOs/Update.vue | 6 - web/components/UpdateOs/UpdateIneligible.vue | 6 - web/components/UserProfile.ce.vue | 64 +------ .../UserProfile/CallbackFeedback.vue | 54 ------ .../UserProfile/DropdownLaunchpad.vue | 71 -------- web/components/UserProfile/ServerState.vue | 2 +- web/components/WanIpCheck.ce.vue | 6 - .../Wrapper/web-component-plugins.ts | 20 ++- web/nuxt.config.ts | 123 ++++---------- web/package.json | 3 +- web/pages/index.vue | 14 -- web/scripts/validate-custom-elements-css.js | 158 ++++++++++++++++++ 36 files changed, 242 insertions(+), 580 deletions(-) create mode 100644 web/scripts/validate-custom-elements-css.js diff --git a/.claude/settings.local.json b/.claude/settings.local.json index eb4cb4f57..45f0a7bae 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -16,7 +16,6 @@ "mcp__ide__getDiagnostics", "Bash(pnpm --filter \"*connect*\" test connect-status-writer.service.spec)", "Bash(pnpm storybook:*)", - "Bash(rm:*)", "Bash(pnpm add:*)", "Bash(pnpm install:*)", "Bash(pkill:*)", @@ -33,7 +32,13 @@ "Bash(pnpm --filter @unraid/ui build)", "Bash(pnpm --filter @unraid/web build)", "Bash(python3:*)", - "Bash(pnpm tailwind:build:*)" + "Bash(pnpm tailwind:build:*)", + "WebFetch(domain:erangrin.github.io)", + "Bash(pnpm clean:*)", + "Bash(pnpm validate:css:*)", + "Bash(node:*)", + "Bash(rm:*)", + "Bash(pnpm run:*)" ] }, "enableAllProjectMcpServers": false diff --git a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/web-components-extractor.php b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/web-components-extractor.php index d5a4ca768..bbebeff38 100644 --- a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/web-components-extractor.php +++ b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/web-components-extractor.php @@ -39,6 +39,7 @@ class WebComponentsExtractor return $contents ? json_decode($contents, true) : []; } + private function getRichComponentsFile(): string { $manifestFiles = $this->findManifestFiles('manifest.json'); diff --git a/web/assets/main.css b/web/assets/main.css index ddf757c50..de7991be6 100644 --- a/web/assets/main.css +++ b/web/assets/main.css @@ -12,6 +12,12 @@ @custom-variant dark (&:where(.dark, .dark *)); @theme { + /* Breakpoints */ + --breakpoint-xs: 30rem; + --breakpoint-2xl: 100rem; + --breakpoint-3xl: 120rem; + + /* Colors */ --color-primary-50: #fff7ed; --color-primary-100: #ffedd5; --color-primary-200: #fed7aa; diff --git a/web/components/Activation/WelcomeModal.ce.vue b/web/components/Activation/WelcomeModal.ce.vue index d13e6609d..a33a86a85 100644 --- a/web/components/Activation/WelcomeModal.ce.vue +++ b/web/components/Activation/WelcomeModal.ce.vue @@ -101,57 +101,3 @@ watchEffect(() => { - - diff --git a/web/components/ApiKeyPage.ce.vue b/web/components/ApiKeyPage.ce.vue index b1e5904e7..1bd51ab23 100644 --- a/web/components/ApiKeyPage.ce.vue +++ b/web/components/ApiKeyPage.ce.vue @@ -6,8 +6,3 @@ import ApiKeyManager from '~/components/ApiKey/ApiKeyManager.vue'; - diff --git a/web/components/Auth.ce.vue b/web/components/Auth.ce.vue index 2b6f8aa2f..5ccc4d529 100644 --- a/web/components/Auth.ce.vue +++ b/web/components/Auth.ce.vue @@ -30,9 +30,3 @@ const { authAction, stateData } = storeToRefs(serverStore); - - diff --git a/web/components/CallbackHandler.ce.vue b/web/components/CallbackHandler.ce.vue index 4225af948..fba4308a2 100644 --- a/web/components/CallbackHandler.ce.vue +++ b/web/components/CallbackHandler.ce.vue @@ -14,9 +14,3 @@ onBeforeMount(() => { - - diff --git a/web/components/ColorSwitcher.ce.vue b/web/components/ColorSwitcher.ce.vue index 32de575d0..0858a358e 100644 --- a/web/components/ColorSwitcher.ce.vue +++ b/web/components/ColorSwitcher.ce.vue @@ -74,9 +74,3 @@ const items = [