viconic-react-icons 1.1.1 → 1.1.3
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/dist/index.js +8 -2
- package/dist/index.mjs +8 -2
- package/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/copyicons-smart-loader.js +3 -0
- package/src/index.jsx +11 -3
package/dist/index.js
CHANGED
|
@@ -787,6 +787,7 @@ var import_react = __toESM(require("react"));
|
|
|
787
787
|
}
|
|
788
788
|
element.innerHTML = scopedContent;
|
|
789
789
|
element.classList.add("svg-loaded");
|
|
790
|
+
element.classList.add("vi-ok");
|
|
790
791
|
if (multiColor) {
|
|
791
792
|
element.classList.add("ci-multicolor");
|
|
792
793
|
}
|
|
@@ -1959,7 +1960,7 @@ var import_react = __toESM(require("react"));
|
|
|
1959
1960
|
// src/index.jsx
|
|
1960
1961
|
var _initializedKits = /* @__PURE__ */ new Set();
|
|
1961
1962
|
function initViconic(options = {}) {
|
|
1962
|
-
const { kitId, cdnBase = "cdn.viconic.dev" } = options;
|
|
1963
|
+
const { kitId, cdnBase = "cdn.viconic.dev", version } = options;
|
|
1963
1964
|
if (typeof window === "undefined") return;
|
|
1964
1965
|
if (!kitId) {
|
|
1965
1966
|
console.warn("[Viconic] initViconic requires a kitId");
|
|
@@ -1971,7 +1972,12 @@ function initViconic(options = {}) {
|
|
|
1971
1972
|
if (document.getElementById(scriptId)) return;
|
|
1972
1973
|
const script = document.createElement("script");
|
|
1973
1974
|
script.id = scriptId;
|
|
1974
|
-
|
|
1975
|
+
let url = `https://${cdnBase}/kits/${kitId}/loader.js`;
|
|
1976
|
+
if (version) {
|
|
1977
|
+
const vQuery = version === "dev" ? Date.now() : version;
|
|
1978
|
+
url += `?v=${vQuery}`;
|
|
1979
|
+
}
|
|
1980
|
+
script.src = url;
|
|
1975
1981
|
script.async = true;
|
|
1976
1982
|
document.head.appendChild(script);
|
|
1977
1983
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -752,6 +752,7 @@ import React, { useEffect, useRef } from "react";
|
|
|
752
752
|
}
|
|
753
753
|
element.innerHTML = scopedContent;
|
|
754
754
|
element.classList.add("svg-loaded");
|
|
755
|
+
element.classList.add("vi-ok");
|
|
755
756
|
if (multiColor) {
|
|
756
757
|
element.classList.add("ci-multicolor");
|
|
757
758
|
}
|
|
@@ -1924,7 +1925,7 @@ import React, { useEffect, useRef } from "react";
|
|
|
1924
1925
|
// src/index.jsx
|
|
1925
1926
|
var _initializedKits = /* @__PURE__ */ new Set();
|
|
1926
1927
|
function initViconic(options = {}) {
|
|
1927
|
-
const { kitId, cdnBase = "cdn.viconic.dev" } = options;
|
|
1928
|
+
const { kitId, cdnBase = "cdn.viconic.dev", version } = options;
|
|
1928
1929
|
if (typeof window === "undefined") return;
|
|
1929
1930
|
if (!kitId) {
|
|
1930
1931
|
console.warn("[Viconic] initViconic requires a kitId");
|
|
@@ -1936,7 +1937,12 @@ function initViconic(options = {}) {
|
|
|
1936
1937
|
if (document.getElementById(scriptId)) return;
|
|
1937
1938
|
const script = document.createElement("script");
|
|
1938
1939
|
script.id = scriptId;
|
|
1939
|
-
|
|
1940
|
+
let url = `https://${cdnBase}/kits/${kitId}/loader.js`;
|
|
1941
|
+
if (version) {
|
|
1942
|
+
const vQuery = version === "dev" ? Date.now() : version;
|
|
1943
|
+
url += `?v=${vQuery}`;
|
|
1944
|
+
}
|
|
1945
|
+
script.src = url;
|
|
1940
1946
|
script.async = true;
|
|
1941
1947
|
document.head.appendChild(script);
|
|
1942
1948
|
}
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -721,6 +721,9 @@
|
|
|
721
721
|
|
|
722
722
|
element.innerHTML = scopedContent;
|
|
723
723
|
element.classList.add('svg-loaded');
|
|
724
|
+
// Also add vi-ok so Kit Loader's refresh() skips this element
|
|
725
|
+
// (Kit refresh only checks for vi-ok, not svg-loaded)
|
|
726
|
+
element.classList.add('vi-ok');
|
|
724
727
|
|
|
725
728
|
// Mark multi-color icons so CSS doesn't override their colors
|
|
726
729
|
if (multiColor) {
|
package/src/index.jsx
CHANGED
|
@@ -20,10 +20,10 @@ const _initializedKits = new Set();
|
|
|
20
20
|
*
|
|
21
21
|
* initViconic({ kitId: '387a6161-cb39-411f-8f13-29a5813e4efd' });
|
|
22
22
|
* // Multiple kits:
|
|
23
|
-
* initViconic({ kitId: 'another-kit-uuid' });
|
|
23
|
+
* initViconic({ kitId: 'another-kit-uuid', version: '1.0' });
|
|
24
24
|
*/
|
|
25
25
|
export function initViconic(options = {}) {
|
|
26
|
-
const { kitId, cdnBase = 'cdn.viconic.dev' } = options;
|
|
26
|
+
const { kitId, cdnBase = 'cdn.viconic.dev', version } = options;
|
|
27
27
|
if (typeof window === 'undefined') return; // SSR guard
|
|
28
28
|
if (!kitId) {
|
|
29
29
|
console.warn('[Viconic] initViconic requires a kitId');
|
|
@@ -37,7 +37,15 @@ export function initViconic(options = {}) {
|
|
|
37
37
|
|
|
38
38
|
const script = document.createElement('script');
|
|
39
39
|
script.id = scriptId;
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
// Add cache busting for development or specific version updates
|
|
42
|
+
let url = `https://${cdnBase}/kits/${kitId}/loader.js`;
|
|
43
|
+
if (version) {
|
|
44
|
+
const vQuery = version === 'dev' ? Date.now() : version;
|
|
45
|
+
url += `?v=${vQuery}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
script.src = url;
|
|
41
49
|
script.async = true;
|
|
42
50
|
document.head.appendChild(script);
|
|
43
51
|
}
|