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.
- package/README.md +23 -364
- package/package.json +2 -4
- package/scripts/postinstall.js +293 -84
- package/ARCHITECTURE.md +0 -195
- package/INSTALLATION.md +0 -403
package/README.md
CHANGED
|
@@ -1,382 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# responsive-system
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Sistema completo de layout responsive con auto-scaling para React + Tailwind CSS.
|
|
4
4
|
|
|
5
|
-
##
|
|
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
|
-
|
|
32
|
-
npm install responsive-system
|
|
8
|
+
npm install responsive-system@latest
|
|
33
9
|
```
|
|
34
10
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### **Inicializar Tailwind (solo la primera vez)**
|
|
38
|
-
|
|
39
|
-
Después de instalar, inicializa Tailwind:
|
|
11
|
+
## ⚡ Configuración
|
|
40
12
|
|
|
41
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
25
|
+
## 📦 Características
|
|
163
26
|
|
|
164
|
-
|
|
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
|
-
|
|
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
|
-
**
|
|
174
|
-
|
|
175
|
-
|
|
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
|
-
|
|
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
|
+
"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",
|