Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
cf01054
fix(svg): svg mouse event doesn't work normally when using shadow, re…
plainheart Sep 1, 2021
a110f28
fix(svg): use `offsetX/offsetY` instead of `layerX/layerY` when Firef…
plainheart Sep 1, 2021
905b533
fix(type): improve gradient types
pissang Sep 5, 2021
3ae9932
fix: spelling error
Sep 6, 2021
462838d
Merge pull request #819 from ChenXiaofan/chenxiaofan/spell-error
pissang Sep 6, 2021
f45c4e4
Merge pull request #820 from ecomfe/improve-types
pissang Sep 9, 2021
f1f0381
Merge pull request #812 from ecomfe/fix-svg-firefox-event
pissang Sep 10, 2021
350287a
fix: export Displayable for type annotation compatibility
Sep 13, 2021
bb2ffb1
Merge pull request #824 from baojd42/fix-export-displayable
pissang Sep 14, 2021
4281e33
fix prototype pollution in merge, clone, extend utilities
pissang Sep 15, 2021
4485727
Merge pull request #826 from ecomfe/fix-prototype-pollution
pissang Sep 15, 2021
6040619
Merge pull request #827 from ecomfe/master
pissang Sep 16, 2021
5e55e00
Release 5.2.1
pissang Sep 17, 2021
8bf1a9c
update package-lock.json
pissang Sep 17, 2021
0fbf9b3
Merge pull request #828 from ecomfe/release-dev
pissang Sep 17, 2021
924cb54
fix: always close path on circle
pissang Sep 18, 2021
fbb0426
Merge pull request #829 from ecomfe/fix-circle-in-bundle
pissang Sep 18, 2021
1c1b379
Merge pull request #830 from ecomfe/release
pissang Sep 22, 2021
7bb451c
WIP: try svg-ssr
pissang Sep 23, 2021
cd93186
wip(svg-ssr): compress generated strings
pissang Sep 24, 2021
9e96e1c
fix: optimize arraydiff perf in first render and clear
pissang Sep 24, 2021
bba6d95
fix(svg): fix arc cmd following close will be wrong.
pissang Sep 24, 2021
99449dc
Merge pull request #832 from ecomfe/optimize-arraydiff
pissang Sep 24, 2021
7381160
wip(svg-ssr): use builtin shape to optimize the size
pissang Sep 24, 2021
3d37a30
Merge branch 'master' into svg-ssr
pissang Sep 24, 2021
f06e85e
wip(svg-ssr): merge from master
pissang Sep 24, 2021
5704662
wip(svg-ssr): support shadow and gradient
pissang Sep 25, 2021
911a205
wip(svg-ssr): add pattern. upgrade ts
pissang Sep 26, 2021
3c60942
wip(svg-ssr): add clipPaths. fix skew transform
pissang Sep 26, 2021
8eb1bc0
wip(svg-ssr): refact to add inner structure storage for dom
pissang Sep 27, 2021
01b2213
wip(svg-ssr): name inner store structure to vnode
pissang Sep 27, 2021
b22cdbe
wip(svg-ssr): add preact patch test
pissang Sep 27, 2021
a12574a
wip(ssr): use snabbdom patch algorithm.
pissang Sep 28, 2021
3588983
wip(svg-ssr): optimize vnode attribute create
pissang Sep 28, 2021
75e5c98
wip(svg-ssr): clean code, cache svg path rebuilder
pissang Sep 29, 2021
b1c2e84
wip(svg-ssr): add animates
pissang Sep 29, 2021
10a6cd2
wip(svg): animation easing
pissang Sep 29, 2021
7bab051
wip(svg-ssr): add animation delay. fix easing on path
pissang Sep 29, 2021
b9d1139
wip(svg-ssr): fix some error in node env
pissang Sep 29, 2021
79ad104
refact(svg): replaced original svg renderer with new
pissang Sep 30, 2021
4cda9a2
wip(svg): fix some issues in echarts
pissang Sep 30, 2021
2b93671
wip(svg): fix id geenrate not in scope.
pissang Sep 30, 2021
c081732
wip(svg): add willUpdate hint
pissang Sep 30, 2021
c810d9e
wip(svg): compress output svg string
pissang Oct 1, 2021
ccca72a
wip(svg): fix setBackgroundColor and getSvgRoot
pissang Oct 1, 2021
508844f
wip(svg): optimize ssr output
pissang Oct 1, 2021
36763db
wip(svg): fix image pattern
pissang Oct 2, 2021
8978c36
wip(svg): use css animation instead of SMIL
pissang Oct 3, 2021
3f6d32e
wip(svg): add transform origin and skew in animation
pissang Oct 3, 2021
b9cc86f
wip(svg): animation only applied on ssr
pissang Oct 3, 2021
7e02159
wip(svg): fix css animation
pissang Oct 3, 2021
0f60ea5
wip(svg): add multiple kf support in css transform
pissang Oct 3, 2021
a855add
wip(svg): fix typos. default to use linear easing
pissang Oct 3, 2021
a48d334
wip(svg): add path animation for compound path
pissang Oct 4, 2021
165dcdc
wip(ssr): add basic text width map for node environment
pissang Oct 5, 2021
e2b0685
wip(ssr): fix some escape chars
pissang Oct 5, 2021
4f7803a
style: naming tweak
pissang Oct 6, 2021
2074583
wip(ssr): disable animation when path data don't match.
pissang Oct 6, 2021
93a5fac
wip(ssr): not add css class if there is no property can animate.
pissang Oct 6, 2021
b055250
chore: add node env
pissang Oct 6, 2021
5cb9a67
refact: remove code for ancient browsers.
pissang Oct 6, 2021
f9be13c
wip(svg): optimize transform origin output in animation
pissang Oct 6, 2021
5a511ac
wip(svg): fix transform origin in animation
pissang Oct 6, 2021
1fe5a47
wip(svg): fix class and id conflicts in multiple instances.
pissang Oct 7, 2021
3ee98e1
wip(svg): fix typo
pissang Oct 7, 2021
294de34
wip(svg): keep text empty space logic
pissang Oct 7, 2021
7140c05
wip(svg): fix animation name.
pissang Oct 7, 2021
95215f5
wip(svg): fix some issues after review
pissang Oct 8, 2021
38d9436
wip(svg): add explain comment
pissang Oct 8, 2021
b0ede2c
fix entry js
pissang Oct 8, 2021
b88a611
wip(svg): fix shadow error log when scale is 0
pissang Oct 8, 2021
b95c3f8
wip(svg): add cssAnimation option in renderToString
pissang Oct 8, 2021
dd57edf
wip(svg): set font attributes instead of style. apache/echarts#15064
pissang Oct 8, 2021
af0d89d
wip(text): always set font in style to avoid other css overwrite it
pissang Oct 8, 2021
8182684
wip(svg): use separated font css in style
pissang Oct 8, 2021
b1d9cde
wip(svg): fix font size with px postfix
pissang Oct 8, 2021
7b734b7
wip(svg): use null check in fontSize
pissang Oct 9, 2021
0302bf6
Merge branch 'next' into svg-ssr
pissang Oct 11, 2021
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,7 @@ pip-log.txt

