Added some finishing touches here and there
This commit is contained in:
parent
ddd77d9f82
commit
656b1ba417
42 changed files with 9344 additions and 30 deletions
1904
node_modules/@iconify/react/dist/iconify.cjs
generated
vendored
Normal file
1904
node_modules/@iconify/react/dist/iconify.cjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
428
node_modules/@iconify/react/dist/iconify.d.cts
generated
vendored
Normal file
428
node_modules/@iconify/react/dist/iconify.d.cts
generated
vendored
Normal file
|
|
@ -0,0 +1,428 @@
|
|||
import { IconifyIcon } from '@iconify/types';
|
||||
import { IconifyJSON } from '@iconify/types';
|
||||
import { IconifyTransformations } from '@iconify/types';
|
||||
import type { JSX as JSX_2 } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { SVGProps } from 'react';
|
||||
|
||||
/**
|
||||
* Add custom config for provider
|
||||
*/
|
||||
export declare function addAPIProvider(provider: string, customConfig: PartialIconifyAPIConfig): boolean;
|
||||
|
||||
/**
|
||||
* Add icon set
|
||||
*/
|
||||
export declare function addCollection(data: IconifyJSON, provider?: string): boolean;
|
||||
|
||||
/**
|
||||
* Add one icon
|
||||
*/
|
||||
export declare function addIcon(name: string, data: IconifyIcon | null): boolean;
|
||||
|
||||
/**
|
||||
* Internal API
|
||||
*/
|
||||
export declare const _api: IconifyAPIInternalFunctions;
|
||||
|
||||
/**
|
||||
* Get SVG attributes and content from icon + customisations
|
||||
*
|
||||
* Does not generate style to make it compatible with frameworks that use objects for style, such as React.
|
||||
* Instead, it generates 'inline' value. If true, rendering engine should add verticalAlign: -0.125em to icon.
|
||||
*
|
||||
* Customisations should be normalised by platform specific parser.
|
||||
* Result should be converted to <svg> by platform specific parser.
|
||||
* Use replaceIDs to generate unique IDs for body.
|
||||
*/
|
||||
export declare function buildIcon(icon: IconifyIcon, customisations?: IconifyIconCustomisations_2): IconifyIconBuildResult;
|
||||
|
||||
/**
|
||||
* Calculate second dimension when only 1 dimension is set
|
||||
*/
|
||||
export declare function calculateSize(size: string, ratio: number, precision?: number): string;
|
||||
|
||||
export declare function calculateSize(size: number, ratio: number, precision?: number): number;
|
||||
|
||||
export declare function calculateSize(size: string | number, ratio: number, precision?: number): string | number;
|
||||
|
||||
/**
|
||||
* Signature for getAPIConfig
|
||||
*/
|
||||
export declare type GetAPIConfig = (provider: string) => IconifyAPIConfig | undefined;
|
||||
|
||||
/**
|
||||
* Get full icon
|
||||
*/
|
||||
export declare function getIcon(name: string): Required<IconifyIcon> | null | undefined;
|
||||
|
||||
/**
|
||||
* Block icon
|
||||
*
|
||||
* @param props - Component properties
|
||||
*/
|
||||
export declare const Icon: IconComponentType;
|
||||
|
||||
declare type IconComponentType = (props: IconProps) => JSX_2.Element;
|
||||
|
||||
/**
|
||||
* API config
|
||||
*/
|
||||
export declare interface IconifyAPIConfig extends RedundancyConfig {
|
||||
path: string;
|
||||
maxURL: number;
|
||||
}
|
||||
|
||||
export declare interface IconifyAPICustomQueryParams {
|
||||
type: 'custom';
|
||||
provider?: string;
|
||||
uri: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Iconify API functions
|
||||
*/
|
||||
export declare interface IconifyAPIFunctions {
|
||||
/**
|
||||
* Load icons
|
||||
*/
|
||||
loadIcons: (icons: (IconifyIconName | string)[], callback?: IconifyIconLoaderCallback) => IconifyIconLoaderAbort;
|
||||
/**
|
||||
* Load one icon, using Promise syntax
|
||||
*/
|
||||
loadIcon: (icon: IconifyIconName | string) => Promise<Required<IconifyIcon>>;
|
||||
/**
|
||||
* Add API provider
|
||||
*/
|
||||
addAPIProvider: (provider: string, customConfig: PartialIconifyAPIConfig) => boolean;
|
||||
/**
|
||||
* Set custom loader for multple icons
|
||||
*/
|
||||
setCustomIconsLoader: (callback: IconifyCustomIconsLoader, prefix: string, provider?: string) => void;
|
||||
/**
|
||||
* Set custom loader for one icon
|
||||
*/
|
||||
setCustomIconLoader: (callback: IconifyCustomIconLoader, prefix: string, provider?: string) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Params for sendQuery()
|
||||
*/
|
||||
declare interface IconifyAPIIconsQueryParams {
|
||||
type: 'icons';
|
||||
provider: string;
|
||||
prefix: string;
|
||||
icons: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposed internal functions
|
||||
*
|
||||
* Used by plug-ins, such as Icon Finder
|
||||
*
|
||||
* Important: any changes published in a release must be backwards compatible.
|
||||
*/
|
||||
export declare interface IconifyAPIInternalFunctions {
|
||||
/**
|
||||
* Get API config, used by custom modules
|
||||
*/
|
||||
getAPIConfig: GetAPIConfig;
|
||||
/**
|
||||
* Set custom API module
|
||||
*/
|
||||
setAPIModule: (provider: string, item: IconifyAPIModule) => void;
|
||||
/**
|
||||
* Send API query
|
||||
*/
|
||||
sendAPIQuery: (target: string | PartialIconifyAPIConfig, query: IconifyAPIQueryParams, callback: QueryDoneCallback) => QueryAbortCallback;
|
||||
/**
|
||||
* Set and get fetch()
|
||||
*/
|
||||
setFetch: (item: typeof fetch) => void;
|
||||
getFetch: () => typeof fetch | undefined;
|
||||
/**
|
||||
* List all API providers (from config)
|
||||
*/
|
||||
listAPIProviders: () => string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* API modules
|
||||
*/
|
||||
export declare interface IconifyAPIModule {
|
||||
prepare: IconifyAPIPrepareIconsQuery;
|
||||
send: IconifyAPISendQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions to implement in module
|
||||
*/
|
||||
export declare type IconifyAPIPrepareIconsQuery = (provider: string, prefix: string, icons: string[]) => IconifyAPIIconsQueryParams[];
|
||||
|
||||
export declare type IconifyAPIQueryParams = IconifyAPIIconsQueryParams | IconifyAPICustomQueryParams;
|
||||
|
||||
export declare type IconifyAPISendQuery = (host: string, params: IconifyAPIQueryParams, callback: QueryModuleResponse) => void;
|
||||
|
||||
/**
|
||||
* Interface for exported builder functions
|
||||
*/
|
||||
export declare interface IconifyBuilderFunctions {
|
||||
replaceIDs?: (body: string, prefix?: string | (() => string)) => string;
|
||||
calculateSize: (size: string | number, ratio: number, precision?: number) => string | number;
|
||||
buildIcon: (icon: IconifyIcon, customisations?: IconifyIconCustomisations_2) => IconifyIconBuildResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom loader for one icon
|
||||
*/
|
||||
export declare type IconifyCustomIconLoader = (name: string, prefix: string, provider: string) => Promise<IconifyIcon | null> | IconifyIcon | null;
|
||||
|
||||
/**
|
||||
* Custom icons loader
|
||||
*/
|
||||
export declare type IconifyCustomIconsLoader = (icons: string[], prefix: string, provider: string) => Promise<IconifyJSON | null> | IconifyJSON | null;
|
||||
|
||||
/**
|
||||
* React component properties: generic element for Icon component, SVG for generated component
|
||||
*/
|
||||
declare type IconifyElementProps = SVGProps<SVGSVGElement>;
|
||||
|
||||
export { IconifyIcon }
|
||||
|
||||
/**
|
||||
* Interface for getSVGData() result
|
||||
*/
|
||||
export declare interface IconifyIconBuildResult {
|
||||
attributes: {
|
||||
width?: string;
|
||||
height?: string;
|
||||
viewBox: string;
|
||||
};
|
||||
viewBox: SVGViewBox;
|
||||
body: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon customisations
|
||||
*/
|
||||
export declare type IconifyIconCustomisations = IconifyIconCustomisations_2 & {
|
||||
rotate?: string | number;
|
||||
inline?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Icon customisations
|
||||
*/
|
||||
declare interface IconifyIconCustomisations_2 extends IconifyTransformations, IconifyIconSizeCustomisations {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to abort loading (usually just removes callback because loading is already in progress)
|
||||
*/
|
||||
export declare type IconifyIconLoaderAbort = () => void;
|
||||
|
||||
/**
|
||||
* Loader callback
|
||||
*
|
||||
* Provides list of icons that have been loaded
|
||||
*/
|
||||
export declare type IconifyIconLoaderCallback = (loaded: IconifyIconName[], missing: IconifyIconName[], pending: IconifyIconName[], unsubscribe: IconifyIconLoaderAbort) => void;
|
||||
|
||||
/**
|
||||
* Icon name
|
||||
*/
|
||||
export declare interface IconifyIconName {
|
||||
readonly provider: string;
|
||||
readonly prefix: string;
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for when icon has been loaded (only triggered for icons loaded from API)
|
||||
*/
|
||||
export declare type IconifyIconOnLoad = (name: string) => void;
|
||||
|
||||
/**
|
||||
* Icon properties
|
||||
*/
|
||||
export declare interface IconifyIconProps extends IconifyIconCustomisations {
|
||||
icon: IconifyIcon | string;
|
||||
mode?: IconifyRenderMode;
|
||||
color?: string;
|
||||
flip?: string;
|
||||
id?: string;
|
||||
ssr?: boolean;
|
||||
fallback?: ReactNode;
|
||||
onLoad?: IconifyIconOnLoad;
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon size
|
||||
*/
|
||||
export declare type IconifyIconSize = null | string | number;
|
||||
|
||||
/**
|
||||
* Dimensions
|
||||
*/
|
||||
declare interface IconifyIconSizeCustomisations {
|
||||
width?: IconifyIconSize;
|
||||
height?: IconifyIconSize;
|
||||
}
|
||||
|
||||
export { IconifyJSON }
|
||||
|
||||
/**
|
||||
* Function to load icons
|
||||
*/
|
||||
declare type IconifyLoadIcons = (icons: (IconifyIconName | string)[], callback?: IconifyIconLoaderCallback) => IconifyIconLoaderAbort;
|
||||
|
||||
/**
|
||||
* Icon render mode
|
||||
*
|
||||
* 'style' = 'bg' or 'mask', depending on icon content
|
||||
* 'bg' = <span> with style using `background`
|
||||
* 'mask' = <span> with style using `mask`
|
||||
* 'svg' = <svg>
|
||||
*/
|
||||
export declare type IconifyRenderMode = 'style' | 'bg' | 'mask' | 'svg';
|
||||
|
||||
/**
|
||||
* Interface for exported storage functions
|
||||
*/
|
||||
export declare interface IconifyStorageFunctions {
|
||||
/**
|
||||
* Check if icon data is available
|
||||
*/
|
||||
iconLoaded: (name: string) => boolean;
|
||||
/**
|
||||
* Get icon data with all properties
|
||||
*
|
||||
* Returns null if icon is missing (attempted to load, but failed)
|
||||
* Returns undefined if icon was not loaded
|
||||
*/
|
||||
getIcon: (name: string) => Required<IconifyIcon> | null | undefined;
|
||||
/**
|
||||
* List all available icons
|
||||
*/
|
||||
listIcons: (provider?: string, prefix?: string) => string[];
|
||||
/**
|
||||
* Add icon to storage
|
||||
*
|
||||
* Data is null if icon is missing
|
||||
*/
|
||||
addIcon: (name: string, data: IconifyIcon | null) => boolean;
|
||||
/**
|
||||
* Add icon set to storage
|
||||
*/
|
||||
addCollection: (data: IconifyJSON, provider?: string) => boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if icon data is available
|
||||
*/
|
||||
export declare function iconLoaded(name: string): boolean;
|
||||
|
||||
/**
|
||||
* Mix of icon properties and SVGSVGElement properties
|
||||
*/
|
||||
export declare type IconProps = IconifyElementProps & IconifyIconProps;
|
||||
|
||||
/**
|
||||
* Inline icon (has negative verticalAlign that makes it behave like icon font)
|
||||
*
|
||||
* @param props - Component properties
|
||||
*/
|
||||
export declare const InlineIcon: IconComponentType;
|
||||
|
||||
/**
|
||||
* List available icons
|
||||
*/
|
||||
export declare function listIcons(provider?: string, prefix?: string): string[];
|
||||
|
||||
/**
|
||||
* Load one icon using Promise
|
||||
*/
|
||||
export declare const loadIcon: (icon: IconifyIconName | string) => Promise<Required<IconifyIcon>>;
|
||||
|
||||
/**
|
||||
* Load icons
|
||||
*/
|
||||
export declare const loadIcons: IconifyLoadIcons;
|
||||
|
||||
export declare type PartialIconifyAPIConfig = Partial<IconifyAPIConfig> & Pick<IconifyAPIConfig, 'resources'>;
|
||||
|
||||
/**
|
||||
* Callback for "abort" pending item.
|
||||
*/
|
||||
declare type QueryAbortCallback = () => void;
|
||||
|
||||
/**
|
||||
* Callback
|
||||
*
|
||||
* If error is present, something went wrong and data is undefined. If error is undefined, data is set.
|
||||
*/
|
||||
declare type QueryDoneCallback = (data?: QueryModuleResponseData, error?: QueryModuleResponseData) => void;
|
||||
|
||||
declare type QueryModuleResponse = (status: QueryModuleResponseType, data: QueryModuleResponseData) => void;
|
||||
|
||||
/**
|
||||
* Response from query module
|
||||
*/
|
||||
declare type QueryModuleResponseData = unknown;
|
||||
|
||||
/**
|
||||
* Response from query module
|
||||
*/
|
||||
declare type QueryModuleResponseType = 'success' | 'next' | 'abort';
|
||||
|
||||
/**
|
||||
* Configuration object
|
||||
*/
|
||||
declare interface RedundancyConfig {
|
||||
resources: RedundancyResource[];
|
||||
index: number;
|
||||
timeout: number;
|
||||
rotate: number;
|
||||
random: boolean;
|
||||
dataAfterTimeout: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resource to rotate (usually hostname or partial URL)
|
||||
*/
|
||||
declare type RedundancyResource = string;
|
||||
|
||||
/**
|
||||
* IDs usage:
|
||||
*
|
||||
* id="{id}"
|
||||
* xlink:href="#{id}"
|
||||
* url(#{id})
|
||||
*
|
||||
* From SVG animations:
|
||||
*
|
||||
* begin="0;{id}.end"
|
||||
* begin="{id}.end"
|
||||
* begin="{id}.click"
|
||||
*/
|
||||
/**
|
||||
* Replace IDs in SVG output with unique IDs
|
||||
*/
|
||||
export declare function replaceIDs(body: string, prefix?: string | ((id: string) => string)): string;
|
||||
|
||||
/**
|
||||
* Set custom loader for one icon
|
||||
*/
|
||||
export declare function setCustomIconLoader(loader: IconifyCustomIconLoader, prefix: string, provider?: string): void;
|
||||
|
||||
/**
|
||||
* Set custom loader for multiple icons
|
||||
*/
|
||||
export declare function setCustomIconsLoader(loader: IconifyCustomIconsLoader, prefix: string, provider?: string): void;
|
||||
|
||||
/**
|
||||
* SVG viewBox: x, y, width, height
|
||||
*/
|
||||
declare type SVGViewBox = [x: number, y: number, width: number, height: number];
|
||||
|
||||
export { }
|
||||
428
node_modules/@iconify/react/dist/iconify.d.ts
generated
vendored
Normal file
428
node_modules/@iconify/react/dist/iconify.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,428 @@
|
|||
import { IconifyIcon } from '@iconify/types';
|
||||
import { IconifyJSON } from '@iconify/types';
|
||||
import { IconifyTransformations } from '@iconify/types';
|
||||
import type { JSX as JSX_2 } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { SVGProps } from 'react';
|
||||
|
||||
/**
|
||||
* Add custom config for provider
|
||||
*/
|
||||
export declare function addAPIProvider(provider: string, customConfig: PartialIconifyAPIConfig): boolean;
|
||||
|
||||
/**
|
||||
* Add icon set
|
||||
*/
|
||||
export declare function addCollection(data: IconifyJSON, provider?: string): boolean;
|
||||
|
||||
/**
|
||||
* Add one icon
|
||||
*/
|
||||
export declare function addIcon(name: string, data: IconifyIcon | null): boolean;
|
||||
|
||||
/**
|
||||
* Internal API
|
||||
*/
|
||||
export declare const _api: IconifyAPIInternalFunctions;
|
||||
|
||||
/**
|
||||
* Get SVG attributes and content from icon + customisations
|
||||
*
|
||||
* Does not generate style to make it compatible with frameworks that use objects for style, such as React.
|
||||
* Instead, it generates 'inline' value. If true, rendering engine should add verticalAlign: -0.125em to icon.
|
||||
*
|
||||
* Customisations should be normalised by platform specific parser.
|
||||
* Result should be converted to <svg> by platform specific parser.
|
||||
* Use replaceIDs to generate unique IDs for body.
|
||||
*/
|
||||
export declare function buildIcon(icon: IconifyIcon, customisations?: IconifyIconCustomisations_2): IconifyIconBuildResult;
|
||||
|
||||
/**
|
||||
* Calculate second dimension when only 1 dimension is set
|
||||
*/
|
||||
export declare function calculateSize(size: string, ratio: number, precision?: number): string;
|
||||
|
||||
export declare function calculateSize(size: number, ratio: number, precision?: number): number;
|
||||
|
||||
export declare function calculateSize(size: string | number, ratio: number, precision?: number): string | number;
|
||||
|
||||
/**
|
||||
* Signature for getAPIConfig
|
||||
*/
|
||||
export declare type GetAPIConfig = (provider: string) => IconifyAPIConfig | undefined;
|
||||
|
||||
/**
|
||||
* Get full icon
|
||||
*/
|
||||
export declare function getIcon(name: string): Required<IconifyIcon> | null | undefined;
|
||||
|
||||
/**
|
||||
* Block icon
|
||||
*
|
||||
* @param props - Component properties
|
||||
*/
|
||||
export declare const Icon: IconComponentType;
|
||||
|
||||
declare type IconComponentType = (props: IconProps) => JSX_2.Element;
|
||||
|
||||
/**
|
||||
* API config
|
||||
*/
|
||||
export declare interface IconifyAPIConfig extends RedundancyConfig {
|
||||
path: string;
|
||||
maxURL: number;
|
||||
}
|
||||
|
||||
export declare interface IconifyAPICustomQueryParams {
|
||||
type: 'custom';
|
||||
provider?: string;
|
||||
uri: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Iconify API functions
|
||||
*/
|
||||
export declare interface IconifyAPIFunctions {
|
||||
/**
|
||||
* Load icons
|
||||
*/
|
||||
loadIcons: (icons: (IconifyIconName | string)[], callback?: IconifyIconLoaderCallback) => IconifyIconLoaderAbort;
|
||||
/**
|
||||
* Load one icon, using Promise syntax
|
||||
*/
|
||||
loadIcon: (icon: IconifyIconName | string) => Promise<Required<IconifyIcon>>;
|
||||
/**
|
||||
* Add API provider
|
||||
*/
|
||||
addAPIProvider: (provider: string, customConfig: PartialIconifyAPIConfig) => boolean;
|
||||
/**
|
||||
* Set custom loader for multple icons
|
||||
*/
|
||||
setCustomIconsLoader: (callback: IconifyCustomIconsLoader, prefix: string, provider?: string) => void;
|
||||
/**
|
||||
* Set custom loader for one icon
|
||||
*/
|
||||
setCustomIconLoader: (callback: IconifyCustomIconLoader, prefix: string, provider?: string) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Params for sendQuery()
|
||||
*/
|
||||
declare interface IconifyAPIIconsQueryParams {
|
||||
type: 'icons';
|
||||
provider: string;
|
||||
prefix: string;
|
||||
icons: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposed internal functions
|
||||
*
|
||||
* Used by plug-ins, such as Icon Finder
|
||||
*
|
||||
* Important: any changes published in a release must be backwards compatible.
|
||||
*/
|
||||
export declare interface IconifyAPIInternalFunctions {
|
||||
/**
|
||||
* Get API config, used by custom modules
|
||||
*/
|
||||
getAPIConfig: GetAPIConfig;
|
||||
/**
|
||||
* Set custom API module
|
||||
*/
|
||||
setAPIModule: (provider: string, item: IconifyAPIModule) => void;
|
||||
/**
|
||||
* Send API query
|
||||
*/
|
||||
sendAPIQuery: (target: string | PartialIconifyAPIConfig, query: IconifyAPIQueryParams, callback: QueryDoneCallback) => QueryAbortCallback;
|
||||
/**
|
||||
* Set and get fetch()
|
||||
*/
|
||||
setFetch: (item: typeof fetch) => void;
|
||||
getFetch: () => typeof fetch | undefined;
|
||||
/**
|
||||
* List all API providers (from config)
|
||||
*/
|
||||
listAPIProviders: () => string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* API modules
|
||||
*/
|
||||
export declare interface IconifyAPIModule {
|
||||
prepare: IconifyAPIPrepareIconsQuery;
|
||||
send: IconifyAPISendQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions to implement in module
|
||||
*/
|
||||
export declare type IconifyAPIPrepareIconsQuery = (provider: string, prefix: string, icons: string[]) => IconifyAPIIconsQueryParams[];
|
||||
|
||||
export declare type IconifyAPIQueryParams = IconifyAPIIconsQueryParams | IconifyAPICustomQueryParams;
|
||||
|
||||
export declare type IconifyAPISendQuery = (host: string, params: IconifyAPIQueryParams, callback: QueryModuleResponse) => void;
|
||||
|
||||
/**
|
||||
* Interface for exported builder functions
|
||||
*/
|
||||
export declare interface IconifyBuilderFunctions {
|
||||
replaceIDs?: (body: string, prefix?: string | (() => string)) => string;
|
||||
calculateSize: (size: string | number, ratio: number, precision?: number) => string | number;
|
||||
buildIcon: (icon: IconifyIcon, customisations?: IconifyIconCustomisations_2) => IconifyIconBuildResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom loader for one icon
|
||||
*/
|
||||
export declare type IconifyCustomIconLoader = (name: string, prefix: string, provider: string) => Promise<IconifyIcon | null> | IconifyIcon | null;
|
||||
|
||||
/**
|
||||
* Custom icons loader
|
||||
*/
|
||||
export declare type IconifyCustomIconsLoader = (icons: string[], prefix: string, provider: string) => Promise<IconifyJSON | null> | IconifyJSON | null;
|
||||
|
||||
/**
|
||||
* React component properties: generic element for Icon component, SVG for generated component
|
||||
*/
|
||||
declare type IconifyElementProps = SVGProps<SVGSVGElement>;
|
||||
|
||||
export { IconifyIcon }
|
||||
|
||||
/**
|
||||
* Interface for getSVGData() result
|
||||
*/
|
||||
export declare interface IconifyIconBuildResult {
|
||||
attributes: {
|
||||
width?: string;
|
||||
height?: string;
|
||||
viewBox: string;
|
||||
};
|
||||
viewBox: SVGViewBox;
|
||||
body: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon customisations
|
||||
*/
|
||||
export declare type IconifyIconCustomisations = IconifyIconCustomisations_2 & {
|
||||
rotate?: string | number;
|
||||
inline?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Icon customisations
|
||||
*/
|
||||
declare interface IconifyIconCustomisations_2 extends IconifyTransformations, IconifyIconSizeCustomisations {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to abort loading (usually just removes callback because loading is already in progress)
|
||||
*/
|
||||
export declare type IconifyIconLoaderAbort = () => void;
|
||||
|
||||
/**
|
||||
* Loader callback
|
||||
*
|
||||
* Provides list of icons that have been loaded
|
||||
*/
|
||||
export declare type IconifyIconLoaderCallback = (loaded: IconifyIconName[], missing: IconifyIconName[], pending: IconifyIconName[], unsubscribe: IconifyIconLoaderAbort) => void;
|
||||
|
||||
/**
|
||||
* Icon name
|
||||
*/
|
||||
export declare interface IconifyIconName {
|
||||
readonly provider: string;
|
||||
readonly prefix: string;
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for when icon has been loaded (only triggered for icons loaded from API)
|
||||
*/
|
||||
export declare type IconifyIconOnLoad = (name: string) => void;
|
||||
|
||||
/**
|
||||
* Icon properties
|
||||
*/
|
||||
export declare interface IconifyIconProps extends IconifyIconCustomisations {
|
||||
icon: IconifyIcon | string;
|
||||
mode?: IconifyRenderMode;
|
||||
color?: string;
|
||||
flip?: string;
|
||||
id?: string;
|
||||
ssr?: boolean;
|
||||
fallback?: ReactNode;
|
||||
onLoad?: IconifyIconOnLoad;
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon size
|
||||
*/
|
||||
export declare type IconifyIconSize = null | string | number;
|
||||
|
||||
/**
|
||||
* Dimensions
|
||||
*/
|
||||
declare interface IconifyIconSizeCustomisations {
|
||||
width?: IconifyIconSize;
|
||||
height?: IconifyIconSize;
|
||||
}
|
||||
|
||||
export { IconifyJSON }
|
||||
|
||||
/**
|
||||
* Function to load icons
|
||||
*/
|
||||
declare type IconifyLoadIcons = (icons: (IconifyIconName | string)[], callback?: IconifyIconLoaderCallback) => IconifyIconLoaderAbort;
|
||||
|
||||
/**
|
||||
* Icon render mode
|
||||
*
|
||||
* 'style' = 'bg' or 'mask', depending on icon content
|
||||
* 'bg' = <span> with style using `background`
|
||||
* 'mask' = <span> with style using `mask`
|
||||
* 'svg' = <svg>
|
||||
*/
|
||||
export declare type IconifyRenderMode = 'style' | 'bg' | 'mask' | 'svg';
|
||||
|
||||
/**
|
||||
* Interface for exported storage functions
|
||||
*/
|
||||
export declare interface IconifyStorageFunctions {
|
||||
/**
|
||||
* Check if icon data is available
|
||||
*/
|
||||
iconLoaded: (name: string) => boolean;
|
||||
/**
|
||||
* Get icon data with all properties
|
||||
*
|
||||
* Returns null if icon is missing (attempted to load, but failed)
|
||||
* Returns undefined if icon was not loaded
|
||||
*/
|
||||
getIcon: (name: string) => Required<IconifyIcon> | null | undefined;
|
||||
/**
|
||||
* List all available icons
|
||||
*/
|
||||
listIcons: (provider?: string, prefix?: string) => string[];
|
||||
/**
|
||||
* Add icon to storage
|
||||
*
|
||||
* Data is null if icon is missing
|
||||
*/
|
||||
addIcon: (name: string, data: IconifyIcon | null) => boolean;
|
||||
/**
|
||||
* Add icon set to storage
|
||||
*/
|
||||
addCollection: (data: IconifyJSON, provider?: string) => boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if icon data is available
|
||||
*/
|
||||
export declare function iconLoaded(name: string): boolean;
|
||||
|
||||
/**
|
||||
* Mix of icon properties and SVGSVGElement properties
|
||||
*/
|
||||
export declare type IconProps = IconifyElementProps & IconifyIconProps;
|
||||
|
||||
/**
|
||||
* Inline icon (has negative verticalAlign that makes it behave like icon font)
|
||||
*
|
||||
* @param props - Component properties
|
||||
*/
|
||||
export declare const InlineIcon: IconComponentType;
|
||||
|
||||
/**
|
||||
* List available icons
|
||||
*/
|
||||
export declare function listIcons(provider?: string, prefix?: string): string[];
|
||||
|
||||
/**
|
||||
* Load one icon using Promise
|
||||
*/
|
||||
export declare const loadIcon: (icon: IconifyIconName | string) => Promise<Required<IconifyIcon>>;
|
||||
|
||||
/**
|
||||
* Load icons
|
||||
*/
|
||||
export declare const loadIcons: IconifyLoadIcons;
|
||||
|
||||
export declare type PartialIconifyAPIConfig = Partial<IconifyAPIConfig> & Pick<IconifyAPIConfig, 'resources'>;
|
||||
|
||||
/**
|
||||
* Callback for "abort" pending item.
|
||||
*/
|
||||
declare type QueryAbortCallback = () => void;
|
||||
|
||||
/**
|
||||
* Callback
|
||||
*
|
||||
* If error is present, something went wrong and data is undefined. If error is undefined, data is set.
|
||||
*/
|
||||
declare type QueryDoneCallback = (data?: QueryModuleResponseData, error?: QueryModuleResponseData) => void;
|
||||
|
||||
declare type QueryModuleResponse = (status: QueryModuleResponseType, data: QueryModuleResponseData) => void;
|
||||
|
||||
/**
|
||||
* Response from query module
|
||||
*/
|
||||
declare type QueryModuleResponseData = unknown;
|
||||
|
||||
/**
|
||||
* Response from query module
|
||||
*/
|
||||
declare type QueryModuleResponseType = 'success' | 'next' | 'abort';
|
||||
|
||||
/**
|
||||
* Configuration object
|
||||
*/
|
||||
declare interface RedundancyConfig {
|
||||
resources: RedundancyResource[];
|
||||
index: number;
|
||||
timeout: number;
|
||||
rotate: number;
|
||||
random: boolean;
|
||||
dataAfterTimeout: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resource to rotate (usually hostname or partial URL)
|
||||
*/
|
||||
declare type RedundancyResource = string;
|
||||
|
||||
/**
|
||||
* IDs usage:
|
||||
*
|
||||
* id="{id}"
|
||||
* xlink:href="#{id}"
|
||||
* url(#{id})
|
||||
*
|
||||
* From SVG animations:
|
||||
*
|
||||
* begin="0;{id}.end"
|
||||
* begin="{id}.end"
|
||||
* begin="{id}.click"
|
||||
*/
|
||||
/**
|
||||
* Replace IDs in SVG output with unique IDs
|
||||
*/
|
||||
export declare function replaceIDs(body: string, prefix?: string | ((id: string) => string)): string;
|
||||
|
||||
/**
|
||||
* Set custom loader for one icon
|
||||
*/
|
||||
export declare function setCustomIconLoader(loader: IconifyCustomIconLoader, prefix: string, provider?: string): void;
|
||||
|
||||
/**
|
||||
* Set custom loader for multiple icons
|
||||
*/
|
||||
export declare function setCustomIconsLoader(loader: IconifyCustomIconsLoader, prefix: string, provider?: string): void;
|
||||
|
||||
/**
|
||||
* SVG viewBox: x, y, width, height
|
||||
*/
|
||||
declare type SVGViewBox = [x: number, y: number, width: number, height: number];
|
||||
|
||||
export { }
|
||||
1887
node_modules/@iconify/react/dist/iconify.js
generated
vendored
Normal file
1887
node_modules/@iconify/react/dist/iconify.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
823
node_modules/@iconify/react/dist/offline.cjs
generated
vendored
Normal file
823
node_modules/@iconify/react/dist/offline.cjs
generated
vendored
Normal file
|
|
@ -0,0 +1,823 @@
|
|||
'use client';
|
||||
|
||||
'use strict';
|
||||
|
||||
var react = require('react');
|
||||
|
||||
const defaultIconDimensions = Object.freeze(
|
||||
{
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: 16,
|
||||
height: 16
|
||||
}
|
||||
);
|
||||
const defaultIconTransformations = Object.freeze({
|
||||
rotate: 0,
|
||||
vFlip: false,
|
||||
hFlip: false
|
||||
});
|
||||
const defaultIconProps = Object.freeze({
|
||||
...defaultIconDimensions,
|
||||
...defaultIconTransformations
|
||||
});
|
||||
const defaultExtendedIconProps = Object.freeze({
|
||||
...defaultIconProps,
|
||||
body: "",
|
||||
hidden: false
|
||||
});
|
||||
|
||||
function mergeIconTransformations(obj1, obj2) {
|
||||
const result = {};
|
||||
if (!obj1.hFlip !== !obj2.hFlip) {
|
||||
result.hFlip = true;
|
||||
}
|
||||
if (!obj1.vFlip !== !obj2.vFlip) {
|
||||
result.vFlip = true;
|
||||
}
|
||||
const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
|
||||
if (rotate) {
|
||||
result.rotate = rotate;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function mergeIconData(parent, child) {
|
||||
const result = mergeIconTransformations(parent, child);
|
||||
for (const key in defaultExtendedIconProps) {
|
||||
if (key in defaultIconTransformations) {
|
||||
if (key in parent && !(key in result)) {
|
||||
result[key] = defaultIconTransformations[key];
|
||||
}
|
||||
} else if (key in child) {
|
||||
result[key] = child[key];
|
||||
} else if (key in parent) {
|
||||
result[key] = parent[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getIconsTree(data, names) {
|
||||
const icons = data.icons;
|
||||
const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
|
||||
const resolved = /* @__PURE__ */ Object.create(null);
|
||||
function resolve(name) {
|
||||
if (icons[name]) {
|
||||
return resolved[name] = [];
|
||||
}
|
||||
if (!(name in resolved)) {
|
||||
resolved[name] = null;
|
||||
const parent = aliases[name] && aliases[name].parent;
|
||||
const value = parent && resolve(parent);
|
||||
if (value) {
|
||||
resolved[name] = [parent].concat(value);
|
||||
}
|
||||
}
|
||||
return resolved[name];
|
||||
}
|
||||
(Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
|
||||
return resolved;
|
||||
}
|
||||
|
||||
function internalGetIconData(data, name, tree) {
|
||||
const icons = data.icons;
|
||||
const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
|
||||
let currentProps = {};
|
||||
function parse(name2) {
|
||||
currentProps = mergeIconData(
|
||||
icons[name2] || aliases[name2],
|
||||
currentProps
|
||||
);
|
||||
}
|
||||
parse(name);
|
||||
tree.forEach(parse);
|
||||
return mergeIconData(data, currentProps);
|
||||
}
|
||||
|
||||
function parseIconSet(data, callback) {
|
||||
const names = [];
|
||||
if (typeof data !== "object" || typeof data.icons !== "object") {
|
||||
return names;
|
||||
}
|
||||
if (data.not_found instanceof Array) {
|
||||
data.not_found.forEach((name) => {
|
||||
callback(name, null);
|
||||
names.push(name);
|
||||
});
|
||||
}
|
||||
const tree = getIconsTree(data);
|
||||
for (const name in tree) {
|
||||
const item = tree[name];
|
||||
if (item) {
|
||||
callback(name, internalGetIconData(data, name, item));
|
||||
names.push(name);
|
||||
}
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
const optionalPropertyDefaults = {
|
||||
provider: "",
|
||||
aliases: {},
|
||||
not_found: {},
|
||||
...defaultIconDimensions
|
||||
};
|
||||
function checkOptionalProps(item, defaults) {
|
||||
for (const prop in defaults) {
|
||||
if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function quicklyValidateIconSet(obj) {
|
||||
if (typeof obj !== "object" || obj === null) {
|
||||
return null;
|
||||
}
|
||||
const data = obj;
|
||||
if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
|
||||
return null;
|
||||
}
|
||||
if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
|
||||
return null;
|
||||
}
|
||||
const icons = data.icons;
|
||||
for (const name in icons) {
|
||||
const icon = icons[name];
|
||||
if (
|
||||
// Name cannot be empty
|
||||
!name || // Must have body
|
||||
typeof icon.body !== "string" || // Check other props
|
||||
!checkOptionalProps(
|
||||
icon,
|
||||
defaultExtendedIconProps
|
||||
)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
|
||||
for (const name in aliases) {
|
||||
const icon = aliases[name];
|
||||
const parent = icon.parent;
|
||||
if (
|
||||
// Name cannot be empty
|
||||
!name || // Parent must be set and point to existing icon
|
||||
typeof parent !== "string" || !icons[parent] && !aliases[parent] || // Check other props
|
||||
!checkOptionalProps(
|
||||
icon,
|
||||
defaultExtendedIconProps
|
||||
)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
const defaultIconSizeCustomisations = Object.freeze({
|
||||
width: null,
|
||||
height: null
|
||||
});
|
||||
const defaultIconCustomisations = Object.freeze({
|
||||
// Dimensions
|
||||
...defaultIconSizeCustomisations,
|
||||
// Transformations
|
||||
...defaultIconTransformations
|
||||
});
|
||||
|
||||
function mergeCustomisations(defaults, item) {
|
||||
const result = {
|
||||
...defaults
|
||||
};
|
||||
for (const key in item) {
|
||||
const value = item[key];
|
||||
const valueType = typeof value;
|
||||
if (key in defaultIconSizeCustomisations) {
|
||||
if (value === null || value && (valueType === "string" || valueType === "number")) {
|
||||
result[key] = value;
|
||||
}
|
||||
} else if (valueType === typeof result[key]) {
|
||||
result[key] = key === "rotate" ? value % 4 : value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const separator = /[\s,]+/;
|
||||
function flipFromString(custom, flip) {
|
||||
flip.split(separator).forEach((str) => {
|
||||
const value = str.trim();
|
||||
switch (value) {
|
||||
case "horizontal":
|
||||
custom.hFlip = true;
|
||||
break;
|
||||
case "vertical":
|
||||
custom.vFlip = true;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function rotateFromString(value, defaultValue = 0) {
|
||||
const units = value.replace(/^-?[0-9.]*/, "");
|
||||
function cleanup(value2) {
|
||||
while (value2 < 0) {
|
||||
value2 += 4;
|
||||
}
|
||||
return value2 % 4;
|
||||
}
|
||||
if (units === "") {
|
||||
const num = parseInt(value);
|
||||
return isNaN(num) ? 0 : cleanup(num);
|
||||
} else if (units !== value) {
|
||||
let split = 0;
|
||||
switch (units) {
|
||||
case "%":
|
||||
split = 25;
|
||||
break;
|
||||
case "deg":
|
||||
split = 90;
|
||||
}
|
||||
if (split) {
|
||||
let num = parseFloat(value.slice(0, value.length - units.length));
|
||||
if (isNaN(num)) {
|
||||
return 0;
|
||||
}
|
||||
num = num / split;
|
||||
return num % 1 === 0 ? cleanup(num) : 0;
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
|
||||
const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
||||
function calculateSize(size, ratio, precision) {
|
||||
if (ratio === 1) {
|
||||
return size;
|
||||
}
|
||||
precision = precision || 100;
|
||||
if (typeof size === "number") {
|
||||
return Math.ceil(size * ratio * precision) / precision;
|
||||
}
|
||||
if (typeof size !== "string") {
|
||||
return size;
|
||||
}
|
||||
const oldParts = size.split(unitsSplit);
|
||||
if (oldParts === null || !oldParts.length) {
|
||||
return size;
|
||||
}
|
||||
const newParts = [];
|
||||
let code = oldParts.shift();
|
||||
let isNumber = unitsTest.test(code);
|
||||
while (true) {
|
||||
if (isNumber) {
|
||||
const num = parseFloat(code);
|
||||
if (isNaN(num)) {
|
||||
newParts.push(code);
|
||||
} else {
|
||||
newParts.push(Math.ceil(num * ratio * precision) / precision);
|
||||
}
|
||||
} else {
|
||||
newParts.push(code);
|
||||
}
|
||||
code = oldParts.shift();
|
||||
if (code === void 0) {
|
||||
return newParts.join("");
|
||||
}
|
||||
isNumber = !isNumber;
|
||||
}
|
||||
}
|
||||
|
||||
function splitSVGDefs(content, tag = "defs") {
|
||||
let defs = "";
|
||||
const index = content.indexOf("<" + tag);
|
||||
while (index >= 0) {
|
||||
const start = content.indexOf(">", index);
|
||||
const end = content.indexOf("</" + tag);
|
||||
if (start === -1 || end === -1) {
|
||||
break;
|
||||
}
|
||||
const endEnd = content.indexOf(">", end);
|
||||
if (endEnd === -1) {
|
||||
break;
|
||||
}
|
||||
defs += content.slice(start + 1, end).trim();
|
||||
content = content.slice(0, index).trim() + content.slice(endEnd + 1);
|
||||
}
|
||||
return {
|
||||
defs,
|
||||
content
|
||||
};
|
||||
}
|
||||
function mergeDefsAndContent(defs, content) {
|
||||
return defs ? "<defs>" + defs + "</defs>" + content : content;
|
||||
}
|
||||
function wrapSVGContent(body, start, end) {
|
||||
const split = splitSVGDefs(body);
|
||||
return mergeDefsAndContent(split.defs, start + split.content + end);
|
||||
}
|
||||
|
||||
const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
|
||||
function iconToSVG(icon, customisations) {
|
||||
const fullIcon = {
|
||||
...defaultIconProps,
|
||||
...icon
|
||||
};
|
||||
const fullCustomisations = {
|
||||
...defaultIconCustomisations,
|
||||
...customisations
|
||||
};
|
||||
const box = {
|
||||
left: fullIcon.left,
|
||||
top: fullIcon.top,
|
||||
width: fullIcon.width,
|
||||
height: fullIcon.height
|
||||
};
|
||||
let body = fullIcon.body;
|
||||
[fullIcon, fullCustomisations].forEach((props) => {
|
||||
const transformations = [];
|
||||
const hFlip = props.hFlip;
|
||||
const vFlip = props.vFlip;
|
||||
let rotation = props.rotate;
|
||||
if (hFlip) {
|
||||
if (vFlip) {
|
||||
rotation += 2;
|
||||
} else {
|
||||
transformations.push(
|
||||
"translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"
|
||||
);
|
||||
transformations.push("scale(-1 1)");
|
||||
box.top = box.left = 0;
|
||||
}
|
||||
} else if (vFlip) {
|
||||
transformations.push(
|
||||
"translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"
|
||||
);
|
||||
transformations.push("scale(1 -1)");
|
||||
box.top = box.left = 0;
|
||||
}
|
||||
let tempValue;
|
||||
if (rotation < 0) {
|
||||
rotation -= Math.floor(rotation / 4) * 4;
|
||||
}
|
||||
rotation = rotation % 4;
|
||||
switch (rotation) {
|
||||
case 1:
|
||||
tempValue = box.height / 2 + box.top;
|
||||
transformations.unshift(
|
||||
"rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"
|
||||
);
|
||||
break;
|
||||
case 2:
|
||||
transformations.unshift(
|
||||
"rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"
|
||||
);
|
||||
break;
|
||||
case 3:
|
||||
tempValue = box.width / 2 + box.left;
|
||||
transformations.unshift(
|
||||
"rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"
|
||||
);
|
||||
break;
|
||||
}
|
||||
if (rotation % 2 === 1) {
|
||||
if (box.left !== box.top) {
|
||||
tempValue = box.left;
|
||||
box.left = box.top;
|
||||
box.top = tempValue;
|
||||
}
|
||||
if (box.width !== box.height) {
|
||||
tempValue = box.width;
|
||||
box.width = box.height;
|
||||
box.height = tempValue;
|
||||
}
|
||||
}
|
||||
if (transformations.length) {
|
||||
body = wrapSVGContent(
|
||||
body,
|
||||
'<g transform="' + transformations.join(" ") + '">',
|
||||
"</g>"
|
||||
);
|
||||
}
|
||||
});
|
||||
const customisationsWidth = fullCustomisations.width;
|
||||
const customisationsHeight = fullCustomisations.height;
|
||||
const boxWidth = box.width;
|
||||
const boxHeight = box.height;
|
||||
let width;
|
||||
let height;
|
||||
if (customisationsWidth === null) {
|
||||
height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
||||
width = calculateSize(height, boxWidth / boxHeight);
|
||||
} else {
|
||||
width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
|
||||
height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
||||
}
|
||||
const attributes = {};
|
||||
const setAttr = (prop, value) => {
|
||||
if (!isUnsetKeyword(value)) {
|
||||
attributes[prop] = value.toString();
|
||||
}
|
||||
};
|
||||
setAttr("width", width);
|
||||
setAttr("height", height);
|
||||
const viewBox = [box.left, box.top, boxWidth, boxHeight];
|
||||
attributes.viewBox = viewBox.join(" ");
|
||||
return {
|
||||
attributes,
|
||||
viewBox,
|
||||
body
|
||||
};
|
||||
}
|
||||
|
||||
const regex = /\sid="(\S+)"/g;
|
||||
const randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
|
||||
let counter = 0;
|
||||
function replaceIDs(body, prefix = randomPrefix) {
|
||||
const ids = [];
|
||||
let match;
|
||||
while (match = regex.exec(body)) {
|
||||
ids.push(match[1]);
|
||||
}
|
||||
if (!ids.length) {
|
||||
return body;
|
||||
}
|
||||
const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
|
||||
ids.forEach((id) => {
|
||||
const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString();
|
||||
const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
body = body.replace(
|
||||
// Allowed characters before id: [#;"]
|
||||
// Allowed characters after id: [)"], .[a-z]
|
||||
new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"),
|
||||
"$1" + newID + suffix + "$3"
|
||||
);
|
||||
});
|
||||
body = body.replace(new RegExp(suffix, "g"), "");
|
||||
return body;
|
||||
}
|
||||
|
||||
function iconToHTML(body, attributes) {
|
||||
let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
|
||||
for (const attr in attributes) {
|
||||
renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
|
||||
}
|
||||
return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
|
||||
}
|
||||
|
||||
function encodeSVGforURL(svg) {
|
||||
return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
|
||||
}
|
||||
function svgToData(svg) {
|
||||
return "data:image/svg+xml," + encodeSVGforURL(svg);
|
||||
}
|
||||
function svgToURL(svg) {
|
||||
return 'url("' + svgToData(svg) + '")';
|
||||
}
|
||||
|
||||
let policy;
|
||||
function createPolicy() {
|
||||
try {
|
||||
policy = window.trustedTypes.createPolicy("iconify", {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
createHTML: (s) => s
|
||||
});
|
||||
} catch (err) {
|
||||
policy = null;
|
||||
}
|
||||
}
|
||||
function cleanUpInnerHTML(html) {
|
||||
if (policy === void 0) {
|
||||
createPolicy();
|
||||
}
|
||||
return policy ? policy.createHTML(html) : html;
|
||||
}
|
||||
|
||||
const defaultExtendedIconCustomisations = {
|
||||
...defaultIconCustomisations,
|
||||
inline: false,
|
||||
};
|
||||
|
||||
const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
|
||||
const colonSeparated = value.split(":");
|
||||
if (value.slice(0, 1) === "@") {
|
||||
if (colonSeparated.length < 2 || colonSeparated.length > 3) {
|
||||
return null;
|
||||
}
|
||||
provider = colonSeparated.shift().slice(1);
|
||||
}
|
||||
if (colonSeparated.length > 3 || !colonSeparated.length) {
|
||||
return null;
|
||||
}
|
||||
if (colonSeparated.length > 1) {
|
||||
const name2 = colonSeparated.pop();
|
||||
const prefix = colonSeparated.pop();
|
||||
const result = {
|
||||
// Allow provider without '@': "provider:prefix:name"
|
||||
provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
|
||||
prefix,
|
||||
name: name2
|
||||
};
|
||||
return result;
|
||||
}
|
||||
const name = colonSeparated[0];
|
||||
const dashSeparated = name.split("-");
|
||||
if (dashSeparated.length > 1) {
|
||||
const result = {
|
||||
provider,
|
||||
prefix: dashSeparated.shift(),
|
||||
name: dashSeparated.join("-")
|
||||
};
|
||||
return result;
|
||||
}
|
||||
if (provider === "") {
|
||||
const result = {
|
||||
provider,
|
||||
prefix: "",
|
||||
name
|
||||
};
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Default SVG attributes
|
||||
*/
|
||||
const svgDefaults = {
|
||||
'xmlns': 'http://www.w3.org/2000/svg',
|
||||
'xmlnsXlink': 'http://www.w3.org/1999/xlink',
|
||||
'aria-hidden': true,
|
||||
'role': 'img',
|
||||
};
|
||||
/**
|
||||
* Style modes
|
||||
*/
|
||||
const commonProps = {
|
||||
display: 'inline-block',
|
||||
};
|
||||
const monotoneProps = {
|
||||
backgroundColor: 'currentColor',
|
||||
};
|
||||
const coloredProps = {
|
||||
backgroundColor: 'transparent',
|
||||
};
|
||||
// Dynamically add common props to variables above
|
||||
const propsToAdd = {
|
||||
Image: 'var(--svg)',
|
||||
Repeat: 'no-repeat',
|
||||
Size: '100% 100%',
|
||||
};
|
||||
const propsToAddTo = {
|
||||
WebkitMask: monotoneProps,
|
||||
mask: monotoneProps,
|
||||
background: coloredProps,
|
||||
};
|
||||
for (const prefix in propsToAddTo) {
|
||||
const list = propsToAddTo[prefix];
|
||||
for (const prop in propsToAdd) {
|
||||
list[prefix + prop] = propsToAdd[prop];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Default values for customisations for inline icon
|
||||
*/
|
||||
const inlineDefaults = {
|
||||
...defaultExtendedIconCustomisations,
|
||||
inline: true,
|
||||
};
|
||||
/**
|
||||
* Fix size: add 'px' to numbers
|
||||
*/
|
||||
function fixSize(value) {
|
||||
return value + (value.match(/^[-0-9.]+$/) ? 'px' : '');
|
||||
}
|
||||
/**
|
||||
* Render icon
|
||||
*/
|
||||
const render = (
|
||||
// Icon must be validated before calling this function
|
||||
icon,
|
||||
// Partial properties
|
||||
props,
|
||||
// Icon name
|
||||
name) => {
|
||||
// Get default properties
|
||||
const defaultProps = props.inline
|
||||
? inlineDefaults
|
||||
: defaultExtendedIconCustomisations;
|
||||
// Get all customisations
|
||||
const customisations = mergeCustomisations(defaultProps, props);
|
||||
// Check mode
|
||||
const mode = props.mode || 'svg';
|
||||
// Create style
|
||||
const style = {};
|
||||
const customStyle = props.style || {};
|
||||
// Create SVG component properties
|
||||
const componentProps = {
|
||||
...(mode === 'svg' ? svgDefaults : {}),
|
||||
};
|
||||
if (name) {
|
||||
const iconName = stringToIcon(name);
|
||||
if (iconName) {
|
||||
const classNames = ['iconify'];
|
||||
const props = [
|
||||
'provider',
|
||||
'prefix',
|
||||
];
|
||||
for (const prop of props) {
|
||||
if (iconName[prop]) {
|
||||
classNames.push('iconify--' + iconName[prop]);
|
||||
}
|
||||
}
|
||||
componentProps.className = classNames.join(' ');
|
||||
}
|
||||
}
|
||||
// Get element properties
|
||||
for (let key in props) {
|
||||
const value = props[key];
|
||||
if (value === void 0) {
|
||||
continue;
|
||||
}
|
||||
switch (key) {
|
||||
// Properties to ignore
|
||||
case 'icon':
|
||||
case 'style':
|
||||
case 'children':
|
||||
case 'onLoad':
|
||||
case 'mode':
|
||||
case 'ssr':
|
||||
break;
|
||||
// Forward ref
|
||||
case '_ref':
|
||||
componentProps.ref = value;
|
||||
break;
|
||||
// Merge class names
|
||||
case 'className':
|
||||
componentProps[key] =
|
||||
(componentProps[key] ? componentProps[key] + ' ' : '') +
|
||||
value;
|
||||
break;
|
||||
// Boolean attributes
|
||||
case 'inline':
|
||||
case 'hFlip':
|
||||
case 'vFlip':
|
||||
customisations[key] =
|
||||
value === true || value === 'true' || value === 1;
|
||||
break;
|
||||
// Flip as string: 'horizontal,vertical'
|
||||
case 'flip':
|
||||
if (typeof value === 'string') {
|
||||
flipFromString(customisations, value);
|
||||
}
|
||||
break;
|
||||
// Color: copy to style
|
||||
case 'color':
|
||||
style.color = value;
|
||||
break;
|
||||
// Rotation as string
|
||||
case 'rotate':
|
||||
if (typeof value === 'string') {
|
||||
customisations[key] = rotateFromString(value);
|
||||
}
|
||||
else if (typeof value === 'number') {
|
||||
customisations[key] = value;
|
||||
}
|
||||
break;
|
||||
// Remove aria-hidden
|
||||
case 'ariaHidden':
|
||||
case 'aria-hidden':
|
||||
if (value !== true && value !== 'true') {
|
||||
delete componentProps['aria-hidden'];
|
||||
}
|
||||
break;
|
||||
// Copy missing property if it does not exist in customisations
|
||||
default:
|
||||
if (defaultProps[key] === void 0) {
|
||||
componentProps[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Generate icon
|
||||
const item = iconToSVG(icon, customisations);
|
||||
const renderAttribs = item.attributes;
|
||||
// Inline display
|
||||
if (customisations.inline) {
|
||||
style.verticalAlign = '-0.125em';
|
||||
}
|
||||
if (mode === 'svg') {
|
||||
// Add style
|
||||
componentProps.style = {
|
||||
...style,
|
||||
...customStyle,
|
||||
};
|
||||
// Add icon stuff
|
||||
Object.assign(componentProps, renderAttribs);
|
||||
// Counter for ids based on "id" property to render icons consistently on server and client
|
||||
let localCounter = 0;
|
||||
let id = props.id;
|
||||
if (typeof id === 'string') {
|
||||
// Convert '-' to '_' to avoid errors in animations
|
||||
id = id.replace(/-/g, '_');
|
||||
}
|
||||
// Add icon stuff
|
||||
componentProps.dangerouslySetInnerHTML = {
|
||||
__html: cleanUpInnerHTML(replaceIDs(item.body, id ? () => id + 'ID' + localCounter++ : 'iconifyReact')),
|
||||
};
|
||||
return react.createElement('svg', componentProps);
|
||||
}
|
||||
// Render <span> with style
|
||||
const { body, width, height } = icon;
|
||||
const useMask = mode === 'mask' ||
|
||||
(mode === 'bg' ? false : body.indexOf('currentColor') !== -1);
|
||||
// Generate SVG
|
||||
const html = iconToHTML(body, {
|
||||
...renderAttribs,
|
||||
width: width + '',
|
||||
height: height + '',
|
||||
});
|
||||
// Generate style
|
||||
componentProps.style = {
|
||||
...style,
|
||||
'--svg': svgToURL(html),
|
||||
'width': fixSize(renderAttribs.width),
|
||||
'height': fixSize(renderAttribs.height),
|
||||
...commonProps,
|
||||
...(useMask ? monotoneProps : coloredProps),
|
||||
...customStyle,
|
||||
};
|
||||
return react.createElement('span', componentProps);
|
||||
};
|
||||
|
||||
/**
|
||||
* Storage for icons referred by name
|
||||
*/
|
||||
const storage = Object.create(null);
|
||||
function IconComponent(props) {
|
||||
const icon = props.icon;
|
||||
const data = typeof icon === 'string' ? storage[icon] : icon;
|
||||
if (!data) {
|
||||
return props.children
|
||||
? props.children
|
||||
: react.createElement('span', {});
|
||||
}
|
||||
return render({
|
||||
...defaultIconProps,
|
||||
...data,
|
||||
}, props, typeof icon === 'string' ? icon : undefined);
|
||||
}
|
||||
/**
|
||||
* Block icon
|
||||
*
|
||||
* @param props - Component properties
|
||||
*/
|
||||
const Icon = react.memo(react.forwardRef((props, ref) => IconComponent({
|
||||
...props,
|
||||
_ref: ref,
|
||||
})));
|
||||
/**
|
||||
* Inline icon (has negative verticalAlign that makes it behave like icon font)
|
||||
*
|
||||
* @param props - Component properties
|
||||
*/
|
||||
const InlineIcon = react.memo(react.forwardRef((props, ref) => IconComponent({
|
||||
inline: true,
|
||||
...props,
|
||||
_ref: ref,
|
||||
})));
|
||||
/**
|
||||
* Add icon to storage, allowing to call it by name
|
||||
*
|
||||
* @param name
|
||||
* @param data
|
||||
*/
|
||||
function addIcon(name, data) {
|
||||
storage[name] = data;
|
||||
}
|
||||
/**
|
||||
* Add collection to storage, allowing to call icons by name
|
||||
*
|
||||
* @param data Icon set
|
||||
* @param prefix Optional prefix to add to icon names, true (default) if prefix from icon set should be used.
|
||||
*/
|
||||
function addCollection(data, prefix) {
|
||||
const iconPrefix = typeof prefix === 'string'
|
||||
? prefix
|
||||
: prefix !== false && typeof data.prefix === 'string'
|
||||
? data.prefix + ':'
|
||||
: '';
|
||||
quicklyValidateIconSet(data) &&
|
||||
parseIconSet(data, (name, icon) => {
|
||||
if (icon) {
|
||||
storage[iconPrefix + name] = icon;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.Icon = Icon;
|
||||
exports.InlineIcon = InlineIcon;
|
||||
exports.addCollection = addCollection;
|
||||
exports.addIcon = addIcon;
|
||||
110
node_modules/@iconify/react/dist/offline.d.cts
generated
vendored
Normal file
110
node_modules/@iconify/react/dist/offline.d.cts
generated
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
import type { IconifyIcon } from '@iconify/types';
|
||||
import type { IconifyJSON } from '@iconify/types';
|
||||
import { IconifyTransformations } from '@iconify/types';
|
||||
import type { JSX as JSX_2 } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { SVGProps } from 'react';
|
||||
|
||||
/**
|
||||
* Add collection to storage, allowing to call icons by name
|
||||
*
|
||||
* @param data Icon set
|
||||
* @param prefix Optional prefix to add to icon names, true (default) if prefix from icon set should be used.
|
||||
*/
|
||||
export declare function addCollection(data: IconifyJSON, prefix?: string | boolean): void;
|
||||
|
||||
/**
|
||||
* Add icon to storage, allowing to call it by name
|
||||
*
|
||||
* @param name
|
||||
* @param data
|
||||
*/
|
||||
export declare function addIcon(name: string, data: IconifyIcon): void;
|
||||
|
||||
/**
|
||||
* Block icon
|
||||
*
|
||||
* @param props - Component properties
|
||||
*/
|
||||
export declare const Icon: IconComponentType;
|
||||
|
||||
declare type IconComponentType = (props: IconProps) => JSX_2.Element;
|
||||
|
||||
/**
|
||||
* React component properties: generic element for Icon component, SVG for generated component
|
||||
*/
|
||||
declare type IconifyElementProps = SVGProps<SVGSVGElement>;
|
||||
|
||||
export { IconifyIcon }
|
||||
|
||||
/**
|
||||
* Icon customisations
|
||||
*/
|
||||
export declare type IconifyIconCustomisations = IconifyIconCustomisations_2 & {
|
||||
rotate?: string | number;
|
||||
inline?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Icon customisations
|
||||
*/
|
||||
declare interface IconifyIconCustomisations_2 extends IconifyTransformations, IconifyIconSizeCustomisations {
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for when icon has been loaded (only triggered for icons loaded from API)
|
||||
*/
|
||||
declare type IconifyIconOnLoad = (name: string) => void;
|
||||
|
||||
/**
|
||||
* Icon properties
|
||||
*/
|
||||
export declare interface IconifyIconProps extends IconifyIconCustomisations {
|
||||
icon: IconifyIcon | string;
|
||||
mode?: IconifyRenderMode;
|
||||
color?: string;
|
||||
flip?: string;
|
||||
id?: string;
|
||||
ssr?: boolean;
|
||||
fallback?: ReactNode;
|
||||
onLoad?: IconifyIconOnLoad;
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon size
|
||||
*/
|
||||
export declare type IconifyIconSize = null | string | number;
|
||||
|
||||
/**
|
||||
* Dimensions
|
||||
*/
|
||||
declare interface IconifyIconSizeCustomisations {
|
||||
width?: IconifyIconSize;
|
||||
height?: IconifyIconSize;
|
||||
}
|
||||
|
||||
export { IconifyJSON }
|
||||
|
||||
/**
|
||||
* Icon render mode
|
||||
*
|
||||
* 'style' = 'bg' or 'mask', depending on icon content
|
||||
* 'bg' = <span> with style using `background`
|
||||
* 'mask' = <span> with style using `mask`
|
||||
* 'svg' = <svg>
|
||||
*/
|
||||
export declare type IconifyRenderMode = 'style' | 'bg' | 'mask' | 'svg';
|
||||
|
||||
/**
|
||||
* Mix of icon properties and SVGSVGElement properties
|
||||
*/
|
||||
export declare type IconProps = IconifyElementProps & IconifyIconProps;
|
||||
|
||||
/**
|
||||
* Inline icon (has negative verticalAlign that makes it behave like icon font)
|
||||
*
|
||||
* @param props - Component properties
|
||||
*/
|
||||
export declare const InlineIcon: IconComponentType;
|
||||
|
||||
export { }
|
||||
110
node_modules/@iconify/react/dist/offline.d.ts
generated
vendored
Normal file
110
node_modules/@iconify/react/dist/offline.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
import type { IconifyIcon } from '@iconify/types';
|
||||
import type { IconifyJSON } from '@iconify/types';
|
||||
import { IconifyTransformations } from '@iconify/types';
|
||||
import type { JSX as JSX_2 } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { SVGProps } from 'react';
|
||||
|
||||
/**
|
||||
* Add collection to storage, allowing to call icons by name
|
||||
*
|
||||
* @param data Icon set
|
||||
* @param prefix Optional prefix to add to icon names, true (default) if prefix from icon set should be used.
|
||||
*/
|
||||
export declare function addCollection(data: IconifyJSON, prefix?: string | boolean): void;
|
||||
|
||||
/**
|
||||
* Add icon to storage, allowing to call it by name
|
||||
*
|
||||
* @param name
|
||||
* @param data
|
||||
*/
|
||||
export declare function addIcon(name: string, data: IconifyIcon): void;
|
||||
|
||||
/**
|
||||
* Block icon
|
||||
*
|
||||
* @param props - Component properties
|
||||
*/
|
||||
export declare const Icon: IconComponentType;
|
||||
|
||||
declare type IconComponentType = (props: IconProps) => JSX_2.Element;
|
||||
|
||||
/**
|
||||
* React component properties: generic element for Icon component, SVG for generated component
|
||||
*/
|
||||
declare type IconifyElementProps = SVGProps<SVGSVGElement>;
|
||||
|
||||
export { IconifyIcon }
|
||||
|
||||
/**
|
||||
* Icon customisations
|
||||
*/
|
||||
export declare type IconifyIconCustomisations = IconifyIconCustomisations_2 & {
|
||||
rotate?: string | number;
|
||||
inline?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Icon customisations
|
||||
*/
|
||||
declare interface IconifyIconCustomisations_2 extends IconifyTransformations, IconifyIconSizeCustomisations {
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for when icon has been loaded (only triggered for icons loaded from API)
|
||||
*/
|
||||
declare type IconifyIconOnLoad = (name: string) => void;
|
||||
|
||||
/**
|
||||
* Icon properties
|
||||
*/
|
||||
export declare interface IconifyIconProps extends IconifyIconCustomisations {
|
||||
icon: IconifyIcon | string;
|
||||
mode?: IconifyRenderMode;
|
||||
color?: string;
|
||||
flip?: string;
|
||||
id?: string;
|
||||
ssr?: boolean;
|
||||
fallback?: ReactNode;
|
||||
onLoad?: IconifyIconOnLoad;
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon size
|
||||
*/
|
||||
export declare type IconifyIconSize = null | string | number;
|
||||
|
||||
/**
|
||||
* Dimensions
|
||||
*/
|
||||
declare interface IconifyIconSizeCustomisations {
|
||||
width?: IconifyIconSize;
|
||||
height?: IconifyIconSize;
|
||||
}
|
||||
|
||||
export { IconifyJSON }
|
||||
|
||||
/**
|
||||
* Icon render mode
|
||||
*
|
||||
* 'style' = 'bg' or 'mask', depending on icon content
|
||||
* 'bg' = <span> with style using `background`
|
||||
* 'mask' = <span> with style using `mask`
|
||||
* 'svg' = <svg>
|
||||
*/
|
||||
export declare type IconifyRenderMode = 'style' | 'bg' | 'mask' | 'svg';
|
||||
|
||||
/**
|
||||
* Mix of icon properties and SVGSVGElement properties
|
||||
*/
|
||||
export declare type IconProps = IconifyElementProps & IconifyIconProps;
|
||||
|
||||
/**
|
||||
* Inline icon (has negative verticalAlign that makes it behave like icon font)
|
||||
*
|
||||
* @param props - Component properties
|
||||
*/
|
||||
export declare const InlineIcon: IconComponentType;
|
||||
|
||||
export { }
|
||||
818
node_modules/@iconify/react/dist/offline.js
generated
vendored
Normal file
818
node_modules/@iconify/react/dist/offline.js
generated
vendored
Normal file
|
|
@ -0,0 +1,818 @@
|
|||
'use client';
|
||||
|
||||
import { createElement, memo, forwardRef } from 'react';
|
||||
|
||||
const defaultIconDimensions = Object.freeze(
|
||||
{
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: 16,
|
||||
height: 16
|
||||
}
|
||||
);
|
||||
const defaultIconTransformations = Object.freeze({
|
||||
rotate: 0,
|
||||
vFlip: false,
|
||||
hFlip: false
|
||||
});
|
||||
const defaultIconProps = Object.freeze({
|
||||
...defaultIconDimensions,
|
||||
...defaultIconTransformations
|
||||
});
|
||||
const defaultExtendedIconProps = Object.freeze({
|
||||
...defaultIconProps,
|
||||
body: "",
|
||||
hidden: false
|
||||
});
|
||||
|
||||
function mergeIconTransformations(obj1, obj2) {
|
||||
const result = {};
|
||||
if (!obj1.hFlip !== !obj2.hFlip) {
|
||||
result.hFlip = true;
|
||||
}
|
||||
if (!obj1.vFlip !== !obj2.vFlip) {
|
||||
result.vFlip = true;
|
||||
}
|
||||
const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
|
||||
if (rotate) {
|
||||
result.rotate = rotate;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function mergeIconData(parent, child) {
|
||||
const result = mergeIconTransformations(parent, child);
|
||||
for (const key in defaultExtendedIconProps) {
|
||||
if (key in defaultIconTransformations) {
|
||||
if (key in parent && !(key in result)) {
|
||||
result[key] = defaultIconTransformations[key];
|
||||
}
|
||||
} else if (key in child) {
|
||||
result[key] = child[key];
|
||||
} else if (key in parent) {
|
||||
result[key] = parent[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getIconsTree(data, names) {
|
||||
const icons = data.icons;
|
||||
const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
|
||||
const resolved = /* @__PURE__ */ Object.create(null);
|
||||
function resolve(name) {
|
||||
if (icons[name]) {
|
||||
return resolved[name] = [];
|
||||
}
|
||||
if (!(name in resolved)) {
|
||||
resolved[name] = null;
|
||||
const parent = aliases[name] && aliases[name].parent;
|
||||
const value = parent && resolve(parent);
|
||||
if (value) {
|
||||
resolved[name] = [parent].concat(value);
|
||||
}
|
||||
}
|
||||
return resolved[name];
|
||||
}
|
||||
(Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
|
||||
return resolved;
|
||||
}
|
||||
|
||||
function internalGetIconData(data, name, tree) {
|
||||
const icons = data.icons;
|
||||
const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
|
||||
let currentProps = {};
|
||||
function parse(name2) {
|
||||
currentProps = mergeIconData(
|
||||
icons[name2] || aliases[name2],
|
||||
currentProps
|
||||
);
|
||||
}
|
||||
parse(name);
|
||||
tree.forEach(parse);
|
||||
return mergeIconData(data, currentProps);
|
||||
}
|
||||
|
||||
function parseIconSet(data, callback) {
|
||||
const names = [];
|
||||
if (typeof data !== "object" || typeof data.icons !== "object") {
|
||||
return names;
|
||||
}
|
||||
if (data.not_found instanceof Array) {
|
||||
data.not_found.forEach((name) => {
|
||||
callback(name, null);
|
||||
names.push(name);
|
||||
});
|
||||
}
|
||||
const tree = getIconsTree(data);
|
||||
for (const name in tree) {
|
||||
const item = tree[name];
|
||||
if (item) {
|
||||
callback(name, internalGetIconData(data, name, item));
|
||||
names.push(name);
|
||||
}
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
const optionalPropertyDefaults = {
|
||||
provider: "",
|
||||
aliases: {},
|
||||
not_found: {},
|
||||
...defaultIconDimensions
|
||||
};
|
||||
function checkOptionalProps(item, defaults) {
|
||||
for (const prop in defaults) {
|
||||
if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function quicklyValidateIconSet(obj) {
|
||||
if (typeof obj !== "object" || obj === null) {
|
||||
return null;
|
||||
}
|
||||
const data = obj;
|
||||
if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
|
||||
return null;
|
||||
}
|
||||
if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
|
||||
return null;
|
||||
}
|
||||
const icons = data.icons;
|
||||
for (const name in icons) {
|
||||
const icon = icons[name];
|
||||
if (
|
||||
// Name cannot be empty
|
||||
!name || // Must have body
|
||||
typeof icon.body !== "string" || // Check other props
|
||||
!checkOptionalProps(
|
||||
icon,
|
||||
defaultExtendedIconProps
|
||||
)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
|
||||
for (const name in aliases) {
|
||||
const icon = aliases[name];
|
||||
const parent = icon.parent;
|
||||
if (
|
||||
// Name cannot be empty
|
||||
!name || // Parent must be set and point to existing icon
|
||||
typeof parent !== "string" || !icons[parent] && !aliases[parent] || // Check other props
|
||||
!checkOptionalProps(
|
||||
icon,
|
||||
defaultExtendedIconProps
|
||||
)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
const defaultIconSizeCustomisations = Object.freeze({
|
||||
width: null,
|
||||
height: null
|
||||
});
|
||||
const defaultIconCustomisations = Object.freeze({
|
||||
// Dimensions
|
||||
...defaultIconSizeCustomisations,
|
||||
// Transformations
|
||||
...defaultIconTransformations
|
||||
});
|
||||
|
||||
function mergeCustomisations(defaults, item) {
|
||||
const result = {
|
||||
...defaults
|
||||
};
|
||||
for (const key in item) {
|
||||
const value = item[key];
|
||||
const valueType = typeof value;
|
||||
if (key in defaultIconSizeCustomisations) {
|
||||
if (value === null || value && (valueType === "string" || valueType === "number")) {
|
||||
result[key] = value;
|
||||
}
|
||||
} else if (valueType === typeof result[key]) {
|
||||
result[key] = key === "rotate" ? value % 4 : value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const separator = /[\s,]+/;
|
||||
function flipFromString(custom, flip) {
|
||||
flip.split(separator).forEach((str) => {
|
||||
const value = str.trim();
|
||||
switch (value) {
|
||||
case "horizontal":
|
||||
custom.hFlip = true;
|
||||
break;
|
||||
case "vertical":
|
||||
custom.vFlip = true;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function rotateFromString(value, defaultValue = 0) {
|
||||
const units = value.replace(/^-?[0-9.]*/, "");
|
||||
function cleanup(value2) {
|
||||
while (value2 < 0) {
|
||||
value2 += 4;
|
||||
}
|
||||
return value2 % 4;
|
||||
}
|
||||
if (units === "") {
|
||||
const num = parseInt(value);
|
||||
return isNaN(num) ? 0 : cleanup(num);
|
||||
} else if (units !== value) {
|
||||
let split = 0;
|
||||
switch (units) {
|
||||
case "%":
|
||||
split = 25;
|
||||
break;
|
||||
case "deg":
|
||||
split = 90;
|
||||
}
|
||||
if (split) {
|
||||
let num = parseFloat(value.slice(0, value.length - units.length));
|
||||
if (isNaN(num)) {
|
||||
return 0;
|
||||
}
|
||||
num = num / split;
|
||||
return num % 1 === 0 ? cleanup(num) : 0;
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
|
||||
const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
||||
function calculateSize(size, ratio, precision) {
|
||||
if (ratio === 1) {
|
||||
return size;
|
||||
}
|
||||
precision = precision || 100;
|
||||
if (typeof size === "number") {
|
||||
return Math.ceil(size * ratio * precision) / precision;
|
||||
}
|
||||
if (typeof size !== "string") {
|
||||
return size;
|
||||
}
|
||||
const oldParts = size.split(unitsSplit);
|
||||
if (oldParts === null || !oldParts.length) {
|
||||
return size;
|
||||
}
|
||||
const newParts = [];
|
||||
let code = oldParts.shift();
|
||||
let isNumber = unitsTest.test(code);
|
||||
while (true) {
|
||||
if (isNumber) {
|
||||
const num = parseFloat(code);
|
||||
if (isNaN(num)) {
|
||||
newParts.push(code);
|
||||
} else {
|
||||
newParts.push(Math.ceil(num * ratio * precision) / precision);
|
||||
}
|
||||
} else {
|
||||
newParts.push(code);
|
||||
}
|
||||
code = oldParts.shift();
|
||||
if (code === void 0) {
|
||||
return newParts.join("");
|
||||
}
|
||||
isNumber = !isNumber;
|
||||
}
|
||||
}
|
||||
|
||||
function splitSVGDefs(content, tag = "defs") {
|
||||
let defs = "";
|
||||
const index = content.indexOf("<" + tag);
|
||||
while (index >= 0) {
|
||||
const start = content.indexOf(">", index);
|
||||
const end = content.indexOf("</" + tag);
|
||||
if (start === -1 || end === -1) {
|
||||
break;
|
||||
}
|
||||
const endEnd = content.indexOf(">", end);
|
||||
if (endEnd === -1) {
|
||||
break;
|
||||
}
|
||||
defs += content.slice(start + 1, end).trim();
|
||||
content = content.slice(0, index).trim() + content.slice(endEnd + 1);
|
||||
}
|
||||
return {
|
||||
defs,
|
||||
content
|
||||
};
|
||||
}
|
||||
function mergeDefsAndContent(defs, content) {
|
||||
return defs ? "<defs>" + defs + "</defs>" + content : content;
|
||||
}
|
||||
function wrapSVGContent(body, start, end) {
|
||||
const split = splitSVGDefs(body);
|
||||
return mergeDefsAndContent(split.defs, start + split.content + end);
|
||||
}
|
||||
|
||||
const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
|
||||
function iconToSVG(icon, customisations) {
|
||||
const fullIcon = {
|
||||
...defaultIconProps,
|
||||
...icon
|
||||
};
|
||||
const fullCustomisations = {
|
||||
...defaultIconCustomisations,
|
||||
...customisations
|
||||
};
|
||||
const box = {
|
||||
left: fullIcon.left,
|
||||
top: fullIcon.top,
|
||||
width: fullIcon.width,
|
||||
height: fullIcon.height
|
||||
};
|
||||
let body = fullIcon.body;
|
||||
[fullIcon, fullCustomisations].forEach((props) => {
|
||||
const transformations = [];
|
||||
const hFlip = props.hFlip;
|
||||
const vFlip = props.vFlip;
|
||||
let rotation = props.rotate;
|
||||
if (hFlip) {
|
||||
if (vFlip) {
|
||||
rotation += 2;
|
||||
} else {
|
||||
transformations.push(
|
||||
"translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"
|
||||
);
|
||||
transformations.push("scale(-1 1)");
|
||||
box.top = box.left = 0;
|
||||
}
|
||||
} else if (vFlip) {
|
||||
transformations.push(
|
||||
"translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"
|
||||
);
|
||||
transformations.push("scale(1 -1)");
|
||||
box.top = box.left = 0;
|
||||
}
|
||||
let tempValue;
|
||||
if (rotation < 0) {
|
||||
rotation -= Math.floor(rotation / 4) * 4;
|
||||
}
|
||||
rotation = rotation % 4;
|
||||
switch (rotation) {
|
||||
case 1:
|
||||
tempValue = box.height / 2 + box.top;
|
||||
transformations.unshift(
|
||||
"rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"
|
||||
);
|
||||
break;
|
||||
case 2:
|
||||
transformations.unshift(
|
||||
"rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"
|
||||
);
|
||||
break;
|
||||
case 3:
|
||||
tempValue = box.width / 2 + box.left;
|
||||
transformations.unshift(
|
||||
"rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"
|
||||
);
|
||||
break;
|
||||
}
|
||||
if (rotation % 2 === 1) {
|
||||
if (box.left !== box.top) {
|
||||
tempValue = box.left;
|
||||
box.left = box.top;
|
||||
box.top = tempValue;
|
||||
}
|
||||
if (box.width !== box.height) {
|
||||
tempValue = box.width;
|
||||
box.width = box.height;
|
||||
box.height = tempValue;
|
||||
}
|
||||
}
|
||||
if (transformations.length) {
|
||||
body = wrapSVGContent(
|
||||
body,
|
||||
'<g transform="' + transformations.join(" ") + '">',
|
||||
"</g>"
|
||||
);
|
||||
}
|
||||
});
|
||||
const customisationsWidth = fullCustomisations.width;
|
||||
const customisationsHeight = fullCustomisations.height;
|
||||
const boxWidth = box.width;
|
||||
const boxHeight = box.height;
|
||||
let width;
|
||||
let height;
|
||||
if (customisationsWidth === null) {
|
||||
height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
||||
width = calculateSize(height, boxWidth / boxHeight);
|
||||
} else {
|
||||
width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
|
||||
height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
||||
}
|
||||
const attributes = {};
|
||||
const setAttr = (prop, value) => {
|
||||
if (!isUnsetKeyword(value)) {
|
||||
attributes[prop] = value.toString();
|
||||
}
|
||||
};
|
||||
setAttr("width", width);
|
||||
setAttr("height", height);
|
||||
const viewBox = [box.left, box.top, boxWidth, boxHeight];
|
||||
attributes.viewBox = viewBox.join(" ");
|
||||
return {
|
||||
attributes,
|
||||
viewBox,
|
||||
body
|
||||
};
|
||||
}
|
||||
|
||||
const regex = /\sid="(\S+)"/g;
|
||||
const randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
|
||||
let counter = 0;
|
||||
function replaceIDs(body, prefix = randomPrefix) {
|
||||
const ids = [];
|
||||
let match;
|
||||
while (match = regex.exec(body)) {
|
||||
ids.push(match[1]);
|
||||
}
|
||||
if (!ids.length) {
|
||||
return body;
|
||||
}
|
||||
const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
|
||||
ids.forEach((id) => {
|
||||
const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString();
|
||||
const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
body = body.replace(
|
||||
// Allowed characters before id: [#;"]
|
||||
// Allowed characters after id: [)"], .[a-z]
|
||||
new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"),
|
||||
"$1" + newID + suffix + "$3"
|
||||
);
|
||||
});
|
||||
body = body.replace(new RegExp(suffix, "g"), "");
|
||||
return body;
|
||||
}
|
||||
|
||||
function iconToHTML(body, attributes) {
|
||||
let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
|
||||
for (const attr in attributes) {
|
||||
renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
|
||||
}
|
||||
return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
|
||||
}
|
||||
|
||||
function encodeSVGforURL(svg) {
|
||||
return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
|
||||
}
|
||||
function svgToData(svg) {
|
||||
return "data:image/svg+xml," + encodeSVGforURL(svg);
|
||||
}
|
||||
function svgToURL(svg) {
|
||||
return 'url("' + svgToData(svg) + '")';
|
||||
}
|
||||
|
||||
let policy;
|
||||
function createPolicy() {
|
||||
try {
|
||||
policy = window.trustedTypes.createPolicy("iconify", {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
createHTML: (s) => s
|
||||
});
|
||||
} catch (err) {
|
||||
policy = null;
|
||||
}
|
||||
}
|
||||
function cleanUpInnerHTML(html) {
|
||||
if (policy === void 0) {
|
||||
createPolicy();
|
||||
}
|
||||
return policy ? policy.createHTML(html) : html;
|
||||
}
|
||||
|
||||
const defaultExtendedIconCustomisations = {
|
||||
...defaultIconCustomisations,
|
||||
inline: false,
|
||||
};
|
||||
|
||||
const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
|
||||
const colonSeparated = value.split(":");
|
||||
if (value.slice(0, 1) === "@") {
|
||||
if (colonSeparated.length < 2 || colonSeparated.length > 3) {
|
||||
return null;
|
||||
}
|
||||
provider = colonSeparated.shift().slice(1);
|
||||
}
|
||||
if (colonSeparated.length > 3 || !colonSeparated.length) {
|
||||
return null;
|
||||
}
|
||||
if (colonSeparated.length > 1) {
|
||||
const name2 = colonSeparated.pop();
|
||||
const prefix = colonSeparated.pop();
|
||||
const result = {
|
||||
// Allow provider without '@': "provider:prefix:name"
|
||||
provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
|
||||
prefix,
|
||||
name: name2
|
||||
};
|
||||
return result;
|
||||
}
|
||||
const name = colonSeparated[0];
|
||||
const dashSeparated = name.split("-");
|
||||
if (dashSeparated.length > 1) {
|
||||
const result = {
|
||||
provider,
|
||||
prefix: dashSeparated.shift(),
|
||||
name: dashSeparated.join("-")
|
||||
};
|
||||
return result;
|
||||
}
|
||||
if (provider === "") {
|
||||
const result = {
|
||||
provider,
|
||||
prefix: "",
|
||||
name
|
||||
};
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Default SVG attributes
|
||||
*/
|
||||
const svgDefaults = {
|
||||
'xmlns': 'http://www.w3.org/2000/svg',
|
||||
'xmlnsXlink': 'http://www.w3.org/1999/xlink',
|
||||
'aria-hidden': true,
|
||||
'role': 'img',
|
||||
};
|
||||
/**
|
||||
* Style modes
|
||||
*/
|
||||
const commonProps = {
|
||||
display: 'inline-block',
|
||||
};
|
||||
const monotoneProps = {
|
||||
backgroundColor: 'currentColor',
|
||||
};
|
||||
const coloredProps = {
|
||||
backgroundColor: 'transparent',
|
||||
};
|
||||
// Dynamically add common props to variables above
|
||||
const propsToAdd = {
|
||||
Image: 'var(--svg)',
|
||||
Repeat: 'no-repeat',
|
||||
Size: '100% 100%',
|
||||
};
|
||||
const propsToAddTo = {
|
||||
WebkitMask: monotoneProps,
|
||||
mask: monotoneProps,
|
||||
background: coloredProps,
|
||||
};
|
||||
for (const prefix in propsToAddTo) {
|
||||
const list = propsToAddTo[prefix];
|
||||
for (const prop in propsToAdd) {
|
||||
list[prefix + prop] = propsToAdd[prop];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Default values for customisations for inline icon
|
||||
*/
|
||||
const inlineDefaults = {
|
||||
...defaultExtendedIconCustomisations,
|
||||
inline: true,
|
||||
};
|
||||
/**
|
||||
* Fix size: add 'px' to numbers
|
||||
*/
|
||||
function fixSize(value) {
|
||||
return value + (value.match(/^[-0-9.]+$/) ? 'px' : '');
|
||||
}
|
||||
/**
|
||||
* Render icon
|
||||
*/
|
||||
const render = (
|
||||
// Icon must be validated before calling this function
|
||||
icon,
|
||||
// Partial properties
|
||||
props,
|
||||
// Icon name
|
||||
name) => {
|
||||
// Get default properties
|
||||
const defaultProps = props.inline
|
||||
? inlineDefaults
|
||||
: defaultExtendedIconCustomisations;
|
||||
// Get all customisations
|
||||
const customisations = mergeCustomisations(defaultProps, props);
|
||||
// Check mode
|
||||
const mode = props.mode || 'svg';
|
||||
// Create style
|
||||
const style = {};
|
||||
const customStyle = props.style || {};
|
||||
// Create SVG component properties
|
||||
const componentProps = {
|
||||
...(mode === 'svg' ? svgDefaults : {}),
|
||||
};
|
||||
if (name) {
|
||||
const iconName = stringToIcon(name);
|
||||
if (iconName) {
|
||||
const classNames = ['iconify'];
|
||||
const props = [
|
||||
'provider',
|
||||
'prefix',
|
||||
];
|
||||
for (const prop of props) {
|
||||
if (iconName[prop]) {
|
||||
classNames.push('iconify--' + iconName[prop]);
|
||||
}
|
||||
}
|
||||
componentProps.className = classNames.join(' ');
|
||||
}
|
||||
}
|
||||
// Get element properties
|
||||
for (let key in props) {
|
||||
const value = props[key];
|
||||
if (value === void 0) {
|
||||
continue;
|
||||
}
|
||||
switch (key) {
|
||||
// Properties to ignore
|
||||
case 'icon':
|
||||
case 'style':
|
||||
case 'children':
|
||||
case 'onLoad':
|
||||
case 'mode':
|
||||
case 'ssr':
|
||||
break;
|
||||
// Forward ref
|
||||
case '_ref':
|
||||
componentProps.ref = value;
|
||||
break;
|
||||
// Merge class names
|
||||
case 'className':
|
||||
componentProps[key] =
|
||||
(componentProps[key] ? componentProps[key] + ' ' : '') +
|
||||
value;
|
||||
break;
|
||||
// Boolean attributes
|
||||
case 'inline':
|
||||
case 'hFlip':
|
||||
case 'vFlip':
|
||||
customisations[key] =
|
||||
value === true || value === 'true' || value === 1;
|
||||
break;
|
||||
// Flip as string: 'horizontal,vertical'
|
||||
case 'flip':
|
||||
if (typeof value === 'string') {
|
||||
flipFromString(customisations, value);
|
||||
}
|
||||
break;
|
||||
// Color: copy to style
|
||||
case 'color':
|
||||
style.color = value;
|
||||
break;
|
||||
// Rotation as string
|
||||
case 'rotate':
|
||||
if (typeof value === 'string') {
|
||||
customisations[key] = rotateFromString(value);
|
||||
}
|
||||
else if (typeof value === 'number') {
|
||||
customisations[key] = value;
|
||||
}
|
||||
break;
|
||||
// Remove aria-hidden
|
||||
case 'ariaHidden':
|
||||
case 'aria-hidden':
|
||||
if (value !== true && value !== 'true') {
|
||||
delete componentProps['aria-hidden'];
|
||||
}
|
||||
break;
|
||||
// Copy missing property if it does not exist in customisations
|
||||
default:
|
||||
if (defaultProps[key] === void 0) {
|
||||
componentProps[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Generate icon
|
||||
const item = iconToSVG(icon, customisations);
|
||||
const renderAttribs = item.attributes;
|
||||
// Inline display
|
||||
if (customisations.inline) {
|
||||
style.verticalAlign = '-0.125em';
|
||||
}
|
||||
if (mode === 'svg') {
|
||||
// Add style
|
||||
componentProps.style = {
|
||||
...style,
|
||||
...customStyle,
|
||||
};
|
||||
// Add icon stuff
|
||||
Object.assign(componentProps, renderAttribs);
|
||||
// Counter for ids based on "id" property to render icons consistently on server and client
|
||||
let localCounter = 0;
|
||||
let id = props.id;
|
||||
if (typeof id === 'string') {
|
||||
// Convert '-' to '_' to avoid errors in animations
|
||||
id = id.replace(/-/g, '_');
|
||||
}
|
||||
// Add icon stuff
|
||||
componentProps.dangerouslySetInnerHTML = {
|
||||
__html: cleanUpInnerHTML(replaceIDs(item.body, id ? () => id + 'ID' + localCounter++ : 'iconifyReact')),
|
||||
};
|
||||
return createElement('svg', componentProps);
|
||||
}
|
||||
// Render <span> with style
|
||||
const { body, width, height } = icon;
|
||||
const useMask = mode === 'mask' ||
|
||||
(mode === 'bg' ? false : body.indexOf('currentColor') !== -1);
|
||||
// Generate SVG
|
||||
const html = iconToHTML(body, {
|
||||
...renderAttribs,
|
||||
width: width + '',
|
||||
height: height + '',
|
||||
});
|
||||
// Generate style
|
||||
componentProps.style = {
|
||||
...style,
|
||||
'--svg': svgToURL(html),
|
||||
'width': fixSize(renderAttribs.width),
|
||||
'height': fixSize(renderAttribs.height),
|
||||
...commonProps,
|
||||
...(useMask ? monotoneProps : coloredProps),
|
||||
...customStyle,
|
||||
};
|
||||
return createElement('span', componentProps);
|
||||
};
|
||||
|
||||
/**
|
||||
* Storage for icons referred by name
|
||||
*/
|
||||
const storage = Object.create(null);
|
||||
function IconComponent(props) {
|
||||
const icon = props.icon;
|
||||
const data = typeof icon === 'string' ? storage[icon] : icon;
|
||||
if (!data) {
|
||||
return props.children
|
||||
? props.children
|
||||
: createElement('span', {});
|
||||
}
|
||||
return render({
|
||||
...defaultIconProps,
|
||||
...data,
|
||||
}, props, typeof icon === 'string' ? icon : undefined);
|
||||
}
|
||||
/**
|
||||
* Block icon
|
||||
*
|
||||
* @param props - Component properties
|
||||
*/
|
||||
const Icon = memo(forwardRef((props, ref) => IconComponent({
|
||||
...props,
|
||||
_ref: ref,
|
||||
})));
|
||||
/**
|
||||
* Inline icon (has negative verticalAlign that makes it behave like icon font)
|
||||
*
|
||||
* @param props - Component properties
|
||||
*/
|
||||
const InlineIcon = memo(forwardRef((props, ref) => IconComponent({
|
||||
inline: true,
|
||||
...props,
|
||||
_ref: ref,
|
||||
})));
|
||||
/**
|
||||
* Add icon to storage, allowing to call it by name
|
||||
*
|
||||
* @param name
|
||||
* @param data
|
||||
*/
|
||||
function addIcon(name, data) {
|
||||
storage[name] = data;
|
||||
}
|
||||
/**
|
||||
* Add collection to storage, allowing to call icons by name
|
||||
*
|
||||
* @param data Icon set
|
||||
* @param prefix Optional prefix to add to icon names, true (default) if prefix from icon set should be used.
|
||||
*/
|
||||
function addCollection(data, prefix) {
|
||||
const iconPrefix = typeof prefix === 'string'
|
||||
? prefix
|
||||
: prefix !== false && typeof data.prefix === 'string'
|
||||
? data.prefix + ':'
|
||||
: '';
|
||||
quicklyValidateIconSet(data) &&
|
||||
parseIconSet(data, (name, icon) => {
|
||||
if (icon) {
|
||||
storage[iconPrefix + name] = icon;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export { Icon, InlineIcon, addCollection, addIcon };
|
||||
21
node_modules/@iconify/react/license.txt
generated
vendored
Normal file
21
node_modules/@iconify/react/license.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2019-PRESENT Vjacheslav Trushkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
14
node_modules/@iconify/react/offline/package.json
generated
vendored
Normal file
14
node_modules/@iconify/react/offline/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "@iconify/react/offline",
|
||||
"main": "../dist/offline.js",
|
||||
"types": "../dist/offline.d.ts",
|
||||
"exports": {
|
||||
"./*": "./*",
|
||||
".": {
|
||||
"types": "../dist/offline.d.ts",
|
||||
"require": "../dist/offline.cjs",
|
||||
"import": "../dist/offline.js",
|
||||
"default": "../dist/offline.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
5
node_modules/@iconify/react/offline/readme.md
generated
vendored
Normal file
5
node_modules/@iconify/react/offline/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# @iconify/react/offline
|
||||
|
||||
This sub-directory contains `package.json` with entry points for importing `@iconify/react/offline`.
|
||||
|
||||
There is a duplicate entry in `exports` section of `package.json` in the parent directory, but at moment of coding this, TypeScript does not support conditional exports properly, so this directory is used as a duplicate to make everything work with TypeScript.
|
||||
75
node_modules/@iconify/react/package.json
generated
vendored
Normal file
75
node_modules/@iconify/react/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"name": "@iconify/react",
|
||||
"description": "Iconify icon component for React.",
|
||||
"author": "Vjacheslav Trushkin",
|
||||
"type": "module",
|
||||
"version": "6.0.0",
|
||||
"publishConfig": {
|
||||
"tag": "next"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": "https://github.com/iconify/iconify/issues",
|
||||
"homepage": "https://iconify.design/",
|
||||
"funding": "https://github.com/sponsors/cyberalien",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/iconify/iconify.git",
|
||||
"directory": "components/react"
|
||||
},
|
||||
"main": "dist/iconify.js",
|
||||
"types": "dist/iconify.d.ts",
|
||||
"exports": {
|
||||
"./*": "./*",
|
||||
".": {
|
||||
"types": "./dist/iconify.d.ts",
|
||||
"require": "./dist/iconify.cjs",
|
||||
"import": "./dist/iconify.js",
|
||||
"default": "./dist/iconify.js"
|
||||
},
|
||||
"./offline": {
|
||||
"types": "./dist/offline.d.ts",
|
||||
"require": "./dist/offline.cjs",
|
||||
"import": "./dist/offline.js",
|
||||
"default": "./dist/offline.js"
|
||||
},
|
||||
"./dist/offline": {
|
||||
"types": "./dist/offline.d.ts",
|
||||
"require": "./dist/offline.cjs",
|
||||
"import": "./dist/offline.js",
|
||||
"default": "./dist/offline.js"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@iconify/types": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/api-extractor": "^7.52.2",
|
||||
"@rollup/plugin-node-resolve": "^15.3.1",
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
"@testing-library/react": "^16.2.0",
|
||||
"@types/react": "^18.3.20",
|
||||
"@types/react-dom": "^18.3.5",
|
||||
"jsdom": "^25.0.1",
|
||||
"react": "^18.3.1",
|
||||
"rimraf": "^6.0.1",
|
||||
"rollup": "^4.38.0",
|
||||
"typescript": "^5.8.2",
|
||||
"vitest": "^2.1.9",
|
||||
"@iconify/core": "^3.1.0",
|
||||
"@iconify/utils": "^2.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf lib dist tsconfig.tsbuildinfo",
|
||||
"prebuild": "pnpm run clean",
|
||||
"build": "node build",
|
||||
"build:lib": "tsc -b tsconfig.src.json",
|
||||
"build:dist": "rollup -c rollup.config.js",
|
||||
"prebuild:api": "api-extractor run --local --verbose --config api-extractor.offline.json",
|
||||
"build:api": "api-extractor run --local --verbose --config api-extractor.iconify.json",
|
||||
"build:cleanup": "node cleanup",
|
||||
"test": "vitest"
|
||||
}
|
||||
}
|
||||
371
node_modules/@iconify/react/readme.md
generated
vendored
Normal file
371
node_modules/@iconify/react/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,371 @@
|
|||
# Iconify for React
|
||||
|
||||
Iconify for React is not yet another icon component! There are many of them already.
|
||||
|
||||
What you get with other components:
|
||||
|
||||
- Limited set of icons.
|
||||
- Large bundle size because all icons are bundled.
|
||||
|
||||
Iconify icon component is nothing like that. Component does not include any icon data, it is not tied to any specific icon set. Instead, all data is retrieved from public API on demand.
|
||||
|
||||
That means:
|
||||
|
||||
- One syntax for over 200,000 icons from 150+ icon sets.
|
||||
- Renders SVG. Many components simply render icon fonts, which look ugly. Iconify renders pixel perfect SVG.
|
||||
- Loads icons on demand. No need to bundle icons, component will automatically load icon data for icons that you use from Iconify API.
|
||||
|
||||
For more information about Iconify project visit [https://iconify.design/](https://iconify.design/).
|
||||
|
||||
For extended documentation visit [Iconify for React documentation](https://iconify.design/docs/icon-components/react/).
|
||||
|
||||
## Installation
|
||||
|
||||
If you are using NPM:
|
||||
|
||||
```bash
|
||||
npm install --save-dev @iconify/react
|
||||
```
|
||||
|
||||
If you are using Yarn:
|
||||
|
||||
```bash
|
||||
yarn add --dev @iconify/react
|
||||
```
|
||||
|
||||
## Usage with API
|
||||
|
||||
Install `@iconify/react` and import `Icon` from it:
|
||||
|
||||
```typescript
|
||||
import { Icon } from '@iconify/react';
|
||||
```
|
||||
|
||||
Then use `Icon` component with icon name or data as "icon" parameter:
|
||||
|
||||
```jsx
|
||||
<Icon icon="mdi-light:home" />
|
||||
```
|
||||
|
||||
Component will automatically retrieve data for "mdi-light:home" from Iconify API and render it. There are over 200,000 icons available on Iconify API from various free and open source icon sets, including all the most popular icon sets.
|
||||
|
||||
## Offline usage
|
||||
|
||||
This icon component is designed to be used with Iconify API, loading icon data on demand instead of bundling it.
|
||||
|
||||
If you want to use icons without Iconify API, [there are many other options available](https://iconify.design/docs/usage/).
|
||||
|
||||
## Icon Names
|
||||
|
||||
Icon name is a string. Few examples:
|
||||
|
||||
- `@api-provider:icon-set-prefix:icon-name`
|
||||
- `mdi-light:home` (in this example API provider is empty, so it is skipped)
|
||||
|
||||
It has 3 parts, separated by ":":
|
||||
|
||||
- provider points to API source. Starts with "@", can be empty (empty value is used for public Iconify API).
|
||||
- prefix is name of icon set.
|
||||
- name is name of icon.
|
||||
|
||||
See [Iconify for React icon names documentation](https://iconify.design/docs/icon-components/react/icon-name.html) for more detailed explanation.
|
||||
|
||||
## Using icon data
|
||||
|
||||
Instead of icon name, you can pass icon data to component:
|
||||
|
||||
```jsx
|
||||
import { Icon } from '@iconify/react';
|
||||
import home from '@iconify-icons/mdi-light/home';
|
||||
|
||||
function renderHomeIcon() {
|
||||
return <Icon icon={home} />;
|
||||
}
|
||||
```
|
||||
|
||||
See [icon packages documentation](https://iconify.design/docs/icons/) for more details.
|
||||
|
||||
### Next.js notice
|
||||
|
||||
Example above will currently fail with Next.js. This is because Next.js uses outdated packaging software that does not support ES modules. But do not worry, there is a simple solution: switch to CommonJS icon packages.
|
||||
|
||||
To switch to CommonJS package, replace this line in example above:
|
||||
|
||||
```js
|
||||
import home from '@iconify-icons/mdi-light/home';
|
||||
```
|
||||
|
||||
with
|
||||
|
||||
```js
|
||||
import home from '@iconify/icons-mdi-light/home';
|
||||
```
|
||||
|
||||
All icons are available as ES modules for modern bundler and as CommonJS modules for outdated bundlers. ES modules use format `@iconify-icons/{prefix}`, CommonJS modules use `@iconify/icons-{prefix}`.
|
||||
|
||||
For more details, see [icon packages documentation](https://iconify.design/docs/icons/).
|
||||
|
||||
## Vertical alignment
|
||||
|
||||
Icons have 2 modes: inline and block. Difference between modes is `vertical-align` that is added to inline icons.
|
||||
|
||||
Inline icons are aligned slightly below baseline, so they look centred compared to text, like glyph fonts.
|
||||
|
||||
Block icons do not have alignment, like images, which aligns them to baseline by default.
|
||||
|
||||
Alignment option was added to make icons look like continuation of text, behaving like glyph fonts. This should make migration from glyph fonts easier.
|
||||
|
||||
```jsx
|
||||
import React from 'react';
|
||||
import { Icon, InlineIcon } from '@iconify/react';
|
||||
|
||||
export function inlineDemo() {
|
||||
return (
|
||||
<div>
|
||||
<p>
|
||||
Block:
|
||||
<Icon icon="line-md:image-twotone" />
|
||||
<Icon icon="mdi:account-box-outline" />
|
||||
</p>
|
||||
<p>
|
||||
Inline:
|
||||
<InlineIcon icon="line-md:image-twotone" />
|
||||
<InlineIcon icon="mdi:account-box-outline" />
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
To toggle between block and inline modes, you can either use `InlineIcon` or use boolean `inline` property:
|
||||
|
||||
```jsx
|
||||
import React from 'react';
|
||||
import { Icon } from '@iconify/react';
|
||||
|
||||
export function inlineDemo() {
|
||||
return (
|
||||
<div>
|
||||
<p>
|
||||
Block:
|
||||
<Icon icon="line-md:image-twotone" />
|
||||
<Icon icon="mdi:account-box-outline" />
|
||||
</p>
|
||||
<p>
|
||||
Inline:
|
||||
<Icon icon="line-md:image-twotone" inline={true} />
|
||||
<Icon icon="mdi:account-box-outline" inline={true} />
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
Visual example to show the difference between inline and block modes:
|
||||
|
||||

|
||||
|
||||
## Icon component properties
|
||||
|
||||
`icon` property is mandatory. It tells component what icon to render. The value can be a string containing the icon name or an object containing the icon data.
|
||||
|
||||
The icon component has the following optional properties:
|
||||
|
||||
- `inline`. Changes icon behaviour to match icon fonts. See "Inline icon" section above.
|
||||
- `width` and `height`. Icon dimensions. The default values are "1em" for both. See "Dimensions" section below.
|
||||
- `color`. Icon colour. This is the same as setting colour in style. See "Icon colour" section below.
|
||||
- `flip`, `hFlip`, `vFlip`. Flip icon horizontally and/or vertically. See "Transformations" section below.
|
||||
- `rotate`. Rotate icon by 90, 180 or 270 degrees. See "Transformations" section below.
|
||||
- `align`, `vAlign`, `hAlign`, `slice`. Icon alignment. See "Alignment" section below.
|
||||
- `onLoad`. Callback function that is called when icon data has been loaded. See "onLoad" section below.
|
||||
|
||||
### Other properties and events
|
||||
|
||||
In addition to the properties mentioned above, the icon component accepts any other properties and events. All other properties and events will be passed to generated `SVG` element, so you can do stuff like assigning `onClick` event, setting the inline style, add title and so on.
|
||||
|
||||
### Dimensions
|
||||
|
||||
By default, icon height is "1em". With is dynamic, calculated using the icon's width to height ratio. This makes it easy to change icon size by changing `font-size` in the stylesheet, just like icon fonts.
|
||||
|
||||
There are several ways to change icon dimensions:
|
||||
|
||||
- Setting `font-size` in style (or `fontSize` if you are using inline style).
|
||||
- Setting `width` and/or `height` property.
|
||||
|
||||
Values for `width` and `height` can be numbers or strings.
|
||||
|
||||
If you set only one dimension, another dimension will be calculated using the icon's width to height ratio. For example, if the icon size is 16 x 24, you set the height to 48, the width will be set to 32. Calculations work not only with numbers, but also with string values.
|
||||
|
||||
#### Dimensions as numbers
|
||||
|
||||
You can use numbers for `width` and `height`.
|
||||
|
||||
```jsx
|
||||
<Icon icon={homeIcon} height={24} />
|
||||
```
|
||||
|
||||
```jsx
|
||||
<Icon icon="mdi-light:home" width={16} height={16} />
|
||||
```
|
||||
|
||||
Number values are treated as pixels. That means in examples above, values are identical to "24px" and "16px".
|
||||
|
||||
#### Dimensions as strings without units
|
||||
|
||||
If you use strings without units, they are treated the same as numbers in an example above.
|
||||
|
||||
```jsx
|
||||
<Icon icon={homeIcon} height="24" />
|
||||
```
|
||||
|
||||
```jsx
|
||||
<Icon icon="mdi-light:home" width="16" height={'16'} />
|
||||
```
|
||||
|
||||
#### Dimensions as strings with units
|
||||
|
||||
You can use units in width and height values:
|
||||
|
||||
```jsx
|
||||
<Icon icon="mdi-light:home" height="2em" />
|
||||
```
|
||||
|
||||
Be careful when using `calc`, view port based units or percentages. In SVG element they might not behave the way you expect them to behave and when using such units, you should consider settings both width and height.
|
||||
|
||||
#### Dimensions as 'auto'
|
||||
|
||||
Keyword "auto" sets dimensions to the icon's `viewBox` dimensions. For example, for 24 x 24 icon using `height="auto"` sets height to 24 pixels.
|
||||
|
||||
```jsx
|
||||
<Icon icon="mdi-light:home" height="auto" />
|
||||
```
|
||||
|
||||
### Icon colour
|
||||
|
||||
There are two types of icons: icons that do not have a palette and icons that do have a palette.
|
||||
|
||||
Icons that do have a palette, such as emojis, cannot be customised. Setting colour to such icons will not change anything.
|
||||
|
||||
Icons that do not have a palette can be customised. By default, colour is set to "currentColor", which means the icon's colour matches text colour. To change the colour you can:
|
||||
|
||||
- Set `color` style or use stylesheet to target icon. If you are using the stylesheet, target `svg` element.
|
||||
- Add `color` property.
|
||||
|
||||
Examples:
|
||||
|
||||
Using `color` property:
|
||||
|
||||
```jsx
|
||||
<Icon icon="eva:alert-triangle-fill" color="red" />
|
||||
<Icon icon="eva:alert-triangle-fill" color="#f00" />
|
||||
```
|
||||
|
||||
Using inline style:
|
||||
|
||||
```jsx
|
||||
<Icon icon="eva:alert-triangle-fill" style={{color: 'red'}} />
|
||||
<Icon icon="eva:alert-triangle-fill" style={{color: '#f00'}} />
|
||||
```
|
||||
|
||||
Using stylesheet:
|
||||
|
||||
```jsx
|
||||
<Icon icon="eva:alert-triangle-fill" className="red-icon" />
|
||||
```
|
||||
|
||||
```css
|
||||
.red-icon {
|
||||
color: red;
|
||||
}
|
||||
```
|
||||
|
||||
### Transformations
|
||||
|
||||
You can rotate and flip the icon.
|
||||
|
||||
This might seem redundant because icon can also be rotated and flipped using CSS transformations. So why do transformation properties exist? Because it is a different type of transformation.
|
||||
|
||||
- CSS transformations transform the entire icon.
|
||||
- Icon transformations transform the contents of the icon.
|
||||
|
||||
If you have a square icon, this makes no difference. However, if you have an icon that has different width and height values, it makes a huge difference.
|
||||
|
||||
Rotating 16x24 icon by 90 degrees results in:
|
||||
|
||||
- CSS transformation keeps 16x24 bounding box, which might cause the icon to overlap text around it.
|
||||
- Icon transformation changes bounding box to 24x16, rotating content inside an icon.
|
||||
|
||||
See [icon transformations documentation](https://iconify.design/docs/icon-components/react/transform.html) for more details.
|
||||
|
||||
#### Flipping an icon
|
||||
|
||||
There are several properties available to flip an icon:
|
||||
|
||||
- `hFlip`: boolean property, flips icon horizontally.
|
||||
- `vFlip`: boolean property, flips icon vertically.
|
||||
- `flip`: shorthand string property, can flip icon horizontally and/or vertically.
|
||||
|
||||
Examples:
|
||||
|
||||
Flip an icon horizontally:
|
||||
|
||||
```jsx
|
||||
<Icon icon="eva:alert-triangle-fill" hFlip={true} />
|
||||
<Icon icon="eva:alert-triangle-fill" flip="horizontal" />
|
||||
```
|
||||
|
||||
Flip an icon vertically:
|
||||
|
||||
```jsx
|
||||
<Icon icon="eva:alert-triangle-fill" vFlip={true} />
|
||||
<Icon icon="eva:alert-triangle-fill" flip="vertical" />
|
||||
```
|
||||
|
||||
Flip an icon horizontally and vertically (the same as 180 degrees rotation):
|
||||
|
||||
```jsx
|
||||
<Icon icon="eva:alert-triangle-fill" hFlip={true} vFlip={true} />
|
||||
<Icon icon="eva:alert-triangle-fill" flip="horizontal,vertical" />
|
||||
```
|
||||
|
||||
#### Rotating an icon
|
||||
|
||||
An icon can be rotated by 90, 180 and 270 degrees. Only contents of the icon are rotated.
|
||||
|
||||
To rotate an icon, use `rotate` property. Value can be a string (degrees or percentages) or a number.
|
||||
|
||||
Number values are 1 for 90 degrees, 2 for 180 degrees, 3 for 270 degrees.
|
||||
|
||||
Examples of 90 degrees rotation:
|
||||
|
||||
```jsx
|
||||
<Icon icon="eva:alert-triangle-fill" rotate={1} />
|
||||
<Icon icon="eva:alert-triangle-fill" rotate="90deg" />
|
||||
<Icon icon="eva:alert-triangle-fill" rotate="25%" />
|
||||
```
|
||||
|
||||
### onLoad
|
||||
|
||||
`onLoad` property is an optional callback function. It is called when icon data has been loaded.
|
||||
|
||||
It is not an event, such as `onClick` event for links, it is a simple callback function.
|
||||
|
||||
When `onLoad` is called:
|
||||
|
||||
- If value of icon property is an object, `onLoad` is not called.
|
||||
- If value of icon property is a string and icon data is available, `onLoad` is called on first render.
|
||||
- If value of icon property is a string and icon data is not available, `onLoad` is called on first re-render after icon data is retrieved from API.
|
||||
|
||||
What is the purpose of `onLoad`? To let you know when Icon component renders an icon and when it does not render anything. This allows you to do things like adding class name for parent element, such as "container--with-icon" that modify layout if icon is being displayed.
|
||||
|
||||
## Full documentation
|
||||
|
||||
For extended documentation visit [Iconify for React documentation](https://iconify.design/docs/icon-components/react/).
|
||||
|
||||
## License
|
||||
|
||||
React component is released with MIT license.
|
||||
|
||||
© 2019-PRESENT Vjacheslav Trushkin
|
||||
|
||||
See [Iconify icon sets page](https://icon-sets.iconify.design/) for list of collections and their licenses.
|
||||
17
node_modules/@iconify/react/tsconfig.src.json
generated
vendored
Normal file
17
node_modules/@iconify/react/tsconfig.src.json
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["tests/**/*"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib",
|
||||
"target": "ES2019",
|
||||
"module": "ESNext",
|
||||
"declaration": true,
|
||||
"sourceMap": false,
|
||||
"strict": false,
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
||||
18
node_modules/@iconify/react/tsconfig.tests.json
generated
vendored
Normal file
18
node_modules/@iconify/react/tsconfig.tests.json
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"include": ["tests/**/*", "tests/**/*.tsx"],
|
||||
"exclude": ["src/*"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "./tests",
|
||||
"target": "ES2019",
|
||||
"module": "ESNext",
|
||||
"declaration": false,
|
||||
"sourceMap": false,
|
||||
"strict": false,
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"skipLibCheck": true,
|
||||
"jsx": "react",
|
||||
"noEmit": true
|
||||
}
|
||||
}
|
||||
9
node_modules/@iconify/react/vitest.config.ts
generated
vendored
Normal file
9
node_modules/@iconify/react/vitest.config.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
globals: true,
|
||||
environment: 'jsdom',
|
||||
watch: false,
|
||||
},
|
||||
});
|
||||
8
node_modules/@iconify/types/.prettierrc
generated
vendored
Normal file
8
node_modules/@iconify/types/.prettierrc
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"trailingComma": "es5",
|
||||
"singleQuote": true,
|
||||
"useTabs": true,
|
||||
"semi": true,
|
||||
"quoteProps": "consistent",
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
459
node_modules/@iconify/types/README.md
generated
vendored
Normal file
459
node_modules/@iconify/types/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,459 @@
|
|||
# Iconify Types
|
||||
|
||||
Type definitions for using Iconify icon sets with TypeScript.
|
||||
|
||||
## Files structure
|
||||
|
||||
Iconify icon sets are available in several formats:
|
||||
|
||||
- Big JSON files that combine many icons in one file
|
||||
- Node.js packages split into individual icons
|
||||
|
||||
### Icon format
|
||||
|
||||
Each icon is represented by the `IconifyIcon` type. It is a simple object with multiple string, number or boolean attributes.
|
||||
|
||||
The only required attribute is:
|
||||
|
||||
- `body`: string. Value contains inner HTML of an icon as a string, for example `<path d="..."/>`.
|
||||
|
||||
Optional attributes are represented by type `IconifyOptional`. They are split into several types: dimensions (`IconifyDimenisons` type) and transformations (`IconifyTransformations` type).
|
||||
|
||||
Dimensions attributes:
|
||||
|
||||
- `width`: number. viewBox width, number. If missing, value is set to 16.
|
||||
- `height`: number. viewBox height, number. If missing, value is set to 16.
|
||||
- `left`: number. viewBox left, number. If missing, the value is set to 0.
|
||||
- `top`: number. viewBox top, number. If missing, the value is set to 0.
|
||||
|
||||
Transformations:
|
||||
|
||||
- `rotate`: number. Icon rotation. Iconify icons can be rotated in 90 degrees increments, allowing to reuse the same source icon for multiple icons, such as arrow-up being a copy of arrow-left rotated by 90 degrees. Values are 0 for 0 degrees, 1 for 90 degrees, 2 for 180 degrees, 3 for 270 degrees. The default value is 0.
|
||||
- `hFlip`: boolean. Horizontal flip. Similar to the rotation transformation, an icon can be flipped horizontally and vertically. It can be used to quickly create aliases, such as arrow-left being an alias of arrow-right, but with hFlip set to true. The default value is false.
|
||||
- `vFlip`: boolean. Vertical flip. The default value is false.
|
||||
|
||||
Example of icon object:
|
||||
|
||||
```js
|
||||
const mdiHandIcon = {
|
||||
body: '<path d="M6.58 19h8v3h-8v-3m13.16-7.4c-.19-.2-.45-.32-.74-.32l-.22.03l-3.2 1.69v-1.17l.51-8.93c.03-.55-.39-1.03-.94-1.06c-.55-.03-1.03.39-1.06.94l-.27 4.69h-.24l-1.04.11V2a1 1 0 0 0-1-1c-.54 0-1 .45-1 1v6.41l-.82.37l-.69-5.46c-.07-.55-.57-.94-1.12-.87c-.55.05-.94.55-.87 1.12l.77 6.06l-.38.17c-.13.05-.25.13-.36.2l-1.1-3.89c-.16-.57-.72-.91-1.26-.77c-.53.16-.83.74-.67 1.31l2.57 9.12c0 .03.02.07.03.1l.03.13h.01c.22.57.79 1 1.4 1h6.5c.39 0 .74-.16 1-.43l4.92-4.2l-.76-.77z" fill="currentColor"/>',
|
||||
width: 24,
|
||||
height: 24,
|
||||
};
|
||||
```
|
||||
|
||||
### Icon sets format
|
||||
|
||||
Iconify icon sets format is available from multiple sources:
|
||||
|
||||
- NPM package `@iconify/json` that includes all icon sets
|
||||
- API responses used by SVG framework
|
||||
|
||||
Icon set format structure is available as the `IconifyJSON` type. It is an object with several fields:
|
||||
|
||||
- `prefix`: string. Icon set prefix.
|
||||
- `icons`: object. Icons data. Value is an object that represents a set of icons, where the key is an icon name and value is `IconifyIcon` object (see "Icon format" above).
|
||||
- `aliases`: object. Icon aliases, similar to the `icons` object (see "Aliases" section below).
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"prefix": "mdi",
|
||||
"icons": {
|
||||
"home": {
|
||||
"body": "<path d=\"M10 20v-6h4v6h5v-8h3L12 3L2 12h3v8h5z\" fill=\"currentColor\"/>",
|
||||
"width": 24,
|
||||
"height": 24
|
||||
},
|
||||
"arrow-left": {
|
||||
"body": "<path d=\"M20 11v2H8l5.5 5.5l-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5L8 11h12z\" fill=\"currentColor\"/>",
|
||||
"width": 24,
|
||||
"height": 24
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
All icon properties except for `body` are optional and are represented by type `IconifyOptional`. Type `IconifyJSON` also extends type `IconifyOptional`, allowing all optional properties to be placed in the root object.
|
||||
|
||||
If an icon is missing a property, look in the root object for the default value. If the root object does not have the default value, use Iconify default value for that property (see list of properties and default values in the "Icon format" section above).
|
||||
|
||||
Default values in the root object make it possible to reduce duplication.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"prefix": "mdi",
|
||||
"icons": {
|
||||
"home": {
|
||||
"body": "<path d=\"M10 20v-6h4v6h5v-8h3L12 3L2 12h3v8h5z\" fill=\"currentColor\"/>"
|
||||
},
|
||||
"arrow-left": {
|
||||
"body": "<path d=\"M20 11v2H8l5.5 5.5l-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5L8 11h12z\" fill=\"currentColor\"/>"
|
||||
}
|
||||
},
|
||||
"width": 24,
|
||||
"height": 24
|
||||
}
|
||||
```
|
||||
|
||||
In this example, both icons are 24x24, so width and height have been moved to the root object.
|
||||
|
||||
Another example:
|
||||
|
||||
```json
|
||||
{
|
||||
"prefix": "fa-solid",
|
||||
"icons": {
|
||||
"arrow-left": {
|
||||
"body": "<path d=\"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z\" fill=\"currentColor\"/>",
|
||||
"width": 448
|
||||
},
|
||||
"arrow-circle-left": {
|
||||
"body": "<path d=\"M256 504C119 504 8 393 8 256S119 8 256 8s248 111 248 248s-111 248-248 248zm28.9-143.6L209.4 288H392c13.3 0 24-10.7 24-24v-16c0-13.3-10.7-24-24-24H209.4l75.5-72.4c9.7-9.3 9.9-24.8.4-34.3l-11-10.9c-9.4-9.4-24.6-9.4-33.9 0L107.7 239c-9.4 9.4-9.4 24.6 0 33.9l132.7 132.7c9.4 9.4 24.6 9.4 33.9 0l11-10.9c9.5-9.5 9.3-25-.4-34.3z\" fill=\"currentColor\"/>"
|
||||
},
|
||||
"barcode": {
|
||||
"body": "<path d=\"M0 448V64h18v384H0zm26.857-.273V64H36v383.727h-9.143zm27.143 0V64h8.857v383.727H54zm44.857 0V64h8.857v383.727h-8.857zm36 0V64h17.714v383.727h-17.714zm44.857 0V64h8.857v383.727h-8.857zm18 0V64h8.857v383.727h-8.857zm18 0V64h8.857v383.727h-8.857zm35.715 0V64h18v383.727h-18zm44.857 0V64h18v383.727h-18zm35.999 0V64h18.001v383.727h-18.001zm36.001 0V64h18.001v383.727h-18.001zm26.857 0V64h18v383.727h-18zm45.143 0V64h26.857v383.727h-26.857zm35.714 0V64h9.143v383.727H476zm18 .273V64h18v384h-18z\" fill=\"currentColor\"/>"
|
||||
}
|
||||
},
|
||||
"width": 512,
|
||||
"height": 512
|
||||
}
|
||||
```
|
||||
|
||||
In this example `arrow-circle-left` and `barcode` have width of 512, `arrow-left` has width of 448. All icons have a height of 512.
|
||||
|
||||
#### Aliases
|
||||
|
||||
In addition to `icons`, another important field in icon set object is `aliases`.
|
||||
|
||||
Aliases object is similar to icons object, except that instead of icon body icons reference another icon.
|
||||
|
||||
Each entry has the same attributes as an icon, except for `body` and has required attribute `parent` that contains the name of the parent icon. The parent icon must be present in the icon set file.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"prefix": "fa",
|
||||
"icons": {
|
||||
"automobile": {
|
||||
"body": "<path d=\"M480 960q0-66-47-113t-113-47t-113 47t-47 113t47 113t113 47t113-47t47-113zm36-320h1016l-89-357q-2-8-14-17.5t-21-9.5H640q-9 0-21 9.5T605 283zm1372 320q0-66-47-113t-113-47t-113 47t-47 113t47 113t113 47t113-47t47-113zm160-96v384q0 14-9 23t-23 9h-96v128q0 80-56 136t-136 56t-136-56t-56-136v-128H512v128q0 80-56 136t-136 56t-136-56t-56-136v-128H32q-14 0-23-9t-9-23V864q0-93 65.5-158.5T224 640h28l105-419q23-94 104-157.5T640 0h768q98 0 179 63.5T1691 221l105 419h28q93 0 158.5 65.5T2048 864z\" fill=\"currentColor\"/>",
|
||||
"width": 2048,
|
||||
"height": 1600
|
||||
}
|
||||
},
|
||||
"aliases": {
|
||||
"car": {
|
||||
"parent": "automobile"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In this example `car` is an alias of `automobile`, allowing to use the same icon by multiple names.
|
||||
|
||||
Another example:
|
||||
|
||||
```json
|
||||
{
|
||||
"prefix": "fa",
|
||||
"icons": {
|
||||
"caret-left": {
|
||||
"body": "<path d=\"M576 192v896q0 26-19 45t-45 19t-45-19L19 685Q0 666 0 640t19-45l448-448q19-19 45-19t45 19t19 45z\" fill=\"currentColor\"/>",
|
||||
"width": 576,
|
||||
"height": 1280
|
||||
}
|
||||
},
|
||||
"aliases": {
|
||||
"caret-right": {
|
||||
"parent": "caret-left",
|
||||
"hFlip": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In this example `caret-right` is alias of `caret-left`, but with additional `hFlip` attribute. It is identical to this:
|
||||
|
||||
```json
|
||||
{
|
||||
"prefix": "fa",
|
||||
"icons": {
|
||||
"caret-left": {
|
||||
"body": "<path d=\"M576 192v896q0 26-19 45t-45 19t-45-19L19 685Q0 666 0 640t19-45l448-448q19-19 45-19t45 19t19 45z\" fill=\"currentColor\"/>"
|
||||
},
|
||||
"caret-right": {
|
||||
"body": "<path d=\"M576 192v896q0 26-19 45t-45 19t-45-19L19 685Q0 666 0 640t19-45l448-448q19-19 45-19t45 19t19 45z\" fill=\"currentColor\"/>",
|
||||
"hFlip": true
|
||||
}
|
||||
},
|
||||
"width": 576,
|
||||
"height": 1280
|
||||
}
|
||||
```
|
||||
|
||||
##### Merging alias attributes
|
||||
|
||||
If both icon and alias have same attribute, following rules apply:
|
||||
|
||||
- `rotate`: attributes are combined. For example, icon has rotate = 1, alias has rotate = 1. Result will have rotate = 2. To prevent overflow, if rotate > 3, rotate = rotate - 4.
|
||||
- `hFlip` and `vFlip`: attributes are combined. For example, icon has hFlip = true, alias also has hFlip = true (icon.hFlip !== alias.hFlip). Result is false. false + false = false, false + true = true, true + true = false.
|
||||
- other attributes are overwritten.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"prefix": "fa",
|
||||
"icons": {
|
||||
"caret-left": {
|
||||
"body": "<path d=\"M576 192v896q0 26-19 45t-45 19t-45-19L19 685Q0 666 0 640t19-45l448-448q19-19 45-19t45 19t19 45z\" fill=\"currentColor\"/>",
|
||||
"hFlip": true,
|
||||
"width": 576,
|
||||
"height": 1280
|
||||
}
|
||||
},
|
||||
"aliases": {
|
||||
"caret-left-compact": {
|
||||
"parent": "caret-left",
|
||||
"left": 64,
|
||||
"width": 448
|
||||
},
|
||||
"caret-right": {
|
||||
"parent": "caret-left",
|
||||
"hFlip": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
is identical to:
|
||||
|
||||
```json
|
||||
{
|
||||
"prefix": "fa",
|
||||
"icons": {
|
||||
"caret-left": {
|
||||
"body": "<path d=\"M576 192v896q0 26-19 45t-45 19t-45-19L19 685Q0 666 0 640t19-45l448-448q19-19 45-19t45 19t19 45z\" fill=\"currentColor\"/>",
|
||||
"hFlip": true
|
||||
},
|
||||
"caret-left-compact": {
|
||||
"body": "<path d=\"M576 192v896q0 26-19 45t-45 19t-45-19L19 685Q0 666 0 640t19-45l448-448q19-19 45-19t45 19t19 45z\" fill=\"currentColor\"/>",
|
||||
"hFlip": true, // from caret-left
|
||||
"left": 64, // overwritten
|
||||
"width": 448 // overwritten
|
||||
},
|
||||
"caret-right": {
|
||||
"body": "<path d=\"M576 192v896q0 26-19 45t-45 19t-45-19L19 685Q0 666 0 640t19-45l448-448q19-19 45-19t45 19t19 45z\" fill=\"currentColor\"/>"
|
||||
// hFlip = false, which is default value, so it was removed
|
||||
}
|
||||
},
|
||||
"width": 576,
|
||||
"height": 1280
|
||||
}
|
||||
```
|
||||
|
||||
#### Metadata
|
||||
|
||||
Icon set files might also contain the metadata. That data is used for browsing icons, searching icons, exporting icon sets as fonts.
|
||||
|
||||
Metadata is a combination of several types, represented as type `IconifyMetaData`.
|
||||
|
||||
##### Icon set information
|
||||
|
||||
Icon set information is part of the metadata, it includes information about an author and license.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"prefix": "dashicons",
|
||||
"info": {
|
||||
"name": "Dashicons",
|
||||
"total": 304,
|
||||
"author": {
|
||||
"name": "WordPress",
|
||||
"url": "https://github.com/WordPress/dashicons"
|
||||
},
|
||||
"license": {
|
||||
"title": "GPL 2.0",
|
||||
"spdx": "GPL-2.0-only",
|
||||
"url": "http://www.gnu.org/licenses/gpl-2.0.html"
|
||||
},
|
||||
"version": "0.9.0",
|
||||
"samples": ["shortcode", "businessperson", "editor-expand"],
|
||||
"height": 20,
|
||||
"category": "General",
|
||||
"palette": false
|
||||
},
|
||||
"icons": {
|
||||
// Icons here
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### Info
|
||||
|
||||
Information block is part of the metadata, it is used for browsing or searching icon sets. It also contains the license for icons in the icon set and information about the author.
|
||||
|
||||
Info block is represented by the type `IconifyInfo`. You can see an example above in "info" property.
|
||||
|
||||
IconifyInfo type has the following properties, most of them are optional:
|
||||
|
||||
- `name`: string. Icon set name. This field is always set.
|
||||
- `total`: number. The total number of icons, optional.
|
||||
- `version`: string. The current version, optional.
|
||||
- `author`: object. Information about the author, always set. Author information has the following properties:
|
||||
- `name`: string. Author name. This field is always set.
|
||||
- `url`: string. Link to icon set, optional. Usually links to GitHub repository.
|
||||
- `license`: object. Information about the license, always set. License information has the following properties:
|
||||
- `title`: string. License title. This field is always set.
|
||||
- `spdx`: string. SPDX license identifier, optional.
|
||||
- `url`: string. Link to the license, optional.
|
||||
- `samples`: string[]. Value is an array of icon names that should be used as samples when showing the icon set in an icon sets list.
|
||||
- `height`: number | number[]. Value is a number or array of numbers, values are pixel grids used in the icon set. If any icons in an icon set do not match the grid, this attribute should not be set.
|
||||
- `displayHeight`: number. The height value that should be used for displaying samples. Value is a number between 16 and 30 (inclusive).
|
||||
|
||||
##### Characters map
|
||||
|
||||
Characters map is part of the metadata, it is used for icon sets that are either imported from icon fonts or intended to be exported to icon font.
|
||||
|
||||
Characters map allows storing characters for export as well as searching icons by character used in an icon font.
|
||||
|
||||
It is a simple object, where the key is character code in hexadecimal form, value is an icon name.
|
||||
|
||||
Important: each icon can have multiple characters!
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"prefix": "fa",
|
||||
"icons": {
|
||||
// Icons here
|
||||
},
|
||||
"chars": {
|
||||
"f000": "glass",
|
||||
"f001": "music",
|
||||
"f002": "search",
|
||||
"f003": "envelope-o",
|
||||
"f004": "heart",
|
||||
"f005": "star"
|
||||
// and so on...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### Categories
|
||||
|
||||
Categories are part of the metadata, used to allow filtering icons when showing the entire icons set.
|
||||
|
||||
Categories list is a simple object, where the key is category name, value is the list of icons.
|
||||
|
||||
Important: each icon can belong to multiple categories!
|
||||
|
||||
```json
|
||||
{
|
||||
"prefix": "fa-solid",
|
||||
"icons": {
|
||||
// Icons here
|
||||
},
|
||||
"categories": {
|
||||
"Accessibility": [
|
||||
"american-sign-language-interpreting",
|
||||
"assistive-listening-systems",
|
||||
"audio-description",
|
||||
"blind",
|
||||
"braille",
|
||||
"closed-captioning",
|
||||
"deaf",
|
||||
"low-vision",
|
||||
"phone-volume",
|
||||
"question-circle",
|
||||
"sign-language",
|
||||
"tty",
|
||||
"universal-access",
|
||||
"wheelchair"
|
||||
],
|
||||
"Alert": [
|
||||
"bell",
|
||||
"bell-slash",
|
||||
"exclamation",
|
||||
"exclamation-circle",
|
||||
"exclamation-triangle",
|
||||
"radiation",
|
||||
"radiation-alt",
|
||||
"skull-crossbones"
|
||||
]
|
||||
// and so on...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### Themes
|
||||
|
||||
Themes are part of the metadata, similar to categories, but using prefixes or suffixes to identify icons that belong to a theme.
|
||||
|
||||
This is useful when icon set has variations of icons, such as "baseline-_", "outline-_".
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"prefix": "ic",
|
||||
"icons": {
|
||||
// Icons here
|
||||
},
|
||||
"themes": {
|
||||
"baseline": {
|
||||
"title": "Baseline",
|
||||
"prefix": "baseline-"
|
||||
},
|
||||
"outline": {
|
||||
"title": "Outline",
|
||||
"prefix": "outline-"
|
||||
},
|
||||
"round": {
|
||||
"title": "Round",
|
||||
"prefix": "round-"
|
||||
},
|
||||
"sharp": {
|
||||
"title": "Sharp",
|
||||
"prefix": "sharp-"
|
||||
},
|
||||
"twotone": {
|
||||
"title": "Two-Tone",
|
||||
"prefix": "twotone-"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Each theme can have one of the attributes: `prefix` or `suffix`. The prefix must end with `-`, suffix must start with `-`.
|
||||
|
||||
In an example above, all icons that start with "baseline-", such as "baseline-home", are considered part of the "Baseline" theme.
|
||||
|
||||
#### All attributes
|
||||
|
||||
For an example of full icon set files that include metadata, look in icon set files in `@iconify/json` package or browse it at GitHub: [https://github.com/iconify/collections-json](https://github.com/iconify/collections-json)
|
||||
|
||||
For an example of individual icons, look in JavaScript files in NPM packages such as `@iconify/icons-mdi`.
|
||||
|
||||
## Usage
|
||||
|
||||
This repository is intended to be used with any Iconify packages.
|
||||
|
||||
At the moment of writing, multiple Iconify packages are written without TypeScript. At the beginning of the year 2020 plan is to rewrite all of them with TypeScript to make sure data is consistent and avoid duplication, this package will be used for sharing types between Iconify packages.
|
||||
|
||||
## License
|
||||
|
||||
This package is licensed under MIT license.
|
||||
|
||||
`SPDX-License-Identifier: MIT`
|
||||
|
||||
Previous versions of this package were dual-licensed under Apache 2.0 and GPL 2.0 licence, which was messy and confusing. This was later changed to MIT for simplicity.
|
||||
|
||||
© 2021 - 2022 Vjacheslav Trushkin / Iconify OÜ
|
||||
21
node_modules/@iconify/types/license.txt
generated
vendored
Normal file
21
node_modules/@iconify/types/license.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021 - 2022 Vjacheslav Trushkin / Iconify OÜ
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
23
node_modules/@iconify/types/package.json
generated
vendored
Normal file
23
node_modules/@iconify/types/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "@iconify/types",
|
||||
"type": "module",
|
||||
"description": "Types for Iconify data",
|
||||
"version": "2.0.0",
|
||||
"author": "Vjacheslav Trushkin",
|
||||
"license": "MIT",
|
||||
"main": "./types.js",
|
||||
"types": "./types.d.ts",
|
||||
"bugs": "https://github.com/iconify/iconify/issues",
|
||||
"homepage": "https://github.com/iconify/iconify",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/iconify/iconify.git",
|
||||
"directory": "packages/types"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.8.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tsc --noEmit --strict --typeRoots '[]' types.d.ts"
|
||||
}
|
||||
}
|
||||
15
node_modules/@iconify/types/pnpm-lock.yaml
generated
vendored
Normal file
15
node_modules/@iconify/types/pnpm-lock.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
typescript: ^4.6.2
|
||||
|
||||
devDependencies:
|
||||
typescript: 4.7.4
|
||||
|
||||
packages:
|
||||
|
||||
/typescript/4.7.4:
|
||||
resolution: {integrity: sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==}
|
||||
engines: {node: '>=4.2.0'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
44
node_modules/@iconify/types/provider.d.ts
generated
vendored
Normal file
44
node_modules/@iconify/types/provider.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* Raw data sent by API
|
||||
*/
|
||||
|
||||
// Links
|
||||
export interface APIProviderRawDataLinks {
|
||||
// Collections list
|
||||
home?: string;
|
||||
// Collection. Available variables: {prefix}
|
||||
collection?: string;
|
||||
// Icon. Available variables: {prefix}, {name}
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
// NPM
|
||||
export interface APIProviderRawDataNPM {
|
||||
// Package name for installation. Available variables: {prefix}
|
||||
package?: string;
|
||||
|
||||
// Icon import source. Available variables: {prefix}, {name}
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
// Main type
|
||||
export interface APIProviderRawData {
|
||||
// Provider name (as used in icon names)
|
||||
provider: string;
|
||||
|
||||
// Provider name (human readable version)
|
||||
title?: string;
|
||||
|
||||
// API link(s), though they are usually redundant because API end point is used to retrieve data
|
||||
api?: string | string[];
|
||||
|
||||
// Links to website
|
||||
links?: APIProviderRawDataLinks;
|
||||
|
||||
// NPM packages for icons, used when showing code samples
|
||||
npm?: APIProviderRawDataNPM;
|
||||
|
||||
// SVG generator URL, including full host name, {prefix} and {name} variables
|
||||
// Example: 'https://api.iconify.design/{prefix}/{name}.svg'
|
||||
svg?: string;
|
||||
}
|
||||
3
node_modules/@iconify/types/provider.js
generated
vendored
Normal file
3
node_modules/@iconify/types/provider.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
/**
|
||||
* Empty file. This repository contains only TypeScript types
|
||||
*/
|
||||
272
node_modules/@iconify/types/types.d.ts
generated
vendored
Normal file
272
node_modules/@iconify/types/types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,272 @@
|
|||
/**
|
||||
* Icon dimensions.
|
||||
*
|
||||
* Used in:
|
||||
* icon (as is)
|
||||
* alias (overwrite icon's properties)
|
||||
* root of JSON file (default values)
|
||||
*/
|
||||
export interface IconifyDimenisons {
|
||||
// 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon transformations.
|
||||
*
|
||||
* Used in:
|
||||
* icon (as is)
|
||||
* alias (merged with icon's properties)
|
||||
*/
|
||||
export interface IconifyTransformations {
|
||||
// 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combination of dimensions and transformations.
|
||||
*/
|
||||
export interface IconifyOptional
|
||||
extends IconifyDimenisons,
|
||||
IconifyTransformations {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias.
|
||||
*/
|
||||
export interface IconifyAlias extends IconifyOptional {
|
||||
// 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.
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon.
|
||||
*/
|
||||
export interface IconifyIcon 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.
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon with optional parameters that are provided by API and affect only search
|
||||
*/
|
||||
interface APIIconAttributes {
|
||||
// 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;
|
||||
}
|
||||
|
||||
export interface ExtendedIconifyIcon extends IconifyIcon, APIIconAttributes {}
|
||||
export interface ExtendedIconifyAlias extends IconifyAlias, APIIconAttributes {}
|
||||
|
||||
/**
|
||||
* "icons" field of JSON file.
|
||||
*/
|
||||
export interface IconifyIcons {
|
||||
// Index is name of icon, without prefix. Value is ExtendedIconifyIcon object.
|
||||
[index: string]: ExtendedIconifyIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* "aliases" field of JSON file.
|
||||
*/
|
||||
export interface IconifyAliases {
|
||||
// Index is name of icon, without prefix. Value is ExtendedIconifyAlias object.
|
||||
[index: string]: ExtendedIconifyAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon set information block.
|
||||
*/
|
||||
export interface IconifyInfo {
|
||||
// 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;
|
||||
|
||||
// List of tags to group similar icon sets.
|
||||
tags?: 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;
|
||||
|
||||
// If true, icon set should not appear in icon sets list.
|
||||
hidden?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional themes, old format.
|
||||
*
|
||||
* Deprecated because format is unnecessary complicated. Key is meaningless, suffixes and prefixes are mixed together.
|
||||
*/
|
||||
export interface LegacyIconifyThemes {
|
||||
// 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'
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Characters used in font.
|
||||
*/
|
||||
export interface IconifyChars {
|
||||
// Index is character, such as "f000".
|
||||
// Value is icon name.
|
||||
[index: string]: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon categories
|
||||
*/
|
||||
export interface IconifyCategories {
|
||||
// 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[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta data stored in JSON file, used for browsing icon set.
|
||||
*/
|
||||
export interface IconifyMetaData {
|
||||
// Icon set information block. Used for public icon sets, can be skipped for private icon sets.
|
||||
info?: IconifyInfo;
|
||||
|
||||
// Characters used in font. Used for searching by character for icon sets imported from font, exporting icon set to font.
|
||||
chars?: IconifyChars;
|
||||
|
||||
// Categories. Used for filtering icons.
|
||||
categories?: IconifyCategories;
|
||||
|
||||
// Optional themes (old format).
|
||||
themes?: LegacyIconifyThemes;
|
||||
|
||||
// Optional themes (new format). Key is prefix or suffix, value is title.
|
||||
prefixes?: Record<string, string>;
|
||||
suffixes?: Record<string, string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* JSON structure, contains only icon data
|
||||
*/
|
||||
export interface IconifyJSONIconsData extends IconifyDimenisons {
|
||||
// Prefix for icons in JSON file, required.
|
||||
prefix: string;
|
||||
|
||||
// API provider, optional.
|
||||
provider?: string;
|
||||
|
||||
// List of icons, required.
|
||||
icons: IconifyIcons;
|
||||
|
||||
// Optional aliases.
|
||||
aliases?: IconifyAliases;
|
||||
|
||||
// IconifyDimenisons properties that are used as default viewbox for icons when icon is missing value.
|
||||
// If viewbox exists in both icon and root, use value from icon.
|
||||
// This is used to reduce duplication.
|
||||
}
|
||||
|
||||
/**
|
||||
* JSON structure.
|
||||
*
|
||||
* All optional values can exist in root of JSON file, used as defaults.
|
||||
*/
|
||||
export interface IconifyJSON extends IconifyJSONIconsData, IconifyMetaData {
|
||||
// Last modification time of icons. Unix time stamp in seconds.
|
||||
// Time is calculated only for icon data, ignoring metadata.
|
||||
// Used to invalidate icons cache in components.
|
||||
lastModified?: number;
|
||||
|
||||
// Optional list of missing icons. Returned by Iconify API when querying for icons that do not exist.
|
||||
not_found?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Structure of exports '@iconify-json/*' packages.
|
||||
*
|
||||
* These are small packages, one per icon set, that split JSON structure into multiple files to reduce
|
||||
* amount of data imported from package.
|
||||
*/
|
||||
export interface IconifyJSONPackageExports {
|
||||
info: IconifyInfo;
|
||||
icons: IconifyJSON;
|
||||
metadata: IconifyMetaData;
|
||||
chars: IconifyChars;
|
||||
}
|
||||
3
node_modules/@iconify/types/types.js
generated
vendored
Normal file
3
node_modules/@iconify/types/types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
/**
|
||||
* Empty file. This repository contains only TypeScript types
|
||||
*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue