@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,5 +1,5 @@
1
- import type { InterfaceToObject, NullishProps } from "#utils";
2
- import { RenderFlagsMixin, RenderFlags, RenderFlag } from "#client/canvas/interaction/_module.mjs";
1
+ import type { InexactPartial, InterfaceToObject } from "#utils";
2
+ import type { RenderFlagsMixin, RenderFlags, RenderFlag } from "#client/canvas/interaction/_module.d.mts";
3
3
 
4
4
  /**
5
5
  * A helper class which manages the refresh workflow for perception layers on the canvas.
@@ -7,9 +7,10 @@ import { RenderFlagsMixin, RenderFlags, RenderFlag } from "#client/canvas/intera
7
7
  * A singleton instance is available as {@link Canvas.perception | `Canvas#perception`}.
8
8
  */
9
9
  declare class PerceptionManager extends RenderFlagsMixin() {
10
- static RENDER_FLAGS: InterfaceToObject<PerceptionManager.RENDER_FLAGS>;
10
+ static override RENDER_FLAGS: InterfaceToObject<PerceptionManager.RENDER_FLAGS>;
11
11
 
12
- static RENDER_FLAG_PRIORITY: "PERCEPTION";
12
+ /** @defaultValue `"PERCEPTION"`*/
13
+ static override RENDER_FLAG_PRIORITY: RenderFlags.Priority;
13
14
 
14
15
  // Note: This isn't a "real" override but `renderFlags` is set corresponding to the
15
16
  // `RENDER_FLAGS` and so it has to be adjusted here.
@@ -29,23 +30,24 @@ declare class PerceptionManager extends RenderFlagsMixin() {
29
30
  initialize(): void;
30
31
 
31
32
  /**
32
- * @deprecated since v12, will be removed in v14
33
- * @remarks "PerceptionManager#refresh is deprecated in favor of assigning granular \"refresh flags\""
33
+ * @deprecated "`PerceptionManager#refresh` is deprecated in favor of assigning granular \"refresh flags\"" (since v12, until v14)
34
34
  */
35
35
  refresh(): void;
36
+
37
+ static #PerceptionManager: true;
36
38
  }
37
39
 
38
40
  declare namespace PerceptionManager {
39
41
  interface Any extends AnyPerceptionManager {}
40
42
  type AnyConstructor = typeof AnyPerceptionManager;
41
43
 
42
- type PassableFlags = NullishProps<RenderFlags>;
44
+ type PassableFlags = InexactPartial<RenderFlags>;
43
45
 
44
46
  type RenderFlags = RenderFlagsMixin.ToBooleanFlags<RENDER_FLAGS>;
45
47
 
46
48
  interface RENDER_FLAGS {
47
49
  /**
48
- * Recompute intersections between all registered edges. See {@link CanvasEdges#refresh}.
50
+ * Recompute intersections between all registered edges. See {@linkcode foundry.canvas.geometry.edges.CanvasEdges.refresh | CanvasEdges#refresh}.
49
51
  * @defaultValue `{}`
50
52
  */
51
53
  refreshEdges: RenderFlag<this, "refreshEdges">;
@@ -58,9 +60,6 @@ declare namespace PerceptionManager {
58
60
  initializeLighting: RenderFlag<this, "initializeLighting">;
59
61
 
60
62
  /** @defaultValue `{ propagate: ["refreshLighting", "refreshVision", "refreshEdges"] }` */
61
- initializeDarknessSources: RenderFlag<this, "initializeDarknessSources">;
62
-
63
- /** @defaultValue `{ propagate: ["refreshLighting", "refreshVision"] }` */
64
63
  initializeLightSources: RenderFlag<this, "initializeLightSources">;
65
64
 
66
65
  /**
@@ -76,13 +75,13 @@ declare namespace PerceptionManager {
76
75
  refreshLightSources: RenderFlag<this, "refreshLightSources">;
77
76
 
78
77
  /**
79
- * Re-initialize the entire vision modes. See {@link CanvasVisibility#initializeVisionMode}.
78
+ * Re-initialize the entire vision modes. See {@linkcode foundry.canvas.groups.CanvasVisibility.initializeVisionMode | CanvasVisibility#initializeVisionMode}.
80
79
  * @defaultValue `{ propagate: ["refreshVisionSources", "refreshLighting", "refreshPrimary"] }`
81
80
  */
82
81
  initializeVisionModes: RenderFlag<this, "initializeVisionModes">;
83
82
 
84
83
  /**
85
- * Re-initialize the entire vision configuration. See {@link CanvasVisibility#initializeSources}.
84
+ * Re-initialize the entire vision configuration. See {@linkcode foundry.canvas.groups.CanvasVisibility.initializeSources | CanvasVisibility#initializeSources}.
86
85
  * @defaultValue `{ propagate: ["initializeVisionModes", "refreshVision"] }`
87
86
  */
88
87
  initializeVision: RenderFlag<this, "initializeVision">;
@@ -100,7 +99,7 @@ declare namespace PerceptionManager {
100
99
  refreshVisionSources: RenderFlag<this, "refreshVisionSources">;
101
100
 
102
101
  /**
103
- * Refresh the contents of the PrimaryCanvasGroup mesh
102
+ * Refresh the contents of the {@linkcode foundry.canvas.groups.PrimaryCanvasGroup | PrimaryCanvasGroup} mesh
104
103
  * @defaultValue `{}`
105
104
  */
106
105
  refreshPrimary: RenderFlag<this, "refreshPrimary">;
@@ -118,7 +117,7 @@ declare namespace PerceptionManager {
118
117
  refreshOcclusionMask: RenderFlag<this, "refreshOcclusionMask">;
119
118
 
120
119
  /**
121
- * Re-initialize the entire ambient sound configuration. See {@link SoundsLayer#initializeSources}.
120
+ * Re-initialize the entire ambient sound configuration. See {@linkcode foundry.canvas.layers.SoundsLayer.initializeSources | SoundsLayer#initializeSources}.
122
121
  * @defaultValue `{ propagate: ["refreshSounds"] }`
123
122
  */
124
123
  initializeSounds: RenderFlag<this, "initializeSounds">;
@@ -136,23 +135,22 @@ declare namespace PerceptionManager {
136
135
  soundFadeDuration: RenderFlag<this, "soundFadeDuration">;
137
136
 
138
137
  /**
139
- * @defaultValue `{ propagate: ["refreshOcclusion"] }`
140
- * @deprecated since v12, will be removed in v14
138
+ * @defaultValue `{ propagate: ["refreshOcclusion"], alias: true }`
139
+ * @deprecated "The `refreshTiles` flag is deprecated in favor of `refreshOcclusion`" (since v12, until v14)
141
140
  */
142
141
  refreshTiles: RenderFlag<this, "refreshTiles">;
143
142
 
144
143
  /**
145
- * @defaultValue `{ propagate: ["initializeLighting", "initializeVision"] }`
146
- * @deprecated since v12, will be removed in v14
144
+ * @defaultValue `{ propagate: ["initializeLighting", "initializeVision"], alias: true }`
145
+ * @deprecated "The `identifyInteriorWalls` flag is now obsolete and has no replacement." (since v12, until v14)
147
146
  */
148
147
  identifyInteriorWalls: RenderFlag<this, "identifyInteriorWalls">;
149
148
 
150
149
  /**
151
- * @defaultValue `{ propagate: ["refreshVision"] }`
152
- * @deprecated since v11, will be removed in v13
153
- * @remarks In v12 the flag remains, but the static method it would have triggered was removed prematurely (was listed as until v13 in v11)
150
+ * @defaultValue `{ propagate: ["refreshLightSources"] }`
151
+ * @deprecated "The `initializeDarknessSources` flag is now obsolete. `initializeLightSources` flag must be used instead." (since v13, until v15)
154
152
  */
155
- forceUpdateFog: RenderFlag<this, "forceUpdateFog">;
153
+ initializeDarknessSources: RenderFlag<this, "initializeDarknessSources">;
156
154
  }
157
155
  }
158
156
 
@@ -1,17 +1,15 @@
1
- import type { Brand, ConcreteKeys, InterfaceToObject, SimpleMerge } from "#utils";
1
+ import type { AnyObject, Brand, ConcreteKeys, Identity, InterfaceToObject, SimpleMerge } from "#utils";
2
2
  import type { fields } from "#common/data/_module.d.mts";
3
- import type { DataSchema } from "#common/data/fields.d.mts";
4
3
  import type { AbstractBaseShader } from "#client/canvas/rendering/shaders/_module.d.mts";
5
- import DataField = foundry.data.fields.DataField;
6
- import type DataModel from "#common/abstract/data.d.mts";
7
- import type PointVisionSource from "#client/canvas/sources/point-vision-source.d.mts";
4
+ import type { DataModel } from "#common/abstract/_module.d.mts";
5
+ import type { PointVisionSource } from "#client/canvas/sources/_module.d.mts";
8
6
 
9
7
  declare class ShaderField<
10
8
  const Options extends ShaderField.Options = ShaderField.DefaultOptions,
11
9
  const AssignmentType = ShaderField.AssignmentType<Options>,
12
10
  const InitializedType = ShaderField.InitializedType<Options>,
13
11
  const PersistedType extends typeof AbstractBaseShader | null | undefined = ShaderField.InitializedType<Options>,
14
- > extends foundry.data.fields.DataField<Options, AssignmentType, InitializedType, PersistedType> {
12
+ > extends fields.DataField<Options, AssignmentType, InitializedType, PersistedType> {
15
13
  /**
16
14
  * @defaultValue
17
15
  * ```typescript
@@ -23,17 +21,18 @@ declare class ShaderField<
23
21
  */
24
22
  static override get _defaults(): ShaderField.DefaultOptions;
25
23
 
26
- // TODO: _cast blatantly breaks inheritance so this is difficult to work with
27
-
28
- /** @remarks The value provided to a ShaderField must be an AbstractBaseShader subclass. */
24
+ /**
25
+ * @remarks
26
+ * @throws If the value provided is not an {@linkcode AbstractBaseShader} subclass.
27
+ */
29
28
  override _cast(value: unknown): AssignmentType; // typeof AbstractBaseShader;
30
29
  }
31
30
 
32
31
  declare namespace ShaderField {
33
- type Options = DataField.Options<typeof AbstractBaseShader>;
32
+ type Options = fields.DataField.Options<typeof AbstractBaseShader>;
34
33
 
35
34
  type DefaultOptions = SimpleMerge<
36
- DataField.DefaultOptions,
35
+ fields.DataField.DefaultOptions,
37
36
  {
38
37
  nullable: true;
39
38
  initial: undefined;
@@ -51,7 +50,7 @@ declare namespace ShaderField {
51
50
  * @template Opts - the options that override the default options
52
51
  */
53
52
  // eslint-disable-next-line @typescript-eslint/no-deprecated
54
- type AssignmentType<Opts extends Options> = DataField.DerivedAssignmentType<
53
+ type AssignmentType<Opts extends Options> = fields.DataField.DerivedAssignmentType<
55
54
  typeof AbstractBaseShader,
56
55
  MergedOptions<Opts>
57
56
  >;
@@ -60,7 +59,7 @@ declare namespace ShaderField {
60
59
  * A shorthand for the initialized type of a BooleanField class.
61
60
  * @template Opts - the options that override the default options
62
61
  */
63
- type InitializedType<Opts extends Options> = DataField.DerivedInitializedType<
62
+ type InitializedType<Opts extends Options> = fields.DataField.DerivedInitializedType<
64
63
  typeof AbstractBaseShader,
65
64
  MergedOptions<Opts>
66
65
  >;
@@ -70,17 +69,17 @@ declare namespace ShaderField {
70
69
  * A Vision Mode which can be selected for use by a Token.
71
70
  * The selected Vision Mode alters the appearance of various aspects of the canvas while that Token is the POV.
72
71
  */
73
- declare class VisionMode extends foundry.abstract.DataModel<
72
+ declare class VisionMode extends DataModel<
74
73
  VisionMode.Schema,
75
74
  DataModel.Any | null,
76
75
  InterfaceToObject<VisionMode.ExtraConstructorOptions>
77
76
  > {
78
77
  // A constructor override has been omitted as there are no typing changes
79
78
 
80
- static defineSchema(): VisionMode.Schema;
79
+ static override defineSchema(): VisionMode.Schema;
81
80
 
82
81
  /** The lighting illumination levels which are supported. */
83
- static LIGHTING_LEVELS: typeof foundry.CONST.LIGHTING_LEVELS;
82
+ static LIGHTING_LEVELS: typeof CONST.LIGHTING_LEVELS;
84
83
 
85
84
  /**
86
85
  * Flags for how each lighting channel should be rendered for the currently active vision modes:
@@ -103,47 +102,51 @@ declare class VisionMode extends foundry.abstract.DataModel<
103
102
  get perceivesLight(): boolean;
104
103
 
105
104
  /**
106
- * Special activation handling that could be implemented by VisionMode subclasses
107
- * @param source - Activate this VisionMode for a specific source
105
+ * Special activation handling that could be implemented by `VisionMode` subclasses
106
+ * @param source - Activate this `VisionMode` for a specific source
108
107
  */
109
- _activate(source: PointVisionSource.Any): void;
108
+ protected _activate(source: PointVisionSource.Any): void;
110
109
 
111
110
  /**
112
- * Special deactivation handling that could be implemented by VisionMode subclasses
113
- * @param source - Deactivate this VisionMode for a specific source
111
+ * Special deactivation handling that could be implemented by `VisionMode` subclasses
112
+ * @param source - Deactivate this `VisionMode` for a specific source
114
113
  */
115
- _deactivate(source: PointVisionSource.Any): void;
114
+ protected _deactivate(source: PointVisionSource.Any): void;
116
115
 
117
116
  /**
118
117
  * Special handling which is needed when this Vision Mode is activated for a VisionSource.
119
- * @param source - Activate this VisionMode for a specific source
118
+ * @param source - Activate this `VisionMode` for a specific source
120
119
  */
121
120
  activate(source: PointVisionSource.Any): void;
122
121
 
123
122
  /**
124
123
  * Special handling which is needed when this Vision Mode is deactivated for a VisionSource.
125
- * @param source - Deactivate this VisionMode for a specific source
124
+ * @param source - Deactivate this `VisionMode` for a specific source
126
125
  */
127
126
  deactivate(source: PointVisionSource.Any): void;
128
127
 
129
128
  /**
130
129
  * An animation function which runs every frame while this Vision Mode is active.
131
130
  * @param dt - The deltaTime passed by the PIXI Ticker
132
- * @remarks Calls `RenderedEffectSource#animateTime` with `this` set to this `VisionMode`
131
+ * @deprecated Always throws as of 13.346, see remarks
132
+ * @remarks Calls {@linkcode foundry.canvas.sources.RenderedEffectSource.animateTime | RenderedEffectSource#animateTime} with `this` set to this {@linkcode VisionMode}
133
+ * @throws Because of the above, as of 13.346 this will **always** throw: it tries to access `this.animation.seed`, but `VisionMode`s don't have an `#animation` object.
134
+ * See {@link https://github.com/foundryvtt/foundryvtt/issues/13227}.
133
135
  */
134
136
  animate(dt: number): void;
135
137
  }
136
138
 
137
139
  declare namespace VisionMode {
138
140
  interface Any extends AnyVisionMode {}
139
- type AnyConstructor = typeof AnyVisionMode;
141
+ interface AnyConstructor extends Identity<typeof AnyVisionMode> {}
140
142
 
141
143
  type ConfiguredModes = ConcreteKeys<CONFIG["Canvas"]["visionModes"]>;
142
144
 
143
145
  type LIGHTING_VISIBILITY = Brand<number, "VisionMode.LIGHTING_VISIBILITY">;
144
146
 
145
147
  interface ExtraConstructorOptions {
146
- animated?: boolean | undefined | null;
148
+ /** @defaultValue `false` */
149
+ animated?: boolean | undefined;
147
150
  }
148
151
 
149
152
  interface LightingVisibility {
@@ -157,24 +160,46 @@ declare namespace VisionMode {
157
160
  REQUIRED: 2 & LIGHTING_VISIBILITY;
158
161
  }
159
162
 
160
- type ShaderSchema = fields.SchemaField<{
163
+ interface ShaderSchema extends fields.DataSchema {
161
164
  shader: ShaderField;
162
165
  uniforms: fields.ObjectField;
163
- }>;
166
+ }
164
167
 
165
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
166
- type LightingSchema = {
168
+ interface LightingTypeSchema extends fields.DataSchema {
167
169
  visibility: fields.NumberField;
168
170
  postProcessingModes: fields.ArrayField<fields.StringField>;
169
171
  uniforms: fields.ObjectField;
170
- };
172
+ }
171
173
 
172
- type LightingSchemaField = fields.SchemaField<LightingSchema>;
174
+ /** @privateRemarks Pulled out simplify creating {@linkcode LightingData} */
175
+ interface LightingSchema extends fields.DataSchema {
176
+ background: fields.SchemaField<LightingTypeSchema>;
177
+ coloration: fields.SchemaField<LightingTypeSchema>;
178
+ illumination: fields.SchemaField<LightingTypeSchema>;
179
+ levels: fields.ObjectField<
180
+ {
181
+ validate: (o: AnyObject) => o is LightingLevels;
182
+ validationError: "may only contain a mapping of keys from VisionMode.LIGHTING_LEVELS";
183
+ },
184
+ LightingLevels,
185
+ LightingLevels,
186
+ LightingLevels
187
+ >;
188
+ multipliers: fields.ObjectField<
189
+ {
190
+ validate: (o: AnyObject) => o is LightingMultipliers;
191
+ validationError: "must provide a mapping of keys from VisionMode.LIGHTING_LEVELS to numeric multiplier values";
192
+ },
193
+ LightingMultipliers,
194
+ LightingMultipliers,
195
+ LightingMultipliers
196
+ >;
197
+ }
173
198
 
174
- type LightingLevels = Record<foundry.CONST.LIGHTING_LEVELS, foundry.CONST.LIGHTING_LEVELS>;
175
- type LightingMultipliers = Record<foundry.CONST.LIGHTING_LEVELS, number>;
199
+ type LightingLevels = Record<CONST.LIGHTING_LEVELS | `${CONST.LIGHTING_LEVELS}`, CONST.LIGHTING_LEVELS>;
200
+ type LightingMultipliers = Record<CONST.LIGHTING_LEVELS | `${CONST.LIGHTING_LEVELS}`, number>;
176
201
 
177
- interface Schema extends DataSchema {
202
+ interface Schema extends fields.DataSchema {
178
203
  id: fields.StringField<{ blank: false }>;
179
204
  label: fields.StringField<{ blank: false }>;
180
205
  tokenConfig: fields.BooleanField<{ initial: true }>;
@@ -182,33 +207,11 @@ declare namespace VisionMode {
182
207
  shader: ShaderField;
183
208
  uniforms: fields.ObjectField;
184
209
  }>;
185
- lighting: fields.SchemaField<{
186
- background: LightingSchemaField;
187
- coloration: LightingSchemaField;
188
- illumination: LightingSchemaField;
189
- levels: fields.ObjectField<
190
- {
191
- validate: (o: unknown) => boolean;
192
- validationError: "may only contain a mapping of keys from VisionMode.LIGHTING_LEVELS";
193
- },
194
- LightingLevels,
195
- LightingLevels,
196
- LightingLevels
197
- >;
198
- multipliers: fields.ObjectField<
199
- {
200
- validate: (o: unknown) => boolean;
201
- validationError: "must provide a mapping of keys from VisionMode.LIGHTING_LEVELS to numeric multiplier values";
202
- },
203
- LightingMultipliers,
204
- LightingMultipliers,
205
- LightingMultipliers
206
- >;
207
- }>;
210
+ lighting: fields.SchemaField<LightingSchema>;
208
211
  vision: fields.SchemaField<{
209
- background: ShaderSchema;
210
- coloration: ShaderSchema;
211
- illumination: ShaderSchema;
212
+ background: fields.SchemaField<ShaderSchema>;
213
+ coloration: fields.SchemaField<ShaderSchema>;
214
+ illumination: fields.SchemaField<ShaderSchema>;
212
215
  darkness: fields.SchemaField<{
213
216
  adaptive: fields.BooleanField<{ initial: true }>;
214
217
  }>;
@@ -240,6 +243,14 @@ declare namespace VisionMode {
240
243
  preferred: fields.BooleanField<{ initial: false }>;
241
244
  }>;
242
245
  }
246
+
247
+ interface LightingData extends fields.SchemaField.InitializedData<LightingSchema> {}
248
+
249
+ interface CreateData extends fields.SchemaField.CreateData<Schema> {}
250
+
251
+ interface UpdateData extends fields.SchemaField.UpdateData<Schema> {}
252
+
253
+ interface SourceData extends fields.SchemaField.SourceData<Schema> {}
243
254
  }
244
255
 
245
256
  export { VisionMode as default, ShaderField };
@@ -213,10 +213,10 @@ declare namespace TokenRing {
213
213
  duration?: number;
214
214
 
215
215
  /** @defaultValue `PIXI.UPDATE_PRIORITY.HIGH` */
216
- priority?: PIXI.UPDATE_PRIORITY | null | undefined;
216
+ priority?: PIXI.UPDATE_PRIORITY | undefined;
217
217
 
218
218
  /** @defaultValue `TokenRing.createSpikeEasing(0.15)` */
219
- easing?: CanvasAnimation.EasingFunction | null | undefined;
219
+ easing?: CanvasAnimation.EasingFunction | undefined;
220
220
  }
221
221
 
222
222
  interface TextureData {
@@ -1,3 +1,4 @@
1
+ import type { Ruler } from "#client/canvas/interaction/_module.d.mts";
1
2
  import type { Identity } from "#utils";
2
3
  import type { BaseTokenRuler } from "./_module.d.mts";
3
4
 
@@ -46,14 +47,14 @@ declare class TokenRuler extends BaseTokenRuler {
46
47
  * @param waypoint - The waypoint
47
48
  * @returns The radius, color, and alpha of the waypoint. If the radius is 0, no waypoint marker is drawn.
48
49
  */
49
- protected _getWaypointStyle(waypoint: TokenRuler.Waypoint): TokenRuler.WaypointStyle;
50
+ protected _getWaypointStyle(waypoint: TokenRuler.Waypoint): Ruler.WaypointStyle;
50
51
 
51
52
  /**
52
53
  * Get the style of the segment from the previous to the given waypoint.
53
54
  * @param waypoint - The waypoint
54
55
  * @returns The line width, color, and alpha of the segment. If the width is 0, no segment is drawn.
55
56
  */
56
- protected _getSegmentStyle(waypoint: TokenRuler.Waypoint): TokenRuler.SegmentStyle;
57
+ protected _getSegmentStyle(waypoint: TokenRuler.Waypoint): Ruler.SegmentStyle;
57
58
 
58
59
  /**
59
60
  * Get the style to be used to highlight the grid offset.
@@ -159,49 +160,13 @@ declare namespace TokenRuler {
159
160
  /**
160
161
  * @remarks Fed into the template
161
162
  */
162
- interface WaypointContext {
163
- action: string;
164
- cssClass: string;
165
- secret: boolean;
166
- units: string;
167
- uiScale: number;
168
- position: {
169
- x: number;
170
- y: number;
171
- };
172
- distance: SegmentDistance;
163
+ interface WaypointContext extends Ruler.WaypointContext {
173
164
  cost: SegmentCost;
174
- elevation: ElevationContext;
175
- }
176
-
177
- interface SegmentDistance {
178
- total: string;
179
- delta?: string | undefined;
180
165
  }
181
166
 
182
- interface SegmentCost {
167
+ interface SegmentCost extends Ruler._DeltaString {
183
168
  total: string;
184
169
  units: string;
185
- delta?: string | undefined;
186
- }
187
-
188
- interface ElevationContext {
189
- total: number;
190
- icon: string;
191
- hidden: boolean;
192
- delta?: string | undefined;
193
- }
194
-
195
- interface WaypointStyle {
196
- radius: number;
197
- color?: PIXI.ColorSource | undefined;
198
- alpha?: number | undefined;
199
- }
200
-
201
- interface SegmentStyle {
202
- width: number;
203
- color?: PIXI.ColorSource | undefined;
204
- alpha?: number | undefined;
205
170
  }
206
171
 
207
172
  interface GridHighlightStyle {
@@ -140,6 +140,7 @@ declare abstract class BaseLightSource<
140
140
  * An animation with flickering ratio and light intensity.
141
141
  * @param dt - Delta time
142
142
  * @param options - Additional options which modify the torch animation
143
+ * @remarks A valid {@linkcode BaseLightSource.LightAnimationFunction | LightAnimationFunction}
143
144
  */
144
145
  animateTorch(dt: number, options?: RenderedEffectSource.AnimationFunctionOptions): void;
145
146
 
@@ -147,6 +148,7 @@ declare abstract class BaseLightSource<
147
148
  * An animation with flickering ratio and light intensity
148
149
  * @param dt - Delta time
149
150
  * @param options - Additional options which modify the flame animation
151
+ * @remarks A valid {@linkcode BaseLightSource.LightAnimationFunction | LightAnimationFunction}
150
152
  */
151
153
  animateFlickering(dt: number, options?: BaseLightSource.AnimateFlickeringOptions): void;
152
154
 
@@ -154,6 +156,7 @@ declare abstract class BaseLightSource<
154
156
  * A basic "pulse" animation which expands and contracts.
155
157
  * @param dt - Delta time
156
158
  * @param options - Additional options which modify the pulse animation
159
+ * @remarks A valid {@linkcode BaseLightSource.LightAnimationFunction | LightAnimationFunction}
157
160
  */
158
161
  animatePulse(dt: number, options?: RenderedEffectSource.AnimationFunctionOptions): void;
159
162
 
@@ -164,6 +167,7 @@ declare abstract class BaseLightSource<
164
167
  *
165
168
  * @param dt - The delta time since the last frame, in milliseconds.
166
169
  * @param options - Additional options for customizing the audio reaction.
170
+ * @remarks A valid {@linkcode BaseLightSource.LightAnimationFunction | LightAnimationFunction}
167
171
  */
168
172
  animateSoundPulse(dt: number, options?: BaseLightSource.AnimateSoundPulseOptions): void;
169
173
 
@@ -14,7 +14,6 @@ import type {
14
14
  RenderedEffectSource,
15
15
  } from "#client/canvas/sources/_module.d.mts";
16
16
  import type { ClockwiseSweepPolygon } from "#client/canvas/geometry/_module.d.mts";
17
- import type { PlaceableObject } from "#client/canvas/placeables/_module.d.mts";
18
17
  import type { CanvasVisibility } from "#client/canvas/groups/_module.d.mts";
19
18
  import type { PointSourceMesh } from "#client/canvas/containers/_module.d.mts";
20
19
 
@@ -76,8 +75,9 @@ declare class PointLightSource<
76
75
  * This check should not consider the relative positions of either object, only their state.
77
76
  * @param target - The target object being tested
78
77
  * @returns Can the target object theoretically be detected by this vision source?
78
+ * @remarks Only returns `false` in core's implementation if `target?.document` is a {@linkcode TokenDocument} with {@linkcode CONFIG.specialStatusEffects.INVISIBLE}
79
79
  */
80
- protected _canDetectObject(target?: PlaceableObject.Any | null): boolean;
80
+ protected _canDetectObject(target?: CanvasVisibility.TestObject): boolean;
81
81
 
82
82
  /**
83
83
  * @deprecated "`BaseLightSource#isDarkness` is now obsolete. Use {@linkcode foundry.canvas.sources.PointDarknessSource | PointDarknessSource} instead." (since v12, until v14)
@@ -206,6 +206,9 @@ declare abstract class RenderedEffectSource<
206
206
  * Generic time-based animation used for Rendered Point Sources.
207
207
  * @param dt - Delta time.
208
208
  * @param options - Options which affect the time animation
209
+ * @remarks A valid {@linkcode RenderedEffectSource.AnimationFunction}.
210
+ *
211
+ * `dt` is unused by core as of 13.346
209
212
  */
210
213
  animateTime(dt: number, options?: RenderedEffectSource.AnimationFunctionOptions): void;
211
214
 
@@ -242,16 +245,15 @@ declare namespace RenderedEffectSource {
242
245
  /**
243
246
  * A color applied to the rendered effect
244
247
  * @defaultValue `null`
245
- * @remarks Foundry types as `number`, but it gets passed to `Color.from()`
246
- *
247
- * If `null`, Foundry will use the associated shader's `.defaultUniforms.color`
248
+ * @remarks If `null`, Foundry will use the associated shader's `.defaultUniforms.color`
249
+ * @privateRemarks Foundry types as `number`, but it gets passed to `Color.from()`
248
250
  */
249
251
  color: Color.Source | null;
250
252
 
251
253
  /**
252
254
  * An integer seed to synchronize (or de-synchronize) animations
253
255
  * @defaultValue `null`
254
- * @remarks This will remain null in `#data` if not specified, which will lead to using `Math.floor(Math.random() * 100000)` at runtime
256
+ * @remarks This will remain null in {@linkcode RenderedEffectSource.data | #data} if not specified, which will lead to using `Math.floor(Math.random() * 100000)` at runtime
255
257
  *
256
258
  * If specified, this will take precedence over {@linkcode RenderedEffectSource.AnimationConfig.seed | RenderedEffectSource#animation.seed}
257
259
  */
@@ -267,8 +269,13 @@ declare namespace RenderedEffectSource {
267
269
  /**
268
270
  * @param dt - Delta time
269
271
  * @param options - Additional options which modify the animation
272
+ * @remarks A function to be added to the {@link PIXI.Ticker | canvas.app.ticker}
273
+ *
274
+ * @privateRemarks As of 13.346 there is one non-Source usage of this in core: {@linkcode foundry.canvas.perception.VisionMode.animate | VisionMode#animate} attempts to call
275
+ * {@linkcode RenderedEffectSource.animateTime | RenderedEffectSource#animateTime} with `this` set to `VisionMode`, but that's invalid (see
276
+ * {@link https://github.com/foundryvtt/foundryvtt/issues/13227}), so it is not included in the `this` here.
270
277
  */
271
- type AnimationFunction = (this: RenderedEffectSource, dt: number, options?: AnimationFunctionOptions) => void;
278
+ type AnimationFunction = (this: RenderedEffectSource.Any, dt: number, options?: AnimationFunctionOptions) => void;
272
279
 
273
280
  /** @internal */
274
281
  type _AnimationFunctionOptions = InexactPartial<{
@@ -2223,6 +2223,9 @@ declare global {
2223
2223
  }
2224
2224
 
2225
2225
  interface Canvas {
2226
+ /** @defaultValue `10` */
2227
+ elevationSnappingPrecision: number;
2228
+
2226
2229
  /** @defaultValue `8` */
2227
2230
  blurStrength: number;
2228
2231
 
@@ -2303,6 +2306,7 @@ declare global {
2303
2306
  * @defaultValue `FogManager`
2304
2307
  * @remarks Can't be `AnyConstructor` because Foundry assumes it can call `new` with the same arguments FogManager accepts
2305
2308
  */
2309
+ // TODO: Widen to `.AnyConstructor`? Takes no arguments
2306
2310
  fogManager: typeof perception.FogManager;
2307
2311
 
2308
2312
  polygonBackends: Canvas.PolygonBackends;
@@ -4,7 +4,7 @@ import type Document from "#common/abstract/document.d.mts";
4
4
  import type { DataSchema } from "#common/data/fields.d.mts";
5
5
  import type { BaseActor, BaseUser } from "#common/documents/_module.d.mts";
6
6
  import type { UserTargets } from "#client/canvas/placeables/tokens/_module.d.mts";
7
- import type { Ping, Ruler } from "#client/canvas/interaction/_module.d.mts";
7
+ import type { BaseRuler, Ping } from "#client/canvas/interaction/_module.d.mts";
8
8
 
9
9
  import AVSettings = foundry.av.AVSettings;
10
10
  import fields = foundry.data.fields;
@@ -489,7 +489,7 @@ declare namespace User {
489
489
  * The state of the user's ruler, if they are currently using one.
490
490
  * @remarks Can't be explicit `undefined` as the socket drops such keys.
491
491
  */
492
- ruler: Ruler.MeasurementData | null;
492
+ ruler: BaseRuler.UpdateData | null;
493
493
 
494
494
  /**
495
495
  * The IDs of the tokens the user has targeted in the currently viewed
@@ -635,6 +635,13 @@ export interface AllHooks extends DynamicHooks {
635
635
 
636
636
  /** CanvasVisibility */
637
637
 
638
+ /**
639
+ * A hook event that fires when the vision mode is initialized.
640
+ * @param visibility - The CanvasVisibility instance
641
+ * @remarks This is called by {@linkcode Hooks.callAll}.
642
+ */
643
+ initializeVisionMode: (visibility: CanvasVisibility.Any) => void;
644
+
638
645
  /**
639
646
  * A hook event that fires when the set of vision sources are initialized.
640
647
  * @param sources - The collection of current vision sources
@@ -634,8 +634,14 @@ declare namespace BaseGrid {
634
634
  /** The total number of spaces moved along a direct path up to this waypoint. */
635
635
  spaces: number;
636
636
 
637
- /** The total cost of the direct path ({@link BaseGrid.getDirectPath | `BaseGrid#getDirectPath`}) up to this waypoint. */
637
+ /** The total cost of the direct path ({@linkcode BaseGrid.getDirectPath | BaseGrid#getDirectPath}) up to this waypoint. */
638
638
  cost: number;
639
+
640
+ /** The total number of diagonals moved along a direct path up to this waypoint. */
641
+ diagonals: number;
642
+
643
+ /** The total Euclidean length of the straight line path up to this waypoint. */
644
+ euclidean: number;
639
645
  }
640
646
 
641
647
  /** The measurements of a segment. */
@@ -254,7 +254,8 @@ declare class InternalColor extends PatchedNumber {
254
254
  /**
255
255
  * Create a Color instance from an RGB array.
256
256
  * @param color - A color input
257
- * @returns The hex color instance or NaN
257
+ * @returns The hex color instance or `NaN`
258
+ * @remarks Nullish values return `Color(NaN)`
258
259
  */
259
260
  static from(color: Color.Source | null | undefined): Color;
260
261
 
@@ -13,8 +13,9 @@ declare class EventEmitter {
13
13
 
14
14
  /**
15
15
  * An array of event types which are valid for this class.
16
+ * @privateRemarks `| readonly` because {@linkcode foundry.canvas.perception.FogManager | FogManager.emittedEvents} is frozen
16
17
  */
17
- static emittedEvents: string[];
18
+ static emittedEvents: string[] | readonly string[];
18
19
 
19
20
  /**
20
21
  * Add a new event listener for a certain type of event.