@workadventure/iframe-api-typings 1.10.4 → 1.11.2
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/Api/Events/ChangeAreaEvent.d.ts +3 -3
- package/Api/Events/CreateAreaEvent.d.ts +44 -0
- package/Api/Events/EmbeddedWebsiteEvent.d.ts +2 -2
- package/Api/Events/HasPlayerMovedEvent.d.ts +4 -4
- package/Api/Events/IframeEvent.d.ts +581 -113
- package/Api/Events/OpenPopupEvent.d.ts +2 -2
- package/Api/Events/RemotePlayerClickedEvent.d.ts +6 -0
- package/Api/Events/SetAreaPropertyEvent.d.ts +18 -0
- package/Api/Events/{setPropertyEvent.d.ts → SetPropertyEvent.d.ts} +0 -0
- package/Api/Events/ui/UIWebsite.d.ts +42 -42
- package/Api/iframe/Area/Area.d.ts +22 -0
- package/Api/iframe/IframeApiContribution.d.ts +2 -10
- package/Api/iframe/area.d.ts +25 -0
- package/Api/iframe/camera.d.ts +10 -1
- package/Api/iframe/chat.d.ts +6 -1
- package/Api/iframe/player.d.ts +11 -1
- package/Api/iframe/registeredCallbacks.d.ts +15 -5
- package/Api/iframe/room.d.ts +23 -1
- package/Api/iframe/state.d.ts +8 -1
- package/Api/iframe/ui.d.ts +38 -9
- package/package.json +1 -1
|
@@ -24,16 +24,16 @@ export declare const isOpenPopupEvent: z.ZodObject<{
|
|
|
24
24
|
label: string;
|
|
25
25
|
}>, "many">;
|
|
26
26
|
}, "strip", z.ZodTypeAny, {
|
|
27
|
-
popupId: number;
|
|
28
27
|
message: string;
|
|
28
|
+
popupId: number;
|
|
29
29
|
targetObject: string;
|
|
30
30
|
buttons: {
|
|
31
31
|
className?: string | undefined;
|
|
32
32
|
label: string;
|
|
33
33
|
}[];
|
|
34
34
|
}, {
|
|
35
|
-
popupId: number;
|
|
36
35
|
message: string;
|
|
36
|
+
popupId: number;
|
|
37
37
|
targetObject: string;
|
|
38
38
|
buttons: {
|
|
39
39
|
className?: string | undefined;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const isRemotePlayerClickedEvent: z.ZodObject<{
|
|
3
3
|
id: z.ZodNumber;
|
|
4
|
+
uuid: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
4
6
|
}, "strip", z.ZodTypeAny, {
|
|
5
7
|
id: number;
|
|
8
|
+
name: string;
|
|
9
|
+
uuid: string;
|
|
6
10
|
}, {
|
|
7
11
|
id: number;
|
|
12
|
+
name: string;
|
|
13
|
+
uuid: string;
|
|
8
14
|
}>;
|
|
9
15
|
/**
|
|
10
16
|
* A message sent from the game to the iFrame when RemotePlayer is clicked.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const isSetAreaPropertyEvent: z.ZodObject<{
|
|
3
|
+
areaName: z.ZodString;
|
|
4
|
+
propertyName: z.ZodString;
|
|
5
|
+
propertyValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
propertyValue?: string | number | boolean | undefined;
|
|
8
|
+
propertyName: string;
|
|
9
|
+
areaName: string;
|
|
10
|
+
}, {
|
|
11
|
+
propertyValue?: string | number | boolean | undefined;
|
|
12
|
+
propertyName: string;
|
|
13
|
+
areaName: string;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* A message sent from the iFrame to the game to change the value of the property of the area
|
|
17
|
+
*/
|
|
18
|
+
export declare type SetAreaPropertyEvent = z.infer<typeof isSetAreaPropertyEvent>;
|
|
File without changes
|
|
@@ -7,15 +7,15 @@ export declare const isUIWebsiteMargin: z.ZodObject<{
|
|
|
7
7
|
left: z.ZodOptional<z.ZodString>;
|
|
8
8
|
right: z.ZodOptional<z.ZodString>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
right?: string | undefined;
|
|
11
|
-
left?: string | undefined;
|
|
12
10
|
top?: string | undefined;
|
|
13
11
|
bottom?: string | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
right?: string | undefined;
|
|
16
12
|
left?: string | undefined;
|
|
13
|
+
right?: string | undefined;
|
|
14
|
+
}, {
|
|
17
15
|
top?: string | undefined;
|
|
18
16
|
bottom?: string | undefined;
|
|
17
|
+
left?: string | undefined;
|
|
18
|
+
right?: string | undefined;
|
|
19
19
|
}>;
|
|
20
20
|
export declare type UIWebsiteMargin = z.infer<typeof isUIWebsiteMargin>;
|
|
21
21
|
export declare const isViewportPositionVertical: z.ZodEnum<["top", "middle", "bottom"]>;
|
|
@@ -27,10 +27,10 @@ export declare const isUIWebsitePosition: z.ZodObject<{
|
|
|
27
27
|
horizontal: z.ZodEnum<["left", "middle", "right"]>;
|
|
28
28
|
}, "strip", z.ZodTypeAny, {
|
|
29
29
|
vertical: "top" | "middle" | "bottom";
|
|
30
|
-
horizontal: "
|
|
30
|
+
horizontal: "middle" | "left" | "right";
|
|
31
31
|
}, {
|
|
32
32
|
vertical: "top" | "middle" | "bottom";
|
|
33
|
-
horizontal: "
|
|
33
|
+
horizontal: "middle" | "left" | "right";
|
|
34
34
|
}>;
|
|
35
35
|
export declare type UIWebsitePosition = z.infer<typeof isUIWebsitePosition>;
|
|
36
36
|
export declare const isUIWebsiteSize: z.ZodObject<{
|
|
@@ -54,10 +54,10 @@ export declare const isCreateUIWebsiteEvent: z.ZodObject<{
|
|
|
54
54
|
horizontal: z.ZodEnum<["left", "middle", "right"]>;
|
|
55
55
|
}, "strip", z.ZodTypeAny, {
|
|
56
56
|
vertical: "top" | "middle" | "bottom";
|
|
57
|
-
horizontal: "
|
|
57
|
+
horizontal: "middle" | "left" | "right";
|
|
58
58
|
}, {
|
|
59
59
|
vertical: "top" | "middle" | "bottom";
|
|
60
|
-
horizontal: "
|
|
60
|
+
horizontal: "middle" | "left" | "right";
|
|
61
61
|
}>;
|
|
62
62
|
size: z.ZodObject<{
|
|
63
63
|
height: z.ZodString;
|
|
@@ -75,30 +75,30 @@ export declare const isCreateUIWebsiteEvent: z.ZodObject<{
|
|
|
75
75
|
left: z.ZodOptional<z.ZodString>;
|
|
76
76
|
right: z.ZodOptional<z.ZodString>;
|
|
77
77
|
}, "strip", z.ZodTypeAny, {
|
|
78
|
-
right?: string | undefined;
|
|
79
|
-
left?: string | undefined;
|
|
80
78
|
top?: string | undefined;
|
|
81
79
|
bottom?: string | undefined;
|
|
82
|
-
}, {
|
|
83
|
-
right?: string | undefined;
|
|
84
80
|
left?: string | undefined;
|
|
81
|
+
right?: string | undefined;
|
|
82
|
+
}, {
|
|
85
83
|
top?: string | undefined;
|
|
86
84
|
bottom?: string | undefined;
|
|
85
|
+
left?: string | undefined;
|
|
86
|
+
right?: string | undefined;
|
|
87
87
|
}>>;
|
|
88
88
|
}, "strip", z.ZodTypeAny, {
|
|
89
89
|
allowApi?: boolean | undefined;
|
|
90
90
|
allowPolicy?: string | undefined;
|
|
91
91
|
visible?: boolean | undefined;
|
|
92
92
|
margin?: {
|
|
93
|
-
right?: string | undefined;
|
|
94
|
-
left?: string | undefined;
|
|
95
93
|
top?: string | undefined;
|
|
96
94
|
bottom?: string | undefined;
|
|
95
|
+
left?: string | undefined;
|
|
96
|
+
right?: string | undefined;
|
|
97
97
|
} | undefined;
|
|
98
98
|
url: string;
|
|
99
99
|
position: {
|
|
100
100
|
vertical: "top" | "middle" | "bottom";
|
|
101
|
-
horizontal: "
|
|
101
|
+
horizontal: "middle" | "left" | "right";
|
|
102
102
|
};
|
|
103
103
|
size: {
|
|
104
104
|
width: string;
|
|
@@ -109,15 +109,15 @@ export declare const isCreateUIWebsiteEvent: z.ZodObject<{
|
|
|
109
109
|
allowPolicy?: string | undefined;
|
|
110
110
|
visible?: boolean | undefined;
|
|
111
111
|
margin?: {
|
|
112
|
-
right?: string | undefined;
|
|
113
|
-
left?: string | undefined;
|
|
114
112
|
top?: string | undefined;
|
|
115
113
|
bottom?: string | undefined;
|
|
114
|
+
left?: string | undefined;
|
|
115
|
+
right?: string | undefined;
|
|
116
116
|
} | undefined;
|
|
117
117
|
url: string;
|
|
118
118
|
position: {
|
|
119
119
|
vertical: "top" | "middle" | "bottom";
|
|
120
|
-
horizontal: "
|
|
120
|
+
horizontal: "middle" | "left" | "right";
|
|
121
121
|
};
|
|
122
122
|
size: {
|
|
123
123
|
width: string;
|
|
@@ -134,10 +134,10 @@ export declare const isModifyUIWebsiteEvent: z.ZodObject<{
|
|
|
134
134
|
horizontal: z.ZodEnum<["left", "middle", "right"]>;
|
|
135
135
|
}, "strip", z.ZodTypeAny, {
|
|
136
136
|
vertical: "top" | "middle" | "bottom";
|
|
137
|
-
horizontal: "
|
|
137
|
+
horizontal: "middle" | "left" | "right";
|
|
138
138
|
}, {
|
|
139
139
|
vertical: "top" | "middle" | "bottom";
|
|
140
|
-
horizontal: "
|
|
140
|
+
horizontal: "middle" | "left" | "right";
|
|
141
141
|
}>>;
|
|
142
142
|
size: z.ZodOptional<z.ZodObject<{
|
|
143
143
|
height: z.ZodString;
|
|
@@ -155,21 +155,21 @@ export declare const isModifyUIWebsiteEvent: z.ZodObject<{
|
|
|
155
155
|
left: z.ZodOptional<z.ZodString>;
|
|
156
156
|
right: z.ZodOptional<z.ZodString>;
|
|
157
157
|
}, "strip", z.ZodTypeAny, {
|
|
158
|
-
right?: string | undefined;
|
|
159
|
-
left?: string | undefined;
|
|
160
158
|
top?: string | undefined;
|
|
161
159
|
bottom?: string | undefined;
|
|
162
|
-
}, {
|
|
163
|
-
right?: string | undefined;
|
|
164
160
|
left?: string | undefined;
|
|
161
|
+
right?: string | undefined;
|
|
162
|
+
}, {
|
|
165
163
|
top?: string | undefined;
|
|
166
164
|
bottom?: string | undefined;
|
|
165
|
+
left?: string | undefined;
|
|
166
|
+
right?: string | undefined;
|
|
167
167
|
}>>;
|
|
168
168
|
}, "strip", z.ZodTypeAny, {
|
|
169
169
|
url?: string | undefined;
|
|
170
170
|
position?: {
|
|
171
171
|
vertical: "top" | "middle" | "bottom";
|
|
172
|
-
horizontal: "
|
|
172
|
+
horizontal: "middle" | "left" | "right";
|
|
173
173
|
} | undefined;
|
|
174
174
|
visible?: boolean | undefined;
|
|
175
175
|
size?: {
|
|
@@ -177,17 +177,17 @@ export declare const isModifyUIWebsiteEvent: z.ZodObject<{
|
|
|
177
177
|
height: string;
|
|
178
178
|
} | undefined;
|
|
179
179
|
margin?: {
|
|
180
|
-
right?: string | undefined;
|
|
181
|
-
left?: string | undefined;
|
|
182
180
|
top?: string | undefined;
|
|
183
181
|
bottom?: string | undefined;
|
|
182
|
+
left?: string | undefined;
|
|
183
|
+
right?: string | undefined;
|
|
184
184
|
} | undefined;
|
|
185
185
|
id: string;
|
|
186
186
|
}, {
|
|
187
187
|
url?: string | undefined;
|
|
188
188
|
position?: {
|
|
189
189
|
vertical: "top" | "middle" | "bottom";
|
|
190
|
-
horizontal: "
|
|
190
|
+
horizontal: "middle" | "left" | "right";
|
|
191
191
|
} | undefined;
|
|
192
192
|
visible?: boolean | undefined;
|
|
193
193
|
size?: {
|
|
@@ -195,10 +195,10 @@ export declare const isModifyUIWebsiteEvent: z.ZodObject<{
|
|
|
195
195
|
height: string;
|
|
196
196
|
} | undefined;
|
|
197
197
|
margin?: {
|
|
198
|
-
right?: string | undefined;
|
|
199
|
-
left?: string | undefined;
|
|
200
198
|
top?: string | undefined;
|
|
201
199
|
bottom?: string | undefined;
|
|
200
|
+
left?: string | undefined;
|
|
201
|
+
right?: string | undefined;
|
|
202
202
|
} | undefined;
|
|
203
203
|
id: string;
|
|
204
204
|
}>;
|
|
@@ -214,10 +214,10 @@ export declare const isUIWebsite: z.ZodObject<{
|
|
|
214
214
|
horizontal: z.ZodEnum<["left", "middle", "right"]>;
|
|
215
215
|
}, "strip", z.ZodTypeAny, {
|
|
216
216
|
vertical: "top" | "middle" | "bottom";
|
|
217
|
-
horizontal: "
|
|
217
|
+
horizontal: "middle" | "left" | "right";
|
|
218
218
|
}, {
|
|
219
219
|
vertical: "top" | "middle" | "bottom";
|
|
220
|
-
horizontal: "
|
|
220
|
+
horizontal: "middle" | "left" | "right";
|
|
221
221
|
}>;
|
|
222
222
|
size: z.ZodObject<{
|
|
223
223
|
height: z.ZodString;
|
|
@@ -235,29 +235,29 @@ export declare const isUIWebsite: z.ZodObject<{
|
|
|
235
235
|
left: z.ZodOptional<z.ZodString>;
|
|
236
236
|
right: z.ZodOptional<z.ZodString>;
|
|
237
237
|
}, "strip", z.ZodTypeAny, {
|
|
238
|
-
right?: string | undefined;
|
|
239
|
-
left?: string | undefined;
|
|
240
238
|
top?: string | undefined;
|
|
241
239
|
bottom?: string | undefined;
|
|
242
|
-
}, {
|
|
243
|
-
right?: string | undefined;
|
|
244
240
|
left?: string | undefined;
|
|
241
|
+
right?: string | undefined;
|
|
242
|
+
}, {
|
|
245
243
|
top?: string | undefined;
|
|
246
244
|
bottom?: string | undefined;
|
|
245
|
+
left?: string | undefined;
|
|
246
|
+
right?: string | undefined;
|
|
247
247
|
}>>;
|
|
248
248
|
}, "strip", z.ZodTypeAny, {
|
|
249
249
|
margin?: {
|
|
250
|
-
right?: string | undefined;
|
|
251
|
-
left?: string | undefined;
|
|
252
250
|
top?: string | undefined;
|
|
253
251
|
bottom?: string | undefined;
|
|
252
|
+
left?: string | undefined;
|
|
253
|
+
right?: string | undefined;
|
|
254
254
|
} | undefined;
|
|
255
255
|
url: string;
|
|
256
256
|
allowApi: boolean;
|
|
257
257
|
allowPolicy: string;
|
|
258
258
|
position: {
|
|
259
259
|
vertical: "top" | "middle" | "bottom";
|
|
260
|
-
horizontal: "
|
|
260
|
+
horizontal: "middle" | "left" | "right";
|
|
261
261
|
};
|
|
262
262
|
id: string;
|
|
263
263
|
visible: boolean;
|
|
@@ -267,17 +267,17 @@ export declare const isUIWebsite: z.ZodObject<{
|
|
|
267
267
|
};
|
|
268
268
|
}, {
|
|
269
269
|
margin?: {
|
|
270
|
-
right?: string | undefined;
|
|
271
|
-
left?: string | undefined;
|
|
272
270
|
top?: string | undefined;
|
|
273
271
|
bottom?: string | undefined;
|
|
272
|
+
left?: string | undefined;
|
|
273
|
+
right?: string | undefined;
|
|
274
274
|
} | undefined;
|
|
275
275
|
url: string;
|
|
276
276
|
allowApi: boolean;
|
|
277
277
|
allowPolicy: string;
|
|
278
278
|
position: {
|
|
279
279
|
vertical: "top" | "middle" | "bottom";
|
|
280
|
-
horizontal: "
|
|
280
|
+
horizontal: "middle" | "left" | "right";
|
|
281
281
|
};
|
|
282
282
|
id: string;
|
|
283
283
|
visible: boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ITiledMapObject } from "../../../Phaser/Map/ITiledMap";
|
|
2
|
+
import { CreateAreaEvent } from "../../Events/CreateAreaEvent";
|
|
3
|
+
export declare type IArea = Omit<ITiledMapObject, "id" | "gid" | "visible" | "rotation" | "ellipse" | "polygon" | "polyline">;
|
|
4
|
+
export declare class Area implements IArea {
|
|
5
|
+
private config;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly type: string;
|
|
8
|
+
private _x;
|
|
9
|
+
private _y;
|
|
10
|
+
private _width;
|
|
11
|
+
private _height;
|
|
12
|
+
constructor(config: CreateAreaEvent);
|
|
13
|
+
setProperty(propertyName: string, propertyValue: string | number | boolean | undefined): void;
|
|
14
|
+
set x(x: number);
|
|
15
|
+
set y(y: number);
|
|
16
|
+
set width(width: number);
|
|
17
|
+
set height(height: number);
|
|
18
|
+
get x(): number;
|
|
19
|
+
get y(): number;
|
|
20
|
+
get width(): number;
|
|
21
|
+
get height(): number;
|
|
22
|
+
}
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { IframeEvent, IframeQuery, IframeQueryMap, IframeResponseEventMap } from "../Events/IframeEvent";
|
|
1
|
+
import type { IframeEvent, IframeQuery, IframeQueryMap } from "../Events/IframeEvent";
|
|
3
2
|
export declare function sendToWorkadventure(content: IframeEvent): void;
|
|
4
3
|
export declare const answerPromises: Map<number, {
|
|
5
4
|
resolve: (value: IframeQueryMap[keyof IframeQueryMap]["answer"] | PromiseLike<IframeQueryMap[keyof IframeQueryMap]["answer"]>) => void;
|
|
6
5
|
reject: (reason?: any) => void;
|
|
7
6
|
}>;
|
|
8
7
|
export declare function queryWorkadventure<T extends keyof IframeQueryMap>(content: IframeQuery<T>): Promise<IframeQueryMap[T]["answer"]>;
|
|
9
|
-
export interface IframeCallback<Key extends keyof IframeResponseEventMap, T = IframeResponseEventMap[Key], Guard = z.ZodType<T>> {
|
|
10
|
-
typeChecker: Guard;
|
|
11
|
-
callback: (payloadData: T) => void;
|
|
12
|
-
}
|
|
13
|
-
export interface IframeCallbackContribution<Key extends keyof IframeResponseEventMap> extends IframeCallback<Key> {
|
|
14
|
-
type: Key;
|
|
15
|
-
}
|
|
16
8
|
/**
|
|
17
9
|
* !! be aware that the implemented attributes (addMethodsAtRoot and subObjectIdentifier) must be readonly
|
|
18
10
|
*
|
|
19
11
|
*
|
|
20
12
|
*/
|
|
21
13
|
export declare abstract class IframeApiContribution<T extends {
|
|
22
|
-
callbacks:
|
|
14
|
+
callbacks: unknown[];
|
|
23
15
|
}> {
|
|
24
16
|
abstract callbacks: T["callbacks"];
|
|
25
17
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Subject } from "rxjs";
|
|
2
|
+
import { CreateAreaEvent, ModifyAreaEvent } from "../Events/CreateAreaEvent";
|
|
3
|
+
import { Area } from "./Area/Area";
|
|
4
|
+
import { IframeApiContribution } from "./IframeApiContribution";
|
|
5
|
+
export declare class WorkadventureAreaCommands extends IframeApiContribution<WorkadventureAreaCommands> {
|
|
6
|
+
callbacks: ({
|
|
7
|
+
type: "enterAreaEvent";
|
|
8
|
+
callback: (event: {
|
|
9
|
+
name: string;
|
|
10
|
+
}) => void;
|
|
11
|
+
} | {
|
|
12
|
+
type: "leaveAreaEvent";
|
|
13
|
+
callback: (event: {
|
|
14
|
+
name: string;
|
|
15
|
+
}) => void;
|
|
16
|
+
})[];
|
|
17
|
+
create(createAreaEvent: CreateAreaEvent): Area;
|
|
18
|
+
get(name: string): Promise<Area>;
|
|
19
|
+
delete(name: string): Promise<void>;
|
|
20
|
+
modify(modifyAreaEvent: ModifyAreaEvent): void;
|
|
21
|
+
onEnter(areaName: string): Subject<void>;
|
|
22
|
+
onLeave(areaName: string): Subject<void>;
|
|
23
|
+
}
|
|
24
|
+
declare const _default: WorkadventureAreaCommands;
|
|
25
|
+
export default _default;
|
package/Api/iframe/camera.d.ts
CHANGED
|
@@ -2,7 +2,16 @@ import { IframeApiContribution } from "./IframeApiContribution";
|
|
|
2
2
|
import { Subject } from "rxjs";
|
|
3
3
|
import type { WasCameraUpdatedEvent } from "../Events/WasCameraUpdatedEvent";
|
|
4
4
|
export declare class WorkAdventureCameraCommands extends IframeApiContribution<WorkAdventureCameraCommands> {
|
|
5
|
-
callbacks:
|
|
5
|
+
callbacks: {
|
|
6
|
+
type: "wasCameraUpdated";
|
|
7
|
+
callback: (event: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
zoom: number;
|
|
13
|
+
}) => void;
|
|
14
|
+
}[];
|
|
6
15
|
set(x: number, y: number, width?: number, height?: number, lock?: boolean, smooth?: boolean): void;
|
|
7
16
|
followPlayer(smooth?: boolean): void;
|
|
8
17
|
onCameraUpdate(): Subject<WasCameraUpdatedEvent>;
|
package/Api/iframe/chat.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { IframeApiContribution } from "./IframeApiContribution";
|
|
2
2
|
export declare class WorkadventureChatCommands extends IframeApiContribution<WorkadventureChatCommands> {
|
|
3
|
-
callbacks:
|
|
3
|
+
callbacks: {
|
|
4
|
+
type: "userInputChat";
|
|
5
|
+
callback: (event: {
|
|
6
|
+
message: string;
|
|
7
|
+
}) => void;
|
|
8
|
+
}[];
|
|
4
9
|
sendChatMessage(message: string, author: string): void;
|
|
5
10
|
/**
|
|
6
11
|
* Listen to messages sent by the local user, in the chat.
|
package/Api/iframe/player.d.ts
CHANGED
|
@@ -9,7 +9,17 @@ export declare class WorkadventurePlayerCommands extends IframeApiContribution<W
|
|
|
9
9
|
readonly state: import("./state").WorkadventureStateCommands & {
|
|
10
10
|
[key: string]: unknown;
|
|
11
11
|
};
|
|
12
|
-
callbacks:
|
|
12
|
+
callbacks: {
|
|
13
|
+
type: "hasPlayerMoved";
|
|
14
|
+
callback: (event: {
|
|
15
|
+
oldX?: number | undefined;
|
|
16
|
+
oldY?: number | undefined;
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
direction: "left" | "right" | "up" | "down";
|
|
20
|
+
moving: boolean;
|
|
21
|
+
}) => void;
|
|
22
|
+
}[];
|
|
13
23
|
onPlayerMove(callback: HasPlayerMovedEventCallback): void;
|
|
14
24
|
get name(): string;
|
|
15
25
|
get language(): string;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { IframeCallback } from "../../Api/iframe/IframeApiContribution";
|
|
3
|
-
import type { IframeCallbackContribution } from "../../Api/iframe/IframeApiContribution";
|
|
1
|
+
import { IframeResponseEvent } from "../../Api/Events/IframeEvent";
|
|
4
2
|
export declare const registeredCallbacks: {
|
|
5
|
-
[K in
|
|
3
|
+
[K in IframeResponseEvent["type"]]?: (event: Extract<IframeResponseEvent, {
|
|
4
|
+
type: K;
|
|
5
|
+
}>["data"]) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function apiCallback<T extends IframeResponseEvent["type"]>(callbackData: {
|
|
8
|
+
type: T;
|
|
9
|
+
callback: (event: Extract<IframeResponseEvent, {
|
|
10
|
+
type: T;
|
|
11
|
+
}>["data"]) => void;
|
|
12
|
+
}): {
|
|
13
|
+
type: T;
|
|
14
|
+
callback: (event: Extract<IframeResponseEvent, {
|
|
15
|
+
type: T;
|
|
16
|
+
}>["data"]) => void;
|
|
6
17
|
};
|
|
7
|
-
export declare function apiCallback<T extends keyof IframeResponseEventMap>(callbackData: IframeCallbackContribution<T>): IframeCallbackContribution<keyof IframeResponseEventMap>;
|
package/Api/iframe/room.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Subject } from "rxjs";
|
|
|
2
2
|
import { IframeApiContribution } from "./IframeApiContribution";
|
|
3
3
|
import type { ITiledMap } from "../../Phaser/Map/ITiledMap";
|
|
4
4
|
import type { WorkadventureRoomWebsiteCommands } from "./website";
|
|
5
|
+
import { WorkadventureAreaCommands } from "./area";
|
|
5
6
|
interface TileDescriptor {
|
|
6
7
|
x: number;
|
|
7
8
|
y: number;
|
|
@@ -11,7 +12,27 @@ interface TileDescriptor {
|
|
|
11
12
|
export declare const setRoomId: (id: string) => void;
|
|
12
13
|
export declare const setMapURL: (url: string) => void;
|
|
13
14
|
export declare class WorkadventureRoomCommands extends IframeApiContribution<WorkadventureRoomCommands> {
|
|
14
|
-
callbacks:
|
|
15
|
+
callbacks: ({
|
|
16
|
+
type: "enterEvent";
|
|
17
|
+
callback: (event: {
|
|
18
|
+
name: string;
|
|
19
|
+
}) => void;
|
|
20
|
+
} | {
|
|
21
|
+
type: "leaveEvent";
|
|
22
|
+
callback: (event: {
|
|
23
|
+
name: string;
|
|
24
|
+
}) => void;
|
|
25
|
+
} | {
|
|
26
|
+
type: "enterLayerEvent";
|
|
27
|
+
callback: (event: {
|
|
28
|
+
name: string;
|
|
29
|
+
}) => void;
|
|
30
|
+
} | {
|
|
31
|
+
type: "leaveLayerEvent";
|
|
32
|
+
callback: (event: {
|
|
33
|
+
name: string;
|
|
34
|
+
}) => void;
|
|
35
|
+
})[];
|
|
15
36
|
/**
|
|
16
37
|
* @deprecated Use onEnterLayer instead
|
|
17
38
|
*/
|
|
@@ -31,6 +52,7 @@ export declare class WorkadventureRoomCommands extends IframeApiContribution<Wor
|
|
|
31
52
|
get mapURL(): string;
|
|
32
53
|
loadTileset(url: string): Promise<number>;
|
|
33
54
|
get website(): WorkadventureRoomWebsiteCommands;
|
|
55
|
+
get area(): WorkadventureAreaCommands;
|
|
34
56
|
}
|
|
35
57
|
declare const _default: WorkadventureRoomCommands;
|
|
36
58
|
export default _default;
|
package/Api/iframe/state.d.ts
CHANGED
|
@@ -6,7 +6,14 @@ export declare class WorkadventureStateCommands extends IframeApiContribution<Wo
|
|
|
6
6
|
private variables;
|
|
7
7
|
private variableSubscribers;
|
|
8
8
|
constructor(target: "global" | "player");
|
|
9
|
-
callbacks:
|
|
9
|
+
callbacks: {
|
|
10
|
+
type: "setVariable";
|
|
11
|
+
callback: (event: {
|
|
12
|
+
value?: unknown;
|
|
13
|
+
key: string;
|
|
14
|
+
target: "global" | "player";
|
|
15
|
+
}) => void;
|
|
16
|
+
}[];
|
|
10
17
|
initVariables(_variables: Map<string, unknown>): void;
|
|
11
18
|
saveVariable(key: string, value: unknown): Promise<void>;
|
|
12
19
|
loadVariable(key: string): unknown;
|
package/Api/iframe/ui.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Popup } from "./Ui/Popup";
|
|
|
4
4
|
import { ActionMessage } from "./Ui/ActionMessage";
|
|
5
5
|
import { Menu } from "./Ui/Menu";
|
|
6
6
|
import type { RequireOnlyOne } from "../types";
|
|
7
|
+
import { RemotePlayerClickedEvent } from "../Events/RemotePlayerClickedEvent";
|
|
7
8
|
import { Observable, Subject } from "rxjs";
|
|
8
9
|
import type { UIWebsiteCommands } from "./Ui/UIWebsite";
|
|
9
10
|
interface MenuDescriptor {
|
|
@@ -17,13 +18,12 @@ export interface ActionMessageOptions {
|
|
|
17
18
|
type?: "message" | "warning";
|
|
18
19
|
callback: () => void;
|
|
19
20
|
}
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
private id;
|
|
21
|
+
export declare class RemotePlayer {
|
|
22
|
+
readonly id: number;
|
|
23
|
+
readonly uuid: string;
|
|
24
|
+
readonly name: string;
|
|
25
25
|
private actions;
|
|
26
|
-
constructor(
|
|
26
|
+
constructor(remotePlayer: RemotePlayerClickedEvent);
|
|
27
27
|
addAction(key: string, callback: Function): ActionsMenuAction;
|
|
28
28
|
callAction(key: string): void;
|
|
29
29
|
removeAction(key: string): void;
|
|
@@ -37,11 +37,40 @@ export declare class ActionsMenuAction {
|
|
|
37
37
|
remove(): void;
|
|
38
38
|
}
|
|
39
39
|
export declare class WorkAdventureUiCommands extends IframeApiContribution<WorkAdventureUiCommands> {
|
|
40
|
-
readonly _onRemotePlayerClicked: Subject<
|
|
41
|
-
readonly onRemotePlayerClicked: Observable<
|
|
40
|
+
readonly _onRemotePlayerClicked: Subject<RemotePlayer>;
|
|
41
|
+
readonly onRemotePlayerClicked: Observable<RemotePlayer>;
|
|
42
42
|
private currentlyClickedRemotePlayer?;
|
|
43
43
|
constructor();
|
|
44
|
-
callbacks:
|
|
44
|
+
callbacks: ({
|
|
45
|
+
type: "buttonClickedEvent";
|
|
46
|
+
callback: (event: {
|
|
47
|
+
popupId: number;
|
|
48
|
+
buttonId: number;
|
|
49
|
+
}) => void;
|
|
50
|
+
} | {
|
|
51
|
+
type: "menuItemClicked";
|
|
52
|
+
callback: (event: {
|
|
53
|
+
menuItem: string;
|
|
54
|
+
}) => void;
|
|
55
|
+
} | {
|
|
56
|
+
type: "messageTriggered";
|
|
57
|
+
callback: (event: {
|
|
58
|
+
uuid: string;
|
|
59
|
+
}) => void;
|
|
60
|
+
} | {
|
|
61
|
+
type: "remotePlayerClickedEvent";
|
|
62
|
+
callback: (event: {
|
|
63
|
+
id: number;
|
|
64
|
+
name: string;
|
|
65
|
+
uuid: string;
|
|
66
|
+
}) => void;
|
|
67
|
+
} | {
|
|
68
|
+
type: "actionsMenuActionClickedEvent";
|
|
69
|
+
callback: (event: {
|
|
70
|
+
id: number;
|
|
71
|
+
actionName: string;
|
|
72
|
+
}) => void;
|
|
73
|
+
})[];
|
|
45
74
|
addActionsMenuKeyToRemotePlayer(id: number, actionKey: string): void;
|
|
46
75
|
removeActionsMenuKeyFromRemotePlayer(id: number, actionKey: string): void;
|
|
47
76
|
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup;
|