modern-canvas 0.6.13 → 0.7.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.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { Font } from 'modern-font';
2
- import { EventListenerOptions, EventListenerValue, EventEmitter, PropertyDeclaration, ReactiveObject, ReactiveObjectPropertyAccessorContext, Color as Color$1, RawWeakMap as RawWeakMap$1, LinearGradient, RadialGradient, NormalizedFill, Fill, NormalizedBackground, Background, NormalizedForeground, Foreground, NormalizedOutline, Outline, NormalizedShadow, Shadow, NormalizedShape, Shape, FullStyle, Text as Text$1, Style, ImageFillCropRect } from 'modern-idoc';
2
+ import { EventListenerOptions as EventListenerOptions$1, EventListenerValue, EventEmitter, PropertyDeclaration, ReactiveObject, ReactiveObjectPropertyAccessorContext, Color as Color$1, RawWeakMap as RawWeakMap$1, LinearGradient, RadialGradient, NormalizedFill, Fill, NormalizedBackground, Background, NormalizedForeground, Foreground, NormalizedOutline, Outline, NormalizedShadow, Shadow, NormalizedShape, Shape, FullStyle, Text as Text$1, Style, ImageFillCropRect } from 'modern-idoc';
3
3
  export { Color as ColorValue } from 'modern-idoc';
4
4
  import { AnimationItem } from 'lottie-web';
5
5
  import { Colord, RgbaColor, HslaColor, HsvaColor } from 'colord';
6
6
  import { Path2D, LineCap, LineJoin, LineStyle, Path2DSet } from 'modern-path2d';
7
- import { Text, MeasureResult, TextOptions } from 'modern-text';
7
+ import { Text, MeasureResult } from 'modern-text';
8
8
  import { Node as Node$1, Direction } from 'yoga-layout/load';
9
9
 
