@truenas/ui-components 0.8.4 → 0.8.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truenas/ui-components",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/iXsystems/truenas-ui-components.git"
11
11
  },
12
12
  "bin": {
13
- "truenas-icons": "scripts/icon-sprite/cli.js"
13
+ "truenas-icons": "scripts/icon-sprite/cli.cjs"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@angular/cdk": "^22.0.0",
@@ -3,6 +3,11 @@
3
3
  /**
4
4
  * CLI wrapper that uses tsx to run the TypeScript CLI
5
5
  * This allows us to distribute TypeScript files without needing to compile them
6
+ *
7
+ * No `bin` entry and nothing else in the repo points here — `cli.cjs` is what `truenas-icons`
8
+ * runs. This file still ships, because `ng-package.json` copies the whole `scripts` directory
9
+ * as an asset, so it carries the #362 hazard too and is `.cjs` for the same reason; see
10
+ * `cli.cjs` for the full account.
6
11
  */
7
12
 
8
13
  const { spawn } = require('child_process');
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * CLI wrapper that uses tsx to run the TypeScript CLI
5
+ * This allows us to distribute TypeScript files without needing to compile them
6
+ *
7
+ * `.cjs`, not `.js`, and the extension is the fix for #362 rather than a style choice.
8
+ * This file ships to consumers as an ng-package asset, and node decides whether to read a
9
+ * `.js` file as CommonJS or as ESM from the `type` field of the nearest `package.json` — which
10
+ * for the published package is written by ng-packagr, not by this repo. 0.8.2 was the first
11
+ * release where ng-packagr emitted `"type": "module"`, and the same bytes that had worked in
12
+ * 0.7.12 became ESM and died on the `require` below with `ReferenceError: require is not
13
+ * defined in ES module scope`, before generating anything. A `.cjs` file is CommonJS whatever
14
+ * any manifest says, so the generated field cannot reach it.
15
+ *
16
+ * Renaming this back to `.js` reopens #362. `scripts/package-contract/bin-module-scope.spec.ts`
17
+ * fails if anything does.
18
+ */
19
+
20
+ const { spawn } = require('child_process');
21
+ const path = require('path');
22
+
23
+ // Get the directory where this script is located
24
+ const scriptDir = __dirname;
25
+ const cliPath = path.join(scriptDir, 'cli-main.ts');
26
+
27
+ // Use npx to run tsx, which will find it in node_modules
28
+ const child = spawn('npx', ['tsx', cliPath, ...process.argv.slice(2)], {
29
+ stdio: 'inherit',
30
+ cwd: process.cwd(),
31
+ shell: process.platform === 'win32'
32
+ });
33
+
34
+ child.on('exit', (code) => {
35
+ process.exit(code || 0);
36
+ });
37
+
38
+ child.on('error', (err) => {
39
+ console.error('Failed to start tsx:', err.message);
40
+ console.error('Make sure tsx is installed as a dependency of truenas-ui.');
41
+ process.exit(1);
42
+ });
@@ -127,24 +127,41 @@
127
127
  3:1 non-text one. Every theme declares its own: the value is a
128
128
  hue-preserving lightness shift of THAT theme's own hue token (--tn-blue,
129
129
  --tn-orange, --tn-red, --tn-green), the smallest step that clears 4.5:1 on
