2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-13 14:13:06 +00:00

Update React component code for new core and utils structure

This commit is contained in:
Vjacheslav Trushkin 2021-09-25 11:43:00 +03:00
parent e82ecf83da
commit bd18d8874e
7 changed files with 107 additions and 246 deletions

View File

@ -5,7 +5,8 @@
"@iconify/types",
"@iconify/core",
"@iconify/utils",
"@cyberalien/redundancy"
"@cyberalien/redundancy",
"@iconify/api-redundancy"
],
"compiler": {},
"apiReport": {

View File

@ -5,7 +5,8 @@
"@iconify/types",
"@iconify/core",
"@iconify/utils",
"@cyberalien/redundancy"
"@cyberalien/redundancy",
"@iconify/api-redundancy"
],
"compiler": {},
"apiReport": {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
const fs = require('fs');
const path = require('path');
const child_process = require('child_process');
@ -64,7 +65,7 @@ if (compile.api && !fileExists(packagesDir + '/react/lib/icon.d.ts')) {
compile.lib = true;
}
if (compile.lib && !fileExists(packagesDir + '/core/lib/modules.js')) {
if (compile.lib && !fileExists(packagesDir + '/core/lib/cache.js')) {
compile.core = true;
}

View File

@ -14,11 +14,8 @@
"devDependencies": {
"@babel/preset-env": "^7.14.2",
"@babel/preset-react": "^7.13.13",
"@iconify/core": "^1.2.0-beta.2",
"@iconify/types": "^1.0.6",
"@iconify/utils": "^1.0.7",
"@iconify/core": "^1.2.0-beta.3",
"@microsoft/api-extractor": "^7.13.5",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@types/react": "^17.0.3",
"babel-jest": "^26.6.3",
@ -1701,37 +1698,37 @@
"node": ">=0.1.95"
}
},
"node_modules/@cyberalien/redundancy": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@cyberalien/redundancy/-/redundancy-1.1.0.tgz",
"integrity": "sha512-+ZvuwtVXzyxX1CWnP+X5XgDelseU9KSYgmPu3/DSraR7Qyi/vLZwuRRX0sYO24M/gZaChNXRBEK6RHRe3uBndw==",
"node_modules/@iconify/api-redundancy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@iconify/api-redundancy/-/api-redundancy-1.0.2.tgz",
"integrity": "sha512-/i2sIQSL+ygsPXPkmj368mf0UAaJRMd4+TVAvWPQQU0aaS0Km9p+0ZTR0UtD07F9O1oAgfzGAzkMYIh0gAhvJg==",
"dev": true
},
"node_modules/@iconify/core": {
"version": "1.2.0-beta.2",
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.2.tgz",
"integrity": "sha512-BnlanmZB5h+OXP0FIsfjMqsrAaDdHxVN5Y5jjYU4KrqaEwh9BiaIIr7lS/rXGk4UdnLps2NDjhkobuC7DXqm6A==",
"version": "1.2.0-beta.3",
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.3.tgz",
"integrity": "sha512-B9N0jdk1Ik2r/BpKfZGj+BPLUd5rNuwwyWaCiHSwlnt/n3jORwLtt689OPo2lVCaIcgwI9Uvw6I0O53smIKayQ==",
"dev": true,
"dependencies": {
"@cyberalien/redundancy": "^1.1.0",
"@iconify/types": "^1.0.6",
"@iconify/utils": "^1.0.6",
"@iconify/api-redundancy": "^1.0.2",
"@iconify/types": "^1.0.7",
"@iconify/utils": "^1.0.9",
"cross-fetch": "^3.1.4"
}
},
"node_modules/@iconify/types": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.6.tgz",
"integrity": "sha512-eG74WPaqjBGnZ3Xy36X4LRDA/ZlhCK6T0zbsAAIYObY2Qija/379iXx+e2wWwEIXS46B62nGaUcuI0MpUnTSrg==",
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.7.tgz",
"integrity": "sha512-zdwkVc67O9SqI/svsogD2s+XB3Uk4Xx+PrMEn5Qm3ktKSXFveZL0iP3yzqbrFg1KRRd93nRs4QycLaIRMhA0Pg==",
"dev": true
},
"node_modules/@iconify/utils": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.7.tgz",
"integrity": "sha512-ciJNYlqSxWdIZcCbE9FPL3o9o/U8ok0s8B7uf4lcGR57qyMaz3IUfihiBIb8YBr4eVp7eQDT2zV1Xpikkh/ePg==",
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.9.tgz",
"integrity": "sha512-HgHho6s0hQ7hIgx27J6YBg/4Jse0OZxQGQqE8ZT1lELWDOqrvR4RB1AIR2O3JFIts8u0a7uBwDhbjZPBwzj4TQ==",
"dev": true,
"dependencies": {
"@iconify/types": "^1.0.6"
"@iconify/types": "^1.0.7"
}
},
"node_modules/@istanbuljs/load-nyc-config": {
@ -2452,27 +2449,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/@rollup/plugin-commonjs": {
"version": "18.1.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-18.1.0.tgz",
"integrity": "sha512-h3e6T9rUxVMAQswpDIobfUHn/doMzM9sgkMrsMWCFLmB84PSoC8mV8tOloAJjSRwdqhXBqstlX2BwBpHJvbhxg==",
"dev": true,
"dependencies": {
"@rollup/pluginutils": "^3.1.0",
"commondir": "^1.0.1",
"estree-walker": "^2.0.1",
"glob": "^7.1.6",
"is-reference": "^1.2.1",
"magic-string": "^0.25.7",
"resolve": "^1.17.0"
},
"engines": {
"node": ">= 8.0.0"
},
"peerDependencies": {
"rollup": "^2.30.0"
}
},
"node_modules/@rollup/plugin-node-resolve": {
"version": "11.2.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.2.1.tgz",
@ -3584,12 +3560,6 @@
"dev": true,
"optional": true
},
"node_modules/commondir": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=",
"dev": true
},
"node_modules/component-emitter": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
@ -3952,12 +3922,6 @@
"node": ">=4.0"
}
},
"node_modules/estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"dev": true
},
"node_modules/esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
@ -4862,15 +4826,6 @@
"integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==",
"dev": true
},
"node_modules/is-reference": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz",
"integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==",
"dev": true,
"dependencies": {
"@types/estree": "*"
}
},
"node_modules/is-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
@ -6826,15 +6781,6 @@
"node": ">=10"
}
},
"node_modules/magic-string": {
"version": "0.25.7",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz",
"integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==",
"dev": true,
"dependencies": {
"sourcemap-codec": "^1.4.4"
}
},
"node_modules/make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@ -8543,12 +8489,6 @@
"integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==",
"dev": true
},
"node_modules/sourcemap-codec": {
"version": "1.4.8",
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
"dev": true
},
"node_modules/spdx-correct": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
@ -10659,37 +10599,37 @@
"minimist": "^1.2.0"
}
},
"@cyberalien/redundancy": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@cyberalien/redundancy/-/redundancy-1.1.0.tgz",
"integrity": "sha512-+ZvuwtVXzyxX1CWnP+X5XgDelseU9KSYgmPu3/DSraR7Qyi/vLZwuRRX0sYO24M/gZaChNXRBEK6RHRe3uBndw==",
"@iconify/api-redundancy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@iconify/api-redundancy/-/api-redundancy-1.0.2.tgz",
"integrity": "sha512-/i2sIQSL+ygsPXPkmj368mf0UAaJRMd4+TVAvWPQQU0aaS0Km9p+0ZTR0UtD07F9O1oAgfzGAzkMYIh0gAhvJg==",
"dev": true
},
"@iconify/core": {
"version": "1.2.0-beta.2",
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.2.tgz",
"integrity": "sha512-BnlanmZB5h+OXP0FIsfjMqsrAaDdHxVN5Y5jjYU4KrqaEwh9BiaIIr7lS/rXGk4UdnLps2NDjhkobuC7DXqm6A==",
"version": "1.2.0-beta.3",
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.3.tgz",
"integrity": "sha512-B9N0jdk1Ik2r/BpKfZGj+BPLUd5rNuwwyWaCiHSwlnt/n3jORwLtt689OPo2lVCaIcgwI9Uvw6I0O53smIKayQ==",
"dev": true,
"requires": {
"@cyberalien/redundancy": "^1.1.0",
"@iconify/types": "^1.0.6",
"@iconify/utils": "^1.0.6",
"@iconify/api-redundancy": "^1.0.2",
"@iconify/types": "^1.0.7",
"@iconify/utils": "^1.0.9",
"cross-fetch": "^3.1.4"
}
},
"@iconify/types": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.6.tgz",
"integrity": "sha512-eG74WPaqjBGnZ3Xy36X4LRDA/ZlhCK6T0zbsAAIYObY2Qija/379iXx+e2wWwEIXS46B62nGaUcuI0MpUnTSrg==",
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.7.tgz",
"integrity": "sha512-zdwkVc67O9SqI/svsogD2s+XB3Uk4Xx+PrMEn5Qm3ktKSXFveZL0iP3yzqbrFg1KRRd93nRs4QycLaIRMhA0Pg==",
"dev": true
},
"@iconify/utils": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.7.tgz",
"integrity": "sha512-ciJNYlqSxWdIZcCbE9FPL3o9o/U8ok0s8B7uf4lcGR57qyMaz3IUfihiBIb8YBr4eVp7eQDT2zV1Xpikkh/ePg==",
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.9.tgz",
"integrity": "sha512-HgHho6s0hQ7hIgx27J6YBg/4Jse0OZxQGQqE8ZT1lELWDOqrvR4RB1AIR2O3JFIts8u0a7uBwDhbjZPBwzj4TQ==",
"dev": true,
"requires": {
"@iconify/types": "^1.0.6"
"@iconify/types": "^1.0.7"
}
},
"@istanbuljs/load-nyc-config": {
@ -11256,21 +11196,6 @@
}
}
},
"@rollup/plugin-commonjs": {
"version": "18.1.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-18.1.0.tgz",
"integrity": "sha512-h3e6T9rUxVMAQswpDIobfUHn/doMzM9sgkMrsMWCFLmB84PSoC8mV8tOloAJjSRwdqhXBqstlX2BwBpHJvbhxg==",
"dev": true,
"requires": {
"@rollup/pluginutils": "^3.1.0",
"commondir": "^1.0.1",
"estree-walker": "^2.0.1",
"glob": "^7.1.6",
"is-reference": "^1.2.1",
"magic-string": "^0.25.7",
"resolve": "^1.17.0"
}
},
"@rollup/plugin-node-resolve": {
"version": "11.2.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.2.1.tgz",
@ -12180,12 +12105,6 @@
"dev": true,
"optional": true
},
"commondir": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=",
"dev": true
},
"component-emitter": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
@ -12465,12 +12384,6 @@
"integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
"dev": true
},
"estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"dev": true
},
"esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
@ -13172,15 +13085,6 @@
"integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==",
"dev": true
},
"is-reference": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz",
"integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==",
"dev": true,
"requires": {
"@types/estree": "*"
}
},
"is-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
@ -14662,15 +14566,6 @@
"yallist": "^4.0.0"
}
},
"magic-string": {
"version": "0.25.7",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz",
"integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==",
"dev": true,
"requires": {
"sourcemap-codec": "^1.4.4"
}
},
"make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@ -16025,12 +15920,6 @@
"integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==",
"dev": true
},
"sourcemap-codec": {
"version": "1.4.8",
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
"dev": true
},
"spdx-correct": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",

