New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

zrender

Package Overview
Dependencies
Maintainers
18
Versions
78
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

to
5.6.1

20

build/prepublish.js

@@ -78,2 +78,22 @@ const fs = require('fs-extra');

console.log(chalk.yellow('🔎 Checking registry url of the packages in package-lock.json...\n'));
const NPM_REGISTRY = 'https://registry.npmjs.org/';
const packageLock = require('../package-lock.json');
const unexpectedPkgsFromUnofficialRegistry = Object.entries(packageLock.dependencies)
.concat(Object.entries(packageLock.packages))
.filter(([pkgName, pkgRegistry]) => pkgRegistry.resolved && !pkgRegistry.resolved.startsWith(NPM_REGISTRY));
if (unexpectedPkgsFromUnofficialRegistry.length) {
console.error(chalk.red('❌ Found packages that are not from npm registry in package-lock.json! Please double-check before publishing them to npm.'));
unexpectedPkgsFromUnofficialRegistry.forEach(([pkgName, pkgRegistry]) => {
console.log(` ∟ ${pkgName} (${pkgRegistry.resolved})`);
});
console.log();
process.exit(-1);
}
console.log(chalk.green('✔️ No unexpected packages with unofficial registry url found.'));
console.log();
function escapeOctal(str) {

@@ -80,0 +100,0 @@ const matches = str.match(/(\\\d{3}){3}/g);

3

lib/core/env.js

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

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

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

@@ -138,3 +138,3 @@ import { platformApi } from './platform.js';

var keysArr = keys(source);
for (var i = 0; i < keysArr.length; i++) {
for (var i = 0, len = keysArr.length; i < len; i++) {
var key = keysArr[i];

@@ -141,0 +141,0 @@ if ((overlay ? source[key] != null : target[key] == null)) {

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

lines: string[];
isTruncated: boolean;
}

@@ -53,4 +54,5 @@ export declare function parsePlainText(text: string, style?: TextStyleProps): PlainTextContentBlock;

lines: RichTextLine[];
isTruncated: boolean;
}
export declare function parseRichText(text: string, style: TextStyleProps): RichTextContentBlock;
export {};

@@ -6,11 +6,23 @@ import * as imageHelper from '../helper/image.js';

export function truncateText(text, containerWidth, font, ellipsis, options) {
var out = {};
truncateText2(out, text, containerWidth, font, ellipsis, options);
return out.text;
}
function truncateText2(out, text, containerWidth, font, ellipsis, options) {
if (!containerWidth) {
return '';
out.text = '';
out.isTruncated = false;
return;
}
var textLines = (text + '').split('\n');
options = prepareTruncateOptions(containerWidth, font, ellipsis, options);
var isTruncated = false;
var truncateOut = {};
for (var i = 0, len = textLines.length; i < len; i++) {
textLines[i] = truncateSingleLine(textLines[i], options);
truncateSingleLine(truncateOut, textLines[i], options);
textLines[i] = truncateOut.textLine;
isTruncated = isTruncated || truncateOut.isTruncated;
}
return textLines.join('\n');
out.text = textLines.join('\n');
out.isTruncated = isTruncated;
}

@@ -43,3 +55,3 @@ function prepareTruncateOptions(containerWidth, font, ellipsis, options) {

}
function truncateSingleLine(textLine, options) {
function truncateSingleLine(out, textLine, options) {
var containerWidth = options.containerWidth;

@@ -49,7 +61,11 @@ var font = options.font;

if (!containerWidth) {
return '';
out.textLine = '';
out.isTruncated = false;
return;
}
var lineWidth = getWidth(textLine, font);
if (lineWidth <= containerWidth) {
return textLine;
out.textLine = textLine;
out.isTruncated = false;
return;
}

@@ -72,3 +88,4 @@ for (var j = 0;; j++) {

}
return textLine;
out.textLine = textLine;
out.isTruncated = true;
}

@@ -94,2 +111,3 @@ function estimateLength(text, contentWidth, ascCharWidth, cnCharWidth) {

var truncateLineOverflow = style.lineOverflow === 'truncate';
var isTruncated = false;
var width = style.width;

@@ -107,2 +125,3 @@ var lines;

var lineCount = Math.floor(height / lineHeight);
isTruncated = isTruncated || (lines.length > lineCount);
lines = lines.slice(0, lineCount);

@@ -115,4 +134,7 @@ }

});
var singleOut = {};
for (var i = 0; i < lines.length; i++) {
lines[i] = truncateSingleLine(lines[i], options);
truncateSingleLine(singleOut, lines[i], options);
lines[i] = singleOut.textLine;
isTruncated = isTruncated || singleOut.isTruncated;
}

@@ -146,3 +168,4 @@ }

