@onpe/ui 1.0.52 → 1.1.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/dist/cli.esm.js +236 -67
- package/dist/cli.js +236 -67
- package/dist/commands/createBarrelFiles.d.ts +5 -0
- package/dist/index.css +1 -1
- package/dist/index.esm.css +1 -1
- package/package.json +1 -1
package/dist/cli.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import require$$0 from 'events';
|
|
3
|
-
import require$$1
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
3
|
+
import require$$1 from 'child_process';
|
|
4
|
+
import * as path$d from 'path';
|
|
5
|
+
import path__default from 'path';
|
|
6
6
|
import require$$3 from 'fs';
|
|
7
7
|
import require$$4 from 'process';
|
|
8
8
|
import require$$0$1 from 'constants';
|
|
@@ -1176,8 +1176,8 @@ function suggestSimilar$1(word, candidates) {
|
|
|
1176
1176
|
suggestSimilar$2.suggestSimilar = suggestSimilar$1;
|
|
1177
1177
|
|
|
1178
1178
|
const EventEmitter = require$$0.EventEmitter;
|
|
1179
|
-
const childProcess = require$$1
|
|
1180
|
-
const path$c =
|
|
1179
|
+
const childProcess = require$$1;
|
|
1180
|
+
const path$c = path__default;
|
|
1181
1181
|
const fs$i = require$$3;
|
|
1182
1182
|
const process$1 = require$$4;
|
|
1183
1183
|
|
|
@@ -4525,7 +4525,7 @@ var makeDir$1 = {};
|
|
|
4525
4525
|
|
|
4526
4526
|
var utils$1 = {};
|
|
4527
4527
|
|
|
4528
|
-
const path$b =
|
|
4528
|
+
const path$b = path__default;
|
|
4529
4529
|
|
|
4530
4530
|
// https://github.com/nodejs/node/issues/8987
|
|
4531
4531
|
// https://github.com/libuv/libuv/pull/1088
|
|
@@ -4630,7 +4630,7 @@ var utimes = {
|
|
|
4630
4630
|
};
|
|
4631
4631
|
|
|
4632
4632
|
const fs$c = fs$h;
|
|
4633
|
-
const path$a =
|
|
4633
|
+
const path$a = path__default;
|
|
4634
4634
|
const u$b = universalify$1.fromPromise;
|
|
4635
4635
|
|
|
4636
4636
|
function getStats$1 (src, dest, opts) {
|
|
@@ -4788,7 +4788,7 @@ var stat$4 = {
|
|
|
4788
4788
|
};
|
|
4789
4789
|
|
|
4790
4790
|
const fs$b = fs$h;
|
|
4791
|
-
const path$9 =
|
|
4791
|
+
const path$9 = path__default;
|
|
4792
4792
|
const { mkdirs: mkdirs$1 } = mkdirs$2;
|
|
4793
4793
|
const { pathExists: pathExists$5 } = pathExists_1;
|
|
4794
4794
|
const { utimesMillis } = utimes;
|
|
@@ -4969,7 +4969,7 @@ async function onLink$1 (destStat, src, dest, opts) {
|
|
|
4969
4969
|
var copy_1 = copy$2;
|
|
4970
4970
|
|
|
4971
4971
|
const fs$a = gracefulFs;
|
|
4972
|
-
const path$8 =
|
|
4972
|
+
const path$8 = path__default;
|
|
4973
4973
|
const mkdirsSync$1 = mkdirs$2.mkdirsSync;
|
|
4974
4974
|
const utimesMillisSync = utimes.utimesMillisSync;
|
|
4975
4975
|
const stat$2 = stat$4;
|
|
@@ -5162,7 +5162,7 @@ var remove_1 = {
|
|
|
5162
5162
|
|
|
5163
5163
|
const u$8 = universalify$1.fromPromise;
|
|
5164
5164
|
const fs$8 = fs$h;
|
|
5165
|
-
const path$7 =
|
|
5165
|
+
const path$7 = path__default;
|
|
5166
5166
|
const mkdir$3 = mkdirs$2;
|
|
5167
5167
|
const remove$1 = remove_1;
|
|
5168
5168
|
|
|
@@ -5199,7 +5199,7 @@ var empty = {
|
|
|
5199
5199
|
};
|
|
5200
5200
|
|
|
5201
5201
|
const u$7 = universalify$1.fromPromise;
|
|
5202
|
-
const path$6 =
|
|
5202
|
+
const path$6 = path__default;
|
|
5203
5203
|
const fs$7 = fs$h;
|
|
5204
5204
|
const mkdir$2 = mkdirs$2;
|
|
5205
5205
|
|
|
@@ -5264,7 +5264,7 @@ var file = {
|
|
|
5264
5264
|
};
|
|
5265
5265
|
|
|
5266
5266
|
const u$6 = universalify$1.fromPromise;
|
|
5267
|
-
const path$5 =
|
|
5267
|
+
const path$5 = path__default;
|
|
5268
5268
|
const fs$6 = fs$h;
|
|
5269
5269
|
const mkdir$1 = mkdirs$2;
|
|
5270
5270
|
const { pathExists: pathExists$4 } = pathExists_1;
|
|
@@ -5326,7 +5326,7 @@ var link = {
|
|
|
5326
5326
|
createLinkSync: createLinkSync$1
|
|
5327
5327
|
};
|
|
5328
5328
|
|
|
5329
|
-
const path$4 =
|
|
5329
|
+
const path$4 = path__default;
|
|
5330
5330
|
const fs$5 = fs$h;
|
|
5331
5331
|
const { pathExists: pathExists$3 } = pathExists_1;
|
|
5332
5332
|
|
|
@@ -5460,7 +5460,7 @@ var symlinkType_1 = {
|
|
|
5460
5460
|
};
|
|
5461
5461
|
|
|
5462
5462
|
const u$3 = universalify$1.fromPromise;
|
|
5463
|
-
const path$3 =
|
|
5463
|
+
const path$3 = path__default;
|
|
5464
5464
|
const fs$3 = fs$h;
|
|
5465
5465
|
|
|
5466
5466
|
const { mkdirs, mkdirsSync } = mkdirs$2;
|
|
@@ -5663,7 +5663,7 @@ var jsonfile = {
|
|
|
5663
5663
|
|
|
5664
5664
|
const u$2 = universalify$1.fromPromise;
|
|
5665
5665
|
const fs$2 = fs$h;
|
|
5666
|
-
const path$2 =
|
|
5666
|
+
const path$2 = path__default;
|
|
5667
5667
|
const mkdir = mkdirs$2;
|
|
5668
5668
|
const pathExists$1 = pathExists_1.pathExists;
|
|
5669
5669
|
|
|
@@ -5729,7 +5729,7 @@ jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
|
5729
5729
|
var json = jsonFile;
|
|
5730
5730
|
|
|
5731
5731
|
const fs$1 = fs$h;
|
|
5732
|
-
const path$1 =
|
|
5732
|
+
const path$1 = path__default;
|
|
5733
5733
|
const { copy } = copy$1;
|
|
5734
5734
|
const { remove } = remove_1;
|
|
5735
5735
|
const { mkdirp } = mkdirs$2;
|
|
@@ -5787,7 +5787,7 @@ async function moveAcrossDevice$1 (src, dest, overwrite) {
|
|
|
5787
5787
|
var move_1 = move$1;
|
|
5788
5788
|
|
|
5789
5789
|
const fs = gracefulFs;
|
|
5790
|
-
const path =
|
|
5790
|
+
const path = path__default;
|
|
5791
5791
|
const copySync = copy$1.copySync;
|
|
5792
5792
|
const removeSync = remove_1.removeSync;
|
|
5793
5793
|
const mkdirpSync = mkdirs$2.mkdirpSync;
|
|
@@ -5861,27 +5861,107 @@ var lib = {
|
|
|
5861
5861
|
...remove_1
|
|
5862
5862
|
};
|
|
5863
5863
|
|
|
5864
|
+
/**
|
|
5865
|
+
* Crea archivos de barril (barrel exports) para simplificar las importaciones
|
|
5866
|
+
*/
|
|
5867
|
+
function createBarrelFiles() {
|
|
5868
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5869
|
+
var componentsDir, mainIndexContent, uiIndexContent, modalsIndexContent, iconsIndexContent, actionsIndexContent, browsersIndexContent, systemsIndexContent, onpeIndexContent;
|
|
5870
|
+
return __generator(this, function (_a) {
|
|
5871
|
+
switch (_a.label) {
|
|
5872
|
+
case 0:
|
|
5873
|
+
componentsDir = path$d.join(process.cwd(), "src", "components", "onpe");
|
|
5874
|
+
// Crear estructura de carpetas si no existe
|
|
5875
|
+
return [4 /*yield*/, lib.ensureDir(path$d.join(componentsDir, "ui"))];
|
|
5876
|
+
case 1:
|
|
5877
|
+
// Crear estructura de carpetas si no existe
|
|
5878
|
+
_a.sent();
|
|
5879
|
+
return [4 /*yield*/, lib.ensureDir(path$d.join(componentsDir, "modals"))];
|
|
5880
|
+
case 2:
|
|
5881
|
+
_a.sent();
|
|
5882
|
+
return [4 /*yield*/, lib.ensureDir(path$d.join(componentsDir, "icons", "actions"))];
|
|
5883
|
+
case 3:
|
|
5884
|
+
_a.sent();
|
|
5885
|
+
return [4 /*yield*/, lib.ensureDir(path$d.join(componentsDir, "icons", "browsers"))];
|
|
5886
|
+
case 4:
|
|
5887
|
+
_a.sent();
|
|
5888
|
+
return [4 /*yield*/, lib.ensureDir(path$d.join(componentsDir, "icons", "systems"))];
|
|
5889
|
+
case 5:
|
|
5890
|
+
_a.sent();
|
|
5891
|
+
return [4 /*yield*/, lib.ensureDir(path$d.join(componentsDir, "icons", "onpe"))];
|
|
5892
|
+
case 6:
|
|
5893
|
+
_a.sent();
|
|
5894
|
+
mainIndexContent = "// ONPE UI - Punto de entrada principal\nexport * from './ui';\nexport * from './modals';\nexport * from './icons';\n\n// Re-exportar todo para importaciones f\u00E1ciles\nexport * from './ui/index';\nexport * from './modals/index';\nexport * from './icons/index';\n";
|
|
5895
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(componentsDir, "index.ts"), mainIndexContent)];
|
|
5896
|
+
case 7:
|
|
5897
|
+
_a.sent();
|
|
5898
|
+
uiIndexContent = "// Componentes UI b\u00E1sicos\nexport * from './Button';\nexport * from './Modal';\nexport * from './Overlay';\nexport * from './Portal';\nexport * from './Show';\n";
|
|
5899
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(componentsDir, "ui", "index.ts"), uiIndexContent)];
|
|
5900
|
+
case 8:
|
|
5901
|
+
_a.sent();
|
|
5902
|
+
modalsIndexContent = "// Modales especializados\nexport * from './ModalConfirm';\nexport * from './ModalLoading';\nexport * from './ModalBrowserIncompatible';\nexport * from './ModalSystemIncompatible';\n";
|
|
5903
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(componentsDir, "modals", "index.ts"), modalsIndexContent)];
|
|
5904
|
+
case 9:
|
|
5905
|
+
_a.sent();
|
|
5906
|
+
iconsIndexContent = "// Todos los iconos organizados por categor\u00EDas\nexport * from './actions';\nexport * from './browsers';\nexport * from './systems';\nexport * from './onpe';\n";
|
|
5907
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(componentsDir, "icons", "index.ts"), iconsIndexContent)];
|
|
5908
|
+
case 10:
|
|
5909
|
+
_a.sent();
|
|
5910
|
+
actionsIndexContent = "// Iconos de Acciones\nexport * from './IconCheck';\nexport * from './IconClose';\nexport * from './IconWarning';\nexport * from './IconSpinnerDesktop';\nexport * from './IconSpinnerMobile';\nexport * from './IconHome';\n";
|
|
5911
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(componentsDir, "icons", "actions", "index.ts"), actionsIndexContent)];
|
|
5912
|
+
case 11:
|
|
5913
|
+
_a.sent();
|
|
5914
|
+
browsersIndexContent = "// Iconos de Navegadores\nexport * from './IconChrome';\nexport * from './IconChromeColor';\nexport * from './IconEdge';\nexport * from './IconEdgeColor';\nexport * from './IconMozilla';\nexport * from './IconMozillaColor';\nexport * from './IconSafari';\nexport * from './IconSafariColor';\n";
|
|
5915
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(componentsDir, "icons", "browsers", "index.ts"), browsersIndexContent)];
|
|
5916
|
+
case 12:
|
|
5917
|
+
_a.sent();
|
|
5918
|
+
systemsIndexContent = "// Iconos de Sistemas Operativos\nexport * from './IconAndroid';\nexport * from './IconApple';\nexport * from './IconWindow';\n";
|
|
5919
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(componentsDir, "icons", "systems", "index.ts"), systemsIndexContent)];
|
|
5920
|
+
case 13:
|
|
5921
|
+
_a.sent();
|
|
5922
|
+
onpeIndexContent = "// Iconos de ONPE\nexport * from './IconVotoDigital';\nexport * from './IconElectionsGeneral';\nexport * from './IconElections';\n";
|
|
5923
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(componentsDir, "icons", "onpe", "index.ts"), onpeIndexContent)];
|
|
5924
|
+
case 14:
|
|
5925
|
+
_a.sent();
|
|
5926
|
+
console.log("✅ Archivos de barril creados exitosamente!");
|
|
5927
|
+
console.log("📁 Estructura creada:");
|
|
5928
|
+
console.log(" onpe/");
|
|
5929
|
+
console.log(" ├── index.ts (principal)");
|
|
5930
|
+
console.log(" ├── ui/index.ts");
|
|
5931
|
+
console.log(" ├── modals/index.ts");
|
|
5932
|
+
console.log(" └── icons/");
|
|
5933
|
+
console.log(" ├── index.ts");
|
|
5934
|
+
console.log(" ├── actions/index.ts");
|
|
5935
|
+
console.log(" ├── browsers/index.ts");
|
|
5936
|
+
console.log(" ├── systems/index.ts");
|
|
5937
|
+
console.log(" └── onpe/index.ts");
|
|
5938
|
+
return [2 /*return*/];
|
|
5939
|
+
}
|
|
5940
|
+
});
|
|
5941
|
+
});
|
|
5942
|
+
}
|
|
5943
|
+
|
|
5864
5944
|
var COMPONENTS_URL = "https://raw.githubusercontent.com/ricardosv46/onpe-ui/main/src/components";
|
|
5865
5945
|
var ICONS_URL = "https://raw.githubusercontent.com/ricardosv46/onpe-ui/main/src/icons";
|
|
5866
5946
|
function addComponent(componentName) {
|
|
5867
5947
|
return __awaiter(this, void 0, void 0, function () {
|
|
5868
|
-
var isIcon, isModalComponent, componentPath, componentDependencies, availableComponents, availableIcons, componentFile, availableItems, dependencies, _i, dependencies_1, dependency, depError_1, downloadUrl, response, componentCode, personalizedCode, fileName, filePath, componentNamePascal,
|
|
5948
|
+
var isIcon, isModalComponent, componentPath, iconCategory, componentDependencies, availableComponents, availableIcons, componentFile, availableItems, dependencies, _i, dependencies_1, dependency, depError_1, downloadUrl, response, componentCode, personalizedCode, fileName, filePath, barrelError_1, componentNamePascal, iconCategory, dependencies, error_1;
|
|
5869
5949
|
return __generator(this, function (_a) {
|
|
5870
5950
|
switch (_a.label) {
|
|
5871
5951
|
case 0:
|
|
5872
5952
|
isIcon = componentName.toLowerCase().startsWith("icon-");
|
|
5873
5953
|
isModalComponent = componentName.toLowerCase().startsWith("modal") && componentName !== "modal";
|
|
5874
5954
|
if (isIcon) {
|
|
5875
|
-
|
|
5876
|
-
componentPath =
|
|
5955
|
+
iconCategory = getIconCategory(componentName);
|
|
5956
|
+
componentPath = path$d.join(process.cwd(), "src", "components", "onpe", "icons", iconCategory);
|
|
5877
5957
|
}
|
|
5878
5958
|
else if (isModalComponent) {
|
|
5879
|
-
// Los modales específicos van en src/components/onpe
|
|
5880
|
-
componentPath =
|
|
5959
|
+
// Los modales específicos van en src/components/onpe/modals/
|
|
5960
|
+
componentPath = path$d.join(process.cwd(), "src", "components", "onpe", "modals");
|
|
5881
5961
|
}
|
|
5882
5962
|
else {
|
|
5883
|
-
// Los componentes básicos (incluyendo Modal base) van en src/components/onpe
|
|
5884
|
-
componentPath =
|
|
5963
|
+
// Los componentes básicos (incluyendo Modal base) van en src/components/onpe/ui/
|
|
5964
|
+
componentPath = path$d.join(process.cwd(), "src", "components", "onpe", "ui");
|
|
5885
5965
|
}
|
|
5886
5966
|
// Crear directorio si no existe
|
|
5887
5967
|
return [4 /*yield*/, lib.ensureDir(componentPath)];
|
|
@@ -5936,7 +6016,7 @@ function addComponent(componentName) {
|
|
|
5936
6016
|
}
|
|
5937
6017
|
_a.label = 2;
|
|
5938
6018
|
case 2:
|
|
5939
|
-
_a.trys.push([2,
|
|
6019
|
+
_a.trys.push([2, 16, , 17]);
|
|
5940
6020
|
if (!(!isIcon && componentDependencies[componentName.toLowerCase()])) return [3 /*break*/, 8];
|
|
5941
6021
|
dependencies = componentDependencies[componentName.toLowerCase()];
|
|
5942
6022
|
console.log("\uD83D\uDD17 Instalando dependencias: ".concat(dependencies.join(", ")));
|
|
@@ -5972,30 +6052,56 @@ function addComponent(componentName) {
|
|
|
5972
6052
|
componentCode = _a.sent();
|
|
5973
6053
|
personalizedCode = personalizeComponent(componentCode, componentName);
|
|
5974
6054
|
fileName = "".concat(convertToPascalCase(componentName), ".tsx");
|
|
5975
|
-
filePath =
|
|
6055
|
+
filePath = path$d.join(componentPath, fileName);
|
|
5976
6056
|
return [4 /*yield*/, lib.writeFile(filePath, personalizedCode)];
|
|
5977
6057
|
case 11:
|
|
5978
6058
|
_a.sent();
|
|
5979
6059
|
console.log("\uD83D\uDCC1 ".concat(isIcon ? "Icono" : "Componente", " guardado en: ").concat(filePath));
|
|
6060
|
+
_a.label = 12;
|
|
6061
|
+
case 12:
|
|
6062
|
+
_a.trys.push([12, 14, , 15]);
|
|
6063
|
+
return [4 /*yield*/, createBarrelFiles()];
|
|
6064
|
+
case 13:
|
|
6065
|
+
_a.sent();
|
|
6066
|
+
console.log("🔄 Archivos de barril actualizados");
|
|
6067
|
+
return [3 /*break*/, 15];
|
|
6068
|
+
case 14:
|
|
6069
|
+
barrelError_1 = _a.sent();
|
|
6070
|
+
console.warn("\u26A0\uFE0F No se pudieron actualizar los archivos de barril: ".concat(barrelError_1.message));
|
|
6071
|
+
return [3 /*break*/, 15];
|
|
6072
|
+
case 15:
|
|
5980
6073
|
// Mostrar instrucciones
|
|
5981
6074
|
console.log("\n📋 Próximos pasos:");
|
|
5982
6075
|
console.log("1. Importa el ".concat(isIcon ? "icono" : "componente", ":"));
|
|
5983
6076
|
componentNamePascal = convertToPascalCase(componentName);
|
|
5984
|
-
|
|
6077
|
+
// Mostrar opciones de importación
|
|
5985
6078
|
if (isIcon) {
|
|
5986
|
-
|
|
5987
|
-
|
|
6079
|
+
iconCategory = getIconCategory(componentName);
|
|
6080
|
+
console.log(" // Opci\u00F3n 1: Importaci\u00F3n directa");
|
|
6081
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe/icons/").concat(iconCategory, "/").concat(componentNamePascal, "';"));
|
|
6082
|
+
console.log(" // Opci\u00F3n 2: Importaci\u00F3n con barril (recomendado)");
|
|
6083
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe/icons/").concat(iconCategory, "';"));
|
|
6084
|
+
console.log(" // Opci\u00F3n 3: Importaci\u00F3n desde ra\u00EDz");
|
|
6085
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe';"));
|
|
5988
6086
|
}
|
|
5989
6087
|
else {
|
|
5990
|
-
// Los componentes van en onpe-modals o onpe-ui
|
|
5991
6088
|
if (componentName.toLowerCase().startsWith("modal") && componentName !== "modal") {
|
|
5992
|
-
|
|
6089
|
+
console.log(" // Opci\u00F3n 1: Importaci\u00F3n directa");
|
|
6090
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe/modals/").concat(componentNamePascal, "';"));
|
|
6091
|
+
console.log(" // Opci\u00F3n 2: Importaci\u00F3n con barril (recomendado)");
|
|
6092
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe/modals';"));
|
|
6093
|
+
console.log(" // Opci\u00F3n 3: Importaci\u00F3n desde ra\u00EDz");
|
|
6094
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe';"));
|
|
5993
6095
|
}
|
|
5994
6096
|
else {
|
|
5995
|
-
|
|
6097
|
+
console.log(" // Opci\u00F3n 1: Importaci\u00F3n directa");
|
|
6098
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe/ui/").concat(componentNamePascal, "';"));
|
|
6099
|
+
console.log(" // Opci\u00F3n 2: Importaci\u00F3n con barril (recomendado)");
|
|
6100
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe/ui';"));
|
|
6101
|
+
console.log(" // Opci\u00F3n 3: Importaci\u00F3n desde ra\u00EDz");
|
|
6102
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe';"));
|
|
5996
6103
|
}
|
|
5997
6104
|
}
|
|
5998
|
-
console.log(" import { ".concat(componentNamePascal, " } from '").concat(importPath, "'"));
|
|
5999
6105
|
// Mostrar dependencias si las hay
|
|
6000
6106
|
if (!isIcon && componentDependencies[componentName.toLowerCase()]) {
|
|
6001
6107
|
dependencies = componentDependencies[componentName.toLowerCase()];
|
|
@@ -6004,7 +6110,8 @@ function addComponent(componentName) {
|
|
|
6004
6110
|
var depPascal = convertToPascalCase(dep);
|
|
6005
6111
|
var depPath;
|
|
6006
6112
|
if (dep.startsWith("icon-")) {
|
|
6007
|
-
|
|
6113
|
+
var iconCategory = getIconCategory(dep);
|
|
6114
|
+
depPath = "../onpe-icons-".concat(iconCategory, "/").concat(depPascal);
|
|
6008
6115
|
}
|
|
6009
6116
|
else if (dep.startsWith("modal") && dep !== "modal") {
|
|
6010
6117
|
depPath = "../onpe-modals/".concat(depPascal);
|
|
@@ -6020,15 +6127,45 @@ function addComponent(componentName) {
|
|
|
6020
6127
|
console.log("2. Usa el ".concat(isIcon ? "icono" : "componente", ":"));
|
|
6021
6128
|
}
|
|
6022
6129
|
console.log(" <".concat(componentNamePascal, " />"));
|
|
6023
|
-
return [3 /*break*/,
|
|
6024
|
-
case
|
|
6130
|
+
return [3 /*break*/, 17];
|
|
6131
|
+
case 16:
|
|
6025
6132
|
error_1 = _a.sent();
|
|
6026
6133
|
throw new Error("Error al instalar el ".concat(isIcon ? "icono" : "componente", ": ").concat(error_1.message));
|
|
6027
|
-
case
|
|
6134
|
+
case 17: return [2 /*return*/];
|
|
6028
6135
|
}
|
|
6029
6136
|
});
|
|
6030
6137
|
});
|
|
6031
6138
|
}
|
|
6139
|
+
function getIconCategory(iconName) {
|
|
6140
|
+
var icon = iconName.toLowerCase();
|
|
6141
|
+
// Iconos de acciones
|
|
6142
|
+
if (["icon-check", "icon-close", "icon-warning", "icon-spinner-desktop", "icon-spinner-mobile", "icon-home"].includes(icon)) {
|
|
6143
|
+
return "actions";
|
|
6144
|
+
}
|
|
6145
|
+
// Iconos de navegadores
|
|
6146
|
+
if ([
|
|
6147
|
+
"icon-chrome",
|
|
6148
|
+
"icon-chrome-color",
|
|
6149
|
+
"icon-edge",
|
|
6150
|
+
"icon-edge-color",
|
|
6151
|
+
"icon-mozilla",
|
|
6152
|
+
"icon-mozilla-color",
|
|
6153
|
+
"icon-safari",
|
|
6154
|
+
"icon-safari-color",
|
|
6155
|
+
].includes(icon)) {
|
|
6156
|
+
return "browsers";
|
|
6157
|
+
}
|
|
6158
|
+
// Iconos de sistemas operativos
|
|
6159
|
+
if (["icon-android", "icon-apple", "icon-window"].includes(icon)) {
|
|
6160
|
+
return "systems";
|
|
6161
|
+
}
|
|
6162
|
+
// Iconos de ONPE
|
|
6163
|
+
if (["icon-elections", "icon-voto-digital"].includes(icon)) {
|
|
6164
|
+
return "onpe";
|
|
6165
|
+
}
|
|
6166
|
+
// Por defecto, acciones
|
|
6167
|
+
return "actions";
|
|
6168
|
+
}
|
|
6032
6169
|
function convertToPascalCase(name) {
|
|
6033
6170
|
// Convertir kebab-case a PascalCase
|
|
6034
6171
|
// Ejemplo: "icon-android" → "IconAndroid"
|
|
@@ -6039,37 +6176,44 @@ function convertToPascalCase(name) {
|
|
|
6039
6176
|
}
|
|
6040
6177
|
function personalizeComponent(code, componentName) {
|
|
6041
6178
|
var componentNamePascal = convertToPascalCase(componentName);
|
|
6042
|
-
// Mapeo de componentes y sus ubicaciones reales
|
|
6179
|
+
// Mapeo de componentes y sus ubicaciones reales - NUEVA ESTRUCTURA
|
|
6043
6180
|
var componentPaths = {
|
|
6044
|
-
// Componentes básicos
|
|
6045
|
-
Button: "../onpe
|
|
6046
|
-
Overlay: "../onpe
|
|
6047
|
-
Portal: "../onpe
|
|
6048
|
-
Show: "../onpe
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
ModalConfirm: "../onpe
|
|
6052
|
-
ModalLoading: "../onpe
|
|
6053
|
-
ModalBrowserIncompatible: "../onpe
|
|
6054
|
-
ModalSystemIncompatible: "../onpe
|
|
6055
|
-
// Iconos
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6181
|
+
// Componentes básicos - van en onpe/ui/
|
|
6182
|
+
Button: "../onpe/ui/Button",
|
|
6183
|
+
Overlay: "../onpe/ui/Overlay",
|
|
6184
|
+
Portal: "../onpe/ui/Portal",
|
|
6185
|
+
Show: "../onpe/ui/Show",
|
|
6186
|
+
Modal: "../onpe/ui/Modal",
|
|
6187
|
+
// Modales especializados - van en onpe/modals/
|
|
6188
|
+
ModalConfirm: "../onpe/modals/ModalConfirm",
|
|
6189
|
+
ModalLoading: "../onpe/modals/ModalLoading",
|
|
6190
|
+
ModalBrowserIncompatible: "../onpe/modals/ModalBrowserIncompatible",
|
|
6191
|
+
ModalSystemIncompatible: "../onpe/modals/ModalSystemIncompatible",
|
|
6192
|
+
// Iconos - organizados por categorías en onpe/icons/
|
|
6193
|
+
// Actions
|
|
6194
|
+
IconCheck: "../onpe/icons/actions/IconCheck",
|
|
6195
|
+
IconClose: "../onpe/icons/actions/IconClose",
|
|
6196
|
+
IconWarning: "../onpe/icons/actions/IconWarning",
|
|
6197
|
+
IconSpinnerDesktop: "../onpe/icons/actions/IconSpinnerDesktop",
|
|
6198
|
+
IconSpinnerMobile: "../onpe/icons/actions/IconSpinnerMobile",
|
|
6199
|
+
IconHome: "../onpe/icons/actions/IconHome",
|
|
6200
|
+
// Browsers
|
|
6201
|
+
IconChrome: "../onpe/icons/browsers/IconChrome",
|
|
6202
|
+
IconChromeColor: "../onpe/icons/browsers/IconChromeColor",
|
|
6203
|
+
IconEdge: "../onpe/icons/browsers/IconEdge",
|
|
6204
|
+
IconEdgeColor: "../onpe/icons/browsers/IconEdgeColor",
|
|
6205
|
+
IconMozilla: "../onpe/icons/browsers/IconMozilla",
|
|
6206
|
+
IconMozillaColor: "../onpe/icons/browsers/IconMozillaColor",
|
|
6207
|
+
IconSafari: "../onpe/icons/browsers/IconSafari",
|
|
6208
|
+
IconSafariColor: "../onpe/icons/browsers/IconSafariColor",
|
|
6209
|
+
// Systems
|
|
6210
|
+
IconAndroid: "../onpe/icons/systems/IconAndroid",
|
|
6211
|
+
IconApple: "../onpe/icons/systems/IconApple",
|
|
6212
|
+
IconWindow: "../onpe/icons/systems/IconWindow",
|
|
6213
|
+
// ONPE
|
|
6214
|
+
IconVotoDigital: "../onpe/icons/onpe/IconVotoDigital",
|
|
6215
|
+
IconElectionsGeneral: "../onpe/icons/onpe/IconElectionsGeneral",
|
|
6216
|
+
IconElections: "../onpe/icons/onpe/IconElections",
|
|
6073
6217
|
};
|
|
6074
6218
|
// Reemplazar las rutas de importación
|
|
6075
6219
|
var personalizedCode = code;
|
|
@@ -6137,5 +6281,30 @@ program
|
|
|
6137
6281
|
}
|
|
6138
6282
|
});
|
|
6139
6283
|
}); });
|
|
6284
|
+
program
|
|
6285
|
+
.command("init")
|
|
6286
|
+
.description("Crear la estructura inicial de carpetas y archivos de barril")
|
|
6287
|
+
.action(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
6288
|
+
var error_2;
|
|
6289
|
+
return __generator(this, function (_a) {
|
|
6290
|
+
switch (_a.label) {
|
|
6291
|
+
case 0:
|
|
6292
|
+
_a.trys.push([0, 2, , 3]);
|
|
6293
|
+
console.log("\uD83D\uDE80 Creando estructura inicial de ONPE UI...");
|
|
6294
|
+
return [4 /*yield*/, createBarrelFiles()];
|
|
6295
|
+
case 1:
|
|
6296
|
+
_a.sent();
|
|
6297
|
+
console.log("\u2705 Estructura inicial creada exitosamente!");
|
|
6298
|
+
console.log("\uD83D\uDCC1 Estructura creada en: src/components/onpe/");
|
|
6299
|
+
return [3 /*break*/, 3];
|
|
6300
|
+
case 2:
|
|
6301
|
+
error_2 = _a.sent();
|
|
6302
|
+
console.error("\u274C Error: ".concat(error_2));
|
|
6303
|
+
process.exit(1);
|
|
6304
|
+
return [3 /*break*/, 3];
|
|
6305
|
+
case 3: return [2 /*return*/];
|
|
6306
|
+
}
|
|
6307
|
+
});
|
|
6308
|
+
}); });
|
|
6140
6309
|
program.parse();
|
|
6141
6310
|
//# sourceMappingURL=cli.esm.js.map
|