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

@nrk/core-progress

Package Overview
Dependencies
Maintainers
152
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nrk/core-progress - npm Package Compare versions

Comparing version 2.0.8 to 2.0.9

93

core-progress.cjs.js

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

/*! @nrk/core-progress v2.0.9 - Copyright (c) 2017-2022 NRK */
'use strict';

@@ -22,2 +23,5 @@

if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;

@@ -38,2 +42,5 @@ }

});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf(subClass, superClass);

@@ -43,3 +50,3 @@ }

function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);

@@ -51,11 +58,10 @@ };

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function isNativeReflectConstruct() {
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;

@@ -66,3 +72,3 @@ if (Reflect.construct.sham) return false;

try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;

@@ -75,4 +81,4 @@ } catch (e) {

function _construct(Parent, args, Class) {
if (isNativeReflectConstruct()) {
_construct = Reflect.construct;
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct.bind();
} else {

@@ -141,2 +147,4 @@ _construct = function _construct(Parent, args, Class) {

return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}

@@ -147,11 +155,30 @@

function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
var IS_BROWSER = typeof window !== 'undefined';
var IS_ANDROID = IS_BROWSER && /(android)/i.test(navigator.userAgent); // Bad, but needed
var HAS_NAVIGATOR = IS_BROWSER && typeof window.navigator !== 'undefined';
HAS_NAVIGATOR && /(android)/i.test(navigator.userAgent); // Bad, but needed
var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform)); // Mock HTMLElement for Node
HAS_NAVIGATOR && /iPad|iPhone|iPod/.test(String(navigator.platform));
// Mock HTMLElement for Node
if (!IS_BROWSER && !global.HTMLElement) {
global.HTMLElement =
/*#__PURE__*/
function () {
global.HTMLElement = /*#__PURE__*/function () {
function _class() {

@@ -161,3 +188,3 @@ _classCallCheck(this, _class);

return _class;
return _createClass(_class);
}();

@@ -177,7 +204,31 @@ }

/**
* closest
* @param {Element} element Element to traverse up from
* @param {String} selector A selector to search for matching parents or element itself
* @return {Element|null} Element which is the closest ancestor matching selector
*/
(function () {
var proto = typeof window === 'undefined' ? {} : window.Element.prototype;
var match = proto.matches || proto.msMatchesSelector || proto.webkitMatchesSelector;
return proto.closest ? function (el, css) {
return el.closest(css);
} : function (el, css) {
// IE jumps to shadow SVG DOM on clicking an SVG defined by <use>.
// If so, jump back to <use> element and traverse real DOM
if (el.correspondingUseElement) el = el.correspondingUseElement;
for (; el; el = el.parentElement) {
if (match.call(el, css)) return el;
}
return null;
};
})();
/**
* dispatchEvent - with infinite loop prevention
* @param {Element} elem The target object
* @param {String} name The source object(s)
* @param {Element} element The target object
* @param {String} name The event name
* @param {Object} detail Detail object (bubbles and cancelable is set to true)
* @return {Boolean} Whether the event was canceled
* @return {Boolean} Whether the event was canceled. Returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
*/

@@ -224,11 +275,11 @@

var CoreProgress =
/*#__PURE__*/
function (_HTMLElement) {
var CoreProgress = /*#__PURE__*/function (_HTMLElement) {
_inherits(CoreProgress, _HTMLElement);
var _super = _createSuper(CoreProgress);
function CoreProgress() {
_classCallCheck(this, CoreProgress);
return _possibleConstructorReturn(this, _getPrototypeOf(CoreProgress).apply(this, arguments));
return _super.apply(this, arguments);
}

@@ -301,4 +352,4 @@

return CoreProgress;
}(_wrapNativeSuper(HTMLElement));
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
module.exports = CoreProgress;

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

/* eslint no-self-assign: 0 */
import { addStyle, dispatchEvent, toggleAttribute } from '../utils'

@@ -2,0 +4,0 @@

@@ -0,9 +1,12 @@

/*! @nrk/core-progress v2.0.9 - Copyright (c) 2017-2022 NRK */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
typeof define === 'function' && define.amd ? define(['react'], factory) :
(global = global || self, global.CoreProgress = factory(global.React));
}(this, (function (React) { 'use strict';
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.CoreProgress = factory(global.React));
})(this, (function (React) { 'use strict';
React = React && React.hasOwnProperty('default') ? React['default'] : React;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
function _classCallCheck(instance, Constructor) {

@@ -28,2 +31,5 @@ if (!(instance instanceof Constructor)) {

if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;

@@ -44,2 +50,5 @@ }

});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf(subClass, superClass);

@@ -49,3 +58,3 @@ }

function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);

@@ -57,11 +66,10 @@ };

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function isNativeReflectConstruct() {
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;

@@ -72,3 +80,3 @@ if (Reflect.construct.sham) return false;

try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;

@@ -81,4 +89,4 @@ } catch (e) {

function _construct(Parent, args, Class) {
if (isNativeReflectConstruct()) {
_construct = Reflect.construct;
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct.bind();
} else {

@@ -147,2 +155,4 @@ _construct = function _construct(Parent, args, Class) {

return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}

@@ -153,11 +163,30 @@

function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
var IS_BROWSER = typeof window !== 'undefined';
var IS_ANDROID = IS_BROWSER && /(android)/i.test(navigator.userAgent); // Bad, but needed
var HAS_NAVIGATOR = IS_BROWSER && typeof window.navigator !== 'undefined';
HAS_NAVIGATOR && /(android)/i.test(navigator.userAgent); // Bad, but needed
var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform)); // Mock HTMLElement for Node
HAS_NAVIGATOR && /iPad|iPhone|iPod/.test(String(navigator.platform));
// Mock HTMLElement for Node
if (!IS_BROWSER && !global.HTMLElement) {
global.HTMLElement =
/*#__PURE__*/
function () {
global.HTMLElement = /*#__PURE__*/function () {
function _class() {

@@ -167,3 +196,3 @@ _classCallCheck(this, _class);

return _class;
return _createClass(_class);
}();

@@ -183,7 +212,31 @@ }

/**
* closest
* @param {Element} element Element to traverse up from
* @param {String} selector A selector to search for matching parents or element itself
* @return {Element|null} Element which is the closest ancestor matching selector
*/
(function () {
var proto = typeof window === 'undefined' ? {} : window.Element.prototype;
var match = proto.matches || proto.msMatchesSelector || proto.webkitMatchesSelector;
return proto.closest ? function (el, css) {
return el.closest(css);
} : function (el, css) {
// IE jumps to shadow SVG DOM on clicking an SVG defined by <use>.
// If so, jump back to <use> element and traverse real DOM
if (el.correspondingUseElement) el = el.correspondingUseElement;
for (; el; el = el.parentElement) {
if (match.call(el, css)) return el;
}
return null;
};
})();
/**
* dispatchEvent - with infinite loop prevention
* @param {Element} elem The target object
* @param {String} name The source object(s)
* @param {Element} element The target object
* @param {String} name The event name
* @param {Object} detail Detail object (bubbles and cancelable is set to true)
* @return {Boolean} Whether the event was canceled
* @return {Boolean} Whether the event was canceled. Returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
*/

@@ -230,11 +283,11 @@

var CoreProgress =
/*#__PURE__*/
function (_HTMLElement) {
var CoreProgress = /*#__PURE__*/function (_HTMLElement) {
_inherits(CoreProgress, _HTMLElement);
var _super = _createSuper(CoreProgress);
function CoreProgress() {
_classCallCheck(this, CoreProgress);
return _possibleConstructorReturn(this, _getPrototypeOf(CoreProgress).apply(this, arguments));
return _super.apply(this, arguments);
}

@@ -307,5 +360,5 @@

return CoreProgress;
}(_wrapNativeSuper(HTMLElement));
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
var version = "2.0.8";
var version = "2.0.9";

@@ -365,99 +418,96 @@ /**

var tagName = (dashCase + "-" + (options.suffix || 'react')).replace(/\W+/g, '-').toLowerCase();
return (
/*@__PURE__*/
function (superclass) {
function anonymous(props) {
var this$1 = this;
superclass.call(this, props); // Register ref prop for accessing custom element https://reactjs.org/docs/refs-and-the-dom.html#callback-refs
return /*@__PURE__*/function (superclass) {
function anonymous(props) {
var this$1$1 = this;
superclass.call(this, props); // Register ref prop for accessing custom element https://reactjs.org/docs/refs-and-the-dom.html#callback-refs
this.ref = function (el) {
if (typeof this$1.props.forwardRef === 'function') {
this$1.props.forwardRef(el);
} else if (this$1.props.forwardRef) {
this$1.props.forwardRef.current = el;
}
this.ref = function (el) {
if (typeof this$1$1.props.forwardRef === 'function') {
this$1$1.props.forwardRef(el);
} else if (this$1$1.props.forwardRef) {
this$1$1.props.forwardRef.current = el;
}
return this$1.el = el;
}; // Register event handler on component for each custom event
return this$1$1.el = el;
}; // Register event handler on component for each custom event
Object.keys(eventMap).forEach(function (eventName) {
var onEventName = eventMap[eventName];
Object.keys(eventMap).forEach(function (eventName) {
var onEventName = eventMap[eventName];
this$1[eventName] = function (event) {
if (this$1.props[onEventName] && closest(event.target, this$1.el.nodeName) === this$1.el) {
this$1.props[onEventName](event);
}
};
});
}
this$1$1[eventName] = function (event) {
if (this$1$1.props[onEventName] && closest(event.target, this$1$1.el.nodeName) === this$1$1.el) {
this$1$1.props[onEventName](event);
}
};
});
}
if (superclass) anonymous.__proto__ = superclass;
anonymous.prototype = Object.create(superclass && superclass.prototype);
anonymous.prototype.constructor = anonymous;
if (superclass) anonymous.__proto__ = superclass;
anonymous.prototype = Object.create(superclass && superclass.prototype);
anonymous.prototype.constructor = anonymous;
anonymous.prototype.componentDidMount = function componentDidMount() {
var this$1 = this; // Run connectedCallback() after React componentDidMount() to allow React hydration to run first
anonymous.prototype.componentDidMount = function componentDidMount() {
var this$1$1 = this; // Run connectedCallback() after React componentDidMount() to allow React hydration to run first
if (!window.customElements.get(tagName)) {
window.customElements.define(tagName, elementClass);
} // Populate properties on custom element
if (!window.customElements.get(tagName)) {
window.customElements.define(tagName, elementClass);
} // Populate properties on custom element
customProps.forEach(function (propName) {
if (propName in this$1.props) {
this$1.el[propName] = this$1.props[propName];
}
}); // Register events on custom element
customProps.forEach(function (propName) {
if (propName in this$1$1.props) {
this$1$1.el[propName] = this$1$1.props[propName];
}
}); // Register events on custom element
customEvents.forEach(function (eventName) {
this$1.el.addEventListener(eventName, this$1[eventName]);
});
};
customEvents.forEach(function (eventName) {
this$1$1.el.addEventListener(eventName, this$1$1[eventName]);
});
};
anonymous.prototype.componentDidUpdate = function componentDidUpdate(prev) {
var this$1 = this; // Sync prop changes to custom element
anonymous.prototype.componentDidUpdate = function componentDidUpdate(prev) {
var this$1$1 = this; // Sync prop changes to custom element
customProps.forEach(function (propName) {
if (prev[propName] !== this$1.props[propName]) {
this$1.el[propName] = this$1.props[propName];
}
});
};
customProps.forEach(function (propName) {
if (prev[propName] !== this$1$1.props[propName]) {
this$1$1.el[propName] = this$1$1.props[propName];
}
});
};
anonymous.prototype.componentWillUnmount = function componentWillUnmount() {
var this$1 = this; // Remove event handlers on custom element on unmount
anonymous.prototype.componentWillUnmount = function componentWillUnmount() {
var this$1$1 = this; // Remove event handlers on custom element on unmount
customEvents.forEach(function (eventName) {
this$1.el.removeEventListener(eventName, this$1[eventName]);
});
};
customEvents.forEach(function (eventName) {
this$1$1.el.removeEventListener(eventName, this$1$1[eventName]);
});
};
anonymous.prototype.render = function render() {
var this$1 = this; // Convert React props to CustomElement props https://github.com/facebook/react/issues/12810
anonymous.prototype.render = function render() {
var this$1$1 = this; // Convert React props to CustomElement props https://github.com/facebook/react/issues/12810
return React.createElement(tagName, Object.keys(this.props).reduce(function (thisProps, propName) {
if (skipProps.indexOf(propName) === -1) {
// Do not render customEvents and custom props as attributes
if (propName === 'className') {
thisProps["class"] = this$1.props[propName];
} // Fixes className for custom elements
else if (this$1.props[propName] === true) {
thisProps[propName] = '';
} // Fixes boolean attributes
else if (this$1.props[propName] !== false) {
thisProps[propName] = this$1.props[propName];
} // Pass only truthy, non-function props
return React__default["default"].createElement(tagName, Object.keys(this.props).reduce(function (thisProps, propName) {
if (skipProps.indexOf(propName) === -1) {
// Do not render customEvents and custom props as attributes
if (propName === 'className') {
thisProps["class"] = this$1$1.props[propName];
} // Fixes className for custom elements
else if (this$1$1.props[propName] === true) {
thisProps[propName] = '';
} // Fixes boolean attributes
else if (this$1$1.props[propName] !== false) {
thisProps[propName] = this$1$1.props[propName];
} // Pass only truthy, non-function props
}
}
return thisProps;
}, {
ref: this.ref
}));
};
return thisProps;
}, {
ref: this.ref
}));
};
return anonymous;
}(React.Component)
);
return anonymous;
}(React__default["default"].Component);
}

@@ -472,3 +522,3 @@

})));
}));
//# sourceMappingURL=core-progress.jsx.js.map

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

