@unocss/preset-icons 66.0.0 → 66.1.0-beta.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.
@@ -1,8 +1,8 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
2
  import { IconsOptions } from './core.mjs';
3
3
  export { IconsAPI, combineLoaders, createCDNFetchLoader, createPresetIcons, getEnvFlags, icons, parseIconWithLoader } from './core.mjs';
4
- import '@iconify/utils';
5
4
  import '@iconify/types';
5
+ import '@iconify/utils';
6
6
  import '@iconify/utils/lib/svg/encode-svg-for-css';
7
7
 
8
8
  declare const presetIcons: _unocss_core.PresetFactory<object, IconsOptions>;
package/dist/browser.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
2
  import { IconsOptions } from './core.js';
3
3
  export { IconsAPI, combineLoaders, createCDNFetchLoader, createPresetIcons, getEnvFlags, icons, parseIconWithLoader } from './core.js';
4
- import '@iconify/utils';
5
4
  import '@iconify/types';
5
+ import '@iconify/utils';
6
6
  import '@iconify/utils/lib/svg/encode-svg-for-css';
7
7
 
8
8
  declare const presetIcons: _unocss_core.PresetFactory<object, IconsOptions>;
package/dist/core.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
2
  import { Awaitable, CSSObject } from '@unocss/core';
3
- import { CustomIconLoader, InlineCollection, IconCustomizations, UniversalIconLoader, IconifyLoaderOptions } from '@iconify/utils';
4
3
  import { IconifyJSON } from '@iconify/types';
4
+ import { CustomIconLoader, InlineCollection, IconCustomizations, UniversalIconLoader, IconifyLoaderOptions } from '@iconify/utils';
5
5
  import { encodeSvgForCss } from '@iconify/utils/lib/svg/encode-svg-for-css';
6
6
 
7
7
  interface IconMeta {
@@ -344,7 +344,7 @@ interface IconsAPI {
344
344
  }
345
345
  declare function createPresetIcons(lookupIconLoader: (options: IconsOptions) => Promise<UniversalIconLoader>): _unocss_core.PresetFactory<object, IconsOptions>;
346
346
  declare function combineLoaders(loaders: UniversalIconLoader[]): UniversalIconLoader;
347
- declare function createCDNFetchLoader(fetcher: (url: string) => Promise<any>, cdnBase: string): UniversalIconLoader;
347
+ declare function createCDNFetchLoader(fetcher: (url: string) => Promise<any>, cdnBase: string, cacheMap?: Map<string, IconifyJSON | Promise<IconifyJSON>>): UniversalIconLoader;
348
348
  declare function getEnvFlags(): {
349
349
  isNode: boolean;
350
350
  isVSCode: boolean;
package/dist/core.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
2
  import { Awaitable, CSSObject } from '@unocss/core';
3
- import { CustomIconLoader, InlineCollection, IconCustomizations, UniversalIconLoader, IconifyLoaderOptions } from '@iconify/utils';
4
3
  import { IconifyJSON } from '@iconify/types';
4
+ import { CustomIconLoader, InlineCollection, IconCustomizations, UniversalIconLoader, IconifyLoaderOptions } from '@iconify/utils';
5
5
  import { encodeSvgForCss } from '@iconify/utils/lib/svg/encode-svg-for-css';
6
6
 
7
7
  interface IconMeta {
@@ -344,7 +344,7 @@ interface IconsAPI {
344
344
  }
345
345
  declare function createPresetIcons(lookupIconLoader: (options: IconsOptions) => Promise<UniversalIconLoader>): _unocss_core.PresetFactory<object, IconsOptions>;
346
346
  declare function combineLoaders(loaders: UniversalIconLoader[]): UniversalIconLoader;
347
- declare function createCDNFetchLoader(fetcher: (url: string) => Promise<any>, cdnBase: string): UniversalIconLoader;
347
+ declare function createCDNFetchLoader(fetcher: (url: string) => Promise<any>, cdnBase: string, cacheMap?: Map<string, IconifyJSON | Promise<IconifyJSON>>): UniversalIconLoader;
348
348
  declare function getEnvFlags(): {
349
349
  isNode: boolean;
350
350
  isVSCode: boolean;
package/dist/core.mjs CHANGED
@@ -334,14 +334,13 @@ function combineLoaders(loaders) {
334
334
  }
335
335
  };
336
336
  }
337
- function createCDNFetchLoader(fetcher, cdnBase) {
338
- const cache = /* @__PURE__ */ new Map();
337
+ function createCDNFetchLoader(fetcher, cdnBase, cacheMap = /* @__PURE__ */ new Map()) {
339
338
  function fetchCollection(name) {
340
339
  if (!icons.includes(name))
341
340
  return void 0;
342
- if (!cache.has(name))
343
- cache.set(name, fetcher(`${cdnBase}@iconify-json/${name}/icons.json`));
344
- return cache.get(name);
341
+ if (!cacheMap.has(name))
342
+ cacheMap.set(name, fetcher(`${cdnBase}@iconify-json/${name}/icons.json`));
343
+ return cacheMap.get(name);
345
344
  }
346
345
  return async (collection, icon, options) => {
347
346
  let result = await loadIcon(collection, icon, options);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/preset-icons",
3
3
  "type": "module",
4
- "version": "66.0.0",
4
+ "version": "66.1.0-beta.2",
5
5
  "description": "Pure CSS Icons for UnoCSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "@iconify/utils": "^2.3.0",
57
57
  "ofetch": "^1.4.1",
58
- "@unocss/core": "66.0.0"
58
+ "@unocss/core": "66.1.0-beta.2"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@iconify/types": "^2.0.0"