From 4c9e7230329bc5df1c2d1379f146ed50bf25374b Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Wed, 17 Nov 2021 18:24:36 +0200 Subject: [PATCH] Add hidden property to IconifyInfo --- packages/types/package.json | 2 +- packages/types/types.ts | 3 +++ packages/utils/package-lock.json | 18 +++++++++--------- packages/utils/package.json | 6 +++--- packages/utils/src/icon-set/convert-info.ts | 8 ++++++++ packages/utils/tests/convert-info-test.ts | 2 ++ 6 files changed, 26 insertions(+), 13 deletions(-) diff --git a/packages/types/package.json b/packages/types/package.json index 663022a..536b148 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,7 +1,7 @@ { "name": "@iconify/types", "description": "Types for Iconify data", - "version": "1.0.10", + "version": "1.0.12", "author": "Vjacheslav Trushkin", "license": "(Apache-2.0 OR GPL-2.0)", "main": "./index.js", diff --git a/packages/types/types.ts b/packages/types/types.ts index fcf834b..b24d882 100644 --- a/packages/types/types.ts +++ b/packages/types/types.ts @@ -158,6 +158,9 @@ export interface IconifyInfo { // Palette status. True if icons have predefined color scheme, false if icons use currentColor. // Ideally, icon set should not mix icons with and without palette to simplify search. palette?: boolean; + + // If true, icon set should not appear in icon sets list. + hidden?: boolean; } /** diff --git a/packages/utils/package-lock.json b/packages/utils/package-lock.json index f3fffc3..c7e289c 100644 --- a/packages/utils/package-lock.json +++ b/packages/utils/package-lock.json @@ -1,15 +1,15 @@ { "name": "@iconify/utils", - "version": "1.0.13", + "version": "1.0.18", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@iconify/utils", - "version": "1.0.13", + "version": "1.0.18", "license": "MIT", "dependencies": { - "@iconify/types": "^1.0.10" + "@iconify/types": "^1.0.12" }, "devDependencies": { "@iconify/library-builder": "^1.0.3", @@ -723,9 +723,9 @@ } }, "node_modules/@iconify/types": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz", - "integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ==" + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.12.tgz", + "integrity": "sha512-6er6wSGF3hgc1JEZqiGpg21CTCjHBYOUwqLmb2Idzkjiw6ogalGP0ZMLVutCzah+0WB4yP+Zd2oVPN8jvJ+Ftg==" }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", @@ -5832,9 +5832,9 @@ } }, "@iconify/types": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.10.tgz", - "integrity": "sha512-SN3z6einVeUckDQiE8p4POF7X4hk4/y2+a7a4ogJOCxX5XT6z1zXNN8dwS5O1vloXpc6mkHizRZm2qPnhK6NnQ==" + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@iconify/types/-/types-1.0.12.tgz", + "integrity": "sha512-6er6wSGF3hgc1JEZqiGpg21CTCjHBYOUwqLmb2Idzkjiw6ogalGP0ZMLVutCzah+0WB4yP+Zd2oVPN8jvJ+Ftg==" }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", diff --git a/packages/utils/package.json b/packages/utils/package.json index 01dfda9..4dc3d4f 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -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.18", + "version": "1.0.19", "license": "MIT", "bugs": "https://github.com/iconify/iconify/issues", "homepage": "https://iconify.design/", @@ -24,7 +24,7 @@ "module": "./lib/index.mjs", "exports": { "./*": "./*", - ".": { + "./": { "require": "./lib/index.js", "import": "./lib/index.mjs" }, @@ -134,7 +134,7 @@ } }, "dependencies": { - "@iconify/types": "^1.0.10" + "@iconify/types": "^1.0.12" }, "devDependencies": { "@iconify/library-builder": "^1.0.3", diff --git a/packages/utils/src/icon-set/convert-info.ts b/packages/utils/src/icon-set/convert-info.ts index 4fc4bfd..f8baabb 100644 --- a/packages/utils/src/icon-set/convert-info.ts +++ b/packages/utils/src/icon-set/convert-info.ts @@ -37,6 +37,9 @@ export interface LegacyIconifyInfo { // Category category?: string; palette?: 'Colorless' | 'Colorful'; + + // Hidden + hidden?: boolean; } /** @@ -252,6 +255,11 @@ export function convertIconSetInfo( break; } + // Hidden + if (source.hidden === true) { + info.hidden = true; + } + // Parse all old strings Object.keys(source).forEach((key) => { const value = source[key]; diff --git a/packages/utils/tests/convert-info-test.ts b/packages/utils/tests/convert-info-test.ts index e03aff4..5b0e242 100644 --- a/packages/utils/tests/convert-info-test.ts +++ b/packages/utils/tests/convert-info-test.ts @@ -238,6 +238,7 @@ describe('Testing convertIconSetInfo', () => { height: [16, 24], category: 'General', palette: false, + hidden: true, }; const result = convertIconSetInfo(raw); const expected: IconifyInfo = { @@ -258,6 +259,7 @@ describe('Testing convertIconSetInfo', () => { height: [16, 24], category: 'General', palette: false, + hidden: true, }; expect(result).toEqual(expected); });