@d3fc/d3fc-element
Advanced tools
Comparing version 5.3.13 to 5.3.14
@@ -209,3 +209,3 @@ (function (factory) { | ||
var pixelRatio = element.useDevicePixelRatio && global.devicePixelRatio != null ? global.devicePixelRatio : 1; | ||
var pixelRatio = element.useDevicePixelRatio && window.devicePixelRatio != null ? window.devicePixelRatio : 1; | ||
var width = element.clientWidth * pixelRatio; | ||
@@ -212,0 +212,0 @@ var height = element.clientHeight * pixelRatio; |
@@ -1,1 +0,1 @@ | ||
(function(a){"function"==typeof define&&define.amd?define(a):a()})(function(){'use strict';function a(b){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},a(b)}function b(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function c(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function d(a,b,d){return b&&c(a.prototype,b),d&&c(a,d),a}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&g(a,b)}function f(a){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},f(a)}function g(a,b){return g=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},g(a,b)}function h(){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(a){return!1}}function i(){return i=h()?Reflect.construct:function(b,c,d){var e=[null];e.push.apply(e,c);var a=Function.bind.apply(b,e),f=new a;return d&&g(f,d.prototype),f},i.apply(null,arguments)}function j(a){return-1!==Function.toString.call(a).indexOf("[native code]")}function k(a){var b="function"==typeof Map?new Map:void 0;return k=function(a){function c(){return i(a,arguments,f(this).constructor)}if(null===a||!j(a))return a;if("function"!=typeof a)throw new TypeError("Super expression must either be null or a function");if("undefined"!=typeof b){if(b.has(a))return b.get(a);b.set(a,c)}return c.prototype=Object.create(a.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),g(c,a)},k(a)}function l(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function m(a,b){return b&&("object"==typeof b||"function"==typeof b)?b:l(a)}function n(a){return q(a)||r(a)||t()}function o(a){return p(a)||r(a)||s()}function p(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}}function q(a){if(Array.isArray(a))return a}function r(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function t(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var u=function(a){return a["__d3fc-elements__"]||{}},v=function(a,b){a["__d3fc-elements__"]=b},w=function(a){return delete a["__d3fc-elements__"]},x=function(a){return"D3FC-GROUP"===a.tagName?[a].concat(o(a.querySelectorAll("d3fc-canvas, d3fc-group, d3fc-svg"))):[a]},y=function(a){var b=u(a),c=b.width,d=b.height,e=a.useDevicePixelRatio&&null!=global.devicePixelRatio?global.devicePixelRatio:1,f=a.clientWidth*e,g=a.clientHeight*e;v(a,{pixelRatio:e,width:f,height:g,resized:f!==c||g!==d})};if("function"!=typeof CustomEvent)throw new Error("d3fc-element depends on CustomEvent. Make sure that you load a polyfill in older browsers. See README.");var z=function(a){var b=u(a),c=new CustomEvent("measure",{detail:b});a.dispatchEvent(c)},A=function(a){var b=u(a),c=new CustomEvent("draw",{detail:b});a.dispatchEvent(c)},B=function(a){var b=a.map(x).reduce(function(c,a){return c.concat(a)});b.forEach(y),b.forEach(z),b.forEach(A)},C=function(a){return u(a.ownerDocument).queue||[]},D=function(a,b){var c=u(a.ownerDocument),d=c.requestId;null==d&&(d=requestAnimationFrame(function(){var b=C(a);B(b),E(a)})),v(a.ownerDocument,{queue:b,requestId:d})},E=function(a){return w(a.ownerDocument)},F=function(a,b){var c=a;do if(c.parentNode===b)return!0;while(c=c.parentNode);return!1},G=function(a){var b=C(a),c=-1<b.indexOf(a);if(!c){var d=b.some(function(b){return F(a,b)});if(!d){var e=b.filter(function(b){return!F(b,a)});e.push(a),D(a,e)}}};if("function"!=typeof HTMLElement)throw new Error("d3fc-element depends on Custom Elements (v1). Make sure that you load a polyfill in older browsers. See README.");var H=function(a){null!=a.__measureListener__||(a.__measureListener__=function(b){return a.setMeasurements(b.detail)},a.addEventListener("measure",a.__measureListener__))},I=function(a){null==a.__measureListener__||(a.removeEventListener("measure",a.__measureListener__),a.__measureListener__=null)},J=function(a,c){return function(g){function h(){return b(this,h),m(this,f(h).apply(this,arguments))}return e(h,g),d(h,[{key:"attributeChangedCallback",value:function(a){"use-device-pixel-ratio"===a?this.requestRedraw():void 0}},{key:"connectedCallback",value:function(){0===this.childNodes.length&&this.appendChild(a()),H(this)}},{key:"disconnectedCallback",value:function(){I(this)}},{key:"setMeasurements",value:function(a){var b=a.width,d=a.height,e=n(this.childNodes),f=e[0],g=e.slice(1);if(0<g.length)throw new Error("A d3fc-svg/canvas element must only contain a single svg/canvas element.");c(this,f,{width:b,height:d})}},{key:"requestRedraw",value:function(){G(this)}},{key:"useDevicePixelRatio",get:function(){return this.hasAttribute("use-device-pixel-ratio")&&"false"!==this.getAttribute("use-device-pixel-ratio")},set:function(a){a&&!this.useDevicePixelRatio?this.setAttribute("use-device-pixel-ratio",""):!a&&this.useDevicePixelRatio&&this.removeAttribute("use-device-pixel-ratio"),this.requestRedraw()}}],[{key:"observedAttributes",get:function(){return["use-device-pixel-ratio"]}}]),h}(k(HTMLElement))},K=function(a){function c(){return b(this,c),m(this,f(c).apply(this,arguments))}return e(c,a),d(c,[{key:"setWebglViewport",get:function(){return this.hasAttribute("set-webgl-viewport")&&"false"!==this.getAttribute("set-webgl-viewport")},set:function(a){a&&!this.setWebglViewport?this.setAttribute("set-webgl-viewport",""):!a&&this.setWebglViewport&&this.removeAttribute("set-webgl-viewport"),this.requestRedraw()}}]),c}(J(function(){return document.createElement("canvas")},function(a,b,c){var d=c.width,e=c.height;if(b.setAttribute("width",d),b.setAttribute("height",e),a.setWebglViewport){var f=b.getContext("webgl");f.viewport(0,0,d,e)}})),L=function(a){a.autoResize?M(a):N(a)},M=function(a){null!=a.__autoResizeListener__||(a.__autoResizeListener__=function(){return G(a)},addEventListener("resize",a.__autoResizeListener__))},N=function(a){null==a.__autoResizeListener__||(removeEventListener("resize",a.__autoResizeListener__),a.__autoResizeListener__=null)},O=function(a){function c(){return b(this,c),m(this,f(c).apply(this,arguments))}return e(c,a),d(c,[{key:"connectedCallback",value:function(){L(this)}},{key:"disconnectedCallback",value:function(){N(this)}},{key:"requestRedraw",value:function(){G(this)}},{key:"attributeChangedCallback",value:function(a){"auto-resize"===a?L(this):void 0}},{key:"autoResize",get:function(){return this.hasAttribute("auto-resize")&&"false"!==this.getAttribute("auto-resize")},set:function(a){a&&!this.autoResize?this.setAttribute("auto-resize",""):!a&&this.autoResize&&this.removeAttribute("auto-resize"),L(this)}}],[{key:"observedAttributes",get:function(){return["auto-resize"]}}]),c}(k(HTMLElement)),P=J(function(){return document.createElementNS("http://www.w3.org/2000/svg","svg")},function(a,b,c){var d=c.width,e=c.height;b.setAttribute("viewBox","0 0 ".concat(d," ").concat(e))}),Q="d3fc-canvas,d3fc-svg{position:relative;display:block}d3fc-canvas>canvas,d3fc-svg>svg{position:absolute;height:100%;width:100%}d3fc-svg>svg{overflow:visible}",R=document.createElement("style");if(R.setAttribute("type","text/css"),document.querySelector("head").appendChild(R),R.styleSheet?R.styleSheet.cssText+=Q:R.textContent+=Q,"object"!==("undefined"==typeof customElements?"undefined":a(customElements))||"function"!=typeof customElements.define)throw new Error("d3fc-element depends on Custom Elements (v1). Make sure that you load a polyfill in older browsers. See README.");customElements.define("d3fc-canvas",K),customElements.define("d3fc-group",O),customElements.define("d3fc-svg",P)}); | ||
(function(a){"function"==typeof define&&define.amd?define(a):a()})(function(){'use strict';function a(b){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},a(b)}function b(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function c(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function d(a,b,d){return b&&c(a.prototype,b),d&&c(a,d),a}function e(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&g(a,b)}function f(a){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},f(a)}function g(a,b){return g=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},g(a,b)}function h(){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(a){return!1}}function i(){return i=h()?Reflect.construct:function(b,c,d){var e=[null];e.push.apply(e,c);var a=Function.bind.apply(b,e),f=new a;return d&&g(f,d.prototype),f},i.apply(null,arguments)}function j(a){return-1!==Function.toString.call(a).indexOf("[native code]")}function k(a){var b="function"==typeof Map?new Map:void 0;return k=function(a){function c(){return i(a,arguments,f(this).constructor)}if(null===a||!j(a))return a;if("function"!=typeof a)throw new TypeError("Super expression must either be null or a function");if("undefined"!=typeof b){if(b.has(a))return b.get(a);b.set(a,c)}return c.prototype=Object.create(a.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),g(c,a)},k(a)}function l(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function m(a,b){return b&&("object"==typeof b||"function"==typeof b)?b:l(a)}function n(a){return q(a)||r(a)||t()}function o(a){return p(a)||r(a)||s()}function p(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}}function q(a){if(Array.isArray(a))return a}function r(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function t(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var u=function(a){return a["__d3fc-elements__"]||{}},v=function(a,b){a["__d3fc-elements__"]=b},w=function(a){return delete a["__d3fc-elements__"]},x=function(a){return"D3FC-GROUP"===a.tagName?[a].concat(o(a.querySelectorAll("d3fc-canvas, d3fc-group, d3fc-svg"))):[a]},y=function(a){var b=u(a),c=b.width,d=b.height,e=a.useDevicePixelRatio&&null!=window.devicePixelRatio?window.devicePixelRatio:1,f=a.clientWidth*e,g=a.clientHeight*e;v(a,{pixelRatio:e,width:f,height:g,resized:f!==c||g!==d})};if("function"!=typeof CustomEvent)throw new Error("d3fc-element depends on CustomEvent. Make sure that you load a polyfill in older browsers. See README.");var z=function(a){var b=u(a),c=new CustomEvent("measure",{detail:b});a.dispatchEvent(c)},A=function(a){var b=u(a),c=new CustomEvent("draw",{detail:b});a.dispatchEvent(c)},B=function(a){var b=a.map(x).reduce(function(c,a){return c.concat(a)});b.forEach(y),b.forEach(z),b.forEach(A)},C=function(a){return u(a.ownerDocument).queue||[]},D=function(a,b){var c=u(a.ownerDocument),d=c.requestId;null==d&&(d=requestAnimationFrame(function(){var b=C(a);B(b),E(a)})),v(a.ownerDocument,{queue:b,requestId:d})},E=function(a){return w(a.ownerDocument)},F=function(a,b){var c=a;do if(c.parentNode===b)return!0;while(c=c.parentNode);return!1},G=function(a){var b=C(a),c=-1<b.indexOf(a);if(!c){var d=b.some(function(b){return F(a,b)});if(!d){var e=b.filter(function(b){return!F(b,a)});e.push(a),D(a,e)}}};if("function"!=typeof HTMLElement)throw new Error("d3fc-element depends on Custom Elements (v1). Make sure that you load a polyfill in older browsers. See README.");var H=function(a){null!=a.__measureListener__||(a.__measureListener__=function(b){return a.setMeasurements(b.detail)},a.addEventListener("measure",a.__measureListener__))},I=function(a){null==a.__measureListener__||(a.removeEventListener("measure",a.__measureListener__),a.__measureListener__=null)},J=function(a,c){return function(g){function h(){return b(this,h),m(this,f(h).apply(this,arguments))}return e(h,g),d(h,[{key:"attributeChangedCallback",value:function(a){"use-device-pixel-ratio"===a?this.requestRedraw():void 0}},{key:"connectedCallback",value:function(){0===this.childNodes.length&&this.appendChild(a()),H(this)}},{key:"disconnectedCallback",value:function(){I(this)}},{key:"setMeasurements",value:function(a){var b=a.width,d=a.height,e=n(this.childNodes),f=e[0],g=e.slice(1);if(0<g.length)throw new Error("A d3fc-svg/canvas element must only contain a single svg/canvas element.");c(this,f,{width:b,height:d})}},{key:"requestRedraw",value:function(){G(this)}},{key:"useDevicePixelRatio",get:function(){return this.hasAttribute("use-device-pixel-ratio")&&"false"!==this.getAttribute("use-device-pixel-ratio")},set:function(a){a&&!this.useDevicePixelRatio?this.setAttribute("use-device-pixel-ratio",""):!a&&this.useDevicePixelRatio&&this.removeAttribute("use-device-pixel-ratio"),this.requestRedraw()}}],[{key:"observedAttributes",get:function(){return["use-device-pixel-ratio"]}}]),h}(k(HTMLElement))},K=function(a){function c(){return b(this,c),m(this,f(c).apply(this,arguments))}return e(c,a),d(c,[{key:"setWebglViewport",get:function(){return this.hasAttribute("set-webgl-viewport")&&"false"!==this.getAttribute("set-webgl-viewport")},set:function(a){a&&!this.setWebglViewport?this.setAttribute("set-webgl-viewport",""):!a&&this.setWebglViewport&&this.removeAttribute("set-webgl-viewport"),this.requestRedraw()}}]),c}(J(function(){return document.createElement("canvas")},function(a,b,c){var d=c.width,e=c.height;if(b.setAttribute("width",d),b.setAttribute("height",e),a.setWebglViewport){var f=b.getContext("webgl");f.viewport(0,0,d,e)}})),L=function(a){a.autoResize?M(a):N(a)},M=function(a){null!=a.__autoResizeListener__||(a.__autoResizeListener__=function(){return G(a)},addEventListener("resize",a.__autoResizeListener__))},N=function(a){null==a.__autoResizeListener__||(removeEventListener("resize",a.__autoResizeListener__),a.__autoResizeListener__=null)},O=function(a){function c(){return b(this,c),m(this,f(c).apply(this,arguments))}return e(c,a),d(c,[{key:"connectedCallback",value:function(){L(this)}},{key:"disconnectedCallback",value:function(){N(this)}},{key:"requestRedraw",value:function(){G(this)}},{key:"attributeChangedCallback",value:function(a){"auto-resize"===a?L(this):void 0}},{key:"autoResize",get:function(){return this.hasAttribute("auto-resize")&&"false"!==this.getAttribute("auto-resize")},set:function(a){a&&!this.autoResize?this.setAttribute("auto-resize",""):!a&&this.autoResize&&this.removeAttribute("auto-resize"),L(this)}}],[{key:"observedAttributes",get:function(){return["auto-resize"]}}]),c}(k(HTMLElement)),P=J(function(){return document.createElementNS("http://www.w3.org/2000/svg","svg")},function(a,b,c){var d=c.width,e=c.height;b.setAttribute("viewBox","0 0 ".concat(d," ").concat(e))}),Q="d3fc-canvas,d3fc-svg{position:relative;display:block}d3fc-canvas>canvas,d3fc-svg>svg{position:absolute;height:100%;width:100%}d3fc-svg>svg{overflow:visible}",R=document.createElement("style");if(R.setAttribute("type","text/css"),document.querySelector("head").appendChild(R),R.styleSheet?R.styleSheet.cssText+=Q:R.textContent+=Q,"object"!==("undefined"==typeof customElements?"undefined":a(customElements))||"function"!=typeof customElements.define)throw new Error("d3fc-element depends on Custom Elements (v1). Make sure that you load a polyfill in older browsers. See README.");customElements.define("d3fc-canvas",K),customElements.define("d3fc-group",O),customElements.define("d3fc-svg",P)}); |
@@ -6,2 +6,13 @@ # Change Log | ||
## [5.3.14](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-element@5.3.13...@d3fc/d3fc-element@5.3.14) (2020-01-28) | ||
### Bug Fixes | ||
* undefined global when using use-device-pixel-ratio ([d7880bb](https://github.com/d3fc/d3fc/commit/d7880bb)) | ||
## [5.3.13](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-element@5.3.12...@d3fc/d3fc-element@5.3.13) (2020-01-27) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@d3fc/d3fc-element", | ||
"version": "5.3.13", | ||
"version": "5.3.14", | ||
"description": "Custom HTML elements that make it easier to create responsive visualisations that integrate easily with other UI frameworks (e.g. React, Angular)", | ||
@@ -33,3 +33,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "e724ccde6e19cde0b135d6133c37526b670c32db" | ||
"gitHead": "8f34378b837eb2b88eae46db706edd36b0c4a3b4" | ||
} |
@@ -9,3 +9,3 @@ import * as data from './data'; | ||
const { width: previousWidth, height: previousHeight } = data.get(element); | ||
const pixelRatio = (element.useDevicePixelRatio && global.devicePixelRatio != null) ? global.devicePixelRatio : 1; | ||
const pixelRatio = (element.useDevicePixelRatio && window.devicePixelRatio != null) ? window.devicePixelRatio : 1; | ||
const width = element.clientWidth * pixelRatio; | ||
@@ -12,0 +12,0 @@ const height = element.clientHeight * pixelRatio; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67217