/lib
/esm
node_modules
node_modules

# rollup visualizer
/stats.html
74 changes: 47 additions & 27 deletions build/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// const typescript = require('@rollup/plugin-typescript');
const typescript = require('rollup-plugin-typescript2');
const replace = require('@rollup/plugin-replace');
const rollup = require('rollup');
const path = require('path');
const processs = require('process');
Expand All @@ -12,24 +13,33 @@ function current() {
return (new Date()).toLocaleString();
}

const inputOption = {
input: path.resolve(__dirname, '../index.ts'),
plugins: [typescript({
tsconfigOverride: {
compilerOptions: {
// Rollup don't use CommonJS by default.
module: 'ES2015',
sourceMap: true,
// Use the esm d.ts
declaration: false
}
}
}), progress({
scope: {
total: 0
}
})]
};
function createInputOption(env, isWatch) {
return {
input: path.resolve(__dirname, '../index.ts'),
plugins: [
typescript({
clean: !isWatch,
tsconfigOverride: {
compilerOptions: {
// Rollup don't use CommonJS by default.
module: 'ES2015',
sourceMap: true,
// Use the esm d.ts
declaration: false
}
}
}),
replace({
'process.env.NODE_ENV': JSON.stringify(env)
}),
progress({
scope: {
total: 0
}
})
]
};
}

