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

rc-new-window

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-new-window - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

1

es/BrowserPopupWindow.d.ts
export declare function gerWindowBorder(): [number, number, number];
export declare const isSafari: boolean;
export declare const popupSupported: boolean;
export declare const popupWindowBorder: [number, number, number];

3

es/BrowserPopupWindow.js

@@ -40,3 +40,3 @@ "use strict";

});
exports.popupWindowBorder = exports.popupSupported = exports.gerWindowBorder = void 0;
exports.popupWindowBorder = exports.popupSupported = exports.isSafari = exports.gerWindowBorder = void 0;

@@ -96,3 +96,4 @@ var Bowser = __importStar(require("bowser"));

exports.gerWindowBorder = gerWindowBorder;
exports.isSafari = browser.getBrowserName(true) === 'safari';
exports.popupSupported = browser.getPlatformType() === 'desktop';
exports.popupWindowBorder = gerWindowBorder();

@@ -143,4 +143,6 @@ "use strict";

features.width -= sideBorder * 2;
features.height -= topBorder + bottomBorder;
if (!BrowserPopupWindow_1.isSafari) {
features.width -= sideBorder * 2;
features.height -= topBorder + bottomBorder;
}
} else if (initPopupInnerRect) {

@@ -155,2 +157,6 @@ features = initPopupInnerRect();

features.top -= _topBorder;
if (BrowserPopupWindow_1.isSafari) {
features.height += _topBorder;
}
} else {

@@ -157,0 +163,0 @@ features.left = window.top.outerWidth / 2 + window.top.screenX - width / 2;

"use strict";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
Object.defineProperty(exports, "__esModule", {

@@ -15,4 +15,15 @@ value: true

// one of them might be off by a lot due to developer console or other browser plugin
var xRatio = (_window.outerWidth - 8) / _window.innerWidth;
var yRatio = (_window.outerHeight - 80) / _window.innerHeight;
var _BrowserPopupWindow_ = BrowserPopupWindow_1.gerWindowBorder(),
_BrowserPopupWindow_2 = _slicedToArray(_BrowserPopupWindow_, 3),
topBorder = _BrowserPopupWindow_2[0],
sideBorder = _BrowserPopupWindow_2[1],
bottomBorder = _BrowserPopupWindow_2[2];
if (_window.outerWidth === _window.screen.availWidth) {
sideBorder = 0;
bottomBorder = 0;
}
var xRatio = (_window.outerWidth - sideBorder * 2) / _window.innerWidth;
var yRatio = (_window.outerHeight - topBorder - bottomBorder) / _window.innerHeight;
var zoomRatio = Math.min(yRatio, xRatio);

@@ -28,2 +39,3 @@

console.log("zoom ".concat(zoomRatio));
return zoomRatio;

@@ -174,6 +186,6 @@ }

if (removeBorder) {
var _BrowserPopupWindow_ = _slicedToArray(BrowserPopupWindow_1.popupWindowBorder, 3),
topBorder = _BrowserPopupWindow_[0],
sideBorder = _BrowserPopupWindow_[1],
bottomBorder = _BrowserPopupWindow_[2];
var _BrowserPopupWindow_3 = _slicedToArray(BrowserPopupWindow_1.popupWindowBorder, 3),
topBorder = _BrowserPopupWindow_3[0],
sideBorder = _BrowserPopupWindow_3[1],
bottomBorder = _BrowserPopupWindow_3[2];

@@ -180,0 +192,0 @@ fromRect.left += sideBorder;

# History
----
## 0.1.3 / 2020-12-18
- fix safari window position and size issue
## 0.1.2 / 2020-12-13

@@ -5,0 +9,0 @@

export declare function gerWindowBorder(): [number, number, number];
export declare const isSafari: boolean;
export declare const popupSupported: boolean;
export declare const popupWindowBorder: [number, number, number];

@@ -40,3 +40,3 @@ "use strict";

});
exports.popupWindowBorder = exports.popupSupported = exports.gerWindowBorder = void 0;
exports.popupWindowBorder = exports.popupSupported = exports.isSafari = exports.gerWindowBorder = void 0;

@@ -96,3 +96,4 @@ var Bowser = __importStar(require("bowser"));

exports.gerWindowBorder = gerWindowBorder;
exports.isSafari = browser.getBrowserName(true) === 'safari';
exports.popupSupported = browser.getPlatformType() === 'desktop';
exports.popupWindowBorder = gerWindowBorder();

@@ -148,4 +148,6 @@ "use strict";

features.width -= sideBorder * 2;
features.height -= topBorder + bottomBorder;
if (!BrowserPopupWindow_1.isSafari) {
features.width -= sideBorder * 2;
features.height -= topBorder + bottomBorder;
}
} else if (initPopupInnerRect) {

@@ -160,2 +162,6 @@ features = initPopupInnerRect();

features.top -= _topBorder;
if (BrowserPopupWindow_1.isSafari) {
features.height += _topBorder;
}
} else {

@@ -162,0 +168,0 @@ features.left = window.top.outerWidth / 2 + window.top.screenX - width / 2;

@@ -5,4 +5,2 @@ "use strict";

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

@@ -12,2 +10,4 @@

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
Object.defineProperty(exports, "__esModule", {

@@ -22,4 +22,15 @@ value: true

// one of them might be off by a lot due to developer console or other browser plugin
var xRatio = (_window.outerWidth - 8) / _window.innerWidth;
var yRatio = (_window.outerHeight - 80) / _window.innerHeight;
var _BrowserPopupWindow_ = BrowserPopupWindow_1.gerWindowBorder(),
_BrowserPopupWindow_2 = (0, _slicedToArray2.default)(_BrowserPopupWindow_, 3),
topBorder = _BrowserPopupWindow_2[0],
sideBorder = _BrowserPopupWindow_2[1],
bottomBorder = _BrowserPopupWindow_2[2];
if (_window.outerWidth === _window.screen.availWidth) {
sideBorder = 0;
bottomBorder = 0;
}
var xRatio = (_window.outerWidth - sideBorder * 2) / _window.innerWidth;
var yRatio = (_window.outerHeight - topBorder - bottomBorder) / _window.innerHeight;
var zoomRatio = Math.min(yRatio, xRatio);

@@ -35,2 +46,3 @@

console.log("zoom ".concat(zoomRatio));
return zoomRatio;

@@ -180,6 +192,6 @@ }

if (removeBorder) {
var _BrowserPopupWindow_ = (0, _slicedToArray2.default)(BrowserPopupWindow_1.popupWindowBorder, 3),
topBorder = _BrowserPopupWindow_[0],
sideBorder = _BrowserPopupWindow_[1],
bottomBorder = _BrowserPopupWindow_[2];
var _BrowserPopupWindow_3 = (0, _slicedToArray2.default)(BrowserPopupWindow_1.popupWindowBorder, 3),
topBorder = _BrowserPopupWindow_3[0],
sideBorder = _BrowserPopupWindow_3[1],
bottomBorder = _BrowserPopupWindow_3[2];

@@ -186,0 +198,0 @@ fromRect.left += sideBorder;

{
"name": "rc-new-window",
"version": "0.1.2",
"version": "0.1.3",
"description": "popup new browser window with react",

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

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