responsive-system 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,382 +1,41 @@
1
- # 🎯 Responsive System - Auto-Scaling para Tailwind CSS
1
+ # responsive-system
2
2
 
3
- **Sistema de escalado automático para todas las pantallas.** Usa Tailwind CSS normal, TODO escala automáticamente.
3
+ Sistema completo de layout responsive con auto-scaling para React + Tailwind CSS.
4
4
 
5
- ## Características
6
-
7
- - ✅ **100% Automático**: Instala, configura una vez, olvídate del responsive
8
- - ✅ **Tailwind Normal**: Usa `text-base`, `p-4`, `gap-6`, `leading-relaxed`, `shadow-lg` como siempre
9
- - ✅ **Auto-Scaling Completo**: Typography, spacing, line-height, letter-spacing y shadows
10
- - ✅ **Sistema de Layouts**: 4 layouts predefinidos (Default, Sidebar, Dashboard, Minimal)
11
- - ✅ **9 Breakpoints**: xs, sm, md, lg, xl, 2xl, 3xl (1920px), 4xl (2560px), 5xl (3840px)
12
- - ✅ **TypeScript**: 100% type-safe
13
- - ✅ **Zero Runtime Dependencies**: Solo requiere React y Tailwind como peer dependencies
14
- - ✅ **No Invasivo**: Instala solo lo que necesites ([Ver guía](INSTALLATION.md))
15
-
16
- ---
17
-
18
- ## 📦 Instalación desde npm
19
-
20
- ### **Instalación Automática**
21
-
22
- Este paquete instala automáticamente todas las dependencias necesarias:
23
-
24
- - ✅ **React** (v19.1.1) - Se instala automáticamente
25
- - ✅ **React DOM** (v19.1.1) - Se instala automáticamente
26
- - ✅ **Tailwind CSS** (v4.1.14) - Se instala automáticamente
27
- - ✅ **PostCSS** y **Autoprefixer** - Se instalan automáticamente
28
- - ✅ **TypeScript** (v5.9.3) - Se instala automáticamente
5
+ ## 🚀 Instalación Rápida
29
6
 
30
7
  ```bash
31
- # Solo necesitas esto:
32
- npm install responsive-system
8
+ npm install responsive-system@latest
33
9
  ```
34
10
 
35
- El script `postinstall` detectará si faltan dependencias y las instalará automáticamente.
36
-
37
- ### **Inicializar Tailwind (solo la primera vez)**
38
-
39
- Después de instalar, inicializa Tailwind:
11
+ ## Configuración
40
12
 
41
- ```bash
42
- npx tailwindcss init -p
43
- ```
13
+ Después de instalar, ejecuta el script de configuración:
44
14
 
45
- O con yarn/pnpm:
46
15
  ```bash
47
- yarn add responsive-system
48
- # o
49
- pnpm add responsive-system
50
-
51
- # Inicializar Tailwind
52
- npx tailwindcss init -p
53
- ```
54
-
55
- ---
56
-
57
- ## 📦 ¿Tenés un proyecto existente?
58
-
59
- **Este sistema NO es invasivo.** Podés instalarlo de 3 formas:
60
-
61
- 1. **Solo el plugin** (1 archivo) - Auto-scaling sin tocar tu código
62
- 2. **Con hooks** (~8 archivos) - Detección de breakpoints en JS
63
- 3. **Sistema completo** (~30 archivos) - Layouts incluidos
64
-
65
- 👉 **[Ver guía completa de instalación](INSTALLATION.md)**
66
-
67
- ---
68
-
69
- ## 🚀 Inicio Rápido (Proyecto Nuevo)
70
-
71
- ### **Paso 0: Instalar el paquete**
72
-
73
- Si estás empezando desde cero:
74
-
75
- ```bash
76
- # Crear proyecto React (si no lo tienes)
77
- npm create vite@latest mi-proyecto -- --template react-ts
78
-
79
- # Instalar el paquete (instala React y Tailwind automáticamente)
80
- cd mi-proyecto
81
- npm install
82
- npm install responsive-system
83
-
84
- # Inicializar Tailwind (solo la primera vez)
85
- npx tailwindcss init -p
86
- ```
87
-
88
- **¡Eso es todo!** El paquete instala automáticamente React, Tailwind y todas las dependencias necesarias.
89
-
90
- ### **1. Configura el Plugin en Tailwind**
91
-
92
- ```js
93
- // tailwind.config.js
94
- import responsiveScalePlugin from 'responsive-system/plugin'
95
-
96
- export default {
97
- content: ["./src/**/*.{js,ts,jsx,tsx}"],
98
- theme: {
99
- extend: {
100
- screens: {
101
- 'xs': '475px', 'sm': '640px', 'md': '768px', 'lg': '1024px',
102
- 'xl': '1280px', '2xl': '1536px', '3xl': '1920px', '4xl': '2560px', '5xl': '3840px'
103
- }
104
- },
105
- },
106
- plugins: [
107
- responsiveScalePlugin({
108
- scaleProperties: {
109
- typography: true, // font-size
110
- spacing: true, // padding, margin, gap
111
- lineHeight: true, // line-height
112
- letterSpacing: true, // letter-spacing
113
- shadows: true, // box-shadow
114
- borderWidth: false,
115
- sizing: false,
116
- borderRadius: false
117
- },
118
- scales: {
119
- xs: 1.0, sm: 1.0, md: 1.0, lg: 1.0, xl: 1.0,
120
- '2xl': 1.05, '3xl': 1.15, '4xl': 1.25, '5xl': 1.35
121
- }
122
- })
123
- ],
124
- }
125
- ```
126
-
127
- ### **2. Configura el Sistema de Layouts**
128
-
129
- ```tsx
130
- // App.tsx
131
- import { ResponsiveLayoutProvider, MainLayout } from 'responsive-system'
132
-
133
- function App() {
134
- return (
135
- <ResponsiveLayoutProvider defaultLayout="default">
136
- <MainLayout>
137
- <YourContent />
138
- </MainLayout>
139
- </ResponsiveLayoutProvider>
140
- )
141
- }
142
- ```
143
-
144
- ---
145
-
146
- ## 🎨 Cómo Funciona
147
-
148
- ### **Sistema Responsivo (Auto-Scaling)**
149
-
150
- El plugin genera CSS variables que escalan automáticamente:
151
-
152
- ```css
153
- /* Plugin genera automáticamente */
154
- :root { --scale-text: 1.0; --scale-spacing: 1.0; }
155
-
156
- .text-base { font-size: calc(1rem * var(--scale-text)); }
157
- .p-4 { padding: calc(1rem * var(--scale-spacing)); }
16
+ npx responsive-system-setup
158
17
  ```
