@juggle/resize-observer
Advanced tools
Comparing version 3.2.0 to 3.3.0
import { ResizeObserverBoxOptions } from '../ResizeObserverBoxOptions'; | ||
import { ResizeObserverSize } from '../ResizeObserverSize'; | ||
import { DOMRectReadOnly } from '../DOMRectReadOnly'; | ||
import { isSVG, isHidden } from '../utils/element'; | ||
import { freeze } from '../utils/freeze'; | ||
import { global } from '../utils/global'; | ||
@@ -14,8 +16,5 @@ var cache = new WeakMap(); | ||
if (switchSizes === void 0) { switchSizes = false; } | ||
return Object.freeze({ | ||
inlineSize: (switchSizes ? blockSize : inlineSize) || 0, | ||
blockSize: (switchSizes ? inlineSize : blockSize) || 0 | ||
}); | ||
return new ResizeObserverSize((switchSizes ? blockSize : inlineSize) || 0, (switchSizes ? inlineSize : blockSize) || 0); | ||
}; | ||
var zeroBoxes = Object.freeze({ | ||
var zeroBoxes = freeze({ | ||
devicePixelContentBoxSize: size(), | ||
@@ -61,3 +60,3 @@ borderBoxSize: size(), | ||
var borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea; | ||
var boxes = Object.freeze({ | ||
var boxes = freeze({ | ||
devicePixelContentBoxSize: size(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes), | ||
@@ -64,0 +63,0 @@ borderBoxSize: size(borderBoxWidth, borderBoxHeight, switchSizes), |
@@ -0,1 +1,2 @@ | ||
import { freeze } from './utils/freeze'; | ||
var DOMRectReadOnly = (function () { | ||
@@ -11,3 +12,3 @@ function DOMRectReadOnly(x, y, width, height) { | ||
this.right = this.left + this.width; | ||
return Object.freeze(this); | ||
return freeze(this); | ||
} | ||
@@ -14,0 +15,0 @@ DOMRectReadOnly.prototype.toJSON = function () { |
export { ResizeObserver } from '../ResizeObserver'; | ||
export { ResizeObserverEntry } from '../ResizeObserverEntry'; | ||
export { ResizeObserverSize } from '../ResizeObserverSize'; |
export { ResizeObserver } from '../ResizeObserver'; | ||
export { ResizeObserverEntry } from '../ResizeObserverEntry'; | ||
export { ResizeObserverSize } from '../ResizeObserverSize'; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global.ResizeObserver = {})); | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ResizeObserver = {})); | ||
}(this, (function (exports) { 'use strict'; | ||
@@ -40,2 +40,13 @@ | ||
var freeze = function (obj) { return Object.freeze(obj); }; | ||
var ResizeObserverSize = (function () { | ||
function ResizeObserverSize(inlineSize, blockSize) { | ||
this.inlineSize = inlineSize; | ||
this.blockSize = blockSize; | ||
freeze(this); | ||
} | ||
return ResizeObserverSize; | ||
}()); | ||
var DOMRectReadOnly = (function () { | ||
@@ -51,3 +62,3 @@ function DOMRectReadOnly(x, y, width, height) { | ||
this.right = this.left + this.width; | ||
return Object.freeze(this); | ||
return freeze(this); | ||
} | ||
@@ -107,8 +118,5 @@ DOMRectReadOnly.prototype.toJSON = function () { | ||
if (switchSizes === void 0) { switchSizes = false; } | ||
return Object.freeze({ | ||
inlineSize: (switchSizes ? blockSize : inlineSize) || 0, | ||
blockSize: (switchSizes ? inlineSize : blockSize) || 0 | ||
}); | ||
return new ResizeObserverSize((switchSizes ? blockSize : inlineSize) || 0, (switchSizes ? inlineSize : blockSize) || 0); | ||
}; | ||
var zeroBoxes = Object.freeze({ | ||
var zeroBoxes = freeze({ | ||
devicePixelContentBoxSize: size(), | ||
@@ -154,3 +162,3 @@ borderBoxSize: size(), | ||
var borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea; | ||
var boxes = Object.freeze({ | ||
var boxes = freeze({ | ||
devicePixelContentBoxSize: size(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes), | ||
@@ -181,5 +189,5 @@ borderBoxSize: size(borderBoxWidth, borderBoxHeight, switchSizes), | ||
this.contentRect = boxes.contentRect; | ||
this.borderBoxSize = [boxes.borderBoxSize]; | ||
this.contentBoxSize = [boxes.contentBoxSize]; | ||
this.devicePixelContentBoxSize = [boxes.devicePixelContentBoxSize]; | ||
this.borderBoxSize = freeze([boxes.borderBoxSize]); | ||
this.contentBoxSize = freeze([boxes.contentBoxSize]); | ||
this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]); | ||
} | ||
@@ -502,2 +510,3 @@ return ResizeObserverEntry; | ||
exports.ResizeObserverEntry = ResizeObserverEntry; | ||
exports.ResizeObserverSize = ResizeObserverSize; | ||
@@ -504,0 +513,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -6,7 +6,7 @@ import { DOMRectReadOnly } from './DOMRectReadOnly'; | ||
contentRect: DOMRectReadOnly; | ||
borderBoxSize: ResizeObserverSize[]; | ||
contentBoxSize: ResizeObserverSize[]; | ||
devicePixelContentBoxSize: ResizeObserverSize[]; | ||
borderBoxSize: readonly ResizeObserverSize[]; | ||
contentBoxSize: readonly ResizeObserverSize[]; | ||
devicePixelContentBoxSize: readonly ResizeObserverSize[]; | ||
constructor(target: Element); | ||
} | ||
export { ResizeObserverEntry }; |
import { calculateBoxSizes } from './algorithms/calculateBoxSize'; | ||
import { freeze } from './utils/freeze'; | ||
var ResizeObserverEntry = (function () { | ||
@@ -7,5 +8,5 @@ function ResizeObserverEntry(target) { | ||
this.contentRect = boxes.contentRect; | ||
this.borderBoxSize = [boxes.borderBoxSize]; | ||
this.contentBoxSize = [boxes.contentBoxSize]; | ||
this.devicePixelContentBoxSize = [boxes.devicePixelContentBoxSize]; | ||
this.borderBoxSize = freeze([boxes.borderBoxSize]); | ||
this.contentBoxSize = freeze([boxes.contentBoxSize]); | ||
this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]); | ||
} | ||
@@ -12,0 +13,0 @@ return ResizeObserverEntry; |
@@ -1,5 +0,6 @@ | ||
interface ResizeObserverSize { | ||
declare class ResizeObserverSize { | ||
readonly inlineSize: number; | ||
readonly blockSize: number; | ||
constructor(inlineSize: number, blockSize: number); | ||
} | ||
export { ResizeObserverSize }; |
import { ResizeObserver } from '../ResizeObserver'; | ||
import { ResizeObserverEntry } from '../ResizeObserverEntry'; | ||
import { ResizeObserverSize } from '../ResizeObserverSize'; | ||
declare type IsomorphicWindow = Window & { | ||
ResizeObserver?: typeof ResizeObserver; | ||
ResizeObserverEntry?: typeof ResizeObserverEntry; | ||
ResizeObserverSize?: typeof ResizeObserverSize; | ||
}; | ||
export declare const global: IsomorphicWindow; | ||
export {}; |
{ | ||
"name": "@juggle/resize-observer", | ||
"version": "3.2.0", | ||
"version": "3.3.0", | ||
"description": "Polyfills the ResizeObserver API and supports box size options from the latest spec", | ||
@@ -53,18 +53,18 @@ "main": "lib/exports/resize-observer.umd.js", | ||
"devDependencies": { | ||
"@types/jest": "^25.2.3", | ||
"@typescript-eslint/eslint-plugin": "^3.0.2", | ||
"@typescript-eslint/parser": "^3.0.2", | ||
"core-js": "^3.6.5", | ||
"@types/jest": "^26.0.20", | ||
"@typescript-eslint/eslint-plugin": "^4.15.2", | ||
"@typescript-eslint/parser": "^4.15.2", | ||
"core-js": "^3.9.0", | ||
"coveralls": "^3.1.0", | ||
"cssnano": "^4.1.10", | ||
"eslint": "^7.1.0", | ||
"jest": "^26.0.1", | ||
"jest-cli": "^26.0.1", | ||
"jest-junit": "^10.0.0", | ||
"jsdom": "^16.2.2", | ||
"eslint": "^7.20.0", | ||
"jest": "^26.6.3", | ||
"jest-cli": "^26.6.3", | ||
"jest-junit": "^12.0.0", | ||
"jsdom": "^16.4.0", | ||
"parcel-bundler": "^1.12.4", | ||
"rollup": "^2.12.0", | ||
"ts-jest": "^26.1.0", | ||
"typescript": "^3.9.3" | ||
"rollup": "^2.39.1", | ||
"ts-jest": "^26.5.2", | ||
"typescript": "^3.9.9" | ||
} | ||
} |
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
73515
56
1187