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

@ndla/util

Package Overview
Dependencies
Maintainers
8
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 3.1.7 to 3.1.8

21

es/cookieHandler.js

@@ -5,3 +5,2 @@ /** Client/Browser only */

};
var getCookieExpiration = function getCookieExpiration(expiration, removeCookie) {

@@ -11,3 +10,2 @@ if (expiration !== undefined) {

}
if (removeCookie) {

@@ -21,14 +19,14 @@ return 'Thu, 01 Jan 1970 00:00:01 GMT';

};
export var getCookieString = function getCookieString(_ref) {
var cookieName = _ref.cookieName,
cookieValue = _ref.cookieValue,
removeCookie = _ref.removeCookie,
lax = _ref.lax,
_ref$path = _ref.path,
path = _ref$path === void 0 ? '/' : _ref$path,
expiration = _ref.expiration;
cookieValue = _ref.cookieValue,
removeCookie = _ref.removeCookie,
lax = _ref.lax,
_ref$path = _ref.path,
path = _ref$path === void 0 ? '/' : _ref$path,
expiration = _ref.expiration;
var expires = getCookieExpiration(expiration, removeCookie);
return "".concat(cookieName, "=").concat(cookieValue, "; ").concat(expires, "; SameSite=").concat(lax ? 'Lax' : 'Strict', "; path=").concat(path);
};
/**

@@ -39,3 +37,2 @@ * Missing cookie returns `null`, Cookie without value returns `undefined` otherwise cookie value

*/
export var getCookie = function getCookie(cookieName, cookies) {

@@ -48,3 +45,2 @@ var parts = cookies.split(';').map(function (x) {

});
if (cookiePart) {

@@ -54,3 +50,2 @@ var values = cookiePart.split('=');

}
return null;

@@ -62,4 +57,4 @@ };

};
/** Client/Browser only */
export var deleteCookie = function deleteCookie(cookieName) {

@@ -66,0 +61,0 @@ setCookie({

@@ -10,7 +10,5 @@ /**

var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.body;
if (!window || !document) {
return false;
}
var textArea = document.createElement('textarea');

@@ -30,3 +28,2 @@ textArea.style.position = 'fixed';

textArea.select();
try {

@@ -33,0 +30,0 @@ var successful = document.execCommand('copy');

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

import { jsx as _jsx } from "@emotion/react/jsx-runtime";
/**

@@ -10,6 +8,8 @@ * Copyright (c) 2016-present, NDLA.

*/
// N.B This helper is intended to be used in https://github.com/ndlano/article-converter. It is not a general soultion for using portals in SSR applications.
import React from 'react';
import ReactDOM from 'react-dom';
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
var canUseDOM = function canUseDOM() {

@@ -19,3 +19,2 @@ return !!(typeof window !== 'undefined' && window.document && !window.document.hidden);

export function createUniversalPortal(children, selector) {

@@ -28,5 +27,4 @@ if (!canUseDOM()) {

}
var el = document.querySelector(selector);
return /*#__PURE__*/ReactDOM.createPortal(children, el);
}

@@ -8,6 +8,6 @@ /**

*/
var getComponentName = function getComponentName(component) {
return component.displayName || component.name || 'Component';
};
export default getComponentName;
var getCurrentBreakpoint = function getCurrentBreakpoint() {
var body = document.querySelector('body');
if (!body) {
return '';
}
return window.getComputedStyle(body, ':before').getPropertyValue('content').replace(/"/g, '');
};
export default getCurrentBreakpoint;

@@ -12,0 +9,0 @@ export var breakpoints = {

@@ -8,2 +8,3 @@ /**

*/
export { default as uuid } from './uuid';

@@ -10,0 +11,0 @@ export { default as getComponentName } from './getComponentName';

@@ -8,4 +8,5 @@ /**

*/
export function isFunction(object) {
return object && {}.toString.call(object) === '[object Function]';
}

@@ -8,12 +8,11 @@ /**

*/
var joinArrayWithConjunction = function joinArrayWithConjunction(list, _ref) {
var _ref$separator = _ref.separator,
separator = _ref$separator === void 0 ? ', ' : _ref$separator,
_ref$conjunction = _ref.conjunction,
conjunction = _ref$conjunction === void 0 ? 'og' : _ref$conjunction;
separator = _ref$separator === void 0 ? ', ' : _ref$separator,
_ref$conjunction = _ref.conjunction,
conjunction = _ref$conjunction === void 0 ? 'og' : _ref$conjunction;
if (list.length === 1) {
return list[0];
}
return list.reduce(function (currentValue, listElement, i, array) {

@@ -23,3 +22,2 @@ return currentValue + (i < array.length - 1 ? separator : conjunction) + listElement;

};
export default joinArrayWithConjunction;

@@ -8,2 +8,3 @@ /**

*/
//@ts-ignore

@@ -19,3 +20,2 @@ import { Remarkable } from 'remarkable';

markdown.inline.ruler.enable(['sub', 'sup']);
if (parser === 'caption') {

@@ -29,3 +29,2 @@ markdown.set({

}
var rendered = markdown.render(content);

@@ -32,0 +31,0 @@ var parsed = parse(rendered);

var scrollbarWidth = null;
var getScrollbarWidth = function getScrollbarWidth() {

@@ -7,3 +6,2 @@ if (scrollbarWidth) {

}
var scrollDiv = document.createElement('div');

@@ -20,12 +18,8 @@ scrollDiv.style.width = '100px';

};
var scrollTargets = [];
var noScroll = function noScroll(enable, uuid) {
var htmlElement = document.querySelector('html');
if (htmlElement === null) {
var bodyElement = document.querySelector('html > body');
if (bodyElement === null) {
return;
}
if (enable) {

@@ -35,9 +29,4 @@ if (!scrollTargets.includes(uuid)) {

var scrollWidth = getScrollbarWidth();
htmlElement.style.overflow = 'hidden';
htmlElement.style.paddingRight = "".concat(scrollWidth, "px");
var mastHead = document.querySelector('.c-masthead--fixed');
if (mastHead) {
mastHead.style.paddingRight = "".concat(scrollWidth, "px");
}
bodyElement.style.overflow = 'hidden';
bodyElement.style.marginRight = "".concat(scrollWidth, "px");
}

@@ -48,16 +37,8 @@ } else {

}
if (scrollTargets.length === 0) {
htmlElement.style.paddingRight = '0';
htmlElement.style.overflow = 'visible';
var _mastHead = document.querySelector('.c-masthead--fixed');
if (_mastHead) {
_mastHead.style.paddingRight = '0';
}
bodyElement.style.marginRight = '0';
bodyElement.style.overflow = 'visible';
}
}
};
export default noScroll;

@@ -1,16 +0,7 @@

import { jsx as _jsx } from "@emotion/react/jsx-runtime";
import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**

@@ -25,3 +16,4 @@ * Copyright (c) 2022-present, NDLA.

import { useEffect, useState } from 'react';
import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
/**

@@ -33,14 +25,11 @@ * A component that makes children not run on the server

var children = _ref.children,
_ref$fallback = _ref.fallback,
fallback = _ref$fallback === void 0 ? null : _ref$fallback;
_ref$fallback = _ref.fallback,
fallback = _ref$fallback === void 0 ? null : _ref$fallback;
var _useState = useState(false),
_useState2 = _slicedToArray(_useState, 2),
mounted = _useState2[0],
setMounted = _useState2[1];
_useState2 = _slicedToArray(_useState, 2),
mounted = _useState2[0],
setMounted = _useState2[1];
useEffect(function () {
setMounted(true);
}, []);
if (!mounted) {

@@ -51,3 +40,2 @@ return _jsx(_Fragment, {

}
return _jsx(_Fragment, {

@@ -57,3 +45,2 @@ children: children

};
export default NoSSR;

@@ -1,9 +0,4 @@

import { jsx as _jsx } from "@emotion/react/jsx-runtime";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/**

@@ -16,6 +11,8 @@ * Copyright (c) 2022-present, NDLA.

*/
import React from 'react';
import NoSSR from './NoSSR';
/** Basic HoC to wrap your component in `NoSSR`, see `NoSSR.tsx` */
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
function withNoSSR(WrappedComponent) {

@@ -30,3 +27,2 @@ var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

}
export default withNoSSR;

@@ -8,9 +8,8 @@ /**

*/
function closePrint() {
document.body.removeChild(this.__container__);
}
function setPrint() {
var _this = this;
this.contentWindow.__container__ = this;

@@ -20,3 +19,2 @@ this.contentWindow.onbeforeunload = closePrint;

this.contentWindow.focus(); // Required for IE
setTimeout(function () {

@@ -26,3 +24,2 @@ return _this.contentWindow.print();

}
export function printPage(url) {

@@ -29,0 +26,0 @@ var iframe = document.createElement('iframe');

@@ -8,2 +8,3 @@ /**

*/
// Fallback is copied from https://github.com/developit/simple-element-resize-detector

@@ -18,3 +19,2 @@ // Only added firefox support and types

element.appendChild(frame);
if (frame.contentWindow) {

@@ -25,3 +25,2 @@ frame.contentWindow.onresize = function () {

}
return function () {

@@ -31,3 +30,2 @@ frame.remove();

}
function resizeObserverWrapper(element, handler) {

@@ -41,3 +39,2 @@ // @ts-ignore ResizeObserver

var _resizeObserver;
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.disconnect();

@@ -47,2 +44,3 @@ resizeObserver = null;

}
/**

@@ -55,4 +53,2 @@ * Reports changes to the content rectangle of an HTMLElement. Uses builtin `ResizeObserver`

*/
export function resizeObserver(element, handler) {

@@ -63,4 +59,3 @@ // @ts-ignore ResizeObserver

}
return fallbackResizeObserver(element, handler);
}

@@ -1,29 +0,15 @@

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**

@@ -36,2 +22,3 @@ * Copyright (c) 2021-present, NDLA.

*/
var getAllKeys = function getAllKeys(o) {

@@ -42,7 +29,5 @@ var prev = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';

var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
value = _ref2[1];
key = _ref2[0],
value = _ref2[1];
var path = prev + (prev ? '.' : '') + key;
if (_typeof(value) === 'object' && value !== null) {

@@ -57,3 +42,2 @@ var nested = getAllKeys(value, path);

};
var getUniqueKeys = function getUniqueKeys(o) {

@@ -64,3 +48,2 @@ var allKeys = getAllKeys(o);

};
var logTable = function logTable(langs) {

@@ -75,7 +58,6 @@ var table = [];

});
}); // eslint-disable-next-line no-console
});
// eslint-disable-next-line no-console
console.table(table);
};
var getMissingLanguages = function getMissingLanguages(languages) {

@@ -100,3 +82,2 @@ var objs = languages.map(function (langObj) {

};
export var validateTranslationFiles = function validateTranslationFiles(languages, logging) {

@@ -103,0 +84,0 @@ var langs = getMissingLanguages(languages);

import { useEffect, useRef } from 'react';
var useForwardedRef = function useForwardedRef(ref) {

@@ -7,3 +6,2 @@ var innerRef = useRef(null);

if (!ref) return;
if (typeof ref === 'function') {

@@ -17,3 +15,2 @@ ref(innerRef.current);

};
export default useForwardedRef;

@@ -8,11 +8,11 @@ /**

*/
function uuid(a) {
if (a) {
return (a ^ Math.random() * 16 >> a / 4).toString(16);
} // @ts-ignore
}
// @ts-ignore
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid);
}
export default uuid;

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

});
exports.deleteCookie = exports.isValidCookie = exports.getCookie = exports.getCookieString = exports.setCookie = void 0;
exports.setCookie = exports.isValidCookie = exports.getCookieString = exports.getCookie = exports.deleteCookie = void 0;
/** Client/Browser only */

@@ -13,5 +12,3 @@ var setCookie = function setCookie(params) {

};
exports.setCookie = setCookie;
var getCookieExpiration = function getCookieExpiration(expiration, removeCookie) {

@@ -21,3 +18,2 @@ if (expiration !== undefined) {

}
if (removeCookie) {

@@ -31,14 +27,14 @@ return 'Thu, 01 Jan 1970 00:00:01 GMT';

};
var getCookieString = function getCookieString(_ref) {
var cookieName = _ref.cookieName,
cookieValue = _ref.cookieValue,
removeCookie = _ref.removeCookie,
lax = _ref.lax,
_ref$path = _ref.path,
path = _ref$path === void 0 ? '/' : _ref$path,
expiration = _ref.expiration;
cookieValue = _ref.cookieValue,
removeCookie = _ref.removeCookie,
lax = _ref.lax,
_ref$path = _ref.path,
path = _ref$path === void 0 ? '/' : _ref$path,
expiration = _ref.expiration;
var expires = getCookieExpiration(expiration, removeCookie);
return "".concat(cookieName, "=").concat(cookieValue, "; ").concat(expires, "; SameSite=").concat(lax ? 'Lax' : 'Strict', "; path=").concat(path);
};
/**

@@ -49,6 +45,3 @@ * Missing cookie returns `null`, Cookie without value returns `undefined` otherwise cookie value

*/
exports.getCookieString = getCookieString;
var getCookie = function getCookie(cookieName, cookies) {

@@ -61,3 +54,2 @@ var parts = cookies.split(';').map(function (x) {

});
if (cookiePart) {

@@ -67,8 +59,5 @@ var values = cookiePart.split('=');

}
return null;
};
exports.getCookie = getCookie;
var isValidCookie = function isValidCookie(cookieName, cookies) {

@@ -78,7 +67,5 @@ var cookie = getCookie(cookieName, cookies);

};
/** Client/Browser only */
exports.isValidCookie = isValidCookie;
var deleteCookie = function deleteCookie(cookieName) {

@@ -91,3 +78,2 @@ setCookie({

};
exports.deleteCookie = deleteCookie;

@@ -7,3 +7,2 @@ "use strict";

exports.copyTextToClipboard = copyTextToClipboard;
/**

@@ -18,7 +17,5 @@ * Copyright (c) 2017-present, NDLA.

var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.body;
if (!window || !document) {
return false;
}
var textArea = document.createElement('textarea');

@@ -38,3 +35,2 @@ textArea.style.position = 'fixed';

textArea.select();
try {

@@ -41,0 +37,0 @@ var successful = document.execCommand('copy');

@@ -7,11 +7,6 @@ "use strict";

exports.createUniversalPortal = createUniversalPortal;
var _jsxRuntime = require("@emotion/react/jsx-runtime");
var _react = _interopRequireDefault(require("react"));
var _reactDom = _interopRequireDefault(require("react-dom"));
var _jsxRuntime = require("@emotion/react/jsx-runtime");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**

@@ -24,3 +19,5 @@ * Copyright (c) 2016-present, NDLA.

*/
// N.B This helper is intended to be used in https://github.com/ndlano/article-converter. It is not a general soultion for using portals in SSR applications.
var canUseDOM = function canUseDOM() {

@@ -30,3 +27,2 @@ return !!(typeof window !== 'undefined' && window.document && !window.document.hidden);

function createUniversalPortal(children, selector) {

@@ -39,5 +35,4 @@ if (!canUseDOM()) {

}
var el = document.querySelector(selector);
return /*#__PURE__*/_reactDom["default"].createPortal(children, el);
}

@@ -7,3 +7,2 @@ "use strict";

exports["default"] = void 0;
/**

@@ -16,7 +15,7 @@ * Copyright (c) 2016-present, NDLA.

*/
var getComponentName = function getComponentName(component) {
return component.displayName || component.name || 'Component';
};
var _default = getComponentName;
exports["default"] = _default;

@@ -6,14 +6,10 @@ "use strict";

});
exports.breakpoints = exports["default"] = void 0;
exports["default"] = exports.breakpoints = void 0;
var getCurrentBreakpoint = function getCurrentBreakpoint() {
var body = document.querySelector('body');
if (!body) {
return '';
}
return window.getComputedStyle(body, ':before').getPropertyValue('content').replace(/"/g, '');
};
var _default = getCurrentBreakpoint;

@@ -20,0 +16,0 @@ exports["default"] = _default;

"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "uuid", {
Object.defineProperty(exports, "NoSSR", {
enumerable: true,
get: function get() {
return _uuid["default"];
return _NoSSR["default"];
}
});
Object.defineProperty(exports, "getComponentName", {
Object.defineProperty(exports, "breakpoints", {
enumerable: true,
get: function get() {
return _getComponentName["default"];
return _getCurrentBreakpoint.breakpoints;
}

@@ -26,60 +25,60 @@ });

});
Object.defineProperty(exports, "noScroll", {
Object.defineProperty(exports, "createUniversalPortal", {
enumerable: true,
get: function get() {
return _noScroll["default"];
return _createUniversalPortal.createUniversalPortal;
}
});
Object.defineProperty(exports, "getCurrentBreakpoint", {
Object.defineProperty(exports, "deleteCookie", {
enumerable: true,
get: function get() {
return _getCurrentBreakpoint["default"];
return _cookieHandler.deleteCookie;
}
});
Object.defineProperty(exports, "breakpoints", {
Object.defineProperty(exports, "getComponentName", {
enumerable: true,
get: function get() {
return _getCurrentBreakpoint.breakpoints;
return _getComponentName["default"];
}
});
Object.defineProperty(exports, "createUniversalPortal", {
Object.defineProperty(exports, "getCookie", {
enumerable: true,
get: function get() {
return _createUniversalPortal.createUniversalPortal;
return _cookieHandler.getCookie;
}
});
Object.defineProperty(exports, "isFunction", {
Object.defineProperty(exports, "getCurrentBreakpoint", {
enumerable: true,
get: function get() {
return _isFunction.isFunction;
return _getCurrentBreakpoint["default"];
}
});
Object.defineProperty(exports, "resizeObserver", {
Object.defineProperty(exports, "isFunction", {
enumerable: true,
get: function get() {
return _resizeObserver.resizeObserver;
return _isFunction.isFunction;
}
});
Object.defineProperty(exports, "setCookie", {
Object.defineProperty(exports, "isValidCookie", {
enumerable: true,
get: function get() {
return _cookieHandler.setCookie;
return _cookieHandler.isValidCookie;
}
});
Object.defineProperty(exports, "getCookie", {
Object.defineProperty(exports, "joinArrayWithConjunction", {
enumerable: true,
get: function get() {
return _cookieHandler.getCookie;
return _joinArrayWithConjunction["default"];
}
});
Object.defineProperty(exports, "deleteCookie", {
Object.defineProperty(exports, "noScroll", {
enumerable: true,
get: function get() {
return _cookieHandler.deleteCookie;
return _noScroll["default"];
}
});
Object.defineProperty(exports, "isValidCookie", {
Object.defineProperty(exports, "parseMarkdown", {
enumerable: true,
get: function get() {
return _cookieHandler.isValidCookie;
return _markdownHelpers.parseMarkdown;
}

@@ -93,30 +92,30 @@ });

});
Object.defineProperty(exports, "joinArrayWithConjunction", {
Object.defineProperty(exports, "resizeObserver", {
enumerable: true,
get: function get() {
return _joinArrayWithConjunction["default"];
return _resizeObserver.resizeObserver;
}
});
Object.defineProperty(exports, "parseMarkdown", {
Object.defineProperty(exports, "setCookie", {
enumerable: true,
get: function get() {
return _markdownHelpers.parseMarkdown;
return _cookieHandler.setCookie;
}
});
Object.defineProperty(exports, "validateTranslationFiles", {
Object.defineProperty(exports, "useForwardedRef", {
enumerable: true,
get: function get() {
return _translationValidation.validateTranslationFiles;
return _useForwardedRef["default"];
}
});
Object.defineProperty(exports, "useForwardedRef", {
Object.defineProperty(exports, "uuid", {
enumerable: true,
get: function get() {
return _useForwardedRef["default"];
return _uuid["default"];
}
});
Object.defineProperty(exports, "NoSSR", {
Object.defineProperty(exports, "validateTranslationFiles", {
enumerable: true,
get: function get() {
return _NoSSR["default"];
return _translationValidation.validateTranslationFiles;
}

@@ -130,39 +129,20 @@ });

});
var _uuid = _interopRequireDefault(require("./uuid"));
var _getComponentName = _interopRequireDefault(require("./getComponentName"));
var _copyTextToClipboard = require("./copyTextToClipboard");
var _noScroll = _interopRequireDefault(require("./noScroll"));
var _getCurrentBreakpoint = _interopRequireWildcard(require("./getCurrentBreakpoint"));
var _createUniversalPortal = require("./createUniversalPortal");
var _isFunction = require("./isFunction");
var _resizeObserver = require("./resizeObserver");
var _cookieHandler = require("./cookieHandler");
var _printPage = require("./printPage");
var _joinArrayWithConjunction = _interopRequireDefault(require("./joinArrayWithConjunction"));
var _markdownHelpers = require("./markdownHelpers");
var _translationValidation = require("./translationValidation");
var _useForwardedRef = _interopRequireDefault(require("./useForwardedRef"));
var _NoSSR = _interopRequireDefault(require("./nossr/NoSSR"));
var _withNoSSR = _interopRequireDefault(require("./nossr/withNoSSR"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -7,3 +7,2 @@ "use strict";

exports.isFunction = isFunction;
/**

@@ -16,4 +15,5 @@ * Copyright (c) 2017-present, NDLA.

*/
function isFunction(object) {
return object && {}.toString.call(object) === '[object Function]';
}

@@ -7,3 +7,2 @@ "use strict";

exports["default"] = void 0;
/**

@@ -16,12 +15,11 @@ * Copyright (c) 2021-present, NDLA.

*/
var joinArrayWithConjunction = function joinArrayWithConjunction(list, _ref) {
var _ref$separator = _ref.separator,
separator = _ref$separator === void 0 ? ', ' : _ref$separator,
_ref$conjunction = _ref.conjunction,
conjunction = _ref$conjunction === void 0 ? 'og' : _ref$conjunction;
separator = _ref$separator === void 0 ? ', ' : _ref$separator,
_ref$conjunction = _ref.conjunction,
conjunction = _ref$conjunction === void 0 ? 'og' : _ref$conjunction;
if (list.length === 1) {
return list[0];
}
return list.reduce(function (currentValue, listElement, i, array) {

@@ -31,4 +29,3 @@ return currentValue + (i < array.length - 1 ? separator : conjunction) + listElement;

};
var _default = joinArrayWithConjunction;
exports["default"] = _default;

@@ -7,9 +7,5 @@ "use strict";

exports.parseMarkdown = void 0;
var _remarkable = require("remarkable");
var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**

@@ -22,3 +18,5 @@ * Copyright (c) 2021-present, NDLA.

*/
//@ts-ignore
var parseMarkdown = function parseMarkdown(content) {

@@ -31,3 +29,2 @@ var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'caption';

markdown.inline.ruler.enable(['sub', 'sup']);
if (parser === 'caption') {

@@ -41,3 +38,2 @@ markdown.set({

}
var rendered = markdown.render(content);

@@ -47,3 +43,2 @@ var parsed = (0, _htmlReactParser["default"])(rendered);

};
exports.parseMarkdown = parseMarkdown;

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

var scrollbarWidth = null;
var getScrollbarWidth = function getScrollbarWidth() {

@@ -14,3 +13,2 @@ if (scrollbarWidth) {

}
var scrollDiv = document.createElement('div');

@@ -27,12 +25,8 @@ scrollDiv.style.width = '100px';

};
var scrollTargets = [];
var noScroll = function noScroll(enable, uuid) {
var htmlElement = document.querySelector('html');
if (htmlElement === null) {
var bodyElement = document.querySelector('html > body');
if (bodyElement === null) {
return;
}
if (enable) {

@@ -42,9 +36,4 @@ if (!scrollTargets.includes(uuid)) {

var scrollWidth = getScrollbarWidth();
htmlElement.style.overflow = 'hidden';
htmlElement.style.paddingRight = "".concat(scrollWidth, "px");
var mastHead = document.querySelector('.c-masthead--fixed');
if (mastHead) {
mastHead.style.paddingRight = "".concat(scrollWidth, "px");
}
bodyElement.style.overflow = 'hidden';
bodyElement.style.marginRight = "".concat(scrollWidth, "px");
}

@@ -55,17 +44,9 @@ } else {

}
if (scrollTargets.length === 0) {
htmlElement.style.paddingRight = '0';
htmlElement.style.overflow = 'visible';
var _mastHead = document.querySelector('.c-masthead--fixed');
if (_mastHead) {
_mastHead.style.paddingRight = '0';
}
bodyElement.style.marginRight = '0';
bodyElement.style.overflow = 'visible';
}
}
};
var _default = noScroll;
exports["default"] = _default;
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", {

@@ -9,23 +8,12 @@ value: true

exports["default"] = void 0;
var _react = _interopRequireWildcard(require("react"));
var _jsxRuntime = require("@emotion/react/jsx-runtime");
var _react = _interopRequireWildcard(require("react"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**

@@ -37,14 +25,11 @@ * A component that makes children not run on the server

var children = _ref.children,
_ref$fallback = _ref.fallback,
fallback = _ref$fallback === void 0 ? null : _ref$fallback;
_ref$fallback = _ref.fallback,
fallback = _ref$fallback === void 0 ? null : _ref$fallback;
var _useState = (0, _react.useState)(false),
_useState2 = _slicedToArray(_useState, 2),
mounted = _useState2[0],
setMounted = _useState2[1];
_useState2 = _slicedToArray(_useState, 2),
mounted = _useState2[0],
setMounted = _useState2[1];
(0, _react.useEffect)(function () {
setMounted(true);
}, []);
if (!mounted) {

@@ -55,3 +40,2 @@ return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {

}
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {

@@ -61,4 +45,3 @@ children: children

};
var _default = NoSSR;
exports["default"] = _default;

@@ -7,17 +7,9 @@ "use strict";

exports["default"] = void 0;
var _jsxRuntime = require("@emotion/react/jsx-runtime");
var _react = _interopRequireDefault(require("react"));
var _NoSSR = _interopRequireDefault(require("./NoSSR"));
var _jsxRuntime = require("@emotion/react/jsx-runtime");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/** Basic HoC to wrap your component in `NoSSR`, see `NoSSR.tsx` */

@@ -33,4 +25,3 @@ function withNoSSR(WrappedComponent) {

}
var _default = withNoSSR;
exports["default"] = _default;

@@ -7,3 +7,2 @@ "use strict";

exports.printPage = printPage;
/**

@@ -16,9 +15,8 @@ * Copyright (c) 2021-present, NDLA.

*/
function closePrint() {
document.body.removeChild(this.__container__);
}
function setPrint() {
var _this = this;
this.contentWindow.__container__ = this;

@@ -28,3 +26,2 @@ this.contentWindow.onbeforeunload = closePrint;

this.contentWindow.focus(); // Required for IE
setTimeout(function () {

@@ -34,3 +31,2 @@ return _this.contentWindow.print();

}
function printPage(url) {

@@ -37,0 +33,0 @@ var iframe = document.createElement('iframe');

@@ -7,3 +7,2 @@ "use strict";

exports.resizeObserver = resizeObserver;
/**

@@ -16,2 +15,3 @@ * Copyright (c) 2019-present, NDLA.

*/
// Fallback is copied from https://github.com/developit/simple-element-resize-detector

@@ -26,3 +26,2 @@ // Only added firefox support and types

element.appendChild(frame);
if (frame.contentWindow) {

@@ -33,3 +32,2 @@ frame.contentWindow.onresize = function () {

}
return function () {

@@ -39,3 +37,2 @@ frame.remove();

}
function resizeObserverWrapper(element, handler) {

@@ -49,3 +46,2 @@ // @ts-ignore ResizeObserver

var _resizeObserver;
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.disconnect();

@@ -55,2 +51,3 @@ resizeObserver = null;

}
/**

@@ -63,4 +60,2 @@ * Reports changes to the content rectangle of an HTMLElement. Uses builtin `ResizeObserver`

*/
function resizeObserver(element, handler) {

@@ -71,4 +66,3 @@ // @ts-ignore ResizeObserver

}
return fallbackResizeObserver(element, handler);
}

@@ -7,31 +7,16 @@ "use strict";

exports.validateTranslationFiles = void 0;
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**

@@ -44,2 +29,3 @@ * Copyright (c) 2021-present, NDLA.

*/
var getAllKeys = function getAllKeys(o) {

@@ -50,7 +36,5 @@ var prev = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';

var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
value = _ref2[1];
key = _ref2[0],
value = _ref2[1];
var path = prev + (prev ? '.' : '') + key;
if (_typeof(value) === 'object' && value !== null) {

@@ -65,3 +49,2 @@ var nested = getAllKeys(value, path);

};
var getUniqueKeys = function getUniqueKeys(o) {

@@ -72,3 +55,2 @@ var allKeys = getAllKeys(o);

};
var logTable = function logTable(langs) {

@@ -83,7 +65,6 @@ var table = [];

});
}); // eslint-disable-next-line no-console
});
// eslint-disable-next-line no-console
console.table(table);
};
var getMissingLanguages = function getMissingLanguages(languages) {

@@ -108,3 +89,2 @@ var objs = languages.map(function (langObj) {

};
var validateTranslationFiles = function validateTranslationFiles(languages, logging) {

@@ -118,3 +98,2 @@ var langs = getMissingLanguages(languages);

};
exports.validateTranslationFiles = validateTranslationFiles;

@@ -7,5 +7,3 @@ "use strict";

exports["default"] = void 0;
var _react = require("react");
var useForwardedRef = function useForwardedRef(ref) {

@@ -15,3 +13,2 @@ var innerRef = (0, _react.useRef)(null);

if (!ref) return;
if (typeof ref === 'function') {

@@ -25,4 +22,3 @@ ref(innerRef.current);

};
var _default = useForwardedRef;
exports["default"] = _default;

@@ -7,3 +7,2 @@ "use strict";

exports["default"] = void 0;
/**

@@ -16,12 +15,12 @@ * Copyright (c) 2016-present, NDLA.

*/
function uuid(a) {
if (a) {
return (a ^ Math.random() * 16 >> a / 4).toString(16);
} // @ts-ignore
}
// @ts-ignore
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid);
}
var _default = uuid;
exports["default"] = _default;
{
"name": "@ndla/util",
"version": "3.1.7",
"version": "3.1.8",
"description": "Collection of util functions used by NDLA",

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

},
"gitHead": "b390a25bea821cf1c53c7ef440a6c5b530bd79aa"
"gitHead": "069ef3ed8a9641137f8d4de51ab6415985bca997"
}
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