@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250804084032 → 13.346.0-beta.20250805163236

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 (53) hide show
  1. package/package.json +1 -1
  2. package/src/configuration/configuration.d.mts +3 -3
  3. package/src/configuration/hooks.d.mts +6 -4
  4. package/src/foundry/client/canvas/board.d.mts +1 -1
  5. package/src/foundry/client/canvas/containers/elements/door-control.d.mts +12 -4
  6. package/src/foundry/client/canvas/groups/canvas-group-mixin.d.mts +45 -23
  7. package/src/foundry/client/canvas/groups/effects.d.mts +136 -41
  8. package/src/foundry/client/canvas/groups/environment.d.mts +191 -48
  9. package/src/foundry/client/canvas/groups/hidden.d.mts +43 -15
  10. package/src/foundry/client/canvas/groups/interface.d.mts +38 -27
  11. package/src/foundry/client/canvas/groups/overlay.d.mts +17 -4
  12. package/src/foundry/client/canvas/groups/primary.d.mts +57 -30
  13. package/src/foundry/client/canvas/groups/rendered.d.mts +17 -4
  14. package/src/foundry/client/canvas/groups/visibility.d.mts +17 -6
  15. package/src/foundry/client/canvas/interaction/ruler/ruler.d.mts +10 -2
  16. package/src/foundry/client/canvas/layers/controls.d.mts +13 -5
  17. package/src/foundry/client/canvas/layers/sounds.d.mts +1 -1
  18. package/src/foundry/client/canvas/perception/detection-mode.d.mts +9 -6
  19. package/src/foundry/client/canvas/perception/detection-modes/darkvision.d.mts +1 -1
  20. package/src/foundry/client/canvas/perception/detection-modes/invisibility-perception.d.mts +1 -1
  21. package/src/foundry/client/canvas/perception/detection-modes/light-perception.d.mts +2 -2
  22. package/src/foundry/client/canvas/perception/detection-modes/super-perception.d.mts +1 -1
  23. package/src/foundry/client/canvas/perception/detection-modes/tremor-perception.d.mts +1 -1
  24. package/src/foundry/client/canvas/perception/fog.d.mts +13 -5
  25. package/src/foundry/client/canvas/perception/vision-mode.d.mts +4 -4
  26. package/src/foundry/client/canvas/placeables/tokens/ring.d.mts +10 -2
  27. package/src/foundry/client/canvas/primary/primary-canvas-object.d.mts +1 -1
  28. package/src/foundry/client/canvas/rendering/filters/effects-masking.d.mts +11 -4
  29. package/src/foundry/client/canvas/rendering/filters/visibility.d.mts +11 -4
  30. package/src/foundry/client/canvas/sources/base-effect-source.d.mts +2 -3
  31. package/src/foundry/client/canvas/sources/point-darkness-source.d.mts +10 -2
  32. package/src/foundry/client/canvas/sources/point-light-source.d.mts +10 -2
  33. package/src/foundry/client/canvas/sources/point-sound-source.d.mts +10 -2
  34. package/src/foundry/client/canvas/sources/point-vision-source.d.mts +10 -2
  35. package/src/foundry/client/config.d.mts +142 -86
  36. package/src/foundry/client/dice/roll.d.mts +18 -7
  37. package/src/foundry/client/documents/chat-message.d.mts +2 -2
  38. package/src/foundry/client/documents/collections/actors.d.mts +10 -2
  39. package/src/foundry/client/documents/collections/card-stacks.d.mts +10 -2
  40. package/src/foundry/client/documents/collections/chat-messages.d.mts +11 -3
  41. package/src/foundry/client/documents/collections/combat-encounters.d.mts +10 -2
  42. package/src/foundry/client/documents/collections/fog-explorations.d.mts +10 -2
  43. package/src/foundry/client/documents/collections/folders.d.mts +10 -2
  44. package/src/foundry/client/documents/collections/items.d.mts +10 -2
  45. package/src/foundry/client/documents/collections/journal.d.mts +10 -2
  46. package/src/foundry/client/documents/collections/macros.d.mts +10 -2
  47. package/src/foundry/client/documents/collections/playlists.d.mts +10 -2
  48. package/src/foundry/client/documents/collections/roll-tables.d.mts +10 -2
  49. package/src/foundry/client/documents/collections/scenes.d.mts +10 -2
  50. package/src/foundry/client/documents/collections/users.d.mts +10 -2
  51. package/src/foundry/client/documents/collections/world-settings.d.mts +10 -2
  52. package/src/foundry/client/documents/scene.d.mts +45 -37
  53. package/src/foundry/client/hooks.d.mts +41 -19
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@league-of-foundry-developers/foundry-vtt-types",
4
- "version": "13.346.0-beta.20250804084032",
4
+ "version": "13.346.0-beta.20250805163236",
5
5
  "description": "TypeScript type definitions for Foundry VTT",
