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

protvista-utils

Package Overview
Dependencies
Maintainers
7
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protvista-utils - npm Package Compare versions

Comparing version 3.8.4 to 3.8.10

2

dist/protvista-utils.js

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ProtvistaUtils=e():t.ProtvistaUtils=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=10)}([function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(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)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e,n){var r=n(14),i=n(15),o=n(5),l=n(16);t.exports=function(t){return r(t)||i(t)||o(t)||l()}},function(t,e,n){var r=n(17);function i(e,n,o){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=i=Reflect.get:t.exports=i=function(t,e,n){var i=r(t,e);if(i){var o=Object.getOwnPropertyDescriptor(i,e);return o.get?o.get.call(n):o.value}},i(e,n,o||e)}t.exports=i},function(t,e,n){var r=n(6);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}},function(t,e,n){var r=n(11),i=n(12),o=n(5),l=n(13);t.exports=function(t,e){return r(t)||i(t,e)||o(t,e)||l()}},function(t,e,n){var r=n(18);t.exports=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&&r(t,e)}},function(t,e,n){var r=n(19),i=n(20);t.exports=function(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?i(t):e}},function(t,e,n){t.exports=n(21)},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,o=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e,n){var r=n(6);t.exports=function(t){if(Array.isArray(t))return r(t)}},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e,n){var r=n(2);t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}},function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,r)}t.exports=n},function(t,e){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(t){return typeof t}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(e)}t.exports=n},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e,n){"use strict";n.r(e),n.d(e,"Region",(function(){return N})),n.d(e,"TrackHighlighter",(function(){return P})),n.d(e,"ColorScaleParser",(function(){return R})),n.d(e,"String2Object",(function(){return C})),n.d(e,"ScrollFilter",(function(){return F})),n.d(e,"withMargin",(function(){return I}));var r=n(7),i=n.n(r),o=n(0),l=n.n(o),a=n(1),u=n.n(a),c=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.min,r=void 0===n?-1/0:n,i=e.max,o=void 0===i?1/0:i;l()(this,t),this.segments=[],this.max=o,this.min=r,this.regionString=null}return u()(t,[{key:"encode",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.segments.map((function(n){var r=n.start,i=n.end,o=n.color;if(e)return"".concat(r,":").concat(i).concat(o?":".concat(o):"");var l=r===t.min?"":r,a=i===t.max?"":i;return"".concat(l,":").concat(a).concat(o?":".concat(o):"")})).join(",")}},{key:"decode",value:function(t){var e=this;void 0!==t&&(this.regionString=t),this.regionString?this.segments=this.regionString.split(",").map((function(t){var n=t.split(":"),r=i()(n,4),o=r[0],l=r[1],a=r[2];if(void 0!==r[3])throw new Error("there should be at most 2 ':' per region. Region: ".concat(t));var u=o?Number(o):e.min,c=l?Number(l):e.max,s=""!==a?a:void 0;if(u>c){var h=[c,u];u=h[0],c=h[1]}if(u<e.min&&(u=e.min),c>e.max&&(c=e.max),Number.isNaN(u))throw new Error("The parsed value of ".concat(o," is NaN. Region: ").concat(t));if(Number.isNaN(c))throw new Error("The parsed value of ".concat(l," is NaN. Region: ").concat(t));if(s&&!s.match(/^#[0-9a-f]{6,8}$/i))throw new Error("The parsed value of ".concat(a," is not a color in hex format. Region: ").concat(t));return{start:u,end:c,color:s}})):this.segments=[]}}]),t}(),s=function(t,e){return t?e?"".concat(t,",").concat(e):t:e},h=function(){function t(e){var n=e.element,r=e.min,i=e.max;l()(this,t),this.element=n,this.element._highlightcolor="#FFEB3B66",this.region=new c({min:r,max:i}),this.fixedHighlight=null}return u()(t,[{key:"max",set:function(t){this.region.max=t}},{key:"setAttributesInElement",value:function(){this.region.decode(this.element.getAttribute("highlight")),0===this.region.segments.length&&(this.element._highlightstart=Number(this.element.getAttribute("highlightstart")),this.element._highlightend=Number(this.element.getAttribute("highlightend")),this.element._highlightcolor=this.element.getAttribute("highlightcolor")||"#FFEB3B66",null!==this.element._highlightstart&&null!==this.element._highlightend&&"number"==typeof this.element._highlightstart&&"number"==typeof this.element._highlightend&&(this.element._highlight="".concat(this.element._highlightstart,":").concat(this.element._highlightend),this.region.decode(s(this.fixedHighlight,this.element._highlight))))}},{key:"setFloatAttribute",value:function(t,e){var n=parseFloat(e);this.element["_".concat(t)]=Number.isNaN(n)?e:n}},{key:"changedCallBack",value:function(t,e){switch(t){case"highlightstart":case"highlightend":this.setFloatAttribute(t,e),this.element._highlight=Number.isNaN(this.element._highlightstart)||Number.isNaN(this.element._highlightend)||void 0===this.element._highlightstart||void 0===this.element._highlightend||null===this.element._highlightstart||null===this.element._highlightend?"":"".concat(Math.max(this.region.min,this.element._highlightstart),":").concat(Math.min(this.region.max,this.element._highlightend));break;default:this.element._highlight=e}this.region.decode(s(this.fixedHighlight,this.element._highlight)),this.element.refresh()}},{key:"setFixedHighlight",value:function(t){this.fixedHighlight=t,this.region.decode(s(t,this.element._highlight)),this.element.refresh()}},{key:"appendHighlightTo",value:function(t){this.highlighted=t.append("g").attr("class","highlighted")}},{key:"updateHighlight",value:function(){var t=this,e=this.highlighted.selectAll("rect").data(this.region.segments);e.enter().append("rect").style("pointer-events","none").merge(e).attr("fill",(function(e){return e.color?e.color:t.element._highlightcolor})).attr("height",this.element._height).attr("x",(function(e){return t.element.getXFromSeqPosition(e.start)})).attr("width",(function(e){return t.element.getSingleBaseWidth()*(e.end-e.start+1)})),e.exit().remove()}}]),t}();function f(t){var e=document.createElement("div");return e.style.borderColor="",e.style.borderColor=t,""!==e.style.borderColor}var g=function(t){return t},m=function(){function t(e){l()(this,t),this.element=e,this.timeStampWheelOutside=0,this.resetScrollableTimeout=null}return u()(t,[{key:"setElementScrollable",value:function(t){this.element.setAttribute("scrollable",t)}},{key:"startResetScrollableTimer",value:function(){var t=this;this.resetScrollableTimeout&&clearTimeout(this.resetScrollableTimeout),this.resetScrollableTimeout=setTimeout((function(){t.setElementScrollable(!0),t.resetScrollableTimeout=null}),400)}},{key:"blockScroll",value:function(t){this.timeStampWheelOutside=t,this.setElementScrollable(!1),this.startResetScrollableTimer()}},{key:"isWheelEventInsideElement",value:function(t,e){var n=this.element.getBoundingClientRect(),r=n.height,i=n.width,o=n.x,l=n.y;return t>o&&e<o+i&&e>l&&e<l+r}},{key:"wheel",value:function(t){var e=t.x,n=t.y,r=t.timeStamp;this.isWheelEventInsideElement(e,n)?r<this.timeStampWheelOutside+400?this.blockScroll(r):this.setElementScrollable(!0):this.blockScroll(r)}}]),t}(),p=n(3),d=n.n(p),b=n(4),y=n.n(b),v=n(8),x=n.n(v),S=n(9),w=n.n(S),_=n(2),O=n.n(_);function j(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return E(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return l=t.done,t},e:function(t){a=!0,o=t},f:function(){try{l||null==n.return||n.return()}finally{if(a)throw o}}}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function k(t){var e=function(){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}}();return function(){var n,r=O()(t);if(e){var i=O()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return w()(this,n)}}var A=["left","right","top","bottom"],T=A.map((function(t){return"margin".concat(t)})),N=c,P=h,R=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=[],n=[];if(null!==t&&"string"!=typeof t)throw new Error("The attribute text has to be of type string");if(t&&""!==t.trim()){var r=t.split(",").map((function(t){return t.split(":")}));if(r.length<2)throw new Error("There should be at least 2 points to create a scale");e=r.map((function(t){var e=t[0].trim().toUpperCase();if(!f(e))throw new Error("The color '".concat(e," is not valid'"));return e})),n=r.map((function(t,e){var n=parseFloat(t[1]);if(Number.isNaN(n))throw new Error("The second part of every point should be a number. Error in point ".concat(e,": ").concat(t));return n}))}return{range:e,domain:n}},C=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.keyFormatter,r=void 0===n?g:n,i=e.valueFormatter,o=void 0===i?g:i;if(null!==t&&"string"!=typeof t)throw new Error("The attribute text has to be of type string");if(t&&""!==t.trim()){var l=t.split(",").map((function(t){return t.split(":")})),a={};return l.forEach((function(t){if(2!==t.length)throw new Error("Bad block: ".concat(t.join(":"),"\n The blocks of the string should follow the format KEY:VALUE"));a[r(t[0])]=o(t[1])})),a}return{}},F=m,I=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{initialValue:{top:0,bottom:0,left:0,right:0}},r=function(t){x()(r,t);var e=k(r);function r(){var t;return l()(this,r),(t=e.call(this)).margin=n.initialValue,t}return u()(r,[{key:"attributeChangedCallback",value:function(t,e,n){e!==n&&T.includes(t)&&(this[t]=n),y()(O()(r.prototype),"attributeChangedCallback",this).call(this,t,e,n)}}],[{key:"observedAttributes",get:function(){return[].concat(d()(y()(O()(r),"observedAttributes",this)),d()(T))}}]),r}(t),i=j(A);try{var o=function(){var t=e.value;Object.defineProperty(r.prototype,"margin".concat(t),{get:function(){return this.margin[t]||0},set:function(e){this.margin[t]=+e}})};for(i.s();!(e=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}return r}}])}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ProtvistaUtils=e():t.ProtvistaUtils=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=10)}([function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(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)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e,n){var r=n(14),i=n(15),o=n(5),l=n(16);t.exports=function(t){return r(t)||i(t)||o(t)||l()}},function(t,e,n){var r=n(17);function i(e,n,o){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=i=Reflect.get:t.exports=i=function(t,e,n){var i=r(t,e);if(i){var o=Object.getOwnPropertyDescriptor(i,e);return o.get?o.get.call(n):o.value}},i(e,n,o||e)}t.exports=i},function(t,e,n){var r=n(6);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}},function(t,e,n){var r=n(11),i=n(12),o=n(5),l=n(13);t.exports=function(t,e){return r(t)||i(t,e)||o(t,e)||l()}},function(t,e,n){var r=n(18);t.exports=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&&r(t,e)}},function(t,e,n){var r=n(19),i=n(20);t.exports=function(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?i(t):e}},function(t,e,n){t.exports=n(21)},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,o=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e,n){var r=n(6);t.exports=function(t){if(Array.isArray(t))return r(t)}},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e,n){var r=n(2);t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}},function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,r)}t.exports=n},function(t,e){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(t){return typeof t}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(e)}t.exports=n},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e,n){"use strict";n.r(e),n.d(e,"Region",(function(){return N})),n.d(e,"TrackHighlighter",(function(){return P})),n.d(e,"ColorScaleParser",(function(){return R})),n.d(e,"String2Object",(function(){return C})),n.d(e,"ScrollFilter",(function(){return F})),n.d(e,"withMargin",(function(){return B}));var r=n(7),i=n.n(r),o=n(0),l=n.n(o),a=n(1),u=n.n(a),c=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.min,r=void 0===n?-1/0:n,i=e.max,o=void 0===i?1/0:i;l()(this,t),this.segments=[],this.max=o,this.min=r,this.regionString=null}return u()(t,[{key:"encode",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.segments.map((function(n){var r=n.start,i=n.end,o=n.color;if(e)return"".concat(r,":").concat(i).concat(o?":".concat(o):"");var l=r===t.min?"":r,a=i===t.max?"":i;return"".concat(l,":").concat(a).concat(o?":".concat(o):"")})).join(",")}},{key:"decode",value:function(t){var e=this;void 0!==t&&(this.regionString=t),this.regionString?this.segments=this.regionString.split(",").map((function(t){var n=t.split(":"),r=i()(n,4),o=r[0],l=r[1],a=r[2];if(void 0!==r[3])throw new Error("there should be at most 2 ':' per region. Region: ".concat(t));var u=o?Number(o):e.min,c=l?Number(l):e.max,s=""!==a?a:void 0;if(u>c){var h=[c,u];u=h[0],c=h[1]}if(u<e.min&&(u=e.min),c>e.max&&(c=e.max),Number.isNaN(u))throw new Error("The parsed value of ".concat(o," is NaN. Region: ").concat(t));if(Number.isNaN(c))throw new Error("The parsed value of ".concat(l," is NaN. Region: ").concat(t));if(s&&!s.match(/^#[0-9a-f]{6,8}$/i))throw new Error("The parsed value of ".concat(a," is not a color in hex format. Region: ").concat(t));return{start:u,end:c,color:s}})):this.segments=[]}}]),t}(),s=function(t,e){return t?e?"".concat(t,",").concat(e):t:e},h=function(){function t(e){var n=e.element,r=e.min,i=e.max;l()(this,t),this.element=n,this.element._highlightcolor="#FFEB3B66",this.region=new c({min:r,max:i}),this.fixedHighlight=null}return u()(t,[{key:"max",set:function(t){this.region.max=t}},{key:"setAttributesInElement",value:function(){this.region.decode(this.element.getAttribute("highlight")),0===this.region.segments.length&&(this.element._highlightstart=Number(this.element.getAttribute("highlightstart")),this.element._highlightend=Number(this.element.getAttribute("highlightend")),this.element._highlightcolor=this.element.getAttribute("highlightcolor")||"#FFEB3B66",null!==this.element._highlightstart&&null!==this.element._highlightend&&"number"==typeof this.element._highlightstart&&"number"==typeof this.element._highlightend&&(this.element._highlight="".concat(this.element._highlightstart,":").concat(this.element._highlightend),this.region.decode(s(this.fixedHighlight,this.element._highlight))))}},{key:"setFloatAttribute",value:function(t,e){var n=parseFloat(e);this.element["_".concat(t)]=Number.isNaN(n)?e:n}},{key:"changedCallBack",value:function(t,e){switch(t){case"highlightstart":case"highlightend":this.setFloatAttribute(t,e),this.element._highlight=Number.isNaN(this.element._highlightstart)||Number.isNaN(this.element._highlightend)||void 0===this.element._highlightstart||void 0===this.element._highlightend||null===this.element._highlightstart||null===this.element._highlightend?"":"".concat(Math.max(this.region.min,this.element._highlightstart),":").concat(Math.min(this.region.max,this.element._highlightend));break;default:this.element._highlight=e}this.region.decode(s(this.fixedHighlight,this.element._highlight)),this.element.refresh()}},{key:"setFixedHighlight",value:function(t){this.fixedHighlight=t,this.region.decode(s(t,this.element._highlight)),this.element.refresh()}},{key:"appendHighlightTo",value:function(t){this.highlighted=t.append("g").attr("class","highlighted")}},{key:"updateHighlight",value:function(){var t=this,e=this.highlighted.selectAll("rect").data(this.region.segments);e.enter().append("rect").style("pointer-events","none").merge(e).attr("fill",(function(e){return e.color?e.color:t.element._highlightcolor})).attr("height",this.element._height).attr("x",(function(e){return t.element.getXFromSeqPosition(e.start)})).attr("width",(function(e){return t.element.getSingleBaseWidth()*(e.end-e.start+1)})),e.exit().remove()}}]),t}();function f(t){var e=document.createElement("div");return e.style.borderColor="",e.style.borderColor=t,""!==e.style.borderColor}var g=function(t){return t},m=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400;l()(this,t),this.element=e,this.timeStampWheelOutside=0,this.resetScrollableTimeout=null,this.scrollDelay=n}return u()(t,[{key:"setElementScrollable",value:function(t){this.element.setAttribute("scrollable",t)}},{key:"startResetScrollableTimer",value:function(){var t=this;this.resetScrollableTimeout&&clearTimeout(this.resetScrollableTimeout),this.resetScrollableTimeout=setTimeout((function(){t.setElementScrollable(!0),t.resetScrollableTimeout=null}),this.scrollDelay)}},{key:"blockScroll",value:function(t){this.timeStampWheelOutside=t,this.setElementScrollable(!1),this.startResetScrollableTimer()}},{key:"wheel",value:function(t){var e=t.target,n=t.timeStamp;this.element.contains(e)?n<this.timeStampWheelOutside+this.scrollDelay?this.blockScroll(n):this.setElementScrollable(!0):this.blockScroll(n)}}]),t}(),p=n(3),d=n.n(p),b=n(4),y=n.n(b),v=n(8),x=n.n(v),S=n(9),w=n.n(S),_=n(2),O=n.n(_);function j(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return E(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return l=t.done,t},e:function(t){a=!0,o=t},f:function(){try{l||null==n.return||n.return()}finally{if(a)throw o}}}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function k(t){var e=function(){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}}();return function(){var n,r=O()(t);if(e){var i=O()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return w()(this,n)}}var A=["left","right","top","bottom"],T=A.map((function(t){return"margin".concat(t)})),N=c,P=h,R=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=[],n=[];if(null!==t&&"string"!=typeof t)throw new Error("The attribute text has to be of type string");if(t&&""!==t.trim()){var r=t.split(",").map((function(t){return t.split(":")}));if(r.length<2)throw new Error("There should be at least 2 points to create a scale");e=r.map((function(t){var e=t[0].trim().toUpperCase();if(!f(e))throw new Error("The color '".concat(e," is not valid'"));return e})),n=r.map((function(t,e){var n=parseFloat(t[1]);if(Number.isNaN(n))throw new Error("The second part of every point should be a number. Error in point ".concat(e,": ").concat(t));return n}))}return{range:e,domain:n}},C=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.keyFormatter,r=void 0===n?g:n,i=e.valueFormatter,o=void 0===i?g:i;if(null!==t&&"string"!=typeof t)throw new Error("The attribute text has to be of type string");if(t&&""!==t.trim()){var l=t.split(",").map((function(t){return t.split(":")})),a={};return l.forEach((function(t){if(2!==t.length)throw new Error("Bad block: ".concat(t.join(":"),"\n The blocks of the string should follow the format KEY:VALUE"));a[r(t[0])]=o(t[1])})),a}return{}},F=m,B=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{initialValue:{top:0,bottom:0,left:0,right:0}},r=function(t){x()(r,t);var e=k(r);function r(){var t;return l()(this,r),(t=e.call(this)).margin=n.initialValue,t}return u()(r,[{key:"attributeChangedCallback",value:function(t,e,n){e!==n&&T.includes(t)&&(this[t]=n),y()(O()(r.prototype),"attributeChangedCallback",this).call(this,t,e,n)}}],[{key:"observedAttributes",get:function(){return[].concat(d()(y()(O()(r),"observedAttributes",this)),d()(T))}}]),r}(t),i=j(A);try{var o=function(){var t=e.value;Object.defineProperty(r.prototype,"margin".concat(t),{get:function(){return this.margin[t]||0},set:function(e){this.margin[t]=+e}})};for(i.s();!(e=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}return r}}])}));
//# sourceMappingURL=protvista-utils.js.map
{
"name": "protvista-utils",
"version": "3.8.4",
"version": "3.8.10",
"description": "Collection of utilities for ProtVista components",

@@ -29,3 +29,3 @@ "files": [

"license": "ISC",
"gitHead": "e22f7101d9af74e0959d9a16f2cf8d0e2db359b7"
"gitHead": "b752101f62734a8de1f31943ed2c2c59e5b9b709"
}

@@ -1,9 +0,7 @@

/* eslint-disable class-methods-use-this */
const SCROLL_DELAY = 400;
export default class ScrollFilter {
constructor(element) {
constructor(element, scrollDelay = 400) {
this.element = element;
this.timeStampWheelOutside = 0;
this.resetScrollableTimeout = null;
this.scrollDelay = scrollDelay;
}

@@ -23,3 +21,3 @@

this.resetScrollableTimeout = null;
}, SCROLL_DELAY);
}, this.scrollDelay);
}

@@ -33,20 +31,5 @@

isWheelEventInsideElement(mouseX, mouseY) {
const {
height: elementHeight,
width: elementWidth,
x: elementX,
y: elementY
} = this.element.getBoundingClientRect();
return (
mouseX > elementX &&
mouseY < elementX + elementWidth &&
mouseY > elementY &&
mouseY < elementY + elementHeight
);
}
wheel({ x, y, timeStamp }) {
if (this.isWheelEventInsideElement(x, y)) {
if (timeStamp < this.timeStampWheelOutside + SCROLL_DELAY) {
wheel({ target, timeStamp }) {
if (this.element.contains(target)) {
if (timeStamp < this.timeStampWheelOutside + this.scrollDelay) {
// Count this as an outside scroll as it's within the delay and it's

@@ -53,0 +36,0 @@ // inferred the user is doing a continuous scroll past the component

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