@antv/g-lite 1.3.0-next.9 → 2.0.0

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/Canvas.d.ts CHANGED
@@ -6,7 +6,7 @@ import { CustomElementRegistry } from './dom/CustomElementRegistry';
6
6
  import type { ICanvas } from './dom/interfaces';
7
7
  import { EventService, RenderingService } from './services';
8
8
  import type { PointLike } from './shapes';
9
- import type { CanvasConfig, Cursor, InteractivePointerEvent } from './types';
9
+ import { type CanvasConfig, type Cursor, type InteractivePointerEvent } from './types';
10
10
  export declare function isCanvas(value: any): value is Canvas;
11
11
  export declare enum CanvasEvent {
12
12
  READY = "ready",
@@ -81,6 +81,7 @@ export declare class Canvas extends EventTarget implements ICanvas {
81
81
  constructor(config: CanvasConfig);
82
82
  private initRenderingContext;
83
83
  private initDefaultCamera;
84
+ private updateSizeAttenuation;
84
85
  getConfig(): Partial<CanvasConfig>;
85
86
  /**
86
87
  * get the root displayObject in scenegraph
@@ -50,5 +50,6 @@ export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
50
50
  * eg. r of Circle, width/height of Rect
51
51
  */
52
52
  updateGeometry(object: DisplayObject): void;
53
+ updateSizeAttenuation(node: DisplayObject, zoom: number): void;
53
54
  private isPropertyInheritable;
54
55
  }
@@ -24,7 +24,7 @@ export declare const canonicalUnitTypeForCategory: (category: UnitCategory) => U
24
24
  * @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/css_primitive_value.cc#353
25
25
  */
26
26
  export declare const conversionToCanonicalUnitsScaleFactor: (unit_type: UnitType) => number;
27
- export declare const unitTypeToString: (type: UnitType) => "em" | "px" | "deg" | "rad" | "grad" | "ms" | "s" | "rem" | "turn" | "" | "%";
27
+ export declare const unitTypeToString: (type: UnitType) => "" | "em" | "px" | "deg" | "rad" | "grad" | "ms" | "s" | "rem" | "turn" | "%";
28
28
  /**
29
29
  * CSSStyleValue is the base class for all CSS values accessible from Typed OM.
30
30
  * Values that are not yet supported as specific types are also returned as base CSSStyleValues.
@@ -122,6 +122,7 @@ export interface PropertyParseOptions {
122
122
  }
123
123
  export interface StyleValueRegistry {
124
124
  recalc: (displayObject: DisplayObject) => void;
125
+ updateSizeAttenuation: (displayObject: DisplayObject, zoom: number) => void;
125
126
  registerMetadata: (metadata: PropertyMetadata) => void;
126
127
  unregisterMetadata: (name: string) => void;
127
128
  getPropertySyntax: (syntax: string) => CSSProperty<any, any>;
@@ -51,4 +51,4 @@ export declare function convertAngleUnit(value: CSSUnitValue): number;
51
51
  export declare function parseDimensionArrayFormat(string: string | number | (string | number)[], size: number): number[];
52
52
  export declare function parseDimensionArray(string: string | (string | number)[]): CSSUnitValue[];
53
53
  export declare function parseDimensionArrayUnmemoize(string: string | (string | number)[]): CSSUnitValue[];
54
- export declare function convertPercentUnit(valueWithUnit: CSSUnitValue, vec3Index: number, target: DisplayObject): number;
54
+ export declare function convertPercentUnit(valueWithUnit: CSSUnitValue, vec3Index: number, target: DisplayObject, useMin?: boolean): number;
@@ -1,5 +1,5 @@
1
1
  import type { CurveArray, PathArray } from '@antv/util';
2
2
  import type { ParsedPathStyleProps } from '../../display-objects';
3
3
  import type { IElement } from '../../dom';
4
- export declare function parsePath(path: string | PathArray): ParsedPathStyleProps['path'];
5
- export declare function mergePaths(left: ParsedPathStyleProps['path'], right: ParsedPathStyleProps['path'], object?: IElement): [CurveArray, CurveArray, (b: CurveArray) => CurveArray];
4
+ export declare function parsePath(path: string | PathArray): ParsedPathStyleProps['d'];
5
+ export declare function mergePaths(left: ParsedPathStyleProps['d'], right: ParsedPathStyleProps['d'], object?: IElement): [CurveArray, CurveArray, (b: CurveArray) => CurveArray];
@@ -8,7 +8,7 @@ import type { DisplayObject } from '../..';
8
8
  export declare function parsePoints(pointsOrStr: string | [number, number][], object?: DisplayObject): {
9
9
  points: [number, number][];
10
10
  totalLength: number;
11
- segments: [number, number][];
11
+ segments: any[];
12
12
  };
13
13
  export declare function mergePoints(left: any, right: any): [
14
14
  [
@@ -1,4 +1,4 @@
1
- import { DisplayObject } from '../../display-objects';
1
+ import type { DisplayObject } from '../../display-objects';
2
2
  import type { CSSUnitValue } from '../cssom';
3
3
  import type { CSSProperty } from '../CSSProperty';
4
4
  export declare class CSSPropertyOffsetDistance implements Partial<CSSProperty<CSSUnitValue, number>> {
@@ -3,13 +3,13 @@ import type { ParsedPathStyleProps } from '../../display-objects';
3
3
  import { Rectangle } from '../../shapes';
4
4
  import type { CSSProperty } from '../CSSProperty';
5
5
  import { mergePaths, parsePath } from '../parser/path';
6
- export declare class CSSPropertyPath implements Partial<CSSProperty<ParsedPathStyleProps['path'], ParsedPathStyleProps['path']>> {
6
+ export declare class CSSPropertyPath implements Partial<CSSProperty<ParsedPathStyleProps['d'], ParsedPathStyleProps['d']>> {
7
7
  /**
8
8
  * path2Curve
9
9
  */
10
10
  parser: typeof parsePath;
11
11
  parserWithCSSDisabled: typeof parsePath;
12
- calculator(name: string, oldParsed: ParsedPathStyleProps['path'], parsed: ParsedPathStyleProps['path']): {
12
+ calculator(name: string, oldParsed: ParsedPathStyleProps['d'], parsed: ParsedPathStyleProps['d']): {
13
13
  absolutePath: AbsoluteArray;
14
14
  hasArc: boolean;
15
15
  segments: import("../../display-objects").PathSegment[];
@@ -1,4 +1,5 @@
1
- import type { CSSUnitValue } from '../cssom';
1
+ import { DisplayObject } from '../../display-objects';
2
+ import { type CSSUnitValue } from '../cssom';
2
3
  import type { CSSProperty } from '../CSSProperty';
3
4
  /**
4
5
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
@@ -11,4 +12,5 @@ export declare class CSSPropertyTransformOrigin implements Partial<CSSProperty<[
11
12
  cache: Map<any, any>;
12
13
  };
13
14
  parserUnmemoize: (value: string | number[]) => [CSSUnitValue, CSSUnitValue];
15
+ postProcessor(object: DisplayObject): void;
14
16
  }
@@ -36,5 +36,5 @@ export interface ParsedCircleStyleProps extends ParsedBaseStyleProps {
36
36
  isSizeAttenuation?: boolean;
37
37
  }
38
38
  export declare class Circle extends DisplayObject<CircleStyleProps, ParsedCircleStyleProps> {
39
- constructor({ style, ...rest }?: DisplayObjectConfig<CircleStyleProps>);
39
+ constructor(options?: DisplayObjectConfig<CircleStyleProps>);
40
40
  }
@@ -237,16 +237,6 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
237
237
  * @deprecated
238
238
  */
239
239
  add<T extends IChildNode>(child: T, index?: number): T;
240
- /**
241
- * Use `this.style.clipPath` instead.
242
- * @deprecated
243
- */
244
- setClip(clipPath: DisplayObject | null): void;
245
- /**
246
- * Use `this.style.clipPath` instead.
247
- * @deprecated
248
- */
249
- getClip: () => any;
250
240
  /**
251
241
  * @deprecated
252
242
  */
@@ -8,6 +8,7 @@ export interface EllipseStyleProps extends BaseStyleProps {
8
8
  rx: number | string;
9
9
  ry: number | string;
10
10
  isBillboard?: boolean;
11
+ isSizeAttenuation?: boolean;
11
12
  }
12
13
  export interface ParsedEllipseStyleProps extends ParsedBaseStyleProps {
13
14
  cx: number;
@@ -16,7 +17,8 @@ export interface ParsedEllipseStyleProps extends ParsedBaseStyleProps {
16
17
  rx: number;
17
18
  ry: number;
18
19
  isBillboard?: boolean;
20
+ isSizeAttenuation?: boolean;
19
21
  }
20
22
  export declare class Ellipse extends DisplayObject<EllipseStyleProps, ParsedEllipseStyleProps> {
21
- constructor({ style, ...rest }?: DisplayObjectConfig<EllipseStyleProps>);
23
+ constructor(options?: DisplayObjectConfig<EllipseStyleProps>);
22
24
  }
@@ -21,5 +21,5 @@ export interface ParsedGroupStyleProps extends ParsedBaseStyleProps {
21
21
  </g>
22
22
  */
23
23
  export declare class Group extends DisplayObject {
24
- constructor({ style, ...rest }?: DisplayObjectConfig<GroupStyleProps>);
24
+ constructor(options?: DisplayObjectConfig<GroupStyleProps>);
25
25
  }
@@ -5,7 +5,6 @@ export interface ImageStyleProps extends BaseStyleProps {
5
5
  x?: number | string;
6
6
  y?: number | string;
7
7
  z?: number;
8
- img?: string | HTMLImageElement;
9
8
  src?: string | HTMLImageElement;
10
9
  width?: number | string;
11
10
  height?: number | string;
@@ -30,7 +29,6 @@ export interface ParsedImageStyleProps extends ParsedBaseStyleProps {
30
29
  x: number;
31
30
  y: number;
32
31
  z?: number;
33
- img?: string | HTMLImageElement;
34
32
  src?: string | HTMLImageElement;
35
33
  width?: number;
36
34
  height?: number;
@@ -40,5 +38,5 @@ export interface ParsedImageStyleProps extends ParsedBaseStyleProps {
40
38
  keepAspectRatio?: boolean;
41
39
  }
42
40
  export declare class Image extends DisplayObject<ImageStyleProps, ParsedImageStyleProps> {
43
- constructor({ style, ...rest }?: DisplayObjectConfig<ImageStyleProps>);
41
+ constructor(options?: DisplayObjectConfig<ImageStyleProps>);
44
42
  }
@@ -5,7 +5,6 @@ import { Rectangle } from '../shapes/Rectangle';
5
5
  import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
6
6
  import { DisplayObject } from './DisplayObject';
7
7
  export interface PathStyleProps extends BaseStyleProps {
8
- path?: string | PathArray;
9
8
  d?: string | PathArray;
10
9
  /**
11
10
  * marker will be positioned at the first point
@@ -69,17 +68,7 @@ export interface PathArcParams {
69
68
  sweepFlag: number;
70
69
  }
71
70
  export interface ParsedPathStyleProps extends ParsedBaseStyleProps {
72
- path: {
73
- absolutePath: AbsoluteArray;
74
- hasArc: boolean;
75
- segments: PathSegment[];
76
- polygons: [number, number][][];
77
- polylines: [number, number][][];
78
- curve: CurveArray;
79
- totalLength: number;
80
- rect: Rectangle;
81
- };
82
- d?: {
71
+ d: {
83
72
  absolutePath: AbsoluteArray;
84
73
  hasArc: boolean;
85
74
  segments: PathSegment[];
@@ -22,6 +22,7 @@ export interface PolygonStyleProps extends BaseStyleProps {
22
22
  markerEndOffset?: number;
23
23
  isClosed?: boolean;
24
24
  isBillboard?: boolean;
25
+ isSizeAttenuation?: boolean;
25
26
  }
26
27
  export interface ParsedPolygonStyleProps extends ParsedBaseStyleProps {
27
28
  points: {
@@ -36,6 +37,7 @@ export interface ParsedPolygonStyleProps extends ParsedBaseStyleProps {
36
37
  markerEndOffset?: number;
37
38
  isClosed?: boolean;
38
39
  isBillboard?: boolean;
40
+ isSizeAttenuation?: boolean;
39
41
  }
40
42
  export declare class Polygon extends DisplayObject<PolygonStyleProps, ParsedPolygonStyleProps> {
41
43
  private markerStartAngle;
@@ -8,6 +8,7 @@ export interface RectStyleProps extends BaseStyleProps {
8
8
  width: number | string;
9
9
  height: number | string;
10
10
  isBillboard?: boolean;
11
+ isSizeAttenuation?: boolean;
11
12
  /**
12
13
  * top-left, top-right, bottom-right, bottom-left
13
14
  */
@@ -20,8 +21,9 @@ export interface ParsedRectStyleProps extends ParsedBaseStyleProps {
20
21
  width: number;
21
22
  height: number;
22
23
  isBillboard?: boolean;
24
+ isSizeAttenuation?: boolean;
23
25
  radius?: [number, number, number, number];
24
26
  }
25
27
  export declare class Rect extends DisplayObject<RectStyleProps, ParsedRectStyleProps> {
26
- constructor({ style, ...rest }?: DisplayObjectConfig<RectStyleProps>);
28
+ constructor(options?: DisplayObjectConfig<RectStyleProps>);
27
29
  }
@@ -31,4 +31,11 @@ export interface GlobalRuntime {
31
31
  * circle.style.r = 100;
32
32
  */
33
33
  enableStyleSyntax: boolean;
34
+ /**
35
+ * Enable using dash-cased attribute.
36
+ * @example
37
+ * circle.setAttribute('stroke-width', '2');
38
+ */
39
+ enableAttributeDashCased: boolean;
40
+ enableSizeAttenuation: boolean;
34
41
  }