ywana-core8 0.1.84 → 0.1.85
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/__previewjs__/Wrapper.tsx +8 -5
- package/build-doc.sh +10 -0
- package/dist/index.cjs +418 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +294 -94
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +418 -119
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +420 -120
- package/dist/index.umd.js.map +1 -1
- package/doc/README.md +196 -0
- package/doc/craco.config.js +31 -0
- package/doc/generate-examples.cjs +310 -0
- package/doc/package-lock.json +17298 -0
- package/doc/package.json +33 -0
- package/doc/public/index.html +22 -0
- package/doc/src/App.css +171 -0
- package/doc/src/App.js +214 -0
- package/doc/src/components/ExamplePage.js +104 -0
- package/doc/src/components/WelcomePage.js +84 -0
- package/doc/src/examples/button.example.js +47 -0
- package/doc/src/examples/input.example.js +91 -0
- package/doc/src/index.css +237 -0
- package/doc/src/index.js +11 -0
- package/package.json +9 -2
- package/preview.config.js +38 -0
- package/src/html/accordion.example.js +2 -2
- package/src/html/actions-cell.css +108 -0
- package/src/html/actions-cell.example.js +587 -0
- package/src/html/actions-cell.js +260 -0
- package/src/html/checkbox.example.js +2 -2
- package/src/html/chip.example.js +2 -2
- package/src/html/color.example.js +2 -2
- package/src/html/form.example.js +2 -2
- package/src/html/header2.example.js +2 -2
- package/src/html/index.js +1 -0
- package/src/html/menu.css +9 -2
- package/src/html/menu.js +14 -2
- package/src/html/progress.example.js +2 -2
- package/src/html/property.example.js +2 -2
- package/src/html/radio.example.js +2 -2
- package/src/html/switch.example.js +2 -2
- package/src/html/tab.example.js +2 -2
- package/src/html/table.css +47 -1
- package/src/html/table.example.js +1012 -0
- package/src/html/table.js +12 -7
- package/src/html/table2-actions-test.js +138 -0
- package/src/html/table2.css +40 -3
- package/src/html/table2.example.js +330 -0
- package/src/html/table2.js +56 -13
- package/src/html/tokenfield.example.js +2 -2
- package/src/widgets/calendar/Calendar.js +1 -1
- /package/{ACCORDION_EVALUATION.md → doc/evalulations/ACCORDION_EVALUATION.md} +0 -0
- /package/{CHECKBOX_EVALUATION.md → doc/evalulations/CHECKBOX_EVALUATION.md} +0 -0
- /package/{CHIP_EVALUATION.md → doc/evalulations/CHIP_EVALUATION.md} +0 -0
- /package/{COLOR_EVALUATION.md → doc/evalulations/COLOR_EVALUATION.md} +0 -0
- /package/{COMPONENTS_EVALUATION.md → doc/evalulations/COMPONENTS_EVALUATION.md} +0 -0
- /package/{FORM_EVALUATION.md → doc/evalulations/FORM_EVALUATION.md} +0 -0
- /package/{HEADER_EVALUATION.md → doc/evalulations/HEADER_EVALUATION.md} +0 -0
- /package/{ICON_EVALUATION.md → doc/evalulations/ICON_EVALUATION.md} +0 -0
- /package/{LIST_EVALUATION.md → doc/evalulations/LIST_EVALUATION.md} +0 -0
- /package/{PROGRESS_EVALUATION.md → doc/evalulations/PROGRESS_EVALUATION.md} +0 -0
- /package/{RADIO_EVALUATION.md → doc/evalulations/RADIO_EVALUATION.md} +0 -0
- /package/{RADIO_VISUAL_FIX.md → doc/evalulations/RADIO_VISUAL_FIX.md} +0 -0
- /package/{SECTION_IMPROVEMENTS.md → doc/evalulations/SECTION_IMPROVEMENTS.md} +0 -0
- /package/{SWITCH_EVALUATION.md → doc/evalulations/SWITCH_EVALUATION.md} +0 -0
- /package/{SWITCH_VISUAL_FIX.md → doc/evalulations/SWITCH_VISUAL_FIX.md} +0 -0
- /package/{TAB_EVALUATION.md → doc/evalulations/TAB_EVALUATION.md} +0 -0
- /package/{TEXTFIELD_EVALUATION.md → doc/evalulations/TEXTFIELD_EVALUATION.md} +0 -0
- /package/{TOOLTIP_FIX.md → doc/evalulations/TOOLTIP_FIX.md} +0 -0
- /package/{TREE_EVALUATION.md → doc/evalulations/TREE_EVALUATION.md} +0 -0
- /package/src/incubator/{PDFViewer.js → pdfViewer.js} +0 -0
package/doc/README.md
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
# Ywana Core8 - Documentación de Componentes
|
2
|
+
|
3
|
+
Este directorio contiene la documentación interactiva de todos los componentes de Ywana Core8, implementada como un sitio web estático con React.
|
4
|
+
|
5
|
+
## 🌐 Sitio Web
|
6
|
+
|
7
|
+
El sitio web principal se encuentra en `index.html` y proporciona:
|
8
|
+
|
9
|
+
- **Menú lateral navegable** con todos los componentes organizados por categorías
|
10
|
+
- **Búsqueda en tiempo real** de componentes
|
11
|
+
- **Filtrado por categorías** (Input, Data Display, Layout, etc.)
|
12
|
+
- **Vista previa interactiva** de cada componente
|
13
|
+
- **Diseño responsive** que funciona en desktop y móvil
|
14
|
+
|
15
|
+
## 📁 Estructura de Archivos
|
16
|
+
|
17
|
+
```
|
18
|
+
doc/
|
19
|
+
├── index.html # Página principal del sitio web
|
20
|
+
├── app.js # Aplicación React principal
|
21
|
+
├── styles.css # Estilos del sitio web
|
22
|
+
├── generate-examples.cjs # Script para generar archivos HTML
|
23
|
+
├── lib/ # Componentes y ejemplos
|
24
|
+
│ ├── *.js # Componentes React
|
25
|
+
│ ├── *.css # Estilos de componentes
|
26
|
+
│ ├── *.example.js # Archivos de ejemplos
|
27
|
+
│ ├── *.example.html # Páginas HTML generadas
|
28
|
+
│ ├── react.development.js
|
29
|
+
│ ├── react-dom.development.js
|
30
|
+
│ └── ExampleLayout.js # Layout común para ejemplos
|
31
|
+
└── README.md # Este archivo
|
32
|
+
```
|
33
|
+
|
34
|
+
## 🚀 Uso
|
35
|
+
|
36
|
+
### Ver la Documentación
|
37
|
+
|
38
|
+
1. Abrir `doc/index.html` en un navegador web
|
39
|
+
2. Navegar por el menú lateral para ver diferentes componentes
|
40
|
+
3. Usar la búsqueda para encontrar componentes específicos
|
41
|
+
4. Filtrar por categoría usando el dropdown
|
42
|
+
|
43
|
+
### Agregar Nuevos Componentes
|
44
|
+
|
45
|
+
1. **Crear el componente**: `lib/mi-componente.js`
|
46
|
+
2. **Crear los estilos**: `lib/mi-componente.css`
|
47
|
+
3. **Crear el ejemplo**: `lib/mi-componente.example.js`
|
48
|
+
4. **Actualizar la configuración** en `app.js`:
|
49
|
+
```javascript
|
50
|
+
{
|
51
|
+
id: 'mi-componente',
|
52
|
+
title: 'Mi Componente',
|
53
|
+
description: 'Descripción del componente',
|
54
|
+
category: 'Input', // o la categoría apropiada
|
55
|
+
icon: 'icono_material',
|
56
|
+
file: 'mi-componente.example.js'
|
57
|
+
}
|
58
|
+
```
|
59
|
+
5. **Regenerar archivos HTML**: `node generate-examples.cjs`
|
60
|
+
|
61
|
+
## 📊 Componentes Disponibles
|
62
|
+
|
63
|
+
### Input (9 componentes)
|
64
|
+
- **Button** - Botones y acciones interactivas
|
65
|
+
- **Checkbox** - Casillas de verificación
|
66
|
+
- **Color** - Selector y visualizador de colores
|
67
|
+
- **Form** - Formularios y validación
|
68
|
+
- **Radio** - Botones de radio
|
69
|
+
- **Switch** - Interruptores de encendido/apagado
|
70
|
+
- **TextField** - Campos de texto y entrada
|
71
|
+
- **TokenField** - Campo de tokens y etiquetas
|
72
|
+
|
73
|
+
### Data Display (8 componentes)
|
74
|
+
- **Actions Cell** - Celda de acciones con overflow automático
|
75
|
+
- **Chip** - Etiquetas y chips interactivos
|
76
|
+
- **Icon** - Iconos de Material Design
|
77
|
+
- **List** - Listas y elementos de lista
|
78
|
+
- **Property** - Visualizador de propiedades
|
79
|
+
- **Table** - Tabla de datos original
|
80
|
+
- **Table2** - Tabla de datos mejorada
|
81
|
+
- **Tree** - Árbol jerárquico de datos
|
82
|
+
|
83
|
+
### Layout (3 componentes)
|
84
|
+
- **Accordion** - Componente de acordeón expandible
|
85
|
+
- **Header** - Cabeceras y navegación
|
86
|
+
- **Section** - Secciones y contenedores
|
87
|
+
|
88
|
+
### Navigation (1 componente)
|
89
|
+
- **Tab** - Pestañas y navegación por tabs
|
90
|
+
|
91
|
+
### Feedback (1 componente)
|
92
|
+
- **Progress** - Indicadores de progreso
|
93
|
+
|
94
|
+
### Overview (1 componente)
|
95
|
+
- **Components** - Vista general de todos los componentes
|
96
|
+
|
97
|
+
## 🛠️ Desarrollo
|
98
|
+
|
99
|
+
### Tecnologías Utilizadas
|
100
|
+
|
101
|
+
- **React 18** (modo desarrollo)
|
102
|
+
- **Babel Standalone** (transformación JSX en el navegador)
|
103
|
+
- **Material Icons** (iconografía)
|
104
|
+
- **CSS Variables** (theming)
|
105
|
+
- **Vanilla JavaScript** (sin bundlers)
|
106
|
+
|
107
|
+
### Características Técnicas
|
108
|
+
|
109
|
+
- **Sin Build Process**: Todo funciona directamente en el navegador
|
110
|
+
- **Hot Reload**: Los cambios se ven inmediatamente al recargar
|
111
|
+
- **Modular**: Cada componente es independiente
|
112
|
+
- **Responsive**: Diseño adaptativo para todos los dispositivos
|
113
|
+
- **Accesible**: Navegación por teclado y screen readers
|
114
|
+
|
115
|
+
### Scripts Útiles
|
116
|
+
|
117
|
+
```bash
|
118
|
+
# Generar todos los archivos HTML de ejemplos
|
119
|
+
node generate-examples.cjs
|
120
|
+
|
121
|
+
# Servir localmente (opcional)
|
122
|
+
python -m http.server 8000
|
123
|
+
# o
|
124
|
+
npx serve .
|
125
|
+
```
|
126
|
+
|
127
|
+
## 🎨 Personalización
|
128
|
+
|
129
|
+
### Temas y Colores
|
130
|
+
|
131
|
+
Los colores se definen en CSS Variables en `index.html`:
|
132
|
+
|
133
|
+
```css
|
134
|
+
:root {
|
135
|
+
--primary-color: #1976d2;
|
136
|
+
--primary-color-light: #42a5f5;
|
137
|
+
--primary-color-lighter: #e3f2fd;
|
138
|
+
--text-color: #212121;
|
139
|
+
--background-color: #fafafa;
|
140
|
+
/* ... más variables */
|
141
|
+
}
|
142
|
+
```
|
143
|
+
|
144
|
+
### Layout de Ejemplos
|
145
|
+
|
146
|
+
Todos los ejemplos usan `ExampleLayout.js` que proporciona:
|
147
|
+
|
148
|
+
- **Navegación lateral** con secciones y subsecciones
|
149
|
+
- **Snippets de código** con syntax highlighting
|
150
|
+
- **Responsive design** automático
|
151
|
+
- **Scroll spy** para navegación activa
|
152
|
+
|
153
|
+
## 📱 Responsive Design
|
154
|
+
|
155
|
+
El sitio web es completamente responsive:
|
156
|
+
|
157
|
+
- **Desktop**: Sidebar fijo de 320px
|
158
|
+
- **Tablet**: Sidebar colapsable
|
159
|
+
- **Mobile**: Sidebar overlay con navegación táctil
|
160
|
+
|
161
|
+
## 🔍 Búsqueda y Filtrado
|
162
|
+
|
163
|
+
- **Búsqueda en tiempo real** por nombre y descripción
|
164
|
+
- **Filtrado por categorías** con contador de resultados
|
165
|
+
- **Navegación por teclado** para accesibilidad
|
166
|
+
- **URLs amigables** (futuro: deep linking)
|
167
|
+
|
168
|
+
## 📈 Métricas
|
169
|
+
|
170
|
+
- **22 componentes** documentados
|
171
|
+
- **6 categorías** organizadas
|
172
|
+
- **100% responsive** design
|
173
|
+
- **0 dependencias** de build
|
174
|
+
- **< 2MB** tamaño total
|
175
|
+
|
176
|
+
## 🚀 Despliegue
|
177
|
+
|
178
|
+
El sitio está configurado para GitHub Pages:
|
179
|
+
|
180
|
+
1. Los archivos están en la carpeta `doc/`
|
181
|
+
2. GitHub Pages sirve automáticamente desde esta carpeta
|
182
|
+
3. Accesible en: `https://[usuario].github.io/[repo]/`
|
183
|
+
|
184
|
+
## 🤝 Contribución
|
185
|
+
|
186
|
+
Para contribuir:
|
187
|
+
|
188
|
+
1. Agregar nuevos componentes siguiendo la estructura existente
|
189
|
+
2. Actualizar la configuración en `app.js`
|
190
|
+
3. Regenerar archivos HTML con el script
|
191
|
+
4. Probar localmente antes de hacer commit
|
192
|
+
5. Documentar cambios en este README
|
193
|
+
|
194
|
+
---
|
195
|
+
|
196
|
+
**Ywana Core8** - Sistema de Diseño y Componentes React
|
@@ -0,0 +1,31 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
|
3
|
+
module.exports = {
|
4
|
+
webpack: {
|
5
|
+
configure: (webpackConfig) => {
|
6
|
+
// Resolver el problema con moment/locale/es
|
7
|
+
webpackConfig.resolve.alias = {
|
8
|
+
...webpackConfig.resolve.alias,
|
9
|
+
'moment/locale/es': path.resolve(__dirname, 'node_modules/moment/locale/es.js'),
|
10
|
+
};
|
11
|
+
|
12
|
+
// Configurar fallbacks para módulos de Node.js
|
13
|
+
webpackConfig.resolve.fallback = {
|
14
|
+
...webpackConfig.resolve.fallback,
|
15
|
+
"path": require.resolve("path-browserify"),
|
16
|
+
"os": require.resolve("os-browserify/browser"),
|
17
|
+
"crypto": require.resolve("crypto-browserify"),
|
18
|
+
"stream": require.resolve("stream-browserify"),
|
19
|
+
"buffer": require.resolve("buffer"),
|
20
|
+
"util": require.resolve("util"),
|
21
|
+
"assert": require.resolve("assert"),
|
22
|
+
"url": require.resolve("url"),
|
23
|
+
"fs": false,
|
24
|
+
"net": false,
|
25
|
+
"tls": false,
|
26
|
+
};
|
27
|
+
|
28
|
+
return webpackConfig;
|
29
|
+
},
|
30
|
+
},
|
31
|
+
};
|
@@ -0,0 +1,310 @@
|
|
1
|
+
const fs = require('fs');
|
2
|
+
const path = require('path');
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Configuración de dependencias para cada componente
|
6
|
+
*/
|
7
|
+
const COMPONENT_DEPENDENCIES = {
|
8
|
+
'accordion': {
|
9
|
+
css: ['ExampleLayout.css', 'accordion.css', 'icon.css'],
|
10
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'accordion.js']
|
11
|
+
},
|
12
|
+
'actions-cell': {
|
13
|
+
css: ['ExampleLayout.css', 'actions-cell.css', 'icon.css', 'menu.css', 'button.css'],
|
14
|
+
js: ['icon.js', 'text.js', 'menu.js', 'button.js', 'SimpleExampleLayout.js', 'actions-cell.js']
|
15
|
+
},
|
16
|
+
'button': {
|
17
|
+
css: ['ExampleLayout.css', 'button.css', 'icon.css'],
|
18
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'button.js']
|
19
|
+
},
|
20
|
+
'checkbox': {
|
21
|
+
css: ['ExampleLayout.css', 'checkbox.css', 'icon.css'],
|
22
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'checkbox.js']
|
23
|
+
},
|
24
|
+
'chip': {
|
25
|
+
css: ['ExampleLayout.css', 'chip.css', 'icon.css'],
|
26
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'chip.js']
|
27
|
+
},
|
28
|
+
'color': {
|
29
|
+
css: ['ExampleLayout.css', 'color.css', 'icon.css'],
|
30
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'color.js']
|
31
|
+
},
|
32
|
+
'components': {
|
33
|
+
css: ['ExampleLayout.css', 'button.css', 'icon.css', 'checkbox.css', 'textfield.css'],
|
34
|
+
js: ['icon.js', 'text.js', 'button.js', 'checkbox.js', 'textfield.js', 'SimpleExampleLayout.js']
|
35
|
+
},
|
36
|
+
'form': {
|
37
|
+
css: ['ExampleLayout.css', 'form.css', 'textfield.css', 'button.css', 'checkbox.css', 'icon.css'],
|
38
|
+
js: ['icon.js', 'text.js', 'textfield.js', 'button.js', 'checkbox.js', 'SimpleExampleLayout.js', 'form.js']
|
39
|
+
},
|
40
|
+
'header2': {
|
41
|
+
css: ['ExampleLayout.css', 'header2.css', 'icon.css', 'button.css'],
|
42
|
+
js: ['icon.js', 'text.js', 'button.js', 'SimpleExampleLayout.js', 'header2.js']
|
43
|
+
},
|
44
|
+
'icon': {
|
45
|
+
css: ['ExampleLayout.css', 'icon.css'],
|
46
|
+
js: ['text.js', 'SimpleExampleLayout.js', 'icon.js']
|
47
|
+
},
|
48
|
+
'list': {
|
49
|
+
css: ['ExampleLayout.css', 'list.css', 'icon.css'],
|
50
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'list.js']
|
51
|
+
},
|
52
|
+
'progress': {
|
53
|
+
css: ['ExampleLayout.css', 'progress.css', 'icon.css'],
|
54
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'progress.js']
|
55
|
+
},
|
56
|
+
'property': {
|
57
|
+
css: ['ExampleLayout.css', 'property.css', 'icon.css'],
|
58
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'property.js']
|
59
|
+
},
|
60
|
+
'radio': {
|
61
|
+
css: ['ExampleLayout.css', 'radio.css', 'icon.css'],
|
62
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'radio.js']
|
63
|
+
},
|
64
|
+
'section': {
|
65
|
+
css: ['ExampleLayout.css', 'section.css', 'icon.css'],
|
66
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'section.js']
|
67
|
+
},
|
68
|
+
'switch': {
|
69
|
+
css: ['ExampleLayout.css', 'switch.css', 'icon.css'],
|
70
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'switch.js']
|
71
|
+
},
|
72
|
+
'tab': {
|
73
|
+
css: ['ExampleLayout.css', 'tab.css', 'icon.css'],
|
74
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'tab.js']
|
75
|
+
},
|
76
|
+
'table': {
|
77
|
+
css: ['ExampleLayout.css', 'table.css', 'icon.css', 'textfield.css', 'checkbox.css', 'actions-cell.css', 'menu.css', 'button.css'],
|
78
|
+
js: ['icon.js', 'text.js', 'textfield.js', 'checkbox.js', 'menu.js', 'button.js', 'actions-cell.js', 'SimpleExampleLayout.js', 'table.js']
|
79
|
+
},
|
80
|
+
'table2': {
|
81
|
+
css: ['ExampleLayout.css', 'table2.css', 'icon.css', 'textfield.css', 'checkbox.css', 'actions-cell.css', 'menu.css', 'button.css'],
|
82
|
+
js: ['icon.js', 'text.js', 'textfield.js', 'checkbox.js', 'menu.js', 'button.js', 'actions-cell.js', 'SimpleExampleLayout.js', 'table2.js']
|
83
|
+
},
|
84
|
+
'textfield2': {
|
85
|
+
css: ['ExampleLayout.css', 'textfield2.css', 'icon.css'],
|
86
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'textfield2.js']
|
87
|
+
},
|
88
|
+
'tokenfield': {
|
89
|
+
css: ['ExampleLayout.css', 'tokenfield.css', 'icon.css', 'chip.css'],
|
90
|
+
js: ['icon.js', 'text.js', 'chip.js', 'SimpleExampleLayout.js', 'tokenfield.js']
|
91
|
+
},
|
92
|
+
'tree': {
|
93
|
+
css: ['ExampleLayout.css', 'tree.css', 'icon.css'],
|
94
|
+
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'tree.js']
|
95
|
+
}
|
96
|
+
};
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Mapeo de nombres de componentes a nombres de clases de ejemplo
|
100
|
+
*/
|
101
|
+
const COMPONENT_CLASS_NAMES = {
|
102
|
+
'accordion': 'AccordionExamples',
|
103
|
+
'actions-cell': 'ActionsCellExamples',
|
104
|
+
'button': 'ButtonExamples',
|
105
|
+
'checkbox': 'CheckboxExamples',
|
106
|
+
'chip': 'ChipExamples',
|
107
|
+
'color': 'ColorExamples',
|
108
|
+
'components': 'ComponentsExamples',
|
109
|
+
'form': 'FormExamples',
|
110
|
+
'header2': 'Header2Examples',
|
111
|
+
'icon': 'IconExamples',
|
112
|
+
'list': 'ListExamples',
|
113
|
+
'progress': 'ProgressExamples',
|
114
|
+
'property': 'PropertyExamples',
|
115
|
+
'radio': 'RadioExamples',
|
116
|
+
'section': 'SectionExamples',
|
117
|
+
'switch': 'SwitchExamples',
|
118
|
+
'tab': 'TabExamples',
|
119
|
+
'table': 'TableExamples',
|
120
|
+
'table2': 'Table2Examples',
|
121
|
+
'textfield2': 'TextField2Examples',
|
122
|
+
'tokenfield': 'TokenFieldExamples',
|
123
|
+
'tree': 'TreeExamples'
|
124
|
+
};
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Generar HTML para un componente específico
|
128
|
+
*/
|
129
|
+
function generateExampleHTML(componentName, title) {
|
130
|
+
const deps = COMPONENT_DEPENDENCIES[componentName] || { css: [], js: [] };
|
131
|
+
const className = COMPONENT_CLASS_NAMES[componentName] || `${componentName}Examples`;
|
132
|
+
|
133
|
+
const cssImports = deps.css.map(file => ` <link rel="stylesheet" href="${file}">`).join('\n');
|
134
|
+
const jsImports = deps.js.map(file => ` <script type="text/babel" src="${file}"></script>`).join('\n');
|
135
|
+
|
136
|
+
return `<!DOCTYPE html>
|
137
|
+
<html lang="es">
|
138
|
+
<head>
|
139
|
+
<meta charset="UTF-8">
|
140
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
141
|
+
<title>${title} - Ywana Core8</title>
|
142
|
+
|
143
|
+
<!-- CSS Variables -->
|
144
|
+
<style>
|
145
|
+
:root {
|
146
|
+
--primary-color: #1976d2;
|
147
|
+
--primary-color-light: #42a5f5;
|
148
|
+
--primary-color-lighter: #e3f2fd;
|
149
|
+
--secondary-color: #424242;
|
150
|
+
--text-color: #212121;
|
151
|
+
--text-color-light: #757575;
|
152
|
+
--text-color-lighter: #bdbdbd;
|
153
|
+
--paper-color: #ffffff;
|
154
|
+
--background-color: #fafafa;
|
155
|
+
--divider-color: #e0e0e0;
|
156
|
+
--shadow1: 0 2px 4px rgba(0,0,0,0.1);
|
157
|
+
--shadow2: 0 4px 8px rgba(0,0,0,0.15);
|
158
|
+
}
|
159
|
+
|
160
|
+
* {
|
161
|
+
margin: 0;
|
162
|
+
padding: 0;
|
163
|
+
box-sizing: border-box;
|
164
|
+
}
|
165
|
+
|
166
|
+
body {
|
167
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
168
|
+
background-color: var(--background-color);
|
169
|
+
color: var(--text-color);
|
170
|
+
line-height: 1.6;
|
171
|
+
}
|
172
|
+
|
173
|
+
#root {
|
174
|
+
min-height: 100vh;
|
175
|
+
}
|
176
|
+
|
177
|
+
.loading {
|
178
|
+
display: flex;
|
179
|
+
justify-content: center;
|
180
|
+
align-items: center;
|
181
|
+
height: 50vh;
|
182
|
+
font-size: 1.2rem;
|
183
|
+
color: var(--text-color-light);
|
184
|
+
}
|
185
|
+
|
186
|
+
/* Hide code snippets in iframe view */
|
187
|
+
.code-snippet,
|
188
|
+
.example-code,
|
189
|
+
pre,
|
190
|
+
code {
|
191
|
+
display: none !important;
|
192
|
+
}
|
193
|
+
|
194
|
+
/* Ensure examples are visible and well-spaced */
|
195
|
+
.example-section {
|
196
|
+
margin-bottom: 2rem;
|
197
|
+
}
|
198
|
+
|
199
|
+
.example-subsection {
|
200
|
+
margin-bottom: 1.5rem;
|
201
|
+
}
|
202
|
+
|
203
|
+
/* Make sure interactive elements work in iframe */
|
204
|
+
.example-content {
|
205
|
+
padding: 1rem;
|
206
|
+
}
|
207
|
+
</style>
|
208
|
+
|
209
|
+
<!-- Material Icons -->
|
210
|
+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
211
|
+
|
212
|
+
<!-- Component Styles -->
|
213
|
+
${cssImports}
|
214
|
+
|
215
|
+
<!-- React Development -->
|
216
|
+
<script crossorigin src="react.development.js"></script>
|
217
|
+
<script crossorigin src="react-dom.development.js"></script>
|
218
|
+
|
219
|
+
<!-- Babel for JSX transformation -->
|
220
|
+
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
221
|
+
</head>
|
222
|
+
<body>
|
223
|
+
<div id="root">
|
224
|
+
<div class="loading">Cargando ${title}...</div>
|
225
|
+
</div>
|
226
|
+
|
227
|
+
<!-- Component Scripts -->
|
228
|
+
${jsImports}
|
229
|
+
|
230
|
+
<!-- Example Script -->
|
231
|
+
<script type="text/babel">
|
232
|
+
// Import the example component and override CodeSnippet
|
233
|
+
const originalCodeSnippet = window.CodeSnippet;
|
234
|
+
window.CodeSnippet = () => null; // Hide all code snippets
|
235
|
+
|
236
|
+
// Load the example
|
237
|
+
import('./${componentName}.example.js').then(module => {
|
238
|
+
const ExampleComponent = module.${className} || module.default;
|
239
|
+
if (ExampleComponent) {
|
240
|
+
ReactDOM.render(React.createElement(ExampleComponent), document.getElementById('root'));
|
241
|
+
}
|
242
|
+
}).catch(() => {
|
243
|
+
// Fallback: try to load synchronously
|
244
|
+
const script = document.createElement('script');
|
245
|
+
script.type = 'text/babel';
|
246
|
+
script.src = '${componentName}.example.js';
|
247
|
+
script.onload = () => {
|
248
|
+
setTimeout(() => {
|
249
|
+
const ExampleComponent = window.${className};
|
250
|
+
if (ExampleComponent) {
|
251
|
+
ReactDOM.render(React.createElement(ExampleComponent), document.getElementById('root'));
|
252
|
+
}
|
253
|
+
}, 100);
|
254
|
+
};
|
255
|
+
document.head.appendChild(script);
|
256
|
+
});
|
257
|
+
</script>
|
258
|
+
</body>
|
259
|
+
</html>`;
|
260
|
+
}
|
261
|
+
|
262
|
+
/**
|
263
|
+
* Generar todos los archivos HTML
|
264
|
+
*/
|
265
|
+
function generateAllExamples() {
|
266
|
+
const examples = [
|
267
|
+
{ name: 'accordion', title: 'Accordion Examples' },
|
268
|
+
{ name: 'actions-cell', title: 'Actions Cell Examples' },
|
269
|
+
{ name: 'button', title: 'Button Examples' },
|
270
|
+
{ name: 'checkbox', title: 'Checkbox Examples' },
|
271
|
+
{ name: 'chip', title: 'Chip Examples' },
|
272
|
+
{ name: 'color', title: 'Color Examples' },
|
273
|
+
{ name: 'components', title: 'Components Overview' },
|
274
|
+
{ name: 'form', title: 'Form Examples' },
|
275
|
+
{ name: 'header2', title: 'Header Examples' },
|
276
|
+
{ name: 'icon', title: 'Icon Examples' },
|
277
|
+
{ name: 'list', title: 'List Examples' },
|
278
|
+
{ name: 'progress', title: 'Progress Examples' },
|
279
|
+
{ name: 'property', title: 'Property Examples' },
|
280
|
+
{ name: 'radio', title: 'Radio Examples' },
|
281
|
+
{ name: 'section', title: 'Section Examples' },
|
282
|
+
{ name: 'switch', title: 'Switch Examples' },
|
283
|
+
{ name: 'tab', title: 'Tab Examples' },
|
284
|
+
{ name: 'table', title: 'Table Examples' },
|
285
|
+
{ name: 'table2', title: 'Table2 Examples' },
|
286
|
+
{ name: 'textfield2', title: 'TextField Examples' },
|
287
|
+
{ name: 'tokenfield', title: 'TokenField Examples' },
|
288
|
+
{ name: 'tree', title: 'Tree Examples' }
|
289
|
+
];
|
290
|
+
|
291
|
+
const libDir = path.join(__dirname, 'lib');
|
292
|
+
|
293
|
+
examples.forEach(example => {
|
294
|
+
const html = generateExampleHTML(example.name, example.title);
|
295
|
+
const filename = `${example.name}.example.html`;
|
296
|
+
const filepath = path.join(libDir, filename);
|
297
|
+
|
298
|
+
fs.writeFileSync(filepath, html, 'utf8');
|
299
|
+
console.log(`Generated: ${filename}`);
|
300
|
+
});
|
301
|
+
|
302
|
+
console.log(`\nGenerated ${examples.length} example HTML files!`);
|
303
|
+
}
|
304
|
+
|
305
|
+
// Ejecutar si se llama directamente
|
306
|
+
if (require.main === module) {
|
307
|
+
generateAllExamples();
|
308
|
+
}
|
309
|
+
|
310
|
+
module.exports = { generateAllExamples, generateExampleHTML };
|