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,
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue