Procházet zdrojové kódy

chore(app): Tailwind 4 (CSS-first @theme) + react-is explícito + tw-animate-css (#35)

Co-authored-by: gnacho <hnacho@proton.me>
Nacho před 4 měsíci
rodič
revize
11217db2c9
5 změnil soubory, kde provedl 477 přidání a 324 odebrání
  1. 354 191
      app/package-lock.json
  2. 3 2
      app/package.json
  3. 1 2
      app/postcss.config.js
  4. 119 5
      app/src/index.css
  5. 0 124
      app/tailwind.config.js

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 354 - 191
app/package-lock.json


+ 3 - 2
app/package.json

@@ -53,6 +53,7 @@
     "react-dom": "^19.2.0",
     "react-hook-form": "^7.70.0",
     "react-i18next": "^17.0.11",
+    "react-is": "^19.2.8",
     "react-resizable-panels": "^4.2.2",
     "react-router": "^7.6.1",
     "react-router-dom": "^7.18.2",
@@ -68,6 +69,7 @@
   },
   "devDependencies": {
     "@eslint/js": "^9.39.1",
+    "@tailwindcss/postcss": "^4.3.3",
     "@types/node": "^24.10.1",
     "@types/react": "^19.2.5",
     "@types/react-dom": "^19.2.3",
@@ -78,8 +80,7 @@
     "eslint-plugin-react-refresh": "^0.4.24",
     "globals": "^16.5.0",
     "postcss": "^8.5.6",
-    "tailwindcss": "^3.4.19",
-    "tailwindcss-animate": "^1.0.7",
+    "tailwindcss": "^4.3.3",
     "tw-animate-css": "^1.4.0",
     "typescript": "^7.0.2",
     "typescript-eslint": "^8.46.4",

+ 1 - 2
app/postcss.config.js

@@ -1,6 +1,5 @@
 export default {
   plugins: {
-    tailwindcss: {},
-    autoprefixer: {},
+    "@tailwindcss/postcss": {},
   },
 }

+ 119 - 5
app/src/index.css

@@ -1,10 +1,11 @@
-@tailwind base;
-@tailwind components;
-@tailwind utilities;
+@import "tailwindcss";
+@import "tw-animate-css";
 
+@custom-variant dark (&:is(.dark *));
+
+/* NetPulse design tokens — dark-first (design.md §3). Default = dark "NOC doméstico". */
+/* .dark permite forzar el tema oscuro en previews dentro de páginas claras */
 @layer base {
-  /* NetPulse design tokens — dark-first (design.md §3). Default = dark "NOC doméstico". */
-  /* .dark permite forzar el tema oscuro en previews dentro de páginas claras */
   :root,
   .dark {
     --canvas: 7 11 18;          /* #070B12 */
@@ -48,6 +49,119 @@
   }
 }
 
+/* Design tokens → Tailwind 4 @theme (equivalente al theme.extend de v3).
+   En v4 los colores van PUROS (sin <alpha-value>); la opacidad (bg-x/50)
+   la gestiona Tailwind con color-mix automático. */
+@theme {
+  --color-canvas: rgb(var(--canvas));
+  --color-surface: rgb(var(--surface));
+  --color-elevated: rgb(var(--elevated));
+  --color-hover: rgb(var(--hover));
+  --color-border: rgb(var(--border));
+  --color-border-strong: rgb(var(--border-strong));
+  --color-text-primary: rgb(var(--text-primary));
+  --color-text-secondary: rgb(var(--text-secondary));
+  --color-text-muted: rgb(var(--text-muted));
+  --color-accent: rgb(var(--accent));
+  --color-accent-soft: rgb(var(--accent) / 0.12);
+  --color-tunnel: rgb(var(--tunnel));
+  --color-ok: rgb(var(--ok));
+  --color-warn: rgb(var(--warn));
+  --color-danger: rgb(var(--danger));
+  --color-info: rgb(var(--info));
+
+  /* shadcn/ui aliases mapeados a los tokens de diseño */
+  --color-background: rgb(var(--canvas));
+  --color-foreground: rgb(var(--text-primary));
+  --color-input: rgb(var(--border-strong));
+  --color-ring: rgb(var(--accent));
+  --color-primary: rgb(var(--accent));
+  --color-primary-foreground: rgb(var(--canvas));
+  --color-secondary: rgb(var(--elevated));
+  --color-secondary-foreground: rgb(var(--text-primary));
+  --color-destructive: rgb(var(--danger));
+  --color-destructive-foreground: rgb(var(--canvas));
+  --color-muted: rgb(var(--elevated));
+  --color-muted-foreground: rgb(var(--text-muted));
+  --color-popover: rgb(var(--elevated));
+  --color-popover-foreground: rgb(var(--text-primary));
+  --color-card: rgb(var(--surface));
+  --color-card-foreground: rgb(var(--text-primary));
+  --color-sidebar: rgb(var(--surface));
+  --color-sidebar-foreground: rgb(var(--text-primary));
+  --color-sidebar-primary: rgb(var(--accent));
+  --color-sidebar-primary-foreground: rgb(var(--canvas));
+  --color-sidebar-accent: rgb(var(--accent) / 0.12);
+  --color-sidebar-accent-foreground: rgb(var(--accent));
+  --color-sidebar-border: rgb(var(--border));
+  --color-sidebar-ring: rgb(var(--accent));
+
+  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
+  --font-sans: Inter, ui-sans-serif, system-ui, sans-serif;
+  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
+
+  --text-display: 2.75rem;
+  --text-display--line-height: 1.1;
+  --text-display--font-weight: 700;
+  --text-display-sm: 2.25rem;
+  --text-display-sm--line-height: 1.1;
+  --text-display-sm--font-weight: 700;
+  --text-h1: 1.5rem;
+  --text-h1--line-height: 1.2;
+  --text-h1--font-weight: 600;
+  --text-h2: 1.125rem;
+  --text-h2--line-height: 1.3;
+  --text-h2--font-weight: 600;
+  --text-stat: 1.75rem;
+  --text-stat--line-height: 1.1;
+  --text-stat--font-weight: 600;
+  --text-label: 0.75rem;
+  --text-label--line-height: 1.4;
+  --text-label--font-weight: 500;
+  --text-label--letter-spacing: 0.06em;
+  --text-caption: 0.6875rem;
+  --text-caption--line-height: 1.4;
+  --text-caption--font-weight: 500;
+  --text-mono-sm: 0.75rem;
+  --text-mono-sm--line-height: 1.4;
+  --text-mono-sm--font-weight: 500;
+
+  --radius-xs: calc(var(--radius) - 6px);
+  --radius-sm: calc(var(--radius) - 4px);
+  --radius-md: calc(var(--radius) - 2px);
+  --radius-lg: var(--radius);
+  --radius-xl: calc(var(--radius) + 2px);
+
+  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
+  --shadow-glow-ok: 0 0 40px -12px rgb(var(--ok) / 0.35);
+  --shadow-glow-warn: 0 0 40px -12px rgb(var(--warn) / 0.35);
+  --shadow-glow-danger: 0 0 40px -12px rgb(var(--danger) / 0.35);
+  --shadow-glow-accent: 0 0 40px -12px rgb(var(--accent) / 0.35);
+  --shadow-glow-tunnel: 0 0 40px -12px rgb(var(--tunnel) / 0.35);
+
+  --animate-accordion-down: accordion-down 0.2s ease-out;
+  --animate-accordion-up: accordion-up 0.2s ease-out;
+  --animate-caret-blink: caret-blink 1.25s ease-out infinite;
+  --animate-ping-soft: ping-soft 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
+
+  @keyframes accordion-down {
+    from { height: 0; }
+    to { height: var(--radix-accordion-content-height); }
+  }
+  @keyframes accordion-up {
+    from { height: var(--radix-accordion-content-height); }
+    to { height: 0; }
+  }
+  @keyframes caret-blink {
+    0%, 70%, 100% { opacity: 1; }
+    20%, 50% { opacity: 0; }
+  }
+  @keyframes ping-soft {
+    0% { transform: scale(1); opacity: 0.7; }
+    80%, 100% { transform: scale(2.2); opacity: 0; }
+  }
+}
+
 @layer base {
   * {
     @apply border-border;

+ 0 - 124
app/tailwind.config.js

@@ -1,124 +0,0 @@
-/** @type {import('tailwindcss').Config} */
-module.exports = {
-  darkMode: ["class"],
-  content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
-  theme: {
-    extend: {
-      colors: {
-        // NetPulse design tokens (design.md §3)
-        canvas: "rgb(var(--canvas) / <alpha-value>)",
-        surface: "rgb(var(--surface) / <alpha-value>)",
-        elevated: "rgb(var(--elevated) / <alpha-value>)",
-        hover: "rgb(var(--hover) / <alpha-value>)",
-        border: "rgb(var(--border) / <alpha-value>)",
-        "border-strong": "rgb(var(--border-strong) / <alpha-value>)",
-        "text-primary": "rgb(var(--text-primary) / <alpha-value>)",
-        "text-secondary": "rgb(var(--text-secondary) / <alpha-value>)",
-        "text-muted": "rgb(var(--text-muted) / <alpha-value>)",
-        accent: {
-          DEFAULT: "rgb(var(--accent) / <alpha-value>)",
-          soft: "rgb(var(--accent) / 0.12)",
-        },
-        tunnel: "rgb(var(--tunnel) / <alpha-value>)",
-        ok: "rgb(var(--ok) / <alpha-value>)",
-        warn: "rgb(var(--warn) / <alpha-value>)",
-        danger: "rgb(var(--danger) / <alpha-value>)",
-        info: "rgb(var(--info) / <alpha-value>)",
-        // shadcn/ui aliases mapped to design tokens
-        background: "rgb(var(--canvas) / <alpha-value>)",
-        foreground: "rgb(var(--text-primary) / <alpha-value>)",
-        input: "rgb(var(--border-strong) / <alpha-value>)",
-        ring: "rgb(var(--accent) / <alpha-value>)",
-        primary: {
-          DEFAULT: "rgb(var(--accent) / <alpha-value>)",
-          foreground: "rgb(var(--canvas) / <alpha-value>)",
-        },
-        secondary: {
-          DEFAULT: "rgb(var(--elevated) / <alpha-value>)",
-          foreground: "rgb(var(--text-primary) / <alpha-value>)",
-        },
-        destructive: {
-          DEFAULT: "rgb(var(--danger) / <alpha-value>)",
-          foreground: "rgb(var(--canvas) / <alpha-value>)",
-        },
-        muted: {
-          DEFAULT: "rgb(var(--elevated) / <alpha-value>)",
-          foreground: "rgb(var(--text-muted) / <alpha-value>)",
-        },
-        popover: {
-          DEFAULT: "rgb(var(--elevated) / <alpha-value>)",
-          foreground: "rgb(var(--text-primary) / <alpha-value>)",
-        },
-        card: {
-          DEFAULT: "rgb(var(--surface) / <alpha-value>)",
-          foreground: "rgb(var(--text-primary) / <alpha-value>)",
-        },
-        sidebar: {
-          DEFAULT: "rgb(var(--surface) / <alpha-value>)",
-          foreground: "rgb(var(--text-primary) / <alpha-value>)",
-          primary: "rgb(var(--accent) / <alpha-value>)",
-          "primary-foreground": "rgb(var(--canvas) / <alpha-value>)",
-          accent: "rgb(var(--accent) / 0.12)",
-          "accent-foreground": "rgb(var(--accent) / <alpha-value>)",
-          border: "rgb(var(--border) / <alpha-value>)",
-          ring: "rgb(var(--accent) / <alpha-value>)",
-        },
-      },
-      fontFamily: {
-        display: ['"Space Grotesk"', 'ui-sans-serif', 'system-ui', 'sans-serif'],
-        sans: ['Inter', 'ui-sans-serif', 'system-ui', 'sans-serif'],
-        mono: ['"JetBrains Mono"', 'ui-monospace', 'SFMono-Regular', 'monospace'],
-      },
-      fontSize: {
-        display: ['2.75rem', { lineHeight: '1.1', fontWeight: '700' }],
-        'display-sm': ['2.25rem', { lineHeight: '1.1', fontWeight: '700' }],
-        h1: ['1.5rem', { lineHeight: '1.2', fontWeight: '600' }],
-        h2: ['1.125rem', { lineHeight: '1.3', fontWeight: '600' }],
-        stat: ['1.75rem', { lineHeight: '1.1', fontWeight: '600' }],
-        label: ['0.75rem', { lineHeight: '1.4', fontWeight: '500', letterSpacing: '0.06em' }],
-        caption: ['0.6875rem', { lineHeight: '1.4', fontWeight: '500' }],
-        'mono-sm': ['0.75rem', { lineHeight: '1.4', fontWeight: '500' }],
-      },
-      borderRadius: {
-        xl: "calc(var(--radius) + 2px)",
-        lg: "var(--radius)",
-        md: "calc(var(--radius) - 2px)",
-        sm: "calc(var(--radius) - 4px)",
-        xs: "calc(var(--radius) - 6px)",
-      },
-      boxShadow: {
-        xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
-        'glow-ok': "0 0 40px -12px rgb(var(--ok) / 0.35)",
-        'glow-warn': "0 0 40px -12px rgb(var(--warn) / 0.35)",
-        'glow-danger': "0 0 40px -12px rgb(var(--danger) / 0.35)",
-        'glow-accent': "0 0 40px -12px rgb(var(--accent) / 0.35)",
-        'glow-tunnel': "0 0 40px -12px rgb(var(--tunnel) / 0.35)",
-      },
-      keyframes: {
-        "accordion-down": {
-          from: { height: "0" },
-          to: { height: "var(--radix-accordion-content-height)" },
-        },
-        "accordion-up": {
-          from: { height: "var(--radix-accordion-content-height)" },
-          to: { height: "0" },
-        },
-        "caret-blink": {
-          "0%,70%,100%": { opacity: "1" },
-          "20%,50%": { opacity: "0" },
-        },
-        "ping-soft": {
-          "0%": { transform: "scale(1)", opacity: "0.7" },
-          "80%, 100%": { transform: "scale(2.2)", opacity: "0" },
-        },
-      },
-      animation: {
-        "accordion-down": "accordion-down 0.2s ease-out",
-        "accordion-up": "accordion-up 0.2s ease-out",
-        "caret-blink": "caret-blink 1.25s ease-out infinite",
-        "ping-soft": "ping-soft 1.6s cubic-bezier(0, 0, 0.2, 1) infinite",
-      },
-    },
-  },
-  plugins: [require("tailwindcss-animate")],
-}

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů