canvasengine 2.0.0-beta.9 → 2.0.0-rc.2

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 (179) 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/Container.d.ts +16 -0
  8. package/dist/components/Container.d.ts.map +1 -0
  9. package/dist/components/DOMContainer.d.ts +28 -0
  10. package/dist/components/DOMContainer.d.ts.map +1 -0
  11. package/dist/components/DOMElement.d.ts +54 -0
  12. package/dist/components/DOMElement.d.ts.map +1 -0
  13. package/dist/components/DOMSprite.d.ts +127 -0
  14. package/dist/components/DOMSprite.d.ts.map +1 -0
  15. package/dist/components/DisplayObject.d.ts +18 -0
  16. package/dist/components/DisplayObject.d.ts.map +1 -0
  17. package/dist/components/FocusContainer.d.ts +129 -0
  18. package/dist/components/FocusContainer.d.ts.map +1 -0
  19. package/dist/components/Graphic.d.ts +64 -0
  20. package/dist/components/Graphic.d.ts.map +1 -0
  21. package/dist/components/Joystick.d.ts +36 -0
  22. package/dist/components/Joystick.d.ts.map +1 -0
  23. package/dist/components/Mesh.d.ts +138 -0
  24. package/dist/components/Mesh.d.ts.map +1 -0
  25. package/dist/components/NineSliceSprite.d.ts +16 -0
  26. package/dist/components/NineSliceSprite.d.ts.map +1 -0
  27. package/dist/components/ParticleEmitter.d.ts +4 -0
  28. package/dist/components/ParticleEmitter.d.ts.map +1 -0
  29. package/dist/components/Scene.d.ts +2 -0
  30. package/dist/components/Scene.d.ts.map +1 -0
  31. package/dist/components/Sprite.d.ts +182 -0
  32. package/dist/components/Sprite.d.ts.map +1 -0
  33. package/dist/components/Text.d.ts +24 -0
  34. package/dist/components/Text.d.ts.map +1 -0
  35. package/dist/components/TilingSprite.d.ts +17 -0
  36. package/dist/components/TilingSprite.d.ts.map +1 -0
  37. package/dist/components/Video.d.ts +14 -0
  38. package/dist/components/Video.d.ts.map +1 -0
  39. package/dist/components/Viewport.d.ts +52 -0
  40. package/dist/components/Viewport.d.ts.map +1 -0
  41. package/dist/components/index.d.ts +20 -0
  42. package/dist/components/index.d.ts.map +1 -0
  43. package/dist/components/types/DisplayObject.d.ts +122 -0
  44. package/dist/components/types/DisplayObject.d.ts.map +1 -0
  45. package/dist/components/types/MouseEvent.d.ts +4 -0
  46. package/dist/components/types/MouseEvent.d.ts.map +1 -0
  47. package/dist/components/types/Spritesheet.d.ts +248 -0
  48. package/dist/components/types/Spritesheet.d.ts.map +1 -0
  49. package/dist/components/types/index.d.ts +4 -0
  50. package/dist/components/types/index.d.ts.map +1 -0
  51. package/dist/directives/Controls.d.ts +112 -0
  52. package/dist/directives/Controls.d.ts.map +1 -0
  53. package/dist/directives/ControlsBase.d.ts +199 -0
  54. package/dist/directives/ControlsBase.d.ts.map +1 -0
  55. package/dist/directives/Drag.d.ts +69 -0
  56. package/dist/directives/Drag.d.ts.map +1 -0
  57. package/dist/directives/Flash.d.ts +116 -0
  58. package/dist/directives/Flash.d.ts.map +1 -0
  59. package/dist/directives/FocusNavigation.d.ts +52 -0
  60. package/dist/directives/FocusNavigation.d.ts.map +1 -0
  61. package/dist/directives/FogVisibility.d.ts +47 -0
  62. package/dist/directives/FogVisibility.d.ts.map +1 -0
  63. package/dist/directives/GamepadControls.d.ts +224 -0
  64. package/dist/directives/GamepadControls.d.ts.map +1 -0
  65. package/dist/directives/JoystickControls.d.ts +171 -0
  66. package/dist/directives/JoystickControls.d.ts.map +1 -0
  67. package/dist/directives/KeyboardControls.d.ts +219 -0
  68. package/dist/directives/KeyboardControls.d.ts.map +1 -0
  69. package/dist/directives/Scheduler.d.ts +36 -0
  70. package/dist/directives/Scheduler.d.ts.map +1 -0
  71. package/dist/directives/Shake.d.ts +98 -0
  72. package/dist/directives/Shake.d.ts.map +1 -0
  73. package/dist/directives/Sound.d.ts +25 -0
  74. package/dist/directives/Sound.d.ts.map +1 -0
  75. package/dist/directives/SpriteEffects.d.ts +70 -0
  76. package/dist/directives/SpriteEffects.d.ts.map +1 -0
  77. package/dist/directives/Transition.d.ts +10 -0
  78. package/dist/directives/Transition.d.ts.map +1 -0
  79. package/dist/directives/ViewportCull.d.ts +11 -0
  80. package/dist/directives/ViewportCull.d.ts.map +1 -0
  81. package/dist/directives/ViewportFollow.d.ts +18 -0
  82. package/dist/directives/ViewportFollow.d.ts.map +1 -0
  83. package/dist/directives/index.d.ts +15 -0
  84. package/dist/directives/index.d.ts.map +1 -0
  85. package/dist/dist-BOOc43Qm.js +778 -0
  86. package/dist/dist-BOOc43Qm.js.map +1 -0
  87. package/dist/engine/FocusManager.d.ts +174 -0
  88. package/dist/engine/FocusManager.d.ts.map +1 -0
  89. package/dist/engine/animation.d.ts +72 -0
  90. package/dist/engine/animation.d.ts.map +1 -0
  91. package/dist/engine/bootstrap.d.ts +52 -0
  92. package/dist/engine/bootstrap.d.ts.map +1 -0
  93. package/dist/engine/directive.d.ts +13 -0
  94. package/dist/engine/directive.d.ts.map +1 -0
  95. package/dist/engine/reactive.d.ts +139 -0
  96. package/dist/engine/reactive.d.ts.map +1 -0
  97. package/dist/engine/signal.d.ts +73 -0
  98. package/dist/engine/signal.d.ts.map +1 -0
  99. package/dist/engine/trigger.d.ts +54 -0
  100. package/dist/engine/trigger.d.ts.map +1 -0
  101. package/dist/engine/utils.d.ts +89 -0
  102. package/dist/engine/utils.d.ts.map +1 -0
  103. package/dist/hooks/addContext.d.ts +2 -0
  104. package/dist/hooks/addContext.d.ts.map +1 -0
  105. package/dist/hooks/useFocus.d.ts +60 -0
  106. package/dist/hooks/useFocus.d.ts.map +1 -0
  107. package/dist/hooks/useProps.d.ts +42 -0
  108. package/dist/hooks/useProps.d.ts.map +1 -0
  109. package/dist/hooks/useRef.d.ts +4 -0
  110. package/dist/hooks/useRef.d.ts.map +1 -0
  111. package/dist/index.d.ts +19 -1135
  112. package/dist/index.d.ts.map +1 -0
  113. package/dist/index.global.js +189 -0
  114. package/dist/index.global.js.map +1 -0
  115. package/dist/index.js +15038 -3212
  116. package/dist/index.js.map +1 -1
  117. package/dist/utils/Ease.d.ts +17 -0
  118. package/dist/utils/Ease.d.ts.map +1 -0
  119. package/dist/utils/GlobalAssetLoader.d.ts +141 -0
  120. package/dist/utils/GlobalAssetLoader.d.ts.map +1 -0
  121. package/dist/utils/RadialGradient.d.ts +57 -0
  122. package/dist/utils/RadialGradient.d.ts.map +1 -0
  123. package/dist/utils/functions.d.ts +2 -0
  124. package/dist/utils/functions.d.ts.map +1 -0
  125. package/dist/utils/tabindex.d.ts +16 -0
  126. package/dist/utils/tabindex.d.ts.map +1 -0
  127. package/package.json +16 -9
  128. package/src/components/Button.ts +399 -0
  129. package/src/components/Canvas.ts +82 -51
  130. package/src/components/Container.ts +21 -2
  131. package/src/components/DOMContainer.ts +379 -0
  132. package/src/components/DOMElement.ts +556 -0
  133. package/src/components/DOMSprite.ts +1044 -0
  134. package/src/components/DisplayObject.ts +423 -202
  135. package/src/components/FocusContainer.ts +368 -0
  136. package/src/components/Graphic.ts +239 -73
  137. package/src/components/Joystick.ts +363 -0
  138. package/src/components/Mesh.ts +222 -0
  139. package/src/components/NineSliceSprite.ts +4 -1
  140. package/src/components/ParticleEmitter.ts +12 -8
  141. package/src/components/Sprite.ts +418 -52
  142. package/src/components/Text.ts +268 -24
  143. package/src/components/Viewport.ts +122 -63
  144. package/src/components/index.ts +9 -2
  145. package/src/components/types/DisplayObject.ts +57 -5
  146. package/src/components/types/Spritesheet.ts +0 -118
  147. package/src/directives/Controls.ts +254 -0
  148. package/src/directives/ControlsBase.ts +267 -0
  149. package/src/directives/Drag.ts +357 -52
  150. package/src/directives/Flash.ts +419 -0
  151. package/src/directives/FocusNavigation.ts +113 -0
  152. package/src/directives/FogVisibility.ts +273 -0
  153. package/src/directives/GamepadControls.ts +537 -0
  154. package/src/directives/JoystickControls.ts +396 -0
  155. package/src/directives/KeyboardControls.ts +85 -430
  156. package/src/directives/Scheduler.ts +21 -5
  157. package/src/directives/Shake.ts +298 -0
  158. package/src/directives/Sound.ts +94 -31
  159. package/src/directives/SpriteEffects.ts +461 -0
  160. package/src/directives/ViewportFollow.ts +40 -9
  161. package/src/directives/index.ts +14 -6
  162. package/src/engine/FocusManager.ts +510 -0
  163. package/src/engine/animation.ts +137 -19
  164. package/src/engine/bootstrap.ts +140 -6
  165. package/src/engine/directive.ts +4 -4
  166. package/src/engine/reactive.ts +1084 -236
  167. package/src/engine/signal.ts +241 -47
  168. package/src/engine/trigger.ts +34 -7
  169. package/src/engine/utils.ts +19 -3
  170. package/src/hooks/useFocus.ts +91 -0
  171. package/src/hooks/useProps.ts +14 -6
  172. package/src/index.ts +8 -2
  173. package/src/types/pixi-cull.d.ts +7 -0
  174. package/src/utils/GlobalAssetLoader.ts +257 -0
  175. package/src/utils/functions.ts +7 -0
  176. package/src/utils/tabindex.ts +70 -0
  177. package/testing/index.ts +35 -4
  178. package/tsconfig.json +22 -0
  179. package/vite.config.ts +39 -0