6
6
  "type": "module",
7
7
  "types": "./src/index.d.mts",
@@ -344,9 +344,9 @@ export interface SettingConfig {
344
344
  choices: InterfaceToObject<typeof CONFIG.Dice.rollModes>;
345
345
  },
346
346
  // Note(LukeAbby): This override is necessary because the `initial` wasn't removing `null`.
347
- CONFIG.Dice.RollMode | null | undefined,
348
- CONFIG.Dice.RollMode,
349
- CONFIG.Dice.RollMode
347
+ foundry.dice.Roll.Mode | null | undefined,
348
+ foundry.dice.Roll.Mode,
349
+ foundry.dice.Roll.Mode
350
350
  >;
351
351
  "core.rtcClientSettings": typeof AVSettings.schemaFields.client;
352
352
  "core.rtcWorldSettings": typeof AVSettings.schemaFields.world;
@@ -43,10 +43,12 @@ export interface DeprecatedHookConfig {
43
43
  /**
44
44
  * @deprecated This hook appears to have been deleted.
45
45
  */
46
- getSceneNavigationContext: (
47
- app: foundry.applications.ui.SceneNavigation,
48
- contextOptions: foundry.applications.ux.ContextMenu.Entry<HTMLElement>[],
49
- ) => boolean | void;
46
+ getSceneNavigationContext: (app: never, contextOptions: never) => never;
47
+
48
+ /**
49
+ * @deprecated Removed without replacement in v13. This warning will be removed in v14.
50
+ */
51
+ initializeDarknessSources: (group: never) => never;
50
52
  }
51
53
 
52
54
  /**
@@ -414,7 +414,7 @@ declare class Canvas extends _InternalCanvas {
414
414
  /**
415
415
  * Create a SceneManager instance used for this Scene, if any.
416
416
  */
417
- static getSceneManager(scene: Scene.Implementation): foundry.canvas.SceneManager | null;
417
+ static getSceneManager(scene: Scene.Implementation): foundry.canvas.SceneManager.Any | null;
418
418
 
419
419
  /**
420
420
  * Get the value of a GL parameter
@@ -76,11 +76,19 @@ declare class DoorControl extends PIXI.Container {
76
76
  }
77
77
 
78
78
  declare namespace DoorControl {
79
- interface Any extends AnyDoorControl {}
80
- interface AnyConstructor extends Identity<typeof AnyDoorControl> {}
79
+ /** @deprecated There should only be a single implementation of this class in use at one time, use {@linkcode Implementation} instead */
80
+ type Any = Internal.Any;
81
81
 
82
- type ImplementationClass = CONFIG["Canvas"]["doorControlClass"];
83
- type Implementation = FixedInstanceType<ImplementationClass>;
82
+ /** @deprecated There should only be a single implementation of this class in use at one time, use {@linkcode ImplementationClass} instead */
83
+ type AnyConstructor = Internal.AnyConstructor;
84
+
85
+ namespace Internal {
86
+ interface Any extends AnyDoorControl {}
87
+ interface AnyConstructor extends Identity<typeof AnyDoorControl> {}
88
+ }
89
+
90
+ interface ImplementationClass extends Identity<CONFIG["Canvas"]["doorControlClass"]> {}
91
+ interface Implementation extends FixedInstanceType<ImplementationClass> {}
84
92
 
85
93
  /**
86
94
  * @deprecated Replaced by {@linkcode DoorControl.ImplementationClass}.
@@ -1,22 +1,25 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
1
  import type { FixedInstanceType, HandleEmptyObject, Identity, PrettifyType, RemoveIndexSignatures } from "#utils";
3
2
  import type { Canvas } from "#client/canvas/_module.d.mts";
4
3
  import type { CanvasLayer } from "#client/canvas/layers/_module.d.mts";
4
+ // Hooks only used for links
5
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
6
+ import type { AllHooks } from "#client/hooks.mjs";
5
7
 
6
8
  declare const DynamicClass: new <_Computed extends object>(...args: never) => _Computed;
7
9
 
8
10
  // @ts-expect-error This is a workaround to allow for dynamic top level properties in a class.
9
11
  declare class LayersClass<
10
- Group extends CanvasGroupMixin.LayerGroup | NoLayerGroup,
12
+ Group extends CanvasGroupMixin.ConfiguredGroupNames | NoLayerGroup,
11
13
  Instance extends object = RemoveIndexSignatures<CanvasGroupMixin.LayersFor<Group>>,
14
+ // TODO: include child groups https://github.com/League-of-Foundry-Developers/foundry-vtt-types/issues/3444
12
15
  > extends DynamicClass<Instance> {}
13
16
 
14
17
  // Note(LukeAbby): This interface has been separated out to simplify the constructor edge cases.
15
18
  // By avoiding having the instance side it makes the class more malleable and allows generics.
16
- interface CanvasGroupStatic<Group extends CanvasGroupMixin.LayerGroup | NoLayerGroup> {
19
+ interface CanvasGroupStatic<Group extends CanvasGroupMixin.ConfiguredGroupNames | NoLayerGroup> {
17
20
  /**
18
21
  * The name of this canvas group
19
- * @remarks Foundry marked as abstract
22
+ * @privateRemarks Foundry marked as abstract
20
23
  */
