modern-canvas 0.4.23 → 0.4.24

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/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Font } from 'modern-font';
2
2
  import { AnimationItem } from 'lottie-web';
3
3
  import { AnyColor, Colord } from 'colord';
4
4
  import { Path2D, LineCap, LineJoin, LineStyle, Path2DSet } from 'modern-path2d';
5
- import { ImageFillSource, ImageFillTile, FillDeclaration, Path2DDeclaration, OutlineDeclaration, ShadowDeclaration, StyleDeclaration, ImageSource, ImageSourceRect } from 'modern-idoc';
5
+ import { ImageFillSource, ImageFillTile, ImageFillStretch, FillDeclaration, Path2DDeclaration, GeometryDeclaration, OutlineDeclaration, ShadowDeclaration, StyleDeclaration, ImageSource, ImageSourceRect } from 'modern-idoc';
6
6
  import { TextOptions, Text, MeasureResult } from 'modern-text';
7
7
  import { Node as Node$1, Direction } from 'yoga-layout/load';
8
8
 
@@ -1411,14 +1411,14 @@ interface CanvasBatchable extends Batchable2D {
1411
1411
  type: 'stroke' | 'fill';
1412
1412
  texture?: Texture2D;
1413
1413
  }
1414
- interface StrokeDraw {
1414
+ interface StrokeDraw extends Partial<CanvasBatchable> {
1415
1415
  type: 'stroke';
1416
1416
  path: Path2D;
1417
1417
  texture?: Texture2D;
1418
1418
  textureTransform?: Transform2D;
1419
1419
  style: LineStyle;
1420
1420
  }
1421
- interface FillDraw {
1421
+ interface FillDraw extends Partial<CanvasBatchable> {
1422
1422
  type: 'fill';
1423
1423
  path: Path2D;
1424
1424
  texture?: Texture2D;
@@ -1434,10 +1434,10 @@ declare class CanvasContext extends Path2D {
1434
1434
  miterLimit?: number;
1435
1435
  _defaultStyle: Texture2D<Texture2DSource>;
1436
1436
  _draws: (StrokeDraw | FillDraw)[];
1437
- stroke(): void;
1437
+ stroke(options?: Partial<StrokeDraw>): void;
1438
1438
  fillRect(x: number, y: number, width: number, height: number): void;
1439
1439
  strokeRect(x: number, y: number, width: number, height: number): void;
1440
- fill(): void;
1440
+ fill(options?: Partial<FillDraw>): void;
1441
1441
  copy(source: CanvasContext): this;
1442
1442
  reset(): this;
1443
1443
  buildUvs(start: number, vertices: number[], uvs: number[], texture?: Texture2D, textureTransform?: Transform2D): void;
@@ -1767,7 +1767,6 @@ declare class CanvasItem extends TimelineNode {
1767
1767
  protected _globalOpacity?: number;
1768
1768
  get globalOpacity(): number;
1769
1769
  protected _modulate: Color;
1770
- protected _backgroundImage?: Texture2D;
1771
1770
  context: CanvasContext;
1772
1771
  protected _resetContext: boolean;
1773
1772
  protected _redrawing: boolean;
@@ -1858,6 +1857,7 @@ declare class BaseElement2DFill extends CoreObject {
1858
1857
  dpi?: number;
1859
1858
  rotateWithShape?: boolean;
1860
1859
  tile?: ImageFillTile;
1860
+ stretch?: ImageFillStretch;
1861
1861
  protected _image?: Texture2D<ImageBitmap>;
1862
1862
  constructor(parent: BaseElement2D, properties?: Partial<BaseElement2DFillProperties>);
1863
1863
  protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
@@ -1867,12 +1867,7 @@ declare class BaseElement2DFill extends CoreObject {
1867
1867
  draw(): void;
1868
1868
  }
1869
1869
 
1870
- interface BaseElement2DGeometryProperties {
1871
- name?: string;
1872
- svg?: string;
1873
- viewBox?: number[];
1874
- data?: Path2DDeclaration[];
1875
- }
1870
+ type BaseElement2DGeometryProperties = GeometryDeclaration;
1876
1871
  declare class BaseElement2DGeometry extends CoreObject {
1877
1872
  parent: BaseElement2D;
1878
1873
  name?: string;
@@ -1884,6 +1879,7 @@ declare class BaseElement2DGeometry extends CoreObject {
1884
1879
  protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
1885
1880
  protected _updatePath2DSet(): void;
1886
1881
  draw(): void;
1882
+ drawRect(): void;
1887
1883
  }
1888
1884
 
1889
1885
  type BaseElement2DOutlineProperties = OutlineDeclaration;
@@ -1940,7 +1936,7 @@ declare class BaseElement2DText extends CoreObject {
1940
1936
  fonts?: TextOptions['fonts'];
1941
1937
  constructor(parent: BaseElement2D, properties?: Partial<BaseElement2DTextProperties>);
1942
1938
  texture: CanvasTexture;
1943
- text: Text;
1939
+ baseText: Text;
1944
1940
  measureResult?: MeasureResult;
1945
1941
  protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
1946
1942
  protected _updateText(): void;
@@ -2015,20 +2011,12 @@ declare class BaseElement2D extends Node2D implements Rectangulable {
2015
2011
  setProperties(properties?: Record<PropertyKey, any>): this;
2016
2012
  protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
2017
2013
  protected _updateMaskImage(): void;
2018
- protected _updateBackgroundColor(): void;
2019
- protected _updateBackgroundImage(): Promise<void>;
2020
2014
  protected _updateTransform(): void;
2021
2015
  protected _updateGlobalTransform(): void;
2022
2016
  getRect(): Rect2;
2023
2017
  protected _updateOverflow(): void;
2024
2018
  protected _draw(): void;
2025
- protected _drawBackground(): void;
2026
2019
  protected _drawContent(): void;
2027
- protected _drawBorder(): void;
2028
- protected _drawOutline(): void;
2029
- protected _drawBoundingRect(): void;
2030
- protected _fillBoundingRect(): void;
2031
- protected _strokeBoundingRect(): void;
2032
2020
  protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
2033
2021
  canPointerEvents(): boolean;
2034
2022
  input(event: InputEvent, key: InputEventKey): void;