Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
"exports": {
"./index.css": {
"default": "./index.css"
},
"./index-without-icons.css": {
"default": "./index-without-icons.css"
},
"./icons/*.css": {
"default": "./icons/*.css"
}
},
"scripts": {
"prepare": "husky",
"start": "ng run angular-components:storybook",
"build": "ng build angular-components --configuration production && sass --load-path=node_modules src/styles/index.scss dist/index.css --style=compressed --no-source-map && replace-in-file //fonts//g \"./fonts/\" dist/index.css --isRegex && mkdir -p dist/fonts && cp -a node_modules/@tedi-design-system/core/fonts/* dist/fonts/",
"build": "ng build angular-components --configuration production && sass --load-path=node_modules src/styles/index.scss:dist/index.css src/styles/index-without-icons.scss:dist/index-without-icons.css --style=compressed --no-source-map && replace-in-file //fonts//g \"./fonts/\" dist/index.css dist/index-without-icons.css --isRegex && mkdir -p dist/fonts dist/icons && cp -a node_modules/@tedi-design-system/core/fonts/* dist/fonts/ && cp node_modules/@tedi-design-system/core/icons/*.css dist/icons/",
"build:sb": "ng run angular-components:build-storybook && replace-in-file //fonts//g \"./fonts/\" \"dist/storybook-static/*.css\" --isRegex",
"build:sb:chromatic": "ng run angular-components:build-storybook",
"lint": "stylelint \"src/tedi/**/*.scss\" --fix && ng lint angular-components --fix",
Expand Down Expand Up @@ -44,7 +50,7 @@
},
"dependencies": {
"@tanstack/angular-table": "^8.21.4",
"@tedi-design-system/core": "^6.9.0"
"@tedi-design-system/core": "6.11.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "20.3.27",
Expand Down
34 changes: 34 additions & 0 deletions src/docs/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,37 @@ export const appConfig: ApplicationConfig = {
],
};
```

---

# Icon fonts

`tedi-icon` renders [Material Symbols](https://fonts.google.com/icons) in three styles (`outlined`,
`rounded`, `sharp`), each a separate font file of roughly 350–430 KB. `index.css` declares all
three, so every style stays available. Use **one icon style** throughout your application and load
only that font:

```json
"styles": [
"node_modules/@tedi-design-system/angular/index-without-icons.css",
"node_modules/@tedi-design-system/angular/icons/outlined.css"
]
```

Each stylesheet loads one font file:

- `@tedi-design-system/angular/icons/outlined.css`: `material-symbols-outlined.woff2`
- `@tedi-design-system/angular/icons/rounded.css`: `material-symbols-rounded.woff2`
- `@tedi-design-system/angular/icons/sharp.css`: `material-symbols-sharp.woff2`
- `@tedi-design-system/angular/icons/all.css`: all three

A `tedi-icon` whose `type` has no loaded style renders its ligature text instead of the glyph.

Browsers only download an icon font once a glyph uses it, so in a regular web app the unused styles
cost nothing at runtime. In a **PWA**, a service worker that precaches fonts caches all three,
including ones your CSS never references. The default `ngsw-config.json` puts fonts in a `lazy`
asset group, which only caches what the app requests. If you prefetch fonts, or use Workbox, exclude
the unused styles, for example `globIgnores: ['**/material-symbols-{rounded,sharp}.woff2']`.

See the [core icons guide](https://github.com/TEDI-Design-System/core/blob/rc/docs/icons.md) for
SCSS usage and custom font paths.
8 changes: 7 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"exports": {
"./index.css": {
"default": "./index.css"
},
"./index-without-icons.css": {
"default": "./index-without-icons.css"
},
"./icons/*.css": {
"default": "./icons/*.css"
}
},
"peerDependencies": {
Expand All @@ -28,7 +34,7 @@
},
"dependencies": {
"@tanstack/angular-table": "^8.21.4",
"@tedi-design-system/core": "^6.8.1"
"@tedi-design-system/core": "6.11.2"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
},
"publishConfig": {
"access": "public"
Expand Down
5 changes: 5 additions & 0 deletions src/styles/index-without-icons.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// index.scss without the Material Symbols icon fonts. Pair with one of the icons/<style>.css
// entries to load a single icon font instead of all three. See angular#774.
@use "@tedi-design-system/core/index-without-icons";
@use "vertical-spacing";
@use "cdk";
3 changes: 2 additions & 1 deletion src/tedi/components/base/icon/icon.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export class IconComponent {
variant = input<IconVariant>("outlined");
/**
* Type of Material Symbols icon style.
* It is recommended to only use one type throughout your app.
* It is recommended to only use one type throughout your app, and to load only that type's font
* (`icons/<type>.css` with `index-without-icons.css`) instead of all three via `index.css`.
* @default outlined
*/
type = input<IconType>("outlined");
Expand Down
6 changes: 5 additions & 1 deletion src/tedi/components/base/icon/icon.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ const BACKGROUNDS = [
* <a href="https://www.tedi.ee/1ee8444b7/p/28835d-icon" target="_BLANK">Zeroheight ↗</a><hr/>
* <a href="https://fonts.google.com/icons?icon.set=Material+Icons" target="_BLANK">Official Google Material Icons homepage icons ↗</a><br/>
* <a href="https://www.figma.com/community/file/1014241558898418245/material-design-icons?searchSessionId=lvxhc4l5-a6 target="_BLANK">Material Icons Figma ↗</a><br/>
* <a href="https://www.figma.com/community/plugin/740272380439725040/material-design-icons" target="_BLANK">Figma Material Symbols plugin ↗</a>
* <a href="https://www.figma.com/community/plugin/740272380439725040/material-design-icons" target="_BLANK">Figma Material Symbols plugin ↗</a><hr/>
*
* Use a single icon `type` throughout your application. Each type is a separate font file, so add
* `index-without-icons.css` together with only the style you use (e.g. `icons/outlined.css`) to your styles instead of
* `index.css`. See [Get started](/docs/documentation-get-started--get-started) for details and the PWA precache note.
*/

export default {
Expand Down
Loading