@@ -0,0 +1,64 @@
1
+ import { Graphics as PixiGraphics } 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
+ 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,oBAA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Y,8BAE1C;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,8BAoB5C;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,138 @@
1
+ import { 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: any;
26
+ /**
27
+ * Canvas Mesh component class that extends DisplayObject with PixiMesh functionality.
28
+ * This component allows rendering of custom 3D meshes with shaders and textures.
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * // Basic mesh with geometry and texture
33
+ * const mesh = Mesh({
34
+ * geometry: myGeometry,
35
+ * texture: "path/to/texture.png",
36
+ * tint: 0xff0000
37
+ * });
38
+ *
39
+ * // Mesh with custom shader
40
+ * const customMesh = Mesh({
41
+ * geometry: myGeometry,
42
+ * shader: myCustomShader,
43
+ * draw: (mesh) => {
44
+ * // Custom mesh manipulation
45
+ * mesh.rotation += 0.01;
46
+ * }
47
+ * });
48
+ * ```
49
+ */
50
+ declare class CanvasMesh extends CanvasMesh_base {
51
+ /**
52
+ * Constructor for the CanvasMesh component.
53
+ * Initializes the PixiMesh with default geometry and shader to prevent errors.
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * // This constructor is called internally by the engine
58
+ * const mesh = new CanvasMesh();
59
+ * ```
60
+ */
61
+ constructor();
62
+ /**
63
+ * Initializes the mesh component with the provided properties.
64
+ * This method is called before onUpdate to set up initial state.
65
+ *
66
+ * @param props - The initial properties
67
+ * @example
68
+ * ```typescript
69
+ * // This method is called internally when the component is created
70
+ * mesh.onInit({
71
+ * geometry: myGeometry,
72
+ * texture: "texture.png"
73
+ * });
74
+ * ```
75
+ */
76
+ onInit(props: MeshProps): void;
77
+ /**
78
+ * Updates the mesh component when properties change.
79
+ * Handles texture loading, shader updates, and other property changes.
80
+ *
81
+ * @param props - The updated properties
82
+ * @example
83
+ * ```typescript
84
+ * // This method is called internally when props change
85
+ * mesh.onUpdate({
86
+ * tint: 0x00ff00,
87
+ * texture: "new-texture.png"
88
+ * });
89
+ * ```
90
+ */
91
+ onUpdate(props: MeshProps): Promise<void>;
92
+ /**
93
+ * Called when the component is about to be destroyed.
94
+ * Cleans up the draw effect subscription and calls the parent destroy method.
95
+ *
96
+ * @param parent - The parent element
97
+ * @param afterDestroy - Callback function to execute after destruction
98
+ * @example
99
+ * ```typescript
100
+ * // This method is typically called by the engine internally
101
+ * await mesh.onDestroy(parentElement, () => console.log('Mesh destroyed'));
102
+ * ```
103
+ */
104
+ onDestroy(parent: Element<ComponentInstance>, afterDestroy: () => void): Promise<void>;
105
+ }
106
+ /**
107
+ * Creates a Mesh component with the specified properties.
108
+ * This is the main function used to create mesh instances in your application.
109
+ *
110
+ * @param props - The properties for the mesh component
111
+ * @returns A mesh component element
112
+ * @example
113
+ * ```typescript
114
+ * import { Mesh } from 'canvasengine';
115
+ *
116
+ * // Create a basic textured mesh
117
+ * const myMesh = Mesh({
118
+ * geometry: triangleGeometry,
119
+ * texture: "assets/texture.png",
120
+ * x: 100,
121
+ * y: 100,
122
+ * tint: 0xff0000
123
+ * });
124
+ *
125
+ * // Create a mesh with custom shader
126
+ * const shaderMesh = Mesh({
127
+ * geometry: planeGeometry,
128
+ * shader: customShader,
129
+ * draw: (mesh) => {
130
+ * mesh.rotation += 0.01;
131
+ * }
132
+ * });
133
+ * ```
134
+ */
135
+ export declare const Mesh: ComponentFunction<MeshProps>;
136
+ export { CanvasMesh };
137
+ export type { MeshProps };
138
+ //# sourceMappingURL=Mesh.d.ts.map
@@ -0,0 +1 @@
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;IAC1C,IAAI,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACjC,oDAAoD;IACpD,WAAW,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;CAC1C;;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,cAAM,UAAW,SAAQ,eAAuB;IAC9C;;;;;;;;;OASG;;IASH;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS;IAkBvB;;;;;;;;;;;;;OAaG;IACG,QAAQ,CAAC,KAAK,EAAE,SAAS;IA4C/B;;;;;;;;;;;OAWG;IACG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,EAAE,YAAY,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAM7F;AAKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAE7C,CAAC;AAGF,OAAO,EAAE,UAAU,EAAE,CAAC;AAGtB,YAAY,EAAE,SAAS,EAAE,CAAC"}
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NineSliceSprite.d.ts","sourceRoot":"","sources":["../../src/components/NineSliceSprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,UAAU,oBAAqB,SAAQ,kBAAkB;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AA8BD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qEAE1D"}
@@ -0,0 +1,4 @@
1
+ import { Element } from '../engine/reactive';
2
+ import { ComponentInstance } from './DisplayObject';
3
+ export declare function ParticlesEmitter(props: any): Element<ComponentInstance>;
4
+ //# sourceMappingURL=ParticleEmitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParticleEmitter.d.ts","sourceRoot":"","sources":["../../src/components/ParticleEmitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AAGjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAoCpD,wBAAgB,gBAAgB,CAAC,KAAK,KAAA,8BAErC"}
@@ -0,0 +1,2 @@
1
+ export declare function Scene(props: any): import('..').Element<import('./DisplayObject').ComponentInstance> | Promise<import('..').Element<import('./DisplayObject').ComponentInstance>>;
2
+ //# sourceMappingURL=Scene.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../src/components/Scene.ts"],"names":[],"mappings":"AAGA,wBAAgB,KAAK,CAAC,KAAK,KAAA,kJAE1B"}
@@ -0,0 +1,182 @@
1
+ import { Signal } from '@signe/reactive';
2
+ import { Sprite as PixiSprite, Texture } from 'pixi.js';
3
+ import { Element } from '../engine/reactive';
4
+ import { AnimationFrames, FrameOptions, SpritesheetOptions, TextureOptions, TransformOptions } from './types/Spritesheet';
5
+ import { ComponentFunction } from '../engine/signal';
6
+ import { DisplayObjectProps } from './types/DisplayObject';
7
+ import { Layout } from '@pixi/layout';
8
+ type Image = {
9
+ image: string;
10
+ };
11
+ type TextureOptionsMerging = TextureOptions & {
12
+ spriteWidth: number;
13
+ spriteHeight: number;
14
+ sound?: string;
15
+ } & Image & TransformOptions;
16
+ type FrameOptionsMerging = TextureOptionsMerging & FrameOptions;
17
+ type SpritesheetOptionsMerging = TextureOptionsMerging & SpritesheetOptions;
18
+ type AnimationDataFrames = {
19
+ sprites: FrameOptionsMerging[];
20
+ frames: Texture[][];
21
+ name: string;
22
+ animations: AnimationFrames;
23
+ params: any[];
24
+ data: TextureOptionsMerging;
25
+ };
26
+ export type HitboxAnchorMode = "top-left" | "center" | "foot";
27
+ export type Hitbox = {
28
+ w: number;
29
+ h: number;
30
+ anchorMode?: HitboxAnchorMode;
31
+ };
32
+ export declare enum StandardAnimation {
33
+ Stand = "stand",
34
+ Walk = "walk"
35
+ }
36
+ declare const CanvasSprite_base: any;
37
+ export declare class CanvasSprite extends CanvasSprite_base {
38
+ hitbox: Hitbox | null;
39
+ applyTransform: (frame: FrameOptionsMerging, data: TextureOptionsMerging, spritesheet: SpritesheetOptionsMerging) => Partial<FrameOptionsMerging>;
40
+ private spritesheet;
41
+ private currentAnimation;
42
+ private time;
43
+ private frameIndex;
44
+ private animations;
45
+ private subscriptionTick;
46
+ private subscriptionSheet;
47
+ private sheetParams;
48
+ private sheetCurrentAnimation;
49
+ private app;
50
+ onFinish: () => void;
51
+ private globalLoader;
52
+ private trackedAssetIds;
53
+ get renderer(): import('pixi.js').Renderer;
54
+ private currentAnimationContainer;
55
+ /**
56
+ * Auto-detects image dimensions by loading the image and reading its natural size
57
+ * This is used when width/height are not explicitly provided in the spritesheet definition
58
+ *
59
+ * @param imagePath - Path to the image file
60
+ * @returns Object containing the detected width and height of the image
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const { width, height } = await sprite.detectImageDimensions('path/to/image.png');
65
+ * // width: 256, height: 128
66
+ * ```
67
+ */
68
+ private detectImageDimensions;
69
+ /**
70
+ * Creates textures from a spritesheet image by cutting it into frames
71
+ * Automatically detects image dimensions if width/height are not provided
72
+ *
73
+ * @param options - Texture options containing image path, dimensions, and frame configuration
74
+ * @returns A 2D array of textures organized by rows and columns
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * // With explicit dimensions
79
+ * const textures = await sprite.createTextures({
80
+ * image: 'path/to/image.png',
81
+ * width: 256,
82
+ * height: 128,
83
+ * framesWidth: 4,
84
+ * framesHeight: 2,
85
+ * spriteWidth: 64,
86
+ * spriteHeight: 64
87
+ * });
88
+ *
89
+ * // Without dimensions (automatically detected)
90
+ * const textures = await sprite.createTextures({
91
+ * image: 'path/to/image.png',
92
+ * framesWidth: 4,
93
+ * framesHeight: 2,
94
+ * spriteWidth: 64,
95
+ * spriteHeight: 64
96
+ * });
97
+ * ```
98
+ */
99
+ private createTextures;
100
+ private createAnimations;
101
+ onMount(params: Element<any>): Promise<void>;
102
+ onUpdate(props: any): Promise<void>;
103
+ onDestroy(parent: Element, afterDestroy: () => void): Promise<void>;
104
+ has(name: string): boolean;
105
+ get(name: string): AnimationDataFrames;
106
+ isPlaying(name?: string): boolean;
107
+ private getFirstAnimationName;
108
+ private getPlayableAnimationName;
109
+ private getMovementAnimationName;
110
+ stop(): void;
111
+ play(name: string, params?: any[]): void;
112
+ /**
113
+ * Resets the sprite by destroying and recreating all animations
114
+ * This method clears the current animation state, destroys existing textures,
115
+ * and recreates all animations from the spritesheet
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * // Reset all animations to their initial state
120
+ * sprite.resetAnimations();
121
+ *
122
+ * // Reset and then play a specific animation
123
+ * await sprite.resetAnimations();
124
+ * sprite.play('walk');
125
+ * ```
126
+ */
127
+ resetAnimations(): Promise<void>;
128
+ update({ deltaRatio }: {
129
+ deltaRatio: any;
130
+ }): void;
131
+ private applyHitboxAnchor;
132
+ private normalizeHitbox;
133
+ private clamp;
134
+ }
135
+ export interface CanvasSprite extends PixiSprite {
136
+ layout: Layout | null;
137
+ }
138
+ export interface SpriteProps extends DisplayObjectProps {
139
+ sheet?: {
140
+ definition?: SpritesheetOptionsMerging;
141
+ playing?: string;
142
+ params?: any;
143
+ onFinish?: () => void;
144
+ };
145
+ hitbox?: Hitbox;
146
+ scaleMode?: number;
147
+ image?: string;
148
+ rectangle?: {
149
+ x: number;
150
+ y: number;
151
+ width: number;
152
+ height: number;
153
+ };
154
+ context?: {
155
+ tick: Signal;
156
+ };
157
+ }
158
+ export interface SpritePropsWithImage extends Omit<SpriteProps, "sheet"> {
159
+ image: string;
160
+ rectangle?: {
161
+ x: number;
162
+ y: number;
163
+ width: number;
164
+ height: number;
165
+ };
166
+ }
167
+ export interface SpritePropsWithSheet extends Omit<SpriteProps, "image" | "rectangle"> {
168
+ sheet: {
169
+ definition: SpritesheetOptionsMerging;
170
+ playing?: string;
171
+ params?: any;
172
+ onFinish?: () => void;
173
+ };
174
+ loader?: {
175
+ onProgress?: (progress: number) => void;
176
+ onComplete?: (texture: Texture) => void;
177
+ };
178
+ }
179
+ export type SpritePropTypes = SpritePropsWithImage | SpritePropsWithSheet;
180
+ export declare const Sprite: ComponentFunction<SpritePropTypes>;
181
+ export {};
182
+ //# sourceMappingURL=Sprite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sprite.d.ts","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C;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,oBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,CAAC;IAChD,KAAK,EAAE;QACL,UAAU,EAAE,yBAAyB,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,GAAG,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;KACvB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;QACxC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;KACzC,CAAC;CACH;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,GAAG,oBAAoB,CAAC;AAG1E,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,eAAe,CAIrD,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { TextStyle } from 'pixi.js';
2
+ import { Element } from '../engine/reactive';
3
+ import { DisplayObjectProps } from './types/DisplayObject';
4
+ export interface TextProps extends DisplayObjectProps {
5
+ text?: string;
6
+ style?: Partial<TextStyle>;
7
+ color?: string;
8
+ size?: string | number;
9
+ fontFamily?: string;
10
+ typewriter?: {
11
+ speed?: number;
12
+ start?: () => void;
13
+ onComplete?: () => void;
14
+ skip?: () => void;
15
+ sound?: {
16
+ src: string;
17
+ volume?: number;
18
+ rate?: number;
19
+ };
20
+ };
21
+ context?: any;
22
+ }
23
+ export declare function Text(props: TextProps): Element<import('./DisplayObject').ComponentInstance>;
24
+ //# sourceMappingURL=Text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,SAAS,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAsC,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAS3D,MAAM,WAAW,SAAU,SAAQ,kBAAkB;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;QACxB,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC;QAClB,KAAK,CAAC,EAAE;YACN,GAAG,EAAE,MAAM,CAAC;YACZ,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAC;IACF,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAmWD,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,wDAEpC"}
@@ -0,0 +1,17 @@
1
+ import { DisplayObjectProps } from './types/DisplayObject';
2
+ interface TilingSpriteProps extends DisplayObjectProps {
3
+ image?: string;
4
+ tileScale?: {
5
+ x: number;
6
+ y: number;
7
+ };
8
+ tilePosition?: {
9
+ x: number;
10
+ y: number;
11
+ };
12
+ width?: number;
13
+ height?: number;
14
+ }
15
+ export declare function TilingSprite(props: TilingSpriteProps): import('..').Element<import('./DisplayObject').ComponentInstance>;
16
+ export {};
17
+ //# sourceMappingURL=TilingSprite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TilingSprite.d.ts","sourceRoot":"","sources":["../../src/components/TilingSprite.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,UAAU,iBAAkB,SAAQ,kBAAkB;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,YAAY,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAyBD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qEAEpD"}
@@ -0,0 +1,14 @@
1
+ import { Texture } from 'pixi.js';
2
+ interface VideoProps {
3
+ src: string;
4
+ paused?: boolean;
5
+ loop?: boolean;
6
+ muted?: boolean;
7
+ loader?: {
8
+ onComplete?: (texture: Texture) => void;
9
+ onProgress?: (progress: number) => void;
10
+ };
11
+ }
12
+ export declare function Video(props: VideoProps): import('..').Element<import('./DisplayObject').ComponentInstance> | Promise<import('..').Element<import('./DisplayObject').ComponentInstance>>;
13
+ export {};
14
+ //# sourceMappingURL=Video.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Video.d.ts","sourceRoot":"","sources":["../../src/components/Video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAMlC,UAAU,UAAU;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE;QACL,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;QACxC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;KAC3C,CAAC;CACL;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,kJA4FtC"}
@@ -0,0 +1,52 @@
1
+ import { Viewport as PixiViewport } from 'pixi-viewport';
2
+ import { Element, Props } from '../engine/reactive';
3
+ import { ComponentInstance } from './DisplayObject';
4
+ import { ContainerChild, IRenderLayer } from 'pixi.js';
5
+ export interface ViewportProps extends Props {
6
+ screenWidth?: number;
7
+ screenHeight?: number;
8
+ worldWidth?: number;
9
+ worldHeight?: number;
10
+ sortableChildren?: boolean;
11
+ clamp?: boolean | {
12
+ left?: number;
13
+ right?: number;
14
+ top?: number;
15
+ bottom?: number;
16
+ };
17
+ context?: any;
18
+ [key: string]: any;
19
+ }
20
+ declare const CanvasViewport_base: any;
21
+ export declare class CanvasViewport extends CanvasViewport_base {
22
+ #private;
23
+ private tickSubscription;
24
+ overrideProps: string[];
25
+ viewport: PixiViewport;
26
+ constructor();
27
+ addChild<U extends any[]>(...children: U): U[0];
28
+ addChildAt<T extends ContainerChild | IRenderLayer>(child: T, index: number): T;
29
+ onInit(props: any): void;
30
+ /**
31
+ * Called when the component is mounted to the scene graph.
32
+ * Initializes viewport settings and subscriptions.
33
+ * @param {Element<CanvasViewport>} element - The element being mounted. Its `props` property (of type ViewportProps) contains component properties and context.
34
+ * @param {number} [index] - The index of the component among its siblings.
35
+ */
36
+ onMount(element: Element<any>, index?: number): Promise<void>;
37
+ onUpdate(props: any): void;
38
+ private updateViewportSettings;
39
+ private updateMask;
40
+ /**
41
+ * Called when the component is about to be destroyed.
42
+ * Unsubscribes from the tick observable.
43
+ * @param {Element<any>} parent - The parent element.
44
+ * @param {() => void} [afterDestroy] - An optional callback function to be executed after the component's own destruction logic.
45
+ */
46
+ onDestroy(parent: Element<any>, afterDestroy?: () => void): Promise<void>;
47
+ follow(...args: any[]): any;
48
+ get plugins(): import('pixi-viewport').PluginManager;
49
+ }
50
+ export declare function Viewport(props: ViewportProps): Element<ComponentInstance>;
51
+ export {};
52
+ //# sourceMappingURL=Viewport.d.ts.map
@@ -0,0 +1 @@
1
+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,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqCnE,QAAQ,CAAC,KAAK,KAAA;IAKd,OAAO,CAAC,sBAAsB;IA8C9B,OAAO,CAAC,UAAU;IAQlB;;;;;OAKG;IACG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAS/E,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAIrB,IAAI,OAAO,0CAEV;CACJ;AAID,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,8BAE5C"}
@@ -0,0 +1,20 @@
1
+ export { Canvas } from './Canvas';
2
+ export { Container } from './Container';
3
+ export { Graphics, Rect, Circle, Ellipse, Triangle, Svg } from './Graphic';
4
+ export { Mesh } from './Mesh';
5
+ export { Scene } from './Scene';
6
+ export { ParticlesEmitter } from './ParticleEmitter';
7
+ export { Sprite } from './Sprite';
8
+ export { Video } from './Video';
9
+ export { Text } from './Text';
10
+ export { TilingSprite } from './TilingSprite';
11
+ export { Viewport } from './Viewport';
12
+ export { NineSliceSprite } from './NineSliceSprite';
13
+ export { type ComponentInstance } from './DisplayObject';
14
+ export { DOMContainer } from './DOMContainer';
15
+ export { DOMElement } from './DOMElement';
16
+ export { DOMSprite } from './DOMSprite';
17
+ export { Button, ButtonState, type ButtonProps, type ButtonStyle } from './Button';
18
+ export { Joystick, type JoystickSettings } from './Joystick';
19
+ export { FocusContainer, Navigation, type FocusContainerProps } from './FocusContainer';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAA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