mirror of
https://github.com/iconify/iconify.git
synced 2025-01-06 07:20:40 +00:00
Split defaultIconData in utils in 2 objects
This commit is contained in:
parent
b18e9b7f52
commit
99ddeeae47
@ -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<IconifyIcon>;
|
||||
*/
|
||||
export const matchName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
||||
|
||||
/**
|
||||
* Default values for dimensions
|
||||
*/
|
||||
export const defaultIconDimensions: Required<IconifyDimenisons> = Object.freeze(
|
||||
{
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: 16,
|
||||
height: 16,
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Default values for transformations
|
||||
*/
|
||||
export const defaultIconTransformations: Required<IconifyTransformations> =
|
||||
Object.freeze({
|
||||
rotate: 0,
|
||||
vFlip: false,
|
||||
hFlip: false,
|
||||
});
|
||||
|
||||
/**
|
||||
* Default values for all optional IconifyIcon properties
|
||||
*/
|
||||
export const iconDefaults: Required<IconifyOptional> = Object.freeze({
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: 16,
|
||||
height: 16,
|
||||
rotate: 0,
|
||||
vFlip: false,
|
||||
hFlip: false,
|
||||
...defaultIconDimensions,
|
||||
...defaultIconTransformations,
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -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<T extends IconifyIcon | FullIconifyIcon>(
|
||||
export function mergeIconData<T extends IconifyOptional>(
|
||||
icon: T,
|
||||
alias: IconifyOptional
|
||||
): T {
|
||||
|
@ -19,6 +19,8 @@ export { mergeIconData } from './icon/merge';
|
||||
export {
|
||||
iconDefaults as defaultIconData,
|
||||
fullIcon as fullIconData,
|
||||
defaultIconDimensions,
|
||||
defaultIconTransformations,
|
||||
} from './icon/index';
|
||||
|
||||
// Icon set functions
|
||||
|
Loading…
Reference in New Issue
Block a user