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

@applitools/snippets

Package Overview
Dependencies
Maintainers
24
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/snippets - npm Package Compare versions

Comparing version 2.1.10 to 2.1.11

5

CHANGELOG.md

@@ -7,2 +7,7 @@

## 2.1.11 - 2021/12/22
- add neutral color border around marker in `addPageMarker`
- improve handling of pages without viewport tag in `addPageMarker` and `getViewportSize`
## 2.1.10 - 2021/12/20

@@ -9,0 +14,0 @@

10

dist/commands.json
{
"addElementIds": "function(arg){var s=function(){\"use strict\";return function(t){var o=t[0],e=t[1];return o.map((function(t,o){var r=[t];if(t.getRootNode)for(var a=t.getRootNode();a!==document;a=a.host.getRootNode())r.push(a.host);var n=e[o];return r.map((function(t){var o=t.getAttribute(\"data-applitools-selector\"),e=o?o+\" \"+n:n;return t.setAttribute(\"data-applitools-selector\",e),'[data-applitools-selector~=\"'+n+'\"]'}))}))}}();\nreturn s(arg)}",
"addPageMarker": "function(arg){var s=function(){\"use strict\";var t=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),i=n.reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{});return n.forEach((function(t){r.style.setProperty(t,\"string\"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?\"important\":\"\")})),i};return function(){var e=[1,0,1,1,0,1,1,0,1,0,1,0,1,1,0,1,0,0,1,1,1],r={1:\"rgb(0, 0, 0)\",0:\"rgb(255, 255, 255)\"},o=Math.max(1,window.innerWidth/screen.availWidth),n=document.createElement(\"div\");n.setAttribute(\"data-applitools-marker\",\"\"),n.style.setProperty(\"position\",\"fixed\",\"important\"),n.style.setProperty(\"top\",\"0\",\"important\"),n.style.setProperty(\"left\",\"0\",\"important\"),n.style.setProperty(\"box-sizing\",\"content-box\",\"important\"),n.style.setProperty(\"padding\",\"1px\",\"important\"),n.style.setProperty(\"z-index\",\"2147483647\",\"important\"),e.forEach((function(t){var e=document.createElement(\"div\");e.style.setProperty(\"display\",\"block\",\"important\"),e.style.setProperty(\"float\",\"left\",\"important\"),e.style.setProperty(\"width\",o+\"px\",\"important\"),e.style.setProperty(\"height\",\"1px\",\"important\"),e.style.setProperty(\"background\",r[t],\"important\"),n.appendChild(e)}));var i={value:\"none\",important:!0},a=t([document.documentElement,{transform:i,\"-webkit-transform\":i}]),s=t([document.body,{transform:i,\"-webkit-transform\":i}]);return document.documentElement.setAttribute(\"data-applitools-original-transforms\",JSON.stringify(a)),document.body.setAttribute(\"data-applitools-original-transforms\",JSON.stringify(s)),document.body.appendChild(n),{mask:e,size:o,offset:1}}}();\nreturn s(arg)}",
"addPageMarker": "function(arg){var s=function(){\"use strict\";var t=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),i=n.reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{});return n.forEach((function(t){r.style.setProperty(t,\"string\"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?\"important\":\"\")})),i};return function(){var e=[1,0,1,1,0,1,1,0,1,0,1,0,1,1,0,1,0,0,1,1,1],r={1:\"rgb(0, 0, 0)\",0:\"rgb(255, 255, 255)\"},o=visualViewport?visualViewport.scale:1,n=o>=1?1:2,i=n,a=document.createElement(\"div\");a.setAttribute(\"data-applitools-marker\",\"\"),a.style.setProperty(\"position\",\"fixed\",\"important\"),a.style.setProperty(\"top\",\"0\",\"important\"),a.style.setProperty(\"left\",\"0\",\"important\"),a.style.setProperty(\"box-sizing\",\"content-box\",\"important\"),a.style.setProperty(\"padding\",i/o+\"px\",\"important\"),a.style.setProperty(\"background\",\"rgb(128, 128, 128)\",\"important\"),a.style.setProperty(\"z-index\",\"2147483647\",\"important\");for(var s,p=0;p<e.length;p+=s){for(s=1;e[p]===e[p+s];)++s;var l=e[p],y=document.createElement(\"div\");y.style.setProperty(\"display\",\"block\",\"important\"),y.style.setProperty(\"float\",\"left\",\"important\"),y.style.setProperty(\"width\",s*(n/o)+\"px\",\"important\"),y.style.setProperty(\"height\",n/o+\"px\",\"important\"),y.style.setProperty(\"background\",r[l],\"important\"),a.appendChild(y)}var m={value:\"none\",important:!0},d=t([document.documentElement,{transform:m,\"-webkit-transform\":m}]),u=t([document.body,{transform:m,\"-webkit-transform\":m}]);return document.documentElement.setAttribute(\"data-applitools-original-transforms\",JSON.stringify(d)),document.body.setAttribute(\"data-applitools-original-transforms\",JSON.stringify(u)),document.body.appendChild(a),{mask:e,size:n,offset:i}}}();\nreturn s(arg)}",
"blurElement": "function(arg){var s=function(){\"use strict\";return function(t){var n=(void 0===t?[]:t)[0]||document.activeElement;return n&&n.blur(),n}}();\nreturn s(arg)}",

@@ -14,8 +14,8 @@ "cleanupElementIds": "function(arg){var s=function(){\"use strict\";return function(t){t[0].forEach((function(t){if(t.removeAttribute(\"data-applitools-selector\"),t.getRootNode)for(var o=t.getRootNode();o!==document;o=o.host.getRootNode())o.host.removeAttribute(\"data-applitools-selector\")}))}}();\nreturn s(arg)}",

"getElementFixedAncestor": "function(arg){var s=function(){\"use strict\";return function(t){for(var e=(void 0===t?[]:t)[0];e.offsetParent&&e.offsetParent!==document.body&&e.offsetParent!==document.documentElement;)e=e.offsetParent;return\"fixed\"===window.getComputedStyle(e).getPropertyValue(\"position\")?e:null}}();\nreturn s(arg)}",
"getElementInnerOffset": "function(arg){var s=function(){\"use strict\";var r=function(r){var t=(void 0===r?[]:r)[0];return t?{x:t.scrollLeft,y:t.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var t=function(r){var t=void 0===r?[]:r,e=t[0],o=t[1];return(void 0===o?[]:o).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})};var e=function(r){var e=(void 0===r?[]:r)[0],o=void 0===e?document.scrollingElement||document.documentElement:e,n=t([o,[\"transform\",\"-webkit-transform\"]]),i=Object.keys(n).reduce((function(r,t){var e=n[t].value;if(e){var o=e.match(/^translate\\s*\\(\\s*(\\-?[\\d, \\.]+)px\\s*(,\\s*(-?[\\d, \\.]+)px)?\\s*\\)/);if(o){var i=o[1],s=void 0!==o[3]?o[3]:0;r.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(s))})}else r.push({x:0,y:0})}return r}),[]);if(!i.every((function(r){return i[0].x===r.x||i[0].y===r.y})))throw new Error(\"Got different css positions!\");return i[0]||{x:0,y:0}};return function(t){var o=(void 0===t?[]:t)[0],n=r([o]),i=e([o]);return{x:n.x+i.x,y:n.y+i.y}}}();\nreturn s(arg)}",
"getElementInnerOffset": "function(arg){var s=function(){\"use strict\";var r=function(r){var t=(void 0===r?[]:r)[0];return t?{x:t.scrollLeft,y:t.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var t=function(r){var t=void 0===r?[]:r,e=t[0],o=t[1];return(void 0===o?[]:o).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})};var e=function(r){var e=(void 0===r?[]:r)[0],o=void 0===e?document.documentElement:e,n=t([o,[\"transform\",\"-webkit-transform\"]]),i=Object.keys(n).reduce((function(r,t){var e=n[t].value;if(e){var o=e.match(/^translate\\s*\\(\\s*(\\-?[\\d, \\.]+)px\\s*(,\\s*(-?[\\d, \\.]+)px)?\\s*\\)/);if(o){var i=o[1],a=void 0!==o[3]?o[3]:0;r.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else r.push({x:0,y:0})}return r}),[]);if(!i.every((function(r){return i[0].x===r.x||i[0].y===r.y})))throw new Error(\"Got different css positions!\");return i[0]||{x:0,y:0}};return function(t){var o=(void 0===t?[]:t)[0],n=r([o]),i=e([o]);return{x:n.x+i.x,y:n.y+i.y}}}();\nreturn s(arg)}",
"getElementProperties": "function(arg){var s=function(){\"use strict\";return function(r){var n=void 0===r?[]:r,t=n[0],u=n[1];return(void 0===u?[]:u).reduce((function(r,n){return r[n]=t[n],r}),{})}}();\nreturn s(arg)}",
"getElementRect": "function(arg){var s=function(){\"use strict\";var t=function(t){for(var e=(void 0===t?[]:t)[0];e.offsetParent&&e.offsetParent!==document.body&&e.offsetParent!==document.documentElement;)e=e.offsetParent;return\"fixed\"===window.getComputedStyle(e).getPropertyValue(\"position\")?e:null};var e=function(t){var e=(void 0===t?[]:t)[0];return e?{x:e.scrollLeft,y:e.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var r=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1];return(void 0===o?[]:o).reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{})};var o=function(t){var e=(void 0===t?[]:t)[0],o=void 0===e?document.scrollingElement||document.documentElement:e,n=r([o,[\"transform\",\"-webkit-transform\"]]),i=Object.keys(n).reduce((function(t,e){var r=n[e].value;if(r){var o=r.match(/^translate\\s*\\(\\s*(\\-?[\\d, \\.]+)px\\s*(,\\s*(-?[\\d, \\.]+)px)?\\s*\\)/);if(o){var i=o[1],a=void 0!==o[3]?o[3]:0;t.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else t.push({x:0,y:0})}return t}),[]);if(!i.every((function(t){return i[0].x===t.x||i[0].y===t.y})))throw new Error(\"Got different css positions!\");return i[0]||{x:0,y:0}};var n=function(t){var r=(void 0===t?[]:t)[0],n=e([r]),i=o([r]);return{x:n.x+i.x,y:n.y+i.y}};return function(e){var r=void 0===e?[]:e,o=r[0],i=r[1],a=void 0!==i&&i,u=o.getBoundingClientRect(),d={x:u.left,y:u.top,width:u.width,height:u.height};if(a){var s=window.getComputedStyle(o);d.x+=parseInt(s.getPropertyValue(\"border-left-width\")),d.y+=parseInt(s.getPropertyValue(\"border-top-width\")),d.width=o.clientWidth,d.height=o.clientHeight}var f=t([o]);if(f){if(f!==o){var l=n([f]);d.x+=l.x,d.y+=l.y}}else{var v=n();d.x+=v.x,d.y+=v.y}return d}}();\nreturn s(arg)}",
"getElementRect": "function(arg){var s=function(){\"use strict\";var t=function(t){for(var e=(void 0===t?[]:t)[0];e.offsetParent&&e.offsetParent!==document.body&&e.offsetParent!==document.documentElement;)e=e.offsetParent;return\"fixed\"===window.getComputedStyle(e).getPropertyValue(\"position\")?e:null};var e=function(t){var e=(void 0===t?[]:t)[0];return e?{x:e.scrollLeft,y:e.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var r=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1];return(void 0===o?[]:o).reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{})};var o=function(t){var e=(void 0===t?[]:t)[0],o=void 0===e?document.documentElement:e,n=r([o,[\"transform\",\"-webkit-transform\"]]),i=Object.keys(n).reduce((function(t,e){var r=n[e].value;if(r){var o=r.match(/^translate\\s*\\(\\s*(\\-?[\\d, \\.]+)px\\s*(,\\s*(-?[\\d, \\.]+)px)?\\s*\\)/);if(o){var i=o[1],a=void 0!==o[3]?o[3]:0;t.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else t.push({x:0,y:0})}return t}),[]);if(!i.every((function(t){return i[0].x===t.x||i[0].y===t.y})))throw new Error(\"Got different css positions!\");return i[0]||{x:0,y:0}};var n=function(t){var r=(void 0===t?[]:t)[0],n=e([r]),i=o([r]);return{x:n.x+i.x,y:n.y+i.y}};return function(e){var r=void 0===e?[]:e,o=r[0],i=r[1],a=void 0!==i&&i;if(o===document.scrollingElement)return{x:0,y:0,width:o.clientWidth,height:o.clientHeight};var d=o.getBoundingClientRect(),u={x:d.left,y:d.top,width:d.width,height:d.height};if(a){var f=window.getComputedStyle(o);u.x+=parseInt(f.getPropertyValue(\"border-left-width\")),u.y+=parseInt(f.getPropertyValue(\"border-top-width\")),u.width=o.clientWidth,u.height=o.clientHeight}var l=t([o]);if(l){if(l!==o){var s=n([l]);u.x+=s.x,u.y+=s.y}}else{var v=n();u.x+=v.x,u.y+=v.y}return u}}();\nreturn s(arg)}",
"getElementScrollOffset": "function(arg){var s=function(){\"use strict\";return function(o){var r=(void 0===o?[]:o)[0];return r?{x:r.scrollLeft,y:r.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}}}();\nreturn s(arg)}",
"getElementStyleProperties": "function(arg){var s=function(){\"use strict\";return function(r){var t=void 0===r?[]:r,e=t[0],n=t[1];return(void 0===n?[]:n).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})}}();\nreturn s(arg)}",
"getElementTranslateOffset": "function(arg){var s=function(){\"use strict\";var r=function(r){var t=void 0===r?[]:r,e=t[0],n=t[1];return(void 0===n?[]:n).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})};return function(t){var e=(void 0===t?[]:t)[0],n=void 0===e?document.scrollingElement||document.documentElement:e,o=r([n,[\"transform\",\"-webkit-transform\"]]),u=Object.keys(o).reduce((function(r,t){var e=o[t].value;if(e){var n=e.match(/^translate\\s*\\(\\s*(\\-?[\\d, \\.]+)px\\s*(,\\s*(-?[\\d, \\.]+)px)?\\s*\\)/);if(n){var u=n[1],s=void 0!==n[3]?n[3]:0;r.push({x:Math.round(-parseFloat(u)),y:Math.round(-parseFloat(s))})}else r.push({x:0,y:0})}return r}),[]);if(!u.every((function(r){return u[0].x===r.x||u[0].y===r.y})))throw new Error(\"Got different css positions!\");return u[0]||{x:0,y:0}}}();\nreturn s(arg)}",
"getElementTranslateOffset": "function(arg){var s=function(){\"use strict\";var r=function(r){var t=void 0===r?[]:r,e=t[0],n=t[1];return(void 0===n?[]:n).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})};return function(t){var e=(void 0===t?[]:t)[0],n=void 0===e?document.documentElement:e,o=r([n,[\"transform\",\"-webkit-transform\"]]),u=Object.keys(o).reduce((function(r,t){var e=o[t].value;if(e){var n=e.match(/^translate\\s*\\(\\s*(\\-?[\\d, \\.]+)px\\s*(,\\s*(-?[\\d, \\.]+)px)?\\s*\\)/);if(n){var u=n[1],a=void 0!==n[3]?n[3]:0;r.push({x:Math.round(-parseFloat(u)),y:Math.round(-parseFloat(a))})}else r.push({x:0,y:0})}return r}),[]);if(!u.every((function(r){return u[0].x===r.x||u[0].y===r.y})))throw new Error(\"Got different css positions!\");return u[0]||{x:0,y:0}}}();\nreturn s(arg)}",
"getElementXpath": "function(arg){var s=function(){\"use strict\";return function(r){var e=(void 0===r?[]:r)[0],t=\"\",n=e.ownerDocument;if(!n)return t;for(var a=e;a!==n;){var o=Array.prototype.filter.call(a.parentNode.childNodes,(function(r){return r.tagName===a.tagName})).indexOf(a);t=\"/\"+a.tagName+\"[\"+(o+1)+\"]\"+t,a=a.parentNode}return t}}();\nreturn s(arg)}",

@@ -25,3 +25,3 @@ "getPixelRatio": "function(arg){var s=function(){\"use strict\";return function(){return window.devicePixelRatio}}();\nreturn s(arg)}",

"getUserAgent": "function(arg){var s=function(){\"use strict\";return function(){return window.navigator.userAgent}}();\nreturn s(arg)}",
"getViewportSize": "function(arg){var s=function(){\"use strict\";return function(){var e=0,t=0;return window.innerHeight?t=window.innerHeight:document.documentElement&&document.documentElement.clientHeight?t=document.documentElement.clientHeight:document.body&&document.body.clientHeight&&(t=document.body.clientHeight),window.innerWidth?e=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?e=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(e=document.body.clientWidth),{width:e,height:t}}}();\nreturn s(arg)}",
"getViewportSize": "function(arg){var s=function(){\"use strict\";return function(){var e=0,t=0;return window.innerHeight?t=window.innerHeight:document.documentElement&&document.documentElement.clientHeight?t=document.documentElement.clientHeight:document.body&&document.body.clientHeight&&(t=document.body.clientHeight),window.innerWidth?e=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?e=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(e=document.body.clientWidth),window.visualViewport&&(e*=window.visualViewport.scale,t*=window.visualViewport.scale),{width:e,height:t}}}();\nreturn s(arg)}",
"isElementScrollable": "function(arg){var s=function(){\"use strict\";return function(t){var i=(void 0===t?[]:t)[0];return i.scrollWidth>i.clientWidth||i.scrollHeight>i.clientHeight}}();\nreturn s(arg)}",

@@ -28,0 +28,0 @@ "isEqualElements": "function(arg){var s=function(){\"use strict\";return function(r){var n=void 0===r?[]:r;return n[0]===n[1]}}();\nreturn s(arg)}",

@@ -6,3 +6,3 @@ exports.addElementIds=function(arg){

exports.addPageMarker=function(arg){
var s=function(){"use strict";var t=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),i=n.reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{});return n.forEach((function(t){r.style.setProperty(t,"string"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?"important":"")})),i};return function(){var e=[1,0,1,1,0,1,1,0,1,0,1,0,1,1,0,1,0,0,1,1,1],r={1:"rgb(0, 0, 0)",0:"rgb(255, 255, 255)"},o=Math.max(1,window.innerWidth/screen.availWidth),n=document.createElement("div");n.setAttribute("data-applitools-marker",""),n.style.setProperty("position","fixed","important"),n.style.setProperty("top","0","important"),n.style.setProperty("left","0","important"),n.style.setProperty("box-sizing","content-box","important"),n.style.setProperty("padding","1px","important"),n.style.setProperty("z-index","2147483647","important"),e.forEach((function(t){var e=document.createElement("div");e.style.setProperty("display","block","important"),e.style.setProperty("float","left","important"),e.style.setProperty("width",o+"px","important"),e.style.setProperty("height","1px","important"),e.style.setProperty("background",r[t],"important"),n.appendChild(e)}));var i={value:"none",important:!0},a=t([document.documentElement,{transform:i,"-webkit-transform":i}]),s=t([document.body,{transform:i,"-webkit-transform":i}]);return document.documentElement.setAttribute("data-applitools-original-transforms",JSON.stringify(a)),document.body.setAttribute("data-applitools-original-transforms",JSON.stringify(s)),document.body.appendChild(n),{mask:e,size:o,offset:1}}}();
var s=function(){"use strict";var t=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),i=n.reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{});return n.forEach((function(t){r.style.setProperty(t,"string"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?"important":"")})),i};return function(){var e=[1,0,1,1,0,1,1,0,1,0,1,0,1,1,0,1,0,0,1,1,1],r={1:"rgb(0, 0, 0)",0:"rgb(255, 255, 255)"},o=visualViewport?visualViewport.scale:1,n=o>=1?1:2,i=n,a=document.createElement("div");a.setAttribute("data-applitools-marker",""),a.style.setProperty("position","fixed","important"),a.style.setProperty("top","0","important"),a.style.setProperty("left","0","important"),a.style.setProperty("box-sizing","content-box","important"),a.style.setProperty("padding",i/o+"px","important"),a.style.setProperty("background","rgb(128, 128, 128)","important"),a.style.setProperty("z-index","2147483647","important");for(var s,p=0;p<e.length;p+=s){for(s=1;e[p]===e[p+s];)++s;var l=e[p],y=document.createElement("div");y.style.setProperty("display","block","important"),y.style.setProperty("float","left","important"),y.style.setProperty("width",s*(n/o)+"px","important"),y.style.setProperty("height",n/o+"px","important"),y.style.setProperty("background",r[l],"important"),a.appendChild(y)}var m={value:"none",important:!0},d=t([document.documentElement,{transform:m,"-webkit-transform":m}]),u=t([document.body,{transform:m,"-webkit-transform":m}]);return document.documentElement.setAttribute("data-applitools-original-transforms",JSON.stringify(d)),document.body.setAttribute("data-applitools-original-transforms",JSON.stringify(u)),document.body.appendChild(a),{mask:e,size:n,offset:i}}}();
return s(arg)

