Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-utils

Package Overview
Dependencies
Maintainers
1
Versions
620
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-utils - npm Package Compare versions

Comparing version 0.0.0-nightly-20230725.1 to 0.0.0-nightly-20230726.0

src/dom/getelementsintersectionrect.d.ts

2

package.json
{
"name": "@ckeditor/ckeditor5-utils",
"version": "0.0.0-nightly-20230725.1",
"version": "0.0.0-nightly-20230726.0",
"description": "Miscellaneous utilities used by CKEditor 5.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -11,2 +11,5 @@ /**

*
* **Note**: If there are no position coordinates found that meet the requirements (arguments of this helper),
* `null` is returned.
*
* ```ts

@@ -72,3 +75,3 @@ * // The element which is to be positioned.

*/
export declare function getOptimalPosition({ element, target, positions, limiter, fitInViewport, viewportOffsetConfig }: Options): Position;
export declare function getOptimalPosition({ element, target, positions, limiter, fitInViewport, viewportOffsetConfig }: Options): Position | null;
/**

@@ -75,0 +78,0 @@ * A position object which instances are created and used by the {@link module:utils/dom/position~getOptimalPosition} helper.

@@ -13,2 +13,4 @@ /**

import { isFunction } from 'lodash-es';
import getScrollableAncestors from './getscrollableancestors';
import getElementsIntersectionRect from './getelementsintersectionrect';
// @if CK_DEBUG_POSITION // const RectDrawer = require( '@ckeditor/ckeditor5-utils/tests/_utils/rectdrawer' ).default

@@ -20,2 +22,5 @@ /**

*
* **Note**: If there are no position coordinates found that meet the requirements (arguments of this helper),
* `null` is returned.
*
* ```ts

@@ -100,2 +105,8 @@ * // The element which is to be positioned.

const positionOptions = { targetRect, elementRect, positionedElementAncestor, viewportRect };
// Get intersection of all scrollable ancestors of `target`.
const allScrollableAncestors = getScrollableAncestors(target);
const ancestorsIntersectionRect = getElementsIntersectionRect(allScrollableAncestors, (viewportOffsetConfig || { top: 0 }).top);
if (!ancestorsIntersectionRect || !targetRect.getVisible()) {
return null;
}
// If there are no limits, just grab the very first position and be done with that drama.

@@ -113,6 +124,6 @@ if (!limiter && !fitInViewport) {

// @if CK_DEBUG_POSITION // }
Object.assign(positionOptions, { limiterRect, viewportRect });
Object.assign(positionOptions, { limiterRect, viewportRect: ancestorsIntersectionRect });
// If there's no best position found, i.e. when all intersections have no area because
// rects have no width or height, then just use the first available position.
bestPosition = getBestPosition(positions, positionOptions) || new PositionObject(positions[0], positionOptions);
// rects have no width or height, then just return `null`
bestPosition = getBestPosition(positions, positionOptions);
}

@@ -139,2 +150,3 @@ return bestPosition;

const { elementRect } = options;
// @if CK_DEBUG_POSITION // RectDrawer.draw( elementRect, { outlineWidth: '5px', outlineColor: 'orange' }, 'elementRect' );
// This is when element is fully visible.

@@ -237,3 +249,3 @@ const elementRectArea = elementRect.getArea();

this.config = config;
this._positioningFunctionCorrdinates = { left, top };
this._positioningFunctionCoordinates = { left, top };
this._options = options;

@@ -271,5 +283,2 @@ }

}
else {
return limiterRect.getIntersectionArea(this._rect);
}
}

@@ -283,6 +292,3 @@ return 0;

const viewportRect = this._options.viewportRect;
if (viewportRect) {
return viewportRect.getIntersectionArea(this._rect);
}
return 0;
return viewportRect.getIntersectionArea(this._rect);
}

@@ -297,3 +303,3 @@ /**

}
this._cachedRect = this._options.elementRect.clone().moveTo(this._positioningFunctionCorrdinates.left, this._positioningFunctionCorrdinates.top);
this._cachedRect = this._options.elementRect.clone().moveTo(this._positioningFunctionCoordinates.left, this._positioningFunctionCoordinates.top);
return this._cachedRect;

@@ -300,0 +306,0 @@ }

@@ -28,2 +28,4 @@ /**

export { default as getAncestors } from './dom/getancestors';
export { default as getElementsIntersectionRect } from './dom/getelementsintersectionrect';
export { default as getScrollableAncestors } from './dom/getscrollableancestors';
export { default as getDataFromElement } from './dom/getdatafromelement';

@@ -42,3 +44,3 @@ export { default as isText } from './dom/istext';

export { default as isVisible } from './dom/isvisible';
export { getOptimalPosition, type Options as PositionOptions, type PositioningFunction } from './dom/position';
export { getOptimalPosition, type Options as PositionOptions, type PositioningFunction, type Position } from './dom/position';
export { default as remove } from './dom/remove';

@@ -45,0 +47,0 @@ export * from './dom/scroll';

@@ -27,2 +27,4 @@ /**

export { default as getAncestors } from './dom/getancestors';
export { default as getElementsIntersectionRect } from './dom/getelementsintersectionrect';
export { default as getScrollableAncestors } from './dom/getscrollableancestors';
export { default as getDataFromElement } from './dom/getdatafromelement';

@@ -29,0 +31,0 @@ export { default as isText } from './dom/istext';

@@ -5,3 +5,3 @@ /**

*/
declare const version = "0.0.0-nightly-20230725.1";
declare const version = "0.0.0-nightly-20230726.0";
export default version;

@@ -8,0 +8,0 @@ export declare const releaseDate: Date;

@@ -10,6 +10,6 @@ /**

import CKEditorError from './ckeditorerror';
const version = '0.0.0-nightly-20230725.1';
const version = '0.0.0-nightly-20230726.0';
export default version;
// The second argument is not a month. It is `monthIndex` and starts from `0`.
export const releaseDate = new Date(2023, 6, 25);
export const releaseDate = new Date(2023, 6, 26);
/* istanbul ignore next -- @preserve */

@@ -16,0 +16,0 @@ const windowOrGlobal = typeof window === 'object' ? window : global;

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