tailjng 0.1.6 → 0.1.7
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 +12 -4
- package/cli/execute/init-app.js +5 -2
- package/cli/execute/sync-app.js +14 -2
- package/cli/settings/colors-config-utils.js +43 -8
- package/cli/settings/icons-config-utils.js +62 -0
- package/cli/settings/path-utils.js +32 -2
- package/cli/settings/project-utils.js +7 -1
- package/cli/templates/app.generator.js +2 -2
- package/fesm2022/tailjng.mjs +247 -80
- package/fesm2022/tailjng.mjs.map +1 -1
- package/lib/services/static/theme.service.d.ts +39 -1
- package/lib/utils/theme/theme-variables.util.d.ts +31 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -1
- package/registry/components.json +41 -18
- package/src/colors.safelist.css +2 -2
- package/src/lib/components/.config/README.md +11 -0
- package/src/lib/components/.config/colors/README.md +38 -0
- package/src/lib/components/{colors-config → .config/colors}/colors.config.ts +5 -5
- package/src/lib/components/{colors-config → .config/colors}/colors.safelist.css +2 -2
- package/src/lib/components/.config/icons/README.md +26 -0
- package/src/lib/components/.config/icons/icons.lucide.ts +134 -0
- package/src/lib/components/.config/input/README.md +24 -0
- package/src/lib/components/.config/input/input.classes.ts +119 -0
- package/src/lib/components/alert/alert-dialog/dialog-alert.component.css +244 -2
- package/src/lib/components/alert/alert-dialog/dialog-alert.component.html +25 -38
- package/src/lib/components/alert/alert-dialog/dialog-alert.component.ts +66 -56
- package/src/lib/components/alert/alert-dialog/dialog-alert.types.ts +19 -0
- package/src/lib/components/alert/alert-toast/toast-alert.component.css +630 -12
- package/src/lib/components/alert/alert-toast/toast-alert.component.html +103 -102
- package/src/lib/components/alert/alert-toast/toast-alert.component.ts +485 -128
- package/src/lib/components/alert/alert-toast/toast-alert.types.ts +25 -0
- package/src/lib/components/badge/badge.component.html +34 -21
- package/src/lib/components/badge/badge.component.ts +140 -31
- package/src/lib/components/button/button.component.html +16 -10
- package/src/lib/components/button/button.component.ts +162 -22
- package/src/lib/components/card/card-complete/complete-card.component.html +2 -2
- package/src/lib/components/card/card-complete/complete-card.component.ts +26 -16
- package/src/lib/components/card/card-crud-complete/complete-crud-card.component.html +2 -2
- package/src/lib/components/card/card-crud-complete/complete-crud-card.component.ts +26 -16
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.css +97 -0
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.html +54 -46
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.ts +135 -64
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.types.ts +3 -0
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.css +112 -0
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.html +28 -25
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.ts +67 -15
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.types.ts +1 -0
- package/src/lib/components/coach-mark/coach-mark.component.html +4 -22
- package/src/lib/components/coach-mark/coach-mark.component.scss +1 -1
- package/src/lib/components/coach-mark/coach-mark.component.ts +51 -18
- package/src/lib/components/coach-mark/coach-mark.directive.ts +133 -78
- package/src/lib/components/coach-mark/coach-mark.types.ts +12 -0
- package/src/lib/components/dialog/dialog.component.css +103 -1
- package/src/lib/components/dialog/dialog.component.html +46 -66
- package/src/lib/components/dialog/dialog.component.ts +136 -110
- package/src/lib/components/dialog/dialog.types.ts +19 -0
- package/src/lib/components/filter/filter-complete/complete-filter.component.html +16 -19
- package/src/lib/components/filter/filter-complete/complete-filter.component.scss +35 -0
- package/src/lib/components/filter/filter-complete/complete-filter.component.ts +58 -34
- package/src/lib/components/filter/filter-complete/complete-filter.types.ts +7 -0
- package/src/lib/components/filter/filter-complete/complete-filter.util.ts +16 -0
- package/src/lib/components/form/form-container/container-form.component.css +4 -0
- package/src/lib/components/form/form-container/container-form.component.html +2 -2
- package/src/lib/components/form/form-container/container-form.component.ts +72 -16
- package/src/lib/components/form/form-container/container-form.types.ts +42 -0
- package/src/lib/components/form/form-container/form-col-span.directive.ts +25 -0
- package/src/lib/components/form/form-sidebar/sidebar-form.component.css +276 -0
- package/src/lib/components/form/form-sidebar/sidebar-form.component.html +117 -125
- package/src/lib/components/form/form-sidebar/sidebar-form.component.ts +109 -34
- package/src/lib/components/form/form-sidebar/sidebar-form.types.ts +3 -0
- package/src/lib/components/{toggle-radio/toggle-radio.component.css → form/form-validation/validation-form.component.css} +0 -1
- package/src/lib/components/form/form-validation/validation-form.component.html +10 -6
- package/src/lib/components/form/form-validation/validation-form.component.ts +99 -12
- package/src/lib/components/form/form-validation/validation-form.types.ts +33 -0
- package/src/lib/components/icon/icon.component.html +8 -5
- package/src/lib/components/icon/icon.component.ts +111 -9
- package/src/lib/components/input/input/input.component.html +19 -16
- package/src/lib/components/input/input/input.component.ts +130 -53
- package/src/lib/components/input/input/input.types.ts +8 -0
- package/src/lib/components/input/input-file/file-input.component.html +65 -56
- package/src/lib/components/input/input-file/file-input.component.ts +276 -173
- package/src/lib/components/input/input-file/file-input.types.ts +2 -0
- package/src/lib/components/input/input-range/range-input.component.css +67 -0
- package/src/lib/components/input/input-range/range-input.component.html +50 -58
- package/src/lib/components/input/input-range/range-input.component.ts +148 -60
- package/src/lib/components/input/input-range/range-input.types.ts +7 -0
- package/src/lib/components/input/input-textarea/textarea-input.component.html +16 -7
- package/src/lib/components/input/input-textarea/textarea-input.component.ts +140 -50
- package/src/lib/components/input/input-textarea/textarea-input.types.ts +2 -0
- package/src/lib/components/label/label.component.html +17 -16
- package/src/lib/components/label/label.component.ts +70 -16
- package/src/lib/components/label/label.types.ts +2 -0
- package/src/lib/components/menu/menu-options-table/menu-options-defaults.ts +34 -0
- package/src/lib/components/menu/menu-options-table/options-table-menu.component.html +34 -20
- package/src/lib/components/menu/menu-options-table/options-table-menu.component.ts +211 -58
- package/src/lib/components/menu/menu-options-table/options-table-menu.types.ts +38 -0
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.html +49 -52
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.ts +112 -24
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.types.ts +9 -0
- package/src/lib/components/mode-toggle/mode-toggle.component.html +11 -16
- package/src/lib/components/mode-toggle/mode-toggle.component.ts +69 -33
- package/src/lib/components/paginator/paginator-complete/complete-paginator.component.html +4 -4
- package/src/lib/components/paginator/paginator-complete/complete-paginator.component.ts +31 -7
- package/src/lib/components/paginator/paginator-complete/complete-paginator.types.ts +12 -0
- package/src/lib/components/paginator/paginator-complete/complete-paginator.util.ts +36 -0
- package/src/lib/components/progress-bar/progress-bar.component.css +11 -0
- package/src/lib/components/progress-bar/progress-bar.component.html +41 -40
- package/src/lib/components/progress-bar/progress-bar.component.ts +95 -11
- package/src/lib/components/progress-bar/progress-bar.types.ts +2 -0
- package/src/lib/components/select/select-dropdown/dropdown-select.component.css +6 -0
- package/src/lib/components/select/select-dropdown/dropdown-select.component.html +54 -44
- package/src/lib/components/select/select-dropdown/dropdown-select.component.ts +450 -509
- package/src/lib/components/select/select-dropdown/dropdown-select.types.ts +43 -0
- package/src/lib/components/select/select-dropdown/dropdown-select.util.ts +179 -0
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.css +6 -0
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.html +131 -42
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.ts +491 -475
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.types.ts +22 -0
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.util.ts +20 -0
- package/src/lib/components/select/select-multi-table/multi-table-select.component.css +10 -0
- package/src/lib/components/select/select-multi-table/multi-table-select.component.html +76 -60
- package/src/lib/components/select/select-multi-table/multi-table-select.component.ts +250 -313
- package/src/lib/components/select/select-multi-table/multi-table-select.types.ts +10 -0
- package/src/lib/components/select/select-multi-table/multi-table-select.util.ts +5 -0
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.css +212 -0
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.html +62 -53
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.ts +84 -27
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.types.ts +2 -0
- package/src/lib/components/table/table-complete/complete-table.component.html +15 -17
- package/src/lib/components/table/table-complete/complete-table.component.ts +190 -338
- package/src/lib/components/table/table-complete/complete-table.types.ts +28 -0
- package/src/lib/components/table/table-complete/complete-table.util.ts +236 -0
- package/src/lib/components/table/table-complete/index.ts +2 -0
- package/src/lib/components/table/table-crud-complete/complete-crud-table.animations.ts +34 -0
- package/src/lib/components/table/table-crud-complete/complete-crud-table.component.html +73 -128
- package/src/lib/components/table/table-crud-complete/complete-crud-table.component.ts +542 -829
- package/src/lib/components/table/table-crud-complete/complete-crud-table.types.ts +57 -0
- package/src/lib/components/table/table-crud-complete/complete-crud-table.util.ts +723 -0
- package/src/lib/components/table/table-crud-complete/index.ts +3 -0
- package/src/lib/components/theme-generator/theme-generator.component.css +21 -0
- package/src/lib/components/theme-generator/theme-generator.component.html +146 -116
- package/src/lib/components/theme-generator/theme-generator.component.ts +44 -24
- package/src/lib/components/toggle-radio/shared/toggle-options.types.ts +8 -0
- package/src/lib/components/toggle-radio/shared/toggle-options.util.ts +44 -0
- package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.component.css +135 -0
- package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.component.html +52 -0
- package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.component.ts +198 -0
- package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.types.ts +1 -0
- package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.component.css +108 -0
- package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.component.html +37 -0
- package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.component.ts +193 -0
- package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.types.ts +1 -0
- package/src/lib/components/tooltip/tooltip.directive.ts +12 -9
- package/src/lib/components/tooltip/tooltip.service.ts +331 -133
- package/src/lib/components/tooltip/tooltip.types.ts +9 -0
- package/src/lib/components/viewer/viewer-image/image-viewer.component.css +90 -4
- package/src/lib/components/viewer/viewer-image/image-viewer.component.html +52 -103
- package/src/lib/components/viewer/viewer-image/image-viewer.component.ts +182 -177
- package/src/lib/components/viewer/viewer-image/image-viewer.types.ts +3 -0
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.css +177 -0
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.html +74 -24
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.ts +168 -15
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.types.ts +1 -0
- package/src/styles.css +2 -2
- package/lib/services/static/icons.service.d.ts +0 -65
- package/src/lib/components/colors-config/README.md +0 -38
- package/src/lib/components/form/form-sidebar/sidebar-form.component.scss +0 -0
- package/src/lib/components/form/form-validation/validation-form.component.scss +0 -0
- package/src/lib/components/menu/menu-options-table/options-table-menu.component.scss +0 -0
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.scss +0 -12
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.scss +0 -0
- package/src/lib/components/toggle-radio/toggle-radio.component.html +0 -51
- package/src/lib/components/toggle-radio/toggle-radio.component.ts +0 -222
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.scss +0 -0
- package/tailjng-0.1.6.tgz +0 -0
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Librería UI y utilidades para **Angular 19** con **Tailwind CSS v4**. Modelo h
|
|
|
12
12
|
|------|-----------|
|
|
13
13
|
| **Config** | `TAILJNG_CONFIG` — `urlBase`, `socketUrl` para API REST |
|
|
14
14
|
| **Colores** | `JColorsService` — variantes (`primary`, `success_soft`, `error_outline`, …) |
|
|
15
|
-
| **Iconos** | `
|
|
15
|
+
| **Iconos** | Registro `Icons` en `.config/icons/icons.lucide.ts` (copiado con CLI) + componente `JIcon` |
|
|
16
16
|
| **Alertas** | `JAlertDialogService`, `JAlertToastService` |
|
|
17
17
|
| **CRUD / HTTP** | `JGenericCrudService`, `JConverterCrudService`, params, files, error handler |
|
|
18
18
|
| **Transformación** | `JTransformService`, `JCalendarService` — fechas, moneda, tablas |
|
|
@@ -112,7 +112,6 @@ export const tailjngProviders = [
|
|
|
112
112
|
|
|
113
113
|
```typescript
|
|
114
114
|
import {
|
|
115
|
-
JIconsService,
|
|
116
115
|
JColorsService,
|
|
117
116
|
JAlertToastService,
|
|
118
117
|
JGenericCrudService,
|
|
@@ -134,7 +133,16 @@ import { JAlertToastComponent } from './tailjng/alert/alert-toast/toast-alert.co
|
|
|
134
133
|
<JButton [text]="'Guardar'" classes="primary" [icon]="icons.save" (clicked)="save()" />
|
|
135
134
|
```
|
|
136
135
|
|
|
137
|
-
###
|
|
136
|
+
### Configuración — `src/app/tailjng/.config/`
|
|
137
|
+
|
|
138
|
+
Colores e iconos viven fuera de los componentes UI, en subcarpetas de `.config`:
|
|
139
|
+
|
|
140
|
+
| Subcarpeta | Archivos |
|
|
141
|
+
|------------|----------|
|
|
142
|
+
| `.config/colors/` | `colors.config.ts`, `colors.safelist.css` |
|
|
143
|
+
| `.config/icons/` | `icons.lucide.ts` (clase `Icons`) |
|
|
144
|
+
|
|
145
|
+
### Colores — `src/app/tailjng/.config/colors/`
|
|
138
146
|
|
|
139
147
|
Las variantes (`primary`, `success_soft`, …) las resuelve **`JColorsService`**. Tailwind v4 no genera clases solo en runtime, así que cada proyecto tiene una carpeta editable:
|
|
140
148
|
|
|
@@ -176,7 +184,7 @@ Uso en componentes:
|
|
|
176
184
|
`init:app` / `sync:app` registran el provider automáticamente. Manualmente en `app.config.ts`:
|
|
177
185
|
|
|
178
186
|
```typescript
|
|
179
|
-
import { tailjngColorsProvider } from './tailjng/colors/colors.config';
|
|
187
|
+
import { tailjngColorsProvider } from './tailjng/.config/colors/colors.config';
|
|
180
188
|
|
|
181
189
|
providers: [
|
|
182
190
|
tailjngColorsProvider,
|
package/cli/execute/init-app.js
CHANGED
|
@@ -33,6 +33,7 @@ const {
|
|
|
33
33
|
ensureProjectColorsConfig,
|
|
34
34
|
patchAppConfigColors,
|
|
35
35
|
} = require('../settings/colors-config-utils');
|
|
36
|
+
const { ensureProjectIconsConfig } = require('../settings/icons-config-utils');
|
|
36
37
|
|
|
37
38
|
/** Solo si pasas --with-components (opcional; no es el flujo normal). */
|
|
38
39
|
const OPTIONAL_BASE_COMPONENTS = ['mode-toggle', 'alert-dialog', 'alert-toast'];
|
|
@@ -148,7 +149,8 @@ async function runInitApp() {
|
|
|
148
149
|
// Siempre alinear @angular/animations con la versión real de @angular/core del proyecto
|
|
149
150
|
const animationsAligned = alignAngularAnimationsInPackageJson(workspaceRoot);
|
|
150
151
|
if (animationsAligned.changed) {
|
|
151
|
-
|
|
152
|
+
const label = animationsAligned.added ? 'Added' : 'Aligned';
|
|
153
|
+
console.log(`${COLORS.cyan}[tailjng CLI] ${label} @angular/animations → ${animationsAligned.version} (same as @angular/core)${COLORS.reset}`);
|
|
152
154
|
Object.assign(packageJson, readJson(packageJsonPath));
|
|
153
155
|
}
|
|
154
156
|
|
|
@@ -171,6 +173,7 @@ async function runInitApp() {
|
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
ensureProjectColorsConfig(workspaceRoot, appRoot, overwrite);
|
|
176
|
+
ensureProjectIconsConfig(workspaceRoot, appRoot, overwrite);
|
|
174
177
|
|
|
175
178
|
const hasAppConfig = fileExists(appConfigPath);
|
|
176
179
|
const safelistImport = getTailjngSafelistCssImport(workspaceRoot, primaryStylePath, selectedApp);
|
|
@@ -223,7 +226,7 @@ async function runInitApp() {
|
|
|
223
226
|
|
|
224
227
|
const colorsPatched = patchAppConfigColors(appConfigPath, srcRoot);
|
|
225
228
|
if (colorsPatched.changed) {
|
|
226
|
-
console.log(`${COLORS.green}✔ Linked tailjngColorsProvider from src/app/tailjng/colors/${COLORS.reset}`);
|
|
229
|
+
console.log(`${COLORS.green}✔ Linked tailjngColorsProvider from src/app/tailjng/.config/colors/${COLORS.reset}`);
|
|
227
230
|
}
|
|
228
231
|
}
|
|
229
232
|
|
package/cli/execute/sync-app.js
CHANGED
|
@@ -30,6 +30,10 @@ const {
|
|
|
30
30
|
patchAppConfigColors,
|
|
31
31
|
COLORS_FILES,
|
|
32
32
|
} = require('../settings/colors-config-utils');
|
|
33
|
+
const {
|
|
34
|
+
ensureProjectIconsConfig,
|
|
35
|
+
ICONS_FILES,
|
|
36
|
+
} = require('../settings/icons-config-utils');
|
|
33
37
|
|
|
34
38
|
function resolveTargetPath(workspaceRoot, appProject, relativePath, appRootRelative = false) {
|
|
35
39
|
const appRoot = path.join(workspaceRoot, appProject.root || '');
|
|
@@ -89,7 +93,8 @@ async function runSyncApp() {
|
|
|
89
93
|
const animationsAligned = alignAngularAnimationsInPackageJson(workspaceRoot);
|
|
90
94
|
if (animationsAligned.changed) {
|
|
91
95
|
changes += 1;
|
|
92
|
-
|
|
96
|
+
const label = animationsAligned.added ? 'Added' : 'Aligned';
|
|
97
|
+
console.log(`${COLORS.green}✔ ${label} @angular/animations → ${animationsAligned.version}${COLORS.reset}`);
|
|
93
98
|
Object.assign(packageJson, readJson(packageJsonPath));
|
|
94
99
|
}
|
|
95
100
|
|
|
@@ -137,6 +142,13 @@ async function runSyncApp() {
|
|
|
137
142
|
console.log(`${COLORS.dim}↷ Project colors config already present${COLORS.reset}`);
|
|
138
143
|
}
|
|
139
144
|
|
|
145
|
+
const iconsResult = ensureProjectIconsConfig(workspaceRoot, appRoot, false);
|
|
146
|
+
if (iconsResult.created > 0) {
|
|
147
|
+
changes += iconsResult.created;
|
|
148
|
+
} else if (iconsResult.skipped === ICONS_FILES.length) {
|
|
149
|
+
console.log(`${COLORS.dim}↷ Project icons config already present${COLORS.reset}`);
|
|
150
|
+
}
|
|
151
|
+
|
|
140
152
|
const safelistImport = getTailjngSafelistCssImport(workspaceRoot, primaryStylePath, selectedApp);
|
|
141
153
|
const safelistPatched = ensureTailjngSafelistImport(primaryStyleFullPath, safelistImport);
|
|
142
154
|
if (safelistPatched.changed) {
|
|
@@ -167,7 +179,7 @@ async function runSyncApp() {
|
|
|
167
179
|
const colorsPatched = patchAppConfigColors(appConfigPath, srcRoot);
|
|
168
180
|
if (colorsPatched.changed) {
|
|
169
181
|
changes += 1;
|
|
170
|
-
console.log(`${COLORS.green}✔ Linked tailjngColorsProvider from src/app/tailjng/colors/${COLORS.reset}`);
|
|
182
|
+
console.log(`${COLORS.green}✔ Linked tailjngColorsProvider from src/app/tailjng/.config/colors/${COLORS.reset}`);
|
|
171
183
|
}
|
|
172
184
|
}
|
|
173
185
|
|
|
@@ -3,11 +3,19 @@ const path = require('path');
|
|
|
3
3
|
const { COLORS } = require('./colors');
|
|
4
4
|
const { writeFileSafe } = require('./project-utils');
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const CONFIG_DIR = '.config';
|
|
7
|
+
const COLORS_SOURCE_REL = 'src/lib/components/.config/colors';
|
|
7
8
|
const COLORS_FILES = ['colors.config.ts', 'colors.safelist.css', 'README.md'];
|
|
9
|
+
const COLORS_PROVIDER_IMPORT = '../tailjng/.config/colors/colors.config';
|
|
10
|
+
const COLORS_PROVIDER_IMPORT_APP = './tailjng/.config/colors/colors.config';
|
|
11
|
+
const COLORS_SAFELIST_SEGMENT = 'tailjng/.config/colors/colors.safelist.css';
|
|
12
|
+
|
|
13
|
+
function getProjectConfigDir(appRoot) {
|
|
14
|
+
return path.join(appRoot, 'src', 'app', 'tailjng', CONFIG_DIR);
|
|
15
|
+
}
|
|
8
16
|
|
|
9
17
|
function getProjectColorsDir(appRoot) {
|
|
10
|
-
return path.join(appRoot, '
|
|
18
|
+
return path.join(getProjectConfigDir(appRoot), 'colors');
|
|
11
19
|
}
|
|
12
20
|
|
|
13
21
|
function resolveTailjngPackageRoot(workspaceRoot) {
|
|
@@ -24,6 +32,13 @@ function resolveTailjngPackageRoot(workspaceRoot) {
|
|
|
24
32
|
return null;
|
|
25
33
|
}
|
|
26
34
|
|
|
35
|
+
function migrateLegacyColorsPaths(content) {
|
|
36
|
+
return content
|
|
37
|
+
.replaceAll('../tailjng/colors/colors.config', COLORS_PROVIDER_IMPORT)
|
|
38
|
+
.replaceAll('./tailjng/colors/colors.config', COLORS_PROVIDER_IMPORT_APP)
|
|
39
|
+
.replaceAll('tailjng/colors/colors.safelist.css', COLORS_SAFELIST_SEGMENT);
|
|
40
|
+
}
|
|
41
|
+
|
|
27
42
|
function getColorsSafelistImportLine(workspaceRoot, styleEntry, appProject) {
|
|
28
43
|
const appRoot = path.join(workspaceRoot, appProject.root || '');
|
|
29
44
|
const colorsSafelist = path.join(getProjectColorsDir(appRoot), 'colors.safelist.css');
|
|
@@ -80,7 +95,14 @@ function ensureColorsSafelistImport(styleFilePath, importLine) {
|
|
|
80
95
|
if (!fs.existsSync(styleFilePath)) return { changed: false };
|
|
81
96
|
|
|
82
97
|
let content = fs.readFileSync(styleFilePath, 'utf8');
|
|
83
|
-
const
|
|
98
|
+
const migrated = migrateLegacyColorsPaths(content);
|
|
99
|
+
if (migrated !== content) {
|
|
100
|
+
content = migrated;
|
|
101
|
+
fs.writeFileSync(styleFilePath, content, 'utf8');
|
|
102
|
+
return { changed: true, migrated: true };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const projectImport = new RegExp(COLORS_SAFELIST_SEGMENT.replace(/\./g, '\\.'));
|
|
84
106
|
const npmImport = /node_modules\/tailjng\/src\/colors\.safelist\.css/;
|
|
85
107
|
const anySafelistImport = /@import\s+"[^"]*colors\.safelist\.css";?/;
|
|
86
108
|
|
|
@@ -88,7 +110,7 @@ function ensureColorsSafelistImport(styleFilePath, importLine) {
|
|
|
88
110
|
return { changed: false };
|
|
89
111
|
}
|
|
90
112
|
|
|
91
|
-
if (npmImport.test(content) &&
|
|
113
|
+
if (npmImport.test(content) && importLine.includes(COLORS_SAFELIST_SEGMENT)) {
|
|
92
114
|
content = content.replace(anySafelistImport, importLine);
|
|
93
115
|
fs.writeFileSync(styleFilePath, content, 'utf8');
|
|
94
116
|
return { changed: true, migrated: true };
|
|
@@ -114,7 +136,13 @@ function patchTailjngProvidersColors(providersPath) {
|
|
|
114
136
|
if (!fs.existsSync(providersPath)) return { changed: false };
|
|
115
137
|
|
|
116
138
|
let content = fs.readFileSync(providersPath, 'utf8');
|
|
117
|
-
|
|
139
|
+
const migrated = migrateLegacyColorsPaths(content);
|
|
140
|
+
if (migrated !== content) {
|
|
141
|
+
fs.writeFileSync(providersPath, migrated, 'utf8');
|
|
142
|
+
return { changed: true, migrated: true };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (content.includes('tailjngColorsProvider') || content.includes(COLORS_PROVIDER_IMPORT)) {
|
|
118
146
|
return { changed: false };
|
|
119
147
|
}
|
|
120
148
|
|
|
@@ -124,7 +152,7 @@ function patchTailjngProvidersColors(providersPath) {
|
|
|
124
152
|
if (lines[i].startsWith('import ')) lastImport = i;
|
|
125
153
|
}
|
|
126
154
|
|
|
127
|
-
const importLine =
|
|
155
|
+
const importLine = `import { tailjngColorsProvider } from '${COLORS_PROVIDER_IMPORT}';`;
|
|
128
156
|
if (lastImport === -1) {
|
|
129
157
|
content = `${importLine}\n${content}`;
|
|
130
158
|
} else {
|
|
@@ -152,7 +180,13 @@ function patchAppConfigColors(appConfigPath, srcRoot) {
|
|
|
152
180
|
if (!fs.existsSync(appConfigPath)) return { changed: false };
|
|
153
181
|
|
|
154
182
|
let content = fs.readFileSync(appConfigPath, 'utf8');
|
|
155
|
-
|
|
183
|
+
const migrated = migrateLegacyColorsPaths(content);
|
|
184
|
+
if (migrated !== content) {
|
|
185
|
+
fs.writeFileSync(appConfigPath, migrated, 'utf8');
|
|
186
|
+
return { changed: true, migrated: true };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (content.includes('tailjngColorsProvider') || content.includes(COLORS_PROVIDER_IMPORT_APP)) {
|
|
156
190
|
return { changed: false };
|
|
157
191
|
}
|
|
158
192
|
|
|
@@ -162,7 +196,7 @@ function patchAppConfigColors(appConfigPath, srcRoot) {
|
|
|
162
196
|
if (lines[i].startsWith('import ')) lastImport = i;
|
|
163
197
|
}
|
|
164
198
|
|
|
165
|
-
const importLine =
|
|
199
|
+
const importLine = `import { tailjngColorsProvider } from '${COLORS_PROVIDER_IMPORT_APP}';`;
|
|
166
200
|
if (lastImport === -1) {
|
|
167
201
|
content = `${importLine}\n${content}`;
|
|
168
202
|
} else {
|
|
@@ -179,6 +213,7 @@ function patchAppConfigColors(appConfigPath, srcRoot) {
|
|
|
179
213
|
}
|
|
180
214
|
|
|
181
215
|
module.exports = {
|
|
216
|
+
getProjectConfigDir,
|
|
182
217
|
getProjectColorsDir,
|
|
183
218
|
getColorsSafelistImportLine,
|
|
184
219
|
ensureProjectColorsConfig,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { COLORS } = require('./colors');
|
|
4
|
+
const { writeFileSafe } = require('./project-utils');
|
|
5
|
+
const { getProjectConfigDir } = require('./colors-config-utils');
|
|
6
|
+
|
|
7
|
+
const ICONS_SOURCE_REL = 'src/lib/components/.config/icons';
|
|
8
|
+
const ICONS_FILES = ['icons.lucide.ts', 'README.md'];
|
|
9
|
+
|
|
10
|
+
function getProjectIconsDir(appRoot) {
|
|
11
|
+
return path.join(getProjectConfigDir(appRoot), 'icons');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function resolveTailjngPackageRoot(workspaceRoot) {
|
|
15
|
+
const fromNodeModules = path.join(workspaceRoot, 'node_modules', 'tailjng', ICONS_SOURCE_REL);
|
|
16
|
+
if (fs.existsSync(fromNodeModules)) {
|
|
17
|
+
return path.join(workspaceRoot, 'node_modules', 'tailjng');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const fromMonorepo = path.join(workspaceRoot, 'projects', 'tailjng', ICONS_SOURCE_REL);
|
|
21
|
+
if (fs.existsSync(fromMonorepo)) {
|
|
22
|
+
return path.join(workspaceRoot, 'projects', 'tailjng');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function ensureProjectIconsConfig(workspaceRoot, appRoot, overwrite = false) {
|
|
29
|
+
const packageRoot = resolveTailjngPackageRoot(workspaceRoot);
|
|
30
|
+
if (!packageRoot) {
|
|
31
|
+
console.log(`${COLORS.yellow}[tailjng CLI] WARNING: tailjng package not found — skip icons config copy${COLORS.reset}`);
|
|
32
|
+
return { created: 0, skipped: 0, iconsDir: getProjectIconsDir(appRoot) };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const sourceDir = path.join(packageRoot, ICONS_SOURCE_REL);
|
|
36
|
+
const iconsDir = getProjectIconsDir(appRoot);
|
|
37
|
+
let created = 0;
|
|
38
|
+
let skipped = 0;
|
|
39
|
+
|
|
40
|
+
for (const file of ICONS_FILES) {
|
|
41
|
+
const src = path.join(sourceDir, file);
|
|
42
|
+
const dest = path.join(iconsDir, file);
|
|
43
|
+
if (!fs.existsSync(src)) continue;
|
|
44
|
+
|
|
45
|
+
const content = fs.readFileSync(src, 'utf8');
|
|
46
|
+
if (writeFileSafe(dest, content, overwrite)) {
|
|
47
|
+
created += 1;
|
|
48
|
+
console.log(`${COLORS.green}✔ Created ${path.relative(workspaceRoot, dest)}${COLORS.reset}`);
|
|
49
|
+
} else {
|
|
50
|
+
skipped += 1;
|
|
51
|
+
console.log(`${COLORS.dim}↷ Skipped (exists) ${path.relative(workspaceRoot, dest)}${COLORS.reset}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return { created, skipped, iconsDir };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = {
|
|
59
|
+
getProjectIconsDir,
|
|
60
|
+
ensureProjectIconsConfig,
|
|
61
|
+
ICONS_FILES,
|
|
62
|
+
};
|
|
@@ -5,8 +5,26 @@ const path = require("path")
|
|
|
5
5
|
const { getComponentsBasePath } = require("./lib-utils")
|
|
6
6
|
|
|
7
7
|
const COMPONENTS_SOURCE_PREFIX = "src/lib/components/"
|
|
8
|
+
const CONFIG_SOURCE_PREFIX = "src/lib/components/.config/"
|
|
9
|
+
|
|
10
|
+
function isConfigPath(componentPath) {
|
|
11
|
+
return componentPath.startsWith(CONFIG_SOURCE_PREFIX)
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
function parseComponentPath(componentPath) {
|
|
15
|
+
if (isConfigPath(componentPath)) {
|
|
16
|
+
const relativePath = componentPath.replace(CONFIG_SOURCE_PREFIX, "")
|
|
17
|
+
const pathParts = relativePath.split("/")
|
|
18
|
+
const componentFolder = pathParts[pathParts.length - 1]
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
componentFolder,
|
|
22
|
+
subfolders: [".config", ...pathParts.slice(0, -1)],
|
|
23
|
+
hasSubfolders: true,
|
|
24
|
+
fullSubPath: [".config", ...pathParts.slice(0, -1)].join("/"),
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
10
28
|
const relativePath = componentPath.replace(COMPONENTS_SOURCE_PREFIX, "")
|
|
11
29
|
const pathParts = relativePath.split("/")
|
|
12
30
|
const componentFolder = pathParts[pathParts.length - 1]
|
|
@@ -21,9 +39,15 @@ function parseComponentPath(componentPath) {
|
|
|
21
39
|
}
|
|
22
40
|
|
|
23
41
|
function buildTargetPath(projectRoot, componentName, componentPath) {
|
|
24
|
-
const pathInfo = parseComponentPath(componentPath)
|
|
25
42
|
const basePath = getComponentsBasePath(projectRoot)
|
|
26
43
|
|
|
44
|
+
if (isConfigPath(componentPath)) {
|
|
45
|
+
const configRel = componentPath.slice(CONFIG_SOURCE_PREFIX.length)
|
|
46
|
+
return path.join(basePath, ".config", configRel)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const pathInfo = parseComponentPath(componentPath)
|
|
50
|
+
|
|
27
51
|
if (pathInfo.hasSubfolders) {
|
|
28
52
|
return path.join(basePath, pathInfo.fullSubPath, componentName)
|
|
29
53
|
}
|
|
@@ -34,4 +58,10 @@ function isComponentInstalled(projectRoot, componentName, componentPath) {
|
|
|
34
58
|
return fs.existsSync(buildTargetPath(projectRoot, componentName, componentPath))
|
|
35
59
|
}
|
|
36
60
|
|
|
37
|
-
module.exports = {
|
|
61
|
+
module.exports = {
|
|
62
|
+
parseComponentPath,
|
|
63
|
+
buildTargetPath,
|
|
64
|
+
isComponentInstalled,
|
|
65
|
+
isConfigPath,
|
|
66
|
+
CONFIG_SOURCE_PREFIX,
|
|
67
|
+
}
|
|
@@ -260,7 +260,13 @@ function alignAngularAnimationsInPackageJson(workspaceRoot) {
|
|
|
260
260
|
const aligned = coreInstalled ? `^${coreInstalled}` : coreSpec;
|
|
261
261
|
if (!aligned) return { changed: false };
|
|
262
262
|
|
|
263
|
-
if (!deps['@angular/animations'])
|
|
263
|
+
if (!deps['@angular/animations']) {
|
|
264
|
+
deps['@angular/animations'] = aligned;
|
|
265
|
+
pkg.dependencies = deps;
|
|
266
|
+
writeJson(pkgPath, pkg);
|
|
267
|
+
return { changed: true, version: aligned, added: true };
|
|
268
|
+
}
|
|
269
|
+
|
|
264
270
|
if (deps['@angular/animations'] === aligned) return { changed: false };
|
|
265
271
|
|
|
266
272
|
deps['@angular/animations'] = aligned;
|