You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
4.3 KiB

1 year ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /**
  2. * @fileoverview This file only declares the public portions of the API.
  3. * It should not define internal pieces such as utils or modifier details.
  4. *
  5. * Original definitions by: edcarroll <https://github.com/edcarroll>, ggray <https://github.com/giladgray>, rhysd <https://rhysd.github.io>, joscha <https://github.com/joscha>, seckardt <https://github.com/seckardt>, marcfallows <https://github.com/marcfallows>
  6. */
  7. /**
  8. * This kind of namespace declaration is not necessary, but is kept here for backwards-compatibility with
  9. * popper.js 1.x. It can be removed in 2.x so that the default export is simply the Popper class
  10. * and all the types / interfaces are top-level named exports.
  11. */
  12. declare namespace Popper {
  13. export type Position = 'top' | 'right' | 'bottom' | 'left';
  14. export type Placement = 'auto-start'
  15. | 'auto'
  16. | 'auto-end'
  17. | 'top-start'
  18. | 'top'
  19. | 'top-end'
  20. | 'right-start'
  21. | 'right'
  22. | 'right-end'
  23. | 'bottom-end'
  24. | 'bottom'
  25. | 'bottom-start'
  26. | 'left-end'
  27. | 'left'
  28. | 'left-start';
  29. export type Boundary = 'scrollParent' | 'viewport' | 'window';
  30. export type Behavior = 'flip' | 'clockwise' | 'counterclockwise';
  31. export type ModifierFn = (data: Data, options: Object) => Data;
  32. export interface Attributes {
  33. 'x-out-of-boundaries': '' | false;
  34. 'x-placement': Placement;
  35. }
  36. export interface BaseModifier {
  37. order?: number;
  38. enabled?: boolean;
  39. fn?: ModifierFn;
  40. }
  41. export interface Modifiers {
  42. shift?: BaseModifier;
  43. offset?: BaseModifier & {
  44. offset?: number | string,
  45. };
  46. preventOverflow?: BaseModifier & {
  47. priority?: Position[],
  48. padding?: number,
  49. boundariesElement?: Boundary | Element,
  50. escapeWithReference?: boolean
  51. };
  52. keepTogether?: BaseModifier;
  53. arrow?: BaseModifier & {
  54. element?: string | Element,
  55. };
  56. flip?: BaseModifier & {
  57. behavior?: Behavior | Position[],
  58. padding?: number,
  59. boundariesElement?: Boundary | Element,
  60. };
  61. inner?: BaseModifier;
  62. hide?: BaseModifier;
  63. applyStyle?: BaseModifier & {
  64. onLoad?: Function,
  65. gpuAcceleration?: boolean,
  66. };
  67. computeStyle?: BaseModifier & {
  68. gpuAcceleration?: boolean;
  69. x?: 'bottom' | 'top',
  70. y?: 'left' | 'right'
  71. };
  72. [name: string]: (BaseModifier & Record<string, any>) | undefined;
  73. }
  74. export interface Offset {
  75. top: number;
  76. left: number;
  77. width: number;
  78. height: number;
  79. }
  80. export interface Data {
  81. instance: Popper;
  82. placement: Placement;
  83. originalPlacement: Placement;
  84. flipped: boolean;
  85. hide: boolean;
  86. arrowElement: Element;
  87. styles: CSSStyleDeclaration;
  88. arrowStyles: CSSStyleDeclaration;
  89. attributes: Attributes;
  90. boundaries: Object;
  91. offsets: {
  92. popper: Offset,
  93. reference: Offset,
  94. arrow: {
  95. top: number,
  96. left: number,
  97. },
  98. };
  99. }
  100. export interface PopperOptions {
  101. placement?: Placement;
  102. positionFixed?: boolean;
  103. eventsEnabled?: boolean;
  104. modifiers?: Modifiers;
  105. removeOnDestroy?: boolean;
  106. onCreate?(data: Data): void;
  107. onUpdate?(data: Data): void;
  108. }
  109. export interface ReferenceObject {
  110. clientHeight: number;
  111. clientWidth: number;
  112. getBoundingClientRect(): ClientRect;
  113. }
  114. }
  115. // Re-export types in the Popper namespace so that they can be accessed as top-level named exports.
  116. // These re-exports should be removed in 2.x when the "declare namespace Popper" syntax is removed.
  117. export type Position = Popper.Position;
  118. export type Placement = Popper.Placement;
  119. export type Boundary = Popper.Boundary;
  120. export type Behavior = Popper.Behavior;
  121. export type ModifierFn = Popper.ModifierFn;
  122. export type BaseModifier = Popper.BaseModifier;
  123. export type Modifiers = Popper.Modifiers;
  124. export type Offset = Popper.Offset;
  125. export type Data = Popper.Data;
  126. export type PopperOptions = Popper.PopperOptions;
  127. export type ReferenceObject = Popper.ReferenceObject;
  128. declare class Popper {
  129. static modifiers: (BaseModifier & { name: string })[];
  130. static placements: Placement[];
  131. static Defaults: PopperOptions;
  132. options: PopperOptions;
  133. constructor(reference: Element | ReferenceObject, popper: Element, options?: PopperOptions);
  134. destroy(): void;
  135. update(): void;
  136. scheduleUpdate(): void;
  137. enableEventListeners(): void;
  138. disableEventListeners(): void;
  139. }
  140. export default Popper;