UNPKG

lath

Version:

Seamless connection of pages.

5 lines 1.05 kB
import{_ as __awaiter}from"./launcher-f761b2d6.js";import html2canvas from"html2canvas";const capture=l=>__awaiter(void 0,void 0,void 0,function*(){var t=l.sandbox&&l.sameOrigin?l.contentWindow.document.documentElement:l.view,e=l.viewport;if(!e)throw"Capture Shot: The applet has not been initialized!";var o=e.offsetWidth,e=e.offsetHeight,i=l["application"],a="data-html2canvas-ignore";let n,r;l.view===t&&(n=t.cloneNode(!0),i.appletsSpace.setAttribute(a,"true"),(r=document.createElement("div")).style.opacity="0",r.style.contain="strict",r.appendChild(n),document.body.appendChild(r));var d=/\(/.exec(l.color)?l.view?getComputedStyle(l.view).backgroundColor:"transparent":l.color,d=yield html2canvas(n||t,{backgroundColor:d,useCORS:!0,width:o,height:e,windowWidth:o,windowHeight:e,x:t.scrollLeft,y:t.scrollTop,removeContainer:!0,imageTimeout:2e3});return d.style.cssText=` width: 100% !important; height: auto !important; transition: all .4s ease; `,r&&(document.body.removeChild(r),i.appletsSpace.removeAttribute(a)),d});export{capture};