130
- all three surfaces a status colour is painted on — --tn-alt-bg1 (the
131
- banner), --tn-bg1 (the page, the file-picker popup) and --tn-bg2 (the card,
132
- the toast) — and on the 10% wash of itself that tn-file-picker's inline
133
- error paints behind it. Ratios below are on --tn-alt-bg1 / --tn-bg1 /
134
- --tn-bg2.
130
+ all five surfaces a status colour is painted on — --tn-alt-bg2 (a hovered
131
+ or selected row, and what a control projected into one draws on),
132
+ --tn-alt-bg1 (the banner, and the same rows in their other states),
133
+ --tn-bg3 (an elevated surface), --tn-bg1 (the page, the file-picker popup)
134
+ and --tn-bg2 (the card, the toast) — and on the 10% wash of itself that
135
+ tn-file-picker's inline error paints behind it. Ratios below are on
136
+ --tn-alt-bg2 / --tn-alt-bg1 / --tn-bg3 / --tn-bg1 / --tn-bg2.
137
+
138
+ --tn-alt-bg2 IS THE BINDING SURFACE in every dark palette and is why these
139
+ four are paler here than a reading of the page alone would choose (#361).
140
+ The row used to stop at --tn-alt-bg1, and on --tn-alt-bg2 every one of the
141
+ four then measured under 3.4:1 — so a tn-checkbox with a validation error,
142
+ projected into a hovered tn-menu-item or tn-list-option, had no rebind
143
+ target that kept the red. Moving the fill instead was not available: for
144
+ the old values to clear --tn-alt-bg2 it would have had to come down until
145
+ the --tn-alt-bg1 -> --tn-alt-bg2 step measured 1.02:1 here, and 1.02-1.08:1
146
+ across the six dark palettes, against the 1.17-1.55:1 they use today — and
147
+ that step is what tells a SELECTED row from a hovered one in tn-list-item,
148
+ tn-tree-node and tn-button-toggle. The hue tokens are untouched, and the
149
+ three light palettes needed no change at all.
135
150
 
136
151
  --tn-error is NOT --tn-error-text. That one is --tn-red's companion and
137
152
  guarantees 4.5:1 on --tn-bg1 and --tn-bg2 only; it measures 3.64:1 on
138
- --tn-alt-bg1 here, where tn-banner draws an error heading.
153
+ --tn-alt-bg1 here, where tn-banner draws an error heading, and 2.35:1 on
154
+ --tn-alt-bg2, which is why a component filling that surface rebinds it to
155
+ --tn-error rather than reading it through.
139
156
 
140
157
  A reader spells the whole chain — var(--tn-error, var(--tn-red, #bd2626)) —
141
158
  as radio.component.scss does for --tn-error-text, so a consumer stylesheet
142
159
  that predates these four keeps its own palette; semantic-status-contrast
143
160
  .spec.ts pins that shape and the literals. */
144
- --tn-info: #00adf8; /* 4.65:1 / 6.62:1 / 5.85:1; --tn-blue is 2.56:1 on --tn-alt-bg1 */
145
- --tn-warning: var(--tn-orange); /* 4.60:1 / 6.53:1 / 5.78:1 — needs no shade of its own */
146
- --tn-error: #e78888; /* 4.62:1 / 6.57:1 / 5.81:1; --tn-red is 2.22:1 on --tn-alt-bg1 */
147
- --tn-success: var(--tn-green); /* 5.16:1 / 7.33:1 / 6.49:1 — needs no shade of its own */
161
+ --tn-info: #6fd4ff; /* 4.52:1 / 7.00:1 / 7.54:1 / 9.95:1 / 8.80:1; --tn-blue is 1.65:1 on --tn-alt-bg2 */
162
+ --tn-warning: #f1bf8e; /* 4.54:1 / 7.03:1 / 7.57:1 / 9.99:1 / 8.83:1; --tn-orange is 2.97:1 on --tn-alt-bg2 */
163
+ --tn-error: #f1bbbb; /* 4.53:1 / 7.02:1 / 7.56:1 / 9.98:1 / 8.82:1; --tn-red is 1.43:1 on --tn-alt-bg2 */
164
+ --tn-success: #a3d686; /* 4.51:1 / 6.99:1 / 7.53:1 / 9.94:1 / 8.79:1; --tn-green is 3.33:1 on --tn-alt-bg2 */
148
165
  --tn-font-family-header: "Titillium Web", sans-serif;
149
166
  --tn-font-family-body: "IBM Plex Sans", "Roboto", "Helvetica Neue", sans-serif;
150
167
  --tn-font-family-monospace: "Droid Sans Mono", "Courier New", Courier, monospace;
@@ -219,12 +236,12 @@
219
236
  --tn-teal: #008080;
220
237
  --tn-slategray: #708090;
221
238
  --tn-salmon: #fa8072;
222
- /* Semantic status colours — see the note in :root. On --tn-alt-bg1 /
223
- --tn-bg1 / --tn-bg2. */
224
- --tn-info: #00adf8; /* 4.65:1 / 6.62:1 / 5.85:1 */
225
- --tn-warning: var(--tn-orange); /* 4.60:1 / 6.53:1 / 5.78:1 */
226
- --tn-error: #e78888; /* 4.62:1 / 6.57:1 / 5.81:1 */
227
- --tn-success: var(--tn-green); /* 5.16:1 / 7.33:1 / 6.49:1 */
239
+ /* Semantic status colours — see the note in :root. On --tn-alt-bg2 /
240
+ --tn-alt-bg1 / --tn-bg3 / --tn-bg1 / --tn-bg2. */
241
+ --tn-info: #6fd4ff; /* 4.52:1 / 7.00:1 / 7.54:1 / 9.95:1 / 8.80:1 */
242
+ --tn-warning: #f1bf8e; /* 4.54:1 / 7.03:1 / 7.57:1 / 9.99:1 / 8.83:1 */
243
+ --tn-error: #f1bbbb; /* 4.53:1 / 7.02:1 / 7.56:1 / 9.98:1 / 8.82:1 */
244
+ --tn-success: #a3d686; /* 4.51:1 / 6.99:1 / 7.53:1 / 9.94:1 / 8.79:1 */
228
245
  }
229
246
 
230
247
  /* ================================
@@ -281,12 +298,13 @@
281
298
  --tn-slategray: #708090;
282
299
  --tn-salmon: #fa8072;
283
300
  /* Semantic status colours — see the note in :root. Darkened rather than
284
- lightened, this being a light theme. On --tn-alt-bg1 / --tn-bg1 /
285
- --tn-bg2. */
286
- --tn-info: #006997; /* 5.31:1 / 5.41:1 / 6.06:1 */
287
- --tn-warning: #955313; /* 5.23:1 / 5.32:1 / 5.96:1 */
288
- --tn-error: #bd2626; /* 5.31:1 / 5.41:1 / 6.05:1 */
289
- --tn-success: #416f26; /* 5.23:1 / 5.32:1 / 5.95:1 */
301
+ lightened, this being a light theme; all four already cleared --tn-alt-bg2
302
+ and --tn-bg3 when those joined the row in #361, so none of them moved. On
303
+ --tn-alt-bg2 / --tn-alt-bg1 / --tn-bg3 / --tn-bg1 / --tn-bg2. */
304
+ --tn-info: #006997; /* 4.94:1 / 5.31:1 / 4.94:1 / 5.41:1 / 6.06:1 */
305
+ --tn-warning: #955313; /* 4.86:1 / 5.23:1 / 4.86:1 / 5.32:1 / 5.96:1 */
306
+ --tn-error: #bd2626; /* 4.94:1 / 5.31:1 / 4.94:1 / 5.41:1 / 6.05:1 */
307
+ --tn-success: #416f26; /* 4.86:1 / 5.23:1 / 4.86:1 / 5.32:1 / 5.95:1 */
290
308
  }
291
309
 
292
310
  /* ================================
@@ -337,12 +355,14 @@
337
355
  --tn-teal: #008080;
338
356
  --tn-slategray: #708090;
339
357
  --tn-salmon: #fa8072;
340
- /* Semantic status colours — see the note in :root. On --tn-alt-bg1 /
341
- --tn-bg1 / --tn-bg2. */
342
- --tn-info: #9fa9c8; /* 4.62:1 / 7.40:1 / 6.09:1 */
343
- --tn-warning: var(--tn-orange); /* 6.33:1 / 10.15:1 / 8.36:1 */
344
- --tn-error: #ff8888; /* 4.69:1 / 7.52:1 / 6.19:1 */
345
- --tn-success: var(--tn-green); /* 7.86:1 / 12.60:1 / 10.38:1 */
358
+ /* Semantic status colours — see the note in :root. Dracula's own orange and
359
+ green are bright enough that they still need no shade of their own with
360
+ --tn-alt-bg2 in the row (#361); only info and error moved. On --tn-alt-bg2
361
+ / --tn-alt-bg1 / --tn-bg3 / --tn-bg1 / --tn-bg2. */
362
+ --tn-info: #adb6d0; /* 4.52:1 / 5.33:1 / 5.83:1 / 8.55:1 / 7.04:1 */
363
+ --tn-warning: var(--tn-orange); /* 5.37:1 / 6.33:1 / 6.92:1 / 10.15:1 / 8.36:1 */
364
+ --tn-error: #ff9b9b; /* 4.54:1 / 5.35:1 / 5.85:1 / 8.57:1 / 7.06:1 */
365
+ --tn-success: var(--tn-green); /* 6.67:1 / 7.86:1 / 8.59:1 / 12.60:1 / 10.38:1 */
346
366
  }
