@featurepeek/snippet.js
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -1,1 +0,1 @@ | ||
function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){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 _iterableToArrayLimit(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var o=[],n=!0,r=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(n=(i=c.next()).done)&&(o.push(i.value),!t||o.length!==t);n=!0);}catch(e){r=!0,a=e}finally{try{n||null==c.return||c.return()}finally{if(r)throw a}}return o}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}!function(){function r(e,t){return o=t,e.x<o.x&&(t=t,(e=e).x+e.width<t.x);var o}function a(e,t){return o=t,e.y<o.y&&(t=t,(e=e).y+e.height<t.y);var o}function o(e,t){return e.width<=t.width?e:t}function n(e,t){return e.height<=t.height?e:t}function i(e,t){return e.y!==o(e,t).y?C(t,e):{x:e.x+e.width/2,y:e.y+e.height,height:t.y-(e.y+e.height)}}function c(e,t){return e.x!==n(e,t).x?R(t,e):{x:t.x+t.width,y:e.y+e.height/2,width:e.x-(t.x+t.width)}}function d(e,t){return e.x<=t.x&&e.y<=t.y&&e.x+e.width>=t.x+t.width&&e.y+e.height>=t.y+t.height}function s(e,t,o){var n=2<arguments.length&&void 0!==o?o:"red",r={blue:{hex:"#18a0fb",data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAIAAADZrBkAAAAAPklEQVR4AWOQWPAbH5oPQpjiIG2EEC20/ScCDJi2+XTTNp9UbfPgts0hRdt8uLa55DlyHhnahkZ00z8HkIEAA7TgNxFIMYsAAAAASUVORK5CYII="},red:{hex:"#f24822",data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAIAAADZrBkAAAAAHUlEQVR4AWP45KFEBhoobf+JALTXNqptVNuQyDgAD6SjH1sbDJwAAAAASUVORK5CYII="}};return["border: 1px solid","border-image: url(".concat(r[n].data,") 30 / 9px / 5px"),"box-shadow: 0 0 0 2px ".concat(r[n].hex),"display: flex","height: ".concat(Math.max(t.height-2,0),"px"),"justify-content: center","left: ".concat(e.pageXOffset+t.x,"px"),"pointer-events: none","position: absolute","top: ".concat(e.pageYOffset+t.y,"px"),"visibility: visible","width: ".concat(Math.max(t.width-2,0),"px"),"z-index: 99999999999999999"].join(";")}function l(e,t,o){var n=2<arguments.length&&void 0!==o?o:"red";if(i=e.document.getElementById(t))return i;var r=e.document.createElement("div"),a=e.document.createElement("code"),i=e.document.createElement("span");return r.id=t,a.style=["background: #ffffc2","font-size: 11px","left: 4px","line-height: 11px","margin: 0","max-width: calc(100% - 7px)","overflow: hidden","padding: 2px 4px","position: absolute","text-overflow: ellipsis","top: -18px","white-space: nowrap","word-wrap: normal"].join(";"),i.style=["background: ".concat("red"===n?"#fdeae6":"#e6f4ff"),"border-radius: 3px","bottom: -20px","color: ".concat("red"===n?"#f24822":"#18a0fb"),"font-family: -apple-system, 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif","font-size: 11px","line-height: 11px","margin: 0","padding: 2px 4px","position: absolute","text-align: center","white-space: nowrap"].join(";"),r.appendChild(a),r.appendChild(i),e.document.body.appendChild(r),e.document.getElementById(t)}function h(e,t){var o=e.document.getElementById(t);return o||((o=e.document.createElement("div")).id=t,e.document.body.appendChild(o),e.document.getElementById(t))}function p(e){return['<span style="color:#88137f">'.concat(e.tagName.toLowerCase(),"</span>"),e.id&&'<span style="color:#1a1aa6">#'.concat(e.id,"</span>"),e.className&&'<span style="color:#9a4500">.'.concat(e.className.replace(/ /g,"."),"</span>")].filter(Boolean).join("")}function y(t){var o=["align-items: center","border-width: 1px","font-size: 11px","line-height: 11px","margin: 0","padding: 0","pointer-events: none","position: absolute","visibility: visible","z-index: 9999999999999"],n=["background: #fdeae6","border-radius: 3px","color: #f24822","font-family: -apple-system, 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif","margin: 3px","padding: 2px 4px"];Object.keys(t).forEach(function(e){e=t[e];e.el.style=[].concat(o,_toConsumableArray(e.styles),["display: ".concat(1<e.distance?"flex":"none")]).join(";"),e.el.innerHTML='<span style="'.concat(n.join(";"),'">').concat(e.distance,"</span>")})}function f(e,t,o,n){var r=(s=o,i=n,Math.round(i.x>s.x+s.width?i.x-(s.x+s.width):s.x-(i.x+i.width))),a=(c=o,d=n,Math.round(d.y>c.y+c.height?d.y-(c.y+c.height):c.y-(d.y+d.height))),i=(l=n,{horz:{x:(s=o).x<l.x?s.x+s.width:l.x+l.width,y:s.y<l.y?s.y+s.height/2:l.y+l.height},vert:{x:s.x<l.x?s.x+s.width/2:s.x,y:s.y<l.y?s.y+s.height:l.y+l.height}}),c=e.pageXOffset+i.horz.x,d=e.pageYOffset+i.horz.y,s=a+o.height/2,l=e.pageXOffset+i.vert.x,e=e.pageYOffset+i.vert.y,i=o.width/2,i={horz:{el:t[0],distance:r,styles:["border-top-style: ".concat(o.y<n.y?"solid":"dashed"),"border-right-style: dashed","border-bottom-style: ".concat(o.y>n.y?"solid":"dashed"),"border-left-style: dashed","border-top-color: #f24822","border-right-color: ".concat(o.x<n.x?"#f24822":"transparent"),"border-bottom-color: #f24822","border-left-color: ".concat(o.x>n.x?"#f24822":"transparent"),"flex-direction: column","justify-content: flex-".concat(o.y<n.y?"start":"end"),"height: ".concat(s-2,"px"),"left: ".concat(c,"px"),"top: ".concat(d,"px"),"width: ".concat(r-2,"px")]},vert:{el:t[1],distance:a,styles:["border-top-style: dashed","border-right-style: solid","border-bottom-style: dashed","border-left-style: solid","border-top-color: ".concat(o.y>n.y?"#f24822":"transparent"),"border-right-color: ".concat(o.x>n.x?"#f24822":"transparent"),"border-bottom-color: ".concat(o.y<n.y?"#f24822":"transparent"),"border-left-color: ".concat(o.x<n.x?"#f24822":"transparent"),"justify-content: flex-".concat(o.x<n.x?"start":"end"),"height: ".concat(a-2,"px"),"left: ".concat(l,"px"),"top: ".concat(e,"px"),"width: ".concat(i-2,"px")]}};y(i)}function u(e,t,o,n){o={north:{el:t[0],distance:Math.round(n.y-o.y),styles:["border-left: 1px solid #f24822","height: ".concat(n.y-o.y,"px"),"left: ".concat(e.pageXOffset+n.x+n.width/2,"px"),"top: ".concat(e.pageYOffset+o.y-2,"px")]},south:{el:t[1],distance:Math.round(o.y+o.height-(n.y+n.height)),styles:["border-left: 1px solid #f24822","height: ".concat(o.y+o.height-(n.y+n.height),"px"),"left: ".concat(e.pageXOffset+n.x+n.width/2,"px"),"top: ".concat(e.pageYOffset+n.y+n.height+2,"px")]},east:{el:t[2],distance:Math.round(o.x+o.width-(n.x+n.width)),styles:["border-top: 1px solid #f24822","flex-direction: column","left: ".concat(e.pageXOffset+n.x+n.width+2,"px"),"top: ".concat(e.pageYOffset+n.y+n.height/2,"px"),"width: ".concat(o.x+o.width-(n.x+n.width),"px")]},west:{el:t[3],distance:Math.round(n.x-o.x),styles:["border-top: 1px solid #f24822","flex-direction: column","left: ".concat(e.pageXOffset+o.x,"px"),"top: ".concat(e.pageYOffset+n.y+n.height/2,"px"),"width: ".concat(n.x-o.x-2,"px")]}},y(o)}function x(e){e.forEach(function(e){e&&(e.style.visibility="hidden")})}function g(e){var t;e&&m&&(t=e.getBoundingClientRect(),m.style=s(window,t,"blue"),w.innerHTML=p(e),A.innerText="".concat(Math.round(t.width)," × ").concat(Math.round(t.height)),x([v,O,I,T,k]))}function b(e){var t,o,n;v&&(t=m.getBoundingClientRect(),o=e.getBoundingClientRect(),v.style=s(window,o,"red"),_.innerHTML=p(e),E.innerText="".concat(Math.round(o.width)," × ").concat(Math.round(o.height)),(r(n=t,e=o)||r(e,n))&&(a(n,e)||a(e,n))?(f(window,[O,I],t,o),x([T,k])):d(t,o)?u(window,[O,I,T,k],t,o):d(o,t)?u(window,[O,I,T,k],o,t):(N(t,o)?function(e,t,o,n){n=i(o,n),n={pos:{el:t,distance:Math.round(n.height),styles:["border-left: 1px solid #f24822","height: ".concat(n.height,"px"),"left: ".concat(e.pageXOffset+n.x,"px"),"top: ".concat(e.pageYOffset+n.y,"px")]}};y(n)}(window,O,t,o):a(o,t)?function(e,t,o,n){n=C(o,n),n={pos:{el:t,distance:Math.round(n.height),styles:["border-left: 1px solid #f24822","height: ".concat(n.height,"px"),"left: ".concat(e.pageXOffset+n.x,"px"),"top: ".concat(e.pageYOffset+n.y,"px")]}};y(n)}(window,O,t,o):r(o,t)?function(e,t,o,n){n=c(o,n),n={pos:{el:t,distance:Math.round(n.width),styles:["border-top: 1px solid #f24822","flex-direction: column","left: ".concat(e.pageXOffset+n.x,"px"),"top: ".concat(e.pageYOffset+n.y,"px"),"width: ".concat(n.width,"px")]}};y(n)}(window,O,t,o):B(t,o)&&function(e,t,o,n){n=R(o,n),n={pos:{el:t,distance:Math.round(n.width),styles:["border-top: 1px solid #f24822","flex-direction: column","left: ".concat(e.pageXOffset+n.x,"px"),"top: ".concat(e.pageYOffset+n.y,"px"),"width: ".concat(n.width,"px")]}};y(n)}(window,O,t,o),x([I,T,k])))}var m,w,A,v,_,E,O,I,T,k,M,S,L,N=a,B=r,C=function(e,t){return e.y!==o(e,t).y?i(t,e):{x:e.x+e.width/2,y:t.y+t.height,height:e.y-(t.y+t.height)}},R=function(e,t){return e.x!==n(e,t).x?c(t,e):{x:e.x+e.width,y:e.y+e.height/2,width:t.x-(e.x+e.width)}},j="_featurepeek_selection_box",H="_featurepeek_comparison_box",Y="_featurepeek_measure_1",D="_featurepeek_measure_2",U="_featurepeek_measure_3",X="_featurepeek_measure_4";try{var e=window.__FEATUREPEEK__,t=e.branch,z=e.env,F=e.org,P=e.repo,e=e.sha,V="https://dashboard".concat("dev"===z?".dev":"",".featurepeek.com"),W=document.createElement("iframe");W.allow="display-capture",W.src="".concat(V,"/vercel/").concat(F,"/").concat(P,"/").concat(t,"/").concat(e,"/").concat(document.location.hostname),W.style=["display:block","border:0","position:fixed","left:0","bottom:0","width:52px","height:300px","z-index:9999999999"].join(";"),document.body.appendChild(W),window.addEventListener("message",function(e){var t;if(e.origin===V)switch(e.data){case"FULL_VIEWPORT":W.style.height="100vh",W.style.width="100vw";break;case"HALF_VIEWPORT":W.style.height="300px",W.style.width="240px";break;case"TINY_VIEWPORT":W.style.height="300px",W.style.width="52px";break;case"DESIGN_MODE_ON":document.designMode="on";break;case"DESIGN_MODE_OFF":document.designMode="off";break;case"BEGIN_SELECTION":!function(){document.body.style.cursor="crosshair";var e=_slicedToArray((m=l(window,j,"blue")).getElementsByTagName("code"),1);w=e[0],e=_slicedToArray(m.getElementsByTagName("span"),1),A=e[0],e=_slicedToArray((v=l(window,H,"red")).getElementsByTagName("code"),1),_=e[0],e=_slicedToArray(v.getElementsByTagName("span"),1),E=e[0],O=h(window,Y),I=h(window,D),T=h(window,U),k=h(window,X),S=function(e){m?(M?b:g)(e.target):document.body.removeEventListener("mouseover",S)},(L=function(e){e?(e.preventDefault(),e.stopPropagation(),g(e.target),M=!0):(e=document.querySelectorAll(":hover"))&&(e=e[e.length-1],g(e))})(),document.body.addEventListener("click",L),document.body.addEventListener("mouseover",S)}();break;case"END_SELECTION":M=!1,document.body.style.cursor="default",t=window,[j,H,Y,D,U,X].forEach(function(e){e=t.document.getElementById(e);e&&e.parentNode.removeChild(e)}),document.body.removeEventListener("mouseover",S),document.body.removeEventListener("click",L);break;case"LOCATION_HREF":e.source.postMessage({type:"LOCATION_HREF",value:document.location.href},e.origin)}})}catch(e){}}(); | ||
function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){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 _iterableToArrayLimit(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var o=[],n=!0,r=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(n=(i=c.next()).done)&&(o.push(i.value),!t||o.length!==t);n=!0);}catch(e){r=!0,a=e}finally{try{n||null==c.return||c.return()}finally{if(r)throw a}}return o}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}!function(){function r(e,t){return o=t,e.x<o.x&&(t=t,(e=e).x+e.width<t.x);var o}function a(e,t){return o=t,e.y<o.y&&(t=t,(e=e).y+e.height<t.y);var o}function o(e,t){return e.width<=t.width?e:t}function n(e,t){return e.height<=t.height?e:t}function i(e,t){return e.y!==o(e,t).y?B(t,e):{x:e.x+e.width/2,y:e.y+e.height,height:t.y-(e.y+e.height)}}function c(e,t){return e.x!==n(e,t).x?R(t,e):{x:t.x+t.width,y:e.y+e.height/2,width:e.x-(t.x+t.width)}}function d(e,t){return e.x<=t.x&&e.y<=t.y&&e.x+e.width>=t.x+t.width&&e.y+e.height>=t.y+t.height}function s(e,t,o){var n=2<arguments.length&&void 0!==o?o:"red",r={blue:{hex:"#18a0fb",data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAIAAADZrBkAAAAAPklEQVR4AWOQWPAbH5oPQpjiIG2EEC20/ScCDJi2+XTTNp9UbfPgts0hRdt8uLa55DlyHhnahkZ00z8HkIEAA7TgNxFIMYsAAAAASUVORK5CYII="},red:{hex:"#f24822",data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAIAAADZrBkAAAAAHUlEQVR4AWP45KFEBhoobf+JALTXNqptVNuQyDgAD6SjH1sbDJwAAAAASUVORK5CYII="}};return["border: 1px solid","border-image: url(".concat(r[n].data,") 30 / 9px / 5px"),"box-shadow: 0 0 0 2px ".concat(r[n].hex),"display: flex","height: ".concat(Math.max(t.height-2,0),"px"),"justify-content: center","left: ".concat(e.pageXOffset+t.x,"px"),"pointer-events: none","position: absolute","top: ".concat(e.pageYOffset+t.y,"px"),"visibility: visible","width: ".concat(Math.max(t.width-2,0),"px"),"z-index: 99999999999999999"].join(";")}function l(e,t,o){var n=2<arguments.length&&void 0!==o?o:"red";if(i=e.document.getElementById(t))return i;var r=e.document.createElement("div"),a=e.document.createElement("code"),i=e.document.createElement("span");return r.id=t,a.style=["background: #ffffc2","font-size: 11px","left: 4px","line-height: 11px","margin: 0","max-width: calc(100% - 7px)","overflow: hidden","padding: 2px 4px","position: absolute","text-overflow: ellipsis","top: -18px","white-space: nowrap","word-wrap: normal"].join(";"),i.style=["background: ".concat("red"===n?"#fdeae6":"#e6f4ff"),"border-radius: 3px","bottom: -20px","color: ".concat("red"===n?"#f24822":"#18a0fb"),"font-family: -apple-system, 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif","font-size: 11px","line-height: 11px","margin: 0","padding: 2px 4px","position: absolute","text-align: center","white-space: nowrap"].join(";"),r.appendChild(a),r.appendChild(i),e.document.body.appendChild(r),e.document.getElementById(t)}function h(e,t){var o=e.document.getElementById(t);return o||((o=e.document.createElement("div")).id=t,e.document.body.appendChild(o),e.document.getElementById(t))}function p(e){return['<span style="color:#88137f">'.concat(e.tagName.toLowerCase(),"</span>"),e.id&&'<span style="color:#1a1aa6">#'.concat(e.id,"</span>"),e.className&&'<span style="color:#9a4500">.'.concat(e.className.replace(/ /g,"."),"</span>")].filter(Boolean).join("")}function y(t){var o=["align-items: center","border-width: 1px","font-size: 11px","line-height: 11px","margin: 0","padding: 0","pointer-events: none","position: absolute","visibility: visible","z-index: 9999999999999"],n=["background: #fdeae6","border-radius: 3px","color: #f24822","font-family: -apple-system, 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif","margin: 3px","padding: 2px 4px"];Object.keys(t).forEach(function(e){e=t[e];e.el.style=[].concat(o,_toConsumableArray(e.styles),["display: ".concat(1<e.distance?"flex":"none")]).join(";"),e.el.innerHTML='<span style="'.concat(n.join(";"),'">').concat(e.distance,"</span>")})}function f(e,t,o,n){var r=(s=o,i=n,Math.round(i.x>s.x+s.width?i.x-(s.x+s.width):s.x-(i.x+i.width))),a=(c=o,d=n,Math.round(d.y>c.y+c.height?d.y-(c.y+c.height):c.y-(d.y+d.height))),i=(l=n,{horz:{x:(s=o).x<l.x?s.x+s.width:l.x+l.width,y:s.y<l.y?s.y+s.height/2:l.y+l.height},vert:{x:s.x<l.x?s.x+s.width/2:s.x,y:s.y<l.y?s.y+s.height:l.y+l.height}}),c=e.pageXOffset+i.horz.x,d=e.pageYOffset+i.horz.y,s=a+o.height/2,l=e.pageXOffset+i.vert.x,e=e.pageYOffset+i.vert.y,i=o.width/2,i={horz:{el:t[0],distance:r,styles:["border-top-style: ".concat(o.y<n.y?"solid":"dashed"),"border-right-style: dashed","border-bottom-style: ".concat(o.y>n.y?"solid":"dashed"),"border-left-style: dashed","border-top-color: #f24822","border-right-color: ".concat(o.x<n.x?"#f24822":"transparent"),"border-bottom-color: #f24822","border-left-color: ".concat(o.x>n.x?"#f24822":"transparent"),"flex-direction: column","justify-content: flex-".concat(o.y<n.y?"start":"end"),"height: ".concat(s-2,"px"),"left: ".concat(c,"px"),"top: ".concat(d,"px"),"width: ".concat(r-2,"px")]},vert:{el:t[1],distance:a,styles:["border-top-style: dashed","border-right-style: solid","border-bottom-style: dashed","border-left-style: solid","border-top-color: ".concat(o.y>n.y?"#f24822":"transparent"),"border-right-color: ".concat(o.x>n.x?"#f24822":"transparent"),"border-bottom-color: ".concat(o.y<n.y?"#f24822":"transparent"),"border-left-color: ".concat(o.x<n.x?"#f24822":"transparent"),"justify-content: flex-".concat(o.x<n.x?"start":"end"),"height: ".concat(a-2,"px"),"left: ".concat(l,"px"),"top: ".concat(e,"px"),"width: ".concat(i-2,"px")]}};y(i)}function u(e,t,o,n){o={north:{el:t[0],distance:Math.round(n.y-o.y),styles:["border-left: 1px solid #f24822","height: ".concat(n.y-o.y,"px"),"left: ".concat(e.pageXOffset+n.x+n.width/2,"px"),"top: ".concat(e.pageYOffset+o.y-2,"px")]},south:{el:t[1],distance:Math.round(o.y+o.height-(n.y+n.height)),styles:["border-left: 1px solid #f24822","height: ".concat(o.y+o.height-(n.y+n.height),"px"),"left: ".concat(e.pageXOffset+n.x+n.width/2,"px"),"top: ".concat(e.pageYOffset+n.y+n.height+2,"px")]},east:{el:t[2],distance:Math.round(o.x+o.width-(n.x+n.width)),styles:["border-top: 1px solid #f24822","flex-direction: column","left: ".concat(e.pageXOffset+n.x+n.width+2,"px"),"top: ".concat(e.pageYOffset+n.y+n.height/2,"px"),"width: ".concat(o.x+o.width-(n.x+n.width),"px")]},west:{el:t[3],distance:Math.round(n.x-o.x),styles:["border-top: 1px solid #f24822","flex-direction: column","left: ".concat(e.pageXOffset+o.x,"px"),"top: ".concat(e.pageYOffset+n.y+n.height/2,"px"),"width: ".concat(n.x-o.x-2,"px")]}},y(o)}function x(e){e.forEach(function(e){e&&(e.style.visibility="hidden")})}function g(e){var t;e&&m&&(t=e.getBoundingClientRect(),m.style=s(window,t,"blue"),w.innerHTML=p(e),A.innerText="".concat(Math.round(t.width)," × ").concat(Math.round(t.height)),x([v,O,I,T,k]))}function b(e){var t,o,n;v&&(t=m.getBoundingClientRect(),o=e.getBoundingClientRect(),v.style=s(window,o,"red"),_.innerHTML=p(e),E.innerText="".concat(Math.round(o.width)," × ").concat(Math.round(o.height)),(r(n=t,e=o)||r(e,n))&&(a(n,e)||a(e,n))?(f(window,[O,I],t,o),x([T,k])):d(t,o)?u(window,[O,I,T,k],t,o):d(o,t)?u(window,[O,I,T,k],o,t):(C(t,o)?function(e,t,o,n){n=i(o,n),n={pos:{el:t,distance:Math.round(n.height),styles:["border-left: 1px solid #f24822","height: ".concat(n.height,"px"),"left: ".concat(e.pageXOffset+n.x,"px"),"top: ".concat(e.pageYOffset+n.y,"px")]}};y(n)}(window,O,t,o):a(o,t)?function(e,t,o,n){n=B(o,n),n={pos:{el:t,distance:Math.round(n.height),styles:["border-left: 1px solid #f24822","height: ".concat(n.height,"px"),"left: ".concat(e.pageXOffset+n.x,"px"),"top: ".concat(e.pageYOffset+n.y,"px")]}};y(n)}(window,O,t,o):r(o,t)?function(e,t,o,n){n=c(o,n),n={pos:{el:t,distance:Math.round(n.width),styles:["border-top: 1px solid #f24822","flex-direction: column","left: ".concat(e.pageXOffset+n.x,"px"),"top: ".concat(e.pageYOffset+n.y,"px"),"width: ".concat(n.width,"px")]}};y(n)}(window,O,t,o):N(t,o)&&function(e,t,o,n){n=R(o,n),n={pos:{el:t,distance:Math.round(n.width),styles:["border-top: 1px solid #f24822","flex-direction: column","left: ".concat(e.pageXOffset+n.x,"px"),"top: ".concat(e.pageYOffset+n.y,"px"),"width: ".concat(n.width,"px")]}};y(n)}(window,O,t,o),x([I,T,k])))}var m,w,A,v,_,E,O,I,T,k,M,S,L,C=a,N=r,B=function(e,t){return e.y!==o(e,t).y?i(t,e):{x:e.x+e.width/2,y:t.y+t.height,height:e.y-(t.y+t.height)}},R=function(e,t){return e.x!==n(e,t).x?c(t,e):{x:e.x+e.width,y:e.y+e.height/2,width:t.x-(e.x+e.width)}},j="_featurepeek_selection_box",H="_featurepeek_comparison_box",Y="_featurepeek_measure_1",U="_featurepeek_measure_2",D="_featurepeek_measure_3",X="_featurepeek_measure_4";try{var e=window.__FEATUREPEEK__,t=e.branch,z=e.env,F=e.org,P=e.repo,e=e.sha,V="https://dashboard".concat("dev"===z?".dev":"",".featurepeek.com"),W=document.createElement("iframe");W.allow="display-capture",W.src="".concat(V,"/vercel/").concat(F,"/").concat(P,"/").concat(encodeURIComponent(t),"/").concat(e,"/").concat(document.location.hostname),W.style=["display:block","border:0","position:fixed","left:0","bottom:0","width:52px","height:300px","z-index:9999999999"].join(";"),document.body.appendChild(W),window.addEventListener("message",function(e){var t;if(e.origin===V)switch(e.data){case"FULL_VIEWPORT":W.style.height="100vh",W.style.width="100vw";break;case"HALF_VIEWPORT":W.style.height="300px",W.style.width="240px";break;case"TINY_VIEWPORT":W.style.height="300px",W.style.width="52px";break;case"DESIGN_MODE_ON":document.designMode="on";break;case"DESIGN_MODE_OFF":document.designMode="off";break;case"BEGIN_SELECTION":!function(){document.body.style.cursor="crosshair";var e=_slicedToArray((m=l(window,j,"blue")).getElementsByTagName("code"),1);w=e[0],e=_slicedToArray(m.getElementsByTagName("span"),1),A=e[0],e=_slicedToArray((v=l(window,H,"red")).getElementsByTagName("code"),1),_=e[0],e=_slicedToArray(v.getElementsByTagName("span"),1),E=e[0],O=h(window,Y),I=h(window,U),T=h(window,D),k=h(window,X),S=function(e){m?(M?b:g)(e.target):document.body.removeEventListener("mouseover",S)},(L=function(e){e?(e.preventDefault(),e.stopPropagation(),g(e.target),M=!0):(e=document.querySelectorAll(":hover"))&&(e=e[e.length-1],g(e))})(),document.body.addEventListener("click",L),document.body.addEventListener("mouseover",S)}();break;case"END_SELECTION":M=!1,document.body.style.cursor="default",t=window,[j,H,Y,U,D,X].forEach(function(e){e=t.document.getElementById(e);e&&e.parentNode.removeChild(e)}),document.body.removeEventListener("mouseover",S),document.body.removeEventListener("click",L);break;case"LOCATION_HREF":e.source.postMessage({type:"LOCATION_HREF",value:document.location.href},e.origin)}})}catch(e){}}(); |
{ | ||
"name": "@featurepeek/snippet.js", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"main": "dist/loader.js", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/featurepeek/snippet.js", |
@@ -605,3 +605,3 @@ ;(() => { | ||
frame.allow = 'display-capture' | ||
frame.src = `${url}/vercel/${org}/${repo}/${branch}/${sha}/${document.location.hostname}` | ||
frame.src = `${url}/vercel/${org}/${repo}/${encodeURIComponent(branch)}/${sha}/${document.location.hostname}` | ||
frame.style = [ | ||
@@ -608,0 +608,0 @@ 'display:block', |
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
68506