@kingdomsconnected/types 1.5.0
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/README.md +39 -0
- package/client/index.d.ts +4112 -0
- package/package.json +30 -0
- package/server/index.d.ts +4577 -0
- package/shared.d.ts +82 -0
package/shared.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural TypeScript types that are not runtime globals.
|
|
3
|
+
*
|
|
4
|
+
* These describe what the MafiaHub Framework itself provides -- the base entity and player handles
|
|
5
|
+
* KCDC's own `Entity`, `Player` and `Horse` extend, and the value types they exchange. The
|
|
6
|
+
* generated declarations import from here; nothing in this file is produced by the exporter, so it
|
|
7
|
+
* is edited by hand when the framework's own surface changes.
|
|
8
|
+
*
|
|
9
|
+
* KCDC's own callback types live here too. A binding may only declare a named type, never an
|
|
10
|
+
* inline `(...) => ...`, so a handler parameter has nowhere else it can be spelled.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Handler for an event raised through the framework event bus. A returned promise is awaited, so a handler may be async. */
|
|
14
|
+
export type EventHandler = (...args: unknown[]) => unknown | Promise<unknown>;
|
|
15
|
+
|
|
16
|
+
/** Removes the subscription that returned it. Calling it more than once is harmless. */
|
|
17
|
+
export type Unsubscribe = () => void;
|
|
18
|
+
|
|
19
|
+
/** Replies to a request received by a MessageHandler. */
|
|
20
|
+
export type MessageReply = (value: unknown) => void;
|
|
21
|
+
|
|
22
|
+
/** Handler for a request addressed to a resource, given the payload and a reply callback. */
|
|
23
|
+
export type MessageHandler = (payload: unknown, reply: MessageReply) => void;
|
|
24
|
+
|
|
25
|
+
/** Handler for a bound key, given the key name and which edge fired. */
|
|
26
|
+
export type KeyHandler = (key: string, state: "down" | "up") => void;
|
|
27
|
+
|
|
28
|
+
/** Handler for an event emitted by a web view. */
|
|
29
|
+
export type WebEventHandler = (payload: unknown) => void;
|
|
30
|
+
|
|
31
|
+
/** Handler for a notification raised by a native screen, given whatever that notification carries. */
|
|
32
|
+
export type NativeScreenHandler = (...args: any[]) => void;
|
|
33
|
+
|
|
34
|
+
/** Handler for an ActionScript mouse event on a native clip, given the clip that raised it. Generic because `shared.d.ts` cannot reach the generated `NativeClip`. */
|
|
35
|
+
export type NativeClipHandler<TClip = unknown> = (clip: TClip, ...args: any[]) => void;
|
|
36
|
+
|
|
37
|
+
/** Handler for an event a native element's XML declares, given the arguments the movie raised it with. */
|
|
38
|
+
export type NativeElementHandler = (args: any[]) => void;
|
|
39
|
+
|
|
40
|
+
/** Handler for a placement-mode event, given where the placement is aimed and whether that spot is accepted. The pose is null for `cancel` and `end`. Generic because `shared.d.ts` cannot reach the generated `PlacementPose`. */
|
|
41
|
+
export type PlacementHandler<TPose = unknown> = (pose: TPose | null, valid: boolean) => void;
|
|
42
|
+
|
|
43
|
+
/** A two-dimensional vector. */
|
|
44
|
+
export interface Vector2 {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** A normalized RGBA color. */
|
|
50
|
+
export interface Color {
|
|
51
|
+
r: number;
|
|
52
|
+
g: number;
|
|
53
|
+
b: number;
|
|
54
|
+
a: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** A mutable three-dimensional vector used for world positions and Euler angles. */
|
|
58
|
+
export interface Vector3 {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
z: number;
|
|
62
|
+
add(other: Vector3): this;
|
|
63
|
+
sub(other: Vector3): this;
|
|
64
|
+
mul(scalar: number): this;
|
|
65
|
+
div(scalar: number): this;
|
|
66
|
+
normalize(): this;
|
|
67
|
+
dot(other: Vector3): number;
|
|
68
|
+
cross(other: Vector3): this;
|
|
69
|
+
distance(other: Vector3): number;
|
|
70
|
+
lerp(target: Vector3, t: number): this;
|
|
71
|
+
set(x: number, y: number, z: number): this;
|
|
72
|
+
clone(): Vector3;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Quaternion used for entity rotations. */
|
|
76
|
+
export interface Quaternion {
|
|
77
|
+
w: number;
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
z: number;
|
|
81
|
+
}
|
|
82
|
+
|