347
367
 
348
368
  /* ================================
@@ -408,11 +428,11 @@
408
428
  --tn-salmon: #fa8072;
409
429
  /* Semantic status colours — see the note in :root. This palette's surfaces
410
430
  sit close together, so every one of these is a long shift. On
411
- --tn-alt-bg1 / --tn-bg1 / --tn-bg2. */
412
- --tn-info: #b4c4d8; /* 4.86:1 / 7.03:1 / 5.67:1 */
413
- --tn-warning: #e4b9ab; /* 4.86:1 / 7.03:1 / 5.67:1 */
414
- --tn-error: #e2b8bc; /* 4.85:1 / 7.03:1 / 5.66:1 */
415
- --tn-success: #b4caa1; /* 4.89:1 / 7.08:1 / 5.70:1 */
431
+ --tn-alt-bg2 / --tn-alt-bg1 / --tn-bg3 / --tn-bg1 / --tn-bg2. */
432
+ --tn-info: #beccdd; /* 4.52:1 / 5.29:1 / 5.20:1 / 7.65:1 / 6.17:1 */
433
+ --tn-warning: #e8c3b7; /* 4.54:1 / 5.31:1 / 5.22:1 / 7.68:1 / 6.19:1 */
434
+ --tn-error: #e6c2c5; /* 4.53:1 / 5.29:1 / 5.20:1 / 7.66:1 / 6.17:1 */
435
+ --tn-success: #bdd1ad; /* 4.53:1 / 5.29:1 / 5.20:1 / 7.66:1 / 6.17:1 */
416
436
  }
