Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@floating-ui/core

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@floating-ui/core - npm Package Compare versions

Comparing version 0.6.2 to 0.7.0

dist/floating-ui.core.browser.min.mjs

39

dist/floating-ui.core.esm.js

@@ -335,3 +335,8 @@ function getSide(placement) {

const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
const clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
if (clientSize === 0) {
clientSize = rects.floating[length];
}
const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center

@@ -695,7 +700,9 @@ // point is outside of the floating element's bounds

function convertValueToCoords(placement, rects, value, rtl) {
if (rtl === void 0) {
rtl = false;
}
async function convertValueToCoords(middlewareArguments, value) {
const {
placement,
platform,
elements
} = middlewareArguments;
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
const side = getSide(placement);

@@ -706,5 +713,3 @@ const alignment = getAlignment(placement);

const crossAxisMulti = rtl && isVertical ? -1 : 1;
const rawValue = typeof value === 'function' ? value({ ...rects,
placement
}) : value; // eslint-disable-next-line prefer-const
const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const

@@ -755,9 +760,5 @@ let {

x,
y,
placement,
rects,
platform,
elements
y
} = middlewareArguments;
const diffCoords = convertValueToCoords(placement, rects, value, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
const diffCoords = await convertValueToCoords(middlewareArguments, value);
return {

@@ -980,8 +981,8 @@ x: x + diffCoords.x,

const dimensions = {
height: rects.floating.height - (['left', 'right'].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)) : overflow[heightSide]),
width: rects.floating.width - (['top', 'bottom'].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)) : overflow[widthSide])
availableHeight: rects.floating.height - (['left', 'right'].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)) : overflow[heightSide]),
availableWidth: rects.floating.width - (['top', 'bottom'].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)) : overflow[widthSide])
};
const prevDimensions = await platform.getDimensions(elements.floating);
apply == null ? void 0 : apply({ ...dimensions,
...rects
apply == null ? void 0 : apply({ ...middlewareArguments,
...dimensions
});

@@ -988,0 +989,0 @@ const nextDimensions = await platform.getDimensions(elements.floating);

{
"name": "@floating-ui/core",
"version": "0.6.2",
"version": "0.7.0",
"@rollingversions": {

@@ -15,17 +15,20 @@ "baseVersion": [

},
"main": "dist/floating-ui.core.js",
"module": "dist/floating-ui.core.esm.js",
"unpkg": "dist/floating-ui.core.min.js",
"type": "module",
"main": "./dist/floating-ui.core.umd.js",
"module": "./dist/floating-ui.core.esm.js",
"unpkg": "./dist/floating-ui.core.umd.min.js",
"types": "./index.d.ts",
"exports": {
".": {
"types": "./index.d.ts",
"import": {
"development": "./dist/floating-ui.core.esm.development.js",
"production": "./dist/floating-ui.core.esm.min.js",
"default": "./dist/floating-ui.core.esm.js"
"browser": {
"development": "./dist/floating-ui.core.browser.mjs",
"default": "./dist/floating-ui.core.browser.min.mjs"
},
"default": "./dist/floating-ui.core.mjs"
},
"require": "./dist/floating-ui.core.cjs"
"module": "./dist/floating-ui.core.esm.js",
"default": "./dist/floating-ui.core.umd.js"
},
"./package.json": "./package.json",
"./src/index.ts": "./src/index.ts"
"./package.json": "./package.json"
},

@@ -32,0 +35,0 @@ "sideEffects": false,

@@ -1,2 +0,2 @@

import type { Placement, Rect, Coords, Middleware, ElementRects } from '../types';
import type { Coords, Middleware, MiddlewareArguments } from '../types';
declare type OffsetValue = number | {

@@ -22,9 +22,5 @@ /**

};
declare type OffsetFunction = (args: {
floating: Rect;
reference: Rect;
placement: Placement;
}) => OffsetValue;
declare type OffsetFunction = (args: MiddlewareArguments) => OffsetValue;
export declare type Options = OffsetValue | OffsetFunction;
export declare function convertValueToCoords(placement: Placement, rects: ElementRects, value: Options, rtl?: boolean): Coords;
export declare function convertValueToCoords(middlewareArguments: MiddlewareArguments, value: Options): Promise<Coords>;
/**

@@ -31,0 +27,0 @@ * Displaces the floating element from its reference element.

@@ -1,2 +0,2 @@

import type { Dimensions, ElementRects, Middleware } from '../types';
import type { Middleware, MiddlewareArguments } from '../types';
import { Options as DetectOverflowOptions } from '../detectOverflow';

@@ -9,3 +9,6 @@ export interface Options {

*/
apply(args: Dimensions & ElementRects): void;
apply(args: MiddlewareArguments & {
availableWidth: number;
availableHeight: number;
}): void;
}

@@ -12,0 +15,0 @@ /**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc