@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250801022737 → 13.346.0-beta.20250801172911

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 (40) hide show
  1. package/package.json +1 -1
  2. package/src/configuration/hooks.d.mts +2 -1
  3. package/src/foundry/client/canvas/animation/_types.d.mts +1 -1
  4. package/src/foundry/client/canvas/animation/canvas-animation.d.mts +95 -44
  5. package/src/foundry/client/canvas/animation/chat-bubbles.d.mts +79 -8
  6. package/src/foundry/client/canvas/animation/smooth-noise.d.mts +23 -8
  7. package/src/foundry/client/canvas/board.d.mts +180 -31
  8. package/src/foundry/client/canvas/groups/canvas-group-mixin.d.mts +4 -3
  9. package/src/foundry/client/canvas/groups/visibility.d.mts +104 -60
  10. package/src/foundry/client/canvas/interaction/mouse-handler.d.mts +143 -85
  11. package/src/foundry/client/canvas/interaction/ping/alert.d.mts +14 -11
  12. package/src/foundry/client/canvas/interaction/ping/arrow.d.mts +5 -5
  13. package/src/foundry/client/canvas/interaction/ping/chevron.d.mts +27 -56
  14. package/src/foundry/client/canvas/interaction/ping/ping.d.mts +22 -17
  15. package/src/foundry/client/canvas/interaction/ping/pulse.d.mts +15 -44
  16. package/src/foundry/client/canvas/interaction/render-flags.d.mts +29 -15
  17. package/src/foundry/client/canvas/interaction/ruler/base-ruler.d.mts +230 -3
  18. package/src/foundry/client/canvas/interaction/ruler/ruler.d.mts +139 -434
  19. package/src/foundry/client/canvas/layers/controls.d.mts +1 -1
  20. package/src/foundry/client/canvas/layers/masks/vision.d.mts +28 -40
  21. package/src/foundry/client/canvas/perception/detection-mode.d.mts +62 -30
  22. package/src/foundry/client/canvas/perception/detection-modes/darkvision.d.mts +3 -2
  23. package/src/foundry/client/canvas/perception/detection-modes/invisibility-perception.d.mts +8 -3
  24. package/src/foundry/client/canvas/perception/detection-modes/light-perception.d.mts +6 -5
  25. package/src/foundry/client/canvas/perception/detection-modes/super-perception.d.mts +8 -3
  26. package/src/foundry/client/canvas/perception/detection-modes/tremor-perception.d.mts +8 -3
  27. package/src/foundry/client/canvas/perception/fog.d.mts +43 -42
  28. package/src/foundry/client/canvas/perception/perception-manager.d.mts +21 -23
  29. package/src/foundry/client/canvas/perception/vision-mode.d.mts +73 -62
  30. package/src/foundry/client/canvas/placeables/tokens/ring.d.mts +2 -2
  31. package/src/foundry/client/canvas/placeables/tokens/ruler.d.mts +5 -40
  32. package/src/foundry/client/canvas/sources/base-light-source.d.mts +4 -0
  33. package/src/foundry/client/canvas/sources/point-light-source.d.mts +2 -2
  34. package/src/foundry/client/canvas/sources/rendered-effect-source.d.mts +12 -5
  35. package/src/foundry/client/config.d.mts +4 -0
  36. package/src/foundry/client/documents/user.d.mts +2 -2
  37. package/src/foundry/client/hooks.d.mts +7 -0
  38. package/src/foundry/common/grid/base.d.mts +7 -1
  39. package/src/foundry/common/utils/color.d.mts +2 -1
  40. package/src/foundry/common/utils/event-emitter.d.mts +2 -1
@@ -1,78 +1,99 @@
1
- import type { AnyArray, Brand, Identity, NullishProps } from "#utils";
1
+ import type { AnyArray, Brand, Identity, InexactPartial } from "#utils";
2
2
  import type { ControlIcon } from "#client/canvas/containers/_module.d.mts";
3
+ import type { Canvas } from "#client/canvas/_module.d.mts";
3
4
 
