2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-09 23:00:56 +00:00

Export more types and functions in main file in utils

This commit is contained in:
Vjacheslav Trushkin 2022-07-01 11:35:23 +03:00
parent 1c24f85160
commit 581ece2444
2 changed files with 21 additions and 9 deletions

View File

@ -52,7 +52,7 @@ export const stringToIcon = (
prefix,
name,
};
return validate && !validateIcon(result) ? null : result;
return validate && !validateIconName(result) ? null : result;
}
// Attempt to split by dash: "prefix-name"
@ -64,7 +64,7 @@ export const stringToIcon = (
prefix: dashSeparated.shift() as string,
name: dashSeparated.join('-'),
};
return validate && !validateIcon(result) ? null : result;
return validate && !validateIconName(result) ? null : result;
}
// If allowEmpty is set, allow empty provider and prefix, allowing names like "home"
@ -74,7 +74,7 @@ export const stringToIcon = (
prefix: '',
name,
};
return validate && !validateIcon(result, allowSimpleName)
return validate && !validateIconName(result, allowSimpleName)
? null
: result;
}
@ -87,7 +87,7 @@ export const stringToIcon = (
*
* This function is not part of stringToIcon because validation is not needed for most code.
*/
export const validateIcon = (
export const validateIconName = (
icon: IconifyIconName | null,
allowSimpleName?: boolean
): boolean => {

View File

@ -3,6 +3,12 @@ export {
defaultIconCustomisations,
defaultIconSizeCustomisations,
} from './customisations/defaults';
export type {
IconifyIconSize,
IconifyIconSizeCustomisations,
IconifyIconCustomisations,
FullIconCustomisations,
} from './customisations/defaults';
export { mergeCustomisations } from './customisations/merge';
// Customisations: converting attributes in components
@ -11,11 +17,8 @@ export { flipFromString } from './customisations/flip';
export { rotateFromString } from './customisations/rotate';
// Icon names
export {
matchIconName,
stringToIcon,
validateIcon as validateIconName,
} from './icon/name';
export { matchIconName, stringToIcon, validateIconName } from './icon/name';
export type { IconifyIconName, IconifyIconSource } from './icon/name';
// Icon data
export { mergeIconData } from './icon/merge';
@ -24,10 +27,18 @@ export {
defaultIconProps,
defaultIconDimensions,
defaultIconTransformations,
defaultExtendedIconProps,
} from './icon/defaults';
export type {
IconifyIcon,
FullIconifyIcon,
PartialExtendedIconifyIcon,
FullExtendedIconifyIcon,
} from './icon/defaults';
// Icon set functions
export { getIconsTree } from './icon-set/tree';
export type { ParentIconsList, ParentIconsTree } from './icon-set/tree';
export { parseIconSet } from './icon-set/parse';
export { validateIconSet } from './icon-set/validate';
export { quicklyValidateIconSet } from './icon-set/validate-basic';
@ -41,6 +52,7 @@ export { convertIconSetInfo } from './icon-set/convert-info';
// Build SVG
export { iconToSVG } from './svg/build';
export type { IconifyIconBuildResult } from './svg/build';
export { replaceIDs } from './svg/id';
export { calculateSize } from './svg/size';
export { encodeSvgForCss } from './svg/encode-svg-for-css';