@@ -51,3 +51,3 @@ }

exports.getElementInnerOffset=function(arg){
var s=function(){"use strict";var r=function(r){var t=(void 0===r?[]:r)[0];return t?{x:t.scrollLeft,y:t.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var t=function(r){var t=void 0===r?[]:r,e=t[0],o=t[1];return(void 0===o?[]:o).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})};var e=function(r){var e=(void 0===r?[]:r)[0],o=void 0===e?document.scrollingElement||document.documentElement:e,n=t([o,["transform","-webkit-transform"]]),i=Object.keys(n).reduce((function(r,t){var e=n[t].value;if(e){var o=e.match(/^translate\s*\(\s*(\-?[\d, \.]+)px\s*(,\s*(-?[\d, \.]+)px)?\s*\)/);if(o){var i=o[1],s=void 0!==o[3]?o[3]:0;r.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(s))})}else r.push({x:0,y:0})}return r}),[]);if(!i.every((function(r){return i[0].x===r.x||i[0].y===r.y})))throw new Error("Got different css positions!");return i[0]||{x:0,y:0}};return function(t){var o=(void 0===t?[]:t)[0],n=r([o]),i=e([o]);return{x:n.x+i.x,y:n.y+i.y}}}();
var s=function(){"use strict";var r=function(r){var t=(void 0===r?[]:r)[0];return t?{x:t.scrollLeft,y:t.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var t=function(r){var t=void 0===r?[]:r,e=t[0],o=t[1];return(void 0===o?[]:o).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})};var e=function(r){var e=(void 0===r?[]:r)[0],o=void 0===e?document.documentElement:e,n=t([o,["transform","-webkit-transform"]]),i=Object.keys(n).reduce((function(r,t){var e=n[t].value;if(e){var o=e.match(/^translate\s*\(\s*(\-?[\d, \.]+)px\s*(,\s*(-?[\d, \.]+)px)?\s*\)/);if(o){var i=o[1],a=void 0!==o[3]?o[3]:0;r.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else r.push({x:0,y:0})}return r}),[]);if(!i.every((function(r){return i[0].x===r.x||i[0].y===r.y})))throw new Error("Got different css positions!");return i[0]||{x:0,y:0}};return function(t){var o=(void 0===t?[]:t)[0],n=r([o]),i=e([o]);return{x:n.x+i.x,y:n.y+i.y}}}();
return s(arg)

@@ -60,3 +60,3 @@ }

