@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250731052244 → 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,503 +1,208 @@
1
- import type { Brand, FixedInstanceType, Identity, IntentionalPartial, NullishProps } from "#utils";
2
- import type { Canvas } from "#client/canvas/_module.d.mts";
3
- import type { GridHighlight, PreciseText } from "#client/canvas/containers/_module.mjs";
1
+ import type { FixedInstanceType, Identity, InexactPartial } from "#utils";
4
2
  import type { Ray } from "#client/canvas/geometry/_module.d.mts";
5
- import type { Token } from "#client/canvas/placeables/_module.d.mts";
3
+ import type { BaseRuler } from "../_module.d.mts";
4
+ import type { BaseGrid } from "#common/grid/_module.d.mts";
6
5
 
7
6
  /**
8
- * The Ruler - used to measure distances and trigger movements
7
+ * The default implementation of the Ruler.
9
8
  */
10
- declare class Ruler extends PIXI.Container {
11
- /**
12
- * @param user - The User for whom to construct the Ruler instance
13
- * (default: `game.user`)
14
- * @param options - Additional options
15
- */
16
- constructor(user?: User.Implementation, options?: Ruler.ConstructorOptions);
17
-
18
- /**
19
- * Record the User which this Ruler references
20
- * @defaultValue `game.user`
21
- */
22
- user: User.Implementation;
23
-
24
- /**
25
- * The ruler name - used to differentiate between players
26
- * @defaultValue `"Ruler." + user.id`
27
- */
28
- name: string;
29
-
30
- /**
31
- * The ruler color - by default the color of the active user
32
- * @defaultValue `this.user.color`
33
- */
34
- color: Color;
35
-
36
- /**
37
- * The Ruler element is a Graphics instance which draws the line and points of the measured path
38
- */
39
- ruler: PIXI.Graphics;
40
-
41
- /**
42
- * The Labels element is a Container of Text elements which label the measured path
43
- */
44
- labels: PIXI.Container;
45
-
46
- /**
47
- * The possible Ruler measurement states.
48
- */
49
- static get STATES(): Ruler.States;
50
-
51
- /**
52
- * Is the ruler ready for measure?
53
- */
54
- static get canMeasure(): boolean;
55
-
56
- /**
57
- * The current destination point at the end of the measurement
58
- * @defaultValue `null`
59
- */
60
- destination: Canvas.Point | null;
61
-
62
- /**
63
- * The origin point of the measurement, which is the first waypoint.
64
- * @defaultValue `null`
65
- */
66
- get origin(): Canvas.Point | null;
67
-
68
- /**
69
- * This Array tracks individual waypoints along the ruler's measured path.
70
- * The first waypoint is always the origin of the route.
71
- * @defaultValue `[]`
72
- */
73
- waypoints: Canvas.Point[];
74
-
75
- /**
76
- * The array of most recently computed ruler measurement segments
77
- * @defaultValue `[]`
78
- */
79
- segments: Ruler.MeasurementSegment[];
80
-
81
- /**
82
- * The measurement history.
83
- */
84
- get history(): Ruler.MeasurementHistory;
85
-
86
- /**
87
- * The computed total distance of the Ruler.
88
- * @defaultValue `0`
89
- */
90
- totalDistance: number;
91
-
92
- /**
93
- * The computed total cost of the Ruler.
94
- * @defaultValue `0`
95
- */
96
- totalCost: number;
9
+ declare class Ruler extends BaseRuler {
10
+ constructor(user: User.Implementation);
97
11
 
98
12
  /**
99
- * The current state of the Ruler (one of {@linkcode Ruler.States}).
13
+ * A handlebars template used to render each waypoint label.
14
+ * @defaultValue `"templates/hud/waypoint-label.hbs"`
100
15
  */
101
- get state(): Ruler.STATES;
16
+ static WAYPOINT_LABEL_TEMPLATE: string;
102
17
 
103
18
  /**
104
- * The current state of the Ruler (one of {@linkcode Ruler.States}).
105
- * @defaultValue `Ruler.STATES.INACTIVE`
19
+ * Configure the properties of the outline.
20
+ * Called in {@linkcode Ruler.draw | Ruler#draw}.
21
+ * @returns The thickness in pixels and the color
106
22
  */
107
- protected _state: Ruler.STATES;
23
+ protected _configureOutline(): Ruler.ConfigureOutlineReturn;
108
24
 
109
- /**
110
- * Is the Ruler being actively used to measure distance?
111
- */
112
- get active(): boolean;
113
-
114
- /**
115
- * Get a GridHighlight layer for this Ruler
116
- */
117
- get highlightLayer(): GridHighlight;
118
-
119
- /**
120
- * The Token that is moved by the Ruler.
121
- */
122
- get token(): Token.Implementation | null;
123
-
124
- /**
125
- * Clear display of the current Ruler
126
- */
127
- clear(): void;
128
-
129
- /**
130
- * Measure the distance between two points and render the ruler UI to illustrate it
131
- * @param destination - The destination point to which to measure
132
- * @param options - Additional options
133
- * @returns The array of measured segments if measured
134
- */
135
- measure(
136
- destination: Canvas.Point,
137
- options?: Ruler.MeasureOptions, // not:null (destructured)
138
- ): Ruler.MeasurementSegment[] | void;
139
-
140
- /**
141
- * Get the measurement origin.
142
- * @param point - The waypoint
143
- * @param options - Additional options
144
- */
145
- protected _getMeasurementOrigin(
146
- point: Canvas.Point,
147
- options?: Ruler.GetMeasurementOriginOptions, // not:null (destructured)
148
- ): Canvas.Point;
149
-
150
- /**
151
- * While measurement is in progress, update the destination to be the central point of the target grid space.
152
- * @param point - The point coordinates
153
- * @param options - Additional options
154
- * @returns The snapped destination point
155
- */
156
- protected _getMeasurementDestination(
157
- point: Canvas.Point,
158
- options?: Ruler.GetMeasurementDestinationOptions, // not:null (destructured)
159
- ): Canvas.Point;
160
-
161
- /**
162
- * Translate the waypoints and destination point of the Ruler into an array of Ray segments.
163
- * @returns The segments of the measured path
164
- */
165
- protected _getMeasurementSegments(): Ruler.MeasurementSegment[];
166
-
167
- /**
168
- * Handle the start of a Ruler measurement workflow
169
- * @param origin - The origin
170
- * @param options - Additional options
171
- */
172
- protected _startMeasurement(
173
- origin: Canvas.Point,
174
- options?: Ruler.StartMeasurementOptions, // not:null (destructured)
175
- ): void;
176
-
177
- /**
178
- * Handle the conclusion of a Ruler measurement workflow
179
- */
180
- protected _endMeasurement(): void;
181
-
182
- /**
183
- * Handle the addition of a new waypoint in the Ruler measurement path
184
- * @param point - The waypoint
185
- * @param options - Additional options
186
- */
187
- protected _addWaypoint(
188
- point: Canvas.Point,
189
- options?: Ruler.AddWaypointOptions, // not:null (destructured)
190
- ): void;
191
-
192
- /**
193
- * Handle the removal of a waypoint in the Ruler measurement path
194
- */
195
- protected _removeWaypoint(): void;
25
+ override draw(): Promise<void>;
196
26
 
197
- /**
198
- * Get the cost function to be used for Ruler measurements.
199
- * @remarks Just a stub in v12.331
200
- */
201
- protected _getCostFunction(): foundry.grid.BaseGrid.MeasurePathCostFunction2D | void;
27
+ override destroy(): void;
202
28
 
203
- /**
204
- * Compute the distance of each segment and the total distance of the measured path.
205
- */
206
- protected _computeDistance(): void;
29
+ protected override _refresh(): void;
207
30
 
208
31
  /**
209
- * Get the text label for a segment of the measured path
32
+ * Get the context used to render a ruler waypoint label
33
+ * @remarks `Ruler##renderWaypointLabels` always starts by passing an empty object for `state`, but the parameter itself has no default
210
34
  */
211
- protected _getSegmentLabel(segment: Ruler.PartialSegmentForLabelling): string;
35
+ protected _getWaypointLabelContext(
36
+ waypoint: Ruler.Waypoint,
37
+ state: Ruler.WaypointContextState,
38
+ ): Ruler.WaypointContext | void;
212
39
 
213
40
  /**
214
- * Draw each segment of the measured path.
41
+ * Get the style of the waypoint at the given waypoint.
42
+ * @param waypoint - The waypoint
43
+ * @returns The radius, color, and alpha of the waypoint
44
+ * @remarks `waypoint` is unused in core's implementation as of 13.346
215
45
  */
216
- protected _drawMeasuredPath(): void;
46
+ protected _getWaypointStyle(waypoint: Ruler.Waypoint): Ruler.WaypointStyle;
217
47
 
218
48
  /**
219
- * Highlight the measurement required to complete the move in the minimum number of discrete spaces
49
+ * Get the style of the segment from the previous to the given waypoint.
50
+ * @param waypoint - The waypoint
51
+ * @returns The line width, color, and alpha of the segment
52
+ * @remarks `waypoint` is unused in core's implementation as of 13.346
220
53
  */
221
- protected _highlightMeasurementSegment(segment: Ruler.PartialSegmentForHighlighting): void;
54
+ protected _getSegmentStyle(waypoint: Ruler.Waypoint): Ruler.SegmentStyle;
222
55
 
223
56
  /**
224
- * Determine whether a SPACE keypress event entails a legal token movement along a measured ruler
225
- *
226
- * @returns An indicator for whether a token was successfully moved or not. If True the event should be
227
- * prevented from propagating further, if False it should move on to other handlers.
57
+ * @deprecated "`Ruler#color` is deprecated. Use {@linkcode Ruler.user | Ruler#user#color} instead." (since v13, until v15)
58
+ * @remarks Pulling `color` from {@linkcode Ruler._getWaypointStyle | #_getWaypointStyle()} or
59
+ * {@linkcode Ruler._getSegmentStyle | #_getSegmentStyle()} as appropriate would be the more accurate replacement
228
60
  */
229
- moveToken(): Promise<boolean>;
61
+ get color(): Color;
230
62
 
231
63
  /**
232
- * Acquire a Token, if any, which is eligible to perform a movement based on the starting point of the Ruler
233
- * @param origin - The origin of the Ruler
234
- * @returns The Token that is to be moved, if any
235
- *
64
+ * @deprecated "`Ruler#ruler` is deprecated without replacement." (since v13, until v15)
236
65
  */
237
- protected _getMovementToken(origin: Canvas.Point): Token.Implementation | null;
66
+ get ruler(): PIXI.Graphics;
238
67
 
239
- /**
240
- * Get the current measurement history.
241
- * @returns The current measurement history, if any
242
- * @remarks Just a stub in v12.331
243
- */
244
- protected _getMeasurementHistory(): Ruler.MeasurementHistory | void;
245
-
246
- /**
247
- * Create the next measurement history from the current history and current Ruler state.
248
- * @returns The next measurement history
249
- */
250
- protected _createMeasurementHistory(): Ruler.MeasurementHistory;
251
-
252
- /**
253
- * Test whether a Token is allowed to execute a measured movement path.
254
- * @param token - The Token being tested
255
- * @returns Whether the movement is allowed
256
- * @throws A specific Error message used instead of returning false
257
- */
258
- protected _canMove(token: Token.Implementation): boolean;
259
-
260
- /**
261
- * Animate piecewise Token movement along the measured segment path.
262
- * @param token - The Token being animated
263
- * @returns A Promise which resolves once all animation is completed
264
- */
265
- protected _animateMovement(token: Token.Implementation): Promise<void>;
266
-
267
- /**
268
- * Update Token position and configure its animation properties for the next leg of its animation.
269
- * @param token - The Token being updated
270
- * @param segment - The measured segment being moved
271
- * @param destination - The adjusted destination coordinate
272
- * @param updateOptions - Additional options to configure the `TokenDocument` update
273
- * @returns A Promise that resolves once the animation for this segment is done
274
- */
275
- protected _animateSegment(
276
- token: Token.Implementation,
277
- segment: Ruler.PartialSegmentForAnimating,
278
- destination: Canvas.Point,
279
- updateOptions?: Ruler.PartialTokenUpdateOptions, // not:null (used as first param in mergeObject)
280
- ): Promise<void>;
281
-
282
- /**
283
- * An method which can be extended by a subclass of Ruler to define custom behaviors before a confirmed movement.
284
- * @param token - The Token that will be moving
285
- */
286
- protected _preMove(token: Token.Implementation): Promise<void>;
287
-
288
- /**
289
- * An event which can be extended by a subclass of Ruler to define custom behaviors before a confirmed movement.
290
- * @param token - The Token that finished moving
291
- */
292
- protected _postMove(token: Token.Implementation): Promise<void>;
293
-
294
- /**
295
- * Broadcast Ruler measurement if its User is the connected client.
296
- * The broadcast is throttled to 100ms.
297
- */
298
- protected _broadcastMeasurement(): void;
299
-
300
- /**
301
- * Package Ruler data to an object which can be serialized to a string.
302
- */
303
- protected _getMeasurementData(): Ruler.MeasurementData;
304
-
305
- /**
306
- * Update a Ruler instance using data provided through the cursor activity socket
307
- * @param data - Ruler data with which to update the display
308
- */
309
- update(data?: Ruler.MeasurementData | null): void;
310
-
311
- /**
312
- * Handle the beginning of a new Ruler measurement workflow
313
- * @param event - The drag start event
314
- * @see {@linkcode Canvas.#onDragLeftStart}
315
- */
316
- protected _onDragStart(event: Canvas.Event.Pointer): void;
317
-
318
- /**
319
- * Handle left-click events on the Canvas during Ruler measurement.
320
- * @param event - The pointer-down event
321
- * @see {@linkcode Canvas._onClickLeft}
322
- */
323
- protected _onClickLeft(event: Canvas.Event.Pointer): void;
324
-
325
- /**
326
- * Handle right-click events on the Canvas during Ruler measurement.
327
- * @param event - The pointer-down event
328
- * @see {@linkcode Canvas._onClickRight}
329
- */
330
- protected _onClickRight(event: Canvas.Event.Pointer): void;
331
-
332
- /**
333
- * Continue a Ruler measurement workflow for left-mouse movements on the Canvas.
334
- * @param event - The mouse move event
335
- * @see {@linkcode Canvas.#onDragLeftMove}
336
- */
337
- protected _onMouseMove(event: Canvas.Event.Pointer): void;
338
-
339
- /**
340
- * Conclude a Ruler measurement workflow by releasing the left-mouse button.
341
- * @param event - The pointer-up event
342
- * @see {@linkcode Canvas.#onDragLeftDrop}
343
- */
344
- protected _onMouseUp(event: Canvas.Event.Pointer): void;
68
+ #Ruler: true;
345
69
  }
346
70
 
347
71
  declare namespace Ruler {
348
72
  interface Any extends AnyRuler {}
349
73
  interface AnyConstructor extends Identity<typeof AnyRuler> {}
350
74
 
351
- type ImplementationClass = CONFIG["Canvas"]["rulerClass"];
352
- type Implementation = FixedInstanceType<ImplementationClass>;
353
-
354
- /** @internal */
355
- type _ConstructorOptions = NullishProps<{
356
- /**
357
- * The color of the ruler (defaults to the color of the User)
358
- * @defaultValue `this.user.color`
359
- */
360
- color?: number;
361
- }>;
362
-
363
- interface ConstructorOptions extends _ConstructorOptions {}
75
+ interface ImplementationClass extends Identity<CONFIG["Canvas"]["rulerClass"]> {}
76
+ interface Implementation extends FixedInstanceType<ImplementationClass> {}
364
77
 
365
- type STATES = Brand<number, "Ruler.STATES">;
366
-
367
- interface States {
368
- readonly INACTIVE: 0 & STATES;
369
- readonly STARTING: 1 & STATES;
370
- readonly MEASURING: 2 & STATES;
371
- readonly MOVING: 3 & STATES;
372
- }
373
-
374
- interface MeasurementSegment {
375
- /** The Ray which represents the point-to-point line segment */
376
- ray: Ray;
377
-
378
- teleport: boolean;
379
-
380
- /** The text object used to display a label for this segment */
381
- label: PreciseText;
382
-
383
- /** The measured distance of the segment */
384
- distance: number;
385
-
386
- /** The measured cost of the segment */
387
- cost: number;
388
-
389
- /** The cumulative measured distance of this segment and the segments before it */
390
- cumulativeDistance: number;
391
-
392
- /** The cumulative measured cost of this segment and the segments before it */
393
- cumulativeCost: number;
394
-
395
- /** Is this segment part of the measurement history? */
396
- history: boolean;
397
-
398
- /** Is this segment the first one after the measurement history? */
399
- first: boolean;
400
-
401
- /** Is this segment the last one? */
402
- last: boolean;
403
-
404
- /** Animation options passed to {@link TokenDocument.update | `TokenDocument#update`} */
405
- animation: TokenDocument.Database.Update["animation"];
78
+ interface ConfigureOutlineReturn {
79
+ thickness: number;
80
+ color: PIXI.ColorSource;
406
81
  }
407
82
 
408
- interface MeasurementHistoryWaypoint {
409
- /** The x-coordinate of the waypoint */
83
+ interface Waypoint {
84
+ /** The x-coordinate in pixels */
410
85
  x: number;
411
86
 
412
- /** The y-coordinate of the waypoint */
87
+ /** The y-coordinate in pixels */
413
88
  y: number;
414
89
 
415
- /** Teleported to from the previous waypoint this waypoint? */
416
- teleport: boolean;
417
-
418
- /** The cost of having moved from the previous waypoint to this waypoint */
419
- cost: number;
420
- }
421
-
422
- type MeasurementHistory = MeasurementHistoryWaypoint[];
90
+ /** The elevation in grid units */
91
+ elevation: number;
423
92
 
424
- interface MeasurementData {
425
- /** The state ({@link Ruler.state | `Ruler#state`}) */
426
- state: Ruler.STATES;
93
+ /** The index of the waypoint */
94
+ index: number;
427
95
 
428
- /** The token ID ({@link Ruler.token | `Ruler#token`}) */
429
- token: string | null;
96
+ /**
97
+ * The ray from the center point of previous to the center point of this waypoint,
98
+ * or null if there is no previous waypoint.
99
+ */
100
+ ray: Ray | null;
430
101
 
431
- /** The measurement history ({@link Ruler.history | `Ruler#history`}) */
432
- history: MeasurementHistory;
102
+ /** The measurements at this waypoint. */
103
+ measurement: BaseGrid.MeasurePathResultWaypoint;
433
104
 
434
- /** The waypoints ({@link Ruler.waypoints | `Ruler#waypoints`}) */
435
- waypoints: Canvas.Point[];
105
+ /** The previous waypoint, if any. */
106
+ previous: Waypoint;
436
107
 
437
- /** The destination ({@link Ruler.destination | `Ruler#destination`}) */
438
- destination: Canvas.Point | null;
108
+ /** The next waypoint, if any. */
109
+ next: Waypoint;
439
110
  }
440
111
 
441
- /** @internal */
442
- type _Snap = NullishProps<{
112
+ /**
113
+ * @remarks The type of the `state` param passed to {@linkcode Ruler._getWaypointLabelContext | Ruler#_getWaypointLabelContext}.
114
+ * It gets passed initially empty, and is mutated and shared between each call to that method made in `Ruler##renderWaypointLabels`.
115
+ */
116
+ interface WaypointContextState {
443
117
  /**
444
- * Snap the destination?
445
- * @defaultValue `true`
118
+ * @remarks Gets set `true` the first time a waypoint has non-`0` elevation and remains `true` from then on, within
119
+ * the context of a single `##renderWaypointLabels` call
446
120
  */
447
- snap: boolean;
448
- }>;
121
+ hasElevation?: boolean | undefined;
122
+ }
449
123
 
450
- /** @internal */
451
- type _MeasureOptions = NullishProps<{
452
- /**
453
- * If not forced and the destination matches the current destination of this ruler, no measuring is done and nothing is returned
454
- * @defaultValue `false`
455
- */
456
- force: boolean;
124
+ interface WaypointContext {
125
+ action: string;
126
+ cssClass: string;
127
+ secret: boolean;
128
+ units: string;
129
+ uiScale: number;
130
+ position: {
131
+ x: number;
132
+ y: number;
133
+ };
134
+ distance: SegmentDistance;
135
+ elevation: ElevationContext;
136
+ }
137
+
138
+ /**
139
+ * {@linkcode SegmentDistance} and {@linkcode ElevationContext} (and {@linkcode foundry.canvas.placeables.tokens.TokenRuler.SegmentCost | TokenRuler.SegmentCost})
140
+ * all will include the {@linkcode Number.signedString | .signedString()} of the difference in the property they're describing
141
+ * @internal
142
+ */
143
+ type _DeltaString = InexactPartial<{
144
+ delta: string;
457
145
  }>;
458
146
 
459
- interface MeasureOptions extends _Snap, _MeasureOptions {}
147
+ interface SegmentDistance extends _DeltaString {
148
+ total: string;
149
+ }
460
150
 
461
- interface GetMeasurementOriginOptions extends _Snap {}
151
+ interface ElevationContext extends _DeltaString {
152
+ total: number;
153
+ icon: string;
154
+ hidden: boolean;
155
+ }
462
156
 
463
- interface GetMeasurementDestinationOptions extends _Snap {}
157
+ /**
158
+ * {@linkcode WaypointStyle} and {@linkcode SegmentStyle} both have defaults applied to these properties when read in
159
+ * `Ruler##drawPath` and `TokenRuler##drawPath`, via:
160
+ * ```js
161
+ * // WaypointStyle:
162
+ * const {radius, color=0xFFFFFF, alpha=1} = this._getWaypointStyle(waypoint);
163
+ * // SegmentStyle:
164
+ * let {width, color=0xFFFFFF, alpha=1} = this._getSegmentStyle(waypoint)
165
+ * ```
166
+ * @internal
167
+ */
168
+ type _StylePropsWithDefaults = InexactPartial<{
169
+ /**
170
+ * @defaultValue `0xFFFFFF`
171
+ * @remarks The above default is the value if the implementation of {@linkcode Ruler._getWaypointStyle | Ruler#_getWaypointStyle}
172
+ * or {@linkcode foundry.canvas.placeables.tokens.TokenRuler._getWaypointStyle | TokenRuler#_getWaypointStyle} being used provides
173
+ * no value/`undefined` for this property. The effective defaults in core's implementations are {@linkcode Ruler.user | this.user.color}
174
+ * and `game.users.get(waypoint.userId)?.color ?? 0x000000`, respectively
175
+ */
176
+ color: PIXI.ColorSource;
464
177
 
465
- /** @internal */
466
- type _StartMeasurementOptions = NullishProps<{
467
178
  /**
468
- * The token that is moved (defaults to {@link Ruler#_getMovementToken})
179
+ * @defaultValue `1`
180
+ * @remarks The above default is the value if the implementation of {@linkcode Ruler._getWaypointStyle | Ruler#_getWaypointStyle}
181
+ * or {@linkcode foundry.canvas.placeables.tokens.TokenRuler._getWaypointStyle | TokenRuler#_getWaypointStyle} being used provides
182
+ * no value/`undefined` for this property. It is *also* the default value core's implementations provide in both cases.
469
183
  */
470
- token: Token.Implementation | null;
184
+ alpha: number;
471
185
  }>;
472
186
 
473
- interface StartMeasurementOptions extends _StartMeasurementOptions, _Snap {}
474
-
475
- interface AddWaypointOptions extends _Snap {}
476
-
477
- // TODO: revisit after docs v2
478
- type PartialTokenUpdateOptions = IntentionalPartial<TokenDocument.Database.Update>;
479
-
480
- // TODO: also revisit after docs v2 merges with new and improved IntentionalPartial
481
- interface PartialSegmentForLabelling
482
- extends Pick<MeasurementSegment, "teleport" | "last" | "distance">,
483
- IntentionalPartial<Omit<MeasurementSegment, "teleport" | "last" | "distance">> {}
187
+ interface WaypointStyle extends _StylePropsWithDefaults {
188
+ radius: number;
189
+ }
484
190
 
485
- interface PartialSegmentForHighlighting
486
- extends Pick<MeasurementSegment, "teleport" | "ray">,
487
- IntentionalPartial<Omit<MeasurementSegment, "teleport" | "ray">> {}
191
+ interface SegmentStyle extends _StylePropsWithDefaults {
192
+ width: number;
193
+ }
488
194
 
489
- interface PartialSegmentForAnimating
490
- extends Pick<MeasurementSegment, "teleport" | "animation">,
491
- IntentionalPartial<Omit<MeasurementSegment, "teleport" | "animation">> {}
195
+ // BaseRuler interfaces it'd be convenient to not need a second import for
196
+ export import RENDER_FLAGS = foundry.canvas.interaction.BaseRuler.RENDER_FLAGS;
197
+ export import Path = foundry.canvas.interaction.BaseRuler.Path;
198
+ export import UpdateData = foundry.canvas.interaction.BaseRuler.UpdateData;
199
+ export import AddDragWaypointOptions = foundry.canvas.interaction.BaseRuler.AddDragWaypointOptions;
200
+ export import ChangeDragElevationOptions = foundry.canvas.interaction.BaseRuler.ChangeDragElevationOptions;
492
201
 
493
- /**
494
- * @deprecated Replaced by {@linkcode Ruler.ImplementationClass}.
495
- */
202
+ /** @deprecated Use {@linkcode ImplementationClass} instead */
496
203
  type ConfiguredClass = ImplementationClass;
497
204
 
498
- /**
499
- * @deprecated Replaced by {@linkcode Ruler.Implementation}.
500
- */
205
+ /** @deprecated Use {@linkcode Implementation} instead */
501
206
  type ConfiguredInstance = Implementation;
502
207
  }
503
208
 
@@ -183,7 +183,7 @@ declare class ControlsLayer extends InteractionLayer {
183
183
  * Update display of an active Ruler object for a user given provided data
184
184
  * @see {@link Ruler#update}
185
185
  */
186
- updateRuler(user: User.Implementation, rulerData?: Ruler.MeasurementData | null): void;
186
+ updateRuler(user: User.Implementation, rulerData?: Ruler.UpdateData | null): void;
187
187
 
188
188
  /**
189
189
  * Handle a broadcast ping.