/*! @nrk/core-progress v2.0.8 - Copyright (c) 2017-2019 NRK */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).coreProgress=e()}(this,function(){"use strict";function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t,e,n){return(u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&o(i,n.prototype),i}).apply(null,arguments)}function a(t){var n="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||!function(t){return-1!==Function.toString.call(t).indexOf("[native code]")}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return u(t,arguments,i(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),o(e,t)})(t)}function n(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}var t="undefined"!=typeof window;t&&/(android)/i.test(navigator.userAgent),t&&/iPad|iPhone|iPod/.test(String(navigator.platform));return t||global.HTMLElement||(global.HTMLElement=function(){return function t(){e(this,t)}}()),function(){function t(){return e(this,t),n(this,i(t).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}(t,a(HTMLElement)),function(t,e,n){e&&r(t.prototype,e),n&&r(t,n)}(t,[{key:"connectedCallback",value:function(){this.setAttribute("role","img"),this.setAttribute("aria-label",this.getAttribute("aria-label")||"0%"),this.type=this.type,function(t,e){var n="style-".concat(t.toLowerCase()),r=e.replace(/\/\*[^!][^*]*\*\//g,"").replace(/\s*(^|[:;,{}]|$)\s*/g,"$1");document.getElementById(n)||document.head.insertAdjacentHTML("afterbegin",'<style id="'.concat(n,'">').concat(r,"</style>"))}(this.nodeName,"".concat(this.nodeName,"{display:block;fill:none;stroke-width:15}"))}},{key:"attributeChangedCallback",value:function(t,e,n){var r=this.parentElement&&"type"===t&&"radial"===n==!this.querySelector("svg"),i=this.indeterminate?100:this.percentage;this.setAttribute("aria-label",this.indeterminate||"".concat(i,"%")),function(t,e,n){var r=2<arguments.length&&void 0!==n?n:!this.hasAttribute(e);!r===t.hasAttribute(e)&&t[r?"setAttribute":"removeAttribute"](e,"")}(this,"indeterminate",this.indeterminate),"linear"===this.type&&(this.style.width="".concat(i,"%")),"radial"===this.type&&(this.style.strokeDashoffset=Math.round((100-i)*Math.PI)),r&&(this.innerHTML="radial"===n?'<svg style="display:block;overflow:hidden;border-radius:100%" width="100%" viewBox="0 0 100 100"><circle cx="50" cy="50" r="50" stroke-dashoffset="0"/><circle cx="50" cy="50" r="50" stroke="currentColor" stroke-dasharray="314.159" transform="rotate(-90 50 50)"/></svg>':""),"value"===t&&Number(n)!==Number(e)&&function(t,e,n){var r,i=2<arguments.length&&void 0!==n?n:{},o="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[o])return;t[o]=!0,"function"==typeof window.CustomEvent?r=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:i}):(r=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i);var u=t.dispatchEvent(r);t[o]=null}(this,"change")}},{key:"indeterminate",get:function(){return isNaN(parseFloat(this.getAttribute("value")))&&this.getAttribute("value")}},{key:"percentage",get:function(){return Math.round(this.value/this.max*100)||0}},{key:"value",get:function(){return this.indeterminate||Number(this.getAttribute("value"))},set:function(t){this.setAttribute("value",t)}},{key:"max",get:function(){return Number(this.getAttribute("max"))||1},set:function(t){this.setAttribute("max",t)}},{key:"type",get:function(){return this.getAttribute("type")||"linear"},set:function(t){this.setAttribute("type",t)}}],[{key:"observedAttributes",get:function(){return["type","value","max"]}}]),t}()}),window.customElements.define("core-progress",coreProgress);
/*! @nrk/core-progress v2.0.9 - Copyright (c) 2017-2022 NRK */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).coreProgress=e()}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(t){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},r(t)}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function u(t,e,n){return u=o()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&i(o,n.prototype),o},u.apply(null,arguments)}function a(t){var e="function"==typeof Map?new Map:void 0;return a=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,o)}function o(){return u(t,arguments,r(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),i(o,t)},a(t)}function c(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}var s,l="undefined"!=typeof window,f=l&&void 0!==window.navigator;f&&/(android)/i.test(navigator.userAgent),f&&/iPad|iPhone|iPod/.test(String(navigator.platform)),l||global.HTMLElement||(global.HTMLElement=function(){return n((function e(){t(this,e)}))}()),s="undefined"==typeof window?{}:window.Element.prototype,s.matches||s.msMatchesSelector||s.webkitMatchesSelector,s.closest;var p=function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}(l,e);var u,a,s=(u=l,a=o(),function(){var t,e=r(u);if(a){var n=r(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return c(this,t)});function l(){return t(this,l),s.apply(this,arguments)}return n(l,[{key:"connectedCallback",value:function(){var t,e,n,r;this.setAttribute("role","img"),this.setAttribute("aria-label",this.getAttribute("aria-label")||"0%"),this.type=this.type,t=this.nodeName,e="".concat(this.nodeName,"{display:block;fill:none;stroke-width:15}"),n="style-".concat(t.toLowerCase()),r=e.replace(/\/\*[^!][^*]*\*\//g,"").replace(/\s*(^|[:;,{}]|$)\s*/g,"$1"),document.getElementById(n)||document.head.insertAdjacentHTML("afterbegin",'<style id="'.concat(n,'">').concat(r,"</style>"))}},{key:"attributeChangedCallback",value:function(t,e,n){var r=this.parentElement&&"type"===t&&"radial"===n==!this.querySelector("svg"),i=this.indeterminate?100:this.percentage;this.setAttribute("aria-label",this.indeterminate||"".concat(i,"%")),function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:!this.hasAttribute(e);!n===t.hasAttribute(e)&&t[n?"setAttribute":"removeAttribute"](e,"")}(this,"indeterminate",this.indeterminate),"linear"===this.type&&(this.style.width="".concat(i,"%")),"radial"===this.type&&(this.style.strokeDashoffset=Math.round((100-i)*Math.PI)),r&&(this.innerHTML="radial"===n?'<svg style="display:block;overflow:hidden;border-radius:100%" width="100%" viewBox="0 0 100 100"><circle cx="50" cy="50" r="50" stroke-dashoffset="0"/><circle cx="50" cy="50" r="50" stroke="currentColor" stroke-dasharray="314.159" transform="rotate(-90 50 50)"/></svg>':""),"value"===t&&Number(n)!==Number(e)&&function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[i])return!0;t[i]=!0,"function"==typeof window.CustomEvent?n=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,r);var o=t.dispatchEvent(n);t[i]=null}(this,"change")}},{key:"indeterminate",get:function(){return isNaN(parseFloat(this.getAttribute("value")))&&this.getAttribute("value")}},{key:"percentage",get:function(){return Math.round(this.value/this.max*100)||0}},{key:"value",get:function(){return this.indeterminate||Number(this.getAttribute("value"))},set:function(t){this.setAttribute("value",t)}},{key:"max",get:function(){return Number(this.getAttribute("max"))||1},set:function(t){this.setAttribute("max",t)}},{key:"type",get:function(){return this.getAttribute("type")||"linear"},set:function(t){this.setAttribute("type",t)}}],[{key:"observedAttributes",get:function(){return["type","value","max"]}}]),l}(a(HTMLElement));return p})),window.customElements.define("core-progress",coreProgress);
//# sourceMappingURL=core-progress.min.js.map

@@ -0,8 +1,393 @@

/*! @nrk/core-progress v2.0.9 - Copyright (c) 2017-2022 NRK */
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var fs = require('fs');
var path = require('path');
var fs = _interopDefault(require('fs'));
var path = _interopDefault(require('path'));
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
function _regeneratorRuntime() {
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
_regeneratorRuntime = function () {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function (obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function (innerFn, self, context) {
var state = "suspendedStart";
return function (method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function () {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function (method) {
define(prototype, method, function (arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
invoke("next", value, resolve, reject);
}, function (err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
result.value = unwrapped, resolve(result);
}, function (error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function (method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function (resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function (genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function (arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
return this;
}), define(Gp, "toString", function () {
return "[object Generator]";
}), exports.keys = function (object) {
var keys = [];
for (var key in object) keys.push(key);
return keys.reverse(), function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function (skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
},
stop: function () {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function (exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function (type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function (record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function (finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
catch: function (tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function (iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function prop(selector, name) {

@@ -19,7 +404,7 @@ return browser.executeScript(function (selector, name) {

var coreProgress = fs.readFileSync(path.resolve(__dirname, 'core-progress.min.js'), 'utf-8');
var customElements = fs.readFileSync(require.resolve('@webcomponents/custom-elements'), 'utf-8');
var coreProgress = fs__default["default"].readFileSync(path__default["default"].resolve(__dirname, 'core-progress.min.js'), 'utf-8');
var customElements = fs__default["default"].readFileSync(require.resolve('@webcomponents/custom-elements'), 'utf-8');
describe('core-progress', function () {
beforeEach(function _callee() {
return regeneratorRuntime.async(function _callee$(_context) {
beforeEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {

@@ -29,11 +414,11 @@ switch (_context.prev = _context.next) {

_context.next = 2;
return regeneratorRuntime.awrap(browser.refresh());
return browser.refresh();
case 2:
_context.next = 4;
return regeneratorRuntime.awrap(browser.executeScript(customElements));
return browser.executeScript(customElements);
case 4:
_context.next = 6;
return regeneratorRuntime.awrap(browser.executeScript(coreProgress));
return browser.executeScript(coreProgress);

@@ -45,6 +430,6 @@ case 6:

}
});
});
it('sets up properties', function _callee2() {
return regeneratorRuntime.async(function _callee2$(_context2) {
}, _callee);
})));
it('sets up properties', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) {

@@ -54,21 +439,21 @@ switch (_context2.prev = _context2.next) {

_context2.next = 2;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
document.body.innerHTML = "\n <core-progress></core-progress>\n ";
}));
});
case 2:
_context2.next = 4;
return regeneratorRuntime.awrap(expect(prop('core-progress', 'type')).toEqual('linear'));
return expect(prop('core-progress', 'type')).toEqual('linear');
case 4:
_context2.next = 6;
return regeneratorRuntime.awrap(expect(prop('core-progress', 'value')).toEqual('0'));
return expect(prop('core-progress', 'value')).toEqual('0');
case 6:
_context2.next = 8;
return regeneratorRuntime.awrap(expect(attr('core-progress', 'role')).toEqual('img'));
return expect(attr('core-progress', 'role')).toEqual('img');
case 8:
_context2.next = 10;
return regeneratorRuntime.awrap(expect(attr('core-progress', 'aria-label')).toEqual('0%'));
return expect(attr('core-progress', 'aria-label')).toEqual('0%');

@@ -80,6 +465,6 @@ case 10:

}
});
});
it('updates label from value', function _callee3() {
return regeneratorRuntime.async(function _callee3$(_context3) {
}, _callee2);
})));
it('updates label from value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
while (1) {

@@ -89,29 +474,29 @@ switch (_context3.prev = _context3.next) {

_context3.next = 2;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
document.body.innerHTML = "\n <core-progress value=\"0.2\"></core-progress>\n ";
}));
});
case 2:
_context3.next = 4;
return regeneratorRuntime.awrap(expect(attr('core-progress', 'aria-label')).toEqual('20%'));
return expect(attr('core-progress', 'aria-label')).toEqual('20%');
case 4:
_context3.next = 6;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
return document.querySelector('core-progress').value = 0;
}));
});
case 6:
_context3.next = 8;
return regeneratorRuntime.awrap(expect(attr('core-progress', 'aria-label')).toEqual('0%'));
return expect(attr('core-progress', 'aria-label')).toEqual('0%');
case 8:
_context3.next = 10;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
return document.querySelector('core-progress').value = 1;
}));
});
case 10:
_context3.next = 12;
return regeneratorRuntime.awrap(expect(attr('core-progress', 'aria-label')).toEqual('100%'));
return expect(attr('core-progress', 'aria-label')).toEqual('100%');

@@ -123,6 +508,6 @@ case 12:

}
});
});
it('updates label from value as radial', function _callee4() {
return regeneratorRuntime.async(function _callee4$(_context4) {
}, _callee3);
})));
it('updates label from value as radial', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
while (1) {

@@ -132,29 +517,29 @@ switch (_context4.prev = _context4.next) {

_context4.next = 2;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
document.body.innerHTML = "\n <core-progress value=\"0.2\" type=\"radial\"></core-progress>\n ";
}));
});
case 2:
_context4.next = 4;
return regeneratorRuntime.awrap(expect(attr('core-progress', 'aria-label')).toEqual('20%'));
return expect(attr('core-progress', 'aria-label')).toEqual('20%');
case 4:
_context4.next = 6;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
return document.querySelector('core-progress').value = 0;
}));
});
case 6:
_context4.next = 8;
return regeneratorRuntime.awrap(expect(attr('core-progress', 'aria-label')).toEqual('0%'));
return expect(attr('core-progress', 'aria-label')).toEqual('0%');
case 8:
_context4.next = 10;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
return document.querySelector('core-progress').value = 1;
}));
});
case 10:
_context4.next = 12;
return regeneratorRuntime.awrap(expect(attr('core-progress', 'aria-label')).toEqual('100%'));
return expect(attr('core-progress', 'aria-label')).toEqual('100%');