4
5
  /**
5
6
  * Handle mouse interaction events for a Canvas object.
6
7
  * There are three phases of events: hover, click, and drag
7
8
  *
8
9
  * Hover Events:
9
- * _handlePointerOver
10
- * action: hoverIn
11
- * _handlePointerOut
12
- * action: hoverOut
10
+ * - _handlePointerOver
11
+ * - action: hoverIn
12
+ * - _handlePointerOut
13
+ * - action: hoverOut
13
14
  *
14
15
  * Left Click and Double-Click
15
- * _handlePointerDown
16
- * action: clickLeft
17
- * action: clickLeft2
18
- * action: unclickLeft
16
+ * - _handlePointerDown
17
+ * - action: clickLeft
18
+ * - action: clickLeft2
19
+ * - action: unclickLeft
19
20
  *
20
21
  * Right Click and Double-Click
21
- * _handleRightDown
22
- * action: clickRight
23
- * action: clickRight2
24
- * action: unclickRight
22
+ * - _handleRightDown
23
+ * - action: clickRight
24
+ * - action: clickRight2
25
+ * - action: unclickRight
25
26
  *
26
27
  * Drag and Drop
27
- * _handlePointerMove
28
- * action: dragLeftStart
29
- * action: dragRightStart
30
- * action: dragLeftMove
31
- * action: dragRightMove
32
- * _handlePointerUp
33
- * action: dragLeftDrop
34
- * action: dragRightDrop
35
- * _handleDragCancel
36
- * action: dragLeftCancel
37
- * action: dragRightCancel
28
+ * - _handlePointerMove
29
+ * - action: dragLeftStart
30
+ * - action: dragRightStart
31
+ * - action: dragLeftMove
32
+ * - action: dragRightMove
33
+ * - _handlePointerUp
34
+ * - action: dragLeftDrop
35
+ * - action: dragRightDrop
36
+ * - _handleDragCancel
37
+ * - action: dragLeftCancel
38
+ * - action: dragRightCancel
38
39
  */