10
10
  declare abstract class Loader {
@@ -180,9 +180,9 @@ interface InputEventMap {
180
180
  }
181
181
  type InputEventKey = keyof InputEventMap;
182
182
  interface Input {
183
- on: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
184
- once: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
185
- off: (<K extends keyof InputEventMap>(type: K, listener?: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
183
+ on: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
184
+ once: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
185
+ off: (<K extends keyof InputEventMap>(type: K, listener?: InputEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
186
186
  emit: (<K extends keyof InputEventMap>(type: K, ...args: Parameters<InputEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
187
187
  }
188
188
  declare class Input extends EventEmitter {
@@ -225,9 +225,9 @@ interface CustomPropertyAccessor {
225
225
  set: (key: string, value: any) => void;
226
226
  }
227
227
  interface CoreObject {
228
- on: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
229
- once: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
230
- off: (<K extends keyof CoreObjectEventMap>(type: K, listener?: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
228
+ on: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
229
+ once: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
230
+ off: (<K extends keyof CoreObjectEventMap>(type: K, listener?: CoreObjectEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
231
231
  emit: (<K extends keyof CoreObjectEventMap>(type: K, ...args: Parameters<CoreObjectEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
232
232
  }
233
233
  declare class CoreObject extends EventEmitter implements Required<ReactiveObject> {
@@ -264,9 +264,9 @@ declare class CoreObject extends EventEmitter implements Required<ReactiveObject
264
264
  interface RefCountedEventMap extends CoreObjectEventMap {
265
265
  }
266
266
  interface RefCounted {
267
- on: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
268
- once: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
269
- off: (<K extends keyof RefCountedEventMap>(type: K, listener?: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
267
+ on: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
268
+ once: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
269
+ off: (<K extends keyof RefCountedEventMap>(type: K, listener?: RefCountedEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
270
270
  emit: (<K extends keyof RefCountedEventMap>(type: K, ...args: Parameters<RefCountedEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
271
271
  }
272
272
  declare class RefCounted extends CoreObject {
@@ -275,9 +275,9 @@ declare class RefCounted extends CoreObject {
275
275
  interface ResourceEventMap extends RefCountedEventMap {
276
276
  }
277
277
  interface Resource {
278
- on: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
279
- once: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
280
- off: (<K extends keyof ResourceEventMap>(type: K, listener?: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
278
+ on: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
279
+ once: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
280
+ off: (<K extends keyof ResourceEventMap>(type: K, listener?: ResourceEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
281
281
  emit: (<K extends keyof ResourceEventMap>(type: K, ...args: Parameters<ResourceEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
282
282
  }
283
283
  declare class Resource extends RefCounted {
@@ -317,24 +317,20 @@ declare abstract class Vector extends EventEmitter {
317
317
  protected _array: number[];
318
318
  get length(): number;
319
319
  constructor(dim: number);
320
- protected _operate(operator: '+' | '-' | '*' | '/' | 'rot' | '==' | '=' | string, target: VectorLike, output?: VectorOperateOutput): any;
321
- add(value: VectorLike): this;
322
- add<T extends VectorOperateOutput>(value: VectorLike, output: T): T;
323
- sub(value: VectorLike): this;
324
- sub<T extends VectorOperateOutput>(value: VectorLike, output: T): T;
325
- multiply(value: VectorLike): this;
326
- multiply<T extends VectorOperateOutput>(value: VectorLike, output: T): T;
327
- divide(value: VectorLike): this;
328
- divide<T extends VectorOperateOutput>(value: VectorLike, output: T): T;
320
+ operate(operator: '+' | '-' | '*' | '/' | 'rot' | '==' | '=', target: VectorLike, output?: VectorOperateOutput): any;
321
+ add(value: VectorLike, ...args: number[]): this;
322
+ sub(value: VectorLike, ...args: number[]): this;
323
+ multiply(value: VectorLike, ...args: number[]): this;
324
+ divide(value: VectorLike, ...args: number[]): this;
329
325
  rotate(angle: number): this;
330
- rotate<T extends VectorOperateOutput>(angle: number, output: T): T;
331
326
  set(value: VectorLike, ...args: number[]): this;
332
327
  equals(value: VectorLike): boolean;
333
328
  copy(value: VectorLike): this;
334
329
  clone(): this;
335
330
  protected _onUpdate(_array: number[]): void;
336
- toArray(): number[];
337
331
  toName(): string;
332
+ toArray(): number[];
333
+ toJSON(): number[];
338
334
  }
339
335
 
340
336
  type MatrixLike = number | number[] | Matrix;
@@ -346,7 +342,7 @@ declare abstract class Matrix extends EventEmitter {
346
342
  dirtyId: number;
347
343
  get length(): number;
348
344
  constructor(rows: number, cols: number, array?: number[]);
349
- protected _operate(operator: string, target: MatrixLike | Vector, output?: MatrixOperateOutput): any;
345
+ operate(operator: string, target: MatrixLike | Vector, output?: MatrixOperateOutput): any;
350
346
  identity(): this;
351
347
  set(value: MatrixLike): this;
352
348
  copy(value: MatrixLike): this;
@@ -478,6 +474,12 @@ declare class Rect2 {
478
474
  constructor(x: number, y: number, width: number, height: number);
479
475
  update(): this;
480
476
  toArray(): number[];
477
+ toJSON(): {
478
+ x: number;
479
+ y: number;
480
+ width: number;
481
+ height: number;
482
+ };
481
483
  }
482
484
 
483
485
  interface Transform2DObject {
@@ -530,7 +532,7 @@ declare class Transform2D extends Matrix3 {
530
532
 
531
533
  declare const DEG_TO_RAD: number;
532
534
  declare const RAD_TO_DEG: number;
533
- declare function clamp(min: number, val: number, max: number): number;
535
+ declare function clamp(val: number, min: number, max: number): number;
534
536
  declare function lerp(a: number, b: number, weight: number): number;
535
537
  declare const curves: {
536
538
  adaptive: boolean;
@@ -552,10 +554,10 @@ interface MainLoopEventMap extends CoreObjectEventMap {
552
554
  process: (delta: number) => void;
553
555
  }
554
556
  interface MainLoop {
555
- on: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
556
- once: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
557
- off: (<K extends keyof MainLoopEventMap>(type: K, listener?: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
558
- emit: (<K extends keyof EventListenerOptions>(type: K, ...args: Parameters<EventListenerOptions[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
557
+ on: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
558
+ once: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
559
+ off: (<K extends keyof MainLoopEventMap>(type: K, listener?: MainLoopEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
560
+ emit: (<K extends keyof EventListenerOptions$1>(type: K, ...args: Parameters<EventListenerOptions$1[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
559
561
  }
560
562
  declare class MainLoop extends CoreObject {
561
563
  fps: number;
@@ -832,7 +834,7 @@ declare class WebGLRenderer extends Renderer {
832
834
  reset(): void;
833
835
  flush(): void;
834
836
  free(): void;
835
- toPixels(): Uint8ClampedArray;
837
+ toPixels(x?: number, y?: number, width?: number, height?: number): Uint8ClampedArray;
836
838
  }
837
839
 
838
840
  interface Renderable {
@@ -1445,54 +1447,13 @@ declare class CanvasContext extends Path2D {
1445
1447
  toBatchables(): CanvasBatchable[];
1446
1448
  }
1447
1449
 
1448
- interface RenderCall {
1449
- renderable: Node;
1450
- fn: (renderer: WebGLRenderer, next: () => void) => void;
1451
- parentCall: RenderCall | undefined;
1452
- calls: RenderCall[];
1453
- }
1454
- declare class RenderStack {
1455
- currentCall?: RenderCall;
1456
- calls: RenderCall[];
1457
- createCall(renderable: Node): RenderCall;
1458
- push(renderable: Node): RenderCall;
1459
- render(renderer: WebGLRenderer): void;
1460
- }
1461
-
1462
- interface TimelineEventMap extends NodeEventMap {
1463
- updateCurrentTime: (current: number, delta: number) => void;
1464
- }
1465
- interface TimelineProperties extends NodeProperties {
1466
- startTime: number;
1467
- currentTime: number;
1468
- endTime: number;
1469
- loop: boolean;
1470
- }
1471
- interface Timeline {
1472
- on: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1473
- once: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1474
- off: (<K extends keyof TimelineEventMap>(type: K, listener?: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1475
- emit: (<K extends keyof TimelineEventMap>(type: K, ...args: Parameters<TimelineEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1476
- }
1477
- declare class Timeline extends Node {
1478
- startTime: number;
1479
- currentTime: number;
1480
- endTime: number;
1481
- loop: boolean;
1482
- static from(range: number | number[], loop?: boolean): Timeline;
1483
- constructor(properties?: Partial<TimelineProperties>);
1484
- protected _updateProperty(key: string, value: any, oldValue: any): void;
1485
- addTime(delta: number): this;
1486
- protected _process(delta: number): void;
1487
- }
1488
-
1489
1450
  interface RectangulableEventMap {
1490
1451
  updateRect: () => void;
1491
1452
  }
1492
1453
  interface Rectangulable {
1493
- on: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1494
- once: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1495
- off: (<K extends keyof RectangulableEventMap>(type: K, listener?: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1454
+ on: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1455
+ once: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1456
+ off: (<K extends keyof RectangulableEventMap>(type: K, listener?: RectangulableEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1496
1457
  emit: (<K extends keyof RectangulableEventMap>(type: K, ...args: Parameters<RectangulableEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1497
1458
  }
1498
1459
  interface Rectangulable {
@@ -1506,14 +1467,15 @@ interface ViewportFramebuffer {
1506
1467
  needsUpload: boolean;
1507
1468
  }
1508
1469
  interface Viewport {
1509
- on: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1510
- once: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1511
- off: (<K extends keyof ViewportEventMap>(type: K, listener?: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1470
+ on: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1471
+ once: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1472
+ off: (<K extends keyof ViewportEventMap>(type: K, listener?: ViewportEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1512
1473
  emit: (<K extends keyof ViewportEventMap>(type: K, ...args: Parameters<ViewportEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1513
1474
  }
1514
1475
  declare class Viewport extends Node implements Rectangulable {
1515
1476
  flipY: boolean;
1516
- protected _projection: Projection2D;
1477
+ readonly projection: Projection2D;
1478
+ readonly canvasTransform: Transform2D;
1517
1479
  protected _framebufferIndex: number;
1518
1480
  protected _framebuffers: ViewportFramebuffer[];
1519
1481
  x: number;
@@ -1523,6 +1485,7 @@ declare class Viewport extends Node implements Rectangulable {
1523
1485
  get valid(): boolean;
1524
1486
  get framebuffer(): ViewportFramebuffer;
1525
1487
  get texture(): ViewportTexture;
1488
+ getViewport(): Viewport;
1526
1489
  constructor(flipY?: boolean);
1527
1490
  /** @internal */
1528
1491
  _glFramebufferOptions(renderer: WebGLRenderer): WebGLFramebufferOptions;
@@ -1537,7 +1500,50 @@ declare class Viewport extends Node implements Rectangulable {
1537
1500
  activateWithCopy(renderer: WebGLRenderer, target: Viewport): void;
1538
1501
  render(renderer: WebGLRenderer, next?: () => void): void;
1539
1502
  getRect(): Rect2;
1540
- toProjectionArray(transpose?: boolean): number[];
1503
+ }
1504
+
1505
+ interface RenderCall {
1506
+ renderable: Node;
1507
+ fn: (renderer: WebGLRenderer, next: () => void) => void;
1508
+ parentCall: RenderCall | undefined;
1509
+ calls: RenderCall[];
1510
+ }
1511
+ declare class RenderStack {
1512
+ currentCall?: RenderCall;
1513
+ calls: RenderCall[];
1514
+ createCall(renderable: Node): RenderCall;
1515
+ push(renderable: Node): RenderCall;
1516
+ render(renderer: WebGLRenderer): void;
1517
+ }
1518
+
1519
+ interface TimelineEventMap extends NodeEventMap {
1520
+ updateCurrentTime: (current: number, delta: number) => void;
1521
+ }
1522
+ interface TimelineProperties extends NodeProperties {
1523
+ startTime: number;
1524
+ currentTime: number;
1525
+ endTime: number;
1526
+ loop: boolean;
1527
+ }
1528
+ interface Timeline {
1529
+ on: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1530
+ once: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1531
+ off: (<K extends keyof TimelineEventMap>(type: K, listener?: TimelineEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1532
+ emit: (<K extends keyof TimelineEventMap>(type: K, ...args: Parameters<TimelineEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1533
+ }
1534
+ declare class Timeline extends Node {
1535
+ startTime: number;
1536
+ currentTime: number;
1537
+ endTime: number;
1538
+ loop: boolean;
1539
+ static from(range: number | number[], loop?: boolean): Timeline;
1540
+ constructor(properties?: Partial<TimelineProperties>);
1541
+ protected _updateProperty(key: string, value: any, oldValue: any): void;
1542
+ addTime(delta: number): this;
1543
+ protected _process(delta: number): void;
1544
+ }
1545
+
1546
+ declare class Window extends Viewport {
1541
1547
  }
1542
1548
 
1543
1549
  interface SceneTreeEventMap extends MainLoopEventMap {
@@ -1549,9 +1555,9 @@ interface SceneTreeEventMap extends MainLoopEventMap {
1549
1555
  nodeProcessed: (node: Node) => void;
1550
1556
  }
1551
1557
  interface SceneTree {
1552
- on: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1553
- once: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1554
- off: (<K extends keyof SceneTreeEventMap>(type: K, listener?: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1558
+ on: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1559
+ once: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1560
+ off: (<K extends keyof SceneTreeEventMap>(type: K, listener?: SceneTreeEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1555
1561
  emit: (<K extends keyof SceneTreeEventMap>(type: K, ...args: Parameters<SceneTreeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1556
1562
  }
1557
1563
  declare class SceneTree extends MainLoop {
@@ -1560,9 +1566,8 @@ declare class SceneTree extends MainLoop {
1560
1566
  debug: boolean;
1561
1567
  readonly input: Input;
1562
1568
  readonly renderStack: RenderStack;
1563
- readonly root: Viewport;
1569
+ readonly root: Window;
1564
1570
  readonly timeline: Timeline;
1565
- nodes: Map<string, Node>;
1566
1571
  protected _backgroundColor: Color;
1567
1572
  protected _currentViewport?: Viewport;
1568
1573
  getCurrentViewport(): Viewport | undefined;
@@ -1620,9 +1625,9 @@ interface NodeProperties {
1620
1625
  meta: Record<string, any>;
1621
1626
  }
1622
1627
  interface Node {
1623
- on: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1624
- once: (<K extends keyof NodeEventMap>(type: K, listener?: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1625
- off: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1628
+ on: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1629
+ once: (<K extends keyof NodeEventMap>(type: K, listener?: NodeEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1630
+ off: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1626
1631
  emit: (<K extends keyof NodeEventMap>(type: K, ...args: Parameters<NodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1627
1632
  }
1628
1633
  declare class Node extends CoreObject {
@@ -1647,7 +1652,7 @@ declare class Node extends CoreObject {
1647
1652
  set tree(tree: SceneTree | undefined);
1648
1653
  getTree(): SceneTree | undefined;
1649
1654
  getViewport(): Viewport | undefined;
1650
- getWindow(): Viewport | undefined;
1655
+ getWindow(): Window | undefined;
1651
1656
  isInsideTree(): boolean;
1652
1657
  setTree(tree: SceneTree | undefined): this;
1653
1658
  log(...args: any[]): void;
@@ -1724,9 +1729,9 @@ interface TimelineNodeEventMap extends NodeEventMap {
1724
1729
  updateCurrentTime: (currentTime: number) => void;
1725
1730
  }
1726
1731
  interface TimelineNode {
1727
- on: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1728
- once: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1729
- off: (<K extends keyof TimelineNodeEventMap>(type: K, listener?: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1732
+ on: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1733
+ once: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1734
+ off: (<K extends keyof TimelineNodeEventMap>(type: K, listener?: TimelineNodeEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1730
1735
  emit: (<K extends keyof TimelineNodeEventMap>(type: K, ...args: Parameters<TimelineNodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1731
1736
  }
1732
1737
  declare class TimelineNode extends Node {
@@ -1760,9 +1765,9 @@ interface CanvasItemEventMap extends TimelineNodeEventMap {
1760
1765
  draw: () => void;
1761
1766
  }
1762
1767
  interface CanvasItem {
1763
- on: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1764
- once: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1765
- off: (<K extends keyof CanvasItemEventMap>(type: K, listener?: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1768
+ on: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1769
+ once: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1770
+ off: (<K extends keyof CanvasItemEventMap>(type: K, listener?: CanvasItemEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
1766
1771
  emit: (<K extends keyof CanvasItemEventMap>(type: K, ...args: Parameters<CanvasItemEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1767
1772
  }
1768
1773
  declare class CanvasItem extends TimelineNode {
@@ -1861,6 +1866,14 @@ declare class Transition extends Effect {
1861
1866
 
1862
1867
  interface Node2DProperties extends CanvasItemProperties {
1863
1868
  }
1869
+ interface Node2DEventMap extends CanvasItemEventMap {
1870
+ }
1871
+ interface Node2D {
1872
+ on: (<K extends keyof Node2DEventMap>(type: K, listener: Node2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1873
+ once: (<K extends keyof Node2DEventMap>(type: K, listener: Node2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1874
+ off: (<K extends keyof Node2DEventMap>(type: K, listener?: Node2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1875
+ emit: (<K extends keyof Node2DEventMap>(type: K, ...args: Parameters<Node2DEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1876
+ }
1864
1877
  declare class Node2D extends CanvasItem {
1865
1878
  rotation: number;
1866
1879
  readonly position: Vector2;
@@ -1884,6 +1897,29 @@ declare class Node2D extends CanvasItem {
1884
1897
  protected _process(delta: number): void;
1885
1898
  }
1886
1899
 
1900
+ interface Camera2DProperties extends Node2DProperties {
1901
+ }
1902
+ interface Camera2DEventMap extends Node2DEventMap {
1903
+ updateCanvasTransform: () => void;
1904
+ }
1905
+ interface Camera2D {
1906
+ on: (<K extends keyof Camera2DEventMap>(type: K, listener: Camera2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1907
+ once: (<K extends keyof Camera2DEventMap>(type: K, listener: Camera2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1908
+ off: (<K extends keyof Camera2DEventMap>(type: K, listener?: Camera2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1909
+ emit: (<K extends keyof Camera2DEventMap>(type: K, ...args: Parameters<Camera2DEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1910
+ }
1911
+ declare class Camera2D extends Node2D {
1912
+ readonly zoom: Vector2;
1913
+ readonly maxZoom: Vector2;
1914
+ readonly minZoom: Vector2;
1915
+ constructor(properties?: Partial<Camera2DProperties>, nodes?: Node[]);
1916
+ addZoom(x: number, y?: number): this;
1917
+ setZoom(x: number, y?: number): this;
1918
+ protected _input(event: InputEvent, key: InputEventKey): void;
1919
+ updateTransform(): void;
1920
+ updateCanvasTransform(): void;
1921
+ }
1922
+
1887
1923
  interface BaseElement2DFill extends NormalizedFill {
1888
1924
  }
1889
1925
  declare class BaseElement2DFill extends CoreObject {
@@ -2012,9 +2048,9 @@ interface BaseElement2DProperties extends Node2DProperties {
2012
2048
  shadow: Shadow;
2013
2049
  }
2014
2050
  interface BaseElement2D {
2015
- on: (<K extends keyof BaseElement2DEventMap>(type: K, listener: BaseElement2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2016
- once: (<K extends keyof BaseElement2DEventMap>(type: K, listener: BaseElement2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2017
- off: (<K extends keyof BaseElement2DEventMap>(type: K, listener?: BaseElement2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2051
+ on: (<K extends keyof BaseElement2DEventMap>(type: K, listener: BaseElement2DEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
2052
+ once: (<K extends keyof BaseElement2DEventMap>(type: K, listener: BaseElement2DEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
2053
+ off: (<K extends keyof BaseElement2DEventMap>(type: K, listener?: BaseElement2DEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
2018
2054
  emit: (<K extends keyof BaseElement2DEventMap>(type: K, ...args: Parameters<BaseElement2DEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
2019
2055
  }
2020
2056
  declare class BaseElement2D extends Node2D implements Rectangulable {
@@ -2077,15 +2113,23 @@ declare class Element2DStyle extends BaseElement2DStyle {
2077
2113
  constructor(properties?: Partial<Element2DStyleProperties>);
2078
2114
  }
2079
2115
 
2116
+ interface FlexElement2DStyleProperties extends BaseElement2DStyleProperties {
2117
+ }
2118
+ interface FlexElement2DStyle extends FlexElement2DStyleProperties {
2119
+ }
2120
+ declare class FlexElement2DStyle extends BaseElement2DStyle {
2121
+ constructor(properties?: Partial<FlexElement2DStyleProperties>);
2122
+ }
2123
+
2080
2124
  interface Element2DEventMap extends BaseElement2DEventMap {
2081
2125
  }
2082
2126
  interface Element2DProperties extends BaseElement2DProperties {
2083
2127
  style: Partial<Element2DStyleProperties>;
2084
2128
  }
2085
2129
  interface Element2D {
2086
- on: (<K extends keyof Element2DEventMap>(type: K, listener: Element2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2087
- once: (<K extends keyof Element2DEventMap>(type: K, listener: Element2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2088
- off: (<K extends keyof Element2DEventMap>(type: K, listener?: Element2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2130
+ on: (<K extends keyof Element2DEventMap>(type: K, listener: Element2DEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
2131
+ once: (<K extends keyof Element2DEventMap>(type: K, listener: Element2DEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
2132
+ off: (<K extends keyof Element2DEventMap>(type: K, listener?: Element2DEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
2089
2133
  emit: (<K extends keyof Element2DEventMap>(type: K, ...args: Parameters<Element2DEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
2090
2134
  }
2091
2135
  declare class Element2D extends BaseElement2D {
@@ -2096,14 +2140,6 @@ declare class Element2D extends BaseElement2D {
2096
2140
  protected _updateStyleProperty(key: string, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
2097
2141
  }
2098
2142
 
2099
- interface FlexElement2DStyleProperties extends BaseElement2DStyleProperties {
2100
- }
2101
- interface FlexElement2DStyle extends FlexElement2DStyleProperties {
2102
- }
2103
- declare class FlexElement2DStyle extends BaseElement2DStyle {
2104
- constructor(properties?: Partial<FlexElement2DStyleProperties>);
2105
- }
2106
-
2107
2143
  interface ComputedLayout {
2108
2144
  left: number;
2109
2145
  right: number;
@@ -2135,9 +2171,9 @@ interface FlexElement2DProperties extends BaseElement2DProperties {
2135
2171
  style: Partial<FlexElement2DStyleProperties>;
2136
2172
  }
2137
2173
  interface FlexElement2D {
2138
- on: (<K extends keyof FlexBaseElement2DEventMap>(type: K, listener: FlexBaseElement2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2139
- once: (<K extends keyof FlexBaseElement2DEventMap>(type: K, listener: FlexBaseElement2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2140
- off: (<K extends keyof FlexBaseElement2DEventMap>(type: K, listener?: FlexBaseElement2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2174
+ on: (<K extends keyof FlexBaseElement2DEventMap>(type: K, listener: FlexBaseElement2DEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
2175
+ once: (<K extends keyof FlexBaseElement2DEventMap>(type: K, listener: FlexBaseElement2DEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
2176
+ off: (<K extends keyof FlexBaseElement2DEventMap>(type: K, listener?: FlexBaseElement2DEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
2141
2177
  emit: (<K extends keyof FlexBaseElement2DEventMap>(type: K, ...args: Parameters<FlexBaseElement2DEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
2142
2178
  }
2143
2179
  declare class FlexElement2D extends BaseElement2D implements Rectangulable {
@@ -2209,51 +2245,6 @@ declare class Lottie2D extends TextureRect2D {
2209
2245
  protected _process(delta: number): void;
2210
2246
  }
2211
2247
 
2212
- interface Text2DEventMap extends Element2DEventMap {
2213
- updateBase: (base: Text) => void;
2214
- }
2215
- interface Text2DProperties extends TextureRect2DProperties, Omit<TextOptions, 'style'> {
2216
- split: boolean;
2217
- }
2218
- interface Text2D {
2219
- on: (<K extends keyof Text2DEventMap>(type: K, listener: Text2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2220
- once: (<K extends keyof Text2DEventMap>(type: K, listener: Text2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2221
- off: (<K extends keyof Text2DEventMap>(type: K, listener?: Text2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2222
- emit: (<K extends keyof Text2DEventMap>(type: K, ...args: Parameters<Text2DEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
2223
- }
2224
- /**
2225
- * @example
2226
- *
2227
- * new Text2D({
2228
- * style: {
2229
- * fontSize: 20,
2230
- * },
2231
- * content: 'Text2D',
2232
- * })
2233
- */
2234
- declare class Text2D extends TextureRect2D<CanvasTexture> {
2235
- split: boolean;
2236
- content: Text['content'];
2237
- effects: Text['effects'];
2238
- measureDOM: Text['measureDOM'];
2239
- fonts: Text['fonts'];
2240
- texture: CanvasTexture;
2241
- base: Text;
2242
- measureResult?: MeasureResult;
2243
- protected _subTextsCount: number;
2244
- constructor(properties?: Partial<Text2DProperties>, children?: Node[]);
2245
- protected _updateProperty(key: string, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
2246
- protected _updateBase(): void;
2247
- protected _updateStyleProperty(key: string, value: any, oldValue: any): void;
2248
- protected _getSubTexts(): Text2D[];
2249
- protected _updateSubTexts(): void;
2250
- measure(): MeasureResult;
2251
- updateMeasure(): this;
2252
- protected _updateSplit(): void;
2253
- protected _redraw(): CanvasBatchable[];
2254
- protected _drawContent(): void;
2255
- }
2256
-
2257
2248
  interface TransformRect2DProperties extends BaseElement2DProperties {
2258
2249
  }
2259
2250
  declare class TransformRect2D extends Element2D {
@@ -2916,9 +2907,9 @@ interface ControlEventMap extends CanvasItemEventMap, RectangulableEventMap {
2916
2907
  interface ControlProperties extends BaseElement2DProperties {
2917
2908
  }
2918
2909
  interface Control {
2919
- on: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2920
- once: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2921
- off: (<K extends keyof ControlEventMap>(type: K, listener?: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2910
+ on: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
2911
+ once: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
2912
+ off: (<K extends keyof ControlEventMap>(type: K, listener?: ControlEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
2922
2913
  emit: (<K extends keyof ControlEventMap>(type: K, ...args: Parameters<ControlEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
2923
2914
  }
2924
2915
  declare class Control extends Element2D implements Rectangulable {
@@ -3023,9 +3014,9 @@ interface ScalerProperties extends NodeProperties {
3023
3014
  maxScale: number;
3024
3015
  }
3025
3016
  interface Scaler {
3026
- on: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3027
- once: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3028
- off: (<K extends keyof ScalerEventMap>(type: K, listener?: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3017
+ on: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
3018
+ once: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
3019
+ off: (<K extends keyof ScalerEventMap>(type: K, listener?: ScalerEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
3029
3020
  emit: (<K extends keyof ScalerEventMap>(type: K, ...args: Parameters<ScalerEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
3030
3021
  }
3031
3022
  declare class Scaler extends Node {
@@ -3194,9 +3185,9 @@ declare const defaultOptions: {
3194
3185
  readonly powerPreference: "default";
3195
3186
  };
3196
3187
  interface Engine {
3197
- on: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3198
- once: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3199
- off: (<K extends keyof EngineEventMap>(type: K, listener?: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3188
+ on: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
3189
+ once: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
3190
+ off: (<K extends keyof EngineEventMap>(type: K, listener?: EngineEventMap[K], options?: EventListenerOptions$1) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions$1) => this);
3200
3191
  emit: (<K extends keyof EngineEventMap>(type: K, ...args: Parameters<EngineEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
3201
3192
  }
3202
3193
  declare class Engine extends SceneTree {
@@ -3239,5 +3230,5 @@ interface RenderOptions {
3239
3230
  }
3240
3231
  declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
3241
3232
 
3242
- export { AnimatedTexture, Animation, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BaseElement2D, BaseElement2DBackground, BaseElement2DFill, BaseElement2DForeground, BaseElement2DOutline, BaseElement2DShadow, BaseElement2DShape, BaseElement2DStyle, BaseElement2DText, CanvasContext, CanvasItem, CanvasItemEditor, CanvasTexture, Color, ColorAdjustEffect, ColorFilterEffect, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, Control, CoreObject, DEG_TO_RAD, DEVICE_PIXEL_RATIO, DropShadowEffect, Effect, EffectMaterial, Element2D, Element2DStyle, EmbossEffect, Engine, FlexElement2D, FlexElement2DStyle, FlexLayout, FontLoader, GIFLoader, GaussianBlurEffect, Geometry, GlitchEffect, GodrayEffect, GradientTexture, HTMLAudio, HTMLAudioContext, HTMLSound, IN_BROWSER, Image2D, ImageTexture, IndexBuffer, Input, InputEvent, JSONLoader, KawaseBlurEffect, KawaseTransition, LeftEraseTransition, Loader, Lottie2D, LottieLoader, MainLoop, MaskEffect, Material, Matrix, Matrix2, Matrix3, Matrix4, MouseInputEvent, Node, Node2D, OutlineEffect, PI, PI_2, PixelateEffect, PixelsTexture, PointerInputEvent, Projection2D, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Range, RawWeakMap, Rect2, RefCounted, Renderer, Resource, Ruler, 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, Scaler, SceneTree, ScrollBar, Text2D, TextLoader, Texture2D, TextureLoader, TextureRect2D, Ticker, TiltShiftTransition, Timeline, TimelineNode, Transform2D, TransformRect2D, Transition, TwistTransition, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, VertexAttribute, VertexBuffer, Video2D, VideoLoader, VideoTexture, Viewport, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, WebGLBufferModule, WebGLFramebufferModule, WebGLMaskModule, WebGLModule, WebGLProgramModule, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, WebGLTextureModule, WebGLVertexArrayModule, WebGLViewportModule, WebSound, WheelInputEvent, XScrollBar, YScrollBar, ZoomBlurEffect, assets, clamp, clampFrag, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, frag, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCSSFilter, parseCSSTransform, parseCSSTransformOrigin, parseCssFunctions, parseCssProperty, render, timingFunctions, uid };
3243
- export type { AnimationEffectMode, AnimationProperties, AssetHandler, AudioWaveformProperties, BaseElement2DEventMap, BaseElement2DProperties, BaseElement2DStyleProperties, Batchable2D, CSSFilterKey, CSSFilters, CanvasBatchable, CanvasItemEventMap, CanvasItemProperties, ColorAdjustEffectProperties, ColorFilterEffectProperties, ColorOverlayEffectProperties, ColorRemoveEffectProperties, ColorReplaceEffectProperties, ComputedLayout, ControlEventMap, ControlProperties, CoreObjectEventMap, CssFunction, CssFunctionArg, Cursor, CustomPropertyAccessor, DropShadowEffectProperties, Easing, EffectContext, EffectMode, EffectProperties, Element2DEventMap, Element2DProperties, Element2DStyleProperties, EmbossEffectProperties, EngineOptions, FillDraw, FlexBaseElement2DEventMap, FlexElement2DProperties, FlexElement2DStyleProperties, GaussianBlurEffectProperties, GeometryOptions, GlitchEffectProperties, GodrayEffectProperties, IAudioContext, IAudioNode, IPlayOptions, Image2DProperties, ImageFrame, ImageTextureOptions, IndexBufferOptions, InputEventKey, InputEventMap, InternalMode, KawaseBlurEffectProperties, Keyframe, Lottie2DProperties, MainLoopEventMap, MaskColor, MaskData, MaskEffectProperties, MaskObject, MaskRect, Maskable, MaterialOptions, MatrixLike, MatrixOperateOutput, Node2DProperties, NodeEventMap, NodeProperties, NormalizedKeyframe, OutlineEffectProperties, PixelateEffectProperties, PlatformAudio, PlatformSound, ProcessMode, ProcessSortMode, RangeProperties, Rectangulable, RectangulableEventMap, RefCountedEventMap, RenderMode, RenderOptions, Renderable, ResourceEventMap, RulerProperties, ScalerEventMap, ScalerProperties, SceneTreeEventMap, ScrollBarProperties, StrokeDraw, Text2DEventMap, Text2DProperties, Texture2DFilterMode, Texture2DPixelsSource, Texture2DSource, Texture2DWrapMode, TextureRect2DProperties, TimelineEventMap, TimelineNodeEventMap, TimelineNodeProperties, TimelineProperties, TimingFunctions, Transform2DObject, TransformRect2DProperties, TransitionProperties, UVTransform, VectorLike, VectorOperateOutput, VertTransform, VertexAttributeOptions, VertexBufferOptions, Video2DProperties, VideoTextureOptions, VideoTextureSource, ViewportEventMap, ViewportFramebuffer, WebGLBufferMeta, WebGLBufferOptions, WebGLBufferTarget, WebGLBufferUsage, WebGLDrawMode, WebGLDrawOptions, WebGLExtensions, WebGLFramebufferMeta, WebGLFramebufferOptions, WebGLProgramMeta, WebGLProgramOptions, WebGLTarget, WebGLTextureFilterMode, WebGLTextureLocation, WebGLTextureMeta, WebGLTextureOptions, WebGLTextureSource, WebGLTextureTarget, WebGLTextureWrapMode, WebGLVertexArrayObjectMeta, WebGLVertexArrayObjectOptions, WebGLVertexAttrib, WebGLVertexAttribType, WebGLViewport, XScrollBarProperties, YScrollBarProperties, ZoomBlurEffectProperties };
3233
+ export { AnimatedTexture, Animation, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BaseElement2D, BaseElement2DBackground, BaseElement2DFill, BaseElement2DForeground, BaseElement2DOutline, BaseElement2DShadow, BaseElement2DShape, BaseElement2DStyle, BaseElement2DText, Camera2D, CanvasContext, CanvasItem, CanvasItemEditor, CanvasTexture, Color, ColorAdjustEffect, ColorFilterEffect, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, Control, CoreObject, DEG_TO_RAD, DEVICE_PIXEL_RATIO, DropShadowEffect, Effect, EffectMaterial, Element2D, Element2DStyle, EmbossEffect, Engine, FlexElement2D, FlexElement2DStyle, FlexLayout, FontLoader, GIFLoader, GaussianBlurEffect, Geometry, GlitchEffect, GodrayEffect, GradientTexture, HTMLAudio, HTMLAudioContext, HTMLSound, IN_BROWSER, Image2D, ImageTexture, IndexBuffer, Input, InputEvent, JSONLoader, KawaseBlurEffect, KawaseTransition, LeftEraseTransition, Loader, Lottie2D, LottieLoader, MainLoop, MaskEffect, Material, Matrix, Matrix2, Matrix3, Matrix4, MouseInputEvent, Node, Node2D, OutlineEffect, PI, PI_2, PixelateEffect, PixelsTexture, PointerInputEvent, Projection2D, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Range, RawWeakMap, Rect2, RefCounted, Renderer, Resource, Ruler, 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, Scaler, SceneTree, ScrollBar, TextLoader, Texture2D, TextureLoader, TextureRect2D, Ticker, TiltShiftTransition, Timeline, TimelineNode, Transform2D, TransformRect2D, Transition, TwistTransition, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, VertexAttribute, VertexBuffer, Video2D, VideoLoader, VideoTexture, Viewport, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, WebGLBufferModule, WebGLFramebufferModule, WebGLMaskModule, WebGLModule, WebGLProgramModule, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, WebGLTextureModule, WebGLVertexArrayModule, WebGLViewportModule, WebSound, WheelInputEvent, Window, XScrollBar, YScrollBar, ZoomBlurEffect, assets, clamp, clampFrag, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, frag, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCSSFilter, parseCSSTransform, parseCSSTransformOrigin, parseCssFunctions, parseCssProperty, render, timingFunctions, uid };
3234
+ export type { AnimationEffectMode, AnimationProperties, AssetHandler, AudioWaveformProperties, BaseElement2DEventMap, BaseElement2DProperties, BaseElement2DStyleProperties, Batchable2D, CSSFilterKey, CSSFilters, Camera2DEventMap, Camera2DProperties, CanvasBatchable, CanvasItemEventMap, CanvasItemProperties, ColorAdjustEffectProperties, ColorFilterEffectProperties, ColorOverlayEffectProperties, ColorRemoveEffectProperties, ColorReplaceEffectProperties, ComputedLayout, ControlEventMap, ControlProperties, CoreObjectEventMap, CssFunction, CssFunctionArg, Cursor, CustomPropertyAccessor, DropShadowEffectProperties, Easing, EffectContext, EffectMode, EffectProperties, Element2DEventMap, Element2DProperties, Element2DStyleProperties, EmbossEffectProperties, EngineOptions, FillDraw, FlexBaseElement2DEventMap, FlexElement2DProperties, FlexElement2DStyleProperties, GaussianBlurEffectProperties, GeometryOptions, GlitchEffectProperties, GodrayEffectProperties, IAudioContext, IAudioNode, IPlayOptions, Image2DProperties, ImageFrame, ImageTextureOptions, IndexBufferOptions, InputEventKey, InputEventMap, InternalMode, KawaseBlurEffectProperties, Keyframe, Lottie2DProperties, MainLoopEventMap, MaskColor, MaskData, MaskEffectProperties, MaskObject, MaskRect, Maskable, MaterialOptions, MatrixLike, MatrixOperateOutput, Node2DEventMap, Node2DProperties, NodeEventMap, NodeProperties, NormalizedKeyframe, OutlineEffectProperties, PixelateEffectProperties, PlatformAudio, PlatformSound, ProcessMode, ProcessSortMode, RangeProperties, Rectangulable, RectangulableEventMap, RefCountedEventMap, RenderMode, RenderOptions, Renderable, ResourceEventMap, RulerProperties, ScalerEventMap, ScalerProperties, SceneTreeEventMap, ScrollBarProperties, StrokeDraw, Texture2DFilterMode, Texture2DPixelsSource, Texture2DSource, Texture2DWrapMode, TextureRect2DProperties, TimelineEventMap, TimelineNodeEventMap, TimelineNodeProperties, TimelineProperties, TimingFunctions, Transform2DObject, TransformRect2DProperties, TransitionProperties, UVTransform, VectorLike, VectorOperateOutput, VertTransform, VertexAttributeOptions, VertexBufferOptions, Video2DProperties, VideoTextureOptions, VideoTextureSource, ViewportEventMap, ViewportFramebuffer, WebGLBufferMeta, WebGLBufferOptions, WebGLBufferTarget, WebGLBufferUsage, WebGLDrawMode, WebGLDrawOptions, WebGLExtensions, WebGLFramebufferMeta, WebGLFramebufferOptions, WebGLProgramMeta, WebGLProgramOptions, WebGLTarget, WebGLTextureFilterMode, WebGLTextureLocation, WebGLTextureMeta, WebGLTextureOptions, WebGLTextureSource, WebGLTextureTarget, WebGLTextureWrapMode, WebGLVertexArrayObjectMeta, WebGLVertexArrayObjectOptions, WebGLVertexAttrib, WebGLVertexAttribType, WebGLViewport, XScrollBarProperties, YScrollBarProperties, ZoomBlurEffectProperties };