canvasengine 2.0.0-beta.4 → 2.0.0-beta.41
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/DebugRenderer-BxfW34YG.js +172 -0
- package/dist/DebugRenderer-BxfW34YG.js.map +1 -0
- package/dist/components/Button.d.ts +183 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Canvas.d.ts +18 -0
- package/dist/components/Canvas.d.ts.map +1 -0
- package/dist/components/DOMElement.d.ts +44 -0
- package/dist/components/DOMElement.d.ts.map +1 -0
- package/dist/components/Graphic.d.ts +65 -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/NineSliceSprite.d.ts +17 -0
- package/dist/components/NineSliceSprite.d.ts.map +1 -0
- package/dist/components/ParticleEmitter.d.ts +5 -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/Text.d.ts +26 -0
- package/dist/components/Text.d.ts.map +1 -0
- package/dist/components/TilingSprite.d.ts +18 -0
- package/dist/components/TilingSprite.d.ts.map +1 -0
- package/dist/components/Video.d.ts +15 -0
- package/dist/components/Video.d.ts.map +1 -0
- package/dist/components/index.d.ts +18 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/types/DisplayObject.d.ts +110 -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 +5 -0
- package/dist/components/types/index.d.ts.map +1 -0
- package/dist/directives/Controls.d.ts +113 -0
- package/dist/directives/Controls.d.ts.map +1 -0
- package/dist/directives/ControlsBase.d.ts +198 -0
- package/dist/directives/ControlsBase.d.ts.map +1 -0
- package/dist/directives/Drag.d.ts +70 -0
- package/dist/directives/Drag.d.ts.map +1 -0
- package/dist/directives/Flash.d.ts +117 -0
- package/dist/directives/Flash.d.ts.map +1 -0
- package/dist/directives/GamepadControls.d.ts +225 -0
- package/dist/directives/GamepadControls.d.ts.map +1 -0
- package/dist/directives/JoystickControls.d.ts +172 -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 +36 -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 +26 -0
- package/dist/directives/Sound.d.ts.map +1 -0
- package/dist/directives/Transition.d.ts +11 -0
- package/dist/directives/Transition.d.ts.map +1 -0
- package/dist/directives/ViewportCull.d.ts +12 -0
- package/dist/directives/ViewportCull.d.ts.map +1 -0
- package/dist/directives/ViewportFollow.d.ts +19 -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/animation.d.ts +73 -0
- package/dist/engine/animation.d.ts.map +1 -0
- package/dist/engine/bootstrap.d.ts +16 -0
- package/dist/engine/bootstrap.d.ts.map +1 -0
- package/dist/engine/directive.d.ts +14 -0
- package/dist/engine/directive.d.ts.map +1 -0
- package/dist/engine/reactive.d.ts +105 -0
- package/dist/engine/reactive.d.ts.map +1 -0
- package/dist/engine/signal.d.ts +72 -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 +90 -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/useProps.d.ts +42 -0
- package/dist/hooks/useProps.d.ts.map +1 -0
- package/dist/hooks/useRef.d.ts +5 -0
- package/dist/hooks/useRef.d.ts.map +1 -0
- package/dist/index-BnuKipxl.js +12568 -0
- package/dist/index-BnuKipxl.js.map +1 -0
- package/dist/index.d.ts +15 -1083
- package/dist/index.d.ts.map +1 -0
- package/dist/index.global.js +29 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +81 -3041
- 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 +58 -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/package.json +13 -7
- package/src/components/Button.ts +396 -0
- package/src/components/Canvas.ts +61 -45
- package/src/components/Container.ts +21 -2
- package/src/components/DOMContainer.ts +123 -0
- package/src/components/DOMElement.ts +421 -0
- package/src/components/DisplayObject.ts +350 -197
- package/src/components/Graphic.ts +200 -34
- 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 +306 -30
- package/src/components/Text.ts +125 -18
- package/src/components/Video.ts +110 -0
- package/src/components/Viewport.ts +59 -43
- package/src/components/index.ts +8 -2
- package/src/components/types/DisplayObject.ts +34 -0
- package/src/components/types/Spritesheet.ts +0 -118
- package/src/directives/Controls.ts +254 -0
- package/src/directives/ControlsBase.ts +266 -0
- package/src/directives/Drag.ts +357 -52
- package/src/directives/Flash.ts +419 -0
- package/src/directives/GamepadControls.ts +537 -0
- package/src/directives/JoystickControls.ts +396 -0
- package/src/directives/KeyboardControls.ts +66 -424
- package/src/directives/Shake.ts +295 -0
- package/src/directives/Sound.ts +94 -31
- package/src/directives/ViewportFollow.ts +35 -7
- package/src/directives/index.ts +12 -6
- package/src/engine/animation.ts +175 -21
- package/src/engine/bootstrap.ts +23 -3
- package/src/engine/directive.ts +2 -2
- package/src/engine/reactive.ts +780 -177
- package/src/engine/signal.ts +35 -4
- package/src/engine/trigger.ts +34 -7
- package/src/engine/utils.ts +19 -3
- package/src/hooks/useProps.ts +1 -1
- package/src/index.ts +4 -2
- package/src/utils/GlobalAssetLoader.ts +257 -0
- package/src/utils/functions.ts +7 -0
- package/testing/index.ts +12 -0
- package/tsconfig.json +17 -0
- package/vite.config.ts +39 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { ControlsBase, Controls } from './ControlsBase';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Joystick directions reported by the Joystick component
|
|
5
|
+
*/
|
|
6
|
+
export type JoystickDirection = 'left' | 'right' | 'top' | 'bottom' | 'top_left' | 'top_right' | 'bottom_left' | 'bottom_right';
|
|
7
|
+
/**
|
|
8
|
+
* Joystick change event payload
|
|
9
|
+
*/
|
|
10
|
+
export interface JoystickChangeEvent {
|
|
11
|
+
angle: number;
|
|
12
|
+
direction: JoystickDirection;
|
|
13
|
+
power: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Joystick configuration interface
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const joystickConfig: JoystickConfig = {
|
|
21
|
+
* enabled: true,
|
|
22
|
+
* directionMapping: {
|
|
23
|
+
* 'top': 'up',
|
|
24
|
+
* 'bottom': 'down',
|
|
25
|
+
* 'left': 'left',
|
|
26
|
+
* 'right': 'right',
|
|
27
|
+
* 'top_left': ['up', 'left'],
|
|
28
|
+
* 'top_right': ['up', 'right'],
|
|
29
|
+
* 'bottom_left': ['down', 'left'],
|
|
30
|
+
* 'bottom_right': ['down', 'right']
|
|
31
|
+
* },
|
|
32
|
+
* moveInterval: 50,
|
|
33
|
+
* threshold: 0.1
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export interface JoystickConfig {
|
|
38
|
+
/** Whether joystick is enabled (default: true) */
|
|
39
|
+
enabled?: boolean;
|
|
40
|
+
/** Mapping of joystick direction names to control names (can be single string or array for diagonals) */
|
|
41
|
+
directionMapping?: {
|
|
42
|
+
[joystickDirection: string]: string | string[];
|
|
43
|
+
};
|
|
44
|
+
/** Interval in milliseconds for repeating movement actions (default: 50) */
|
|
45
|
+
moveInterval?: number;
|
|
46
|
+
/** Threshold for power value to trigger movement (default: 0.1) */
|
|
47
|
+
threshold?: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Joystick input controls implementation
|
|
51
|
+
*
|
|
52
|
+
* Handles joystick input events from the Joystick component and maps them to control actions.
|
|
53
|
+
* Supports directional movement with configurable mappings, including diagonal directions.
|
|
54
|
+
*
|
|
55
|
+
* The joystick controls work by receiving change events from a Joystick component instance.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const joystickControls = new JoystickControls();
|
|
60
|
+
* joystickControls.setInputs({
|
|
61
|
+
* up: {
|
|
62
|
+
* repeat: true,
|
|
63
|
+
* bind: 'up',
|
|
64
|
+
* keyDown() {
|
|
65
|
+
* console.log('Up pressed');
|
|
66
|
+
* }
|
|
67
|
+
* }
|
|
68
|
+
* });
|
|
69
|
+
* joystickControls.updateJoystickConfig({
|
|
70
|
+
* enabled: true,
|
|
71
|
+
* directionMapping: {
|
|
72
|
+
* 'top': 'up'
|
|
73
|
+
* }
|
|
74
|
+
* });
|
|
75
|
+
* joystickControls.start();
|
|
76
|
+
*
|
|
77
|
+
* // Later, when joystick changes:
|
|
78
|
+
* joystickControls.handleJoystickChange({ angle: 90, direction: Direction.TOP, power: 0.8 });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export declare class JoystickControls extends ControlsBase {
|
|
82
|
+
private joystickEnabled;
|
|
83
|
+
private joystickConfig;
|
|
84
|
+
private joystickMoving;
|
|
85
|
+
private joystickDirections;
|
|
86
|
+
private joystickLastUpdate;
|
|
87
|
+
private joystickMoveInterval;
|
|
88
|
+
private currentPower;
|
|
89
|
+
/**
|
|
90
|
+
* Setup joystick event listeners
|
|
91
|
+
* Note: Joystick events are handled via handleJoystickChange() method
|
|
92
|
+
*/
|
|
93
|
+
protected setupListeners(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Cleanup joystick intervals
|
|
96
|
+
*/
|
|
97
|
+
protected cleanup(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Process joystick inputs each step
|
|
100
|
+
* Continuous actions are handled by the interval; no inactivity timeout here.
|
|
101
|
+
*/
|
|
102
|
+
protected preStep(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Handle joystick change event
|
|
105
|
+
* Called by the Joystick component when its position changes
|
|
106
|
+
*
|
|
107
|
+
* @param event - Joystick change event containing angle, direction, and power
|
|
108
|
+
*/
|
|
109
|
+
handleJoystickChange(event: JoystickChangeEvent): void;
|
|
110
|
+
/**
|
|
111
|
+
* Handle joystick start event
|
|
112
|
+
* Called when user starts interacting with the joystick
|
|
113
|
+
*/
|
|
114
|
+
handleJoystickStart(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Handle joystick end event
|
|
117
|
+
* Called when user stops interacting with the joystick
|
|
118
|
+
*/
|
|
119
|
+
handleJoystickEnd(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Stop all active joystick movements
|
|
122
|
+
*/
|
|
123
|
+
private stopAllMovements;
|
|
124
|
+
/**
|
|
125
|
+
* Process continuous joystick movement
|
|
126
|
+
* Called at intervals to repeat movement actions while joystick is active
|
|
127
|
+
*/
|
|
128
|
+
private processJoystickMovement;
|
|
129
|
+
/**
|
|
130
|
+
* Update joystick configuration
|
|
131
|
+
* Merges provided config with defaults
|
|
132
|
+
*
|
|
133
|
+
* @param config - Partial joystick configuration
|
|
134
|
+
*/
|
|
135
|
+
updateJoystickConfig(config: Partial<JoystickConfig>): void;
|
|
136
|
+
/**
|
|
137
|
+
* Extract joystick config from controls configuration and update
|
|
138
|
+
*
|
|
139
|
+
* @param inputs - Controls configuration that may contain a 'joystick' property
|
|
140
|
+
*/
|
|
141
|
+
extractJoystickConfig(inputs: Controls & {
|
|
142
|
+
joystick?: JoystickConfig;
|
|
143
|
+
}): void;
|
|
144
|
+
/**
|
|
145
|
+
* Get the current joystick configuration
|
|
146
|
+
*
|
|
147
|
+
* @returns The joystick configuration object
|
|
148
|
+
*/
|
|
149
|
+
getJoystickConfig(): JoystickConfig;
|
|
150
|
+
/**
|
|
151
|
+
* Apply a control action programmatically
|
|
152
|
+
* Uses the bound controls to trigger actions
|
|
153
|
+
*
|
|
154
|
+
* @param controlName - Name of the control
|
|
155
|
+
* @param isDown - Whether the control is pressed (true) or released (false)
|
|
156
|
+
* @returns Promise that resolves when the action is complete
|
|
157
|
+
*/
|
|
158
|
+
applyControl(controlName: string | number, isDown?: boolean, payload?: any): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Override setInputs to extract joystick config
|
|
161
|
+
*/
|
|
162
|
+
setInputs(inputs: Controls & {
|
|
163
|
+
joystick?: JoystickConfig;
|
|
164
|
+
}): void;
|
|
165
|
+
/**
|
|
166
|
+
* Check if joystick is currently active
|
|
167
|
+
*
|
|
168
|
+
* @returns true if joystick is moving, false otherwise
|
|
169
|
+
*/
|
|
170
|
+
isActive(): boolean;
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=JoystickControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JoystickControls.d.ts","sourceRoot":"","sources":["../../src/directives/JoystickControls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACvB,MAAM,GACN,OAAO,GACP,KAAK,GACL,QAAQ,GAC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IACH,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;IAS3D;;;;OAIG;IACH,qBAAqB,CAAC,MAAM,EAAE,QAAQ,GAAG;QAAE,QAAQ,CAAC,EAAE,cAAc,CAAA;KAAE,GAAG,IAAI;IAM7E;;;;OAIG;IACH,iBAAiB,IAAI,cAAc;IAInC;;;;;;;OAOG;IACG,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAsDhG;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG;QAAE,QAAQ,CAAC,EAAE,cAAc,CAAA;KAAE,GAAG,IAAI;IAKjE;;;;OAIG;IACH,QAAQ,IAAI,OAAO;CAGtB"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { ControlsBase, ControlOptions, Controls, BoundKey } from './ControlsBase';
|
|
2
|
+
|
|
3
|
+
export declare enum Input {
|
|
4
|
+
Break = "break",
|
|
5
|
+
Backspace = "backspace",
|
|
6
|
+
Tab = "tab",
|
|
7
|
+
Clear = "clear",
|
|
8
|
+
Enter = "enter",
|
|
9
|
+
Shift = "shift",
|
|
10
|
+
Ctrl = "ctrl",
|
|
11
|
+
Alt = "alt",
|
|
12
|
+
Pause = "pause/break",
|
|
13
|
+
CapsLock = "caps lock",
|
|
14
|
+
Escape = "escape",
|
|
15
|
+
Conversion = "conversion",
|
|
16
|
+
NonConversion = "non-conversion",
|
|
17
|
+
Space = "space",
|
|
18
|
+
PageUp = "page up",
|
|
19
|
+
PageDown = "page down",
|
|
20
|
+
End = "end",
|
|
21
|
+
Home = "home",
|
|
22
|
+
Left = 4,
|
|
23
|
+
Up = 1,
|
|
24
|
+
Right = 2,
|
|
25
|
+
Down = 3,
|
|
26
|
+
Select = "select",
|
|
27
|
+
Print = "print",
|
|
28
|
+
Execute = "execute",
|
|
29
|
+
PrintScreen = "Print Screen",
|
|
30
|
+
Insert = "insert",
|
|
31
|
+
Delete = "delete",
|
|
32
|
+
Zero = "0",
|
|
33
|
+
One = "1",
|
|
34
|
+
Two = "2",
|
|
35
|
+
Three = "3",
|
|
36
|
+
Four = "4",
|
|
37
|
+
Five = "5",
|
|
38
|
+
Six = "6",
|
|
39
|
+
Seven = "7",
|
|
40
|
+
Height = "8",
|
|
41
|
+
Nine = "9",
|
|
42
|
+
Equal = "=",
|
|
43
|
+
Semicolon = "semicolon (firefox), equals",
|
|
44
|
+
LessThan = "<",
|
|
45
|
+
Equals = "equals (firefox)",
|
|
46
|
+
Beta = "\u00DF",
|
|
47
|
+
At = "@",
|
|
48
|
+
A = "a",
|
|
49
|
+
B = "b",
|
|
50
|
+
C = "c",
|
|
51
|
+
D = "d",
|
|
52
|
+
E = "e",
|
|
53
|
+
F = "f",
|
|
54
|
+
G = "g",
|
|
55
|
+
H = "h",
|
|
56
|
+
I = "i",
|
|
57
|
+
J = "j",
|
|
58
|
+
K = "k",
|
|
59
|
+
L = "l",
|
|
60
|
+
M = "m",
|
|
61
|
+
N = "n",
|
|
62
|
+
O = "o",
|
|
63
|
+
P = "p",
|
|
64
|
+
Q = "q",
|
|
65
|
+
R = "r",
|
|
66
|
+
S = "s",
|
|
67
|
+
T = "t",
|
|
68
|
+
U = "u",
|
|
69
|
+
V = "v",
|
|
70
|
+
W = "w",
|
|
71
|
+
X = "x",
|
|
72
|
+
Y = "y",
|
|
73
|
+
Z = "z",
|
|
74
|
+
SearchKey = "Windows Key / Left \u2318 / Chromebook Search key",
|
|
75
|
+
NumPad0 = "numpad 0",
|
|
76
|
+
NumPad1 = "numpad 1",
|
|
77
|
+
NumPad2 = "numpad 2",
|
|
78
|
+
NumPad3 = "numpad 3",
|
|
79
|
+
NumPad4 = "numpad 4",
|
|
80
|
+
NumPad5 = "numpad 5",
|
|
81
|
+
NumPad6 = "numpad 6",
|
|
82
|
+
NumPad7 = "numpad 7",
|
|
83
|
+
NumPad8 = "numpad 8",
|
|
84
|
+
NumPad9 = "numpad 9",
|
|
85
|
+
Multiply = "multiply",
|
|
86
|
+
Add = "add",
|
|
87
|
+
Subtract = "subtract",
|
|
88
|
+
DecimalPoint = "decimal point",
|
|
89
|
+
Divide = "divide",
|
|
90
|
+
F1 = "f1",
|
|
91
|
+
F2 = "f2",
|
|
92
|
+
F3 = "f3",
|
|
93
|
+
F4 = "f4",
|
|
94
|
+
F5 = "f5",
|
|
95
|
+
F6 = "f6",
|
|
96
|
+
F7 = "f7",
|
|
97
|
+
F8 = "f8",
|
|
98
|
+
F9 = "f9",
|
|
99
|
+
F10 = "f10",
|
|
100
|
+
F11 = "f11",
|
|
101
|
+
F12 = "f12",
|
|
102
|
+
F13 = "f13",
|
|
103
|
+
F14 = "f14",
|
|
104
|
+
F15 = "f15",
|
|
105
|
+
F16 = "f16",
|
|
106
|
+
F17 = "f17",
|
|
107
|
+
F18 = "f18",
|
|
108
|
+
F19 = "f19",
|
|
109
|
+
F20 = "f20",
|
|
110
|
+
F21 = "f21",
|
|
111
|
+
F22 = "f22",
|
|
112
|
+
F23 = "f23",
|
|
113
|
+
F24 = "f24",
|
|
114
|
+
NumLock = "num lock",
|
|
115
|
+
ScrollLock = "scroll lock",
|
|
116
|
+
CircumflexAccent = "^",
|
|
117
|
+
ExclamationMark = "!",
|
|
118
|
+
Hash = "#",
|
|
119
|
+
Dollar = "$",
|
|
120
|
+
AccentU = "\u00F9",
|
|
121
|
+
PageBackward = "page backward",
|
|
122
|
+
PageForWard = "page forward",
|
|
123
|
+
Star = "*",
|
|
124
|
+
DecreaseVolume = "decrease volume level",
|
|
125
|
+
IncreaseVolume = "increase volume level",
|
|
126
|
+
Next = "next",
|
|
127
|
+
Previous = "previous",
|
|
128
|
+
Stop = "stop",
|
|
129
|
+
PlayPause = "play/pause",
|
|
130
|
+
Email = "e-mail",
|
|
131
|
+
SemiColon = "semi-colon / \u00F1",
|
|
132
|
+
EqualSign = "equal sign",
|
|
133
|
+
Comma = "comma",
|
|
134
|
+
Dash = "dash",
|
|
135
|
+
FowardSlach = "forward slash / \u00E7",
|
|
136
|
+
GraveAccent = "grave accent / \u00F1 / \u00E6",
|
|
137
|
+
OpenBracket = "open bracket",
|
|
138
|
+
BackSlach = "back slash",
|
|
139
|
+
CloseBracket = "close bracket / \u00E5",
|
|
140
|
+
SingleQuote = "single quote / \u00F8",
|
|
141
|
+
BackQuote = "`",
|
|
142
|
+
Altgr = "altgr"
|
|
143
|
+
}
|
|
144
|
+
export type { ControlOptions, Controls, BoundKey };
|
|
145
|
+
/**
|
|
146
|
+
* Keyboard input controls implementation
|
|
147
|
+
*
|
|
148
|
+
* Handles keyboard input events and maps them to control actions.
|
|
149
|
+
* Supports composite directions (diagonal movement) and key repeat functionality.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* const keyboardControls = new KeyboardControls();
|
|
154
|
+
* keyboardControls.setInputs({
|
|
155
|
+
* up: {
|
|
156
|
+
* repeat: true,
|
|
157
|
+
* bind: Input.Up,
|
|
158
|
+
* keyDown() {
|
|
159
|
+
* console.log('Up pressed');
|
|
160
|
+
* }
|
|
161
|
+
* }
|
|
162
|
+
* });
|
|
163
|
+
* keyboardControls.start();
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export declare class KeyboardControls extends ControlsBase {
|
|
167
|
+
private keyState;
|
|
168
|
+
private lastKeyPressed;
|
|
169
|
+
private directionState;
|
|
170
|
+
/**
|
|
171
|
+
* Setup keyboard event listeners
|
|
172
|
+
*/
|
|
173
|
+
protected setupListeners(): void;
|
|
174
|
+
/**
|
|
175
|
+
* Cleanup keyboard event listeners
|
|
176
|
+
*/
|
|
177
|
+
protected cleanup(): void;
|
|
178
|
+
/**
|
|
179
|
+
* Process keyboard inputs each step
|
|
180
|
+
*/
|
|
181
|
+
protected preStep(): void;
|
|
182
|
+
/**
|
|
183
|
+
* Apply input for a keyboard key
|
|
184
|
+
* Overrides base implementation to handle key state and repeat logic
|
|
185
|
+
*/
|
|
186
|
+
protected applyInput(keyName: string): void;
|
|
187
|
+
private applyKeyDown;
|
|
188
|
+
private applyKeyUp;
|
|
189
|
+
private applyKeyPress;
|
|
190
|
+
private onKeyChange;
|
|
191
|
+
private updateDirectionState;
|
|
192
|
+
private getDirection;
|
|
193
|
+
/**
|
|
194
|
+
* Apply a control action programmatically
|
|
195
|
+
* Triggers keyboard events to simulate key presses
|
|
196
|
+
*
|
|
197
|
+
* @param controlName - Name of the control
|
|
198
|
+
* @param isDown - Whether the key is pressed (true) or released (false)
|
|
199
|
+
* @returns Promise that resolves when the action is complete
|
|
200
|
+
* @example
|
|
201
|
+
* ```ts
|
|
202
|
+
* // Press a key
|
|
203
|
+
* await keyboardControls.applyControl('action', true);
|
|
204
|
+
*
|
|
205
|
+
* // Release a key
|
|
206
|
+
* await keyboardControls.applyControl('action', false);
|
|
207
|
+
*
|
|
208
|
+
* // Press and release (default)
|
|
209
|
+
* await keyboardControls.applyControl('action');
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
applyControl(controlName: string | number, isDown?: boolean | undefined): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Resume listening to inputs after stopInputs() was called
|
|
215
|
+
* Also resets keyboard state
|
|
216
|
+
*/
|
|
217
|
+
listenInputs(): void;
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=KeyboardControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyboardControls.d.ts","sourceRoot":"","sources":["../../src/directives/KeyboardControls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAElF,oBAAY,KAAK;IACb,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU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;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;IAC9C,OAAO,CAAC,QAAQ,CAKV;IACN,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,cAAc,CAUpB;IAEF;;OAEG;IACH,SAAS,CAAC,cAAc,IAAI,IAAI;IAKhC;;OAEG;IACH,SAAS,CAAC,OAAO,IAAI,IAAI;IAKzB;;OAEG;IACH,SAAS,CAAC,OAAO;IAsBjB;;;OAGG;IACH,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM;IAqBpC,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,WAAW;IAgCnB,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,YAAY;IAepB;;;;;;;;;;;;;;;;;;OAkBG;IACG,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB7F;;;OAGG;IACH,YAAY;CAKf"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Directive } from '../engine/directive';
|
|
2
|
+
import { Element } from '../engine/reactive';
|
|
3
|
+
|
|
4
|
+
export interface Tick {
|
|
5
|
+
timestamp: number;
|
|
6
|
+
deltaTime: number;
|
|
7
|
+
frame: number;
|
|
8
|
+
deltaRatio: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class Scheduler extends Directive {
|
|
11
|
+
private maxFps?;
|
|
12
|
+
private fps;
|
|
13
|
+
private deltaTime;
|
|
14
|
+
frame: number;
|
|
15
|
+
private timestamp;
|
|
16
|
+
private requestedDelay;
|
|
17
|
+
private lastTimestamp;
|
|
18
|
+
private _stop;
|
|
19
|
+
private tick;
|
|
20
|
+
onInit(element: Element): void;
|
|
21
|
+
onDestroy(): void;
|
|
22
|
+
onMount(element: Element): void;
|
|
23
|
+
onUpdate(props: any): void;
|
|
24
|
+
nextTick(timestamp: number): void;
|
|
25
|
+
/**
|
|
26
|
+
* start the schedule
|
|
27
|
+
* @return {Scheduler} returns this scheduler instance
|
|
28
|
+
*/
|
|
29
|
+
start(options?: {
|
|
30
|
+
maxFps?: number;
|
|
31
|
+
fps?: number;
|
|
32
|
+
delay?: number;
|
|
33
|
+
}): this;
|
|
34
|
+
stop(): void;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=Scheduler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scheduler.d.ts","sourceRoot":"","sources":["../../src/directives/Scheduler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAqB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,MAAM,WAAW,IAAI;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACrB;AAED,qBAAa,SAAU,SAAQ,SAAS;IACpC,OAAO,CAAC,MAAM,CAAC,CAAQ;IACvB,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,SAAS,CAAY;IACtB,KAAK,EAAE,MAAM,CAAI;IACxB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,cAAc,CAAY;IAClC,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,KAAK,CAAiB;IAC9B,OAAO,CAAC,IAAI,CAA6B;IAEzC,MAAM,CAAC,OAAO,EAAE,OAAO;IAIvB,SAAS;IACT,OAAO,CAAC,OAAO,EAAE,OAAO;IACxB,QAAQ,CAAC,KAAK,EAAE,GAAG;IAEnB,QAAQ,CAAC,SAAS,EAAE,MAAM;IAa1B;;;OAGG;IACH,KAAK,CAAC,OAAO,GAAE;QACX,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;KACZ;IA2CN,IAAI;CAGP"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Container } from 'pixi.js';
|
|
2
|
+
import { Directive } from '../engine/directive';
|
|
3
|
+
import { Element } from '../engine/reactive';
|
|
4
|
+
import { Trigger } from '../engine/trigger';
|
|
5
|
+
import { SignalOrPrimitive } from '../components/types';
|
|
6
|
+
|
|
7
|
+
export type ShakeProps = {
|
|
8
|
+
/**
|
|
9
|
+
* Trigger that activates the shake animation
|
|
10
|
+
* When the trigger is activated, the shake animation will start
|
|
11
|
+
*/
|
|
12
|
+
trigger?: Trigger<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Intensity of the shake effect (in pixels)
|
|
15
|
+
* @default 10
|
|
16
|
+
*/
|
|
17
|
+
intensity?: SignalOrPrimitive<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Duration of the shake animation in milliseconds
|
|
20
|
+
* @default 500
|
|
21
|
+
*/
|
|
22
|
+
duration?: SignalOrPrimitive<number>;
|
|
23
|
+
/**
|
|
24
|
+
* Number of shake oscillations during the animation
|
|
25
|
+
* Higher values create more rapid shaking
|
|
26
|
+
* @default 10
|
|
27
|
+
*/
|
|
28
|
+
frequency?: SignalOrPrimitive<number>;
|
|
29
|
+
/**
|
|
30
|
+
* Direction of the shake: 'x', 'y', or 'both'
|
|
31
|
+
* @default 'both'
|
|
32
|
+
*/
|
|
33
|
+
direction?: SignalOrPrimitive<'x' | 'y' | 'both'>;
|
|
34
|
+
/**
|
|
35
|
+
* Callback function called when shake starts
|
|
36
|
+
*/
|
|
37
|
+
onStart?: () => void;
|
|
38
|
+
/**
|
|
39
|
+
* Callback function called when shake completes
|
|
40
|
+
*/
|
|
41
|
+
onComplete?: () => void;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Shake directive that animates a display object's position when a trigger is activated.
|
|
45
|
+
* Creates a shake effect by rapidly oscillating the x and/or y position.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* // Basic usage with trigger
|
|
50
|
+
* const shakeTrigger = trigger();
|
|
51
|
+
*
|
|
52
|
+
* onMount(element) {
|
|
53
|
+
* // Element will shake when trigger is activated
|
|
54
|
+
* element.props.shake = { trigger: shakeTrigger };
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* // Trigger the shake
|
|
58
|
+
* shakeTrigger.start();
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare class Shake extends Directive {
|
|
62
|
+
private elementRef;
|
|
63
|
+
private originalPosition;
|
|
64
|
+
private progressSignal;
|
|
65
|
+
private shakeSubscription;
|
|
66
|
+
private positionEffect;
|
|
67
|
+
private currentShakeConfig;
|
|
68
|
+
/**
|
|
69
|
+
* Initializes the shake directive
|
|
70
|
+
* @param element - The element to attach the shake effect to
|
|
71
|
+
*/
|
|
72
|
+
onInit(element: Element<Container>): void;
|
|
73
|
+
/**
|
|
74
|
+
* Mounts the shake directive and sets up trigger listener
|
|
75
|
+
* @param element - The element being mounted
|
|
76
|
+
*/
|
|
77
|
+
onMount(element: Element<Container>): void;
|
|
78
|
+
/**
|
|
79
|
+
* Gets the shake props with default values
|
|
80
|
+
* @returns ShakeProps with defaults applied
|
|
81
|
+
*/
|
|
82
|
+
get shakeProps(): ShakeProps;
|
|
83
|
+
/**
|
|
84
|
+
* Performs the shake animation using animatedSignal
|
|
85
|
+
* @param data - Optional data passed from the trigger that can override default options
|
|
86
|
+
*/
|
|
87
|
+
private performShake;
|
|
88
|
+
/**
|
|
89
|
+
* Updates the shake directive when props change
|
|
90
|
+
* @param props - Updated props
|
|
91
|
+
*/
|
|
92
|
+
onUpdate(props: any): void;
|
|
93
|
+
/**
|
|
94
|
+
* Cleans up the shake directive
|
|
95
|
+
*/
|
|
96
|
+
onDestroy(): void;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=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IlC;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;IA0BnC;;;OAGG;IACH,IAAI,UAAU,IAAI,UAAU,CAQ3B;IAED;;;OAGG;YACW,YAAY;IA6G1B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG;IAUnB;;OAEG;IACH,SAAS;CA+BZ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Container } from 'pixi.js';
|
|
2
|
+
import { Directive } from '../engine/directive';
|
|
3
|
+
import { Element } from '../engine/reactive';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sound directive for playing audio with support for spatial audio and multiple sound sources
|
|
7
|
+
*
|
|
8
|
+
* This directive manages audio playback using Howler.js library. It supports:
|
|
9
|
+
* - Single or multiple sound sources
|
|
10
|
+
* - Spatial audio with distance-based volume calculation
|
|
11
|
+
* - All standard audio controls (play, pause, volume, etc.)
|
|
12
|
+
* - Event handling for audio lifecycle
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export declare class Sound extends Directive {
|
|
16
|
+
private sounds;
|
|
17
|
+
private eventsFn;
|
|
18
|
+
private maxVolume;
|
|
19
|
+
private maxDistance;
|
|
20
|
+
private tickSubscription?;
|
|
21
|
+
onInit(element: Element<Container>): void;
|
|
22
|
+
onMount(element: Element<Container>): void;
|
|
23
|
+
onUpdate(props: any): void;
|
|
24
|
+
onDestroy(): void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=Sound.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sound.d.ts","sourceRoot":"","sources":["../../src/directives/Sound.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAqB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAK7C;;;;;;;;;GASG;AACH,qBAAa,KAAM,SAAQ,SAAS;IAChC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,gBAAgB,CAAC,CAAc;IAEvC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;IAElC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;IA0DnC,QAAQ,CAAC,KAAK,EAAE,GAAG;IAuBnB,SAAS;CAkBZ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Container } from 'pixi.js';
|
|
2
|
+
import { Directive } from '../engine/directive';
|
|
3
|
+
import { Element } from '../engine/reactive';
|
|
4
|
+
|
|
5
|
+
export declare class Transition extends Directive {
|
|
6
|
+
onInit(element: Element<Container>): void;
|
|
7
|
+
onMount(element: Element<Container>): void;
|
|
8
|
+
onUpdate(props: any): void;
|
|
9
|
+
onDestroy(): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=Transition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Transition.d.ts","sourceRoot":"","sources":["../../src/directives/Transition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmD,MAAM,SAAS,CAAC;AAErF,OAAO,EAAE,SAAS,EAAqB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,qBAAa,UAAW,SAAQ,SAAS;IAGrC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;IAGlC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;IAuBnC,QAAQ,CAAC,KAAK,EAAE,GAAG;IAInB,SAAS;CAGZ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Container } from 'pixi.js';
|
|
2
|
+
import { Directive } from '../engine/directive';
|
|
3
|
+
import { Element } from '../engine/reactive';
|
|
4
|
+
|
|
5
|
+
export declare class ViewportCull extends Directive {
|
|
6
|
+
private cull;
|
|
7
|
+
onInit(element: any): void;
|
|
8
|
+
onMount(element: Element<Container>): void;
|
|
9
|
+
onUpdate(props: any): void;
|
|
10
|
+
onDestroy(): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ViewportCull.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewportCull.d.ts","sourceRoot":"","sources":["../../src/directives/ViewportCull.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,SAAS,EAAqB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,qBAAa,YAAa,SAAQ,SAAS;IACvC,OAAO,CAAC,IAAI,CAAQ;IAEpB,MAAM,CAAC,OAAO,KAAA;IAKd,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;IAoBnC,QAAQ,CAAC,KAAK,EAAE,GAAG;IACnB,SAAS;CACZ"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentInstance } from '../components/DisplayObject';
|
|
2
|
+
import { SignalOrPrimitive } from '../components/types';
|
|
3
|
+
import { Directive } from '../engine/directive';
|
|
4
|
+
import { Element } from '../engine/reactive';
|
|
5
|
+
|
|
6
|
+
export type ViewportFollowProps = {
|
|
7
|
+
viewportFollow?: boolean | {
|
|
8
|
+
speed?: SignalOrPrimitive<number>;
|
|
9
|
+
acceleration?: SignalOrPrimitive<number>;
|
|
10
|
+
radius?: SignalOrPrimitive<number>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare class ViewportFollow extends Directive {
|
|
14
|
+
onInit(element: Element<ComponentInstance>): void;
|
|
15
|
+
onMount(element: Element): void;
|
|
16
|
+
onUpdate(viewportFollow: any, element: Element): void;
|
|
17
|
+
onDestroy(element: Element): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ViewportFollow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewportFollow.d.ts","sourceRoot":"","sources":["../../src/directives/ViewportFollow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAqB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAI7C,MAAM,MAAM,mBAAmB,GAAG;IAC9B,cAAc,CAAC,EAAE,OAAO,GAAG;QACvB,KAAK,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAClC,YAAY,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;KACtC,CAAC;CACL,CAAA;AAED,qBAAa,cAAe,SAAQ,SAAS;IACzC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC;IAG1C,OAAO,CAAC,OAAO,EAAE,OAAO;IAGxB,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO;IAwB9C,SAAS,CAAC,OAAO,EAAE,OAAO;CAK7B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './ControlsBase';
|
|
2
|
+
export * from './KeyboardControls';
|
|
3
|
+
export * from './GamepadControls';
|
|
4
|
+
export * from './JoystickControls';
|
|
5
|
+
export * from './Controls';
|
|
6
|
+
export * from './Scheduler';
|
|
7
|
+
export * from './ViewportFollow';
|
|
8
|
+
export * from './Sound';
|
|
9
|
+
export * from './Drag';
|
|
10
|
+
export * from './Transition';
|
|
11
|
+
export * from './Shake';
|
|
12
|
+
export * from './Flash';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAEhC,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|