39
40
  declare class MouseInteractionManager<ObjectFor extends PIXI.Container = PIXI.Container> {
40
41
  /**
41
- * @param permissions - (default: `{}`)
42
- * @param callbacks - (default: `{}`)
43
- * @param options - (default: `{}`)
44
- * @remarks Foundry does not provide type information for the constructor, everything here is inferred from usage
42
+ * @param object - The Canvas object (e.g., a Token, Tile, or Drawing) to which mouse events should be bound.
43
+ * @param layer - The Canvas Layer that contains the object.
44
+ * @param permissions - An object of permission checks, keyed by action name, which return a boolean or invoke a function for whether the action is allowed. (default: `{}`)
45
+ * @param callbacks - An object of callback functions, keyed by action name, which will be executed during the event workflow (e.g., `hoverIn`, `clickLeft`). (default: `{}`)
46
+ * @param options - Additional options that configure interaction behavior. (default: `{}`)
47
+ *
48
+ * @remarks Foundry types `object` as {@linkcode PIXI.DisplayObject}, but only ever passes a {@linkcode placeables.PlaceableObject | PlaceableObject}
49
+ * (in {@linkcode placeables.PlaceableObject._createInteractionManager | #_createInteractionManager}) or the {@linkcode Canvas.stage | canvas.stage}
50
+ * (in `Canvas##addListeners`), so it's typed as {@linkcode PIXI.Container} here.
51
+ *
52
+ * `layer` is described as if it's a {@linkcode foundry.canvas.layers.CanvasLayer | CanvasLayer}, but Foundry always passes the {@linkcode Canvas.stage | canvas.stage}
45
53
  */
46
54
  constructor(
47
55
  object: ObjectFor,
48
56
  layer: PIXI.Container,
49
- permissions?: MouseInteractionManager.Permissions,
50
- callbacks?: MouseInteractionManager.Callbacks,
57
+ permissions?: MouseInteractionManager.Permissions<ObjectFor>,
58
+ callbacks?: MouseInteractionManager.Callbacks<ObjectFor>,
51
59
  options?: MouseInteractionManager.Options,
52
60
  );
53
61
 
62
+ /**
63
+ * The Canvas object (e.g., a Token, Tile, or Drawing) to which mouse events should be bound.
64
+ * @remarks See remarks on {@linkcode MouseInteractionManager | MouseInteractionManager#constructor}
65
+ */
54
66
  object: ObjectFor;
55
67
 
68
+ /**
69
+ * The Canvas Layer that contains the object.
70
+ * @remarks Despite the above description, in core usage this is always the {@linkcode Canvas.stage | canvas.stage}
71
+ */
56
72
  layer: PIXI.Container;
57
73
 
58
74
  /**
75
+ * An object of permission checks, keyed by action name, which return a boolean or invoke a function for whether the action is allowed.
59
76
  * @defaultValue `{}`
60
77
  */
78
+ // TODO: This should be MouseInteractionManager.Permissions<ObjectFor> but that causes circularities in all placeables
61
79
  permissions: MouseInteractionManager.Permissions;
62
80
 
63
81
  /**
82
+ * An object of callback functions, keyed by action name, which will be executed during the event workflow (e.g., `hoverIn`, `clickLeft`).
64
83
  * @defaultValue `{}`
65
84
  */
85
+ // TODO: This should be MouseInteractionManager.Callbacks<ObjectFor> but that causes circularities in all placeables
66
86
  callbacks: MouseInteractionManager.Callbacks;
67
87
 
68
88
  /**
89
+ * Interaction options which configure handling workflows
69
90
  * @defaultValue `{}`
70
91
  */
71
92
  options: MouseInteractionManager.Options;
72
93
 
73
94
  /**
74
95
  * The current interaction state
75
- * @defaultValue `MouseInteractionManager.INTERACTION_STATES.NONE`
96
+ * @defaultValue {@linkcode MouseInteractionManager.INTERACTION_STATES.NONE}
76
97
  */
77
98
  state: MouseInteractionManager.INTERACTION_STATES;
78
99
 
@@ -103,17 +124,20 @@ declare class MouseInteractionManager<ObjectFor extends PIXI.Container = PIXI.Co
103
124
  /**
104
125
  * A flag for whether we are right-click dragging
105
126
  * @defaultValue `false`
127
+ * @internal
106
128
  */
107
- _dragRight: boolean;
129
+ protected _dragRight: boolean;
108
130
 
109
131
  /**
110
132
  * An optional ControlIcon instance for the object
111
133
  */
134
+ // TODO: can this be inferred from ObjectFor without introducing circularities?
112
135
  controlIcon: ControlIcon | null;
113
136
 
114
137
  /**
115
138
  * The view id pertaining to the PIXI Application.
116
- * If not provided, default to canvas.app.view.id
139
+ * If not provided, default to `canvas.app.view.id`
140
+ * @remarks Despite the above there is actually no opportunity to pass any other value
117
141
  */
118
142
  viewId: string;
119
143
 
@@ -124,15 +148,22 @@ declare class MouseInteractionManager<ObjectFor extends PIXI.Container = PIXI.Co
124
148
 
125
149
  /**
126
150
  * Enumerate the states of a mouse interaction workflow.
127
- * 0: NONE - the object is inactive
128
- * 1: HOVER - the mouse is hovered over the object
129
- * 2: CLICKED - the object is clicked
130
- * 3: GRABBED - the object is grabbed
131
- * 4: DRAG - the object is being dragged
132
- * 5: DROP - the object is being dropped
151
+ * - `0`: `NONE` - the object is inactive
152
+ * - `1`: `HOVER` - the mouse is hovered over the object
153
+ * - `2`: `CLICKED` - the object is clicked
154
+ * - `3`: `GRABBED` - the object is grabbed
155
+ * - `4`: `DRAG` - the object is being dragged
156
+ * - `5`: `DROP` - the object is being dropped
133
157
  */
134
158
  static INTERACTION_STATES: MouseInteractionManager.InteractionStates;
135
159
 
160
+ /**
161
+ * The minimum distance, measured in screen-coordinate pixels, that a pointer must move to initiate a drag operation.
162
+ * This default value can be overridden by specifying the `dragResistance` option when invoking the constructor.
163
+ * @defaultValue `10`
164
+ */
165
+ static DEFAULT_DRAG_RESISTANCE_PX: number;
166
+
136
167
  /**
137
168
  * The maximum number of milliseconds between two clicks to be considered a double-click.
138
169
  * @defaultValue `250`
@@ -154,19 +185,23 @@ declare class MouseInteractionManager<ObjectFor extends PIXI.Container = PIXI.Co
154
185
  /**
155
186
  * Global timeout for the long-press event.
156
187
  * @defaultValue `null`
188
+ * @remarks Set in `##handleLeftDown` to the return from a `setTimeout` call, which gets cleared by that and various other handlers
157
189
  */
158
190
  static longPressTimeout: number | null;
159
191
 
160
192
  /**
161
- * Emulate a pointermove event. Needs to be called when an object with the static event mode
162
- * or any of its parents is transformed or its visibility is changed.
193
+ * Emulate a pointermove event on the main game canvas.
194
+ * This method must be called when an object with the static event mode or any of its parents is transformed
195
+ * or its visibility is changed.
163
196
  */
164
197
  static emulateMoveEvent(): void;
165
198
 
166
199
  /**
167
200
  * Get the target.
201
+ * @remarks Returns the {@linkcode ControlIcon} if one is in use and the appropriate {@linkcode MouseInteractionManager.Options.target | options.target} was passed,
202
+ * otherwise {@linkcode MouseInteractionManager.object | this.object}
168
203
  */
169
- get target(): PIXI.DisplayObject;
204
+ get target(): ObjectFor | ControlIcon;
170
205
 
171
206
  /**
172
207
  * Is this mouse manager in a dragging state?
@@ -183,8 +218,9 @@ declare class MouseInteractionManager<ObjectFor extends PIXI.Container = PIXI.Co
183
218
  * @param action - The action being attempted
184
219
  * @param event - The event being handled
185
220
  * @returns Can the action be performed?
221
+ * @remarks See {@linkcode MouseInteractionManager.PermissionFunction}
186
222
  */
187
- can(action: MouseInteractionManager.PermissionAction, event: MouseInteractionManager.Event): boolean;
223
+ can(action: MouseInteractionManager.PermissionAction, event: MouseInteractionManager.Event<ObjectFor>): boolean;
188
224
 
189
225
  /**
190
226
  * Execute a callback function associated with a certain action in the workflow
@@ -192,10 +228,15 @@ declare class MouseInteractionManager<ObjectFor extends PIXI.Container = PIXI.Co
192
228
  * @param event - The event being handled
193
229
  * @param args - Additional callback arguments.
194
230
  * @returns A boolean which may indicate that the event was handled by the callback.
195
- * Events which do not specify a callback are assumed to have been handled as no-op.
196
- * @remarks
231
+ * Events which do not specify a callback are assumed to have been handled as no-op.
232
+ * @remarks See {@linkcode MouseInteractionManager.CallbackFunction}
197
233
  */
198
- callback(action: MouseInteractionManager.Action, event: MouseInteractionManager.Event, ...args: AnyArray): boolean;
234
+ callback(
235
+ action: MouseInteractionManager.Action,
236
+ event: MouseInteractionManager.Event<ObjectFor>,
237
+ // TODO: Possibly limit `args` to what's valid for the given `action`
238
+ ...args: AnyArray
239
+ ): boolean;
199
240
 
200
241
  /**
201
242
  * A reference to the possible interaction states which can be observed
@@ -215,7 +256,7 @@ declare class MouseInteractionManager<ObjectFor extends PIXI.Container = PIXI.Co
215
256
  * @remarks Note that the event has specific `interactionData` it expects. A valid `event` can be
216
257
  * fairly involved to create from scratch.
217
258
  */
218
- handleEvent(event: MouseInteractionManager.Event): boolean;
259
+ handleEvent(event: MouseInteractionManager.Event<ObjectFor>): boolean;
219
260
 
220
261
  /**
221
262
  * A public method to cancel a current interaction workflow from this manager.
@@ -224,7 +265,7 @@ declare class MouseInteractionManager<ObjectFor extends PIXI.Container = PIXI.Co
224
265
  * @remarks Note that the event has specific `interactionData` it expects. A valid `event` can be
225
266
  * fairly involved to create from scratch.
226
267
  */
227
- cancel(event: MouseInteractionManager.Event): void;
268
+ cancel(event: MouseInteractionManager.Event<ObjectFor>): void;
228
269
 
229
270
  /**
230
271
  * Reset the mouse manager.
@@ -241,31 +282,32 @@ declare namespace MouseInteractionManager {
241
282
 
242
283
  interface HandlerOutcomes {
243
284
  /** -2: SKIPPED - the handler has been skipped by previous logic */
244
- SKIPPED: -2 & MouseInteractionManager.HANDLER_OUTCOMES;
285
+ SKIPPED: -2 & HANDLER_OUTCOMES;
245
286
 
246
- /** -1: DISALLOWED - the handler has dissallowed further process */
247
- DISALLOWED: -1 & MouseInteractionManager.HANDLER_OUTCOMES;
287
+ /** -1: DISALLOWED - the handler has disallowed further process */
288
+ DISALLOWED: -1 & HANDLER_OUTCOMES;
248
289
 
249
290
  /** 1: REFUSED - the handler callback has been processed and is refusing further process */
250
- REFUSED: 1 & MouseInteractionManager.HANDLER_OUTCOMES;
291
+ REFUSED: 1 & HANDLER_OUTCOMES;
251
292
 
252
293
  /** 2: ACCEPTED - the handler callback has been processed and is accepting further process */
253
- ACCEPTED: 2 & MouseInteractionManager.HANDLER_OUTCOMES;
294
+ ACCEPTED: 2 & HANDLER_OUTCOMES;
254
295
  }
