feature: vor und nachteile

This commit is contained in:
Hikyu
2026-05-31 13:54:31 +02:00
parent 552a947a1c
commit e3dad17446
23270 changed files with 3024794 additions and 200 deletions
+31
View File
@@ -0,0 +1,31 @@
import type { FloatingElement, ReferenceElement } from './types';
export interface Options {
/**
* Whether to update the position when an overflow ancestor is scrolled.
* @default true
*/
ancestorScroll: boolean;
/**
* Whether to update the position when an overflow ancestor is resized. This
* uses the native `resize` event.
* @default true
*/
ancestorResize: boolean;
/**
* Whether to update the position when either the reference or floating
* elements resized. This uses a `ResizeObserver`.
* @default true
*/
elementResize: boolean;
/**
* Whether to update on every animation frame if necessary. Optimized for
* performance so updates are only called when necessary, but use sparingly.
* @default false
*/
animationFrame: boolean;
}
/**
* Automatically updates the position of the floating element when necessary.
* @see https://floating-ui.com/docs/autoUpdate
*/
export declare function autoUpdate(reference: ReferenceElement, floating: FloatingElement, update: () => void, options?: Partial<Options>): () => void;
+11
View File
@@ -0,0 +1,11 @@
import type { ComputePositionConfig, FloatingElement, ReferenceElement } 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 CSS positioning
* strategy.
*/
export declare const computePosition: (reference: ReferenceElement, floating: FloatingElement, options?: Partial<ComputePositionConfig>) => Promise<import("@floating-ui/core").ComputePositionReturn>;
export { autoUpdate } from './autoUpdate';
export { platform } from './platform';
export { getOverflowAncestors } from './utils/getOverflowAncestors';
export { arrow, autoPlacement, detectOverflow, flip, hide, inline, limitShift, offset, shift, size, } from '@floating-ui/core';
+2
View File
@@ -0,0 +1,2 @@
import type { Platform } from './types';
export declare const platform: Platform;
+128
View File
@@ -0,0 +1,128 @@
import type { AutoPlacementOptions, ClientRectObject, ComputePositionConfig as CoreComputePositionConfig, DetectOverflowOptions as CoreDetectOverflowOptions, Dimensions, ElementRects, FlipOptions, HideOptions, Middleware as CoreMiddleware, MiddlewareArguments as CoreMiddlewareArguments, MiddlewareReturn, Padding, Rect, RootBoundary, ShiftOptions, SideObject, SizeOptions as CoreSizeOptions, Strategy } from '@floating-ui/core';
type Promisable<T> = T | Promise<T>;
export interface Platform {
getElementRects: (args: {
reference: ReferenceElement;
floating: FloatingElement;
strategy: Strategy;
}) => Promisable<ElementRects>;
getClippingRect: (args: {
element: Element;
boundary: Boundary;
rootBoundary: RootBoundary;
strategy: Strategy;
}) => Promisable<Rect>;
getDimensions: (element: Element) => Promisable<Dimensions>;
convertOffsetParentRelativeRectToViewportRelativeRect?: (args: {
rect: Rect;
offsetParent: Element;
strategy: Strategy;
}) => Promisable<Rect>;
getOffsetParent?: (element: Element) => Promisable<Element | Window>;
isElement?: (value: unknown) => Promisable<boolean>;
getDocumentElement?: (element: Element) => Promisable<HTMLElement>;
getClientRects?: (element: Element) => Promisable<Array<ClientRectObject>>;
isRTL?: (element: Element) => Promisable<boolean>;
getScale?: (element: HTMLElement) => Promisable<{
x: number;
y: number;
}>;
}
export interface NodeScroll {
scrollLeft: number;
scrollTop: number;
}
export type Boundary = 'clippingAncestors' | Element | Array<Element>;
export type DetectOverflowOptions = Omit<CoreDetectOverflowOptions, 'boundary'> & {
boundary: Boundary;
};
export type SizeOptions = Omit<CoreSizeOptions, 'apply'> & {
/**
* Function that is called to perform style mutations to the floating element
* to change its size.
* @default undefined
*/
apply(args: MiddlewareArguments & {
availableWidth: number;
availableHeight: number;
}): Promisable<void>;
};
export type ComputePositionConfig = Omit<CoreComputePositionConfig, 'middleware' | 'platform'> & {
middleware?: Array<Middleware | null | undefined | false>;
platform?: Platform;
};
/**
* Custom positioning reference element.
* @see https://floating-ui.com/docs/virtual-elements
*/
export interface VirtualElement {
getBoundingClientRect(): ClientRectObject;
contextElement?: Element;
}
export type ReferenceElement = Element | VirtualElement;
export type FloatingElement = HTMLElement;
export interface Elements {
reference: ReferenceElement;
floating: FloatingElement;
}
export type MiddlewareArguments = Omit<CoreMiddlewareArguments, 'elements'> & {
elements: Elements;
};
export type Middleware = Omit<CoreMiddleware, 'fn'> & {
fn(args: MiddlewareArguments): Promisable<MiddlewareReturn>;
};
/**
* Automatically chooses the `placement` which has the most space available.
* @see https://floating-ui.com/docs/autoPlacement
*/
declare const autoPlacement: (options?: Partial<AutoPlacementOptions & DetectOverflowOptions>) => Middleware;
/**
* Shifts the floating element in order to keep it in view when it will overflow
* a clipping boundary.
* @see https://floating-ui.com/docs/shift
*/
declare const shift: (options?: Partial<ShiftOptions & DetectOverflowOptions>) => Middleware;
/**
* Changes the placement of the floating element to one that will fit if the
* initially specified `placement` does not.
* @see https://floating-ui.com/docs/flip
*/
declare const flip: (options?: Partial<FlipOptions & DetectOverflowOptions>) => Middleware;
/**
* 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.
* @see https://floating-ui.com/docs/size
*/
declare const size: (options?: Partial<SizeOptions & DetectOverflowOptions>) => Middleware;
/**
* Positions an inner element of the floating element such that it is centered
* to the reference element.
* @see https://floating-ui.com/docs/arrow
*/
declare const arrow: (options: {
element: Element;
padding?: Padding;
}) => Middleware;
/**
* 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.
* @see https://floating-ui.com/docs/hide
*/
declare const hide: (options?: Partial<HideOptions & DetectOverflowOptions>) => Middleware;
/**
* 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
* @see https://floating-ui.com/docs/detectOverflow
*/
declare const detectOverflow: (middlewareArguments: MiddlewareArguments, options?: Partial<DetectOverflowOptions>) => Promise<SideObject>;
export { arrow, autoPlacement, detectOverflow, flip, hide, shift, size };
export { computePosition } from './';
export { autoUpdate, Options as AutoUpdateOptions } from './autoUpdate';
export { platform } from './platform';
export { getOverflowAncestors } from './utils/getOverflowAncestors';
export type { AlignedPlacement, Alignment, Axis, ClientRectObject, ComputePositionReturn, Coords, Dimensions, ElementContext, ElementRects, Length, MiddlewareData, MiddlewareReturn, Padding, Placement, Rect, RootBoundary, Side, SideObject, Strategy, } from '@floating-ui/core';
export { inline, limitShift, offset } from '@floating-ui/core';
@@ -0,0 +1,6 @@
import type { Rect, Strategy } from '@floating-ui/core';
export declare function convertOffsetParentRelativeRectToViewportRelativeRect({ rect, offsetParent, strategy, }: {
rect: Rect;
offsetParent: Element | Window;
strategy: Strategy;
}): Rect;
@@ -0,0 +1,2 @@
import type { ClientRectObject, VirtualElement } from '@floating-ui/core';
export declare function getBoundingClientRect(element: Element | VirtualElement, includeScale?: boolean, isFixedStrategy?: boolean, offsetParent?: Element | Window): ClientRectObject;
@@ -0,0 +1,12 @@
import type { Boundary, Rect, RootBoundary, Strategy } from '@floating-ui/core';
import { Platform, ReferenceElement } from '../types';
type PlatformWithCache = Platform & {
_c: Map<ReferenceElement, Element[]>;
};
export declare function getClippingRect(this: PlatformWithCache, { element, boundary, rootBoundary, strategy, }: {
element: Element;
boundary: Boundary;
rootBoundary: RootBoundary;
strategy: Strategy;
}): Rect;
export {};
@@ -0,0 +1 @@
export declare function getComputedStyle(element: Element): CSSStyleDeclaration;
@@ -0,0 +1,4 @@
import type { Dimensions } from '@floating-ui/core';
export declare function getCssDimensions(element: HTMLElement): Dimensions & {
fallback: boolean;
};
@@ -0,0 +1,2 @@
import type { Dimensions } from '@floating-ui/core';
export declare function getDimensions(element: Element): Dimensions;
@@ -0,0 +1 @@
export declare function getDocumentElement(node: Node | Window): HTMLElement;
@@ -0,0 +1,2 @@
import type { Rect } from '@floating-ui/core';
export declare function getDocumentRect(element: HTMLElement): Rect;
@@ -0,0 +1 @@
export declare function getNearestOverflowAncestor(node: Node): HTMLElement;
@@ -0,0 +1 @@
export declare function getNodeName(node: Node | Window): string;
@@ -0,0 +1,2 @@
import { NodeScroll } from '../types';
export declare function getNodeScroll(element: Element | Window): NodeScroll;
@@ -0,0 +1 @@
export declare function getOffsetParent(element: Element): Element | Window;
@@ -0,0 +1,3 @@
type OverflowAncestors = Array<Element | Window | VisualViewport>;
export declare function getOverflowAncestors(node: Node, list?: OverflowAncestors): OverflowAncestors;
export {};
@@ -0,0 +1 @@
export declare function getParentNode(node: Node): Node;
@@ -0,0 +1,2 @@
import type { Rect, Strategy, VirtualElement } from '@floating-ui/core';
export declare function getRectRelativeToOffsetParent(element: Element | VirtualElement, offsetParent: Element | Window, strategy: Strategy): Rect;
+7
View File
@@ -0,0 +1,7 @@
import type { Coords } from '@floating-ui/core';
import type { VirtualElement } from '../types';
export declare const FALLBACK_SCALE: {
x: number;
y: number;
};
export declare function getScale(element: Element | VirtualElement): Coords;
@@ -0,0 +1,2 @@
import type { Rect, Strategy } from '@floating-ui/core';
export declare function getViewportRect(element: Element, strategy: Strategy): Rect;
@@ -0,0 +1 @@
export declare function getWindowScrollBarX(element: Element): number;
+17
View File
@@ -0,0 +1,17 @@
declare global {
interface Window {
HTMLElement: any;
Element: any;
Node: any;
ShadowRoot: any;
}
}
export declare function isHTMLElement(value: any): value is HTMLElement;
export declare function isElement(value: any): value is Element;
export declare function isNode(value: any): value is Node;
export declare function isShadowRoot(node: Node): node is ShadowRoot;
export declare function isOverflowElement(element: Element): boolean;
export declare function isTableElement(element: Element): boolean;
export declare function isContainingBlock(element: Element): boolean;
export declare function isLayoutViewport(): boolean;
export declare function isLastTraversableNode(node: Node): boolean;
+3
View File
@@ -0,0 +1,3 @@
export declare const min: (...values: number[]) => number;
export declare const max: (...values: number[]) => number;
export declare const round: (x: number) => number;
@@ -0,0 +1,2 @@
import type { VirtualElement } from '../types';
export declare function unwrapElement(element: Element | VirtualElement): Element | undefined;
+1
View File
@@ -0,0 +1 @@
export declare function getUAString(): string;
+1
View File
@@ -0,0 +1 @@
export declare function getWindow(node: Node): Window;