@whydrf/nava-icon-angular 1.1.2 → 1.4.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/README.md +52 -4
- package/dist/chunk-6LC2NS7W.js +7 -0
- package/dist/config.cjs +31 -0
- package/dist/config.d.cts +6 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.js +7 -0
- package/dist/index.cjs +3822 -3815
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +248 -243
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/whydrf/nava-icon/main/docs/public/favicon.svg" width="60" alt="Nava Icons">
|
|
3
|
-
</p>
|
|
4
1
|
|
|
5
2
|
<h1 align="center">@whydrf/nava-icon-angular</h1>
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://vahidghadiri.github.io/Nava-icon/">
|
|
5
|
+
Live Documentation
|
|
6
|
+
</a>
|
|
7
|
+
</p>
|
|
6
8
|
|
|
7
9
|
<p align="center">
|
|
8
10
|
950+ beautiful, tree-shakeable SVG icons for Angular 17+.
|
|
@@ -53,7 +55,7 @@ import { HomeIconComponent, SearchIconComponent, SettingsIconComponent } from '@
|
|
|
53
55
|
export class NavigationComponent {}
|
|
54
56
|
```
|
|
55
57
|
|
|
56
|
-
That's it — no `NavaIconsModule`, no global registration. The component's selector is the kebab-case version of the icon name (e.g., `HomeIconComponent` → `<home-icon>`).
|
|
58
|
+
That's it — no `NavaIconsModule`, no global registration. The component's selector is the kebab-case version of the icon name (e.g., `HomeIconComponent` → `<home-icon>`). For setting default inputs across your app, see [Global Configuration](#global-configuration).
|
|
57
59
|
|
|
58
60
|
## How Tree Shaking Works
|
|
59
61
|
|
|
@@ -207,6 +209,52 @@ Icons include built-in accessibility features:
|
|
|
207
209
|
<home-icon />
|
|
208
210
|
```
|
|
209
211
|
|
|
212
|
+
## Global Configuration
|
|
213
|
+
|
|
214
|
+
Instead of passing the same inputs to every icon, provide a global configuration using Angular's Dependency Injection. All `IconComponent` and static icon components will inherit these values.
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
// app.config.ts
|
|
218
|
+
import { ApplicationConfig } from '@angular/core'
|
|
219
|
+
import { NAVA_ICON_CONFIG } from '@whydrf/nava-icon-angular'
|
|
220
|
+
|
|
221
|
+
export const appConfig: ApplicationConfig = {
|
|
222
|
+
providers: [
|
|
223
|
+
{
|
|
224
|
+
provide: NAVA_ICON_CONFIG,
|
|
225
|
+
useValue: { size: 20, color: 'gray', strokeWidth: 1.5 },
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Or in a module-based app:
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
// app.module.ts
|
|
235
|
+
import { NgModule } from '@angular/core'
|
|
236
|
+
import { NAVA_ICON_CONFIG } from '@whydrf/nava-icon-angular'
|
|
237
|
+
|
|
238
|
+
@NgModule({
|
|
239
|
+
providers: [
|
|
240
|
+
{
|
|
241
|
+
provide: NAVA_ICON_CONFIG,
|
|
242
|
+
useValue: { size: 20, color: 'gray', strokeWidth: 1.5 },
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
})
|
|
246
|
+
export class AppModule {}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Now every icon inherits the defaults:
|
|
250
|
+
|
|
251
|
+
```html
|
|
252
|
+
<home-icon /> <!-- size=20, color="gray", strokeWidth=1.5 -->
|
|
253
|
+
<search-icon [size]="24" /> <!-- size=24 overrides — rest inherited -->
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Inputs always override global configuration.** If you pass `[size]="32"` to an icon, that takes priority over the injected `size`.
|
|
257
|
+
|
|
210
258
|
## Server-Side Rendering
|
|
211
259
|
|
|
212
260
|
Nava Icons works with Angular SSR and hydration out of the box. Icons are rendered as regular HTML/SNG elements — no client-side JavaScript required to display them.
|
package/dist/config.cjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/config.ts
|
|
21
|
+
var config_exports = {};
|
|
22
|
+
__export(config_exports, {
|
|
23
|
+
NAVA_ICON_CONFIG: () => NAVA_ICON_CONFIG
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(config_exports);
|
|
26
|
+
var import_core = require("@angular/core");
|
|
27
|
+
var NAVA_ICON_CONFIG = new import_core.InjectionToken("NAVA_ICON_CONFIG");
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
NAVA_ICON_CONFIG
|
|
31
|
+
});
|
package/dist/config.d.ts
ADDED