159
18
 
160
- **En 1920px (3xl):** `--scale-text: 1.15` → `text-base` = 18.4px
19
+ Este comando:
20
+ - ✅ Instalará React, TypeScript, Tailwind y Vite automáticamente
21
+ - ✅ Te permitirá seleccionar el layout que prefieras
22
+ - ✅ Creará la estructura base del proyecto
23
+ - ✅ Generará componentes genéricos y página de ejemplo
161
24
 
162
- ### **Sistema de Layouts**
25
+ ## 📦 Características
163
26
 
164
- **4 Layouts Predefinidos:**
27
+ - Auto-scaling automático (texto, espaciado, sombras)
28
+ - ✅ Layouts pre-configurados (default, sidebar, dashboard, minimal)
29
+ - ✅ Hook `useResponsive` para configuración manual
30
+ - ✅ Sin media queries necesarias
165
31
 
166
- | Layout | Componentes | Uso |
167
- |--------|-------------|-----|
168
- | `default` | Navigation + Footer | Páginas estáticas |
169
- | `sidebar` | Sidebar | Apps con navegación lateral |
170
- | `dashboard` | Header + Sidebar + Footer | Dashboards complejos |
171
- | `minimal` | Solo contenido | Landing pages |
32
+ ## 🎨 Layouts Disponibles
172
33
 
173
- **Cambio Dinámico:**
174
- ```tsx
175
- import { useLayout } from 'responsive-system'
176
-
177
- function MyComponent() {
178
- const { setLayout } = useLayout()
179
-
180
- return (
181
- <button onClick={() => setLayout('dashboard')}>
182
- Cambiar a Dashboard
183
- </button>
184
- )
185
- }
186
- ```
187
-
188
- ---
189
-
190
- ## 📊 Breakpoints y Escalas
191
-
192
- | Breakpoint | Tamaño | Factor | Ejemplo `text-base` |
193
- |------------|--------|--------|---------------------|
194
- | `xs` | 475px+ | 1.0 | 16px |
195
- | `sm` | 640px+ | 1.0 | 16px |
196
- | `md` | 768px+ | 1.0 | 16px |
197
- | `lg` | 1024px+ | 1.0 | 16px |
198
- | `xl` | 1280px+ | 1.0 | 16px |
199
- | `2xl` | 1536px+ | 1.05 | 16.8px |
200
- | `3xl` | 1920px+ | 1.15 | 18.4px |
201
- | `4xl` | 2560px+ | 1.25 | 20px |
202
- | `5xl` | 3840px+ | 1.35 | 21.6px |
203
-
204
- ---
205
-
206
- ## 🔧 Uso del Hook
207
-
208
- ```tsx
209
- import { useResponsiveLayout } from 'responsive-system'
210
-
211
- function MyComponent() {
212
- const {
213
- // Estado responsivo
214
- breakpoint, width, height, isMobile, isDesktop,
215
- // Estado del layout
216
- layout: { current, setLayout },
217
- // Utilidades
218
- layoutUtils
219
- } = useResponsiveLayout()
220
-
221
- return (
222
- <div className="p-6"> {/* ✅ Escala automáticamente */}
223
- <h1 className="text-4xl">Título</h1> {/* ✅ Escala automáticamente */}
224
-
225
- {/* Renderizado condicional */}
226
- {isMobile && <MobileMenu />}
227
- {isDesktop && <DesktopSidebar />}
228
-
229
- {/* Cambio de layout */}
230
- <button onClick={() => setLayout('sidebar')}>
231
- Cambiar Layout
232
- </button>
233
- </div>
234
- )
235
- }
236
- ```
34
+ - **default**: Navigation + Footer
35
+ - **sidebar**: Sidebar lateral
36
+ - **dashboard**: Sidebar + Footer
37
+ - **minimal**: Sin componentes (solo contenido)
237
38
 
238
39
  ---
239
40
 
