@leafer-in/html 1.0.0-rc.7 → 1.0.0-rc.9
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.
- package/dist/html.esm.js +1 -1
- package/dist/html.esm.min.js +1 -1
- package/dist/html.js +1 -1
- package/dist/html.min.js +1 -1
- package/package.json +4 -4
- package/src/HTMLText.ts +1 -1
package/dist/html.esm.js
CHANGED
|
@@ -66,7 +66,7 @@ let HTMLText = class HTMLText extends Image {
|
|
|
66
66
|
</body>
|
|
67
67
|
</foreignObject>
|
|
68
68
|
</svg>`;
|
|
69
|
-
this.__.
|
|
69
|
+
this.__.__setImageFill('data:image/svg+xml,' + encodeURIComponent(svg));
|
|
70
70
|
this.__.__htmlChanged = false;
|
|
71
71
|
div.remove();
|
|
72
72
|
}
|
package/dist/html.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ImageData as
|
|
1
|
+
import{ImageData as e,dataProcessor as t,boundsType as n,registerUI as o,Image as i}from"@leafer-ui/core";function r(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var d=e.length-1;d>=0;d--)(i=e[d])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s}"function"==typeof SuppressedError&&SuppressedError;let s=class extends i{get __tag(){return"HTMLText"}constructor(e){super(e)}__updateBoxBounds(){if(this.__.__htmlChanged){const e=document.createElement("div"),{style:t}=e;t.all="initial",t.position="absolute",t.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:n,height:o}=e.getBoundingClientRect(),i=10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${n+i}" height="${o}">\n <foreignObject width="${n+i}" height="${o}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.text}\n </body>\n </foreignObject>\n </svg>`;this.__.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),this.__.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}};r([t(class extends e{setText(e){this._text=e,this.__htmlChanged=!0}})],s.prototype,"__",void 0),r([n("")],s.prototype,"text",void 0),s=r([o()],s);export{s as HTMLText};
|
package/dist/html.js
CHANGED
|
@@ -68,7 +68,7 @@ this.LeaferIN.html = (function (exports, core) {
|
|
|
68
68
|
</body>
|
|
69
69
|
</foreignObject>
|
|
70
70
|
</svg>`;
|
|
71
|
-
this.__.
|
|
71
|
+
this.__.__setImageFill('data:image/svg+xml,' + encodeURIComponent(svg));
|
|
72
72
|
this.__.__htmlChanged = false;
|
|
73
73
|
div.remove();
|
|
74
74
|
}
|
package/dist/html.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.LeaferIN=this.LeaferIN||{},this.LeaferIN.html=function(e,t){"use strict";function n(e,t,n,o){var r
|
|
1
|
+
this.LeaferIN=this.LeaferIN||{},this.LeaferIN.html=function(e,t){"use strict";function n(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var d=e.length-1;d>=0;d--)(i=e[d])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s}"function"==typeof SuppressedError&&SuppressedError;class o extends t.ImageData{setText(e){this._text=e,this.__htmlChanged=!0}}return e.HTMLText=class extends t.Image{get __tag(){return"HTMLText"}constructor(e){super(e)}__updateBoxBounds(){if(this.__.__htmlChanged){const e=document.createElement("div"),{style:t}=e;t.all="initial",t.position="absolute",t.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:n,height:o}=e.getBoundingClientRect(),i=10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${n+i}" height="${o}">\n <foreignObject width="${n+i}" height="${o}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.text}\n </body>\n </foreignObject>\n </svg>`;this.__.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),this.__.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}},n([t.dataProcessor(o)],e.HTMLText.prototype,"__",void 0),n([t.boundsType("")],e.HTMLText.prototype,"text",void 0),e.HTMLText=n([t.registerUI()],e.HTMLText),e}({},LeaferUI);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-in/html",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.9",
|
|
4
4
|
"description": "@leafer-in/html",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"leaferjs"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@leafer-ui/core": "1.0.0-rc.
|
|
31
|
+
"@leafer-ui/core": "1.0.0-rc.9"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@leafer-ui/interface": "1.0.0-rc.
|
|
35
|
-
"@leafer-in/interface": "1.0.0-rc.
|
|
34
|
+
"@leafer-ui/interface": "1.0.0-rc.9",
|
|
35
|
+
"@leafer-in/interface": "1.0.0-rc.9"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/HTMLText.ts
CHANGED
|
@@ -52,7 +52,7 @@ export class HTMLText extends Image implements IImage {
|
|
|
52
52
|
</foreignObject>
|
|
53
53
|
</svg>`
|
|
54
54
|
|
|
55
|
-
this.__.
|
|
55
|
+
this.__.__setImageFill('data:image/svg+xml,' + encodeURIComponent(svg))
|
|
56
56
|
this.__.__htmlChanged = false
|
|
57
57
|
|
|
58
58
|
div.remove()
|