diff --git a/packages/utils/src/icon/index.ts b/packages/utils/src/icon/index.ts index c448af6..2b68c41 100644 --- a/packages/utils/src/icon/index.ts +++ b/packages/utils/src/icon/index.ts @@ -1,4 +1,9 @@ -import type { IconifyOptional, IconifyIcon } from '@iconify/types'; +import type { + IconifyDimenisons, + IconifyTransformations, + IconifyOptional, + IconifyIcon, +} from '@iconify/types'; // Export icon and full icon types export { IconifyIcon }; @@ -9,17 +14,34 @@ export type FullIconifyIcon = Required; */ export const matchName = /^[a-z0-9]+(-[a-z0-9]+)*$/; +/** + * Default values for dimensions + */ +export const defaultIconDimensions: Required = Object.freeze( + { + left: 0, + top: 0, + width: 16, + height: 16, + } +); + +/** + * Default values for transformations + */ +export const defaultIconTransformations: Required = + Object.freeze({ + rotate: 0, + vFlip: false, + hFlip: false, + }); + /** * Default values for all optional IconifyIcon properties */ export const iconDefaults: Required = Object.freeze({ - left: 0, - top: 0, - width: 16, - height: 16, - rotate: 0, - vFlip: false, - hFlip: false, + ...defaultIconDimensions, + ...defaultIconTransformations, }); /** diff --git a/packages/utils/src/icon/merge.ts b/packages/utils/src/icon/merge.ts index ef1d9ac..b5d0071 100644 --- a/packages/utils/src/icon/merge.ts +++ b/packages/utils/src/icon/merge.ts @@ -1,11 +1,10 @@ import type { IconifyOptional } from '@iconify/types'; -import type { FullIconifyIcon, IconifyIcon } from './index'; import { iconDefaults } from './index'; /** * Merge icon and alias */ -export function mergeIconData( +export function mergeIconData( icon: T, alias: IconifyOptional ): T { diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 9b6e6a6..53f3fb6 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -19,6 +19,8 @@ export { mergeIconData } from './icon/merge'; export { iconDefaults as defaultIconData, fullIcon as fullIconData, + defaultIconDimensions, + defaultIconTransformations, } from './icon/index'; // Icon set functions