mirror of
https://github.com/iconify/iconify.git
synced 2025-02-14 09:30:21 +00:00
Redo function for parsing icon sets, fix bug in parsing icon sets
This commit is contained in:
parent
8766772b02
commit
0691bb6836
32
packages/core/package-lock.json
generated
32
packages/core/package-lock.json
generated
@ -10,8 +10,8 @@
|
||||
"license": "(Apache-2.0 OR GPL-2.0)",
|
||||
"dependencies": {
|
||||
"@iconify/api-redundancy": "^1.0.2",
|
||||
"@iconify/types": "^1.0.7",
|
||||
"@iconify/utils": "^1.0.10",
|
||||
"@iconify/types": "^1.0.10",
|
||||
"@iconify/utils": "^1.0.15",
|
||||
"cross-fetch": "^3.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -732,16 +732,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@iconify/types": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.7.tgz",
|
||||
"integrity": "sha512-zdwkVc67O9SqI/svsogD2s+XB3Uk4Xx+PrMEn5Qm3ktKSXFveZL0iP3yzqbrFg1KRRd93nRs4QycLaIRMhA0Pg=="
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz",
|
||||
"integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ=="
|
||||
},
|
||||
"node_modules/@iconify/utils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.10.tgz",
|
||||
"integrity": "sha512-a1n7qGqoOMdaD20DzxRVRgXr77qjVmyiEzJeLmIoBOXWE2ueJ1O/0EXHzTMGuYFWcKtu0pFHbqghNfh1vpTtdw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.15.tgz",
|
||||
"integrity": "sha512-ENcZMIaU6niedrY9rNMPofYOlN+d/7k4sDxxQbkcuu/MUyUrVugDLUeNDln9CmNcrwbHzBAoItkGQ21H5gXiPw==",
|
||||
"dependencies": {
|
||||
"@iconify/types": "^1.0.7"
|
||||
"@iconify/types": "^1.0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@istanbuljs/load-nyc-config": {
|
||||
@ -5910,16 +5910,16 @@
|
||||
}
|
||||
},
|
||||
"@iconify/types": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.7.tgz",
|
||||
"integrity": "sha512-zdwkVc67O9SqI/svsogD2s+XB3Uk4Xx+PrMEn5Qm3ktKSXFveZL0iP3yzqbrFg1KRRd93nRs4QycLaIRMhA0Pg=="
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz",
|
||||
"integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ=="
|
||||
},
|
||||
"@iconify/utils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.10.tgz",
|
||||
"integrity": "sha512-a1n7qGqoOMdaD20DzxRVRgXr77qjVmyiEzJeLmIoBOXWE2ueJ1O/0EXHzTMGuYFWcKtu0pFHbqghNfh1vpTtdw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.15.tgz",
|
||||
"integrity": "sha512-ENcZMIaU6niedrY9rNMPofYOlN+d/7k4sDxxQbkcuu/MUyUrVugDLUeNDln9CmNcrwbHzBAoItkGQ21H5gXiPw==",
|
||||
"requires": {
|
||||
"@iconify/types": "^1.0.7"
|
||||
"@iconify/types": "^1.0.10"
|
||||
}
|
||||
},
|
||||
"@istanbuljs/load-nyc-config": {
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "@iconify/core",
|
||||
"description": "Reusable files used by multiple Iconify packages",
|
||||
"author": "Vjacheslav Trushkin <cyberalien@gmail.com> (https://iconify.design)",
|
||||
"version": "1.2.0-beta.3",
|
||||
"version": "1.2.0-beta.4",
|
||||
"license": "(Apache-2.0 OR GPL-2.0)",
|
||||
"bugs": "https://github.com/iconify/iconify/issues",
|
||||
"homepage": "https://iconify.design/",
|
||||
@ -101,8 +101,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@iconify/api-redundancy": "^1.0.2",
|
||||
"@iconify/types": "^1.0.7",
|
||||
"@iconify/utils": "^1.0.10",
|
||||
"@iconify/types": "^1.0.10",
|
||||
"@iconify/utils": "^1.0.15",
|
||||
"cross-fetch": "^3.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -9,7 +9,6 @@ import {
|
||||
addIconToStorage,
|
||||
addIconSet,
|
||||
} from './storage';
|
||||
// import { parseIconSet } from '../icon';
|
||||
|
||||
/**
|
||||
* Interface for exported storage functions
|
||||
@ -100,11 +99,21 @@ export function addCollection(data: IconifyJSON, provider?: string): boolean {
|
||||
) {
|
||||
// Simple names: add icons one by one
|
||||
let added = false;
|
||||
parseIconSet(data, (name, icon) => {
|
||||
if (icon !== null && addIcon(name, icon)) {
|
||||
added = true;
|
||||
parseIconSet(
|
||||
data,
|
||||
(name, icon) => {
|
||||
if (icon && addIcon(name, icon)) {
|
||||
added = true;
|
||||
}
|
||||
},
|
||||
{
|
||||
// Validate icon set and set prefix to empty
|
||||
validate: {
|
||||
fix: true,
|
||||
prefix: '',
|
||||
},
|
||||
}
|
||||
});
|
||||
);
|
||||
return added;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { IconifyJSON, IconifyIcon } from '@iconify/types';
|
||||
import type { FullIconifyIcon } from '@iconify/utils/lib/icon';
|
||||
import { fullIcon } from '@iconify/utils/lib/icon';
|
||||
import type { AddIconSetTracking } from '@iconify/utils/lib/icon-set/parse';
|
||||
import type { ParseIconSetTracking } from '@iconify/utils/lib/icon-set/parse';
|
||||
import { parseIconSet } from '@iconify/utils/lib/icon-set/parse';
|
||||
|
||||
/**
|
||||
@ -60,19 +60,19 @@ export function getStorage(provider: string, prefix: string): IconStorage {
|
||||
export function addIconSet(
|
||||
storage: IconStorage,
|
||||
data: IconifyJSON,
|
||||
list: AddIconSetTracking = 'none'
|
||||
list: ParseIconSetTracking = 'none'
|
||||
): boolean | string[] {
|
||||
const t = Date.now();
|
||||
return parseIconSet(
|
||||
data,
|
||||
(name, icon: FullIconifyIcon | null) => {
|
||||
if (icon === null) {
|
||||
storage.missing[name] = t;
|
||||
} else {
|
||||
if (icon) {
|
||||
storage.icons[name] = icon;
|
||||
} else {
|
||||
storage.missing[name] = t;
|
||||
}
|
||||
},
|
||||
list
|
||||
{ list }
|
||||
);
|
||||
}
|
||||
|
||||
|
54
packages/iconify/package-lock.json
generated
54
packages/iconify/package-lock.json
generated
@ -1,18 +1,18 @@
|
||||
{
|
||||
"name": "@iconify/iconify",
|
||||
"version": "2.1.0-beta.3",
|
||||
"version": "2.1.0-beta.5",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@iconify/iconify",
|
||||
"version": "2.1.0-beta.3",
|
||||
"version": "2.1.0-beta.5",
|
||||
"license": "(Apache-2.0 OR GPL-2.0)",
|
||||
"dependencies": {
|
||||
"cross-fetch": "^3.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify/core": "^1.2.0-beta.3",
|
||||
"@iconify/core": "^1.2.0-beta.4",
|
||||
"@microsoft/api-extractor": "^7.12.0",
|
||||
"@rollup/plugin-buble": "^0.21.3",
|
||||
"@rollup/plugin-node-resolve": "^10.0.0",
|
||||
@ -664,30 +664,30 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@iconify/core": {
|
||||
"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==",
|
||||
"version": "1.2.0-beta.4",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.4.tgz",
|
||||
"integrity": "sha512-wlBgiE8r3cq91J5x1RPOl1IydWcnaYTdjE031zLuPsrU6v53KD08MWHT5/2NFbqYHIMGdAWmGe8rAOMF9447lQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@iconify/api-redundancy": "^1.0.2",
|
||||
"@iconify/types": "^1.0.7",
|
||||
"@iconify/utils": "^1.0.9",
|
||||
"@iconify/types": "^1.0.10",
|
||||
"@iconify/utils": "^1.0.15",
|
||||
"cross-fetch": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@iconify/types": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.9.tgz",
|
||||
"integrity": "sha512-ALO6IGXBEztcySLq+vGJrgUJqGgiZJ8sTQ8mM6e3i77okM9fw8F23h6GLbbaMz/pNfeK8QHJBAOmx3LjhZ3YZw==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz",
|
||||
"integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@iconify/utils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.10.tgz",
|
||||
"integrity": "sha512-a1n7qGqoOMdaD20DzxRVRgXr77qjVmyiEzJeLmIoBOXWE2ueJ1O/0EXHzTMGuYFWcKtu0pFHbqghNfh1vpTtdw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.15.tgz",
|
||||
"integrity": "sha512-ENcZMIaU6niedrY9rNMPofYOlN+d/7k4sDxxQbkcuu/MUyUrVugDLUeNDln9CmNcrwbHzBAoItkGQ21H5gXiPw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@iconify/types": "^1.0.7"
|
||||
"@iconify/types": "^1.0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@istanbuljs/load-nyc-config": {
|
||||
@ -7907,30 +7907,30 @@
|
||||
"dev": true
|
||||
},
|
||||
"@iconify/core": {
|
||||
"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==",
|
||||
"version": "1.2.0-beta.4",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.4.tgz",
|
||||
"integrity": "sha512-wlBgiE8r3cq91J5x1RPOl1IydWcnaYTdjE031zLuPsrU6v53KD08MWHT5/2NFbqYHIMGdAWmGe8rAOMF9447lQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@iconify/api-redundancy": "^1.0.2",
|
||||
"@iconify/types": "^1.0.7",
|
||||
"@iconify/utils": "^1.0.9",
|
||||
"@iconify/types": "^1.0.10",
|
||||
"@iconify/utils": "^1.0.15",
|
||||
"cross-fetch": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"@iconify/types": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.9.tgz",
|
||||
"integrity": "sha512-ALO6IGXBEztcySLq+vGJrgUJqGgiZJ8sTQ8mM6e3i77okM9fw8F23h6GLbbaMz/pNfeK8QHJBAOmx3LjhZ3YZw==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz",
|
||||
"integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@iconify/utils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.10.tgz",
|
||||
"integrity": "sha512-a1n7qGqoOMdaD20DzxRVRgXr77qjVmyiEzJeLmIoBOXWE2ueJ1O/0EXHzTMGuYFWcKtu0pFHbqghNfh1vpTtdw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.15.tgz",
|
||||
"integrity": "sha512-ENcZMIaU6niedrY9rNMPofYOlN+d/7k4sDxxQbkcuu/MUyUrVugDLUeNDln9CmNcrwbHzBAoItkGQ21H5gXiPw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@iconify/types": "^1.0.7"
|
||||
"@iconify/types": "^1.0.10"
|
||||
}
|
||||
},
|
||||
"@istanbuljs/load-nyc-config": {
|
||||
|
@ -72,7 +72,7 @@
|
||||
"cross-fetch": "^3.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify/core": "^1.2.0-beta.3",
|
||||
"@iconify/core": "^1.2.0-beta.4",
|
||||
"@microsoft/api-extractor": "^7.12.0",
|
||||
"@rollup/plugin-buble": "^0.21.3",
|
||||
"@rollup/plugin-node-resolve": "^10.0.0",
|
||||
|
54
packages/react/package-lock.json
generated
54
packages/react/package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@iconify/react",
|
||||
"version": "3.1.0-beta.3",
|
||||
"version": "3.1.0-beta.5",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@iconify/react",
|
||||
"version": "3.1.0-beta.3",
|
||||
"version": "3.1.0-beta.5",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cross-fetch": "^3.1.4"
|
||||
@ -14,7 +14,7 @@
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.14.2",
|
||||
"@babel/preset-react": "^7.13.13",
|
||||
"@iconify/core": "^1.2.0-beta.3",
|
||||
"@iconify/core": "^1.2.0-beta.4",
|
||||
"@microsoft/api-extractor": "^7.13.5",
|
||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
||||
"@types/react": "^17.0.3",
|
||||
@ -1706,30 +1706,30 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@iconify/core": {
|
||||
"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==",
|
||||
"version": "1.2.0-beta.4",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.4.tgz",
|
||||
"integrity": "sha512-wlBgiE8r3cq91J5x1RPOl1IydWcnaYTdjE031zLuPsrU6v53KD08MWHT5/2NFbqYHIMGdAWmGe8rAOMF9447lQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@iconify/api-redundancy": "^1.0.2",
|
||||
"@iconify/types": "^1.0.7",
|
||||
"@iconify/utils": "^1.0.9",
|
||||
"@iconify/types": "^1.0.10",
|
||||
"@iconify/utils": "^1.0.15",
|
||||
"cross-fetch": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@iconify/types": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.9.tgz",
|
||||
"integrity": "sha512-ALO6IGXBEztcySLq+vGJrgUJqGgiZJ8sTQ8mM6e3i77okM9fw8F23h6GLbbaMz/pNfeK8QHJBAOmx3LjhZ3YZw==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz",
|
||||
"integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@iconify/utils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.10.tgz",
|
||||
"integrity": "sha512-a1n7qGqoOMdaD20DzxRVRgXr77qjVmyiEzJeLmIoBOXWE2ueJ1O/0EXHzTMGuYFWcKtu0pFHbqghNfh1vpTtdw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.15.tgz",
|
||||
"integrity": "sha512-ENcZMIaU6niedrY9rNMPofYOlN+d/7k4sDxxQbkcuu/MUyUrVugDLUeNDln9CmNcrwbHzBAoItkGQ21H5gXiPw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@iconify/types": "^1.0.7"
|
||||
"@iconify/types": "^1.0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@istanbuljs/load-nyc-config": {
|
||||
@ -10610,30 +10610,30 @@
|
||||
"dev": true
|
||||
},
|
||||
"@iconify/core": {
|
||||
"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==",
|
||||
"version": "1.2.0-beta.4",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.4.tgz",
|
||||
"integrity": "sha512-wlBgiE8r3cq91J5x1RPOl1IydWcnaYTdjE031zLuPsrU6v53KD08MWHT5/2NFbqYHIMGdAWmGe8rAOMF9447lQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@iconify/api-redundancy": "^1.0.2",
|
||||
"@iconify/types": "^1.0.7",
|
||||
"@iconify/utils": "^1.0.9",
|
||||
"@iconify/types": "^1.0.10",
|
||||
"@iconify/utils": "^1.0.15",
|
||||
"cross-fetch": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"@iconify/types": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.9.tgz",
|
||||
"integrity": "sha512-ALO6IGXBEztcySLq+vGJrgUJqGgiZJ8sTQ8mM6e3i77okM9fw8F23h6GLbbaMz/pNfeK8QHJBAOmx3LjhZ3YZw==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz",
|
||||
"integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@iconify/utils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.10.tgz",
|
||||
"integrity": "sha512-a1n7qGqoOMdaD20DzxRVRgXr77qjVmyiEzJeLmIoBOXWE2ueJ1O/0EXHzTMGuYFWcKtu0pFHbqghNfh1vpTtdw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.15.tgz",
|
||||
"integrity": "sha512-ENcZMIaU6niedrY9rNMPofYOlN+d/7k4sDxxQbkcuu/MUyUrVugDLUeNDln9CmNcrwbHzBAoItkGQ21H5gXiPw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@iconify/types": "^1.0.7"
|
||||
"@iconify/types": "^1.0.10"
|
||||
}
|
||||
},
|
||||
"@istanbuljs/load-nyc-config": {
|
||||
|
@ -41,7 +41,7 @@
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.14.2",
|
||||
"@babel/preset-react": "^7.13.13",
|
||||
"@iconify/core": "^1.2.0-beta.3",
|
||||
"@iconify/core": "^1.2.0-beta.4",
|
||||
"@microsoft/api-extractor": "^7.13.5",
|
||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
||||
"@types/react": "^17.0.3",
|
||||
|
@ -116,9 +116,19 @@ export function addCollection(
|
||||
: prefix !== false && typeof data.prefix === 'string'
|
||||
? data.prefix + ':'
|
||||
: '';
|
||||
parseIconSet(data, (name, icon) => {
|
||||
if (icon !== null) {
|
||||
storage[iconPrefix + name] = icon;
|
||||
parseIconSet(
|
||||
data,
|
||||
(name, icon) => {
|
||||
if (icon) {
|
||||
storage[iconPrefix + name] = icon;
|
||||
}
|
||||
},
|
||||
{
|
||||
// Allow empty prefix
|
||||
validate: {
|
||||
fix: true,
|
||||
prefix: iconPrefix,
|
||||
},
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
50
packages/svelte/package-lock.json
generated
50
packages/svelte/package-lock.json
generated
@ -12,7 +12,7 @@
|
||||
"cross-fetch": "^3.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify/core": "^1.2.0-beta.3",
|
||||
"@iconify/core": "^1.2.0-beta.4",
|
||||
"@microsoft/api-extractor": "^7.15.0",
|
||||
"@rollup/plugin-node-resolve": "^10.0.0",
|
||||
"@rollup/plugin-typescript": "^8.2.1",
|
||||
@ -707,30 +707,30 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@iconify/core": {
|
||||
"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==",
|
||||
"version": "1.2.0-beta.4",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.4.tgz",
|
||||
"integrity": "sha512-wlBgiE8r3cq91J5x1RPOl1IydWcnaYTdjE031zLuPsrU6v53KD08MWHT5/2NFbqYHIMGdAWmGe8rAOMF9447lQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@iconify/api-redundancy": "^1.0.2",
|
||||
"@iconify/types": "^1.0.7",
|
||||
"@iconify/utils": "^1.0.9",
|
||||
"@iconify/types": "^1.0.10",
|
||||
"@iconify/utils": "^1.0.15",
|
||||
"cross-fetch": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@iconify/types": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.9.tgz",
|
||||
"integrity": "sha512-ALO6IGXBEztcySLq+vGJrgUJqGgiZJ8sTQ8mM6e3i77okM9fw8F23h6GLbbaMz/pNfeK8QHJBAOmx3LjhZ3YZw==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz",
|
||||
"integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@iconify/utils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.10.tgz",
|
||||
"integrity": "sha512-a1n7qGqoOMdaD20DzxRVRgXr77qjVmyiEzJeLmIoBOXWE2ueJ1O/0EXHzTMGuYFWcKtu0pFHbqghNfh1vpTtdw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.15.tgz",
|
||||
"integrity": "sha512-ENcZMIaU6niedrY9rNMPofYOlN+d/7k4sDxxQbkcuu/MUyUrVugDLUeNDln9CmNcrwbHzBAoItkGQ21H5gXiPw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@iconify/types": "^1.0.7"
|
||||
"@iconify/types": "^1.0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@istanbuljs/load-nyc-config": {
|
||||
@ -6485,30 +6485,30 @@
|
||||
"dev": true
|
||||
},
|
||||
"@iconify/core": {
|
||||
"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==",
|
||||
"version": "1.2.0-beta.4",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.4.tgz",
|
||||
"integrity": "sha512-wlBgiE8r3cq91J5x1RPOl1IydWcnaYTdjE031zLuPsrU6v53KD08MWHT5/2NFbqYHIMGdAWmGe8rAOMF9447lQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@iconify/api-redundancy": "^1.0.2",
|
||||
"@iconify/types": "^1.0.7",
|
||||
"@iconify/utils": "^1.0.9",
|
||||
"@iconify/types": "^1.0.10",
|
||||
"@iconify/utils": "^1.0.15",
|
||||
"cross-fetch": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"@iconify/types": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.9.tgz",
|
||||
"integrity": "sha512-ALO6IGXBEztcySLq+vGJrgUJqGgiZJ8sTQ8mM6e3i77okM9fw8F23h6GLbbaMz/pNfeK8QHJBAOmx3LjhZ3YZw==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz",
|
||||
"integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@iconify/utils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.10.tgz",
|
||||
"integrity": "sha512-a1n7qGqoOMdaD20DzxRVRgXr77qjVmyiEzJeLmIoBOXWE2ueJ1O/0EXHzTMGuYFWcKtu0pFHbqghNfh1vpTtdw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.15.tgz",
|
||||
"integrity": "sha512-ENcZMIaU6niedrY9rNMPofYOlN+d/7k4sDxxQbkcuu/MUyUrVugDLUeNDln9CmNcrwbHzBAoItkGQ21H5gXiPw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@iconify/types": "^1.0.7"
|
||||
"@iconify/types": "^1.0.10"
|
||||
}
|
||||
},
|
||||
"@istanbuljs/load-nyc-config": {
|
||||
|
@ -26,7 +26,7 @@
|
||||
"test": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify/core": "^1.2.0-beta.3",
|
||||
"@iconify/core": "^1.2.0-beta.4",
|
||||
"@microsoft/api-extractor": "^7.15.0",
|
||||
"@rollup/plugin-node-resolve": "^10.0.0",
|
||||
"@rollup/plugin-typescript": "^8.2.1",
|
||||
|
@ -60,9 +60,19 @@ export function addCollection(
|
||||
: prefix !== false && typeof data.prefix === 'string'
|
||||
? data.prefix + ':'
|
||||
: '';
|
||||
parseIconSet(data, (name, icon) => {
|
||||
if (icon !== null) {
|
||||
storage[iconPrefix + name] = icon;
|
||||
parseIconSet(
|
||||
data,
|
||||
(name, icon) => {
|
||||
if (icon) {
|
||||
storage[iconPrefix + name] = icon;
|
||||
}
|
||||
},
|
||||
{
|
||||
// Allow empty prefix
|
||||
validate: {
|
||||
fix: true,
|
||||
prefix: iconPrefix,
|
||||
},
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "@iconify/utils",
|
||||
"description": "Common functions for working with Iconify icon sets used by various packages.",
|
||||
"author": "Vjacheslav Trushkin",
|
||||
"version": "1.0.14",
|
||||
"version": "1.0.15",
|
||||
"license": "MIT",
|
||||
"bugs": "https://github.com/iconify/iconify/issues",
|
||||
"homepage": "https://iconify.design/",
|
||||
|
@ -149,7 +149,9 @@ describe('Testing parsing icon set', () => {
|
||||
// Check icon data
|
||||
expect(data).toEqual(expected[name]);
|
||||
},
|
||||
'all'
|
||||
{
|
||||
list: 'all',
|
||||
}
|
||||
)
|
||||
).toEqual(namesCopy);
|
||||
|
||||
@ -166,6 +168,9 @@ describe('Testing parsing icon set', () => {
|
||||
'alias2f',
|
||||
'alias2z',
|
||||
'alias2z3',
|
||||
'alias2z4',
|
||||
'alias2z5',
|
||||
'alias2z6',
|
||||
];
|
||||
const namesCopy = names.slice(0);
|
||||
|
||||
@ -235,6 +240,39 @@ describe('Testing parsing icon set', () => {
|
||||
vFlip: true,
|
||||
rotate: 1,
|
||||
},
|
||||
alias2z4: {
|
||||
// alias of alias2z3
|
||||
body: '<path d="icon2" />',
|
||||
width: 21,
|
||||
height: 24,
|
||||
top: 0,
|
||||
left: 0,
|
||||
hFlip: false,
|
||||
vFlip: true,
|
||||
rotate: 1,
|
||||
},
|
||||
alias2z5: {
|
||||
// alias of alias2z4
|
||||
body: '<path d="icon2" />',
|
||||
width: 21,
|
||||
height: 24,
|
||||
top: 0,
|
||||
left: 0,
|
||||
hFlip: false,
|
||||
vFlip: true,
|
||||
rotate: 1,
|
||||
},
|
||||
alias2z6: {
|
||||
// alias of alias2z5
|
||||
body: '<path d="icon2" />',
|
||||
width: 21,
|
||||
height: 24,
|
||||
top: 0,
|
||||
left: 0,
|
||||
hFlip: false,
|
||||
vFlip: true,
|
||||
rotate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Do stuff
|
||||
@ -281,9 +319,21 @@ describe('Testing parsing icon set', () => {
|
||||
},
|
||||
alias2z4: {
|
||||
// 4 parents: alias2z3, alias2z, alias2f, icon2
|
||||
// nesting is too deep and should not be parsed
|
||||
parent: 'alias2z3',
|
||||
},
|
||||
alias2z5: {
|
||||
// 5 parents: alias2z4, alias2z3, alias2z, alias2f, icon2
|
||||
parent: 'alias2z4',
|
||||
},
|
||||
alias2z6: {
|
||||
// 6 parents: alias2z5, alias2z4, alias2z3, alias2z, alias2f, icon2
|
||||
parent: 'alias2z5',
|
||||
},
|
||||
alias2z7: {
|
||||
// 7 parents: alias2z6, alias2z5, alias2z4, alias2z3, alias2z, alias2f, icon2
|
||||
// nesting is too deep and should not be parsed
|
||||
parent: 'alias2z6',
|
||||
},
|
||||
alias3: {
|
||||
// invalid parent
|
||||
parent: 'icon3',
|
||||
@ -299,81 +349,9 @@ describe('Testing parsing icon set', () => {
|
||||
// Check icon data
|
||||
expect(data).toEqual(expected[name]);
|
||||
},
|
||||
'added'
|
||||
)
|
||||
).toEqual(namesCopy);
|
||||
|
||||
// All names should have been parsed
|
||||
expect(names).toEqual([]);
|
||||
});
|
||||
|
||||
it('Invalid default values', () => {
|
||||
// Names list
|
||||
const names = ['icon1', 'icon2'];
|
||||
const namesCopy = names.slice(0);
|
||||
|
||||
// Resolved data
|
||||
const expected = {
|
||||
icon1: {
|
||||
body: '<path d="icon1" />',
|
||||
width: 20,
|
||||
height: 20,
|
||||
top: 0,
|
||||
left: 0,
|
||||
hFlip: false,
|
||||
vFlip: false,
|
||||
rotate: 0,
|
||||
},
|
||||
icon2: {
|
||||
body: '<path d="icon2" />',
|
||||
width: 24,
|
||||
height: 24,
|
||||
top: 0,
|
||||
left: 0,
|
||||
hFlip: false,
|
||||
vFlip: false,
|
||||
rotate: 0,
|
||||
},
|
||||
};
|
||||
|
||||
const iconSet = {
|
||||
icons: {
|
||||
icon1: {
|
||||
body: '<path d="icon1" />',
|
||||
width: 20,
|
||||
// Default should not override this
|
||||
height: 20,
|
||||
},
|
||||
icon2: {
|
||||
body: '<path d="icon2" />',
|
||||
width: 24,
|
||||
},
|
||||
icon3: {
|
||||
// Missing 'body'
|
||||
width: 24,
|
||||
},
|
||||
},
|
||||
height: 24,
|
||||
// Objects should be ignored. Not testing other types because validation is done only for objects
|
||||
rotate: {
|
||||
foo: 1,
|
||||
},
|
||||
hFlip: null,
|
||||
};
|
||||
|
||||
// Do stuff
|
||||
expect(
|
||||
parseIconSet(
|
||||
iconSet,
|
||||
(name, data) => {
|
||||
// Make sure name matches
|
||||
expect(names.length).toBeGreaterThanOrEqual(1);
|
||||
expect(name).toBe(names.shift());
|
||||
|
||||
// Check icon data
|
||||
expect(data).toEqual(expected[name]);
|
||||
},
|
||||
'all'
|
||||
{
|
||||
list: 'valid',
|
||||
}
|
||||
)
|
||||
).toEqual(namesCopy);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { IconifyJSON } from '@iconify/types';
|
||||
import { minifyProps } from '../icon';
|
||||
import { iconDefaults } from '../icon';
|
||||
|
||||
/**
|
||||
* Expand minified icon set
|
||||
@ -9,19 +9,21 @@ import { minifyProps } from '../icon';
|
||||
export function expandIconSet(data: IconifyJSON): void {
|
||||
const icons = Object.keys(data.icons);
|
||||
|
||||
minifyProps.forEach((prop) => {
|
||||
if (typeof data[prop] !== 'number') {
|
||||
return;
|
||||
}
|
||||
const value = data[prop];
|
||||
|
||||
icons.forEach((name) => {
|
||||
const item = data.icons[name];
|
||||
if (item[prop] === void 0) {
|
||||
item[prop] = value;
|
||||
(Object.keys(iconDefaults) as (keyof typeof iconDefaults)[]).forEach(
|
||||
(prop) => {
|
||||
if (typeof data[prop] !== typeof iconDefaults[prop]) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
const value = data[prop];
|
||||
|
||||
delete data[prop];
|
||||
});
|
||||
icons.forEach((name) => {
|
||||
const item = data.icons[name];
|
||||
if (item[prop] === void 0) {
|
||||
item[prop as 'height'] = value as number;
|
||||
}
|
||||
});
|
||||
|
||||
delete data[prop];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ export function getIconData(
|
||||
const item = data.aliases?.[name];
|
||||
const result = getIcon(item.parent, iteration + 1);
|
||||
if (result) {
|
||||
mergeIconData(result, item);
|
||||
return mergeIconData(result, item);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
import type { IconifyJSON } from '@iconify/types';
|
||||
import { minifyProps } from '../icon';
|
||||
import { iconDefaults } from '../icon';
|
||||
|
||||
/**
|
||||
* Optional properties that must be copied when copying icon set
|
||||
*/
|
||||
export const propsToCopy: (keyof IconifyJSON)[] = (
|
||||
minifyProps as (keyof IconifyJSON)[]
|
||||
).concat(['provider']);
|
||||
export const propsToCopy = Object.keys(iconDefaults).concat([
|
||||
'provider',
|
||||
]) as (keyof IconifyJSON)[];
|
||||
|
||||
/**
|
||||
* Extract icons from icon set
|
||||
|
@ -1,11 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
import type { IconifyJSON } from '@iconify/types';
|
||||
import { minifyProps, iconDefaults } from '../icon';
|
||||
import { iconDefaults } from '../icon';
|
||||
|
||||
/**
|
||||
* Minify icon set
|
||||
*
|
||||
* Function finds common values for few numeric properties, such as 'width' and 'height' (see minifyProps for list of properties),
|
||||
* Function finds common values for few numeric properties, such as 'width' and 'height' (see iconDefaults keys for list of properties),
|
||||
* removes entries from icons and sets default entry in root of icon set object.
|
||||
*
|
||||
* For example, this:
|
||||
@ -45,93 +45,88 @@ import { minifyProps, iconDefaults } from '../icon';
|
||||
export function minifyIconSet(data: IconifyJSON): void {
|
||||
const icons = Object.keys(data.icons);
|
||||
|
||||
minifyProps.forEach((prop) => {
|
||||
// Check for default value for property
|
||||
const hasIconDefault = typeof iconDefaults[prop] === 'number';
|
||||
if (hasIconDefault && data[prop] === iconDefaults[prop]) {
|
||||
delete data[prop];
|
||||
}
|
||||
(Object.keys(iconDefaults) as (keyof typeof iconDefaults)[]).forEach(
|
||||
(prop) => {
|
||||
// Check for default value for property
|
||||
if (data[prop] === iconDefaults[prop]) {
|
||||
delete data[prop];
|
||||
}
|
||||
const defaultValue = iconDefaults[prop];
|
||||
const propType = typeof defaultValue;
|
||||
|
||||
// Check for previously minified value
|
||||
const hasMinifiedDefault = typeof data[prop] === 'number';
|
||||
// Check for previously minified value
|
||||
const hasMinifiedDefault =
|
||||
typeof data[prop] === propType && data[prop] !== defaultValue;
|
||||
|
||||
// Find value that is used by most icons
|
||||
let maxCount = 0;
|
||||
let maxValue: number | null = null;
|
||||
const counters: Map<number, number> = new Map();
|
||||
// Find value that is used by most icons
|
||||
let maxCount = 0;
|
||||
let maxValue: typeof defaultValue | null = null;
|
||||
const counters: Map<typeof defaultValue, number> = new Map();
|
||||
|
||||
for (let i = 0; i < icons.length; i++) {
|
||||
const item = data.icons[icons[i]];
|
||||
for (let i = 0; i < icons.length; i++) {
|
||||
const item = data.icons[icons[i]];
|
||||
|
||||
let value: number;
|
||||
if (typeof item[prop] === 'number') {
|
||||
value = item[prop]!;
|
||||
} else if (hasMinifiedDefault) {
|
||||
value = data[prop]!;
|
||||
} else if (hasIconDefault) {
|
||||
value = iconDefaults[prop];
|
||||
let value: typeof defaultValue;
|
||||
if (typeof item[prop] === propType) {
|
||||
value = item[prop]!;
|
||||
} else if (hasMinifiedDefault) {
|
||||
value = data[prop]!;
|
||||
} else {
|
||||
value = iconDefaults[prop];
|
||||
}
|
||||
|
||||
if (i === 0) {
|
||||
// First item
|
||||
maxCount = 1;
|
||||
maxValue = value;
|
||||
counters.set(value, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!counters.has(value)) {
|
||||
// First entry for new value
|
||||
counters.set(value, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
const count = counters.get(value)! + 1;
|
||||
counters.set(value, count);
|
||||
if (count > maxCount) {
|
||||
maxCount = count;
|
||||
maxValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Found value to minify
|
||||
const canMinify = maxValue !== null && maxCount > 1;
|
||||
const oldDefault = hasMinifiedDefault ? data[prop] : null;
|
||||
|
||||
// Change global value
|
||||
if (!canMinify || maxValue === defaultValue) {
|
||||
delete data[prop];
|
||||
} else {
|
||||
// Cannot minify property
|
||||
maxValue = null;
|
||||
break;
|
||||
data[prop as 'height'] = maxValue as number;
|
||||
}
|
||||
|
||||
if (i === 0) {
|
||||
// First item
|
||||
maxCount = 1;
|
||||
maxValue = value;
|
||||
counters.set(value, 1);
|
||||
continue;
|
||||
}
|
||||
// Minify stuff
|
||||
icons.forEach((key) => {
|
||||
const item = data.icons[key];
|
||||
if (canMinify && item[prop] === maxValue) {
|
||||
// New value matches minified value
|
||||
delete item[prop];
|
||||
return;
|
||||
}
|
||||
|
||||
if (!counters.has(value)) {
|
||||
// First entry for new value
|
||||
counters.set(value, 1);
|
||||
continue;
|
||||
}
|
||||
if (hasMinifiedDefault && item[prop] === void 0) {
|
||||
// Old value matches old minified value
|
||||
item[prop as 'height'] = oldDefault as number;
|
||||
}
|
||||
|
||||
const count = counters.get(value)! + 1;
|
||||
counters.set(value, count);
|
||||
if (count > maxCount) {
|
||||
maxCount = count;
|
||||
maxValue = value;
|
||||
}
|
||||
if (!canMinify && item[prop] === iconDefaults[prop]) {
|
||||
// Current value (after changes above) matches default and there is no minified value
|
||||
delete item[prop];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Found value to minify
|
||||
const canMinify = maxValue !== null && maxCount > 1;
|
||||
const oldDefault = hasMinifiedDefault ? data[prop] : null;
|
||||
|
||||
// Change global value
|
||||
if (!canMinify) {
|
||||
delete data[prop];
|
||||
} else {
|
||||
data[prop] = maxValue!;
|
||||
}
|
||||
|
||||
// Check if new minified value matches default value
|
||||
if (hasIconDefault && data[prop] === iconDefaults[prop]) {
|
||||
delete data[prop];
|
||||
}
|
||||
|
||||
// Minify stuff
|
||||
icons.forEach((key) => {
|
||||
const item = data.icons[key];
|
||||
if (canMinify && item[prop] === maxValue) {
|
||||
// New value matches minified value
|
||||
delete item[prop];
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasMinifiedDefault && item[prop] === void 0) {
|
||||
// Old value matches old minified value
|
||||
item[prop] = oldDefault!;
|
||||
}
|
||||
|
||||
if (!canMinify && item[prop] === iconDefaults[prop]) {
|
||||
// Current value (after changes above) matches default and there is no minified value
|
||||
delete item[prop];
|
||||
}
|
||||
});
|
||||
});
|
||||
);
|
||||
}
|
||||
|
@ -1,26 +1,28 @@
|
||||
import type {
|
||||
IconifyJSON,
|
||||
IconifyIcon,
|
||||
IconifyOptional,
|
||||
IconifyAlias,
|
||||
IconifyIcons,
|
||||
IconifyAliases,
|
||||
} from '@iconify/types';
|
||||
import type { FullIconifyIcon } from '../icon';
|
||||
import { iconDefaults } from '../icon';
|
||||
import { mergeIconData } from '../icon/merge';
|
||||
import type { IconifyAlias, IconifyJSON } from '@iconify/types';
|
||||
import { FullIconifyIcon, iconDefaults } from '../icon';
|
||||
import { getIconData } from './get-icon';
|
||||
import { IconSetValidationOptions, validateIconSet } from './validate';
|
||||
|
||||
/**
|
||||
* What to track when adding icon set:
|
||||
* What to track when parsing icon set:
|
||||
*
|
||||
* none - do not track anything, return true on success
|
||||
* added - track added icons, return list of added icons on success
|
||||
* all - track added and missing icons, return full list on success
|
||||
* valid - track valid icons, return list of valid icons on success
|
||||
* all - track valid and missing icons, return full list on success
|
||||
*/
|
||||
export type AddIconSetTracking = 'none' | 'added' | 'all';
|
||||
export type ParseIconSetTracking = 'none' | 'valid' | 'all';
|
||||
|
||||
/**
|
||||
* Callback to add icon to storage.
|
||||
* Which aliases to parse:
|
||||
*
|
||||
* none - do not parse aliases
|
||||
* all - parse all aliases
|
||||
* variations - parse only aliases that have transformations (can be considered to be different icon)
|
||||
*/
|
||||
export type ParseIconSetAliases = 'none' | 'all' | 'variations';
|
||||
|
||||
/**
|
||||
* Callback to call for each icon.
|
||||
*
|
||||
* If data === null, icon is missing.
|
||||
*/
|
||||
@ -30,35 +32,21 @@ export type SplitIconSetCallback = (
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Get list of defaults keys
|
||||
* Check if alias is a variation
|
||||
*/
|
||||
const defaultsKeys = Object.keys(iconDefaults) as (keyof IconifyOptional)[];
|
||||
|
||||
/**
|
||||
* Resolve alias
|
||||
*/
|
||||
function resolveAlias(
|
||||
alias: IconifyAlias,
|
||||
icons: IconifyIcons,
|
||||
aliases: IconifyAliases,
|
||||
level = 0
|
||||
): IconifyIcon | null {
|
||||
const parent = alias.parent;
|
||||
if (icons[parent] !== void 0) {
|
||||
return mergeIconData(icons[parent], alias);
|
||||
}
|
||||
if (aliases[parent] !== void 0) {
|
||||
if (level > 2) {
|
||||
// icon + alias + alias + alias = too much nesting, possibly infinite
|
||||
return null;
|
||||
}
|
||||
const icon = resolveAlias(aliases[parent], icons, aliases, level + 1);
|
||||
if (icon) {
|
||||
return mergeIconData(icon, alias);
|
||||
export function isVariation(item: IconifyAlias): boolean {
|
||||
for (const key in iconDefaults) {
|
||||
if (item[key as keyof typeof iconDefaults] !== void 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return null;
|
||||
export interface ParseIconSetOptions {
|
||||
validate?: boolean | IconSetValidationOptions;
|
||||
list?: ParseIconSetTracking;
|
||||
aliases?: ParseIconSetAliases;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,13 +55,31 @@ function resolveAlias(
|
||||
export function parseIconSet(
|
||||
data: IconifyJSON,
|
||||
callback: SplitIconSetCallback,
|
||||
list: AddIconSetTracking = 'none'
|
||||
options?: ParseIconSetOptions
|
||||
): boolean | string[] {
|
||||
const added: string[] = [];
|
||||
// List of icon names
|
||||
const names: string[] = [];
|
||||
|
||||
// Options
|
||||
options = options || {};
|
||||
const list = options.list || 'none';
|
||||
|
||||
const validate = options.validate;
|
||||
if (validate !== false) {
|
||||
// Validate icon set
|
||||
try {
|
||||
validateIconSet(
|
||||
data,
|
||||
typeof validate === 'object' ? validate : { fix: true }
|
||||
);
|
||||
} catch (err) {
|
||||
return list === 'none' ? false : [];
|
||||
}
|
||||
}
|
||||
|
||||
// Must be an object
|
||||
if (typeof data !== 'object') {
|
||||
return list === 'none' ? false : added;
|
||||
return list === 'none' ? false : names;
|
||||
}
|
||||
|
||||
// Check for missing icons list returned by API
|
||||
@ -81,55 +87,43 @@ export function parseIconSet(
|
||||
data.not_found.forEach((name) => {
|
||||
callback(name, null);
|
||||
if (list === 'all') {
|
||||
added.push(name);
|
||||
names.push(name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Must have 'icons' object
|
||||
if (typeof data.icons !== 'object') {
|
||||
return list === 'none' ? false : added;
|
||||
return list === 'none' ? false : names;
|
||||
}
|
||||
|
||||
// Get default values
|
||||
const defaults = Object.create(null);
|
||||
defaultsKeys.forEach((key) => {
|
||||
if (data[key] !== void 0 && typeof data[key] !== 'object') {
|
||||
defaults[key] = data[key];
|
||||
}
|
||||
});
|
||||
|
||||
// Get icons
|
||||
const icons = data.icons;
|
||||
Object.keys(icons).forEach((name) => {
|
||||
const icon = icons[name];
|
||||
if (typeof icon.body !== 'string') {
|
||||
return;
|
||||
const iconData = getIconData(data, name, true);
|
||||
if (iconData) {
|
||||
// Call callback
|
||||
callback(name, iconData);
|
||||
names.push(name);
|
||||
}
|
||||
|
||||
// Freeze icon to make sure it will not be modified
|
||||
callback(
|
||||
name,
|
||||
Object.freeze({ ...iconDefaults, ...defaults, ...icon })
|
||||
);
|
||||
added.push(name);
|
||||
});
|
||||
|
||||
// Get aliases
|
||||
if (typeof data.aliases === 'object') {
|
||||
const parseAliases = options.aliases || 'all';
|
||||
if (parseAliases !== 'none' && typeof data.aliases === 'object') {
|
||||
const aliases = data.aliases;
|
||||
Object.keys(aliases).forEach((name) => {
|
||||
const icon = resolveAlias(aliases[name], icons, aliases, 1);
|
||||
if (icon) {
|
||||
// Freeze icon to make sure it will not be modified
|
||||
callback(
|
||||
name,
|
||||
Object.freeze({ ...iconDefaults, ...defaults, ...icon })
|
||||
);
|
||||
added.push(name);
|
||||
if (parseAliases === 'variations' && isVariation(aliases[name])) {
|
||||
return;
|
||||
}
|
||||
const iconData = getIconData(data, name, true);
|
||||
if (iconData) {
|
||||
// Call callback
|
||||
callback(name, iconData);
|
||||
names.push(name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return list === 'none' ? added.length > 0 : added;
|
||||
return list === 'none' ? names.length > 0 : names;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { IconifyJSON, IconifyOptional } from '@iconify/types';
|
||||
import { minifyProps, matchName } from '../icon';
|
||||
import { iconDefaults, matchName } from '../icon';
|
||||
|
||||
/**
|
||||
* Match character
|
||||
@ -270,15 +270,16 @@ export function validateIconSet(
|
||||
}
|
||||
}
|
||||
|
||||
// Validate all properties that can be optimised, must be numbers
|
||||
minifyProps.forEach((prop) => {
|
||||
if (
|
||||
data[prop as keyof IconifyJSON] !== void 0 &&
|
||||
typeof data[prop as keyof IconifyJSON] !== 'number'
|
||||
) {
|
||||
throw new Error(`Invalid value type for "${prop}"`);
|
||||
// Validate all properties that can be optimised
|
||||
(Object.keys(iconDefaults) as (keyof typeof iconDefaults)[]).forEach(
|
||||
(prop) => {
|
||||
const expectedType = typeof iconDefaults[prop];
|
||||
const actualType = typeof data[prop as keyof IconifyJSON];
|
||||
if (actualType !== 'undefined' && actualType !== expectedType) {
|
||||
throw new Error(`Invalid value type for "${prop}"`);
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
// Validate characters map
|
||||
if (data.chars !== void 0) {
|
||||
|
@ -1,8 +1,4 @@
|
||||
import type {
|
||||
IconifyOptional,
|
||||
IconifyDimenisons,
|
||||
IconifyIcon,
|
||||
} from '@iconify/types';
|
||||
import type { IconifyOptional, IconifyIcon } from '@iconify/types';
|
||||
|
||||
// Export icon and full icon types
|
||||
export { IconifyIcon };
|
||||
@ -13,19 +9,6 @@ export type FullIconifyIcon = Required<IconifyIcon>;
|
||||
*/
|
||||
export const matchName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
||||
|
||||
/**
|
||||
* Properties that can be minified
|
||||
*
|
||||
* Values of all these properties are awalys numbers
|
||||
*/
|
||||
export const minifyProps: (keyof IconifyDimenisons)[] = [
|
||||
// All IconifyDimenisons properties
|
||||
'width',
|
||||
'height',
|
||||
'top',
|
||||
'left',
|
||||
];
|
||||
|
||||
/**
|
||||
* Default values for all optional IconifyIcon properties
|
||||
*/
|
||||
|
@ -1,4 +1,3 @@
|
||||
import type { IconifyJSON } from '@iconify/types';
|
||||
import { parseIconSet } from '../lib/icon-set/parse';
|
||||
import type { FullIconifyIcon } from '../lib/icon';
|
||||
|
||||
@ -151,7 +150,9 @@ describe('Testing parsing icon set', () => {
|
||||
// Check icon data
|
||||
expect(data).toEqual(expected[name]);
|
||||
},
|
||||
'all'
|
||||
{
|
||||
list: 'all',
|
||||
}
|
||||
)
|
||||
).toEqual(namesCopy);
|
||||
|
||||
@ -168,6 +169,9 @@ describe('Testing parsing icon set', () => {
|
||||
'alias2f',
|
||||
'alias2z',
|
||||
'alias2z3',
|
||||
'alias2z4',
|
||||
'alias2z5',
|
||||
'alias2z6',
|
||||
];
|
||||
const namesCopy = names.slice(0);
|
||||
|
||||
@ -237,6 +241,39 @@ describe('Testing parsing icon set', () => {
|
||||
vFlip: true,
|
||||
rotate: 1,
|
||||
},
|
||||
alias2z4: {
|
||||
// alias of alias2z3
|
||||
body: '<path d="icon2" />',
|
||||
width: 21,
|
||||
height: 24,
|
||||
top: 0,
|
||||
left: 0,
|
||||
hFlip: false,
|
||||
vFlip: true,
|
||||
rotate: 1,
|
||||
},
|
||||
alias2z5: {
|
||||
// alias of alias2z4
|
||||
body: '<path d="icon2" />',
|
||||
width: 21,
|
||||
height: 24,
|
||||
top: 0,
|
||||
left: 0,
|
||||
hFlip: false,
|
||||
vFlip: true,
|
||||
rotate: 1,
|
||||
},
|
||||
alias2z6: {
|
||||
// alias of alias2z5
|
||||
body: '<path d="icon2" />',
|
||||
width: 21,
|
||||
height: 24,
|
||||
top: 0,
|
||||
left: 0,
|
||||
hFlip: false,
|
||||
vFlip: true,
|
||||
rotate: 1,
|
||||
},
|
||||
};
|
||||
|
||||
// Do stuff
|
||||
@ -283,9 +320,21 @@ describe('Testing parsing icon set', () => {
|
||||
},
|
||||
alias2z4: {
|
||||
// 4 parents: alias2z3, alias2z, alias2f, icon2
|
||||
// nesting is too deep and should not be parsed
|
||||
parent: 'alias2z3',
|
||||
},
|
||||
alias2z5: {
|
||||
// 5 parents: alias2z4, alias2z3, alias2z, alias2f, icon2
|
||||
parent: 'alias2z4',
|
||||
},
|
||||
alias2z6: {
|
||||
// 6 parents: alias2z5, alias2z4, alias2z3, alias2z, alias2f, icon2
|
||||
parent: 'alias2z5',
|
||||
},
|
||||
alias2z7: {
|
||||
// 7 parents: alias2z6, alias2z5, alias2z4, alias2z3, alias2z, alias2f, icon2
|
||||
// nesting is too deep and should not be parsed
|
||||
parent: 'alias2z6',
|
||||
},
|
||||
alias3: {
|
||||
// invalid parent
|
||||
parent: 'icon3',
|
||||
@ -301,81 +350,9 @@ describe('Testing parsing icon set', () => {
|
||||
// Check icon data
|
||||
expect(data).toEqual(expected[name]);
|
||||
},
|
||||
'added'
|
||||
)
|
||||
).toEqual(namesCopy);
|
||||
|
||||
// All names should have been parsed
|
||||
expect(names).toEqual([]);
|
||||
});
|
||||
|
||||
test('Invalid default values', () => {
|
||||
// Names list
|
||||
const names: string[] = ['icon1', 'icon2'];
|
||||
const namesCopy = names.slice(0);
|
||||
|
||||
// Resolved data
|
||||
const expected: Record<string, FullIconifyIcon | null> = {
|
||||
icon1: {
|
||||
body: '<path d="icon1" />',
|
||||
width: 20,
|
||||
height: 20,
|
||||
top: 0,
|
||||
left: 0,
|
||||
hFlip: false,
|
||||
vFlip: false,
|
||||
rotate: 0,
|
||||
},
|
||||
icon2: {
|
||||
body: '<path d="icon2" />',
|
||||
width: 24,
|
||||
height: 24,
|
||||
top: 0,
|
||||
left: 0,
|
||||
hFlip: false,
|
||||
vFlip: false,
|
||||
rotate: 0,
|
||||
},
|
||||
};
|
||||
|
||||
const iconSet: IconifyJSON = {
|
||||
icons: {
|
||||
icon1: {
|
||||
body: '<path d="icon1" />',
|
||||
width: 20,
|
||||
// Default should not override this
|
||||
height: 20,
|
||||
},
|
||||
icon2: {
|
||||
body: '<path d="icon2" />',
|
||||
width: 24,
|
||||
},
|
||||
icon3: {
|
||||
// Missing 'body'
|
||||
width: 24,
|
||||
},
|
||||
},
|
||||
height: 24,
|
||||
// Objects should be ignored. Not testing other types because validation is done only for objects
|
||||
rotate: {
|
||||
foo: 1,
|
||||
},
|
||||
hFlip: null,
|
||||
} as unknown as IconifyJSON;
|
||||
|
||||
// Do stuff
|
||||
expect(
|
||||
parseIconSet(
|
||||
iconSet,
|
||||
(name, data) => {
|
||||
// Make sure name matches
|
||||
expect(names.length).toBeGreaterThanOrEqual(1);
|
||||
expect(name).toBe(names.shift());
|
||||
|
||||
// Check icon data
|
||||
expect(data).toEqual(expected[name]);
|
||||
},
|
||||
'all'
|
||||
{
|
||||
list: 'valid',
|
||||
}
|
||||
)
|
||||
).toEqual(namesCopy);
|
||||
|
||||
|
@ -218,4 +218,70 @@ describe('Testing validation', () => {
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
test('Invalid default values', (done) => {
|
||||
try {
|
||||
validateIconSet(
|
||||
{
|
||||
prefix: 'foo',
|
||||
icons: {
|
||||
icon1: {
|
||||
body: '<path d="icon1" />',
|
||||
},
|
||||
},
|
||||
height: 24,
|
||||
// Object
|
||||
rotate: {
|
||||
foo: 1,
|
||||
},
|
||||
},
|
||||
{ fix: true }
|
||||
);
|
||||
done('Expected to throw error for bad default properties');
|
||||
} catch (err) {
|
||||
//
|
||||
}
|
||||
|
||||
try {
|
||||
validateIconSet(
|
||||
{
|
||||
prefix: 'foo',
|
||||
icons: {
|
||||
icon1: {
|
||||
body: '<path d="icon1" />',
|
||||
},
|
||||
},
|
||||
height: 24,
|
||||
// Object
|
||||
hFlip: null,
|
||||
},
|
||||
{ fix: true }
|
||||
);
|
||||
done('Expected to throw error for bad default properties');
|
||||
} catch (err) {
|
||||
//
|
||||
}
|
||||
|
||||
try {
|
||||
validateIconSet(
|
||||
{
|
||||
prefix: 'foo',
|
||||
icons: {
|
||||
icon1: {
|
||||
body: '<path d="icon1" />',
|
||||
},
|
||||
},
|
||||
height: 24,
|
||||
// String
|
||||
width: '32',
|
||||
},
|
||||
{ fix: true }
|
||||
);
|
||||
done('Expected to throw error for bad default properties');
|
||||
} catch (err) {
|
||||
//
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
78
packages/vue/package-lock.json
generated
78
packages/vue/package-lock.json
generated
@ -1,19 +1,19 @@
|
||||
{
|
||||
"name": "@iconify/vue",
|
||||
"version": "3.1.0-beta.4",
|
||||
"version": "3.1.0-beta.5",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@iconify/vue",
|
||||
"version": "3.1.0-beta.4",
|
||||
"version": "3.1.0-beta.5",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cross-fetch": "^3.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.15.6",
|
||||
"@iconify/core": "^1.2.0-beta.3",
|
||||
"@iconify/core": "^1.2.0-beta.4",
|
||||
"@microsoft/api-extractor": "^7.15.2",
|
||||
"@rollup/plugin-node-resolve": "^13.0.0",
|
||||
"@types/jest": "^27.0.2",
|
||||
@ -1607,30 +1607,30 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@iconify/core": {
|
||||
"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==",
|
||||
"version": "1.2.0-beta.4",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.4.tgz",
|
||||
"integrity": "sha512-wlBgiE8r3cq91J5x1RPOl1IydWcnaYTdjE031zLuPsrU6v53KD08MWHT5/2NFbqYHIMGdAWmGe8rAOMF9447lQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@iconify/api-redundancy": "^1.0.2",
|
||||
"@iconify/types": "^1.0.7",
|
||||
"@iconify/utils": "^1.0.9",
|
||||
"@iconify/types": "^1.0.10",
|
||||
"@iconify/utils": "^1.0.15",
|
||||
"cross-fetch": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@iconify/types": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.9.tgz",
|
||||
"integrity": "sha512-ALO6IGXBEztcySLq+vGJrgUJqGgiZJ8sTQ8mM6e3i77okM9fw8F23h6GLbbaMz/pNfeK8QHJBAOmx3LjhZ3YZw==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz",
|
||||
"integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@iconify/utils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.10.tgz",
|
||||
"integrity": "sha512-a1n7qGqoOMdaD20DzxRVRgXr77qjVmyiEzJeLmIoBOXWE2ueJ1O/0EXHzTMGuYFWcKtu0pFHbqghNfh1vpTtdw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.15.tgz",
|
||||
"integrity": "sha512-ENcZMIaU6niedrY9rNMPofYOlN+d/7k4sDxxQbkcuu/MUyUrVugDLUeNDln9CmNcrwbHzBAoItkGQ21H5gXiPw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@iconify/types": "^1.0.7"
|
||||
"@iconify/types": "^1.0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@istanbuljs/load-nyc-config": {
|
||||
@ -3672,9 +3672,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.3.856",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.856.tgz",
|
||||
"integrity": "sha512-lSezYIe1/p5qkEswAfaQUseOBiwGwuCvRl/MKzOEVe++DcmQ92+43dznDl4rFJ4Zpu+kevhwyIf7KjJevyDA/A==",
|
||||
"version": "1.3.857",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.857.tgz",
|
||||
"integrity": "sha512-a5kIr2lajm4bJ5E4D3fp8Y/BRB0Dx2VOcCRE5Gtb679mXIME/OFhWler8Gy2ksrf8gFX+EFCSIGA33FB3gqYpg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/emittery": {
|
||||
@ -6433,9 +6433,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/node-releases": {
|
||||
"version": "1.1.76",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.76.tgz",
|
||||
"integrity": "sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA==",
|
||||
"version": "1.1.77",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.77.tgz",
|
||||
"integrity": "sha512-rB1DUFUNAN4Gn9keO2K1efO35IDK7yKHCdCaIMvFO7yUYmmZYeDjnGKle26G4rwj+LKRQpjyUUvMkPglwGCYNQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/normalize-path": {
|
||||
@ -8823,30 +8823,30 @@
|
||||
"dev": true
|
||||
},
|
||||
"@iconify/core": {
|
||||
"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==",
|
||||
"version": "1.2.0-beta.4",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.4.tgz",
|
||||
"integrity": "sha512-wlBgiE8r3cq91J5x1RPOl1IydWcnaYTdjE031zLuPsrU6v53KD08MWHT5/2NFbqYHIMGdAWmGe8rAOMF9447lQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@iconify/api-redundancy": "^1.0.2",
|
||||
"@iconify/types": "^1.0.7",
|
||||
"@iconify/utils": "^1.0.9",
|
||||
"@iconify/types": "^1.0.10",
|
||||
"@iconify/utils": "^1.0.15",
|
||||
"cross-fetch": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"@iconify/types": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.9.tgz",
|
||||
"integrity": "sha512-ALO6IGXBEztcySLq+vGJrgUJqGgiZJ8sTQ8mM6e3i77okM9fw8F23h6GLbbaMz/pNfeK8QHJBAOmx3LjhZ3YZw==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz",
|
||||
"integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@iconify/utils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.10.tgz",
|
||||
"integrity": "sha512-a1n7qGqoOMdaD20DzxRVRgXr77qjVmyiEzJeLmIoBOXWE2ueJ1O/0EXHzTMGuYFWcKtu0pFHbqghNfh1vpTtdw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.15.tgz",
|
||||
"integrity": "sha512-ENcZMIaU6niedrY9rNMPofYOlN+d/7k4sDxxQbkcuu/MUyUrVugDLUeNDln9CmNcrwbHzBAoItkGQ21H5gXiPw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@iconify/types": "^1.0.7"
|
||||
"@iconify/types": "^1.0.10"
|
||||
}
|
||||
},
|
||||
"@istanbuljs/load-nyc-config": {
|
||||
@ -10497,9 +10497,9 @@
|
||||
}
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.3.856",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.856.tgz",
|
||||
"integrity": "sha512-lSezYIe1/p5qkEswAfaQUseOBiwGwuCvRl/MKzOEVe++DcmQ92+43dznDl4rFJ4Zpu+kevhwyIf7KjJevyDA/A==",
|
||||
"version": "1.3.857",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.857.tgz",
|
||||
"integrity": "sha512-a5kIr2lajm4bJ5E4D3fp8Y/BRB0Dx2VOcCRE5Gtb679mXIME/OFhWler8Gy2ksrf8gFX+EFCSIGA33FB3gqYpg==",
|
||||
"dev": true
|
||||
},
|
||||
"emittery": {
|
||||
@ -12570,9 +12570,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node-releases": {
|
||||
"version": "1.1.76",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.76.tgz",
|
||||
"integrity": "sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA==",
|
||||
"version": "1.1.77",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.77.tgz",
|
||||
"integrity": "sha512-rB1DUFUNAN4Gn9keO2K1efO35IDK7yKHCdCaIMvFO7yUYmmZYeDjnGKle26G4rwj+LKRQpjyUUvMkPglwGCYNQ==",
|
||||
"dev": true
|
||||
},
|
||||
"normalize-path": {
|
||||
|
@ -38,7 +38,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.15.6",
|
||||
"@iconify/core": "^1.2.0-beta.3",
|
||||
"@iconify/core": "^1.2.0-beta.4",
|
||||
"@microsoft/api-extractor": "^7.15.2",
|
||||
"@rollup/plugin-node-resolve": "^13.0.0",
|
||||
"@types/jest": "^27.0.2",
|
||||
|
@ -70,11 +70,21 @@ export function addCollection(
|
||||
: prefix !== false && typeof data.prefix === 'string'
|
||||
? data.prefix + ':'
|
||||
: '';
|
||||
parseIconSet(data, (name, icon) => {
|
||||
if (icon !== null) {
|
||||
storage[iconPrefix + name] = icon;
|
||||
parseIconSet(
|
||||
data,
|
||||
(name, icon) => {
|
||||
if (icon) {
|
||||
storage[iconPrefix + name] = icon;
|
||||
}
|
||||
},
|
||||
{
|
||||
// Allow empty prefix
|
||||
validate: {
|
||||
fix: true,
|
||||
prefix: iconPrefix,
|
||||
},
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
50
packages/vue2/package-lock.json
generated
50
packages/vue2/package-lock.json
generated
@ -13,7 +13,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.15.6",
|
||||
"@iconify/core": "^1.2.0-beta.3",
|
||||
"@iconify/core": "^1.2.0-beta.4",
|
||||
"@microsoft/api-extractor": "^7.15.1",
|
||||
"@rollup/plugin-node-resolve": "^13.0.0",
|
||||
"@types/jest": "^27.0.2",
|
||||
@ -1607,30 +1607,30 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@iconify/core": {
|
||||
"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==",
|
||||
"version": "1.2.0-beta.4",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.4.tgz",
|
||||
"integrity": "sha512-wlBgiE8r3cq91J5x1RPOl1IydWcnaYTdjE031zLuPsrU6v53KD08MWHT5/2NFbqYHIMGdAWmGe8rAOMF9447lQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@iconify/api-redundancy": "^1.0.2",
|
||||
"@iconify/types": "^1.0.7",
|
||||
"@iconify/utils": "^1.0.9",
|
||||
"@iconify/types": "^1.0.10",
|
||||
"@iconify/utils": "^1.0.15",
|
||||
"cross-fetch": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@iconify/types": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.9.tgz",
|
||||
"integrity": "sha512-ALO6IGXBEztcySLq+vGJrgUJqGgiZJ8sTQ8mM6e3i77okM9fw8F23h6GLbbaMz/pNfeK8QHJBAOmx3LjhZ3YZw==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz",
|
||||
"integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@iconify/utils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.10.tgz",
|
||||
"integrity": "sha512-a1n7qGqoOMdaD20DzxRVRgXr77qjVmyiEzJeLmIoBOXWE2ueJ1O/0EXHzTMGuYFWcKtu0pFHbqghNfh1vpTtdw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.15.tgz",
|
||||
"integrity": "sha512-ENcZMIaU6niedrY9rNMPofYOlN+d/7k4sDxxQbkcuu/MUyUrVugDLUeNDln9CmNcrwbHzBAoItkGQ21H5gXiPw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@iconify/types": "^1.0.7"
|
||||
"@iconify/types": "^1.0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@istanbuljs/load-nyc-config": {
|
||||
@ -8974,30 +8974,30 @@
|
||||
"dev": true
|
||||
},
|
||||
"@iconify/core": {
|
||||
"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==",
|
||||
"version": "1.2.0-beta.4",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/core/-/core-1.2.0-beta.4.tgz",
|
||||
"integrity": "sha512-wlBgiE8r3cq91J5x1RPOl1IydWcnaYTdjE031zLuPsrU6v53KD08MWHT5/2NFbqYHIMGdAWmGe8rAOMF9447lQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@iconify/api-redundancy": "^1.0.2",
|
||||
"@iconify/types": "^1.0.7",
|
||||
"@iconify/utils": "^1.0.9",
|
||||
"@iconify/types": "^1.0.10",
|
||||
"@iconify/utils": "^1.0.15",
|
||||
"cross-fetch": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"@iconify/types": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.9.tgz",
|
||||
"integrity": "sha512-ALO6IGXBEztcySLq+vGJrgUJqGgiZJ8sTQ8mM6e3i77okM9fw8F23h6GLbbaMz/pNfeK8QHJBAOmx3LjhZ3YZw==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz",
|
||||
"integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@iconify/utils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.10.tgz",
|
||||
"integrity": "sha512-a1n7qGqoOMdaD20DzxRVRgXr77qjVmyiEzJeLmIoBOXWE2ueJ1O/0EXHzTMGuYFWcKtu0pFHbqghNfh1vpTtdw==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.15.tgz",
|
||||
"integrity": "sha512-ENcZMIaU6niedrY9rNMPofYOlN+d/7k4sDxxQbkcuu/MUyUrVugDLUeNDln9CmNcrwbHzBAoItkGQ21H5gXiPw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@iconify/types": "^1.0.7"
|
||||
"@iconify/types": "^1.0.10"
|
||||
}
|
||||
},
|
||||
"@istanbuljs/load-nyc-config": {
|
||||
|
@ -38,7 +38,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.15.6",
|
||||
"@iconify/core": "^1.2.0-beta.3",
|
||||
"@iconify/core": "^1.2.0-beta.4",
|
||||
"@microsoft/api-extractor": "^7.15.1",
|
||||
"@rollup/plugin-node-resolve": "^13.0.0",
|
||||
"@types/jest": "^27.0.2",
|
||||
|
@ -64,9 +64,15 @@ export function addCollection(
|
||||
? data.prefix + ':'
|
||||
: '';
|
||||
parseIconSet(data, (name, icon) => {
|
||||
if (icon !== null) {
|
||||
if (icon) {
|
||||
storage[iconPrefix + name] = icon;
|
||||
}
|
||||
}, {
|
||||
// Allow empty prefix
|
||||
validate: {
|
||||
fix: true,
|
||||
prefix: iconPrefix,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user