source: imaps-frontend/node_modules/@popperjs/core/lib/enums.js.flow

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 2.7 KB
Line 
1// @flow
2export const top: 'top' = 'top';
3export const bottom: 'bottom' = 'bottom';
4export const right: 'right' = 'right';
5export const left: 'left' = 'left';
6export const auto: 'auto' = 'auto';
7export type BasePlacement =
8 | typeof top
9 | typeof bottom
10 | typeof right
11 | typeof left;
12export const basePlacements: Array<BasePlacement> = [top, bottom, right, left];
13
14export const start: 'start' = 'start';
15export const end: 'end' = 'end';
16export type Variation = typeof start | typeof end;
17
18export const clippingParents: 'clippingParents' = 'clippingParents';
19export const viewport: 'viewport' = 'viewport';
20export type Boundary = Element | Array<Element> | typeof clippingParents;
21export type RootBoundary = typeof viewport | 'document';
22
23export const popper: 'popper' = 'popper';
24export const reference: 'reference' = 'reference';
25export type Context = typeof popper | typeof reference;
26
27export type VariationPlacement =
28 | 'top-start'
29 | 'top-end'
30 | 'bottom-start'
31 | 'bottom-end'
32 | 'right-start'
33 | 'right-end'
34 | 'left-start'
35 | 'left-end';
36export type AutoPlacement = 'auto' | 'auto-start' | 'auto-end';
37export type ComputedPlacement = VariationPlacement | BasePlacement;
38export type Placement = AutoPlacement | BasePlacement | VariationPlacement;
39
40export const variationPlacements: Array<VariationPlacement> = basePlacements.reduce(
41 (acc: Array<VariationPlacement>, placement: BasePlacement) =>
42 acc.concat([(`${placement}-${start}`: any), (`${placement}-${end}`: any)]),
43 []
44);
45export const placements: Array<Placement> = [...basePlacements, auto].reduce(
46 (
47 acc: Array<Placement>,
48 placement: BasePlacement | typeof auto
49 ): Array<Placement> =>
50 acc.concat([
51 placement,
52 (`${placement}-${start}`: any),
53 (`${placement}-${end}`: any),
54 ]),
55 []
56);
57
58// modifiers that need to read the DOM
59export const beforeRead: 'beforeRead' = 'beforeRead';
60export const read: 'read' = 'read';
61export const afterRead: 'afterRead' = 'afterRead';
62// pure-logic modifiers
63export const beforeMain: 'beforeMain' = 'beforeMain';
64export const main: 'main' = 'main';
65export const afterMain: 'afterMain' = 'afterMain';
66// modifier with the purpose to write to the DOM (or write into a framework state)
67export const beforeWrite: 'beforeWrite' = 'beforeWrite';
68export const write: 'write' = 'write';
69export const afterWrite: 'afterWrite' = 'afterWrite';
70export const modifierPhases: Array<ModifierPhases> = [
71 beforeRead,
72 read,
73 afterRead,
74 beforeMain,
75 main,
76 afterMain,
77 beforeWrite,
78 write,
79 afterWrite,
80];
81
82export type ModifierPhases =
83 | typeof beforeRead
84 | typeof read
85 | typeof afterRead
86 | typeof beforeMain
87 | typeof main
88 | typeof afterMain
89 | typeof beforeWrite
90 | typeof write
91 | typeof afterWrite;
Note: See TracBrowser for help on using the repository browser.