Socket
Socket
Sign inDemoInstall

zrender

Package Overview
Dependencies
Maintainers
16
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zrender - npm Package Compare versions

Comparing version 5.4.4 to 5.5.0

build/package.json

1

lib/canvas/Layer.d.ts

@@ -30,3 +30,2 @@ import { ImagePatternObject } from '../graphic/Pattern';

private _paintRects;
__painter: CanvasPainter;
__dirty: boolean;

@@ -33,0 +32,0 @@ __firstTimePaint: boolean;

@@ -172,3 +172,3 @@ import { __extends } from "tslib";

var el = prevList[i];
var shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true);
var shouldPaint = el && el.shouldBePainted(viewWidth, viewHeight, true, true);
if (el && (!shouldPaint || !el.__zr) && el.__isRendered) {

@@ -270,3 +270,3 @@ var prevRect = el.getPrevPaintRect();

self.setUnpainted();
self.__painter.refresh();
self.painter.refresh();
}

@@ -273,0 +273,0 @@ });

@@ -396,3 +396,3 @@ import { devicePixelRatio } from '../config.js';

}
layer.__painter = this;
layer.painter || (layer.painter = this);
};

@@ -399,0 +399,0 @@ CanvasPainter.prototype.eachLayer = function (cb, context) {

@@ -35,3 +35,4 @@ var Browser = (function () {

}
else if (typeof navigator === 'undefined') {
else if (typeof navigator === 'undefined'
|| navigator.userAgent.indexOf('Node.js') === 0) {
env.node = true;

@@ -38,0 +39,0 @@ env.svgSupported = true;

@@ -8,5 +8,5 @@ import { VectorArray } from './vector';

export declare function translate(out: MatrixArray, a: MatrixArray, v: VectorArray): MatrixArray;
export declare function rotate(out: MatrixArray, a: MatrixArray, rad: number): MatrixArray;
export declare function rotate(out: MatrixArray, a: MatrixArray, rad: number, pivot?: VectorArray): MatrixArray;
export declare function scale(out: MatrixArray, a: MatrixArray, v: VectorArray): MatrixArray;
export declare function invert(out: MatrixArray, a: MatrixArray): MatrixArray | null;
export declare function clone(a: MatrixArray): MatrixArray;

@@ -46,3 +46,4 @@ export function create() {

}
export function rotate(out, a, rad) {
export function rotate(out, a, rad, pivot) {
if (pivot === void 0) { pivot = [0, 0]; }
var aa = a[0];

@@ -60,4 +61,4 @@ var ac = a[2];

out[3] = -ac * st + ct * ad;
out[4] = ct * atx + st * aty;
out[5] = ct * aty - st * atx;
out[4] = ct * (atx - pivot[0]) + st * (aty - pivot[1]) + pivot[0];
out[5] = ct * (aty - pivot[1]) - st * (atx - pivot[0]) + pivot[1];
return out;

@@ -64,0 +65,0 @@ }

@@ -437,3 +437,2 @@ import * as vec2 from './vector.js';

i += 1;
var anticlockwise = !data[i++];
if (isFirst) {

@@ -440,0 +439,0 @@ x0 = mathCos(startAngle) * rx + cx;

var DEFAULT_MIN_MERGE = 32;
var DEFAULT_MIN_GALLOPING = 7;
var DEFAULT_TMP_STORAGE_LENGTH = 256;
function minRunLength(n) {

@@ -170,14 +169,6 @@ var r = 0;

var minGallop = DEFAULT_MIN_GALLOPING;
var length = 0;
var tmpStorageLength = DEFAULT_TMP_STORAGE_LENGTH;
var stackLength = 0;
var runStart;
var runLength;
var stackSize = 0;
length = array.length;
if (length < 2 * DEFAULT_TMP_STORAGE_LENGTH) {
tmpStorageLength = length >>> 1;
}
var tmp = [];
stackLength = length < 120 ? 5 : length < 1542 ? 10 : length < 119151 ? 19 : 40;
runStart = [];

@@ -184,0 +175,0 @@ runLength = [];

@@ -127,2 +127,3 @@ import * as matrix from './matrix.js';

if (parent && parent.transform) {
parent.invTransform = parent.invTransform || matrix.create();
matrix.mul(tmpTransform, parent.invTransform, m);

@@ -129,0 +130,0 @@ m = tmpTransform;

@@ -169,2 +169,3 @@ import Transformable, { TransformProp } from './core/Transformable';

useStates(states: string[], noAnimation?: boolean, forceUseHoverLayer?: boolean): void;
isSilent(): boolean;
private _updateAnimationTargets;

@@ -171,0 +172,0 @@ removeState(state: string): void;

@@ -403,2 +403,14 @@ import Transformable, { TRANSFORMABLE_PROPS } from './core/Transformable.js';

};
Element.prototype.isSilent = function () {
var isSilent = this.silent;
var ancestor = this.parent;
while (!isSilent && ancestor) {
if (ancestor.silent) {
isSilent = true;
break;
}
ancestor = ancestor.parent;
}
return isSilent;
};
Element.prototype._updateAnimationTargets = function () {

@@ -405,0 +417,0 @@ for (var i = 0; i < this.animators.length; i++) {

@@ -9,3 +9,3 @@ import { TextAlign, TextVerticalAlign } from '../../core/types';

}
export declare function truncateText(text: string, containerWidth: number, font: string, ellipsis: string, options: InnerTruncateOption): string;
export declare function truncateText(text: string, containerWidth: number, font: string, ellipsis?: string, options?: InnerTruncateOption): string;
export interface PlainTextContentBlock {

@@ -12,0 +12,0 @@ lineHeight: number;

@@ -265,6 +265,6 @@ import { __extends } from "tslib";

}
if (el.silent) {
isSilent = true;
}
}
if (el.silent) {
isSilent = true;
}
var hostEl = el.__hostTarget;

@@ -271,0 +271,0 @@ el = hostEl ? hostEl : el.parent;

@@ -7,2 +7,3 @@ export declare type CSSSelectorVNode = Record<string, string>;

export declare const XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
export declare const META_DATA_PREFIX = "ecmeta_";
export declare function createElement(name: string): SVGElement;

@@ -34,3 +35,3 @@ export declare type SVGVNodeAttrs = Record<string, string | number | undefined | boolean>;

cssAnims: Record<string, Record<string, Record<string, string>>>;
cssClassIdx: number;
cssStyleCache: Record<string, string>;
cssAnimIdx: number;

@@ -42,2 +43,3 @@ shadowIdx: number;

animation?: boolean;
emphasis?: boolean;
willUpdate?: boolean;

@@ -44,0 +46,0 @@ compress?: boolean;

@@ -7,2 +7,3 @@ import { keys, map } from '../core/util.js';

export var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
export var META_DATA_PREFIX = 'ecmeta_';
export function createElement(name) {

@@ -89,3 +90,3 @@ return document.createElementNS(SVGNS, name);

cssAnims: {},
cssClassIdx: 0,
cssStyleCache: {},
cssAnimIdx: 0,

@@ -92,0 +93,0 @@ shadowIdx: 0,

@@ -9,2 +9,3 @@ import { copyTransform } from '../core/Transformable.js';

import { createCubicEasingFunc } from '../animation/cubicEasing.js';
import { getClassId } from './cssClassId.js';
export var EASING_MAP = {

@@ -270,3 +271,3 @@ cubicIn: '0.32,0,0.67,0',

if (cssAnimations.length) {
var className = scope.zrId + '-cls-' + scope.cssClassIdx++;
var className = scope.zrId + '-cls-' + getClassId();
scope.cssNodes['.' + className] = {

@@ -273,0 +274,0 @@ animation: cssAnimations.join(',')

@@ -8,3 +8,3 @@ import { adjustTextY, getIdURL, getMatrixStr, getPathPrecision, getShadowKey, getSRTTransformString, hasShadow, isAroundZero, isGradient, isImagePattern, isLinearGradient, isPattern, isRadialGradient, normalizeColor, round4, TEXT_ALIGN_TO_ANCHOR } from './helper.js';

import mapStyleToAttrs from './mapStyleToAttrs.js';
import { createVNode, vNodeToString } from './core.js';
import { createVNode, vNodeToString, META_DATA_PREFIX } from './core.js';
import { assert, clone, isFunction, isString, logError, map, retrieve2 } from '../core/util.js';

@@ -15,2 +15,4 @@ import { createOrUpdateImage } from '../graphic/helper/image.js';

import { DEFAULT_FONT, DEFAULT_FONT_FAMILY } from '../core/platform.js';
import { createCSSEmphasis } from './cssEmphasis.js';
import { getElementSSRData } from '../zrender.js';
var round = Math.round;

@@ -32,2 +34,5 @@ function isImageLike(val) {

}
else if (isFillStroke && val === 'none') {
attrs[key] = 'transparent';
}
else {

@@ -39,2 +44,13 @@ attrs[key] = val;

}
function setMetaData(attrs, el) {
var metaData = getElementSSRData(el);
if (metaData) {
metaData.each(function (val, key) {
val != null && (attrs[(META_DATA_PREFIX + key).toLowerCase()] = val + '');
});
if (el.isSilent()) {
attrs[META_DATA_PREFIX + 'silent'] = 'true';
}
}
}
function noRotateScale(m) {

@@ -144,3 +160,5 @@ return isAroundZero(m[0] - 1)

setStyleAttrs(attrs, style, el, scope);
setMetaData(attrs, el);
scope.animation && createCSSAnimation(el, attrs, scope);
scope.emphasis && createCSSEmphasis(el, attrs, scope);
return createVNode(svgElType, el.id + '', attrs);

@@ -179,2 +197,3 @@ }

setStyleAttrs(attrs, style, el, scope);
setMetaData(attrs, el);
scope.animation && createCSSAnimation(el, attrs, scope);

@@ -232,2 +251,3 @@ return createVNode('image', el.id + '', attrs);

setStyleAttrs(attrs, style, el, scope);
setMetaData(attrs, el);
scope.animation && createCSSAnimation(el, attrs, scope);

@@ -234,0 +254,0 @@ return createVNode('text', el.id + '', attrs, undefined, text);

@@ -42,5 +42,7 @@ import Displayable from '../graphic/Displayable';

useViewBox?: boolean;
emphasis?: boolean;
}): SVGVNode;
renderToString(opts?: {
cssAnimation?: boolean;
cssEmphasis?: boolean;
useViewBox?: boolean;

@@ -47,0 +49,0 @@ }): string;

@@ -68,2 +68,3 @@ import { brush, setClipPath, setGradient, setPattern } from './graphic.js';

scope.compress = opts.compress;
scope.emphasis = opts.emphasis;
var children = [];

@@ -93,2 +94,3 @@ var bgVNode = this._bgVNode = createBackgroundVNode(width, height, this._backgroundColor, scope);

animation: retrieve2(opts.cssAnimation, true),
emphasis: retrieve2(opts.cssEmphasis, true),
willUpdate: false,

@@ -230,4 +232,3 @@ compress: true,

x: '0',
y: '0',
id: '0'
y: '0'
});

@@ -234,0 +235,0 @@ if (isGradient(backgroundColor)) {

@@ -98,3 +98,6 @@ import { isArray, isObject } from '../core/util.js';

else {
if (key.charCodeAt(0) !== xChar) {
if (key === 'style') {
elm.style.cssText = cur;
}
else if (key.charCodeAt(0) !== xChar) {
elm.setAttribute(key, cur);

@@ -101,0 +104,0 @@ }

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

import { GradientObject } from '../graphic/Gradient';
export declare function parse(colorStr: string, rgbaArr?: number[]): number[];

@@ -20,2 +21,4 @@ export declare function lift(color: string, level: number): string;

export declare function random(): string;
export declare function liftColor(color: GradientObject): GradientObject;
export declare function liftColor(color: string): string;
export {};
import LRU from '../core/LRU.js';
import { extend, isGradientObject, isString, map } from '../core/util.js';
var kCSSColorTable = {

@@ -409,1 +410,21 @@ 'transparent': [0, 0, 0, 0], 'aliceblue': [240, 248, 255, 1],

}
var liftedColorCache = new LRU(100);
export function liftColor(color) {
if (isString(color)) {
var liftedColor = liftedColorCache.get(color);
if (!liftedColor) {
liftedColor = lift(color, -0.1);
liftedColorCache.put(color, liftedColor);
}
return liftedColor;
}
else if (isGradientObject(color)) {
var ret = extend({}, color);
ret.colorStops = map(color.colorStops, function (stop) { return ({
offset: stop.offset,
color: lift(stop.color, -0.1)
}); });
return ret;
}
return color;
}

@@ -557,3 +557,6 @@ import Group from '../graphic/Group.js';

case 'rotate':
matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);
matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE, [
parseFloat(valueArr[1] || '0'),
parseFloat(valueArr[2] || '0')
]);
break;

@@ -560,0 +563,0 @@ case 'skewX':

@@ -10,2 +10,3 @@ /*!

*/
import * as zrUtil from './core/util';
import Handler from './Handler';

@@ -36,2 +37,3 @@ import Storage from './Storage';

private _needsRefreshHover;
private _disposed;
private _darkMode;

@@ -60,4 +62,4 @@ private _backgroundColor;

clearAnimation(): void;
getWidth(): number;
getHeight(): number;
getWidth(): number | undefined;
getHeight(): number | undefined;
setCursorStyle(cursorStyle: string): void;

@@ -67,3 +69,3 @@ findHover(x: number, y: number): {

topTarget: Displayable;
};
} | undefined;
on<Ctx>(eventName: ElementEventName, eventHandler: ElementEventCallback<Ctx, ZRenderType>, context?: Ctx): this;

@@ -91,5 +93,9 @@ on<Ctx>(eventName: string, eventHandler: WithThisType<EventCallback<any[]>, unknown extends Ctx ? ZRenderType : Ctx>, context?: Ctx): this;

export declare function registerPainter(name: string, Ctor: PainterBaseCtor): void;
export declare const version = "5.4.4";
export declare type ElementSSRData = zrUtil.HashMap<unknown>;
export declare type ElementSSRDataGetter<T> = (el: Element) => zrUtil.HashMap<T>;
export declare function getElementSSRData(el: Element): ElementSSRData;
export declare function registerSSRDataGetter<T>(getter: ElementSSRDataGetter<T>): void;
export declare const version = "5.5.0";
export interface ZRenderType extends ZRender {
}
export {};

@@ -71,3 +71,3 @@ /*!

this.painter = painter;
var handerProxy = (!env.node && !env.worker && !ssrMode)
var handlerProxy = (!env.node && !env.worker && !ssrMode)
? new HandlerProxy(painter.getViewportRoot(), painter.root)

@@ -84,3 +84,3 @@ : null;

}
this.handler = new Handler(storage, painter, handerProxy, painter.root, pointerSize);
this.handler = new Handler(storage, painter, handlerProxy, painter.root, pointerSize);
this.animation = new Animation({

@@ -96,3 +96,3 @@ stage: {

ZRender.prototype.add = function (el) {
if (!el) {
if (this._disposed || !el) {
return;

@@ -105,3 +105,3 @@ }

ZRender.prototype.remove = function (el) {
if (!el) {
if (this._disposed || !el) {
return;

@@ -114,2 +114,5 @@ }

ZRender.prototype.configLayer = function (zLevel, config) {
if (this._disposed) {
return;
}
if (this.painter.configLayer) {

@@ -121,2 +124,5 @@ this.painter.configLayer(zLevel, config);

ZRender.prototype.setBackgroundColor = function (backgroundColor) {
if (this._disposed) {
return;
}
if (this.painter.setBackgroundColor) {

@@ -139,2 +145,5 @@ this.painter.setBackgroundColor(backgroundColor);

ZRender.prototype.refreshImmediately = function (fromInside) {
if (this._disposed) {
return;
}
if (!fromInside) {

@@ -148,2 +157,5 @@ this.animation.update(true);

ZRender.prototype.refresh = function () {
if (this._disposed) {
return;
}
this._needsRefresh = true;

@@ -153,2 +165,5 @@ this.animation.start();

ZRender.prototype.flush = function () {
if (this._disposed) {
return;
}
this._flush(false);

@@ -185,2 +200,5 @@ };

ZRender.prototype.wakeUp = function () {
if (this._disposed) {
return;
}
this.animation.start();

@@ -193,2 +211,5 @@ this._stillFrameAccum = 0;

ZRender.prototype.refreshHoverImmediately = function () {
if (this._disposed) {
return;
}
this._needsRefreshHover = false;

@@ -200,2 +221,5 @@ if (this.painter.refreshHover && this.painter.getType() === 'canvas') {

ZRender.prototype.resize = function (opts) {
if (this._disposed) {
return;
}
opts = opts || {};

@@ -206,27 +230,53 @@ this.painter.resize(opts.width, opts.height);

ZRender.prototype.clearAnimation = function () {
if (this._disposed) {
return;
}
this.animation.clear();
};
ZRender.prototype.getWidth = function () {
if (this._disposed) {
return;
}
return this.painter.getWidth();
};
ZRender.prototype.getHeight = function () {
if (this._disposed) {
return;
}
return this.painter.getHeight();
};
ZRender.prototype.setCursorStyle = function (cursorStyle) {
if (this._disposed) {
return;
}
this.handler.setCursorStyle(cursorStyle);
};
ZRender.prototype.findHover = function (x, y) {
if (this._disposed) {
return;
}
return this.handler.findHover(x, y);
};
ZRender.prototype.on = function (eventName, eventHandler, context) {
this.handler.on(eventName, eventHandler, context);
if (!this._disposed) {
this.handler.on(eventName, eventHandler, context);
}
return this;
};
ZRender.prototype.off = function (eventName, eventHandler) {
if (this._disposed) {
return;
}
this.handler.off(eventName, eventHandler);
};
ZRender.prototype.trigger = function (eventName, event) {
if (this._disposed) {
return;
}
this.handler.trigger(eventName, event);
};
ZRender.prototype.clear = function () {
if (this._disposed) {
return;
}
var roots = this.storage.getRoots();

@@ -242,2 +292,5 @@ for (var i = 0; i < roots.length; i++) {

ZRender.prototype.dispose = function () {
if (this._disposed) {
return;
}
this.animation.stop();

@@ -252,2 +305,3 @@ this.clear();

this.handler = null;
this._disposed = true;
delInstance(this.id);

@@ -279,3 +333,12 @@ };

}
export var version = '5.4.4';
var ssrDataGetter;
export function getElementSSRData(el) {
if (typeof ssrDataGetter === 'function') {
return ssrDataGetter(el);
}
}
export function registerSSRDataGetter(getter) {
ssrDataGetter = getter;
}
export var version = '5.5.0';
;
{
"name": "zrender",
"version": "5.4.4",
"version": "5.5.0",
"description": "A lightweight graphic library providing 2d draw for Apache ECharts",

@@ -39,3 +39,4 @@ "keywords": [

"lib/canvas/canvas.js",
"lib/svg/svg.js"
"lib/svg/svg.js",
"lib/all.js"
],

@@ -62,3 +63,29 @@ "devDependencies": {

"uglify-js": "^3.10.0"
},
"type": "module",
"exports": {
".": {
"types": "./index.d.ts",
"require": "./dist/zrender.js",
"import": "./index.js"
},
"./lib/canvas/canvas": "./lib/canvas/canvas.js",
"./lib/svg/svg": "./lib/svg/svg.js",
"./lib/vml/vml": "./lib/vml/vml.js",
"./lib/canvas/Painter": "./lib/canvas/Painter.js",
"./lib/svg/Painter": "./lib/svg/Painter.js",
"./lib/svg/patch": "./lib/svg/patch.js",
"./lib/Storage": "./lib/Storage.js",
"./lib/core/util": "./lib/core/util.js",
"./lib/core/env": "./lib/core/env.js",
"./lib/core/Transformable": "./lib/core/Transformable.js",
"./lib/core/BoundingRect": "./lib/core/BoundingRect.js",
"./lib/core/vector": "./lib/core/vector.js",
"./lib/core/bbox": "./lib/core/bbox.js",
"./lib/contain/polygon": "./lib/contain/polygon.js",
"./lib/tool/color": "./lib/tool/color.js",
"./lib/graphic/LinearGradient": "./lib/graphic/LinearGradient.js",
"./lib/graphic/RadialGradient": "./lib/graphic/RadialGradient.js",
"./*": "./*"
}
}
}

@@ -6,3 +6,3 @@ ZRender

[![Build Status](https://travis-ci.com/ecomfe/zrender.svg?branch=master)](https://travis-ci.com/ecomfe/zrender) [![](https://img.shields.io/npm/dw/zrender.svg?label=npm%20downloads&style=flat)](https://www.npmjs.com/package/zrender) ![Commits Since 4.0.0](https://img.shields.io/github/commits-since/ecomfe/zrender/4.0.0.svg?colorB=%234c1&style=flat)
[![](https://img.shields.io/github/actions/workflow/status/ecomfe/zrender/ci.yml)]() [![](https://img.shields.io/npm/dw/zrender.svg?label=npm%20downloads&style=flat)](https://www.npmjs.com/package/zrender) ![Commits Since 4.0.0](https://img.shields.io/github/commits-since/ecomfe/zrender/4.0.0.svg?colorB=%234c1&style=flat)

@@ -9,0 +9,0 @@ ## Documentation

@@ -92,4 +92,2 @@ import * as util from '../core/util';

__painter: CanvasPainter
__dirty = true

@@ -315,3 +313,3 @@ __firstTimePaint = true

*/
const shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true);
const shouldPaint = el && el.shouldBePainted(viewWidth, viewHeight, true, true);
if (el && (!shouldPaint || !el.__zr) && el.__isRendered) {

@@ -454,5 +452,4 @@ // el was removed

dirty() {
// TODO
self.setUnpainted();
self.__painter.refresh();
self.painter.refresh();
}

@@ -459,0 +456,0 @@ }

@@ -600,3 +600,3 @@ import {devicePixelRatio} from '../config';

// Vitual layer will not directly show on the screen.
// Virtual layer will not directly show on the screen.
// (It can be a WebGL layer and assigned to a ZRImage element)

@@ -627,3 +627,3 @@ // But it still under management of zrender.

layer.__painter = this;
layer.painter || (layer.painter = this);
}

@@ -630,0 +630,0 @@

@@ -40,3 +40,6 @@ declare const wx: {

}
else if (typeof navigator === 'undefined') {
else if (
typeof navigator === 'undefined'
|| navigator.userAgent.indexOf('Node.js') === 0
) {
// In node

@@ -43,0 +46,0 @@ env.node = true;

@@ -82,3 +82,8 @@ /**

*/
export function rotate(out: MatrixArray, a: MatrixArray, rad: number): MatrixArray {
export function rotate(
out: MatrixArray,
a: MatrixArray,
rad: number,
pivot: VectorArray = [0, 0]
): MatrixArray {
const aa = a[0];

@@ -97,4 +102,4 @@ const ac = a[2];

out[3] = -ac * st + ct * ad;
out[4] = ct * atx + st * aty;
out[5] = ct * aty - st * atx;
out[4] = ct * (atx - pivot[0]) + st * (aty - pivot[1]) + pivot[0];
out[5] = ct * (aty - pivot[1]) - st * (atx - pivot[0]) + pivot[1];
return out;

@@ -101,0 +106,0 @@ }

@@ -678,4 +678,2 @@ /**

i += 1;
const anticlockwise = !data[i++];
if (isFirst) {

@@ -682,0 +680,0 @@ // 直接使用 arc 命令

@@ -6,4 +6,2 @@ // https://github.com/mziccard/node-timsort

const DEFAULT_TMP_STORAGE_LENGTH = 256;
type CompareFunc<T> =(a: T, b: T) => number

@@ -221,5 +219,2 @@

let minGallop = DEFAULT_MIN_GALLOPING;
let length = 0;
let tmpStorageLength = DEFAULT_TMP_STORAGE_LENGTH;
let stackLength = 0;
let runStart: number[];

@@ -229,12 +224,4 @@ let runLength: number[];

length = array.length;
if (length < 2 * DEFAULT_TMP_STORAGE_LENGTH) {
tmpStorageLength = length >>> 1;
}
var tmp: T[] = [];
stackLength = length < 120 ? 5 : length < 1542 ? 10 : length < 119151 ? 19 : 40;
runStart = [];

@@ -241,0 +228,0 @@ runLength = [];

@@ -220,2 +220,3 @@ import * as matrix from './matrix';

// Get local transform and decompose them to position, scale, rotation
parent.invTransform = parent.invTransform || matrix.create();
matrix.mul(tmpTransform, parent.invTransform, m);

@@ -222,0 +223,0 @@ m = tmpTransform;

@@ -68,3 +68,3 @@ /* global: defineProperty */

* Plain object, Array, TypedArray, number, string, null, undefined.
* Those data types will be assgined using the orginal data:
* Those data types will be assigned using the original data:
* BUILTIN_OBJECT

@@ -630,4 +630,4 @@ * Instance of user defined class will be cloned to a plain object, without

/**
* @param str string to be trimed
* @return trimed string
* @param str string to be trimmed
* @return trimmed string
*/

@@ -722,3 +722,3 @@ export function trim(str: string): string {

// Key should not be set on this, otherwise
// methods get/set/... may be overrided.
// methods get/set/... may be overridden.
this.data = maybeNativeMap<T, KEY>();

@@ -725,0 +725,0 @@ const thisMap = this;

@@ -155,3 +155,3 @@

* Make a fake event but not change the original event,
* becuase the global event probably be used by other
* because the global event probably be used by other
* listeners not belonging to zrender.

@@ -263,4 +263,4 @@ * @class

// to the legacy event `mouseevent`.
// Typically if event `wheel` is suppored and the handler has been mounted on a
// DOM element, the lagecy `mousewheel` event will not be triggered (Chrome and Safari).
// Typically if event `wheel` is supported and the handler has been mounted on a
// DOM element, the legacy `mousewheel` event will not be triggered (Chrome and Safari).
// But we still do this guard to avoid to duplicated handle.

@@ -342,3 +342,3 @@ if (wheelEventSupported) {

// tap(click) on touch screen, which affect some judgement in
// upper application. So, we dont support mousemove on MS touch
// upper application. So, we don't support mousemove on MS touch
// device yet.

@@ -391,3 +391,3 @@ if (!isPointerFromTouch(event)) {

// tap(click) on touch screen, which affect some judgement in
// upper application. So, we dont support mousemove on MS touch
// upper application. So, we don't support mousemove on MS touch
// device yet.

@@ -448,3 +448,3 @@ if (!isPointerFromTouch(event)) {

// MS Gesture Event is only supported on IE11+/Edge and on Windows 8+.
// We dont support touch on IE on win7.
// We don't support touch on IE on win7.
// See <https://msdn.microsoft.com/en-us/library/dn433243(v=vs.85).aspx>

@@ -548,3 +548,3 @@ // if (typeof MSGesture === 'function') {

// Key: eventName, value: mounted handler funcitons.
// Key: eventName, value: mounted handler functions.
// Used for unmount.

@@ -551,0 +551,0 @@ mounted: Dictionary<EventListener> = {};

@@ -44,4 +44,4 @@ import * as imageHelper from '../helper/image';

font: string,
ellipsis: string,
options: InnerTruncateOption
ellipsis?: string,
options?: InnerTruncateOption
): string {

@@ -67,4 +67,4 @@ if (!containerWidth) {

font: string,
ellipsis: string,
options: InnerTruncateOption
ellipsis?: string,
options?: InnerTruncateOption
): InnerPreparedTruncateOption {

@@ -71,0 +71,0 @@ options = options || {};

@@ -500,6 +500,6 @@ import * as util from './core/util';

}
if (el.silent) {
isSilent = true;
}
}
if (el.silent) {
isSilent = true;
}
// Consider when el is textContent, also need to be silent

@@ -506,0 +506,0 @@ // if any of its host el and its ancestors is silent.

@@ -11,2 +11,3 @@ import { keys, map } from '../core/util';

export const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
export const META_DATA_PREFIX = 'ecmeta_';

@@ -132,4 +133,7 @@ export function createElement(name: string) {

cssAnims: Record<string, Record<string, Record<string, string>>>
/**
* Cache for css style string, mapping from style string to class name.
*/
cssStyleCache: Record<string, string>
cssClassIdx: number
cssAnimIdx: number

@@ -146,2 +150,6 @@

animation?: boolean,
/**
* If create emphasis styles.
*/
emphasis?: boolean,

@@ -170,4 +178,4 @@ /**

cssAnims: {},
cssStyleCache: {},
cssClassIdx: 0,
cssAnimIdx: 0,

@@ -174,0 +182,0 @@

@@ -13,2 +13,3 @@ import Transformable, { copyTransform } from '../core/Transformable';

import { createCubicEasingFunc } from '../animation/cubicEasing';
import { getClassId } from './cssClassId';

@@ -359,3 +360,3 @@ export const EASING_MAP: Record<string, string> = {

if (cssAnimations.length) {
const className = scope.zrId + '-cls-' + scope.cssClassIdx++;
const className = scope.zrId + '-cls-' + getClassId();
scope.cssNodes['.' + className] = {

@@ -362,0 +363,0 @@ animation: cssAnimations.join(',')

@@ -29,3 +29,3 @@ // TODO

import mapStyleToAttrs from './mapStyleToAttrs';
import { SVGVNodeAttrs, createVNode, SVGVNode, vNodeToString, BrushScope } from './core';
import { SVGVNodeAttrs, createVNode, SVGVNode, vNodeToString, BrushScope, META_DATA_PREFIX } from './core';
import { MatrixArray } from '../core/matrix';

@@ -43,2 +43,4 @@ import Displayable from '../graphic/Displayable';

import { DEFAULT_FONT, DEFAULT_FONT_FAMILY } from '../core/platform';
import { createCSSEmphasis } from './cssEmphasis';
import { getElementSSRData } from '../zrender';

@@ -66,2 +68,6 @@ const round = Math.round;

}
else if (isFillStroke && val === 'none') {
// When is none, it cannot be interacted when ssr
attrs[key] = 'transparent';
}
else {

@@ -75,2 +81,14 @@ attrs[key] = val;

function setMetaData(attrs: SVGVNodeAttrs, el: Path | TSpan | ZRImage) {
const metaData = getElementSSRData(el);
if (metaData) {
metaData.each((val, key) => {
val != null && (attrs[(META_DATA_PREFIX + key).toLowerCase()] = val + '');
});
if (el.isSilent()) {
attrs[META_DATA_PREFIX + 'silent'] = 'true';
}
}
}
function noRotateScale(m: MatrixArray) {

@@ -211,4 +229,6 @@ return isAroundZero(m[0] - 1)

setStyleAttrs(attrs, style, el, scope);
setMetaData(attrs, el);
scope.animation && createCSSAnimation(el, attrs, scope);
scope.emphasis && createCSSEmphasis(el, attrs, scope);

@@ -256,2 +276,3 @@ return createVNode(svgElType, el.id + '', attrs);

setStyleAttrs(attrs, style, el, scope);
setMetaData(attrs, el);

@@ -328,2 +349,3 @@ scope.animation && createCSSAnimation(el, attrs, scope);

setStyleAttrs(attrs, style, el, scope);
setMetaData(attrs, el);

@@ -330,0 +352,0 @@ scope.animation && createCSSAnimation(el, attrs, scope);

@@ -127,6 +127,7 @@ /**

renderToVNode(opts?: {
animation?: boolean
willUpdate?: boolean
animation?: boolean,
willUpdate?: boolean,
compress?: boolean,
useViewBox?: boolean
useViewBox?: boolean,
emphasis?: boolean
}) {

@@ -144,2 +145,3 @@

scope.compress = opts.compress;
scope.emphasis = opts.emphasis;

@@ -178,4 +180,9 @@ const children: SVGVNode[] = [];

*/
cssAnimation?: boolean
cssAnimation?: boolean,
/**
* If add css emphasis.
* @default true
*/
cssEmphasis?: boolean,
/**
* If use viewBox

@@ -189,2 +196,3 @@ * @default true

animation: retrieve2(opts.cssAnimation, true),
emphasis: retrieve2(opts.cssEmphasis, true),
willUpdate: false,

@@ -381,4 +389,3 @@ compress: true,

x: '0',
y: '0',
id: '0'
y: '0'
}

@@ -385,0 +392,0 @@ );

@@ -125,3 +125,3 @@ /**

let key: string;
const elm = vnode.elm as Element;
const elm = vnode.elm as SVGElement;
const oldAttrs = oldVnode && oldVnode.attrs || {};

@@ -147,3 +147,6 @@ const attrs = vnode.attrs || {};

else {
if (key.charCodeAt(0) !== xChar) {
if (key === 'style') {
elm.style.cssText = cur as string;
}
else if (key.charCodeAt(0) !== xChar) {
elm.setAttribute(key, cur as any);

@@ -150,0 +153,0 @@ }

import LRU from '../core/LRU';
import { extend, isGradientObject, isString, map } from '../core/util';
import { GradientObject } from '../graphic/Gradient';

@@ -569,2 +571,26 @@ const kCSSColorTable = {

], 'rgb');
}
}
const liftedColorCache = new LRU<string>(100);
export function liftColor(color: GradientObject): GradientObject;
export function liftColor(color: string): string;
export function liftColor(color: string | GradientObject): string | GradientObject {
if (isString(color)) {
let liftedColor = liftedColorCache.get(color);
if (!liftedColor) {
liftedColor = lift(color, -0.1);
liftedColorCache.put(color, liftedColor);
}
return liftedColor;
}
else if (isGradientObject(color)) {
const ret = extend({}, color) as GradientObject;
ret.colorStops = map(color.colorStops, stop => ({
offset: stop.offset,
color: lift(stop.color, -0.1)
}));
return ret;
}
// Change nothing.
return color;
}

@@ -848,3 +848,6 @@ import Group from '../graphic/Group';

// TODO: zrender use different hand in coordinate system.
matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);
matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE, [
parseFloat(valueArr[1] || '0'),
parseFloat(valueArr[2] || '0')
]);
break;

@@ -851,0 +854,0 @@ case 'skewX':

@@ -84,3 +84,3 @@ /*!

private _needsRefreshHover = true
private _disposed: boolean;
/**

@@ -127,3 +127,3 @@ * If theme is dark mode. It will determine the color strategy for labels.

const handerProxy = (!env.node && !env.worker && !ssrMode)
const handlerProxy = (!env.node && !env.worker && !ssrMode)
? new HandlerProxy(painter.getViewportRoot(), painter.root)

@@ -142,3 +142,3 @@ : null;

this.handler = new Handler(storage, painter, handerProxy, painter.root, pointerSize);
this.handler = new Handler(storage, painter, handlerProxy, painter.root, pointerSize);

@@ -160,3 +160,3 @@ this.animation = new Animation({

add(el: Element) {
if (!el) {
if (this._disposed || !el) {
return;

@@ -173,3 +173,3 @@ }

remove(el: Element) {
if (!el) {
if (this._disposed || !el) {
return;

@@ -186,2 +186,5 @@ }

configLayer(zLevel: number, config: LayerConfig) {
if (this._disposed) {
return;
}
if (this.painter.configLayer) {

@@ -197,2 +200,5 @@ this.painter.configLayer(zLevel, config);

setBackgroundColor(backgroundColor: string | GradientObject | PatternObject) {
if (this._disposed) {
return;
}
if (this.painter.setBackgroundColor) {

@@ -225,2 +231,5 @@ this.painter.setBackgroundColor(backgroundColor);

refreshImmediately(fromInside?: boolean) {
if (this._disposed) {
return;
}
// const start = new Date();

@@ -245,2 +254,5 @@ if (!fromInside) {

refresh() {
if (this._disposed) {
return;
}
this._needsRefresh = true;

@@ -255,2 +267,5 @@ // Active the animation again.

flush() {
if (this._disposed) {
return;
}
this._flush(false);

@@ -282,3 +297,3 @@ }

this._stillFrameAccum++;
// Stop the animiation after still for 10 frames.
// Stop the animation after still for 10 frames.
if (this._stillFrameAccum > this._sleepAfterStill) {

@@ -302,2 +317,5 @@ this.animation.stop();

wakeUp() {
if (this._disposed) {
return;
}
this.animation.start();

@@ -319,2 +337,5 @@ // Reset the frame count.

refreshHoverImmediately() {
if (this._disposed) {
return;
}
this._needsRefreshHover = false;

@@ -334,2 +355,5 @@ if (this.painter.refreshHover && this.painter.getType() === 'canvas') {

}) {
if (this._disposed) {
return;
}
opts = opts || {};

@@ -344,2 +368,5 @@ this.painter.resize(opts.width, opts.height);

clearAnimation() {
if (this._disposed) {
return;
}
this.animation.clear();

@@ -351,3 +378,6 @@ }

*/
getWidth(): number {
getWidth(): number | undefined {
if (this._disposed) {
return;
}
return this.painter.getWidth();

@@ -359,3 +389,6 @@ }

*/
getHeight(): number {
getHeight(): number | undefined {
if (this._disposed) {
return;
}
return this.painter.getHeight();

@@ -369,2 +402,5 @@ }

setCursorStyle(cursorStyle: string) {
if (this._disposed) {
return;
}
this.handler.setCursorStyle(cursorStyle);

@@ -382,3 +418,6 @@ }

topTarget: Displayable
} {
} | undefined {
if (this._disposed) {
return;
}
return this.handler.findHover(x, y);

@@ -392,3 +431,5 @@ }

on<Ctx>(eventName: string, eventHandler: (...args: any) => any, context?: Ctx): this {
this.handler.on(eventName, eventHandler, context);
if (!this._disposed) {
this.handler.on(eventName, eventHandler, context);
}
return this;

@@ -404,2 +445,5 @@ }

off(eventName?: string, eventHandler?: EventCallback) {
if (this._disposed) {
return;
}
this.handler.off(eventName, eventHandler);

@@ -415,2 +459,5 @@ }

trigger(eventName: string, event?: unknown) {
if (this._disposed) {
return;
}
this.handler.trigger(eventName, event);

@@ -424,2 +471,5 @@ }

clear() {
if (this._disposed) {
return;
}
const roots = this.storage.getRoots();

@@ -439,2 +489,6 @@ for (let i = 0; i < roots.length; i++) {

dispose() {
if (this._disposed) {
return;
}
this.animation.stop();

@@ -452,2 +506,4 @@

this._disposed = true;
delInstance(this.id);

@@ -510,8 +566,23 @@ }

export type ElementSSRData = zrUtil.HashMap<unknown>;
export type ElementSSRDataGetter<T> = (el: Element) => zrUtil.HashMap<T>;
let ssrDataGetter: ElementSSRDataGetter<unknown>;
export function getElementSSRData(el: Element): ElementSSRData {
if (typeof ssrDataGetter === 'function') {
return ssrDataGetter(el);
}
}
export function registerSSRDataGetter<T>(getter: ElementSSRDataGetter<T>) {
ssrDataGetter = getter;
}
/**
* @type {string}
*/
export const version = '5.4.4';
export const version = '5.5.0';
export interface ZRenderType extends ZRender {};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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