@tectra-ng/icons 0.2.6 → 0.3.1

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 CHANGED
@@ -32,7 +32,19 @@
32
32
  <tx-icon [name]="'trash'" />
33
33
  ```
34
34
 
35
- `TX_ICONS` is generated by `tools/icons/build-icons.mjs` from `tools/icons/defs/*.mjs` — edit the definitions there, never `icons.ts`.
35
+ ## Register the icons
36
+
37
+ Components of the kit bring the icons they draw themselves. The names your own templates use are registered once in `app.config.ts` — the whole set, or only what the app needs, so the rest stays out of the bundle (every icon is its own constant, `txIcon` + the name in PascalCase):
38
+
39
+ ```ts
40
+ provideTxIcons(TX_ICONS);
41
+
42
+ provideTxIcons({ plus: txIconPlus, trash: txIconTrash });
43
+ ```
44
+
45
+ A name nobody registered draws nothing; in development the console says which name is missing. Icons you register replace the built-in ones of the components with the same name.
46
+
47
+ `TX_ICONS` and the `txIcon…` constants are generated by `tools/icons/build-icons.mjs` from `tools/icons/defs/*.mjs` — edit the definitions there, never `icons.ts`. The icons each entry point of the kit draws are listed in its generated `<name>.icons.ts` (`npm run icons:defaults`; CI fails when a list is out of date) and given to its components with `provideTxIconDefaults`.
36
48
 
37
49
  ## Inputs
38
50
  | Name | Description |
@@ -46,7 +58,7 @@
46
58
  provideTxIcons({ 'my-logo': [{ d: 'M…', fill: true, stroke: false }] })
47
59
  ```
48
60
 
49
- `TxIconRegistry` (`register`, `get`, `has`) is the registry itself.
61
+ `TxIconRegistry` (`register`, `get`, `has`) is the registry of the app; `injectTxIcons()` looks a name up in it and in the defaults of the surrounding component.
50
62
 
51
63
  ## Design tokens
52
64
  | Token | Description |