240
- ## 🎯 Qué Escala Automáticamente
241
-
242
- ### ✅ **SÍ Escala:**
243
- - **Typography**: `text-base`, `text-lg`, `text-xl`, etc.
244
- - **Spacing**: `p-4`, `m-6`, `gap-3`, `space-y-2`
245
- - **Line Height**: `leading-relaxed`, `leading-loose`
246
- - **Letter Spacing**: `tracking-tight`, `tracking-wide`
247
- - **Shadows**: `shadow-lg`, `shadow-xl`
248
-
249
- ### ❌ **NO Escala:**
250
- - **Sizing**: `w-64`, `h-32` (puede romper layouts)
251
- - **Border Radius**: `rounded-lg` (mantiene proporciones)
252
- - **Valores Arbitrarios**: `text-[16px]`, `p-[10px]`
253
-
254
- ---
255
-
256
- ## 📱 Layouts en Acción
257
-
258
- ### **Default Layout**
259
- ```tsx
260
- import { ResponsiveLayoutProvider, MainLayout } from 'responsive-system'
261
-
262
- <ResponsiveLayoutProvider defaultLayout="default">
263
- <MainLayout>
264
- {/* Navigation arriba, Footer abajo */}
265
- <YourContent />
266
- </MainLayout>
267
- </ResponsiveLayoutProvider>
268
- ```
269
-
270
- ### **Sidebar Layout**
271
- ```tsx
272
- import { ResponsiveLayoutProvider, MainLayout } from 'responsive-system'
273
-
274
- <ResponsiveLayoutProvider defaultLayout="sidebar">
275
- <MainLayout>
276
- {/* Sidebar izquierda, contenido principal */}
277
- <YourContent />
278
- </MainLayout>
279
- </ResponsiveLayoutProvider>
280
- ```
281
-
282
- ### **Dashboard Layout**
283
- ```tsx
284
- import { ResponsiveLayoutProvider, MainLayout } from 'responsive-system'
285
-
286
- <ResponsiveLayoutProvider defaultLayout="dashboard">
287
- <MainLayout>
288
- {/* Header + Sidebar + Main + Footer */}
289
- <YourContent />
290
- </MainLayout>
291
- </ResponsiveLayoutProvider>
292
- ```
293
-
294
- ---
295
-
296
- ## 🏗️ Estructura del Proyecto
297
-
298
- ```
299
- src/
300
- ├── plugin/
301
- │ └── responsiveScalePlugin.js # Plugin de Tailwind
302
- ├── providers/
303
- │ ├── index.ts # ✅ Barrel exports
304
- │ ├── ResponsiveProvider.tsx # Provider base
305
- │ └── ResponsiveLayoutProvider.tsx # Provider con layouts
306
- ├── hooks/
307
- │ ├── index.ts # ✅ Barrel exports
308
- │ ├── useResponsive.ts # Hook responsivo
309
- │ ├── useResponsiveLayout.ts # Hook unificado
310
- │ └── useLayout.ts # Hook de layout
311
- ├── layouts/
312
- │ ├── index.ts # ✅ Barrel exports
313
- │ ├── MainLayout.tsx # Layout principal
314
- │ ├── DefaultLayout.tsx # Layout por defecto
315
- │ ├── SidebarLayout.tsx # Layout con sidebar
316
- │ ├── DashboardLayout.tsx # Layout dashboard
317
- │ └── MinimalLayout.tsx # Layout mínimo
318
- ├── components/layout/
319
- │ ├── index.ts # ✅ Barrel exports
320
- │ ├── Navigation.tsx # Navegación
321
- │ ├── Sidebar.tsx # Sidebar
322
- │ ├── Header.tsx # Header
323
- │ └── Footer.tsx # Footer
324
- ├── context/
325
- │ ├── index.ts # ✅ Barrel exports
326
- │ ├── ResponsiveLayoutContext.tsx # Context principal
327
- │ └── SidebarContext.tsx # Context del sidebar
328
- ├── config/
329
- │ └── layout.ts # Configuración de layouts
330
- └── index.ts # ✅ Export principal
331
- ```
332
-
333
- ---
334
-
335
- ## 🎉 Ejemplo Completo
336
-
337
- ```tsx
338
- // App.tsx
339
- import { ResponsiveLayoutProvider, MainLayout, useResponsiveLayout } from 'responsive-system'
340
-
341
- function MyApp() {
342
- return (
343
- <ResponsiveLayoutProvider defaultLayout="default">
344
- <MainLayout>
345
- <Dashboard />
346
- </MainLayout>
347
- </ResponsiveLayoutProvider>
348
- )
349
- }
350
-
351
- function Dashboard() {
352
- const { breakpoint, isMobile } = useResponsiveLayout()
353
-
354
- return (
355
- <div className="p-6 space-y-6"> {/* ✅ Auto-scaling */}
356
- <h1 className="text-4xl font-bold">Dashboard</h1> {/* ✅ Auto-scaling */}
357
-
358
- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
359
- <div className="p-6 bg-white rounded-lg shadow-lg"> {/* ✅ Auto-scaling */}
360
- <h2 className="text-xl mb-4">Card 1</h2>
361
- <p className="text-base leading-relaxed">Contenido...</p>
362
- </div>
363
- {/* Más cards... */}
364
- </div>
365
- </div>
366
- )
367
- }
368
- ```
369
-
370
- ---
371
-
372
- ## 🚀 Resultado
373
-
374
- **¡Eso es todo!** Tu aplicación ahora:
375
-
376
- - ✅ **Escala automáticamente** en todas las pantallas
377
- - ✅ **Usa layouts profesionales** predefinidos
378
- - ✅ **Mantiene código limpio** con Tailwind normal
379
- - ✅ **Funciona en móvil y desktop** sin media queries manuales
380
- - ✅ **Se adapta a pantallas grandes** (1920px, 4K, etc.)
381
-
382
- **Desarrollado por [Felipe Caroca](https://github.com/FelipeCaroca1)**
41
+ **Siguiente paso:** Ejecuta `npx responsive-system-setup` para comenzar 🚀
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "responsive-system",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "Sistema de layout responsivo con auto-scaling para Tailwind CSS",
5
5
  "type": "module",
6
6
  "main": "./dist/responsive-system.cjs",
@@ -34,9 +34,7 @@
34
34
  "src",
35
35
  "src/plugin",
36
36
  "scripts",
37
- "README.md",
38
- "ARCHITECTURE.md",
39
- "INSTALLATION.md"
37
+ "README.md"
40
38
  ],
