canvasengine 2.0.0-beta.6 → 2.0.0-beta.60

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.
Files changed (164) hide show
  1. package/dist/DebugRenderer-DkjTAc48.js +1384 -0
  2. package/dist/DebugRenderer-DkjTAc48.js.map +1 -0
  3. package/dist/components/Button.d.ts +185 -0
  4. package/dist/components/Button.d.ts.map +1 -0
  5. package/dist/components/Canvas.d.ts +17 -0
  6. package/dist/components/Canvas.d.ts.map +1 -0
  7. package/dist/components/DOMElement.d.ts +54 -0
  8. package/dist/components/DOMElement.d.ts.map +1 -0
  9. package/dist/components/DOMSprite.d.ts +127 -0
  10. package/dist/components/DOMSprite.d.ts.map +1 -0
  11. package/dist/components/FocusContainer.d.ts +129 -0
  12. package/dist/components/FocusContainer.d.ts.map +1 -0
  13. package/dist/components/Graphic.d.ts +64 -0
  14. package/dist/components/Graphic.d.ts.map +1 -0
  15. package/dist/components/Joystick.d.ts +36 -0
  16. package/dist/components/Joystick.d.ts.map +1 -0
  17. package/dist/components/NineSliceSprite.d.ts +16 -0
  18. package/dist/components/NineSliceSprite.d.ts.map +1 -0
  19. package/dist/components/ParticleEmitter.d.ts +4 -0
  20. package/dist/components/ParticleEmitter.d.ts.map +1 -0
  21. package/dist/components/Scene.d.ts +2 -0
  22. package/dist/components/Scene.d.ts.map +1 -0
  23. package/dist/components/Text.d.ts +25 -0
  24. package/dist/components/Text.d.ts.map +1 -0
  25. package/dist/components/TilingSprite.d.ts +17 -0
  26. package/dist/components/TilingSprite.d.ts.map +1 -0
  27. package/dist/components/Video.d.ts +14 -0
  28. package/dist/components/Video.d.ts.map +1 -0
  29. package/dist/components/index.d.ts +20 -0
  30. package/dist/components/index.d.ts.map +1 -0
  31. package/dist/components/types/DisplayObject.d.ts +118 -0
  32. package/dist/components/types/DisplayObject.d.ts.map +1 -0
  33. package/dist/components/types/MouseEvent.d.ts +4 -0
  34. package/dist/components/types/MouseEvent.d.ts.map +1 -0
  35. package/dist/components/types/Spritesheet.d.ts +248 -0
  36. package/dist/components/types/Spritesheet.d.ts.map +1 -0
  37. package/dist/components/types/index.d.ts +4 -0
  38. package/dist/components/types/index.d.ts.map +1 -0
  39. package/dist/directives/Controls.d.ts +112 -0
  40. package/dist/directives/Controls.d.ts.map +1 -0
  41. package/dist/directives/ControlsBase.d.ts +199 -0
  42. package/dist/directives/ControlsBase.d.ts.map +1 -0
  43. package/dist/directives/Drag.d.ts +69 -0
  44. package/dist/directives/Drag.d.ts.map +1 -0
  45. package/dist/directives/Flash.d.ts +116 -0
  46. package/dist/directives/Flash.d.ts.map +1 -0
  47. package/dist/directives/FocusNavigation.d.ts +52 -0
  48. package/dist/directives/FocusNavigation.d.ts.map +1 -0
  49. package/dist/directives/FogVisibility.d.ts +47 -0
  50. package/dist/directives/FogVisibility.d.ts.map +1 -0
  51. package/dist/directives/GamepadControls.d.ts +224 -0
  52. package/dist/directives/GamepadControls.d.ts.map +1 -0
  53. package/dist/directives/JoystickControls.d.ts +171 -0
  54. package/dist/directives/JoystickControls.d.ts.map +1 -0
  55. package/dist/directives/KeyboardControls.d.ts +219 -0
  56. package/dist/directives/KeyboardControls.d.ts.map +1 -0
  57. package/dist/directives/Scheduler.d.ts +35 -0
  58. package/dist/directives/Scheduler.d.ts.map +1 -0
  59. package/dist/directives/Shake.d.ts +98 -0
  60. package/dist/directives/Shake.d.ts.map +1 -0
  61. package/dist/directives/Sound.d.ts +25 -0
  62. package/dist/directives/Sound.d.ts.map +1 -0
  63. package/dist/directives/Transition.d.ts +10 -0
  64. package/dist/directives/Transition.d.ts.map +1 -0
  65. package/dist/directives/ViewportCull.d.ts +11 -0
  66. package/dist/directives/ViewportCull.d.ts.map +1 -0
  67. package/dist/directives/ViewportFollow.d.ts +18 -0
  68. package/dist/directives/ViewportFollow.d.ts.map +1 -0
  69. package/dist/directives/index.d.ts +14 -0
  70. package/dist/directives/index.d.ts.map +1 -0
  71. package/dist/dist-BOOc43Qm.js +778 -0
  72. package/dist/dist-BOOc43Qm.js.map +1 -0
  73. package/dist/engine/FocusManager.d.ts +174 -0
  74. package/dist/engine/FocusManager.d.ts.map +1 -0
  75. package/dist/engine/animation.d.ts +72 -0
  76. package/dist/engine/animation.d.ts.map +1 -0
  77. package/dist/engine/bootstrap.d.ts +48 -0
  78. package/dist/engine/bootstrap.d.ts.map +1 -0
  79. package/dist/engine/directive.d.ts +13 -0
  80. package/dist/engine/directive.d.ts.map +1 -0
  81. package/dist/engine/reactive.d.ts +134 -0
  82. package/dist/engine/reactive.d.ts.map +1 -0
  83. package/dist/engine/signal.d.ts +71 -0
  84. package/dist/engine/signal.d.ts.map +1 -0
  85. package/dist/engine/trigger.d.ts +54 -0
  86. package/dist/engine/trigger.d.ts.map +1 -0
  87. package/dist/engine/utils.d.ts +89 -0
  88. package/dist/engine/utils.d.ts.map +1 -0
  89. package/dist/hooks/addContext.d.ts +2 -0
  90. package/dist/hooks/addContext.d.ts.map +1 -0
  91. package/dist/hooks/useFocus.d.ts +60 -0
  92. package/dist/hooks/useFocus.d.ts.map +1 -0
  93. package/dist/hooks/useProps.d.ts +42 -0
  94. package/dist/hooks/useProps.d.ts.map +1 -0
  95. package/dist/hooks/useRef.d.ts +4 -0
  96. package/dist/hooks/useRef.d.ts.map +1 -0
  97. package/dist/index.d.ts +19 -1107
  98. package/dist/index.d.ts.map +1 -0
  99. package/dist/index.global.js +5 -0
  100. package/dist/index.global.js.map +1 -0
  101. package/dist/index.js +9768 -3135
  102. package/dist/index.js.map +1 -1
  103. package/dist/utils/Ease.d.ts +17 -0
  104. package/dist/utils/Ease.d.ts.map +1 -0
  105. package/dist/utils/GlobalAssetLoader.d.ts +141 -0
  106. package/dist/utils/GlobalAssetLoader.d.ts.map +1 -0
  107. package/dist/utils/RadialGradient.d.ts +57 -0
  108. package/dist/utils/RadialGradient.d.ts.map +1 -0
  109. package/dist/utils/functions.d.ts +2 -0
  110. package/dist/utils/functions.d.ts.map +1 -0
  111. package/dist/utils/tabindex.d.ts +16 -0
  112. package/dist/utils/tabindex.d.ts.map +1 -0
  113. package/package.json +15 -9
  114. package/src/components/Button.ts +399 -0
  115. package/src/components/Canvas.ts +62 -46
  116. package/src/components/Container.ts +21 -2
  117. package/src/components/DOMContainer.ts +379 -0
  118. package/src/components/DOMElement.ts +556 -0
  119. package/src/components/DOMSprite.ts +1040 -0
  120. package/src/components/DisplayObject.ts +419 -201
  121. package/src/components/FocusContainer.ts +368 -0
  122. package/src/components/Graphic.ts +227 -66
  123. package/src/components/Joystick.ts +363 -0
  124. package/src/components/Mesh.ts +222 -0
  125. package/src/components/NineSliceSprite.ts +4 -1
  126. package/src/components/ParticleEmitter.ts +12 -8
  127. package/src/components/Sprite.ts +418 -52
  128. package/src/components/Text.ts +125 -18
  129. package/src/components/Viewport.ts +122 -63
  130. package/src/components/index.ts +9 -2
  131. package/src/components/types/DisplayObject.ts +53 -5
  132. package/src/components/types/Spritesheet.ts +0 -118
  133. package/src/directives/Controls.ts +254 -0
  134. package/src/directives/ControlsBase.ts +267 -0
  135. package/src/directives/Drag.ts +357 -52
  136. package/src/directives/Flash.ts +419 -0
  137. package/src/directives/FocusNavigation.ts +113 -0
  138. package/src/directives/FogVisibility.ts +273 -0
  139. package/src/directives/GamepadControls.ts +537 -0
  140. package/src/directives/JoystickControls.ts +396 -0
  141. package/src/directives/KeyboardControls.ts +85 -430
  142. package/src/directives/Scheduler.ts +12 -4
  143. package/src/directives/Shake.ts +298 -0
  144. package/src/directives/Sound.ts +94 -31
  145. package/src/directives/ViewportFollow.ts +40 -9
  146. package/src/directives/index.ts +13 -6
  147. package/src/engine/FocusManager.ts +510 -0
  148. package/src/engine/animation.ts +175 -21
  149. package/src/engine/bootstrap.ts +93 -3
  150. package/src/engine/directive.ts +4 -4
  151. package/src/engine/reactive.ts +979 -176
  152. package/src/engine/signal.ts +113 -25
  153. package/src/engine/trigger.ts +34 -7
  154. package/src/engine/utils.ts +19 -3
  155. package/src/hooks/useFocus.ts +91 -0
  156. package/src/hooks/useProps.ts +1 -1
  157. package/src/index.ts +8 -2
  158. package/src/types/pixi-cull.d.ts +7 -0
  159. package/src/utils/GlobalAssetLoader.ts +257 -0
  160. package/src/utils/functions.ts +7 -0
  161. package/src/utils/tabindex.ts +70 -0
  162. package/testing/index.ts +35 -4
  163. package/tsconfig.json +18 -0
  164. package/vite.config.ts +39 -0
