canvasengine 2.0.0-beta.4 → 2.0.0-beta.40

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 (142) hide show
  1. package/dist/DebugRenderer-DgECR3yZ.js +172 -0
  2. package/dist/DebugRenderer-DgECR3yZ.js.map +1 -0
  3. package/dist/components/Button.d.ts +183 -0
  4. package/dist/components/Button.d.ts.map +1 -0
  5. package/dist/components/Canvas.d.ts +18 -0
  6. package/dist/components/Canvas.d.ts.map +1 -0
  7. package/dist/components/DOMElement.d.ts +44 -0
  8. package/dist/components/DOMElement.d.ts.map +1 -0
  9. package/dist/components/Graphic.d.ts +65 -0
  10. package/dist/components/Graphic.d.ts.map +1 -0
  11. package/dist/components/Joystick.d.ts +36 -0
  12. package/dist/components/Joystick.d.ts.map +1 -0
  13. package/dist/components/NineSliceSprite.d.ts +17 -0
  14. package/dist/components/NineSliceSprite.d.ts.map +1 -0
  15. package/dist/components/ParticleEmitter.d.ts +5 -0
  16. package/dist/components/ParticleEmitter.d.ts.map +1 -0
  17. package/dist/components/Scene.d.ts +2 -0
  18. package/dist/components/Scene.d.ts.map +1 -0
  19. package/dist/components/Text.d.ts +26 -0
  20. package/dist/components/Text.d.ts.map +1 -0
  21. package/dist/components/TilingSprite.d.ts +18 -0
  22. package/dist/components/TilingSprite.d.ts.map +1 -0
  23. package/dist/components/Video.d.ts +15 -0
  24. package/dist/components/Video.d.ts.map +1 -0
  25. package/dist/components/index.d.ts +18 -0
  26. package/dist/components/index.d.ts.map +1 -0
  27. package/dist/components/types/DisplayObject.d.ts +110 -0
  28. package/dist/components/types/DisplayObject.d.ts.map +1 -0
  29. package/dist/components/types/MouseEvent.d.ts +4 -0
  30. package/dist/components/types/MouseEvent.d.ts.map +1 -0
  31. package/dist/components/types/Spritesheet.d.ts +248 -0
  32. package/dist/components/types/Spritesheet.d.ts.map +1 -0
  33. package/dist/components/types/index.d.ts +5 -0
  34. package/dist/components/types/index.d.ts.map +1 -0
  35. package/dist/directives/Controls.d.ts +113 -0
  36. package/dist/directives/Controls.d.ts.map +1 -0
  37. package/dist/directives/ControlsBase.d.ts +198 -0
  38. package/dist/directives/ControlsBase.d.ts.map +1 -0
  39. package/dist/directives/Drag.d.ts +70 -0
  40. package/dist/directives/Drag.d.ts.map +1 -0
  41. package/dist/directives/Flash.d.ts +117 -0
  42. package/dist/directives/Flash.d.ts.map +1 -0
  43. package/dist/directives/GamepadControls.d.ts +225 -0
  44. package/dist/directives/GamepadControls.d.ts.map +1 -0
  45. package/dist/directives/JoystickControls.d.ts +172 -0
  46. package/dist/directives/JoystickControls.d.ts.map +1 -0
  47. package/dist/directives/KeyboardControls.d.ts +219 -0
  48. package/dist/directives/KeyboardControls.d.ts.map +1 -0
  49. package/dist/directives/Scheduler.d.ts +36 -0
  50. package/dist/directives/Scheduler.d.ts.map +1 -0
  51. package/dist/directives/Shake.d.ts +98 -0
  52. package/dist/directives/Shake.d.ts.map +1 -0
  53. package/dist/directives/Sound.d.ts +26 -0
  54. package/dist/directives/Sound.d.ts.map +1 -0
  55. package/dist/directives/Transition.d.ts +11 -0
  56. package/dist/directives/Transition.d.ts.map +1 -0
  57. package/dist/directives/ViewportCull.d.ts +12 -0
  58. package/dist/directives/ViewportCull.d.ts.map +1 -0
  59. package/dist/directives/ViewportFollow.d.ts +19 -0
  60. package/dist/directives/ViewportFollow.d.ts.map +1 -0
  61. package/dist/directives/index.d.ts +13 -0
  62. package/dist/directives/index.d.ts.map +1 -0
  63. package/dist/engine/animation.d.ts +73 -0
  64. package/dist/engine/animation.d.ts.map +1 -0
  65. package/dist/engine/bootstrap.d.ts +16 -0
  66. package/dist/engine/bootstrap.d.ts.map +1 -0
  67. package/dist/engine/directive.d.ts +14 -0
  68. package/dist/engine/directive.d.ts.map +1 -0
  69. package/dist/engine/reactive.d.ts +105 -0
  70. package/dist/engine/reactive.d.ts.map +1 -0
  71. package/dist/engine/signal.d.ts +72 -0
  72. package/dist/engine/signal.d.ts.map +1 -0
  73. package/dist/engine/trigger.d.ts +50 -0
  74. package/dist/engine/trigger.d.ts.map +1 -0
  75. package/dist/engine/utils.d.ts +90 -0
  76. package/dist/engine/utils.d.ts.map +1 -0
  77. package/dist/hooks/addContext.d.ts +2 -0
  78. package/dist/hooks/addContext.d.ts.map +1 -0
  79. package/dist/hooks/useProps.d.ts +42 -0
  80. package/dist/hooks/useProps.d.ts.map +1 -0
  81. package/dist/hooks/useRef.d.ts +5 -0
  82. package/dist/hooks/useRef.d.ts.map +1 -0
  83. package/dist/index-gb763Hyx.js +12560 -0
  84. package/dist/index-gb763Hyx.js.map +1 -0
  85. package/dist/index.d.ts +15 -1083
  86. package/dist/index.d.ts.map +1 -0
  87. package/dist/index.global.js +29 -0
  88. package/dist/index.global.js.map +1 -0
  89. package/dist/index.js +81 -3041
  90. package/dist/index.js.map +1 -1
  91. package/dist/utils/Ease.d.ts +17 -0
  92. package/dist/utils/Ease.d.ts.map +1 -0
  93. package/dist/utils/GlobalAssetLoader.d.ts +141 -0
  94. package/dist/utils/GlobalAssetLoader.d.ts.map +1 -0
  95. package/dist/utils/RadialGradient.d.ts +58 -0
  96. package/dist/utils/RadialGradient.d.ts.map +1 -0
  97. package/dist/utils/functions.d.ts +2 -0
  98. package/dist/utils/functions.d.ts.map +1 -0
  99. package/package.json +13 -7
  100. package/src/components/Button.ts +396 -0
  101. package/src/components/Canvas.ts +61 -45
  102. package/src/components/Container.ts +21 -2
  103. package/src/components/DOMContainer.ts +123 -0
  104. package/src/components/DOMElement.ts +421 -0
  105. package/src/components/DisplayObject.ts +350 -197
  106. package/src/components/Graphic.ts +200 -34
  107. package/src/components/Joystick.ts +361 -0
  108. package/src/components/Mesh.ts +222 -0
  109. package/src/components/NineSliceSprite.ts +4 -1
  110. package/src/components/ParticleEmitter.ts +12 -8
  111. package/src/components/Sprite.ts +306 -30
  112. package/src/components/Text.ts +125 -18
  113. package/src/components/Video.ts +110 -0
  114. package/src/components/Viewport.ts +59 -43
  115. package/src/components/index.ts +8 -2
  116. package/src/components/types/DisplayObject.ts +34 -0
  117. package/src/components/types/Spritesheet.ts +0 -118
  118. package/src/directives/Controls.ts +254 -0
  119. package/src/directives/ControlsBase.ts +266 -0
  120. package/src/directives/Drag.ts +357 -52
  121. package/src/directives/Flash.ts +409 -0
  122. package/src/directives/GamepadControls.ts +537 -0
  123. package/src/directives/JoystickControls.ts +396 -0
  124. package/src/directives/KeyboardControls.ts +66 -424
  125. package/src/directives/Shake.ts +282 -0
  126. package/src/directives/Sound.ts +94 -31
  127. package/src/directives/ViewportFollow.ts +35 -7
  128. package/src/directives/index.ts +12 -6
  129. package/src/engine/animation.ts +175 -21
  130. package/src/engine/bootstrap.ts +23 -3
  131. package/src/engine/directive.ts +2 -2
  132. package/src/engine/reactive.ts +780 -177
  133. package/src/engine/signal.ts +35 -4
  134. package/src/engine/trigger.ts +21 -4
  135. package/src/engine/utils.ts +19 -3
  136. package/src/hooks/useProps.ts +1 -1
  137. package/src/index.ts +4 -2
  138. package/src/utils/GlobalAssetLoader.ts +257 -0
  139. package/src/utils/functions.ts +7 -0
  140. package/testing/index.ts +12 -0
  141. package/tsconfig.json +17 -0
  142. package/vite.config.ts +39 -0
