@leafer-in/html 1.1.1 → 1.2.0

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.cjs CHANGED
@@ -89,4 +89,6 @@ exports.HTMLText = __decorate([
89
89
  draw.registerUI()
90
90
  ], exports.HTMLText);
91
91
 
92
+ draw.Plugin.add('html');
93
+
92
94
  exports.HTMLTextData = HTMLTextData;
package/dist/html.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ImageData, dataProcessor, boundsType, registerUI, Image } from '@leafer-ui/draw';
1
+ import { ImageData, dataProcessor, boundsType, registerUI, Image, Plugin } from '@leafer-ui/draw';
2
2
 
3
3
  /******************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -87,4 +87,6 @@ HTMLText = __decorate([
87
87
  registerUI()
88
88
  ], HTMLText);
89
89
 
90
+ Plugin.add('html');
91
+
90
92
  export { HTMLText, HTMLTextData };
@@ -1 +1 @@
1
- import{ImageData as t,dataProcessor as e,boundsType as n,registerUI as o,Image as i}from"@leafer-ui/draw";function r(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var d=t.length-1;d>=0;d--)(i=t[d])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s}"function"==typeof SuppressedError&&SuppressedError;class s extends t{setText(t){this._text=t,this.__htmlChanged=!0}}let d=class extends i{get __tag(){return"HTMLText"}get editInner(){return"TextEditor"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:n}=e;n.all="initial",n.position="absolute",n.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:o,height:i}=e.getBoundingClientRect(),r=o+10,s=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${i}">\n <foreignObject width="${r}" height="${i}">\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>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(s)),t.__naturalWidth=r/t.pixelRatio,t.__naturalHeight=i/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}};r([e(s)],d.prototype,"__",void 0),r([n("")],d.prototype,"text",void 0),d=r([o()],d);export{d as HTMLText,s as HTMLTextData};
1
+ import{ImageData as t,dataProcessor as e,boundsType as n,registerUI as o,Image as i,Plugin as r}from"@leafer-ui/draw";function d(t,e,n,o){var i,r=arguments.length,d=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(d=(r<3?i(d):r>3?i(e,n,d):i(e,n))||d);return r>3&&d&&Object.defineProperty(e,n,d),d}"function"==typeof SuppressedError&&SuppressedError;class s extends t{setText(t){this._text=t,this.__htmlChanged=!0}}let l=class extends i{get __tag(){return"HTMLText"}get editInner(){return"TextEditor"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:n}=e;n.all="initial",n.position="absolute",n.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:o,height:i}=e.getBoundingClientRect(),r=o+10,d=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${i}">\n <foreignObject width="${r}" height="${i}">\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>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(d)),t.__naturalWidth=r/t.pixelRatio,t.__naturalHeight=i/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}};d([e(s)],l.prototype,"__",void 0),d([n("")],l.prototype,"text",void 0),l=d([o()],l),r.add("html");export{l as HTMLText,s as HTMLTextData};
package/dist/html.js CHANGED
@@ -89,6 +89,8 @@ this.LeaferIN.html = (function (exports, draw) {
89
89
  draw.registerUI()
90
90
  ], exports.HTMLText);
91
91
 
92
+ draw.Plugin.add('html');
93
+
92
94
  exports.HTMLTextData = HTMLTextData;
93
95
 
94
96
  return exports;
package/dist/html.min.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("@leafer-ui/draw");function t(e,t,n,o){var r,i=arguments.length,s=i<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--)(r=e[d])&&(s=(i<3?r(s):i>3?r(t,n,s):r(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s}"function"==typeof SuppressedError&&SuppressedError;class n extends e.ImageData{setText(e){this._text=e,this.__htmlChanged=!0}}exports.HTMLText=class extends e.Image{get __tag(){return"HTMLText"}get editInner(){return"TextEditor"}constructor(e){super(e)}__updateBoxBounds(){const e=this.__;if(e.__htmlChanged){const t=document.createElement("div"),{style:n}=t;n.all="initial",n.position="absolute",n.visibility="hidden",t.innerHTML=this.text,document.body.appendChild(t);const{width:o,height:r}=t.getBoundingClientRect(),i=o+10,s=`<svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${r}">\n <foreignObject width="${i}" height="${r}">\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>`;e.__setImageFill("data:image/svg+xml,"+encodeURIComponent(s)),e.__naturalWidth=i/e.pixelRatio,e.__naturalHeight=r/e.pixelRatio,e.__htmlChanged=!1,t.remove()}super.__updateBoxBounds()}},t([e.dataProcessor(n)],exports.HTMLText.prototype,"__",void 0),t([e.boundsType("")],exports.HTMLText.prototype,"text",void 0),exports.HTMLText=t([e.registerUI()],exports.HTMLText),exports.HTMLTextData=n;
1
+ "use strict";var e=require("@leafer-ui/draw");function t(e,t,n,o){var r,i=arguments.length,s=i<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--)(r=e[d])&&(s=(i<3?r(s):i>3?r(t,n,s):r(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s}"function"==typeof SuppressedError&&SuppressedError;class n extends e.ImageData{setText(e){this._text=e,this.__htmlChanged=!0}}exports.HTMLText=class extends e.Image{get __tag(){return"HTMLText"}get editInner(){return"TextEditor"}constructor(e){super(e)}__updateBoxBounds(){const e=this.__;if(e.__htmlChanged){const t=document.createElement("div"),{style:n}=t;n.all="initial",n.position="absolute",n.visibility="hidden",t.innerHTML=this.text,document.body.appendChild(t);const{width:o,height:r}=t.getBoundingClientRect(),i=o+10,s=`<svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${r}">\n <foreignObject width="${i}" height="${r}">\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>`;e.__setImageFill("data:image/svg+xml,"+encodeURIComponent(s)),e.__naturalWidth=i/e.pixelRatio,e.__naturalHeight=r/e.pixelRatio,e.__htmlChanged=!1,t.remove()}super.__updateBoxBounds()}},t([e.dataProcessor(n)],exports.HTMLText.prototype,"__",void 0),t([e.boundsType("")],exports.HTMLText.prototype,"text",void 0),exports.HTMLText=t([e.registerUI()],exports.HTMLText),e.Plugin.add("html"),exports.HTMLTextData=n;
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,i){var o,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(r<3?o(s):r>3?o(t,n,s):o(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s}"function"==typeof SuppressedError&&SuppressedError;class i extends t.ImageData{setText(e){this._text=e,this.__htmlChanged=!0}}return e.HTMLText=class extends t.Image{get __tag(){return"HTMLText"}get editInner(){return"TextEditor"}constructor(e){super(e)}__updateBoxBounds(){const e=this.__;if(e.__htmlChanged){const t=document.createElement("div"),{style:n}=t;n.all="initial",n.position="absolute",n.visibility="hidden",t.innerHTML=this.text,document.body.appendChild(t);const{width:i,height:o}=t.getBoundingClientRect(),r=i+10,s=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${o}">\n <foreignObject width="${r}" 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>`;e.__setImageFill("data:image/svg+xml,"+encodeURIComponent(s)),e.__naturalWidth=r/e.pixelRatio,e.__naturalHeight=o/e.pixelRatio,e.__htmlChanged=!1,t.remove()}super.__updateBoxBounds()}},n([t.dataProcessor(i)],e.HTMLText.prototype,"__",void 0),n([t.boundsType("")],e.HTMLText.prototype,"text",void 0),e.HTMLText=n([t.registerUI()],e.HTMLText),e.HTMLTextData=i,e}({},LeaferUI);
1
+ this.LeaferIN=this.LeaferIN||{},this.LeaferIN.html=function(t,e){"use strict";function n(t,e,n,i){var o,r=arguments.length,s=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(e,n,s):o(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s}"function"==typeof SuppressedError&&SuppressedError;class i extends e.ImageData{setText(t){this._text=t,this.__htmlChanged=!0}}return t.HTMLText=class extends e.Image{get __tag(){return"HTMLText"}get editInner(){return"TextEditor"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:n}=e;n.all="initial",n.position="absolute",n.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:i,height:o}=e.getBoundingClientRect(),r=i+10,s=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${o}">\n <foreignObject width="${r}" 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>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(s)),t.__naturalWidth=r/t.pixelRatio,t.__naturalHeight=o/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}},n([e.dataProcessor(i)],t.HTMLText.prototype,"__",void 0),n([e.boundsType("")],t.HTMLText.prototype,"text",void 0),t.HTMLText=n([e.registerUI()],t.HTMLText),e.Plugin.add("html"),t.HTMLTextData=i,t}({},LeaferUI);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-in/html",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "@leafer-in/html",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -34,8 +34,8 @@
34
34
  "leaferjs"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@leafer-ui/draw": "^1.1.1",
38
- "@leafer-ui/interface": "^1.1.1",
39
- "@leafer-in/interface": "^1.1.1"
37
+ "@leafer-ui/draw": "^1.2.0",
38
+ "@leafer-ui/interface": "^1.2.0",
39
+ "@leafer-in/interface": "^1.2.0"
40
40
  }
41
41
  }
package/src/index.ts CHANGED
@@ -1,2 +1,6 @@
1
1
  export { HTMLText } from './HTMLText'
2
- export { HTMLTextData } from './data/HTMLTextData'
2
+ export { HTMLTextData } from './data/HTMLTextData'
3
+
4
+ import { Plugin } from '@leafer-ui/draw'
5
+
6
+ Plugin.add('html')