21
24
  groupName: Group extends NoLayerGroup ? undefined : Group;
22
25
 
@@ -28,30 +31,36 @@ interface CanvasGroupStatic<Group extends CanvasGroupMixin.LayerGroup | NoLayerG
28
31
  }
29
32
 
30
33
  declare class CanvasGroup<
31
- Group extends CanvasGroupMixin.LayerGroup | NoLayerGroup,
34
+ Group extends CanvasGroupMixin.ConfiguredGroupNames | NoLayerGroup,
32
35
  DrawOptions extends CanvasGroupMixin.DrawOptions = CanvasGroupMixin.DrawOptions,
33
36
  TearDownOptions extends CanvasGroupMixin.TearDownOptions = CanvasGroupMixin.TearDownOptions,
34
37
  > extends LayersClass<Group> {
35
38
  /** @privateRemarks All mixin classes should accept anything for its constructor. */
36
39
  constructor(...args: any[]);
37
40
 
38
- /** @defaultValue `true` */
41
+ /**
42
+ * @defaultValue `true`
43
+ * @remarks Actually an override of {@linkcode PIXI.Container.sortableChildren | PIXI.Container#sortableChildren}
44
+ */
39
45
  sortableChildren: boolean;
40
46
 
41
47
  /**
42
48
  * The canonical name of the canvas group is the name of the constructor that is the immediate child of the defined base class.
49
+ * @remarks For example, both `CanvasVisibility` and any user-provided subclasses would return `"CanvasVisibility"`, as that
50
+ * is the class in the chain that extends {@linkcode CanvasGroup | CanvasGroupMixin}
43
51
  */
44
52
  get name(): string;
45
53
 
46
54
  /**
47
55
  * The name used by hooks to construct their hook string.
48
56
  * Note: You should override this getter if hookName should not return the class constructor name.
57
+ * @remarks Just returns {@link name | this.name} in core's implementation
49
58
  */
50
59
  get hookName(): string;
51
60
 
52
61
  /**
53
62
  * A mapping of CanvasLayer classes which belong to this group.
54
- * @remarks Default value defined by this._createLayers, which is called in the constructor, and pulls from CONFIG.Canvas.layers
63
+ * @remarks Default value defined by this._createLayers, which is called in the constructor, and pulls from {@linkcode CONFIG.Canvas.layers}
55
64
  */
56
65
  layers: CanvasGroupMixin.LayersFor<Group>;
57
66
 
@@ -60,21 +69,27 @@ declare class CanvasGroup<
60
69
  */
61
70
  protected _createLayers(): CanvasGroupMixin.LayersFor<Group>;
62
71
 
63
- /** Draw the canvas group and all its component layers. */
72
+ /**
73
+ * Draw the canvas group and all its component layers.
74
+ * @remarks Fires the {@linkcode Hooks.DrawGroup | drawGroupName} hook where `GroupName` is replaced with {@linkcode hookName | this.hookName}
75
+ */
64
76
  draw(options?: HandleEmptyObject<DrawOptions>): Promise<this>;
65
77
 
66
78
  /**
67
79
  * Draw the canvas group and all its component layers.
80
+ * @remarks Will always be passed an options object by {@linkcode draw}
68
81
  */
69
- protected _draw(options?: HandleEmptyObject<DrawOptions>): Promise<void>;
82
+ protected _draw(options: HandleEmptyObject<DrawOptions>): Promise<void>;
70
83
 
71
84
  /**
72
85
  * Remove and destroy all layers from the base canvas.
86
+ * @remarks Fires the {@linkcode Hooks.TearDownGroup | tearDownGroupName} hook where `GroupName` is replaced with {@linkcode hookName | this.hookName}
73
87
  */
74
- tearDown(options: HandleEmptyObject<TearDownOptions>): Promise<this>;
88
+ tearDown(options?: HandleEmptyObject<TearDownOptions>): Promise<this>;
75
89
 
76
90
  /**
77
91
  * Remove and destroy all layers from the base canvas.
92
+ * @remarks Will always be passed an options object by {@linkcode draw}
78
93
  */
79
94
  protected _tearDown(options: HandleEmptyObject<TearDownOptions>): Promise<void>;
80
95
 
@@ -86,7 +101,7 @@ type NoLayerGroup = typeof _NoLayerGroup;
86
101
 
87
102
  type ApplyGroup<
88
103
  BaseClass extends CanvasGroupMixin.BaseClass,
89
- Group extends CanvasGroupMixin.LayerGroup | NoLayerGroup,
104
+ Group extends CanvasGroupMixin.ConfiguredGroupNames | NoLayerGroup,
90
105
  > = CanvasGroupStatic<Group> &
91
106
  (new <DrawOptions extends CanvasGroupMixin.DrawOptions, TearDownOptions extends CanvasGroupMixin.TearDownOptions>(
92
107
  ...args: ConstructorParameters<BaseClass>
@@ -99,8 +114,8 @@ type ApplyGroup<
99
114
  declare function CanvasGroupMixin<
100
115
  BaseClass extends CanvasGroupMixin.BaseClass,
101
116
  // In `_createLayers` the code assigns top level properties to the class.
102
- // This is why Group exists.`
103
- Group extends CanvasGroupMixin.LayerGroup | NoLayerGroup = NoLayerGroup,
117
+ // This is why the Group type param exists.
118
+ Group extends CanvasGroupMixin.ConfiguredGroupNames | NoLayerGroup = NoLayerGroup,
104
119
  >(ContainerClass: BaseClass): CanvasGroupMixin.Mix<BaseClass, Group>;
105
120
 
106
121
  declare global {
@@ -120,7 +135,7 @@ declare namespace CanvasGroupMixin {
120
135
 
121
136
  type Mix<
122
137
  BaseClass extends CanvasGroupMixin.BaseClass,
123
- Group extends CanvasGroupMixin.LayerGroup | NoLayerGroup,
138
+ Group extends CanvasGroupMixin.ConfiguredGroupNames | NoLayerGroup,
124
139
  > = BaseClass & ApplyGroup<BaseClass, Group>;
125
140
 
126
141
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
@@ -129,13 +144,9 @@ declare namespace CanvasGroupMixin {
129
144
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
130
145
  interface TearDownOptions {}
131
146
 
132
- interface Layers {
133
- readonly [key: string]: CanvasLayer;
134
- }
147
+ type ConfiguredGroupNames = keyof CONFIG["Canvas"]["groups"];
135
148
 
136
- type LayerGroup = keyof CONFIG["Canvas"]["groups"];
137
-
138
- type LayersFor<T extends LayerGroup | NoLayerGroup> = PrettifyType<
149
+ type LayersFor<T extends ConfiguredGroupNames | NoLayerGroup> = PrettifyType<
139
150
  _FilterOutNever<{
140
151
  readonly [K in keyof typeof Canvas.layers]: (typeof Canvas.layers)[K] extends {
141
152
  readonly layerClass?: abstract new (...args: infer _1) => infer LayerInstance extends CanvasLayer;
@@ -146,6 +157,17 @@ declare namespace CanvasGroupMixin {
146
157
  }>
147
158
  >;
148
159
 
160
+ // type ChildGroupsFor<Parent extends ConfiguredGroupNames | NoLayerGroup> = PrettifyType<
161
+ // _FilterOutNever<{
162
+ // readonly [K in ConfiguredGroupNames]: CONFIG.Canvas.Groups[K] extends {
163
+ // readonly groupClass?: abstract new (...args: infer _1) => infer GroupInstance extends AnyMixed;
164
+ // readonly parent?: Parent;
165
+ // }
166
+ // ? GroupInstance
167
+ // : never;
168
+ // }>
169
+ // >;
170
+
149
171
  /** @internal */
150
172
  type _FilterOutNever<T> = {
151
173
  [K in keyof T as [T[K]] extends [never] ? never : K]: T[K];
@@ -159,7 +181,7 @@ declare namespace CanvasGroupMixin {
159
181
 
160
182
  export default CanvasGroupMixin;
161
183
 
162
- declare abstract class InnerAnyCanvasGroup extends CanvasGroup<
184
+ declare abstract class _InnerAnyCanvasGroup extends CanvasGroup<
163
185
  NoLayerGroup,
164
186
  CanvasGroupMixin.DrawOptions,
165
187
  CanvasGroupMixin.TearDownOptions
@@ -167,11 +189,11 @@ declare abstract class InnerAnyCanvasGroup extends CanvasGroup<
167
189
  constructor(...args: never);
168
190
  }
169
191
 
170
- declare class MixableContainer extends PIXI.Container {
192
+ declare class _MixableContainer extends PIXI.Container {
171
193
  constructor(...args: any[]);
172
194
  }
173
195
 
174
- declare const MergedCanvasGroup: typeof MixableContainer & typeof InnerAnyCanvasGroup & CanvasGroupStatic<any>;
196
+ declare const MergedCanvasGroup: typeof _MixableContainer & typeof _InnerAnyCanvasGroup & CanvasGroupStatic<any>;
175
197
 
176
198
  // Note(LukeAbby) It's more involved than typical to get a proper `AnyCanvasGroup` type because
177
199
  // static side and instance side have been split apart and mixing `PIXI.Container` has to be done
@@ -1,15 +1,18 @@
1
- import type { HandleEmptyObject, Identity, NullishProps } from "#utils";
2
- import type { Canvas } from "#client/canvas/_module.d.mts";
1
+ import type { FixedInstanceType, HandleEmptyObject, Identity, InexactPartial } from "#utils";
2
+ import type { Canvas, sources } from "#client/canvas/_module.d.mts";
3
3
  import type { CanvasAnimation } from "#client/canvas/animation/_module.d.mts";
4
4
  import type { AbstractBaseShader } from "#client/canvas/rendering/shaders/_module.d.mts";
5
5
  import type { VisualEffectsMaskingFilter } from "#client/canvas/rendering/filters/_module.d.mts";
6
- import type { CanvasGroupMixin } from "#client/canvas/groups/_module.d.mts";
6
+ import type { CanvasGroupMixin, CanvasVisibility, EnvironmentCanvasGroup } from "#client/canvas/groups/_module.d.mts";
7
7
  import type * as layers from "#client/canvas/layers/_module.d.mts";
8
+ // Only used for, and aliased to match, foundry's links
9
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
+ import type { AllHooks as hookEvents } from "#client/hooks.mjs";
8
11
 
9
12
  declare module "#configuration" {
10
13
  namespace Hooks {
11
14
  interface CanvasGroupConfig {
12
- EffectsCanvasGroup: EffectsCanvasGroup.Any;
15
+ EffectsCanvasGroup: EffectsCanvasGroup.Implementation;
13
16
  }
14
17
  }
15
18
  }
@@ -21,7 +24,7 @@ declare module "#configuration" {
21
24
  * The effects canvas group is now only performing shape initialization, logic that needs to happen at
22
25
  * the placeable or object level is now their burden.
23
26
  * - [DONE] Adding or removing a source from the EffectsCanvasGroup collection.
24
- * - [TODO] A change in a darkness source should re-initialize all overlaping light and vision source.
27
+ * - [TODO] A change in a darkness source should re-initialize all overlapping light and vision source.
25
28
  *
26
29
  * ### Hook Events
27
30
  * - {@linkcode hookEvents.lightingRefresh}
@@ -30,6 +33,8 @@ declare class EffectsCanvasGroup<
30
33
  DrawOptions extends EffectsCanvasGroup.DrawOptions = EffectsCanvasGroup.DrawOptions,
31
34
  TearDownOptions extends EffectsCanvasGroup.TearDownOptions = EffectsCanvasGroup.TearDownOptions,
32
35
  > extends CanvasGroupMixin(PIXI.Container)<DrawOptions, TearDownOptions> {
36
+ // static override groupName is handled by the CanvasGroupMixin type
37
+
33
38
  /**
34
39
  * Whether to currently animate light sources.
35
40
  * @defaultValue `true`
@@ -44,54 +49,68 @@ declare class EffectsCanvasGroup<
44
49
 
45
50
  /**
46
51
  * A mapping of light sources which are active within the rendered Scene.
52
+ * @remarks Foundry always initializes prior to adding to this collection
47
53
  */
48
- lightSources: Collection<foundry.canvas.sources.PointLightSource>;
54
+ // TODO: Make .InitializedImplementation when https://github.com/League-of-Foundry-Developers/foundry-vtt-types/issues/3438 is completed
55
+ lightSources: Collection<sources.PointLightSource.Internal.Any>;
49
56
 
50
57
  /**
51
58
  * A mapping of darkness sources which are active within the rendered Scene.
59
+ * @remarks Foundry always initializes prior to adding to this collection
52
60
  */
53
- darknessSources: Collection<foundry.canvas.sources.PointDarknessSource>;
61
+ // TODO: Make .InitializedImplementation
62
+ darknessSources: Collection<sources.PointDarknessSource.Internal.Any>;
54
63
 
55
64
  /**
56
65
  * A Collection of vision sources which are currently active within the rendered Scene.
66
+ * @remarks Foundry always initializes prior to adding to this collection
57
67
  */
58
- visionSources: Collection<foundry.canvas.sources.PointVisionSource.Any>;
68
+ // TODO: Make .InitializedImplementation
69
+ visionSources: Collection<sources.PointVisionSource.Internal.Any>;
59
70
 
60
71
  /**
61
72
  * A set of vision mask filters used in visual effects group
62
73
  */
63
- visualEffectsMaskingFilters: Set<VisualEffectsMaskingFilter>;
74
+ visualEffectsMaskingFilters: Set<VisualEffectsMaskingFilter.Implementation>;
64
75
 
65
76
  /**
66
77
  * Iterator for all light and darkness sources.
67
78
  */
79
+ // TODO: Make .InitializedImplementation
68
80
  allSources(): Generator<
69
- foundry.canvas.sources.PointDarknessSource | foundry.canvas.sources.PointLightSource,
81
+ sources.PointDarknessSource.Internal.Any | sources.PointLightSource.Internal.Any,
70
82
  void,
71
83
  undefined
72
84
  >;
73
85
 
74
- override _createLayers(): Record<string, layers.CanvasLayer>;
86
+ /**
87
+ * @remarks `EffectsCanvasGroup` doesn't use the same dynamic layer property assignment as other groups, instead this returns
88
+ * an object with known keys ({@linkcode background}, {@linkcode illumination}, {@linkcode coloration}, and {@linkcode darkness})
89
+ */
90
+ protected override _createLayers(): EffectsCanvasGroup.Layers;
91
+
92
+ /** @privateRemarks Fake override to sync with {@linkcode _createLayers} */
93
+ override layers: EffectsCanvasGroup.Layers;
75
94
 
76
95
  /**
77
96
  * A layer of background alteration effects which change the appearance of the primary group render texture.
78
97
  */
79
- background: layers.CanvasBackgroundAlterationEffects;
98
+ background: layers.CanvasBackgroundAlterationEffects.Any;
80
99
 
81
100
  /**
82
101
  * A layer which adds illumination-based effects to the scene.
83
102
  */
84
- illumination: layers.CanvasIlluminationEffects;
103
+ illumination: layers.CanvasIlluminationEffects.Any;
85
104
 
86
105
  /**
87
106
  * A layer which adds color-based effects to the scene.
88
107
  */
89
- coloration: layers.CanvasColorationEffects;
108
+ coloration: layers.CanvasColorationEffects.Any;
90
109
 
91
110
  /**
92
111
  * A layer which adds darkness effects to the scene.
93
112
  */
94
- darkness: layers.CanvasDarknessEffects;
113
+ darkness: layers.CanvasDarknessEffects.Any;
95
114
 
96
115
  /**
97
116
  * Clear all effects containers and animated sources.
@@ -107,12 +126,13 @@ declare class EffectsCanvasGroup<
107
126
  initializeLightSources(): void;
108
127
 
109
128
  /**
110
- * Re-initialize the shapes of all darkness sources in the Scene.
111
- * This happens before initialization of light sources because darkness sources contribute additional edges which
112
- * limit perception.
113
- * Packages can use the "initializeDarknessSources" hook to programmatically add darkness sources.
129
+ * Initialize all sources that generate edges (Darkness and certain Light sources).
130
+ * Darkness sources always generate edges. Light sources only do so if their priority is strictly greater than 0.
131
+ * The `edgesSources` array will be rebuilt and sorted by descending priority, in the case of a tie,
132
+ * DarknessSources take precedence. Otherwise, the existing array is used as-is.
133
+ * Regardless of whether the array is rebuilt, each source is re-initialized to ensure their geometry is refreshed.
114
134
  */
115
- initializeDarknessSources(): void;
135
+ initializePriorityLightSources(): void;
116
136
 
117
137
  /**
118
138
  * Refresh the state and uniforms of all light sources and darkness sources objects.
@@ -129,37 +149,64 @@ declare class EffectsCanvasGroup<
129
149
  */
130
150
  refreshLighting(): void;
131
151
 
152
+ /**
153
+ * Test whether the point is inside light.
154
+ * @param point - The point to test.
155
+ * @returns Is inside light?
156
+ */
157
+ testInsideLight(point: Canvas.ElevatedPoint, options?: EffectsCanvasGroup.TestInsideLightOptions): boolean;
158
+
132
159
  /**
133
160
  * Test whether the point is inside light.
134
161
  * @param point - The point.
135
162
  * @param elevation - The elevation of the point.
136
163
  * @returns Is inside light?
164
+ * @deprecated "`EffectsCanvasGroup#testInsideLight(point: Point, elevation: number)` has been deprecated in favor of `EffectsCanvasGroup#testInsideLight(point: ElevatedPoint, options: object)`." (since v13, until v15)
137
165
  */
138
166
  testInsideLight(point: Canvas.Point, elevation: number): boolean;
139
167
 
168
+ /**
169
+ * Test whether the point is inside darkness.
170
+ * @param point - The point to test.
171
+ * @returns Is inside darkness?
172
+ */
173
+ testInsideDarkness(point: Canvas.ElevatedPoint, options?: EffectsCanvasGroup.TestInsideDarknessOptions): boolean;
174
+
140
175
  /**
141
176
  * Test whether the point is inside darkness.
142
177
  * @param point - The point.
143
178
  * @param elevation - The elevation of the point.
144
179
  * @returns Is inside darkness?
145
180
  * @remarks Foundry does not use the `elevation` parameter
181
+ * @deprecated "`EffectsCanvasGroup#testInsideDarkness(point: Point, elevation: number)` has been deprecated in favor of `EffectsCanvasGroup#testInsideDarkness(point: ElevatedPoint, options: object)`." (since v13, until v15)
182
+ *
146
183
  */
147
- testInsideDarkness(point: Canvas.Point, _elevation?: number): boolean;
184
+ testInsideDarkness(point: Canvas.Point, _elevation: number): boolean;
185
+
186
+ /**
187
+ * Get the darkness level at the given point.
188
+ * @param point - The point.
189
+ * @returns The darkness level.
190
+ */
191
+ getDarknessLevel(point: Canvas.ElevatedPoint): number;
148
192
 
149
193
  /**
150
194
  * Get the darkness level at the given point.
151
195
  * @param point - The point.
152
196
  * @param elevation - The elevation of the point.
153
197
  * @returns The darkness level.
198
+ * @deprecated "`EffectsCanvasGroup#getDarknessLevel(point: Point, elevation: number)` has been deprecated in favor of `EffectsCanvasGroup#getDarknessLevel(point: ElevatedPoint)`." (since v13, until v15)
154
199
  */
155
- getDarknessLevel(point: Canvas.Point, elevation: number): number;
200
+ getDarknessLevel(point: Canvas.Point, _elevation: number): number;
156
201
 
157
- override _tearDown(options: HandleEmptyObject<TearDownOptions>): Promise<void>;
202
+ protected override _tearDown(options: HandleEmptyObject<TearDownOptions>): Promise<void>;
158
203
 
159
204
  /**
160
205
  * Activate vision masking for visual effects
161
- * @param enabled - Whether to enable or disable vision masking
162
- * (default: `true`)
206
+ * @param enabled - Whether to enable or disable vision masking (default: `true`)
207
+ * @remarks Despite the name, this will not swap the existing state, just set it to the value of `enabled`.
208
+ *
209
+ * Ignores `enabled` and always sets `false` if {@linkcode Canvas.visibilityOptions.persistentVision | canvas.visibilityOptions.persistentVision} is truthy
163
210
  */
164
211
  toggleMaskingFilters(enabled?: boolean): void;
165
212
 
@@ -199,34 +246,66 @@ declare class EffectsCanvasGroup<
199
246
  animateDarkness(target?: number, options?: EffectsCanvasGroup.AnimateDarknessOptions): CanvasAnimation.AnimateReturn;
200
247
 
201
248
  /**
202
- * @deprecated since v12, until v14
203
- * @remarks "EffectsCanvasGroup#visibility has been deprecated and moved to Canvas#visibility."
249
+ * @deprecated "`EffectsCanvasGroup#visibility` has been deprecated and moved to {@linkcode foundry.canvas.Canvas.visibility | Canvas#visibility}." (since v12, until v14)
204
250
  */
205
- get visibility(): Canvas["visibility"];
251
+ get visibility(): CanvasVisibility.Implementation;
206
252
 
207
253
  /**
208
- * @deprecated since v12, until v14
209
- * @remarks "EffectsCanvasGroup#globalLightSource has been deprecated and moved to EnvironmentCanvasGroup#globalLightSource."
254
+ * @deprecated "`EffectsCanvasGroup#globalLightSource` has been deprecated and moved to {@linkcode EnvironmentCanvasGroup.Implementation.globalLightSource | EnvironmentCanvasGroup#globalLightSource}." (since v12, until v14)
210
255
  */
211
- get globalLightSource(): Canvas["environment"]["globalLightSource"];
256
+ get globalLightSource(): EnvironmentCanvasGroup.Implementation["globalLightSource"];
212
257
 
213
258
  /**
214
- * @deprecated since v12
215
- * @remarks "EffectsCanvasGroup#updateGlobalLightSource has been deprecated and is part of EnvironmentCanvasGroup#initialize workflow."
259
+ * @deprecated "`EffectsCanvasGroup#updateGlobalLightSource` has been deprecated and is part of {@linkcode EnvironmentCanvasGroup.Implementation.initialize | EnvironmentCanvasGroup#initialize} workflow." (since v12, until v14)
216
260
  */
217
261
  updateGlobalLightSource(): void;
262
+
263
+ /**
264
+ * @deprecated "`EffectsCanvasGroup#initializeDarknessSources` and its associated hook are now obsolete and have no replacement." (since v13, until v15)
265
+ */
266
+ initializeDarknessSources(): void;
267
+
268
+ #EffectsCanvasGroup: true;
218
269
  }
219
270
 
220
271
  declare namespace EffectsCanvasGroup {
221
- interface Any extends AnyEffectsCanvasGroup {}
222
- interface AnyConstructor extends Identity<typeof AnyEffectsCanvasGroup> {}
272
+ /** @deprecated There should only be a single implementation of this class in use at one time, use {@linkcode Implementation} instead */
273
+ type Any = Internal.Any;
274
+
275
+ /** @deprecated There should only be a single implementation of this class in use at one time, use {@linkcode ImplementationClass} instead */
276
+ type AnyConstructor = Internal.AnyConstructor;
277
+
278
+ namespace Internal {
279
+ interface Any extends AnyEffectsCanvasGroup {}
280
+ interface AnyConstructor extends Identity<typeof AnyEffectsCanvasGroup> {}
281
+ }
282
+
283
+ interface ImplementationClass extends Identity<typeof CONFIG.Canvas.groups.effects.groupClass> {}
284
+ interface Implementation extends FixedInstanceType<ImplementationClass> {}
285
+
286
+ /** @internal */
287
+ type _TestInsideLightOptions = InexactPartial<{
288
+ /** Optional condition a source must satisfy in order to be tested. */
289
+ // TODO: Make .InitializedImplementation
290
+ condition: (source: sources.PointLightSource.Internal.Any | sources.GlobalLightSource.Any) => boolean;
291
+ }>;
292
+
293
+ interface TestInsideLightOptions extends _TestInsideLightOptions {}
223
294
 
224
295
  /** @internal */
225
- type _AnimateDarknessOptions = NullishProps<{
296
+ type _TestInsideDarknessOptions = InexactPartial<{
297
+ /** Optional condition a source must satisfy in order to be tested. */
298
+ // TODO: Make .InitializedImplementation
299
+ condition: (source: sources.PointDarknessSource.Internal.Any) => boolean;
300
+ }>;
301
+
302
+ interface TestInsideDarknessOptions extends _TestInsideLightOptions {}
303
+
304
+ /** @internal */
305
+ type _AnimateDarknessOptions = InexactPartial<{
226
306
  /**
227
307
  * The desired animation time in milliseconds. Default is 10 seconds
228
308
  * @defaultValue `10000`
229
- * @remarks Only has a parameter default; `null` is effectively `0`, resulting in no animation, just instant darkness
230
309
  */
231
310
  duration: number;
232
311
  }>;
@@ -236,13 +315,29 @@ declare namespace EffectsCanvasGroup {
236
315
  interface DrawOptions extends CanvasGroupMixin.DrawOptions {}
237
316
 
238
317
  interface TearDownOptions extends CanvasGroupMixin.TearDownOptions {}
318
+
319
+ /**
320
+ * @remarks {@linkcode EffectsCanvasGroup} overrides {@linkcode CanvasGroupMixin.AnyMixed._createLayers | #_createLayers},
321
+ * returning a predefined object rather than something built from `CONFIG`. The layer classes are constructed by name,
322
+ * with no ability to override or extend by users, which is why `.Any` is not used here
323
+ */
324
+ interface Layers {
325
+ /** A layer of background alteration effects which change the appearance of the primary group render texture. */
326
+ background: layers.CanvasBackgroundAlterationEffects;
327
+
328
+ /** A layer which adds illumination-based effects to the scene. */
329
+ illumination: layers.CanvasIlluminationEffects;
330
+
331
+ /** A layer which adds color-based effects to the scene. */
332
+ coloration: layers.CanvasColorationEffects;
333
+
334
+ /** A layer which adds darkness effects to the scene. */
335
+ darkness: layers.CanvasDarknessEffects;
336
+ }
239
337
  }
240
338
 
241
339
  export default EffectsCanvasGroup;
242
340
 
243
- declare abstract class AnyEffectsCanvasGroup extends EffectsCanvasGroup<
244
- EffectsCanvasGroup.DrawOptions,
245
- EffectsCanvasGroup.TearDownOptions
246
- > {
341
+ declare abstract class AnyEffectsCanvasGroup extends EffectsCanvasGroup {
247
342
  constructor(...args: never);
248
343
  }