@unopsitg/ux 21.1.1 → 21.2.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/AGENTS.md +19 -5
- package/README.md +39 -17
- package/package.json +12 -10
- package/schematics/ng-add/index.js +28 -9
package/AGENTS.md
CHANGED
|
@@ -6,7 +6,7 @@ This file is for AI coding assistants (Cursor, Claude Code, Copilot, etc.) worki
|
|
|
6
6
|
|
|
7
7
|
- **Layout shell** — full application chrome (sidebar, topbar, breadcrumb, configurator)
|
|
8
8
|
- **Brand theme** — PrimeNG / PrimeUIX preset (`BrandSoft`) with UNOPS brand colors
|
|
9
|
-
- **Tailwind CSS** — design tokens, custom utilities, and component animations
|
|
9
|
+
- **Tailwind CSS** — design tokens, custom utilities, and component animations (Tailwind v4 source file)
|
|
10
10
|
- **Shared types** — demo data interfaces
|
|
11
11
|
|
|
12
12
|
## Quick setup (or run `ng add @unopsitg/ux`)
|
|
@@ -18,8 +18,8 @@ This file is for AI coding assistants (Cursor, Claude Code, Copilot, etc.) worki
|
|
|
18
18
|
|
|
19
19
|
2. Create `src/tailwind.css`:
|
|
20
20
|
```css
|
|
21
|
-
@import "
|
|
22
|
-
@
|
|
21
|
+
@import "tailwindcss";
|
|
22
|
+
@import "@unopsitg/ux/tailwind";
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
3. In `angular.json` styles:
|
|
@@ -32,7 +32,12 @@ This file is for AI coding assistants (Cursor, Claude Code, Copilot, etc.) worki
|
|
|
32
32
|
{ "glob": "**/*", "input": "node_modules/@unopsitg/ux/assets/opp", "output": "assets/opp" }
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
5.
|
|
35
|
+
5. Install dev dependencies:
|
|
36
|
+
```bash
|
|
37
|
+
npm install -D @tailwindcss/postcss tailwindcss postcss
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
6. In `app.config.ts` providers:
|
|
36
41
|
```typescript
|
|
37
42
|
import { providePrimeNG } from 'primeng/config';
|
|
38
43
|
import { BrandSoft, TOPBAR_PROFILE_MENU_CONFIG, LayoutService } from '@unopsitg/ux';
|
|
@@ -42,11 +47,20 @@ This file is for AI coding assistants (Cursor, Claude Code, Copilot, etc.) worki
|
|
|
42
47
|
|
|
43
48
|
## Critical rules
|
|
44
49
|
|
|
50
|
+
- **NEVER** add `node_modules/@unopsitg/ux/assets/tailwind.css` directly to `angular.json` styles — Angular's esbuild does NOT run PostCSS on node_modules CSS, so all directives pass through as raw text and zero utilities are generated.
|
|
51
|
+
- **ALWAYS** use `src/tailwind.css` with `@import "@unopsitg/ux/tailwind"` — this lives in the source tree where PostCSS processes it.
|
|
45
52
|
- **NEVER** put `@source` directives in `.scss` files — Sass passes them through as inert text.
|
|
46
53
|
- **NEVER** use `postcss.config.mjs` — Angular 21 esbuild silently ignores it.
|
|
47
|
-
- **NEVER** reference `node_modules/@unopsitg/ux/assets/tailwind.css` directly in `angular.json` — use the `src/tailwind.css` wrapper for correct `@source` path resolution.
|
|
48
54
|
- Shell-critical utilities (`.hidden`, `.animate-scalein`, `.animate-fadeout`) ship as real CSS. Do not redefine them.
|
|
49
55
|
|
|
56
|
+
## Package exports
|
|
57
|
+
|
|
58
|
+
| Import path | Resolves to |
|
|
59
|
+
|-------------|-------------|
|
|
60
|
+
| `@unopsitg/ux` | `fesm2022/unopsitg-ux.mjs` (Angular library) |
|
|
61
|
+
| `@unopsitg/ux/tailwind` | `assets/tailwind.css` (Tailwind v4 source) |
|
|
62
|
+
| `@unopsitg/ux/styles` | `assets/styles.scss` (layout SCSS) |
|
|
63
|
+
|
|
50
64
|
## Injection tokens
|
|
51
65
|
|
|
52
66
|
| Token | Purpose | Shape |
|
package/README.md
CHANGED
|
@@ -44,11 +44,25 @@ export const appConfig: ApplicationConfig = {
|
|
|
44
44
|
|
|
45
45
|
## Styles and assets
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
### Automated setup
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
```bash
|
|
50
|
+
ng add @unopsitg/ux
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This creates all required files and patches `angular.json` + `app.config.ts` automatically. The rest of this section documents the manual equivalent.
|
|
54
|
+
|
|
55
|
+
### Understanding `assets/tailwind.css`
|
|
56
|
+
|
|
57
|
+
The library ships `assets/tailwind.css` as a **Tailwind v4 source file** — it contains `@plugin`, `@source`, `@theme`, and `@utility` directives that must be processed by `@tailwindcss/postcss` to generate utility classes.
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
> **Do NOT add `assets/tailwind.css` directly to angular.json styles.** Angular's esbuild/Vite builder does not run PostCSS on CSS files referenced from `node_modules` — it inlines them as raw text. All directives will appear literally in the browser output and zero utilities will be generated.
|
|
60
|
+
|
|
61
|
+
### Manual setup
|
|
62
|
+
|
|
63
|
+
#### 1. PostCSS configuration
|
|
64
|
+
|
|
65
|
+
Angular 21's `application` builder only loads JSON-format PostCSS configs. Create `.postcssrc.json` in the project root:
|
|
52
66
|
|
|
53
67
|
```json
|
|
54
68
|
{
|
|
@@ -58,9 +72,20 @@ Angular 21's `application` builder (esbuild) only loads JSON-format PostCSS conf
|
|
|
58
72
|
}
|
|
59
73
|
```
|
|
60
74
|
|
|
61
|
-
> **Warning:** `.mjs` configs (`postcss.config.mjs`) are silently ignored by esbuild.
|
|
75
|
+
> **Warning:** `.mjs` configs (`postcss.config.mjs`) are silently ignored by esbuild.
|
|
76
|
+
|
|
77
|
+
#### 2. Tailwind entry point
|
|
78
|
+
|
|
79
|
+
Create `src/tailwind.css` — this lives in your source tree so Angular **will** run PostCSS on it:
|
|
80
|
+
|
|
81
|
+
```css
|
|
82
|
+
@import "tailwindcss";
|
|
83
|
+
@import "@unopsitg/ux/tailwind";
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The `@unopsitg/ux/tailwind` export resolves to the library's `assets/tailwind.css` via the package `exports` field. The file includes brand tokens, custom utilities, and a `@source` directive that scans the library's compiled JS for class references.
|
|
62
87
|
|
|
63
|
-
|
|
88
|
+
#### 3. angular.json styles and assets
|
|
64
89
|
|
|
65
90
|
```json
|
|
66
91
|
"styles": [
|
|
@@ -75,23 +100,20 @@ Angular 21's `application` builder (esbuild) only loads JSON-format PostCSS conf
|
|
|
75
100
|
]
|
|
76
101
|
```
|
|
77
102
|
|
|
78
|
-
|
|
103
|
+
#### 4. Dev dependencies
|
|
79
104
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
```css
|
|
83
|
-
/* src/tailwind.css */
|
|
84
|
-
@import "../node_modules/@unopsitg/ux/assets/tailwind.css";
|
|
85
|
-
@source "../node_modules/@unopsitg/ux/fesm2022";
|
|
105
|
+
```bash
|
|
106
|
+
npm install -D @tailwindcss/postcss tailwindcss postcss
|
|
86
107
|
```
|
|
87
108
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
> **Do not** put `@source` directives in `.scss` files — Sass copies them as inert text and PostCSS/Tailwind never processes them.
|
|
109
|
+
### Troubleshooting
|
|
91
110
|
|
|
92
|
-
**
|
|
111
|
+
- **Tailwind directives appear as raw text in browser CSS** — you added the library's CSS directly to `angular.json` instead of using `src/tailwind.css`.
|
|
112
|
+
- **"The path './assets/tailwind.css' is not exported"** — upgrade to `@unopsitg/ux@21.2.0+` which adds the `./tailwind` export.
|
|
113
|
+
- **Zero utilities generated** — verify `.postcssrc.json` exists (not `.mjs`) and `src/tailwind.css` is in the styles array.
|
|
114
|
+
- **Do not** put `@source` directives in `.scss` files — Sass copies them as inert text.
|
|
93
115
|
|
|
94
|
-
|
|
116
|
+
**Verify:** after `ng serve`, inspect the compiled CSS for `.flex { display: flex }`. If missing, PostCSS is not running on your tailwind entry point.
|
|
95
117
|
|
|
96
118
|
## Tokens
|
|
97
119
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unopsitg/ux",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.2.0",
|
|
4
4
|
"description": "UNOPS Angular 21 layout shell, brand theme (PrimeNG / PrimeUIX), and shared types",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -13,6 +13,17 @@
|
|
|
13
13
|
"ng-add": {
|
|
14
14
|
"save": "dependencies"
|
|
15
15
|
},
|
|
16
|
+
"exports": {
|
|
17
|
+
"./tailwind": "./assets/tailwind.css",
|
|
18
|
+
"./styles": "./assets/styles.scss",
|
|
19
|
+
"./package.json": {
|
|
20
|
+
"default": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./types/unopsitg-ux.d.ts",
|
|
24
|
+
"default": "./fesm2022/unopsitg-ux.mjs"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
16
27
|
"repository": {
|
|
17
28
|
"type": "git",
|
|
18
29
|
"url": "https://github.com/opp_plus/unops-ng21_ux.git"
|
|
@@ -33,15 +44,6 @@
|
|
|
33
44
|
},
|
|
34
45
|
"module": "fesm2022/unopsitg-ux.mjs",
|
|
35
46
|
"typings": "types/unopsitg-ux.d.ts",
|
|
36
|
-
"exports": {
|
|
37
|
-
"./package.json": {
|
|
38
|
-
"default": "./package.json"
|
|
39
|
-
},
|
|
40
|
-
".": {
|
|
41
|
-
"types": "./types/unopsitg-ux.d.ts",
|
|
42
|
-
"default": "./fesm2022/unopsitg-ux.mjs"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
47
|
"sideEffects": false,
|
|
46
48
|
"type": "module",
|
|
47
49
|
"dependencies": {
|
|
@@ -3,12 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ngAdd = ngAdd;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
6
|
-
const
|
|
6
|
+
const RUNTIME_DEPS = {
|
|
7
7
|
primeng: '^21.0.4',
|
|
8
8
|
'@primeuix/themes': '^2.0.0',
|
|
9
9
|
primeicons: '^7.0.0',
|
|
10
|
+
};
|
|
11
|
+
const DEV_DEPS = {
|
|
10
12
|
'@tailwindcss/postcss': '^4.0.0',
|
|
11
|
-
|
|
13
|
+
tailwindcss: '^4.0.0',
|
|
14
|
+
postcss: '^8.4.0',
|
|
12
15
|
};
|
|
13
16
|
const STYLES_ENTRIES = [
|
|
14
17
|
'node_modules/@unopsitg/ux/assets/styles.scss',
|
|
@@ -43,11 +46,19 @@ function addPeerDependencies() {
|
|
|
43
46
|
if (!pkg.dependencies) {
|
|
44
47
|
pkg.dependencies = {};
|
|
45
48
|
}
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
if (!pkg.devDependencies) {
|
|
50
|
+
pkg.devDependencies = {};
|
|
51
|
+
}
|
|
52
|
+
for (const [name, version] of Object.entries(RUNTIME_DEPS)) {
|
|
53
|
+
if (!pkg.dependencies[name] && !pkg.devDependencies[name]) {
|
|
48
54
|
pkg.dependencies[name] = version;
|
|
49
55
|
}
|
|
50
56
|
}
|
|
57
|
+
for (const [name, version] of Object.entries(DEV_DEPS)) {
|
|
58
|
+
if (!pkg.dependencies[name] && !pkg.devDependencies[name]) {
|
|
59
|
+
pkg.devDependencies[name] = version;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
51
62
|
tree.overwrite(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
52
63
|
return tree;
|
|
53
64
|
};
|
|
@@ -69,8 +80,8 @@ function createTailwindWrapper() {
|
|
|
69
80
|
return tree;
|
|
70
81
|
}
|
|
71
82
|
tree.create(path, [
|
|
72
|
-
'@import "
|
|
73
|
-
'@
|
|
83
|
+
'@import "tailwindcss";',
|
|
84
|
+
'@import "@unopsitg/ux/tailwind";',
|
|
74
85
|
'',
|
|
75
86
|
].join('\n'));
|
|
76
87
|
return tree;
|
|
@@ -188,9 +199,17 @@ This project uses the @unopsitg/ux Angular library for its layout shell, brand t
|
|
|
188
199
|
## Critical Integration Invariants
|
|
189
200
|
|
|
190
201
|
1. **PostCSS config must be JSON format** — use \`.postcssrc.json\`, never \`.mjs\`. Angular 21 esbuild silently ignores \`.mjs\` configs.
|
|
191
|
-
2. **
|
|
192
|
-
3. **
|
|
193
|
-
4. **
|
|
202
|
+
2. **\`assets/tailwind.css\` is a Tailwind v4 source file** (not pre-compiled CSS). It contains \`@plugin\`, \`@source\`, \`@theme\`, and \`@utility\` directives that must be processed by \`@tailwindcss/postcss\`. Never add it directly to \`angular.json\` styles — it will be inlined as raw text with no utility generation.
|
|
203
|
+
3. **Use \`src/tailwind.css\`** as the entry point. It imports \`tailwindcss\` and \`@unopsitg/ux/tailwind\` via the package exports. This file IS processed by PostCSS because it lives in \`src/\`.
|
|
204
|
+
4. **Never put \`@source\` directives in \`.scss\` files** — Sass copies them as inert text.
|
|
205
|
+
5. **Shell utilities** (\`.hidden\`, \`.animate-scalein\`, \`.animate-fadeout\`) are shipped as real CSS in the library. Do not redefine them.
|
|
206
|
+
|
|
207
|
+
## Correct src/tailwind.css
|
|
208
|
+
|
|
209
|
+
\`\`\`css
|
|
210
|
+
@import "tailwindcss";
|
|
211
|
+
@import "@unopsitg/ux/tailwind";
|
|
212
|
+
\`\`\`
|
|
194
213
|
|
|
195
214
|
## Available Injection Tokens
|
|
196
215
|
|