Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
e742715
fix(path): using appendData instead of setData for path
Ovilia Oct 10, 2024
de10c10
fix(path): init data in appendData when is null
Ovilia Oct 10, 2024
55b9232
fix(path): init data in appendData when is null
Ovilia Oct 11, 2024
0969347
Merge pull request #1096 from ecomfe/fix-path
Ovilia Oct 14, 2024
a6dde17
Relax tslib requirement specifier
mrginglymus Nov 7, 2024
629d839
Merge pull request #1097 from mrginglymus/relax-tslib
Ovilia Nov 8, 2024
c1f5e8e
Merge branch 'master' into v6
Ovilia Nov 12, 2024
0e01b01
chore: revert tslib version
Ovilia Nov 13, 2024
8aeb055
chore: revert tslib package-lock.json
Ovilia Nov 13, 2024
e4766d8
Merge pull request #1099 from ecomfe/fix-ts
plainheart Nov 15, 2024
f7cf14f
fix: `boundingRect.x` of text is incorrect when overflow: 'truncate'.…
100pah Nov 16, 2024
92dbb39
feat: support output the state `isTruncated` in `Text` element, which…
100pah Nov 18, 2024
4055b18
Merge pull request #1100 from ecomfe/fix-text-truncate
plainheart Nov 20, 2024
980b0ea
Merge pull request #1101 from ecomfe/feat/truncate-inquiry
plainheart Nov 23, 2024
a641958
Merge pull request #1102 from ecomfe/master
100pah Nov 26, 2024
771bd70
chore: npm audit packages
plainheart Dec 3, 2024
5dec07f
fix(path): revert #1096
Ovilia Dec 4, 2024
2896ce3
Merge pull request #1105 from ecomfe/fix-path
plainheart Dec 4, 2024
83fc9ec
release v5.6.1
plainheart Dec 6, 2024
a810fee
fix(util): exclude the `__proto__` key from `each`/`keys` function (#…
plainheart Dec 7, 2024
07a3ace
chore(build): check packages that are not from npm registry in packag…
plainheart Dec 10, 2024
b9156fc
release: v5.6.1
plainheart Dec 10, 2024
45df132
Merge pull request #1104 from ecomfe/release-dev
plainheart Dec 10, 2024
1c79191
Revert "fix(util): exclude the `__proto__` key from `each`/`keys` fun…
plainheart Dec 10, 2024
6eb0c73
release: rebuild v5.6.1
plainheart Dec 10, 2024
7bbbdbe
Merge pull request #1107 from ecomfe/release-dev
plainheart Dec 10, 2024
ae8cfaa
Merge pull request #1110 from ecomfe/release
Ovilia Dec 30, 2024
f71100c
fix(env): improve env detection compatibility for Node
liamjones Jan 6, 2025
615fcf6
Merge branch 'master' into v6
Ovilia Jan 20, 2025
d061b03
fix(env): improve env detection compatibility for Node
plainheart Feb 17, 2025
6631053
style(env): fix lint issue
plainheart Feb 17, 2025
aa71872
Merge pull request #1111 from liamjones/improve-nodejs-detection
plainheart Feb 17, 2025
be48e12
feat(OBB): (1) Fix OBB calculation incorrect in some angles when over…
100pah Mar 7, 2025
c2682f7
(feat) OBB support touchThreshold.
100pah Mar 12, 2025
f4a26c5
(feat): OBB support non-bidirectional.
100pah Mar 13, 2025
36b2c17
(ts) Fix parameter optional.
100pah Mar 13, 2025
ea31d0e
(test) Forgot to change the dat link back.
100pah Mar 14, 2025
6cb315d
fix(svg): fix `stop-opacity` is not parsed by SVG parser.
plainheart Mar 20, 2025
be40616
fix: custom stroke pattern
n-bes Mar 26, 2025
ccb0ba0
Merge pull request #1115 from ecomfe/feat/obb-direction
Ovilia Mar 31, 2025
86ec3b6
Merge pull request #1117 from n-bes/fix/copy_paste
plainheart Apr 3, 2025
5053c91
(ts): Support text margin array.
100pah Apr 5, 2025
ecdeba3
Merge pull request #1116 from ecomfe/svg/parse-stop-opacity
plainheart Apr 7, 2025
efb13f2
bug(obb): Fix OBB in extreme value and add test cases.
100pah Apr 22, 2025
ccc6e88
Merge branch 'v6' into feat/obb-direction
100pah Apr 22, 2025
c057c9a
test: Enhance test utilities.
100pah Apr 28, 2025
1f0758e
test: Clarify transform test case.
100pah Apr 28, 2025
456272b
chore: Clarify comments.
100pah Apr 28, 2025
0508fdc
fix&feat(BoundingRect, OBB): (1) Support the same features from OBB (…
100pah Apr 28, 2025
bb47510
feat(color): support function for modifyHSL
Ovilia May 12, 2025
bab415b
fix(color): fix implementation of modifyHSL
Ovilia May 12, 2025
f7a821b
Merge pull request #1118 from ecomfe/feat-color
100pah May 12, 2025
827f5d0
Update README.md
enlightened88 May 17, 2025
5d64336
Merge pull request #1119 from enlightened88/patch-1
plainheart May 19, 2025
c1d9816
fix(dom): support `transformLocalCoord` cleanup
plainheart May 21, 2025
0243cf4
fix(dom): support `transformLocalCoord` cleanup
plainheart May 24, 2025
9e0a174
fix(dom): add `transformLocalCoordClear` function to clear markers cr…
plainheart May 31, 2025
61c4c25
Merge pull request #1120 from ecomfe/fix/transformLocalCoord-cleanup
100pah May 31, 2025
31a654f
Merge pull request #1121 from ecomfe/master
100pah May 31, 2025
e9a389f
feat: Support `ignoreHostSilent` for some scenarios that textContent …
100pah Jun 2, 2025
55ba4b2
fix(overflow): lineOverflow need to update contentHeight.
100pah Jun 2, 2025
725a87c
fix(wrap): Fix that some branches cause null pointer error.
100pah Jun 5, 2025
54d354e
Merge branch 'fix/wrap-causes-npe' into feat/ignore-host-silent
100pah Jun 5, 2025
f86f96b
chore(text): (1) clarify plain text parsing: if text.style.width spec…
100pah Jun 5, 2025
3c54b35
(test): enrich test case.
100pah Jun 5, 2025
fabe0ca
perf(trancate): (1) Make text overflow truncate more precise (conside…
100pah Jun 6, 2025
5d80fdd
feat(boundingRect): Support that touchThreshold cause negative size t…
100pah Jun 7, 2025
8eeaa03
feat(boundingRect): (1) Support get intersection rect. (2) Add some s…
100pah Jun 7, 2025
ca2381c
Merge remote-tracking branch 'origin/feat/obb-direction' into feat/ig…
100pah Jun 7, 2025
58c9f72
chore(ts): Add checktype command.
100pah Jun 7, 2025
3ce7eef
test: fix dat.gui reference error introduced by the previous commit, …
100pah Jun 7, 2025
0358e3f
Merge remote-tracking branch 'origin/feat/obb-direction' into feat/ig…
100pah Jun 7, 2025
08b0fc9
feat(boundingRect): support clamp in intersect rect.
100pah Jun 8, 2025
6219dbb
perf(clipPath): Handy optimize clipPath.
100pah Jun 8, 2025
82f8bd1
feat(rectText): Support `textConfig.autoOverflowArea`, which auto cal…
100pah Jun 8, 2025
5721d2c
chore: remove unnecessary import.
100pah Jun 9, 2025
4ebf34d
Merge pull request #1122 from ecomfe/feat/ignore-host-silent
100pah Jun 9, 2025
31d263d
tweak(BoundingRect): Add a static method `contain`.
100pah Jun 14, 2025
1368d71
feat: may be an approach to fix #1105 (available custom path in compo…
100pah Jun 16, 2025
120ba2b
fix cr suggestion
100pah Jun 17, 2025
3a61cd5
Merge pull request #1125 from ecomfe/fix-path-2
100pah Jun 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ZRender

A lightweight graphic library which provides 2d draw for [Apache ECharts](https://github.com/apache/echarts).

[![](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)
[![](https://img.shields.io/github/actions/workflow/status/ecomfe/zrender/ci.yml)](https://github.com/ecomfe/zrender/actions) [![](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)

## Documentation

Expand Down
20 changes: 20 additions & 0 deletions build/prepublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,26 @@ if (untrackedFiles.length) {
console.log(chalk.green('✔️ No unexpected files found.'));
console.log();

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) {
const matches = str.match(/(\\\d{3}){3}/g);
if (matches) {
Expand Down
64 changes: 45 additions & 19 deletions dist/zrender.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
else if (typeof document === 'undefined' && typeof self !== 'undefined') {
env.worker = true;
}
else if (typeof navigator === 'undefined'
|| navigator.userAgent.indexOf('Node.js') === 0) {
else if (!env.hasGlobalWindow || 'Deno' in window) {
env.node = true;
env.svgSupported = true;
}
Expand Down Expand Up @@ -293,7 +292,7 @@
}
function defaults(target, source, overlay) {
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];
if ((overlay ? source[key] != null : target[key] == null)) {
target[key] = source[key];
Expand Down Expand Up @@ -7338,7 +7337,7 @@
function registerSSRDataGetter(getter) {
ssrDataGetter = getter;
}
var version = '5.6.0';
var version = '5.6.1';

var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
var DEFAULT_COMMON_STYLE = {
Expand Down Expand Up @@ -12552,16 +12551,23 @@
}

var STYLE_REG = /\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;
function truncateText(text, containerWidth, font, ellipsis, options) {
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;
}
function prepareTruncateOptions(containerWidth, font, ellipsis, options) {
options = options || {};
Expand Down Expand Up @@ -12589,16 +12595,20 @@
preparedOpts.containerWidth = containerWidth;
return preparedOpts;
}
function truncateSingleLine(textLine, options) {
function truncateSingleLine(out, textLine, options) {
var containerWidth = options.containerWidth;
var font = options.font;
var contentWidth = options.contentWidth;
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;
}
for (var j = 0;; j++) {
if (lineWidth <= contentWidth || j >= options.maxIterations) {
Expand All @@ -12616,7 +12626,8 @@
if (textLine === '') {
textLine = options.placeholder;
}
return textLine;
out.textLine = textLine;
out.isTruncated = true;
}
function estimateLength(text, contentWidth, ascCharWidth, cnCharWidth) {
var width = 0;
Expand All @@ -12637,6 +12648,7 @@
var lineHeight = retrieve2(style.lineHeight, calculatedLineHeight);
var bgColorDrawn = !!(style.backgroundColor);
var truncateLineOverflow = style.lineOverflow === 'truncate';
var isTruncated = false;
var width = style.width;
var lines;
if (width != null && (overflow === 'break' || overflow === 'breakAll')) {
Expand All @@ -12649,15 +12661,19 @@
var height = retrieve2(style.height, contentHeight);
if (contentHeight > height && truncateLineOverflow) {
var lineCount = Math.floor(height / lineHeight);
isTruncated = isTruncated || (lines.length > lineCount);
lines = lines.slice(0, lineCount);
}
if (text && truncate && width != null) {
var options = prepareTruncateOptions(width, font, style.ellipsis, {
minChar: style.truncateMinChar,
placeholder: style.placeholder
});
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;
}
}
var outerHeight = height;
Expand Down Expand Up @@ -12686,7 +12702,8 @@
calculatedLineHeight: calculatedLineHeight,
contentWidth: contentWidth,
contentHeight: contentHeight,
width: width
width: width,
isTruncated: isTruncated
};
}
var RichTextToken = (function () {
Expand All @@ -12712,6 +12729,7 @@
this.outerWidth = 0;
this.outerHeight = 0;
this.lines = [];
this.isTruncated = false;
}
return RichTextContentBlock;
}());
Expand Down Expand Up @@ -12746,6 +12764,7 @@
var stlPadding = style.padding;
var truncate = overflow === 'truncate';
var truncateLine = style.lineOverflow === 'truncate';
var tmpTruncateOut = {};
function finishLine(line, lineWidth, lineHeight) {
line.width = lineWidth;
line.lineHeight = lineHeight;
Expand All @@ -12771,6 +12790,7 @@
token.align = tokenStyle && tokenStyle.align || style.align;
token.verticalAlign = tokenStyle && tokenStyle.verticalAlign || 'middle';
if (truncateLine && topHeight != null && calculatedHeight + token.lineHeight > topHeight) {
var originalLength = contentBlock.lines.length;
if (j > 0) {
line.tokens = line.tokens.slice(0, j);
finishLine(line, lineWidth, lineHeight);
Expand All @@ -12779,6 +12799,7 @@
else {
contentBlock.lines = contentBlock.lines.slice(0, i);
}
contentBlock.isTruncated = contentBlock.isTruncated || (contentBlock.lines.length < originalLength);
break outer;
}
var styleTokenWidth = tokenStyle.width;
Expand Down Expand Up @@ -12807,7 +12828,9 @@
token.width = token.contentWidth = 0;
}
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);
}
}
Expand Down Expand Up @@ -13204,6 +13227,7 @@
var textLines = contentBlock.lines;
var lineHeight = contentBlock.lineHeight;
var defaultStyle = this._defaultStyle;
this.isTruncated = !!contentBlock.isTruncated;
var baseX = style.x || 0;
var baseY = style.y || 0;
var textAlign = style.align || defaultStyle.align || 'left';
Expand Down Expand Up @@ -13270,7 +13294,7 @@
setSeparateFont(subElStyle, style);
textY += lineHeight;
if (fixedBoundingRect) {
el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, style.width, subElStyle.textAlign), adjustTextY$1(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, contentWidth, subElStyle.textAlign), adjustTextY$1(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
}
}
};
Expand All @@ -13287,6 +13311,7 @@
var defaultStyle = this._defaultStyle;
var textAlign = style.align || defaultStyle.align;
var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign;
this.isTruncated = !!contentBlock.isTruncated;
var boxX = adjustTextX(baseX, outerWidth, textAlign);
var boxY = adjustTextY$1(baseY, outerHeight, verticalAlign);
var xLeft = boxX;
Expand Down Expand Up @@ -16416,12 +16441,12 @@
else if (isFillStroke && isPattern(val)) {
setPattern(el, attrs, key, scope);
}
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);
setShadow(el, attrs, scope);
}
Expand Down Expand Up @@ -17200,6 +17225,7 @@
scope.willUpdate = opts.willUpdate;
scope.compress = opts.compress;
scope.emphasis = opts.emphasis;
scope.ssr = this._opts.ssr;
var children = [];
var bgVNode = this._bgVNode = createBackgroundVNode(width, height, this._backgroundColor, scope);
bgVNode && children.push(bgVNode);
Expand Down
2 changes: 1 addition & 1 deletion dist/zrender.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zrender.min.js

Large diffs are not rendered by default.

Loading