@league-of-foundry-developers/foundry-vtt-types 0.8.9-7 → 0.8.9-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/index-lenient.d.ts +10 -0
  2. package/package.json +10 -1
  3. package/src/foundry/common/abstract/backend.mjs.d.ts +14 -15
  4. package/src/foundry/common/abstract/document.mjs.d.ts +6 -2
  5. package/src/foundry/common/types.mjs.d.ts +5 -0
  6. package/src/foundry/foundry.js/application.d.ts +2 -5
  7. package/src/foundry/foundry.js/applications/cameraViews.d.ts +36 -31
  8. package/src/foundry/foundry.js/applications/compendium.d.ts +5 -2
  9. package/src/foundry/foundry.js/applications/filePicker.d.ts +115 -115
  10. package/src/foundry/foundry.js/applications/formApplication.d.ts +1 -1
  11. package/src/foundry/foundry.js/applications/formApplications/combatTrackerConfig.d.ts +20 -27
  12. package/src/foundry/foundry.js/applications/formApplications/defaultTokenConfig.d.ts +66 -0
  13. package/src/foundry/foundry.js/applications/formApplications/documentSheets/activeEffectConfig.d.ts +2 -2
  14. package/src/foundry/foundry.js/applications/formApplications/documentSheets/actorSheet.d.ts +5 -2
  15. package/src/foundry/foundry.js/applications/formApplications/{folderConfig.d.ts → documentSheets/folderConfig.d.ts} +2 -2
  16. package/src/foundry/foundry.js/applications/formApplications/documentSheets/index.d.ts +3 -0
  17. package/src/foundry/foundry.js/applications/formApplications/documentSheets/measuredTemplateConfig.d.ts +60 -0
  18. package/src/foundry/foundry.js/applications/formApplications/documentSheets/noteConfig.d.ts +72 -0
  19. package/src/foundry/foundry.js/applications/formApplications/documentSheets/rollTableConfig.d.ts +190 -148
  20. package/src/foundry/foundry.js/applications/formApplications/documentSheets/sceneConfig.d.ts +133 -110
  21. package/src/foundry/foundry.js/applications/formApplications/drawingConfig.d.ts +93 -95
  22. package/src/foundry/foundry.js/applications/formApplications/entitySheetConfig.d.ts +163 -147
  23. package/src/foundry/foundry.js/applications/formApplications/index.d.ts +1 -3
  24. package/src/foundry/foundry.js/applications/formApplications/moduleManagement.d.ts +41 -23
  25. package/src/foundry/foundry.js/applications/formApplications/settingsConfig.d.ts +95 -86
  26. package/src/foundry/foundry.js/applications/formApplications/tokenConfig.d.ts +146 -158
  27. package/src/foundry/foundry.js/applications/formApplications/wallConfig.d.ts +60 -70
  28. package/src/foundry/foundry.js/applications/formApplications/worldConfig.d.ts +25 -17
  29. package/src/foundry/foundry.js/applications/hotbar.d.ts +5 -4
  30. package/src/foundry/foundry.js/applications/sceneNavigation.d.ts +90 -71
  31. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/actorDirectory.d.ts +13 -56
  32. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/itemDirectory.d.ts +7 -30
  33. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/journalDirectory.d.ts +14 -34
  34. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/macroDirectory.d.ts +6 -52
  35. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/sceneDirectory.d.ts +6 -23
  36. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectory.d.ts +2 -4
  37. package/src/foundry/foundry.js/cameraPopoutAppWrapper.d.ts +12 -7
  38. package/src/foundry/foundry.js/canvas.d.ts +2 -1
  39. package/src/foundry/foundry.js/clientDatabaseBackend.d.ts +210 -0
  40. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/tokenDocument.d.ts +1 -1
  41. package/src/foundry/foundry.js/clientDocuments/index.d.ts +1 -0
  42. package/src/foundry/foundry.js/clientDocuments/prototypeToken.d.ts +15 -0
  43. package/src/foundry/foundry.js/clientSettings.d.ts +14 -1
  44. package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +44 -11
  45. package/src/foundry/foundry.js/config.d.ts +12 -4
  46. package/src/foundry/foundry.js/dragDrop.d.ts +17 -14
  47. package/src/foundry/foundry.js/globalVariables.d.ts +7 -4
  48. package/src/foundry/foundry.js/mouseInteractionManager.d.ts +78 -34
  49. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayer.d.ts +5 -17
  50. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/wallsLayer.d.ts +1 -1
  51. package/src/foundry/foundry.js/pixi/containers/placeableObject.d.ts +4 -1
  52. package/src/foundry/foundry.js/pixi/containers/placeableObjects/wall.d.ts +1 -1
  53. package/src/foundry/foundry.js/pointSource.d.ts +173 -85
  54. package/src/foundry/foundry.js/textEditor.d.ts +39 -8
  55. package/src/foundry/index.d.ts +1 -0
  56. package/src/foundry/foundry.js/applications/formApplications/measuredTemplateConfig.d.ts +0 -61
  57. package/src/foundry/foundry.js/applications/formApplications/noteConfig.d.ts +0 -77