@@ -166,6 +551,6 @@ case 12:

}
});
});
it('updates label from indeterminate value', function _callee5() {
return regeneratorRuntime.async(function _callee5$(_context5) {
}, _callee4);
})));
it('updates label from indeterminate value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
while (1) {

@@ -175,9 +560,9 @@ switch (_context5.prev = _context5.next) {

_context5.next = 2;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
document.body.innerHTML = "\n <core-progress value=\"Loading...\"></core-progress>\n ";
}));
});
case 2:
_context5.next = 4;
return regeneratorRuntime.awrap(expect(attr('core-progress', 'aria-label')).toEqual('Loading...'));
return expect(attr('core-progress', 'aria-label')).toEqual('Loading...');

@@ -189,6 +574,6 @@ case 4:

}
});
});
it('calculates percentage relative to max', function _callee6() {
return regeneratorRuntime.async(function _callee6$(_context6) {
}, _callee5);
})));
it('calculates percentage relative to max', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
while (1) {

@@ -198,29 +583,29 @@ switch (_context6.prev = _context6.next) {

_context6.next = 2;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
document.body.innerHTML = "\n <core-progress value=\"0.5\"></core-progress>\n ";
}));
});
case 2:
_context6.next = 4;
return regeneratorRuntime.awrap(expect(attr('core-progress', 'aria-label')).toEqual('50%'));
return expect(attr('core-progress', 'aria-label')).toEqual('50%');
case 4:
_context6.next = 6;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
return document.querySelector('core-progress').max = 10;
}));
});
case 6:
_context6.next = 8;
return regeneratorRuntime.awrap(expect(attr('core-progress', 'aria-label')).toEqual('5%'));
return expect(attr('core-progress', 'aria-label')).toEqual('5%');
case 8:
_context6.next = 10;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
return document.querySelector('core-progress').max = 100;
}));
});
case 10:
_context6.next = 12;
return regeneratorRuntime.awrap(expect(attr('core-progress', 'aria-label')).toEqual('1%'));
return expect(attr('core-progress', 'aria-label')).toEqual('1%');

