@ndwnu/design-system 13.2.0 → 14.0.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/fesm2022/ndwnu-design-system.mjs +66 -39
- package/fesm2022/ndwnu-design-system.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/FONTS.md +46 -0
- package/styles/base/_fonts.scss +13 -0
- package/styles/base/_typography.scss +0 -6
- package/styles/base/_variables.scss +2 -2
- package/styles/base/index.scss +1 -0
- package/styles/components/_input.scss +16 -1
- package/types/ndwnu-design-system.d.ts +6 -1
package/package.json
CHANGED
package/styles/FONTS.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Fonts
|
|
2
|
+
|
|
3
|
+
The design system self-hosts its fonts via [Fontsource](https://fontsource.org/) instead of loading them from the Google Fonts CDN. This avoids a runtime dependency on `fonts.googleapis.com` / `fonts.gstatic.com`.
|
|
4
|
+
|
|
5
|
+
## Fonts in use
|
|
6
|
+
|
|
7
|
+
| Family | Used for | Fontsource package |
|
|
8
|
+
| --------------------------------- | -------------------------------------- | ----------------------------------------------- |
|
|
9
|
+
| DM Sans Variable | Headings (`--ndw-font-family-heading`) | `@fontsource-variable/dm-sans` |
|
|
10
|
+
| Nunito Sans Variable | Body text (`--ndw-font-family-body`) | `@fontsource-variable/nunito-sans` |
|
|
11
|
+
| Material Symbols Rounded Variable | Icons (`<ndw-icon>`) | `@fontsource-variable/material-symbols-rounded` |
|
|
12
|
+
|
|
13
|
+
These three packages are declared as **peer dependencies** of `@ndwnu/design-system`. Consuming apps install them alongside the design system:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @fontsource-variable/dm-sans @fontsource-variable/nunito-sans @fontsource-variable/material-symbols-rounded
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## How they are loaded
|
|
20
|
+
|
|
21
|
+
The `@font-face` declarations live in [`base/_fonts.scss`](./base/_fonts.scss), which is `@forward`ed from [`base/index.scss`](./base/index.scss). `base/index.scss` is pulled in by the global stylesheet entry [`index.scss`](./index.scss), which apps include in their `angular.json`:
|
|
22
|
+
|
|
23
|
+
```jsonc
|
|
24
|
+
// angular.json > projects > your-app > architect > build > options > styles
|
|
25
|
+
"styles": [
|
|
26
|
+
"./node_modules/@ndwnu/design-system/styles/index.scss"
|
|
27
|
+
]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Component-scoped SCSS files only `@use 'base/typography'` (mixins and classes). They never pull in `_fonts.scss`, which keeps `@font-face` declarations out of every component bundle and prevents ng-packagr from inlining megabytes of font CSS per component.
|
|
31
|
+
|
|
32
|
+
## Subset selection
|
|
33
|
+
|
|
34
|
+
Each Fontsource package exposes several CSS entrypoints with different axis combinations. We pick the smallest subset that covers actual usage:
|
|
35
|
+
|
|
36
|
+
| Family | Entrypoint used | Axes | Notes |
|
|
37
|
+
| ------------------------ | ------------------------------ | -------------- | ------------------------------------------------------------------------------------- |
|
|
38
|
+
| DM Sans | `opsz.css` + `opsz-italic.css` | `opsz`, `wght` | Matches the Google URL the project used previously (`opsz 9..40`, `wght 400..650`). |
|
|
39
|
+
| Nunito Sans | `opsz.css` + `opsz-italic.css` | `opsz`, `wght` | Matches the previous Google URL (`opsz 6..12`, `wght 400..650`). |
|
|
40
|
+
| Material Symbols Rounded | `fill.css` | `wght`, `FILL` | We only toggle `FILL` (see below). Choosing `fill.css` over `full.css` saves ~3.7 MB. |
|
|
41
|
+
|
|
42
|
+
The icon component sets `font-variation-settings: 'FILL' 1;` in [`icon.component.scss`](../lib/components/icon/icon.component.scss) to switch between outlined and filled icons. We do not vary the `opsz` or `GRAD` axes for icons, so `fill.css` (≈1.4 MB) is sufficient. If a future feature needs those axes, switch the import to `full.css` (≈5.1 MB) — the tradeoff is bundle size.
|
|
43
|
+
|
|
44
|
+
## Material Symbols Rounded class
|
|
45
|
+
|
|
46
|
+
Google's hosted CSS provides a `.material-symbols-rounded` class that pairs the font-family with `font-feature-settings: 'liga'` (so glyph name → ligature → icon works). Fontsource does not, so [`_fonts.scss`](./base/_fonts.scss) defines the equivalent rule locally. The `<ndw-icon>` component applies this class via its host binding.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@import '@fontsource-variable/dm-sans/opsz.css';
|
|
2
|
+
@import '@fontsource-variable/dm-sans/opsz-italic.css';
|
|
3
|
+
@import '@fontsource-variable/nunito-sans/opsz.css';
|
|
4
|
+
@import '@fontsource-variable/nunito-sans/opsz-italic.css';
|
|
5
|
+
@import '@fontsource-variable/material-symbols-rounded/fill.css';
|
|
6
|
+
|
|
7
|
+
.material-symbols-rounded {
|
|
8
|
+
font-family: 'Material Symbols Rounded Variable', sans-serif;
|
|
9
|
+
font-feature-settings: 'liga';
|
|
10
|
+
font-style: normal;
|
|
11
|
+
font-weight: normal;
|
|
12
|
+
line-height: 1;
|
|
13
|
+
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
@import url('https://fonts.googleapis.com/css2\
|
|
2
|
-
?family=DM+Sans:ital,opsz,wght@0,9..40,400..650;1,9..40,400..650\
|
|
3
|
-
&family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,400,0..1\
|
|
4
|
-
&family=Nunito+Sans:ital,opsz,wght@0,6..12,400..650;1,6..12,400..650\
|
|
5
|
-
&display=block');
|
|
6
|
-
|
|
7
1
|
/* Mixins */
|
|
8
2
|
@mixin ndw-heading-xl {
|
|
9
3
|
font-family: var(--ndw-font-family-heading);
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
|
|
52
52
|
/* Typography */
|
|
53
53
|
// Font Family
|
|
54
|
-
--ndw-font-family-body: 'Nunito Sans', sans-serif;
|
|
55
|
-
--ndw-font-family-heading: 'DM Sans', sans-serif;
|
|
54
|
+
--ndw-font-family-body: 'Nunito Sans Variable', sans-serif;
|
|
55
|
+
--ndw-font-family-heading: 'DM Sans Variable', sans-serif;
|
|
56
56
|
|
|
57
57
|
// Font Size
|
|
58
58
|
--ndw-base-font-size: 16px;
|
package/styles/base/index.scss
CHANGED
|
@@ -71,14 +71,29 @@
|
|
|
71
71
|
background-color: var(--ndw-color-grey-100);
|
|
72
72
|
border-color: var(--ndw-color-grey-300);
|
|
73
73
|
color: var(--ndw-color-grey-500);
|
|
74
|
-
|
|
74
|
+
cursor: default;
|
|
75
|
+
|
|
76
|
+
&:hover,
|
|
77
|
+
&:has([ndwInput]:hover) {
|
|
78
|
+
border-color: var(--ndw-color-grey-300);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&:has([ndwInput]:active),
|
|
82
|
+
&:has([ndwInput]:focus),
|
|
83
|
+
&:has([ndwInput]:focus-visible) {
|
|
84
|
+
border-color: var(--ndw-color-grey-300);
|
|
85
|
+
box-shadow: none;
|
|
86
|
+
outline-color: transparent;
|
|
87
|
+
}
|
|
75
88
|
|
|
76
89
|
[ndwInput] {
|
|
77
90
|
background-color: var(--ndw-color-grey-100);
|
|
91
|
+
user-select: text;
|
|
78
92
|
}
|
|
79
93
|
|
|
80
94
|
ndw-icon {
|
|
81
95
|
color: var(--ndw-color-grey-500);
|
|
96
|
+
pointer-events: none;
|
|
82
97
|
}
|
|
83
98
|
}
|
|
84
99
|
}
|
|
@@ -990,6 +990,7 @@ declare class LanguageSwitcherComponent {
|
|
|
990
990
|
|
|
991
991
|
interface SubMenuItem {
|
|
992
992
|
label: string;
|
|
993
|
+
icon?: string;
|
|
993
994
|
active?: boolean;
|
|
994
995
|
callback?: () => void;
|
|
995
996
|
notifications?: number;
|
|
@@ -997,7 +998,6 @@ interface SubMenuItem {
|
|
|
997
998
|
queryParams?: Params;
|
|
998
999
|
}
|
|
999
1000
|
interface MenuItem extends SubMenuItem {
|
|
1000
|
-
icon: string;
|
|
1001
1001
|
children?: SubMenuItem[];
|
|
1002
1002
|
}
|
|
1003
1003
|
type Theme = 'ndw' | 'nwb';
|
|
@@ -1588,12 +1588,17 @@ declare class TooltipDirective implements OnChanges, OnDestroy, OnInit {
|
|
|
1588
1588
|
private readonly ariaDescriber;
|
|
1589
1589
|
text: _angular_core.InputSignal<string>;
|
|
1590
1590
|
private overlayRef;
|
|
1591
|
+
private tooltipRef;
|
|
1592
|
+
private isMouseOverTooltip;
|
|
1591
1593
|
ngOnInit(): void;
|
|
1592
1594
|
ngOnChanges(): void;
|
|
1593
1595
|
ngOnDestroy(): void;
|
|
1594
1596
|
protected show(): void;
|
|
1597
|
+
protected hideFromTrigger(): void;
|
|
1595
1598
|
protected hide(): void;
|
|
1596
1599
|
protected hideOnEscape(): void;
|
|
1600
|
+
private readonly onTooltipMouseEnter;
|
|
1601
|
+
private readonly onTooltipMouseLeave;
|
|
1597
1602
|
private updateAriaDescription;
|
|
1598
1603
|
private getFlexibleConnectedPositionStrategy;
|
|
1599
1604
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TooltipDirective, never>;
|