exports.getElementRect=function(arg){
var s=function(){"use strict";var t=function(t){for(var e=(void 0===t?[]:t)[0];e.offsetParent&&e.offsetParent!==document.body&&e.offsetParent!==document.documentElement;)e=e.offsetParent;return"fixed"===window.getComputedStyle(e).getPropertyValue("position")?e:null};var e=function(t){var e=(void 0===t?[]:t)[0];return e?{x:e.scrollLeft,y:e.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var r=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1];return(void 0===o?[]:o).reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{})};var o=function(t){var e=(void 0===t?[]:t)[0],o=void 0===e?document.scrollingElement||document.documentElement:e,n=r([o,["transform","-webkit-transform"]]),i=Object.keys(n).reduce((function(t,e){var r=n[e].value;if(r){var o=r.match(/^translate\s*\(\s*(\-?[\d, \.]+)px\s*(,\s*(-?[\d, \.]+)px)?\s*\)/);if(o){var i=o[1],a=void 0!==o[3]?o[3]:0;t.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else t.push({x:0,y:0})}return t}),[]);if(!i.every((function(t){return i[0].x===t.x||i[0].y===t.y})))throw new Error("Got different css positions!");return i[0]||{x:0,y:0}};var n=function(t){var r=(void 0===t?[]:t)[0],n=e([r]),i=o([r]);return{x:n.x+i.x,y:n.y+i.y}};return function(e){var r=void 0===e?[]:e,o=r[0],i=r[1],a=void 0!==i&&i,u=o.getBoundingClientRect(),d={x:u.left,y:u.top,width:u.width,height:u.height};if(a){var s=window.getComputedStyle(o);d.x+=parseInt(s.getPropertyValue("border-left-width")),d.y+=parseInt(s.getPropertyValue("border-top-width")),d.width=o.clientWidth,d.height=o.clientHeight}var f=t([o]);if(f){if(f!==o){var l=n([f]);d.x+=l.x,d.y+=l.y}}else{var v=n();d.x+=v.x,d.y+=v.y}return d}}();
var s=function(){"use strict";var t=function(t){for(var e=(void 0===t?[]:t)[0];e.offsetParent&&e.offsetParent!==document.body&&e.offsetParent!==document.documentElement;)e=e.offsetParent;return"fixed"===window.getComputedStyle(e).getPropertyValue("position")?e:null};var e=function(t){var e=(void 0===t?[]:t)[0];return e?{x:e.scrollLeft,y:e.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var r=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1];return(void 0===o?[]:o).reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{})};var o=function(t){var e=(void 0===t?[]:t)[0],o=void 0===e?document.documentElement:e,n=r([o,["transform","-webkit-transform"]]),i=Object.keys(n).reduce((function(t,e){var r=n[e].value;if(r){var o=r.match(/^translate\s*\(\s*(\-?[\d, \.]+)px\s*(,\s*(-?[\d, \.]+)px)?\s*\)/);if(o){var i=o[1],a=void 0!==o[3]?o[3]:0;t.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else t.push({x:0,y:0})}return t}),[]);if(!i.every((function(t){return i[0].x===t.x||i[0].y===t.y})))throw new Error("Got different css positions!");return i[0]||{x:0,y:0}};var n=function(t){var r=(void 0===t?[]:t)[0],n=e([r]),i=o([r]);return{x:n.x+i.x,y:n.y+i.y}};return function(e){var r=void 0===e?[]:e,o=r[0],i=r[1],a=void 0!==i&&i;if(o===document.scrollingElement)return{x:0,y:0,width:o.clientWidth,height:o.clientHeight};var d=o.getBoundingClientRect(),u={x:d.left,y:d.top,width:d.width,height:d.height};if(a){var f=window.getComputedStyle(o);u.x+=parseInt(f.getPropertyValue("border-left-width")),u.y+=parseInt(f.getPropertyValue("border-top-width")),u.width=o.clientWidth,u.height=o.clientHeight}var l=t([o]);if(l){if(l!==o){var s=n([l]);u.x+=s.x,u.y+=s.y}}else{var v=n();u.x+=v.x,u.y+=v.y}return u}}();
return s(arg)

@@ -73,3 +73,3 @@ }