41
39
  "keywords": [
42
40
  "responsive",
@@ -838,106 +838,6 @@ export default App
838
838
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
839
839
  console.log(' ✅ Actualizado: package.json con scripts')
840
840
 
841
- // Actualizar README.md con información completa
842
- // Si ya existe (el básico), lo reemplazamos con el completo
843
- if (fs.existsSync(readmePath)) {
844
- const readmeContent = `# Tu Aplicación
845
-
846
- Proyecto inicializado con **responsive-system**.
847
-
848
- ## 🚀 Inicio Rápido
849
-
850
- Después de instalar el paquete, ejecuta el script de configuración:
851
-
852
- \`\`\`bash
853
- npx responsive-system-setup
854
- \`\`\`
855
-
856
- O si prefieres ejecutarlo directamente:
857
-
858
- \`\`\`bash
859
- node node_modules/responsive-system/scripts/postinstall.js
860
- \`\`\`
861
-
862
- Luego inicia el servidor de desarrollo:
863
-
864
- \`\`\`bash
865
- npm run dev
866
- \`\`\`
867
-
868
- Abre http://localhost:5173 en tu navegador.
869
-
870
- ## 📁 Estructura del Proyecto
871
-
872
- - \`src/pages/\` - Páginas de tu aplicación
873
- - \`src/components/layout/\` - Componentes de layout (Navigation, Footer, Sidebar)
874
- - \`src/hooks/useResponsive.ts\` - Hook para configuración responsive manual
875
- - \`src/App.tsx\` - Componente principal
876
- - \`src/main.tsx\` - Punto de entrada
877
-
878
- ## 🎨 Layout Actual
879
-
880
- Layout seleccionado: **${selectedLayout}**
881
-
882
- - **default**: Navigation + Footer
883
- - **sidebar**: Sidebar lateral
884
- - **dashboard**: Sidebar + Footer
885
- - **minimal**: Sin componentes (solo contenido)
886
-
887
- ## 🔧 Personalización
888
-
889
- ### Cambiar el Layout
890
-
891
- Si quieres cambiar el layout después de la instalación:
892
-
893
- \`\`\`bash
894
- npx responsive-system-setup
895
- \`\`\`
896
-
897
- ### Usar el Hook useResponsive
898
-
899
- El hook \`useResponsive\` está disponible localmente en \`src/hooks/useResponsive.ts\`:
900
-
901
- \`\`\`typescript
902
- import { useResponsive } from '../hooks'
903
-
904
- function MyComponent() {
905
- const { breakpoint, isMobile, isDesktop, width, height } = useResponsive()
906
-
907
- // Tu lógica aquí
908
- }
909
- \`\`\`
910
-
911
- ### Personalizar Componentes
912
-
913
- Los componentes de layout están en \`src/components/layout/\` y puedes modificarlos según tus necesidades.
914
-
915
- ## 📚 Documentación
916
-
917
- - [responsive-system en npm](https://www.npmjs.com/package/responsive-system)
918
- - Hook \`useResponsive\`: \`src/hooks/useResponsive.ts\`
919
- - Tipos TypeScript: \`src/types/responsive.ts\`
920
-
921
- ## ✅ Características
922
-
923
- - ✅ Auto-scaling automático (texto, espaciado, sombras)
924
- - ✅ Layout responsive que se adapta a todos los tamaños
925
- - ✅ Hook \`useResponsive\` para configuración manual
926
- - ✅ Componentes de layout personalizables
927
- - ✅ Sin media queries necesarias
928
-
929
- ---
930
-
931
- **¡Listo para empezar a desarrollar!** 🎉
932
- `
933
- fs.writeFileSync(readmePath, readmeContent)
934
- console.log(' ✅ Actualizado: README.md con instrucciones completas')
935
- } else {
936
- // Si no existe, crearlo completo
937
- fs.writeFileSync(readmePath, readmeContent)
938
- console.log(' ✅ Creado: README.md con instrucciones completas')
939
- }
940
-
941
841
  console.log('')
942
842
  console.log('🎉 responsive-system: Proyecto inicializado correctamente!')
943
843
  console.log('')
@@ -949,7 +849,6 @@ Los componentes de layout están en \`src/components/layout/\` y puedes modifica
949
849
  console.log(' - Componentes generados en src/components/layout/')
950
850
  console.log(' - Hook useResponsive disponible en src/hooks/useResponsive.ts')
951
851
  console.log(' - Página de ejemplo en src/pages/HomePage.tsx')
952
- console.log(' - README.md creado con instrucciones')
953
852
  console.log('')
954
853
  console.log('💡 Para cambiar el layout después, ejecuta: npx responsive-system-setup')
955
854
  console.log('')
package/ARCHITECTURE.md DELETED
@@ -1,195 +0,0 @@
1
- # 🏗️ Arquitectura del Sistema
2
-
3
- ## 📦 Sistema Core vs Ejemplos
4
-
5
- ### ✅ **SISTEMA CORE (Independiente)**
6
-
7
- Estos archivos conforman el **sistema responsivo reutilizable**. Puedes eliminar las páginas de ejemplo y el sistema seguirá funcionando.
8
-
9
- #### **Plugin**
10
- ```
11
- src/plugin/
12
- └── responsiveScalePlugin.js # ✅ Plugin de Tailwind
13
- ```
14
-
15
- #### **Providers**
16
- ```
17
- src/providers/
18
- ├── index.ts # ✅ Barrel exports
19
- ├── ResponsiveProvider.tsx # ✅ Provider base
20
- └── ResponsiveLayoutProvider.tsx # ✅ Provider con layouts
21
- ```
22
-
23
- #### **Hooks**
24
- ```
25
- src/hooks/
26
- ├── index.ts # ✅ Barrel exports
27
- ├── useResponsive.ts # ✅ Hook responsivo
28
- ├── useResponsiveLayout.ts # ✅ Hook unificado
29
- └── useLayout.ts # ✅ Hook de layout
30
- ```
31
-
32
- #### **Layouts**
33
- ```
34
- src/layouts/
35
- ├── index.ts # ✅ Barrel exports
36
- ├── MainLayout.tsx # ✅ Layout principal
37
- ├── DefaultLayout.tsx # ✅ Layout por defecto
38
- ├── SidebarLayout.tsx # ✅ Layout con sidebar
39
- ├── DashboardLayout.tsx # ✅ Layout dashboard
40
- └── MinimalLayout.tsx # ✅ Layout mínimo
41
- ```
42
-
43
- #### **Componentes de Layout**
44
- ```
45
- src/components/layout/
46
- ├── index.ts # ✅ Barrel exports
47
- ├── Navigation.tsx # ✅ Navegación
48
- ├── Sidebar.tsx # ✅ Sidebar
49
- ├── Header.tsx # ✅ Header
50
- └── Footer.tsx # ✅ Footer
51
- ```
52
-
53
- #### **Context**
54
- ```
55
- src/context/
56
- ├── index.ts # ✅ Barrel exports
57
- ├── ResponsiveLayoutContext.tsx # ✅ Context principal
58
- ├── SidebarContext.tsx # ✅ Context del sidebar
59
- └── NavigationContext.tsx # ✅ Context de navegación
60
- ```
61
-
62
- #### **Tipos**
63
- ```
64
- src/types/
65
- └── responsive.ts # ✅ Tipos TypeScript
66
- ```
67
-
68
- #### **Constantes**
69
- ```
70
- src/constants/
71
- └── breakpoints.ts # ✅ Configuración de breakpoints
72
- ```
73
-
74
- #### **Configuración**
75
- ```
76
- src/config/
77
- └── layout.ts # ✅ Configuración de layouts
78
- ```
79
-
80
- #### **Componentes Auxiliares**
81
- ```
82
- src/components/
83
- └── LayoutSwitcher.tsx # ✅ Selector de layouts
84
- ```
85
-
86
- #### **Export Principal**
87
- ```
88
- src/index.ts # ✅ Exportaciones del sistema
89
- ```
90
-
91
- ---
92
-
93
- ### 🎨 **EJEMPLOS (Eliminables)**
94
-
95
- Estos archivos son **solo para demostración**. Puedes eliminarlos sin afectar el sistema core.
96
-
97
- #### **Páginas de Ejemplo**
98
- ```
99
- src/pages/
100
- └── ResponsiveTestPage.tsx # ❌ Ejemplo - Suite de tests
101
- ```
102
-
103
- #### **Componentes de Ejemplo**
104
- ```
105
- src/components/
106
- └── ResponsiveDemo.tsx # ❌ Ejemplo - Demo visual
107
- ```
108
-
109
- #### **App de Ejemplo**
110
- ```
111
- src/App.tsx # ❌ Ejemplo - Aplicación de prueba
112
- src/main.tsx # ❌ Ejemplo - Entry point
113
- ```
114
-
115
- ---
116
-
117
- ### **Paso 1: Actualizar `src/index.ts`**
118
- ```typescript
119
- // Eliminar estas líneas:
120
- export { default as ResponsiveTestPage } from './pages/ResponsiveTestPage'
121
- export { default as ResponsiveDemo } from './components/ResponsiveDemo'
122
- ```
123
-
124
- ### **Paso 2: Listo ✅**
125
- El sistema core sigue funcionando perfectamente. Ahora puedes:
126
- - Instalar el sistema en tu proyecto
127
- - Importar solo lo que necesites: `import { ResponsiveLayoutProvider, MainLayout } from './index'`
128
- - Usar el plugin en `tailwind.config.js`
129
-
130
- ---
131
-
132
- ## 📖 Uso en Tu Proyecto
133
-
134
- ### **1. Instalar el Sistema**
135
- ```bash
136
- # Copiar la carpeta src/ a tu proyecto
137
- # O publicar como paquete npm
138
- ```
139
-
140
- ### **2. Configurar Tailwind**
141
- ```js
142
- // tailwind.config.js
143
- import responsiveScalePlugin from './src/plugin/responsiveScalePlugin.js'
144
-
145
- export default {
146
- plugins: [responsiveScalePlugin({ /* config */ })]
147
- }
148
- ```
149
-
150
- ### **3. Crear Tu App**
151
- ```tsx
152
- // TuApp.tsx
153
- import { ResponsiveLayoutProvider, MainLayout } from './index'
154
-
155
- function TuApp() {
156
- return (
157
- <ResponsiveLayoutProvider defaultLayout="default">
158
- <MainLayout>
159
- <TuContenido />
160
- </MainLayout>
161
- </ResponsiveLayoutProvider>
162
- )
163
- }
164
- ```
165
-
166
- ### **4. Si Necesitas Navegación**
167
- ```tsx
168
- import { NavigationProvider, useNavigation } from './index'
169
-
170
- function TuApp() {
171
- return (
172
- <NavigationProvider defaultPage="home">
173
- <ResponsiveLayoutProvider defaultLayout="default">
174
- <MainLayout>
175
- <TuContenido />
176
- </MainLayout>
177
- </ResponsiveLayoutProvider>
178
- </NavigationProvider>
179
- )
180
- }
181
- ```
182
-
183
- ---
184
-
185
- ## 🎯 Resumen
186
-
187
- | Tipo | Archivos | ¿Eliminable? | Función |
188
- |------|----------|--------------|---------|
189
- | **Sistema Core** | 30+ archivos | ❌ NO | Sistema responsivo + layouts |
190
- | **Ejemplos** | 4 archivos | ✅ SÍ | Demostración y pruebas |
191
-
192
- **✅ El sistema es 100% independiente de los ejemplos**
193
- **✅ Puedes eliminar `App.tsx`, `ResponsiveDemo.tsx`, `ResponsiveTestPage.tsx` sin problemas**
194
-
195
-
package/INSTALLATION.md DELETED
@@ -1,403 +0,0 @@
1
- # 📦 Instalación en Proyecto Existente
2
-
3
- ## ¿Es invasivo este sistema?
4
-
5
- **RESPUESTA CORTA: NO, es completamente modular y no invasivo.**
6
-
7
- El sistema se divide en **2 partes independientes**:
8
-
9
- 1. **Sistema de Auto-Scaling** (Plugin de Tailwind) - ⚠️ Requiere configuración
10
- 2. **Sistema de Layouts** (Componentes React) - ✅ Completamente opcional
11
-
12
- ---
13
-
14
- ## 🎯 Nivel de Invasividad
15
-
16
- ### ✅ **BAJO IMPACTO** - Solo Auto-Scaling
17
-
18
- Si **solo quieres el auto-scaling** (sin layouts):
19
-
20
- **Archivos a copiar:** `1 archivo`
21
- ```
22
- src/plugin/responsiveScalePlugin.js
23
- ```
24
-
25
- **Archivos a modificar:** `1 archivo`
26
- ```
27
- tailwind.config.js (agregar plugin)
28
- ```
29
-
30
- **¿Rompe código existente?** **NO**
31
- - El plugin solo agrega CSS variables nuevas
32
- - No modifica clases existentes de Tailwind
33
- - Tu código actual sigue funcionando igual
34
-
35
- ---
36
-
37
- ### ⚠️ **MEDIO IMPACTO** - Con Providers
38
-
39
- Si quieres usar **hooks** (`useResponsive`, etc.):
40
-
41
- **Archivos a copiar:** `~10 archivos`
42
- ```
43
- src/plugin/responsiveScalePlugin.js
44
- src/providers/ResponsiveProvider.tsx
45
- src/hooks/useResponsive.ts
46
- src/constants/breakpoints.ts
47
- src/types/responsive.ts
48
- ```
49
-
50
- **Archivos a modificar:** `2 archivos`
51
- ```
52
- tailwind.config.js (agregar plugin)
53
- App.tsx (envolver con provider)
54
- ```
55
-
56
- **¿Rompe código existente?** **NO**
57
- - Solo necesitas agregar `<ResponsiveProvider>` en tu App
58
- - No afecta componentes existentes
59
- - Puedes usar solo en componentes nuevos
60
-
61
- ---
62
-
63
- ### 🔧 **ALTO IMPACTO** - Sistema Completo + Layouts
64
-
65
- Si quieres **todo el sistema** (auto-scaling + layouts + hooks):
66
-
67
- **Archivos a copiar:** `~30 archivos`
68
-
69
- **Archivos a modificar:** `2-3 archivos`
70
- ```
71
- tailwind.config.js
72
- App.tsx
73
- package.json (si faltan dependencias)
74
- ```
75
-
76
- **¿Rompe código existente?** **DEPENDE**
77
- - Si usas `MainLayout`, necesitas adaptar tu estructura
78
- - Tus componentes existentes **NO se rompen**
79
- - Puedes migrar progresivamente
80
-
81
- ---
82
-
83
- ## 📋 Guía de Instalación Paso a Paso
84
-
85
- ### **OPCIÓN 1: Solo Auto-Scaling** ⭐ **RECOMENDADA PARA EMPEZAR**
86
-
87
- #### 1. Copiar el plugin
88
- ```bash
89
- # Crear carpeta
90
- mkdir -p src/plugin
91
-
92
- # Copiar archivo
93
- cp responsiveScalePlugin.js src/plugin/
94
- ```
95
-
96
- #### 2. Modificar `tailwind.config.js`
97
- ```js
98
- import responsiveScalePlugin from './src/plugin/responsiveScalePlugin.js'
99
-
100
- export default {
101
- content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
102
- theme: {
103
- extend: {
104
- screens: {
105
- 'xs': '475px',
106
- 'sm': '640px',
107
- 'md': '768px',
108
- 'lg': '1024px',
109
- 'xl': '1280px',
110
- '2xl': '1536px',
111
- '3xl': '1920px', // 👈 Nuevo
112
- '4xl': '2560px', // 👈 Nuevo
113
- '5xl': '3840px', // 👈 Nuevo (4K)
114
- }
115
- },
116
- },
117
- plugins: [
118
- responsiveScalePlugin({
119
- scaleProperties: {
120
- typography: true, // font-size se escala
121
- spacing: true, // padding, margin, gap se escalan
122
- lineHeight: true, // line-height se escala
123
- letterSpacing: true, // letter-spacing se escala
124
- shadows: true, // box-shadow se escala
125
- borderWidth: false, // border-width NO se escala (puede romper)
126
- sizing: false, // width, height NO se escalan (puede romper)
127
- borderRadius: false // rounded-* NO se escala (mantener fijo)
128
- },
129
- scales: {
130
- xs: 1.0,
131
- sm: 1.0,
132
- md: 1.0,
133
- lg: 1.0,
134
- xl: 1.0,
135
- '2xl': 1.05, // +5% en 1536px
136
- '3xl': 1.15, // +15% en 1920px (Full HD)
137
- '4xl': 1.25, // +25% en 2560px (2K)
138
- '5xl': 1.35 // +35% en 3840px (4K)
139
- },
140
- breakpoints: {
141
- xs: '475px',
142
- sm: '640px',
143
- md: '768px',
144
- lg: '1024px',
145
- xl: '1280px',
146
- '2xl': '1536px',
147
- '3xl': '1920px',
148
- '4xl': '2560px',
149
- '5xl': '3840px'
150
- }
151
- })
152
- ],
153
- }
154
- ```
155
-
156
- #### 3. ¡Listo! 🎉
157
-
158
- **Ya funciona.** Ahora puedes usar:
159
-
160
- ```tsx
161
- // Componente existente
162
- function MyButton() {
163
- return (
164
- <button className="px-4 py-2 text-base">
165
- Click me
166
- </button>
167
- )
168
- }
169
-
170
- // En móvil: px-4 = 16px
171
- // En 4K: px-4 = 21.6px (escalado automáticamente)
172
- ```
173
-
174
- **✅ Ventajas:**
175
- - Cero cambios en tu código
176
- - Compatible con cualquier proyecto Tailwind
177
- - No rompe nada existente
178
- - Puedes ajustar `scales` a tu gusto
179
-
180
- **❌ Limitaciones:**
181
- - No tienes acceso a hooks (`useResponsive`, `isMobile`, etc.)
182
- - No puedes detectar breakpoints en JavaScript
183
-
184
- ---
185
-
186
- ### **OPCIÓN 2: Con Hooks** (Detección de Breakpoints)
187
-
188
- Si necesitas **detectar breakpoints en JavaScript** (ej: `isMobile`, `isTablet`):
189
-
190
- #### 1. Instalar OPCIÓN 1 primero
191
-
192
- #### 2. Copiar archivos adicionales
193
- ```bash
194
- mkdir -p src/providers src/hooks src/constants src/types
195
-
196
- # Copiar archivos core
197
- cp ResponsiveProvider.tsx src/providers/
198
- cp useResponsive.ts src/hooks/
199
- cp breakpoints.ts src/constants/
200
- cp responsive.ts src/types/
201
- ```
202
-
203
- #### 3. Envolver tu App
204
- ```tsx
205
- // App.tsx (ANTES)
206
- function App() {
207
- return <YourExistingApp />
208
- }
209
-
210
- // App.tsx (DESPUÉS)
211
- import { ResponsiveProvider } from './providers/ResponsiveProvider'
212
-
213
- function App() {
214
- return (
215
- <ResponsiveProvider>
216
- <YourExistingApp />
217
- </ResponsiveProvider>
218
- )
219
- }
220
- ```
221
-
222
- #### 4. Usar en componentes
223
- ```tsx
224
- import { useResponsive } from './hooks/useResponsive'
225
-
226
- function MyComponent() {
227
- const { isMobile, isTablet, currentBreakpoint } = useResponsive()
228
-
229
- return (
230
- <div>
231
- {isMobile && <MobileMenu />}
232
- {isTablet && <TabletView />}
233
- <p>Breakpoint actual: {currentBreakpoint}</p>
234
- </div>
235
- )
236
- }
237
- ```
238
-
239
- **✅ Ventajas adicionales:**
240
- - Detección de breakpoints en JS
241
- - Helpers booleanos (isMobile, isTablet, etc.)
242
- - Condicionales responsive sin CSS
243
-
244
- **⚠️ Consideración:**
245
- - Agrega 1 provider a tu App
246
- - Agrega ~50KB al bundle (hooks + context)
247
-
248
- ---
249
-
250
- ### **OPCIÓN 3: Sistema Completo** (Con Layouts)
251
-
252
- Si quieres **layouts preconfigurados** (tipo Ant Design):
253
-
254
- #### 1. Instalar OPCIÓN 2 primero
255
-
256
- #### 2. Copiar carpetas adicionales
257
- ```bash
258
- mkdir -p src/layouts src/components/layout src/context
259
-
260
- # Copiar todo el sistema de layouts
261
- cp -r layouts/* src/layouts/
262
- cp -r components/layout/* src/components/layout/
263
- cp -r context/* src/context/
264
- cp ResponsiveLayoutProvider.tsx src/providers/
265
- cp useResponsiveLayout.ts src/hooks/
266
- cp useLayout.ts src/hooks/
267
- ```
268
-
269
- #### 3. Modificar App.tsx
270
- ```tsx
271
- // App.tsx
272
- import { ResponsiveLayoutProvider, MainLayout } from './index'
273
-
274
- function App() {
275
- return (
276
- <ResponsiveLayoutProvider defaultLayout="default">
277
- <MainLayout>
278
- <YourExistingApp />
279
- </MainLayout>
280
- </ResponsiveLayoutProvider>
281
- )
282
- }
283
- ```
284
-
285
- #### 4. Usar layouts
286
- ```tsx
287
- import { useResponsiveLayout } from './hooks'
288
-
289
- function MyPage() {
290
- const { layout } = useResponsiveLayout()
291
-
292
- return (
293
- <div>
294
- <h1>Mi Página</h1>
295
- <p>Layout actual: {layout.current}</p>
296
-
297
- <button onClick={() => layout.setLayout('sidebar')}>
298
- Cambiar a Sidebar
299
- </button>
300
- </div>
301
- )
302
- }
303
- ```
304
-
305
- **✅ Ventajas adicionales:**
306
- - Layouts listos para usar (Default, Sidebar, Dashboard, Minimal)
307
- - Navbar, Sidebar, Footer incluidos
308
- - Cambio dinámico de layout
309
-
310
- **⚠️ Consideraciones:**
311
- - Sistema más complejo (~30 archivos)
312
- - Puede requerir adaptar tu estructura actual
313
- - Si ya tienes un layout, puede generar conflictos
314
-
315
- ---
316
-
317
- ## 🔍 Comparación de Opciones
318
-
319
- | Característica | Solo Plugin | Con Hooks | Completo |
320
- |---|---|---|---|
321
- | **Archivos a copiar** | 1 | ~8 | ~30 |
322
- | **Archivos a modificar** | 1 | 2 | 2-3 |
323
- | **Auto-scaling CSS** | ✅ | ✅ | ✅ |
324
- | **Detección de breakpoints** | ❌ | ✅ | ✅ |
325
- | **Helpers booleanos** | ❌ | ✅ | ✅ |
326
- | **Layouts preconfigurados** | ❌ | ❌ | ✅ |
327
- | **Cambio dinámico de layout** | ❌ | ❌ | ✅ |
328
- | **Invasividad** | ⬇️ Baja | ⬇️ Media | ⬆️ Alta |
329
- | **Bundle size** | +5KB | +50KB | +150KB |
330
-
331
- ---
332
-
333
- ## ⚡ Recomendación
334
-
335
- ### Para un **proyecto nuevo**:
336
- 👉 **OPCIÓN 3** (Sistema completo) - Aprovecha todo
337
-
338
- ### Para un **proyecto existente pequeño**:
339
- 👉 **OPCIÓN 2** (Con hooks) - Buen balance
340
-
341
- ### Para un **proyecto existente grande/complejo**:
342
- 👉 **OPCIÓN 1** (Solo plugin) - Mínima invasión
343
-
344
- ---
345
-
346
- ## 🚨 ¿Puede romper algo?
347
-
348
- ### **NO romperá:**
349
- - ✅ Componentes existentes
350
- - ✅ Estilos actuales de Tailwind
351
- - ✅ Otras librerías CSS
352
- - ✅ Funcionalidad de la app
353
-
354
- ### **PUEDE conflictuar con:**
355
- - ⚠️ Otros plugins de Tailwind que modifiquen las mismas propiedades
356
- - ⚠️ Sistemas de layout existentes (si usas OPCIÓN 3)
357
- - ⚠️ CSS custom que dependa de valores fijos de Tailwind
358
-
359
- ---
360
-
361
- ## 🧪 Modo de Prueba
362
-
363
- **Recomendación:** Prueba primero en una **rama separada**
364
-
365
- ```bash
366
- # Crear rama de prueba
367
- git checkout -b test-responsive-system
368
-
369
- # Instalar OPCIÓN 1
370
- # ... copiar archivo y modificar config
371
-
372
- # Probar en desarrollo
373
- npm run dev
374
-
375
- # Si funciona bien, mergear
376
- git checkout main
377
- git merge test-responsive-system
378
- ```
379
-
380
- ---
381
-
382
- ## 📞 Soporte
383
-
384
- Si encuentras problemas:
385
-
386
- 1. Verifica que Tailwind CSS v4+ esté instalado
387
- 2. Revisa que el plugin se esté importando correctamente
388
- 3. Verifica que los breakpoints coincidan en `theme.extend.screens` y en el plugin
389
- 4. Abre un issue en GitHub
390
-
391
- ---
392
-
393
- ## 🎯 Conclusión
394
-
395
- **El sistema NO es invasivo** si usas solo el plugin (OPCIÓN 1).
396
-
397
- **Es progresivamente más invasivo** si agregas hooks y layouts, pero siempre:
398
- - ✅ Sin romper código existente
399
- - ✅ Modular (usa solo lo que necesites)
400
- - ✅ Fácil de remover si no te gusta
401
-
402
- **Empieza con OPCIÓN 1, y escala según necesites.** 🚀
403
-