modern-canvas 0.1.0 → 0.1.1

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.cts CHANGED
@@ -1878,12 +1878,12 @@ interface Style2DBackgroundProperties {
1878
1878
  backgroundImage?: string;
1879
1879
  }
1880
1880
  interface Style2DBackgroundExtend extends Style2DBackgroundProperties {
1881
- getComputedBackground: typeof getComputedBackground;
1881
+ getComputedBackgroundImage: typeof getComputedBackgroundImage;
1882
1882
  }
1883
1883
  declare class Style2DBackgroundModule extends Style2DModule {
1884
1884
  install(Style2D: new () => Style2D): void;
1885
1885
  }
1886
- declare function getComputedBackground(this: Style2D): Promise<ColorTexture | undefined>;
1886
+ declare function getComputedBackgroundImage(this: Style2D): Promise<Texture<ImageBitmap> | undefined>;
1887
1887
 
1888
1888
  type Style2DFilterKey = 'hue-rotate' | 'saturate' | 'brightness' | 'contrast' | 'invert' | 'sepia' | 'opacity' | 'grayscale';
1889
1889
  type Style2DFilter = Record<Style2DFilterKey, number>;
@@ -1983,11 +1983,12 @@ declare class CanvasItem extends Node {
1983
1983
  protected _parentOpacity?: number;
1984
1984
  protected _tint: Color;
1985
1985
  protected _backgroundColor: Color;
1986
+ protected _backgroundImage?: Texture;
1986
1987
  context: CanvasContext;
1987
1988
  protected _resetContext: boolean;
1988
- protected _waitingRedraw: boolean;
1989
- protected _waitingReflow: boolean;
1990
- protected _waitingRepaint: boolean;
1989
+ protected _redrawing: boolean;
1990
+ protected _reflowing: boolean;
1991
+ protected _repainting: boolean;
1991
1992
  protected _originalBatchables: CanvasBatchable[];
1992
1993
  protected _layoutedBatchables: CanvasBatchable[];
1993
1994
  protected _batchables: CanvasBatchable[];
@@ -1995,6 +1996,8 @@ declare class CanvasItem extends Node {
1995
1996
  setProperties(properties?: Record<PropertyKey, any>): this;
1996
1997
  protected _onUpdateProperty(key: PropertyKey, newValue: any, oldValue: any, declaration?: PropertyDeclaration): void;
1997
1998
  protected _onUpdateStyleProperty(key: PropertyKey, newValue: any, oldValue: any, declaration?: PropertyDeclaration): void;
1999
+ protected _updateBackgroundColor(): void;
2000
+ protected _updateBackgroundImage(): Promise<void>;
1998
2001
  protected _updateOpacity(): void;
1999
2002
  isVisible(): boolean;
2000
2003
  requestRedraw(): void;
@@ -2002,6 +2005,9 @@ declare class CanvasItem extends Node {
2002
2005
  requestRepaint(): void;
2003
2006
  protected _process(delta: number): void;
2004
2007
  protected _draw(): void;
2008
+ protected _drawBackground(): void;
2009
+ protected _drawContent(): void;
2010
+ protected _fill(): void;
2005
2011
  protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
2006
2012
  protected _reflow(batchables: CanvasBatchable[]): CanvasBatchable[];
2007
2013
  protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
@@ -2018,29 +2024,13 @@ declare class Node2D extends CanvasItem {
2018
2024
  getBoundingBox(): Rectangle;
2019
2025
  protected _onUpdateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
2020
2026
  protected _updateTransform(): void;
2027
+ protected _updateOverflow(): void;
2021
2028
  protected _transformVertices(vertices: number[]): number[];
2022
2029
  protected _reflow(batchables: CanvasBatchable[]): CanvasBatchable[];
2023
2030
  protected _process(delta: number): void;
2024
2031
  input(event: UIEvent): void;
2025
2032
  }
2026
2033
 
2027
- interface Element2DOptions extends Node2DOptions {
2028
- draggable?: boolean;
2029
- }
2030
- declare class Element2D extends Node2D {
2031
- draggable?: boolean;
2032
- protected _background?: Texture;
2033
- constructor(options?: Element2DOptions);
2034
- protected _onUpdateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
2035
- protected _updateBackground(): Promise<void>;
2036
- protected _updateTransform(): void;
2037
- protected _updateOverflow(): void;
2038
- protected _draw(): void;
2039
- protected _drawBackground(): void;
2040
- protected _drawContent(): void;
2041
- protected _drawRect(): void;
2042
- }
2043
-
2044
2034
  declare class Graphics2D extends Node2D {
2045
2035
  protected _resetContext: boolean;
2046
2036
  lineCap?: LineCap;
@@ -2077,11 +2067,11 @@ declare class Image2DResource extends Resource {
2077
2067
  destroy(): void;
2078
2068
  }
2079
2069
 
2080
- interface Image2DOptions extends Element2DOptions {
2070
+ interface Image2DOptions extends Node2DOptions {
2081
2071
  src?: string;
2082
2072
  gif?: boolean;
2083
2073
  }
2084
- declare class Image2D extends Element2D {
2074
+ declare class Image2D extends Node2D {
2085
2075
  resource?: Image2DResource;
2086
2076
  gif: boolean;
2087
2077
  src: string;
@@ -2105,11 +2095,11 @@ declare class Image2D extends Element2D {
2105
2095
  protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
2106
2096
  }
2107
2097
 
2108
- interface LottieOptions extends Element2DOptions {
2098
+ interface LottieOptions extends Node2DOptions {
2109
2099
  pixelRatio?: number;
2110
2100
  src?: string;
2111
2101
  }
2112
- declare class Lottie2D extends Element2D {
2102
+ declare class Lottie2D extends Node2D {
2113
2103
  pixelRatio: number;
2114
2104
  src: string;
2115
2105
  duration: number;
@@ -2123,13 +2113,23 @@ declare class Lottie2D extends Element2D {
2123
2113
  protected _drawContent(): void;
2124
2114
  }
2125
2115
 
2126
- interface Text2DOptions extends Element2DOptions {
2116
+ interface Text2DOptions extends Node2DOptions {
2127
2117
  pixelRatio?: number;
2128
2118
  split?: boolean;
2129
2119
  content?: IDOCTextContent;
2130
2120
  effects?: Partial<IDOCStyleDeclaration>[];
2131
2121
  }
2132
- declare class Text2D extends Element2D {
2122
+ /**
2123
+ * @example
2124
+ *
2125
+ * new Text2D({
2126
+ * style: {
2127
+ * fontSize: 20,
2128
+ * },
2129
+ * content: 'Text2D',
2130
+ * })
2131
+ */
2132
+ declare class Text2D extends Node2D {
2133
2133
  pixelRatio: number;
2134
2134
  split: boolean;
2135
2135
  content: IDOCTextContent;
@@ -2146,10 +2146,10 @@ declare class Text2D extends Element2D {
2146
2146
  protected _drawContent(): void;
2147
2147
  }
2148
2148
 
2149
- interface Video2DOptions extends Element2DOptions {
2149
+ interface Video2DOptions extends Node2DOptions {
2150
2150
  src?: string;
2151
2151
  }
2152
- declare class Video2D extends Element2D {
2152
+ declare class Video2D extends Node2D {
2153
2153
  src: string;
2154
2154
  texture?: VideoTexture;
2155
2155
  get duration(): number;
@@ -2528,15 +2528,15 @@ declare class Audio extends Node {
2528
2528
  protected _setTimeStop(): void;
2529
2529
  }
2530
2530
 
2531
- declare class AudioSpectrum extends Element2D {
2531
+ declare class AudioSpectrum extends Node2D {
2532
2532
  }
2533
2533
 
2534
- interface AudioWaveformOptions extends Element2DOptions {
2534
+ interface AudioWaveformOptions extends Node2DOptions {
2535
2535
  src?: string;
2536
2536
  gap?: number;
2537
2537
  color?: string;
2538
2538
  }
2539
- declare class AudioWaveform extends Element2D {
2539
+ declare class AudioWaveform extends Node2D {
2540
2540
  src?: string;
2541
2541
  gap: number;
2542
2542
  color: string;
@@ -3112,4 +3112,4 @@ interface RenderOptions {
3112
3112
  }
3113
3113
  declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
3114
3114
 
3115
- export { Animation2D, type AnimationOptions, type AssetHandler, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, type AudioWaveformOptions, type Batchable2D, BlurEffect, Bounds, type BoundsData, type CanvasBatchable, CanvasContext, CanvasItem, type CanvasItemOptions, Circle, Color, ColorAdjustEffect, ColorFilterEffect, type ColorFilterEffectOptions, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, type ColorValue, type CssFunction, type CssFunctionArg, type Cursor, type CustomNodeOptions, DEG_TO_RAD, DEVICE_PIXEL_RATIO, type Easing, Effect, type EffectContext, EffectMaterial, type EffectMode, type EffectOptions, Element2D, type Element2DOptions, Ellipse, EmbossEffect, Engine, type EngineOptions, EventEmitter, type EventListener, type EventListenerOptions, type EventListenerValue, type FilledGraphics, FontLoader, Geometry, type GeometryOptions, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, type IAudioContext, type IAudioNode, IN_BROWSER, type IPlayOptions, Image2D, type Image2DOptions, Image2DResource, type ImageFrame, ImageTexture, type ImageTextureOptions, IndexBuffer, type IndexBufferOptions, Input, InternalMode, JsonLoader, KawaseEffect, type Keyframe, LeftEraseEffect, type LineCap, type LineJoin, type LineStyle, Loader, Lottie2D, LottieLoader, type LottieOptions, MainLoop, type MainLoopEventMap, type MaskColor, type MaskData, MaskEffect, type MaskEffectOptions, type MaskObject, type MaskRect, type Maskable, Material, type MaterialOptions, Matrix, Matrix2, Matrix3, Matrix4, type MatrixLike, type MatrixOperateOutput, MouseInputEvent, Node, Node2D, type Node2DOptions, type NodeEventMap, type NodeOptions, type NormalizedKeyframe, PI, PI_2, Path2D, type Path2DCall, type Path2DCallMethod, type Path2DShape, PixelateEffect, PixelsTexture, type PlatformAudio, type PlatformSound, Point, type PointData, type PointLike, PointerInputEvent, Polygon, Projection2D, type PropertyDeclaration, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Rectangle, Reference, type ReferenceEventMap, type RenderCall, type RenderOptions, RenderStack, type Renderable, Renderer, Resource, type ResourceEventMap, RoundedRectangle, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SVGPath, type SVGPathDefine, type SVGPathDefineCommand, SceneTree, type SceneTreeEventMap, type Shape, type ShapeBuildCommand, Star, type StrokedGraphics, Style2D, type Style2DBackgroundExtend, Style2DBackgroundModule, type Style2DBackgroundProperties, type Style2DFilter, type Style2DFilterExtend, type Style2DFilterKey, Style2DFilterModule, type Style2DFilterProperties, Style2DModule, type Style2DOffsetExtend, Style2DOffsetModule, type Style2DOffsetProperties, type Style2DOptions, type Style2DTextExtend, Style2DTextModule, type Style2DTextProperties, type Style2DTransformExtend, Style2DTransformModule, type Style2DTransformProperties, Text2D, type Text2DOptions, TextLoader, Texture, type TextureFilterMode, TextureLoader, type TexturePixelsSource, type TextureSource, type TextureWrapMode, Ticker, TiltShiftEffect, Timer, type TimerEventMap, type TimerOptions, type TimingFunctions, Transform2D, type Transform2DObject, Triangle, TwistEffect, UIInputEvent, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, type VectorLike, type VectorOperateOutput, VertexAttribute, type VertexAttributeOptions, VertexBuffer, type VertexBufferOptions, Video2D, type Video2DOptions, VideoLoader, VideoTexture, type VideoTextureOptions, type VideoTextureSource, Viewport, type ViewportFramebuffer, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, type WebGLBufferMeta, WebGLBufferModule, type WebGLBufferOptions, type WebGLBufferTarget, type WebGLBufferUsage, type WebGLDrawMode, type WebGLDrawOptions, type WebGLExtensions, type WebGLFramebufferMeta, WebGLFramebufferModule, type WebGLFramebufferOptions, WebGLMaskModule, WebGLModule, type WebGLProgramMeta, WebGLProgramModule, type WebGLProgramOptions, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, type WebGLTarget, type WebGLTextureFilterMode, type WebGLTextureLocation, type WebGLTextureMeta, WebGLTextureModule, type WebGLTextureOptions, type WebGLTextureSource, type WebGLTextureTarget, type WebGLTextureWrapMode, WebGLVertexArrayModule, type WebGLVertexArrayObjectMeta, type WebGLVertexArrayObjectOptions, type WebGLVertexAttrib, type WebGLVertexAttribType, type WebGLViewport, WebGLViewportModule, WebSound, WheelInputEvent, ZoomBlurEffect, _Object, type _ObjectEventMap, assets, buildAdaptiveBezier, buildAdaptiveQuadratic, buildArc, buildArcTo, buildArcToSvg, buildCircle, buildLine, buildPolygon, buildRectangle, buildTriangle, clamp, closePointEps, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curveEps, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, squaredDistanceToLineSegment, timingFunctions, uid };
3115
+ export { Animation2D, type AnimationOptions, type AssetHandler, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, type AudioWaveformOptions, type Batchable2D, BlurEffect, Bounds, type BoundsData, type CanvasBatchable, CanvasContext, CanvasItem, type CanvasItemOptions, Circle, Color, ColorAdjustEffect, ColorFilterEffect, type ColorFilterEffectOptions, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, type ColorValue, type CssFunction, type CssFunctionArg, type Cursor, type CustomNodeOptions, DEG_TO_RAD, DEVICE_PIXEL_RATIO, type Easing, Effect, type EffectContext, EffectMaterial, type EffectMode, type EffectOptions, Ellipse, EmbossEffect, Engine, type EngineOptions, EventEmitter, type EventListener, type EventListenerOptions, type EventListenerValue, type FilledGraphics, FontLoader, Geometry, type GeometryOptions, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, type IAudioContext, type IAudioNode, IN_BROWSER, type IPlayOptions, Image2D, type Image2DOptions, Image2DResource, type ImageFrame, ImageTexture, type ImageTextureOptions, IndexBuffer, type IndexBufferOptions, Input, InternalMode, JsonLoader, KawaseEffect, type Keyframe, LeftEraseEffect, type LineCap, type LineJoin, type LineStyle, Loader, Lottie2D, LottieLoader, type LottieOptions, MainLoop, type MainLoopEventMap, type MaskColor, type MaskData, MaskEffect, type MaskEffectOptions, type MaskObject, type MaskRect, type Maskable, Material, type MaterialOptions, Matrix, Matrix2, Matrix3, Matrix4, type MatrixLike, type MatrixOperateOutput, MouseInputEvent, Node, Node2D, type Node2DOptions, type NodeEventMap, type NodeOptions, type NormalizedKeyframe, PI, PI_2, Path2D, type Path2DCall, type Path2DCallMethod, type Path2DShape, PixelateEffect, PixelsTexture, type PlatformAudio, type PlatformSound, Point, type PointData, type PointLike, PointerInputEvent, Polygon, Projection2D, type PropertyDeclaration, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Rectangle, Reference, type ReferenceEventMap, type RenderCall, type RenderOptions, RenderStack, type Renderable, Renderer, Resource, type ResourceEventMap, RoundedRectangle, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SVGPath, type SVGPathDefine, type SVGPathDefineCommand, SceneTree, type SceneTreeEventMap, type Shape, type ShapeBuildCommand, Star, type StrokedGraphics, Style2D, type Style2DBackgroundExtend, Style2DBackgroundModule, type Style2DBackgroundProperties, type Style2DFilter, type Style2DFilterExtend, type Style2DFilterKey, Style2DFilterModule, type Style2DFilterProperties, Style2DModule, type Style2DOffsetExtend, Style2DOffsetModule, type Style2DOffsetProperties, type Style2DOptions, type Style2DTextExtend, Style2DTextModule, type Style2DTextProperties, type Style2DTransformExtend, Style2DTransformModule, type Style2DTransformProperties, Text2D, type Text2DOptions, TextLoader, Texture, type TextureFilterMode, TextureLoader, type TexturePixelsSource, type TextureSource, type TextureWrapMode, Ticker, TiltShiftEffect, Timer, type TimerEventMap, type TimerOptions, type TimingFunctions, Transform2D, type Transform2DObject, Triangle, TwistEffect, UIInputEvent, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, type VectorLike, type VectorOperateOutput, VertexAttribute, type VertexAttributeOptions, VertexBuffer, type VertexBufferOptions, Video2D, type Video2DOptions, VideoLoader, VideoTexture, type VideoTextureOptions, type VideoTextureSource, Viewport, type ViewportFramebuffer, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, type WebGLBufferMeta, WebGLBufferModule, type WebGLBufferOptions, type WebGLBufferTarget, type WebGLBufferUsage, type WebGLDrawMode, type WebGLDrawOptions, type WebGLExtensions, type WebGLFramebufferMeta, WebGLFramebufferModule, type WebGLFramebufferOptions, WebGLMaskModule, WebGLModule, type WebGLProgramMeta, WebGLProgramModule, type WebGLProgramOptions, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, type WebGLTarget, type WebGLTextureFilterMode, type WebGLTextureLocation, type WebGLTextureMeta, WebGLTextureModule, type WebGLTextureOptions, type WebGLTextureSource, type WebGLTextureTarget, type WebGLTextureWrapMode, WebGLVertexArrayModule, type WebGLVertexArrayObjectMeta, type WebGLVertexArrayObjectOptions, type WebGLVertexAttrib, type WebGLVertexAttribType, type WebGLViewport, WebGLViewportModule, WebSound, WheelInputEvent, ZoomBlurEffect, _Object, type _ObjectEventMap, assets, buildAdaptiveBezier, buildAdaptiveQuadratic, buildArc, buildArcTo, buildArcToSvg, buildCircle, buildLine, buildPolygon, buildRectangle, buildTriangle, clamp, closePointEps, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curveEps, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, squaredDistanceToLineSegment, timingFunctions, uid };
package/dist/index.d.mts CHANGED
@@ -1878,12 +1878,12 @@ interface Style2DBackgroundProperties {
1878
1878
  backgroundImage?: string;
1879
1879
  }
1880
1880
  interface Style2DBackgroundExtend extends Style2DBackgroundProperties {
1881
- getComputedBackground: typeof getComputedBackground;
1881
+ getComputedBackgroundImage: typeof getComputedBackgroundImage;
1882
1882
  }
1883
1883
  declare class Style2DBackgroundModule extends Style2DModule {
1884
1884
  install(Style2D: new () => Style2D): void;
1885
1885
  }
1886
- declare function getComputedBackground(this: Style2D): Promise<ColorTexture | undefined>;
1886
+ declare function getComputedBackgroundImage(this: Style2D): Promise<Texture<ImageBitmap> | undefined>;
1887
1887
 
1888
1888
  type Style2DFilterKey = 'hue-rotate' | 'saturate' | 'brightness' | 'contrast' | 'invert' | 'sepia' | 'opacity' | 'grayscale';
1889
1889
  type Style2DFilter = Record<Style2DFilterKey, number>;
@@ -1983,11 +1983,12 @@ declare class CanvasItem extends Node {
1983
1983
  protected _parentOpacity?: number;
1984
1984
  protected _tint: Color;
1985
1985
  protected _backgroundColor: Color;
1986
+ protected _backgroundImage?: Texture;
1986
1987
  context: CanvasContext;
1987
1988
  protected _resetContext: boolean;
1988
- protected _waitingRedraw: boolean;
1989
- protected _waitingReflow: boolean;
1990
- protected _waitingRepaint: boolean;
1989
+ protected _redrawing: boolean;
1990
+ protected _reflowing: boolean;
1991
+ protected _repainting: boolean;
1991
1992
  protected _originalBatchables: CanvasBatchable[];
1992
1993
  protected _layoutedBatchables: CanvasBatchable[];
1993
1994
  protected _batchables: CanvasBatchable[];
@@ -1995,6 +1996,8 @@ declare class CanvasItem extends Node {
1995
1996
  setProperties(properties?: Record<PropertyKey, any>): this;
1996
1997
  protected _onUpdateProperty(key: PropertyKey, newValue: any, oldValue: any, declaration?: PropertyDeclaration): void;
1997
1998
  protected _onUpdateStyleProperty(key: PropertyKey, newValue: any, oldValue: any, declaration?: PropertyDeclaration): void;
1999
+ protected _updateBackgroundColor(): void;
2000
+ protected _updateBackgroundImage(): Promise<void>;
1998
2001
  protected _updateOpacity(): void;
1999
2002
  isVisible(): boolean;
2000
2003
  requestRedraw(): void;
@@ -2002,6 +2005,9 @@ declare class CanvasItem extends Node {
2002
2005
  requestRepaint(): void;
2003
2006
  protected _process(delta: number): void;
2004
2007
  protected _draw(): void;
2008
+ protected _drawBackground(): void;
2009
+ protected _drawContent(): void;
2010
+ protected _fill(): void;
2005
2011
  protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
2006
2012
  protected _reflow(batchables: CanvasBatchable[]): CanvasBatchable[];
2007
2013
  protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
@@ -2018,29 +2024,13 @@ declare class Node2D extends CanvasItem {
2018
2024
  getBoundingBox(): Rectangle;
2019
2025
  protected _onUpdateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
2020
2026
  protected _updateTransform(): void;
2027
+ protected _updateOverflow(): void;
2021
2028
  protected _transformVertices(vertices: number[]): number[];
2022
2029
  protected _reflow(batchables: CanvasBatchable[]): CanvasBatchable[];
2023
2030
  protected _process(delta: number): void;
2024
2031
  input(event: UIEvent): void;
2025
2032
  }
2026
2033
 
2027
- interface Element2DOptions extends Node2DOptions {
2028
- draggable?: boolean;
2029
- }
2030
- declare class Element2D extends Node2D {
2031
- draggable?: boolean;
2032
- protected _background?: Texture;
2033
- constructor(options?: Element2DOptions);
2034
- protected _onUpdateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
2035
- protected _updateBackground(): Promise<void>;
2036
- protected _updateTransform(): void;
2037
- protected _updateOverflow(): void;
2038
- protected _draw(): void;
2039
- protected _drawBackground(): void;
2040
- protected _drawContent(): void;
2041
- protected _drawRect(): void;
2042
- }
2043
-
2044
2034
  declare class Graphics2D extends Node2D {
2045
2035
  protected _resetContext: boolean;
2046
2036
  lineCap?: LineCap;
@@ -2077,11 +2067,11 @@ declare class Image2DResource extends Resource {
2077
2067
  destroy(): void;
2078
2068
  }
2079
2069
 
2080
- interface Image2DOptions extends Element2DOptions {
2070
+ interface Image2DOptions extends Node2DOptions {
2081
2071
  src?: string;
2082
2072
  gif?: boolean;
2083
2073
  }
2084
- declare class Image2D extends Element2D {
2074
+ declare class Image2D extends Node2D {
2085
2075
  resource?: Image2DResource;
2086
2076
  gif: boolean;
2087
2077
  src: string;
@@ -2105,11 +2095,11 @@ declare class Image2D extends Element2D {
2105
2095
  protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
2106
2096
  }
2107
2097
 
2108
- interface LottieOptions extends Element2DOptions {
2098
+ interface LottieOptions extends Node2DOptions {
2109
2099
  pixelRatio?: number;
2110
2100
  src?: string;
2111
2101
  }
2112
- declare class Lottie2D extends Element2D {
2102
+ declare class Lottie2D extends Node2D {
2113
2103
  pixelRatio: number;
2114
2104
  src: string;
2115
2105
  duration: number;
@@ -2123,13 +2113,23 @@ declare class Lottie2D extends Element2D {
2123
2113
  protected _drawContent(): void;
2124
2114
  }
2125
2115
 
2126
- interface Text2DOptions extends Element2DOptions {
2116
+ interface Text2DOptions extends Node2DOptions {
2127
2117
  pixelRatio?: number;
2128
2118
  split?: boolean;
2129
2119
  content?: IDOCTextContent;
2130
2120
  effects?: Partial<IDOCStyleDeclaration>[];
2131
2121
  }
2132
- declare class Text2D extends Element2D {
2122
+ /**
2123
+ * @example
2124
+ *
2125
+ * new Text2D({
2126
+ * style: {
2127
+ * fontSize: 20,
2128
+ * },
2129
+ * content: 'Text2D',
2130
+ * })
2131
+ */
2132
+ declare class Text2D extends Node2D {
2133
2133
  pixelRatio: number;
2134
2134
  split: boolean;
2135
2135
  content: IDOCTextContent;
@@ -2146,10 +2146,10 @@ declare class Text2D extends Element2D {
2146
2146
  protected _drawContent(): void;
2147
2147
  }
2148
2148
 
2149
- interface Video2DOptions extends Element2DOptions {
2149
+ interface Video2DOptions extends Node2DOptions {
2150
2150
  src?: string;
2151
2151
  }
2152
- declare class Video2D extends Element2D {
2152
+ declare class Video2D extends Node2D {
2153
2153
  src: string;
2154
2154
  texture?: VideoTexture;
2155
2155
  get duration(): number;
@@ -2528,15 +2528,15 @@ declare class Audio extends Node {
2528
2528
  protected _setTimeStop(): void;
2529
2529
  }
2530
2530
 
2531
- declare class AudioSpectrum extends Element2D {
2531
+ declare class AudioSpectrum extends Node2D {
2532
2532
  }
2533
2533
 
2534
- interface AudioWaveformOptions extends Element2DOptions {
2534
+ interface AudioWaveformOptions extends Node2DOptions {
2535
2535
  src?: string;
2536
2536
  gap?: number;
2537
2537
  color?: string;
2538
2538
  }
2539
- declare class AudioWaveform extends Element2D {
2539
+ declare class AudioWaveform extends Node2D {
2540
2540
  src?: string;
2541
2541
  gap: number;
2542
2542
  color: string;
@@ -3112,4 +3112,4 @@ interface RenderOptions {
3112
3112
  }
3113
3113
  declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
3114
3114
 
3115
- export { Animation2D, type AnimationOptions, type AssetHandler, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, type AudioWaveformOptions, type Batchable2D, BlurEffect, Bounds, type BoundsData, type CanvasBatchable, CanvasContext, CanvasItem, type CanvasItemOptions, Circle, Color, ColorAdjustEffect, ColorFilterEffect, type ColorFilterEffectOptions, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, type ColorValue, type CssFunction, type CssFunctionArg, type Cursor, type CustomNodeOptions, DEG_TO_RAD, DEVICE_PIXEL_RATIO, type Easing, Effect, type EffectContext, EffectMaterial, type EffectMode, type EffectOptions, Element2D, type Element2DOptions, Ellipse, EmbossEffect, Engine, type EngineOptions, EventEmitter, type EventListener, type EventListenerOptions, type EventListenerValue, type FilledGraphics, FontLoader, Geometry, type GeometryOptions, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, type IAudioContext, type IAudioNode, IN_BROWSER, type IPlayOptions, Image2D, type Image2DOptions, Image2DResource, type ImageFrame, ImageTexture, type ImageTextureOptions, IndexBuffer, type IndexBufferOptions, Input, InternalMode, JsonLoader, KawaseEffect, type Keyframe, LeftEraseEffect, type LineCap, type LineJoin, type LineStyle, Loader, Lottie2D, LottieLoader, type LottieOptions, MainLoop, type MainLoopEventMap, type MaskColor, type MaskData, MaskEffect, type MaskEffectOptions, type MaskObject, type MaskRect, type Maskable, Material, type MaterialOptions, Matrix, Matrix2, Matrix3, Matrix4, type MatrixLike, type MatrixOperateOutput, MouseInputEvent, Node, Node2D, type Node2DOptions, type NodeEventMap, type NodeOptions, type NormalizedKeyframe, PI, PI_2, Path2D, type Path2DCall, type Path2DCallMethod, type Path2DShape, PixelateEffect, PixelsTexture, type PlatformAudio, type PlatformSound, Point, type PointData, type PointLike, PointerInputEvent, Polygon, Projection2D, type PropertyDeclaration, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Rectangle, Reference, type ReferenceEventMap, type RenderCall, type RenderOptions, RenderStack, type Renderable, Renderer, Resource, type ResourceEventMap, RoundedRectangle, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SVGPath, type SVGPathDefine, type SVGPathDefineCommand, SceneTree, type SceneTreeEventMap, type Shape, type ShapeBuildCommand, Star, type StrokedGraphics, Style2D, type Style2DBackgroundExtend, Style2DBackgroundModule, type Style2DBackgroundProperties, type Style2DFilter, type Style2DFilterExtend, type Style2DFilterKey, Style2DFilterModule, type Style2DFilterProperties, Style2DModule, type Style2DOffsetExtend, Style2DOffsetModule, type Style2DOffsetProperties, type Style2DOptions, type Style2DTextExtend, Style2DTextModule, type Style2DTextProperties, type Style2DTransformExtend, Style2DTransformModule, type Style2DTransformProperties, Text2D, type Text2DOptions, TextLoader, Texture, type TextureFilterMode, TextureLoader, type TexturePixelsSource, type TextureSource, type TextureWrapMode, Ticker, TiltShiftEffect, Timer, type TimerEventMap, type TimerOptions, type TimingFunctions, Transform2D, type Transform2DObject, Triangle, TwistEffect, UIInputEvent, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, type VectorLike, type VectorOperateOutput, VertexAttribute, type VertexAttributeOptions, VertexBuffer, type VertexBufferOptions, Video2D, type Video2DOptions, VideoLoader, VideoTexture, type VideoTextureOptions, type VideoTextureSource, Viewport, type ViewportFramebuffer, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, type WebGLBufferMeta, WebGLBufferModule, type WebGLBufferOptions, type WebGLBufferTarget, type WebGLBufferUsage, type WebGLDrawMode, type WebGLDrawOptions, type WebGLExtensions, type WebGLFramebufferMeta, WebGLFramebufferModule, type WebGLFramebufferOptions, WebGLMaskModule, WebGLModule, type WebGLProgramMeta, WebGLProgramModule, type WebGLProgramOptions, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, type WebGLTarget, type WebGLTextureFilterMode, type WebGLTextureLocation, type WebGLTextureMeta, WebGLTextureModule, type WebGLTextureOptions, type WebGLTextureSource, type WebGLTextureTarget, type WebGLTextureWrapMode, WebGLVertexArrayModule, type WebGLVertexArrayObjectMeta, type WebGLVertexArrayObjectOptions, type WebGLVertexAttrib, type WebGLVertexAttribType, type WebGLViewport, WebGLViewportModule, WebSound, WheelInputEvent, ZoomBlurEffect, _Object, type _ObjectEventMap, assets, buildAdaptiveBezier, buildAdaptiveQuadratic, buildArc, buildArcTo, buildArcToSvg, buildCircle, buildLine, buildPolygon, buildRectangle, buildTriangle, clamp, closePointEps, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curveEps, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, squaredDistanceToLineSegment, timingFunctions, uid };
3115
+ export { Animation2D, type AnimationOptions, type AssetHandler, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, type AudioWaveformOptions, type Batchable2D, BlurEffect, Bounds, type BoundsData, type CanvasBatchable, CanvasContext, CanvasItem, type CanvasItemOptions, Circle, Color, ColorAdjustEffect, ColorFilterEffect, type ColorFilterEffectOptions, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, type ColorValue, type CssFunction, type CssFunctionArg, type Cursor, type CustomNodeOptions, DEG_TO_RAD, DEVICE_PIXEL_RATIO, type Easing, Effect, type EffectContext, EffectMaterial, type EffectMode, type EffectOptions, Ellipse, EmbossEffect, Engine, type EngineOptions, EventEmitter, type EventListener, type EventListenerOptions, type EventListenerValue, type FilledGraphics, FontLoader, Geometry, type GeometryOptions, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, type IAudioContext, type IAudioNode, IN_BROWSER, type IPlayOptions, Image2D, type Image2DOptions, Image2DResource, type ImageFrame, ImageTexture, type ImageTextureOptions, IndexBuffer, type IndexBufferOptions, Input, InternalMode, JsonLoader, KawaseEffect, type Keyframe, LeftEraseEffect, type LineCap, type LineJoin, type LineStyle, Loader, Lottie2D, LottieLoader, type LottieOptions, MainLoop, type MainLoopEventMap, type MaskColor, type MaskData, MaskEffect, type MaskEffectOptions, type MaskObject, type MaskRect, type Maskable, Material, type MaterialOptions, Matrix, Matrix2, Matrix3, Matrix4, type MatrixLike, type MatrixOperateOutput, MouseInputEvent, Node, Node2D, type Node2DOptions, type NodeEventMap, type NodeOptions, type NormalizedKeyframe, PI, PI_2, Path2D, type Path2DCall, type Path2DCallMethod, type Path2DShape, PixelateEffect, PixelsTexture, type PlatformAudio, type PlatformSound, Point, type PointData, type PointLike, PointerInputEvent, Polygon, Projection2D, type PropertyDeclaration, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Rectangle, Reference, type ReferenceEventMap, type RenderCall, type RenderOptions, RenderStack, type Renderable, Renderer, Resource, type ResourceEventMap, RoundedRectangle, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SVGPath, type SVGPathDefine, type SVGPathDefineCommand, SceneTree, type SceneTreeEventMap, type Shape, type ShapeBuildCommand, Star, type StrokedGraphics, Style2D, type Style2DBackgroundExtend, Style2DBackgroundModule, type Style2DBackgroundProperties, type Style2DFilter, type Style2DFilterExtend, type Style2DFilterKey, Style2DFilterModule, type Style2DFilterProperties, Style2DModule, type Style2DOffsetExtend, Style2DOffsetModule, type Style2DOffsetProperties, type Style2DOptions, type Style2DTextExtend, Style2DTextModule, type Style2DTextProperties, type Style2DTransformExtend, Style2DTransformModule, type Style2DTransformProperties, Text2D, type Text2DOptions, TextLoader, Texture, type TextureFilterMode, TextureLoader, type TexturePixelsSource, type TextureSource, type TextureWrapMode, Ticker, TiltShiftEffect, Timer, type TimerEventMap, type TimerOptions, type TimingFunctions, Transform2D, type Transform2DObject, Triangle, TwistEffect, UIInputEvent, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, type VectorLike, type VectorOperateOutput, VertexAttribute, type VertexAttributeOptions, VertexBuffer, type VertexBufferOptions, Video2D, type Video2DOptions, VideoLoader, VideoTexture, type VideoTextureOptions, type VideoTextureSource, Viewport, type ViewportFramebuffer, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, type WebGLBufferMeta, WebGLBufferModule, type WebGLBufferOptions, type WebGLBufferTarget, type WebGLBufferUsage, type WebGLDrawMode, type WebGLDrawOptions, type WebGLExtensions, type WebGLFramebufferMeta, WebGLFramebufferModule, type WebGLFramebufferOptions, WebGLMaskModule, WebGLModule, type WebGLProgramMeta, WebGLProgramModule, type WebGLProgramOptions, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, type WebGLTarget, type WebGLTextureFilterMode, type WebGLTextureLocation, type WebGLTextureMeta, WebGLTextureModule, type WebGLTextureOptions, type WebGLTextureSource, type WebGLTextureTarget, type WebGLTextureWrapMode, WebGLVertexArrayModule, type WebGLVertexArrayObjectMeta, type WebGLVertexArrayObjectOptions, type WebGLVertexAttrib, type WebGLVertexAttribType, type WebGLViewport, WebGLViewportModule, WebSound, WheelInputEvent, ZoomBlurEffect, _Object, type _ObjectEventMap, assets, buildAdaptiveBezier, buildAdaptiveQuadratic, buildArc, buildArcTo, buildArcToSvg, buildCircle, buildLine, buildPolygon, buildRectangle, buildTriangle, clamp, closePointEps, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curveEps, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, squaredDistanceToLineSegment, timingFunctions, uid };
package/dist/index.d.ts CHANGED
@@ -1878,12 +1878,12 @@ interface Style2DBackgroundProperties {
1878
1878
  backgroundImage?: string;
1879
1879
  }
1880
1880
  interface Style2DBackgroundExtend extends Style2DBackgroundProperties {
1881
- getComputedBackground: typeof getComputedBackground;
1881
+ getComputedBackgroundImage: typeof getComputedBackgroundImage;
1882
1882
  }
1883
1883
  declare class Style2DBackgroundModule extends Style2DModule {
1884
1884
  install(Style2D: new () => Style2D): void;
1885
1885
  }
1886
- declare function getComputedBackground(this: Style2D): Promise<ColorTexture | undefined>;
1886
+ declare function getComputedBackgroundImage(this: Style2D): Promise<Texture<ImageBitmap> | undefined>;
1887
1887
 
1888
1888
  type Style2DFilterKey = 'hue-rotate' | 'saturate' | 'brightness' | 'contrast' | 'invert' | 'sepia' | 'opacity' | 'grayscale';
1889
1889
  type Style2DFilter = Record<Style2DFilterKey, number>;
@@ -1983,11 +1983,12 @@ declare class CanvasItem extends Node {
1983
1983
  protected _parentOpacity?: number;
1984
1984
  protected _tint: Color;
1985
1985
  protected _backgroundColor: Color;
1986
+ protected _backgroundImage?: Texture;
1986
1987
  context: CanvasContext;
1987
1988
  protected _resetContext: boolean;
1988
- protected _waitingRedraw: boolean;
1989
- protected _waitingReflow: boolean;
1990
- protected _waitingRepaint: boolean;
1989
+ protected _redrawing: boolean;
1990
+ protected _reflowing: boolean;
1991
+ protected _repainting: boolean;
1991
1992
  protected _originalBatchables: CanvasBatchable[];
1992
1993
  protected _layoutedBatchables: CanvasBatchable[];
1993
1994
  protected _batchables: CanvasBatchable[];
@@ -1995,6 +1996,8 @@ declare class CanvasItem extends Node {
1995
1996
  setProperties(properties?: Record<PropertyKey, any>): this;
1996
1997
  protected _onUpdateProperty(key: PropertyKey, newValue: any, oldValue: any, declaration?: PropertyDeclaration): void;
1997
1998
  protected _onUpdateStyleProperty(key: PropertyKey, newValue: any, oldValue: any, declaration?: PropertyDeclaration): void;
1999
+ protected _updateBackgroundColor(): void;
2000
+ protected _updateBackgroundImage(): Promise<void>;
1998
2001
  protected _updateOpacity(): void;
1999
2002
  isVisible(): boolean;
2000
2003
  requestRedraw(): void;
@@ -2002,6 +2005,9 @@ declare class CanvasItem extends Node {
2002
2005
  requestRepaint(): void;
2003
2006
  protected _process(delta: number): void;
2004
2007
  protected _draw(): void;
2008
+ protected _drawBackground(): void;
2009
+ protected _drawContent(): void;
2010
+ protected _fill(): void;
2005
2011
  protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
2006
2012
  protected _reflow(batchables: CanvasBatchable[]): CanvasBatchable[];
2007
2013
  protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
@@ -2018,29 +2024,13 @@ declare class Node2D extends CanvasItem {
2018
2024
  getBoundingBox(): Rectangle;
2019
2025
  protected _onUpdateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
2020
2026
  protected _updateTransform(): void;
2027
+ protected _updateOverflow(): void;
2021
2028
  protected _transformVertices(vertices: number[]): number[];
2022
2029
  protected _reflow(batchables: CanvasBatchable[]): CanvasBatchable[];
2023
2030
  protected _process(delta: number): void;
2024
2031
  input(event: UIEvent): void;
2025
2032
  }
2026
2033
 
2027
- interface Element2DOptions extends Node2DOptions {
2028
- draggable?: boolean;
2029
- }
2030
- declare class Element2D extends Node2D {
2031
- draggable?: boolean;
2032
- protected _background?: Texture;
2033
- constructor(options?: Element2DOptions);
2034
- protected _onUpdateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
2035
- protected _updateBackground(): Promise<void>;
2036
- protected _updateTransform(): void;
2037
- protected _updateOverflow(): void;
2038
- protected _draw(): void;
2039
- protected _drawBackground(): void;
2040
- protected _drawContent(): void;
2041
- protected _drawRect(): void;
2042
- }
2043
-
2044
2034
  declare class Graphics2D extends Node2D {
2045
2035
  protected _resetContext: boolean;
2046
2036
  lineCap?: LineCap;
@@ -2077,11 +2067,11 @@ declare class Image2DResource extends Resource {
2077
2067
  destroy(): void;
2078
2068
  }
2079
2069
 
2080
- interface Image2DOptions extends Element2DOptions {
2070
+ interface Image2DOptions extends Node2DOptions {
2081
2071
  src?: string;
2082
2072
  gif?: boolean;
2083
2073
  }
2084
- declare class Image2D extends Element2D {
2074
+ declare class Image2D extends Node2D {
2085
2075
  resource?: Image2DResource;
2086
2076
  gif: boolean;
2087
2077
  src: string;
@@ -2105,11 +2095,11 @@ declare class Image2D extends Element2D {
2105
2095
  protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
2106
2096
  }
2107
2097
 
2108
- interface LottieOptions extends Element2DOptions {
2098
+ interface LottieOptions extends Node2DOptions {
2109
2099
  pixelRatio?: number;
2110
2100
  src?: string;
2111
2101
  }
2112
- declare class Lottie2D extends Element2D {
2102
+ declare class Lottie2D extends Node2D {
2113
2103
  pixelRatio: number;
2114
2104
  src: string;
2115
2105
  duration: number;
@@ -2123,13 +2113,23 @@ declare class Lottie2D extends Element2D {
2123
2113
  protected _drawContent(): void;
2124
2114
  }
2125
2115
 
2126
- interface Text2DOptions extends Element2DOptions {
2116
+ interface Text2DOptions extends Node2DOptions {
2127
2117
  pixelRatio?: number;
2128
2118
  split?: boolean;
2129
2119
  content?: IDOCTextContent;
2130
2120
  effects?: Partial<IDOCStyleDeclaration>[];
2131
2121
  }
2132
- declare class Text2D extends Element2D {
2122
+ /**
2123
+ * @example
2124
+ *
2125
+ * new Text2D({
2126
+ * style: {
2127
+ * fontSize: 20,
2128
+ * },
2129
+ * content: 'Text2D',
2130
+ * })
2131
+ */
2132
+ declare class Text2D extends Node2D {
2133
2133
  pixelRatio: number;
2134
2134
  split: boolean;
2135
2135
  content: IDOCTextContent;
@@ -2146,10 +2146,10 @@ declare class Text2D extends Element2D {
2146
2146
  protected _drawContent(): void;
2147
2147
  }
2148
2148
 
2149
- interface Video2DOptions extends Element2DOptions {
2149
+ interface Video2DOptions extends Node2DOptions {
2150
2150
  src?: string;
2151
2151
  }
2152
- declare class Video2D extends Element2D {
2152
+ declare class Video2D extends Node2D {
2153
2153
  src: string;
2154
2154
  texture?: VideoTexture;
2155
2155
  get duration(): number;
@@ -2528,15 +2528,15 @@ declare class Audio extends Node {
2528
2528
  protected _setTimeStop(): void;
2529
2529
  }
2530
2530
 
2531
- declare class AudioSpectrum extends Element2D {
2531
+ declare class AudioSpectrum extends Node2D {
2532
2532
  }
2533
2533
 
2534
- interface AudioWaveformOptions extends Element2DOptions {
2534
+ interface AudioWaveformOptions extends Node2DOptions {
2535
2535
  src?: string;
2536
2536
  gap?: number;
2537
2537
  color?: string;
2538
2538
  }
2539
- declare class AudioWaveform extends Element2D {
2539
+ declare class AudioWaveform extends Node2D {
2540
2540
  src?: string;
2541
2541
  gap: number;
2542
2542
  color: string;
@@ -3112,4 +3112,4 @@ interface RenderOptions {
3112
3112
  }
3113
3113
  declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
3114
3114
 
3115
- export { Animation2D, type AnimationOptions, type AssetHandler, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, type AudioWaveformOptions, type Batchable2D, BlurEffect, Bounds, type BoundsData, type CanvasBatchable, CanvasContext, CanvasItem, type CanvasItemOptions, Circle, Color, ColorAdjustEffect, ColorFilterEffect, type ColorFilterEffectOptions, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, type ColorValue, type CssFunction, type CssFunctionArg, type Cursor, type CustomNodeOptions, DEG_TO_RAD, DEVICE_PIXEL_RATIO, type Easing, Effect, type EffectContext, EffectMaterial, type EffectMode, type EffectOptions, Element2D, type Element2DOptions, Ellipse, EmbossEffect, Engine, type EngineOptions, EventEmitter, type EventListener, type EventListenerOptions, type EventListenerValue, type FilledGraphics, FontLoader, Geometry, type GeometryOptions, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, type IAudioContext, type IAudioNode, IN_BROWSER, type IPlayOptions, Image2D, type Image2DOptions, Image2DResource, type ImageFrame, ImageTexture, type ImageTextureOptions, IndexBuffer, type IndexBufferOptions, Input, InternalMode, JsonLoader, KawaseEffect, type Keyframe, LeftEraseEffect, type LineCap, type LineJoin, type LineStyle, Loader, Lottie2D, LottieLoader, type LottieOptions, MainLoop, type MainLoopEventMap, type MaskColor, type MaskData, MaskEffect, type MaskEffectOptions, type MaskObject, type MaskRect, type Maskable, Material, type MaterialOptions, Matrix, Matrix2, Matrix3, Matrix4, type MatrixLike, type MatrixOperateOutput, MouseInputEvent, Node, Node2D, type Node2DOptions, type NodeEventMap, type NodeOptions, type NormalizedKeyframe, PI, PI_2, Path2D, type Path2DCall, type Path2DCallMethod, type Path2DShape, PixelateEffect, PixelsTexture, type PlatformAudio, type PlatformSound, Point, type PointData, type PointLike, PointerInputEvent, Polygon, Projection2D, type PropertyDeclaration, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Rectangle, Reference, type ReferenceEventMap, type RenderCall, type RenderOptions, RenderStack, type Renderable, Renderer, Resource, type ResourceEventMap, RoundedRectangle, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SVGPath, type SVGPathDefine, type SVGPathDefineCommand, SceneTree, type SceneTreeEventMap, type Shape, type ShapeBuildCommand, Star, type StrokedGraphics, Style2D, type Style2DBackgroundExtend, Style2DBackgroundModule, type Style2DBackgroundProperties, type Style2DFilter, type Style2DFilterExtend, type Style2DFilterKey, Style2DFilterModule, type Style2DFilterProperties, Style2DModule, type Style2DOffsetExtend, Style2DOffsetModule, type Style2DOffsetProperties, type Style2DOptions, type Style2DTextExtend, Style2DTextModule, type Style2DTextProperties, type Style2DTransformExtend, Style2DTransformModule, type Style2DTransformProperties, Text2D, type Text2DOptions, TextLoader, Texture, type TextureFilterMode, TextureLoader, type TexturePixelsSource, type TextureSource, type TextureWrapMode, Ticker, TiltShiftEffect, Timer, type TimerEventMap, type TimerOptions, type TimingFunctions, Transform2D, type Transform2DObject, Triangle, TwistEffect, UIInputEvent, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, type VectorLike, type VectorOperateOutput, VertexAttribute, type VertexAttributeOptions, VertexBuffer, type VertexBufferOptions, Video2D, type Video2DOptions, VideoLoader, VideoTexture, type VideoTextureOptions, type VideoTextureSource, Viewport, type ViewportFramebuffer, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, type WebGLBufferMeta, WebGLBufferModule, type WebGLBufferOptions, type WebGLBufferTarget, type WebGLBufferUsage, type WebGLDrawMode, type WebGLDrawOptions, type WebGLExtensions, type WebGLFramebufferMeta, WebGLFramebufferModule, type WebGLFramebufferOptions, WebGLMaskModule, WebGLModule, type WebGLProgramMeta, WebGLProgramModule, type WebGLProgramOptions, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, type WebGLTarget, type WebGLTextureFilterMode, type WebGLTextureLocation, type WebGLTextureMeta, WebGLTextureModule, type WebGLTextureOptions, type WebGLTextureSource, type WebGLTextureTarget, type WebGLTextureWrapMode, WebGLVertexArrayModule, type WebGLVertexArrayObjectMeta, type WebGLVertexArrayObjectOptions, type WebGLVertexAttrib, type WebGLVertexAttribType, type WebGLViewport, WebGLViewportModule, WebSound, WheelInputEvent, ZoomBlurEffect, _Object, type _ObjectEventMap, assets, buildAdaptiveBezier, buildAdaptiveQuadratic, buildArc, buildArcTo, buildArcToSvg, buildCircle, buildLine, buildPolygon, buildRectangle, buildTriangle, clamp, closePointEps, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curveEps, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, squaredDistanceToLineSegment, timingFunctions, uid };
3115
+ export { Animation2D, type AnimationOptions, type AssetHandler, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, type AudioWaveformOptions, type Batchable2D, BlurEffect, Bounds, type BoundsData, type CanvasBatchable, CanvasContext, CanvasItem, type CanvasItemOptions, Circle, Color, ColorAdjustEffect, ColorFilterEffect, type ColorFilterEffectOptions, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, type ColorValue, type CssFunction, type CssFunctionArg, type Cursor, type CustomNodeOptions, DEG_TO_RAD, DEVICE_PIXEL_RATIO, type Easing, Effect, type EffectContext, EffectMaterial, type EffectMode, type EffectOptions, Ellipse, EmbossEffect, Engine, type EngineOptions, EventEmitter, type EventListener, type EventListenerOptions, type EventListenerValue, type FilledGraphics, FontLoader, Geometry, type GeometryOptions, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, type IAudioContext, type IAudioNode, IN_BROWSER, type IPlayOptions, Image2D, type Image2DOptions, Image2DResource, type ImageFrame, ImageTexture, type ImageTextureOptions, IndexBuffer, type IndexBufferOptions, Input, InternalMode, JsonLoader, KawaseEffect, type Keyframe, LeftEraseEffect, type LineCap, type LineJoin, type LineStyle, Loader, Lottie2D, LottieLoader, type LottieOptions, MainLoop, type MainLoopEventMap, type MaskColor, type MaskData, MaskEffect, type MaskEffectOptions, type MaskObject, type MaskRect, type Maskable, Material, type MaterialOptions, Matrix, Matrix2, Matrix3, Matrix4, type MatrixLike, type MatrixOperateOutput, MouseInputEvent, Node, Node2D, type Node2DOptions, type NodeEventMap, type NodeOptions, type NormalizedKeyframe, PI, PI_2, Path2D, type Path2DCall, type Path2DCallMethod, type Path2DShape, PixelateEffect, PixelsTexture, type PlatformAudio, type PlatformSound, Point, type PointData, type PointLike, PointerInputEvent, Polygon, Projection2D, type PropertyDeclaration, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Rectangle, Reference, type ReferenceEventMap, type RenderCall, type RenderOptions, RenderStack, type Renderable, Renderer, Resource, type ResourceEventMap, RoundedRectangle, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SVGPath, type SVGPathDefine, type SVGPathDefineCommand, SceneTree, type SceneTreeEventMap, type Shape, type ShapeBuildCommand, Star, type StrokedGraphics, Style2D, type Style2DBackgroundExtend, Style2DBackgroundModule, type Style2DBackgroundProperties, type Style2DFilter, type Style2DFilterExtend, type Style2DFilterKey, Style2DFilterModule, type Style2DFilterProperties, Style2DModule, type Style2DOffsetExtend, Style2DOffsetModule, type Style2DOffsetProperties, type Style2DOptions, type Style2DTextExtend, Style2DTextModule, type Style2DTextProperties, type Style2DTransformExtend, Style2DTransformModule, type Style2DTransformProperties, Text2D, type Text2DOptions, TextLoader, Texture, type TextureFilterMode, TextureLoader, type TexturePixelsSource, type TextureSource, type TextureWrapMode, Ticker, TiltShiftEffect, Timer, type TimerEventMap, type TimerOptions, type TimingFunctions, Transform2D, type Transform2DObject, Triangle, TwistEffect, UIInputEvent, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, type VectorLike, type VectorOperateOutput, VertexAttribute, type VertexAttributeOptions, VertexBuffer, type VertexBufferOptions, Video2D, type Video2DOptions, VideoLoader, VideoTexture, type VideoTextureOptions, type VideoTextureSource, Viewport, type ViewportFramebuffer, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, type WebGLBufferMeta, WebGLBufferModule, type WebGLBufferOptions, type WebGLBufferTarget, type WebGLBufferUsage, type WebGLDrawMode, type WebGLDrawOptions, type WebGLExtensions, type WebGLFramebufferMeta, WebGLFramebufferModule, type WebGLFramebufferOptions, WebGLMaskModule, WebGLModule, type WebGLProgramMeta, WebGLProgramModule, type WebGLProgramOptions, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, type WebGLTarget, type WebGLTextureFilterMode, type WebGLTextureLocation, type WebGLTextureMeta, WebGLTextureModule, type WebGLTextureOptions, type WebGLTextureSource, type WebGLTextureTarget, type WebGLTextureWrapMode, WebGLVertexArrayModule, type WebGLVertexArrayObjectMeta, type WebGLVertexArrayObjectOptions, type WebGLVertexAttrib, type WebGLVertexAttribType, type WebGLViewport, WebGLViewportModule, WebSound, WheelInputEvent, ZoomBlurEffect, _Object, type _ObjectEventMap, assets, buildAdaptiveBezier, buildAdaptiveQuadratic, buildArc, buildArcTo, buildArcToSvg, buildCircle, buildLine, buildPolygon, buildRectangle, buildTriangle, clamp, closePointEps, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curveEps, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, squaredDistanceToLineSegment, timingFunctions, uid };