@floating-ui/core
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -79,2 +79,10 @@ function getBasePlacement(placement) { | ||
/** | ||
* Computes the `x` and `y` coordinates that will place the floating element | ||
* next to a reference element when it is given a certain positioning strategy. | ||
* | ||
* This export does not have any `platform` interface logic. You will need to | ||
* write one for the platform you are using Floating UI with. | ||
*/ | ||
const computePosition = async (reference, floating, config) => { | ||
@@ -220,2 +228,9 @@ const { | ||
/** | ||
* Resolves with an object of overflow side offsets that determine how much the | ||
* element is overflowing a given clipping boundary. | ||
* - positive = overflowing the boundary by that number of pixels | ||
* - negative = how many pixels left before it will overflow | ||
* - 0 = lies flush with the boundary | ||
*/ | ||
async function detectOverflow(middlewareArguments, options) { | ||
@@ -278,2 +293,6 @@ if (options === void 0) { | ||
/** | ||
* Positions an inner element of the floating element such that it is centered | ||
* to the reference element. | ||
*/ | ||
const arrow = options => ({ | ||
@@ -388,2 +407,6 @@ name: 'arrow', | ||
} | ||
/** | ||
* Automatically chooses the `placement` which has the most space available. | ||
*/ | ||
const autoPlacement = function (options) { | ||
@@ -482,2 +505,6 @@ if (options === void 0) { | ||
/** | ||
* Changes the placement of the floating element to one that will fit if the | ||
* initially specified `placement` does not. | ||
*/ | ||
const flip = function (options) { | ||
@@ -607,3 +634,8 @@ if (options === void 0) { | ||
} | ||
/** | ||
* Provides data to hide the floating element in applicable situations, such as | ||
* when it is not in the same clipping context as the reference element. | ||
*/ | ||
const hide = () => ({ | ||
@@ -665,2 +697,6 @@ name: 'hide', | ||
} | ||
/** | ||
* Displaces the floating element from its reference element. | ||
*/ | ||
const offset = function (value) { | ||
@@ -701,2 +737,6 @@ if (value === void 0) { | ||
/** | ||
* Shifts the floating element in order to keep it in view when it will overflow | ||
* a clipping boundary. | ||
*/ | ||
const shift = function (options) { | ||
@@ -774,2 +814,6 @@ if (options === void 0) { | ||
}; | ||
/** | ||
* Built-in `limiter` that will stop `shift()` at a certain point. | ||
*/ | ||
const limitShift = function (options) { | ||
@@ -852,2 +896,7 @@ if (options === void 0) { | ||
/** | ||
* Provides data to change the size of the floating element. For instance, | ||
* prevent it from overflowing its clipping boundary or match the width of the | ||
* reference element. | ||
*/ | ||
const size = function (options) { | ||
@@ -917,2 +966,6 @@ if (options === void 0) { | ||
/** | ||
* Provides improved positioning for inline reference elements that can span | ||
* over multiple lines, such as hyperlinks or range selections. | ||
*/ | ||
const inline = function (options) { | ||
@@ -919,0 +972,0 @@ if (options === void 0) { |
@@ -85,2 +85,10 @@ (function (global, factory) { | ||
/** | ||
* Computes the `x` and `y` coordinates that will place the floating element | ||
* next to a reference element when it is given a certain positioning strategy. | ||
* | ||
* This export does not have any `platform` interface logic. You will need to | ||
* write one for the platform you are using Floating UI with. | ||
*/ | ||
const computePosition = async (reference, floating, config) => { | ||
@@ -226,2 +234,9 @@ const { | ||
/** | ||
* Resolves with an object of overflow side offsets that determine how much the | ||
* element is overflowing a given clipping boundary. | ||
* - positive = overflowing the boundary by that number of pixels | ||
* - negative = how many pixels left before it will overflow | ||
* - 0 = lies flush with the boundary | ||
*/ | ||
async function detectOverflow(middlewareArguments, options) { | ||
@@ -284,2 +299,6 @@ if (options === void 0) { | ||
/** | ||
* Positions an inner element of the floating element such that it is centered | ||
* to the reference element. | ||
*/ | ||
const arrow = options => ({ | ||
@@ -394,2 +413,6 @@ name: 'arrow', | ||
} | ||
/** | ||
* Automatically chooses the `placement` which has the most space available. | ||
*/ | ||
const autoPlacement = function (options) { | ||
@@ -488,2 +511,6 @@ if (options === void 0) { | ||
/** | ||
* Changes the placement of the floating element to one that will fit if the | ||
* initially specified `placement` does not. | ||
*/ | ||
const flip = function (options) { | ||
@@ -613,3 +640,8 @@ if (options === void 0) { | ||
} | ||
/** | ||
* Provides data to hide the floating element in applicable situations, such as | ||
* when it is not in the same clipping context as the reference element. | ||
*/ | ||
const hide = () => ({ | ||
@@ -671,2 +703,6 @@ name: 'hide', | ||
} | ||
/** | ||
* Displaces the floating element from its reference element. | ||
*/ | ||
const offset = function (value) { | ||
@@ -707,2 +743,6 @@ if (value === void 0) { | ||
/** | ||
* Shifts the floating element in order to keep it in view when it will overflow | ||
* a clipping boundary. | ||
*/ | ||
const shift = function (options) { | ||
@@ -780,2 +820,6 @@ if (options === void 0) { | ||
}; | ||
/** | ||
* Built-in `limiter` that will stop `shift()` at a certain point. | ||
*/ | ||
const limitShift = function (options) { | ||
@@ -858,2 +902,7 @@ if (options === void 0) { | ||
/** | ||
* Provides data to change the size of the floating element. For instance, | ||
* prevent it from overflowing its clipping boundary or match the width of the | ||
* reference element. | ||
*/ | ||
const size = function (options) { | ||
@@ -923,2 +972,6 @@ if (options === void 0) { | ||
/** | ||
* Provides improved positioning for inline reference elements that can span | ||
* over multiple lines, such as hyperlinks or range selections. | ||
*/ | ||
const inline = function (options) { | ||
@@ -925,0 +978,0 @@ if (options === void 0) { |
{ | ||
"name": "@floating-ui/core", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"@rollingversions": { | ||
@@ -21,3 +21,7 @@ "baseVersion": [ | ||
".": { | ||
"import": "./dist/floating-ui.core.esm.js", | ||
"import": { | ||
"development": "./dist/floating-ui.core.esm.development.js", | ||
"production": "./dist/floating-ui.core.esm.min.js", | ||
"default": "./dist/floating-ui.core.esm.js" | ||
}, | ||
"require": "./dist/floating-ui.core.cjs" | ||
@@ -24,0 +28,0 @@ }, |
import type { ComputePosition } from './types'; | ||
/** | ||
* Computes the `x` and `y` coordinates that will place the floating element | ||
* next to a reference element when it is given a certain positioning strategy. | ||
* | ||
* This export does not have any `platform` interface logic. You will need to | ||
* write one for the platform you are using Floating UI with. | ||
*/ | ||
export declare const computePosition: ComputePosition; |
import type { SideObject, Padding, Boundary, RootBoundary, ElementContext, MiddlewareArguments } from './types'; | ||
export declare type Options = { | ||
/** | ||
* The clipping element(s) in which overflow will be checked. | ||
*/ | ||
boundary: Boundary; | ||
/** | ||
* The root clipping element in which overflow will be checked. | ||
*/ | ||
rootBoundary: RootBoundary; | ||
/** | ||
* The element in which overflow is being checked relative to a boundary. | ||
*/ | ||
elementContext: ElementContext; | ||
/** | ||
* Whether to check for overflow using the alternate element's boundary | ||
* (`clippingParents` boundary only). | ||
*/ | ||
altBoundary: boolean; | ||
/** | ||
* Virtual padding for the resolved overflow offsets. | ||
*/ | ||
padding: Padding; | ||
}; | ||
/** | ||
* Resolves with an object of overflow side offsets that determine how much the | ||
* element is overflowing a given clipping boundary. | ||
* - positive = overflowing the boundary by that number of pixels | ||
* - negative = how many pixels left before it will overflow | ||
* - 0 = lies flush with the boundary | ||
*/ | ||
export declare function detectOverflow(middlewareArguments: MiddlewareArguments, options?: Partial<Options>): Promise<SideObject>; |
import type { Middleware, Padding } from '../types'; | ||
export declare type Options = { | ||
/** | ||
* The arrow element to be positioned. | ||
*/ | ||
element: any; | ||
/** | ||
* The padding between the arrow element and the floating element edges. | ||
* Useful when the floating element has rounded corners. | ||
*/ | ||
padding?: Padding; | ||
}; | ||
/** | ||
* Positions an inner element of the floating element such that it is centered | ||
* to the reference element. | ||
*/ | ||
export declare const arrow: (options: Options) => Middleware; |
@@ -5,6 +5,20 @@ import type { Middleware, Placement, Alignment } from '../types'; | ||
export declare type Options = { | ||
/** | ||
* Choose placements with a particular alignment. | ||
*/ | ||
alignment: Alignment | null; | ||
/** | ||
* Which placements are allowed to be chosen. Placements must be within the | ||
* `alignment` option set. | ||
*/ | ||
allowedPlacements: Array<Placement>; | ||
/** | ||
* Whether to choose placements with the opposite alignment if they will fit | ||
* better. | ||
*/ | ||
autoAlignment: boolean; | ||
}; | ||
/** | ||
* Automatically chooses the `placement` which has the most space available. | ||
*/ | ||
export declare const autoPlacement: (options?: Partial<Options & DetectOverflowOptions>) => Middleware; |
import type { Placement, Middleware } from '../types'; | ||
import { Options as DetectOverflowOptions } from '../detectOverflow'; | ||
export declare type Options = { | ||
/** | ||
* The axis that runs along the side of the floating element. | ||
*/ | ||
mainAxis: boolean; | ||
/** | ||
* The axis that runs along the alignment of the floating element. | ||
*/ | ||
crossAxis: boolean; | ||
/** | ||
* Placements to try if the preferred `placement` does not fit. | ||
*/ | ||
fallbackPlacements: Array<Placement>; | ||
/** | ||
* What strategy to use when no placements fit. | ||
*/ | ||
fallbackStrategy: 'bestFit' | 'initialPlacement'; | ||
/** | ||
* Whether to flip to placements with the opposite alignment if they fit | ||
* better. | ||
*/ | ||
flipAlignment: boolean; | ||
}; | ||
/** | ||
* Changes the placement of the floating element to one that will fit if the | ||
* initially specified `placement` does not. | ||
*/ | ||
export declare const flip: (options?: Partial<Options & DetectOverflowOptions>) => Middleware; |
import type { Middleware } from '../types'; | ||
/** | ||
* Provides data to hide the floating element in applicable situations, such as | ||
* when it is not in the same clipping context as the reference element. | ||
*/ | ||
export declare const hide: () => Middleware; |
import type { Coords, Middleware, Padding } from '../types'; | ||
export declare type Options = Coords & { | ||
/** | ||
* @experimental | ||
*/ | ||
padding: Padding; | ||
}; | ||
/** | ||
* Provides improved positioning for inline reference elements that can span | ||
* over multiple lines, such as hyperlinks or range selections. | ||
*/ | ||
export declare const inline: (options?: Partial<Options>) => Middleware; |
import type { Placement, Rect, Coords, Middleware } from '../types'; | ||
declare type OffsetValue = number | { | ||
/** | ||
* The axis that runs along the side of the floating element. | ||
*/ | ||
mainAxis?: number; | ||
/** | ||
* The axis that runs along the alignment of the floating element. | ||
*/ | ||
crossAxis?: number; | ||
@@ -20,3 +26,6 @@ }; | ||
}): Coords; | ||
/** | ||
* Displaces the floating element from its reference element. | ||
*/ | ||
export declare const offset: (value?: Options) => Middleware; | ||
export {}; |
import type { Middleware, Rect, Placement, MiddlewareArguments, Coords } from '../types'; | ||
import { Options as DetectOverflowOptions } from '../detectOverflow'; | ||
export declare type Options = { | ||
/** | ||
* The axis that runs along the alignment of the floating element. | ||
*/ | ||
mainAxis: boolean; | ||
/** | ||
* The axis that runs along the side of the floating element. | ||
*/ | ||
crossAxis: boolean; | ||
/** | ||
* Accepts a function that limits the shifting done in order to prevent | ||
* detachment. | ||
*/ | ||
limiter: { | ||
@@ -11,2 +21,6 @@ fn: (middlewareArguments: MiddlewareArguments) => Coords; | ||
}; | ||
/** | ||
* Shifts the floating element in order to keep it in view when it will overflow | ||
* a clipping boundary. | ||
*/ | ||
export declare const shift: (options?: Partial<Options & DetectOverflowOptions>) => Middleware; | ||
@@ -18,13 +32,45 @@ declare type LimitShiftOffset = ((args: { | ||
}) => number | { | ||
/** | ||
* Offset the limiting of the axis that runs along the alignment of the | ||
* floating element. | ||
*/ | ||
mainAxis?: number; | ||
/** | ||
* Offset the limiting of the axis that runs along the side of the | ||
* floating element. | ||
*/ | ||
crossAxis?: number; | ||
}) | number | { | ||
/** | ||
* Offset the limiting of the axis that runs along the alignment of the | ||
* floating element. | ||
*/ | ||
mainAxis?: number; | ||
/** | ||
* Offset the limiting of the axis that runs along the side of the | ||
* floating element. | ||
*/ | ||
crossAxis?: number; | ||
}; | ||
export declare type LimitShiftOptions = { | ||
/** | ||
* Offset when limiting starts. `0` will limit when the opposite edges of the | ||
* reference and floating elements are aligned. | ||
* - positive = start limiting earlier | ||
* - negative = start limiting later | ||
*/ | ||
offset: LimitShiftOffset; | ||
/** | ||
* Whether to limit the axis that runs along the alignment of the floating | ||
* element. | ||
*/ | ||
mainAxis: boolean; | ||
/** | ||
* Whether to limit the axis that runs along the side of the floating element. | ||
*/ | ||
crossAxis: boolean; | ||
}; | ||
/** | ||
* Built-in `limiter` that will stop `shift()` at a certain point. | ||
*/ | ||
export declare const limitShift: (options?: Partial<LimitShiftOptions>) => { | ||
@@ -31,0 +77,0 @@ options: Partial<LimitShiftOffset>; |
import type { Dimensions, ElementRects, Middleware } from '../types'; | ||
import { Options as DetectOverflowOptions } from '../detectOverflow'; | ||
export declare type Options = { | ||
/** | ||
* Function that is called to perform style mutations to the floating element | ||
* to change its size. | ||
*/ | ||
apply(args: Dimensions & ElementRects): void; | ||
}; | ||
/** | ||
* Provides data to change the size of the floating element. For instance, | ||
* prevent it from overflowing its clipping boundary or match the width of the | ||
* reference element. | ||
*/ | ||
export declare const size: (options?: Partial<Options & DetectOverflowOptions>) => Middleware; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
165353
38
4358
13