react-pdf-levelup 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/fn/aggAlias.js +21 -0
- package/fn/moveComponents.js +129 -0
- package/fn/postinstall.js +66 -0
- package/fn/upVersion.js +12 -0
- package/fn/updateTsconfig.js +10 -0
- package/next.config.mjs +6 -0
- package/package.json +39 -0
- package/public/bg-login.jpg +0 -0
- package/public/codigo_guardado.js +1 -0
- package/public/css/style.css +751 -0
- package/public/dboard/logo.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/fonts/TimesNewerRoman-Bold.otf +0 -0
- package/public/fonts/TimesNewerRoman-BoldItalic.otf +0 -0
- package/public/fonts/TimesNewerRoman-Italic.otf +0 -0
- package/public/fonts/TimesNewerRoman-Regular.otf +0 -0
- package/public/header-pdf.jpg +0 -0
- package/public/home/bgHome.jpg +0 -0
- package/public/home/bgHome2.jpg +0 -0
- package/public/home/download.jpg +0 -0
- package/public/home/undraw_elements_re_25t9.svg +1 -0
- package/public/home/undraw_project_completed_re_jr7u.svg +1 -0
- package/public/home/undraw_shared_goals_re_jvqd.svg +1 -0
- package/public/home/undraw_spread_love_re_v3cl.svg +1 -0
- package/public/home/undraw_target_re_fi8j.svg +1 -0
- package/public/home/undraw_visionary_technology_re_jfp7.svg +1 -0
- package/public/logo.png +0 -0
- package/public/marca/logo.svg +1 -0
- package/src/components/PDF/components/DocumentoTemplate.tsx +140 -0
- package/src/components/PDF/components/PDFContent.tsx +192 -0
- package/src/components/PDF/core/Etiquetas.tsx +152 -0
- package/src/components/PDF/core/Grid.tsx +101 -0
- package/src/components/PDF/core/Img.tsx +22 -0
- package/src/components/PDF/core/LayoutPDF.tsx +186 -0
- package/src/components/PDF/core/Listas.tsx +10 -0
- package/src/components/PDF/core/MakePDF.tsx +50 -0
- package/src/components/PDF/core/PageElements.tsx +50 -0
- package/src/components/PDF/core/Position.tsx +33 -0
- package/src/components/PDF/core/Tablet.tsx +121 -0
- package/src/components/PDF/core/index.tsx +56 -0
- package/src/components/PDF/lib/pdfParser.ts +620 -0
- package/src/components/PDF/services/apiService.ts +17 -0
- package/src/components/PDF/templates/AllTemplate.tsx +134 -0
- package/src/components/PDF/templates/BusinessCardTemplate.tsx +139 -0
- package/src/components/PDF/templates/CertificateTemplate.tsx +31 -0
- package/src/components/PDF/templates/HeaderFooterTemplate.tsx +61 -0
- package/src/components/PDF/templates/InvoiceTemplate.tsx +53 -0
- package/src/components/PDF/templates/ProposalTemplate.tsx +246 -0
- package/src/components/PDF/templates/ReportTemplate.tsx +57 -0
- package/src/components/PDF/templates/ResumeTemplate.tsx +170 -0
- package/src/components/PDF/templates/TablasTemplate.tsx +307 -0
- package/src/components/PDF/templates/index.ts +9 -0
- package/src/components/PDF/view/ColorPicker.tsx +147 -0
- package/src/components/PDF/view/Header.tsx +102 -0
- package/src/components/PDF/view/HomePDF.tsx +177 -0
- package/src/components/PDF/view/SettingsPanel.tsx +703 -0
- package/src/pages/AllTemplate.tsx +53 -0
- package/src/pages/Documento2.tsx +45 -0
- package/src/pages/_app.tsx +6 -0
- package/src/pages/_document.tsx +13 -0
- package/src/pages/api/generatePDF.ts +74 -0
- package/src/pages/api/hello.ts +13 -0
- package/src/pages/api/readFile.ts +18 -0
- package/src/pages/api/readTemplateFile.ts +26 -0
- package/src/pages/api/save.ts +22 -0
- package/src/pages/api/saveFile.ts +20 -0
- package/src/pages/index.tsx +13 -0
- package/src/pages/template/[template].tsx +250 -0
- package/tsconfig.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
First, run the development server:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run dev
|
|
9
|
+
# or
|
|
10
|
+
yarn dev
|
|
11
|
+
# or
|
|
12
|
+
pnpm dev
|
|
13
|
+
# or
|
|
14
|
+
bun dev
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
18
|
+
|
|
19
|
+
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
|
|
20
|
+
|
|
21
|
+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
|
|
22
|
+
|
|
23
|
+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
|
24
|
+
|
|
25
|
+
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
|
26
|
+
|
|
27
|
+
## Learn More
|
|
28
|
+
|
|
29
|
+
To learn more about Next.js, take a look at the following resources:
|
|
30
|
+
|
|
31
|
+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
32
|
+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
33
|
+
|
|
34
|
+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
|
35
|
+
|
|
36
|
+
## Deploy on Vercel
|
|
37
|
+
|
|
38
|
+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
39
|
+
|
|
40
|
+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
package/fn/aggAlias.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
|
|
3
|
+
const updateTsconfigPaths = () => {
|
|
4
|
+
const tsconfigPath = './tsconfig.json';
|
|
5
|
+
const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, 'utf8'));
|
|
6
|
+
|
|
7
|
+
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
8
|
+
tsconfig.compilerOptions.paths = {
|
|
9
|
+
"@components/*": ["./src/components/*"],
|
|
10
|
+
"@fn/*": ["./src/functions/*"],
|
|
11
|
+
"@env": ["./env.ts"],
|
|
12
|
+
"@public/*": ["./public/*"],
|
|
13
|
+
"@nano": ["./src/components/nano/index.tsx"],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2), 'utf8');
|
|
17
|
+
|
|
18
|
+
console.log('tsconfig.json actualizado correctamente');
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
updateTsconfigPaths();
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const readline = require('readline');
|
|
4
|
+
|
|
5
|
+
// Función para copiar recursivamente una carpeta
|
|
6
|
+
function copyFolderSync(from, to) {
|
|
7
|
+
fs.mkdirSync(to, { recursive: true });
|
|
8
|
+
fs.readdirSync(from).forEach(element => {
|
|
9
|
+
const fromPath = path.join(from, element);
|
|
10
|
+
const toPath = path.join(to, element);
|
|
11
|
+
if (fs.lstatSync(fromPath).isFile()) {
|
|
12
|
+
if (!fs.existsSync(toPath)) {
|
|
13
|
+
fs.copyFileSync(fromPath, toPath);
|
|
14
|
+
}
|
|
15
|
+
} else {
|
|
16
|
+
copyFolderSync(fromPath, toPath);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function transformPath(pathString) {
|
|
22
|
+
const transformedSegments = pathString.split('/');
|
|
23
|
+
const pathJoin = path.resolve(__dirname, "..", "src", "components", ...transformedSegments);
|
|
24
|
+
return pathJoin;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Rutas preestablecidas
|
|
28
|
+
const predefinedPaths = {
|
|
29
|
+
alanaLayout: transformPath('layout/ecommerce/alana'),
|
|
30
|
+
algolia: transformPath('algolia'),
|
|
31
|
+
headerToolTip: transformPath('layout/tooltip'),
|
|
32
|
+
btnLoki: transformPath('btns/hamburguesa/btnLoki'),
|
|
33
|
+
btnNormalBasic: transformPath('btns/basic/btnNormalBasic'),
|
|
34
|
+
navBasic: transformPath('layout/nav'),
|
|
35
|
+
|
|
36
|
+
sliderBackground: transformPath('swiper/sliderBackgroud'),
|
|
37
|
+
swiperStructure: transformPath('swiper/estructura'),
|
|
38
|
+
sectionCategoriaSlider: transformPath('sections/ecomerce/categoriaSlider'),
|
|
39
|
+
|
|
40
|
+
formLoki: transformPath('form/formLoki'),
|
|
41
|
+
btnText: transformPath('btns/basic/btnText'),
|
|
42
|
+
btnRowCircle: transformPath('btns/animate/btnRowCircle'),
|
|
43
|
+
|
|
44
|
+
viewLoginLoki: transformPath('view/authAlana'),
|
|
45
|
+
|
|
46
|
+
nano: transformPath('nano'),
|
|
47
|
+
|
|
48
|
+
tabletExample: transformPath('view/example/agTablet'),
|
|
49
|
+
tabletAg: transformPath('tablet'),
|
|
50
|
+
|
|
51
|
+
mentorBasicImgcomponent: transformPath('mentor/basico/bentorgrid'),
|
|
52
|
+
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Dependencias de cada opción
|
|
56
|
+
const dependencies = {
|
|
57
|
+
/* nano */
|
|
58
|
+
nano: [""],
|
|
59
|
+
/* layout */
|
|
60
|
+
alanaLayout: ['algolia', 'headerToolTip', 'btnLoki', "btnNormalBasic", "navBasic"],
|
|
61
|
+
sliderBackground: ['btnNormalBasic', "swiperStructure"],
|
|
62
|
+
formLoki: ["btnText", "btnRowCircle"],
|
|
63
|
+
/* view */
|
|
64
|
+
viewLoginLoki: ["formLoki", "swiperStructure", "btnText"],
|
|
65
|
+
tabletExample:["tabletAg"],
|
|
66
|
+
|
|
67
|
+
mentorBasicImgcomponent: [''],
|
|
68
|
+
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// Opciones disponibles (excluyendo dependencias)
|
|
72
|
+
const availableOptions = Object.keys(predefinedPaths).filter(key => !Object.values(dependencies).flat().includes(key));
|
|
73
|
+
|
|
74
|
+
// Configura readline para leer la entrada del usuario
|
|
75
|
+
const rl = readline.createInterface({
|
|
76
|
+
input: process.stdin,
|
|
77
|
+
output: process.stdout
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Muestra las opciones al usuario
|
|
81
|
+
console.log('Opciones disponibles:');
|
|
82
|
+
availableOptions.forEach(key => {
|
|
83
|
+
console.log(`- ${key}`);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Pregunta al usuario por la opción
|
|
87
|
+
rl.question('Introduce la opción del directorio a copiar: ', (option) => {
|
|
88
|
+
const source = predefinedPaths[option];
|
|
89
|
+
if (!source) {
|
|
90
|
+
console.error('Opción no válida');
|
|
91
|
+
rl.close();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Pregunta al usuario por el nombre del directorio de destino
|
|
96
|
+
rl.question('Introduce el nombre del directorio de destino (deja en blanco para usar la opción): ', (destDir) => {
|
|
97
|
+
console.log('Copiando archivos...');
|
|
98
|
+
const targetDir = destDir || option;
|
|
99
|
+
const target = path.join(__dirname, "..", '..', '..', 'src', "components", targetDir);
|
|
100
|
+
const dirName = targetDir.toUpperCase();
|
|
101
|
+
|
|
102
|
+
// Verifica si la carpeta de destino ya existe
|
|
103
|
+
if (!fs.existsSync(target)) {
|
|
104
|
+
try {
|
|
105
|
+
copyFolderSync(source, target);
|
|
106
|
+
console.log(`Carpeta copiada ${dirName}`);
|
|
107
|
+
|
|
108
|
+
// Copia las dependencias si existen
|
|
109
|
+
if (dependencies[option]) {
|
|
110
|
+
dependencies[option].forEach(dep => {
|
|
111
|
+
const depSource = predefinedPaths[dep];
|
|
112
|
+
const depTarget = path.join(__dirname, "..", '..', '..', 'src', "components", path.relative(path.join(__dirname, "..", 'src', 'components'), depSource));
|
|
113
|
+
if (!fs.existsSync(depTarget)) {
|
|
114
|
+
copyFolderSync(depSource, depTarget);
|
|
115
|
+
console.log(`Dependencia copiada ${dep.toUpperCase()}`);
|
|
116
|
+
} else {
|
|
117
|
+
console.log(`La carpeta de destino ${dep.toUpperCase()} ya existe. No se copian los archivos.`);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error(`Error al copiar la carpeta ${dirName}`, error);
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
console.log(`La carpeta de destino ${dirName} ya existe. No se copian los archivos.`);
|
|
126
|
+
}
|
|
127
|
+
rl.close();
|
|
128
|
+
});
|
|
129
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
// Función para copiar recursivamente una carpeta
|
|
5
|
+
function copyFolderSync(from, to) {
|
|
6
|
+
fs.mkdirSync(to, { recursive: true });
|
|
7
|
+
fs.readdirSync(from).forEach(element => {
|
|
8
|
+
const fromPath = path.join(from, element);
|
|
9
|
+
const toPath = path.join(to, element);
|
|
10
|
+
if (fs.lstatSync(fromPath).isFile()) {
|
|
11
|
+
if (!fs.existsSync(toPath)) {
|
|
12
|
+
fs.copyFileSync(fromPath, toPath);
|
|
13
|
+
}
|
|
14
|
+
} else {
|
|
15
|
+
copyFolderSync(fromPath, toPath);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Arreglo de directorios a copiar
|
|
21
|
+
const directories = [
|
|
22
|
+
{
|
|
23
|
+
source: path.join(__dirname, "..", 'src', 'sass'),
|
|
24
|
+
target: path.join(__dirname, "..", '..', '..', 'src', 'sass'),
|
|
25
|
+
name: 'STYLES'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
source: path.join(__dirname, "..", 'src', 'app', 'api'),
|
|
29
|
+
target: path.join(__dirname, "..", '..', '..', 'src', 'app', 'api'),
|
|
30
|
+
name: 'API'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
source: path.join(__dirname, "..", 'src', 'functions'),
|
|
34
|
+
target: path.join(__dirname, "..", '..', '..', 'src', 'functions'),
|
|
35
|
+
name: 'FUNCIONES'
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
// Itera sobre el arreglo y copia las carpetas
|
|
40
|
+
directories.forEach(dir => {
|
|
41
|
+
if (!fs.existsSync(dir.target)) {
|
|
42
|
+
try {
|
|
43
|
+
copyFolderSync(dir.source, dir.target);
|
|
44
|
+
console.log(`Carpeta copiada ${dir.name}`);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error(`Error al copiar la carpeta ${dir.name}`, error);
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
console.log(`La carpeta de destino ${dir.name} ya existe. No se copian los archivos.`);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Función para agregar un script a package.json
|
|
54
|
+
function addScriptToPackageJson(scriptName, scriptCommand) {
|
|
55
|
+
const packageJsonPath = path.join(__dirname, '..', 'package.json');
|
|
56
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
57
|
+
|
|
58
|
+
packageJson.scripts = packageJson.scripts || {};
|
|
59
|
+
packageJson.scripts[scriptName] = scriptCommand;
|
|
60
|
+
|
|
61
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf8');
|
|
62
|
+
console.log(`Script "${scriptName}" agregado a package.json`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Agrega el script moveComponents a package.json
|
|
66
|
+
addScriptToPackageJson("@nano", 'node ./node_modules/nanify/fn/moveComponents.js');
|
package/fn/upVersion.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
|
|
3
|
+
const packageJsonPath = './package.json';
|
|
4
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
5
|
+
|
|
6
|
+
const versionParts = packageJson.version.split('.');
|
|
7
|
+
versionParts[2] = (parseInt(versionParts[2], 10) + 1).toString();
|
|
8
|
+
packageJson.version = versionParts.join('.');
|
|
9
|
+
|
|
10
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf8');
|
|
11
|
+
|
|
12
|
+
console.log('package.json actualizado correctamente a la versión', packageJson.version);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
|
|
3
|
+
const tsconfigPath = './tsconfig.json';
|
|
4
|
+
const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, 'utf8'));
|
|
5
|
+
|
|
6
|
+
tsconfig.compilerOptions.jsx = 'react';
|
|
7
|
+
|
|
8
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2), 'utf8');
|
|
9
|
+
|
|
10
|
+
console.log('tsconfig.json actualizado correctamente');
|
package/next.config.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-pdf-levelup",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "next dev",
|
|
9
|
+
"build": "next build",
|
|
10
|
+
"start": "next start",
|
|
11
|
+
"lint": "next lint",
|
|
12
|
+
"upVersion": "node ./fn/upVersion.js",
|
|
13
|
+
"update:jsx": "node ./fn/updateTsconfig.js",
|
|
14
|
+
"publicar": "npm run upVersion && npm run update:jsx && npm publish",
|
|
15
|
+
"postinstall": "node ./fn/postinstall.js"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@babel/standalone": "^7.26.9",
|
|
19
|
+
"@monaco-editor/react": "^4.7.0",
|
|
20
|
+
"@react-pdf/renderer": "^4.3.0",
|
|
21
|
+
"lucide-react": "^0.477.0",
|
|
22
|
+
"next": "14.2.24",
|
|
23
|
+
"next-transpile-modules": "^10.0.1",
|
|
24
|
+
"react": "^18",
|
|
25
|
+
"react-dom": "^18",
|
|
26
|
+
"react-pdf": "^9.2.1"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@react-pdf/types": "^2.9.0",
|
|
30
|
+
"@types/node": "^20",
|
|
31
|
+
"@types/react": "^18",
|
|
32
|
+
"@types/react-dom": "^18",
|
|
33
|
+
"eslint": "^8",
|
|
34
|
+
"eslint-config-next": "14.2.24",
|
|
35
|
+
"json": "^11.0.0",
|
|
36
|
+
"tsup": "^8.4.0",
|
|
37
|
+
"typescript": "^5"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const hola = {}
|