zrender-nightly 5.6.2-dev.20250406 → 5.6.2-dev.20250407
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/zrender.js +13 -1
- package/dist/zrender.js.map +1 -1
- package/dist/zrender.min.js +1 -1
- package/lib/tool/color.d.ts +2 -0
- package/lib/tool/color.js +2 -2
- package/lib/tool/parseSVG.js +11 -0
- package/lib/zrender.d.ts +1 -1
- package/lib/zrender.js +1 -1
- package/package.json +1 -1
- package/src/tool/color.ts +2 -2
- package/src/tool/parseSVG.ts +12 -1
- package/src/zrender.ts +1 -1
package/lib/tool/color.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { GradientObject } from '../graphic/Gradient';
|
|
2
|
+
export declare function parseCssInt(val: string | number): number;
|
|
3
|
+
export declare function parseCssFloat(val: string | number): number;
|
|
2
4
|
export declare function parse(colorStr: string, rgbaArr?: number[]): number[];
|
|
3
5
|
export declare function lift(color: string, level: number): string;
|
|
4
6
|
export declare function toHex(color: string): string;
|
package/lib/tool/color.js
CHANGED
|
@@ -87,14 +87,14 @@ function clampCssAngle(i) {
|
|
|
87
87
|
function clampCssFloat(f) {
|
|
88
88
|
return f < 0 ? 0 : f > 1 ? 1 : f;
|
|
89
89
|
}
|
|
90
|
-
function parseCssInt(val) {
|
|
90
|
+
export function parseCssInt(val) {
|
|
91
91
|
var str = val;
|
|
92
92
|
if (str.length && str.charAt(str.length - 1) === '%') {
|
|
93
93
|
return clampCssByte(parseFloat(str) / 100 * 255);
|
|
94
94
|
}
|
|
95
95
|
return clampCssByte(parseInt(str, 10));
|
|
96
96
|
}
|
|
97
|
-
function parseCssFloat(val) {
|
|
97
|
+
export function parseCssFloat(val) {
|
|
98
98
|
var str = val;
|
|
99
99
|
if (str.length && str.charAt(str.length - 1) === '%') {
|
|
100
100
|
return clampCssFloat(parseFloat(str) / 100);
|
package/lib/tool/parseSVG.js
CHANGED
|
@@ -13,6 +13,7 @@ import LinearGradient from '../graphic/LinearGradient.js';
|
|
|
13
13
|
import RadialGradient from '../graphic/RadialGradient.js';
|
|
14
14
|
import TSpan from '../graphic/TSpan.js';
|
|
15
15
|
import { parseXML } from './parseXML.js';
|
|
16
|
+
import * as colorTool from './color.js';
|
|
16
17
|
;
|
|
17
18
|
var nodeParsers;
|
|
18
19
|
var INHERITABLE_STYLE_ATTRIBUTES_MAP = {
|
|
@@ -399,6 +400,16 @@ function parseGradientColorStops(xmlNode, gradient) {
|
|
|
399
400
|
var stopColor = styleVals.stopColor
|
|
400
401
|
|| stop.getAttribute('stop-color')
|
|
401
402
|
|| '#000000';
|
|
403
|
+
var stopOpacity = styleVals.stopOpacity
|
|
404
|
+
|| stop.getAttribute('stop-opacity');
|
|
405
|
+
if (stopOpacity) {
|
|
406
|
+
var rgba = colorTool.parse(stopColor);
|
|
407
|
+
var stopColorOpacity = rgba && rgba[3];
|
|
408
|
+
if (stopColorOpacity) {
|
|
409
|
+
rgba[3] *= colorTool.parseCssFloat(stopOpacity);
|
|
410
|
+
stopColor = colorTool.stringify(rgba, 'rgba');
|
|
411
|
+
}
|
|
412
|
+
}
|
|
402
413
|
gradient.colorStops.push({
|
|
403
414
|
offset: offset,
|
|
404
415
|
color: stopColor
|
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.2-dev.
|
|
93
|
+
export declare const version = "5.6.2-dev.20250407";
|
|
94
94
|
export interface ZRenderType extends ZRender {
|
|
95
95
|
}
|
|
96
96
|
export {};
|
package/lib/zrender.js
CHANGED
package/package.json
CHANGED
package/src/tool/color.ts
CHANGED
|
@@ -93,7 +93,7 @@ function clampCssFloat(f: number): number { // Clamp to float 0.0 .. 1.0.
|
|
|
93
93
|
return f < 0 ? 0 : f > 1 ? 1 : f;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
function parseCssInt(val: string | number): number { // int or percentage.
|
|
96
|
+
export function parseCssInt(val: string | number): number { // int or percentage.
|
|
97
97
|
let str = val as string;
|
|
98
98
|
if (str.length && str.charAt(str.length - 1) === '%') {
|
|
99
99
|
return clampCssByte(parseFloat(str) / 100 * 255);
|
|
@@ -101,7 +101,7 @@ function parseCssInt(val: string | number): number { // int or percentage.
|
|
|
101
101
|
return clampCssByte(parseInt(str, 10));
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
function parseCssFloat(val: string | number): number { // float or percentage.
|
|
104
|
+
export function parseCssFloat(val: string | number): number { // float or percentage.
|
|
105
105
|
let str = val as string;
|
|
106
106
|
if (str.length && str.charAt(str.length - 1) === '%') {
|
|
107
107
|
return clampCssFloat(parseFloat(str) / 100);
|
package/src/tool/parseSVG.ts
CHANGED
|
@@ -19,6 +19,7 @@ import RadialGradient, { RadialGradientObject } from '../graphic/RadialGradient'
|
|
|
19
19
|
import Gradient, { GradientObject } from '../graphic/Gradient';
|
|
20
20
|
import TSpan, { TSpanStyleProps } from '../graphic/TSpan';
|
|
21
21
|
import { parseXML } from './parseXML';
|
|
22
|
+
import * as colorTool from './color';
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
interface SVGParserOption {
|
|
@@ -627,9 +628,19 @@ function parseGradientColorStops(xmlNode: SVGElement, gradient: GradientObject):
|
|
|
627
628
|
// <stop stop-color="red"/>
|
|
628
629
|
const styleVals = {} as Dictionary<string>;
|
|
629
630
|
parseInlineStyle(stop, styleVals, styleVals);
|
|
630
|
-
|
|
631
|
+
let stopColor = styleVals.stopColor
|
|
631
632
|
|| stop.getAttribute('stop-color')
|
|
632
633
|
|| '#000000';
|
|
634
|
+
const stopOpacity = styleVals.stopOpacity
|
|
635
|
+
|| stop.getAttribute('stop-opacity');
|
|
636
|
+
if (stopOpacity) {
|
|
637
|
+
const rgba = colorTool.parse(stopColor);
|
|
638
|
+
const stopColorOpacity = rgba && rgba[3];
|
|
639
|
+
if (stopColorOpacity) {
|
|
640
|
+
rgba[3] *= colorTool.parseCssFloat(stopOpacity);
|
|
641
|
+
stopColor = colorTool.stringify(rgba, 'rgba');
|
|
642
|
+
}
|
|
643
|
+
}
|
|
633
644
|
|
|
634
645
|
gradient.colorStops.push({
|
|
635
646
|
offset: offset,
|
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.2-dev.
|
|
559
|
+
export const version = '5.6.2-dev.20250407';
|
|
560
560
|
|
|
561
561
|
|
|
562
562
|
export interface ZRenderType extends ZRender {};
|