View File

@ -27,11 +27,8 @@
"devDependencies": {
"@babel/preset-env": "^7.14.2",
"@babel/preset-react": "^7.13.13",
"@iconify/core": "^1.2.0-beta.2",
"@iconify/types": "^1.0.6",
"@iconify/utils": "^1.0.7",
"@iconify/core": "^1.2.0-beta.3",
"@microsoft/api-extractor": "^7.13.5",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@types/react": "^17.0.3",
"babel-jest": "^26.6.3",

View File

@ -1,5 +1,4 @@
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
const names = ['offline', 'iconify'];
@ -17,7 +16,7 @@ names.forEach((name) => {
},
],
external: ['react'],
plugins: [resolve(), commonjs()],
plugins: [resolve()],
});
// CommonJS module
@ -30,7 +29,7 @@ names.forEach((name) => {
},
],
external: ['react'],
plugins: [resolve(), commonjs()],
plugins: [resolve()],
});
});

View File

@ -8,51 +8,55 @@ import type {
IconifyHorizontalIconAlignment,
IconifyVerticalIconAlignment,
} from '@iconify/utils/lib/customisations';
import type { IconifyStorageFunctions } from '@iconify/core/lib/storage/functions';
import {
IconifyStorageFunctions,
storageFunctions,
iconExists,
getIcon,
addIcon,
addCollection,
getIconData,
allowSimpleNames,
} from '@iconify/core/lib/storage/functions';
import {
IconifyBuilderFunctions,
builderFunctions,
} from '@iconify/core/lib/builder/functions';
import { listIcons } from '@iconify/core/lib/storage/storage';
import type { IconifyBuilderFunctions } from '@iconify/core/lib/builder/functions';
import { buildIcon } from '@iconify/core/lib/builder/functions';
import { replaceIDs } from '@iconify/utils/lib/svg/id';
import { calculateSize } from '@iconify/utils/lib/svg/size';
import type { IconifyIconBuildResult } from '@iconify/utils/lib/svg/build';
import { fullIcon } from '@iconify/utils/lib/icon';
// API
import {
import type {
IconifyAPIFunctions,
IconifyAPIInternalFunctions,
APIFunctions,
APIInternalFunctions,
IconifyAPIQueryParams,
IconifyAPICustomQueryParams,
IconifyAPIMergeQueryParams,
} from '@iconify/core/lib/api/functions';
import {
setAPIModule,
import type {
IconifyAPIModule,
IconifyAPISendQuery,
IconifyAPIPrepareIconsQuery,
} from '@iconify/core/lib/api/modules';
import { jsonpAPIModule } from '@iconify/core/lib/api/modules/jsonp';
import {
fetchAPIModule,
getFetch,
setFetch,
} from '@iconify/core/lib/api/modules/fetch';
import {
setAPIConfig,
import { setAPIModule } from '@iconify/core/lib/api/modules';
import type {
PartialIconifyAPIConfig,
IconifyAPIConfig,
GetAPIConfig,
} from '@iconify/core/lib/api/config';
import {
addAPIProvider,
getAPIConfig,
listAPIProviders,
} from '@iconify/core/lib/api/config';
import { fetchAPIModule, setFetch } from '@iconify/core/lib/api/modules/fetch';
import type {
IconifyIconLoaderCallback,
IconifyIconLoaderAbort,
} from '@iconify/core/lib/api/icons';
import { loadIcons } from '@iconify/core/lib/api/icons';
import { sendAPIQuery } from '@iconify/core/lib/api/query';
import { mergeParams } from '@iconify/core/lib/api/params';
// Cache
import { cache } from '@iconify/core/lib/cache';
@ -124,71 +128,18 @@ export { RawIconCustomisations, IconifyIconBuildResult };
export { IconifyBrowserCacheType };
/**
* Enable and disable browser cache
* Enable cache
*/
export const enableCache = (storage: IconifyBrowserCacheType) =>
function enableCache(storage: IconifyBrowserCacheType): void {
toggleBrowserCache(storage, true);
}
export const disableCache = (storage: IconifyBrowserCacheType) =>
/**
* Disable cache
*/
function disableCache(storage: IconifyBrowserCacheType): void {
toggleBrowserCache(storage, false);
/* Storage functions */
/**
* Check if icon exists
*/
export const iconExists = storageFunctions.iconExists;
/**
* Get icon data
*/
export const getIcon = storageFunctions.getIcon;
/**
* List available icons
*/
export const listIcons = storageFunctions.listIcons;
/**
* Add one icon
*/
export const addIcon = storageFunctions.addIcon;
/**
* Add icon set
*/
export const addCollection = storageFunctions.addCollection;
/* Builder functions */
/**
* Calculate icon size
*/
export const calculateSize = builderFunctions.calculateSize;
/**
* Replace unique ids in content
*/
export const replaceIDs = builderFunctions.replaceIDs;
/**
* Build SVG
*/
export const buildIcon = builderFunctions.buildIcon;
/* API functions */
/**
* Load icons
*/
export const loadIcons = APIFunctions.loadIcons;
/**
* Add API provider
*/
export const addAPIProvider = APIFunctions.addAPIProvider;
/**
* Export internal functions that can be used by third party implementations
*/
export const _api = APIInternalFunctions;
}
/**
* Initialise stuff
@ -197,15 +148,7 @@ export const _api = APIInternalFunctions;
allowSimpleNames(true);
// Set API module
setAPIModule('', getFetch() ? fetchAPIModule : jsonpAPIModule);
/**
* Function to enable node-fetch for getting icons on server side
*/
_api.setFetch = (nodeFetch: typeof fetch) => {
setFetch(nodeFetch);
setAPIModule('', fetchAPIModule);
};
setAPIModule('', fetchAPIModule);
/**
* Browser stuff
@ -263,7 +206,7 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
) {
continue;
}
if (!setAPIConfig(key, value)) {
if (!addAPIProvider(key, value)) {
console.error(err);
}
} catch (e) {
@ -497,3 +440,33 @@ export const InlineIcon = React.forwardRef<IconRef, IconProps>(
return React.createElement(IconComponent, newProps);
}
);
/**
* Internal API
*/
const _api: IconifyAPIInternalFunctions = {
getAPIConfig,
setAPIModule,
sendAPIQuery,
setFetch,
listAPIProviders,
mergeParams,
};
/**
* Export functions
*/
// IconifyAPIInternalFunctions
export { _api };
// IconifyAPIFunctions
export { addAPIProvider, loadIcons };
// IconifyStorageFunctions
export { iconExists, getIcon, listIcons, addIcon, addCollection };
// IconifyBuilderFunctions
export { replaceIDs, calculateSize, buildIcon };
// IconifyBrowserCacheFunctions
export { enableCache, disableCache };