polotno-node 2.9.34 → 2.9.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -191,7 +191,7 @@ For more info see: https://github.com/konvajs/react-konva/issues/194
191
191
  }
192
192
  ${e.resetStyleContent}
193
193
  </style>
194
- `;let l;const u=()=>(l||(l=document.createElement("div"),l.id="polotno-hidden-do-not-touch",l.style.overflow="hidden",l.style.position="relative",document.body.appendChild(l),l.innerHTML=`<style>#polotno-hidden-do-not-touch {${e.resetStyleContent}}</style>`),l),f=new Map,h=navigator.userAgent.includes("Firefox"),E=async d=>{if(f.has(d))return f.get(d);const g=(async()=>{const _=`<div style="font-family: ${d}; font-size: 100px;">${d}<strong>${d}</strong></div>`,k=document.createElement("div");k.innerHTML=_,k.style.visibility="hidden",k.style.position="absolute";const C=u();C.appendChild(k);const P=h?180:10;await new Promise(O=>setTimeout(O,P)),C.removeChild(k)})();return f.set(d,g),g};function w({html:d}){const g=document.createElement("div");g.innerHTML=d,g.style.display="inline-block",g.style.position="fixed",g.style.top="0px",g.style.left="0px",g.style.zIndex="1000",g.style.whiteSpace="nowrap",g.style.visibility="hidden";const _=u();_.appendChild(g);const k=g.textContent,C=g.childNodes[0],P=k.split(/\s+/);let O=!1;for(let x=0;x<P.length;x++){const A=P[x];if(C.textContent=A,O=C.scrollWidth>g.clientWidth,O)break}return _.removeChild(g),O}function p(d){const g=document.createElement("div");g.innerHTML=d,g.style.display="inline-block",g.style.position="fixed",g.style.top="0px",g.style.left="0px",g.style.zIndex="1000";const _=u();_.appendChild(g);const k=g.getBoundingClientRect();return _.removeChild(g),{width:k.width,height:k.height}}e.prerenderFont=E,e.isContentWrapping=w,e.detectSize=p;const S={};function b(d){const g=[];for(const _ of document.styleSheets)try{for(const k of _.cssRules)k instanceof CSSFontFaceRule&&k.style.fontFamily.replace(/['"]/g,"")===d&&g.push(k)}catch(k){console.warn(`Could not access stylesheet: ${_.href}`,k)}return g}const y={},v=d=>{if(y[d])return y[d];const g=b(d).filter(_=>_.style.fontFamily.replace(/['"]/g,"")===d).map(_=>({src:_.style.src,fontStyle:_.style.fontStyle||"normal",fontWeight:_.style.fontWeight||"normal"}));return y[d]=g,g};async function m({html:d,width:g,height:_,fontFamily:k,padding:C,font:P,pixelRatio:O}){const x=document.createElement("canvas");if(k!=="Arial"&&!P){const I=(0,a.getGoogleFontsVariants)();d+=`<link type="text/css" href="https://fonts.googleapis.com/css?family=${k}:${I}" rel="stylesheet">`}if(P){const I=P.styles||(P.url?[{src:`url("${P.url}")`}]:v(k));d+="<style>",I.forEach(U=>{d+=`
194
+ `;let l;const u=()=>(l||(l=document.createElement("div"),l.id="polotno-hidden-do-not-touch",l.style.overflow="hidden",l.style.position="relative",document.body.appendChild(l),l.innerHTML=`<style>#polotno-hidden-do-not-touch {${e.resetStyleContent}}</style>`),l),f=new Map,h=navigator.userAgent.includes("Firefox"),E=async d=>{if(f.has(d))return f.get(d);const g=(async()=>{const _=`<div style="font-family: ${d}; font-size: 100px;">${d}<strong>${d}</strong></div>`,k=document.createElement("div");k.innerHTML=_,k.style.visibility="hidden",k.style.position="absolute";const C=u();C.appendChild(k);const P=h?180:50;await new Promise(O=>setTimeout(O,P)),C.removeChild(k)})();return f.set(d,g),g};function w({html:d}){const g=document.createElement("div");g.innerHTML=d,g.style.display="inline-block",g.style.position="fixed",g.style.top="0px",g.style.left="0px",g.style.zIndex="1000",g.style.whiteSpace="nowrap",g.style.visibility="hidden";const _=u();_.appendChild(g);const k=g.textContent,C=g.childNodes[0],P=k.split(/\s+/);let O=!1;for(let x=0;x<P.length;x++){const A=P[x];if(C.textContent=A,O=C.scrollWidth>g.clientWidth,O)break}return _.removeChild(g),O}function p(d){const g=document.createElement("div");g.innerHTML=d,g.style.display="inline-block",g.style.position="fixed",g.style.top="0px",g.style.left="0px",g.style.zIndex="1000";const _=u();_.appendChild(g);const k=g.getBoundingClientRect();return _.removeChild(g),{width:k.width,height:k.height}}e.prerenderFont=E,e.isContentWrapping=w,e.detectSize=p;const S={};function b(d){const g=[];for(const _ of document.styleSheets)try{for(const k of _.cssRules)k instanceof CSSFontFaceRule&&k.style.fontFamily.replace(/['"]/g,"")===d&&g.push(k)}catch(k){console.warn(`Could not access stylesheet: ${_.href}`,k)}return g}const y={},v=d=>{if(y[d])return y[d];const g=b(d).filter(_=>_.style.fontFamily.replace(/['"]/g,"")===d).map(_=>({src:_.style.src,fontStyle:_.style.fontStyle||"normal",fontWeight:_.style.fontWeight||"normal"}));return y[d]=g,g};async function m({html:d,width:g,height:_,fontFamily:k,padding:C,font:P,pixelRatio:O}){const x=document.createElement("canvas");if(k!=="Arial"&&!P){const I=(0,a.getGoogleFontsVariants)();d+=`<link type="text/css" href="https://fonts.googleapis.com/css?family=${k}:${I}" rel="stylesheet">`}if(P){const I=P.styles||(P.url?[{src:`url("${P.url}")`}]:v(k));d+="<style>",I.forEach(U=>{d+=`
195
195
  @font-face {
196
196
  font-family: '${k}';
197
197
  src: ${U.src};
package/dist/index.html CHANGED
@@ -8,7 +8,7 @@
8
8
  }
9
9
  </style>
10
10
  <meta name="viewport" content="width=device-width, initial-scale=1" />
11
- <script type="module" crossorigin src="./assets/index-DcPAu4G1.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-DsVyOnN0.js"></script>
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polotno-node",
3
- "version": "2.9.34",
3
+ "version": "2.9.35",
4
4
  "description": "Polotno workflow from NodeJS",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  "gifencoder": "^2.0.1",
27
27
  "pixelmatch": "^6.0.0",
28
28
  "pngjs": "^7.0.0",
29
- "polotno": "^2.11.1",
29
+ "polotno": "^2.11.2",
30
30
  "react": "^18.3.1",
31
31
  "react-dom": "^18.3.1",
32
32
  "vite": "^5.3.4"