@antv/g-plugin-html-renderer
Advanced tools
Comparing version 1.9.16 to 1.9.17
@@ -108,4 +108,3 @@ import { __extends } from 'tslib'; | ||
HTMLRenderingPlugin.prototype.createCamera = function (camera) { | ||
var _a; | ||
var doc = (_a = this.context.config, _a.document), width = _a.width, height = _a.height; | ||
var _a = this.context.config, doc = _a.document, width = _a.width, height = _a.height; | ||
var $canvas = this.context.contextService.getDomElement(); | ||
@@ -112,0 +111,0 @@ var $container = $canvas.parentNode; |
@@ -110,4 +110,3 @@ 'use strict'; | ||
HTMLRenderingPlugin.prototype.createCamera = function (camera) { | ||
var _a; | ||
var doc = (_a = this.context.config, _a.document), width = _a.width, height = _a.height; | ||
var _a = this.context.config, doc = _a.document, width = _a.width, height = _a.height; | ||
var $canvas = this.context.contextService.getDomElement(); | ||
@@ -114,0 +113,0 @@ var $container = $canvas.parentNode; |
@@ -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 n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};var r=function(e){return null==e},a={}.toString,i=function(e,t){return a.call(e)==="[object "+t+"]"},o=function(e){return i(e,"Number")},s=function(){function e(){this.displayObjectHTMLElementMap=new WeakMap}return e.prototype.joinTransformMatrix=function(e){return"matrix(".concat([e[0],e[1],e[4],e[5],e[12],e[13]].join(","),")")},e.prototype.apply=function(n,r){var a=this,i=n.camera,o=n.renderingContext,s=n.renderingService;this.context=n;var l=o.root.ownerDocument.defaultView,c=function(e,t){t.style.transform=a.joinTransformMatrix(e.getWorldTransform())},d=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){a.$camera||(a.$camera=a.createCamera(i));var o=a.getOrCreateEl(n);if(a.$camera.appendChild(o),r.enableCSSParsing){var s=n.ownerDocument.documentElement.attributes;Object.keys(s).forEach((function(e){o.style[e]=s[e]}))}Object.keys(n.attributes).forEach((function(e){a.updateAttribute(e,n)})),c(n,o),a.context.nativeHTMLMap.set(o,n)}},p=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML&&a.$camera){var r=a.getOrCreateEl(n);r&&(r.remove(),a.context.nativeHTMLMap.delete(r))}},f=function(e){var n=e.target;n.nodeName===t.Shape.HTML&&a.updateAttribute(e.attrName,n)},y=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){var r=a.getOrCreateEl(n);c(n,r)}},u=function(){if(a.$camera){var e=a.context.config,t=e.height;a.$camera.style.width="".concat(e.width||0,"px"),a.$camera.style.height="".concat(t||0,"px")}};s.hooks.init.tap(e.tag,(function(){l.addEventListener(t.CanvasEvent.RESIZE,u),l.addEventListener(t.ElementEvent.MOUNTED,d),l.addEventListener(t.ElementEvent.UNMOUNTED,p),l.addEventListener(t.ElementEvent.ATTR_MODIFIED,f),l.addEventListener(t.ElementEvent.BOUNDS_CHANGED,y)})),s.hooks.endFrame.tap(e.tag,(function(){a.$camera&&o.renderReasons.has(t.RenderReason.CAMERA_CHANGED)&&(a.$camera.style.transform=a.joinTransformMatrix(i.getOrthoMatrix()))})),s.hooks.destroy.tap(e.tag,(function(){a.$camera&&a.$camera.remove(),l.removeEventListener(t.CanvasEvent.RESIZE,u),l.removeEventListener(t.ElementEvent.MOUNTED,d),l.removeEventListener(t.ElementEvent.UNMOUNTED,p),l.removeEventListener(t.ElementEvent.ATTR_MODIFIED,f),l.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,y)}))},e.prototype.createCamera=function(e){var t,n=(t=this.context.config).document,r=t.width,a=t.height,i=this.context.contextService.getDomElement(),o=i.parentNode;if(o){var s="g-canvas-camera",l=o.querySelector("#"+s);if(!l){var c=(n||document).createElement("div");l=c,c.id=s,c.style.position="absolute",c.style.left="".concat(i.offsetLeft||0,"px"),c.style.top="".concat(i.offsetTop||0,"px"),c.style.transformOrigin="left top",c.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),c.style.overflow="hidden",c.style.pointerEvents="none",c.style.width="".concat(r||0,"px"),c.style.height="".concat(a||0,"px"),o.appendChild(c)}return l}return null},e.prototype.getOrCreateEl=function(e){var t=this.context.config.document,n=this.displayObjectHTMLElementMap.get(e);return n||(n=(t||document).createElement("div"),e.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(e,n),e.id&&(n.id=e.id),e.name&&n.setAttribute("name",e.name),e.className&&(n.className=e.className),n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(e.getWorldTransform())),n},e.prototype.updateAttribute=function(e,n){var a=this.getOrCreateEl(n);switch(e){case"innerHTML":var s=n.parsedStyle.innerHTML;i(s,"String")?a.innerHTML=s:(a.innerHTML="",a.appendChild(s));break;case"transformOrigin":var l=n.parsedStyle.transformOrigin;a.style["transform-origin"]="".concat(l[0].value," ").concat(l[1].value);break;case"width":if(this.context.enableCSSParsing){var c=n.computedStyleMap().get("width");a.style.width=""+c}else{a.style.width=o(c=n.parsedStyle.width)?"".concat(c,"px"):""+c}break;case"height":if(this.context.enableCSSParsing){var d=n.computedStyleMap().get("height");a.style.height=""+d}else{a.style.height=o(d=n.parsedStyle.height)?"".concat(d,"px"):""+d}break;case"zIndex":a.style["z-index"]="".concat(n.parsedStyle.zIndex);break;case"visibility":a.style.visibility=n.parsedStyle.visibility;break;case"pointerEvents":a.style.pointerEvents=n.parsedStyle.pointerEvents;break;case"opacity":a.style.opacity="".concat(n.parsedStyle.opacity);break;case"fill":var p=n.parsedStyle.fill,f="";t.isCSSRGB(p)?f=p.isNone?"transparent":n.getAttribute("fill"):Array.isArray(p)?f=n.getAttribute("fill"):t.isPattern(p),a.style.background=f;break;case"stroke":var y=n.parsedStyle.stroke,u="";t.isCSSRGB(y)?u=y.isNone?"transparent":n.getAttribute("stroke"):Array.isArray(y)?u=n.getAttribute("stroke"):t.isPattern(y),a.style["border-color"]=u,a.style["border-style"]="solid";break;case"lineWidth":a.style["border-width"]="".concat(n.parsedStyle.lineWidth||0,"px");break;case"lineDash":a.style["border-style"]="dashed";break;case"filter":a.style.filter=n.style.filter;break;default:"x"!==e&&"y"!==e&&(r(n.style[e])||""===n.style[e]||(a.style[e]=n.style[e]))}},e.tag="HTMLRendering",e}(),l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||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 r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t.prototype.init=function(){this.addRenderingPlugin(new s)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin);e.Plugin=l})); | ||
!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 n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};var r=function(e){return null==e},a={}.toString,i=function(e,t){return a.call(e)==="[object "+t+"]"},o=function(e){return i(e,"Number")},s=function(){function e(){this.displayObjectHTMLElementMap=new WeakMap}return e.prototype.joinTransformMatrix=function(e){return"matrix(".concat([e[0],e[1],e[4],e[5],e[12],e[13]].join(","),")")},e.prototype.apply=function(n,r){var a=this,i=n.camera,o=n.renderingContext,s=n.renderingService;this.context=n;var l=o.root.ownerDocument.defaultView,c=function(e,t){t.style.transform=a.joinTransformMatrix(e.getWorldTransform())},d=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){a.$camera||(a.$camera=a.createCamera(i));var o=a.getOrCreateEl(n);if(a.$camera.appendChild(o),r.enableCSSParsing){var s=n.ownerDocument.documentElement.attributes;Object.keys(s).forEach((function(e){o.style[e]=s[e]}))}Object.keys(n.attributes).forEach((function(e){a.updateAttribute(e,n)})),c(n,o),a.context.nativeHTMLMap.set(o,n)}},p=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML&&a.$camera){var r=a.getOrCreateEl(n);r&&(r.remove(),a.context.nativeHTMLMap.delete(r))}},f=function(e){var n=e.target;n.nodeName===t.Shape.HTML&&a.updateAttribute(e.attrName,n)},y=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){var r=a.getOrCreateEl(n);c(n,r)}},u=function(){if(a.$camera){var e=a.context.config,t=e.height;a.$camera.style.width="".concat(e.width||0,"px"),a.$camera.style.height="".concat(t||0,"px")}};s.hooks.init.tap(e.tag,(function(){l.addEventListener(t.CanvasEvent.RESIZE,u),l.addEventListener(t.ElementEvent.MOUNTED,d),l.addEventListener(t.ElementEvent.UNMOUNTED,p),l.addEventListener(t.ElementEvent.ATTR_MODIFIED,f),l.addEventListener(t.ElementEvent.BOUNDS_CHANGED,y)})),s.hooks.endFrame.tap(e.tag,(function(){a.$camera&&o.renderReasons.has(t.RenderReason.CAMERA_CHANGED)&&(a.$camera.style.transform=a.joinTransformMatrix(i.getOrthoMatrix()))})),s.hooks.destroy.tap(e.tag,(function(){a.$camera&&a.$camera.remove(),l.removeEventListener(t.CanvasEvent.RESIZE,u),l.removeEventListener(t.ElementEvent.MOUNTED,d),l.removeEventListener(t.ElementEvent.UNMOUNTED,p),l.removeEventListener(t.ElementEvent.ATTR_MODIFIED,f),l.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,y)}))},e.prototype.createCamera=function(e){var t=this.context.config,n=t.document,r=t.width,a=t.height,i=this.context.contextService.getDomElement(),o=i.parentNode;if(o){var s="g-canvas-camera",l=o.querySelector("#"+s);if(!l){var c=(n||document).createElement("div");l=c,c.id=s,c.style.position="absolute",c.style.left="".concat(i.offsetLeft||0,"px"),c.style.top="".concat(i.offsetTop||0,"px"),c.style.transformOrigin="left top",c.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),c.style.overflow="hidden",c.style.pointerEvents="none",c.style.width="".concat(r||0,"px"),c.style.height="".concat(a||0,"px"),o.appendChild(c)}return l}return null},e.prototype.getOrCreateEl=function(e){var t=this.context.config.document,n=this.displayObjectHTMLElementMap.get(e);return n||(n=(t||document).createElement("div"),e.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(e,n),e.id&&(n.id=e.id),e.name&&n.setAttribute("name",e.name),e.className&&(n.className=e.className),n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(e.getWorldTransform())),n},e.prototype.updateAttribute=function(e,n){var a=this.getOrCreateEl(n);switch(e){case"innerHTML":var s=n.parsedStyle.innerHTML;i(s,"String")?a.innerHTML=s:(a.innerHTML="",a.appendChild(s));break;case"transformOrigin":var l=n.parsedStyle.transformOrigin;a.style["transform-origin"]="".concat(l[0].value," ").concat(l[1].value);break;case"width":if(this.context.enableCSSParsing){var c=n.computedStyleMap().get("width");a.style.width=""+c}else{a.style.width=o(c=n.parsedStyle.width)?"".concat(c,"px"):""+c}break;case"height":if(this.context.enableCSSParsing){var d=n.computedStyleMap().get("height");a.style.height=""+d}else{a.style.height=o(d=n.parsedStyle.height)?"".concat(d,"px"):""+d}break;case"zIndex":a.style["z-index"]="".concat(n.parsedStyle.zIndex);break;case"visibility":a.style.visibility=n.parsedStyle.visibility;break;case"pointerEvents":a.style.pointerEvents=n.parsedStyle.pointerEvents;break;case"opacity":a.style.opacity="".concat(n.parsedStyle.opacity);break;case"fill":var p=n.parsedStyle.fill,f="";t.isCSSRGB(p)?f=p.isNone?"transparent":n.getAttribute("fill"):Array.isArray(p)?f=n.getAttribute("fill"):t.isPattern(p),a.style.background=f;break;case"stroke":var y=n.parsedStyle.stroke,u="";t.isCSSRGB(y)?u=y.isNone?"transparent":n.getAttribute("stroke"):Array.isArray(y)?u=n.getAttribute("stroke"):t.isPattern(y),a.style["border-color"]=u,a.style["border-style"]="solid";break;case"lineWidth":a.style["border-width"]="".concat(n.parsedStyle.lineWidth||0,"px");break;case"lineDash":a.style["border-style"]="dashed";break;case"filter":a.style.filter=n.style.filter;break;default:"x"!==e&&"y"!==e&&(r(n.style[e])||""===n.style[e]||(a.style[e]=n.style[e]))}},e.tag="HTMLRendering",e}(),l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||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 r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(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": "1.9.16", | ||
"version": "1.9.17", | ||
"description": "A G plugin for rendering HTML", | ||
@@ -38,3 +38,3 @@ "keywords": [ | ||
"tslib": "^2.5.3", | ||
"@antv/g-lite": "1.2.13" | ||
"@antv/g-lite": "1.2.14" | ||
}, | ||
@@ -41,0 +41,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126499
630
+ Added@antv/g-lite@1.2.14(transitive)
- Removed@antv/g-lite@1.2.13(transitive)
Updated@antv/g-lite@1.2.14