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

@nrk/core-progress

Package Overview
Dependencies
Maintainers
130
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.6 to 2.0.7

26

core-progress.cjs.js

@@ -143,13 +143,4 @@ 'use strict';

var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform)); // Polyfill toggleAttribute for IE
var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform)); // Mock HTMLElement for Node
if (IS_BROWSER && !window.Element.prototype.toggleAttribute) {
window.Element.prototype.toggleAttribute = function (name) {
var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !this.hasAttribute(name);
if (!force === this.hasAttribute(name)) this[force ? 'setAttribute' : 'removeAttribute'](name, '');
return force;
};
} // Mock HTMLElement for Node
if (!IS_BROWSER && !global.HTMLElement) {

@@ -230,3 +221,16 @@ global.HTMLElement =

}
/**
* toggleAttribute (Ponyfill for IE and Edge, fixes #299)
* @link https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute
* @param {Element} el Single DOM Element
* @param {String} name The name of the attribute to be toggled
* @param {Boolean} force Force attribute to be added or removed regardless of previous state
*/
function toggleAttribute(el, name) {
var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !this.hasAttribute(name);
if (!force === el.hasAttribute(name)) el[force ? 'setAttribute' : 'removeAttribute'](name, '');
return force;
}
var CoreProgress =

@@ -260,3 +264,3 @@ /*#__PURE__*/

this.setAttribute('aria-label', this.indeterminate || "".concat(percentage, "%"));
this.toggleAttribute('indeterminate', this.indeterminate);
toggleAttribute(this, 'indeterminate', this.indeterminate);
if (this.type === 'linear') this.style.width = "".concat(percentage, "%");

@@ -263,0 +267,0 @@ if (this.type === 'radial') this.style.strokeDashoffset = Math.round((100 - percentage) * Math.PI);

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

import { addStyle, dispatchEvent } from '../utils'
import { addStyle, dispatchEvent, toggleAttribute } from '../utils'

@@ -12,2 +12,3 @@ export default class CoreProgress extends HTMLElement {

}
attributeChangedCallback (name, prev, next) {

@@ -18,3 +19,3 @@ const changeType = this.parentElement && name === 'type' && (next === 'radial') === !this.querySelector('svg')

this.setAttribute('aria-label', this.indeterminate || `${percentage}%`)
this.toggleAttribute('indeterminate', this.indeterminate)
toggleAttribute(this, 'indeterminate', this.indeterminate)

@@ -26,10 +27,18 @@ if (this.type === 'linear') this.style.width = `${percentage}%`

}
get indeterminate () { return isNaN(parseFloat(this.getAttribute('value'))) && this.getAttribute('value') }
get percentage () { return Math.round(this.value / this.max * 100) || 0 }
get value () { return this.indeterminate || Number(this.getAttribute('value')) }
set value (val) { this.setAttribute('value', val) }
get max () { return Number(this.getAttribute('max')) || 1 }
set max (val) { this.setAttribute('max', val) }
get type () { return this.getAttribute('type') || 'linear' }
set type (val) { this.setAttribute('type', val) }
}

@@ -149,13 +149,4 @@ (function (global, factory) {

var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform)); // Polyfill toggleAttribute for IE
var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform)); // Mock HTMLElement for Node
if (IS_BROWSER && !window.Element.prototype.toggleAttribute) {
window.Element.prototype.toggleAttribute = function (name) {
var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !this.hasAttribute(name);
if (!force === this.hasAttribute(name)) this[force ? 'setAttribute' : 'removeAttribute'](name, '');
return force;
};
} // Mock HTMLElement for Node
if (!IS_BROWSER && !global.HTMLElement) {

@@ -236,3 +227,16 @@ global.HTMLElement =

}
/**
* toggleAttribute (Ponyfill for IE and Edge, fixes #299)
* @link https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute
* @param {Element} el Single DOM Element
* @param {String} name The name of the attribute to be toggled
* @param {Boolean} force Force attribute to be added or removed regardless of previous state
*/
function toggleAttribute(el, name) {
var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !this.hasAttribute(name);
if (!force === el.hasAttribute(name)) el[force ? 'setAttribute' : 'removeAttribute'](name, '');
return force;
}
var CoreProgress =

@@ -266,3 +270,3 @@ /*#__PURE__*/

this.setAttribute('aria-label', this.indeterminate || "".concat(percentage, "%"));
this.toggleAttribute('indeterminate', this.indeterminate);
toggleAttribute(this, 'indeterminate', this.indeterminate);
if (this.type === 'linear') this.style.width = "".concat(percentage, "%");

@@ -317,3 +321,3 @@ if (this.type === 'radial') this.style.strokeDashoffset = Math.round((100 - percentage) * Math.PI);

var version = "2.0.6";
var version = "2.0.7";

@@ -362,3 +366,3 @@ /**

var customEvents = options.customEvents || [];
var skipProps = customProps.slice(); // Keep a copy
var skipProps = customProps.concat('forwardRef'); // Keep a copy with forwardRef added

@@ -374,2 +378,9 @@ var tagName = (dashCase + "-" + (options.suffix || 'react')).replace(/\W+/g, '-').toLowerCase();

this.ref = function (el) {
// Support callback ref https://reactjs.org/docs/refs-and-the-dom.html#callback-refs
if (typeof this$1.props.forwardRef === 'function') {
this$1.props.forwardRef(el);
} else if (this$1.props.forwardRef) {
this$1.props.forwardRef.current = el;
}
return this$1.el = el;

@@ -403,3 +414,3 @@ };

customProps.forEach(function (key) {
return this$1.props.hasOwnProperty(key) && (this$1.el[key] = this$1.props[key]);
return key in this$1.props && (this$1.el[key] = this$1.props[key]);
});

@@ -406,0 +417,0 @@ customEvents.forEach(function (key) {

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

/*! @nrk/core-progress v2.0.6 - 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 o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(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 a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(t,e,n){return(i=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&&c(i,n.prototype),i}).apply(null,arguments)}function s(t){var r="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||(e=t,-1===Function.toString.call(e).indexOf("[native code]")))return t;var e;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,n)}function n(){return i(t,arguments,a(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(n,t)})(t)}function l(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));t&&!window.Element.prototype.toggleAttribute&&(window.Element.prototype.toggleAttribute=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:!this.hasAttribute(t);return!e===this.hasAttribute(t)&&this[e?"setAttribute":"removeAttribute"](t,""),e}),t||global.HTMLElement||(global.HTMLElement=function(){return function t(){o(this,t)}}());var e,n;e="undefined"==typeof window?{}:window.Element.prototype,n=e.matches||e.msMatchesSelector||e.webkitMatchesSelector,e.closest;return function(t){function e(){return o(this,e),l(this,a(e).apply(this,arguments))}var n,r,i;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&&c(t,e)}(e,s(HTMLElement)),n=e,i=[{key:"observedAttributes",get:function(){return["type","value","max"]}}],(r=[{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,"%")),this.toggleAttribute("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=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},i="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[i])return;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)}}])&&u(n.prototype,r),i&&u(n,i),e}()}),window.customElements.define("core-progress",coreProgress);
/*! @nrk/core-progress v2.0.7 - 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 o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(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 a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(t,e,n){return(i=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&&c(i,n.prototype),i}).apply(null,arguments)}function s(t){var r="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||(e=t,-1===Function.toString.call(e).indexOf("[native code]")))return t;var e;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,n)}function n(){return i(t,arguments,a(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(n,t)})(t)}function l(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));t||global.HTMLElement||(global.HTMLElement=function(){return function t(){o(this,t)}}());var e,n;e="undefined"==typeof window?{}:window.Element.prototype,n=e.matches||e.msMatchesSelector||e.webkitMatchesSelector,e.closest;return function(t){function e(){return o(this,e),l(this,a(e).apply(this,arguments))}var n,r,i;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&&c(t,e)}(e,s(HTMLElement)),n=e,i=[{key:"observedAttributes",get:function(){return["type","value","max"]}}],(r=[{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=2<arguments.length&&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=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},i="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[i])return;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)}}])&&u(n.prototype,r),i&&u(n,i),e}()}),window.customElements.define("core-progress",coreProgress);
//# sourceMappingURL=core-progress.min.js.map

@@ -147,13 +147,4 @@ 'use strict';

var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform)); // Polyfill toggleAttribute for IE
var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform)); // Mock HTMLElement for Node
if (IS_BROWSER && !window.Element.prototype.toggleAttribute) {
window.Element.prototype.toggleAttribute = function (name) {
var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !this.hasAttribute(name);
if (!force === this.hasAttribute(name)) this[force ? 'setAttribute' : 'removeAttribute'](name, '');
return force;
};
} // Mock HTMLElement for Node
if (!IS_BROWSER && !global.HTMLElement) {

@@ -234,3 +225,16 @@ global.HTMLElement =

}
/**
* toggleAttribute (Ponyfill for IE and Edge, fixes #299)
* @link https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute
* @param {Element} el Single DOM Element
* @param {String} name The name of the attribute to be toggled
* @param {Boolean} force Force attribute to be added or removed regardless of previous state
*/
function toggleAttribute(el, name) {
var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !this.hasAttribute(name);
if (!force === el.hasAttribute(name)) el[force ? 'setAttribute' : 'removeAttribute'](name, '');
return force;
}
var CoreProgress =