@@ -232,6 +617,6 @@ case 12:

}
});
});
it('does not trigger change event on max', function _callee7() {
return regeneratorRuntime.async(function _callee7$(_context7) {
}, _callee6);
})));
it('does not trigger change event on max', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
while (1) {

@@ -241,3 +626,3 @@ switch (_context7.prev = _context7.next) {

_context7.next = 2;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
document.body.innerHTML = "\n <core-progress></core-progress>\n ";

@@ -248,9 +633,9 @@ document.addEventListener('change', function () {

document.querySelector('core-progress').max = 2;
}));
});
case 2:
_context7.next = 4;
return regeneratorRuntime.awrap(expect(browser.executeScript(function () {
return expect(browser.executeScript(function () {
return window.triggered;
})).toBeFalsy());
})).toBeFalsy();

@@ -262,6 +647,6 @@ case 4:

}
});
});
it('triggers change event on value', function _callee8() {
return regeneratorRuntime.async(function _callee8$(_context8) {
}, _callee7);
})));
it('triggers change event on value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
while (1) {

@@ -271,3 +656,3 @@ switch (_context8.prev = _context8.next) {

_context8.next = 2;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
document.body.innerHTML = "\n <core-progress></core-progress>\n ";

@@ -278,9 +663,9 @@ document.addEventListener('change', function () {

document.querySelector('core-progress').value = 2;
}));
});
case 2:
_context8.next = 4;
return regeneratorRuntime.awrap(expect(browser.executeScript(function () {
return expect(browser.executeScript(function () {
return window.triggered;
})).toBeTruthy());
})).toBeTruthy();