@@ -1,9 +1,6 @@
1
1
  /**
2
2
  * Handle mouse interaction events for a Canvas object.
3
3
  * There are three phases of events: hover, click, and drag
4
- * @typeParam O - Canvas object this instance handles events for
5
- * @typeParam T - Target object for mouseinteraction events. Generally a `ControlIcon` or `O`.
6
- * (default: `O`)
7
4
  *
8
5
  * Hover Events:
9
6
  * _handleMouseOver
@@ -33,22 +30,24 @@
33
30
  * _handleDragCancel
34
31
  * action: dragLeftCancel
35
32
  * action: dragRightCancel
33
+ *
34
+ * @typeParam Object - The concrete {@link PIXI.Container} object that for which mouse interactions are being managed
36
35
  */
37
- declare class MouseInteractionManager<O extends PIXI.Container = PIXI.Container, T extends PIXI.Container = O> {
36
+ declare class MouseInteractionManager<Object extends PIXI.Container = PIXI.Container> {
38
37
  /**
39
38
  * @param permissions - (default: `{}`)
40
39
  * @param callbacks - (default: `{}`)
41
40
  * @param options - (default: `{}`)
42
41
  */
43
42
  constructor(
44
- object: O,
43
+ object: Object,
45
44
  layer: MouseInteractionManager['layer'],
46
45
  permissions?: MouseInteractionManager['permissions'],
47
46
  callbacks?: MouseInteractionManager['callbacks'],
48
47
  options?: MouseInteractionManager['options']
49
48
  );
50
49
 
51
- object: O;
50
+ object: Object;
52
51
 
53
52
  layer: PIXI.Container;
54
53
 
@@ -56,24 +55,25 @@ declare class MouseInteractionManager<O extends PIXI.Container = PIXI.Container,
56
55
  * @defaultValue `{}`
57
56
  */
58
57
  permissions: Partial<
59
- Record<MouseInteractionManager.EventNames, ((user: User, event: PIXI.InteractionEvent) => boolean) | boolean>
58
+ Record<
59
+ MouseInteractionManager.PermissionAction,
60
+ ((user: Game['user'], event: PIXI.InteractionEvent) => boolean) | boolean
61
+ >
60
62
  >;
61
63
 
62
64
  /**
63
65
  * @defaultValue `{}`
64
66
  */
65
- callbacks: Partial<
66
- Record<MouseInteractionManager.EventNames, ((event: Event | PIXI.InteractionEvent) => unknown) | null>
67
- >;
67
+ callbacks: Partial<Record<MouseInteractionManager.Action, ((event: Event | PIXI.InteractionEvent) => void) | null>>;
68
68
 
69
69
  /**
70
70
  * @defaultValue `{}`
71
71
  */
72
- options: { target?: string[] | string | null };
72
+ options: MouseInteractionManager.Options;
73
73
 
74
74
  /**
75
75
  * The current interaction state
76
- * @defaultValue `0`
76
+ * @defaultValue `MouseInteractionManager.INTERACTION_STATES.NONE`
77
77
  */
78
78
  state: ValueOf<typeof MouseInteractionManager['INTERACTION_STATES']>;
79
79
 
@@ -82,7 +82,10 @@ declare class MouseInteractionManager<O extends PIXI.Container = PIXI.Container,
82
82
  * @defaultValue `{}`
83
83
  */
84
84
  handlers: Partial<
85
- Record<'contextmenu' | 'mousedown' | 'mousemove' | 'mouseout' | 'mouseover' | 'mouseup' | 'rightdown', Function>
85
+ Record<
86
+ 'contextmenu' | 'mousedown' | 'mousemove' | 'mouseout' | 'mouseover' | 'mouseup' | 'rightdown',
87
+ (event: PIXI.InteractionEvent | MouseEvent) => void
88
+ >
86
89
  >;
87
90
 
88
91
  /**
@@ -94,6 +97,7 @@ declare class MouseInteractionManager<O extends PIXI.Container = PIXI.Container,
94
97
  /**
95
98
  * The throttling time below which a mouse move event will not be handled
96
99
  * @defaultValue `Math.ceil(1000 / canvas.app.ticker.maxFPS)`
100
+ * @internal
97
101
  */
98
102
  protected _dragThrottleMS: number;
99
103
 
@@ -115,11 +119,31 @@ declare class MouseInteractionManager<O extends PIXI.Container = PIXI.Container,
115
119
  */
116
120
  protected _dragRight: boolean;
117
121
 
122
+ /**
123
+ * An optional ControlIcon instance for the object
124
+ */
125
+ controlIcon: ControlIcon | undefined;
126
+
127
+ /**
128
+ * Enumerate the states of a mouse interaction workflow.
129
+ * 0: NONE - the object is inactive
130
+ * 1: HOVER - the mouse is hovered over the object
131
+ * 2: CLICKED - the object is clicked
132
+ * 3: DRAG - the object is being dragged
133
+ * 4: DROP - the object is being dropped
134
+ */
135
+ static INTERACTION_STATES: {
136
+ NONE: 0;
137
+ HOVER: 1;
138
+ CLICKED: 2;
139
+ DRAG: 3;
140
+ DROP: 4;
141
+ };
142
+
118
143
  /**
119
144
  * Get the target
120
- * @returns `this.object` or `this.object[this.options.target]`
121
145
  */
122
- get target(): T;
146
+ get target(): PIXI.Container;
123
147
 
124
148
  /**
125
149
  * Activate interactivity for the handled object
@@ -132,14 +156,14 @@ declare class MouseInteractionManager<O extends PIXI.Container = PIXI.Container,
132
156
  * @param event - The event being handled
133
157
  * @returns Can the action be performed?
134
158
  */
135
- can(action: MouseInteractionManager.EventNames, event: Event | PIXI.InteractionEvent): boolean;
159
+ can(action: MouseInteractionManager.PermissionAction, event: Event | PIXI.InteractionEvent): boolean;
136
160
 
137
161
  /**
138
162
  * Execute a callback function associated with a certain action in the workflow
139
163
  * @param action - The action being attempted
140
164
  * @param event - The event being handled
141
165
  */
142
- callback(action: MouseInteractionManager.EventNames, event: Event | PIXI.InteractionEvent): unknown;
166
+ callback(action: MouseInteractionManager.Action, event: Event | PIXI.InteractionEvent): unknown;
143
167
 
144
168
  /**
145
169
  * A reference to the possible interaction states which can be observed
@@ -148,132 +172,152 @@ declare class MouseInteractionManager<O extends PIXI.Container = PIXI.Container,
148
172
 
149
173
  /**
150
174
  * Activate a set of listeners which handle hover events on the target object
175
+ * @internal
151
176
  */
152
177
  protected _activateHoverEvents(): void;
153
178
 
154
179
  /**
155
180
  * Activate a new set of listeners for click events on the target object
181
+ * @internal
156
182
  */
157
183
  protected _activateClickEvents(): void;
158
184
 
159
185
  /**
160
186
  * Deactivate event listeners for click events on the target object
187
+ * @internal
161
188
  */
162
189
  protected _deactivateClickEvents(): void;
163
190
 
164
191
  /**
165
192
  * Activate events required for handling a drag-and-drop workflow
193
+ * @internal
166
194
  */
167
195
  protected _activateDragEvents(): void;
168
196
 
169
197
  /**
170
198
  * Deactivate events required for handling drag-and-drop workflow.
199
+ * @internal
171
200
  */
172
201
  protected _deactivateDragEvents(): void;
173
202
 
174
203
  /**
175
204
  * Handle mouse-over events which activate downstream listeners and do not stop propagation.
205
+ * @internal
176
206
  */
177
207
  protected _handleMouseOver(event: PIXI.InteractionEvent): unknown;
178
208
 
179
209
  /**
180
210
  * Handle mouse-out events which terminate hover workflows and do not stop propagation.
211
+ * @internal
181
212
  */
182
213
  protected _handleMouseOut(event: PIXI.InteractionEvent): unknown;
183
214
 
184
215
  /**
185
216
  * Handle mouse-down events which activate downstream listeners.
186
217
  * Stop further propagation only if the event is allowed by either single or double-click.
218
+ * @internal
187
219
  */
188
220
  protected _handleMouseDown(event: PIXI.InteractionEvent): unknown;
189
221
 
190
222
  /**
191
223
  * Handle mouse-down which trigger a single left-click workflow.
224
+ * @internal
192
225
  */
193
226
  protected _handleClickLeft(event: PIXI.InteractionEvent): void;
194
227
 
195
228
  /**
196
229
  * Handle mouse-down which trigger a single left-click workflow.
230
+ * @internal
197
231
  */
198
232
  protected _handleClickLeft2(event: PIXI.InteractionEvent): unknown;
199
233
 
200
234
  /**
201
235
  * Handle right-click mouse-down events.
202
236
  * Stop further propagation only if the event is allowed by either single or double-click.
237
+ * @internal
203
238
  */
204
239
  protected _handleRightDown(event: PIXI.InteractionEvent): unknown;
205
240
 
206
241
  /**
207
242
  * Handle single right-click actions.
243
+ * @internal
208
244
  */
209
245
  protected _handleClickRight(event: PIXI.InteractionEvent): void;
210
246
 
211
247
  /**
212
248
  * Handle double right-click actions.
249
+ * @internal
213
250
  */
214
251
  protected _handleClickRight2(event: PIXI.InteractionEvent): unknown;
215
252
 
216
253
  /**
217
254
  * Handle mouse movement during a drag workflow
255
+ * @internal
218
256
  */
219
257
  protected _handleMouseMove(event: PIXI.InteractionEvent): unknown;
220
258
 
221
259
  /**
222
260
  * Handle the beginning of a new drag start workflow, moving all controlled objects on the layer
261
+ * @internal
223
262
  */
224
263
  protected _handleDragStart(event: PIXI.InteractionEvent): unknown;
225
264
 
226
265
  /**
227
266
  * Handle the continuation of a drag workflow, moving all controlled objects on the layer
267
+ * @internal
228
268
  */
229
269
  protected _handleDragMove(event: PIXI.InteractionEvent): unknown;
230
270
 
231
271
  /**
232
272
  * Handle mouse up events which may optionally conclude a drag workflow
273
+ * @internal
233
274
  */
234
275
  protected _handleMouseUp(event: PIXI.InteractionEvent): void;
235
276
 
236
277
  /**
237
278
  * Handle the conclusion of a drag workflow, placing all dragged objects back on the layer
279
+ * @internal
238
280
  */
239
281
  protected _handleDragDrop(event: PIXI.InteractionEvent): void;
240
282
 
241
283
  /**
242
284
  * Handle the cancellation of a drag workflow, resetting back to the original state
285
+ * @internal
243
286
  */
244
- protected _handleDragCancel(event: PointerEvent): void;
287
+ protected _handleDragCancel(event: MouseEvent): void;
245
288
 
246
289
  /**
247
- * Enumerate the states of a mouse interaction workflow.
248
- * 0: NONE - the object is inactive
249
- * 1: HOVER - the mouse is hovered over the object
250
- * 2: CLICKED - the object is clicked
251
- * 3: DRAG - the object is being dragged
252
- * 4: DROP - the object is being dropped
290
+ * A public method to cancel a current interaction workflow from this manager.
291
+ * @param event - The event that initiates the cancellation
253
292
  */
254
- static INTERACTION_STATES: {
255
- NONE: 0;
256
- HOVER: 1;
257
- CLICKED: 2;
258
- DRAG: 3;
259
- DROP: 4;
260
- };
293
+ cancel(event: Event): void;
261
294
  }
262
295
 
263
296
  declare namespace MouseInteractionManager {
264
- type EventNames =
297
+ type PermissionAction =
265
298
  | 'clickLeft'
266
299
  | 'clickLeft2'
267
300
  | 'clickRight'
268
301
  | 'clickRight2'
269
- | 'dragLeftCancel'
270
302
  | 'dragLeftDrop'
271
303
  | 'dragLeftMove'
272
304
  | 'dragLeftStart'
273
- | 'dragRightCancel'
274
305
  | 'dragRightDrop'
275
306
  | 'dragRightMove'
276
307
  | 'dragRightStart'
277
308
  | 'hoverIn'
278
309
  | 'hoverOut';
310
+
311
+ type Action = PermissionAction | 'dragLeftCancel' | 'dragRightCancel';
312
+
313
+ interface Options {
314
+ /**
315
+ * @remarks If set, this must be the name of a property of the object that is a {@link PIXI.Container}.
316
+ */
317
+ target?: string | null;
318
+
319
+ dragResistance?: number;
320
+ }
279
321
  }
322
+
323
+ declare const a: PIXI.Container;
@@ -273,7 +273,7 @@ declare global {
273
273
  * @param event - (unused)
274
274
  * @see {@link Canvas#_onClickLeft}
275
275
  */
276
- protected _onClickLeft(event: PIXI.InteractionEvent): number | void;
276
+ protected _onClickLeft(event: PIXI.InteractionEvent): void;
277
277
 
278
278
  /**
279
279
  * Handle double left-click events which originate from the Canvas stage and are dispatched to this Layer.
@@ -285,9 +285,8 @@ declare global {
285
285
  /**
286
286
  * Start a left-click drag workflow originating from the Canvas stage.
287
287
  * @see {@link Canvas#_onDragLeftStart}
288
- * @remarks This returns Promise<void> but is overridden by some subclasses.
289
288
  */
290
- protected _onDragLeftStart(event: PIXI.InteractionEvent): Promise<void | PlaceableObject>;
289
+ protected _onDragLeftStart(event: PIXI.InteractionEvent): void;
291
290
 
292
291
  /**
293
292
  * Continue a left-click drag workflow originating from the Canvas stage.
@@ -298,11 +297,8 @@ declare global {
298
297
  /**
299
298
  * Conclude a left-click drag workflow originating from the Canvas stage.
300
299
  * @see {@link Canvas#_onDragLeftDrop}
301
- * @remarks Returns always a promise but is overridden in subclasses.
302
300
  */
303
- protected _onDragLeftDrop(
304
- event: PIXI.InteractionEvent
305
- ): Promise<InstanceType<ConfiguredDocumentClassForName<DocumentName>> | void> | void;
301
+ protected _onDragLeftDrop(event: PIXI.InteractionEvent): void;
306
302
 
307
303
  /**
308
304
  * Cancel a left-click drag workflow originating from the Canvas stage.
@@ -322,23 +318,15 @@ declare global {
322
318
  * Handle mouse-wheel events at the PlaceableObjects layer level to rotate multiple objects at once.
323
319
  * This handler will rotate all controlled objects by some incremental angle.
324
320
  * @param event - The mousewheel event which originated the request
325
- * @remarks This methods just returns ReturnType\<this['rotateMany']\>|void but is overridden by subclasses
326
321
  */
327
- protected _onMouseWheel(
328
- event: WheelEvent
329
- ):
330
- | ReturnType<this['rotateMany']>
331
- | ReturnType<InstanceType<ConfiguredObjectClassForName<DocumentName>>['rotate']>
332
- | void;
322
+ protected _onMouseWheel(event: WheelEvent): void;
333
323
 
334
324
  /**
335
325
  * Handle a DELETE keypress while a placeable object is hovered
336
326
  * @param event - The delete key press event which triggered the request
337
327
  * (unused)
338
328
  */
339
- protected _onDeleteKey(
340
- event?: any
341
- ): Promise<InstanceType<ConfiguredDocumentClassForName<DocumentName>>[] | undefined>;
329
+ protected _onDeleteKey(event?: any): void;
342
330
 
343
331
  /**
344
332
  * @deprecated since 0.8.0
@@ -196,7 +196,7 @@ declare global {
196
196
  | this['_cloneType'];
197
197
 
198
198
  /** @override */
199
- protected _onDragLeftStart(event: PIXI.InteractionEvent): Promise<Wall>;
199
+ protected _onDragLeftStart(event: PIXI.InteractionEvent): void;
200
200
 
201
201
  /** @override */
202
202
  protected _onDragLeftMove(event: PIXI.InteractionEvent): void;
@@ -17,6 +17,9 @@ declare global {
17
17
  */
18
18
  constructor(document: D);
19
19
 
20
+ /** @internal */
21
+ protected _original?: this | undefined;
22
+
20
23
  /**
21
24
  * Retain a reference to the Scene within which this Placeable Object resides
22
25
  */
@@ -50,7 +53,7 @@ declare global {
50
53
  * A mouse interaction manager instance which handles mouse workflows related to this object.
51
54
  * @defaultValue `null`
52
55
  */
53
- mouseInteractionManager: MouseInteractionManager<this, ControlIcon | this> | null;
56
+ mouseInteractionManager: MouseInteractionManager<this> | null;
54
57
 
55
58
  /**
56
59
  * An indicator for whether the object is currently controlled
@@ -22,7 +22,7 @@ declare global {
22
22
  /**
23
23
  * @remarks Type is `MouseInteractionManager<this, this['endpoints']>`
24
24
  */
25
- mouseInteractionManager: MouseInteractionManager<this, any> | null;
25
+ mouseInteractionManager: MouseInteractionManager<this> | null;
26
26
 
27
27
  constructor(document: ConcreteWallDocument);
28
28