canvasengine 2.0.0-beta.56 → 2.0.0-beta.58

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.
@@ -50,7 +50,7 @@ export declare class RadialGradient {
50
50
  y: number;
51
51
  };
52
52
  }): {
53
- texture: Texture<import('pixi.js').TextureSource<any>>;
53
+ texture: Texture<import('pixi.js').TextureSource<any>> | null;
54
54
  matrix: Matrix;
55
55
  };
56
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvasengine",
3
- "version": "2.0.0-beta.56",
3
+ "version": "2.0.0-beta.58",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,18 +10,18 @@
10
10
  "dependencies": {
11
11
  "@barvynkoa/particle-emitter": "^0.0.1",
12
12
  "@pixi/layout": "^3.2.0",
13
- "@signe/reactive": "^2.6.0",
13
+ "@signe/reactive": "^2.9.0",
14
14
  "howler": "^2.2.4",
15
15
  "joypad.js": "^2.3.5",
16
- "pixi-filters": "^6.0.5",
16
+ "pixi-filters": "^6.1.5",
17
17
  "pixi-viewport": "^6.0.3",
18
18
  "popmotion": "^11.0.5",
19
- "rxjs": "^7.8.1",
19
+ "rxjs": "^7.8.2",
20
20
  "yoga-layout": "^3.2.1"
21
21
  },
22
22
  "devDependencies": {
23
- "@types/howler": "^2.2.11",
24
- "vite": "^7.3.0",
23
+ "@types/howler": "^2.2.12",
24
+ "vite": "^8.0.10",
25
25
  "vite-plugin-dts": "^4.5.4"
26
26
  },
27
27
  "author": "Samuel Ronce",
