tailjng 0.0.12 → 0.0.14
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/cli/tailjng.js +142 -0
- package/fesm2022/tailjng.mjs +27 -4472
- package/fesm2022/tailjng.mjs.map +1 -1
- package/lib/services/icons.service.d.ts +9 -0
- package/lib/tailjng.component.d.ts +5 -0
- package/lib/tailjng.service.d.ts +6 -0
- package/package.json +8 -2
- package/public-api.d.ts +3 -30
- package/src/lib/components/label/label.component.css +0 -0
- package/src/lib/components/label/label.component.html +25 -0
- package/src/lib/components/label/label.component.ts +27 -0
- package/src/lib/components/tooltip/tooltip.directive.ts +341 -0
- package/src/lib/components/tooltip/tooltip.service.ts +192 -0
- package/lib/colors/colors.service.d.ts +0 -16
- package/lib/colors/theme/elements/theme.service.d.ts +0 -15
- package/lib/colors/theme/theme.component.d.ts +0 -87
- package/lib/components/alert-dialog/alert-dialog.component.d.ts +0 -24
- package/lib/components/alert-dialog/elements/alert-dialog.interface.d.ts +0 -41
- package/lib/components/alert-dialog/elements/alert-dialog.service.d.ts +0 -24
- package/lib/components/alert-toast/alert-toast.component.d.ts +0 -27
- package/lib/components/alert-toast/elements/alert-toast.interface.d.ts +0 -47
- package/lib/components/alert-toast/elements/alert-toast.service.d.ts +0 -26
- package/lib/components/button/button.component.d.ts +0 -35
- package/lib/components/checkbox/checkbox.component.d.ts +0 -21
- package/lib/components/crud/card-component/card.component.d.ts +0 -91
- package/lib/components/crud/filter-component/elements/filter.interface.d.ts +0 -62
- package/lib/components/crud/filter-component/filter.component.d.ts +0 -54
- package/lib/components/crud/form-component/components/content-form/content-form.component.d.ts +0 -8
- package/lib/components/crud/form-component/components/error-message/error-message.component.d.ts +0 -13
- package/lib/components/crud/form-component/form.component.d.ts +0 -29
- package/lib/components/crud/paginator-component/paginator.component.d.ts +0 -27
- package/lib/components/crud/table-component/elements/table.interface.d.ts +0 -65
- package/lib/components/crud/table-component/table.component.d.ts +0 -97
- package/lib/components/dialog/dialog.component.d.ts +0 -37
- package/lib/components/input/input.component.d.ts +0 -47
- package/lib/components/label/label.component.d.ts +0 -13
- package/lib/components/mode-toggle/mode-toggle.component.d.ts +0 -15
- package/lib/components/select/option/option.component.d.ts +0 -15
- package/lib/components/select/select.component.d.ts +0 -93
- package/lib/components/toggle-radio/toggle-radio.component.d.ts +0 -48
- package/lib/components/tooltip/tooltip.directive.d.ts +0 -20
- package/lib/components/tooltip/tooltip.service.d.ts +0 -16
- package/lib/http/api-url.d.ts +0 -2
- package/lib/http/converter.service.d.ts +0 -21
- package/lib/http/crud-generic.service.d.ts +0 -86
- package/lib/http/http-error.service.d.ts +0 -24
- package/lib/http/http-rest.service.d.ts +0 -9
- package/lib/http/interface/api-response.d.ts +0 -20
- package/lib/service/calendar.service.d.ts +0 -26
- package/lib/shared/dialog.shared.d.ts +0 -9
- package/lib/shared/form.shared.d.ts +0 -28
- package/tailjng-theme.css +0 -2810
package/cli/tailjng.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// Color helpers
|
|
7
|
+
const COLORS = {
|
|
8
|
+
reset: "\x1b[0m",
|
|
9
|
+
bright: "\x1b[1m",
|
|
10
|
+
dim: "\x1b[2m",
|
|
11
|
+
underscore: "\x1b[4m",
|
|
12
|
+
red: "\x1b[31m",
|
|
13
|
+
green: "\x1b[32m",
|
|
14
|
+
yellow: "\x1b[33m",
|
|
15
|
+
blue: "\x1b[34m",
|
|
16
|
+
magenta: "\x1b[35m",
|
|
17
|
+
cyan: "\x1b[36m",
|
|
18
|
+
white: "\x1b[37m"
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Determinar el root del paquete
|
|
22
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
23
|
+
|
|
24
|
+
// Path a los componentes dentro de la lib build
|
|
25
|
+
const componentsPath = path.join(packageRoot, 'src', 'lib', 'components');
|
|
26
|
+
|
|
27
|
+
const args = process.argv.slice(2);
|
|
28
|
+
const command = args[0];
|
|
29
|
+
|
|
30
|
+
const installedComponents = new Set();
|
|
31
|
+
|
|
32
|
+
if (command === 'add') {
|
|
33
|
+
const componentName = args[1];
|
|
34
|
+
checkTailwindInstalled();
|
|
35
|
+
addComponent(componentName);
|
|
36
|
+
} else {
|
|
37
|
+
console.log(`${COLORS.cyan}
|
|
38
|
+
Usage:
|
|
39
|
+
npx tailjng add <component>
|
|
40
|
+
${COLORS.reset}`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Check if TailwindCSS is installed in the project.
|
|
47
|
+
* If not, display a warning message with installation instructions.
|
|
48
|
+
*/
|
|
49
|
+
function checkTailwindInstalled() {
|
|
50
|
+
try {
|
|
51
|
+
require.resolve('tailwindcss');
|
|
52
|
+
console.log(`${COLORS.green}[tailjng CLI] TailwindCSS is installed.${COLORS.reset}`);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
console.warn(`${COLORS.yellow}
|
|
55
|
+
[tailjng CLI] WARNING:
|
|
56
|
+
------------------------------------------------------------
|
|
57
|
+
TailwindCSS is not installed in your project.
|
|
58
|
+
|
|
59
|
+
Please install it to ensure styles work properly:
|
|
60
|
+
|
|
61
|
+
npm install tailwindcss
|
|
62
|
+
|
|
63
|
+
And generate the config:
|
|
64
|
+
|
|
65
|
+
npx tailwindcss init
|
|
66
|
+
------------------------------------------------------------
|
|
67
|
+
${COLORS.reset}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Add a component to the project.
|
|
75
|
+
* @param {string} componentName
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
function addComponent(componentName) {
|
|
79
|
+
|
|
80
|
+
if (installedComponents.has(componentName)) {
|
|
81
|
+
// If the component is already installed, skip it
|
|
82
|
+
console.log(`${COLORS.dim}[tailjng CLI] Component "${componentName}" already installed, skipping.${COLORS.reset}`);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
installedComponents.add(componentName);
|
|
87
|
+
|
|
88
|
+
const sourcePath = path.join(componentsPath, componentName);
|
|
89
|
+
|
|
90
|
+
// Check if the component exists in the source path
|
|
91
|
+
if (!fs.existsSync(sourcePath)) {
|
|
92
|
+
console.error(`${COLORS.red}[tailjng CLI] ERROR: Component "${componentName}" does not exist at path: ${sourcePath}${COLORS.reset}`);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const projectRoot = process.cwd();
|
|
97
|
+
const targetPath = path.join(projectRoot, 'src', 'app', 'tailjng', componentName);
|
|
98
|
+
|
|
99
|
+
console.log(`${COLORS.blue}[tailjng CLI] Copying component "${componentName}" → ${path.relative(projectRoot, targetPath)}${COLORS.reset}`);
|
|
100
|
+
|
|
101
|
+
fs.mkdirSync(targetPath, { recursive: true });
|
|
102
|
+
|
|
103
|
+
const files = fs.readdirSync(sourcePath);
|
|
104
|
+
|
|
105
|
+
for (const file of files) {
|
|
106
|
+
const srcFile = path.join(sourcePath, file);
|
|
107
|
+
const destFile = path.join(targetPath, file);
|
|
108
|
+
|
|
109
|
+
let content = fs.readFileSync(srcFile, 'utf8');
|
|
110
|
+
|
|
111
|
+
// Analize if it imports any service from the library
|
|
112
|
+
const serviceMatches = [...content.matchAll(/import\s+\{\s*(\w+)\s*\}\s+from\s+['"]\.\.\/\.\.\/services\/(.*?)['"]/g)];
|
|
113
|
+
|
|
114
|
+
for (const match of serviceMatches) {
|
|
115
|
+
const serviceName = match[1];
|
|
116
|
+
console.log(`${COLORS.yellow}[tailjng CLI] Updating import of service "${serviceName}" to tailjng.${COLORS.reset}`);
|
|
117
|
+
|
|
118
|
+
// Rewrite the import statement to use the tailjng library
|
|
119
|
+
content = content.replace(
|
|
120
|
+
match[0],
|
|
121
|
+
`import { ${serviceName} } from 'tailjng'`
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Analize if it imports another component from the same library
|
|
126
|
+
const componentMatches = [...content.matchAll(/import\s+.*\s+from\s+['"]\.\.\/(\w+)\/.*['"]/g)];
|
|
127
|
+
|
|
128
|
+
for (const match of componentMatches) {
|
|
129
|
+
const dependentComponent = match[1];
|
|
130
|
+
|
|
131
|
+
if (!installedComponents.has(dependentComponent)) {
|
|
132
|
+
console.log(`${COLORS.magenta}[tailjng CLI] Detected dependency on component "${dependentComponent}". Installing it...${COLORS.reset}`);
|
|
133
|
+
addComponent(dependentComponent);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
fs.writeFileSync(destFile, content);
|
|
138
|
+
console.log(`${COLORS.green}[tailjng CLI] Copied file: ${file}${COLORS.reset}`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
console.log(`${COLORS.greenBright || COLORS.green}\n[tailjng CLI] ✅ Component "${componentName}" copied successfully.${COLORS.reset}`);
|
|
142
|
+
}
|