index.d.mts 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. import { Ref, ComponentPublicInstance, PropType, FunctionalComponent } from 'vue';
  2. interface LocaleMessages {
  3. [key: string]: LocaleMessages | string;
  4. }
  5. interface LocaleOptions {
  6. messages?: LocaleMessages;
  7. locale?: string;
  8. fallback?: string;
  9. adapter?: LocaleInstance;
  10. }
  11. interface LocaleInstance {
  12. name: string;
  13. messages: Ref<LocaleMessages>;
  14. current: Ref<string>;
  15. fallback: Ref<string>;
  16. t: (key: string, ...params: unknown[]) => string;
  17. n: (value: number) => string;
  18. provide: (props: LocaleOptions) => LocaleInstance;
  19. }
  20. interface RtlOptions {
  21. rtl?: Record<string, boolean>;
  22. }
  23. interface InternalGoToOptions {
  24. container: ComponentPublicInstance | HTMLElement | string;
  25. duration: number;
  26. layout: boolean;
  27. offset: number;
  28. easing: string | ((t: number) => number);
  29. patterns: Record<string, (t: number) => number>;
  30. }
  31. type GoToOptions = Partial<InternalGoToOptions>;
  32. interface DateAdapter<T = unknown> {
  33. date(value?: any): T | null;
  34. format(date: T, formatString: string): string;
  35. toJsDate(value: T): Date;
  36. parseISO(date: string): T;
  37. toISO(date: T): string;
  38. startOfDay(date: T): T;
  39. endOfDay(date: T): T;
  40. startOfWeek(date: T, firstDayOfWeek?: number | string): T;
  41. endOfWeek(date: T): T;
  42. startOfMonth(date: T): T;
  43. endOfMonth(date: T): T;
  44. startOfYear(date: T): T;
  45. endOfYear(date: T): T;
  46. isAfter(date: T, comparing: T): boolean;
  47. isAfterDay(value: T, comparing: T): boolean;
  48. isSameDay(date: T, comparing: T): boolean;
  49. isSameMonth(date: T, comparing: T): boolean;
  50. isSameYear(value: T, comparing: T): boolean;
  51. isBefore(date: T, comparing: T): boolean;
  52. isEqual(date: T, comparing: T): boolean;
  53. isValid(date: any): boolean;
  54. isWithinRange(date: T, range: [T, T]): boolean;
  55. addMinutes(date: T, amount: number): T;
  56. addHours(date: T, amount: number): T;
  57. addDays(date: T, amount: number): T;
  58. addWeeks(date: T, amount: number): T;
  59. addMonths(date: T, amount: number): T;
  60. getYear(date: T): number;
  61. setYear(date: T, year: number): T;
  62. getDiff(date: T, comparing: T | string, unit?: string): number;
  63. getWeekArray(date: T, firstDayOfWeek?: number | string): T[][];
  64. getWeekdays(firstDayOfWeek?: number | string): string[];
  65. getMonth(date: T): number;
  66. setMonth(date: T, month: number): T;
  67. getDate(date: T): number;
  68. setDate(date: T, day: number): T;
  69. getNextMonth(date: T): T;
  70. getPreviousMonth(date: T): T;
  71. getHours(date: T): number;
  72. setHours(date: T, hours: number): T;
  73. getMinutes(date: T): number;
  74. setMinutes(date: T, minutes: number): T;
  75. }
  76. interface DateInstance extends DateModule.InternalAdapter {
  77. locale?: any;
  78. }
  79. /** Supports module augmentation to specify date adapter types */
  80. declare namespace DateModule {
  81. interface Adapter {
  82. }
  83. export type InternalAdapter = {} extends Adapter ? DateAdapter : Adapter;
  84. }
  85. type InternalDateOptions = {
  86. adapter: (new (options: {
  87. locale: any;
  88. formats?: any;
  89. }) => DateInstance) | DateInstance;
  90. formats?: Record<string, any>;
  91. locale: Record<string, any>;
  92. };
  93. type DateOptions = Partial<InternalDateOptions>;
  94. type DeepPartial<T> = T extends object ? {
  95. [P in keyof T]?: DeepPartial<T[P]>;
  96. } : T;
  97. type ThemeOptions = false | {
  98. cspNonce?: string;
  99. defaultTheme?: string;
  100. variations?: false | VariationsOptions;
  101. themes?: Record<string, ThemeDefinition>;
  102. };
  103. type ThemeDefinition = DeepPartial<InternalThemeDefinition>;
  104. interface VariationsOptions {
  105. colors: string[];
  106. lighten: number;
  107. darken: number;
  108. }
  109. interface InternalThemeDefinition {
  110. dark: boolean;
  111. colors: Colors;
  112. variables: Record<string, string | number>;
  113. }
  114. interface Colors extends BaseColors, OnColors {
  115. [key: string]: string;
  116. }
  117. interface BaseColors {
  118. background: string;
  119. surface: string;
  120. primary: string;
  121. secondary: string;
  122. success: string;
  123. warning: string;
  124. error: string;
  125. info: string;
  126. }
  127. interface OnColors {
  128. 'on-background': string;
  129. 'on-surface': string;
  130. 'on-primary': string;
  131. 'on-secondary': string;
  132. 'on-success': string;
  133. 'on-warning': string;
  134. 'on-error': string;
  135. 'on-info': string;
  136. }
  137. type JSXComponent<Props = any> = {
  138. new (): ComponentPublicInstance<Props>;
  139. } | FunctionalComponent<Props>;
  140. type IconValue = string | (string | [path: string, opacity: number])[] | JSXComponent;
  141. declare const IconValue: PropType<IconValue>;
  142. interface IconAliases {
  143. [name: string]: IconValue;
  144. complete: IconValue;
  145. cancel: IconValue;
  146. close: IconValue;
  147. delete: IconValue;
  148. clear: IconValue;
  149. success: IconValue;
  150. info: IconValue;
  151. warning: IconValue;
  152. error: IconValue;
  153. prev: IconValue;
  154. next: IconValue;
  155. checkboxOn: IconValue;
  156. checkboxOff: IconValue;
  157. checkboxIndeterminate: IconValue;
  158. delimiter: IconValue;
  159. sortAsc: IconValue;
  160. sortDesc: IconValue;
  161. expand: IconValue;
  162. menu: IconValue;
  163. subgroup: IconValue;
  164. dropdown: IconValue;
  165. radioOn: IconValue;
  166. radioOff: IconValue;
  167. edit: IconValue;
  168. ratingEmpty: IconValue;
  169. ratingFull: IconValue;
  170. ratingHalf: IconValue;
  171. loading: IconValue;
  172. first: IconValue;
  173. last: IconValue;
  174. unfold: IconValue;
  175. file: IconValue;
  176. plus: IconValue;
  177. minus: IconValue;
  178. calendar: IconValue;
  179. }
  180. interface IconProps {
  181. tag: string;
  182. icon?: IconValue;
  183. disabled?: Boolean;
  184. }
  185. type IconComponent = JSXComponent<IconProps>;
  186. interface IconSet {
  187. component: IconComponent;
  188. }
  189. type InternalIconOptions = {
  190. defaultSet: string;
  191. aliases: Partial<IconAliases>;
  192. sets: Record<string, IconSet>;
  193. };
  194. type IconOptions = Partial<InternalIconOptions>;
  195. declare const breakpoints: readonly ["sm", "md", "lg", "xl", "xxl"];
  196. type Breakpoint = typeof breakpoints[number];
  197. type DisplayBreakpoint = 'xs' | Breakpoint;
  198. type DisplayThresholds = {
  199. [key in DisplayBreakpoint]: number;
  200. };
  201. interface DisplayOptions {
  202. mobileBreakpoint?: number | DisplayBreakpoint;
  203. thresholds?: Partial<DisplayThresholds>;
  204. }
  205. type SSROptions = boolean | {
  206. clientWidth: number;
  207. clientHeight?: number;
  208. };
  209. type DefaultsInstance = undefined | {
  210. [key: string]: undefined | Record<string, unknown>;
  211. global?: Record<string, unknown>;
  212. };
  213. type DefaultsOptions = Partial<DefaultsInstance>;
  214. interface VuetifyOptions {
  215. aliases?: Record<string, any>;
  216. blueprint?: Blueprint;
  217. components?: Record<string, any>;
  218. date?: DateOptions;
  219. directives?: Record<string, any>;
  220. defaults?: DefaultsOptions;
  221. display?: DisplayOptions;
  222. goTo?: GoToOptions;
  223. theme?: ThemeOptions;
  224. icons?: IconOptions;
  225. locale?: LocaleOptions & RtlOptions;
  226. ssr?: SSROptions;
  227. }
  228. interface Blueprint extends Omit<VuetifyOptions, 'blueprint'> {
  229. }
  230. declare const md1: Blueprint;
  231. declare const md2: Blueprint;
  232. declare const md3: Blueprint;
  233. export { md1, md2, md3 };