exports.getElementTranslateOffset=function(arg){
var s=function(){"use strict";var r=function(r){var t=void 0===r?[]:r,e=t[0],n=t[1];return(void 0===n?[]:n).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})};return function(t){var e=(void 0===t?[]:t)[0],n=void 0===e?document.scrollingElement||document.documentElement:e,o=r([n,["transform","-webkit-transform"]]),u=Object.keys(o).reduce((function(r,t){var e=o[t].value;if(e){var n=e.match(/^translate\s*\(\s*(\-?[\d, \.]+)px\s*(,\s*(-?[\d, \.]+)px)?\s*\)/);if(n){var u=n[1],s=void 0!==n[3]?n[3]:0;r.push({x:Math.round(-parseFloat(u)),y:Math.round(-parseFloat(s))})}else r.push({x:0,y:0})}return r}),[]);if(!u.every((function(r){return u[0].x===r.x||u[0].y===r.y})))throw new Error("Got different css positions!");return u[0]||{x:0,y:0}}}();
var s=function(){"use strict";var r=function(r){var t=void 0===r?[]:r,e=t[0],n=t[1];return(void 0===n?[]:n).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})};return function(t){var e=(void 0===t?[]:t)[0],n=void 0===e?document.documentElement:e,o=r([n,["transform","-webkit-transform"]]),u=Object.keys(o).reduce((function(r,t){var e=o[t].value;if(e){var n=e.match(/^translate\s*\(\s*(\-?[\d, \.]+)px\s*(,\s*(-?[\d, \.]+)px)?\s*\)/);if(n){var u=n[1],a=void 0!==n[3]?n[3]:0;r.push({x:Math.round(-parseFloat(u)),y:Math.round(-parseFloat(a))})}else r.push({x:0,y:0})}return r}),[]);if(!u.every((function(r){return u[0].x===r.x||u[0].y===r.y})))throw new Error("Got different css positions!");return u[0]||{x:0,y:0}}}();
return s(arg)

@@ -94,3 +94,3 @@ }

exports.getViewportSize=function(arg){
var s=function(){"use strict";return function(){var e=0,t=0;return window.innerHeight?t=window.innerHeight:document.documentElement&&document.documentElement.clientHeight?t=document.documentElement.clientHeight:document.body&&document.body.clientHeight&&(t=document.body.clientHeight),window.innerWidth?e=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?e=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(e=document.body.clientWidth),{width:e,height:t}}}();
var s=function(){"use strict";return function(){var e=0,t=0;return window.innerHeight?t=window.innerHeight:document.documentElement&&document.documentElement.clientHeight?t=document.documentElement.clientHeight:document.body&&document.body.clientHeight&&(t=document.body.clientHeight),window.innerWidth?e=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?e=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(e=document.body.clientWidth),window.visualViewport&&(e*=window.visualViewport.scale,t*=window.visualViewport.scale),{width:e,height:t}}}();
return s(arg)

@@ -97,0 +97,0 @@ }

{
"name": "@applitools/snippets",
"version": "2.1.10",
"version": "2.1.11",
"license": "SEE LICENSE IN LICENSE",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

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