canvasengine 1.3.0 → 2.0.0-beta.10

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