Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antv/g-plugin-html-renderer

Package Overview
Dependencies
Maintainers
0
Versions
225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g-plugin-html-renderer - npm Package Compare versions

Comparing version 2.0.13-alpha.0 to 2.1.0

2

dist/index.umd.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.HTMLRenderer={}),e.window.G)}(this,(function(e,t){"use strict";var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)};function n(e){return"number"==typeof e}"function"==typeof SuppressedError&&SuppressedError;var a=function(){function e(){this.displayObjectHTMLElementMap=new WeakMap}return e.prototype.joinTransformMatrix=function(e,t){return void 0===t&&(t=[0,0,0]),"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+t[0],e[13]+t[1]].join(","),")")},e.prototype.apply=function(r,n){var a=this,o=r.camera,i=r.renderingContext,s=r.renderingService;this.context=r;var l=i.root.ownerDocument.defaultView,c=l.context.eventService.nativeHTMLMap,p=function(e,t){t.style.transform=a.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())},d=function(e){var r=e.target;if(r.nodeName===t.Shape.HTML){a.$camera||(a.$camera=a.createCamera(o));var n=a.getOrCreateEl(r);a.$camera.appendChild(n),Object.keys(r.attributes).forEach((function(e){a.updateAttribute(e,r)})),p(r,n),c.set(n,r)}},y=function(e){var r=e.target;if(r.nodeName===t.Shape.HTML&&a.$camera){var n=a.getOrCreateEl(r);n&&(n.remove(),c.delete(n))}},f=function(e){var r=e.target;r.nodeName===t.Shape.HTML&&a.updateAttribute(e.attrName,r)},u=function(e){var r=e.target;(r.nodeName===t.Shape.FRAGMENT?r.childNodes:[r]).forEach((function(e){if(e.nodeName===t.Shape.HTML){var r=a.getOrCreateEl(e);p(e,r)}}))},v=function(){if(a.$camera){var e=a.context.config,t=e.height;a.$camera.parentElement.style.width="".concat(e.width||0,"px"),a.$camera.parentElement.style.height="".concat(t||0,"px")}};s.hooks.init.tap(e.tag,(function(){l.addEventListener(t.CanvasEvent.RESIZE,v),l.addEventListener(t.ElementEvent.MOUNTED,d),l.addEventListener(t.ElementEvent.UNMOUNTED,y),l.addEventListener(t.ElementEvent.ATTR_MODIFIED,f),l.addEventListener(t.ElementEvent.BOUNDS_CHANGED,u)})),s.hooks.endFrame.tap(e.tag,(function(){a.$camera&&i.renderReasons.has(t.RenderReason.CAMERA_CHANGED)&&(a.$camera.style.transform=a.joinTransformMatrix(o.getOrthoMatrix()))})),s.hooks.destroy.tap(e.tag,(function(){a.$camera&&a.$camera.remove(),l.removeEventListener(t.CanvasEvent.RESIZE,v),l.removeEventListener(t.ElementEvent.MOUNTED,d),l.removeEventListener(t.ElementEvent.UNMOUNTED,y),l.removeEventListener(t.ElementEvent.ATTR_MODIFIED,f),l.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,u)}))},e.prototype.createCamera=function(e){var t=this.context.config,r=t.document,n=t.width,a=t.height,o=this.context.contextService.getDomElement(),i=o.parentNode;if(i){var s="g-canvas-camera",l=i.querySelector("#"+s);if(!l){var c=(r||document).createElement("div");c.style.overflow="hidden",c.style.pointerEvents="none",c.style.position="absolute",c.style.left="0px",c.style.top="0px",c.style.width="".concat(n||0,"px"),c.style.height="".concat(a||0,"px");var p=(r||document).createElement("div");l=p,p.id=s,p.style.position="absolute",p.style.left="".concat(o.offsetLeft||0,"px"),p.style.top="".concat(o.offsetTop||0,"px"),p.style.transformOrigin="left top",p.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),p.style.pointerEvents="none",p.style.width="100%",p.style.height="100%",c.appendChild(p),i.appendChild(c)}return l}return null},e.prototype.getOrCreateEl=function(e){var t=this.context.config.document,r=this.displayObjectHTMLElementMap.get(e);return r||(r=(t||document).createElement("div"),e.parsedStyle.$el=r,this.displayObjectHTMLElementMap.set(e,r),e.id&&(r.id=e.id),e.name&&r.setAttribute("name",e.name),e.className&&(r.className=e.className),r.style.position="absolute",r.style["will-change"]="transform",r.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())),r},e.prototype.updateAttribute=function(e,r){var a=this.getOrCreateEl(r);switch(e){case"innerHTML":var o=r.parsedStyle.innerHTML;"string"==typeof o?a.innerHTML=o:(a.innerHTML="",a.appendChild(o));break;case"x":a.style.left="".concat(r.parsedStyle.x,"px");break;case"y":a.style.top="".concat(r.parsedStyle.y,"px");break;case"transformOrigin":var i=r.parsedStyle.transformOrigin;a.style["transform-origin"]="".concat(i[0].buildCSSText(null,null,"")," ").concat(i[1].buildCSSText(null,null,""));break;case"width":var s=r.parsedStyle.width;a.style.width=n(s)?"".concat(s,"px"):""+s;break;case"height":var l=r.parsedStyle.height;a.style.height=n(l)?"".concat(l,"px"):""+l;break;case"zIndex":a.style["z-index"]="".concat(r.parsedStyle.zIndex);break;case"visibility":a.style.visibility=r.parsedStyle.visibility;break;case"pointerEvents":var c=r.parsedStyle.pointerEvents;a.style.pointerEvents=void 0===c?"auto":c;break;case"opacity":a.style.opacity="".concat(r.parsedStyle.opacity);break;case"fill":var p=r.parsedStyle.fill,d="";t.isCSSRGB(p)?d=p.isNone?"transparent":r.getAttribute("fill"):Array.isArray(p)?d=r.getAttribute("fill"):t.isPattern(p),a.style.background=d;break;case"stroke":var y=r.parsedStyle.stroke,f="";t.isCSSRGB(y)?f=y.isNone?"transparent":r.getAttribute("stroke"):Array.isArray(y)?f=r.getAttribute("stroke"):t.isPattern(y),a.style["border-color"]=f,a.style["border-style"]="solid";break;case"lineWidth":a.style["border-width"]="".concat(r.parsedStyle.lineWidth||0,"px");break;case"lineDash":a.style["border-style"]="dashed";break;case"filter":a.style.filter=r.style.filter;break;default:(function(e){return null==e})(r.style[e])||""===r.style[e]||(a.style[e]=r.style[e])}},e.tag="HTMLRendering",e}(),o=function(e){function t(){var t=e.apply(this,function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;o>a;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([],function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,a,o=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i}(arguments),!1))||this;return t.name="html-renderer",t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+t+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.init=function(){this.addRenderingPlugin(new a)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin);e.Plugin=o}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.HTMLRenderer={}),e.window.G)}(this,(function(e,t){"use strict";var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)};"function"==typeof SuppressedError&&SuppressedError;var n=function(e){return null==e},a={}.toString,o=function(e,t){return a.call(e)==="[object "+t+"]"},i=function(e){return o(e,"Number")},s=function(){function e(){this.displayObjectHTMLElementMap=new WeakMap}return e.prototype.joinTransformMatrix=function(e,t){return void 0===t&&(t=[0,0,0]),"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+t[0],e[13]+t[1]].join(","),")")},e.prototype.apply=function(r,n){var a=this,o=r.camera,i=r.renderingContext,s=r.renderingService;this.context=r;var l=i.root.ownerDocument.defaultView,c=l.context.eventService.nativeHTMLMap,p=function(e,t){t.style.transform=a.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())},d=function(e){var r=e.target;if(r.nodeName===t.Shape.HTML){a.$camera||(a.$camera=a.createCamera(o));var n=a.getOrCreateEl(r);a.$camera.appendChild(n),Object.keys(r.attributes).forEach((function(e){a.updateAttribute(e,r)})),p(r,n),c.set(n,r)}},y=function(e){var r=e.target;if(r.nodeName===t.Shape.HTML&&a.$camera){var n=a.getOrCreateEl(r);n&&(n.remove(),c.delete(n))}},f=function(e){var r=e.target;r.nodeName===t.Shape.HTML&&a.updateAttribute(e.attrName,r)},u=function(e){var r=e.target;(r.nodeName===t.Shape.FRAGMENT?r.childNodes:[r]).forEach((function(e){if(e.nodeName===t.Shape.HTML){var r=a.getOrCreateEl(e);p(e,r)}}))},v=function(){if(a.$camera){var e=a.context.config,t=e.height;a.$camera.parentElement.style.width="".concat(e.width||0,"px"),a.$camera.parentElement.style.height="".concat(t||0,"px")}};s.hooks.init.tap(e.tag,(function(){l.addEventListener(t.CanvasEvent.RESIZE,v),l.addEventListener(t.ElementEvent.MOUNTED,d),l.addEventListener(t.ElementEvent.UNMOUNTED,y),l.addEventListener(t.ElementEvent.ATTR_MODIFIED,f),l.addEventListener(t.ElementEvent.BOUNDS_CHANGED,u)})),s.hooks.endFrame.tap(e.tag,(function(){a.$camera&&i.renderReasons.has(t.RenderReason.CAMERA_CHANGED)&&(a.$camera.style.transform=a.joinTransformMatrix(o.getOrthoMatrix()))})),s.hooks.destroy.tap(e.tag,(function(){a.$camera&&a.$camera.remove(),l.removeEventListener(t.CanvasEvent.RESIZE,v),l.removeEventListener(t.ElementEvent.MOUNTED,d),l.removeEventListener(t.ElementEvent.UNMOUNTED,y),l.removeEventListener(t.ElementEvent.ATTR_MODIFIED,f),l.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,u)}))},e.prototype.createCamera=function(e){var t=this.context.config,r=t.document,n=t.width,a=t.height,o=this.context.contextService.getDomElement(),i=o.parentNode;if(i){var s="g-canvas-camera",l=i.querySelector("#"+s);if(!l){var c=(r||document).createElement("div");c.style.overflow="hidden",c.style.pointerEvents="none",c.style.position="absolute",c.style.left="0px",c.style.top="0px",c.style.width="".concat(n||0,"px"),c.style.height="".concat(a||0,"px");var p=(r||document).createElement("div");l=p,p.id=s,p.style.position="absolute",p.style.left="".concat(o.offsetLeft||0,"px"),p.style.top="".concat(o.offsetTop||0,"px"),p.style.transformOrigin="left top",p.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),p.style.pointerEvents="none",p.style.width="100%",p.style.height="100%",c.appendChild(p),i.appendChild(c)}return l}return null},e.prototype.getOrCreateEl=function(e){var t=this.context.config.document,r=this.displayObjectHTMLElementMap.get(e);return r||(r=(t||document).createElement("div"),e.parsedStyle.$el=r,this.displayObjectHTMLElementMap.set(e,r),e.id&&(r.id=e.id),e.name&&r.setAttribute("name",e.name),e.className&&(r.className=e.className),r.style.position="absolute",r.style["will-change"]="transform",r.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())),r},e.prototype.updateAttribute=function(e,r){var a=this.getOrCreateEl(r);switch(e){case"innerHTML":var s=r.parsedStyle.innerHTML;o(s,"String")?a.innerHTML=s:(a.innerHTML="",a.appendChild(s));break;case"x":a.style.left="".concat(r.parsedStyle.x,"px");break;case"y":a.style.top="".concat(r.parsedStyle.y,"px");break;case"transformOrigin":var l=r.parsedStyle.transformOrigin;a.style["transform-origin"]="".concat(l[0].buildCSSText(null,null,"")," ").concat(l[1].buildCSSText(null,null,""));break;case"width":var c=r.parsedStyle.width;a.style.width=i(c)?"".concat(c,"px"):""+c;break;case"height":var p=r.parsedStyle.height;a.style.height=i(p)?"".concat(p,"px"):""+p;break;case"zIndex":a.style["z-index"]="".concat(r.parsedStyle.zIndex);break;case"visibility":a.style.visibility=r.parsedStyle.visibility;break;case"pointerEvents":var d=r.parsedStyle.pointerEvents;a.style.pointerEvents=void 0===d?"auto":d;break;case"opacity":a.style.opacity="".concat(r.parsedStyle.opacity);break;case"fill":var y=r.parsedStyle.fill,f="";t.isCSSRGB(y)?f=y.isNone?"transparent":r.getAttribute("fill"):Array.isArray(y)?f=r.getAttribute("fill"):t.isPattern(y),a.style.background=f;break;case"stroke":var u=r.parsedStyle.stroke,v="";t.isCSSRGB(u)?v=u.isNone?"transparent":r.getAttribute("stroke"):Array.isArray(u)?v=r.getAttribute("stroke"):t.isPattern(u),a.style["border-color"]=v,a.style["border-style"]="solid";break;case"lineWidth":a.style["border-width"]="".concat(r.parsedStyle.lineWidth||0,"px");break;case"lineDash":a.style["border-style"]="dashed";break;case"filter":a.style.filter=r.style.filter;break;default:n(r.style[e])||""===r.style[e]||(a.style[e]=r.style[e])}},e.tag="HTMLRendering",e}(),l=function(e){function t(){var t=e.apply(this,function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;o>a;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([],function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,a,o=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i}(arguments),!1))||this;return t.name="html-renderer",t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+t+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.init=function(){this.addRenderingPlugin(new s)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin);e.Plugin=l}));
//# sourceMappingURL=index.umd.min.js.map
{
"name": "@antv/g-plugin-html-renderer",
"version": "2.0.13-alpha.0",
"version": "2.1.0",
"description": "A G plugin for rendering HTML",

@@ -38,3 +38,3 @@ "keywords": [

"tslib": "^2.5.3",
"@antv/g-lite": "2.0.12-alpha.0"
"@antv/g-lite": "2.1.0"
},

@@ -41,0 +41,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc