polotno 2.7.3 → 2.7.4

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.
@@ -6,6 +6,8 @@
6
6
  ol {
7
7
  list-style-position: inside;
8
8
  margin: 0;
9
+ display: inline-block;
10
+ text-align: left;
9
11
  }
10
12
  p {
11
13
  line-height: auto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polotno",
3
- "version": "2.7.3",
3
+ "version": "2.7.4",
4
4
  "description": "Design Editor Framework",
5
5
  "author": "Anton Lavrenov",
6
6
  "keywords": [
package/polotno.bundle.js CHANGED
@@ -39,6 +39,8 @@ For more info see: https://github.com/konvajs/react-konva/issues/194
39
39
  ul, ol {
40
40
  list-style-position: inside;
41
41
  margin: 0;
42
+ display: inline-block;
43
+ text-align: left;
42
44
  }
43
45
  </style>
44
46
  `,ob=()=>(t||((t=document.createElement("div")).id="polotno-hidden-do-not-touch",t.style.overflow="hidden",t.style.position="relative",document.body.appendChild(t),t.innerHTML=`<style>
@@ -49,6 +51,8 @@ For more info see: https://github.com/konvajs/react-konva/issues/194
49
51
  #polotno-hidden-do-not-touch ul, #polotno-hidden-do-not-touch ol {
50
52
  list-style-position: inside;
51
53
  margin: 0;
54
+ display: inline-block;
55
+ text-align: left;
52
56
  }
53
57
  </style>`),t);function ow(e){let t=document.createElement("div");t.innerHTML=e,t.style.display="inline-block",t.style.position="fixed",t.style.top="0px",t.style.left="0px",t.style.zIndex="1000";let n=ob();n.appendChild(t);let r=t.getBoundingClientRect();return n.removeChild(t),{width:r.width,height:r.height}}async function ox({html:e,width:t,height:n,fontFamily:r,padding:i,font:o,pixelRatio:a}){let l=document.createElement("canvas");if("Arial"===r||o||(e+=`<link type="text/css" href="https://fonts.googleapis.com/css?family=${r}:${iN}" rel="stylesheet">`),o){let t=o.styles||(o.url?[{src:`url("${o.url}")`}]:[]);e+="<style>",t.forEach(t=>{e+=`
54
58
  @font-face {
@@ -65,6 +69,8 @@ For more info see: https://github.com/konvajs/react-konva/issues/194
65
69
  ol {
66
70
  list-style-position: inside;
67
71
  margin: 0;
72
+ display: inline-block;
73
+ text-align: left;
68
74
  }
69
75
  p {
70
76
  line-height: auto;
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&__createBinding(t,e,n);return __setModuleDefault(t,e),t};Object.defineProperty(exports,"__esModule",{value:!0}),exports.htmlToCanvas=exports.detectSize=void 0;const rasterizeHTML=__importStar(require("rasterizehtml")),fonts_1=require("./fonts"),resetStyle="\n<style>\n html, body {\n padding: 0;\n margin: 0;\n }\n p {\n margin: 0;\n padding: 0\n }\n ul, ol {\n list-style-position: inside;\n margin: 0;\n }\n</style>\n";let hidden;const getHiddenElement=()=>(hidden||(hidden=document.createElement("div"),hidden.id="polotno-hidden-do-not-touch",hidden.style.overflow="hidden",hidden.style.position="relative",document.body.appendChild(hidden),hidden.innerHTML="<style>\n#polotno-hidden-do-not-touch p {\n margin: 0;\n padding: 0\n}\n#polotno-hidden-do-not-touch ul, #polotno-hidden-do-not-touch ol {\n list-style-position: inside;\n margin: 0;\n}\n</style>"),hidden);function detectSize(e){const t=document.createElement("div");t.innerHTML=e,t.style.display="inline-block",t.style.position="fixed",t.style.top="0px",t.style.left="0px",t.style.zIndex="1000";const n=getHiddenElement();n.appendChild(t);const i=t.getBoundingClientRect();return n.removeChild(t),{width:i.width,height:i.height}}async function htmlToCanvas({html:e,width:t,height:n,fontFamily:i,padding:o,font:d,pixelRatio:l}){const r=document.createElement("canvas");if("Arial"!==i&&!d){const t=(0,fonts_1.getGoogleFontsVariants)();e+=`<link type="text/css" href="https://fonts.googleapis.com/css?family=${i}:${t}" rel="stylesheet">`}if(d){const t=d.styles||(d.url?[{src:`url("${d.url}")`}]:[]);e+="<style>",t.forEach((t=>{e+=`\n @font-face {\n font-family: '${i}';\n src: ${t.src};\n font-style: ${t.fontStyle||"normal"};\n font-weight: ${t.fontWeight||"normal"};\n }\n `})),e+="</style>"}e+=resetStyle;const s=await rasterizeHTML.drawHTML(`<div style="padding: ${o}px;">${e}</div>`,r,{width:t+2*o,height:n+2*o});r.width=(t+2*o)*l,r.height=(n+2*o)*l;const a=r.getContext("2d");return null==a||a.drawImage(s.image,0,0,s.image.width*l,s.image.height*l),r}exports.detectSize=detectSize,exports.htmlToCanvas=htmlToCanvas;
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&__createBinding(t,e,n);return __setModuleDefault(t,e),t};Object.defineProperty(exports,"__esModule",{value:!0}),exports.htmlToCanvas=exports.detectSize=void 0;const rasterizeHTML=__importStar(require("rasterizehtml")),fonts_1=require("./fonts"),resetStyle="\n<style>\n html, body {\n padding: 0;\n margin: 0;\n }\n p {\n margin: 0;\n padding: 0\n }\n ul, ol {\n list-style-position: inside;\n margin: 0;\n display: inline-block;\n text-align: left;\n }\n</style>\n";let hidden;const getHiddenElement=()=>(hidden||(hidden=document.createElement("div"),hidden.id="polotno-hidden-do-not-touch",hidden.style.overflow="hidden",hidden.style.position="relative",document.body.appendChild(hidden),hidden.innerHTML="<style>\n#polotno-hidden-do-not-touch p {\n margin: 0;\n padding: 0\n}\n#polotno-hidden-do-not-touch ul, #polotno-hidden-do-not-touch ol {\n list-style-position: inside;\n margin: 0;\n display: inline-block;\n text-align: left;\n}\n</style>"),hidden);function detectSize(e){const t=document.createElement("div");t.innerHTML=e,t.style.display="inline-block",t.style.position="fixed",t.style.top="0px",t.style.left="0px",t.style.zIndex="1000";const n=getHiddenElement();n.appendChild(t);const i=t.getBoundingClientRect();return n.removeChild(t),{width:i.width,height:i.height}}async function htmlToCanvas({html:e,width:t,height:n,fontFamily:i,padding:o,font:l,pixelRatio:d}){const r=document.createElement("canvas");if("Arial"!==i&&!l){const t=(0,fonts_1.getGoogleFontsVariants)();e+=`<link type="text/css" href="https://fonts.googleapis.com/css?family=${i}:${t}" rel="stylesheet">`}if(l){const t=l.styles||(l.url?[{src:`url("${l.url}")`}]:[]);e+="<style>",t.forEach((t=>{e+=`\n @font-face {\n font-family: '${i}';\n src: ${t.src};\n font-style: ${t.fontStyle||"normal"};\n font-weight: ${t.fontWeight||"normal"};\n }\n `})),e+="</style>"}e+=resetStyle;const s=await rasterizeHTML.drawHTML(`<div style="padding: ${o}px;">${e}</div>`,r,{width:t+2*o,height:n+2*o});r.width=(t+2*o)*d,r.height=(n+2*o)*d;const a=r.getContext("2d");return null==a||a.drawImage(s.image,0,0,s.image.width*d,s.image.height*d),r}exports.detectSize=detectSize,exports.htmlToCanvas=htmlToCanvas;