index.d.mts 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. import { DirectiveBinding } from 'vue';
  2. interface ClickOutsideBindingArgs {
  3. handler: (e: MouseEvent) => void;
  4. closeConditional?: (e: Event) => boolean;
  5. include?: () => HTMLElement[];
  6. }
  7. interface ClickOutsideDirectiveBinding extends DirectiveBinding {
  8. value: ((e: MouseEvent) => void) | ClickOutsideBindingArgs;
  9. }
  10. declare const ClickOutside: {
  11. mounted(el: HTMLElement, binding: ClickOutsideDirectiveBinding): void;
  12. unmounted(el: HTMLElement, binding: ClickOutsideDirectiveBinding): void;
  13. };
  14. type ObserveHandler = (isIntersecting: boolean, entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void;
  15. interface ObserveDirectiveBinding extends Omit<DirectiveBinding, 'modifiers' | 'value'> {
  16. value?: ObserveHandler | {
  17. handler: ObserveHandler;
  18. options?: IntersectionObserverInit;
  19. };
  20. modifiers: {
  21. once?: boolean;
  22. quiet?: boolean;
  23. };
  24. }
  25. declare function mounted$5(el: HTMLElement, binding: ObserveDirectiveBinding): void;
  26. declare function unmounted$5(el: HTMLElement, binding: ObserveDirectiveBinding): void;
  27. declare const Intersect: {
  28. mounted: typeof mounted$5;
  29. unmounted: typeof unmounted$5;
  30. };
  31. interface MutationOptions {
  32. attr?: boolean;
  33. char?: boolean;
  34. child?: boolean;
  35. sub?: boolean;
  36. once?: boolean;
  37. immediate?: boolean;
  38. }
  39. interface MutationDirectiveBinding extends Omit<DirectiveBinding, 'modifiers' | 'value'> {
  40. value: MutationCallback | {
  41. handler: MutationCallback;
  42. options?: MutationObserverInit;
  43. };
  44. modifiers: MutationOptions;
  45. }
  46. declare function mounted$4(el: HTMLElement, binding: MutationDirectiveBinding): void;
  47. declare function unmounted$4(el: HTMLElement, binding: MutationDirectiveBinding): void;
  48. declare const Mutate: {
  49. mounted: typeof mounted$4;
  50. unmounted: typeof unmounted$4;
  51. };
  52. interface ResizeDirectiveBinding extends Omit<DirectiveBinding, 'modifiers'> {
  53. value: () => void;
  54. modifiers?: {
  55. active?: boolean;
  56. quiet?: boolean;
  57. };
  58. }
  59. declare function mounted$3(el: HTMLElement, binding: ResizeDirectiveBinding): void;
  60. declare function unmounted$3(el: HTMLElement, binding: ResizeDirectiveBinding): void;
  61. declare const Resize: {
  62. mounted: typeof mounted$3;
  63. unmounted: typeof unmounted$3;
  64. };
  65. interface RippleDirectiveBinding extends Omit<DirectiveBinding, 'modifiers' | 'value'> {
  66. value?: boolean | {
  67. class: string;
  68. };
  69. modifiers: {
  70. center?: boolean;
  71. circle?: boolean;
  72. stop?: boolean;
  73. };
  74. }
  75. declare function mounted$2(el: HTMLElement, binding: RippleDirectiveBinding): void;
  76. declare function unmounted$2(el: HTMLElement): void;
  77. declare function updated$1(el: HTMLElement, binding: RippleDirectiveBinding): void;
  78. declare const Ripple: {
  79. mounted: typeof mounted$2;
  80. unmounted: typeof unmounted$2;
  81. updated: typeof updated$1;
  82. };
  83. interface ScrollDirectiveBinding extends Omit<DirectiveBinding, 'modifiers'> {
  84. value: EventListener | {
  85. handler: EventListener;
  86. options?: AddEventListenerOptions;
  87. } | EventListenerObject & {
  88. options?: AddEventListenerOptions;
  89. };
  90. modifiers?: {
  91. self?: boolean;
  92. };
  93. }
  94. declare function mounted$1(el: HTMLElement, binding: ScrollDirectiveBinding): void;
  95. declare function unmounted$1(el: HTMLElement, binding: ScrollDirectiveBinding): void;
  96. declare function updated(el: HTMLElement, binding: ScrollDirectiveBinding): void;
  97. declare const Scroll: {
  98. mounted: typeof mounted$1;
  99. unmounted: typeof unmounted$1;
  100. updated: typeof updated;
  101. };
  102. interface TouchHandlers {
  103. start?: (wrapperEvent: {
  104. originalEvent: TouchEvent;
  105. } & TouchData) => void;
  106. end?: (wrapperEvent: {
  107. originalEvent: TouchEvent;
  108. } & TouchData) => void;
  109. move?: (wrapperEvent: {
  110. originalEvent: TouchEvent;
  111. } & TouchData) => void;
  112. left?: (wrapper: TouchData) => void;
  113. right?: (wrapper: TouchData) => void;
  114. up?: (wrapper: TouchData) => void;
  115. down?: (wrapper: TouchData) => void;
  116. }
  117. interface TouchData {
  118. touchstartX: number;
  119. touchstartY: number;
  120. touchmoveX: number;
  121. touchmoveY: number;
  122. touchendX: number;
  123. touchendY: number;
  124. offsetX: number;
  125. offsetY: number;
  126. }
  127. interface TouchValue extends TouchHandlers {
  128. parent?: boolean;
  129. options?: AddEventListenerOptions;
  130. }
  131. interface TouchDirectiveBinding extends Omit<DirectiveBinding, 'value'> {
  132. value?: TouchValue;
  133. }
  134. declare function mounted(el: HTMLElement, binding: TouchDirectiveBinding): void;
  135. declare function unmounted(el: HTMLElement, binding: TouchDirectiveBinding): void;
  136. declare const Touch: {
  137. mounted: typeof mounted;
  138. unmounted: typeof unmounted;
  139. };
  140. export { ClickOutside, Intersect, Mutate, Resize, Ripple, Scroll, Touch };