@@ -292,6 +677,6 @@ case 4:

}
});
});
it('triggers change event on indeterminate value', function _callee9() {
return regeneratorRuntime.async(function _callee9$(_context9) {
}, _callee8);
})));
it('triggers change event on indeterminate value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
while (1) {

@@ -301,3 +686,3 @@ switch (_context9.prev = _context9.next) {

_context9.next = 2;
return regeneratorRuntime.awrap(browser.executeScript(function () {
return browser.executeScript(function () {
document.body.innerHTML = "\n <core-progress></core-progress>\n ";

@@ -308,9 +693,9 @@ document.addEventListener('change', function () {

document.querySelector('core-progress').value = 'Loading...';
}));
});
case 2:
_context9.next = 4;
return regeneratorRuntime.awrap(expect(browser.executeScript(function () {
return expect(browser.executeScript(function () {
return window.triggered;
})).toBeTruthy());
})).toBeTruthy();

@@ -322,4 +707,4 @@ case 4:

}
});
});
}, _callee9);
})));
});

@@ -0,7 +1,10 @@

/*! @nrk/core-progress v2.0.9 - Copyright (c) 2017-2022 NRK */
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var React = require('react');
var React = _interopDefault(require('react'));
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
function _classCallCheck(instance, Constructor) {

@@ -26,2 +29,5 @@ if (!(instance instanceof Constructor)) {

if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;

@@ -42,2 +48,5 @@ }

});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf(subClass, superClass);

