floating_ui_dom/middleware.rs
1use floating_ui_core::middleware::{
2 Arrow as CoreArrow, AutoPlacement as CoreAutoPlacement, Flip as CoreFlip, Hide as CoreHide,
3 Inline as CoreInline, Offset as CoreOffset, Shift as CoreShift, Size as CoreSize,
4};
5use web_sys::{Element, Window};
6
7pub use floating_ui_core::middleware::{
8 ARROW_NAME, AUTO_PLACEMENT_NAME, ApplyState, ArrowData, ArrowOptions, AutoPlacementData,
9 AutoPlacementDataOverflow, AutoPlacementOptions, CrossAxis, DefaultLimiter, FLIP_NAME,
10 FallbackStrategy, FlipData, FlipDataOverflow, FlipOptions, HIDE_NAME, HideData, HideOptions,
11 HideStrategy, INLINE_NAME, InlineOptions, LimitShift, LimitShiftOffset, LimitShiftOffsetValues,
12 LimitShiftOptions, OFFSET_NAME, OffsetData, OffsetOptions, OffsetOptionsValues, SHIFT_NAME,
13 SIZE_NAME, ShiftData, ShiftOptions, SizeOptions,
14};
15
16/// Arrow middleware.
17///
18/// Provides data to position an inner element of the floating element so that it appears centered to the reference element.
19///
20/// See [the Rust Floating UI book](https://floating-ui.rustforweb.org/middleware/arrow.html) for more documentation.
21pub type Arrow<'a> = CoreArrow<'a, Element, Window>;
22
23/// Auto placement middleware.
24///
25/// Optimizes the visibility of the floating element by choosing the placement that has the most space available automatically,
26/// without needing to specify a preferred placement.
27///
28/// Alternative to [`Flip`].
29///
30/// See [the Rust Floating UI book](https://floating-ui.rustforweb.org/middleware/auto-placement.html) for more documentation.
31pub type AutoPlacement<'a> = CoreAutoPlacement<'a, Element, Window>;
32
33/// Flip middleware.
34///
35/// Optimizes the visibility of the floating element by flipping the `placement` in order to keep it in view when the preferred placement(s) will overflow the clipping boundary.
36/// Alternative to [`AutoPlacement`].
37///
38/// See [the Rust Floating UI book](https://floating-ui.rustforweb.org/middleware/flip.html) for more documentation.
39pub type Flip<'a> = CoreFlip<'a, Element, Window>;
40
41/// Hide middleware.
42///
43/// Provides data to hide the floating element in applicable situations,
44/// such as when it is not in the same clipping context as the reference element.
45///
46/// See [the Rust Floating UI book](https://floating-ui.rustforweb.org/middleware/hide.html) for more documentation.
47pub type Hide<'a> = CoreHide<'a, Element, Window>;
48
49/// Inline middleware.
50///
51/// Provides improved positioning for inline reference elements that can span over multiple lines, such as hyperlinks or range selections.
52///
53/// See [the Rust Floating UI book](https://floating-ui.rustforweb.org/middleware/inline.html) for more documentation.
54pub type Inline<'a> = CoreInline<'a, Element, Window>;
55
56/// Offset middleware.
57///
58/// Modifies the placement by translating the floating element along the specified axes.
59///
60/// See [the Rust Floating UI book](https://floating-ui.rustforweb.org/middleware/offset.html) for more documentation.
61pub type Offset<'a> = CoreOffset<'a, Element, Window>;
62
63/// Shift middleware.
64///
65/// Optimizes the visibility of the floating element by shifting it in order to keep it in view when it will overflow the clipping boundary.
66///
67/// See [the Rust Floating UI book](https://floating-ui.rustforweb.org/middleware/shift.html) for more documentation.
68pub type Shift<'a> = CoreShift<'a, Element, Window>;
69
70/// Size middleware.
71///
72/// Provides data that allows you to change the size of the floating element -
73/// for instance, prevent it from overflowing the clipping boundary or match the width of the reference element.
74///
75/// See [the Rust Floating UI book](https://floating-ui.rustforweb.org/middleware/size.html) for more documentation.
76pub type Size<'a> = CoreSize<'a, Element, Window>;