responsive-system 1.3.0 → 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.
@@ -31,6 +31,9 @@ console.log('')
31
31
  console.log('📦 responsive-system: Iniciando configuración...')
32
32
  console.log(` Directorio: ${projectRoot}`)
33
33
  console.log('')
34
+ console.log('💡 Si este es tu primer uso, este script configurará todo automáticamente.')
35
+ console.log(' Si ya tienes el proyecto configurado, puedes cancelar (Ctrl+C)')
36
+ console.log('')
34
37
 
35
38
  // Verificar si package.json existe
36
39
  if (!fs.existsSync(packageJsonPath)) {
@@ -146,8 +149,8 @@ function copyFileFromPackage(relativePath, targetPath, isComponent = false) {
146
149
  return true
147
150
  }
148
151
 
149
- // Función para copiar componentes según el layout seleccionado
150
- function copyLayoutComponents(selectedLayout) {
152
+ // Función para generar componentes genéricos según el layout seleccionado
153
+ function generateLayoutComponents(selectedLayout) {
151
154
  const componentsDir = path.join(projectRoot, 'src', 'components', 'layout')
152
155
 
153
156
  // Crear directorio si no existe
@@ -155,29 +158,199 @@ function copyLayoutComponents(selectedLayout) {
155
158
  fs.mkdirSync(componentsDir, { recursive: true })
156
159
  }
157
160
 
158
- const componentsToCopy = {
161
+ const componentsToGenerate = {
159
162
  default: ['Navigation', 'Footer'],
160
163
  sidebar: ['Sidebar'],
161
164
  dashboard: ['Sidebar', 'Footer'],
162
165
  minimal: []
163
166
  }
164
167
 
165
- const components = componentsToCopy[selectedLayout] || []
168
+ const components = componentsToGenerate[selectedLayout] || []
166
169
 
167
170
  if (components.length === 0) {
168
- console.log(' ✅ Layout minimal: No se copian componentes')
171
+ console.log(' ✅ Layout minimal: No se generan componentes')
169
172
  return
170
173
  }
171
174
 
172
- console.log(` 📦 Copiando componentes para layout "${selectedLayout}":`)
175
+ console.log(` 📦 Generando componentes genéricos para layout "${selectedLayout}":`)
173
176
 
174
- for (const component of components) {
175
- const sourceFile = `src/components/layout/${component}.tsx`
176
- const targetFile = `src/components/layout/${component}.tsx`
177
-
178
- if (copyFileFromPackage(sourceFile, targetFile, true)) {
179
- console.log(` ✅ ${component}.tsx`)
180
- }
177
+ // Generar Navigation genérico
178
+ if (components.includes('Navigation')) {
179
+ const navigationContent = `import { useResponsiveLayout } from 'responsive-system'
180
+
181
+ const Navigation = () => {
182
+ const { isMobile, breakpoint } = useResponsiveLayout()
183
+
184
+ return (
185
+ <nav className="sticky top-0 z-50 bg-gray-900 border-b border-gray-800">
186
+ <div className="px-4 py-4">
187
+ <div className="flex items-center justify-between">
188
+ <div className="flex items-center space-x-3">
189
+ <div className="w-8 h-8 bg-blue-500 rounded-lg flex items-center justify-center">
190
+ <span className="text-white font-bold text-sm">LO</span>
191
+ </div>
192
+ <h1 className="text-white font-semibold text-lg">Tu Aplicación</h1>
193
+ </div>
194
+
195
+ {isMobile && (
196
+ <button className="p-2 text-gray-400 hover:text-white">
197
+ <svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
198
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 12h16M4 18h16" />
199
+ </svg>
200
+ </button>
201
+ )}
202
+ </div>
203
+ </div>
204
+ </nav>
205
+ )
206
+ }
207
+
208
+ export default Navigation
209
+ `
210
+ fs.writeFileSync(path.join(componentsDir, 'Navigation.tsx'), navigationContent)
211
+ console.log(' ✅ Navigation.tsx (genérico)')
212
+ }
213
+
214
+ // Generar Footer genérico
215
+ if (components.includes('Footer')) {
216
+ const footerContent = `import { useResponsiveLayout } from 'responsive-system'
217
+
218
+ const Footer = () => {
219
+ const { breakpoint } = useResponsiveLayout()
220
+
221
+ return (
222
+ <footer className="bg-gray-900 border-t border-gray-800">
223
+ <div className="px-4 py-6">
224
+ <div className="max-w-7xl mx-auto">
225
+ <div className="grid grid-cols-1 md:grid-cols-3 gap-6">
226
+ <div>
227
+ <h3 className="text-white font-semibold mb-2">Tu Aplicación</h3>
228
+ <p className="text-gray-400 text-sm">
229
+ Descripción de tu aplicación aquí.
230
+ </p>
231
+ </div>
232
+
233
+ <div>
234
+ <h3 className="text-white font-semibold mb-2">Enlaces</h3>
235
+ <ul className="space-y-1 text-gray-400 text-sm">
236
+ <li><a href="#" className="hover:text-white">Inicio</a></li>
237
+ <li><a href="#" className="hover:text-white">Acerca</a></li>
238
+ <li><a href="#" className="hover:text-white">Contacto</a></li>
239
+ </ul>
240
+ </div>
241
+
242
+ <div>
243
+ <h3 className="text-white font-semibold mb-2">Info</h3>
244
+ <p className="text-gray-400 text-xs">
245
+ Breakpoint: <span className="text-blue-400">{breakpoint.toUpperCase()}</span>
246
+ </p>
247
+ </div>
248
+ </div>
249
+
250
+ <div className="border-t border-gray-800 mt-6 pt-4 text-center">
251
+ <p className="text-gray-500 text-xs">
252
+ © {new Date().getFullYear()} Tu Aplicación. Todos los derechos reservados.
253
+ </p>
254
+ </div>
255
+ </div>
256
+ </div>
257
+ </footer>
258
+ )
259
+ }
260
+
261
+ export default Footer
262
+ `
263
+ fs.writeFileSync(path.join(componentsDir, 'Footer.tsx'), footerContent)
264
+ console.log(' ✅ Footer.tsx (genérico)')
265
+ }
266
+
267
+ // Generar Sidebar genérico
268
+ if (components.includes('Sidebar')) {
269
+ const sidebarContent = `import { useResponsiveLayout } from 'responsive-system'
270
+ import { useSidebar } from 'responsive-system'
271
+
272
+ const Sidebar = () => {
273
+ const { isMobile, isTablet } = useResponsiveLayout()
274
+ const { sidebarOpen, setSidebarOpen } = useSidebar()
275
+
276
+ const menuItems = [
277
+ { id: 'home', label: 'Inicio' },
278
+ { id: 'about', label: 'Acerca' },
279
+ { id: 'contact', label: 'Contacto' },
280
+ ]
281
+
282
+ return (
283
+ <>
284
+ {/* Hamburger button para móvil */}
285
+ {isMobile && (
286
+ <button
287
+ onClick={() => setSidebarOpen(true)}
288
+ className="fixed top-4 left-4 z-50 p-2 rounded-lg text-gray-300 hover:text-white hover:bg-gray-800 bg-gray-900 border border-gray-700"
289
+ >
290
+ <svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
291
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 12h16M4 18h16" />
292
+ </svg>
293
+ </button>
294
+ )}
295
+
296
+ {/* Sidebar desktop */}
297
+ <aside className={\`bg-gray-900 border-r border-gray-800 \${isMobile ? 'hidden' : 'w-64 flex-shrink-0'} \${isTablet ? 'w-56' : 'w-64'}\`}>
298
+ <div className="p-6 flex flex-col h-full">
299
+ <div className="flex items-center space-x-3 mb-8">
300
+ <div className="w-8 h-8 bg-blue-500 rounded-lg flex items-center justify-center">
301
+ <span className="text-white font-bold text-sm">LO</span>
302
+ </div>
303
+ <span className="text-white font-bold text-lg">Tu Aplicación</span>
304
+ </div>
305
+
306
+ <nav className="space-y-2">
307
+ {menuItems.map((item) => (
308
+ <button
309
+ key={item.id}
310
+ className="w-full flex items-center px-4 py-3 rounded-lg transition-all text-left text-gray-300 hover:text-white hover:bg-gray-800"
311
+ >
312
+ <span className="font-medium">{item.label}</span>
313
+ </button>
314
+ ))}
315
+ </nav>
316
+ </div>
317
+ </aside>
318
+
319
+ {/* Sidebar móvil desplegable */}
320
+ {isMobile && sidebarOpen && (
321
+ <div className="fixed inset-0 z-40 bg-black/50" onClick={() => setSidebarOpen(false)}>
322
+ <div className="fixed top-0 left-0 w-64 h-full bg-gray-900 border-r border-gray-800">
323
+ <div className="p-6 flex flex-col h-full pt-20">
324
+ <div className="flex items-center space-x-3 mb-8">
325
+ <div className="w-8 h-8 bg-blue-500 rounded-lg flex items-center justify-center">
326
+ <span className="text-white font-bold text-sm">LO</span>
327
+ </div>
328
+ <span className="text-white font-bold text-lg">Tu Aplicación</span>
329
+ </div>
330
+
331
+ <nav className="space-y-2">
332
+ {menuItems.map((item) => (
333
+ <button
334
+ key={item.id}
335
+ onClick={() => setSidebarOpen(false)}
336
+ className="w-full flex items-center px-4 py-3 rounded-lg transition-all text-left text-gray-300 hover:text-white hover:bg-gray-800"
337
+ >
338
+ <span className="font-medium">{item.label}</span>
339
+ </button>
340
+ ))}
341
+ </nav>
342
+ </div>
343
+ </div>
344
+ </div>
345
+ )}
346
+ </>
347
+ )
348
+ }
349
+
350
+ export default Sidebar
351
+ `
352
+ fs.writeFileSync(path.join(componentsDir, 'Sidebar.tsx'), sidebarContent)
353
+ console.log(' ✅ Sidebar.tsx (genérico)')
181
354
  }
182
355
 
183
356
  // Crear index.ts para exportar los componentes
@@ -307,10 +480,50 @@ if (needsUpdate) {
307
480
  console.log('✅ responsive-system: Todas las dependencias ya están en package.json')
308
481
  }
309
482
 
310
- // Si el proyecto está vacío, crear estructura base
483
+ // Si el proyecto está vacío, crear README básico PRIMERO
311
484
  if (isProjectEmpty) {
485
+ // Crear README básico INMEDIATAMENTE para que el usuario sepa qué hacer
486
+ const readmePath = path.join(projectRoot, 'README.md')
487
+ if (!fs.existsSync(readmePath)) {
488
+ const basicReadme = `# Tu Aplicación
489
+
490
+ ## 🚀 Configuración Inicial
491
+
492
+ Acabas de instalar **responsive-system**. Para completar la configuración, ejecuta:
493
+
494
+ \`\`\`bash
495
+ npx responsive-system-setup
496
+ \`\`\`
497
+
498
+ Este comando:
499
+ - ✅ Instalará React, TypeScript, Tailwind y Vite automáticamente
500
+ - ✅ Te permitirá seleccionar el layout que prefieras
501
+ - ✅ Creará la estructura base del proyecto
502
+ - ✅ Generará componentes genéricos y página de ejemplo
503
+
504
+ ## 📦 ¿Qué es responsive-system?
505
+
506
+ Sistema completo de layout responsive con auto-scaling para React + Tailwind CSS.
507
+
508
+ - Auto-scaling automático (texto, espaciado, sombras)
509
+ - Layouts pre-configurados (default, sidebar, dashboard, minimal)
510
+ - Hook \`useResponsive\` para configuración manual
511
+ - Sin media queries necesarias
512
+
513
+ ---
514
+
515
+ **Siguiente paso:** Ejecuta \`npx responsive-system-setup\` para comenzar 🚀
516
+ `
517
+ fs.writeFileSync(readmePath, basicReadme)
518
+ console.log(' ✅ README.md básico creado con instrucciones')
519
+ }
520
+
312
521
  console.log('')
313
522
  console.log('📦 responsive-system: Proyecto vacío detectado, creando estructura base...')
523
+ console.log('')
524
+ console.log('💡 IMPORTANTE: Si este es tu primer uso, este script configurará todo automáticamente.')
525
+ console.log(' Si ya tienes el proyecto configurado, puedes cancelar (Ctrl+C)')
526
+ console.log('')
314
527
 
315
528
  // Preguntar qué layout quiere
316
529
  const selectedLayout = await askLayout()
@@ -326,8 +539,8 @@ if (isProjectEmpty) {
326
539
  }
327
540
  })
328
541
 
329
- // Copiar componentes según layout seleccionado
330
- copyLayoutComponents(selectedLayout)
542
+ // Generar componentes genéricos según layout seleccionado
543
+ generateLayoutComponents(selectedLayout)
331
544
  console.log('')
332
545
 
333
546
  // Copiar hook useResponsive
@@ -504,93 +717,84 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
504
717
  console.log(' ✅ Creado: src/index.css')
505
718
  }
506
719
 
507
- // Crear src/pages/HomePage.tsx con página de ejemplo
720
+ // Crear src/pages/HomePage.tsx con página de ejemplo simple
508
721
  const homePagePath = path.join(projectRoot, 'src', 'pages', 'HomePage.tsx')
509
722
  if (!fs.existsSync(homePagePath)) {
510
- const homePage = `import { useResponsiveLayout, LayoutSwitcher } from 'responsive-system'
723
+ const homePage = `import { useResponsiveLayout } from 'responsive-system'
511
724
  import { useResponsive } from '../hooks'
512
725
 
513
726
  function HomePage() {
514
- const { breakpoint, isMobile, layout } = useResponsiveLayout()
727
+ const { breakpoint, isMobile } = useResponsiveLayout()
515
728
  const responsive = useResponsive()
516
729
 
517
730
  return (
518
- <div className="min-h-screen bg-gray-50 p-6">
519
- <div className="max-w-7xl mx-auto space-y-6">
520
- {/* Header con información del sistema */}
521
- <div className="bg-white rounded-lg shadow-lg p-6">
522
- <h1 className="text-4xl font-bold mb-4">Responsive System Demo</h1>
523
- <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
524
- <div className="p-4 bg-blue-50 rounded">
525
- <p className="text-sm text-gray-600">Breakpoint actual</p>
526
- <p className="text-2xl font-bold">{breakpoint}</p>
527
- </div>
528
- <div className="p-4 bg-green-50 rounded">
529
- <p className="text-sm text-gray-600">Layout actual</p>
530
- <p className="text-2xl font-bold capitalize">{layout.current}</p>
531
- </div>
532
- <div className="p-4 bg-purple-50 rounded">
533
- <p className="text-sm text-gray-600">Dispositivo</p>
534
- <p className="text-2xl font-bold">{isMobile ? 'Móvil' : 'Desktop'}</p>
535
- </div>
536
- </div>
731
+ <div className="min-h-screen bg-gray-50 py-8 px-4">
732
+ <div className="max-w-7xl mx-auto space-y-8">
733
+ {/* Hero Section */}
734
+ <div className="bg-white rounded-lg shadow-md p-8 text-center">
735
+ <h1 className="text-4xl font-bold text-gray-900 mb-4">
736
+ Bienvenido a tu Aplicación
737
+ </h1>
738
+ <p className="text-lg text-gray-600 max-w-2xl mx-auto">
739
+ Esta es una página de ejemplo que demuestra el sistema responsive con auto-scaling.
740
+ Todo el contenido se ajusta automáticamente según el tamaño de pantalla.
741
+ </p>
537
742
  </div>
538
743
 
539
- {/* Selector de layouts */}
540
- <div className="bg-white rounded-lg shadow-lg p-6">
541
- <h2 className="text-2xl font-bold mb-4">Cambiar Layout</h2>
542
- <LayoutSwitcher />
744
+ {/* Info Cards */}
745
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
746
+ <div className="bg-blue-50 rounded-lg p-6 border border-blue-200">
747
+ <h3 className="text-sm font-semibold text-blue-900 mb-2">Breakpoint</h3>
748
+ <p className="text-2xl font-bold text-blue-700">{breakpoint.toUpperCase()}</p>
749
+ </div>
750
+ <div className="bg-green-50 rounded-lg p-6 border border-green-200">
751
+ <h3 className="text-sm font-semibold text-green-900 mb-2">Dispositivo</h3>
752
+ <p className="text-2xl font-bold text-green-700">{isMobile ? 'Móvil' : 'Desktop'}</p>
753
+ </div>
754
+ <div className="bg-purple-50 rounded-lg p-6 border border-purple-200">
755
+ <h3 className="text-sm font-semibold text-purple-900 mb-2">Ancho</h3>
756
+ <p className="text-2xl font-bold text-purple-700">{responsive.width}px</p>
757
+ </div>
758
+ <div className="bg-orange-50 rounded-lg p-6 border border-orange-200">
759
+ <h3 className="text-sm font-semibold text-orange-900 mb-2">Alto</h3>
760
+ <p className="text-2xl font-bold text-orange-700">{responsive.height}px</p>
761
+ </div>
543
762
  </div>
544
763
 
545
- {/* Cards de ejemplo */}
764
+ {/* Content Cards */}
546
765
  <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
547
766
  {[1, 2, 3, 4, 5, 6].map((i) => (
548
- <div key={i} className="bg-white rounded-lg shadow-lg p-6">
549
- <h3 className="text-xl font-bold mb-2">Card {i}</h3>
767
+ <div key={i} className="bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow">
768
+ <div className="w-12 h-12 bg-blue-500 rounded-lg flex items-center justify-center mb-4">
769
+ <span className="text-white font-bold text-xl">{i}</span>
770
+ </div>
771
+ <h3 className="text-xl font-bold text-gray-900 mb-2">Card {i}</h3>
550
772
  <p className="text-gray-600">
551
- Este es un ejemplo de card que escala automáticamente según el tamaño de pantalla.
552
- Todo el texto, espaciado y sombras se ajustan automáticamente.
773
+ Este es un ejemplo de card. El texto, espaciado y sombras se ajustan automáticamente
774
+ según el tamaño de pantalla gracias al sistema de auto-scaling.
553
775
  </p>
554
776
  </div>
555
777
  ))}
556
778
  </div>
557
779
 
558
- {/* Información sobre el hook useResponsive */}
559
- <div className="bg-white rounded-lg shadow-lg p-6">
560
- <h2 className="text-2xl font-bold mb-4">Hook useResponsive</h2>
561
- <p className="text-gray-700 mb-4">
562
- El hook <code className="bg-gray-100 px-2 py-1 rounded">useResponsive</code> está disponible localmente en <code className="bg-gray-100 px-2 py-1 rounded">src/hooks/useResponsive.ts</code>
563
- </p>
564
- <div className="grid grid-cols-2 md:grid-cols-4 gap-4">
565
- <div className="p-3 bg-gray-50 rounded">
566
- <p className="text-xs text-gray-600">Ancho</p>
567
- <p className="text-lg font-bold">{responsive.width}px</p>
568
- </div>
569
- <div className="p-3 bg-gray-50 rounded">
570
- <p className="text-xs text-gray-600">Alto</p>
571
- <p className="text-lg font-bold">{responsive.height}px</p>
572
- </div>
573
- <div className="p-3 bg-gray-50 rounded">
574
- <p className="text-xs text-gray-600">Orientación</p>
575
- <p className="text-lg font-bold capitalize">{responsive.orientation}</p>
576
- </div>
577
- <div className="p-3 bg-gray-50 rounded">
578
- <p className="text-xs text-gray-600">Desktop</p>
579
- <p className="text-lg font-bold">{responsive.isDesktop ? 'Sí' : 'No'}</p>
580
- </div>
780
+ {/* Info Section */}
781
+ <div className="bg-white rounded-lg shadow-md p-8">
782
+ <h2 className="text-2xl font-bold text-gray-900 mb-4">Sistema Responsive</h2>
783
+ <div className="space-y-3 text-gray-700">
784
+ <p>
785
+ <strong className="text-gray-900">Auto-scaling activo:</strong> Todo el contenido escala
786
+ automáticamente según el breakpoint actual (texto, espaciado, sombras).
787
+ </p>
788
+ <p>
789
+ <strong className="text-gray-900">Hook useResponsive:</strong> Disponible en{' '}
790
+ <code className="bg-gray-100 px-2 py-1 rounded text-sm">src/hooks/useResponsive.ts</code>{' '}
791
+ para configuración manual cuando lo necesites.
792
+ </p>
793
+ <p>
794
+ <strong className="text-gray-900">Layout actual:</strong> <span className="capitalize">{selectedLayout}</span>
795
+ </p>
581
796
  </div>
582
797
  </div>
583
-
584
- {/* Información */}
585
- <div className="bg-white rounded-lg shadow-lg p-6">
586
- <h2 className="text-2xl font-bold mb-4">Cómo funciona</h2>
587
- <ul className="space-y-2 text-gray-700">
588
- <li>✅ <strong>Auto-scaling:</strong> Todo escala automáticamente (texto, espaciado, sombras)</li>
589
- <li>✅ <strong>Layouts:</strong> Cambia entre default, sidebar, dashboard y minimal</li>
590
- <li>✅ <strong>Responsive:</strong> Se adapta automáticamente a todos los tamaños de pantalla</li>
591
- <li>✅ <strong>Hook useResponsive:</strong> Disponible localmente para configuración manual</li>
592
- </ul>
593
- </div>
594
798
  </div>
595
799
  </div>
596
800
  )
@@ -599,7 +803,7 @@ function HomePage() {
599
803
  export default HomePage
600
804
  `
601
805
  fs.writeFileSync(homePagePath, homePage)
602
- console.log(' ✅ Creado: src/pages/HomePage.tsx')
806
+ console.log(' ✅ Creado: src/pages/HomePage.tsx (página de ejemplo simple)')
603
807
  }
604
808
 
605
809
  // Crear src/App.tsx que importa la página
@@ -642,11 +846,11 @@ export default App
642
846
  console.log(' 2. Abre http://localhost:5173')
643
847
  console.log('')
644
848
  console.log(`Layout seleccionado: "${selectedLayout}"`)
645
- console.log(' - Componentes copiados en src/components/layout/')
849
+ console.log(' - Componentes generados en src/components/layout/')
646
850
  console.log(' - Hook useResponsive disponible en src/hooks/useResponsive.ts')
647
851
  console.log(' - Página de ejemplo en src/pages/HomePage.tsx')
648
852
  console.log('')
649
- console.log('💡 Para cambiar el layout, ejecuta: npx responsive-system-setup')
853
+ console.log('💡 Para cambiar el layout después, ejecuta: npx responsive-system-setup')
650
854
  console.log('')
651
855
  } else {
652
856
  console.log('✅ responsive-system: Proyecto ya inicializado')
@@ -655,3 +859,8 @@ export default App
655
859
  console.log('')
656
860
  console.log('✅ responsive-system: postinstall completado')
657
861
  console.log('')
862
+ console.log('📝 NOTA: Si instalaste el paquete pero este script no se ejecutó automáticamente,')
863
+ console.log(' ejecuta uno de estos comandos:')
864
+ console.log(' - npx responsive-system-setup')
865
+ console.log(' - node node_modules/responsive-system/scripts/postinstall.js')
866
+ 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
-