@whydrf/nava-icon-web-components 1.1.0 → 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 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-web-components</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 as native Web Components.
@@ -10,7 +12,7 @@
10
12
 
11
13
  <p align="center">
12
14
  <a href="https://www.npmjs.com/package/@whydrf/nava-icon-web-components"><img src="https://img.shields.io/npm/v/@whydrf/nava-icon-web-components?style=flat-square&color=purple" alt="npm version"></a>
13
- <a href="https://github.com/whydrf/nava-icon/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@whydrf/nava-icon-web-components?style=flat-square" alt="license"></a>
15
+ <a href="https://github.com/vahidGhadiri/nava-icon/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@whydrf/nava-icon-web-components?style=flat-square" alt="license"></a>
14
16
  <a href="https://www.npmjs.com/package/@whydrf/nava-icon-web-components"><img src="https://img.shields.io/npm/dm/@whydrf/nava-icon-web-components?style=flat-square&color=purple" alt="npm downloads"></a>
15
17
  </p>
16
18
 
@@ -18,7 +20,7 @@
18
20
 
19
21
  ## What is this?
20
22
 
21
- `@whydrf/nava-icon-web-components` is the framework-agnostic binding for [Nava Icons](https://github.com/whydrf/nava-icon) — a collection of 950+ handcrafted SVG icons. Each icon is a native Web Component using the Custom Elements API, so it works everywhere: vanilla HTML, React, Vue, Angular, Svelte, Solid, Lit — any framework that can render HTML.
23
+ `@whydrf/nava-icon-web-components` is the framework-agnostic binding for [Nava Icons](https://vahidghadiri.github.io/Nava-icon/) — a collection of 950+ handcrafted SVG icons. Each icon is a native Web Component using the Custom Elements API, so it works everywhere: vanilla HTML, React, Vue, Angular, Svelte, Solid, Lit — any framework that can render HTML.
22
24
 
23
25
  Unlike icon fonts or SVG sprites, every icon here is a proper Custom Element with Shadow DOM encapsulation. You use it in your markup exactly like any native HTML element — no framework, no build step, no configuration.
24
26
 
@@ -52,6 +54,33 @@ Once imported, every icon becomes available as a custom element. Icons follow th
52
54
 
53
55
  That's it — no framework, no components to import, no configuration. Just HTML.
54
56
 
57
+ ## Global Configuration
58
+
59
+ You can set default icon properties globally using `setNavaIconConfig`. All icons will use these defaults unless overridden by individual attributes.
60
+
61
+ ```html
62
+ <script type="module">
63
+ import '@whydrf/nava-icon-web-components'
64
+ import { setNavaIconConfig } from '@whydrf/nava-icon-web-components'
65
+
66
+ // Set global defaults
67
+ setNavaIconConfig({ size: 20, color: 'gray', strokeWidth: 1.5 })
68
+ </script>
69
+
70
+ <!-- All icons inherit global defaults -->
71
+ <nava-icon-home></nava-icon-home> <!-- size=20, color="gray" -->
72
+ <nava-icon-search size="24"></nava-icon-search> <!-- size=24 overrides — rest inherited -->
73
+ ```
74
+
75
+ **Attributes always override global configuration.** If you pass `size="32"` on an element, that takes priority over the global `size`.
76
+
77
+ You can read the current configuration at any time:
78
+
79
+ ```js
80
+ import { getNavaIconConfig } from '@whydrf/nava-icon-web-components'
81
+ console.log(getNavaIconConfig()) // { size: 20, color: 'gray', strokeWidth: 1.5 }
82
+ ```
83
+
55
84
  ## How Tree Shaking Works
56
85
 
57
86
  When you import the package in a `<script type="module">`, only the icons actually used in your HTML are included in the final bundle. The build tool (Vite, Rollup, webpack, esbuild) traces which custom elements are referenced and eliminates the rest.
@@ -164,7 +193,7 @@ You can theme icons using CSS custom properties that inherit through the Shadow
164
193
  | **Weather** | `sun`, `moon`, `cloud`, `droplet`, `wind`, `umbrella` |
165
194
  | **Shopping** | `cart`, `credit-card`, `bag`, `tag`, `badge`, `diamond` |
166
195
 
167
- Browse all 950+ icons with live preview at [**Nava Icons Docs**](https://vahidghadiri.github.io/Nava-icon/).
196
+ Browse all 950+ icons with live preview at **[https://vahidghadiri.github.io/Nava-icon/](https://vahidghadiri.github.io/Nava-icon/)**.
168
197
 
169
198
  ## Accessibility
170
199
 
@@ -306,4 +335,4 @@ Each icon is registered as a custom element with the prefix `nava-icon-` followe
306
335
 
307
336
  ## License
308
337
 
309
- [MIT](https://github.com/whydrf/nava-icon/blob/main/LICENSE) &copy; [whydrf](https://github.com/whydrf)
338
+ [MIT](https://github.com/vahidGhadiri/nava-icon/blob/main/LICENSE) &copy; [whydrf](https://github.com/whydrf)
@@ -0,0 +1,13 @@
1
+ // src/config.ts
2
+ var globalConfig = {};
3
+ function setNavaIconConfig(config) {
4
+ globalConfig = { ...globalConfig, ...config };
5
+ }
6
+ function getNavaIconConfig() {
7
+ return { ...globalConfig };
8
+ }
9
+
10
+ export {
11
+ setNavaIconConfig,
12
+ getNavaIconConfig
13
+ };
@@ -0,0 +1,7 @@
1
+ import { NavaIconConfig } from '@whydrf/nava-icon-core';
2
+ export { NavaIconConfig } from '@whydrf/nava-icon-core';
3
+
4
+ declare function setNavaIconConfig(config: NavaIconConfig): void;
5
+ declare function getNavaIconConfig(): NavaIconConfig;
6
+
7
+ export { getNavaIconConfig, setNavaIconConfig };
package/dist/config.js ADDED
@@ -0,0 +1,8 @@
1
+ import {
2
+ getNavaIconConfig,
3
+ setNavaIconConfig
4
+ } from "./chunk-6PLL5KGQ.js";
5
+ export {
6
+ getNavaIconConfig,
7
+ setNavaIconConfig
8
+ };