viconic-react-icons 1.0.8 â 1.1.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 +60 -11
- package/dist/index.js +61 -9
- package/dist/index.mjs +59 -8
- package/index.d.ts +20 -4
- package/package.json +33 -30
- package/src/copyicons-smart-loader.js +2164 -2148
- package/src/index.jsx +87 -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"));
|
|
@@ -170,6 +171,17 @@ var import_react = __toESM(require("react"));
|
|
|
170
171
|
}
|
|
171
172
|
function parseViconicIcon(attrValue) {
|
|
172
173
|
if (!attrValue) return null;
|
|
174
|
+
if (attrValue.startsWith("@")) {
|
|
175
|
+
const slashIdx = attrValue.indexOf("/");
|
|
176
|
+
if (slashIdx > 1) {
|
|
177
|
+
const prefix2 = attrValue.slice(1, slashIdx).trim();
|
|
178
|
+
const name = attrValue.slice(slashIdx + 1).trim();
|
|
179
|
+
if (prefix2 && name) {
|
|
180
|
+
return { prefix: prefix2, iconName: camelToKebab(name), isKit: true };
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
173
185
|
const colonIdx = attrValue.indexOf(":");
|
|
174
186
|
if (colonIdx < 1) return null;
|
|
175
187
|
const prefix = attrValue.slice(0, colonIdx).trim();
|
|
@@ -219,10 +231,10 @@ var import_react = __toESM(require("react"));
|
|
|
219
231
|
}
|
|
220
232
|
const currentScript = document.currentScript;
|
|
221
233
|
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.
|
|
234
|
+
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
235
|
// 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.
|
|
236
|
+
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(/\/$/, ""),
|
|
237
|
+
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
238
|
// Custom domain for R2 CDN via Cloudflare edge (HTTP/2, edge cache)
|
|
227
239
|
cdnCustomDomain: ((_h = window.CONFIG) == null ? void 0 : _h.CDN_CUSTOM_DOMAIN) || ((_i = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _i.cdnCustomDomain) || "",
|
|
228
240
|
observe: (currentScript == null ? void 0 : currentScript.hasAttribute("data-observe")) ?? false,
|
|
@@ -814,8 +826,9 @@ var import_react = __toESM(require("react"));
|
|
|
814
826
|
function registerViconicIcon(el) {
|
|
815
827
|
if (!el || el.nodeType !== 1) return;
|
|
816
828
|
if (processedElements.has(el)) return;
|
|
817
|
-
processedElements.add(el);
|
|
818
829
|
const iconAttr = el.getAttribute("icon");
|
|
830
|
+
if (iconAttr && iconAttr.startsWith("@")) return;
|
|
831
|
+
processedElements.add(el);
|
|
819
832
|
const parsed = parseViconicIcon(iconAttr);
|
|
820
833
|
if (!parsed) {
|
|
821
834
|
if (iconAttr) console.warn(`[CopyIcons] \u26A0\uFE0F Cannot parse viconic-icon icon="${iconAttr}"`);
|
|
@@ -1944,12 +1957,50 @@ var import_react = __toESM(require("react"));
|
|
|
1944
1957
|
})();
|
|
1945
1958
|
|
|
1946
1959
|
// src/index.jsx
|
|
1960
|
+
var _initializedKits = /* @__PURE__ */ new Set();
|
|
1961
|
+
function initViconic(options = {}) {
|
|
1962
|
+
const { kitId, cdnBase = "cdn.viconic.dev" } = options;
|
|
1963
|
+
if (typeof window === "undefined") return;
|
|
1964
|
+
if (!kitId) {
|
|
1965
|
+
console.warn("[Viconic] initViconic requires a kitId");
|
|
1966
|
+
return;
|
|
1967
|
+
}
|
|
1968
|
+
if (_initializedKits.has(kitId)) return;
|
|
1969
|
+
_initializedKits.add(kitId);
|
|
1970
|
+
const scriptId = `viconic-kit-${kitId}`;
|
|
1971
|
+
if (document.getElementById(scriptId)) return;
|
|
1972
|
+
const script = document.createElement("script");
|
|
1973
|
+
script.id = scriptId;
|
|
1974
|
+
script.src = `https://${cdnBase}/kits/${kitId}/loader.js`;
|
|
1975
|
+
script.async = true;
|
|
1976
|
+
document.head.appendChild(script);
|
|
1977
|
+
}
|
|
1947
1978
|
var ViconicIcon = ({ name, className, style, size, color, ...props }) => {
|
|
1948
1979
|
const iconRef = (0, import_react.useRef)(null);
|
|
1949
1980
|
(0, import_react.useEffect)(() => {
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1981
|
+
const el = iconRef.current;
|
|
1982
|
+
if (!el) return;
|
|
1983
|
+
const isKitIcon = name && name.startsWith("@");
|
|
1984
|
+
if (window.CopyIcons && window.CopyIcons.forceProcess && !isKitIcon) {
|
|
1985
|
+
window.CopyIcons.forceProcess(el);
|
|
1986
|
+
}
|
|
1987
|
+
const isLoaded = el.classList.contains("vi-ok") || el.classList.contains("svg-loaded");
|
|
1988
|
+
if (isLoaded) return;
|
|
1989
|
+
let retries = 0;
|
|
1990
|
+
const maxRetries = 50;
|
|
1991
|
+
const timer = setInterval(() => {
|
|
1992
|
+
retries++;
|
|
1993
|
+
if (el.classList.contains("vi-ok") || el.classList.contains("svg-loaded")) {
|
|
1994
|
+
clearInterval(timer);
|
|
1995
|
+
return;
|
|
1996
|
+
}
|
|
1997
|
+
if (el._u) el._u();
|
|
1998
|
+
if (window.CopyIcons && window.CopyIcons.forceProcess && !isKitIcon) {
|
|
1999
|
+
window.CopyIcons.forceProcess(el);
|
|
2000
|
+
}
|
|
2001
|
+
if (retries >= maxRetries) clearInterval(timer);
|
|
2002
|
+
}, 100);
|
|
2003
|
+
return () => clearInterval(timer);
|
|
1953
2004
|
}, [name, className, size, color, style]);
|
|
1954
2005
|
const combinedStyle = {
|
|
1955
2006
|
...size ? { fontSize: size } : {},
|
|
@@ -1970,7 +2021,8 @@ var ViconicIcon = ({ name, className, style, size, color, ...props }) => {
|
|
|
1970
2021
|
var index_default = ViconicIcon;
|
|
1971
2022
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1972
2023
|
0 && (module.exports = {
|
|
1973
|
-
ViconicIcon
|
|
2024
|
+
ViconicIcon,
|
|
2025
|
+
initViconic
|
|
1974
2026
|
});
|
|
1975
2027
|
/**
|
|
1976
2028
|
* CopyIcons Smart Loader v8.3 (CDN Smart Fallback + Early Abort)
|
package/dist/index.mjs
CHANGED
|
@@ -136,6 +136,17 @@ import React, { useEffect, useRef } from "react";
|
|
|
136
136
|
}
|
|
137
137
|
function parseViconicIcon(attrValue) {
|
|
138
138
|
if (!attrValue) return null;
|
|
139
|
+
if (attrValue.startsWith("@")) {
|
|
140
|
+
const slashIdx = attrValue.indexOf("/");
|
|
141
|
+
if (slashIdx > 1) {
|
|
142
|
+
const prefix2 = attrValue.slice(1, slashIdx).trim();
|
|
143
|
+
const name = attrValue.slice(slashIdx + 1).trim();
|
|
144
|
+
if (prefix2 && name) {
|
|
145
|
+
return { prefix: prefix2, iconName: camelToKebab(name), isKit: true };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
139
150
|
const colonIdx = attrValue.indexOf(":");
|
|
140
151
|
if (colonIdx < 1) return null;
|
|
141
152
|
const prefix = attrValue.slice(0, colonIdx).trim();
|
|
@@ -185,10 +196,10 @@ import React, { useEffect, useRef } from "react";
|
|
|
185
196
|
}
|
|
186
197
|
const currentScript = document.currentScript;
|
|
187
198
|
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.
|
|
199
|
+
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
200
|
// 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.
|
|
201
|
+
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(/\/$/, ""),
|
|
202
|
+
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
203
|
// Custom domain for R2 CDN via Cloudflare edge (HTTP/2, edge cache)
|
|
193
204
|
cdnCustomDomain: ((_h = window.CONFIG) == null ? void 0 : _h.CDN_CUSTOM_DOMAIN) || ((_i = currentScript == null ? void 0 : currentScript.dataset) == null ? void 0 : _i.cdnCustomDomain) || "",
|
|
194
205
|
observe: (currentScript == null ? void 0 : currentScript.hasAttribute("data-observe")) ?? false,
|
|
@@ -780,8 +791,9 @@ import React, { useEffect, useRef } from "react";
|
|
|
780
791
|
function registerViconicIcon(el) {
|
|
781
792
|
if (!el || el.nodeType !== 1) return;
|
|
782
793
|
if (processedElements.has(el)) return;
|
|
783
|
-
processedElements.add(el);
|
|
784
794
|
const iconAttr = el.getAttribute("icon");
|
|
795
|
+
if (iconAttr && iconAttr.startsWith("@")) return;
|
|
796
|
+
processedElements.add(el);
|
|
785
797
|
const parsed = parseViconicIcon(iconAttr);
|
|
786
798
|
if (!parsed) {
|
|
787
799
|
if (iconAttr) console.warn(`[CopyIcons] \u26A0\uFE0F Cannot parse viconic-icon icon="${iconAttr}"`);
|
|
@@ -1910,12 +1922,50 @@ import React, { useEffect, useRef } from "react";
|
|
|
1910
1922
|
})();
|
|
1911
1923
|
|
|
1912
1924
|
// src/index.jsx
|
|
1925
|
+
var _initializedKits = /* @__PURE__ */ new Set();
|
|
1926
|
+
function initViconic(options = {}) {
|
|
1927
|
+
const { kitId, cdnBase = "cdn.viconic.dev" } = options;
|
|
1928
|
+
if (typeof window === "undefined") return;
|
|
1929
|
+
if (!kitId) {
|
|
1930
|
+
console.warn("[Viconic] initViconic requires a kitId");
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1933
|
+
if (_initializedKits.has(kitId)) return;
|
|
1934
|
+
_initializedKits.add(kitId);
|
|
1935
|
+
const scriptId = `viconic-kit-${kitId}`;
|
|
1936
|
+
if (document.getElementById(scriptId)) return;
|
|
1937
|
+
const script = document.createElement("script");
|
|
1938
|
+
script.id = scriptId;
|
|
1939
|
+
script.src = `https://${cdnBase}/kits/${kitId}/loader.js`;
|
|
1940
|
+
script.async = true;
|
|
1941
|
+
document.head.appendChild(script);
|
|
1942
|
+
}
|
|
1913
1943
|
var ViconicIcon = ({ name, className, style, size, color, ...props }) => {
|
|
1914
1944
|
const iconRef = useRef(null);
|
|
1915
1945
|
useEffect(() => {
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1946
|
+
const el = iconRef.current;
|
|
1947
|
+
if (!el) return;
|
|
1948
|
+
const isKitIcon = name && name.startsWith("@");
|
|
1949
|
+
if (window.CopyIcons && window.CopyIcons.forceProcess && !isKitIcon) {
|
|
1950
|
+
window.CopyIcons.forceProcess(el);
|
|
1951
|
+
}
|
|
1952
|
+
const isLoaded = el.classList.contains("vi-ok") || el.classList.contains("svg-loaded");
|
|
1953
|
+
if (isLoaded) return;
|
|
1954
|
+
let retries = 0;
|
|
1955
|
+
const maxRetries = 50;
|
|
1956
|
+
const timer = setInterval(() => {
|
|
1957
|
+
retries++;
|
|
1958
|
+
if (el.classList.contains("vi-ok") || el.classList.contains("svg-loaded")) {
|
|
1959
|
+
clearInterval(timer);
|
|
1960
|
+
return;
|
|
1961
|
+
}
|
|
1962
|
+
if (el._u) el._u();
|
|
1963
|
+
if (window.CopyIcons && window.CopyIcons.forceProcess && !isKitIcon) {
|
|
1964
|
+
window.CopyIcons.forceProcess(el);
|
|
1965
|
+
}
|
|
1966
|
+
if (retries >= maxRetries) clearInterval(timer);
|
|
1967
|
+
}, 100);
|
|
1968
|
+
return () => clearInterval(timer);
|
|
1919
1969
|
}, [name, className, size, color, style]);
|
|
1920
1970
|
const combinedStyle = {
|
|
1921
1971
|
...size ? { fontSize: size } : {},
|
|
@@ -1936,7 +1986,8 @@ var ViconicIcon = ({ name, className, style, size, color, ...props }) => {
|
|
|
1936
1986
|
var index_default = ViconicIcon;
|
|
1937
1987
|
export {
|
|
1938
1988
|
ViconicIcon,
|
|
1939
|
-
index_default as default
|
|
1989
|
+
index_default as default,
|
|
1990
|
+
initViconic
|
|
1940
1991
|
};
|
|
1941
1992
|
/**
|
|
1942
1993
|
* 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.
|
|
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.1",
|
|
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
|
+
}
|