global.d.ts 3.6 KB

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