@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250717053920 → 13.346.0-beta.20250717163058

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.
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.20250717053920",
4
+ "version": "13.346.0-beta.20250717163058",
5
5
  "description": "TypeScript type definitions for Foundry VTT",
6
6
  "type": "module",
7
7
  "types": "./src/index.d.mts",
@@ -12,15 +12,93 @@ declare module "#configuration" {
12
12
 
13
13
  /**
14
14
  * The Scene Controls UI element.
15
- * @remarks TODO: Stub
16
15
  */
17
16
  declare class SceneControls<
18
17
  RenderContext extends SceneControls.RenderContext = SceneControls.RenderContext,
19
18
  Configuration extends SceneControls.Configuration = SceneControls.Configuration,
20
19
  RenderOptions extends SceneControls.RenderOptions = SceneControls.RenderOptions,
21
20
  > extends HandlebarsApplicationMixin(ApplicationV2)<RenderContext, Configuration, RenderOptions> {
22
- // Fake override.
23
21
  static override DEFAULT_OPTIONS: SceneControls.DefaultOptions;
22
+
23
+ static PARTS: Record<string, HandlebarsApplicationMixin.HandlebarsTemplatePart>;
24
+
25
+ static override readonly emittedEvents: string[];
26
+
27
+ /**
28
+ * Prepared data of available controls.
29
+ */
30
+ get controls(): Record<string, SceneControls.Control>;
31
+
32
+ /**
33
+ * The currently active control layer.
34
+ */
35
+ get control(): SceneControls.Control | null;
36
+
37
+ /**
38
+ * The tools which are available within the current control layer.
39
+ */
40
+ get tools(): Record<string, SceneControls.Tool>;
41
+
42
+ /**
43
+ * The currently active tool in the control palette.
44
+ */
45
+ get tool(): SceneControls.Tool;
46
+
47
+ /**
48
+ * Activate a new control layer or tool.
49
+ * This method is advantageous to use because it minimizes the amount of re-rendering necessary.
50
+ */
51
+ activate(options?: SceneControls.ActivateOptions): Promise<void>;
52
+
53
+ protected override _configureRenderOptions(options: DeepPartial<RenderOptions>): void;
54
+ protected override _preRender(
55
+ context: DeepPartial<RenderContext>,
56
+ options: DeepPartial<RenderOptions>,
57
+ ): Promise<void>;
58
+ protected override _prepareContext(
59
+ options: DeepPartial<RenderOptions> & { isFirstRender: boolean },
60
+ ): Promise<RenderContext>;
61
+ protected override _onRender(context: DeepPartial<RenderContext>, options: DeepPartial<RenderOptions>): Promise<void>;
62
+
63
+ /**
64
+ * Update the class of the notes layer icon to reflect whether there are visible notes or not.
65
+ * @internal
66
+ */
67
+ _updateNotesIcon(): void;
68
+
69
+ override setPosition(position?: DeepPartial<ApplicationV2.Position>): ApplicationV2.Position | void;
70
+
71
+ /**
72
+ * Reusable toolclip items.
73
+ */
74
+ static COMMON_TOOLCLIP_ITEMS: Record<string, SceneControls.ToolclipItem>;
75
+
76
+ /**
77
+ * A helper function used to prepare an array of toolclip items.
78
+ */
79
+ static buildToolclipItems(
80
+ items: Array<SceneControls.ToolclipConfigurationItem | string | null>,
81
+ ): SceneControls.ToolclipConfigurationItem[];
82
+
83
+ /**
84
+ * @deprecated "{@linkcode SceneControls#activeControl} is deprecated in favor of {@linkcode SceneControls#control#name}" (since v13, until v15)
85
+ * @ignore
86
+ */
87
+ get activeControl(): void;
88
+
89
+ /**
90
+ * @deprecated "{@linkcode SceneControls#activeTool} is deprecated in favor of {@linkcode SceneControls#tool#name}" (since v13, until v15)
91
+ * @ignore
92
+ */
93
+ get activeTool(): void;
94
+
95
+ /**
96
+ * @deprecated "{@linkcode SceneControls#initialize} is deprecated in favor of {@linkcode SceneControls#render} with `{controls, tool}` passed as render options." (since v13, until v15)
97
+ * @ignore
98
+ */
99
+ initialize({ layer, tool }: { layer?: string | undefined; tool?: string | undefined }): Promise<void>;
100
+
101
+ #sceneControls: true;
24
102
  }
25
103
 
26
104
  declare namespace SceneControls {
@@ -105,6 +183,11 @@ declare namespace SceneControls {
105
183
  reference: string;
106
184
  }
107
185
 
186
+ interface ToolclipItem {
187
+ heading: string;
188
+ reference: string;
189
+ }
190
+
108
191
  interface Configuration<SceneControls extends SceneControls.Any = SceneControls.Any>
109
192
  extends ApplicationV2.Configuration<SceneControls> {}
110
193
 
@@ -115,7 +198,26 @@ declare namespace SceneControls {
115
198
  > &
116
199
  object;
117
200
 
118
- interface RenderOptions extends ApplicationV2.RenderOptions {}
201
+ interface RenderOptions extends ApplicationV2.RenderOptions, HandlebarsApplicationMixin.RenderOptions {
202
+ /** An event which prompted a re-render */
203
+ event: Event;
204
+
205
+ /** Re-prepare the possible list of controls */
206
+ reset: boolean;
207
+
208
+ /** The control set to activate. If undefined, the current control set remains active */
209
+ control: string;
210
+
211
+ /** A specific tool to activate. If undefined the current tool or default tool for the control set becomes active */
212
+ tool: string;
213
+
214
+ /** Changes to apply to toggles within the control set */
215
+ toggles: Record<string, boolean>;
216
+ }
217
+
218
+ type EmittedEvents = [...ApplicationV2.EmittedEvents, "activate"];
219
+
220
+ interface ActivateOptions extends Pick<SceneControls.RenderOptions, "event" | "control" | "tool" | "toggles"> {}
119
221
  }
120
222
 
121
223
  declare abstract class AnySceneControls extends SceneControls<
@@ -12,13 +12,61 @@ declare module "#configuration" {
12
12
 
13
13
  /**
14
14
  * The Scene Navigation UI element.
15
- * @remarks TODO: Stub
16
15
  */
17
16
  declare class SceneNavigation<
18
17
  RenderContext extends SceneNavigation.RenderContext = SceneNavigation.RenderContext,
19
18
  Configuration extends SceneNavigation.Configuration = SceneNavigation.Configuration,
20
19
  RenderOptions extends SceneNavigation.RenderOptions = SceneNavigation.RenderOptions,
21
- > extends HandlebarsApplicationMixin(ApplicationV2)<RenderContext, Configuration, RenderOptions> {}
20
+ > extends HandlebarsApplicationMixin(ApplicationV2)<RenderContext, Configuration, RenderOptions> {
21
+ static override DEFAULT_OPTIONS: SceneNavigation.DefaultOptions;
22
+ static override PARTS: Record<string, HandlebarsApplicationMixin.HandlebarsTemplatePart>;
23
+
24
+ /**
25
+ * Whether the scene navigation is currently expanded.
26
+ */
27
+ get expanded(): boolean;
28
+
29
+ protected override _prepareContext(
30
+ options: DeepPartial<RenderOptions> & { isFirstRender: boolean },
31
+ ): Promise<RenderContext>;
32
+
33
+ protected override _onFirstRender(
34
+ context: DeepPartial<RenderContext>,
35
+ options: DeepPartial<RenderOptions>,
36
+ ): Promise<void>;
37
+
38
+ protected override _onRender(context: DeepPartial<RenderContext>, options: DeepPartial<RenderOptions>): Promise<void>;
39
+
40
+ /**
41
+ * Get the set of ContextMenu options which should be applied for Scenes in the menu.
42
+ */
43
+ protected _getContextMenuOptions(): foundry.applications.ux.ContextMenu.Entry<HTMLElement>[];
44
+
45
+ /**
46
+ * Expand Scene Navigation, displaying inactive Scenes.
47
+ */
48
+ expand(): void;
49
+
50
+ /**
51
+ * Collapse Scene Navigation, hiding inactive Scenes.
52
+ */
53
+ collapse(): Promise<void>;
54
+
55
+ /**
56
+ * Toggle the expanded state of scene navigation.
57
+ * @param expanded - Force the expanded state to the provided value, otherwise toggle the state.
58
+ */
59
+ toggleExpanded(expanded?: boolean): void;
60
+
61
+ /**
62
+ * @deprecated "SceneNavigation.displayProgressBar is deprecated in favor of {@linkcode Notifications#notify} using the \{progress: true\} option" (since v13, until v15)
63
+ * @ignore
64
+ */
65
+ static displayProgressBar({ label, pct }?: SceneNavigation.DisplayProgressBarOptions): void;
66
+
67
+ static #SceneNavigationStatic: true;
68
+ #SceneNavigation: true;
69
+ }
22
70
 
23
71
  declare namespace SceneNavigation {
24
72
  interface Any extends AnySceneNavigation {}
@@ -40,6 +88,11 @@ declare namespace SceneNavigation {
40
88
  canExpand: number;
41
89
  }
42
90
 
91
+ interface DisplayProgressBarOptions {
92
+ label?: string | undefined;
93
+ pct?: number | undefined;
94
+ }
95
+
43
96
  interface Configuration<SceneNavigation extends SceneNavigation.Any = SceneNavigation.Any>
44
97
  extends HandlebarsApplicationMixin.Configuration,
45
98
  ApplicationV2.Configuration<SceneNavigation> {}
@@ -40,7 +40,7 @@ declare class InterfaceCanvasGroup<
40
40
  * @param origin - An origin point where the text should first emerge
41
41
  * @param content - The text content to display
42
42
  * @param options - Options which customize the text animation
43
- * @returns - The created PreciseText object which is scrolling
43
+ * @returns The created PreciseText object which is scrolling
44
44
  * @remarks Only returns `null` if the core `scrollingStatusText` setting is falsey
45
45
  */
46
46
  createScrollingText(
@@ -38,7 +38,7 @@ declare class InteractionLayer extends CanvasLayer {
38
38
  /**
39
39
  * Activate the InteractionLayer, deactivating other layers and marking this layer's children as interactive.
40
40
  * @param options - Options which configure layer activation
41
- * @returns - The layer instance, now activated
41
+ * @returns The layer instance, now activated
42
42
  */
43
43
  activate(options?: InteractionLayer.ActivateOptions): this;
44
44
 
@@ -49,7 +49,7 @@ declare class InteractionLayer extends CanvasLayer {
49
49
 
50
50
  /**
51
51
  * Deactivate the InteractionLayer, removing interactivity from its children.
52
- * @returns - The layer instance, now inactive
52
+ * @returns The layer instance, now inactive
53
53
  */
54
54
  deactivate(): this;
55
55
 
@@ -167,7 +167,7 @@ declare class BaseSamplerShader extends AbstractBaseShader {
167
167
 
168
168
  /**
169
169
  * Create a batch plugin for this sampler class.
170
- * @returns - The batch plugin class linked to this sampler class.
170
+ * @returns The batch plugin class linked to this sampler class.
171
171
  */
172
172
  static createPlugin<ThisType extends BaseSamplerShader.AnyConstructor>(
173
173
  this: ThisType,
@@ -2,7 +2,7 @@ import type { DataSchema } from "#common/data/fields.d.mts";
2
2
  import type { BaseActorDelta } from "#common/documents/_module.d.mts";
3
3
  import type Document from "#common/abstract/document.d.mts";
4
4
  import type { ConfiguredActorDelta } from "fvtt-types/configuration";
5
- import type { Identity, InexactPartial, Merge, NullishProps, RequiredProps } from "#utils";
5
+ import type { Identity, InexactPartial, Merge, NullishProps } from "#utils";
6
6
  import type DataModel from "#common/abstract/data.d.mts";
7
7
 
8
8
  import fields = foundry.data.fields;
@@ -14,9 +14,9 @@ declare namespace ActorDelta {
14
14
  type Name = "ActorDelta";
15
15
 
16
16
  /**
17
- * @privateRemarks This is off-template, as `ActorDelta` requires a valid parent to validate.
17
+ * The context used to create a `ActorDelta`.
18
18
  */
19
- interface ConstructionContext extends RequiredProps<Document.ConstructionContext<Parent>, "parent"> {}
19
+ interface ConstructionContext extends Document.ConstructionContext<Parent> {}
20
20
 
21
21
  /**
22
22
  * The documents embedded within `ActorDelta`.
@@ -131,8 +131,10 @@ declare namespace ActorDelta {
131
131
  /**
132
132
  * A document's parent is something that can contain it.
133
133
  * For example an `Item` can be contained by an `Actor` which makes `Actor` one of its possible parents.
134
+ *
135
+ * `ActorDelta` requires a parent so `null` is not an option here.
134
136
  */
135
- type Parent = TokenDocument.Implementation | null;
137
+ type Parent = TokenDocument.Implementation;
136
138
 
137
139
  /**
138
140
  * A document's direct descendants are documents that are contained directly within its schema.
@@ -12,13 +12,13 @@ import type ApplicationV2 from "#client/applications/api/application.mjs";
12
12
  * @see {@link Game.packs | `Game#packs`}
13
13
  */
14
14
  declare class CompendiumCollection<
15
- Type extends foundry.documents.collections.CompendiumCollection.DocumentName,
15
+ Type extends CompendiumCollection.DocumentName,
16
16
  > extends foundry.documents.abstract.DirectoryCollectionMixin(foundry.documents.abstract.DocumentCollection)<Type> {
17
17
  /** @param metadata - The compendium metadata, an object provided by game.data */
18
- constructor(metadata: foundry.documents.collections.CompendiumCollection.ConstructorMetadata<Type>);
18
+ constructor(metadata: CompendiumCollection.ConstructorMetadata<Type>);
19
19
 
20
20
  /** The compendium metadata which defines the compendium content and location */
21
- metadata: foundry.documents.collections.CompendiumCollection.Metadata;
21
+ metadata: CompendiumCollection.Metadata;
22
22
 
23
23
  /** A subsidiary collection which contains the more minimal index of the pack */
24
24
  index: IndexTypeForMetadata<Type>;
@@ -83,7 +83,7 @@ declare class CompendiumCollection<
83
83
  // Note(LukeAbby): The override for `_getVisibleTreeContents` become unreasonably long and don't add any changes and so has been omitted.
84
84
 
85
85
  /** Access the compendium configuration data for this pack */
86
- get config(): foundry.documents.collections.CompendiumCollection.Configuration | EmptyObject;
86
+ get config(): CompendiumCollection.Configuration | EmptyObject;
87
87
 
88
88
  get documentName(): Type;
89
89
 
@@ -127,7 +127,7 @@ declare class CompendiumCollection<
127
127
  * Load the Compendium index and cache it as the keys and values of the Collection.
128
128
  * @param options - Options which customize how the index is created
129
129
  */
130
- getIndex(options?: foundry.documents.collections.CompendiumCollection.GetIndexOptions<Type>): Promise<this["index"]>;
130
+ getIndex(options?: CompendiumCollection.GetIndexOptions<Type>): Promise<this["index"]>;
131
131
 
132
132
  /**
133
133
  * Get a single Document from this Compendium by ID.
@@ -158,9 +158,7 @@ declare class CompendiumCollection<
158
158
  * await pack.getDocuments({ type__in: ["weapon", "armor"] });
159
159
  * ```
160
160
  */
161
- getDocuments(
162
- query?: foundry.documents.collections.CompendiumCollection.Query<Type>,
163
- ): Promise<Document.ImplementationFor<Type>[]>;
161
+ getDocuments(query?: CompendiumCollection.Query<Type>): Promise<Document.ImplementationFor<Type>[]>;
164
162
 
165
163
  /**
166
164
  * Get the ownership level that a User has for this Compendium pack.
@@ -180,7 +178,7 @@ declare class CompendiumCollection<
180
178
  testUserPermission(
181
179
  user: User.Implementation,
182
180
  permission: string | number,
183
- options?: foundry.documents.collections.CompendiumCollection.TestUserPermissionOptions,
181
+ options?: CompendiumCollection.TestUserPermissionOptions,
184
182
  ): boolean;
185
183
 
186
184
  /**
@@ -200,29 +198,21 @@ declare class CompendiumCollection<
200
198
  * @param folder - The existing Folder you wish to import
201
199
  * @param options - Additional options which modify how the data is imported.
202
200
  */
203
- importFolder(
204
- folder: Folder.Implementation,
205
- options?: foundry.documents.collections.CompendiumCollection.ImportFolderOptions,
206
- ): Promise<void>;
201
+ importFolder(folder: Folder.Implementation, options?: CompendiumCollection.ImportFolderOptions): Promise<void>;
207
202
 
208
203
  /**
209
204
  * Import an array of Folders into this Compendium Collection.
210
205
  * @param folders - The existing Folders you wish to import
211
206
  * @param options - Additional options which modify how the data is imported.
212
207
  */
213
- importFolders(
214
- folders: Folder.Implementation[],
215
- options?: foundry.documents.collections.CompendiumCollection.ImportFoldersOptions,
216
- ): Promise<void>;
208
+ importFolders(folders: Folder.Implementation[], options?: CompendiumCollection.ImportFoldersOptions): Promise<void>;
217
209
 
218
210
  /**
219
211
  * Fully import the contents of a Compendium pack into a World folder.
220
212
  * @param options - Options which modify the import operation. Additional options are forwarded to {@link WorldCollection.fromCompendium | `WorldCollection#fromCompendium`} and {@linkcode Document.createDocuments} (default: `{}`)
221
213
  * @returns The imported Documents, now existing within the World
222
214
  */
223
- importAll(
224
- options?: foundry.documents.collections.CompendiumCollection.ImportAllOptions<Type>,
225
- ): Promise<Document.StoredForName<Type>[]>;
215
+ importAll(options?: CompendiumCollection.ImportAllOptions<Type>): Promise<Document.StoredForName<Type>[]>;
226
216
 
227
217
  /**
228
218
  * Provide a dialog form that prompts the user to import the full contents of a Compendium pack into the World.
@@ -261,9 +251,9 @@ declare class CompendiumCollection<
261
251
  * @param options - Additional options which modify the Compendium creation request
262
252
  * (default: `{}`)
263
253
  */
264
- static createCompendium<T extends foundry.documents.collections.CompendiumCollection.DocumentName>(
254
+ static createCompendium<T extends CompendiumCollection.DocumentName>(
265
255
  this: abstract new (...args: never) => CompendiumCollection<NoInfer<T>>,
266
- metadata: foundry.documents.collections.CompendiumCollection.CreateCompendiumMetadata<T>,
256
+ metadata: CompendiumCollection.CreateCompendiumMetadata<T>,
267
257
  options?: unknown,
268
258
  ): Promise<CompendiumCollection<T>>;
269
259
 
@@ -294,9 +284,7 @@ declare class CompendiumCollection<
294
284
  * Duplicate a compendium pack to the current World.
295
285
  * @param label - A new Compendium label
296
286
  */
297
- duplicateCompendium({
298
- label,
299
- }?: foundry.documents.collections.CompendiumCollection.DuplicateCompendiumOptions): Promise<this>;
287
+ duplicateCompendium({ label }?: CompendiumCollection.DuplicateCompendiumOptions): Promise<this>;
300
288
 
301
289
  /**
302
290
  * Migrate a compendium pack.
@@ -333,19 +321,21 @@ declare namespace CompendiumCollection {
333
321
  }
334
322
 
335
323
  // The type that's passed to `new CompendiumCollection(...)`
336
- type ConstructorMetadata<Type extends foundry.documents.collections.CompendiumCollection.DocumentName> =
337
- Metadata<Type> & {
338
- index: IndexTypeForMetadata<Type>;
339
- folders: Folder.Implementation[];
340
- };
324
+ type ConstructorMetadata<Type extends CompendiumCollection.DocumentName> = Metadata<Type> & {
325
+ index: IndexTypeForMetadata<Type>;
326
+ folders: Folder.Implementation[];
327
+ };
341
328
 
342
329
  // The type that appears in `compendium.metadata` after initialization.
343
- interface Metadata<
344
- Type extends
345
- foundry.documents.collections.CompendiumCollection.DocumentName = foundry.documents.collections.CompendiumCollection.DocumentName,
346
- > {
330
+ interface Metadata<Type extends CompendiumCollection.DocumentName = CompendiumCollection.DocumentName> {
347
331
  type: Type;
348
332
  label: string;
333
+
334
+ /**
335
+ * @remarks `undefined` is replaced with the default `CONFIG[this.metadata.type]?.compendiumBanner`
336
+ * but `null` passes through unchanged.
337
+ */
338
+ banner?: string | null | undefined;
349
339
  name: string;
350
340
 
351
341
  flags: Record<string, never>; // created by the server, but always empty and no way to change it in a way that is s
@@ -431,7 +421,7 @@ declare namespace CompendiumCollection {
431
421
  importParents?: boolean | undefined;
432
422
  }
433
423
 
434
- type ImportAllOptions<Type extends foundry.documents.collections.CompendiumCollection.DocumentName> = SimpleMerge<
424
+ type ImportAllOptions<Type extends CompendiumCollection.DocumentName> = SimpleMerge<
435
425
  UnionToIntersection<Document.Database.CreateOperationForName<Type>>,
436
426
  foundry.documents.abstract.WorldCollection.FromCompendiumOptions
437
427
  > & {
@@ -462,9 +452,7 @@ declare namespace CompendiumCollection {
462
452
 
463
453
  // Note(LukeAbby): One neat possibility for this type would be making something like `type: "foo"`,
464
454
  // `type__ne: "foo"`, and `type__in: ["foo", "bar"]` all narrow `system`.
465
- type Query<Type extends foundry.documents.collections.CompendiumCollection.DocumentName> = _Queryify<
466
- Document.SourceForName<Type>
467
- >;
455
+ type Query<Type extends CompendiumCollection.DocumentName> = _Queryify<Document.SourceForName<Type>>;
468
456
 
469
457
  /** @internal */
470
458
  type _Queryify<T> = T extends object ? _QueryifyObject<T> : T;
@@ -487,7 +475,8 @@ declare namespace CompendiumCollection {
487
475
 
488
476
  type IsComparable<T> = T extends boolean | string | number | bigint | symbol | null | undefined ? true : false;
489
477
 
490
- type IndexTypeForMetadata<Type extends foundry.documents.collections.CompendiumCollection.DocumentName> =
491
- foundry.utils.Collection<foundry.documents.collections.CompendiumCollection.IndexEntry<Type>>;
478
+ type IndexTypeForMetadata<Type extends CompendiumCollection.DocumentName> = foundry.utils.Collection<
479
+ CompendiumCollection.IndexEntry<Type>
480
+ >;
492
481
 
493
482
  export default CompendiumCollection;
@@ -1,5 +1,5 @@
1
1
  import type { ConfiguredCombatant } from "fvtt-types/configuration";
2
- import type { Identity, InexactPartial, Merge, RequiredProps } from "#utils";
2
+ import type { Identity, InexactPartial, Merge } from "#utils";
3
3
  import type { documents } from "#client/client.d.mts";
4
4
  import type Document from "#common/abstract/document.d.mts";
5
5
  import type { DataSchema } from "#common/data/fields.d.mts";
@@ -15,9 +15,8 @@ declare namespace Combatant {
15
15
 
16
16
  /**
17
17
  * The context used to create a `Combatant`.
18
- * @privateRemarks This is off-template, as `Combatant` requires a valid parent to validate.
19
18
  */
20
- interface ConstructionContext extends RequiredProps<Document.ConstructionContext<Parent>, "parent"> {}
19
+ interface ConstructionContext extends Document.ConstructionContext<Parent> {}
21
20
 
22
21
  /**
23
22
  * The documents embedded within `Combatant`.
@@ -130,8 +129,10 @@ declare namespace Combatant {
130
129
  /**
131
130
  * A document's parent is something that can contain it.
132
131
  * For example an `Item` can be contained by an `Actor` which makes `Actor` one of its possible parents.
132
+ *
133
+ * `Combatant` requires a parent so `null` is not an option here.
133
134
  */
134
- type Parent = Combat.Implementation | null;
135
+ type Parent = Combat.Implementation;
135
136
 
136
137
  /**
137
138
  * A document's descendants are any child documents, grandchild documents, etc.
@@ -456,8 +456,11 @@ export interface AllHooks extends DynamicHooks {
456
456
 
457
457
  /**
458
458
  * A hook event that fires when a custom active effect is applied.
459
- * @param actor - The actor the active effect is being applied to
460
- * @param change - The change data being applied
459
+ * @param actor - The actor the active effect is being applied to
460
+ * @param change - The change data being applied
461
+ * @param current - The current value being modified
462
+ * @param delta - The parsed value of the change object
463
+ * @param changes - An object which accumulates changes to be applied
461
464
  * @remarks This is called by {@linkcode Hooks.call}.
462
465
  * @see {@link ActiveEffect._applyCustom | `ActiveEffect#_applyCustom`}
463
466
  */
@@ -803,8 +806,11 @@ export interface AllHooks extends DynamicHooks {
803
806
  /** The new round of combat */
804
807
  round: number;
805
808
 
806
- /** The new turn number */
807
- turn: number;
809
+ /**
810
+ * The new turn number
811
+ * @remarks `combatRound`, unlike `combatTurn` and `combatStart`, can have a `null` turn.
812
+ */
813
+ turn: number | null;
808
814
  },
809
815
  updateOptions: {
810
816
  /** The amount of time in seconds that time is being advanced */
@@ -974,6 +980,17 @@ export interface AllHooks extends DynamicHooks {
974
980
  app: foundry.applications.ui.Players,
975
981
  contextOptions: ContextMenu.Entry<HTMLElement>[],
976
982
  ) => boolean | void;
983
+
984
+ /**
985
+ * A hook event that fires when the context menu for a SceneNavigation entry is constructed.
986
+ * @param app - The Application instance that the context menu is constructed in
987
+ * @param contextOptions - The context menu entries
988
+ * @remarks This is called by {@linkcode Hooks.callAll}.
989
+ */
990
+ getSceneContextOptions: (
991
+ app: foundry.applications.ui.SceneNavigation,
992
+ contextOptions: ContextMenu.Entry<HTMLElement>[],
993
+ ) => void;
977
994
  }
978
995
 
979
996
  declare global {
@@ -5,7 +5,29 @@ import type Document from "./document.d.mts";
5
5
  // This means that actual functions must use helper types to properly omit properties or explicit undefined
6
6
  // Also, the _result property is intentionally left out as it is never present on the client
7
7
 
8
- export interface DatabaseGetOperation<Parent extends Document.Any | null = Document.Any | null> {
8
+ // @ts-expect-error This pattern is inherently an error.
9
+ interface _DynamicBase<T extends object> extends T {}
10
+
11
+ interface _Parent<Parent extends Document.Any | null>
12
+ extends _DynamicBase<
13
+ Parent extends null
14
+ ? {
15
+ /**
16
+ * A parent Document within which Documents are embedded
17
+ * @defaultValue `null`
18
+ */
19
+ parent?: Parent | null | undefined;
20
+ }
21
+ : {
22
+ /**
23
+ * A parent Document within which Documents are embedded
24
+ */
25
+ parent: Parent;
26
+ }
27
+ > {}
28
+
29
+ export interface DatabaseGetOperation<Parent extends Document.Any | null = Document.Any | null>
30
+ extends _Parent<Parent> {
9
31
  /**
10
32
  * A query object which identifies the set of Documents retrieved
11
33
  */
@@ -31,11 +53,6 @@ export interface DatabaseGetOperation<Parent extends Document.Any | null = Docum
31
53
  */
32
54
  pack?: string | null | undefined;
33
55
 
34
- /**
35
- * A parent Document within which Documents are embedded
36
- */
37
- parent?: Parent | null | undefined;
38
-
39
56
  /**
40
57
  * A parent Document UUID provided when the parent instance is unavailable
41
58
  */
@@ -46,7 +63,7 @@ export interface DatabaseCreateOperation<
46
63
  CreateData extends object | null | undefined = object | null | undefined,
47
64
  Parent extends Document.Any | null = Document.Any | null,
48
65
  Temporary extends boolean | undefined = boolean | undefined,
49
- > {
66
+ > extends _Parent<Parent> {
50
67
  /**
51
68
  * Whether the database operation is broadcast to other connected clients
52
69
  */
@@ -91,11 +108,6 @@ export interface DatabaseCreateOperation<
91
108
  */
92
109
  renderSheet: boolean;
93
110
 
94
- /**
95
- * A parent Document within which Documents are embedded
96
- */
97
- parent?: Parent | undefined;
98
-
99
111
  /**
100
112
  * A compendium collection ID which contains the Documents
101
113
  */
@@ -133,7 +145,7 @@ export interface DatabaseCreateOperation<
133
145
  export interface DatabaseUpdateOperation<
134
146
  UpdateData extends object | null | undefined = object | null | undefined,
135
147
  Parent extends Document.Any | null = Document.Any | null,
136
- > {
148
+ > extends _Parent<Parent> {
137
149
  /**
138
150
  * Whether the database operation is broadcast to other connected clients
139
151
  */
@@ -176,11 +188,6 @@ export interface DatabaseUpdateOperation<
176
188
  */
177
189
  noHook?: boolean | null;
178
190
 
179
- /**
180
- * A parent Document within which Documents are embedded
181
- */
182
- parent?: Parent | null;
183
-
184
191
  /**
185
192
  * A compendium collection ID which contains the Documents
186
193
  */
@@ -192,7 +199,8 @@ export interface DatabaseUpdateOperation<
192
199
  parentUuid?: string | null;
193
200
  }
194
201
 
195
- export interface DatabaseDeleteOperation<Parent extends Document.Any | null = Document.Any | null> {
202
+ export interface DatabaseDeleteOperation<Parent extends Document.Any | null = Document.Any | null>
203
+ extends _Parent<Parent> {
196
204
  /**
197
205
  * Whether the database operation is broadcast to other connected clients
198
206
  */
@@ -226,11 +234,6 @@ export interface DatabaseDeleteOperation<Parent extends Document.Any | null = Do
226
234
  */
227
235
  render: boolean;
228
236
 
229
- /**
230
- * A parent Document within which Documents are embedded
231
- */
232
- parent?: Parent | null;
233
-
234
237
  /**
235
238
  * A compendium collection ID which contains the Documents
236
239
  */
@@ -1573,33 +1573,51 @@ declare namespace Document {
1573
1573
  }
1574
1574
 
1575
1575
  /** @internal */
1576
- type _ConstructionContext<Parent extends Document.Any | null> = NullishProps<{
1577
- /**
1578
- * The parent Document of this one, if this one is embedded
1579
- * @defaultValue `null`
1580
- */
1581
- parent: Parent;
1576
+ interface _ParentContext<Parent extends Document.Any | null>
1577
+ extends _DynamicBase<
1578
+ Parent extends null
1579
+ ? {
1580
+ /**
1581
+ * The parent Document of this one, if this one is embedded
1582
+ * @defaultValue `null`
1583
+ */
1584
+ parent?: Parent | undefined;
1585
+ }
1586
+ : {
1587
+ /**
1588
+ * The parent Document of this one, if this one is embedded
1589
+ */
1590
+ parent: Parent;
1591
+ }
1592
+ > {}
1582
1593
 
1583
- /**
1584
- * The compendium collection ID which contains this Document, if any
1585
- * @defaultValue `null`
1586
- */
1587
- pack: string;
1594
+ // @ts-expect-error This pattern is inherently an error.
1595
+ interface _DynamicBase<T extends object> extends T {}
1588
1596
 
1589
- /**
1590
- * Whether to validate initial data strictly?
1591
- * @defaultValue `true`
1592
- */
1593
- strict: boolean;
1597
+ /** @internal */
1598
+ interface _ConstructionContext<Parent extends Document.Any | null>
1599
+ extends _ParentContext<Parent>,
1600
+ NullishProps<{
1601
+ /**
1602
+ * The compendium collection ID which contains this Document, if any
1603
+ * @defaultValue `null`
1604
+ */
1605
+ pack: string;
1594
1606
 
1595
- /**
1596
- * An immutable reverse-reference to the name of the collection that this Document exists in on its parent, if any.
1597
- * @privateRemarks Omitted from the typedef, inferred from usage in {@link Document._configure | `Document#_configure`}
1598
- * (and included in the construction context rather than `ConfigureOptions` due to being passed to construction in
1599
- * {@link foundry.abstract.EmbeddedCollection.createDocument | `EmbeddedCollection#createDocument`})
1600
- */
1601
- parentCollection: string;
1602
- }>;
1607
+ /**
1608
+ * Whether to validate initial data strictly?
1609
+ * @defaultValue `true`
1610
+ */
1611
+ strict: boolean;
1612
+
1613
+ /**
1614
+ * An immutable reverse-reference to the name of the collection that this Document exists in on its parent, if any.
1615
+ * @privateRemarks Omitted from the typedef, inferred from usage in {@link Document._configure | `Document#_configure`}
1616
+ * (and included in the construction context rather than `ConfigureOptions` due to being passed to construction in
1617
+ * {@link foundry.abstract.EmbeddedCollection.createDocument | `EmbeddedCollection#createDocument`})
1618
+ */
1619
+ parentCollection: string;
1620
+ }> {}
1603
1621
 
1604
1622
  /**
1605
1623
  * Foundry does not include the properties from the DataModel construction context in `DocumentConstructionContext`,
@@ -422,7 +422,7 @@ declare abstract class DataField<
422
422
  * @param delta - The change delta.
423
423
  * @param model - The model instance.
424
424
  * @param change - The original change data.
425
- * @returns - The updated value.
425
+ * @returns The updated value.
426
426
  *
427
427
  * @remarks Returns `value + delta`. `model` and `change` are unused in `DataField`
428
428
  */
@@ -473,7 +473,7 @@ declare abstract class DataField<
473
473
  * @param delta - The change delta.
474
474
  * @param model - The model instance.
475
475
  * @param change - The original change data.
476
- * @returns - The updated value.
476
+ * @returns The updated value.
477
477
  *
478
478
  * @remarks No-op in `DataField`, returns `undefined` unless overridden
479
479
  */
@@ -507,7 +507,7 @@ declare abstract class DataField<
507
507
  * @param delta - The change delta.
508
508
  * @param model - The model instance.
509
509
  * @param change - The original change data.
510
- * @returns - The updated value.
510
+ * @returns The updated value.
511
511
  * @remarks Only returns a value if the target value of the change actually changed
512
512
  */
513
513
  protected _applyChangeCustom(