canvasengine 2.0.0-beta.5 → 2.0.0-beta.50
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.
- package/dist/components/Button.d.ts +185 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Canvas.d.ts +17 -0
- package/dist/components/Canvas.d.ts.map +1 -0
- package/dist/components/Container.d.ts +86 -0
- package/dist/components/Container.d.ts.map +1 -0
- package/dist/components/DOMContainer.d.ts +98 -0
- package/dist/components/DOMContainer.d.ts.map +1 -0
- package/dist/components/DOMElement.d.ts +54 -0
- package/dist/components/DOMElement.d.ts.map +1 -0
- package/dist/components/DOMSprite.d.ts +127 -0
- package/dist/components/DOMSprite.d.ts.map +1 -0
- package/dist/components/DisplayObject.d.ts +94 -0
- package/dist/components/DisplayObject.d.ts.map +1 -0
- package/dist/components/FocusContainer.d.ts +129 -0
- package/dist/components/FocusContainer.d.ts.map +1 -0
- package/dist/components/Graphic.d.ts +64 -0
- package/dist/components/Graphic.d.ts.map +1 -0
- package/dist/components/Joystick.d.ts +36 -0
- package/dist/components/Joystick.d.ts.map +1 -0
- package/dist/components/Mesh.d.ts +208 -0
- package/dist/components/Mesh.d.ts.map +1 -0
- package/dist/components/NineSliceSprite.d.ts +16 -0
- package/dist/components/NineSliceSprite.d.ts.map +1 -0
- package/dist/components/ParticleEmitter.d.ts +4 -0
- package/dist/components/ParticleEmitter.d.ts.map +1 -0
- package/dist/components/Scene.d.ts +2 -0
- package/dist/components/Scene.d.ts.map +1 -0
- package/dist/components/Sprite.d.ts +242 -0
- package/dist/components/Sprite.d.ts.map +1 -0
- package/dist/components/Text.d.ts +25 -0
- package/dist/components/Text.d.ts.map +1 -0
- package/dist/components/TilingSprite.d.ts +17 -0
- package/dist/components/TilingSprite.d.ts.map +1 -0
- package/dist/components/Video.d.ts +14 -0
- package/dist/components/Video.d.ts.map +1 -0
- package/dist/components/Viewport.d.ts +121 -0
- package/dist/components/Viewport.d.ts.map +1 -0
- package/dist/components/index.d.ts +20 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/types/DisplayObject.d.ts +106 -0
- package/dist/components/types/DisplayObject.d.ts.map +1 -0
- package/dist/components/types/MouseEvent.d.ts +4 -0
- package/dist/components/types/MouseEvent.d.ts.map +1 -0
- package/dist/components/types/Spritesheet.d.ts +248 -0
- package/dist/components/types/Spritesheet.d.ts.map +1 -0
- package/dist/components/types/index.d.ts +4 -0
- package/dist/components/types/index.d.ts.map +1 -0
- package/dist/directives/Controls.d.ts +112 -0
- package/dist/directives/Controls.d.ts.map +1 -0
- package/dist/directives/ControlsBase.d.ts +199 -0
- package/dist/directives/ControlsBase.d.ts.map +1 -0
- package/dist/directives/Drag.d.ts +69 -0
- package/dist/directives/Drag.d.ts.map +1 -0
- package/dist/directives/Flash.d.ts +116 -0
- package/dist/directives/Flash.d.ts.map +1 -0
- package/dist/directives/FocusNavigation.d.ts +52 -0
- package/dist/directives/FocusNavigation.d.ts.map +1 -0
- package/dist/directives/GamepadControls.d.ts +224 -0
- package/dist/directives/GamepadControls.d.ts.map +1 -0
- package/dist/directives/JoystickControls.d.ts +171 -0
- package/dist/directives/JoystickControls.d.ts.map +1 -0
- package/dist/directives/KeyboardControls.d.ts +219 -0
- package/dist/directives/KeyboardControls.d.ts.map +1 -0
- package/dist/directives/Scheduler.d.ts +35 -0
- package/dist/directives/Scheduler.d.ts.map +1 -0
- package/dist/directives/Shake.d.ts +98 -0
- package/dist/directives/Shake.d.ts.map +1 -0
- package/dist/directives/Sound.d.ts +25 -0
- package/dist/directives/Sound.d.ts.map +1 -0
- package/dist/directives/Transition.d.ts +10 -0
- package/dist/directives/Transition.d.ts.map +1 -0
- package/dist/directives/ViewportCull.d.ts +11 -0
- package/dist/directives/ViewportCull.d.ts.map +1 -0
- package/dist/directives/ViewportFollow.d.ts +18 -0
- package/dist/directives/ViewportFollow.d.ts.map +1 -0
- package/dist/directives/index.d.ts +13 -0
- package/dist/directives/index.d.ts.map +1 -0
- package/dist/engine/FocusManager.d.ts +174 -0
- package/dist/engine/FocusManager.d.ts.map +1 -0
- package/dist/engine/animation.d.ts +72 -0
- package/dist/engine/animation.d.ts.map +1 -0
- package/dist/engine/bootstrap.d.ts +48 -0
- package/dist/engine/bootstrap.d.ts.map +1 -0
- package/dist/engine/directive.d.ts +13 -0
- package/dist/engine/directive.d.ts.map +1 -0
- package/dist/engine/reactive.d.ts +134 -0
- package/dist/engine/reactive.d.ts.map +1 -0
- package/dist/engine/signal.d.ts +71 -0
- package/dist/engine/signal.d.ts.map +1 -0
- package/dist/engine/trigger.d.ts +54 -0
- package/dist/engine/trigger.d.ts.map +1 -0
- package/dist/engine/utils.d.ts +89 -0
- package/dist/engine/utils.d.ts.map +1 -0
- package/dist/hooks/addContext.d.ts +2 -0
- package/dist/hooks/addContext.d.ts.map +1 -0
- package/dist/hooks/useFocus.d.ts +60 -0
- package/dist/hooks/useFocus.d.ts.map +1 -0
- package/dist/hooks/useProps.d.ts +42 -0
- package/dist/hooks/useProps.d.ts.map +1 -0
- package/dist/hooks/useRef.d.ts +4 -0
- package/dist/hooks/useRef.d.ts.map +1 -0
- package/dist/index-DaGekQUW.js +2218 -0
- package/dist/index-DaGekQUW.js.map +1 -0
- package/dist/index.d.ts +19 -1099
- package/dist/index.d.ts.map +1 -0
- package/dist/index.global.js +5 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +11749 -2901
- package/dist/index.js.map +1 -1
- package/dist/utils/Ease.d.ts +17 -0
- package/dist/utils/Ease.d.ts.map +1 -0
- package/dist/utils/GlobalAssetLoader.d.ts +141 -0
- package/dist/utils/GlobalAssetLoader.d.ts.map +1 -0
- package/dist/utils/RadialGradient.d.ts +57 -0
- package/dist/utils/RadialGradient.d.ts.map +1 -0
- package/dist/utils/functions.d.ts +2 -0
- package/dist/utils/functions.d.ts.map +1 -0
- package/dist/utils/tabindex.d.ts +16 -0
- package/dist/utils/tabindex.d.ts.map +1 -0
- package/package.json +13 -7
- package/src/components/Button.ts +399 -0
- package/src/components/Canvas.ts +62 -46
- package/src/components/Container.ts +21 -2
- package/src/components/DOMContainer.ts +379 -0
- package/src/components/DOMElement.ts +556 -0
- package/src/components/DOMSprite.ts +1040 -0
- package/src/components/DisplayObject.ts +392 -201
- package/src/components/FocusContainer.ts +368 -0
- package/src/components/Graphic.ts +227 -66
- package/src/components/Joystick.ts +363 -0
- package/src/components/Mesh.ts +222 -0
- package/src/components/NineSliceSprite.ts +4 -1
- package/src/components/ParticleEmitter.ts +12 -8
- package/src/components/Sprite.ts +297 -31
- package/src/components/Text.ts +125 -18
- package/src/components/Video.ts +2 -2
- package/src/components/Viewport.ts +118 -63
- package/src/components/index.ts +9 -2
- package/src/components/types/DisplayObject.ts +41 -4
- package/src/components/types/Spritesheet.ts +0 -118
- package/src/directives/Controls.ts +254 -0
- package/src/directives/ControlsBase.ts +267 -0
- package/src/directives/Drag.ts +357 -52
- package/src/directives/Flash.ts +419 -0
- package/src/directives/FocusNavigation.ts +113 -0
- package/src/directives/GamepadControls.ts +537 -0
- package/src/directives/JoystickControls.ts +396 -0
- package/src/directives/KeyboardControls.ts +85 -430
- package/src/directives/Scheduler.ts +12 -4
- package/src/directives/Shake.ts +298 -0
- package/src/directives/Sound.ts +94 -31
- package/src/directives/ViewportFollow.ts +40 -9
- package/src/directives/index.ts +12 -6
- package/src/engine/FocusManager.ts +510 -0
- package/src/engine/animation.ts +175 -21
- package/src/engine/bootstrap.ts +93 -3
- package/src/engine/directive.ts +4 -4
- package/src/engine/reactive.ts +901 -161
- package/src/engine/signal.ts +113 -25
- package/src/engine/trigger.ts +34 -7
- package/src/engine/utils.ts +19 -3
- package/src/hooks/useFocus.ts +91 -0
- package/src/hooks/useProps.ts +1 -1
- package/src/index.ts +8 -2
- package/src/types/pixi-cull.d.ts +7 -0
- package/src/utils/GlobalAssetLoader.ts +257 -0
- package/src/utils/functions.ts +7 -0
- package/src/utils/tabindex.ts +70 -0
- package/testing/index.ts +35 -4
- package/tsconfig.json +18 -0
- package/vite.config.ts +39 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Element, Props } from '../engine/reactive';
|
|
2
|
+
import { AlignContent, EdgeSize, FlexDirection, ObjectFit, ObjectPosition, TransformOrigin } from './types/DisplayObject';
|
|
3
|
+
import { ObservablePoint, Point, Rectangle } from 'pixi.js';
|
|
4
|
+
import { BehaviorSubject } from 'rxjs';
|
|
5
|
+
export interface ComponentInstance extends PixiMixins.ContainerOptions {
|
|
6
|
+
id?: string;
|
|
7
|
+
children?: ComponentInstance[];
|
|
8
|
+
onInit?(props: Props): void;
|
|
9
|
+
onUpdate?(props: Props): void;
|
|
10
|
+
onDestroy?(parent: Element, afterDestroy: () => void): void;
|
|
11
|
+
onMount?(context: Element<any>, index?: number): void;
|
|
12
|
+
setWidth(width: number): void;
|
|
13
|
+
setHeight(height: number): void;
|
|
14
|
+
getLocalBounds?(): Rectangle;
|
|
15
|
+
getGlobalPosition?(): Point;
|
|
16
|
+
}
|
|
17
|
+
export declare const EVENTS: string[];
|
|
18
|
+
export type OnHook = (() => void) | (() => Promise<void> | void);
|
|
19
|
+
export declare function DisplayObject(extendClass: any): {
|
|
20
|
+
new (): {
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
"__#private@#canvasContext": {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
} | null;
|
|
25
|
+
isFlex: boolean;
|
|
26
|
+
fullProps: Props;
|
|
27
|
+
isMounted: boolean;
|
|
28
|
+
_anchorPoints: ObservablePoint;
|
|
29
|
+
isCustomAnchor: boolean;
|
|
30
|
+
displayWidth: import('@signe/reactive').WritableSignal<number>;
|
|
31
|
+
displayHeight: import('@signe/reactive').WritableSignal<number>;
|
|
32
|
+
overrideProps: string[];
|
|
33
|
+
layout: any;
|
|
34
|
+
onBeforeDestroy: OnHook | null;
|
|
35
|
+
onAfterMount: OnHook | null;
|
|
36
|
+
subjectInit: BehaviorSubject<any>;
|
|
37
|
+
disableLayout: boolean;
|
|
38
|
+
"__#private@#registeredEvents": Map<string, Function>;
|
|
39
|
+
"__#private@#computedLayoutBox": {
|
|
40
|
+
width?: number;
|
|
41
|
+
height?: number;
|
|
42
|
+
} | null;
|
|
43
|
+
"__#private@#element": Element<any> | null;
|
|
44
|
+
/**
|
|
45
|
+
* Get the element reference for freeze checking
|
|
46
|
+
* @returns The element reference or null
|
|
47
|
+
*/
|
|
48
|
+
getElement(): Element<any> | null;
|
|
49
|
+
onLayoutComputed(_event: any): void;
|
|
50
|
+
get deltaRatio(): any;
|
|
51
|
+
get parentIsFlex(): any;
|
|
52
|
+
onInit(props: Props): void;
|
|
53
|
+
onMount(element: Element<any>, index?: number): Promise<void>;
|
|
54
|
+
onUpdate(props: Props): void;
|
|
55
|
+
onDestroy(parent: Element, afterDestroy?: () => void): Promise<void>;
|
|
56
|
+
setFlexDirection(direction: FlexDirection): void;
|
|
57
|
+
setFlexWrap(wrap: "wrap" | "nowrap" | "wrap-reverse"): void;
|
|
58
|
+
setAlignContent(align: AlignContent): void;
|
|
59
|
+
setAlignSelf(align: AlignContent): void;
|
|
60
|
+
setAlignItems(align: AlignContent): void;
|
|
61
|
+
setJustifyContent(justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around"): void;
|
|
62
|
+
setPosition(position: EdgeSize): void;
|
|
63
|
+
setX(x: number): void;
|
|
64
|
+
setY(y: number): void;
|
|
65
|
+
setPadding(padding: EdgeSize): void;
|
|
66
|
+
setMargin(margin: EdgeSize): void;
|
|
67
|
+
setGap(gap: EdgeSize): void;
|
|
68
|
+
setBorder(border: EdgeSize): void;
|
|
69
|
+
setPositionType(positionType: "relative" | "absolute"): void;
|
|
70
|
+
setWidth(width: number): void;
|
|
71
|
+
setHeight(height: number): void;
|
|
72
|
+
getWidth(): number;
|
|
73
|
+
getHeight(): number;
|
|
74
|
+
setMinWidth(minWidth: number | string): void;
|
|
75
|
+
setMinHeight(minHeight: number | string): void;
|
|
76
|
+
setMaxWidth(maxWidth: number | string): void;
|
|
77
|
+
setMaxHeight(maxHeight: number | string): void;
|
|
78
|
+
setAspectRatio(aspectRatio: number): void;
|
|
79
|
+
setFlexGrow(flexGrow: number): void;
|
|
80
|
+
setFlexShrink(flexShrink: number): void;
|
|
81
|
+
setFlexBasis(flexBasis: number | string): void;
|
|
82
|
+
setRowGap(rowGap: number): void;
|
|
83
|
+
setColumnGap(columnGap: number): void;
|
|
84
|
+
setTop(top: number | string): void;
|
|
85
|
+
setLeft(left: number | string): void;
|
|
86
|
+
setRight(right: number | string): void;
|
|
87
|
+
setBottom(bottom: number | string): void;
|
|
88
|
+
setObjectFit(objectFit: ObjectFit): void;
|
|
89
|
+
setObjectPosition(objectPosition: ObjectPosition): void;
|
|
90
|
+
setTransformOrigin(transformOrigin: TransformOrigin): void;
|
|
91
|
+
};
|
|
92
|
+
[x: string]: any;
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=DisplayObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DisplayObject.d.ts","sourceRoot":"","sources":["../../src/components/DisplayObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAa,KAAK,EAAmB,MAAM,oBAAoB,CAAC;AAEhF,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,SAAS,EACT,cAAc,EACd,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAc,eAAe,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAGlF,OAAO,EAAE,eAAe,EAAmB,MAAM,MAAM,CAAC;AAExD,MAAM,WAAW,iBAAkB,SAAQ,UAAU,CAAC,gBAAgB;IACpE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC/B,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,CAAC,KAAK,E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,GAAG,QAAQ,GAAG,cAAc;+BAI7B,YAAY;4BAIf,YAAY;6BAIX,YAAY;0CAM3B,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,eAAe,GACf,cAAc;8BAKE,QAAQ;gBAoBtB,MAAM;gBAUN,MAAM;4BAUM,QAAQ;0BAoBV,QAAQ;oBAoBd,QAAQ;0BAIF,QAAQ;sCAoBI,UAAU,GAAG,UAAU;wBAIrC,MAAM;0BASJ,MAAM;oBASZ,MAAM;qBAgBL,MAAM;8BAiBG,MAAM,GAAG,MAAM;gCAIb,MAAM,GAAG,MAAM;8BAIjB,MAAM,GAAG,MAAM;gCAIb,MAAM,GAAG,MAAM;oCAKX,MAAM;8BAKZ,MAAM;kCAIF,MAAM;gCAIR,MAAM,GAAG,MAAM;0BAKrB,MAAM;gCAIA,MAAM;oBAKlB,MAAM,GAAG,MAAM;sBAIb,MAAM,GAAG,MAAM;wBAIb,MAAM,GAAG,MAAM;0BAIb,MAAM,GAAG,MAAM;gCAKT,SAAS;0CAQC,cAAc;4CAQZ,eAAe;;;EAQtD"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Element } from '../engine/reactive';
|
|
2
|
+
import { ComponentFunction } from '../engine/signal';
|
|
3
|
+
import { DisplayObjectProps } from './types/DisplayObject';
|
|
4
|
+
import { ScrollOptions } from '../engine/FocusManager';
|
|
5
|
+
import { Signal } from '@signe/reactive';
|
|
6
|
+
import { CanvasViewport } from './Viewport';
|
|
7
|
+
import { Controls } from '../directives/ControlsBase';
|
|
8
|
+
/**
|
|
9
|
+
* Properties for FocusContainer component
|
|
10
|
+
*
|
|
11
|
+
* @property tabindex - Focus index for the container (default: 0 if present)
|
|
12
|
+
* @property controls - Controls configuration for automatic navigation
|
|
13
|
+
* @property onFocusChange - Callback when focus changes
|
|
14
|
+
* @property autoScroll - Enable automatic scrolling to focused element (default: false)
|
|
15
|
+
* @property viewport - Viewport instance to use for scrolling (optional, uses context viewport by default)
|
|
16
|
+
*/
|
|
17
|
+
export interface FocusContainerProps extends DisplayObjectProps {
|
|
18
|
+
tabindex?: number;
|
|
19
|
+
controls?: Controls | Signal<Controls>;
|
|
20
|
+
onFocusChange?: (index: number, element: Element | null) => void;
|
|
21
|
+
autoScroll?: boolean | ScrollOptions;
|
|
22
|
+
viewport?: CanvasViewport;
|
|
23
|
+
context?: {
|
|
24
|
+
viewport?: CanvasViewport;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* FocusContainer component for managing focus navigation
|
|
29
|
+
*
|
|
30
|
+
* This component provides a container that manages focus navigation between
|
|
31
|
+
* focusable child elements. It supports automatic navigation via Controls
|
|
32
|
+
* (keyboard/gamepad) and automatic scrolling with Viewport.
|
|
33
|
+
*
|
|
34
|
+
* ## Features
|
|
35
|
+
*
|
|
36
|
+
* - **Focus Management**: Automatically registers focusable children
|
|
37
|
+
* - **Navigation**: Supports keyboard/gamepad navigation via Controls
|
|
38
|
+
* - **Auto-scroll**: Automatically scrolls viewport to show focused element
|
|
39
|
+
* - **Hooks**: Provides reactive signals for focus state
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* // Basic usage
|
|
44
|
+
* <FocusContainer tabindex={0}>
|
|
45
|
+
* <Button tabindex={0} text="Button 1" />
|
|
46
|
+
* <Button tabindex={1} text="Button 2" />
|
|
47
|
+
* </FocusContainer>
|
|
48
|
+
*
|
|
49
|
+
* // With Controls
|
|
50
|
+
* <FocusContainer tabindex={0} controls={controlsConfig}>
|
|
51
|
+
* <Button tabindex={0} text="Button 1" />
|
|
52
|
+
* <Button tabindex={1} text="Button 2" />
|
|
53
|
+
* </FocusContainer>
|
|
54
|
+
*
|
|
55
|
+
* // With auto-scroll
|
|
56
|
+
* <Viewport worldWidth={2000} worldHeight={5000}>
|
|
57
|
+
* <FocusContainer tabindex={0} autoScroll={true}>
|
|
58
|
+
* <Button tabindex={0} y={0} text="Item 1" />
|
|
59
|
+
* <Button tabindex={1} y={100} text="Item 2" />
|
|
60
|
+
* </FocusContainer>
|
|
61
|
+
* </Viewport>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare class CanvasFocusContainer {
|
|
65
|
+
private containerId;
|
|
66
|
+
private currentIndexSignal;
|
|
67
|
+
private focusedElementSignal;
|
|
68
|
+
private registeredFocusables;
|
|
69
|
+
/**
|
|
70
|
+
* Initialize the focus container
|
|
71
|
+
*
|
|
72
|
+
* @param props - Component properties
|
|
73
|
+
*/
|
|
74
|
+
onInit(props: FocusContainerProps): void;
|
|
75
|
+
/**
|
|
76
|
+
* Mount hook - register focusable children
|
|
77
|
+
*
|
|
78
|
+
* @param element - The element being mounted
|
|
79
|
+
*/
|
|
80
|
+
onMount(element: Element<CanvasFocusContainer>): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Update hook - handle prop changes
|
|
83
|
+
*
|
|
84
|
+
* @param props - Updated properties
|
|
85
|
+
*/
|
|
86
|
+
onUpdate(props: FocusContainerProps): void;
|
|
87
|
+
/**
|
|
88
|
+
* Destroy hook - cleanup
|
|
89
|
+
*
|
|
90
|
+
* @param parent - Parent element
|
|
91
|
+
* @param afterDestroy - Callback after destruction
|
|
92
|
+
*/
|
|
93
|
+
onDestroy(parent: Element<any>, afterDestroy?: () => void): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Register focusable children from element
|
|
96
|
+
*
|
|
97
|
+
* @param element - Container element
|
|
98
|
+
*/
|
|
99
|
+
private registerChildren;
|
|
100
|
+
/**
|
|
101
|
+
* Get the container ID
|
|
102
|
+
*
|
|
103
|
+
* @returns Container identifier
|
|
104
|
+
*/
|
|
105
|
+
getContainerId(): string;
|
|
106
|
+
/**
|
|
107
|
+
* Get current index signal
|
|
108
|
+
*
|
|
109
|
+
* @returns Signal for current focus index
|
|
110
|
+
*/
|
|
111
|
+
getCurrentIndexSignal(): Signal<number | null> | null;
|
|
112
|
+
/**
|
|
113
|
+
* Get focused element signal
|
|
114
|
+
*
|
|
115
|
+
* @returns Signal for current focused element
|
|
116
|
+
*/
|
|
117
|
+
getFocusedElementSignal(): Signal<Element | null> | null;
|
|
118
|
+
}
|
|
119
|
+
export interface CanvasFocusContainer extends DisplayObjectProps {
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* FocusContainer component function
|
|
123
|
+
*
|
|
124
|
+
* @param props - Component properties
|
|
125
|
+
* @returns FocusContainer element
|
|
126
|
+
*/
|
|
127
|
+
export declare const FocusContainer: ComponentFunction<FocusContainerProps>;
|
|
128
|
+
export declare const Navigation: ComponentFunction<FocusContainerProps>;
|
|
129
|
+
//# sourceMappingURL=FocusContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusContainer.d.ts","sourceRoot":"","sources":["../../src/components/FocusContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAgB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAU,MAAM,EAAkD,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,+BAA+B,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;IACjE,UAAU,CAAC,EAAE,O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3
|
+
import { ComponentInstance } from './DisplayObject';
|
|
4
|
+
import { DisplayObjectProps } from './types/DisplayObject';
|
|
5
|
+
import { SignalOrPrimitive } from './types';
|
|
6
|
+
interface GraphicsProps extends DisplayObjectProps {
|
|
7
|
+
draw?: (graphics: PixiGraphics, width: number, height: number, anchor?: [number, number]) => void;
|
|
8
|
+
}
|
|
9
|
+
interface RectProps extends DisplayObjectProps {
|
|
10
|
+
color: SignalOrPrimitive<string>;
|
|
11
|
+
}
|
|
12
|
+
interface CircleProps extends DisplayObjectProps {
|
|
13
|
+
radius: SignalOrPrimitive<number>;
|
|
14
|
+
color: SignalOrPrimitive<string>;
|
|
15
|
+
}
|
|
16
|
+
interface EllipseProps extends DisplayObjectProps {
|
|
17
|
+
color: SignalOrPrimitive<string>;
|
|
18
|
+
}
|
|
19
|
+
interface TriangleProps extends DisplayObjectProps {
|
|
20
|
+
base: SignalOrPrimitive<number>;
|
|
21
|
+
color: SignalOrPrimitive<string>;
|
|
22
|
+
}
|
|
23
|
+
interface SvgProps extends DisplayObjectProps {
|
|
24
|
+
/** SVG content as string (legacy prop) */
|
|
25
|
+
svg?: string;
|
|
26
|
+
/** URL source of the SVG file to load */
|
|
27
|
+
src?: string;
|
|
28
|
+
/** Direct SVG content as string */
|
|
29
|
+
content?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function Graphics(props: GraphicsProps): Element<ComponentInstance>;
|
|
32
|
+
export declare function Rect(props: RectProps): Element<ComponentInstance>;
|
|
33
|
+
export declare function Circle(props: CircleProps): Element<ComponentInstance>;
|
|
34
|
+
export declare function Ellipse(props: EllipseProps): Element<ComponentInstance>;
|
|
35
|
+
export declare function Triangle(props: TriangleProps): Element<ComponentInstance>;
|
|
36
|
+
/**
|
|
37
|
+
* Creates an SVG component that can render SVG graphics from URL, content, or legacy svg prop.
|
|
38
|
+
*
|
|
39
|
+
* This component provides three ways to display SVG graphics:
|
|
40
|
+
* - **src**: Load SVG from a URL using Assets.load with parseAsGraphicsContext option
|
|
41
|
+
* - **content**: Render SVG directly from string content using Graphics.svg() method
|
|
42
|
+
* - **svg**: Legacy prop for SVG content (for backward compatibility)
|
|
43
|
+
*
|
|
44
|
+
* @param props - Component properties including src, content, or svg
|
|
45
|
+
* @returns A reactive SVG component
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* // Load from URL
|
|
49
|
+
* const svgFromUrl = Svg({ src: "/assets/logo.svg" });
|
|
50
|
+
*
|
|
51
|
+
* // Direct content
|
|
52
|
+
* const svgFromContent = Svg({
|
|
53
|
+
* content: `<svg viewBox="0 0 100 100">
|
|
54
|
+
* <circle cx="50" cy="50" r="40" fill="blue"/>
|
|
55
|
+
* </svg>`
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* // Legacy usage
|
|
59
|
+
* const svgLegacy = Svg({ svg: "<svg>...</svg>" });
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function Svg(props: SvgProps): Element<ComponentInstance>;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=Graphic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Graphic.d.ts","sourceRoot":"","sources":["../../src/components/Graphic.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,QAAQ,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAmB,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAI5C,UAAU,aAAc,SAAQ,kBAAkB;IAChD,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,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
8
|
+
TOP = "top",
|
|
9
|
+
BOTTOM = "bottom",
|
|
10
|
+
RIGHT = "right",
|
|
11
|
+
TOP_LEFT = "top_left",
|
|
12
|
+
TOP_RIGHT = "top_right",
|
|
13
|
+
BOTTOM_LEFT = "bottom_left",
|
|
14
|
+
BOTTOM_RIGHT = "bottom_right"
|
|
15
|
+
}
|
|
16
|
+
export interface JoystickSettings {
|
|
17
|
+
outer?: string;
|
|
18
|
+
inner?: string;
|
|
19
|
+
outerScale?: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
23
|
+
innerScale?: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
};
|
|
27
|
+
innerColor?: string;
|
|
28
|
+
outerColor?: string;
|
|
29
|
+
onChange?: (data: JoystickChangeEvent) => void;
|
|
30
|
+
onStart?: () => void;
|
|
31
|
+
onEnd?: () => void;
|
|
32
|
+
/** Controls instance to automatically apply joystick events to (e.g., JoystickControls or ControlsDirective) */
|
|
33
|
+
controls?: any;
|
|
34
|
+
}
|
|
35
|
+
export declare function Joystick(opts?: JoystickSettings): import('../').Element<import('./DisplayObject').ComponentInstance> | Promise<import('../').Element<import('./DisplayObject').ComponentInstance>>;
|
|
36
|
+
//# sourceMappingURL=Joystick.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Joystick.d.ts","sourceRoot":"","sources":["../../src/components/Joystick.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,UAAU,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,gHAAgH;IAChH,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED,wBAAgB,QAAQ,CAAC,IAAI,GAAE,gBAAqB,oJAkUnD"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { Geometry, Shader, Texture } from 'pixi.js';
|
|
2
|
+
import { Element } from '../engine/reactive';
|
|
3
|
+
import { ComponentInstance } from './DisplayObject';
|
|
4
|
+
import { DisplayObjectProps } from './types/DisplayObject';
|
|
5
|
+
import { SignalOrPrimitive } from './types';
|
|
6
|
+
import { ComponentFunction } from '../engine/signal';
|
|
7
|
+
/**
|
|
8
|
+
* Interface defining the properties for a Mesh component.
|
|
9
|
+
* Extends DisplayObjectProps to inherit common display object properties.
|
|
10
|
+
*/
|
|
11
|
+
interface MeshProps extends DisplayObjectProps {
|
|
12
|
+
/** The geometry defining the mesh structure (vertices, indices, UVs, etc.) */
|
|
13
|
+
geometry?: Geometry;
|
|
14
|
+
/** The shader to render the mesh with */
|
|
15
|
+
shader?: Shader;
|
|
16
|
+
/** The texture to apply to the mesh */
|
|
17
|
+
texture?: Texture | string;
|
|
18
|
+
/** The image URL to load as texture */
|
|
19
|
+
image?: string;
|
|
20
|
+
/** The tint color to apply to the mesh */
|
|
21
|
+
tint?: SignalOrPrimitive<number>;
|
|
22
|
+
/** Whether to round pixels for sharper rendering */
|
|
23
|
+
roundPixels?: SignalOrPrimitive<boolean>;
|
|
24
|
+
}
|
|
25
|
+
declare const CanvasMesh_base: {
|
|
26
|
+
new (): {
|
|
27
|
+
[x: string]: any;
|
|
28
|
+
"__#private@#canvasContext": {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
} | null;
|
|
31
|
+
isFlex: boolean;
|
|
32
|
+
fullProps: import('..').Props;
|
|
33
|
+
isMounted: boolean;
|
|
34
|
+
_anchorPoints: import('pixi.js').ObservablePoint;
|
|
35
|
+
isCustomAnchor: boolean;
|
|
36
|
+
displayWidth: import('@signe/reactive').WritableSignal<number>;
|
|
37
|
+
displayHeight: import('@signe/reactive').WritableSignal<number>;
|
|
38
|
+
overrideProps: string[];
|
|
39
|
+
layout: any;
|
|
40
|
+
onBeforeDestroy: import('./DisplayObject').OnHook | null;
|
|
41
|
+
onAfterMount: import('./DisplayObject').OnHook | null;
|
|
42
|
+
subjectInit: import('rxjs').BehaviorSubject<any>;
|
|
43
|
+
disableLayout: boolean;
|
|
44
|
+
"__#private@#registeredEvents": Map<string, Function>;
|
|
45
|
+
"__#private@#computedLayoutBox": {
|
|
46
|
+
width?: number;
|
|
47
|
+
height?: number;
|
|
48
|
+
} | null;
|
|
49
|
+
"__#private@#element": Element<any> | null;
|
|
50
|
+
getElement(): Element<any> | null;
|
|
51
|
+
onLayoutComputed(_event: any): void;
|
|
52
|
+
get deltaRatio(): any;
|
|
53
|
+
get parentIsFlex(): any;
|
|
54
|
+
onInit(props: import('..').Props): void;
|
|
55
|
+
onMount(element: Element<any>, index?: number): Promise<void>;
|
|
56
|
+
onUpdate(props: import('..').Props): void;
|
|
57
|
+
onDestroy(parent: Element, afterDestroy?: () => void): Promise<void>;
|
|
58
|
+
setFlexDirection(direction: import('./types/DisplayObject').FlexDirection): void;
|
|
59
|
+
setFlexWrap(wrap: "wrap" | "nowrap" | "wrap-reverse"): void;
|
|
60
|
+
setAlignContent(align: import('./types/DisplayObject').AlignContent): void;
|
|
61
|
+
setAlignSelf(align: import('./types/DisplayObject').AlignContent): void;
|
|
62
|
+
setAlignItems(align: import('./types/DisplayObject').AlignContent): void;
|
|
63
|
+
setJustifyContent(justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around"): void;
|
|
64
|
+
setPosition(position: import('./types/DisplayObject').EdgeSize): void;
|
|
65
|
+
setX(x: number): void;
|
|
66
|
+
setY(y: number): void;
|
|
67
|
+
setPadding(padding: import('./types/DisplayObject').EdgeSize): void;
|
|
68
|
+
setMargin(margin: import('./types/DisplayObject').EdgeSize): void;
|
|
69
|
+
setGap(gap: import('./types/DisplayObject').EdgeSize): void;
|
|
70
|
+
setBorder(border: import('./types/DisplayObject').EdgeSize): void;
|
|
71
|
+
setPositionType(positionType: "relative" | "absolute"): void;
|
|
72
|
+
setWidth(width: number): void;
|
|
73
|
+
setHeight(height: number): void;
|
|
74
|
+
getWidth(): number;
|
|
75
|
+
getHeight(): number;
|
|
76
|
+
setMinWidth(minWidth: number | string): void;
|
|
77
|
+
setMinHeight(minHeight: number | string): void;
|
|
78
|
+
setMaxWidth(maxWidth: number | string): void;
|
|
79
|
+
setMaxHeight(maxHeight: number | string): void;
|
|
80
|
+
setAspectRatio(aspectRatio: number): void;
|
|
81
|
+
setFlexGrow(flexGrow: number): void;
|
|
82
|
+
setFlexShrink(flexShrink: number): void;
|
|
83
|
+
setFlexBasis(flexBasis: number | string): void;
|
|
84
|
+
setRowGap(rowGap: number): void;
|
|
85
|
+
setColumnGap(columnGap: number): void;
|
|
86
|
+
setTop(top: number | string): void;
|
|
87
|
+
setLeft(left: number | string): void;
|
|
88
|
+
setRight(right: number | string): void;
|
|
89
|
+
setBottom(bottom: number | string): void;
|
|
90
|
+
setObjectFit(objectFit: import('./types/DisplayObject').ObjectFit): void;
|
|
91
|
+
setObjectPosition(objectPosition: import('./types/DisplayObject').ObjectPosition): void;
|
|
92
|
+
setTransformOrigin(transformOrigin: import('./types/DisplayObject').TransformOrigin): void;
|
|
93
|
+
};
|
|
94
|
+
[x: string]: any;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Canvas Mesh component class that extends DisplayObject with PixiMesh functionality.
|
|
98
|
+
* This component allows rendering of custom 3D meshes with shaders and textures.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* // Basic mesh with geometry and texture
|
|
103
|
+
* const mesh = Mesh({
|
|
104
|
+
* geometry: myGeometry,
|
|
105
|
+
* texture: "path/to/texture.png",
|
|
106
|
+
* tint: 0xff0000
|
|
107
|
+
* });
|
|
108
|
+
*
|
|
109
|
+
* // Mesh with custom shader
|
|
110
|
+
* const customMesh = Mesh({
|
|
111
|
+
* geometry: myGeometry,
|
|
112
|
+
* shader: myCustomShader,
|
|
113
|
+
* draw: (mesh) => {
|
|
114
|
+
* // Custom mesh manipulation
|
|
115
|
+
* mesh.rotation += 0.01;
|
|
116
|
+
* }
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
declare class CanvasMesh extends CanvasMesh_base {
|
|
121
|
+
/**
|
|
122
|
+
* Constructor for the CanvasMesh component.
|
|
123
|
+
* Initializes the PixiMesh with default geometry and shader to prevent errors.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* // This constructor is called internally by the engine
|
|
128
|
+
* const mesh = new CanvasMesh();
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
constructor();
|
|
132
|
+
/**
|
|
133
|
+
* Initializes the mesh component with the provided properties.
|
|
134
|
+
* This method is called before onUpdate to set up initial state.
|
|
135
|
+
*
|
|
136
|
+
* @param props - The initial properties
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* // This method is called internally when the component is created
|
|
140
|
+
* mesh.onInit({
|
|
141
|
+
* geometry: myGeometry,
|
|
142
|
+
* texture: "texture.png"
|
|
143
|
+
* });
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
onInit(props: MeshProps): void;
|
|
147
|
+
/**
|
|
148
|
+
* Updates the mesh component when properties change.
|
|
149
|
+
* Handles texture loading, shader updates, and other property changes.
|
|
150
|
+
*
|
|
151
|
+
* @param props - The updated properties
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* // This method is called internally when props change
|
|
155
|
+
* mesh.onUpdate({
|
|
156
|
+
* tint: 0x00ff00,
|
|
157
|
+
* texture: "new-texture.png"
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
onUpdate(props: MeshProps): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Called when the component is about to be destroyed.
|
|
164
|
+
* Cleans up the draw effect subscription and calls the parent destroy method.
|
|
165
|
+
*
|
|
166
|
+
* @param parent - The parent element
|
|
167
|
+
* @param afterDestroy - Callback function to execute after destruction
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* // This method is typically called by the engine internally
|
|
171
|
+
* await mesh.onDestroy(parentElement, () => console.log('Mesh destroyed'));
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
onDestroy(parent: Element<ComponentInstance>, afterDestroy: () => void): Promise<void>;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Creates a Mesh component with the specified properties.
|
|
178
|
+
* This is the main function used to create mesh instances in your application.
|
|
179
|
+
*
|
|
180
|
+
* @param props - The properties for the mesh component
|
|
181
|
+
* @returns A mesh component element
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* import { Mesh } from 'canvasengine';
|
|
185
|
+
*
|
|
186
|
+
* // Create a basic textured mesh
|
|
187
|
+
* const myMesh = Mesh({
|
|
188
|
+
* geometry: triangleGeometry,
|
|
189
|
+
* texture: "assets/texture.png",
|
|
190
|
+
* x: 100,
|
|
191
|
+
* y: 100,
|
|
192
|
+
* tint: 0xff0000
|
|
193
|
+
* });
|
|
194
|
+
*
|
|
195
|
+
* // Create a mesh with custom shader
|
|
196
|
+
* const shaderMesh = Mesh({
|
|
197
|
+
* geometry: planeGeometry,
|
|
198
|
+
* shader: customShader,
|
|
199
|
+
* draw: (mesh) => {
|
|
200
|
+
* mesh.rotation += 0.01;
|
|
201
|
+
* }
|
|
202
|
+
* });
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
export declare const Mesh: ComponentFunction<MeshProps>;
|
|
206
|
+
export { CanvasMesh };
|
|
207
|
+
export type { MeshProps };
|
|
208
|
+
//# sourceMappingURL=Mesh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mesh.d.ts","sourceRoot":"","sources":["../../src/components/Mesh.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAuB,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAmB,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;GAGG;AACH,UAAU,SAAU,SAAQ,kBAAkB;IAC5C,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,IAAI,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACjC,oDAAoD;IACpD,WAAW,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;CAC1C;;;;;;;;;;;;;;;;;;;;;;iBA+Ec,CAAC;kBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA7EjC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,cAAM,UAAW,SAAQ,eAAuB;IAC9C;;;;;;;;;OASG;;IASH;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS;IAkBvB;;;;;;;;;;;;;OAaG;IACG,QAAQ,CAAC,KAAK,EAAE,SAAS;IA4C/B;;;;;;;;;;;OAWG;IACG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,EAAE,YAAY,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAM7F;AAKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAE7C,CAAC;AAGF,OAAO,EAAE,UAAU,EAAE,CAAC;AAGtB,YAAY,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Texture } from 'pixi.js';
|
|
2
|
+
import { DisplayObjectProps } from './types/DisplayObject';
|
|
3
|
+
interface NineSliceSpriteProps extends DisplayObjectProps {
|
|
4
|
+
image?: string;
|
|
5
|
+
texture?: Texture;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
leftWidth?: number;
|
|
9
|
+
rightWidth?: number;
|
|
10
|
+
topHeight?: number;
|
|
11
|
+
bottomHeight?: number;
|
|
12
|
+
roundPixels?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function NineSliceSprite(props: NineSliceSpriteProps): import('..').Element<import('./DisplayObject').ComponentInstance>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=NineSliceSprite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NineSliceSprite.d.ts","sourceRoot":"","sources":["../../src/components/NineSliceSprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,UAAU,oBAAqB,SAAQ,kBAAkB;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AA8BD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qEAE1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParticleEmitter.d.ts","sourceRoot":"","sources":["../../src/components/ParticleEmitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AAGjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAoCpD,wBAAgB,gBAAgB,CAAC,KAAK,KAAA,8BAErC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../src/components/Scene.ts"],"names":[],"mappings":"AAGA,wBAAgB,KAAK,CAAC,KAAK,KAAA,kJAE1B"}
|