417
437
 
418
438
  /* ================================
@@ -463,12 +483,13 @@
463
483
  --tn-slategray: #708090;
464
484
  --tn-salmon: #fa8072;
465
485
  /* Semantic status colours — see the note in :root. Darkened rather than
466
- lightened, this being a light theme. On --tn-alt-bg1 / --tn-bg1 /
467
- --tn-bg2. */
468
- --tn-info: var(--tn-blue); /* 6.83:1 / 6.95:1 / 7.46:1 — needs no shade of its own */
469
- --tn-warning: #8e5801; /* 5.20:1 / 5.29:1 / 5.67:1 */
470
- --tn-error: #c4000f; /* 5.49:1 / 5.59:1 / 6.00:1 */
471
- --tn-success: #187232; /* 5.28:1 / 5.37:1 / 5.76:1 */
486
+ lightened, this being a light theme; all four already cleared --tn-alt-bg2
487
+ and --tn-bg3 when those joined the row in #361, so none of them moved. On
488
+ --tn-alt-bg2 / --tn-alt-bg1 / --tn-bg3 / --tn-bg1 / --tn-bg2. */
489
+ --tn-info: var(--tn-blue); /* 6.35:1 / 6.83:1 / 6.35:1 / 6.95:1 / 7.46:1 — needs no shade of its own */
490
+ --tn-warning: #8e5801; /* 4.83:1 / 5.20:1 / 4.83:1 / 5.29:1 / 5.67:1 */
491
+ --tn-error: #c4000f; /* 5.11:1 / 5.49:1 / 5.11:1 / 5.59:1 / 6.00:1 */
492
+ --tn-success: #187232; /* 4.91:1 / 5.28:1 / 4.91:1 / 5.37:1 / 5.76:1 */
472
493
  }
473
494
 
474
495
  /* ================================
@@ -594,12 +615,12 @@
594
615
  --tn-teal: #008080;
595
616
  --tn-slategray: #708090;
596
617
  --tn-salmon: #fa8072;
597
- /* Semantic status colours — see the note in :root. On --tn-alt-bg1 /
598
- --tn-bg1 / --tn-bg2. */
599
- --tn-info: #73b6e6; /* 4.62:1 / 6.84:1 / 5.92:1 */
600
- --tn-warning: #f09b78; /* 4.67:1 / 6.91:1 / 5.98:1 */
601
- --tn-error: #ee9998; /* 4.66:1 / 6.90:1 / 5.97:1 */
602
- --tn-success: #a2ba00; /* 4.62:1 / 6.83:1 / 5.92:1 */
618
+ /* Semantic status colours — see the note in :root. On --tn-alt-bg2 /
619
+ --tn-alt-bg1 / --tn-bg3 / --tn-bg1 / --tn-bg2. */
620
+ --tn-info: #9bcbed; /* 4.51:1 / 5.87:1 / 6.53:1 / 8.69:1 / 7.53:1 */
621
+ --tn-warning: #f4b89f; /* 4.53:1 / 5.89:1 / 6.55:1 / 8.72:1 / 7.55:1 */
622
+ --tn-error: #f3b6b5; /* 4.52:1 / 5.88:1 / 6.54:1 / 8.70:1 / 7.53:1 */
623
+ --tn-success: #b7d200; /* 4.54:1 / 5.91:1 / 6.57:1 / 8.74:1 / 7.57:1 */
603
624
  }
604
625
 
605
626
 
@@ -673,12 +694,13 @@
673
694
  --tn-teal: #008080;
674
695
  --tn-slategray: #708090;