contentHeight: contentHeight,
width: width
width: width,
isTruncated: isTruncated
};

@@ -173,2 +196,3 @@ }

this.lines = [];
this.isTruncated = false;
}

@@ -209,2 +233,3 @@ return RichTextContentBlock;

var truncateLine = style.lineOverflow === 'truncate';
var tmpTruncateOut = {};
function finishLine(line, lineWidth, lineHeight) {

@@ -235,2 +260,3 @@ line.width = lineWidth;

if (truncateLine && topHeight != null && calculatedHeight + token.lineHeight > topHeight) {
var originalLength = contentBlock.lines.length;
if (j > 0) {

@@ -244,2 +270,3 @@ line.tokens = line.tokens.slice(0, j);

}
contentBlock.isTruncated = contentBlock.isTruncated || (contentBlock.lines.length < originalLength);
break outer;

@@ -273,3 +300,5 @@ }

else {
token.text = truncateText(token.text, remainTruncWidth - paddingH, font, style.ellipsis, { minChar: style.truncateMinChar });
truncateText2(tmpTruncateOut, token.text, remainTruncWidth - paddingH, font, style.ellipsis, { minChar: style.truncateMinChar });
token.text = tmpTruncateOut.text;
contentBlock.isTruncated = contentBlock.isTruncated || tmpTruncateOut.isTruncated;
token.width = token.contentWidth = getWidth(token.text, font);

@@ -276,0 +305,0 @@ }

@@ -93,2 +93,3 @@ import { TextAlign, TextVerticalAlign, ImageLike, Dictionary, MapToType, FontWeight, FontStyle } from '../core/types';

innerTransformable: Transformable;
isTruncated: boolean;
private _children;

@@ -95,0 +96,0 @@ private _childCursor;

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

var defaultStyle = this._defaultStyle;
this.isTruncated = !!contentBlock.isTruncated;
var baseX = style.x || 0;

@@ -265,3 +266,3 @@ var baseY = style.y || 0;

if (fixedBoundingRect) {
el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, style.width, subElStyle.textAlign), adjustTextY(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, contentWidth, subElStyle.textAlign), adjustTextY(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
}

@@ -283,2 +284,3 @@ }

var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign;
this.isTruncated = !!contentBlock.isTruncated;
var boxX = adjustTextX(baseX, outerWidth, textAlign);

@@ -285,0 +287,0 @@ var boxY = adjustTextY(baseY, outerHeight, verticalAlign);

@@ -44,4 +44,5 @@ export declare type CSSSelectorVNode = Record<string, string>;

compress?: boolean;
ssr?: boolean;
}
export declare function createBrushScope(zrId: string): BrushScope;
export declare function createSVGVNode(width: number | string, height: number | string, children?: SVGVNode[], useViewBox?: boolean): SVGVNode;

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

}
else if (isFillStroke && val === 'none') {
attrs[key] = 'transparent';
}
else {
attrs[key] = val;
}
if (isFillStroke && scope.ssr && val === 'none') {
attrs['pointer-events'] = 'visible';
}
}, style, el, false);

@@ -40,0 +40,0 @@ setShadow(el, attrs, scope);

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

scope.emphasis = opts.emphasis;
scope.ssr = this._opts.ssr;
var children = [];

