An unfinished system to manage all your paper documentation in an easy way.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

poppper.js.flow 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. declare module 'popper.js' {
  2. declare type Position = 'top' | 'right' | 'bottom' | 'left';
  3. declare type Placement =
  4. | 'auto-start'
  5. | 'auto'
  6. | 'auto-end'
  7. | 'top-start'
  8. | 'top'
  9. | 'top-end'
  10. | 'right-start'
  11. | 'right'
  12. | 'right-end'
  13. | 'bottom-end'
  14. | 'bottom'
  15. | 'bottom-start'
  16. | 'left-end'
  17. | 'left'
  18. | 'left-start';
  19. declare type Offset = {
  20. top: number,
  21. left: number,
  22. width: number,
  23. height: number,
  24. position: Position,
  25. };
  26. declare type Boundary = 'scrollParent' | 'viewport' | 'window';
  27. declare type Behavior = 'flip' | 'clockwise' | 'counterclockwise';
  28. declare type Data = {
  29. instance: Popper,
  30. placement: Placement,
  31. originalPlacement: Placement,
  32. flipped: boolean,
  33. hide: boolean,
  34. arrowElement: Element,
  35. styles: CSSStyleDeclaration,
  36. arrowStyles: CSSStyleDeclaration,
  37. boundaries: Object,
  38. offsets: {
  39. popper: Offset,
  40. reference: Offset,
  41. arrow: {
  42. top: number,
  43. left: number,
  44. },
  45. },
  46. };
  47. declare type ModifierFn = (data: Data, options: Object) => Data;
  48. declare type Padding = {
  49. top?: number,
  50. bottom?: number,
  51. left?: number,
  52. right?: number,
  53. }
  54. declare type BaseModifier = {
  55. order?: number,
  56. enabled?: boolean,
  57. fn?: ModifierFn,
  58. };
  59. declare type Modifiers = {
  60. shift?: BaseModifier,
  61. offset?: BaseModifier & {
  62. offset?: number | string,
  63. },
  64. preventOverflow?: BaseModifier & {
  65. priority?: Position[],
  66. padding?: number | Padding,
  67. boundariesElement?: Boundary | Element,
  68. escapeWithReference?: boolean,
  69. },
  70. keepTogether?: BaseModifier,
  71. arrow?: BaseModifier & {
  72. element?: string | Element | null,
  73. },
  74. flip?: BaseModifier & {
  75. behavior?: Behavior | Position[],
  76. padding?: number | Padding,
  77. boundariesElement?: Boundary | Element,
  78. flipVariations?: boolean,
  79. flipVariationsByContent?: boolean,
  80. },
  81. inner?: BaseModifier,
  82. hide?: BaseModifier,
  83. applyStyle?: BaseModifier & {
  84. onLoad?: Function,
  85. gpuAcceleration?: boolean,
  86. },
  87. computeStyle?: BaseModifier & {
  88. gpuAcceleration?: boolean,
  89. x?: 'bottom' | 'top',
  90. y?: 'left' | 'right',
  91. },
  92. [name: string]: (BaseModifier & { [string]: * }) | null,
  93. };
  94. declare type Options = {
  95. placement?: Placement,
  96. positionFixed?: boolean,
  97. eventsEnabled?: boolean,
  98. modifiers?: Modifiers,
  99. removeOnDestroy?: boolean,
  100. onCreate?: (data: Data) => void,
  101. onUpdate?: (data: Data) => void,
  102. };
  103. declare var placements: Placement;
  104. declare type ReferenceObject = {
  105. +clientHeight: number,
  106. +clientWidth: number,
  107. getBoundingClientRect():
  108. | ClientRect
  109. | {
  110. width: number,
  111. height: number,
  112. top: number,
  113. right: number,
  114. bottom: number,
  115. left: number,
  116. },
  117. };
  118. declare type Instance = {
  119. destroy: () => void,
  120. scheduleUpdate: () => void,
  121. update: () => void,
  122. enableEventListeners: () => void,
  123. disableEventListeners: () => void,
  124. };
  125. declare class Popper {
  126. static placements: Placement;
  127. popper: Element;
  128. reference: Element | ReferenceObject;
  129. constructor(
  130. reference: Element | ReferenceObject,
  131. popper: Element,
  132. options?: Options
  133. ): Instance;
  134. }
  135. declare module.exports: Class<Popper>;
  136. }