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
58
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 1.0.21-alpha.15 to 1.0.21-alpha.16

2

dist/index.umd.min.js

@@ -15,2 +15,2 @@ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@antv/g"),require("mana-syringe")):"function"==typeof define&&define.amd?define(["@antv/g","mana-syringe"],t):"object"==typeof exports?exports.HTMLRenderer=t(require("@antv/g"),require("mana-syringe")):(e.G=e.G||{},e.G.HTMLRenderer=t(e.G,e.G.ManaSyringe))}(window,(function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";n.r(t),n.d(t,"Plugin",(function(){return d}));var r=n(1);

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function o(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function i(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function a(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function c(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}u((r=r.apply(e,t||[])).next())}))}function c(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}Object.create;Object.create;var u=n(0),l=function(){function e(){}return e.prototype.apply=function(e){var t=this,n=function(e){var n=e.target;if(n.nodeName===u.Shape.HTML){var r=n.parsedStyle.innerHTML,o="g-html-"+n.entity,i=t.contextService.getDomElement().parentNode;if(i)if(!i.querySelector("#"+o)){var a=document.createElement("div");n.parsedStyle.$el=a,a.id=o,Object(u.isString)(r)?a.innerHTML=r:a.appendChild(r),i.appendChild(a)}}},r=function(e){var n=e.target;if(n.nodeName===u.Shape.HTML){var r="g-html-"+n.entity,o=t.contextService.getDomElement().parentNode;if(o){var i=o.querySelector("#"+r);i&&o.removeChild(i)}}};e.hooks.init.tapPromise((function(){return a(t,void 0,void 0,(function(){return c(this,(function(e){return this.renderingContext.root.addEventListener(u.ElementEvent.MOUNTED,n),this.renderingContext.root.addEventListener(u.ElementEvent.UNMOUNTED,r),[2]}))}))})),e.hooks.destroy.tap((function(){t.renderingContext.root.removeEventListener(u.ElementEvent.MOUNTED,n),t.renderingContext.root.removeEventListener(u.ElementEvent.UNMOUNTED,r)})),e.hooks.render.tap((function(e){if(e.nodeName===u.Shape.HTML){var n="g-html-"+e.entity,r=t.contextService.getDomElement().parentNode;if(r){var o=r.querySelector("#"+n);t.updateCSSStyle(o,e.parsedStyle,e)}}}))},e.prototype.updateCSSStyle=function(e,t,n){var r,o,i=t.zIndex,a=t.visibility,c=t.opacity,l=t.fill,f=t.lineWidth,d=t.lineDash,s=t.stroke,p=t.width,y=t.height,v=t.style,b=void 0===v?"":v,g=t.className,m=void 0===g?"":g;r=p.value,o=y.value;var h={position:"absolute",top:0,left:0};if(h.width="".concat(r,"px"),h.height="".concat(o,"px"),h.transform="matrix3d(".concat(n.getWorldTransform().join(","),")"),n.style.transformOrigin&&(h["transform-origin"]=n.style.transformOrigin),h["z-index"]=i.value,h.visibility=a.value,h.opacity=c.value,l){var S="";if(l instanceof u.CSSRGB)S=l.toString();else if(l instanceof u.CSSGradientValue&&l.type===u.GradientPatternType.LinearGradient){var x=l.value.steps.map((function(e){return"".concat(e[1]," ").concat(100*Number(e[0]),"%")})).join(",");S="linear-gradient(to right, ".concat(x,");")}h.background=S}h["border-width"]="".concat((null==f?void 0:f.value)||0,"px"),s&&(h["border-color"]=s.toString(),h["border-style"]="solid"),d&&(h["border-style"]="dashed"),n.style.filter&&(h.filter=n.style.filter),m&&(Array.isArray(m)?m.forEach((function(t){e.classList.add(t)})):e.classList.add(m)),e.setAttribute("style",Object.keys(h).map((function(e){return"".concat(e,":").concat(h[e])})).join(";")+b)},o([Object(r.inject)(u.ContextService),i("design:type",Object)],e.prototype,"contextService",void 0),o([Object(r.inject)(u.RenderingContext),i("design:type",Object)],e.prototype,"renderingContext",void 0),e=o([Object(r.singleton)({contrib:u.RenderingPluginContribution})],e)}(),f=Object(r.Module)((function(e){e(l)})),d=function(){function e(){}return e.prototype.init=function(e){e.load(f,!0)},e.prototype.destroy=function(e){e.unload(f)},e}()}])}));
***************************************************************************** */function o(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function i(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function a(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function c(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}u((r=r.apply(e,t||[])).next())}))}function c(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}Object.create;Object.create;var u=n(0),l=function(){function e(){}var t;return t=e,e.prototype.apply=function(e){var n=this,r=function(e){var t=e.target;if(t.nodeName===u.Shape.HTML){var r=t.parsedStyle.innerHTML,o="g-html-"+t.entity,i=n.contextService.getDomElement().parentNode;if(i)if(!i.querySelector("#"+o)){var a=document.createElement("div");t.parsedStyle.$el=a,a.id=o,Object(u.isString)(r)?a.innerHTML=r:a.appendChild(r),i.appendChild(a)}}},o=function(e){var t=e.target;if(t.nodeName===u.Shape.HTML){var r="g-html-"+t.entity,o=n.contextService.getDomElement().parentNode;if(o){var i=o.querySelector("#"+r);i&&o.removeChild(i)}}};e.hooks.init.tapPromise(t.tag,(function(){return a(n,void 0,void 0,(function(){return c(this,(function(e){return this.renderingContext.root.addEventListener(u.ElementEvent.MOUNTED,r),this.renderingContext.root.addEventListener(u.ElementEvent.UNMOUNTED,o),[2]}))}))})),e.hooks.destroy.tap(t.tag,(function(){n.renderingContext.root.removeEventListener(u.ElementEvent.MOUNTED,r),n.renderingContext.root.removeEventListener(u.ElementEvent.UNMOUNTED,o)})),e.hooks.render.tap(t.tag,(function(e){if(e.nodeName===u.Shape.HTML){var t="g-html-"+e.entity,r=n.contextService.getDomElement().parentNode;if(r){var o=r.querySelector("#"+t);n.updateCSSStyle(o,e.parsedStyle,e)}}}))},e.prototype.updateCSSStyle=function(e,t,n){var r,o,i=t.zIndex,a=t.visibility,c=t.opacity,l=t.fill,f=t.lineWidth,d=t.lineDash,s=t.stroke,p=t.width,y=t.height,v=t.style,b=void 0===v?"":v,g=t.className,m=void 0===g?"":g;r=p.value,o=y.value;var h={position:"absolute",top:0,left:0};if(h.width="".concat(r,"px"),h.height="".concat(o,"px"),h.transform="matrix3d(".concat(n.getWorldTransform().join(","),")"),n.style.transformOrigin&&(h["transform-origin"]=n.style.transformOrigin),h["z-index"]=i.value,h.visibility=a.value,h.opacity=c.value,l){var S="";if(l instanceof u.CSSRGB)S=l.toString();else if(l instanceof u.CSSGradientValue&&l.type===u.GradientPatternType.LinearGradient){var x=l.value.steps.map((function(e){return"".concat(e[1]," ").concat(100*Number(e[0]),"%")})).join(",");S="linear-gradient(to right, ".concat(x,");")}h.background=S}h["border-width"]="".concat((null==f?void 0:f.value)||0,"px"),s&&(h["border-color"]=s.toString(),h["border-style"]="solid"),d&&(h["border-style"]="dashed"),n.style.filter&&(h.filter=n.style.filter),m&&(Array.isArray(m)?m.forEach((function(t){e.classList.add(t)})):e.classList.add(m)),e.setAttribute("style",Object.keys(h).map((function(e){return"".concat(e,":").concat(h[e])})).join(";")+b)},e.tag="HTMLRendering",o([Object(r.inject)(u.ContextService),i("design:type",Object)],e.prototype,"contextService",void 0),o([Object(r.inject)(u.RenderingContext),i("design:type",Object)],e.prototype,"renderingContext",void 0),e=t=o([Object(r.singleton)({contrib:u.RenderingPluginContribution})],e)}(),f=Object(r.Module)((function(e){e(l)})),d=function(){function e(){}return e.prototype.init=function(e){e.load(f,!0)},e.prototype.destroy=function(e){e.unload(f)},e}()}])}));
import type { RenderingService, RenderingPlugin } from '@antv/g';
export declare class HTMLRenderingPlugin implements RenderingPlugin {
static tag: string;
private contextService;

@@ -4,0 +5,0 @@ private renderingContext;

@@ -12,2 +12,4 @@ import { __awaiter, __decorate, __generator, __metadata } from "tslib";

HTMLRenderingPlugin_1 = HTMLRenderingPlugin;
HTMLRenderingPlugin.prototype.apply = function (renderingService) {

@@ -63,3 +65,3 @@ var _this = this;

renderingService.hooks.init.tapPromise(function () {
renderingService.hooks.init.tapPromise(HTMLRenderingPlugin_1.tag, function () {
return __awaiter(_this, void 0, void 0, function () {

@@ -75,3 +77,3 @@ return __generator(this, function (_a) {

});
renderingService.hooks.destroy.tap(function () {
renderingService.hooks.destroy.tap(HTMLRenderingPlugin_1.tag, function () {
_this.renderingContext.root.removeEventListener(ElementEvent.MOUNTED, handleMounted);

@@ -81,3 +83,3 @@

});
renderingService.hooks.render.tap(function (object) {
renderingService.hooks.render.tap(HTMLRenderingPlugin_1.tag, function (object) {
if (object.nodeName === Shape.HTML) {

@@ -190,2 +192,5 @@ var existedId = HTML_PREFIX + object.entity;

var HTMLRenderingPlugin_1;
HTMLRenderingPlugin.tag = 'HTMLRendering';
__decorate([inject(ContextService), __metadata("design:type", Object)], HTMLRenderingPlugin.prototype, "contextService", void 0);

@@ -195,3 +200,3 @@

HTMLRenderingPlugin = __decorate([singleton({
HTMLRenderingPlugin = HTMLRenderingPlugin_1 = __decorate([singleton({
contrib: RenderingPluginContribution

@@ -198,0 +203,0 @@ })], HTMLRenderingPlugin);

import type { RenderingService, RenderingPlugin } from '@antv/g';
export declare class HTMLRenderingPlugin implements RenderingPlugin {
static tag: string;
private contextService;

@@ -4,0 +5,0 @@ private renderingContext;

@@ -21,2 +21,4 @@ "use strict";

HTMLRenderingPlugin_1 = HTMLRenderingPlugin;
HTMLRenderingPlugin.prototype.apply = function (renderingService) {

@@ -72,3 +74,3 @@ var _this = this;

renderingService.hooks.init.tapPromise(function () {
renderingService.hooks.init.tapPromise(HTMLRenderingPlugin_1.tag, function () {
return (0, _tslib.__awaiter)(_this, void 0, void 0, function () {

@@ -84,3 +86,3 @@ return (0, _tslib.__generator)(this, function (_a) {

});
renderingService.hooks.destroy.tap(function () {
renderingService.hooks.destroy.tap(HTMLRenderingPlugin_1.tag, function () {
_this.renderingContext.root.removeEventListener(_g.ElementEvent.MOUNTED, handleMounted);

@@ -90,3 +92,3 @@

});
renderingService.hooks.render.tap(function (object) {
renderingService.hooks.render.tap(HTMLRenderingPlugin_1.tag, function (object) {
if (object.nodeName === _g.Shape.HTML) {

@@ -199,5 +201,7 @@ var existedId = HTML_PREFIX + object.entity;

var HTMLRenderingPlugin_1;
HTMLRenderingPlugin.tag = 'HTMLRendering';
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_g.ContextService), (0, _tslib.__metadata)("design:type", Object)], HTMLRenderingPlugin.prototype, "contextService", void 0);
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_g.RenderingContext), (0, _tslib.__metadata)("design:type", Object)], HTMLRenderingPlugin.prototype, "renderingContext", void 0);
HTMLRenderingPlugin = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
HTMLRenderingPlugin = HTMLRenderingPlugin_1 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
contrib: _g.RenderingPluginContribution

@@ -204,0 +208,0 @@ })], HTMLRenderingPlugin);

{
"name": "@antv/g-plugin-html-renderer",
"version": "1.0.21-alpha.15",
"version": "1.0.21-alpha.16",
"description": "A G plugin for rendering HTML",

@@ -48,3 +48,3 @@ "main": "lib/index.js",

"homepage": "https://github.com/antvis/g#readme",
"gitHead": "8c28e04155e41a948c323161a35aeda63c2294a4"
"gitHead": "5917b66cd22e8351f0ba54f3d08c884abac3a1a0"
}
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