viconic-react-icons 1.1.1 → 1.1.2

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 CHANGED
@@ -1959,7 +1959,7 @@ var import_react = __toESM(require("react"));
1959
1959
  // src/index.jsx
1960
1960
  var _initializedKits = /* @__PURE__ */ new Set();
1961
1961
  function initViconic(options = {}) {
1962
- const { kitId, cdnBase = "cdn.viconic.dev" } = options;
1962
+ const { kitId, cdnBase = "cdn.viconic.dev", version } = options;
1963
1963
  if (typeof window === "undefined") return;
1964
1964
  if (!kitId) {
1965
1965
  console.warn("[Viconic] initViconic requires a kitId");
@@ -1971,7 +1971,12 @@ function initViconic(options = {}) {
1971
1971
  if (document.getElementById(scriptId)) return;
1972
1972
  const script = document.createElement("script");
1973
1973
  script.id = scriptId;
1974
- script.src = `https://${cdnBase}/kits/${kitId}/loader.js`;
1974
+ let url = `https://${cdnBase}/kits/${kitId}/loader.js`;
1975
+ if (version) {
1976
+ const vQuery = version === "dev" ? Date.now() : version;
1977
+ url += `?v=${vQuery}`;
1978
+ }
1979
+ script.src = url;
1975
1980
  script.async = true;
1976
1981
  document.head.appendChild(script);
1977
1982
  }
package/dist/index.mjs CHANGED
@@ -1924,7 +1924,7 @@ import React, { useEffect, useRef } from "react";
1924
1924
  // src/index.jsx
1925
1925
  var _initializedKits = /* @__PURE__ */ new Set();
1926
1926
  function initViconic(options = {}) {
1927
- const { kitId, cdnBase = "cdn.viconic.dev" } = options;
1927
+ const { kitId, cdnBase = "cdn.viconic.dev", version } = options;
1928
1928
  if (typeof window === "undefined") return;
1929
1929
  if (!kitId) {
1930
1930
  console.warn("[Viconic] initViconic requires a kitId");
@@ -1936,7 +1936,12 @@ function initViconic(options = {}) {
1936
1936
  if (document.getElementById(scriptId)) return;
1937
1937
  const script = document.createElement("script");
1938
1938
  script.id = scriptId;
1939
- script.src = `https://${cdnBase}/kits/${kitId}/loader.js`;
1939
+ let url = `https://${cdnBase}/kits/${kitId}/loader.js`;
1940
+ if (version) {
1941
+ const vQuery = version === "dev" ? Date.now() : version;
1942
+ url += `?v=${vQuery}`;
1943
+ }
1944
+ script.src = url;
1940
1945
  script.async = true;
1941
1946
  document.head.appendChild(script);
1942
1947
  }
package/index.d.ts CHANGED
@@ -5,6 +5,8 @@ export interface InitViconicOptions {
5
5
  kitId: string;
6
6
  /** Custom CDN domain (default: 'cdn.viconic.dev') */
7
7
  cdnBase?: string;
8
+ /** Optional version of the kit to load */
9
+ version?: string | number;
8
10
  }
9
11
 
10
12
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viconic-react-icons",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Viconic Smart Icons loader for React — supports Kit and 200k+ system icons",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
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
- script.src = `https://${cdnBase}/kits/${kitId}/loader.js`;
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
  }