255
296
 
256
297
  type INTERACTION_STATES = Brand<number, "MouseInteractionManager.INTERACTION_STATES">;
257
298
 
258
299
  interface InteractionStates {
259
- NONE: 0 & MouseInteractionManager.INTERACTION_STATES;
260
- HOVER: 1 & MouseInteractionManager.INTERACTION_STATES;
261
- CLICKED: 2 & MouseInteractionManager.INTERACTION_STATES;
262
- GRABBED: 3 & MouseInteractionManager.INTERACTION_STATES;
263
- DRAG: 4 & MouseInteractionManager.INTERACTION_STATES;
264
- DROP: 5 & MouseInteractionManager.INTERACTION_STATES;
300
+ NONE: 0 & INTERACTION_STATES;
301
+ HOVER: 1 & INTERACTION_STATES;
302
+ CLICKED: 2 & INTERACTION_STATES;
303
+ GRABBED: 3 & INTERACTION_STATES;
304
+ DRAG: 4 & INTERACTION_STATES;
305
+ DROP: 5 & INTERACTION_STATES;
265
306
  }
266
307
 
267
308
  /**
268
- * @remarks The list of actions provided by foundry, minus `dragXCancel`, `unclickX`, and `longPress`, which do not check permissions
309
+ * @remarks The list of actions provided by foundry, minus `dragXCancel`, `unclickX`, and `longPress`,
310
+ * whose handler functions never call {@linkcode MouseInteractionManager.can | #can}
269
311
  */