@@ -264,3 +268,3 @@ /*#__PURE__*/

this.setAttribute('aria-label', this.indeterminate || "".concat(percentage, "%"));
this.toggleAttribute('indeterminate', this.indeterminate);
toggleAttribute(this, 'indeterminate', this.indeterminate);
if (this.type === 'linear') this.style.width = "".concat(percentage, "%");

@@ -315,3 +319,3 @@ if (this.type === 'radial') this.style.strokeDashoffset = Math.round((100 - percentage) * Math.PI);

var version = "2.0.6";
var version = "2.0.7";

@@ -360,3 +364,3 @@ /**

var customEvents = options.customEvents || [];
var skipProps = customProps.slice(); // Keep a copy
var skipProps = customProps.concat('forwardRef'); // Keep a copy with forwardRef added

@@ -372,2 +376,9 @@ var tagName = (dashCase + "-" + (options.suffix || 'react')).replace(/\W+/g, '-').toLowerCase();

this.ref = function (el) {
// Support callback ref https://reactjs.org/docs/refs-and-the-dom.html#callback-refs
if (typeof this$1.props.forwardRef === 'function') {
this$1.props.forwardRef(el);
} else if (this$1.props.forwardRef) {
this$1.props.forwardRef.current = el;
}
return this$1.el = el;

@@ -401,3 +412,3 @@ };

customProps.forEach(function (key) {
return this$1.props.hasOwnProperty(key) && (this$1.el[key] = this$1.props[key]);
return key in this$1.props && (this$1.el[key] = this$1.props[key]);
});

@@ -404,0 +415,0 @@ customEvents.forEach(function (key) {

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

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

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

@@ -70,3 +70,3 @@ # Core Progress

<label>Radial progress:
<span style="width:40px">
<span style="display:block;width:40px">
<core-progress type="radial" class="my-radial" value=".75"></core-progress>

@@ -89,3 +89,3 @@ </span>

```html
<script src="https://static.nrk.no/core-components/major/6/core-progress/core-progress.min.js"></script> <!-- Using static -->
<script src="https://static.nrk.no/core-components/major/7/core-progress/core-progress.min.js"></script> <!-- Using static -->
```

@@ -92,0 +92,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