package/dist/index.d.ts CHANGED
@@ -1,1085 +1,17 @@
1
- import * as _signe_reactive from '@signe/reactive';
2
- import { WritableSignal, Signal, WritableArraySignal } from '@signe/reactive';
1
+ export * from './directives';
3
2
  export * from '@signe/reactive';
4
- import { Subscription, Subject, Observable } from 'rxjs';
5
- export { isObservable } from 'rxjs';
6
- import { Node } from 'yoga-layout';
7
- import * as PIXI from 'pixi.js';
8
- import { ObservablePoint, Graphics as Graphics$1, TextStyle, Texture, Matrix } from 'pixi.js';
9
3
  export { Howler } from 'howler';
10
- import * as popmotion from 'popmotion';
11
-
12
- interface AnimateOptions<T> {
13
- duration?: number;
14
- ease?: (t: number) => number;
15
- onUpdate?: (value: T) => void;
16
- }
17
- interface AnimatedState<T> {
18
- current: T;
19
- start: T;
20
- end: T;
21
- }
22
- interface AnimatedSignal<T> extends Omit<WritableSignal<T>, 'set'> {
23
- (): T;
24
- set: (newValue: T) => void;
25
- animatedState: WritableSignal<AnimatedState<T>>;
26
- update: (updater: (value: T) => T) => void;
27
- }
28
- declare function isAnimatedSignal(signal: WritableSignal<any>): boolean;
29
- /**
30
- * Creates an animated signal with the given initial value and animation options.
31
- * It's a writable signal that can be animated using popmotion. Properties of the animated signal are:
32
- * - current: the current value of the signal.
33
- * - start: the start value of the animation.
34
- * - end: the end value of the animation.
35
- *
36
- * @param initialValue The initial value of the signal.
37
- * @param options The animation options.
38
- * @returns The animated signal.
39
- * @example
40
- * const animatedValue = animatedSignal(0, { duration: 1000 });
41
- * animatedValue.set(10);
42
- * animatedValue.update((value) => value + 1);
43
- * console.log(animatedValue()); // 11
44
- *
45
- * animatedValue.animatedState() // { current: 10, start: 10, end: 11 }
46
- */
47
- declare function animatedSignal<T>(initialValue: T, options?: AnimateOptions<T>): AnimatedSignal<T>;
48
-
49
- type SignalOrPrimitive<T> = T | Signal<T> | AnimatedSignal<T>;
50
-
51
- type FlexDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';
52
- type JustifyContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around';
53
- type AlignContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around';
54
- type Size = number | `${number}%`;
55
- type EdgeSize = SignalOrPrimitive<Size | [Size, Size] | [Size, Size, Size, Size]>;
56
- interface DisplayObjectProps {
57
- ref?: string;
58
- x?: SignalOrPrimitive<number>;
59
- y?: SignalOrPrimitive<number>;
60
- width?: SignalOrPrimitive<Size>;
61
- height?: SignalOrPrimitive<Size>;
62
- children?: any[];
63
- flexDirection?: FlexDirection;
64
- justifyContent?: JustifyContent;
65
- alpha?: SignalOrPrimitive<number>;
66
- margin?: EdgeSize;
67
- padding?: EdgeSize;
68
- border?: EdgeSize;
69
- absolute?: SignalOrPrimitive<boolean>;
70
- scale?: SignalOrPrimitive<{
71
- x: number;
72
- y: number;
73
- } | number>;
74
- anchor?: SignalOrPrimitive<{
75
- x: number;
76
- y: number;
77
- }>;
78
- skew?: SignalOrPrimitive<{
79
- x: number;
80
- y: number;
81
- }>;
82
- tint?: SignalOrPrimitive<number>;
83
- rotation?: SignalOrPrimitive<number>;
84
- angle?: SignalOrPrimitive<number>;
85
- zIndex?: SignalOrPrimitive<number>;
86
- roundPixels?: SignalOrPrimitive<boolean>;
87
- cursor?: SignalOrPrimitive<string>;
88
- visible?: SignalOrPrimitive<boolean>;
89
- pivot?: SignalOrPrimitive<{
90
- x: number;
91
- y: number;
92
- }>;
93
- filters?: any[];
94
- blendMode?: SignalOrPrimitive<PIXI.BLEND_MODES>;
95
- blur?: SignalOrPrimitive<number>;
96
- click?: PIXI.FederatedEventHandler;
97
- mousedown?: PIXI.FederatedEventHandler;
98
- mouseenter?: PIXI.FederatedEventHandler;
99
- mouseleave?: PIXI.FederatedEventHandler;
100
- mousemove?: PIXI.FederatedEventHandler;
101
- mouseout?: PIXI.FederatedEventHandler;
102
- mouseover?: PIXI.FederatedEventHandler;
103
- mouseup?: PIXI.FederatedEventHandler;
104
- mouseupoutside?: PIXI.FederatedEventHandler;
105
- pointercancel?: PIXI.FederatedEventHandler;
106
- pointerdown?: PIXI.FederatedEventHandler;
107
- pointerenter?: PIXI.FederatedEventHandler;
108
- pointerleave?: PIXI.FederatedEventHandler;
109
- pointermove?: PIXI.FederatedEventHandler;
110
- pointerout?: PIXI.FederatedEventHandler;
111
- pointerover?: PIXI.FederatedEventHandler;
112
- pointertap?: PIXI.FederatedEventHandler;
113
- pointerup?: PIXI.FederatedEventHandler;
114
- pointerupoutside?: PIXI.FederatedEventHandler;
115
- rightclick?: PIXI.FederatedEventHandler;
116
- rightdown?: PIXI.FederatedEventHandler;
117
- rightup?: PIXI.FederatedEventHandler;
118
- rightupoutside?: PIXI.FederatedEventHandler;
119
- tap?: PIXI.FederatedEventHandler;
120
- touchcancel?: PIXI.FederatedEventHandler;
121
- touchend?: PIXI.FederatedEventHandler;
122
- touchendoutside?: PIXI.FederatedEventHandler;
123
- touchmove?: PIXI.FederatedEventHandler;
124
- touchstart?: PIXI.FederatedEventHandler;
125
- wheel?: PIXI.FederatedEventHandler<PIXI.FederatedWheelEvent>;
126
- }
127
-
128
- interface ComponentInstance extends PixiMixins.ContainerOptions {
129
- id?: string;
130
- children?: ComponentInstance[];
131
- onInit?(props: Props): void;
132
- onUpdate?(props: Props): void;
133
- onDestroy?(parent: Element): void;
134
- onMount?(context: Element, index?: number): void;
135
- setWidth(width: number): void;
136
- setHeight(height: number): void;
137
- }
138
- declare const EVENTS: string[];
139
- declare function DisplayObject(extendClass: any): {
140
- new (): {
141
- [x: string]: any;
142
- "__#1@#canvasContext": {
143
- [key: string]: any;
144
- } | null;
145
- isFlex: boolean;
146
- fullProps: Props;
147
- isMounted: boolean;
148
- _anchorPoints: ObservablePoint;
149
- isCustomAnchor: boolean;
150
- displayWidth: _signe_reactive.WritableSignal<number>;
151
- displayHeight: _signe_reactive.WritableSignal<number>;
152
- overrideProps: string[];
153
- node: Node;
154
- readonly yoga: any;
155
- readonly deltaRatio: any;
156
- onInit(props: any): void;
157
- onMount({ parent, props }: Element</*elided*/ any>, index?: number): void;
158
- effectSize(width: Size, height: Size): void;
159
- "__#1@#applyFlexLayout"(): void;
160
- "__#1@#flexRender"(props: any): void;
161
- onUpdate(props: any): void;
162
- onDestroy(): void;
163
- getComputedLayout(): {
164
- left: number;
165
- right: number;
166
- top: number;
167
- bottom: number;
168
- width: number;
169
- height: number;
170
- };
171
- applyComputedLayout(): void;
172
- calculateLayout(): void;
173
- setFlexDirection(direction: FlexDirection): void;
174
- setFlexWrap(wrap: "wrap" | "nowrap" | "wrap-reverse"): void;
175
- "__#1@#setAlign"(methodName: string, align: AlignContent): void;
176
- setAlignContent(align: AlignContent): void;
177
- setAlignSelf(align: AlignContent): void;
178
- setAlignItems(align: AlignContent): void;
179
- setJustifyContent(justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around"): void;
180
- "__#1@#setEdgeSize"(methodName: string, size: EdgeSize): void;
181
- setPosition(position: EdgeSize): void;
182
- setX(x: number): void;
183
- setY(y: number): void;
184
- setPadding(padding: EdgeSize): void;
185
- setMargin(margin: EdgeSize): void;
186
- setGap(gap: EdgeSize): void;
187
- setBorder(border: EdgeSize): void;
188
- setPositionType(positionType: "relative" | "absolute"): void;
189
- calculateBounds(): void;
190
- setWidth(width: number): void;
191
- setHeight(height: number): void;
192
- getWidth(): number;
193
- getHeight(): number;
194
- };
195
- [x: string]: any;
196
- };
197
-
198
- interface Props {
199
- [key: string]: any;
200
- }
201
- type ArrayChange<T> = {
202
- type: "add" | "remove" | "update" | "init" | "reset";
203
- index?: number;
204
- items: T[];
205
- };
206
- type NestedSignalObjects = {
207
- [Key in string]: NestedSignalObjects | Signal<any>;
208
- };
209
- interface Element<T = ComponentInstance> {
210
- tag: string;
211
- props: Props;
212
- componentInstance: T;
213
- propSubscriptions: Subscription[];
214
- effectSubscriptions: Subscription[];
215
- effectMounts: (() => void)[];
216
- effectUnmounts: ((element?: Element) => void)[];
217
- propObservables: NestedSignalObjects | undefined;
218
- parent: Element | null;
219
- context?: {
220
- [key: string]: any;
221
- };
222
- directives: {
223
- [key: string]: Directive;
224
- };
225
- destroy: () => void;
226
- allElements: Subject<void>;
227
- }
228
- type FlowObservable = Observable<{
229
- elements: Element[];
230
- prev?: Element;
231
- }>;
232
- declare const isElement: (value: any) => value is Element;
233
- declare const isPrimitive: (value: any) => boolean;
234
- declare function registerComponent(name: any, component: any): void;
235
- /**
236
- * Creates a virtual element or a representation thereof, with properties that can be dynamically updated based on BehaviorSubjects.
237
- *
238
- * @param {string} tag - The tag name of the element to create.
239
- * @param {Object} props - An object containing properties for the element. Each property can either be a direct value
240
- * or an array where the first element is a function that returns a value based on input parameters,
241
- * and the second element is an array of BehaviorSubjects. The property is updated dynamically
242
- * using the combineLatest RxJS operator to wait for all BehaviorSubjects to emit.
243
- * @returns {Object} An object representing the created element, including tag name and dynamic properties.
244
- */
245
- declare function createComponent(tag: string, props?: Props): Element;
246
- /**
247
- * Observes a BehaviorSubject containing an array of items and dynamically creates child elements for each item.
248
- *
249
- * @param {BehaviorSubject<Array>} itemsSubject - A BehaviorSubject that emits an array of items.
250
- * @param {Function} createElementFn - A function that takes an item and returns an element representation.
251
- * @returns {Observable} An observable that emits the list of created child elements.
252
- */
253
- declare function loop<T = any>(itemsSubject: WritableArraySignal<T>, createElementFn: (item: any, index: number) => Element | Promise<Element>): FlowObservable;
254
- declare function cond(condition: Signal, createElementFn: () => Element | Promise<Element>): FlowObservable;
255
-
256
- declare abstract class Directive {
257
- abstract onDestroy(): any;
258
- abstract onInit(element: Element<any>): any;
259
- abstract onMount(element: Element<any>): any;
260
- abstract onUpdate(props: any): any;
261
- }
262
-
263
- interface Tick {
264
- timestamp: number;
265
- deltaTime: number;
266
- frame: number;
267
- deltaRatio: number;
268
- }
269
-
270
- type MountFunction = (fn: (element: Element) => void) => void;
271
- type ComponentFunction<P = {}> = (props: P) => Element | Promise<Element>;
272
- declare let currentSubscriptionsTracker: ((subscription: Subscription) => void) | null;
273
- declare let mountTracker: MountFunction | null;
274
- /**
275
- * Registers a mount function to be called when the component is mounted.
276
- * To unmount the component, the function must return a function that will be called by the engine.
277
- *
278
- * @param {(element: Element) => void} fn - The function to be called on mount.
279
- * @example
280
- * ```ts
281
- * mount((el) => {
282
- * console.log('mounted', el);
283
- * });
284
- * ```
285
- * Unmount the component by returning a function:
286
- * ```ts
287
- * mount((el) => {
288
- * console.log('mounted', el);
289
- * return () => {
290
- * console.log('unmounted', el);
291
- * }
292
- * });
293
- * ```
294
- */
295
- declare function mount(fn: (element: Element) => void): void;
296
- /**
297
- * Registers a tick function to be called on each tick of the component's context.
298
- * @param {(tickValue: Tick, element: Element) => void} fn - The function to be called on each tick.
299
- * @example
300
- * ```ts
301
- * tick((tickValue, el) => {
302
- * console.log('tick', tickValue, el);
303
- * });
304
- * ```
305
- */
306
- declare function tick(fn: (tickValue: Tick, element: Element) => void): void;
307
- /**
308
- * Add tracking for subscriptions and mounts, then create an element from a component function.
309
- * @template C
310
- * @param {C} componentFunction - The component function to create an element from.
311
- * @param {Parameters<C>[0]} [props={}] - The props to pass to the component function.
312
- * @param {...any[]} children - The children elements of the component.
313
- * @returns {ReturnType<C>}
314
- * @example
315
- * ```ts
316
- * const el = h(MyComponent, {
317
- * x: 100,
318
- * y: 100,
319
- * });
320
- * ```
321
- *
322
- * with children:
323
- * ```ts
324
- * const el = h(MyComponent, {
325
- * x: 100,
326
- * y: 100,
327
- * },
328
- * h(MyChildComponent, {
329
- * x: 50,
330
- * y: 50,
331
- * }),
332
- * );
333
- * ```
334
- */
335
- declare function h<C extends ComponentFunction<any>>(componentFunction: C, props?: Parameters<C>[0], ...children: any[]): ReturnType<C>;
336
-
337
- interface CanvasProps extends Props {
338
- cursorStyles?: () => any;
339
- width?: SignalOrPrimitive<Size>;
340
- height?: SignalOrPrimitive<Size>;
341
- canvasEl?: HTMLElement;
342
- selector?: string;
343
- isRoot?: boolean;
344
- tick?: any;
345
- class?: SignalOrPrimitive<string>;
346
- }
347
- declare const Canvas: ComponentFunction<CanvasProps>;
348
-
349
- interface ContainerProps extends DisplayObjectProps {
350
- sortableChildren?: boolean;
351
- }
352
- declare const Container: ComponentFunction<ContainerProps>;
353
-
354
- interface GraphicsProps extends DisplayObjectProps {
355
- draw?: (graphics: Graphics$1) => void;
356
- }
357
- interface RectProps extends DisplayObjectProps {
358
- width: number;
359
- height: number;
360
- color: string;
361
- }
362
- interface CircleProps extends DisplayObjectProps {
363
- radius: number;
364
- color: string;
365
- }
366
- interface EllipseProps extends DisplayObjectProps {
367
- width: number;
368
- height: number;
369
- color: string;
370
- }
371
- interface TriangleProps extends DisplayObjectProps {
372
- base: number;
373
- height: number;
374
- color: string;
375
- }
376
- interface SvgProps extends DisplayObjectProps {
377
- svg: string;
378
- }
379
- declare function Graphics(props: GraphicsProps): Element<ComponentInstance>;
380
- declare function Rect(props: RectProps): Element<ComponentInstance>;
381
- declare function Circle(props: CircleProps): Element<ComponentInstance>;
382
- declare function Ellipse(props: EllipseProps): Element<ComponentInstance>;
383
- declare function Triangle(props: TriangleProps): Element<ComponentInstance>;
384
- declare function Svg(props: SvgProps): Element<ComponentInstance>;
385
-
386
- declare function Scene(props: any): Element<ComponentInstance> | Promise<Element<ComponentInstance>>;
387
-
388
- declare function ParticlesEmitter(props: any): Element<ComponentInstance>;
389
-
390
- interface TransformOptions {
391
- /**
392
- * The global value of opacity (between 0 and 1)
393
- *
394
- * @prop {number} [opacity]
395
- * @memberof Spritesheet
396
- * */
397
- opacity?: number;
398
- /**
399
- * The global value of pivot.
400
- *
401
- * Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot is equal to position, regardless of the other three transformations. In other words, It is the center of rotation, scaling, and skewing.
402
- *
403
- * The array has two elements: [x, y]. If y is omitted, both x and y will be set to x.
404
- *
405
- * ```ts
406
- * pivot: [0.5, 0.8]
407
- * ```
408
- *
409
- * @prop {Array<number>} [pivot]
410
- * @memberof Spritesheet
411
- * */
412
- pivot?: number[];
413
- /**
414
- * The global value of anchor.
415
- *
416
- * Position of the origin point
417
- *
418
- * The array has two elements: [x, y]. If y is omitted, both x and y will be set to x.
419
- *
420
- * ```ts
421
- * anchor: [0.5, 0.8]
422
- * ```
423
- *
424
- * @prop {Array<number>} [anchor]
425
- * @memberof Spritesheet
426
- * */
427
- anchor?: number[];
428
- /**
429
- * Defines the actual size of the sprite that is inside a larger rectangle.
430
- * For example, if the texture rectangle is 192x192 while the character, which is in the center, is only 64x64 then set `spriteRealSize: 64`. This way the character will be well positioned in relation to the animations that have a different rectangle
431
- *
432
- * > You can also put `spriteRealSize: { width: 64, height: 64 }` but be aware that the width is not concerned because it will always be centered while the height depends on the hitbox
433
- *
434
- * @prop {{ width: number, height: number } | number} [spriteRealSize]
435
- * @since 3.2.0
436
- * @memberof Spritesheet
437
- * */
438
- spriteRealSize?: {
439
- width: number;
440
- height: number;
441
- } | number;
442
- /**
443
- * The global value of rotation
444
- *
445
- * Rotation. This will rotate the display object's projection by this angle (in radians).
446
- *
447
- * @prop {number} [angle]
448
- * @memberof Spritesheet
449
- * */
450
- angle?: number;
451
- /**
452
- * The global value of rotation
453
- *
454
- * Rotation. This is an alias for rotation, but in degrees.
455
- *
456
- * @prop {number} [rotation]
457
- * @memberof Spritesheet
458
- * */
459
- rotation?: number;
460
- /**
461
- * The global value of scale.
462
- *
463
- * Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center of scaling is the pivot.
464
- *
465
- * The array has two elements: [x, y]. If y is omitted, both x and y will be set to x.
466
- *
467
- * ```ts
468
- * scale: [0.5, 0.8]
469
- * ```
470
- *
471
- * @prop {Array<number>} [scale]
472
- * @memberof Spritesheet
473
- * */
474
- scale?: number[];
475
- /**
476
- * The global value of skew.
477
- *
478
- * Skewing. This can be used to deform a rectangular display object into a parallelogram.
479
- *
480
- * In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be thought of the net rotation applied to the coordinate axes (separately). For example, if "skew.x" is ⍺ and "skew.y" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will be rotated by an angle between ⍺ and β.
481
- *
482
- * It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying a rotation. Indeed, if "skew.x" = -ϴ and "skew.y" = ϴ, it will produce an equivalent of "rotation" = ϴ.
483
- *
484
- * Another quite interesting observation is that "skew.x", "skew.y", rotation are communtative operations. Indeed, because rotation is essentially a careful combination of the two.
485
- *
486
- * The array has two elements: [x, y]. If y is omitted, both x and y will be set to x.
487
- *
488
- * @prop {Array<number>} [skew]
489
- * @memberof Spritesheet
490
- * */
491
- skew?: number[];
492
- /**
493
- * The global value of X translation
494
- *
495
- * @prop {number} [x]
496
- * @memberof Spritesheet
497
- * */
498
- x?: number;
499
- /**
500
- * The global value of Y translation
501
- *
502
- * @prop {number} [y]
503
- * @memberof Spritesheet
504
- * */
505
- y?: number;
506
- /**
507
- * The global value of visible
508
- *
509
- * @prop {boolean} [visible]
510
- * @memberof Spritesheet
511
- * */
512
- visible?: boolean;
513
- /**
514
- * Define the sound that will be played for all animations in the spritesheet. Remember to create the sound before with the @Sound decorator
515
- *
516
- * @prop {string} [sound]
517
- * @memberof Spritesheet
518
- * */
519
- sound?: string;
520
- }
521
- interface FrameOptions extends TransformOptions {
522
- time: number;
523
- frameX?: number;
524
- frameY?: number;
525
- }
526
- interface TextureOptions {
527
- /**
528
- * The number of frames on the width
529
- *
530
- * @prop {number} framesWidth
531
- * @memberof Spritesheet
532
- * */
533
- framesWidth?: number;
534
- /**
535
- * The number of frames on the height
536
- *
537
- * @prop {number} framesHeight
538
- * @memberof Spritesheet
539
- * */
540
- framesHeight?: number;
541
- /**
542
- * The width of the image (in pixels)
543
- *
544
- * @prop {number} width
545
- * @memberof Spritesheet
546
- * */
547
- width?: number;
548
- /**
549
- * The height of the image (in pixels)
550
- *
551
- * @prop {number} height
552
- * @memberof Spritesheet
553
- * */
554
- height?: number;
555
- /**
556
- * Takes a width of a rectangle in the image. Equivalent to `width / framesWidth`
557
- *
558
- * @prop {number} [rectWidth]
559
- * @memberof Spritesheet
560
- * */
561
- rectWidth?: number;
562
- /**
563
- * Takes a height of a rectangle in the image. Equivalent to `height / framesHeight`
564
- *
565
- * @prop {number} [rectHeight]
566
- * @memberof Spritesheet
567
- * */
568
- rectHeight?: number;
569
- /**
570
- * To take the texture, start at a well defined X and Y position. Otherwise, it starts at 0,0
571
- *
572
- * @prop {number} [offset]
573
- * @memberof Spritesheet
574
- * */
575
- offset?: {
576
- x: number;
577
- y: number;
578
- };
579
- }
580
- type AnimationFrames = FrameOptions[][] | ((...args: any) => FrameOptions[][]);
581
- interface TexturesOptions extends TextureOptions, TransformOptions {
582
- animations: AnimationFrames;
583
- }
584
- interface SpritesheetOptions extends TransformOptions, TextureOptions {
585
- /**
586
- * Object containing all animations.
587
- * The key to the object is the name of the animation. The value is a two-dimensional array
588
- *
589
- * ```ts
590
- * textures: {
591
- * myanim: {
592
- * animations: [
593
- * [ { time: 0, frameX: 0, frameY: 0 } ]
594
- * ]
595
- * }
596
- * }
597
- * ```
598
- *
599
- * The first array represents an animation group. You can put several of them together to create an animation cluster. For example, several explosions with the same spritesheet
600
- * The second array represents the animation itself which will animate over time. The object indicates, over a period of time (in frame), which part of the spritesheet will be taken (`frameX`, `frameY`)
601
- *
602
- * Here are the properties:
603
- *
604
- * * `time`: Time in frame
605
- * * `frameX`: Retrieve a frame from the spritesheet on the X-axis
606
- * * `frameY`: Retrieve a frame from the spritesheet on the Y-axis
607
- * * `opacity`
608
- * * `pivot`
609
- * * `anchor`
610
- * * `rotation`
611
- * * `angle`
612
- * * `scale`
613
- * * `skew`
614
- * * `x`
615
- * * `y`
616
- * * `visible`
617
- * * `sound`: The sound that will be played during the frame
618
- *
619
- * ---
620
- * **Extract Animation of Spritesheet**
621
- *
622
- * Sometimes the animation is part of the image
623
- *
624
- * ```ts
625
- * textures: {
626
- * myanim: {
627
- * rectWidth: 64,
628
- * rectHeight: 64,
629
- * framesWidth: 10,
630
- * framesHeight: 2,
631
- * offset: {x: 0, y: 230},
632
- * sound: 'my-sound-id', // You can put a sound just for the animation
633
- * animations: [
634
- * [ { time: 0, frameX: 0, frameY: 0 } ]
635
- * ]
636
- * }
637
- * }
638
- * ```
639
- *
640
- * Above, we can specify which part we want to recover
641
- *
642
- * 1. We go to the position {0, 230} of the image (`offset`)
643
- * 2. We recover cells of 64px (`rectWidth` and `rectHeight`)
644
- * 3. And we get 20 cells (10 on the width, 2 on the height) (`frameX` and `frameY`)
645
- *
646
- * ---
647
- *
648
- * **Advanced**
649
- *
650
- * You can create an animation that will be linked to a data. For example, different animation according to a direction of the character.
651
- *
652
- * Full example:
653
- *
654
- * ```ts
655
- * import { Spritesheet, Animation, Direction } from '@rpgjs/client'
656
- *
657
- * @Spritesheet({
658
- * id: 'chest',
659
- * image: require('./assets/chest.png'),
660
- * width: 124,
661
- * height: 61,
662
- * framesHeight: 2,
663
- * framesWidth: 4,
664
- * textures: {
665
- * [Animation.Stand]: {
666
- * animations: direction => [[ {time: 0, frameX: 3, frameY: direction == Direction.Up ? 0 : 1 } ]]
667
- * }
668
- * })
669
- * })
670
- * export class Chest { }
671
- * ```
672
- *
673
- * > It is important to know that `Animation.Stand` animation is called if it exists. it only works in the case of an event that doesn't move. The direction is then sent
674
- *
675
- * As you can see, the property contains a function that returns the array for the animation. Here, it is the direction but the parameters depend on the call of the animation. Example:
676
- *
677
- * ```ts
678
- * import { Spritesheet, Animation, Direction, RpgSprite, ISpriteCharacter } from '@rpgjs/client'
679
- *
680
- * @Spritesheet({
681
- * id: 'chest',
682
- * image: require('./assets/chest.png'),
683
- * width: 124,
684
- * height: 61,
685
- * framesHeight: 2,
686
- * framesWidth: 4,
687
- * textures: {
688
- * [Animation.Stand]: {
689
- * animations: str => [[ {time: 0, frameX: 3, frameY: str == 'hello' ? 0 : 1 } ]]
690
- * }
691
- * }
692
- * })
693
- * export class Chest implements ISpriteCharacter {
694
- * onCharacterStand(sprite: RpgSprite) {
695
- * sprite.animation.play(Animation.Stand, ['hello'])
696
- * }
697
- * }
698
- * ```
699
- *
700
- * @prop { { [animName: string]: { animations: Array<Array<FrameOptions>> | Function, ...other } } } [textures]
701
- * @memberof Spritesheet
702
- * */
703
- textures?: {
704
- [animationName: string]: Partial<TexturesOptions> & Pick<TexturesOptions, 'animations'>;
705
- };
706
- }
707
-
708
- type Image = {
709
- image: string;
710
- };
711
- type TextureOptionsMerging = TextureOptions & {
712
- spriteWidth: number;
713
- spriteHeight: number;
714
- sound?: string;
715
- } & Image & TransformOptions;
716
- type SpritesheetOptionsMerging = TextureOptionsMerging & SpritesheetOptions;
717
- interface SpriteProps extends DisplayObjectProps {
718
- sheet?: {
719
- definition?: SpritesheetOptionsMerging;
720
- playing?: string;
721
- params?: any;
722
- onFinish?: () => void;
723
- };
724
- scaleMode?: number;
725
- image?: string;
726
- rectangle?: {
727
- x: number;
728
- y: number;
729
- width: number;
730
- height: number;
731
- };
732
- context?: {
733
- tick: Signal;
734
- };
735
- }
736
- interface SpritePropsWithImage extends Omit<SpriteProps, "sheet"> {
737
- image: string;
738
- rectangle?: {
739
- x: number;
740
- y: number;
741
- width: number;
742
- height: number;
743
- };
744
- }
745
- interface SpritePropsWithSheet extends Omit<SpriteProps, "image" | "rectangle"> {
746
- sheet: {
747
- definition: SpritesheetOptionsMerging;
748
- playing?: string;
749
- params?: any;
750
- onFinish?: () => void;
751
- };
752
- }
753
- type SpritePropTypes = SpritePropsWithImage | SpritePropsWithSheet;
754
- declare const Sprite: ComponentFunction<SpritePropTypes>;
755
-
756
- interface TextProps extends DisplayObjectProps {
757
- text?: string;
758
- style?: Partial<TextStyle>;
759
- color?: string;
760
- size?: string;
761
- fontFamily?: string;
762
- typewriter?: {
763
- speed?: number;
764
- start?: () => void;
765
- onComplete?: () => void;
766
- skip?: () => void;
767
- };
768
- }
769
- declare function Text(props: TextProps): Element<ComponentInstance>;
770
-
771
- interface TilingSpriteProps extends DisplayObjectProps {
772
- image?: string;
773
- tileScale?: {
774
- x: number;
775
- y: number;
776
- };
777
- tilePosition?: {
778
- x: number;
779
- y: number;
780
- };
781
- width?: number;
782
- height?: number;
783
- }
784
- declare function TilingSprite(props: TilingSpriteProps): Element<ComponentInstance>;
785
-
786
- interface ViewportProps {
787
- screenWidth?: number;
788
- screenHeight?: number;
789
- worldWidth?: number;
790
- worldHeight?: number;
791
- clamp?: boolean | {
792
- left?: number;
793
- right?: number;
794
- top?: number;
795
- bottom?: number;
796
- };
797
- [key: string]: any;
798
- }
799
- declare function Viewport(props: ViewportProps): Element<ComponentInstance>;
800
-
801
- interface NineSliceSpriteProps extends DisplayObjectProps {
802
- image?: string;
803
- texture?: Texture;
804
- width?: number;
805
- height?: number;
806
- leftWidth?: number;
807
- rightWidth?: number;
808
- topHeight?: number;
809
- bottomHeight?: number;
810
- roundPixels?: boolean;
811
- }
812
- declare function NineSliceSprite(props: NineSliceSpriteProps): Element<ComponentInstance>;
813
-
814
- interface Listen<T = any> {
815
- config: T | undefined;
816
- seed: {
817
- config: T | undefined;
818
- value: number;
819
- resolve: (value: any) => void;
820
- };
821
- }
822
- interface Trigger<T = any> {
823
- start: () => Promise<void>;
824
- listen: () => Listen<T> | undefined;
825
- }
826
- /**
827
- * Checks if the given argument is a Trigger object
828
- * @param arg - The value to check
829
- * @returns True if the argument is a Trigger object
830
- */
831
- declare function isTrigger(arg: any): arg is Trigger<any>;
832
- /**
833
- * Creates a new trigger that can be used to pass data between components
834
- * @param globalConfig - Optional configuration data to be passed when the trigger is activated
835
- * @returns A Trigger object with start and listen methods
836
- * @example
837
- * ```ts
838
- * const myTrigger = trigger()
839
- *
840
- * on(myTrigger, (data) => {
841
- * console.log('Triggered with data:', data)
842
- * })
843
- *
844
- * myTrigger.start({ message: 'Hello' })
845
- * ```
846
- */
847
- declare function trigger<T = any>(globalConfig?: T): Trigger<T>;
848
- /**
849
- * Subscribes to a trigger and executes a callback when the trigger is activated
850
- * @param triggerSignal - The trigger to subscribe to
851
- * @param callback - Function to execute when the trigger is activated
852
- * @throws Error if triggerSignal is not a valid trigger
853
- * @example
854
- * ```ts
855
- * const click = trigger()
856
- *
857
- * on(click, () => {
858
- * console.log('Click triggered')
859
- * })
860
- * ```
861
- */
862
- declare function on(triggerSignal: any, callback: (config: any) => void | Promise<void>): void;
863
-
864
- /**
865
- * Bootstraps a canvas element and renders it to the DOM.
866
- *
867
- * @param rootElement - The HTML element where the canvas will be rendered. Can be null.
868
- * @param canvas - A Promise that resolves to an Element representing the canvas component.
869
- * @returns A Promise that resolves to the rendered canvas element.
870
- * @throws {Error} If the provided element is not a Canvas component.
871
- */
872
- declare const bootstrapCanvas: (rootElement: HTMLElement | null, canvas: ComponentFunction<any>) => Promise<Element<ComponentInstance>>;
873
-
874
- /**
875
- * Converts props into reactive signals if they are primitive values.
876
- *
877
- * @param {object} props - The properties to convert.
878
- * @param {object} [defaults={}] - Default values for properties.
879
- * @returns {object} An object with reactive signals.
880
- *
881
- * @example
882
- * const props = useProps({ count: 0, name: "John" });
883
- * console.log(props.count()); // 0
884
- * props.count.set(1);
885
- * console.log(props.count()); // 1
886
- */
887
- declare const useProps: (props: any, defaults?: {}) => any;
888
- type PropType = NumberConstructor | StringConstructor | BooleanConstructor | FunctionConstructor | ObjectConstructor | ArrayConstructor | null | (new (...args: any[]) => any);
889
- interface PropConfig {
890
- type?: PropType | PropType[];
891
- required?: boolean;
892
- default?: any | ((props: any) => any);
893
- validator?: (value: any, props: any) => boolean;
894
- }
895
- type PropSchema = {
896
- [key: string]: PropType | PropType[] | PropConfig;
897
- };
898
- /**
899
- * Validates and defines properties based on a schema.
900
- *
901
- * @param {object} props - The properties to validate.
902
- * @returns {function} A function that takes a schema and returns validated properties.
903
- *
904
- * @example
905
- * const schema = {
906
- * age: { type: Number, required: true },
907
- * name: { type: String, default: "Anonymous" }
908
- * };
909
- * const validatedProps = useDefineProps({ age: 25 })(schema);
910
- * console.log(validatedProps.age()); // 25
911
- * console.log(validatedProps.name()); // "Anonymous"
912
- */
913
- declare const useDefineProps: (props: any) => (schema?: PropSchema) => any;
914
-
915
- declare const Easing: {
916
- linear: popmotion.Easing;
917
- easeIn: popmotion.Easing;
918
- easeInOut: popmotion.Easing;
919
- easeOut: popmotion.Easing;
920
- circIn: popmotion.Easing;
921
- circInOut: popmotion.Easing;
922
- circOut: popmotion.Easing;
923
- backIn: popmotion.Easing;
924
- backInOut: popmotion.Easing;
925
- backOut: popmotion.Easing;
926
- anticipate: popmotion.Easing;
927
- bounceIn: popmotion.Easing;
928
- bounceInOut: (p: number) => number;
929
- bounceOut: (p: number) => number;
930
- };
931
-
932
- /**
933
- * Creates a radial gradient texture that can be used in PixiJS.
934
- * @example
935
- * const gradient = new RadialGradient(size, size, 0, size, size, 0);
936
- * gradient.addColorStop(0, "rgba(255, 255, 0, 1)");
937
- * gradient.addColorStop(0.5, "rgba(255, 255, 0, 0.3)");
938
- * gradient.addColorStop(0.8, "rgba(255, 255, 0, 0)");
939
- */
940
- declare class RadialGradient {
941
- private x0;
942
- private y0;
943
- private x1;
944
- private y1;
945
- private x2;
946
- private y2;
947
- private focalPoint;
948
- private canvas;
949
- private ctx;
950
- private gradient;
951
- private texture;
952
- transform: Matrix;
953
- size: number;
954
- /**
955
- * Creates a new RadialGradient instance
956
- * @param x0 - The x-coordinate of the starting circle
957
- * @param y0 - The y-coordinate of the starting circle
958
- * @param x1 - The x-coordinate of the ending circle
959
- * @param y1 - The y-coordinate of the ending circle
960
- * @param x2 - The x-coordinate for gradient transformation
961
- * @param y2 - The y-coordinate for gradient transformation
962
- * @param focalPoint - The focal point of the gradient (0-1), defaults to 0
963
- */
964
- constructor(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, focalPoint?: number);
965
- /**
966
- * Adds a color stop to the gradient
967
- * @param offset - The position of the color stop (0-1)
968
- * @param color - The color value (any valid CSS color string)
969
- */
970
- addColorStop(offset: number, color: string): void;
971
- /**
972
- * Renders the gradient and returns the texture with its transformation matrix
973
- * @param options - Render options
974
- * @param options.translate - Optional translation coordinates
975
- * @returns Object containing the texture and transformation matrix
976
- */
977
- render({ translate }?: {
978
- translate?: {
979
- x: number;
980
- y: number;
981
- };
982
- }): {
983
- texture: Texture<PIXI.TextureSource<any>>;
984
- matrix: Matrix;
985
- };
986
- }
987
-
988
- /**
989
- * Checks if code is running in a browser environment
990
- * @returns {boolean} True if running in browser, false otherwise
991
- */
992
- declare function isBrowser(): boolean;
993
- /**
994
- * Returns current high-resolution timestamp
995
- * @returns {number} Current time in milliseconds
996
- */
997
- declare function preciseNow(): number;
998
- /**
999
- * Converts frames per second to milliseconds
1000
- * @param {number} fps - Frames per second
1001
- * @returns {number} Milliseconds per frame
1002
- */
1003
- declare function fps2ms(fps: number): number;
1004
- /**
1005
- * Checks if a value is a Promise
1006
- * @param {any} value - Value to check
1007
- * @returns {boolean} True if value is a Promise, false otherwise
1008
- */
1009
- declare function isPromise(value: any): boolean;
1010
- declare function arrayEquals(a: any[], b: any[]): boolean;
1011
- /**
1012
- * Checks if a value is a function
1013
- * @param {unknown} val - Value to check
1014
- * @returns {boolean} True if value is a function, false otherwise
1015
- */
1016
- declare function isFunction(val: unknown): boolean;
1017
- /**
1018
- * Checks if a value is a plain object
1019
- * @param {unknown} val - Value to check
1020
- * @returns {boolean} True if value is an object (not null and not array), false otherwise
1021
- */
1022
- declare function isObject(val: unknown): boolean;
1023
- /**
1024
- * Sets a value in an object using a dot notation path
1025
- * @param {Record<string, any>} obj - Target object
1026
- * @param {string | string[]} path - Path to set value at (e.g., 'a.b.c' or ['a', 'b', 'c'])
1027
- * @param {any} value - Value to set
1028
- * @param {boolean} onlyPlainObject - If true, only creates plain objects in path
1029
- * @returns {Record<string, any>} Modified object
1030
- */
1031
- declare function set(obj: Record<string, any>, path: string | string[], value: any, onlyPlainObject?: boolean): Record<string, any>;
1032
- /**
1033
- * Gets a value from an object using a dot notation path
1034
- * @param {Record<string, any>} obj - Source object
1035
- * @param {string} path - Path to get value from (e.g., 'a.b.c')
1036
- * @returns {any} Value at path or undefined if not found
1037
- */
1038
- declare function get(obj: Record<string, any>, path: string): any;
1039
- /**
1040
- * Logs a message to console
1041
- * @param {any} text - Message to log
1042
- */
1043
- declare function log(text: any): void;
1044
- /**
1045
- * Logs an error message to console
1046
- * @param {any} text - Error message to log
1047
- */
1048
- declare function error(text: any): void;
1049
- /**
1050
- * Sets the position of an ObservablePoint using various input formats
1051
- * @param {ObservablePoint} observablePoint - The point to modify
1052
- * @param {Object | number | [number, number]} point - New position value
1053
- */
1054
- declare function setObservablePoint(observablePoint: ObservablePoint, point: {
1055
- x: number;
1056
- y: number;
1057
- } | number | [number, number]): void;
1058
- /**
1059
- * Calculates the Euclidean distance between two points
1060
- * @param {number} x1 - X coordinate of first point
1061
- * @param {number} y1 - Y coordinate of first point
1062
- * @param {number} x2 - X coordinate of second point
1063
- * @param {number} y2 - Y coordinate of second point
1064
- * @returns {number} Distance between the points
1065
- */
1066
- declare function calculateDistance(x1: number, y1: number, x2: number, y2: number): number;
1067
-
1068
- declare const utils_arrayEquals: typeof arrayEquals;
1069
- declare const utils_calculateDistance: typeof calculateDistance;
1070
- declare const utils_error: typeof error;
1071
- declare const utils_fps2ms: typeof fps2ms;
1072
- declare const utils_get: typeof get;
1073
- declare const utils_isBrowser: typeof isBrowser;
1074
- declare const utils_isFunction: typeof isFunction;
1075
- declare const utils_isObject: typeof isObject;
1076
- declare const utils_isPromise: typeof isPromise;
1077
- declare const utils_log: typeof log;
1078
- declare const utils_preciseNow: typeof preciseNow;
1079
- declare const utils_set: typeof set;
1080
- declare const utils_setObservablePoint: typeof setObservablePoint;
1081
- declare namespace utils {
1082
- export { utils_arrayEquals as arrayEquals, utils_calculateDistance as calculateDistance, utils_error as error, utils_fps2ms as fps2ms, utils_get as get, utils_isBrowser as isBrowser, utils_isFunction as isFunction, utils_isObject as isObject, utils_isPromise as isPromise, utils_log as log, utils_preciseNow as preciseNow, utils_set as set, utils_setObservablePoint as setObservablePoint };
1083
- }
1084
-
1085
- export { type AnimatedSignal, type AnimatedState, type ArrayChange, Canvas, Circle, type ComponentFunction, type ComponentInstance, Container, DisplayObject, EVENTS, Easing, type Element, Ellipse, Graphics, NineSliceSprite, ParticlesEmitter, type Props, RadialGradient, Rect, Scene, Sprite, Text, TilingSprite, Triangle, utils as Utils, Viewport, animatedSignal, bootstrapCanvas, cond, createComponent, currentSubscriptionsTracker, h, isAnimatedSignal, isElement, isPrimitive, isTrigger, loop, mount, mountTracker, on, registerComponent, Svg as svg, tick, trigger, useDefineProps, useProps };
4
+ export * from './components';
5
+ export * from './engine/reactive';
6
+ export * from './engine/signal';
7
+ export * from './engine/trigger';
8
+ export * from './engine/bootstrap';
9
+ export * from './engine/animation';
10
+ export { useProps, useDefineProps } from './hooks/useProps';
11
+ export * from './utils/Ease';
12
+ export * from './utils/RadialGradient';
13
+ export * from './components/DisplayObject';
14
+ export { isObservable } from 'rxjs';
15
+ export * as Utils from './engine/utils';
16
+ export * as Howl from 'howler';
17
+ //# sourceMappingURL=index.d.ts.map