@@ -0,0 +1,185 @@
1
+ import { Signal } from '@signe/reactive';
2
+ import { FederatedPointerEvent } from 'pixi.js';
3
+ import { ControlsDirective } from '../directives/Controls';
4
+ import { JoystickControls } from '../directives/JoystickControls';
5
+ import { Element } from '../engine/reactive';
6
+ /**
7
+ * Button states for visual feedback
8
+ */
9
+ export declare enum ButtonState {
10
+ Normal = "normal",
11
+ Hover = "hover",
12
+ Pressed = "pressed",
13
+ Disabled = "disabled"
14
+ }
15
+ /**
16
+ * Button style configuration for different visual approaches
17
+ */
18
+ export interface ButtonStyle {
19
+ /** Background color for each state */
20
+ backgroundColor?: {
21
+ [ButtonState.Normal]?: string;
22
+ [ButtonState.Hover]?: string;
23
+ [ButtonState.Pressed]?: string;
24
+ [ButtonState.Disabled]?: string;
25
+ };
26
+ /** Border configuration */
27
+ border?: {
28
+ color?: string;
29
+ width?: number;
30
+ radius?: number;
31
+ };
32
+ /** Text styling */
33
+ text?: {
34
+ color?: string;
35
+ fontSize?: number;
36
+ fontFamily?: string;
37
+ };
38
+ /** Sprite textures for each state (alternative to backgroundColor) */
39
+ textures?: {
40
+ [ButtonState.Normal]?: string;
41
+ [ButtonState.Hover]?: string;
42
+ [ButtonState.Pressed]?: string;
43
+ [ButtonState.Disabled]?: string;
44
+ };
45
+ }
46
+ /**
47
+ * Properties for the Button component
48
+ */
49
+ export interface ButtonProps {
50
+ /** Button text content */
51
+ text?: string;
52
+ /** Button disabled state */
53
+ disabled?: boolean;
54
+ /** Click event handler */
55
+ click?: (event: FederatedPointerEvent) => void;
56
+ /** Hover enter event handler */
57
+ hoverEnter?: (event: FederatedPointerEvent) => void;
58
+ /** Hover leave event handler */
59
+ hoverLeave?: (event: FederatedPointerEvent) => void;
60
+ /** Press down event handler */
61
+ pressDown?: (event: FederatedPointerEvent) => void;
62
+ /** Press up event handler */
63
+ pressUp?: (event: FederatedPointerEvent) => void;
64
+ /** Visual style configuration */
65
+ style?: ButtonStyle;
66
+ /** Button width */
67
+ width?: number;
68
+ /** Button height */
69
+ height?: number;
70
+ /** Button position X */
71
+ x?: number;
72
+ /** Button position Y */
73
+ y?: number;
74
+ /** Button alpha/opacity */
75
+ alpha?: number;
76
+ /** Button visibility */
77
+ visible?: boolean;
78
+ /** Button cursor */
79
+ cursor?: string;
80
+ /** Controls instance to automatically apply button events to (e.g., ControlsDirective or JoystickControls) */
81
+ controls?: ControlsDirective | JoystickControls | any;
82
+ /** Name of the control to trigger with applyControl when button is clicked */
83
+ controlName?: string;
84
+ /** Shape of the button background: 'rect', 'circle', or 'ellipse' */
85
+ shape?: 'rect' | 'circle' | 'ellipse';
86
+ /** Custom background component or element (replaces default background if provided) */
87
+ background?: Element | any;
88
+ /** Custom children components for button content (takes priority over text if provided) */
89
+ children?: Element[];
90
+ /** Focus index for the button */
91
+ tabindex?: number | Signal<number>;
92
+ }
93
+ /**
94
+ * Creates a Button component with interactive states and customizable styling.
95
+ *
96
+ * This component provides a fully interactive button with visual feedback
97
+ * for different states (normal, hover, pressed, disabled). It supports both
98
+ * sprite-based and graphics-based rendering approaches.
99
+ *
100
+ * The button is built using a Container with background and text elements,
101
+ * providing reactive state management and event handling.
102
+ *
103
+ * ## Features
104
+ *
105
+ * - **Controls Integration**: Automatically trigger controls via `applyControl` when clicked
106
+ * - **Multiple Shapes**: Support for rect, circle, and ellipse shapes
107
+ * - **Custom Content**: Use children components for custom button content
108
+ * - **Custom Background**: Provide a custom background component
109
+ *
110
+ * @param props - Button configuration including text, styling, controls, shape, and event handlers
111
+ * @returns A reactive Button component
112
+ * @example
113
+ * ```typescript
114
+ * // Simple button with text and click handler
115
+ * const simpleButton = Button({
116
+ * text: "Click Me",
117
+ * click: () => console.log("Button clicked!"),
118
+ * width: 150,
119
+ * height: 50
120
+ * });
121
+ *
122
+ * // Button with controls integration
123
+ * const jumpButton = Button({
124
+ * text: "Jump",
125
+ * controls: controlsInstance,
126
+ * controlName: "jump",
127
+ * width: 120,
128
+ * height: 40
129
+ * });
130
+ *
131
+ * // Circular button
132
+ * const circleButton = Button({
133
+ * text: "Action",
134
+ * shape: "circle",
135
+ * width: 100,
136
+ * height: 100
137
+ * });
138
+ *
139
+ * // Button with custom content (children)
140
+ * const customButton = Button({
141
+ * shape: "circle",
142
+ * width: 80,
143
+ * height: 80,
144
+ * children: [
145
+ * h(Sprite, { image: "icon.png", width: 50, height: 50 })
146
+ * ]
147
+ * });
148
+ *
149
+ * // Styled button with custom colors
150
+ * const styledButton = Button({
151
+ * text: "Styled Button",
152
+ * style: {
153
+ * backgroundColor: {
154
+ * normal: "#28a745",
155
+ * hover: "#218838",
156
+ * pressed: "#1e7e34",
157
+ * disabled: "#6c757d"
158
+ * },
159
+ * border: {
160
+ * radius: 8,
161
+ * width: 2,
162
+ * color: "#ffffff"
163
+ * },
164
+ * text: {
165
+ * fontSize: 18,
166
+ * color: "#ffffff"
167
+ * }
168
+ * }
169
+ * });
170
+ *
171
+ * // Sprite-based button
172
+ * const spriteButton = Button({
173
+ * text: "Play Game",
174
+ * style: {
175
+ * textures: {
176
+ * normal: "/assets/button-normal.png",
177
+ * hover: "/assets/button-hover.png",
178
+ * pressed: "/assets/button-pressed.png"
179
+ * }
180
+ * }
181
+ * });
182
+ * ```
183
+ */
184
+ export declare function Button(props: ButtonProps): Element<import('./DisplayObject').ComponentInstance> | Promise<Element<import('./DisplayObject').ComponentInstance>>;
185
+ //# sourceMappingURL=Button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,MAAM,EAAE,MAAM,iBAAi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AAU,CAAC,EAAE,OAAO,GAAG,GAAG,CAAC;IAC3B,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,wHA8MxC"}
@@ -0,0 +1,17 @@
1
+ import { Props } from '../engine/reactive';
2
+ import { ComponentFunction } from '../engine/signal';
3
+ import { SignalOrPrimitive } from './types';
4
+ import { Size } from './types/DisplayObject';
5
+ export interface CanvasProps extends Props {
6
+ cursorStyles?: () => any;
7
+ width?: SignalOrPrimitive<Size>;
8
+ height?: SignalOrPrimitive<Size>;
9
+ canvasEl?: HTMLElement;
10
+ selector?: string;
11
+ isRoot?: boolean;
12
+ tick?: any;
13
+ class?: SignalOrPrimitive<string>;
14
+ background?: string;
15
+ }
16
+ export declare const Canvas: ComponentFunction<CanvasProps>;
17
+ //# sourceMappingURL=Canvas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../src/components/Canvas.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EAIN,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAgB7C,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC;IACzB,KAAK,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,CA6GjD,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { Element } from '../engine/reactive';
2
+ import { OnHook } from './DisplayObject';
3
+ import { ComponentFunction } from '../engine/signal';
4
+ import { DisplayObjectProps } from './types/DisplayObject';
5
+ export interface DOMElementProps extends DisplayObjectProps {
6
+ element?: string | {
7
+ value: HTMLElement;
8
+ };
9
+ textContent?: string;
10
+ attrs?: Record<string, any> & {
11
+ class?: string | string[] | Record<string, boolean> | {
12
+ items?: string[];
13
+ } | {
14
+ value?: string | string[] | Record<string, boolean>;
15
+ };
16
+ style?: string | Record<string, string | number> | {
17
+ value?: string | Record<string, string | number>;
18
+ };
19
+ };
20
+ onBeforeDestroy?: OnHook;
21
+ }
22
+ export interface DOMContainerProps extends DOMElementProps {
23
+ element: string | {
24
+ value: HTMLElement;
25
+ };
26
+ }
27
+ export declare class CanvasDOMElement {
28
+ element: HTMLElement;
29
+ private eventListeners;
30
+ private onBeforeDestroy;
31
+ private valueSignal;
32
+ private isFormElementType;
33
+ private classSubscriptions;
34
+ private childTextSubscriptions;
35
+ /**
36
+ * Checks if the element is a form element that supports the value attribute
37
+ * @param elementType - The element type string from props
38
+ * @returns true if the element is a form element with value support
39
+ */
40
+ private isFormElement;
41
+ private collectClassTokens;
42
+ private collectClassSignals;
43
+ private applyClassList;
44
+ private syncClassSubscriptions;
45
+ private appendChildElement;
46
+ onInit(props: DOMElementProps): void;
47
+ onMount(context: Element<CanvasDOMElement>): void;
48
+ onUpdate(props: DOMElementProps): void;
49
+ onDestroy(parent: Element<CanvasDOMElement>, afterDestroy: () => void): Promise<void>;
50
+ }
51
+ export interface CanvasDOMElement extends DisplayObjectProps {
52
+ }
53
+ export declare const DOMElement: ComponentFunction<DOMContainerProps>;
54
+ //# sourceMappingURL=DOMElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DOMElement.d.ts","sourceRoot":"","sources":["../../src/components/DOMElement.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,EAER,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAoC,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI3D,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;IACzD,OAAO,CAAC,EACN,MAAM,GACN;QACA,KAAK,EAAE,WAAW,CAAC;KACpB,CAAC;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;QAC5B,KAAK,CAAC,EACJ,MAAM,GACN,MAAM,EAAE,GACR,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB;YAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,GACpB;YAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,CAAC;QAC1D,KAAK,CAAC,EACJ,MAAM,GACN,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAC/B;YAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;SAAE,CAAC;KACxD,CAAC;IACF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,OAAO,EACL,MAAM,GACN;QACA,KAAK,EAAE,WAAW,CAAC;KACpB,CAAC;CACH;AAwKD,qBAAa,gBAAgB;IACpB,OAAO,EAAE,WAAW,CAAC;IAC5B,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC,eAAe,CAAuB;IAC9C,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,OAAO,CAAC,kBAAkB,CAA0C;IACpE,OAAO,CAAC,sBAAsB,CAA0C;IAExE;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,kBAAkB;IAwB1B,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,sBAAsB;IAmB9B,OAAO,CAAC,kBAAkB;IAqD1B,MAAM,CAAC,KAAK,EAAE,eAAe;IAyD7B,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAgC1C,QAAQ,CAAC,KAAK,EAAE,eAAe;IAqEzB,SAAS,CACb,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,EACjC,YAAY,EAAE,MAAM,IAAI,GACvB,OAAO,CAAC,IAAI,CAAC;CA6BjB;AAED,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;CAAI;AAIhE,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,iBAAiB,CAE3D,CAAC"}
@@ -0,0 +1,127 @@
1
+ import { Signal } from '@signe/reactive';
2
+ import { Element } from '../engine/reactive';
3
+ import { ComponentFunction } from '../engine/signal';
4
+ import { CanvasDOMElement, DOMElementProps } from './DOMElement';
5
+ import { OnHook } from './DisplayObject';
6
+ import { Tick } from '../directives/Scheduler';
7
+ import { SpritesheetOptions } from './types/Spritesheet';
8
+ export interface DOMSpriteFrame {
9
+ x: number;
10
+ y: number;
11
+ width: number;
12
+ height: number;
13
+ }
14
+ export interface DOMSpriteProps extends DOMElementProps {
15
+ image?: string;
16
+ rectangle?: DOMSpriteFrame | {
17
+ value?: DOMSpriteFrame;
18
+ };
19
+ frames?: DOMSpriteFrame[];
20
+ frameIndex?: number;
21
+ fps?: number;
22
+ playing?: boolean;
23
+ loop?: boolean;
24
+ sheet?: {
25
+ definition?: DOMSpriteSheetDefinition | {
26
+ value?: DOMSpriteSheetDefinition;
27
+ } | Signal<DOMSpriteSheetDefinition | undefined> | Promise<DOMSpriteSheetDefinition>;
28
+ playing?: string;
29
+ params?: any;
30
+ onFinish?: () => void;
31
+ };
32
+ element?: "div" | "img";
33
+ class?: any;
34
+ style?: any;
35
+ attrs?: Record<string, any> & {
36
+ class?: string | string[] | Record<string, boolean> | {
37
+ items?: string[];
38
+ } | {
39
+ value?: string | string[] | Record<string, boolean>;
40
+ };
41
+ style?: string | Record<string, string | number> | {
42
+ value?: string | Record<string, string | number>;
43
+ };
44
+ };
45
+ onBeforeDestroy?: OnHook;
46
+ context?: {
47
+ tick?: Signal<Tick | null>;
48
+ };
49
+ }
50
+ type DOMSpriteSheetDefinition = SpritesheetOptions & {
51
+ image?: string;
52
+ };
53
+ export declare class CanvasDOMSprite extends CanvasDOMElement {
54
+ private frameIndex;
55
+ private frames;
56
+ private rectangle?;
57
+ private image?;
58
+ private fps;
59
+ private loop;
60
+ private playing;
61
+ private hasExternalFrameIndex;
62
+ private elapsed;
63
+ private tickSignal?;
64
+ private tickSubscription?;
65
+ private sheetSubscriptions;
66
+ private sheetDefinition?;
67
+ private sheetAnimations;
68
+ private sheetCurrentAnimation?;
69
+ private sheetCurrentName?;
70
+ private sheetParams;
71
+ private sheetTime;
72
+ private sheetFrameIndex;
73
+ private sheetFinished;
74
+ private sheetLoadToken;
75
+ private sheetOnFinish?;
76
+ private rafId?;
77
+ private lastRafTimestamp?;
78
+ private lastTickTimestamp?;
79
+ private renderElementType;
80
+ private wrapperElementType;
81
+ private isAnimating;
82
+ private playingSubscription?;
83
+ private playingSignal?;
84
+ private explicitWidth?;
85
+ private explicitHeight?;
86
+ private frameWidth;
87
+ private frameHeight;
88
+ private fitMode?;
89
+ private renderElement?;
90
+ private isContained;
91
+ onInit(props: DOMElementProps): void;
92
+ onMount(context: Element<CanvasDOMElement>): void;
93
+ onUpdate(props: DOMElementProps): void;
94
+ onDestroy(parent: Element<CanvasDOMElement>, afterDestroy: () => void): Promise<void>;
95
+ private resolveRectangle;
96
+ private resolveSheetDefinition;
97
+ private detectImageDimensions;
98
+ private createSheetAnimations;
99
+ private setSheetDefinition;
100
+ private playSheet;
101
+ private getCurrentSheetFrame;
102
+ private advanceSheet;
103
+ private mergeEventAttrs;
104
+ private applyProps;
105
+ private resolveValue;
106
+ private resolvePoint;
107
+ private resolveSize;
108
+ private resolvePixelSize;
109
+ private toCssColor;
110
+ private applyDisplayProps;
111
+ private syncRenderElement;
112
+ private getRenderElement;
113
+ private applyContainScale;
114
+ private bindPlayingSignal;
115
+ private bindSheetParams;
116
+ private getFrames;
117
+ private normalizeIndex;
118
+ private render;
119
+ private applyFrame;
120
+ private updateAnimationLoop;
121
+ private startAnimationLoop;
122
+ private stopAnimationLoop;
123
+ private advance;
124
+ }
125
+ export declare const DOMSprite: ComponentFunction<DOMSpriteProps>;
126
+ export {};
127
+ //# sourceMappingURL=DOMSprite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DOMSprite.d.ts","sourceRoot":"","sources":["../../src/components/DOMSprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAmB,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,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;IA2BzB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,iBAAiB;IAqBzB,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,MAAM;IA2Bd,OAAO,CAAC,UAAU;IAoClB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,kBAAkB;IAwE1B,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,OAAO;CAkBhB;AAID,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,CAEvD,CAAC"}
@@ -0,0 +1,129 @@
1
+ import { Element } from '../engine/reactive';
2
+ import { ComponentFunction } from '../engine/signal';
3
+ import { DisplayObjectProps } from './types/DisplayObject';
4
+ import { ScrollOptions } from '../engine/FocusManager';
5
+ import { Signal } from '@signe/reactive';
6
+ import { CanvasViewport } from './Viewport';
7
+ import { Controls } from '../directives/ControlsBase';
8
+ /**
9
+ * Properties for FocusContainer component
10
+ *
11
+ * @property tabindex - Focus index for the container (default: 0 if present)
12
+ * @property controls - Controls configuration for automatic navigation
13
+ * @property onFocusChange - Callback when focus changes
14
+ * @property autoScroll - Enable automatic scrolling to focused element (default: false)
15
+ * @property viewport - Viewport instance to use for scrolling (optional, uses context viewport by default)
16
+ */
17
+ export interface FocusContainerProps extends DisplayObjectProps {
18
+ tabindex?: number;
19
+ controls?: Controls | Signal<Controls>;
20
+ onFocusChange?: (index: number, element: Element | null) => void;
21
+ autoScroll?: boolean | ScrollOptions;
22
+ viewport?: CanvasViewport;
23
+ context?: {
24
+ viewport?: CanvasViewport;
25
+ };
26
+ }
27
+ /**
28
+ * FocusContainer component for managing focus navigation
29
+ *
30
+ * This component provides a container that manages focus navigation between
31
+ * focusable child elements. It supports automatic navigation via Controls
32
+ * (keyboard/gamepad) and automatic scrolling with Viewport.
33
+ *
34
+ * ## Features
35
+ *
36
+ * - **Focus Management**: Automatically registers focusable children
37
+ * - **Navigation**: Supports keyboard/gamepad navigation via Controls
38
+ * - **Auto-scroll**: Automatically scrolls viewport to show focused element
39
+ * - **Hooks**: Provides reactive signals for focus state
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * // Basic usage
44
+ * <FocusContainer tabindex={0}>
45
+ * <Button tabindex={0} text="Button 1" />
46
+ * <Button tabindex={1} text="Button 2" />
47
+ * </FocusContainer>
48
+ *
49
+ * // With Controls
50
+ * <FocusContainer tabindex={0} controls={controlsConfig}>
51
+ * <Button tabindex={0} text="Button 1" />
52
+ * <Button tabindex={1} text="Button 2" />
53
+ * </FocusContainer>
54
+ *
55
+ * // With auto-scroll
56
+ * <Viewport worldWidth={2000} worldHeight={5000}>
57
+ * <FocusContainer tabindex={0} autoScroll={true}>
58
+ * <Button tabindex={0} y={0} text="Item 1" />
59
+ * <Button tabindex={1} y={100} text="Item 2" />
60
+ * </FocusContainer>
61
+ * </Viewport>
62
+ * ```
63
+ */
64
+ export declare class CanvasFocusContainer {
65
+ private containerId;
66
+ private currentIndexSignal;
67
+ private focusedElementSignal;
68
+ private registeredFocusables;
69
+ /**
70
+ * Initialize the focus container
71
+ *
72
+ * @param props - Component properties
73
+ */
74
+ onInit(props: FocusContainerProps): void;
75
+ /**
76
+ * Mount hook - register focusable children
77
+ *
78
+ * @param element - The element being mounted
79
+ */
80
+ onMount(element: Element<CanvasFocusContainer>): Promise<void>;
81
+ /**
82
+ * Update hook - handle prop changes
83
+ *
84
+ * @param props - Updated properties
85
+ */
86
+ onUpdate(props: FocusContainerProps): void;
87
+ /**
88
+ * Destroy hook - cleanup
89
+ *
90
+ * @param parent - Parent element
91
+ * @param afterDestroy - Callback after destruction
92
+ */
93
+ onDestroy(parent: Element<any>, afterDestroy?: () => void): Promise<void>;
94
+ /**
95
+ * Register focusable children from element
96
+ *
97
+ * @param element - Container element
98
+ */
99
+ private registerChildren;
100
+ /**
101
+ * Get the container ID
102
+ *
103
+ * @returns Container identifier
104
+ */
105
+ getContainerId(): string;
106
+ /**
107
+ * Get current index signal
108
+ *
109
+ * @returns Signal for current focus index
110
+ */
111
+ getCurrentIndexSignal(): Signal<number | null> | null;
112
+ /**
113
+ * Get focused element signal
114
+ *
115
+ * @returns Signal for current focused element
116
+ */
117
+ getFocusedElementSignal(): Signal<Element | null> | null;
118
+ }
119
+ export interface CanvasFocusContainer extends DisplayObjectProps {
120
+ }
121
+ /**
122
+ * FocusContainer component function
123
+ *
124
+ * @param props - Component properties
125
+ * @returns FocusContainer element
126
+ */
127
+ export declare const FocusContainer: ComponentFunction<FocusContainerProps>;
128
+ export declare const Navigation: ComponentFunction<FocusContainerProps>;
129
+ //# sourceMappingURL=FocusContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FocusContainer.d.ts","sourceRoot":"","sources":["../../src/components/FocusContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAgB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAU,MAAM,EAAkD,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,+BAA+B,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;IACjE,UAAU,CAAC,EAAE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Object';
4
+ import { DisplayObjectProps } from './types/DisplayObject';
5
+ import { SignalOrPrimitive } from './types';
6
+ interface GraphicsProps extends DisplayObjectProps {
7
+ draw?: (graphics: PixiGraphics, width: number, height: number, anchor?: [number, number]) => void;
8
+ }
9
+ interface RectProps extends DisplayObjectProps {
10
+ color: SignalOrPrimitive<string>;
11
+ }
12
+ interface CircleProps extends DisplayObjectProps {
13
+ radius: SignalOrPrimitive<number>;
14
+ color: SignalOrPrimitive<string>;
15
+ }
16
+ interface EllipseProps extends DisplayObjectProps {
17
+ color: SignalOrPrimitive<string>;
18
+ }
19
+ interface TriangleProps extends DisplayObjectProps {
20
+ base: SignalOrPrimitive<number>;
21
+ color: SignalOrPrimitive<string>;
22
+ }
23
+ interface SvgProps extends DisplayObjectProps {
24
+ /** SVG content as string (legacy prop) */
25
+ svg?: string;
26
+ /** URL source of the SVG file to load */
27
+ src?: string;
28
+ /** Direct SVG content as string */
29
+ content?: string;
30
+ }
31
+ export declare function Graphics(props: GraphicsProps): Element<ComponentInstance>;
32
+ export declare function Rect(props: RectProps): Element<ComponentInstance>;
33
+ export declare function Circle(props: CircleProps): Element<ComponentInstance>;
34
+ export declare function Ellipse(props: EllipseProps): Element<ComponentInstance>;
35
+ export declare function Triangle(props: TriangleProps): Element<ComponentInstance>;
36
+ /**
37
+ * Creates an SVG component that can render SVG graphics from URL, content, or legacy svg prop.
38
+ *
39
+ * This component provides three ways to display SVG graphics:
40
+ * - **src**: Load SVG from a URL using Assets.load with parseAsGraphicsContext option
41
+ * - **content**: Render SVG directly from string content using Graphics.svg() method
42
+ * - **svg**: Legacy prop for SVG content (for backward compatibility)
43
+ *
44
+ * @param props - Component properties including src, content, or svg
45
+ * @returns A reactive SVG component
46
+ * @example
47
+ * ```typescript
48
+ * // Load from URL
49
+ * const svgFromUrl = Svg({ src: "/assets/logo.svg" });
50
+ *
51
+ * // Direct content
52
+ * const svgFromContent = Svg({
53
+ * content: `<svg viewBox="0 0 100 100">
54
+ * <circle cx="50" cy="50" r="40" fill="blue"/>
55
+ * </svg>`
56
+ * });
57
+ *
58
+ * // Legacy usage
59
+ * const svgLegacy = Svg({ svg: "<svg>...</svg>" });
60
+ * ```
61
+ */
62
+ export declare function Svg(props: SvgProps): Element<ComponentInstance>;
63
+ export {};
64
+ //# sourceMappingURL=Graphic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Graphic.d.ts","sourceRoot":"","sources":["../../src/components/Graphic.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,QAAQ,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5E,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;AAI5C,UAAU,aAAc,SAAQ,kBAAkB;IAChD,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;CACnG;AAED,UAAU,SAAU,SAAQ,kBAAkB;IAC5C,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CAClC;AAED,UAAU,WAAY,SAAQ,kBAAkB;IAC9C,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAClC,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CAClC;AAED,UAAU,YAAa,SAAQ,kBAAkB;IAC/C,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CAClC;AAED,UAAU,aAAc,SAAQ,kBAAkB;IAChD,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAChC,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CAClC;AAED,UAAU,QAAS,SAAQ,kBAAkB;IAC3C,0CAA0C;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAsID,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,8BAE5C;AAWD,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,8BAqBpC;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,8BAoBxC;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,8BAE1C;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,8BAmB5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,8BAyBlC"}
@@ -0,0 +1,36 @@
1
+ export interface JoystickChangeEvent {
2
+ angle: number;
3
+ direction: Direction;
4
+ power: number;
5
+ }
6
+ export declare enum Direction {
7
+ LEFT = "left",
8
+ TOP = "top",
9
+ BOTTOM = "bottom",
10
+ RIGHT = "right",
11
+ TOP_LEFT = "top_left",
12
+ TOP_RIGHT = "top_right",
13
+ BOTTOM_LEFT = "bottom_left",
14
+ BOTTOM_RIGHT = "bottom_right"
15
+ }
16
+ export interface JoystickSettings {
17
+ outer?: string;
18
+ inner?: string;
19
+ outerScale?: {
20
+ x: number;
21
+ y: number;
22
+ };
23
+ innerScale?: {
24
+ x: number;
25
+ y: number;
26
+ };
27
+ innerColor?: string;
28
+ outerColor?: string;
29
+ onChange?: (data: JoystickChangeEvent) => void;
30
+ onStart?: () => void;
31
+ onEnd?: () => void;
32
+ /** Controls instance to automatically apply joystick events to (e.g., JoystickControls or ControlsDirective) */
33
+ controls?: any;
34
+ }
35
+ export declare function Joystick(opts?: JoystickSettings): import('../').Element<import('./DisplayObject').ComponentInstance> | Promise<import('../').Element<import('./DisplayObject').ComponentInstance>>;
36
+ //# sourceMappingURL=Joystick.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Joystick.d.ts","sourceRoot":"","sources":["../../src/components/Joystick.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,UAAU,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,gHAAgH;IAChH,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED,wBAAgB,QAAQ,CAAC,IAAI,GAAE,gBAAqB,oJAkUnD"}
@@ -0,0 +1,16 @@
1
+ import { Texture } from 'pixi.js';
2
+ import { DisplayObjectProps } from './types/DisplayObject';
3
+ interface NineSliceSpriteProps extends DisplayObjectProps {
4
+ image?: string;
5
+ texture?: Texture;
6
+ width?: number;
7
+ height?: number;
8
+ leftWidth?: number;
9
+ rightWidth?: number;
10
+ topHeight?: number;
11
+ bottomHeight?: number;
12
+ roundPixels?: boolean;
13
+ }
14
+ export declare function NineSliceSprite(props: NineSliceSpriteProps): import('..').Element<import('./DisplayObject').ComponentInstance>;
15
+ export {};
16
+ //# sourceMappingURL=NineSliceSprite.d.ts.map