viconic-react-icons 1.0.7 â 1.1.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 +60 -11
- package/dist/index.js +59 -11
- package/dist/index.mjs +57 -10
- package/index.d.ts +20 -4
- package/package.json +33 -30
- package/src/copyicons-smart-loader.js +2148 -2132
- package/src/index.jsx +85 -3
package/README.md
CHANGED
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|

|
|
4
4
|

|
|
5
5
|
|
|
6
|
-
The official React component wrapper for [Viconic](https://viconic.
|
|
6
|
+
The official React component wrapper for [Viconic](https://viconic.dev), a modern, hyper-fast, CDN-powered icon system.
|
|
7
7
|
|
|
8
8
|
`viconic-react-icons` gives you access to over 200,000+ open-source, pixel-perfect icons grouped in customizable collections. The icons are loaded dynamically from our Smart CDN at runtime, meaning your React bundle stays incredibly lightweight regardless of how many icons you use.
|
|
9
9
|
|
|
10
10
|
## Highlights
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
11
|
+
- ðŠķ **Zero-Bundle Bloat**: SVGs are fetched magically via our CDN and injected directly into the DOM.
|
|
12
|
+
- ðĻ **Fully Customizable**: Compatible with Tailwind CSS and standard inline styles. Inherits color natively via `currentColor`.
|
|
13
|
+
- ⥠**Smart Caching**: LocalStorage and Memory caching so icons appear instantly on repeated renders.
|
|
14
|
+
- ð§ **Kit Support**: Use your custom icon kit with `initViconic()` â supports multiple kits.
|
|
15
|
+
- ðĨïļ **SSR Ready**: Fully supports Next.js, Vite, and other Server-Side Rendering frameworks.
|
|
16
|
+
- ð **TypeScript Support**: Includes built-in types for easy autocompletion.
|
|
16
17
|
|
|
17
18
|
## Installation
|
|
18
19
|
|
|
@@ -24,9 +25,9 @@ yarn add viconic-react-icons
|
|
|
24
25
|
pnpm add viconic-react-icons
|
|
25
26
|
```
|
|
26
27
|
|
|
27
|
-
## Quick Start
|
|
28
|
+
## Quick Start â System Icons
|
|
28
29
|
|
|
29
|
-
Import the `ViconicIcon` component and pass the unique `name` identifier corresponding to your icon of choice from [viconic.
|
|
30
|
+
Import the `ViconicIcon` component and pass the unique `name` identifier corresponding to your icon of choice from [viconic.dev](https://viconic.dev).
|
|
30
31
|
|
|
31
32
|
```jsx
|
|
32
33
|
import { ViconicIcon } from "viconic-react-icons";
|
|
@@ -45,26 +46,74 @@ function App() {
|
|
|
45
46
|
</div>
|
|
46
47
|
);
|
|
47
48
|
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Quick Start â Custom Kit
|
|
52
|
+
|
|
53
|
+
Use icons from your own kit created at [viconic.dev](https://viconic.dev):
|
|
54
|
+
|
|
55
|
+
```jsx
|
|
56
|
+
import { initViconic, ViconicIcon } from "viconic-react-icons";
|
|
57
|
+
|
|
58
|
+
// Initialize your kit â call once at app startup (e.g., in main.jsx or App.jsx)
|
|
59
|
+
initViconic({ kitId: "your-kit-uuid-here" });
|
|
60
|
+
|
|
61
|
+
// You can load multiple kits!
|
|
62
|
+
initViconic({ kitId: "another-kit-uuid" });
|
|
48
63
|
|
|
49
|
-
|
|
64
|
+
function App() {
|
|
65
|
+
return (
|
|
66
|
+
<div style={{ display: "flex", gap: "10px" }}>
|
|
67
|
+
{/* Kit icon using @prefix/name format */}
|
|
68
|
+
<ViconicIcon name="@myprefix/home" />
|
|
69
|
+
|
|
70
|
+
{/* Kit icon using prefix:name format (also works) */}
|
|
71
|
+
<ViconicIcon name="myprefix:settings" />
|
|
72
|
+
|
|
73
|
+
{/* Mix kit icons with system icons */}
|
|
74
|
+
<ViconicIcon name="lucide:star" />
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
50
78
|
```
|
|
51
79
|
|
|
52
80
|
## Props
|
|
53
81
|
|
|
54
82
|
| Prop | Type | Default | Description |
|
|
55
83
|
| ---- | ---- | ------- | ----------- |
|
|
56
|
-
| `name` | `string` | `undefined` | **Required.** The unique icon ID (e.g. `lucide:activity`, `
|
|
84
|
+
| `name` | `string` | `undefined` | **Required.** The unique icon ID (e.g. `lucide:activity`, `@prefix/name`). |
|
|
85
|
+
| `size` | `string \| number` | `undefined` | Icon size as CSS value (e.g. `"24px"`, `"2rem"`). |
|
|
86
|
+
| `color` | `string` | `undefined` | Icon color as CSS value (e.g. `"red"`, `"#333"`). |
|
|
57
87
|
| `className` | `string` | `""` | Standard CSS class names (great for Tailwind). |
|
|
58
88
|
| `style` | `React.CSSProperties` | `{}` | Inline CSS styling. |
|
|
59
89
|
| `...props` | `HTMLAttributes` | | Spread standard HTML attributes (e.g. `onClick`, `title`). |
|
|
60
90
|
|
|
91
|
+
## API
|
|
92
|
+
|
|
93
|
+
### `initViconic(options)`
|
|
94
|
+
|
|
95
|
+
Inject a kit's loader script into `<head>`. Call once per kit at app startup.
|
|
96
|
+
|
|
97
|
+
| Option | Type | Default | Description |
|
|
98
|
+
| ------ | ---- | ------- | ----------- |
|
|
99
|
+
| `kitId` | `string` | â | **Required.** UUID of your Viconic Kit. |
|
|
100
|
+
| `cdnBase` | `string` | `"cdn.viconic.dev"` | Custom CDN domain. |
|
|
101
|
+
|
|
102
|
+
```jsx
|
|
103
|
+
// In your main.jsx or App.jsx
|
|
104
|
+
import { initViconic } from "viconic-react-icons";
|
|
105
|
+
|
|
106
|
+
initViconic({ kitId: "387a6161-cb39-411f-8f13-29a5813e4efd" });
|
|
107
|
+
```
|
|
108
|
+
|
|
61
109
|
## Architecture
|
|
62
110
|
|
|
63
111
|
This package is a React wrapper around `<viconic-icon>` Web Components. The included `copyicons-smart-loader.js` script dynamically monitors the DOM using a `MutationObserver` and rapidly replaces `<viconic-icon>` elements with actual raw `<svg>` code.
|
|
64
112
|
|
|
113
|
+
When using kits, `initViconic()` injects the kit's loader.js from CDN, which fetches your kit's icon map and SVGs in parallel.
|
|
114
|
+
|
|
65
115
|
Because we fetch SVGs in parallel and cache them across user sessions, your frontend performance score will skyrocket compared to packing large icon sets directly into your JS chunks.
|
|
66
116
|
|
|
67
117
|
## License
|
|
68
118
|
|
|
69
119
|
This project is licensed under the MIT License. Icon licenses depend on the specific icon families you request.
|
|
70
|
-
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var index_exports = {};
|
|
31
31
|
__export(index_exports, {
|
|
32
32
|
ViconicIcon: () => ViconicIcon,
|
|
33
|
-
default: () => index_default
|
|
33
|
+
default: () => index_default,
|
|
34
|
+
initViconic: () => initViconic
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(index_exports);
|
|
36
37
|
var import_react = __toESM(require("react"));
|
|
@@ -219,10 +220,10 @@ var import_react = __toESM(require("react"));
|
|
|
219
220
|
}
|
|
220
221
|
const currentScript = document.currentScript;
|
|
221
222
|
const config = {
|
|
222
|
-
apiBase: (((_a = window.CONFIG) == null ? void 0 : _a.API_BASE) || ((_b = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _b.apiBase) || "https://api.viconic.
|
|
223
|
+
apiBase: (((_a = window.CONFIG) == null ? void 0 : _a.API_BASE) || ((_b = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _b.apiBase) || "https://api.viconic.dev").replace(/\/$/, ""),
|
|
223
224
|
// Batch API for Iconify-style loading (by-prefix endpoint)
|
|
224
|
-
batchApiBase: (((_c = window.CONFIG) == null ? void 0 : _c.BATCH_API_BASE) || ((_d = window.CONFIG) == null ? void 0 : _d.API_BASE) || ((_e = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _e.batchApiBase) || "https://api.viconic.
|
|
225
|
-
cdnDomain: ((_f = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _f.cdnDomain) || ((_g = window.CONFIG) == null ? void 0 : _g.CDN_DOMAIN) || "cdn.viconic.
|
|
225
|
+
batchApiBase: (((_c = window.CONFIG) == null ? void 0 : _c.BATCH_API_BASE) || ((_d = window.CONFIG) == null ? void 0 : _d.API_BASE) || ((_e = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _e.batchApiBase) || "https://api.viconic.dev").replace(/\/$/, ""),
|
|
226
|
+
cdnDomain: ((_f = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _f.cdnDomain) || ((_g = window.CONFIG) == null ? void 0 : _g.CDN_DOMAIN) || "cdn.viconic.dev",
|
|
226
227
|
// Custom domain for R2 CDN via Cloudflare edge (HTTP/2, edge cache)
|
|
227
228
|
cdnCustomDomain: ((_h = window.CONFIG) == null ? void 0 : _h.CDN_CUSTOM_DOMAIN) || ((_i = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _i.cdnCustomDomain) || "",
|
|
228
229
|
observe: (currentScript == null ? void 0 : currentScript.hasAttribute("data-observe")) ?? false,
|
|
@@ -758,9 +759,19 @@ var import_react = __toESM(require("react"));
|
|
|
758
759
|
});
|
|
759
760
|
}
|
|
760
761
|
if (scopedContent.includes("id=")) {
|
|
761
|
-
|
|
762
|
-
scopedContent
|
|
763
|
-
|
|
762
|
+
const ids = [];
|
|
763
|
+
scopedContent.replace(/id="([^"]+)"/gi, (m, id) => {
|
|
764
|
+
ids.push(id);
|
|
765
|
+
return m;
|
|
766
|
+
});
|
|
767
|
+
scopedContent = scopedContent.replace(/id="([^"]+)"/gi, `id="${uid}_$1"`);
|
|
768
|
+
scopedContent = scopedContent.replace(/url\(['"]?#([^'"\)]+)['"]?\)/gi, `url(#${uid}_$1)`);
|
|
769
|
+
scopedContent = scopedContent.replace(/href="#([^"]+)"/gi, `href="#${uid}_$1"`);
|
|
770
|
+
if (ids.length > 0) {
|
|
771
|
+
const escapedIds = ids.map((id) => id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
772
|
+
const eventRe = new RegExp(`(["';\\s])(${escapedIds})\\.([a-zA-Z]+)`, "g");
|
|
773
|
+
scopedContent = scopedContent.replace(eventRe, `$1${uid}_$2.$3`);
|
|
774
|
+
}
|
|
764
775
|
}
|
|
765
776
|
}
|
|
766
777
|
element.innerHTML = scopedContent;
|
|
@@ -1934,12 +1945,48 @@ var import_react = __toESM(require("react"));
|
|
|
1934
1945
|
})();
|
|
1935
1946
|
|
|
1936
1947
|
// src/index.jsx
|
|
1948
|
+
var _initializedKits = /* @__PURE__ */ new Set();
|
|
1949
|
+
function initViconic({ kitId, cdnBase = "cdn.viconic.dev" }) {
|
|
1950
|
+
if (typeof window === "undefined") return;
|
|
1951
|
+
if (!kitId) {
|
|
1952
|
+
console.warn("[Viconic] initViconic requires a kitId");
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1955
|
+
if (_initializedKits.has(kitId)) return;
|
|
1956
|
+
_initializedKits.add(kitId);
|
|
1957
|
+
const scriptId = `viconic-kit-${kitId}`;
|
|
1958
|
+
if (document.getElementById(scriptId)) return;
|
|
1959
|
+
const script = document.createElement("script");
|
|
1960
|
+
script.id = scriptId;
|
|
1961
|
+
script.src = `https://${cdnBase}/kits/${kitId}/loader.js`;
|
|
1962
|
+
script.async = true;
|
|
1963
|
+
document.head.appendChild(script);
|
|
1964
|
+
}
|
|
1937
1965
|
var ViconicIcon = ({ name, className, style, size, color, ...props }) => {
|
|
1938
1966
|
const iconRef = (0, import_react.useRef)(null);
|
|
1939
1967
|
(0, import_react.useEffect)(() => {
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1968
|
+
const el = iconRef.current;
|
|
1969
|
+
if (!el) return;
|
|
1970
|
+
if (window.CopyIcons && window.CopyIcons.forceProcess) {
|
|
1971
|
+
window.CopyIcons.forceProcess(el);
|
|
1972
|
+
}
|
|
1973
|
+
const isLoaded = el.classList.contains("vi-ok") || el.classList.contains("svg-loaded");
|
|
1974
|
+
if (isLoaded) return;
|
|
1975
|
+
let retries = 0;
|
|
1976
|
+
const maxRetries = 50;
|
|
1977
|
+
const timer = setInterval(() => {
|
|
1978
|
+
retries++;
|
|
1979
|
+
if (el.classList.contains("vi-ok") || el.classList.contains("svg-loaded")) {
|
|
1980
|
+
clearInterval(timer);
|
|
1981
|
+
return;
|
|
1982
|
+
}
|
|
1983
|
+
if (el._u) el._u();
|
|
1984
|
+
if (window.CopyIcons && window.CopyIcons.forceProcess) {
|
|
1985
|
+
window.CopyIcons.forceProcess(el);
|
|
1986
|
+
}
|
|
1987
|
+
if (retries >= maxRetries) clearInterval(timer);
|
|
1988
|
+
}, 100);
|
|
1989
|
+
return () => clearInterval(timer);
|
|
1943
1990
|
}, [name, className, size, color, style]);
|
|
1944
1991
|
const combinedStyle = {
|
|
1945
1992
|
...size ? { fontSize: size } : {},
|
|
@@ -1960,7 +2007,8 @@ var ViconicIcon = ({ name, className, style, size, color, ...props }) => {
|
|
|
1960
2007
|
var index_default = ViconicIcon;
|
|
1961
2008
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1962
2009
|
0 && (module.exports = {
|
|
1963
|
-
ViconicIcon
|
|
2010
|
+
ViconicIcon,
|
|
2011
|
+
initViconic
|
|
1964
2012
|
});
|
|
1965
2013
|
/**
|
|
1966
2014
|
* CopyIcons Smart Loader v8.3 (CDN Smart Fallback + Early Abort)
|
package/dist/index.mjs
CHANGED
|
@@ -185,10 +185,10 @@ import React, { useEffect, useRef } from "react";
|
|
|
185
185
|
}
|
|
186
186
|
const currentScript = document.currentScript;
|
|
187
187
|
const config = {
|
|
188
|
-
apiBase: (((_a = window.CONFIG) == null ? void 0 : _a.API_BASE) || ((_b = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _b.apiBase) || "https://api.viconic.
|
|
188
|
+
apiBase: (((_a = window.CONFIG) == null ? void 0 : _a.API_BASE) || ((_b = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _b.apiBase) || "https://api.viconic.dev").replace(/\/$/, ""),
|
|
189
189
|
// Batch API for Iconify-style loading (by-prefix endpoint)
|
|
190
|
-
batchApiBase: (((_c = window.CONFIG) == null ? void 0 : _c.BATCH_API_BASE) || ((_d = window.CONFIG) == null ? void 0 : _d.API_BASE) || ((_e = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _e.batchApiBase) || "https://api.viconic.
|
|
191
|
-
cdnDomain: ((_f = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _f.cdnDomain) || ((_g = window.CONFIG) == null ? void 0 : _g.CDN_DOMAIN) || "cdn.viconic.
|
|
190
|
+
batchApiBase: (((_c = window.CONFIG) == null ? void 0 : _c.BATCH_API_BASE) || ((_d = window.CONFIG) == null ? void 0 : _d.API_BASE) || ((_e = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _e.batchApiBase) || "https://api.viconic.dev").replace(/\/$/, ""),
|
|
191
|
+
cdnDomain: ((_f = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _f.cdnDomain) || ((_g = window.CONFIG) == null ? void 0 : _g.CDN_DOMAIN) || "cdn.viconic.dev",
|
|
192
192
|
// Custom domain for R2 CDN via Cloudflare edge (HTTP/2, edge cache)
|
|
193
193
|
cdnCustomDomain: ((_h = window.CONFIG) == null ? void 0 : _h.CDN_CUSTOM_DOMAIN) || ((_i = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _i.cdnCustomDomain) || "",
|
|
194
194
|
observe: (currentScript == null ? void 0 : currentScript.hasAttribute("data-observe")) ?? false,
|
|
@@ -724,9 +724,19 @@ import React, { useEffect, useRef } from "react";
|
|
|
724
724
|
});
|
|
725
725
|
}
|
|
726
726
|
if (scopedContent.includes("id=")) {
|
|
727
|
-
|
|
728
|
-
scopedContent
|
|
729
|
-
|
|
727
|
+
const ids = [];
|
|
728
|
+
scopedContent.replace(/id="([^"]+)"/gi, (m, id) => {
|
|
729
|
+
ids.push(id);
|
|
730
|
+
return m;
|
|
731
|
+
});
|
|
732
|
+
scopedContent = scopedContent.replace(/id="([^"]+)"/gi, `id="${uid}_$1"`);
|
|
733
|
+
scopedContent = scopedContent.replace(/url\(['"]?#([^'"\)]+)['"]?\)/gi, `url(#${uid}_$1)`);
|
|
734
|
+
scopedContent = scopedContent.replace(/href="#([^"]+)"/gi, `href="#${uid}_$1"`);
|
|
735
|
+
if (ids.length > 0) {
|
|
736
|
+
const escapedIds = ids.map((id) => id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
737
|
+
const eventRe = new RegExp(`(["';\\s])(${escapedIds})\\.([a-zA-Z]+)`, "g");
|
|
738
|
+
scopedContent = scopedContent.replace(eventRe, `$1${uid}_$2.$3`);
|
|
739
|
+
}
|
|
730
740
|
}
|
|
731
741
|
}
|
|
732
742
|
element.innerHTML = scopedContent;
|
|
@@ -1900,12 +1910,48 @@ import React, { useEffect, useRef } from "react";
|
|
|
1900
1910
|
})();
|
|
1901
1911
|
|
|
1902
1912
|
// src/index.jsx
|
|
1913
|
+
var _initializedKits = /* @__PURE__ */ new Set();
|
|
1914
|
+
function initViconic({ kitId, cdnBase = "cdn.viconic.dev" }) {
|
|
1915
|
+
if (typeof window === "undefined") return;
|
|
1916
|
+
if (!kitId) {
|
|
1917
|
+
console.warn("[Viconic] initViconic requires a kitId");
|
|
1918
|
+
return;
|
|
1919
|
+
}
|
|
1920
|
+
if (_initializedKits.has(kitId)) return;
|
|
1921
|
+
_initializedKits.add(kitId);
|
|
1922
|
+
const scriptId = `viconic-kit-${kitId}`;
|
|
1923
|
+
if (document.getElementById(scriptId)) return;
|
|
1924
|
+
const script = document.createElement("script");
|
|
1925
|
+
script.id = scriptId;
|
|
1926
|
+
script.src = `https://${cdnBase}/kits/${kitId}/loader.js`;
|
|
1927
|
+
script.async = true;
|
|
1928
|
+
document.head.appendChild(script);
|
|
1929
|
+
}
|
|
1903
1930
|
var ViconicIcon = ({ name, className, style, size, color, ...props }) => {
|
|
1904
1931
|
const iconRef = useRef(null);
|
|
1905
1932
|
useEffect(() => {
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1933
|
+
const el = iconRef.current;
|
|
1934
|
+
if (!el) return;
|
|
1935
|
+
if (window.CopyIcons && window.CopyIcons.forceProcess) {
|
|
1936
|
+
window.CopyIcons.forceProcess(el);
|
|
1937
|
+
}
|
|
1938
|
+
const isLoaded = el.classList.contains("vi-ok") || el.classList.contains("svg-loaded");
|
|
1939
|
+
if (isLoaded) return;
|
|
1940
|
+
let retries = 0;
|
|
1941
|
+
const maxRetries = 50;
|
|
1942
|
+
const timer = setInterval(() => {
|
|
1943
|
+
retries++;
|
|
1944
|
+
if (el.classList.contains("vi-ok") || el.classList.contains("svg-loaded")) {
|
|
1945
|
+
clearInterval(timer);
|
|
1946
|
+
return;
|
|
1947
|
+
}
|
|
1948
|
+
if (el._u) el._u();
|
|
1949
|
+
if (window.CopyIcons && window.CopyIcons.forceProcess) {
|
|
1950
|
+
window.CopyIcons.forceProcess(el);
|
|
1951
|
+
}
|
|
1952
|
+
if (retries >= maxRetries) clearInterval(timer);
|
|
1953
|
+
}, 100);
|
|
1954
|
+
return () => clearInterval(timer);
|
|
1909
1955
|
}, [name, className, size, color, style]);
|
|
1910
1956
|
const combinedStyle = {
|
|
1911
1957
|
...size ? { fontSize: size } : {},
|
|
@@ -1926,7 +1972,8 @@ var ViconicIcon = ({ name, className, style, size, color, ...props }) => {
|
|
|
1926
1972
|
var index_default = ViconicIcon;
|
|
1927
1973
|
export {
|
|
1928
1974
|
ViconicIcon,
|
|
1929
|
-
index_default as default
|
|
1975
|
+
index_default as default,
|
|
1976
|
+
initViconic
|
|
1930
1977
|
};
|
|
1931
1978
|
/**
|
|
1932
1979
|
* CopyIcons Smart Loader v8.3 (CDN Smart Fallback + Early Abort)
|
package/index.d.ts
CHANGED
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
+
export interface InitViconicOptions {
|
|
4
|
+
/** UUID of the Kit to load */
|
|
5
|
+
kitId: string;
|
|
6
|
+
/** Custom CDN domain (default: 'cdn.viconic.dev') */
|
|
7
|
+
cdnBase?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Initialize a Viconic Kit. Injects the kit's loader script into <head>.
|
|
12
|
+
* Supports multiple kits â call once per kitId.
|
|
13
|
+
* Safe to call on server (no-op during SSR).
|
|
14
|
+
*/
|
|
15
|
+
export function initViconic(options: InitViconicOptions): void;
|
|
16
|
+
|
|
3
17
|
export interface ViconicIconProps extends React.HTMLAttributes<HTMLElement> {
|
|
4
|
-
/** The unique icon ID
|
|
18
|
+
/** The unique icon ID. Required.
|
|
19
|
+
* - System icons: 'lucide:activity', 'h2:0'
|
|
20
|
+
* - Kit icons: '@prefix/iconName' (after calling initViconic)
|
|
21
|
+
*/
|
|
5
22
|
name: string;
|
|
6
23
|
|
|
7
|
-
/** Optional icon size, CSS format (e.g., '24px', '1.5rem').
|
|
24
|
+
/** Optional icon size, CSS format (e.g., '24px', '1.5rem'). */
|
|
8
25
|
size?: string | number;
|
|
9
26
|
|
|
10
|
-
/** Optional icon color, CSS color value.
|
|
27
|
+
/** Optional icon color, CSS color value. */
|
|
11
28
|
color?: string;
|
|
12
29
|
|
|
13
30
|
style?: React.CSSProperties;
|
|
@@ -15,4 +32,3 @@ export interface ViconicIconProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
15
32
|
|
|
16
33
|
export const ViconicIcon: React.FC<ViconicIconProps>;
|
|
17
34
|
export default ViconicIcon;
|
|
18
|
-
|
package/package.json
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "viconic-react-icons",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "Viconic Smart Icons loader for React",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist",
|
|
9
|
-
"src",
|
|
10
|
-
"index.d.ts"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "tsup src/index.jsx --format cjs,esm --external react"
|
|
14
|
-
},
|
|
15
|
-
"peerDependencies": {
|
|
16
|
-
"react": ">=16.8.0"
|
|
17
|
-
},
|
|
18
|
-
"keywords": [
|
|
19
|
-
"icons",
|
|
20
|
-
"viconic",
|
|
21
|
-
"react"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "viconic-react-icons",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Viconic Smart Icons loader for React â supports Kit and 200k+ system icons",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"src",
|
|
10
|
+
"index.d.ts"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsup src/index.jsx --format cjs,esm --external react"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"react": ">=16.8.0"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"icons",
|
|
20
|
+
"viconic",
|
|
21
|
+
"react",
|
|
22
|
+
"kit",
|
|
23
|
+
"svg",
|
|
24
|
+
"icon-kit"
|
|
25
|
+
],
|
|
26
|
+
"author": "Viconic Team",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"types": "index.d.ts",
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"tsup": "^8.5.1",
|
|
31
|
+
"typescript": "^5.9.3"
|
|
32
|
+
}
|
|
33
|
+
}
|