index.d.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import Vue, { ComponentOptions, CreateElement, VNode, VueConstructor } from 'vue';
  2. import { ArrayPropsDefinition, DefaultComputed, DefaultData, DefaultMethods } from 'vue/types/options';
  3. export declare type StrokeLinejoin = 'miter' | 'round' | 'bevel';
  4. export declare type StrokeLinecap = 'butt' | 'round' | 'square';
  5. export declare type Theme = 'outline' | 'filled' | 'two-tone' | 'multi-color';
  6. export interface ISvgIconProps {
  7. id: string;
  8. size: number | string;
  9. strokeWidth: number;
  10. strokeLinecap: StrokeLinecap;
  11. strokeLinejoin: StrokeLinejoin;
  12. colors: string[];
  13. }
  14. export interface IIconConfig {
  15. size: number | string;
  16. strokeWidth: number;
  17. strokeLinecap: StrokeLinecap;
  18. strokeLinejoin: StrokeLinejoin;
  19. prefix: string;
  20. rtl: boolean;
  21. theme: Theme;
  22. colors: {
  23. outline: {
  24. fill: string;
  25. background: string;
  26. };
  27. filled: {
  28. fill: string;
  29. background: string;
  30. };
  31. twoTone: {
  32. fill: string;
  33. twoTone: string;
  34. };
  35. multiColor: {
  36. outStrokeColor: string;
  37. outFillColor: string;
  38. innerStrokeColor: string;
  39. innerFillColor: string;
  40. };
  41. };
  42. }
  43. export interface IIconBase {
  44. size?: number | string;
  45. strokeWidth?: number;
  46. strokeLinecap?: StrokeLinecap;
  47. strokeLinejoin?: StrokeLinejoin;
  48. theme?: Theme;
  49. fill?: string | string[];
  50. }
  51. export interface IIconProps extends IIconBase {
  52. spin?: boolean;
  53. }
  54. export declare type IconHelper = CreateElement;
  55. export interface IIconInstance extends Vue, IIconProps {
  56. id: string;
  57. ICON_CONFIGS?: IIconConfig;
  58. }
  59. export declare type IconOptions = ComponentOptions<IIconInstance, DefaultData<{
  60. id: string;
  61. }>, DefaultMethods<never>, DefaultComputed, ArrayPropsDefinition<IIconProps>, IIconProps>;
  62. export declare type IconRender = (h: IconHelper, props: ISvgIconProps) => VNode;
  63. export declare type Icon = VueConstructor<IIconInstance>;
  64. export declare const DEFAULT_ICON_CONFIGS: IIconConfig;
  65. export declare function IconConverter(id: string, icon: IIconBase, config: IIconConfig): ISvgIconProps;
  66. export declare function IconWrapper(name: string, rtl: boolean, render: IconRender): Icon;