@iconify/react
Advanced tools
Comparing version 3.1.1 to 3.1.2-dev.1
@@ -13,3 +13,3 @@ import { default as React_2 } from 'react'; | ||
*/ | ||
export declare function addCollection(data: IconifyJSON, provider?: string): boolean; | ||
export declare function addCollection(data: IconifyJSON_2, provider?: string): boolean; | ||
@@ -19,3 +19,3 @@ /** | ||
*/ | ||
export declare function addIcon(name: string, data: IconifyIcon): boolean; | ||
export declare function addIcon(name: string, data: IconifyIcon_2): boolean; | ||
@@ -38,2 +38,12 @@ /** | ||
/** | ||
* Icon with optional parameters that are provided by API and affect only search | ||
*/ | ||
declare interface APIIconAttributes_2 { | ||
// True if icon is hidden. | ||
// Used in icon sets to keep icons that no longer exist, but should still be accessible | ||
// from API, preventing websites from breaking when icon is removed by developer. | ||
hidden?: boolean; | ||
} | ||
/** | ||
* API query parameters | ||
@@ -46,3 +56,3 @@ */ | ||
*/ | ||
export declare function buildIcon(icon: IconifyIcon, customisations: RawIconCustomisations): IconifyIconBuildResult; | ||
export declare function buildIcon(icon: IconifyIcon_2, customisations: IconifyIconCustomisations_2): IconifyIconBuildResult_2; | ||
@@ -66,4 +76,8 @@ /** | ||
declare interface ExtendedIconifyIcon extends IconifyIcon, APIIconAttributes {} | ||
declare interface ExtendedIconifyAlias_2 extends IconifyAlias_2, APIIconAttributes_2 {} | ||
declare interface ExtendedIconifyIcon extends IconifyIcon_2, APIIconAttributes {} | ||
declare interface ExtendedIconifyIcon_2 extends IconifyIcon, APIIconAttributes_2 {} | ||
/** | ||
@@ -77,3 +91,3 @@ * Signature for getAPIConfig | ||
*/ | ||
export declare function getIcon(name: string): Required<IconifyIcon> | null; | ||
export declare function getIcon(name: string): Required<IconifyIcon_2> | null; | ||
@@ -110,2 +124,14 @@ /** | ||
/** | ||
* Alias. | ||
*/ | ||
declare interface IconifyAlias_2 extends IconifyOptional_2 { | ||
// Parent icon index without prefix, required. | ||
parent: string; | ||
// IconifyOptional properties. | ||
// Alias should have only properties that it overrides. | ||
// Transformations are merged, not overridden. See IconifyTransformations comments. | ||
} | ||
/** | ||
* "aliases" field of JSON file. | ||
@@ -119,2 +145,10 @@ */ | ||
/** | ||
* "aliases" field of JSON file. | ||
*/ | ||
declare interface IconifyAliases_2 { | ||
// Index is name of icon, without prefix. Value is ExtendedIconifyAlias object. | ||
[index: string]: ExtendedIconifyAlias_2; | ||
} | ||
/** | ||
* API config | ||
@@ -140,3 +174,3 @@ */ | ||
*/ | ||
loadIcons: (icons: (IconifyIconName | string)[], callback?: IconifyIconLoaderCallback) => IconifyIconLoaderAbort; | ||
loadIcons: (icons: (IconifyIconName_2 | string)[], callback?: IconifyIconLoaderCallback) => IconifyIconLoaderAbort; | ||
/** | ||
@@ -231,3 +265,3 @@ * Add API provider | ||
calculateSize: (size: string | number, ratio: number, precision?: number) => string | number; | ||
buildIcon: (icon: IconifyIcon, customisations: RawIconCustomisations) => IconifyIconBuildResult; | ||
buildIcon: (icon: IconifyIcon_2, customisations: IconifyIconCustomisations_2) => IconifyIconBuildResult_2; | ||
} | ||
@@ -246,2 +280,12 @@ | ||
/** | ||
* Icon categories | ||
*/ | ||
declare interface IconifyCategories_2 { | ||
// Index is category title, such as "Weather". | ||
// Value is array of icons that belong to that category. | ||
// Each icon can belong to multiple categories or no categories. | ||
[index: string]: string[]; | ||
} | ||
/** | ||
* Characters used in font. | ||
@@ -256,2 +300,11 @@ */ | ||
/** | ||
* Characters used in font. | ||
*/ | ||
declare interface IconifyChars_2 { | ||
// Index is character, such as "f000". | ||
// Value is icon name. | ||
[index: string]: string; | ||
} | ||
/** | ||
* Icon dimensions. | ||
@@ -283,2 +336,28 @@ * | ||
/** | ||
* Icon dimensions. | ||
* | ||
* Used in: | ||
* icon (as is) | ||
* alias (overwrite icon's properties) | ||
* root of JSON file (default values) | ||
*/ | ||
declare interface IconifyDimenisons_2 { | ||
// Left position of viewBox. | ||
// Defaults to 0. | ||
left?: number; | ||
// Top position of viewBox. | ||
// Defaults to 0. | ||
top?: number; | ||
// Width of viewBox. | ||
// Defaults to 16. | ||
width?: number; | ||
// Height of viewBox. | ||
// Defaults to 16. | ||
height?: number; | ||
} | ||
/** | ||
* React component properties: generic element for Icon component, SVG for generated component | ||
@@ -294,5 +373,10 @@ */ | ||
/** | ||
* Icon alignment | ||
*/ | ||
declare type IconifyHorizontalIconAlignment_2 = 'left' | 'center' | 'right'; | ||
/** | ||
* Icon. | ||
*/ | ||
export declare interface IconifyIcon extends IconifyOptional { | ||
export declare interface IconifyIcon extends IconifyOptional_2 { | ||
// Icon body: <path d="..." />, required. | ||
@@ -306,2 +390,13 @@ body: string; | ||
/** | ||
* Icon. | ||
*/ | ||
declare interface IconifyIcon_2 extends IconifyOptional { | ||
// Icon body: <path d="..." />, required. | ||
body: string; | ||
// IconifyOptional properties. | ||
// If property is missing in JSON file, look in root object for default value. | ||
} | ||
/** | ||
* Interface for getSVGData() result | ||
@@ -321,2 +416,16 @@ */ | ||
/** | ||
* Interface for getSVGData() result | ||
*/ | ||
declare interface IconifyIconBuildResult_2 { | ||
attributes: { | ||
width: string; | ||
height: string; | ||
preserveAspectRatio: string; | ||
viewBox: string; | ||
}; | ||
body: string; | ||
inline?: boolean; | ||
} | ||
/** | ||
* Icon customisations | ||
@@ -329,2 +438,17 @@ */ | ||
/** | ||
* Icon customisations | ||
*/ | ||
declare interface IconifyIconCustomisations_2 { | ||
inline?: boolean; | ||
width?: IconifyIconSize_2; | ||
height?: IconifyIconSize_2; | ||
hAlign?: IconifyHorizontalIconAlignment_2; | ||
vAlign?: IconifyVerticalIconAlignment_2; | ||
slice?: boolean; | ||
hFlip?: boolean; | ||
vFlip?: boolean; | ||
rotate?: number; | ||
} | ||
/** | ||
* Function to abort loading (usually just removes callback because loading is already in progress) | ||
@@ -339,3 +463,3 @@ */ | ||
*/ | ||
export declare type IconifyIconLoaderCallback = (loaded: IconifyIconName[], missing: IconifyIconName[], pending: IconifyIconName[], unsubscribe: IconifyIconLoaderAbort) => void; | ||
export declare type IconifyIconLoaderCallback = (loaded: IconifyIconName_2[], missing: IconifyIconName_2[], pending: IconifyIconName_2[], unsubscribe: IconifyIconLoaderAbort) => void; | ||
@@ -352,2 +476,11 @@ /** | ||
/** | ||
* Icon name | ||
*/ | ||
declare interface IconifyIconName_2 { | ||
readonly provider: string; | ||
readonly prefix: string; | ||
readonly name: string; | ||
} | ||
/** | ||
* Callback for when icon has been loaded (only triggered for icons loaded from API) | ||
@@ -378,2 +511,10 @@ */ | ||
/** | ||
* "icons" field of JSON file. | ||
*/ | ||
declare interface IconifyIcons_2 { | ||
// Index is name of icon, without prefix. Value is ExtendedIconifyIcon object. | ||
[index: string]: ExtendedIconifyIcon_2; | ||
} | ||
/** | ||
* Icon size | ||
@@ -384,2 +525,7 @@ */ | ||
/** | ||
* Icon size | ||
*/ | ||
declare type IconifyIconSize_2 = null | string | number; | ||
/** | ||
* Icon set information block. | ||
@@ -433,5 +579,59 @@ */ | ||
palette?: boolean; | ||
// If true, icon set should not appear in icon sets list. | ||
hidden?: boolean; | ||
} | ||
/** | ||
* Icon set information block. | ||
*/ | ||
declare interface IconifyInfo_2 { | ||
// Icon set name. | ||
name: string; | ||
// Total number of icons. | ||
total?: number; | ||
// Version string. | ||
version?: string; | ||
// Author information. | ||
author: { | ||
// Author name. | ||
name: string; | ||
// Link to author's website or icon set website. | ||
url?: string; | ||
}; | ||
// License | ||
license: { | ||
// Human readable license. | ||
title: string; | ||
// SPDX license identifier. | ||
spdx?: string; | ||
// License URL. | ||
url?: string; | ||
}; | ||
// Array of icons that should be used for samples in icon sets list. | ||
samples?: string[]; | ||
// Icon grid: number or array of numbers. | ||
height?: number | number[]; | ||
// Display height for samples: 16 - 24 | ||
displayHeight?: number; | ||
// Category on Iconify collections list. | ||
category?: string; | ||
// 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; | ||
} | ||
/** | ||
* JSON structure. | ||
@@ -441,3 +641,3 @@ * | ||
*/ | ||
export declare interface IconifyJSON extends IconifyJSONIconsData, IconifyMetaData { | ||
export declare interface IconifyJSON extends IconifyJSONIconsData_2, IconifyMetaData_2 { | ||
// Optional list of missing icons. Returned by Iconify API when querying for icons that do not exist. | ||
@@ -448,2 +648,12 @@ not_found?: string[]; | ||
/** | ||
* JSON structure. | ||
* | ||
* All optional values can exist in root of JSON file, used as defaults. | ||
*/ | ||
declare interface IconifyJSON_2 extends IconifyJSONIconsData, IconifyMetaData { | ||
// Optional list of missing icons. Returned by Iconify API when querying for icons that do not exist. | ||
not_found?: string[]; | ||
} | ||
/** | ||
* JSON structure, contains only icon data | ||
@@ -470,5 +680,26 @@ */ | ||
/** | ||
* JSON structure, contains only icon data | ||
*/ | ||
declare interface IconifyJSONIconsData_2 extends IconifyOptional_2 { | ||
// Prefix for icons in JSON file, required. | ||
prefix: string; | ||
// API provider, optional. | ||
provider?: string; | ||
// List of icons, required. | ||
icons: IconifyIcons_2; | ||
// Optional aliases. | ||
aliases?: IconifyAliases_2; | ||
// IconifyOptional properties that are used as default values for icons when icon is missing value. | ||
// If property exists in both icon and root, use value from icon. | ||
// This is used to reduce duplication. | ||
} | ||
/** | ||
* Function to load icons | ||
*/ | ||
declare type IconifyLoadIcons = (icons: (IconifyIconName | string)[], callback?: IconifyIconLoaderCallback) => IconifyIconLoaderAbort; | ||
declare type IconifyLoadIcons = (icons: (IconifyIconName_2 | string)[], callback?: IconifyIconLoaderCallback) => IconifyIconLoaderAbort; | ||
@@ -497,2 +728,23 @@ /** | ||
/** | ||
* Meta data stored in JSON file, used for browsing icon set. | ||
*/ | ||
declare interface IconifyMetaData_2 { | ||
// Icon set information block. Used for public icon sets, can be skipped for private icon sets. | ||
info?: IconifyInfo_2; | ||
// Characters used in font. Used for searching by character for icon sets imported from font, exporting icon set to font. | ||
chars?: IconifyChars_2; | ||
// Categories. Used for filtering icons. | ||
categories?: IconifyCategories_2; | ||
// Optional themes (old format). | ||
themes?: LegacyIconifyThemes_2; | ||
// Optional themes (new format). Key is prefix or suffix, value is title. | ||
prefixes?: Record<string, string>; | ||
suffixes?: Record<string, string>; | ||
} | ||
/** | ||
* Combination of dimensions and transformations. | ||
@@ -507,2 +759,11 @@ */ | ||
/** | ||
* Combination of dimensions and transformations. | ||
*/ | ||
declare interface IconifyOptional_2 | ||
extends IconifyDimenisons_2, | ||
IconifyTransformations_2 { | ||
// | ||
} | ||
/** | ||
* Interface for exported storage functions | ||
@@ -518,3 +779,3 @@ */ | ||
*/ | ||
getIcon: (name: string) => Required<IconifyIcon> | null; | ||
getIcon: (name: string) => Required<IconifyIcon_2> | null; | ||
/** | ||
@@ -527,7 +788,15 @@ * List all available icons | ||
*/ | ||
addIcon: (name: string, data: IconifyIcon) => boolean; | ||
addIcon: (name: string, data: IconifyIcon_2) => boolean; | ||
/** | ||
* Add icon set to storage | ||
*/ | ||
addCollection: (data: IconifyJSON, provider?: string) => boolean; | ||
addCollection: (data: IconifyJSON_2, provider?: string) => boolean; | ||
/** | ||
* Share storage (used to share icon data between various components or multiple instances of component) | ||
* | ||
* It works by moving storage to global variable, new instances of component attempt to detect global | ||
* variable during load. Therefore, function should be called as soon as possible. | ||
* Works only in browser, not usable in SSR. | ||
*/ | ||
shareStorage: () => void; | ||
} | ||
@@ -559,4 +828,30 @@ | ||
/** | ||
* Icon transformations. | ||
* | ||
* Used in: | ||
* icon (as is) | ||
* alias (merged with icon's properties) | ||
* root of JSON file (default values) | ||
*/ | ||
declare interface IconifyTransformations_2 { | ||
// Number of 90 degrees rotations. | ||
// 0 = 0, 1 = 90deg and so on. | ||
// Defaults to 0. | ||
// When merged (such as alias + icon), result is icon.rotation + alias.rotation. | ||
rotate?: number; | ||
// Horizontal flip. | ||
// Defaults to false. | ||
// When merged, result is icon.hFlip !== alias.hFlip | ||
hFlip?: boolean; | ||
// Vertical flip. (see hFlip comments) | ||
vFlip?: boolean; | ||
} | ||
export declare type IconifyVerticalIconAlignment = 'top' | 'middle' | 'bottom'; | ||
declare type IconifyVerticalIconAlignment_2 = 'top' | 'middle' | 'bottom'; | ||
/** | ||
@@ -594,2 +889,19 @@ * Mix of icon properties and SVGSVGElement properties | ||
/** | ||
* Optional themes, old format. | ||
* | ||
* Deprecated because format is unnecessary complicated. Key is meaningless, suffixes and prefixes are mixed together. | ||
*/ | ||
declare interface LegacyIconifyThemes_2 { | ||
// Key is unique string. | ||
[index: string]: { | ||
// Theme title. | ||
title: string; | ||
// Icon prefix or suffix, including dash. All icons that start with prefix and end with suffix belong to theme. | ||
prefix?: string; // Example: 'baseline-' | ||
suffix?: string; // Example: '-filled' | ||
}; | ||
} | ||
/** | ||
* List available icons | ||
@@ -721,2 +1033,7 @@ */ | ||
/** | ||
* Share storage between components | ||
*/ | ||
export declare function shareStorage(): void; | ||
/** | ||
* Callback for "timeout" configuration property. | ||
@@ -723,0 +1040,0 @@ * Returns number of milliseconds to wait before failing query, while there are pending resources. |
@@ -5,3 +5,3 @@ { | ||
"author": "Vjacheslav Trushkin", | ||
"version": "3.1.1", | ||
"version": "3.1.2-dev.1", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "bugs": "https://github.com/iconify/iconify/issues", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
239314
7950
1