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.18 to 1.0.19

4

dist/index.umd.min.js

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

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

@@ -15,2 +15,2 @@ Copyright (c) Microsoft Corporation.

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function o(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}function i(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}Object.create;Object.create;var a=n(0),c={}.toString,u=function(t,e){return c.call(t)==="[object "+e+"]"},f=function(t){return u(t,"Function")},p=function(t){return Array.isArray?Array.isArray(t):u(t,"Array")},l=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};var d=function(t,e){if(t)if(p(t))for(var n=0,r=t.length;n<r&&!1!==e(t[n],n);n++);else if(l(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===e(t[o],o))break};Object.keys;var s=Array.prototype,y=(s.splice,s.indexOf,Array.prototype.splice,function(t){return u(t,"String")});Object.prototype.hasOwnProperty;var v=function(t){return u(t,"Number")};Number.isInteger&&Number.isInteger;Math.PI,parseInt,Math.PI;var g=Object.values?function(t){return Object.values(t)}:function(t){var e=[];return d(t,(function(n,r){f(t)&&"prototype"===r||e.push(n)})),e};Object.prototype;Object.prototype.hasOwnProperty;var m;Object.prototype.hasOwnProperty;(function(t,e){if(!f(t))throw new TypeError("Expected a function");var n=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=e?e.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var c=t.apply(this,r);return a.set(i,c),c};n.cache=new Map})((function(t,e){void 0===e&&(e={});var n=e.fontSize,r=e.fontFamily,o=e.fontWeight,i=e.fontStyle,a=e.fontVariant;return m||(m=document.createElement("canvas").getContext("2d")),m.font=[i,a,o,n+"px",r].join(" "),m.measureText(y(t)?t:"").width}),(function(t,e){return void 0===e&&(e={}),function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],a=0,c=i.length;a<c;a++,o++)r[o]=i[a];return r}([t],g(e)).join("")})),function(){function t(){this.map={}}t.prototype.has=function(t){return void 0!==this.map[t]},t.prototype.get=function(t,e){var n=this.map[t];return void 0===n?e:n},t.prototype.set=function(t,e){this.map[t]=e},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(t){delete this.map[t]},t.prototype.size=function(){return Object.keys(this.map).length}}();var h=function(){function t(){}var e;return e=t,t.prototype.apply=function(t){var n=this,r=function(t){var e=t.target;if(e.nodeName===a.Shape.HTML){var r=e.parsedStyle.innerHTML,o="g-html-"+e.entity,i=n.contextService.getDomElement().parentNode;if(i)if(!i.querySelector("#"+o)){var c=document.createElement("div");e.parsedStyle.$el=c,c.id=o,y(r)?c.innerHTML=r:c.appendChild(r),i.appendChild(c)}}},o=function(t){var e=t.target;if(e.nodeName===a.Shape.HTML){var r="g-html-"+e.entity,o=n.contextService.getDomElement().parentNode;if(o){var i=o.querySelector("#"+r);i&&o.removeChild(i)}}};t.hooks.init.tap(e.tag,(function(){n.renderingContext.root.addEventListener(a.ElementEvent.MOUNTED,r),n.renderingContext.root.addEventListener(a.ElementEvent.UNMOUNTED,o)})),t.hooks.destroy.tap(e.tag,(function(){n.renderingContext.root.removeEventListener(a.ElementEvent.MOUNTED,r),n.renderingContext.root.removeEventListener(a.ElementEvent.UNMOUNTED,o)})),t.hooks.render.tap(e.tag,(function(t){if(t.nodeName===a.Shape.HTML){var e="g-html-"+t.entity,r=n.contextService.getDomElement().parentNode;if(r){var o=r.querySelector("#"+e);n.updateCSSStyle(o,t.parsedStyle,t)}}}))},t.prototype.updateCSSStyle=function(t,e,n){var r=e.zIndex,o=void 0===r?0:r,i=e.visibility,c=void 0===i?"visible":i,u=e.opacity,f=void 0===u?1:u,p=e.fill,l=e.lineWidth,d=e.lineDash,s=e.stroke,y=e.anchor,v=e.width,g=e.height,m=e.style,h=void 0===m?"":m,b=e.className,O=void 0===b?"":b,j=0,x=0,S=v.unit,E=v.value,P=g.unit,R=g.value;""!==S&&"px"!==S||(j=E),""!==P&&"px"!==P||(x=R);var T={position:"absolute",top:0,left:0};if(T.width="".concat(j,"px"),T.height="".concat(x,"px"),T.transform="matrix3d(".concat(n.getWorldTransform().join(","),")"),y&&(T.transform+=" translate(".concat(100*y[0],"%, ").concat(100*y[0],"%)")),n.style.transformOrigin&&(T["transform-origin"]=n.style.transformOrigin),T["z-index"]=o,T.visibility=c,T.opacity=f,p){var C="";if(p.type===a.PARSED_COLOR_TYPE.Constant)C=p.formatted;else if(p.type===a.PARSED_COLOR_TYPE.LinearGradient){var M=p.value.steps.map((function(t){return"".concat(t[1]," ").concat(100*Number(t[0]),"%")})).join(",");C="linear-gradient(to right, ".concat(M,");")}else p.type===a.PARSED_COLOR_TYPE.RadialGradient||(p.type,a.PARSED_COLOR_TYPE.Pattern);T.background=C}T["border-width"]="".concat(l.value,"px"),s&&s.type===a.PARSED_COLOR_TYPE.Constant&&(T["border-color"]=s.formatted,T["border-style"]="solid"),d&&(T["border-style"]="dashed"),n.style.filter&&(T.filter=n.style.filter),O&&(Array.isArray(O)?O.forEach((function(e){t.classList.add(e)})):t.classList.add(O)),t.setAttribute("style",Object.keys(T).map((function(t){return"".concat(t,":").concat(T[t])})).join(";")+h)},t.tag="HTMLRenderingPlugin",o([Object(r.inject)(a.ContextService),i("design:type",Object)],t.prototype,"contextService",void 0),o([Object(r.inject)(a.RenderingContext),i("design:type",Object)],t.prototype,"renderingContext",void 0),t=e=o([Object(r.singleton)({contrib:a.RenderingPluginContribution})],t)}(),b=Object(r.Module)((function(t){t(h)})),O=function(){function t(){}return t.prototype.init=function(t){t.load(b,!0)},t.prototype.destroy=function(t){t.unload(b)},t}()}])}));
***************************************************************************** */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)}Object.create;Object.create;var a=n(0),c={}.toString,u=function(e,t){return c.call(e)==="[object "+t+"]"},f=function(e){return u(e,"Function")},p=function(e){return Array.isArray?Array.isArray(e):u(e,"Array")},l=function(e){var t=typeof e;return null!==e&&"object"===t||"function"===t};var d=function(e,t){if(e)if(p(e))for(var n=0,r=e.length;n<r&&!1!==t(e[n],n);n++);else if(l(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===t(e[o],o))break};Object.keys;var s=Array.prototype,y=(s.splice,s.indexOf,Array.prototype.splice,function(e){return u(e,"String")});Object.prototype.hasOwnProperty;var v=function(e){return u(e,"Number")};Number.isInteger&&Number.isInteger;Math.PI,parseInt,Math.PI;var g=Object.values?function(e){return Object.values(e)}:function(e){var t=[];return d(e,(function(n,r){f(e)&&"prototype"===r||t.push(n)})),t};Object.prototype;Object.prototype.hasOwnProperty;var m;Object.prototype.hasOwnProperty;(function(e,t){if(!f(e))throw new TypeError("Expected a function");var n=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var c=e.apply(this,r);return a.set(i,c),c};n.cache=new Map})((function(e,t){void 0===t&&(t={});var n=t.fontSize,r=t.fontFamily,o=t.fontWeight,i=t.fontStyle,a=t.fontVariant;return m||(m=document.createElement("canvas").getContext("2d")),m.font=[i,a,o,n+"px",r].join(" "),m.measureText(y(e)?e:"").width}),(function(e,t){return void 0===t&&(t={}),function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,c=i.length;a<c;a++,o++)r[o]=i[a];return r}([e],g(t)).join("")})),function(){function e(){this.map={}}e.prototype.has=function(e){return void 0!==this.map[e]},e.prototype.get=function(e,t){var n=this.map[e];return void 0===n?t:n},e.prototype.set=function(e,t){this.map[e]=t},e.prototype.clear=function(){this.map={}},e.prototype.delete=function(e){delete this.map[e]},e.prototype.size=function(){return Object.keys(this.map).length}}();var h=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===a.Shape.HTML){var r=t.parsedStyle.innerHTML,o="g-html-"+t.entity,i=n.contextService.getDomElement().parentNode;if(i)if(!i.querySelector("#"+o)){var c=document.createElement("div");t.parsedStyle.$el=c,c.id=o,y(r)?c.innerHTML=r:c.appendChild(r),i.appendChild(c)}}},o=function(e){var t=e.target;if(t.nodeName===a.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.tap(t.tag,(function(){n.renderingContext.root.addEventListener(a.ElementEvent.MOUNTED,r),n.renderingContext.root.addEventListener(a.ElementEvent.UNMOUNTED,o)})),e.hooks.destroy.tap(t.tag,(function(){n.renderingContext.root.removeEventListener(a.ElementEvent.MOUNTED,r),n.renderingContext.root.removeEventListener(a.ElementEvent.UNMOUNTED,o)})),e.hooks.render.tap(t.tag,(function(e){if(e.nodeName===a.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,c=t.visibility,u=t.opacity,f=t.fill,p=t.lineWidth,l=t.lineDash,d=t.stroke,s=t.width,y=t.height,v=t.style,g=void 0===v?"":v,m=t.className,h=void 0===m?"":m;r=s.value,o=y.value;var b={position:"absolute",top:0,left:0};if(b.width="".concat(r,"px"),b.height="".concat(o,"px"),b.transform="matrix3d(".concat(n.getWorldTransform().join(","),")"),n.style.transformOrigin&&(b["transform-origin"]=n.style.transformOrigin),b["z-index"]=i.value,b.visibility=c.value,b.opacity=u.value,f){var j="";if(f instanceof a.CSSRGB)j=f.toString();else if(f instanceof a.CSSGradientValue&&f.type===a.GradientPatternType.LinearGradient){var O=f.value.steps.map((function(e){return"".concat(e[1]," ").concat(100*Number(e[0]),"%")})).join(",");j="linear-gradient(to right, ".concat(O,");")}b.background=j}b["border-width"]="".concat((null==p?void 0:p.value)||0,"px"),d&&(b["border-color"]=d.toString(),b["border-style"]="solid"),l&&(b["border-style"]="dashed"),n.style.filter&&(b.filter=n.style.filter),h&&(Array.isArray(h)?h.forEach((function(t){e.classList.add(t)})):e.classList.add(h)),e.setAttribute("style",Object.keys(b).map((function(e){return"".concat(e,":").concat(b[e])})).join(";")+g)},e.tag="HTMLRenderingPlugin",o([Object(r.inject)(a.ContextService),i("design:type",Object)],e.prototype,"contextService",void 0),o([Object(r.inject)(a.RenderingContext),i("design:type",Object)],e.prototype,"renderingContext",void 0),e=t=o([Object(r.singleton)({contrib:a.RenderingPluginContribution})],e)}(),b=Object(r.Module)((function(e){e(h)})),j=function(){function e(){}return e.prototype.init=function(e){e.load(b,!0)},e.prototype.destroy=function(e){e.unload(b)},e}()}])}));
import { __decorate, __metadata } from "tslib";
import { inject, singleton } from 'mana-syringe';
import { Shape, RenderingPluginContribution, ContextService, PARSED_COLOR_TYPE, RenderingContext, ElementEvent } from '@antv/g';
import { CSSRGB, CSSGradientValue, GradientPatternType } from '@antv/g';
import { Shape, RenderingPluginContribution, ContextService, RenderingContext, ElementEvent } from '@antv/g';
import { isString } from '@antv/util';