@@ -1,86 +0,0 @@
1
- import { ComponentFunction } from '../engine/signal';
2
- import { DisplayObjectProps } from './types/DisplayObject';
3
- interface ContainerProps extends DisplayObjectProps {
4
- sortableChildren?: boolean;
5
- }
6
- declare const CanvasContainer_base: {
7
- new (): {
8
- [x: string]: any;
9
- "__#private@#canvasContext": {
10
- [key: string]: any;
11
- } | null;
12
- isFlex: boolean;
13
- fullProps: import('..').Props;
14
- isMounted: boolean;
15
- _anchorPoints: import('pixi.js').ObservablePoint;
16
- isCustomAnchor: boolean;
17
- displayWidth: import('@signe/reactive').WritableSignal<number>;
18
- displayHeight: import('@signe/reactive').WritableSignal<number>;
19
- overrideProps: string[];
20
- layout: any;
21
- onBeforeDestroy: import('./DisplayObject').OnHook | null;
22
- onAfterMount: import('./DisplayObject').OnHook | null;
23
- subjectInit: import('rxjs').BehaviorSubject<any>;
24
- disableLayout: boolean;
25
- "__#private@#registeredEvents": Map<string, Function>;
26
- "__#private@#computedLayoutBox": {
27
- width?: number;
28
- height?: number;
29
- } | null;
30
- "__#private@#element": import('..').Element<any> | null;
31
- getElement(): import('..').Element<any> | null;
32
- onLayoutComputed(_event: any): void;
33
- get deltaRatio(): any;
34
- get parentIsFlex(): any;
35
- onInit(props: import('..').Props): void;
36
- onMount(element: import('..').Element<any>, index?: number): Promise<void>;
37
- onUpdate(props: import('..').Props): void;
38
- onDestroy(parent: import('..').Element, afterDestroy?: () => void): Promise<void>;
39
- setFlexDirection(direction: import('./types/DisplayObject').FlexDirection): void;
40
- setFlexWrap(wrap: "wrap" | "nowrap" | "wrap-reverse"): void;
41
- setAlignContent(align: import('./types/DisplayObject').AlignContent): void;
42
- setAlignSelf(align: import('./types/DisplayObject').AlignContent): void;
43
- setAlignItems(align: import('./types/DisplayObject').AlignContent): void;
44
- setJustifyContent(justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around"): void;
45
- setPosition(position: import('./types/DisplayObject').EdgeSize): void;
46
- setX(x: number): void;
47
- setY(y: number): void;
48
- setPadding(padding: import('./types/DisplayObject').EdgeSize): void;
49
- setMargin(margin: import('./types/DisplayObject').EdgeSize): void;
50
- setGap(gap: import('./types/DisplayObject').EdgeSize): void;
51
- setBorder(border: import('./types/DisplayObject').EdgeSize): void;
52
- setPositionType(positionType: "relative" | "absolute"): void;
53
- setWidth(width: number): void;
54
- setHeight(height: number): void;
55
- getWidth(): number;
56
- getHeight(): number;
57
- setMinWidth(minWidth: number | string): void;
58
- setMinHeight(minHeight: number | string): void;
59
- setMaxWidth(maxWidth: number | string): void;
60
- setMaxHeight(maxHeight: number | string): void;
61
- setAspectRatio(aspectRatio: number): void;
62
- setFlexGrow(flexGrow: number): void;
63
- setFlexShrink(flexShrink: number): void;
64
- setFlexBasis(flexBasis: number | string): void;
65
- setRowGap(rowGap: number): void;
66
- setColumnGap(columnGap: number): void;
67
- setTop(top: number | string): void;
68
- setLeft(left: number | string): void;
69
- setRight(right: number | string): void;
70
- setBottom(bottom: number | string): void;
71
- setObjectFit(objectFit: import('./types/DisplayObject').ObjectFit): void;
72
- setObjectPosition(objectPosition: import('./types/DisplayObject').ObjectPosition): void;
73
- setTransformOrigin(transformOrigin: import('./types/DisplayObject').TransformOrigin): void;
74
- };
75
- [x: string]: any;
76
- };
77
- export declare class CanvasContainer extends CanvasContainer_base {
78
- isCustomAnchor: boolean;
79
- onUpdate(props: any): void;
80
- onMount(args: any): Promise<void>;
81
- }
82
- export interface CanvasContainer extends DisplayObjectProps {
83
- }
84
- export declare const Container: ComponentFunction<ContainerProps>;
85
- export {};
86
- //# sourceMappingURL=Container.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../src/components/Container.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI3D,UAAU,cAAe,SAAQ,kBAAkB;IACjD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;;;;;;;;;;;;;;;;;;;;;;iBAuDq/B,CAAC;kBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AArDxgC,qBAAa,eAAgB,SAAQ,oBAA4B;IAC/D,cAAc,UAAQ;IAEtB,QAAQ,CAAC,KAAK,KAAA;IAaR,OAAO,CAAC,IAAI,KAAA;CA0BnB;AAED,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;CAAG;AAI9D,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,CAIvD,CAAC"}
@@ -1,98 +0,0 @@
1
- import { Element } from '../engine/reactive';
2
- import { ComponentFunction } from '../engine/signal';
3
- import { DisplayObjectProps } from './types/DisplayObject';
4
- declare const CanvasDOMContainer_base: {
5
- new (): {
6
- [x: string]: any;
7
- "__#private@#canvasContext": {
8
- [key: string]: any;
9
- } | null;
10
- isFlex: boolean;
11
- fullProps: import('..').Props;
12
- isMounted: boolean;
13
- _anchorPoints: import('pixi.js').ObservablePoint;
14
- isCustomAnchor: boolean;
15
- displayWidth: import('@signe/reactive').WritableSignal<number>;
16
- displayHeight: import('@signe/reactive').WritableSignal<number>;
17
- overrideProps: string[];
18
- layout: any;
19
- onBeforeDestroy: import('./DisplayObject').OnHook | null;
20
- onAfterMount: import('./DisplayObject').OnHook | null;
21
- subjectInit: import('rxjs').BehaviorSubject<any>;
22
- disableLayout: boolean;
23
- "__#private@#registeredEvents": Map<string, Function>;
24
- "__#private@#computedLayoutBox": {
25
- width?: number;
26
- height?: number;
27
- } | null;
28
- "__#private@#element": Element<any> | null;
29
- getElement(): Element<any> | null;
30
- onLayoutComputed(_event: any): void;
31
- get deltaRatio(): any;
32
- get parentIsFlex(): any;
33
- onInit(props: import('..').Props): void;
34
- onMount(element: Element<any>, index?: number): Promise<void>;
35
- onUpdate(props: import('..').Props): void;
36
- onDestroy(parent: Element, afterDestroy?: () => void): Promise<void>;
37
- setFlexDirection(direction: import('./types/DisplayObject').FlexDirection): void;
38
- setFlexWrap(wrap: "wrap" | "nowrap" | "wrap-reverse"): void;
39
- setAlignContent(align: import('./types/DisplayObject').AlignContent): void;
40
- setAlignSelf(align: import('./types/DisplayObject').AlignContent): void;
41
- setAlignItems(align: import('./types/DisplayObject').AlignContent): void;
42
- setJustifyContent(justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around"): void;
43
- setPosition(position: import('./types/DisplayObject').EdgeSize): void;
44
- setX(x: number): void;
45
- setY(y: number): void;
46
- setPadding(padding: import('./types/DisplayObject').EdgeSize): void;
47
- setMargin(margin: import('./types/DisplayObject').EdgeSize): void;
48
- setGap(gap: import('./types/DisplayObject').EdgeSize): void;
49
- setBorder(border: import('./types/DisplayObject').EdgeSize): void;
50
- setPositionType(positionType: "relative" | "absolute"): void;
51
- setWidth(width: number): void;
52
- setHeight(height: number): void;
53
- getWidth(): number;
54
- getHeight(): number;
55
- setMinWidth(minWidth: number | string): void;
56
- setMinHeight(minHeight: number | string): void;
57
- setMaxWidth(maxWidth: number | string): void;
58
- setMaxHeight(maxHeight: number | string): void;
59
- setAspectRatio(aspectRatio: number): void;
60
- setFlexGrow(flexGrow: number): void;
61
- setFlexShrink(flexShrink: number): void;
62
- setFlexBasis(flexBasis: number | string): void;
63
- setRowGap(rowGap: number): void;
64
- setColumnGap(columnGap: number): void;
65
- setTop(top: number | string): void;
66
- setLeft(left: number | string): void;
67
- setRight(right: number | string): void;
68
- setBottom(bottom: number | string): void;
69
- setObjectFit(objectFit: import('./types/DisplayObject').ObjectFit): void;
70
- setObjectPosition(objectPosition: import('./types/DisplayObject').ObjectPosition): void;
71
- setTransformOrigin(transformOrigin: import('./types/DisplayObject').TransformOrigin): void;
72
- };
73
- [x: string]: any;
74
- };
75
- export declare class CanvasDOMContainer extends CanvasDOMContainer_base {
76
- disableLayout: boolean;
77
- private canvasSizeEffect;
78
- private static readonly DOM_ROUTING_MAP;
79
- private static readonly DOM_ALLOWED_TAGS;
80
- private static readonly DOM_UNSUPPORTED_TAGS;
81
- private hasDomContainerAncestor;
82
- private getPercentRatio;
83
- private getCanvasSize;
84
- private shouldUseCanvasPercent;
85
- private syncCanvasSizeEffect;
86
- private applyElementSize;
87
- private routeDomChildren;
88
- onInit(props: any): void;
89
- onMount(element: Element<any>, index?: number): Promise<void>;
90
- onUpdate(props: any): void;
91
- onLayoutComputed(): void;
92
- onDestroy(parent: Element<any>, afterDestroy?: () => void): Promise<void>;
93
- }
94
- export interface CanvasDOMContainer extends DisplayObjectProps {
95
- }
96
- export declare const DOMContainer: ComponentFunction<any>;
97
- export {};
98
- //# sourceMappingURL=DOMContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DOMContainer.d.ts","sourceRoot":"","sources":["../../src/components/DOMContainer.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,OAAO,EAGR,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAK,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;;;;;;;;;;;;;;;;;;;;;;iBAsHnD,CAAC;kBACA,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAnBV,qBAAa,kBAAmB,SAAQ,uBAA+B;IACrE,aAAa,UAAQ;IACrB,OAAO,CAAC,gBAAgB,CAAa;IACrC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAErC;IACF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAIrC;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAqBzC;IAEH,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,sBAAsB;IAO9B,OAAO,CAAC,oBAAoB;IAgB5B,OAAO,CAAC,gBAAgB;IAgDxB,OAAO,CAAC,gBAAgB;IA8BxB,MAAM,CAAC,KAAK,EAAE,GAAG;IA8EX,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM;IAMnD,QAAQ,CAAC,KAAK,EAAE,GAAG;IAMnB,gBAAgB;IAIV,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,IAAI;CAUhE;AAED,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;CAAI;AAIlE,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,GAAG,CAE/C,CAAC"}
@@ -1,94 +0,0 @@
1
- import { Element, Props } from '../engine/reactive';
2
- import { AlignContent, EdgeSize, FlexDirection, ObjectFit, ObjectPosition, TransformOrigin } from './types/DisplayObject';
3
- import { ObservablePoint, Point, Rectangle } from 'pixi.js';
4
- import { BehaviorSubject } from 'rxjs';
5
- export interface ComponentInstance extends PixiMixins.ContainerOptions {
6
- id?: string;
7
- children?: ComponentInstance[];
8
- onInit?(props: Props): void;
9
- onUpdate?(props: Props): void;
10
- onDestroy?(parent: Element, afterDestroy: () => void): void;
11
- onMount?(context: Element<any>, index?: number): void;
12
- setWidth(width: number): void;
13
- setHeight(height: number): void;
14
- getLocalBounds?(): Rectangle;
15
- getGlobalPosition?(): Point;
16
- }
17
- export declare const EVENTS: string[];
18
- export type OnHook = (() => void) | (() => Promise<void> | void);
19
- export declare function DisplayObject(extendClass: any): {
20
- new (): {
21
- [x: string]: any;
22
- "__#private@#canvasContext": {
23
- [key: string]: any;
24
- } | null;
25
- isFlex: boolean;
26
- fullProps: Props;
27
- isMounted: boolean;
28
- _anchorPoints: ObservablePoint;
29
- isCustomAnchor: boolean;
30
- displayWidth: import('@signe/reactive').WritableSignal<number>;
31
- displayHeight: import('@signe/reactive').WritableSignal<number>;
32
- overrideProps: string[];
33
- layout: any;
34
- onBeforeDestroy: OnHook | null;
35
- onAfterMount: OnHook | null;
36
- subjectInit: BehaviorSubject<any>;
37
- disableLayout: boolean;
38
- "__#private@#registeredEvents": Map<string, Function>;
39
- "__#private@#computedLayoutBox": {
40
- width?: number;
41
- height?: number;
42
- } | null;
43
- "__#private@#element": Element<any> | null;
44
- /**
45
- * Get the element reference for freeze checking
46
- * @returns The element reference or null
47
- */
48
- getElement(): Element<any> | null;
49
- onLayoutComputed(_event: any): void;
50
- get deltaRatio(): any;
51
- get parentIsFlex(): any;
52
- onInit(props: Props): void;
53
- onMount(element: Element<any>, index?: number): Promise<void>;
54
- onUpdate(props: Props): void;
55
- onDestroy(parent: Element, afterDestroy?: () => void): Promise<void>;
56
- setFlexDirection(direction: FlexDirection): void;
57
- setFlexWrap(wrap: "wrap" | "nowrap" | "wrap-reverse"): void;
58
- setAlignContent(align: AlignContent): void;
59
- setAlignSelf(align: AlignContent): void;
60
- setAlignItems(align: AlignContent): void;
61
- setJustifyContent(justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around"): void;
62
- setPosition(position: EdgeSize): void;
63
- setX(x: number): void;
64
- setY(y: number): void;
65
- setPadding(padding: EdgeSize): void;
66
- setMargin(margin: EdgeSize): void;
67
- setGap(gap: EdgeSize): void;
68
- setBorder(border: EdgeSize): void;
69
- setPositionType(positionType: "relative" | "absolute"): void;
70
- setWidth(width: number): void;
71
- setHeight(height: number): void;
72
- getWidth(): number;
73
- getHeight(): number;
74
- setMinWidth(minWidth: number | string): void;
75
- setMinHeight(minHeight: number | string): void;
76
- setMaxWidth(maxWidth: number | string): void;
77
- setMaxHeight(maxHeight: number | string): void;
78
- setAspectRatio(aspectRatio: number): void;
79
- setFlexGrow(flexGrow: number): void;
80
- setFlexShrink(flexShrink: number): void;
81
- setFlexBasis(flexBasis: number | string): void;
82
- setRowGap(rowGap: number): void;
83
- setColumnGap(columnGap: number): void;
84
- setTop(top: number | string): void;
85
- setLeft(left: number | string): void;
86
- setRight(right: number | string): void;
87
- setBottom(bottom: number | string): void;
88
- setObjectFit(objectFit: ObjectFit): void;
89
- setObjectPosition(objectPosition: ObjectPosition): void;
90
- setTransformOrigin(transformOrigin: TransformOrigin): void;
91
- };
92
- [x: string]: any;
93
- };
94
- //# sourceMappingURL=DisplayObject.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DisplayObject.d.ts","sourceRoot":"","sources":["../../src/components/DisplayObject.ts"],"names":[],"mappings":"AAA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geometry, Shader, Texture } from 'pixi.js';
2
- import { Element } from '../engine/reactive';
3
- import { ComponentInstance } from './DisplayObject';
4
- import { DisplayObjectProps } from './types/DisplayObject';
5
- import { SignalOrPrimitive } from './types';
6
- import { ComponentFunction } from '../engine/signal';
7
- /**
8
- * Interface defining the properties for a Mesh component.
9
- * Extends DisplayObjectProps to inherit common display object properties.
10
- */
11
- interface MeshProps extends DisplayObjectProps {
12
- /** The geometry defining the mesh structure (vertices, indices, UVs, etc.) */
13
- geometry?: Geometry;
14
- /** The shader to render the mesh with */
15
- shader?: Shader;
16
- /** The texture to apply to the mesh */
17
- texture?: Texture | string;
18
- /** The image URL to load as texture */
19
- image?: string;
20
- /** The tint color to apply to the mesh */
21
- tint?: SignalOrPrimitive<number>;
22
- /** Whether to round pixels for sharper rendering */
23
- roundPixels?: SignalOrPrimitive<boolean>;
24
- }
25
- declare const CanvasMesh_base: {
26
- new (): {
27
- [x: string]: any;
28
- "__#private@#canvasContext": {
29
- [key: string]: any;
30
- } | null;
31
- isFlex: boolean;
32
- fullProps: import('..').Props;
33
- isMounted: boolean;
34
- _anchorPoints: import('pixi.js').ObservablePoint;
35
- isCustomAnchor: boolean;
36
- displayWidth: import('@signe/reactive').WritableSignal<number>;
37
- displayHeight: import('@signe/reactive').WritableSignal<number>;
38
- overrideProps: string[];
39
- layout: any;
40
- onBeforeDestroy: import('./DisplayObject').OnHook | null;
41
- onAfterMount: import('./DisplayObject').OnHook | null;
42
- subjectInit: import('rxjs').BehaviorSubject<any>;
43
- disableLayout: boolean;
44
- "__#private@#registeredEvents": Map<string, Function>;
45
- "__#private@#computedLayoutBox": {
46
- width?: number;
47
- height?: number;
48
- } | null;
49
- "__#private@#element": Element<any> | null;
50
- getElement(): Element<any> | null;
51
- onLayoutComputed(_event: any): void;
52
- get deltaRatio(): any;
53
- get parentIsFlex(): any;
54
- onInit(props: import('..').Props): void;
55
- onMount(element: Element<any>, index?: number): Promise<void>;
56
- onUpdate(props: import('..').Props): void;
57
- onDestroy(parent: Element, afterDestroy?: () => void): Promise<void>;
58
- setFlexDirection(direction: import('./types/DisplayObject').FlexDirection): void;
59
- setFlexWrap(wrap: "wrap" | "nowrap" | "wrap-reverse"): void;
60
- setAlignContent(align: import('./types/DisplayObject').AlignContent): void;
61
- setAlignSelf(align: import('./types/DisplayObject').AlignContent): void;
62
- setAlignItems(align: import('./types/DisplayObject').AlignContent): void;
63
- setJustifyContent(justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around"): void;
64
- setPosition(position: import('./types/DisplayObject').EdgeSize): void;
65
- setX(x: number): void;
66
- setY(y: number): void;
67
- setPadding(padding: import('./types/DisplayObject').EdgeSize): void;
68
- setMargin(margin: import('./types/DisplayObject').EdgeSize): void;
69
- setGap(gap: import('./types/DisplayObject').EdgeSize): void;
70
- setBorder(border: import('./types/DisplayObject').EdgeSize): void;
71
- setPositionType(positionType: "relative" | "absolute"): void;
72
- setWidth(width: number): void;
73
- setHeight(height: number): void;
74
- getWidth(): number;
75
- getHeight(): number;
76
- setMinWidth(minWidth: number | string): void;
77
- setMinHeight(minHeight: number | string): void;
78
- setMaxWidth(maxWidth: number | string): void;
79
- setMaxHeight(maxHeight: number | string): void;
80
- setAspectRatio(aspectRatio: number): void;
81
- setFlexGrow(flexGrow: number): void;
82
- setFlexShrink(flexShrink: number): void;
83
- setFlexBasis(flexBasis: number | string): void;
84
- setRowGap(rowGap: number): void;
85
- setColumnGap(columnGap: number): void;
86
- setTop(top: number | string): void;
87
- setLeft(left: number | string): void;
88
- setRight(right: number | string): void;
89
- setBottom(bottom: number | string): void;
90
- setObjectFit(objectFit: import('./types/DisplayObject').ObjectFit): void;
91
- setObjectPosition(objectPosition: import('./types/DisplayObject').ObjectPosition): void;
92
- setTransformOrigin(transformOrigin: import('./types/DisplayObject').TransformOrigin): void;
93
- };
94
- [x: string]: any;
95
- };
96
- /**
97
- * Canvas Mesh component class that extends DisplayObject with PixiMesh functionality.
98
- * This component allows rendering of custom 3D meshes with shaders and textures.
99
- *
100
- * @example
101
- * ```typescript
102
- * // Basic mesh with geometry and texture
103
- * const mesh = Mesh({
104
- * geometry: myGeometry,
105
- * texture: "path/to/texture.png",
106
- * tint: 0xff0000
107
- * });
108
- *
109
- * // Mesh with custom shader
110
- * const customMesh = Mesh({
111
- * geometry: myGeometry,
112
- * shader: myCustomShader,
113
- * draw: (mesh) => {
114
- * // Custom mesh manipulation
115
- * mesh.rotation += 0.01;
116
- * }
117
- * });
118
- * ```
119
- */
120
- declare class CanvasMesh extends CanvasMesh_base {
121
- /**
122
- * Constructor for the CanvasMesh component.
123
- * Initializes the PixiMesh with default geometry and shader to prevent errors.
124
- *
125
- * @example
126
- * ```typescript
127
- * // This constructor is called internally by the engine
128
- * const mesh = new CanvasMesh();
129
- * ```
130
- */
131
- constructor();
132
- /**
133
- * Initializes the mesh component with the provided properties.
134
- * This method is called before onUpdate to set up initial state.
135
- *
136
- * @param props - The initial properties
137
- * @example
138
- * ```typescript
139
- * // This method is called internally when the component is created
140
- * mesh.onInit({
141
- * geometry: myGeometry,
142
- * texture: "texture.png"
143
- * });
144
- * ```
145
- */
146
- onInit(props: MeshProps): void;
147
- /**
148
- * Updates the mesh component when properties change.
149
- * Handles texture loading, shader updates, and other property changes.
150
- *
151
- * @param props - The updated properties
152
- * @example
153
- * ```typescript
154
- * // This method is called internally when props change
155
- * mesh.onUpdate({
156
- * tint: 0x00ff00,
157
- * texture: "new-texture.png"
158
- * });
159
- * ```
160
- */
161
- onUpdate(props: MeshProps): Promise<void>;
162
- /**
163
- * Called when the component is about to be destroyed.
164
- * Cleans up the draw effect subscription and calls the parent destroy method.
165
- *
166
- * @param parent - The parent element
167
- * @param afterDestroy - Callback function to execute after destruction
168
- * @example
169
- * ```typescript
170
- * // This method is typically called by the engine internally
171
- * await mesh.onDestroy(parentElement, () => console.log('Mesh destroyed'));
172
- * ```
173
- */
174
- onDestroy(parent: Element<ComponentInstance>, afterDestroy: () => void): Promise<void>;
175
- }
176
- /**
177
- * Creates a Mesh component with the specified properties.
178
- * This is the main function used to create mesh instances in your application.
179
- *
180
- * @param props - The properties for the mesh component
181
- * @returns A mesh component element
182
- * @example
183
- * ```typescript
184
- * import { Mesh } from 'canvasengine';
185
- *
186
- * // Create a basic textured mesh
187
- * const myMesh = Mesh({
188
- * geometry: triangleGeometry,
189
- * texture: "assets/texture.png",
190
- * x: 100,
191
- * y: 100,
192
- * tint: 0xff0000
193
- * });
194
- *
195
- * // Create a mesh with custom shader
196
- * const shaderMesh = Mesh({
197
- * geometry: planeGeometry,
198
- * shader: customShader,
199
- * draw: (mesh) => {
200
- * mesh.rotation += 0.01;
201
- * }
202
- * });
203
- * ```
204
- */
205
- export declare const Mesh: ComponentFunction<MeshProps>;
206
- export { CanvasMesh };
207
- export type { MeshProps };
208
- //# sourceMappingURL=Mesh.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Mesh.d.ts","sourceRoot":"","sources":["../../src/components/Mesh.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAuB,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAmB,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;GAGG;AACH,UAAU,SAAU,SAAQ,kBAAkB;IAC5C,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;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