675
696
  --tn-salmon: #fa8072;
676
- /* Semantic status colours — see the note in :root. On --tn-alt-bg1 /
677
- --tn-bg1 / --tn-bg2. */
678
- --tn-info: #79c1f2; /* 4.64:1 / 7.41:1 / 5.68:1 */
679
- --tn-warning: #fda61c; /* 4.61:1 / 7.36:1 / 5.64:1 */
680
- --tn-error: #ff9ea5; /* 4.63:1 / 7.38:1 / 5.66:1 */
681
- --tn-success: #2ed45f; /* 4.63:1 / 7.39:1 / 5.67:1 */
697
+ /* Semantic status colours — see the note in :root. --tn-bg3 and --tn-alt-bg1
698
+ are the same colour here, so their two ratios are too. On --tn-alt-bg2 /
699
+ --tn-alt-bg1 / --tn-bg3 / --tn-bg1 / --tn-bg2. */
700
+ --tn-info: #9bd1f5; /* 4.53:1 / 5.56:1 / 5.56:1 / 8.87:1 / 6.80:1 */
701
+ --tn-warning: #febf5b; /* 4.53:1 / 5.55:1 / 5.55:1 / 8.86:1 / 6.79:1 */
702
+ --tn-error: #ffb8bd; /* 4.54:1 / 5.56:1 / 5.56:1 / 8.87:1 / 6.81:1 */
703
+ --tn-success: #6be18e; /* 4.52:1 / 5.54:1 / 5.54:1 / 8.83:1 / 6.78:1 */
682
704
  }
683
705
 
684
706
  /* ================================
@@ -737,12 +759,15 @@
737
759
  --tn-salmon: #fa8072;
738
760
  /* Semantic status colours — see the note in :root. Darkened rather than
739
761
  lightened, this being a light theme, and further than the other two: the
740
- accessibility theme is the one where a status colour has to hold up. On
741
- --tn-alt-bg1 / --tn-bg1 / --tn-bg2. */
742
- --tn-info: #315c78; /* 6.28:1 / 5.27:1 / 7.16:1 */
743
- --tn-warning: #7c4d01; /* 6.31:1 / 5.30:1 / 7.19:1 */
744
- --tn-error: #ad000d; /* 6.62:1 / 5.56:1 / 7.55:1 */
745
- --tn-success: #296300; /* 6.40:1 / 5.37:1 / 7.29:1 */
762
+ accessibility theme is the one where a status colour has to hold up. All
763
+ four already cleared --tn-alt-bg2 and --tn-bg3 when those joined the row in
764
+ #361, so none of them moved — though --tn-bg3 is this palette's tightest
765
+ surface rather than --tn-alt-bg2, its fill being the darkest of the five.
766
+ On --tn-alt-bg2 / --tn-alt-bg1 / --tn-bg3 / --tn-bg1 / --tn-bg2. */
767
+ --tn-info: #315c78; /* 5.84:1 / 6.28:1 / 4.64:1 / 5.27:1 / 7.16:1 */
768
+ --tn-warning: #7c4d01; /* 5.87:1 / 6.31:1 / 4.66:1 / 5.30:1 / 7.19:1 */
769
+ --tn-error: #ad000d; /* 6.16:1 / 6.62:1 / 4.89:1 / 5.56:1 / 7.55:1 */
770
+ --tn-success: #296300; /* 5.95:1 / 6.40:1 / 4.73:1 / 5.37:1 / 7.29:1 */
746
771
  }
747
772
 
748
773
  /* ================================
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * CLI wrapper that uses tsx to run the TypeScript CLI
5
- * This allows us to distribute TypeScript files without needing to compile them
6
- */
7
-
8
- const { spawn } = require('child_process');
9
- const path = require('path');
10
-
11
- // Get the directory where this script is located
12
- const scriptDir = __dirname;
13
- const cliPath = path.join(scriptDir, 'cli-main.ts');
14
-
15
- // Use npx to run tsx, which will find it in node_modules
16
- const child = spawn('npx', ['tsx', cliPath, ...process.argv.slice(2)], {
17
- stdio: 'inherit',
18
- cwd: process.cwd(),
19
- shell: process.platform === 'win32'
20
- });
21
-
22
- child.on('exit', (code) => {
23
- process.exit(code || 0);
24
- });
25
-
26
- child.on('error', (err) => {
27
- console.error('Failed to start tsx:', err.message);
28
- console.error('Make sure tsx is installed as a dependency of truenas-ui.');
29
- process.exit(1);
30
- });