2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-14 14:38:25 +00:00
iconify/components/vue/src/props.ts

71 lines
1.7 KiB
TypeScript
Raw Normal View History

import type { IconifyIcon } from '@iconify/types';
2022-06-19 16:16:11 +00:00
import type { IconifyIconCustomisations as RawIconifyIconCustomisations } from '@iconify/utils/lib/customisations/defaults';
import { defaultIconCustomisations } from '@iconify/utils/lib/customisations/defaults';
2021-05-05 16:24:26 +00:00
2022-04-15 06:58:43 +00:00
/**
* 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>
2022-04-15 06:58:43 +00:00
*/
export type IconifyRenderMode = 'style' | 'bg' | 'mask' | 'svg';
2022-04-15 06:58:43 +00:00
2021-05-05 16:24:26 +00:00
/**
* Icon customisations
*/
2022-06-19 16:16:11 +00:00
export type IconifyIconCustomisations = RawIconifyIconCustomisations & {
// Allow rotation to be string
2021-05-05 16:24:26 +00:00
rotate?: string | number;
2022-06-19 16:16:11 +00:00
// Inline mode
inline?: boolean;
};
export const defaultExtendedIconCustomisations = {
...defaultIconCustomisations,
inline: false,
2021-05-05 16:24:26 +00:00
};
/**
* Callback for when icon has been loaded (only triggered for icons loaded from API)
*/
export type IconifyIconOnLoad = (name: string) => void;
2021-05-05 16:24:26 +00:00
/**
* Icon properties
*/
export interface IconifyIconProps extends IconifyIconCustomisations {
// Icon object
icon: IconifyIcon | string;
2022-04-15 06:58:43 +00:00
// Render mode
mode?: IconifyRenderMode;
2021-05-05 16:24:26 +00:00
// Style
color?: string;
2022-04-30 20:12:34 +00:00
// Shorthand flip
2021-05-05 16:24:26 +00:00
flip?: string;
}
/**
* Properties for element that are mentioned in render.ts
*/
interface IconifyElementProps {
// Unique id, used as base for ids for shapes. Use it to get consistent ids for server side rendering
id?: string;
// Style
style?: unknown;
// Callback to call when icon data has been loaded. Used only for icons loaded from API
onLoad?: IconifyIconOnLoad;
2021-05-05 16:24:26 +00:00
}
/**
* Mix of icon properties and HTMLElement properties
*/
export type IconProps = IconifyElementProps & IconifyIconProps;