@refineui/icon-cdn 0.2.1 → 0.2.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/utils.d.ts CHANGED
@@ -1,14 +1,9 @@
1
- export declare const createIconHTML: (iconName: string, style: "regular" | "filled") => (size?: number, color?: string, className?: string) => string;
2
- export declare const getCSSUrl: () => string;
3
- export declare const getFontUrl: (style?: "regular" | "filled") => string;
1
+ export declare const createIconURL: (iconName: string, size?: number, style?: "regular" | "filled") => string;
4
2
  export declare const getCDNBaseUrl: () => string;
5
3
  export declare const mapIconName: (iconDir: string) => string;
6
4
  export declare const generateSampleSVG: (iconName: string, size: number, style: string) => string;
7
5
  export declare const isValidIconSize: (size: number) => boolean;
8
6
  export declare const isValidIconStyle: (style: string) => style is "regular" | "filled";
9
7
  export declare const generateIconFileName: (iconName: string, style: string) => string;
10
- export { default as IconUtils } from './IconUtils';
11
- export declare const getIconChar: (iconName: string, style?: "regular" | "filled", size?: number) => string | null;
12
- export declare const getIconClass: (iconName: string, style?: "regular" | "filled", size?: number) => string | null;
13
- export declare const getFontFamily: (style?: "regular" | "filled") => string;
8
+ export declare const getIconURL: (iconName: string, size?: number, style?: "regular" | "filled") => string;
14
9
  //# sourceMappingURL=utils.d.ts.map
package/dist/utils.js CHANGED
@@ -1,31 +1,15 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
2
+ // CDN package utilities for SVG icon URLs
5
3
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getFontFamily = exports.getIconClass = exports.getIconChar = exports.IconUtils = exports.generateIconFileName = exports.isValidIconStyle = exports.isValidIconSize = exports.generateSampleSVG = exports.mapIconName = exports.getCDNBaseUrl = exports.getFontUrl = exports.getCSSUrl = exports.createIconHTML = void 0;
7
- const IconUtils_1 = __importDefault(require("./IconUtils"));
4
+ exports.getIconURL = exports.generateIconFileName = exports.isValidIconStyle = exports.isValidIconSize = exports.generateSampleSVG = exports.mapIconName = exports.getCDNBaseUrl = exports.createIconURL = void 0;
8
5
  // CDN base URL
9
6
  const CDN_BASE_URL = 'https://jihoonahn.github.io/refineui-system-icons/cdn';
10
- // === Icon HTML generation method ===
11
- const createIconHTML = (iconName, style) => {
12
- return (size = 24, color = 'currentColor', className = '') => {
13
- const iconChar = IconUtils_1.default.getIconChar(iconName, style, size);
14
- const fontFamily = IconUtils_1.default.getFontFamily(style);
15
- if (!iconChar)
16
- return '';
17
- return `<span style="font-family: '${fontFamily}'; font-size: ${size}px; color: ${color}; display: inline-block; line-height: 1; vertical-align: middle;" class="${className}">${iconChar}</span>`;
18
- };
7
+ // === SVG URL generation method ===
8
+ const createIconURL = (iconName, size = 24, style = 'regular') => {
9
+ return `${CDN_BASE_URL}/icons/${size}/${iconName}-${style}.svg`;
19
10
  };
20
- exports.createIconHTML = createIconHTML;
11
+ exports.createIconURL = createIconURL;
21
12
  // === CDN utility functions ===
22
- const getCSSUrl = () => `${CDN_BASE_URL}/fonts/refineui-system-icons.css`;
23
- exports.getCSSUrl = getCSSUrl;
24
- const getFontUrl = (style = 'regular') => {
25
- const fontFamily = IconUtils_1.default.getFontFamily(style);
26
- return `${CDN_BASE_URL}/fonts/${fontFamily}.woff2`;
27
- };
28
- exports.getFontUrl = getFontUrl;
29
13
  const getCDNBaseUrl = () => CDN_BASE_URL;
30
14
  exports.getCDNBaseUrl = getCDNBaseUrl;
31
15
  // === Functions needed for build.ts ===
@@ -56,18 +40,8 @@ const generateIconFileName = (iconName, style) => {
56
40
  };
57
41
  exports.generateIconFileName = generateIconFileName;
58
42
  // === Utility functions ===
59
- var IconUtils_2 = require("./IconUtils");
60
- Object.defineProperty(exports, "IconUtils", { enumerable: true, get: function () { return __importDefault(IconUtils_2).default; } });
61
- const getIconChar = (iconName, style = 'regular', size = 24) => {
62
- return IconUtils_1.default.getIconChar(iconName, style, size);
63
- };
64
- exports.getIconChar = getIconChar;
65
- const getIconClass = (iconName, style = 'regular', size = 24) => {
66
- return IconUtils_1.default.getIconClass(iconName, style, size);
67
- };
68
- exports.getIconClass = getIconClass;
69
- const getFontFamily = (style = 'regular') => {
70
- return IconUtils_1.default.getFontFamily(style);
43
+ const getIconURL = (iconName, size = 24, style = 'regular') => {
44
+ return (0, exports.createIconURL)(iconName, size, style);
71
45
  };
72
- exports.getFontFamily = getFontFamily;
46
+ exports.getIconURL = getIconURL;
73
47
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "@refineui/icon-cdn",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "RefineUI System Icons CDN Package",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
- "build": "tsc && node dist/build.js && npm run build:umd && npm run copy-fonts",
8
+ "build": "tsc && node dist/build.js && npm run build:umd",
9
9
  "build:types": "tsc --declaration --emitDeclarationOnly",
10
10
  "build:umd": "rollup -c",
11
- "copy-fonts": "mkdir -p dist/fonts && cp fonts/*.woff2 dist/fonts/ && cp fonts/*.css dist/fonts/",
12
11
  "dev": "tsc --watch",
13
12
  "clean": "rm -rf dist",
14
13
  "prepublishOnly": "npm run clean && npm run build"