ywana-core8 0.1.85 → 0.1.86
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/doc/package-lock.json +4 -4
- package/doc/package.json +3 -2
- package/doc/scripts/generate-examples.js +129 -0
- package/doc/src/App.js +4 -173
- package/doc/src/examples-config.js +170 -0
- package/doc/src/index.js +2 -0
- package/package.json +1 -1
- package/doc/craco.config.js +0 -31
- package/doc/generate-examples.cjs +0 -310
package/doc/package-lock.json
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
"react": "^19.1.1",
|
13
13
|
"react-dom": "^19.1.1",
|
14
14
|
"react-scripts": "^5.0.1",
|
15
|
-
"ywana-core8": "^0.1.
|
15
|
+
"ywana-core8": "^0.1.85"
|
16
16
|
}
|
17
17
|
},
|
18
18
|
"..": {
|
@@ -17268,9 +17268,9 @@
|
|
17268
17268
|
}
|
17269
17269
|
},
|
17270
17270
|
"node_modules/ywana-core8": {
|
17271
|
-
"version": "0.1.
|
17272
|
-
"resolved": "https://registry.npmjs.org/ywana-core8/-/ywana-core8-0.1.
|
17273
|
-
"integrity": "sha512-
|
17271
|
+
"version": "0.1.85",
|
17272
|
+
"resolved": "https://registry.npmjs.org/ywana-core8/-/ywana-core8-0.1.85.tgz",
|
17273
|
+
"integrity": "sha512-XaWRXswsTOGKdqLZ+HDcW1WlbaZ2FDfPWmiPoVdVEQbFVl1Yt9CpYgb2aNdPN0CMQleoiv0lpIn6AZX5ayEsLg==",
|
17274
17274
|
"dependencies": {
|
17275
17275
|
"axios": "^1.3.4",
|
17276
17276
|
"crypto-js": "^4.1.1",
|
package/doc/package.json
CHANGED
@@ -7,7 +7,8 @@
|
|
7
7
|
"start": "react-scripts start",
|
8
8
|
"build": "react-scripts build",
|
9
9
|
"test": "react-scripts test",
|
10
|
-
"eject": "react-scripts eject"
|
10
|
+
"eject": "react-scripts eject",
|
11
|
+
"generate-examples": "node scripts/generate-examples.js"
|
11
12
|
},
|
12
13
|
"keywords": [],
|
13
14
|
"author": "",
|
@@ -16,7 +17,7 @@
|
|
16
17
|
"react": "^19.1.1",
|
17
18
|
"react-dom": "^19.1.1",
|
18
19
|
"react-scripts": "^5.0.1",
|
19
|
-
"ywana-core8": "^0.1.
|
20
|
+
"ywana-core8": "^0.1.85"
|
20
21
|
},
|
21
22
|
"browserslist": {
|
22
23
|
"production": [
|
@@ -0,0 +1,129 @@
|
|
1
|
+
const fs = require('fs');
|
2
|
+
const path = require('path');
|
3
|
+
|
4
|
+
// Función para convertir nombre de archivo a título legible
|
5
|
+
function fileNameToTitle(fileName) {
|
6
|
+
return fileName
|
7
|
+
.replace('.example.js', '')
|
8
|
+
.replace(/[-_]/g, ' ')
|
9
|
+
.replace(/\b\w/g, l => l.toUpperCase());
|
10
|
+
}
|
11
|
+
|
12
|
+
// Función para determinar el icono basado en el tipo de componente
|
13
|
+
function getIconForComponent(fileName) {
|
14
|
+
const iconMap = {
|
15
|
+
'button': 'smart_button',
|
16
|
+
'input': 'input',
|
17
|
+
'textfield': 'text_fields',
|
18
|
+
'checkbox': 'check_box',
|
19
|
+
'radio': 'radio_button_checked',
|
20
|
+
'switch': 'toggle_on',
|
21
|
+
'accordion': 'expand_more',
|
22
|
+
'tab': 'tab',
|
23
|
+
'table': 'table_chart',
|
24
|
+
'form': 'description',
|
25
|
+
'header': 'title',
|
26
|
+
'icon': 'star',
|
27
|
+
'list': 'list',
|
28
|
+
'menu': 'menu',
|
29
|
+
'progress': 'progress_activity',
|
30
|
+
'chip': 'label',
|
31
|
+
'color': 'palette',
|
32
|
+
'section': 'view_module',
|
33
|
+
'tree': 'account_tree',
|
34
|
+
'tooltip': 'help',
|
35
|
+
'thumbnail': 'image',
|
36
|
+
'tokenfield': 'token'
|
37
|
+
};
|
38
|
+
|
39
|
+
const componentName = fileName.replace('.example.js', '');
|
40
|
+
return iconMap[componentName] || 'widgets';
|
41
|
+
}
|
42
|
+
|
43
|
+
// Función para determinar la categoría
|
44
|
+
function getCategoryForComponent(fileName) {
|
45
|
+
const categoryMap = {
|
46
|
+
'button': 'Inputs',
|
47
|
+
'textfield': 'Inputs',
|
48
|
+
'textfield2': 'Inputs',
|
49
|
+
'checkbox': 'Inputs',
|
50
|
+
'radio': 'Inputs',
|
51
|
+
'switch': 'Inputs',
|
52
|
+
'tokenfield': 'Inputs',
|
53
|
+
'form': 'Forms',
|
54
|
+
'accordion': 'Layout',
|
55
|
+
'tab': 'Layout',
|
56
|
+
'section': 'Layout',
|
57
|
+
'header': 'Layout',
|
58
|
+
'header2': 'Layout',
|
59
|
+
'table': 'Data',
|
60
|
+
'table2': 'Data',
|
61
|
+
'list': 'Data',
|
62
|
+
'tree': 'Data',
|
63
|
+
'icon': 'Display',
|
64
|
+
'chip': 'Display',
|
65
|
+
'color': 'Display',
|
66
|
+
'progress': 'Display',
|
67
|
+
'thumbnail': 'Display',
|
68
|
+
'tooltip': 'Display',
|
69
|
+
'menu': 'Navigation',
|
70
|
+
'property': 'Utils',
|
71
|
+
'selector': 'Utils',
|
72
|
+
'actions-cell': 'Utils'
|
73
|
+
};
|
74
|
+
|
75
|
+
const componentName = fileName.replace('.example.js', '');
|
76
|
+
return categoryMap[componentName] || 'Components';
|
77
|
+
}
|
78
|
+
|
79
|
+
// Leer archivos de ejemplos
|
80
|
+
function generateExamplesConfig() {
|
81
|
+
const examplesDir = path.join(__dirname, '../src/examples');
|
82
|
+
|
83
|
+
if (!fs.existsSync(examplesDir)) {
|
84
|
+
console.error('La carpeta src/examples no existe. Creando ejemplos básicos...');
|
85
|
+
createBasicExamples();
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
|
89
|
+
const files = fs.readdirSync(examplesDir);
|
90
|
+
const exampleFiles = files.filter(file => file.endsWith('.example.js'));
|
91
|
+
|
92
|
+
const examples = exampleFiles.map(file => {
|
93
|
+
const componentName = file.replace('.example.js', '');
|
94
|
+
return {
|
95
|
+
id: componentName,
|
96
|
+
title: fileNameToTitle(file),
|
97
|
+
icon: getIconForComponent(file),
|
98
|
+
category: getCategoryForComponent(file),
|
99
|
+
file: file
|
100
|
+
};
|
101
|
+
});
|
102
|
+
|
103
|
+
// Generar el archivo de configuración
|
104
|
+
const configContent = `// Este archivo es generado automáticamente por scripts/generate-examples.js
|
105
|
+
// No editar manualmente
|
106
|
+
|
107
|
+
export const EXAMPLES_CONFIG = ${JSON.stringify(examples, null, 2)};
|
108
|
+
|
109
|
+
// Función para importar dinámicamente los ejemplos
|
110
|
+
export const importExample = async (fileName) => {
|
111
|
+
try {
|
112
|
+
const module = await import(\`../examples/\${fileName}\`);
|
113
|
+
return module.default || module;
|
114
|
+
} catch (error) {
|
115
|
+
console.error(\`Error importing example \${fileName}:\`, error);
|
116
|
+
return null;
|
117
|
+
}
|
118
|
+
};
|
119
|
+
`;
|
120
|
+
|
121
|
+
// Escribir el archivo
|
122
|
+
const configPath = path.join(__dirname, '../src/examples-config.js');
|
123
|
+
fs.writeFileSync(configPath, configContent);
|
124
|
+
|
125
|
+
console.log(`✅ Generados ${examples.length} ejemplos en src/examples-config.js`);
|
126
|
+
console.log('Categorías encontradas:', [...new Set(examples.map(e => e.category))]);
|
127
|
+
}
|
128
|
+
|
129
|
+
generateExamplesConfig();
|
package/doc/src/App.js
CHANGED
@@ -6,183 +6,14 @@ import './App.css';
|
|
6
6
|
import WelcomePage from './components/WelcomePage';
|
7
7
|
import ExamplePage from './components/ExamplePage';
|
8
8
|
|
9
|
-
//
|
10
|
-
|
11
|
-
{
|
12
|
-
id: 'button-examples',
|
13
|
-
title: 'Button',
|
14
|
-
description: 'Componente de botón con diferentes variantes y estados',
|
15
|
-
category: 'Inputs',
|
16
|
-
icon: 'smart_button',
|
17
|
-
file: 'button.example.js'
|
18
|
-
},
|
19
|
-
{
|
20
|
-
id: 'input-examples',
|
21
|
-
title: 'Input',
|
22
|
-
description: 'Campos de entrada de texto con validación y estados',
|
23
|
-
category: 'Inputs',
|
24
|
-
icon: 'input',
|
25
|
-
file: 'input.example.js'
|
26
|
-
},
|
27
|
-
{
|
28
|
-
id: 'select-examples',
|
29
|
-
title: 'Select',
|
30
|
-
description: 'Componente de selección con opciones múltiples',
|
31
|
-
category: 'Inputs',
|
32
|
-
icon: 'arrow_drop_down_circle',
|
33
|
-
file: 'select.example.js'
|
34
|
-
},
|
35
|
-
{
|
36
|
-
id: 'checkbox-examples',
|
37
|
-
title: 'Checkbox',
|
38
|
-
description: 'Casillas de verificación con estados personalizados',
|
39
|
-
category: 'Inputs',
|
40
|
-
icon: 'check_box',
|
41
|
-
file: 'checkbox.example.js'
|
42
|
-
},
|
43
|
-
{
|
44
|
-
id: 'radio-examples',
|
45
|
-
title: 'Radio',
|
46
|
-
description: 'Botones de radio para selección única',
|
47
|
-
category: 'Inputs',
|
48
|
-
icon: 'radio_button_checked',
|
49
|
-
file: 'radio.example.js'
|
50
|
-
},
|
51
|
-
{
|
52
|
-
id: 'textarea-examples',
|
53
|
-
title: 'Textarea',
|
54
|
-
description: 'Área de texto multilínea con redimensionamiento',
|
55
|
-
category: 'Inputs',
|
56
|
-
icon: 'notes',
|
57
|
-
file: 'textarea.example.js'
|
58
|
-
},
|
59
|
-
{
|
60
|
-
id: 'switch-examples',
|
61
|
-
title: 'Switch',
|
62
|
-
description: 'Interruptores de encendido/apagado',
|
63
|
-
category: 'Inputs',
|
64
|
-
icon: 'toggle_on',
|
65
|
-
file: 'switch.example.js'
|
66
|
-
},
|
67
|
-
{
|
68
|
-
id: 'slider-examples',
|
69
|
-
title: 'Slider',
|
70
|
-
description: 'Control deslizante para selección de valores',
|
71
|
-
category: 'Inputs',
|
72
|
-
icon: 'tune',
|
73
|
-
file: 'slider.example.js'
|
74
|
-
},
|
75
|
-
{
|
76
|
-
id: 'card-examples',
|
77
|
-
title: 'Card',
|
78
|
-
description: 'Tarjetas de contenido con diferentes layouts',
|
79
|
-
category: 'Layout',
|
80
|
-
icon: 'credit_card',
|
81
|
-
file: 'card.example.js'
|
82
|
-
},
|
83
|
-
{
|
84
|
-
id: 'modal-examples',
|
85
|
-
title: 'Modal',
|
86
|
-
description: 'Ventanas modales y diálogos',
|
87
|
-
category: 'Layout',
|
88
|
-
icon: 'open_in_new',
|
89
|
-
file: 'modal.example.js'
|
90
|
-
},
|
91
|
-
{
|
92
|
-
id: 'tabs-examples',
|
93
|
-
title: 'Tabs',
|
94
|
-
description: 'Pestañas para organizar contenido',
|
95
|
-
category: 'Layout',
|
96
|
-
icon: 'tab',
|
97
|
-
file: 'tabs.example.js'
|
98
|
-
},
|
99
|
-
{
|
100
|
-
id: 'accordion-examples',
|
101
|
-
title: 'Accordion',
|
102
|
-
description: 'Paneles expandibles para contenido',
|
103
|
-
category: 'Layout',
|
104
|
-
icon: 'expand_more',
|
105
|
-
file: 'accordion.example.js'
|
106
|
-
},
|
107
|
-
{
|
108
|
-
id: 'table-examples',
|
109
|
-
title: 'Table',
|
110
|
-
description: 'Tablas de datos con ordenamiento y filtros',
|
111
|
-
category: 'Data',
|
112
|
-
icon: 'table_chart',
|
113
|
-
file: 'table.example.js'
|
114
|
-
},
|
115
|
-
{
|
116
|
-
id: 'list-examples',
|
117
|
-
title: 'List',
|
118
|
-
description: 'Listas de elementos con diferentes estilos',
|
119
|
-
category: 'Data',
|
120
|
-
icon: 'list',
|
121
|
-
file: 'list.example.js'
|
122
|
-
},
|
123
|
-
{
|
124
|
-
id: 'pagination-examples',
|
125
|
-
title: 'Pagination',
|
126
|
-
description: 'Controles de paginación para datos',
|
127
|
-
category: 'Data',
|
128
|
-
icon: 'last_page',
|
129
|
-
file: 'pagination.example.js'
|
130
|
-
},
|
131
|
-
{
|
132
|
-
id: 'alert-examples',
|
133
|
-
title: 'Alert',
|
134
|
-
description: 'Alertas y notificaciones para el usuario',
|
135
|
-
category: 'Feedback',
|
136
|
-
icon: 'notification_important',
|
137
|
-
file: 'alert.example.js'
|
138
|
-
},
|
139
|
-
{
|
140
|
-
id: 'toast-examples',
|
141
|
-
title: 'Toast',
|
142
|
-
description: 'Notificaciones temporales tipo toast',
|
143
|
-
category: 'Feedback',
|
144
|
-
icon: 'campaign',
|
145
|
-
file: 'toast.example.js'
|
146
|
-
},
|
147
|
-
{
|
148
|
-
id: 'progress-examples',
|
149
|
-
title: 'Progress',
|
150
|
-
description: 'Barras de progreso y indicadores de carga',
|
151
|
-
category: 'Feedback',
|
152
|
-
icon: 'progress_activity',
|
153
|
-
file: 'progress.example.js'
|
154
|
-
},
|
155
|
-
{
|
156
|
-
id: 'spinner-examples',
|
157
|
-
title: 'Spinner',
|
158
|
-
description: 'Indicadores de carga giratorios',
|
159
|
-
category: 'Feedback',
|
160
|
-
icon: 'refresh',
|
161
|
-
file: 'spinner.example.js'
|
162
|
-
},
|
163
|
-
{
|
164
|
-
id: 'tooltip-examples',
|
165
|
-
title: 'Tooltip',
|
166
|
-
description: 'Información contextual en hover',
|
167
|
-
category: 'Feedback',
|
168
|
-
icon: 'help',
|
169
|
-
file: 'tooltip.example.js'
|
170
|
-
},
|
171
|
-
{
|
172
|
-
id: 'badge-examples',
|
173
|
-
title: 'Badge',
|
174
|
-
description: 'Etiquetas y badges informativos',
|
175
|
-
category: 'Feedback',
|
176
|
-
icon: 'label',
|
177
|
-
file: 'badge.example.js'
|
178
|
-
}
|
179
|
-
];
|
9
|
+
// Importar configuración de ejemplos (se genera automáticamente)
|
10
|
+
import { EXAMPLES_CONFIG } from './examples-config.js';
|
180
11
|
|
181
12
|
function App() {
|
182
13
|
return (
|
183
14
|
<Site
|
184
15
|
icon="widgets"
|
185
|
-
title="Ywana Core8"
|
16
|
+
title="Ywana Core8 Documentation"
|
186
17
|
init="welcome"
|
187
18
|
>
|
188
19
|
{/* Página de bienvenida */}
|
@@ -195,7 +26,7 @@ function App() {
|
|
195
26
|
<WelcomePage />
|
196
27
|
</Page>
|
197
28
|
|
198
|
-
{/* Páginas
|
29
|
+
{/* Páginas generadas dinámicamente desde los ejemplos */}
|
199
30
|
{EXAMPLES_CONFIG.map(example => (
|
200
31
|
<Page
|
201
32
|
key={example.id}
|
@@ -0,0 +1,170 @@
|
|
1
|
+
// Este archivo es generado automáticamente por scripts/generate-examples.js
|
2
|
+
// No editar manualmente
|
3
|
+
|
4
|
+
export const EXAMPLES_CONFIG = [
|
5
|
+
{
|
6
|
+
"id": "accordion",
|
7
|
+
"title": "Accordion",
|
8
|
+
"icon": "expand_more",
|
9
|
+
"category": "Layout",
|
10
|
+
"file": "accordion.example.js"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"id": "actions-cell",
|
14
|
+
"title": "Actions Cell",
|
15
|
+
"icon": "widgets",
|
16
|
+
"category": "Utils",
|
17
|
+
"file": "actions-cell.example.js"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"id": "button",
|
21
|
+
"title": "Button",
|
22
|
+
"icon": "smart_button",
|
23
|
+
"category": "Inputs",
|
24
|
+
"file": "button.example.js"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"id": "checkbox",
|
28
|
+
"title": "Checkbox",
|
29
|
+
"icon": "check_box",
|
30
|
+
"category": "Inputs",
|
31
|
+
"file": "checkbox.example.js"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"id": "chip",
|
35
|
+
"title": "Chip",
|
36
|
+
"icon": "label",
|
37
|
+
"category": "Display",
|
38
|
+
"file": "chip.example.js"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"id": "color",
|
42
|
+
"title": "Color",
|
43
|
+
"icon": "palette",
|
44
|
+
"category": "Display",
|
45
|
+
"file": "color.example.js"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"id": "components",
|
49
|
+
"title": "Components",
|
50
|
+
"icon": "widgets",
|
51
|
+
"category": "Components",
|
52
|
+
"file": "components.example.js"
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"id": "form",
|
56
|
+
"title": "Form",
|
57
|
+
"icon": "description",
|
58
|
+
"category": "Forms",
|
59
|
+
"file": "form.example.js"
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"id": "header2",
|
63
|
+
"title": "Header2",
|
64
|
+
"icon": "widgets",
|
65
|
+
"category": "Layout",
|
66
|
+
"file": "header2.example.js"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"id": "icon",
|
70
|
+
"title": "Icon",
|
71
|
+
"icon": "star",
|
72
|
+
"category": "Display",
|
73
|
+
"file": "icon.example.js"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"id": "list",
|
77
|
+
"title": "List",
|
78
|
+
"icon": "list",
|
79
|
+
"category": "Data",
|
80
|
+
"file": "list.example.js"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"id": "progress",
|
84
|
+
"title": "Progress",
|
85
|
+
"icon": "progress_activity",
|
86
|
+
"category": "Display",
|
87
|
+
"file": "progress.example.js"
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"id": "property",
|
91
|
+
"title": "Property",
|
92
|
+
"icon": "widgets",
|
93
|
+
"category": "Utils",
|
94
|
+
"file": "property.example.js"
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"id": "radio",
|
98
|
+
"title": "Radio",
|
99
|
+
"icon": "radio_button_checked",
|
100
|
+
"category": "Inputs",
|
101
|
+
"file": "radio.example.js"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"id": "section",
|
105
|
+
"title": "Section",
|
106
|
+
"icon": "view_module",
|
107
|
+
"category": "Layout",
|
108
|
+
"file": "section.example.js"
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"id": "switch",
|
112
|
+
"title": "Switch",
|
113
|
+
"icon": "toggle_on",
|
114
|
+
"category": "Inputs",
|
115
|
+
"file": "switch.example.js"
|
116
|
+
},
|
117
|
+
{
|
118
|
+
"id": "tab",
|
119
|
+
"title": "Tab",
|
120
|
+
"icon": "tab",
|
121
|
+
"category": "Layout",
|
122
|
+
"file": "tab.example.js"
|
123
|
+
},
|
124
|
+
{
|
125
|
+
"id": "table",
|
126
|
+
"title": "Table",
|
127
|
+
"icon": "table_chart",
|
128
|
+
"category": "Data",
|
129
|
+
"file": "table.example.js"
|
130
|
+
},
|
131
|
+
{
|
132
|
+
"id": "table2",
|
133
|
+
"title": "Table2",
|
134
|
+
"icon": "widgets",
|
135
|
+
"category": "Data",
|
136
|
+
"file": "table2.example.js"
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"id": "textfield2",
|
140
|
+
"title": "Textfield2",
|
141
|
+
"icon": "widgets",
|
142
|
+
"category": "Inputs",
|
143
|
+
"file": "textfield2.example.js"
|
144
|
+
},
|
145
|
+
{
|
146
|
+
"id": "tokenfield",
|
147
|
+
"title": "Tokenfield",
|
148
|
+
"icon": "token",
|
149
|
+
"category": "Inputs",
|
150
|
+
"file": "tokenfield.example.js"
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"id": "tree",
|
154
|
+
"title": "Tree",
|
155
|
+
"icon": "account_tree",
|
156
|
+
"category": "Data",
|
157
|
+
"file": "tree.example.js"
|
158
|
+
}
|
159
|
+
];
|
160
|
+
|
161
|
+
// Función para importar dinámicamente los ejemplos
|
162
|
+
export const importExample = async (fileName) => {
|
163
|
+
try {
|
164
|
+
const module = await import(`ywana-core8/src/html/${fileName}`);
|
165
|
+
return module.default || module;
|
166
|
+
} catch (error) {
|
167
|
+
console.error(`Error importing example ${fileName}:`, error);
|
168
|
+
return null;
|
169
|
+
}
|
170
|
+
};
|
package/doc/src/index.js
CHANGED
package/package.json
CHANGED
package/doc/craco.config.js
DELETED
@@ -1,31 +0,0 @@
|
|
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
|
-
};
|
@@ -1,310 +0,0 @@
|
|
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 };
|