zrender-nightly 5.7.0-dev.20250620 → 5.7.0-dev.20250622

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.
Files changed (61) hide show
  1. package/README.md +1 -1
  2. package/build/prepublish.js +20 -0
  3. package/dist/zrender.js +563 -277
  4. package/dist/zrender.js.map +1 -1
  5. package/dist/zrender.min.js +1 -1
  6. package/lib/Element.d.ts +4 -0
  7. package/lib/Element.js +34 -16
  8. package/lib/Handler.js +1 -1
  9. package/lib/Storage.js +20 -20
  10. package/lib/canvas/graphic.js +1 -1
  11. package/lib/contain/text.d.ts +14 -2
  12. package/lib/contain/text.js +65 -15
  13. package/lib/core/BoundingRect.d.ts +25 -3
  14. package/lib/core/BoundingRect.js +182 -76
  15. package/lib/core/OrientedBoundingRect.d.ts +2 -2
  16. package/lib/core/OrientedBoundingRect.js +50 -34
  17. package/lib/core/PathProxy.d.ts +1 -0
  18. package/lib/core/PathProxy.js +16 -1
  19. package/lib/core/dom.d.ts +1 -0
  20. package/lib/core/dom.js +17 -0
  21. package/lib/core/env.js +15 -10
  22. package/lib/core/types.d.ts +1 -0
  23. package/lib/core/util.d.ts +1 -0
  24. package/lib/core/util.js +2 -1
  25. package/lib/graphic/Displayable.js +1 -1
  26. package/lib/graphic/Text.d.ts +4 -2
  27. package/lib/graphic/Text.js +23 -14
  28. package/lib/graphic/helper/parseText.d.ts +13 -4
  29. package/lib/graphic/helper/parseText.js +110 -54
  30. package/lib/svg-legacy/helper/ClippathManager.js +6 -6
  31. package/lib/tool/color.d.ts +3 -1
  32. package/lib/tool/color.js +6 -6
  33. package/lib/tool/parseSVG.js +11 -0
  34. package/lib/tool/path.js +7 -4
  35. package/lib/zrender.d.ts +1 -1
  36. package/lib/zrender.js +1 -1
  37. package/package.json +3 -2
  38. package/src/Element.ts +69 -16
  39. package/src/Handler.ts +1 -1
  40. package/src/Storage.ts +25 -24
  41. package/src/canvas/graphic.ts +1 -1
  42. package/src/canvas/helper.ts +1 -1
  43. package/src/contain/text.ts +103 -19
  44. package/src/core/BoundingRect.ts +308 -87
  45. package/src/core/OrientedBoundingRect.ts +86 -46
  46. package/src/core/PathProxy.ts +17 -1
  47. package/src/core/Transformable.ts +2 -0
  48. package/src/core/dom.ts +24 -0
  49. package/src/core/env.ts +31 -24
  50. package/src/core/matrix.ts +2 -1
  51. package/src/core/types.ts +2 -0
  52. package/src/core/util.ts +4 -2
  53. package/src/graphic/Displayable.ts +1 -3
  54. package/src/graphic/Group.ts +2 -0
  55. package/src/graphic/Text.ts +68 -21
  56. package/src/graphic/helper/parseText.ts +211 -83
  57. package/src/svg-legacy/helper/ClippathManager.ts +5 -5
  58. package/src/tool/color.ts +15 -11
  59. package/src/tool/parseSVG.ts +12 -1
  60. package/src/tool/path.ts +9 -4
  61. package/src/zrender.ts +1 -1
@@ -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
- const stopColor = styleVals.stopColor
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/tool/path.ts CHANGED
@@ -383,13 +383,16 @@ class SVGPath extends Path {
383
383
  function isPathProxy(path: PathProxy | CanvasRenderingContext2D): path is PathProxy {
384
384
  return (path as PathProxy).setData != null;
385
385
  }
386
+
386
387
  // TODO Optimize double memory cost problem
387
388
  function createPathOptions(str: string, opts: SVGPathOption): InnerSVGPathOption {
388
389
  const pathProxy = createPathProxyFromString(str);
389
390
  const innerOpts: InnerSVGPathOption = extend({}, opts);
390
391
  innerOpts.buildPath = function (path: PathProxy | CanvasRenderingContext2D) {
391
- if (isPathProxy(path)) {
392
- path.setData(pathProxy.data);
392
+ const beProxy = isPathProxy(path);
393
+ if (beProxy && path.canSave()) {
394
+ // path.setData(pathProxy.data);
395
+ path.appendPath(pathProxy);
393
396
  // Svg and vml renderer don't have context
394
397
  const ctx = path.getContext();
395
398
  if (ctx) {
@@ -397,8 +400,10 @@ function createPathOptions(str: string, opts: SVGPathOption): InnerSVGPathOption
397
400
  }
398
401
  }
399
402
  else {
400
- const ctx = path;
401
- pathProxy.rebuildPath(ctx, 1);
403
+ const ctx = beProxy ? path.getContext() : path;
404
+ if (ctx) {
405
+ pathProxy.rebuildPath(ctx, 1);
406
+ }
402
407
  }
403
408
  };
404
409
 
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.7.0-dev.20250620';
559
+ export const version = '5.7.0-dev.20250622';
560
560
 
561
561
 
562
562
  export interface ZRenderType extends ZRender {};