@unocss/preset-icons 0.65.0 → 0.65.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/browser.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { c as createCDNLoader } from './shared/preset-icons.CSbSKOXI.mjs';
2
- import { c as createPresetIcons, b as createCDNFetchLoader, l as loadIcon } from './shared/preset-icons.Dik-90yv.mjs';
3
- export { a as combineLoaders, g as getEnvFlags, i as icons, p as parseIconWithLoader } from './shared/preset-icons.Dik-90yv.mjs';
1
+ import { c as createCDNLoader } from './shared/preset-icons.CqrgFOyb.mjs';
2
+ import { c as createPresetIcons, b as createCDNFetchLoader, l as loadIcon } from './shared/preset-icons.DvZCj0no.mjs';
3
+ export { a as combineLoaders, g as getEnvFlags, i as icons, p as parseIconWithLoader } from './shared/preset-icons.DvZCj0no.mjs';
4
4
  import 'ofetch';
5
5
  import '@unocss/core';
6
6
 
package/dist/core.d.mts CHANGED
@@ -50,6 +50,19 @@ interface IconsOptions {
50
50
  * @default false
51
51
  */
52
52
  warn?: boolean;
53
+ /**
54
+ * `@iconify-json` collections to use (will be also auto installed when missing and `autoInstall` enabled).
55
+ *
56
+ * This option should be used only when there are new `@iconify-json` collections not listed in the default icons preset collection names.
57
+ *
58
+ * Adding external collections will not work, you should use `FileSystemIconLoader` from
59
+ * `@iconify/utils/lib/loader/fs` or `createExternalPackageIconLoader` from
60
+ * `@iconify/utils/lib/loader/external-pkg` instead.
61
+ *
62
+ * @see https://unocss.dev/presets/icons#filesystemiconloader
63
+ * @see https://unocss.dev/presets/icons#externalpackageiconloader
64
+ */
65
+ iconifyCollectionsNames?: string[];
53
66
  /**
54
67
  * In Node.js environment, the preset will search for the installed iconify dataset automatically.
55
68
  * When using in the browser, this options is provided to provide dataset with custom loading mechanism.
@@ -210,6 +223,7 @@ var collections = [
210
223
  "il",
211
224
  "ion",
212
225
  "iwwa",
226
+ "ix",
213
227
  "jam",
214
228
  "la",
215
229
  "lets-icons",
@@ -232,6 +246,7 @@ var collections = [
232
246
  "medical-icon",
233
247
  "memory",
234
248
  "meteocons",
249
+ "meteor-icons",
235
250
  "mi",
236
251
  "mingcute",
237
252
  "mono-icons",
@@ -240,6 +255,7 @@ var collections = [
240
255
  "nonicons",
241
256
  "noto-v1",
242
257
  "noto",
258
+ "nrk",
243
259
  "octicon",
244
260
  "oi",
245
261
  "ooui",
@@ -255,6 +271,7 @@ var collections = [
255
271
  "prime",
256
272
  "proicons",
257
273
  "ps",
274
+ "qlementine-icons",
258
275
  "quill",
259
276
  "radix-icons",
260
277
  "raphael",
@@ -319,7 +336,7 @@ declare function getEnvFlags(): {
319
336
  isVSCode: boolean;
320
337
  isESLint: boolean;
321
338
  };
322
- declare function parseIconWithLoader(body: string, loader: UniversalIconLoader, options?: IconifyLoaderOptions): Promise<{
339
+ declare function parseIconWithLoader(body: string, loader: UniversalIconLoader, options?: IconifyLoaderOptions, safeCollectionsNames?: string[]): Promise<{
323
340
  collection: string;
324
341
  name: string;
325
342
  svg: string;
package/dist/core.d.ts CHANGED
@@ -50,6 +50,19 @@ interface IconsOptions {
50
50
  * @default false
51
51
  */
52
52
  warn?: boolean;
53
+ /**
54
+ * `@iconify-json` collections to use (will be also auto installed when missing and `autoInstall` enabled).
55
+ *
56
+ * This option should be used only when there are new `@iconify-json` collections not listed in the default icons preset collection names.
57
+ *
58
+ * Adding external collections will not work, you should use `FileSystemIconLoader` from
59
+ * `@iconify/utils/lib/loader/fs` or `createExternalPackageIconLoader` from
60
+ * `@iconify/utils/lib/loader/external-pkg` instead.
61
+ *
62
+ * @see https://unocss.dev/presets/icons#filesystemiconloader
63
+ * @see https://unocss.dev/presets/icons#externalpackageiconloader
64
+ */
65
+ iconifyCollectionsNames?: string[];
53
66
  /**
54
67
  * In Node.js environment, the preset will search for the installed iconify dataset automatically.
55
68
  * When using in the browser, this options is provided to provide dataset with custom loading mechanism.
@@ -210,6 +223,7 @@ var collections = [
210
223
  "il",
211
224
  "ion",
212
225
  "iwwa",
226
+ "ix",
213
227
  "jam",
214
228
  "la",
215
229
  "lets-icons",
@@ -232,6 +246,7 @@ var collections = [
232
246
  "medical-icon",
233
247
  "memory",
234
248
  "meteocons",
249
+ "meteor-icons",
235
250
  "mi",
236
251
  "mingcute",
237
252
  "mono-icons",
@@ -240,6 +255,7 @@ var collections = [
240
255
  "nonicons",
241
256
  "noto-v1",
242
257
  "noto",
258
+ "nrk",
243
259
  "octicon",
244
260
  "oi",
245
261
  "ooui",
@@ -255,6 +271,7 @@ var collections = [
255
271
  "prime",
256
272
  "proicons",
257
273
  "ps",
274
+ "qlementine-icons",
258
275
  "quill",
259
276
  "radix-icons",
260
277
  "raphael",
@@ -319,7 +336,7 @@ declare function getEnvFlags(): {
319
336
  isVSCode: boolean;
320
337
  isESLint: boolean;
321
338
  };
322
- declare function parseIconWithLoader(body: string, loader: UniversalIconLoader, options?: IconifyLoaderOptions): Promise<{
339
+ declare function parseIconWithLoader(body: string, loader: UniversalIconLoader, options?: IconifyLoaderOptions, safeCollectionsNames?: string[]): Promise<{
323
340
  collection: string;
324
341
  name: string;
325
342
  svg: string;
package/dist/core.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export { a as combineLoaders, b as createCDNFetchLoader, c as createPresetIcons, g as getEnvFlags, i as icons, p as parseIconWithLoader } from './shared/preset-icons.Dik-90yv.mjs';
1
+ export { a as combineLoaders, b as createCDNFetchLoader, c as createPresetIcons, g as getEnvFlags, i as icons, p as parseIconWithLoader } from './shared/preset-icons.DvZCj0no.mjs';
2
2
  import '@unocss/core';
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { definePreset } from '@unocss/core';
2
- import { c as createCDNLoader } from './shared/preset-icons.CSbSKOXI.mjs';
3
- import { c as createPresetIcons, g as getEnvFlags, a as combineLoaders, l as loadIcon } from './shared/preset-icons.Dik-90yv.mjs';
4
- export { b as createCDNFetchLoader, i as icons, p as parseIconWithLoader } from './shared/preset-icons.Dik-90yv.mjs';
2
+ import { c as createCDNLoader } from './shared/preset-icons.CqrgFOyb.mjs';
3
+ import { c as createPresetIcons, g as getEnvFlags, a as combineLoaders, l as loadIcon } from './shared/preset-icons.DvZCj0no.mjs';
4
+ export { b as createCDNFetchLoader, i as icons, p as parseIconWithLoader } from './shared/preset-icons.DvZCj0no.mjs';
5
5
  import 'ofetch';
6
6
 
7
7
  const _factory = /* @__PURE__ */ createPresetIcons(async (options) => {
@@ -1,5 +1,5 @@
1
1
  import { $fetch } from 'ofetch';
2
- import { b as createCDNFetchLoader } from './preset-icons.Dik-90yv.mjs';
2
+ import { b as createCDNFetchLoader } from './preset-icons.DvZCj0no.mjs';
3
3
 
4
4
  function createCDNLoader(cdnBase) {
5
5
  return createCDNFetchLoader($fetch, cdnBase);
@@ -646,6 +646,7 @@ var collections = [
646
646
  "il",
647
647
  "ion",
648
648
  "iwwa",
649
+ "ix",
649
650
  "jam",
650
651
  "la",
651
652
  "lets-icons",
@@ -668,6 +669,7 @@ var collections = [
668
669
  "medical-icon",
669
670
  "memory",
670
671
  "meteocons",
672
+ "meteor-icons",
671
673
  "mi",
672
674
  "mingcute",
673
675
  "mono-icons",
@@ -676,6 +678,7 @@ var collections = [
676
678
  "nonicons",
677
679
  "noto-v1",
678
680
  "noto",
681
+ "nrk",
679
682
  "octicon",
680
683
  "oi",
681
684
  "ooui",
@@ -691,6 +694,7 @@ var collections = [
691
694
  "prime",
692
695
  "proicons",
693
696
  "ps",
697
+ "qlementine-icons",
694
698
  "quill",
695
699
  "radix-icons",
696
700
  "raphael",
@@ -744,6 +748,7 @@ function createPresetIcons(lookupIconLoader) {
744
748
  mode = "auto",
745
749
  prefix = "i-",
746
750
  warn = false,
751
+ iconifyCollectionsNames,
747
752
  collections: customCollections,
748
753
  extraProperties = {},
749
754
  customizations = {},
@@ -793,7 +798,12 @@ function createPresetIcons(lookupIconLoader) {
793
798
  let [full, body, _mode = mode] = matcher;
794
799
  iconLoader = iconLoader || await lookupIconLoader(options);
795
800
  const usedProps = {};
796
- const parsed = await parseIconWithLoader(body, iconLoader, { ...loaderOptions, usedProps });
801
+ const parsed = await parseIconWithLoader(
802
+ body,
803
+ iconLoader,
804
+ { ...loaderOptions, usedProps },
805
+ iconifyCollectionsNames
806
+ );
797
807
  if (!parsed) {
798
808
  if (warn && !flags.isESLint)
799
809
  warnOnce(`failed to load icon "${full}"`);
@@ -881,24 +891,25 @@ function getEnvFlags() {
881
891
  isESLint
882
892
  };
883
893
  }
884
- async function parseIconWithLoader(body, loader, options = {}) {
894
+ async function parseIconWithLoader(body, loader, options = {}, safeCollectionsNames = []) {
885
895
  let collection = "";
886
896
  let name = "";
887
897
  let svg;
888
- const allCollections = [
898
+ const allCollections = /* @__PURE__ */ new Set([
889
899
  ...icons,
900
+ ...safeCollectionsNames,
890
901
  ...Object.keys(options.customCollections || {})
891
- ];
902
+ ]);
892
903
  if (body.includes(":")) {
893
904
  [collection, name] = body.split(":");
894
- if (!allCollections.includes(collection))
905
+ if (!allCollections.has(collection))
895
906
  return;
896
907
  svg = await loader(collection, name, options);
897
908
  } else {
898
909
  const parts = body.split(/-/g);
899
910
  for (let i = COLLECTION_NAME_PARTS_MAX; i >= 1; i--) {
900
911
  collection = parts.slice(0, i).join("-");
901
- if (!allCollections.includes(collection))
912
+ if (!allCollections.has(collection))
902
913
  continue;
903
914
  name = parts.slice(i).join("-");
904
915
  svg = await loader(collection, name, options);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/preset-icons",
3
3
  "type": "module",
4
- "version": "0.65.0",
4
+ "version": "0.65.2",
5
5
  "description": "Pure CSS Icons for UnoCSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -53,15 +53,16 @@
53
53
  "dist"
54
54
  ],
55
55
  "dependencies": {
56
- "@iconify/utils": "^2.1.33",
56
+ "@iconify/utils": "^2.2.1",
57
57
  "ofetch": "^1.4.1",
58
- "@unocss/core": "0.65.0"
58
+ "@unocss/core": "0.65.2"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@iconify/types": "^2.0.0"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "unbuild",
65
- "stub": "unbuild --stub"
65
+ "stub": "unbuild --stub",
66
+ "test:attw": "attw --pack --config-path ../../.attw-esm-only.json"
66
67
  }
67
68
  }