@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
@@ -2,8 +2,16 @@ import type { InexactPartial, NullishProps, FixedInstanceType } from "#utils";
2
2
  import type { CANVAS_PERFORMANCE_MODES } from "#common/constants.d.mts";
3
3
  import type { CanvasAnimation } from "#client/canvas/animation/_module.d.mts";
4
4
  import type { MouseInteractionManager, RenderFlagsMixin, Ping } from "#client/canvas/interaction/_module.d.mts";
5
- import type * as groups from "#client/canvas/groups/_module.d.mts";
6
- import type * as layers from "#client/canvas/layers/_module.d.mts";
5
+ import type {
6
+ groups,
7
+ layers,
8
+ // placeables is only used for @links
9
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
+ placeables,
11
+ // interaction is only used for @links
12
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+ interaction,
14
+ } from "./_module.d.mts";
7
15
  import type { PerceptionManager } from "#client/canvas/perception/_module.d.mts";
8
16
 
9
17
  type InternalCanvas = new (...args: never) => {
@@ -710,18 +718,13 @@ declare namespace Canvas {
710
718
  * @remarks Copied from `common/_types.mjs`
711
719
  */
712
720
  interface ElevatedPoint {
721
+ /** The x-coordinate in pixels */
713
722
  x: number;
714
- y: number;
715
- elevation: number;
716
- }
717
723
 
718
- /**
719
- * A 3D point, expressed as `{x, y, elevation}`.
720
- * @remarks Copied from `common/_types.mjs`
721
- */
722
- interface ElevatedPoint {
723
- x: number;
724
+ /** The y-coordinate in pixels */
724
725
  y: number;
726
+
727
+ /** The elevation in grid units */
725
728
  elevation: number;
726
729
  }
727
730
 
@@ -737,20 +740,6 @@ declare namespace Canvas {
737
740
 
738
741
  type PairOfPointsTuple = [x0: number, y0: number, x1: number, y1: number];
739
742
 
740
- /**
741
- * A 3D point, expessed as \{x, y, elevation\}.
742
- */
743
- interface ElevatedPoint {
744
- /** The x-coordinate in pixels */
745
- x: number;
746
-
747
- /** The y-coordinate in pixels */
748
- y: number;
749
-
750
- /** The elevation in grid units */
751
- elevation: number;
752
- }
753
-
754
743
  /**
755
744
  * A standard rectangle interface.
756
745
  * @remarks Copied from `resources/app/common/types.mjs`
@@ -828,13 +817,173 @@ declare namespace Canvas {
828
817
  }
829
818
 
830
819
  namespace Event {
820
+ /**
821
+ * All known InteractionData properties. Last updated 13.346.
822
+ * @internal
823
+ */
824
+ type _InteractionData<ObjectFor extends PIXI.DisplayObject> = InexactPartial<{
825
+ /**
826
+ * @remarks Set in `MouseInteractionManager##assignInteractionData`, which is called in
827
+ * {@linkcode MouseInteractionManager.callback | #callback}, so this will always be available
828
+ * to {@linkcode CallbackFunction}s
829
+ */
830
+ object: ObjectFor;
831
+
832
+ /**
833
+ * @privateRemarks Set as:
834
+ *
835
+ * A {@linkcode PIXI.Point} in:
836
+ * - `MouseInteractionManager##handlePointerMove`
837
+ * - `MouseInteractionManager##handlePointerUp`
838
+ *
839
+ * A {@linkcode Canvas.PossiblyElevatedPoint} in:
840
+ * - {@linkcode layers.DrawingsLayer._onDragLeftDrop | DrawingsLayer#_onDragLeftDrop}
841
+ * - {@linkcode layers.RegionLayer._onDragLeftMove | RegionLayer#_onDragLeftMove}
842
+ * - {@linkcode layers.RegionLayer._onDragLeftDrop | RegionLayer#_onDragLeftDrop}
843
+ * - {@linkcode layers.SoundsLayer._onDragLeftDrop | SoundsLayer#_onDragLeftDrop}
844
+ * - {@linkcode layers.TemplateLayer._onDragLeftMove | TemplateLayer#_onDragLeftMove}
845
+ * - {@linkcode layers.TilesLayer._onDragLeftMove | TilesLayer#_onDragLeftMove}
846
+ * - {@linkcode layers.TilesLayer._onDragLeftDrop | TilesLayer#_onDragLeftDrop}
847
+ * - {@linkcode placeables.Tile._onHandleDragMove | Tile#_onHandleDragMove}
848
+ * - {@linkcode placeables.Tile._onHandleDragDrop | Tile#_onHandleDragDrop}
849
+ */
850
+ destination: PIXI.Point | Canvas.PossiblyElevatedPoint;
851
+
852
+ /**
853
+ * @privateRemarks Set:
854
+ * - As {@linkcode PIXI.Point} in `MouseInteractionManager##assignOriginData`
855
+ * - As {@linkcode Canvas.Rectangle} in {@linkcode placeables.Tile._onHandleDragStart | Tile#_onHandleDragStart}
856
+ */
857
+ origin: PIXI.Point | Canvas.Rectangle;
858
+
859
+ /** @privateRemarks Set in `MouseInteractionManager##assignOriginData` */
860
+ screenOrigin: PIXI.Point;
861
+
862
+ /** @privateRemarks Set in `Canvas##onDragSelect` */
863
+ coords: Canvas.Rectangle;
864
+
865
+ /** @privateRemarks Set in `Canvas##onDragLeftStart` */
866
+ ruler: boolean;
867
+
868
+ /**
869
+ * @privateRemarks Set in:
870
+ * - `SceneControls##onToolChange`
871
+ * - `ClientKeybindings.#onDismiss`
872
+ * - {@linkcode interaction.BaseRuler._onDragStart | BaseRuler#_onDragStart}
873
+ * - {@linkcode interaction.BaseRuler._onClickLeft | BaseRuler#_onClickLeft}
874
+ * - {@linkcode interaction.BaseRuler._onClickRight | BaseRuler#_onClickRight}
875
+ * - {@linkcode interaction.BaseRuler._onMouseUp | BaseRuler#_onMouseUp}
876
+ * - {@linkcode layers.ControlsLayer._onLongPress | ControlsLayer#_onLongPress}
877
+ * - {@linkcode layers.WallsLayer._onUndoCreate | WallsLayer#_onUndoCreate}
878
+ * - {@linkcode placeables.Token._initializeDragLeft | Token#_initializeDragLeft}
879
+ * - {@linkcode placeables.Token._triggerDragLeftCancel | Token#_triggerDragLeftCancel}
880
+ */
881
+ cancelled: boolean;
882
+
883
+ /**
884
+ * @privateRemarks Set in:
885
+ * - {@linkcode placeables.Token._initializeDragLeft | Token#_initializeDragLeft}
886
+ * - {@linkcode placeables.Token._onDragLeftDrop | Token#_onDragLeftDrop}
887
+ * - {@linkcode placeables.Token._triggerDragLeftDrop | Token#_triggerDragLeftDrop}
888
+ */
889
+ dropped: boolean;
890
+
891
+ /**
892
+ * @privateRemarks Set in:
893
+ * - {@linkcode interaction.BaseRuler._onDragStart | BaseRuler#_onDragStart}
894
+ * - {@linkcode interaction.BaseRuler._onMouseUp | BaseRuler#_onMouseUp}
895
+ * - {@linkcode placeables.Token._initializeDragLeft | Token#_initializeDragLeft}
896
+ * - {@linkcode placeables.Token._onDragLeftDrop | Token#_onDragLeftDrop}
897
+ */
898
+ released: boolean;
899
+
900
+ /**
901
+ * @privateRemarks Set in:
902
+ * - {@linkcode layers.DrawingsLayer._onDragLeftStart | DrawingsLayer#_onDragLeftStart}
903
+ * - {@linkcode layers.LightingLayer._onDragLeftStart | LightingLayer#_onDragLeftStart}
904
+ * - {@linkcode layers.SoundsLayer._onDragLeftStart | SoundsLayer#_onDragLeftStart}
905
+ * - {@linkcode layers.TemplateLayer._onDragLeftStart | TemplateLayer#_onDragLeftStart}
906
+ * - {@linkcode layers.WallsLayer._onDragLeftStart | WallsLayer#_onDragLeftStart}
907
+ */
908
+ preview: ObjectFor;
909
+
910
+ /**
911
+ * @privateRemarks Set in:
912
+ * - {@linkcode layers.DrawingsLayer._onClickLeft2 | DrawingsLayer#_onClickLeft2}
913
+ * - {@linkcode layers.DrawingsLayer._onDragLeftStart | DrawingsLayer#_onDragLeftStart}
914
+ * - {@linkcode layers.DrawingsLayer._onDragLeftMove | DrawingsLayer#_onDragLeftMove}
915
+ * - {@linkcode layers.DrawingsLayer._onDragLeftDrop | DrawingsLayer#_onDragLeftDrop}
916
+ * - {@linkcode layers.DrawingsLayer._onDragLeftCancel | DrawingsLayer#_onDragLeftCancel}
917
+ */
918
+ drawingsState: layers.PlaceablesLayer.CREATION_STATES;
919
+
920
+ /**
921
+ * @privateRemarks Set in:
922
+ * - {@linkcode layers.SoundsLayer._onDragLeftStart | SoundsLayer#_onDragLeftStart}
923
+ * - {@linkcode layers.SoundsLayer._onDragLeftMove | SoundsLayer#_onDragLeftMove}
924
+ */
925
+ soundState: layers.PlaceablesLayer.CREATION_STATES;
926
+
927
+ /**
928
+ * @privateRemarks Set in:
929
+ * - {@linkcode placeables.PlaceableObject._onDragLeftDrop | PlaceableObject#_onDragLeftDrop}
930
+ * - {@linkcode layers.PlaceablesLayer._onDragLeftDrop | PlaceablesLayer#_onDragLeftDrop}
931
+ * - {@linkcode layers.DrawingsLayer._onDragLeftDrop | DrawingsLayer#_onDragLeftDrop}
932
+ * - {@linkcode layers.WallsLayer._onDragLeftStart | WallsLayer#_onDragLeftStart}
933
+ * - {@linkcode layers.WallsLayer._onDragLeftDrop | WallsLayer#_onDragLeftDrop}
934
+ */
935
+ clearPreviewContainer: boolean;
936
+
937
+ /**
938
+ * @privateRemarks Set in: {@linkcode placeables.PlaceableObject._onClickLeft | PlaceableObject#_onClickLeft}
939
+ */
940
+ release: boolean;
941
+
942
+ /**
943
+ * @privateRemarks Set in:
944
+ * - {@linkcode placeables.Drawing._onClickLeft | Drawing#_onClickLeft}
945
+ * - {@linkcode placeables.Tile._onClickLeft | Tile#_onClickLeft}
946
+ */
947
+ dragHandle: boolean;
948
+
949
+ /**
950
+ * @privateRemarks Set in {@linkcode placeables.Drawing._onHandleDragStart | Drawing#_onHandleDragStart}
951
+ */
952
+ handleOrigin: Canvas.Point;
953
+
954
+ /**
955
+ * @privateRemarks Set in {@linkcode placeables.Drawing._onHandleDragStart | Drawing#_onHandleDragStart}
956
+ */
957
+ originalData: DrawingDocument.Source;
958
+
959
+ /**
960
+ * @privateRemarks Set in {@linkcode placeables.Drawing._onHandleDragDrop | Drawing#_onHandleDragDrop}
961
+ */
962
+ restoreOriginalData: boolean;
963
+
964
+ /**
965
+ * @privateRemarks Set in {@linkcode placeables.PlaceableObject._initializeDragLeft | PlaceableObject#_initializeDragLeft}
966
+ */
967
+ clones: ObjectFor[];
968
+
969
+ /**
970
+ * @privateRemarks Set in {@linkcode layers.WallsLayer._onDragLeftStart | WallsLayer#_onDragLeftStart}
971
+ */
972
+ fixed: boolean;
973
+ }>;
974
+
975
+ interface InteractionData<ObjectFor extends PIXI.DisplayObject = PIXI.DisplayObject>
976
+ extends _InteractionData<ObjectFor> {}
977
+
831
978
  /** @internal */
832
- interface _Base<Original extends UIEvent | PIXI.PixiTouch = UIEvent | PIXI.PixiTouch>
833
- extends PIXI.FederatedEvent<Original> {
834
- interactionData: MouseInteractionManager.InteractionData<PIXI.DisplayObject>;
979
+ interface _Base<
980
+ ObjectFor extends PIXI.DisplayObject = PIXI.DisplayObject,
981
+ Original extends UIEvent | PIXI.PixiTouch = UIEvent | PIXI.PixiTouch,
982
+ > extends PIXI.FederatedEvent<Original> {
983
+ interactionData: InteractionData<ObjectFor>;
835
984
  }
836
985
 
837
- interface Pointer extends _Base<PointerEvent> {}
986
+ interface Pointer<ObjectFor extends PIXI.Container = PIXI.Container> extends _Base<ObjectFor, PointerEvent> {}
838
987
  interface Wheel extends WheelEvent {}
839
988
  interface DeleteKey extends KeyboardEvent {}
840
989
 
@@ -848,8 +997,8 @@ declare namespace Canvas {
848
997
  }
849
998
 
850
999
  interface PendingRenderFlags {
851
- OBJECTS: Set<FixedInstanceType<ReturnType<typeof RenderFlagsMixin>>>;
852
- PERCEPTION: Set<FixedInstanceType<ReturnType<typeof RenderFlagsMixin>>>;
1000
+ OBJECTS: Set<RenderFlagsMixin.AnyMixed>;
1001
+ PERCEPTION: Set<RenderFlagsMixin.AnyMixed>;
853
1002
  }
854
1003
  }
855
1004
 
@@ -32,7 +32,7 @@ declare class CanvasGroup<
32
32
  DrawOptions extends CanvasGroupMixin.DrawOptions = CanvasGroupMixin.DrawOptions,
33
33
  TearDownOptions extends CanvasGroupMixin.TearDownOptions = CanvasGroupMixin.TearDownOptions,
34
34
  > extends LayersClass<Group> {
35
- /** @privateRemarks All mixin classses should accept anything for its constructor. */
35
+ /** @privateRemarks All mixin classes should accept anything for its constructor. */
36
36
  constructor(...args: any[]);
37
37
 
38
38
  /** @defaultValue `true` */
@@ -77,6 +77,8 @@ declare class CanvasGroup<
77
77
  * Remove and destroy all layers from the base canvas.
78
78
  */
79
79
  protected _tearDown(options: HandleEmptyObject<TearDownOptions>): Promise<void>;
80
+
81
+ #CanvasGroup: true;
80
82
  }
81
83
 
82
84
  declare const _NoLayerGroup: unique symbol;
@@ -103,8 +105,7 @@ declare function CanvasGroupMixin<
103
105
 
104
106
  declare global {
105
107
  /**
106
- * @deprecated since v12, until 14
107
- * @remarks "`BaseCanvasMixin` is deprecated in favor of {@linkcode foundry.canvas.groups.CanvasGroupMixin}"
108
+ * @deprecated "`BaseCanvasMixin` is deprecated in favor of {@linkcode foundry.canvas.groups.CanvasGroupMixin}" (since v12, until v14)
108
109
  */
109
110
  const BaseCanvasMixin: typeof CanvasGroupMixin;
110
111
  }
@@ -1,10 +1,16 @@
1
- import type { HandleEmptyObject, Identity, InexactPartial, IntentionalPartial, NullishProps } from "#utils";
1
+ import type { EmptyObject, HandleEmptyObject, Identity, InexactPartial } from "#utils";
2
2
  import type { Canvas } from "#client/canvas/_module.mjs";
3
3
  import type { VisibilityFilter } from "#client/canvas/rendering/filters/_module.mjs";
4
4
  import type { CanvasGroupMixin } from "#client/canvas/groups/_module.d.mts";
5
5
  import type { CanvasVisionMask } from "#client/canvas/layers/_module.d.mts";
6
- import type { VisionMode } from "#client/canvas/perception/_module.d.mts";
6
+ // PerceptionManager is only used for @links
7
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
8
+ import type { PerceptionManager, VisionMode } from "#client/canvas/perception/_module.d.mts";
7
9
  import type { PlaceableObject } from "#client/canvas/placeables/_module.d.mts";
10
+ import type { PointVisionSource } from "#client/canvas/sources/_module.d.mts";
11
+ // Hooks are only linked, aliased to match foundry's links
12
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+ import type { AllHooks as hookEvents } from "#client/hooks.mjs";
8
14
 
9
15
  declare module "#configuration" {
10
16
  namespace Hooks {
@@ -15,14 +21,21 @@ declare module "#configuration" {
15
21
  }
16
22
 
17
23
  /**
18
- * The visibility Layer which implements dynamic vision, lighting, and fog of war
19
- * This layer uses an event-driven workflow to perform the minimal required calculation in response to changes.
20
- * @see {@linkcode PointSource}
24
+ * The visibility group which implements dynamic vision, lighting, and fog of war.
25
+ * This group uses an event-driven workflow to perform the minimal required calculation in response to changes.
26
+ *
27
+ * ### Hook Events
28
+ * - {@linkcode hookEvents.initializeVisionMode}
29
+ * - {@linkcode hookEvents.initializeVisionSources}
30
+ * - {@linkcode hookEvents.sightRefresh}
31
+ * - {@linkcode hookEvents.visibilityRefresh}
21
32
  */
22
33
  declare class CanvasVisibility<
23
34
  DrawOptions extends CanvasVisibility.DrawOptions = CanvasVisibility.DrawOptions,
24
35
  TearDownOptions extends CanvasVisibility.TearDownOptions = CanvasVisibility.TearDownOptions,
25
36
  > extends CanvasGroupMixin<typeof PIXI.Container, "visibility">(PIXI.Container)<DrawOptions, TearDownOptions> {
37
+ // static override groupName is handled by the CanvasGroupMixin type
38
+
26
39
  /**
27
40
  * The currently revealed vision.
28
41
  * @remarks Only `undefined` prior to first draw
@@ -37,6 +50,7 @@ declare class CanvasVisibility<
37
50
 
38
51
  /**
39
52
  * The optional visibility overlay sprite that should be drawn instead of the unexplored color in the fog of war.
53
+ * @remarks This is `undefined` prior to first draw, and it remains that way unless a fog overlay texture has been set for the current scene
40
54
  */
41
55
  visibilityOverlay: PIXI.Sprite | undefined;
42
56
 
@@ -57,55 +71,55 @@ declare class CanvasVisibility<
57
71
 
58
72
  /**
59
73
  * Define whether each lighting layer is enabled, required, or disabled by this vision mode.
60
- * The value for each lighting channel is a number in LIGHTING_VISIBILITY
74
+ * The value for each lighting channel is a number in {@linkcode VisionMode.LIGHTING_VISIBILITY}
61
75
  * ```js
62
76
  * {
63
77
  * background: VisionMode.LIGHTING_VISIBILITY.ENABLED,
64
- * illumination: VisionMode.LIGHTING_VISIBILITY.ENABLED,
65
- * coloration: VisionMode.LIGHTING_VISIBILITY.ENABLED,
66
- * darkness: VisionMode.LIGHTING_VISIBILITY.ENABLED,
67
- * any: true
78
+ * illumination: VisionMode.LIGHTING_VISIBILITY.ENABLED,
79
+ * coloration: VisionMode.LIGHTING_VISIBILITY.ENABLED,
80
+ * darkness: VisionMode.LIGHTING_VISIBILITY.ENABLED,
81
+ * any: true
68
82
  * }
69
83
  * ```
70
84
  */
71
85
  lightingVisibility: CanvasVisibility.LightingVisibility;
72
86
 
73
87
  /**
74
- * A status flag for whether the layer initialization workflow has succeeded.
88
+ * A status flag for whether the group initialization workflow has succeeded.
75
89
  */
76
90
  get initialized(): boolean;
77
91
 
78
92
  /**
79
93
  * Indicates whether containment filtering is required when rendering vision into a texture
80
- * @remarks Foundry marked `@internal`
94
+ * @internal
81
95
  */
82
96
  get needsContainment(): boolean;
83
97
 
84
98
  /**
85
99
  * Does the currently viewed Scene support Token field of vision?
100
+ * @remarks
101
+ * @throws If {@linkcode Canvas.scene | Canvas#scene} is `null`
86
102
  */
87
103
  get tokenVision(): Scene.Implementation["tokenVision"];
88
104
 
89
105
  /**
90
106
  * The configured options used for the saved fog-of-war texture.
91
- * @remarks Only `undefined` before first `#draw()`
107
+ * @remarks Only `undefined` prior to first draw
92
108
  */
93
109
  get textureConfiguration(): CanvasVisibility.TextureConfiguration | undefined;
94
110
 
95
111
  /**
96
112
  * Optional overrides for exploration sprite dimensions.
97
- *
98
- * @privateRemarks Foundry types this parameter as `FogTextureConfiguration` in v12.331 which is plainly wrong even if it didn't not exist
99
- * v13.335 types as `PIXI.Rectangle | undefined`, but only x/y/width/height are ever accessed, and only then if this has been set to something
100
- * other than `undefined`, and in fact nothing in core ever does.
113
+ * @privateRemarks Only `x`, `y`, `width`, and `height` are ever checked, and this is never even set by core anywhere,
114
+ * but they type it as a `PIXI.Rectangle` so might as well match.
101
115
  */
102
- set explorationRect(rect: Canvas.Rectangle | undefined);
116
+ set explorationRect(rect: PIXI.Rectangle | undefined);
103
117
 
104
118
  /** @remarks This getter doesn't actually exist, it's only here to correct the type inferred from the setter */
105
119
  get explorationRect(): undefined;
106
120
 
107
121
  /**
108
- * Initialize all Token vision sources which are present on this layer
122
+ * Initialize all Token vision sources which are present on this group
109
123
  */
110
124
  initializeSources(): void;
111
125
 
@@ -119,7 +133,7 @@ declare class CanvasVisibility<
119
133
  protected override _tearDown(options: HandleEmptyObject<TearDownOptions>): Promise<void>;
120
134
 
121
135
  /**
122
- * Update the display of the sight layer.
136
+ * Update the display of the visibility group.
123
137
  * Organize sources into rendering queues and draw lighting containers for each source
124
138
  */
125
139
  refresh(): void;
@@ -142,31 +156,25 @@ declare class CanvasVisibility<
142
156
 
143
157
  /**
144
158
  * Test whether a target point on the Canvas is visible based on the current vision and LOS polygons.
145
- * @param point - The point in space to test, an object with coordinates x and y.
159
+ * @param point - The point in space to test
146
160
  * @param options - Additional options which modify visibility testing.
147
161
  * @returns Whether the point is currently visible.
148
162
  */
149
- testVisibility(
150
- point: Canvas.Point,
151
- options?: CanvasVisibility.TestVisibilityOptions, // not:null (destructured when passed to _createVisibilityTestConfig)
152
- ): boolean;
163
+ testVisibility(point: Canvas.PossiblyElevatedPoint, options?: CanvasVisibility.TestVisibilityOptions): boolean;
153
164
 
154
165
  /**
155
166
  * Create the visibility test config.
156
167
  * @param point - The point in space to test, an object with coordinates x and y.
157
168
  * @param options - Additional options which modify visibility testing.
158
- * @remarks Foundry marked `@internal`
169
+ * @internal
170
+ * @remarks If a Point is passed without elevation, uses the `object`'s if it's a `Token`, otherwise defaults to `0`
159
171
  */
160
172
  protected _createVisibilityTestConfig(
161
- point: Canvas.Point,
162
- options?: CanvasVisibility.CreateTestConfigOptions, // not:null (destructured)
173
+ point: Canvas.PossiblyElevatedPoint,
174
+ options?: CanvasVisibility.CreateTestConfigOptions,
163
175
  ): CanvasVisibility.TestConfig;
164
176
 
165
- /**
166
- * @deprecated since v11, will be removed in v13
167
- * @remarks `"fogOverlay is deprecated in favor of visibilityOverlay"`
168
- */
169
- get fogOverlay(): this["visibilityOverlay"];
177
+ #CanvasVisibility: true;
170
178
  }
171
179
 
172
180
  declare namespace CanvasVisibility {
@@ -180,17 +188,50 @@ declare namespace CanvasVisibility {
180
188
  type TestObject = PlaceableObject.Any | null;
181
189
 
182
190
  interface VisionModeData {
183
- source: foundry.canvas.sources.PointVisionSource.Any | null | undefined;
184
- activeLightingOptions: IntentionalPartial<VisionMode["lighting"]>;
191
+ /**
192
+ * @remarks Only `undefined` immediately following construction. Gets set to a Source or `null` when {@linkcode Canvas.perception | canvas.perception} receives the
193
+ * {@linkcode PerceptionManager.RENDER_FLAGS.initializeVisionModes | initializeVisionModes} render flag
194
+ */
195
+ source: PointVisionSource.Any | null | undefined;
196
+
197
+ /**
198
+ * @remarks Defaults to `{}` at construction. Gets set to {@linkcode VisionMode.lighting | this.visionModeData.source?.visionMode.lighting}`|| {}` when
199
+ * {@linkcode Canvas.perception | canvas.perception} receives the {@linkcode PerceptionManager.RENDER_FLAGS.initializeVisionModes | initializeVisionModes}
200
+ * render flag.
201
+ */
202
+ activeLightingOptions: VisionMode.LightingData | EmptyObject;
185
203
  }
186
204
 
187
205
  interface LightingVisibility {
206
+ /**
207
+ * @remarks Defaults to {@linkcode VisionMode.LIGHTING_VISIBILITY.ENABLED | ENABLED} at construction. Updated in `CanvasVisibility##configureLightingVisibility`
208
+ * when {@linkcode Canvas.perception | canvas.perception} receives the {@linkcode PerceptionManager.RENDER_FLAGS.initializeVisionModes | initializeVisionModes}
209
+ * render flag.
210
+ */
188
211
  illumination: VisionMode.LIGHTING_VISIBILITY;
212
+
213
+ /**
214
+ * @remarks Defaults to {@linkcode VisionMode.LIGHTING_VISIBILITY.ENABLED | ENABLED} at construction. Updated in `CanvasVisibility##configureLightingVisibility`
215
+ * when {@linkcode Canvas.perception | canvas.perception} receives the {@linkcode PerceptionManager.RENDER_FLAGS.initializeVisionModes | initializeVisionModes}
216
+ * render flag.
217
+ */
189
218
  background: VisionMode.LIGHTING_VISIBILITY;
219
+
220
+ /**
221
+ * @remarks Defaults to {@linkcode VisionMode.LIGHTING_VISIBILITY.ENABLED | ENABLED} at construction. Updated in `CanvasVisibility##configureLightingVisibility`
222
+ * when {@linkcode Canvas.perception | canvas.perception} receives the {@linkcode PerceptionManager.RENDER_FLAGS.initializeVisionModes | initializeVisionModes}
223
+ * render flag.
224
+ */
190
225
  coloration: VisionMode.LIGHTING_VISIBILITY;
226
+
227
+ /**
228
+ * @remarks Defaults to {@linkcode VisionMode.LIGHTING_VISIBILITY.ENABLED | ENABLED} at construction. Updated in `CanvasVisibility##configureLightingVisibility`
229
+ * when {@linkcode Canvas.perception | canvas.perception} receives the {@linkcode PerceptionManager.RENDER_FLAGS.initializeVisionModes | initializeVisionModes}
230
+ * render flag.
231
+ */
191
232
  darkness: VisionMode.LIGHTING_VISIBILITY;
192
233
 
193
- /** @remarks Only set `false` if all other keys are `VisionMode.LIGHTING_VISIBILITY.DISABLED` */
234
+ /** @remarks Only set `false` if **all** other keys are {@linkcode VisionMode.LIGHTING_VISIBILITY.DISABLED} */
194
235
  any: boolean;
195
236
  }
196
237
 
@@ -200,10 +241,8 @@ declare namespace CanvasVisibility {
200
241
  type _CreateTestConfigOptions = InexactPartial<{
201
242
  /**
202
243
  * A numeric radial offset which allows for a non-exact match.
203
- * For example, if tolerance is 2 then the test will pass if the point
204
- * is within 2px of a vision polygon
244
+ * For example, if tolerance is 2 then the test will pass if the point is within 2px of a vision polygon
205
245
  * @defaultValue `2`
206
- * @remarks Can't be `null` because it only has a parameter default
207
246
  */
208
247
  tolerance: number;
209
248
 
@@ -217,43 +256,48 @@ declare namespace CanvasVisibility {
217
256
  interface CreateTestConfigOptions extends _CreateTestConfigOptions {}
218
257
 
219
258
  /** @internal */
220
- type _TestConfigOptional = NullishProps<{
259
+ type _TestConfigOptional = InexactPartial<{
221
260
  /**
222
261
  * The target object
223
262
  * @defaultValue `null`
224
- * @remarks Only checked in `#_canDetect` for `instanceof Token`
263
+ * @remarks Foundry marks this required, but it's only checked in three places in core:
264
+ * - {@linkcode DetectionMode._canDetect | DetectionMode#_canDetect} for `object instanceof Token`
265
+ * - {@linkcode CanvasVisibility._createVisibilityTestConfig | CanvasVisibility#_crateVisibilityTestConfig} for `object instanceof Token`
266
+ * - {@linkcode foundry.canvas.sources.PointLightSource._canDetectObject | PointLightSource#_canDetectObject} for `object?.document instanceof TokenDocument`
267
+ * All of which are nullish-safe, so this is allowed to be optional/`undefined`, and if coming in via {@linkcode CanvasVisibility.testVisibility | #testVisibility}, it
268
+ * gets a `null` parameter default applied
225
269
  */
226
270
  object: TestObject;
227
271
  }>;
228
272
 
229
- /** @internal */
230
- interface _TestConfigRequired {
273
+ interface TestConfig extends _TestConfigOptional {
231
274
  /** An array of visibility tests */
232
275
  tests: CanvasVisibility.Test[];
233
276
  }
234
277
 
235
- interface TestConfig extends _TestConfigRequired, _TestConfigOptional {}
236
-
237
278
  interface Test {
238
- point: Canvas.Point;
239
- elevation: number;
240
- los: Map<foundry.canvas.sources.PointVisionSource.Any, boolean>;
279
+ point: Canvas.ElevatedPoint;
280
+
281
+ /**
282
+ * @deprecated "`CanvasVisibility.Test#elevation` has been deprecated in favor of {@linkcode Canvas.ElevatedPoint.elevation | CanvasVisibility.Test#point#elevation}." (since v13, until v15)
283
+ * @remarks This deprecation shim only exists on configs generated by {@linkcode CanvasVisibility._createVisibilityTestConfig | CanvasVisibility#_createVisibilityTestConfig}.
284
+ * @privateRemarks Actually a getter/setter pair tied to `this.point.elevation`, but getters/setters can't be optional.
285
+ *
286
+ * Can't be `undefined` as that is not a valid value for {@linkcode Canvas.ElevatedPoint.elevation}
287
+ */
288
+ elevation?: number;
289
+
290
+ los: Map<PointVisionSource.Any, boolean>;
241
291
  }
242
292
 
243
293
  /**
244
- * @privateRemarks This is a fixed subset of `PIXI.IBaseTextureOptions` that `CanvasVisibility##createTextureConfiguration` produces.
245
- * Since it's generated by a private method and stored in a private property, it's not meaningfully extensible (`canvas.visibility.textureConfiguration.foo = "bar"` doesn't count)
294
+ * @remarks The subset of {@linkcode PIXI.IBaseTextureOptions} that `CanvasVisibility##createTextureConfiguration` returns.
246
295
  */
247
- interface TextureConfiguration {
248
- resolution: number;
249
- width: number;
250
- height: number;
251
- mipmap: PIXI.MIPMAP_MODES;
252
- multisample: PIXI.MSAA_QUALITY;
253
- scaleMode: PIXI.SCALE_MODES;
254
- alphaMode: PIXI.ALPHA_MODES;
255
- format: PIXI.FORMATS;
256
- }
296
+ interface TextureConfiguration
297
+ extends Pick<
298
+ PIXI.IBaseTextureOptions,
299
+ "resolution" | "width" | "height" | "mipmap" | "multisample" | "scaleMode" | "alphaMode" | "format"
300
+ > {}
257
301
  }
258
302
 
259
303
  export default CanvasVisibility;