@@ -90,8 +91,5 @@ var HTML_PREFIX = 'g-html-';

HTMLRenderingPlugin.prototype.updateCSSStyle = function ($el, parsedStyle, object) {
var _a = parsedStyle.zIndex,
zIndex = _a === void 0 ? 0 : _a,
_b = parsedStyle.visibility,
visibility = _b === void 0 ? 'visible' : _b,
_c = parsedStyle.opacity,
opacity = _c === void 0 ? 1 : _c,
var zIndex = parsedStyle.zIndex,
visibility = parsedStyle.visibility,
opacity = parsedStyle.opacity,
fill = parsedStyle.fill,

@@ -101,24 +99,14 @@ lineWidth = parsedStyle.lineWidth,

stroke = parsedStyle.stroke,
anchor = parsedStyle.anchor,
width = parsedStyle.width,
height = parsedStyle.height,
_d = parsedStyle.style,
initialStyle = _d === void 0 ? '' : _d,
_e = parsedStyle.className,
className = _e === void 0 ? '' : _e;
_a = parsedStyle.style,
initialStyle = _a === void 0 ? '' : _a,
_b = parsedStyle.className,
className = _b === void 0 ? '' : _b;
var contentWidth = 0;
var contentHeight = 0;
var widthUnit = width.unit,
widthValue = width.value;
var heightUnit = height.unit,
heightValue = height.value;
if (widthUnit === '' || widthUnit === 'px') {
contentWidth = widthValue;
}
if (heightUnit === '' || heightUnit === 'px') {
contentHeight = heightValue;
}
var widthValue = width.value;
var heightValue = height.value;
contentWidth = widthValue;
contentHeight = heightValue;
var style = {}; // use absolute position

@@ -132,9 +120,4 @@

style.transform = "matrix3d(".concat(object.getWorldTransform().join(','), ")");
style.transform = "matrix3d(".concat(object.getWorldTransform().join(','), ")"); // use unparsed transform origin
if (anchor) {
style.transform += " translate(".concat(anchor[0] * 100, "%, ").concat(anchor[0] * 100, "%)");
} // use unparsed transform origin
if (object.style.transformOrigin) {

@@ -145,7 +128,7 @@ style['transform-origin'] = object.style.transformOrigin;

style['z-index'] = zIndex; // visibility
style['z-index'] = zIndex.value; // visibility
style.visibility = visibility; // opacity
style.visibility = visibility.value; // opacity
style.opacity = opacity; // backgroundColor
style.opacity = opacity.value; // backgroundColor

@@ -155,12 +138,14 @@ if (fill) {

if (fill.type === PARSED_COLOR_TYPE.Constant) {
color = fill.formatted;
} else if (fill.type === PARSED_COLOR_TYPE.LinearGradient) {
var steps = fill.value.steps.map(function (cur) {
// ['0', '#ffffff'],
return "".concat(cur[1], " ").concat(Number(cur[0]) * 100, "%");
}).join(','); // @see https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient()
if (fill instanceof CSSRGB) {
color = fill.toString();
} else if (fill instanceof CSSGradientValue) {
if (fill.type === GradientPatternType.LinearGradient) {
var steps = fill.value.steps.map(function (cur) {
// ['0', '#ffffff'],
return "".concat(cur[1], " ").concat(Number(cur[0]) * 100, "%");
}).join(','); // @see https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient()
color = "linear-gradient(to right, ".concat(steps, ");");
} else if (fill.type === PARSED_COLOR_TYPE.RadialGradient) {} else if (fill.type === PARSED_COLOR_TYPE.Pattern) {}
color = "linear-gradient(to right, ".concat(steps, ");");
}
}

@@ -171,6 +156,6 @@ style.background = color;

style['border-width'] = "".concat(lineWidth.value, "px");
style['border-width'] = "".concat((lineWidth === null || lineWidth === void 0 ? void 0 : lineWidth.value) || 0, "px");
if (stroke && stroke.type === PARSED_COLOR_TYPE.Constant) {
style['border-color'] = stroke.formatted;
if (stroke) {
style['border-color'] = stroke.toString();
style['border-style'] = 'solid';

@@ -177,0 +162,0 @@ }

@@ -101,8 +101,5 @@ "use strict";

HTMLRenderingPlugin.prototype.updateCSSStyle = function ($el, parsedStyle, object) {
var _a = parsedStyle.zIndex,
zIndex = _a === void 0 ? 0 : _a,
_b = parsedStyle.visibility,
visibility = _b === void 0 ? 'visible' : _b,
_c = parsedStyle.opacity,
opacity = _c === void 0 ? 1 : _c,
var zIndex = parsedStyle.zIndex,
visibility = parsedStyle.visibility,
opacity = parsedStyle.opacity,
fill = parsedStyle.fill,

@@ -112,24 +109,14 @@ lineWidth = parsedStyle.lineWidth,

stroke = parsedStyle.stroke,
anchor = parsedStyle.anchor,
width = parsedStyle.width,
height = parsedStyle.height,
_d = parsedStyle.style,
initialStyle = _d === void 0 ? '' : _d,
_e = parsedStyle.className,
className = _e === void 0 ? '' : _e;
_a = parsedStyle.style,
initialStyle = _a === void 0 ? '' : _a,
_b = parsedStyle.className,
className = _b === void 0 ? '' : _b;
var contentWidth = 0;
var contentHeight = 0;
var widthUnit = width.unit,
widthValue = width.value;
var heightUnit = height.unit,
heightValue = height.value;
if (widthUnit === '' || widthUnit === 'px') {
contentWidth = widthValue;
}
if (heightUnit === '' || heightUnit === 'px') {
contentHeight = heightValue;
}
var widthValue = width.value;
var heightValue = height.value;
contentWidth = widthValue;
contentHeight = heightValue;
var style = {}; // use absolute position

@@ -143,9 +130,4 @@

style.transform = "matrix3d(".concat(object.getWorldTransform().join(','), ")");
style.transform = "matrix3d(".concat(object.getWorldTransform().join(','), ")"); // use unparsed transform origin
if (anchor) {
style.transform += " translate(".concat(anchor[0] * 100, "%, ").concat(anchor[0] * 100, "%)");
} // use unparsed transform origin
if (object.style.transformOrigin) {

@@ -156,7 +138,7 @@ style['transform-origin'] = object.style.transformOrigin;

style['z-index'] = zIndex; // visibility
style['z-index'] = zIndex.value; // visibility
style.visibility = visibility; // opacity
style.visibility = visibility.value; // opacity
style.opacity = opacity; // backgroundColor
style.opacity = opacity.value; // backgroundColor

@@ -166,12 +148,14 @@ if (fill) {

if (fill.type === _g.PARSED_COLOR_TYPE.Constant) {
color = fill.formatted;
} else if (fill.type === _g.PARSED_COLOR_TYPE.LinearGradient) {
var steps = fill.value.steps.map(function (cur) {
// ['0', '#ffffff'],
return "".concat(cur[1], " ").concat(Number(cur[0]) * 100, "%");
}).join(','); // @see https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient()
if (fill instanceof _g.CSSRGB) {
color = fill.toString();
} else if (fill instanceof _g.CSSGradientValue) {
if (fill.type === _g.GradientPatternType.LinearGradient) {
var steps = fill.value.steps.map(function (cur) {
// ['0', '#ffffff'],
return "".concat(cur[1], " ").concat(Number(cur[0]) * 100, "%");
}).join(','); // @see https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient()
color = "linear-gradient(to right, ".concat(steps, ");");
} else if (fill.type === _g.PARSED_COLOR_TYPE.RadialGradient) {} else if (fill.type === _g.PARSED_COLOR_TYPE.Pattern) {}
color = "linear-gradient(to right, ".concat(steps, ");");
}
}

@@ -182,6 +166,6 @@ style.background = color;

style['border-width'] = "".concat(lineWidth.value, "px");
style['border-width'] = "".concat((lineWidth === null || lineWidth === void 0 ? void 0 : lineWidth.value) || 0, "px");
if (stroke && stroke.type === _g.PARSED_COLOR_TYPE.Constant) {
style['border-color'] = stroke.formatted;
if (stroke) {
style['border-color'] = stroke.toString();
style['border-style'] = 'solid';

@@ -188,0 +172,0 @@ }

{
"name": "@antv/g-plugin-html-renderer",
"version": "1.0.18",
"version": "1.0.19",
"description": "A G plugin for rendering HTML",

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

"homepage": "https://github.com/antvis/g#readme",
"gitHead": "477bba12093a037c42ad9ff3f275ea798c0379f5"
"gitHead": "cc8e74c562a0cb5b5fab1063510c4c9fc9aae360"
}
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