global.d.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. import type {
  2. ComponentRenderProxy,
  3. VNode,
  4. ComponentPublicInstance,
  5. FunctionalComponent,
  6. PropType as VuePropType
  7. } from "vue";
  8. import type { ECharts } from "echarts";
  9. // GlobalComponents for Volar
  10. declare module "vue" {
  11. export interface GlobalComponents {
  12. IconifyIconOffline: typeof import("../src/components/ReIcon")["IconifyIconOffline"];
  13. IconifyIconOnline: typeof import("../src/components/ReIcon")["IconifyIconOnline"];
  14. FontIcon: typeof import("../src/components/ReIcon")["FontIcon"];
  15. }
  16. }
  17. declare global {
  18. const __APP_INFO__: {
  19. pkg: {
  20. name: string;
  21. version: string;
  22. dependencies: Recordable<string>;
  23. devDependencies: Recordable<string>;
  24. };
  25. lastBuildTime: string;
  26. };
  27. interface Window {
  28. // Global vue app instance
  29. __APP__: App<Element>;
  30. webkitCancelAnimationFrame: (handle: number) => void;
  31. mozCancelAnimationFrame: (handle: number) => void;
  32. oCancelAnimationFrame: (handle: number) => void;
  33. msCancelAnimationFrame: (handle: number) => void;
  34. webkitRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  35. mozRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  36. oRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  37. msRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  38. }
  39. // vue
  40. type PropType<T> = VuePropType<T>;
  41. type Writable<T> = {
  42. -readonly [P in keyof T]: T[P];
  43. };
  44. type Nullable<T> = T | null;
  45. type NonNullable<T> = T extends null | undefined ? never : T;
  46. type Recordable<T = any> = Record<string, T>;
  47. type ReadonlyRecordable<T = any> = {
  48. readonly [key: string]: T;
  49. };
  50. type Indexable<T = any> = {
  51. [key: string]: T;
  52. };
  53. type DeepPartial<T> = {
  54. [P in keyof T]?: DeepPartial<T[P]>;
  55. };
  56. type TimeoutHandle = ReturnType<typeof setTimeout>;
  57. type IntervalHandle = ReturnType<typeof setInterval>;
  58. interface ChangeEvent extends Event {
  59. target: HTMLInputElement;
  60. }
  61. interface WheelEvent {
  62. path?: EventTarget[];
  63. }
  64. interface ImportMetaEnv extends ViteEnv {
  65. __: unknown;
  66. }
  67. declare interface ViteEnv {
  68. VITE_PORT: number;
  69. VITE_PUBLIC_PATH: string;
  70. VITE_PROXY_DOMAIN: string;
  71. VITE_PROXY_DOMAIN_REAL: string;
  72. VITE_ROUTER_HISTORY: string;
  73. VITE_LEGACY: boolean;
  74. }
  75. declare interface ServerConfigs {
  76. Version?: string;
  77. Title?: string;
  78. FixedHeader?: boolean;
  79. HiddenSideBar?: boolean;
  80. MultiTagsCache?: boolean;
  81. KeepAlive?: boolean;
  82. Locale?: string;
  83. Layout?: string;
  84. Theme?: string;
  85. DarkMode?: boolean;
  86. Grey?: boolean;
  87. Weak?: boolean;
  88. HideTabs?: boolean;
  89. SidebarStatus?: boolean;
  90. EpThemeColor?: string;
  91. ShowLogo?: boolean;
  92. ShowModel?: string;
  93. MapConfigure?: {
  94. amapKey?: string;
  95. options: {
  96. resizeEnable?: boolean;
  97. center?: number[];
  98. zoom?: number;
  99. };
  100. };
  101. }
  102. declare interface GlobalPropertiesApi {
  103. $echarts: ECharts;
  104. $storage: ServerConfigs;
  105. }
  106. function parseInt(s: string | number, radix?: number): number;
  107. function parseFloat(string: string | number): number;
  108. namespace JSX {
  109. // tslint:disable no-empty-interface
  110. type Element = VNode;
  111. // tslint:disable no-empty-interface
  112. type ElementClass = ComponentRenderProxy;
  113. interface ElementAttributesProperty {
  114. $props: any;
  115. }
  116. interface IntrinsicElements {
  117. [elem: string]: any;
  118. }
  119. interface IntrinsicAttributes {
  120. [elem: string]: any;
  121. }
  122. }
  123. }