zrender-nightly 5.6.0-dev.20240629 → 5.6.1-dev.20240629

Sign up to get free protection for your applications and to get access to all the features.
package/lib/core/env.js CHANGED
@@ -32,8 +32,9 @@ if (typeof wx === 'object' && typeof wx.getSystemInfoSync === 'function') {
32
32
  else if (typeof document === 'undefined' && typeof self !== 'undefined') {
33
33
  env.worker = true;
34
34
  }
35
- else if (typeof navigator === 'undefined'
36
- || navigator.userAgent.indexOf('Node.js') === 0) {
35
+ else if ((typeof process !== 'undefined' && typeof process.version === 'string')
36
+ || (typeof navigator === 'undefined' || typeof navigator.userAgent === 'undefined')
37
+ || (env.hasGlobalWindow && 'Deno' in window)) {
37
38
  env.node = true;
38
39
  env.svgSupported = true;
39
40
  }
@@ -39,7 +39,7 @@ export var platformApi = {
39
39
  else {
40
40
  text = text || '';
41
41
  font = font || DEFAULT_FONT;
42
- var res = /(\d+)px/.exec(font);
42
+ var res = /((?:\d+)?\.?\d*)px/.exec(font);
43
43
  var fontSize = res && +res[1] || DEFAULT_FONT_SIZE;
44
44
  var width = 0;
45
45
  if (font.indexOf('mono') >= 0) {
@@ -66,6 +66,7 @@ var SVGPainter = (function () {
66
66
  scope.willUpdate = opts.willUpdate;
67
67
  scope.compress = opts.compress;
68
68
  scope.emphasis = opts.emphasis;
69
+ scope.ssr = this._opts.ssr;
69
70
  var children = [];
70
71
  var bgVNode = this._bgVNode = createBackgroundVNode(width, height, this._backgroundColor, scope);
71
72
  bgVNode && children.push(bgVNode);
package/lib/svg/core.d.ts CHANGED
@@ -41,6 +41,7 @@ export interface BrushScope {
41
41
  emphasis?: boolean;
42
42
  willUpdate?: boolean;
43
43
  compress?: boolean;
44
+ ssr?: boolean;
44
45
  }
45
46
  export declare function createBrushScope(zrId: string): BrushScope;
46
47
  export declare function createSVGVNode(width: number | string, height: number | string, children?: SVGVNode[], useViewBox?: boolean): SVGVNode;
@@ -29,12 +29,12 @@ function setStyleAttrs(attrs, style, el, scope) {
29
29
  else if (isFillStroke && isPattern(val)) {
30
30
  setPattern(el, attrs, key, scope);
31
31
  }
32
- else if (isFillStroke && val === 'none') {
33
- attrs[key] = 'transparent';
34
- }
35
32
  else {
36
33
  attrs[key] = val;
37
34
  }
35
+ if (isFillStroke && scope.ssr && val === 'none') {
36
+ attrs['pointer-events'] = 'visible';
37
+ }
38
38
  }, style, el, false);
39
39
  setShadow(el, attrs, scope);
40
40
  }
package/lib/zrender.d.ts CHANGED
@@ -90,7 +90,7 @@ export declare type ElementSSRData = zrUtil.HashMap<unknown>;
90
90
  export declare type ElementSSRDataGetter<T> = (el: Element) => zrUtil.HashMap<T>;
91
91
  export declare function getElementSSRData(el: Element): ElementSSRData;
92
92
  export declare function registerSSRDataGetter<T>(getter: ElementSSRDataGetter<T>): void;
93
- export declare const version = "5.6.0-dev.20240629";
93
+ export declare const version = "5.6.1-dev.20240629";
94
94
  export interface ZRenderType extends ZRender {
95
95
  }
96
96
  export {};
package/lib/zrender.js CHANGED
@@ -324,5 +324,5 @@ export function getElementSSRData(el) {
324
324
  export function registerSSRDataGetter(getter) {
325
325
  ssrDataGetter = getter;
326
326
  }
327
- export var version = '5.6.0-dev.20240629';
327
+ export var version = '5.6.1-dev.20240629';
328
328
  ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zrender-nightly",
3
- "version": "5.6.0-dev.20240629",
3
+ "version": "5.6.1-dev.20240629",
4
4
  "description": "A lightweight graphic library providing 2d draw for Apache ECharts",
5
5
  "keywords": [
6
6
  "canvas",
package/src/core/env.ts CHANGED
@@ -38,8 +38,9 @@ else if (typeof document === 'undefined' && typeof self !== 'undefined') {
38
38
  env.worker = true;
39
39
  }
40
40
  else if (
41
- typeof navigator === 'undefined'
42
- || navigator.userAgent.indexOf('Node.js') === 0
41
+ (typeof process !== 'undefined' && typeof process.version === 'string')
42
+ || (typeof navigator === 'undefined' || typeof navigator.userAgent === 'undefined')
43
+ || (env.hasGlobalWindow && 'Deno' in window)
43
44
  ) {
44
45
  // In node
45
46
  env.node = true;
@@ -75,7 +75,7 @@ export const platformApi: Platform = {
75
75
  text = text || '';
76
76
  font = font || DEFAULT_FONT;
77
77
  // Use font size if there is no other method can be used.
78
- const res = /(\d+)px/.exec(font);
78
+ const res = /((?:\d+)?\.?\d*)px/.exec(font);
79
79
  const fontSize = res && +res[1] || DEFAULT_FONT_SIZE;
80
80
  let width = 0;
81
81
  if (font.indexOf('mono') >= 0) { // is monospace
@@ -108,4 +108,4 @@ export function setPlatformAPI(newPlatformApis: Partial<Platform>) {
108
108
  (platformApi as any)[key] = (newPlatformApis as any)[key];
109
109
  }
110
110
  }
111
- }
111
+ }
@@ -142,6 +142,7 @@ class SVGPainter implements PainterBase {
142
142
  scope.willUpdate = opts.willUpdate;
143
143
  scope.compress = opts.compress;
144
144
  scope.emphasis = opts.emphasis;
145
+ scope.ssr = this._opts.ssr;
145
146
 
146
147
  const children: SVGVNode[] = [];
147
148
 
package/src/svg/core.ts CHANGED
@@ -159,6 +159,8 @@ export interface BrushScope {
159
159
  * If compress the output string.
160
160
  */
161
161
  compress?: boolean
162
+
163
+ ssr?: boolean
162
164
  }
163
165
 
164
166
  export function createBrushScope(zrId: string): BrushScope {
@@ -63,13 +63,15 @@ function setStyleAttrs(attrs: SVGVNodeAttrs, style: AllStyleOption, el: Path | T
63
63
  else if (isFillStroke && isPattern(val)) {
64
64
  setPattern(el, attrs, key, scope);
65
65
  }
66
- else if (isFillStroke && val === 'none') {
67
- // When is none, it cannot be interacted when ssr
68
- attrs[key] = 'transparent';
69
- }
70
66
  else {
71
67
  attrs[key] = val;
72
68
  }
69
+ if (isFillStroke && scope.ssr && val === 'none') {
70
+ // When is none, it cannot be interacted when ssr
71
+ // Setting `pointer-events` as `visible` to make it responding
72
+ // See also https://www.w3.org/TR/SVG/interact.html#PointerEventsProperty
73
+ attrs['pointer-events'] = 'visible';
74
+ }
73
75
  }, style, el, false);
74
76
 
75
77
  setShadow(el, attrs, scope);
package/src/zrender.ts CHANGED
@@ -556,7 +556,7 @@ export function registerSSRDataGetter<T>(getter: ElementSSRDataGetter<T>) {
556
556
  /**
557
557
  * @type {string}
558
558
  */
559
- export const version = '5.6.0-dev.20240629';
559
+ export const version = '5.6.1-dev.20240629';
560
560
 
561
561
 
562
562
  export interface ZRenderType extends ZRender {};