@onpe/ui 1.0.51 → 1.0.53
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 +69 -30
- package/dist/cli.js +69 -30
- package/package.json +1 -1
package/dist/cli.esm.js
CHANGED
|
@@ -5865,22 +5865,22 @@ var COMPONENTS_URL = "https://raw.githubusercontent.com/ricardosv46/onpe-ui/main
|
|
|
5865
5865
|
var ICONS_URL = "https://raw.githubusercontent.com/ricardosv46/onpe-ui/main/src/icons";
|
|
5866
5866
|
function addComponent(componentName) {
|
|
5867
5867
|
return __awaiter(this, void 0, void 0, function () {
|
|
5868
|
-
var isIcon,
|
|
5868
|
+
var isIcon, isModalComponent, componentPath, iconCategory, componentDependencies, availableComponents, availableIcons, componentFile, availableItems, dependencies, _i, dependencies_1, dependency, depError_1, downloadUrl, response, componentCode, personalizedCode, fileName, filePath, componentNamePascal, importPath, iconCategory, dependencies, error_1;
|
|
5869
5869
|
return __generator(this, function (_a) {
|
|
5870
5870
|
switch (_a.label) {
|
|
5871
5871
|
case 0:
|
|
5872
5872
|
isIcon = componentName.toLowerCase().startsWith("icon-");
|
|
5873
|
-
|
|
5873
|
+
isModalComponent = componentName.toLowerCase().startsWith("modal") && componentName !== "modal";
|
|
5874
5874
|
if (isIcon) {
|
|
5875
|
-
|
|
5876
|
-
componentPath = require$$1.join(process.cwd(), "src", "components", "onpe-icons");
|
|
5875
|
+
iconCategory = getIconCategory(componentName);
|
|
5876
|
+
componentPath = require$$1.join(process.cwd(), "src", "components", "onpe-icons-".concat(iconCategory));
|
|
5877
5877
|
}
|
|
5878
|
-
else if (
|
|
5879
|
-
// Los modales van en src/components/onpe-modals/
|
|
5878
|
+
else if (isModalComponent) {
|
|
5879
|
+
// Los modales específicos van en src/components/onpe-modals/
|
|
5880
5880
|
componentPath = require$$1.join(process.cwd(), "src", "components", "onpe-modals");
|
|
5881
5881
|
}
|
|
5882
5882
|
else {
|
|
5883
|
-
// Los componentes básicos van en src/components/onpe-ui/
|
|
5883
|
+
// Los componentes básicos (incluyendo Modal base) van en src/components/onpe-ui/
|
|
5884
5884
|
componentPath = require$$1.join(process.cwd(), "src", "components", "onpe-ui");
|
|
5885
5885
|
}
|
|
5886
5886
|
// Crear directorio si no existe
|
|
@@ -5983,12 +5983,12 @@ function addComponent(componentName) {
|
|
|
5983
5983
|
componentNamePascal = convertToPascalCase(componentName);
|
|
5984
5984
|
importPath = void 0;
|
|
5985
5985
|
if (isIcon) {
|
|
5986
|
-
|
|
5987
|
-
importPath = "../onpe-icons/".concat(componentNamePascal);
|
|
5986
|
+
iconCategory = getIconCategory(componentName);
|
|
5987
|
+
importPath = "../onpe-icons-".concat(iconCategory, "/").concat(componentNamePascal);
|
|
5988
5988
|
}
|
|
5989
5989
|
else {
|
|
5990
5990
|
// Los componentes van en onpe-modals o onpe-ui
|
|
5991
|
-
if (componentName.toLowerCase().
|
|
5991
|
+
if (componentName.toLowerCase().startsWith("modal") && componentName !== "modal") {
|
|
5992
5992
|
importPath = "../onpe-modals/".concat(componentNamePascal);
|
|
5993
5993
|
}
|
|
5994
5994
|
else {
|
|
@@ -6004,9 +6004,10 @@ function addComponent(componentName) {
|
|
|
6004
6004
|
var depPascal = convertToPascalCase(dep);
|
|
6005
6005
|
var depPath;
|
|
6006
6006
|
if (dep.startsWith("icon-")) {
|
|
6007
|
-
|
|
6007
|
+
var iconCategory = getIconCategory(dep);
|
|
6008
|
+
depPath = "../onpe-icons-".concat(iconCategory, "/").concat(depPascal);
|
|
6008
6009
|
}
|
|
6009
|
-
else if (dep.startsWith("modal")) {
|
|
6010
|
+
else if (dep.startsWith("modal") && dep !== "modal") {
|
|
6010
6011
|
depPath = "../onpe-modals/".concat(depPascal);
|
|
6011
6012
|
}
|
|
6012
6013
|
else {
|
|
@@ -6029,6 +6030,36 @@ function addComponent(componentName) {
|
|
|
6029
6030
|
});
|
|
6030
6031
|
});
|
|
6031
6032
|
}
|
|
6033
|
+
function getIconCategory(iconName) {
|
|
6034
|
+
var icon = iconName.toLowerCase();
|
|
6035
|
+
// Iconos de acciones
|
|
6036
|
+
if (["icon-check", "icon-close", "icon-warning", "icon-spinner-desktop", "icon-spinner-mobile", "icon-home"].includes(icon)) {
|
|
6037
|
+
return "actions";
|
|
6038
|
+
}
|
|
6039
|
+
// Iconos de navegadores
|
|
6040
|
+
if ([
|
|
6041
|
+
"icon-chrome",
|
|
6042
|
+
"icon-chrome-color",
|
|
6043
|
+
"icon-edge",
|
|
6044
|
+
"icon-edge-color",
|
|
6045
|
+
"icon-mozilla",
|
|
6046
|
+
"icon-mozilla-color",
|
|
6047
|
+
"icon-safari",
|
|
6048
|
+
"icon-safari-color",
|
|
6049
|
+
].includes(icon)) {
|
|
6050
|
+
return "browsers";
|
|
6051
|
+
}
|
|
6052
|
+
// Iconos de sistemas operativos
|
|
6053
|
+
if (["icon-android", "icon-apple", "icon-window"].includes(icon)) {
|
|
6054
|
+
return "systems";
|
|
6055
|
+
}
|
|
6056
|
+
// Iconos de ONPE
|
|
6057
|
+
if (["icon-elections", "icon-voto-digital"].includes(icon)) {
|
|
6058
|
+
return "onpe";
|
|
6059
|
+
}
|
|
6060
|
+
// Por defecto, acciones
|
|
6061
|
+
return "actions";
|
|
6062
|
+
}
|
|
6032
6063
|
function convertToPascalCase(name) {
|
|
6033
6064
|
// Convertir kebab-case a PascalCase
|
|
6034
6065
|
// Ejemplo: "icon-android" → "IconAndroid"
|
|
@@ -6047,29 +6078,33 @@ function personalizeComponent(code, componentName) {
|
|
|
6047
6078
|
Portal: "../onpe-ui/Portal",
|
|
6048
6079
|
Show: "../onpe-ui/Show",
|
|
6049
6080
|
// Modales
|
|
6050
|
-
Modal: "../onpe-
|
|
6081
|
+
Modal: "../onpe-ui/Modal", // Modal base va en onpe-ui
|
|
6051
6082
|
ModalConfirm: "../onpe-modals/ModalConfirm",
|
|
6052
6083
|
ModalLoading: "../onpe-modals/ModalLoading",
|
|
6053
6084
|
ModalBrowserIncompatible: "../onpe-modals/ModalBrowserIncompatible",
|
|
6054
6085
|
ModalSystemIncompatible: "../onpe-modals/ModalSystemIncompatible",
|
|
6055
6086
|
// Iconos
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6087
|
+
// Iconos organizados por categorías
|
|
6088
|
+
// Actions
|
|
6089
|
+
IconCheck: "../onpe-icons-actions/IconCheck",
|
|
6090
|
+
IconClose: "../onpe-icons-actions/IconClose",
|
|
6091
|
+
IconWarning: "../onpe-icons-actions/IconWarning",
|
|
6092
|
+
IconSpinnerDesktop: "../onpe-icons-actions/IconSpinnerDesktop",
|
|
6093
|
+
IconSpinnerMobile: "../onpe-icons-actions/IconSpinnerMobile",
|
|
6094
|
+
IconHome: "../onpe-icons-actions/IconHome",
|
|
6095
|
+
// Browsers
|
|
6096
|
+
IconChrome: "../onpe-icons-browsers/IconChrome",
|
|
6097
|
+
IconChromeColor: "../onpe-icons-browsers/IconChromeColor",
|
|
6098
|
+
IconEdge: "../onpe-icons-browsers/IconEdge",
|
|
6099
|
+
IconEdgeColor: "../onpe-icons-browsers/IconEdgeColor",
|
|
6100
|
+
IconMozilla: "../onpe-icons-browsers/IconMozilla",
|
|
6101
|
+
IconMozillaColor: "../onpe-icons-browsers/IconMozillaColor",
|
|
6102
|
+
IconSafari: "../onpe-icons-browsers/IconSafari",
|
|
6103
|
+
IconSafariColor: "../onpe-icons-browsers/IconSafariColor",
|
|
6104
|
+
// Systems
|
|
6105
|
+
IconAndroid: "../onpe-icons-systems/IconAndroid",
|
|
6106
|
+
IconApple: "../onpe-icons-systems/IconApple",
|
|
6107
|
+
IconWindow: "../onpe-icons-systems/IconWindow",
|
|
6073
6108
|
};
|
|
6074
6109
|
// Reemplazar las rutas de importación
|
|
6075
6110
|
var personalizedCode = code;
|
|
@@ -6103,6 +6138,10 @@ function personalizeComponent(code, componentName) {
|
|
|
6103
6138
|
personalizedCode = personalizedCode.replace(pattern, "from \"".concat(newPath, "\""));
|
|
6104
6139
|
});
|
|
6105
6140
|
});
|
|
6141
|
+
// Agregar export default si no existe
|
|
6142
|
+
if (!personalizedCode.includes("export default")) {
|
|
6143
|
+
personalizedCode += "\n\nexport default ".concat(componentNamePascal, ";");
|
|
6144
|
+
}
|
|
6106
6145
|
var finalCode = "// Componente ".concat(componentNamePascal, " copiado y ajustado para la nueva estructura\n// Las rutas de importaci\u00F3n han sido actualizadas autom\u00E1ticamente\n\n").concat(personalizedCode);
|
|
6107
6146
|
return finalCode;
|
|
6108
6147
|
}
|
package/dist/cli.js
CHANGED
|
@@ -5865,22 +5865,22 @@ var COMPONENTS_URL = "https://raw.githubusercontent.com/ricardosv46/onpe-ui/main
|
|
|
5865
5865
|
var ICONS_URL = "https://raw.githubusercontent.com/ricardosv46/onpe-ui/main/src/icons";
|
|
5866
5866
|
function addComponent(componentName) {
|
|
5867
5867
|
return __awaiter(this, void 0, void 0, function () {
|
|
5868
|
-
var isIcon,
|
|
5868
|
+
var isIcon, isModalComponent, componentPath, iconCategory, componentDependencies, availableComponents, availableIcons, componentFile, availableItems, dependencies, _i, dependencies_1, dependency, depError_1, downloadUrl, response, componentCode, personalizedCode, fileName, filePath, componentNamePascal, importPath, iconCategory, dependencies, error_1;
|
|
5869
5869
|
return __generator(this, function (_a) {
|
|
5870
5870
|
switch (_a.label) {
|
|
5871
5871
|
case 0:
|
|
5872
5872
|
isIcon = componentName.toLowerCase().startsWith("icon-");
|
|
5873
|
-
|
|
5873
|
+
isModalComponent = componentName.toLowerCase().startsWith("modal") && componentName !== "modal";
|
|
5874
5874
|
if (isIcon) {
|
|
5875
|
-
|
|
5876
|
-
componentPath = require$$1.join(process.cwd(), "src", "components", "onpe-icons");
|
|
5875
|
+
iconCategory = getIconCategory(componentName);
|
|
5876
|
+
componentPath = require$$1.join(process.cwd(), "src", "components", "onpe-icons-".concat(iconCategory));
|
|
5877
5877
|
}
|
|
5878
|
-
else if (
|
|
5879
|
-
// Los modales van en src/components/onpe-modals/
|
|
5878
|
+
else if (isModalComponent) {
|
|
5879
|
+
// Los modales específicos van en src/components/onpe-modals/
|
|
5880
5880
|
componentPath = require$$1.join(process.cwd(), "src", "components", "onpe-modals");
|
|
5881
5881
|
}
|
|
5882
5882
|
else {
|
|
5883
|
-
// Los componentes básicos van en src/components/onpe-ui/
|
|
5883
|
+
// Los componentes básicos (incluyendo Modal base) van en src/components/onpe-ui/
|
|
5884
5884
|
componentPath = require$$1.join(process.cwd(), "src", "components", "onpe-ui");
|
|
5885
5885
|
}
|
|
5886
5886
|
// Crear directorio si no existe
|
|
@@ -5983,12 +5983,12 @@ function addComponent(componentName) {
|
|
|
5983
5983
|
componentNamePascal = convertToPascalCase(componentName);
|
|
5984
5984
|
importPath = void 0;
|
|
5985
5985
|
if (isIcon) {
|
|
5986
|
-
|
|
5987
|
-
importPath = "../onpe-icons/".concat(componentNamePascal);
|
|
5986
|
+
iconCategory = getIconCategory(componentName);
|
|
5987
|
+
importPath = "../onpe-icons-".concat(iconCategory, "/").concat(componentNamePascal);
|
|
5988
5988
|
}
|
|
5989
5989
|
else {
|
|
5990
5990
|
// Los componentes van en onpe-modals o onpe-ui
|
|
5991
|
-
if (componentName.toLowerCase().
|
|
5991
|
+
if (componentName.toLowerCase().startsWith("modal") && componentName !== "modal") {
|
|
5992
5992
|
importPath = "../onpe-modals/".concat(componentNamePascal);
|
|
5993
5993
|
}
|
|
5994
5994
|
else {
|
|
@@ -6004,9 +6004,10 @@ function addComponent(componentName) {
|
|
|
6004
6004
|
var depPascal = convertToPascalCase(dep);
|
|
6005
6005
|
var depPath;
|
|
6006
6006
|
if (dep.startsWith("icon-")) {
|
|
6007
|
-
|
|
6007
|
+
var iconCategory = getIconCategory(dep);
|
|
6008
|
+
depPath = "../onpe-icons-".concat(iconCategory, "/").concat(depPascal);
|
|
6008
6009
|
}
|
|
6009
|
-
else if (dep.startsWith("modal")) {
|
|
6010
|
+
else if (dep.startsWith("modal") && dep !== "modal") {
|
|
6010
6011
|
depPath = "../onpe-modals/".concat(depPascal);
|
|
6011
6012
|
}
|
|
6012
6013
|
else {
|
|
@@ -6029,6 +6030,36 @@ function addComponent(componentName) {
|
|
|
6029
6030
|
});
|
|
6030
6031
|
});
|
|
6031
6032
|
}
|
|
6033
|
+
function getIconCategory(iconName) {
|
|
6034
|
+
var icon = iconName.toLowerCase();
|
|
6035
|
+
// Iconos de acciones
|
|
6036
|
+
if (["icon-check", "icon-close", "icon-warning", "icon-spinner-desktop", "icon-spinner-mobile", "icon-home"].includes(icon)) {
|
|
6037
|
+
return "actions";
|
|
6038
|
+
}
|
|
6039
|
+
// Iconos de navegadores
|
|
6040
|
+
if ([
|
|
6041
|
+
"icon-chrome",
|
|
6042
|
+
"icon-chrome-color",
|
|
6043
|
+
"icon-edge",
|
|
6044
|
+
"icon-edge-color",
|
|
6045
|
+
"icon-mozilla",
|
|
6046
|
+
"icon-mozilla-color",
|
|
6047
|
+
"icon-safari",
|
|
6048
|
+
"icon-safari-color",
|
|
6049
|
+
].includes(icon)) {
|
|
6050
|
+
return "browsers";
|
|
6051
|
+
}
|
|
6052
|
+
// Iconos de sistemas operativos
|
|
6053
|
+
if (["icon-android", "icon-apple", "icon-window"].includes(icon)) {
|
|
6054
|
+
return "systems";
|
|
6055
|
+
}
|
|
6056
|
+
// Iconos de ONPE
|
|
6057
|
+
if (["icon-elections", "icon-voto-digital"].includes(icon)) {
|
|
6058
|
+
return "onpe";
|
|
6059
|
+
}
|
|
6060
|
+
// Por defecto, acciones
|
|
6061
|
+
return "actions";
|
|
6062
|
+
}
|
|
6032
6063
|
function convertToPascalCase(name) {
|
|
6033
6064
|
// Convertir kebab-case a PascalCase
|
|
6034
6065
|
// Ejemplo: "icon-android" → "IconAndroid"
|
|
@@ -6047,29 +6078,33 @@ function personalizeComponent(code, componentName) {
|
|
|
6047
6078
|
Portal: "../onpe-ui/Portal",
|
|
6048
6079
|
Show: "../onpe-ui/Show",
|
|
6049
6080
|
// Modales
|
|
6050
|
-
Modal: "../onpe-
|
|
6081
|
+
Modal: "../onpe-ui/Modal", // Modal base va en onpe-ui
|
|
6051
6082
|
ModalConfirm: "../onpe-modals/ModalConfirm",
|
|
6052
6083
|
ModalLoading: "../onpe-modals/ModalLoading",
|
|
6053
6084
|
ModalBrowserIncompatible: "../onpe-modals/ModalBrowserIncompatible",
|
|
6054
6085
|
ModalSystemIncompatible: "../onpe-modals/ModalSystemIncompatible",
|
|
6055
6086
|
// Iconos
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6087
|
+
// Iconos organizados por categorías
|
|
6088
|
+
// Actions
|
|
6089
|
+
IconCheck: "../onpe-icons-actions/IconCheck",
|
|
6090
|
+
IconClose: "../onpe-icons-actions/IconClose",
|
|
6091
|
+
IconWarning: "../onpe-icons-actions/IconWarning",
|
|
6092
|
+
IconSpinnerDesktop: "../onpe-icons-actions/IconSpinnerDesktop",
|
|
6093
|
+
IconSpinnerMobile: "../onpe-icons-actions/IconSpinnerMobile",
|
|
6094
|
+
IconHome: "../onpe-icons-actions/IconHome",
|
|
6095
|
+
// Browsers
|
|
6096
|
+
IconChrome: "../onpe-icons-browsers/IconChrome",
|
|
6097
|
+
IconChromeColor: "../onpe-icons-browsers/IconChromeColor",
|
|
6098
|
+
IconEdge: "../onpe-icons-browsers/IconEdge",
|
|
6099
|
+
IconEdgeColor: "../onpe-icons-browsers/IconEdgeColor",
|
|
6100
|
+
IconMozilla: "../onpe-icons-browsers/IconMozilla",
|
|
6101
|
+
IconMozillaColor: "../onpe-icons-browsers/IconMozillaColor",
|
|
6102
|
+
IconSafari: "../onpe-icons-browsers/IconSafari",
|
|
6103
|
+
IconSafariColor: "../onpe-icons-browsers/IconSafariColor",
|
|
6104
|
+
// Systems
|
|
6105
|
+
IconAndroid: "../onpe-icons-systems/IconAndroid",
|
|
6106
|
+
IconApple: "../onpe-icons-systems/IconApple",
|
|
6107
|
+
IconWindow: "../onpe-icons-systems/IconWindow",
|
|
6073
6108
|
};
|
|
6074
6109
|
// Reemplazar las rutas de importación
|
|
6075
6110
|
var personalizedCode = code;
|
|
@@ -6103,6 +6138,10 @@ function personalizeComponent(code, componentName) {
|
|
|
6103
6138
|
personalizedCode = personalizedCode.replace(pattern, "from \"".concat(newPath, "\""));
|
|
6104
6139
|
});
|
|
6105
6140
|
});
|
|
6141
|
+
// Agregar export default si no existe
|
|
6142
|
+
if (!personalizedCode.includes("export default")) {
|
|
6143
|
+
personalizedCode += "\n\nexport default ".concat(componentNamePascal, ";");
|
|
6144
|
+
}
|
|
6106
6145
|
var finalCode = "// Componente ".concat(componentNamePascal, " copiado y ajustado para la nueva estructura\n// Las rutas de importaci\u00F3n han sido actualizadas autom\u00E1ticamente\n\n").concat(personalizedCode);
|
|
6107
6146
|
return finalCode;
|
|
6108
6147
|
}
|