const outputOption = {
format: 'umd',
Expand All @@ -39,18 +49,17 @@ const outputOption = {
};

function minify(outPath) {
const fileMinPath = outPath.replace(/.js$/, '.min.js');
const code = fs.readFileSync(outPath, 'utf-8');
const uglifyResult = UglifyJS.minify(code);
if (uglifyResult.error) {
throw new Error(uglifyResult.error);
}
fs.writeFileSync(fileMinPath, uglifyResult.code, 'utf-8');
fs.writeFileSync(outPath, uglifyResult.code, 'utf-8');
}

if (processs.argv.includes('--watch')) {
const watcher = rollup.watch({
...inputOption,
...createInputOption('development', true),
output: [outputOption],
watch: {
clearScreen: true
Expand Down Expand Up @@ -83,13 +92,24 @@ if (processs.argv.includes('--watch')) {
});
}
else {
// Unminified
rollup.rollup({
...inputOption
...createInputOption('development', false)
}).then(bundle => {
bundle.write(outputOption).then(function () {
if (process.argv.indexOf('--minify') >= 0) {
minify(outputOption.file);
}
});
bundle.write(outputOption);
});
// Minified
if (process.argv.indexOf('--minify') >= 0) {
rollup.rollup({
...createInputOption('production', false)
}).then(bundle => {
const file = outputOption.file.replace(/.js$/, '.min.js');
bundle.write(Object.assign(outputOption, {
file,
sourcemap: false
})).then(function () {
minify(file);
});
});
}
}
49 changes: 26 additions & 23 deletions dist/zrender.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
var nativeMap = arrayProto.map;
var ctorFunction = function () { }.constructor;
var protoFunction = ctorFunction ? ctorFunction.prototype : null;
var protoKey = '__proto__';
var methods = {};
function $override(name, fn) {
methods[name] = fn;
Expand Down Expand Up @@ -164,7 +165,7 @@
else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {
result = {};
for (var key in source) {
if (source.hasOwnProperty(key)) {
if (source.hasOwnProperty(key) && key !== protoKey) {
result[key] = clone(source[key]);
}
}
Expand All @@ -176,7 +177,7 @@
return overwrite ? clone(source) : target;
}
for (var key in source) {
if (source.hasOwnProperty(key)) {
if (source.hasOwnProperty(key) && key !== protoKey) {
var targetProp = target[key];
var sourceProp = source[key];
if (isObject(sourceProp)
Expand Down Expand Up @@ -211,7 +212,7 @@
}
else {
for (var key in source) {
if (source.hasOwnProperty(key)) {
if (source.hasOwnProperty(key) && key !== protoKey) {
target[key] = source[key];
}
}
Expand Down Expand Up @@ -1173,6 +1174,7 @@
calculateZrXY(el, e, out);
}
else if (env.browser.firefox
&& env.browser.version < '39'
&& e.layerX != null
&& e.layerX !== e.offsetX) {
out.zrX = e.layerX;
Expand Down Expand Up @@ -2130,7 +2132,7 @@
ts.forceMergeRuns();
}

var REDARAW_BIT = 1;
var REDRAW_BIT = 1;
var STYLE_CHANGED_BIT = 2;
var SHAPE_CHANGED_BIT = 4;

Expand Down Expand Up @@ -2214,7 +2216,7 @@
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (el.__dirty) {
child.__dirty |= REDARAW_BIT;
child.__dirty |= REDRAW_BIT;
}
this._updateAndAddDisplayable(child, clipPaths, includeIgnore);
}
Expand Down Expand Up @@ -5275,7 +5277,7 @@
innerTextDefaultStyle.verticalAlign = textVerticalAlign;
textEl.setDefaultTextStyle(innerTextDefaultStyle);
}
textEl.__dirty |= REDARAW_BIT;
textEl.__dirty |= REDRAW_BIT;
if (textStyleChanged) {
textEl.dirtyStyle(true);
}
Expand Down Expand Up @@ -5452,7 +5454,7 @@
this.markRedraw();
if (!useHoverLayer && this.__inHover) {
this._toggleHoverLayerFlag(false);
this.__dirty &= ~REDARAW_BIT;
this.__dirty &= ~REDRAW_BIT;
}
return state;
};
Expand Down Expand Up @@ -5511,7 +5513,7 @@
this.markRedraw();
if (!useHoverLayer && this.__inHover) {
this._toggleHoverLayerFlag(false);
this.__dirty &= ~REDARAW_BIT;
this.__dirty &= ~REDRAW_BIT;
}
}
};
Expand Down Expand Up @@ -5722,7 +5724,7 @@
}
};
Element.prototype.markRedraw = function () {
this.__dirty |= REDARAW_BIT;
this.__dirty |= REDRAW_BIT;
var zr = this.__zr;
if (zr) {
if (this.__inHover) {
Expand Down Expand Up @@ -5871,7 +5873,7 @@
elProto.dragging = false;
elProto.ignoreClip = false;
elProto.__inHover = false;
elProto.__dirty = REDARAW_BIT;
elProto.__dirty = REDRAW_BIT;
var logs = {};
function logDeprecatedError(key, xKey, yKey) {
if (!logs[key + xKey + yKey]) {
Expand Down Expand Up @@ -6542,7 +6544,7 @@
function registerPainter(name, Ctor) {
painterCtors[name] = Ctor;
}
var version = '5.2.0';
var version = '5.2.1';

var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
var DEFAULT_COMMON_STYLE = {
Expand Down Expand Up @@ -6847,7 +6849,7 @@
dispProto.incremental = false;
dispProto._rect = null;
dispProto.dirtyRectTolerance = 0;
dispProto.__dirty = REDARAW_BIT | STYLE_CHANGED_BIT;
dispProto.__dirty = REDRAW_BIT | STYLE_CHANGED_BIT;
})();
return Displayable;
}(Element));
Expand Down Expand Up @@ -8628,7 +8630,7 @@
for (var i = 0; i < pathCopyParams.length; ++i) {
decalEl[pathCopyParams[i]] = this[pathCopyParams[i]];
}
decalEl.__dirty |= REDARAW_BIT;
decalEl.__dirty |= REDRAW_BIT;
}
else if (this._decalEl) {
this._decalEl = null;
Expand Down Expand Up @@ -8954,7 +8956,7 @@
pathProto.segmentIgnoreThreshold = 0;
pathProto.subPixelOptimize = false;
pathProto.autoBatch = false;
pathProto.__dirty = REDARAW_BIT | STYLE_CHANGED_BIT | SHAPE_CHANGED_BIT;
pathProto.__dirty = REDRAW_BIT | STYLE_CHANGED_BIT | SHAPE_CHANGED_BIT;
})();
return Path;
}(Displayable));
Expand Down Expand Up @@ -10379,7 +10381,7 @@
inheritStyle(parentGroup, img);
parseAttributes(xmlNode, img, this._defsUsePending, false, false);
img.setStyle({
image: xmlNode.getAttribute('xlink:href'),
image: xmlNode.getAttribute('xlink:href') || xmlNode.getAttribute('href'),
x: +xmlNode.getAttribute('x'),
y: +xmlNode.getAttribute('y'),
width: +xmlNode.getAttribute('width'),
Expand Down Expand Up @@ -14377,7 +14379,7 @@
function brush(ctx, el, scope, isLast) {
var m = el.transform;
if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false)) {
el.__dirty &= ~REDARAW_BIT;
el.__dirty &= ~REDRAW_BIT;
el.__isRendered = false;
return;
}
Expand Down Expand Up @@ -14663,13 +14665,13 @@
var el = displayList[i];
if (el) {
var shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true);
var prevRect = el.__isRendered && ((el.__dirty & REDARAW_BIT) || !shouldPaint)
var prevRect = el.__isRendered && ((el.__dirty & REDRAW_BIT) || !shouldPaint)
? el.getPrevPaintRect()
: null;
if (prevRect) {
addRectToMergePool(prevRect);
}
var curRect = shouldPaint && ((el.__dirty & REDARAW_BIT) || !el.__isRendered)
var curRect = shouldPaint && ((el.__dirty & REDRAW_BIT) || !el.__isRendered)
? el.getPaintRect()
: null;
if (curRect) {
Expand Down Expand Up @@ -15277,7 +15279,7 @@
updatePrevLayer(i);
prevLayer = layer;
}
if ((el.__dirty & REDARAW_BIT) && !el.__inHover) {
if ((el.__dirty & REDRAW_BIT) && !el.__inHover) {
layer.__dirty = true;
if (layer.incremental && layer.__drawIndex < 0) {
layer.__drawIndex = i;
Expand Down Expand Up @@ -15712,7 +15714,7 @@
function bindStyle(svgEl, style, el) {
var opacity = style.opacity == null ? 1 : style.opacity;
if (el instanceof ZRImage) {
svgEl.style.opacity = opacity + '';
attr(svgEl, 'opacity', opacity + '');
return;
}
if (pathHasFill(style)) {
Expand Down Expand Up @@ -15753,7 +15755,7 @@
attr(svgEl, 'stroke-dashoffset', (lineDashOffset || 0) + '');
}
else {
attr(svgEl, 'stroke-dasharray', '');
attr(svgEl, 'stroke-dasharray', NONE);
}
style.lineCap && attr(svgEl, 'stroke-linecap', style.lineCap);
style.lineJoin && attr(svgEl, 'stroke-linejoin', style.lineJoin);
Expand Down Expand Up @@ -16585,7 +16587,7 @@
ShadowManager.prototype.remove = function (svgElement, displayable) {
if (displayable._shadowDom != null) {
displayable._shadowDom = null;
svgElement.style.filter = '';
svgElement.removeAttribute('filter');
}
};
ShadowManager.prototype.updateDom = function (svgElement, displayable, shadowDom) {
Expand Down Expand Up @@ -16615,7 +16617,7 @@
shadowDom.setAttribute('height', '300%');
displayable._shadowDom = shadowDom;
var id = shadowDom.getAttribute('id');
svgElement.style.filter = 'url(#' + id + ')';
svgElement.setAttribute('filter', 'url(#' + id + ')');
};
ShadowManager.prototype.removeUnused = function () {
var defs = this.getDefs(false);
Expand Down Expand Up @@ -16957,6 +16959,7 @@
exports.Circle = Circle;
exports.CircleShape = CircleShape;
exports.CompoundPath = CompoundPath;
exports.Displayable = Displayable;
exports.Droplet = Droplet;
exports.DropletShape = DropletShape;
exports.Element = Element;
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.

1 change: 0 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ import CanvasPainter from './src/canvas/Painter';
import SVGPainter from './src/svg/Painter';
registerPainter('canvas', CanvasPainter);
registerPainter('svg', SVGPainter);
// import './src/vml/vml';
Loading