index.d.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import { PluginOption } from 'vite';
  2. interface VueInspectorClient {
  3. enabled: boolean;
  4. position: {
  5. x: number;
  6. y: number;
  7. };
  8. linkParams: {
  9. file: string;
  10. line: number;
  11. column: number;
  12. };
  13. enable: () => void;
  14. disable: () => void;
  15. toggleEnabled: () => void;
  16. onEnabled: () => void;
  17. onDisabled: () => void;
  18. openInEditor: (url: URL) => void;
  19. onUpdated: () => void;
  20. }
  21. interface VitePluginInspectorOptions {
  22. /**
  23. * Vue version
  24. * @default 3
  25. */
  26. vue?: 2 | 3;
  27. /**
  28. * Default enable state
  29. * @default false
  30. */
  31. enabled?: boolean;
  32. /**
  33. * Define a combo key to toggle inspector
  34. * @default 'control-shift' on windows, 'meta-shift' on other os
  35. *
  36. * any number of modifiers `control` `shift` `alt` `meta` followed by zero or one regular key, separated by -
  37. * examples: control-shift, control-o, control-alt-s meta-x control-meta
  38. * Some keys have native behavior (e.g. alt-s opens history menu on firefox).
  39. * To avoid conflicts or accidentally typing into inputs, modifier only combinations are recommended.
  40. * You can also disable it by setting `false`.
  41. */
  42. toggleComboKey?: string | false;
  43. /**
  44. * Toggle button visibility
  45. * @default 'active'
  46. */
  47. toggleButtonVisibility?: 'always' | 'active' | 'never';
  48. /**
  49. * Toggle button display position
  50. * @default top-right
  51. */
  52. toggleButtonPos?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
  53. /**
  54. * append an import to the module id ending with `appendTo` instead of adding a script into body
  55. * useful for frameworks that do not support transformIndexHtml hook (e.g. Nuxt3)
  56. *
  57. * WARNING: only set this if you know exactly what it does.
  58. */
  59. appendTo?: string | RegExp;
  60. /**
  61. * Customize openInEditor host (e.g. http://localhost:3000)
  62. * @default false
  63. * @deprecated This option is deprecated and removed in 5.0. The plugin now automatically detects the correct host.
  64. */
  65. openInEditorHost?: string | false;
  66. /**
  67. * lazy load inspector times (ms)
  68. * @default false
  69. */
  70. lazyLoad?: number | false;
  71. /**
  72. * disable inspector on editor open
  73. * @default false
  74. */
  75. disableInspectorOnEditorOpen?: boolean;
  76. /**
  77. * Hide information in VNode and produce clean html in DevTools
  78. *
  79. * Currently, it only works for Vue 3
  80. *
  81. * @default true
  82. */
  83. cleanHtml?: boolean;
  84. /**
  85. * Target editor when open in editor (v5.1.0+)
  86. *
  87. * @default process.env.LAUNCH_EDITOR ?? code (Visual Studio Code)
  88. */
  89. launchEditor?: 'appcode' | 'atom' | 'atom-beta' | 'brackets' | 'clion' | 'code' | 'code-insiders' | 'codium' | 'emacs' | 'idea' | 'notepad++' | 'pycharm' | 'phpstorm' | 'rubymine' | 'sublime' | 'vim' | 'visualstudio' | 'webstorm' | 'rider' | 'cursor' | string;
  90. /**
  91. * Disable animation/transition, will auto disable when `prefers-reduced-motion` is set
  92. * @default false
  93. */
  94. reduceMotion?: boolean;
  95. }
  96. declare function normalizeComboKeyPrint(toggleComboKey: string): string;
  97. declare const DEFAULT_INSPECTOR_OPTIONS: VitePluginInspectorOptions;
  98. declare function VitePluginInspector(options?: VitePluginInspectorOptions): PluginOption;
  99. export { DEFAULT_INSPECTOR_OPTIONS, VitePluginInspectorOptions, VueInspectorClient, VitePluginInspector as default, normalizeComboKeyPrint };