@@ -47,3 +56,3 @@ }

function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);

@@ -55,11 +64,10 @@ };

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function isNativeReflectConstruct() {
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;

@@ -70,3 +78,3 @@ if (Reflect.construct.sham) return false;

try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;

@@ -79,4 +87,4 @@ } catch (e) {

function _construct(Parent, args, Class) {
if (isNativeReflectConstruct()) {
_construct = Reflect.construct;
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct.bind();
} else {

@@ -145,2 +153,4 @@ _construct = function _construct(Parent, args, Class) {

return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}

@@ -151,11 +161,30 @@

function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
var IS_BROWSER = typeof window !== 'undefined';
var IS_ANDROID = IS_BROWSER && /(android)/i.test(navigator.userAgent); // Bad, but needed
var HAS_NAVIGATOR = IS_BROWSER && typeof window.navigator !== 'undefined';
HAS_NAVIGATOR && /(android)/i.test(navigator.userAgent); // Bad, but needed
var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform)); // Mock HTMLElement for Node
HAS_NAVIGATOR && /iPad|iPhone|iPod/.test(String(navigator.platform));
// Mock HTMLElement for Node
if (!IS_BROWSER && !global.HTMLElement) {
global.HTMLElement =
/*#__PURE__*/
function () {
global.HTMLElement = /*#__PURE__*/function () {
function _class() {

@@ -165,3 +194,3 @@ _classCallCheck(this, _class);

return _class;
return _createClass(_class);
}();

@@ -181,7 +210,31 @@ }

/**
* closest
* @param {Element} element Element to traverse up from
* @param {String} selector A selector to search for matching parents or element itself
* @return {Element|null} Element which is the closest ancestor matching selector
*/
(function () {
var proto = typeof window === 'undefined' ? {} : window.Element.prototype;
var match = proto.matches || proto.msMatchesSelector || proto.webkitMatchesSelector;
return proto.closest ? function (el, css) {
return el.closest(css);
} : function (el, css) {
// IE jumps to shadow SVG DOM on clicking an SVG defined by <use>.
// If so, jump back to <use> element and traverse real DOM
if (el.correspondingUseElement) el = el.correspondingUseElement;
for (; el; el = el.parentElement) {
if (match.call(el, css)) return el;
}
return null;
};
})();
/**
* dispatchEvent - with infinite loop prevention
* @param {Element} elem The target object
* @param {String} name The source object(s)
* @param {Element} element The target object
* @param {String} name The event name
* @param {Object} detail Detail object (bubbles and cancelable is set to true)
* @return {Boolean} Whether the event was canceled
* @return {Boolean} Whether the event was canceled. Returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
*/

@@ -228,11 +281,11 @@

var CoreProgress =
/*#__PURE__*/
function (_HTMLElement) {
var CoreProgress = /*#__PURE__*/function (_HTMLElement) {
_inherits(CoreProgress, _HTMLElement);
var _super = _createSuper(CoreProgress);
function CoreProgress() {
_classCallCheck(this, CoreProgress);
return _possibleConstructorReturn(this, _getPrototypeOf(CoreProgress).apply(this, arguments));
return _super.apply(this, arguments);
}

@@ -305,5 +358,5 @@

return CoreProgress;
}(_wrapNativeSuper(HTMLElement));
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
var version = "2.0.8";
var version = "2.0.9";

@@ -363,99 +416,96 @@ /**

var tagName = (dashCase + "-" + (options.suffix || 'react')).replace(/\W+/g, '-').toLowerCase();
return (
/*@__PURE__*/
function (superclass) {
function anonymous(props) {
var this$1 = this;
superclass.call(this, props); // Register ref prop for accessing custom element https://reactjs.org/docs/refs-and-the-dom.html#callback-refs
return /*@__PURE__*/function (superclass) {
function anonymous(props) {
var this$1$1 = this;
superclass.call(this, props); // Register ref prop for accessing custom element https://reactjs.org/docs/refs-and-the-dom.html#callback-refs
this.ref = function (el) {
if (typeof this$1.props.forwardRef === 'function') {
this$1.props.forwardRef(el);
} else if (this$1.props.forwardRef) {
this$1.props.forwardRef.current = el;
}
this.ref = function (el) {
if (typeof this$1$1.props.forwardRef === 'function') {
this$1$1.props.forwardRef(el);
} else if (this$1$1.props.forwardRef) {
this$1$1.props.forwardRef.current = el;
}
return this$1.el = el;
}; // Register event handler on component for each custom event
return this$1$1.el = el;
}; // Register event handler on component for each custom event
Object.keys(eventMap).forEach(function (eventName) {
var onEventName = eventMap[eventName];
Object.keys(eventMap).forEach(function (eventName) {
var onEventName = eventMap[eventName];
this$1[eventName] = function (event) {
if (this$1.props[onEventName] && closest(event.target, this$1.el.nodeName) === this$1.el) {
this$1.props[onEventName](event);
}
};
});
}
this$1$1[eventName] = function (event) {
if (this$1$1.props[onEventName] && closest(event.target, this$1$1.el.nodeName) === this$1$1.el) {
this$1$1.props[onEventName](event);
}
};
});
}
if (superclass) anonymous.__proto__ = superclass;
anonymous.prototype = Object.create(superclass && superclass.prototype);
anonymous.prototype.constructor = anonymous;
if (superclass) anonymous.__proto__ = superclass;
anonymous.prototype = Object.create(superclass && superclass.prototype);
anonymous.prototype.constructor = anonymous;
anonymous.prototype.componentDidMount = function componentDidMount() {
var this$1 = this; // Run connectedCallback() after React componentDidMount() to allow React hydration to run first
anonymous.prototype.componentDidMount = function componentDidMount() {
var this$1$1 = this; // Run connectedCallback() after React componentDidMount() to allow React hydration to run first
if (!window.customElements.get(tagName)) {
window.customElements.define(tagName, elementClass);
} // Populate properties on custom element
if (!window.customElements.get(tagName)) {
window.customElements.define(tagName, elementClass);
} // Populate properties on custom element
customProps.forEach(function (propName) {
if (propName in this$1.props) {
this$1.el[propName] = this$1.props[propName];
}
}); // Register events on custom element
customProps.forEach(function (propName) {
if (propName in this$1$1.props) {
this$1$1.el[propName] = this$1$1.props[propName];
}
}); // Register events on custom element
customEvents.forEach(function (eventName) {
this$1.el.addEventListener(eventName, this$1[eventName]);
});
};
customEvents.forEach(function (eventName) {
this$1$1.el.addEventListener(eventName, this$1$1[eventName]);
});
};
anonymous.prototype.componentDidUpdate = function componentDidUpdate(prev) {
var this$1 = this; // Sync prop changes to custom element
anonymous.prototype.componentDidUpdate = function componentDidUpdate(prev) {
var this$1$1 = this; // Sync prop changes to custom element
customProps.forEach(function (propName) {
if (prev[propName] !== this$1.props[propName]) {
this$1.el[propName] = this$1.props[propName];
}
});
};
customProps.forEach(function (propName) {
if (prev[propName] !== this$1$1.props[propName]) {
this$1$1.el[propName] = this$1$1.props[propName];
}
});
};
anonymous.prototype.componentWillUnmount = function componentWillUnmount() {
var this$1 = this; // Remove event handlers on custom element on unmount
anonymous.prototype.componentWillUnmount = function componentWillUnmount() {
var this$1$1 = this; // Remove event handlers on custom element on unmount
customEvents.forEach(function (eventName) {
this$1.el.removeEventListener(eventName, this$1[eventName]);
});
};
customEvents.forEach(function (eventName) {
this$1$1.el.removeEventListener(eventName, this$1$1[eventName]);
});
};
anonymous.prototype.render = function render() {
var this$1 = this; // Convert React props to CustomElement props https://github.com/facebook/react/issues/12810
anonymous.prototype.render = function render() {
var this$1$1 = this; // Convert React props to CustomElement props https://github.com/facebook/react/issues/12810
return React.createElement(tagName, Object.keys(this.props).reduce(function (thisProps, propName) {
if (skipProps.indexOf(propName) === -1) {
// Do not render customEvents and custom props as attributes
if (propName === 'className') {
thisProps["class"] = this$1.props[propName];
} // Fixes className for custom elements
else if (this$1.props[propName] === true) {
thisProps[propName] = '';
} // Fixes boolean attributes
else if (this$1.props[propName] !== false) {
thisProps[propName] = this$1.props[propName];
} // Pass only truthy, non-function props
return React__default["default"].createElement(tagName, Object.keys(this.props).reduce(function (thisProps, propName) {
if (skipProps.indexOf(propName) === -1) {
// Do not render customEvents and custom props as attributes
if (propName === 'className') {
thisProps["class"] = this$1$1.props[propName];
} // Fixes className for custom elements
else if (this$1$1.props[propName] === true) {
thisProps[propName] = '';
} // Fixes boolean attributes
else if (this$1$1.props[propName] !== false) {
thisProps[propName] = this$1$1.props[propName];
} // Pass only truthy, non-function props
}
}
return thisProps;
}, {
ref: this.ref
}));
};
return thisProps;
}, {
ref: this.ref
}));
};
return anonymous;
}(React.Component)
);
return anonymous;
}(React__default["default"].Component);
}

@@ -462,0 +512,0 @@

@@ -5,3 +5,3 @@ {

"author": "NRK <opensource@nrk.no> (https://www.nrk.no/)",
"version": "2.0.8",
"version": "2.0.9",
"license": "MIT",

@@ -8,0 +8,0 @@ "main": "core-progress.cjs.js",

@@ -89,6 +89,6 @@ # Core Progress

```html
<script src="https://static.nrk.no/core-components/major/7/core-progress/core-progress.min.js"></script> <!-- Using static -->
<script src="https://static.nrk.no/core-components/major/10/core-progress/core-progress.min.js"></script> <!-- Using static -->
```
Remember to [polyfill](https://github.com/webcomponents/polyfills#custom-elements) custom elements if needed.
Remember to [polyfill](https://github.com/webcomponents/polyfills/tree/master/packages/custom-elements) custom elements if needed.

@@ -95,0 +95,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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