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

@ndla/util

Package Overview
Dependencies
Maintainers
5
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ndla/util - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

2

es/index.js

@@ -11,3 +11,3 @@ /**

export { copyTextToClipboard } from './copyTextToClipboard';
export { default as noScroll, isIosDeviceSafari } from './noScroll';
export { default as noScroll } from './noScroll';
export { default as getCurrentBreakpoint, breakpoints } from './getCurrentBreakpoint';

@@ -14,0 +14,0 @@ export { createUniversalPortal } from './createUniversalPortal';

@@ -20,15 +20,2 @@ var scrollbarWidth = null;

export var isIosDeviceSafari = typeof window !== 'undefined' && window.navigator && window.navigator.platform && /^((?!chrome|android).)*safari/i.test(navigator.userAgent) && /iPad|iPhone|iPod|(iPad Simulator)|(iPhone Simulator)|(iPod Simulator)/.test(window.navigator.platform);
var getBodyScrollTop = function getBodyScrollTop() {
var el = document.scrollingElement || document.documentElement;
return el.scrollTop;
};
var setBodyScrollTop = function setBodyScrollTop(top) {
var el = document.scrollingElement || document.documentElement;
el.scrollTop = top;
};
var currentScrollPosition;
var scrollTargets = [];

@@ -47,3 +34,2 @@

var scrollWidth = getScrollbarWidth();
currentScrollPosition = getBodyScrollTop();
htmlElement.style.overflow = 'hidden';

@@ -56,7 +42,2 @@ htmlElement.style.paddingRight = "".concat(scrollWidth, "px");

}
htmlElement.style.position = isIosDeviceSafari ? 'fixed' : 'static'; // iOS scrolling fix
htmlElement.style.left = '0';
htmlElement.style.right = '0';
}

@@ -69,5 +50,4 @@ } else {

if (scrollTargets.length === 0) {
htmlElement.style.paddingRight = '0';
htmlElement.style.overflow = 'visible';
htmlElement.style.position = 'static';
htmlElement.style.paddingRight = '0';

@@ -79,9 +59,2 @@ var _mastHead = document.querySelector('.c-masthead--fixed');

}
htmlElement.style.left = 'auto';
htmlElement.style.right = 'auto';
if (isIosDeviceSafari) {
setBodyScrollTop(currentScrollPosition);
}
}

@@ -88,0 +61,0 @@ }

@@ -11,3 +11,3 @@ /**

export { copyTextToClipboard } from './copyTextToClipboard';
export { default as noScroll, isIosDeviceSafari } from './noScroll';
export { default as noScroll } from './noScroll';
export { default as getCurrentBreakpoint, breakpoints, } from './getCurrentBreakpoint';

@@ -14,0 +14,0 @@ export { createUniversalPortal } from './createUniversalPortal';

@@ -30,8 +30,2 @@ "use strict";

});
Object.defineProperty(exports, "isIosDeviceSafari", {
enumerable: true,
get: function get() {
return _noScroll.isIosDeviceSafari;
}
});
Object.defineProperty(exports, "getCurrentBreakpoint", {

@@ -74,3 +68,3 @@ enumerable: true,

var _noScroll = _interopRequireWildcard(require("./noScroll"));
var _noScroll = _interopRequireDefault(require("./noScroll"));

@@ -77,0 +71,0 @@ var _getCurrentBreakpoint = _interopRequireWildcard(require("./getCurrentBreakpoint"));

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

export declare const isIosDeviceSafari: boolean | "";
declare const noScroll: (enable: boolean, uuid: string) => void;
export default noScroll;

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

});
exports.default = exports.isIosDeviceSafari = void 0;
exports.default = void 0;
var scrollbarWidth = null;

@@ -27,16 +27,2 @@

var isIosDeviceSafari = typeof window !== 'undefined' && window.navigator && window.navigator.platform && /^((?!chrome|android).)*safari/i.test(navigator.userAgent) && /iPad|iPhone|iPod|(iPad Simulator)|(iPhone Simulator)|(iPod Simulator)/.test(window.navigator.platform);
exports.isIosDeviceSafari = isIosDeviceSafari;
var getBodyScrollTop = function getBodyScrollTop() {
var el = document.scrollingElement || document.documentElement;
return el.scrollTop;
};
var setBodyScrollTop = function setBodyScrollTop(top) {
var el = document.scrollingElement || document.documentElement;
el.scrollTop = top;
};
var currentScrollPosition;
var scrollTargets = [];

@@ -55,3 +41,2 @@

var scrollWidth = getScrollbarWidth();
currentScrollPosition = getBodyScrollTop();
htmlElement.style.overflow = 'hidden';

@@ -64,7 +49,2 @@ htmlElement.style.paddingRight = "".concat(scrollWidth, "px");

}
htmlElement.style.position = isIosDeviceSafari ? 'fixed' : 'static'; // iOS scrolling fix
htmlElement.style.left = '0';
htmlElement.style.right = '0';
}

@@ -77,5 +57,4 @@ } else {

if (scrollTargets.length === 0) {
htmlElement.style.paddingRight = '0';
htmlElement.style.overflow = 'visible';
htmlElement.style.position = 'static';
htmlElement.style.paddingRight = '0';

@@ -87,9 +66,2 @@ var _mastHead = document.querySelector('.c-masthead--fixed');

}
htmlElement.style.left = 'auto';
htmlElement.style.right = 'auto';
if (isIosDeviceSafari) {
setBodyScrollTop(currentScrollPosition);
}
}

@@ -96,0 +68,0 @@ }

{
"name": "@ndla/util",
"version": "0.3.3",
"version": "0.3.4",
"description": "Collection of util functions used by NDLA",

@@ -34,3 +34,3 @@ "license": "GPL-3.0",

},
"gitHead": "84b8002661e3569d84ef1d57fc5e57cf2fe6f062"
"gitHead": "7cff2ebe74be9bafe3e18d7dfe9bea586e523044"
}
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