270
312
  type PermissionAction =
271
313
  | "clickLeft"
@@ -281,45 +323,64 @@ declare namespace MouseInteractionManager {
281
323
  | "hoverIn"
282
324
  | "hoverOut";
283
325
 
284
- type PermissionFunction = (user: User.Implementation, event: MouseInteractionManager.Event) => boolean;
326
+ type PermissionFunction<ObjectFor extends PIXI.Container = PIXI.Container> = (
327
+ this: ObjectFor,
328
+ user: User.Implementation,
329
+ event: MouseInteractionManager.Event<ObjectFor>,
330
+ ) => boolean;
285
331
 
286
- type Permissions = Partial<Record<PermissionAction, PermissionFunction | boolean>>;
332
+ /** @remarks All values that aren't `boolean` or {@linkcode PermissionFunction} are treated as `true`, i.e, "always allow" */
333
+ interface Permissions<ObjectFor extends PIXI.Container = PIXI.Container>
334
+ extends InexactPartial<Record<PermissionAction, PermissionFunction<ObjectFor> | boolean>> {}
287
335
 
288
336
  /**
289
337
  * @remarks The full list of possible callback actions.
290
- *
291
- * Three actions get additional, non-event arguments passed by Foundry:
292
- * - `hoverIn` on all placeables takes `options: { hoverOutOthers: boolean }` to trigger hover-out behavior on sibling objects
293
- * - For Regions specifically, `hoverOut` takes an `options: { updateLegend: boolean }` object, and that key is also added to Region `hoverIn` options
294
- * - `longPress` receives `origin: PIXI.Point`
295
338
  */
296
339
  type Action = PermissionAction | "dragLeftCancel" | "dragRightCancel" | "unclickLeft" | "unclickRight" | "longPress";
297
340
 
298
341
  /**
299
- * @remarks Only three actions get additional, non-event arguments passed by Foundry:
300
- * - `hoverIn` on all placeables takes `options: { hoverOutOthers: boolean }` to trigger hover-out behavior on sibling objects
301
- * - For Regions specifically, `hoverOut` takes an `options: { updateLegend: boolean }` object, and that key is also added to Region `hoverIn` options
342
+ * @remarks Returning `false` indicates the callback fully handled the event and no further action should be taken.
343
+ *
344
+ * Only three actions get additional, non-event arguments passed by Foundry:
345
+ * - `hoverIn` on all placeables takes {@linkcode PlaceableObject.HoverInOptions | options: PlaceableObject.HoverInOptions} to trigger hover-out behavior on sibling objects
346
+ * - `hoverOut` on {@linkcode foundry.canvas.placeables.Region | Region}s only takes {@linkcode foundry.canvas.placeables.Region.HoverOutOptions | options: Region.HoverOutOptions},
347
+ * and that key is also added to Region `hoverIn` options
302
348
  * - `longPress` receives `origin: PIXI.Point`
303
349
  */
304
- type CallbackFunction = (event: MouseInteractionManager.Event, ...args: never) => boolean | null | void;
350
+ type CallbackFunction<ObjectFor extends PIXI.Container = PIXI.Container> = (
351
+ this: ObjectFor,
352
+ event: MouseInteractionManager.Event<ObjectFor>,
353
+ ...args: never
354
+ ) => boolean | void;
305
355
 
306
- type Callbacks = Partial<Record<Action, CallbackFunction>>;
356
+ /**
357
+ * @remarks Any callbacks not provided effectively default to `() => true`
358
+ *
359
+ * See {@linkcode CallbackFunction}
360
+ */
361
+ interface Callbacks<ObjectFor extends PIXI.Container = PIXI.Container>
362
+ extends InexactPartial<Record<Action, CallbackFunction<ObjectFor>>> {}
307
363
 
308
364
  /** @internal */
309
- type _Options = NullishProps<{
365
+ type _Options = InexactPartial<{
310
366
  /**
311
- * @remarks If passed, will set `this.controlIcon` to `Object[target]`; in practice, this should only be `null` or `"controlIcon"`
312
- * @privateRemarks Despite Foundry typing this as `PIXI.DisplayObject` its one use in practice is as `string | null`
367
+ * If provided, the property name on `object` which references a {@linkcode foundry.canvas.containers.ControlIcon | ControlIcon}.
368
+ * This is used to set {@linkcode MouseInteractionManager.controlIcon | MouseInteractionManager#controlIcon}.
369
+ * @remarks In practice, this should only be `"controlIcon"` or omitted
313
370
  */
314
- target: string | null;
371
+ // TODO: Can we limit this to `PropertiesOfType<ObjectFor, ControlIcon>` without introducing circularities?
372
+ target: PropertyKey;
315
373
 
316
374
  /**
317
- * @remarks If falsey, gets replaced with `(canvas.dimensions.size / 4)`
375
+ * A minimum number of pixels the mouse must move before a drag is initiated.
376
+ * @defaultValue {@linkcode MouseInteractionManager.DEFAULT_DRAG_RESISTANCE_PX}
377
+ * @remarks Gets replaced with the above default if falsey when read in `MouseInteractionManager##handlePointerMove`
318
378
  */
319
379
  dragResistance: number;
320
380
 
321
381
  /**
322
- * @remarks Undocumented. Used in the constructor as `this.viewId = (this.options.application ?? canvas.app).view.id`, never passed in practice
382
+ * A specific {@linkcode PIXI.Application} to use for pointer event handling. Defaults to
383
+ * {@linkcode Canvas.app | canvas.app} if not provided.
323
384
  */
324
385
  application: PIXI.Application;
325
386
  }>;
@@ -330,7 +391,7 @@ declare namespace MouseInteractionManager {
330
391
  interface Options extends _Options {}
331
392
 
332
393
  /** @internal */
333
- type _ResetOptions = NullishProps<{
394
+ type _ResetOptions = InexactPartial<{
334
395
  /**
335
396
  * Reset the interaction data?
336
397
  * @defaultValue `true`
@@ -346,13 +407,10 @@ declare namespace MouseInteractionManager {
346
407
 
347
408
  interface ResetOptions extends _ResetOptions {}
348
409
 
349
- interface InteractionData<T extends PIXI.DisplayObject> {
350
- origin?: PIXI.Point | undefined;
351
- destination?: PIXI.Point | undefined;
352
- object?: T | undefined;
353
- }
410
+ interface InteractionData<ObjectFor extends PIXI.Container = PIXI.Container>
411
+ extends Pick<Canvas.Event.InteractionData<ObjectFor>, "object" | "origin" | "screenOrigin" | "destination"> {}
354
412
 
355
- type Event = foundry.canvas.Canvas.Event._Base | globalThis.Event;
413
+ type Event<ObjectFor extends PIXI.Container = PIXI.Container> = Canvas.Event._Base<ObjectFor>;
356
414
  }
357
415
 
358
416
  export default MouseInteractionManager;
@@ -1,5 +1,6 @@
1
- import type { Identity } from "#utils";
1
+ import type { Identity, InexactPartial } from "#utils";
2
2
  import type { PulsePing } from "#client/canvas/interaction/_module.d.mts";
3
+ import type { Canvas } from "#client/canvas/_module.d.mts";
3
4
 
4
5
  /**
5
6
  * A type of ping that produces a pulse warning sign animation.
@@ -9,26 +10,28 @@ declare class AlertPing extends PulsePing {
9
10
  * @param origin - The canvas coordinates of the origin of the ping.
10
11
  * @param options - Additional options to configure the ping animation.
11
12
  */
12
- constructor(origin: PIXI.Point, options: AlertPing.ConstructorOptions);
13
+ constructor(origin: Canvas.Point, options?: AlertPing.ConstructorOptions);
13
14
 
14
- protected override _drawShape(g: PIXI.Graphics, color: number | Color, alpha: number, size: number): void;
15
+ protected override _drawShape(g: PIXI.Graphics, color: number, alpha: number, size: number): void;
15
16
  }
16
17
 
17
18
  declare namespace AlertPing {
18
19
  interface Any extends AnyAlertPing {}
19
20
  interface AnyConstructor extends Identity<typeof AnyAlertPing> {}
20
21
 
21
- /** @privateRemarks Only exists to change the default value of `color` */
22
- interface ConstructorOptions extends PulsePing.ConstructorOptions {
22
+ /**
23
+ * Only exists to change the default value of `color`
24
+ * @internal
25
+ */
26
+ type _ConstructorOptions = InexactPartial<{
23
27
  /**
28
+ * The color of the ping graphic.
24
29
  * @defaultValue `"#ff0000"`
25
- * @remarks Can't be `null` or `undefined` because `options` is `mergeObject`ed with an object with this key,
26
- * and passing either to `Color.from` produces a `Color(NaN)`, which may cause breakage in subclasses or when
27
- * passed to PIXI methods
28
- * @privateRemarks Typing this as `Ping.ConstructorOptions["color"]` breaks, because it thinks `| undefined` has snuck in for unknown reasons
29
30
  */
30
- color?: Color.Source;
31
- }
31
+ color: Color.Source;
32
+ }>;
33
+
34
+ interface ConstructorOptions extends Omit<PulsePing.ConstructorOptions, "color">, _ConstructorOptions {}
32
35
  }
33
36
 
34
37
  export default AlertPing;
@@ -1,5 +1,6 @@
1
- import type { Identity, NullishProps } from "#utils";
1
+ import type { Identity, InexactPartial } from "#utils";
2
2
  import type { PulsePing } from "#client/canvas/interaction/_module.d.mts";
3
+ import type { Canvas } from "#client/canvas/_module.d.mts";
3
4
 
4
5
  /**
5
6
  * A type of ping that produces an arrow pointing in a given direction.
@@ -9,12 +10,12 @@ declare class ArrowPing extends PulsePing {
9
10
  * @param origin - The canvas coordinates of the origin of the ping. This becomes the arrow's tip.
10
11
  * @param options - Additional options to configure the ping animation.
11
12
  */
12
- constructor(origin: PIXI.Point, options?: ArrowPing.ConstructorOptions);
13
+ constructor(origin: Canvas.Point, options?: ArrowPing.ConstructorOptions);
13
14
 
14
15
  // @privateRemarks The `options` property does not get overridden here as the `rotation` key does not
15
16
  // get passed up to super, so it's still just `PulsePing.Constructor.Options`
16
17
 
17
- protected override _drawShape(g: PIXI.Graphics, color: number | Color, alpha: number, size: number): void;
18
+ protected override _drawShape(g: PIXI.Graphics, color: number, alpha: number, size: number): void;
18
19
  }
19
20
 
20
21
  declare namespace ArrowPing {
@@ -22,11 +23,10 @@ declare namespace ArrowPing {
22
23
  interface AnyConstructor extends Identity<typeof AnyArrowPing> {}
23
24
 
24
25
  /** @internal */
25
- type _ConstructorOptions = NullishProps<{
26
+ type _ConstructorOptions = InexactPartial<{
26
27
  /**
27
28
  * The angle of the arrow in radians.
28
29
  * @defaultValue `0`
29
- * @privateRemarks Null coercion to `0` is fine here, as it's only added to then passed to `Math.normalizeRadians`
30
30
  */
31
31
  rotation: number;
32
32
  }>;
@@ -9,81 +9,52 @@ import type { Ping } from "#client/canvas/interaction/_module.d.mts";
9
9
  declare class ChevronPing extends Ping {
10
10
  /**
11
11
  * @param origin - The canvas coordinates of the origin of the ping.
12
- * @param options - Additional options to configure the ping animation.
13
- * (default: `{duration: 900, size: 128, color: "#ff6400"}`)
12
+ * @param options - Additional options to configure the ping animation. (default: see {@linkcode Ping.ConstructorOptions})
14
13
  */
15
- constructor(
16
- origin: Canvas.Point,
14
+ constructor(origin: Canvas.Point, options?: Ping.ConstructorOptions);
17
15
 
18
- /** @privateRemarks Can't be `null` as it's directly assigned to `Ping#options` which has properties accessed null-unsafely */
19
- options?: Ping.ConstructorOptions,
20
- );
16
+ /** @deprecated Made hard private in v13 (this warning will be removed in v14) */
17
+ _r: never;
21
18
 
22
- /** @defaultValue `(this.options.size / 2) * .75` */
23
- _r: number;
19
+ /** @deprecated Made hard private in v13 (this warning will be removed in v14) */
20
+ _rInner: never;
24
21
 
25
- /**
26
- * The inner ring is 3/4s the size of the outer.
27
- * @defaultValue `this._r * .75`
28
- */
29
- _rInner: number;
22
+ /** @deprecated Made hard private in v13 (this warning will be removed in v14) */
23
+ _t14: never;
30
24
 
31
- /**
32
- * The animation is split into three stages. First, the chevron fades in and moves downwards, then the rings fade
33
- * in, then everything fades out as the chevron moves back up.
34
- * Store the 1/4 time slice.
35
- * @defaultValue `this.options.duration * .25`
36
- */
37
- _t14: number;
25
+ /** @deprecated Made hard private in v13 (this warning will be removed in v14) */
26
+ _t12: never;
38
27
 
39
- /**
40
- * Store the 1/2 time slice.
41
- * @defaultValue `this.options.duration * .5`
42
- */
43
- _t12: number;
28
+ /** @deprecated Made hard private in v13 (this warning will be removed in v14) */
29
+ _t34: never;
44
30
 
45
- /**
46
- * Store the 3/4s time slice.
47
- * @defaultValue `this._t14 * 3`
48
- */
49
- _t34: number;
31
+ /** @deprecated Made hard private in v13 (this warning will be removed in v14) */
32
+ _inner: never;
50
33
 
51
- /** @remarks Doesn't exist before the first `#_createRings()` call, usually via `#animate()` */
52
- _inner?: PIXI.Graphics;
53
-
54
- /** @remarks Doesn't exist before the first `#_createRings()` call, usually via `#animate()` */
55
- _outer?: PIXI.Graphics;
34
+ /** @deprecated Made hard private in v13 (this warning will be removed in v14) */
35
+ _outer: never;
56
36
 
57
37
  /**
58
38
  * The path to the chevron texture.
39
+ * @defaultValue `"icons/pings/chevron.webp"`
59
40
  * @remarks Unusually for Foundry, this is referred to by `ChevronPing.`, not `this.constructor.`, in
60
- * `#_loadChevron()`, which must therefore be overridden to use a different value in a subclass
61
- * @privateRemarks Foundry marked `@private`.
41
+ * `##loadChevron`, so subclasses *cannot* specify other values, and changing this value affects *all*
42
+ * chevrons.
62
43
  */
63
- static _CHEVRON_PATH: string;
44
+ static CHEVRON_PATH: string;
64
45
 
65
46
  override animate(): Promise<boolean>;
66
47
 
67
- override _animateFrame(dt: number, animation: CanvasAnimation.AnimationData): void;
48
+ protected override _animateFrame(dt: number, animation: CanvasAnimation.AnimationData<this>): void;
68
49
 
69
- /**
70
- * Draw the outer and inner rings.
71
- * @param a - The alpha.
72
- * @privateRemarks Foundry marked `@private`
73
- */
74
- _drawRings(a: number): void;
50
+ /** @deprecated Made hard private in v13 (this warning will be removed in v14) */
51
+ _drawRings(a: never): never;
75
52
 
76
- /**
77
- * Load the chevron texture.
78
- * @privateRemarks Foundry marked `@private`
79
- */
80
- _loadChevron(): Promise<PIXI.Sprite>;
53
+ /** @deprecated Made hard private in v13 (this warning will be removed in v14) */
54
+ _loadChevron(): never;
81
55
 
82
- /**
83
- * Draw the two rings that are used as part of the ping animation.
84
- * @privateRemarks Foundry marked `@private`
85
- */
86
- _createRings(): [PIXI.Graphics, PIXI.Graphics];
56
+ /** @deprecated Made hard private in v13 (this warning will be removed in v14) */
57
+ _createRings(): never;
87
58
  }
88
59
 
89
60
  declare namespace ChevronPing {