@@ -71,0 +72,0 @@ var bgVNode = this._bgVNode = createBackgroundVNode(width, height, this._backgroundColor, scope);

@@ -93,5 +93,5 @@ /*!

export declare function registerSSRDataGetter<T>(getter: ElementSSRDataGetter<T>): void;
export declare const version = "5.6.0";
export declare const version = "5.6.1";
export interface ZRenderType extends ZRender {
}
export {};

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

}
export var version = '5.6.0';
export var version = '5.6.1';
;
{
"name": "zrender",
"version": "5.6.0",
"version": "5.6.1",
"description": "A lightweight graphic library providing 2d draw for Apache ECharts",

@@ -89,2 +89,2 @@ "keywords": [

}
}
}

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

}
else if (
typeof navigator === 'undefined'
|| navigator.userAgent.indexOf('Node.js') === 0
) {
else if (!env.hasGlobalWindow || 'Deno' in window) {
// In node

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

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

const keysArr = keys(source);
for (let i = 0; i < keysArr.length; i++) {
for (let i = 0, len = keysArr.length; i < len; i++) {
let key = keysArr[i];

@@ -209,0 +209,0 @@ if ((overlay ? source[key] != null : (target as T & S)[key] == null)) {

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

): string {
const out = {} as Parameters<typeof truncateText2>[0];
truncateText2(out, text, containerWidth, font, ellipsis, options);
return out.text;
}
// PENDING: not sure whether `truncateText` is used outside zrender, since it has an `export`
// specifier. So keep it and perform the interface modification in `truncateText2`.
function truncateText2(
out: {text: string, isTruncated: boolean},
text: string,
containerWidth: number,
font: string,
ellipsis?: string,
options?: InnerTruncateOption
): void {
if (!containerWidth) {
return '';
out.text = '';
out.isTruncated = false;
return;
}

@@ -57,7 +74,12 @@

// It is not appropriate that every line has '...' when truncate multiple lines.
let isTruncated = false;
const truncateOut = {} as Parameters<typeof truncateSingleLine>[0];
for (let i = 0, len = textLines.length; i < len; i++) {
textLines[i] = truncateSingleLine(textLines[i], options as InnerPreparedTruncateOption);
truncateSingleLine(truncateOut, textLines[i], options as InnerPreparedTruncateOption);
textLines[i] = truncateOut.textLine;
isTruncated = isTruncated || truncateOut.isTruncated;
}
return textLines.join('\n');
out.text = textLines.join('\n');
out.isTruncated = isTruncated;
}

@@ -109,3 +131,7 @@

function truncateSingleLine(textLine: string, options: InnerPreparedTruncateOption): string {
function truncateSingleLine(
out: {textLine: string, isTruncated: boolean},
textLine: string,
options: InnerPreparedTruncateOption
): void {
const containerWidth = options.containerWidth;

@@ -116,3 +142,5 @@ const font = options.font;

if (!containerWidth) {
return '';
out.textLine = '';
out.isTruncated = false;
return;
}

@@ -123,3 +151,5 @@

if (lineWidth <= containerWidth) {
return textLine;
out.textLine = textLine;
out.isTruncated = false;
return;
}

@@ -147,3 +177,4 @@

return textLine;
out.textLine = textLine;
out.isTruncated = true;
}

@@ -183,2 +214,6 @@

lines: string[]
// Be `true` if and only if the result text is modified due to overflow, due to
// settings on either `overflow` or `lineOverflow`
isTruncated: boolean
}

@@ -202,2 +237,3 @@

const truncateLineOverflow = style.lineOverflow === 'truncate';
let isTruncated = false;

@@ -221,2 +257,3 @@ let width = style.width;

isTruncated = isTruncated || (lines.length > lineCount);
lines = lines.slice(0, lineCount);

@@ -240,4 +277,7 @@

// Having every line has '...' when truncate multiple lines.
const singleOut = {} as Parameters<typeof truncateSingleLine>[0];
for (let i = 0; i < lines.length; i++) {
lines[i] = truncateSingleLine(lines[i], options);
truncateSingleLine(singleOut, lines[i], options);
lines[i] = singleOut.textLine;
isTruncated = isTruncated || singleOut.isTruncated;
}

@@ -278,3 +318,4 @@ }

contentHeight: contentHeight,
width: width
width: width,
isTruncated: isTruncated
};

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

lines: RichTextLine[] = []
// Be `true` if and only if the result text is modified due to overflow, due to
// settings on either `overflow` or `lineOverflow`
isTruncated: boolean = false
}

@@ -341,3 +385,3 @@

*/
export function parseRichText(text: string, style: TextStyleProps) {
export function parseRichText(text: string, style: TextStyleProps): RichTextContentBlock {
const contentBlock = new RichTextContentBlock();

@@ -382,2 +426,3 @@

const truncateLine = style.lineOverflow === 'truncate';
const tmpTruncateOut = {} as Parameters<typeof truncateText2>[0];

@@ -429,2 +474,3 @@ // let prevToken: RichTextToken;

// prevToken.text =
const originalLength = contentBlock.lines.length;
if (j > 0) {

@@ -438,2 +484,3 @@ line.tokens = line.tokens.slice(0, j);

}
contentBlock.isTruncated = contentBlock.isTruncated || (contentBlock.lines.length < originalLength);
break outer;

@@ -480,6 +527,9 @@ }

else {
token.text = truncateText(
truncateText2(
tmpTruncateOut,
token.text, remainTruncWidth - paddingH, font, style.ellipsis,
{minChar: style.truncateMinChar}
);
token.text = tmpTruncateOut.text;
contentBlock.isTruncated = contentBlock.isTruncated || tmpTruncateOut.isTruncated;
token.width = token.contentWidth = getWidth(token.text, font);

@@ -486,0 +536,0 @@ }

@@ -278,2 +278,8 @@ /**

// Be `true` if and only if the result text is modified due to overflow, due to
// settings on either `overflow` or `lineOverflow`. Based on this the caller can
// take some action like showing the original text in a particular tip.
// Only take effect after rendering. So do not visit it before it.
isTruncated: boolean
private _children: (ZRImage | Rect | TSpan)[] = []

@@ -501,2 +507,4 @@

this.isTruncated = !!contentBlock.isTruncated;
const baseX = style.x || 0;

@@ -607,3 +615,3 @@ const baseY = style.y || 0;

el.setBoundingRect(new BoundingRect(
adjustTextX(subElStyle.x, style.width, subElStyle.textAlign as TextAlign),
adjustTextX(subElStyle.x, contentWidth, subElStyle.textAlign as TextAlign),
adjustTextY(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline as TextVerticalAlign),

@@ -641,2 +649,4 @@ /**

this.isTruncated = !!contentBlock.isTruncated;
const boxX = adjustTextX(baseX, outerWidth, textAlign);

@@ -643,0 +653,0 @@ const boxY = adjustTextY(baseY, outerHeight, verticalAlign);

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

compress?: boolean
ssr?: boolean
}

@@ -164,0 +166,0 @@

@@ -66,9 +66,11 @@ // TODO

}
else if (isFillStroke && val === 'none') {
// When is none, it cannot be interacted when ssr
attrs[key] = 'transparent';
}
else {
attrs[key] = val;
}
if (isFillStroke && scope.ssr && val === 'none') {
// When is none, it cannot be interacted when ssr
// Setting `pointer-events` as `visible` to make it responding
// See also https://www.w3.org/TR/SVG/interact.html#PointerEventsProperty
attrs['pointer-events'] = 'visible';
}
}, style, el, false);

@@ -75,0 +77,0 @@

@@ -145,2 +145,3 @@ /**

scope.emphasis = opts.emphasis;
scope.ssr = this._opts.ssr;

@@ -147,0 +148,0 @@ const children: SVGVNode[] = [];

@@ -559,5 +559,5 @@ /*!

*/
export const version = '5.6.0';
export const version = '5.6.1';
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