@league-of-foundry-developers/foundry-vtt-types 9.249.0 → 9.249.4

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 (121) hide show
  1. package/package.json +2 -2
  2. package/src/foundry/common/abstract/data.mjs.d.ts +2 -2
  3. package/src/foundry/common/abstract/document.mjs.d.ts +20 -9
  4. package/src/foundry/common/config.mjs/releaseData.d.ts +3 -1
  5. package/src/foundry/common/data/data.mjs/activeEffectData.d.ts +3 -1
  6. package/src/foundry/common/data/data.mjs/actorData.d.ts +1 -1
  7. package/src/foundry/common/data/data.mjs/adventureData.d.ts +14 -12
  8. package/src/foundry/common/data/data.mjs/ambientLightData.d.ts +5 -3
  9. package/src/foundry/common/data/data.mjs/ambientSoundData.d.ts +62 -16
  10. package/src/foundry/common/data/data.mjs/animationData.d.ts +13 -5
  11. package/src/foundry/common/data/data.mjs/cardData.d.ts +4 -4
  12. package/src/foundry/common/data/data.mjs/cardFaceData.d.ts +5 -3
  13. package/src/foundry/common/data/data.mjs/cardsData.d.ts +3 -3
  14. package/src/foundry/common/data/data.mjs/chatMessageData.d.ts +3 -1
  15. package/src/foundry/common/data/data.mjs/chatSpeakerData.d.ts +3 -1
  16. package/src/foundry/common/data/data.mjs/combatData.d.ts +3 -1
  17. package/src/foundry/common/data/data.mjs/combatantData.d.ts +3 -1
  18. package/src/foundry/common/data/data.mjs/darknessActivation.d.ts +3 -1
  19. package/src/foundry/common/data/data.mjs/drawingData.d.ts +3 -1
  20. package/src/foundry/common/data/data.mjs/effectChangeData.d.ts +3 -1
  21. package/src/foundry/common/data/data.mjs/effectDurationData.d.ts +3 -1
  22. package/src/foundry/common/data/data.mjs/fogExplorationData.d.ts +3 -1
  23. package/src/foundry/common/data/data.mjs/folderData.d.ts +3 -1
  24. package/src/foundry/common/data/data.mjs/journalEntryData.d.ts +3 -1
  25. package/src/foundry/common/data/data.mjs/lightData.d.ts +7 -5
  26. package/src/foundry/common/data/data.mjs/macroData.d.ts +3 -1
  27. package/src/foundry/common/data/data.mjs/measuredTemplateData.d.ts +3 -1
  28. package/src/foundry/common/data/data.mjs/noteData.d.ts +3 -1
  29. package/src/foundry/common/data/data.mjs/playlistData.d.ts +3 -1
  30. package/src/foundry/common/data/data.mjs/playlistSoundData.d.ts +3 -1
  31. package/src/foundry/common/data/data.mjs/prototypeTokenData.d.ts +6 -4
  32. package/src/foundry/common/data/data.mjs/rollTableData.d.ts +3 -1
  33. package/src/foundry/common/data/data.mjs/sceneData.d.ts +3 -1
  34. package/src/foundry/common/data/data.mjs/settingData.d.ts +3 -1
  35. package/src/foundry/common/data/data.mjs/tableResultData.d.ts +3 -1
  36. package/src/foundry/common/data/data.mjs/tileData.d.ts +4 -2
  37. package/src/foundry/common/data/data.mjs/tileOcclusion.d.ts +4 -2
  38. package/src/foundry/common/data/data.mjs/tokenBarData.d.ts +4 -2
  39. package/src/foundry/common/data/data.mjs/tokenData.d.ts +5 -3
  40. package/src/foundry/common/data/data.mjs/userData.d.ts +3 -1
  41. package/src/foundry/common/data/data.mjs/videoData.d.ts +4 -2
  42. package/src/foundry/common/data/data.mjs/wallData.d.ts +4 -2
  43. package/src/foundry/common/documents.mjs/baseActiveEffect.d.ts +15 -12
  44. package/src/foundry/common/documents.mjs/baseActor.d.ts +24 -21
  45. package/src/foundry/common/documents.mjs/baseAdventure.d.ts +14 -12
  46. package/src/foundry/common/documents.mjs/baseAmbientLight.d.ts +14 -11
  47. package/src/foundry/common/documents.mjs/baseAmbientSound.d.ts +14 -11
  48. package/src/foundry/common/documents.mjs/baseCard.d.ts +27 -28
  49. package/src/foundry/common/documents.mjs/baseCards.d.ts +18 -16
  50. package/src/foundry/common/documents.mjs/baseChatMessage.d.ts +24 -17
  51. package/src/foundry/common/documents.mjs/baseCombat.d.ts +21 -20
  52. package/src/foundry/common/documents.mjs/baseCombatant.d.ts +25 -18
  53. package/src/foundry/common/documents.mjs/baseDrawing.d.ts +26 -23
  54. package/src/foundry/common/documents.mjs/baseFogExploration.d.ts +19 -17
  55. package/src/foundry/common/documents.mjs/baseFolder.d.ts +14 -12
  56. package/src/foundry/common/documents.mjs/baseItem.d.ts +25 -19
  57. package/src/foundry/common/documents.mjs/baseJournalEntry.d.ts +16 -14
  58. package/src/foundry/common/documents.mjs/baseMacro.d.ts +21 -18
  59. package/src/foundry/common/documents.mjs/baseMeasuredTemplate.d.ts +34 -18
  60. package/src/foundry/common/documents.mjs/baseNote.d.ts +20 -14
  61. package/src/foundry/common/documents.mjs/basePlaylist.d.ts +16 -14
  62. package/src/foundry/common/documents.mjs/basePlaylistSound.d.ts +14 -11
  63. package/src/foundry/common/documents.mjs/baseRollTable.d.ts +16 -14
  64. package/src/foundry/common/documents.mjs/baseScene.d.ts +23 -21
  65. package/src/foundry/common/documents.mjs/baseSetting.d.ts +18 -16
  66. package/src/foundry/common/documents.mjs/baseTableResult.d.ts +27 -19
  67. package/src/foundry/common/documents.mjs/baseTile.d.ts +17 -11
  68. package/src/foundry/common/documents.mjs/baseToken.d.ts +20 -16
  69. package/src/foundry/common/documents.mjs/baseUser.d.ts +45 -11
  70. package/src/foundry/common/documents.mjs/baseWall.d.ts +17 -15
  71. package/src/foundry/common/packages.mjs/packageAuthorData.d.ts +3 -1
  72. package/src/foundry/common/packages.mjs/packageCompendiumData.d.ts +4 -2
  73. package/src/foundry/common/packages.mjs/packageData.d.ts +3 -4
  74. package/src/foundry/common/packages.mjs/packageDependencyData.d.ts +3 -1
  75. package/src/foundry/common/packages.mjs/packageLanguageData.d.ts +3 -1
  76. package/src/foundry/common/utils/primitives.mjs.d.ts +1 -1
  77. package/src/foundry/foundry.js/application.d.ts +1 -1
  78. package/src/foundry/foundry.js/applications/formApplications/documentSheets/ambientLightConfig.d.ts +2 -2
  79. package/src/foundry/foundry.js/applications/formApplications/documentSheets/itemSheet.d.ts +1 -1
  80. package/src/foundry/foundry.js/applications/formApplications/documentSheets/rollTableConfig.d.ts +1 -1
  81. package/src/foundry/foundry.js/applications/formApplications/entitySheetConfig.d.ts +2 -2
  82. package/src/foundry/foundry.js/applications/formApplications/tokenConfig.d.ts +1 -1
  83. package/src/foundry/foundry.js/applications/sidebarTabs/chatLog.d.ts +1 -1
  84. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectory.d.ts +1 -1
  85. package/src/foundry/foundry.js/avSettings.d.ts +11 -0
  86. package/src/foundry/foundry.js/clientDocumentMixin.d.ts +36 -34
  87. package/src/foundry/foundry.js/clientDocuments/activeEffect.d.ts +1 -1
  88. package/src/foundry/foundry.js/clientDocuments/actor.d.ts +1 -1
  89. package/src/foundry/foundry.js/clientDocuments/chatMessage.d.ts +1 -1
  90. package/src/foundry/foundry.js/clientDocuments/combat.d.ts +5 -5
  91. package/src/foundry/foundry.js/clientDocuments/item.d.ts +2 -2
  92. package/src/foundry/foundry.js/clientDocuments/playlist.d.ts +1 -1
  93. package/src/foundry/foundry.js/clientDocuments/scene.d.ts +39 -38
  94. package/src/foundry/foundry.js/clientDocuments/user.d.ts +27 -35
  95. package/src/foundry/foundry.js/clientSettings.d.ts +1 -1
  96. package/src/foundry/foundry.js/collections/documentCollection.d.ts +65 -11
  97. package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +78 -67
  98. package/src/foundry/foundry.js/collections/documentCollections/worldCollection.d.ts +73 -32
  99. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/actors.d.ts +3 -37
  100. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/combatEncounters.d.ts +5 -2
  101. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/fogExplorations.d.ts +0 -2
  102. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/folders.d.ts +1 -1
  103. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/items.d.ts +1 -22
  104. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/journal.d.ts +1 -1
  105. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/macros.d.ts +3 -8
  106. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/messages.d.ts +7 -2
  107. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/playlists.d.ts +5 -5
  108. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/rollTables.d.ts +1 -1
  109. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/scenes.d.ts +3 -2
  110. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/users.d.ts +7 -4
  111. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/worldSettings.d.ts +2 -2
  112. package/src/foundry/foundry.js/hooks.d.ts +3 -3
  113. package/src/foundry/foundry.js/pixi/containers/ruler.d.ts +18 -7
  114. package/src/foundry/foundry.js/pixi/points/wallEndpoint.d.ts +1 -1
  115. package/src/foundry/foundry.js/pixi/polygons/pointSourcePolygons/clockwiseSweepPolygon.d.ts +1 -1
  116. package/src/foundry/foundry.js/pointSources/lightSource.d.ts +1 -1
  117. package/src/foundry/foundry.js/pointSources/soundSource.d.ts +1 -1
  118. package/src/foundry/foundry.js/pointSources/visionSource.d.ts +1 -1
  119. package/src/foundry/foundry.js/polygonEdge.d.ts +1 -1
  120. package/src/foundry/foundry.js/ray.d.ts +1 -1
  121. package/src/types/helperTypes.d.ts +31 -13
@@ -1,4 +1,5 @@
1
1
  import { ConfiguredDocumentClass, DocumentConstructor } from '../../../../types/helperTypes';
2
+ import type { DOCUMENT_TYPES } from '../../../common/constants.mjs';
2
3
 
3
4
  declare global {
4
5
  /**
@@ -21,6 +22,7 @@ declare global {
21
22
 
22
23
  /**
23
24
  * Initialize the WorldCollection object by constructing its contained Document instances
25
+ * @internal
24
26
  */
25
27
  protected _initialize(): void;
26
28
 
@@ -39,14 +41,19 @@ declare global {
39
41
  static documentName: string | null;
40
42
 
41
43
  /**
42
- * Return a reference to the SidebarDirectory application for this WorldCollection, or null if it has not yet been created.
44
+ * Return a reference to the SidebarDirectory application for this WorldCollection.
43
45
  * @remarks
44
- * In the case where `Lowercase<Name>` is not a property of {@link ui}, this actually always returns `null` but
45
- * {@link RollTables} overrides this so we need to allow a wider return type.
46
+ * In the case where `Lowercase<Name>` is not a property of {@link ui}, this actually always returns `undefined`,
47
+ * but {@link RollTables} overrides this, so we need to allow a wider return type.
46
48
  */
47
49
  get directory(): Lowercase<Name> extends keyof typeof ui
48
50
  ? typeof ui[Lowercase<Name>]
49
- : null | SidebarDirectory<ConfiguredDocumentClass<T>['metadata']['name']> | undefined;
51
+ :
52
+ | (ConfiguredDocumentClass<T>['metadata']['name'] extends DOCUMENT_TYPES
53
+ ? SidebarDirectory<ConfiguredDocumentClass<T>['metadata']['name']>
54
+ : never)
55
+ | SidebarTab
56
+ | undefined;
50
57
 
51
58
  /**
52
59
  * Return a reference to the singleton instance of this WorldCollection, or null if it has not yet been created.
@@ -63,23 +70,30 @@ declare global {
63
70
  * @param pack - The CompendiumCollection instance from which to import
64
71
  * @param id - The ID of the compendium entry to import
65
72
  * @param updateData - Optional additional data used to modify the imported Document before it is created
66
- * @param options - Optional arguments passed to the Document.create method
73
+ * (default: `{}`)
74
+ * @param options - Optional arguments passed to the {@link WorldCollection#fromCompendium} and {@link Document.create} methods
75
+ * (default: `{}`)
67
76
  * @returns The imported Document instance
68
77
  */
69
78
  importFromCompendium(
70
- pack: any, // TODO: CompendiumCollection
79
+ pack: CompendiumCollection<
80
+ CompendiumCollection.Metadata & { type: ConfiguredDocumentClass<T>['metadata']['name'] }
81
+ >,
71
82
  id: string,
72
- updateData?: DeepPartial<InstanceType<ConfiguredDocumentClass<T>>['data']['_source']>,
73
- options?: DocumentModificationContext
83
+ updateData?: DeepPartial<InstanceType<ConfiguredDocumentClass<T>>['data']['_source']> | undefined,
84
+ options?: (DocumentModificationContext & WorldCollection.FromCompendiumOptions) | undefined
74
85
  ): Promise<StoredDocument<InstanceType<ConfiguredDocumentClass<T>>>>;
75
86
 
76
87
  /**
77
88
  * Apply data transformations when importing a Document from a Compendium pack
78
89
  * @param document - The source Document, or a plain data object
90
+ * @param options - Additional options which modify how the document is imported
91
+ * (default: `{}`)
79
92
  * @returns The processed data ready for world Document creation
80
93
  */
81
94
  fromCompendium(
82
- document: InstanceType<ConfiguredDocumentClass<T>> | InstanceType<ConfiguredDocumentClass<T>>['data']['_source']
95
+ document: InstanceType<ConfiguredDocumentClass<T>> | InstanceType<ConfiguredDocumentClass<T>>['data']['_source'],
96
+ options?: WorldCollection.FromCompendiumOptions | undefined
83
97
  ): Omit<InstanceType<ConfiguredDocumentClass<T>>['data']['_source'], '_id' | 'folder'>;
84
98
 
85
99
  /**
@@ -92,36 +106,63 @@ declare global {
92
106
  ): Omit<InstanceType<ConfiguredDocumentClass<T>>['data']['_source'], '_id' | 'folder'>;
93
107
 
94
108
  /**
95
- * The WorldCollection#insert method is deprecated in favor of the WorldCollection#set method and will be removed in 0.9.0
96
- * @deprecated since 0.8.0
97
- */
98
- insert(document: InstanceType<ConfiguredDocumentClass<T>>): this;
99
-
100
- /**
101
- * The WorldCollection#remove method is deprecated in favor of the WorldCollection#delete method and will be removed in 0.9.0
102
- * @deprecated since 0.8.0
109
+ * Register a Document sheet class as a candidate which can be used to display Documents of a given type.
110
+ * See {@link DocumentSheetConfig.registerSheet} for details.
111
+ * @see DocumentSheetConfig.registerSheet
112
+ *
113
+ * @example <caption>Register a new ActorSheet subclass for use with certain Actor types.</caption>
114
+ * ```typescript
115
+ * Actors.registerSheet("dnd5e", ActorSheet5eCharacter, { types: ["character], makeDefault: true });
116
+ * ```
103
117
  */
104
- remove(id: string): boolean;
118
+ static registerSheet(...args: DropFirst<Parameters<typeof EntitySheetConfig.registerSheet>>): void;
105
119
 
106
120
  /**
107
- * The WorldCollection#entities property is deprecated in favor of the Collection#contents attribute and will be removed in 0.9.0
108
- * @deprecated since 0.8.0
121
+ * Unregister a Document sheet class, removing it from the list of available sheet Applications to use.
122
+ * See {@link DocumentSheetConfig.unregisterSheet} for detauls.
123
+ * @see DocumentSheetConfig.unregisterSheet
124
+ *
125
+ * @example <caption>Deregister the default ActorSheet subclass to replace it with others.</caption>
126
+ * Actors.unregisterSheet("core", ActorSheet);
109
127
  */
110
- get entities(): this['contents'];
128
+ static unregisterSheet(...args: DropFirst<Parameters<typeof EntitySheetConfig.unregisterSheet>>): void;
111
129
 
112
130
  /**
113
- * The WorldCollection#object property has been deprecated in favor of WorldCollection#documentClass. Support will be removed in 0.9.0
114
- * @deprecated since 0.8.0
131
+ * Return an array of currently registered sheet classes for this Document type.
132
+ * @remarks
133
+ * This is documented to return only {@link DocumentSheet}s but {@link DrawingConfig} is just a
134
+ * {@link FormApplication}. See https://gitlab.com/foundrynet/foundryvtt/-/issues/6454.
115
135
  */
116
- get object(): this['documentClass'];
136
+ static get registeredSheets(): FormApplication[];
137
+ }
117
138
 
118
- /**
119
- * The WorldCollection#importFromCollection method has been deprecated in favor of WorldCollection#importFromCompendium. Support for the old method name will be removed in 0.9.0
120
- * @deprecated since 0.8.0
121
- */
122
- importFromCollection(
123
- packName: string,
124
- ...args: Parameters<this['importFromCompendium']> extends [any, ...infer U] ? U : never
125
- ): ReturnType<this['importFromCompendium']>;
139
+ namespace WorldCollection {
140
+ interface FromCompendiumOptions {
141
+ /**
142
+ * Add flags which track the import source
143
+ * @defaultValue `false`
144
+ */
145
+ addFlags?: boolean | undefined;
146
+
147
+ /**
148
+ * Clear the currently assigned folder and sort order
149
+ * @defaultValue `true`
150
+ */
151
+ clearSort?: boolean | undefined;
152
+
153
+ /**
154
+ * Clear document permissions
155
+ * @defaultValue `true`
156
+ */
157
+ clearPermissions?: boolean | undefined;
158
+
159
+ /**
160
+ * Retain the Document id from the source Compendium
161
+ * @defaultValue `false`
162
+ */
163
+ keepId?: boolean | undefined;
164
+ }
126
165
  }
127
166
  }
167
+
168
+ type DropFirst<T extends Array<unknown>> = T extends [unknown, ...infer V] ? V : T;
@@ -5,7 +5,7 @@ declare global {
5
5
  * The singleton collection of Actor documents which exist within the active World.
6
6
  * This Collection is accessible within the Game object as game.actors.
7
7
  *
8
- * @see {@link Actor} The Actor entity
8
+ * @see {@link Actor} The Actor document
9
9
  * @see {@link ActorDirectory} The ActorDirectory sidebar directory
10
10
  *
11
11
  * @example <caption>Retrieve an existing Actor by its id</caption>
@@ -27,45 +27,11 @@ declare global {
27
27
  fromCompendium(
28
28
  document:
29
29
  | InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseActor>>
30
- | InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseActor>>['data']['_source']
30
+ | InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseActor>>['data']['_source'],
31
+ options?: WorldCollection.FromCompendiumOptions | undefined
31
32
  ): Omit<
32
33
  InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseActor>>['data']['_source'],
33
34
  '_id' | 'folder'
34
35
  >;
35
-
36
- /**
37
- * Register an Actor sheet class as a candidate which can be used to display Actors of a given type
38
- * See EntitySheetConfig.registerSheet for details
39
- *
40
- * @example <caption>Register a new ActorSheet subclass for use with certain Actor types.</caption>
41
- * ```typescript
42
- * Actors.registerSheet("dnd5e", ActorSheet5eCharacter, { types: ["character"], makeDefault: true });
43
- * ```
44
- */
45
- static registerSheet(
46
- scope: string,
47
- sheetClass: ConstructorOf<ActorSheet>,
48
- { label, types, makeDefault }?: { label?: string; types?: string[]; makeDefault?: boolean }
49
- ): void;
50
-
51
- /**
52
- * Unregister an Actor sheet class, removing it from the list of avaliable sheet Applications to use
53
- * See EntitySheetConfig.unregisterSheet for details
54
- *
55
- * @example <caption>Deregister the default ActorSheet subclass to replace it with others.</caption>
56
- * ```typescript
57
- * Actors.unregisterSheet("core", ActorSheet);
58
- * ```
59
- */
60
- static unregisterSheet(
61
- scope: string,
62
- sheetClass: ConstructorOf<ActorSheet>,
63
- { types }?: { types?: string[] }
64
- ): void;
65
-
66
- /**
67
- * Return an Array of currently registered sheet classes for this Entity type
68
- */
69
- static get registeredSheets(): typeof ActorSheet[];
70
36
  }
71
37
  }
@@ -5,7 +5,7 @@ declare global {
5
5
  * The singleton collection of Combat documents which exist within the active World.
6
6
  * This Collection is accessible within the Game object as game.combats.
7
7
  *
8
- * @see {@link Combat} The Combat entity
8
+ * @see {@link Combat} The Combat document
9
9
  * @see {@link CombatTracker} The CombatTracker sidebar directory
10
10
  */
11
11
  class CombatEncounters extends WorldCollection<typeof foundry.documents.BaseCombat, 'CombatEncounters'> {
@@ -13,10 +13,13 @@ declare global {
13
13
  static documentName: 'Combat';
14
14
 
15
15
  /**
16
- * Provide the settings object which configures the Combat entity
16
+ * Provide the settings object which configures the Combat document
17
17
  */
18
18
  static get settings(): ClientSettings.Values[`core.${typeof Combat['CONFIG_SETTING']}`];
19
19
 
20
+ /** @override */
21
+ get directory(): typeof ui['combat'];
22
+
20
23
  /**
21
24
  * Get an Array of Combat instances which apply to the current canvas scene
22
25
  */
@@ -1,7 +1,5 @@
1
1
  /**
2
2
  * The singleton collection of FogExploration documents which exist within the active World.
3
- * This Collection is accessible within the Game object as game.fog.
4
- *
5
3
  * @see {@link FogExploration} The FogExploration document
6
4
  */
7
5
  declare class FogExplorations extends WorldCollection<typeof foundry.documents.BaseFogExploration, 'FogExplorations'> {
@@ -5,7 +5,7 @@ declare global {
5
5
  * The singleton collection of Folder documents which exist within the active World.
6
6
  * This Collection is accessible within the Game object as game.fog.
7
7
  *
8
- * @see {@link FogExploration} The FogExploration document
8
+ * @see {@link Folder} The Folder document
9
9
  */
10
10
  class Folders extends WorldCollection<typeof foundry.documents.BaseFolder, 'Folders'> {
11
11
  constructor(data?: StoredDocument<InstanceType<ConfiguredDocumentClass<typeof Folder>>>['data']['_source'][]);
@@ -2,31 +2,10 @@
2
2
  * The singleton collection of Item documents which exist within the active World.
3
3
  * This Collection is accessible within the Game object as game.items.
4
4
  *
5
- * @see {@link Item} The Item entity
5
+ * @see {@link Item} The Item document
6
6
  * @see {@link ItemDirectory} The ItemDirectory sidebar directory
7
7
  */
8
8
  declare class Items extends WorldCollection<typeof foundry.documents.BaseItem, 'Items'> {
9
9
  /** @override */
10
10
  static documentName: 'Item';
11
-
12
- /**
13
- * Register an Item sheet class as a candidate which can be used to display Items of a given type
14
- * See EntitySheetConfig.registerSheet for details
15
- */
16
- static registerSheet(
17
- scope: string,
18
- sheetClass: ConstructorOf<ItemSheet>,
19
- { label, types, makeDefault }?: { label?: string; types?: string[]; makeDefault?: boolean }
20
- ): void;
21
-
22
- /**
23
- * Unregister an Item sheet class, removing it from the list of available sheet Applications to use
24
- * See EntitySheetConfig.unregisterSheet for details
25
- */
26
- static unregisterSheet(scope: string, sheetClass: ConstructorOf<ItemSheet>, { types }?: { types?: string[] }): void;
27
-
28
- /**
29
- * Return an Array of currently registered sheet classes for this Entity type
30
- */
31
- static get registeredSheets(): typeof ItemSheet[];
32
11
  }
@@ -2,7 +2,7 @@
2
2
  * The singleton collection of JournalEntry documents which exist within the active World.
3
3
  * This Collection is accessible within the Game object as game.journal.
4
4
  *
5
- * @see {@link JournalEntry} The JournalEntry entity
5
+ * @see {@link JournalEntry} The JournalEntry document
6
6
  * @see {@link JournalDirectory} The JournalDirectory sidebar directory
7
7
  */
8
8
  declare class Journal extends WorldCollection<typeof foundry.documents.BaseJournalEntry, 'Journal'> {
@@ -5,7 +5,7 @@ declare global {
5
5
  * The singleton collection of Macro documents which exist within the active World.
6
6
  * This Collection is accessible within the Game object as game.macros.
7
7
  *
8
- * @see {@link Macro} The Macro entity
8
+ * @see {@link Macro} The Macro document
9
9
  * @see {@link MacroDirectory} The MacroDirectory sidebar directory
10
10
  */
11
11
  class Macros extends WorldCollection<typeof foundry.documents.BaseMacro, 'Macros'> {
@@ -19,16 +19,11 @@ declare global {
19
19
  fromCompendium(
20
20
  document:
21
21
  | InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseMacro>>
22
- | InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseMacro>>['data']['_source']
22
+ | InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseMacro>>['data']['_source'],
23
+ options?: WorldCollection.FromCompendiumOptions | undefined
23
24
  ): Omit<
24
25
  InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseMacro>>['data']['_source'],
25
26
  '_id' | 'folder'
26
27
  >;
27
-
28
- /**
29
- * You are calling Macros.canUseScripts which has been deprecated in favor of User#can('MACRO_SCRIPT')
30
- * @deprecated since 0.8.1
31
- */
32
- static canUseScripts(user: InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseUser>>): boolean;
33
28
  }
34
29
  }
@@ -5,19 +5,24 @@ declare global {
5
5
  * The singleton collection of ChatMessage documents which exist within the active World.
6
6
  * This Collection is accessible within the Game object as game.messages.
7
7
  *
8
- * @see {@link ChatMessage} The ChatMessage entity
8
+ * @see {@link ChatMessage} The ChatMessage document
9
9
  * @see {@link ChatLog} The ChatLog sidebar directory
10
10
  */
11
11
  class Messages extends WorldCollection<typeof foundry.documents.BaseChatMessage, 'Messages'> {
12
12
  /** @override */
13
13
  static documentName: 'ChatMessage';
14
14
 
15
+ /**
16
+ * @override
17
+ * */
18
+ get directory(): typeof ui.chat;
19
+
15
20
  /** @override */
16
21
  render(force?: boolean): void;
17
22
 
18
23
  /**
19
24
  * If requested, dispatch a Chat Bubble UI for the newly created message
20
- * @param message - The ChatMessage entity to say
25
+ * @param message - The ChatMessage document to say
21
26
  */
22
27
  sayBubble(message: InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseChatMessage>>): void;
23
28
 
@@ -1,12 +1,12 @@
1
1
  import { ConfiguredDocumentClass } from '../../../../../types/helperTypes';
2
- import type { SceneDataConstructorData } from '../../../../common/data/data.mjs/sceneData.js';
2
+ import type { SceneDataConstructorData } from '../../../../common/data/data.mjs/sceneData';
3
3
 
4
4
  declare global {
5
5
  /**
6
6
  * The singleton collection of Playlist documents which exist within the active World.
7
7
  * This Collection is accessible within the Game object as game.playlists.
8
8
  *
9
- * @see {@link Playlist} The Playlist entity
9
+ * @see {@link Playlist} The Playlist document
10
10
  * @see {@link PlaylistDirectory} The PlaylistDirectory sidebar directory
11
11
  */
12
12
  class Playlists extends WorldCollection<typeof foundry.documents.BasePlaylist, 'Playlists'> {
@@ -20,7 +20,7 @@ declare global {
20
20
  static documentName: 'Playlist';
21
21
 
22
22
  /**
23
- * Return the subset of Playlist entities which are currently playing
23
+ * Return the subset of Playlist documents which are currently playing
24
24
  */
25
25
  get playing(): ReturnType<this['filter']>;
26
26
 
@@ -30,8 +30,8 @@ declare global {
30
30
  initialize(): void;
31
31
 
32
32
  /**
33
- * Handle changes to a Scene to determine whether to trigger changes to Playlist entities.
34
- * @param scene - The Scene entity being updated
33
+ * Handle changes to a Scene to determine whether to trigger changes to Playlist documents.
34
+ * @param scene - The Scene document being updated
35
35
  * @param data - The incremental update data
36
36
  */
37
37
  protected _onChangeScene(
@@ -13,7 +13,7 @@ declare class RollTables extends WorldCollection<typeof foundry.documents.BaseRo
13
13
  get directory(): typeof ui['tables'];
14
14
 
15
15
  /**
16
- * Register world settings related to RollTable entities
16
+ * Register world settings related to RollTable documents
17
17
  */
18
18
  static registerSettings(): void;
19
19
  }
@@ -5,7 +5,7 @@ declare global {
5
5
  * The singleton collection of Scene documents which exist within the active World.
6
6
  * This Collection is accessible within the Game object as game.scenes.
7
7
  *
8
- * @see {@link Scene} The Scene entity
8
+ * @see {@link Scene} The Scene document
9
9
  * @see {@link SceneDirectory} The SceneDirectory sidebar directory
10
10
  */
11
11
  class Scenes extends WorldCollection<typeof foundry.documents.BaseScene, 'Scenes'> {
@@ -54,7 +54,8 @@ declare global {
54
54
  fromCompendium(
55
55
  document:
56
56
  | InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseScene>>
57
- | InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseScene>>['data']['_source']
57
+ | InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseScene>>['data']['_source'],
58
+ options?: WorldCollection.FromCompendiumOptions | undefined
58
59
  ): Omit<
59
60
  InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseScene>>['data']['_source'],
60
61
  '_id' | 'folder'
@@ -5,19 +5,21 @@ declare global {
5
5
  * The singleton collection of User documents which exist within the active World.
6
6
  * This Collection is accessible within the Game object as game.users.
7
7
  *
8
- * @see {@link User} The User entity
8
+ * @see {@link User} The User document
9
9
  */
10
10
  class Users extends WorldCollection<typeof foundry.documents.BaseUser, 'Users'> {
11
11
  constructor(data?: foundry.data.UserData['_source'][]);
12
12
 
13
13
  /**
14
- * The User entity of the currently connected user
14
+ * The User document of the currently connected user
15
15
  * @defaultValue `null`
16
16
  */
17
17
  current: StoredDocument<InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseUser>>> | null;
18
18
 
19
19
  /**
20
- * Initialize the Map object and all its contained entities
20
+ * Initialize the Map object and all its contained documents
21
+ * @override
22
+ * @internal
21
23
  */
22
24
  protected _initialize(): void;
23
25
 
@@ -36,7 +38,8 @@ declare global {
36
38
  * Handle receipt of activity data from another User connected to the Game session
37
39
  * @param userId - The User id who generated the activity data
38
40
  * @param activityData - The object of activity data
41
+ * (default: `{}`)
39
42
  */
40
- protected static _handleUserActivity(userId: string, activityData?: User.ActivityData): void;
43
+ protected static _handleUserActivity(userId: string, activityData?: ActivityData | undefined): void;
41
44
  }
42
45
  }
@@ -9,10 +9,10 @@ declare class WorldSettings extends WorldCollection<typeof foundry.documents.Bas
9
9
  static documentName: 'Setting';
10
10
 
11
11
  /** @override */
12
- get directory(): null;
12
+ get directory(): undefined;
13
13
 
14
14
  /**
15
- * Return the Setting document with the given key.
15
+ * Return the Setting or Keybind document with the given key.
16
16
  * @param key - The setting key
17
17
  * @returns The Setting.
18
18
  */
@@ -4,9 +4,9 @@ import {
4
4
  ConfiguredObjectClassForName,
5
5
  DocumentConstructor,
6
6
  ToObjectFalseType
7
- } from '../../types/helperTypes.js';
8
- import { DocumentModificationOptions } from '../common/abstract/document.mjs.js';
9
- import { EffectChangeData } from '../common/data/data.mjs/effectChangeData.js';
7
+ } from '../../types/helperTypes';
8
+ import { DocumentModificationOptions } from '../common/abstract/document.mjs';
9
+ import { EffectChangeData } from '../common/data/data.mjs/effectChangeData';
10
10
  import { DropData } from './clientDocumentMixin';
11
11
 
12
12
  declare global {
@@ -1,6 +1,23 @@
1
1
  import { ConfiguredDocumentClass, ConfiguredObjectClassForName } from '../../../../types/helperTypes';
2
2
 
3
3
  declare global {
4
+ interface RulerData {
5
+ /** The ruler measurement state. */
6
+ _state: Ruler['_state'];
7
+
8
+ /** A unique name for the ruler containing the owning user's ID. */
9
+ name: string;
10
+
11
+ /** The current point the ruler has been extended to. */
12
+ destination: PIXI.Point;
13
+
14
+ /** The class name of this ruler instance. */
15
+ class: string;
16
+
17
+ /** Additional waypoints along the ruler's length, including the starting point. */
18
+ waypoints: PIXI.Point[];
19
+ }
20
+
4
21
  /**
5
22
  * The Ruler - used to measure distances and trigger movements
6
23
  */
@@ -169,13 +186,7 @@ declare global {
169
186
  */
170
187
  protected _endMeasurement(): void;
171
188
 
172
- toJSON(): {
173
- class: 'Ruler';
174
- name: string;
175
- waypoints: Ruler['waypoints'];
176
- destination: Ruler['destination'];
177
- _state: Ruler['_state'];
178
- };
189
+ toJSON(): RulerData;
179
190
 
180
191
  /**
181
192
  * Update a Ruler instance using data provided through the cursor activity socket
@@ -1,4 +1,4 @@
1
- import type { ConfiguredObjectClassForName } from '../../../../types/helperTypes.js';
1
+ import type { ConfiguredObjectClassForName } from '../../../../types/helperTypes';
2
2
 
3
3
  declare global {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { ConfiguredObjectClassForName } from '../../../../../types/helperTypes.js';
1
+ import type { ConfiguredObjectClassForName } from '../../../../../types/helperTypes';
2
2
 
3
3
  declare global {
4
4
  type VertexMap = Map<number, PolygonVertex>;
@@ -1,4 +1,4 @@
1
- import type { ConfiguredObjectClassForName } from '../../../types/helperTypes.js';
1
+ import type { ConfiguredObjectClassForName } from '../../../types/helperTypes';
2
2
 
3
3
  declare global {
4
4
  /** @see {@link foundry.data.LightData} */
@@ -1,4 +1,4 @@
1
- import type { ConfiguredObjectClassForName } from '../../../types/helperTypes.js';
1
+ import type { ConfiguredObjectClassForName } from '../../../types/helperTypes';
2
2
 
3
3
  declare global {
4
4
  interface SoundSourceData extends PointSource.Data {
@@ -1,4 +1,4 @@
1
- import type { ConfiguredObjectClassForName } from '../../../types/helperTypes.js';
1
+ import type { ConfiguredObjectClassForName } from '../../../types/helperTypes';
2
2
 
3
3
  declare global {
4
4
  interface VisionSourceData extends Exclude<PointSource.Data, 'walls'> {
@@ -1,4 +1,4 @@
1
- import type { ConfiguredObjectClassForName } from '../../types/helperTypes.js';
1
+ import type { ConfiguredObjectClassForName } from '../../types/helperTypes';
2
2
 
3
3
  declare global {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { LineIntersection } from '../common/utils/geometry.mjs.js';
1
+ import type { LineIntersection } from '../common/utils/geometry.mjs';
2
2
 
3
3
  declare global {
4
4
  interface RayIntersection {
@@ -63,9 +63,35 @@ export type ConfiguredDocumentClass<T extends DocumentConstructor> = ConfiguredD
63
63
  T['metadata']['name']
64
64
  >;
65
65
 
66
- export type DocumentType = keyof {
67
- [Key in keyof CONFIG as 'documentClass' extends keyof CONFIG[Key] ? Key : never]: unknown;
68
- };
66
+ export type DocumentType =
67
+ | 'Actor'
68
+ | 'Adventure'
69
+ | 'Cards'
70
+ | 'ChatMessage'
71
+ | 'Combat'
72
+ | 'FogExploration'
73
+ | 'Folder'
74
+ | 'Item'
75
+ | 'JournalEntry'
76
+ | 'Macro'
77
+ | 'Playlist'
78
+ | 'RollTable'
79
+ | 'Scene'
80
+ | 'Setting'
81
+ | 'User'
82
+ | 'ActiveEffect'
83
+ | 'Card'
84
+ | 'TableResult'
85
+ | 'PlaylistSound'
86
+ | 'AmbientLight'
87
+ | 'AmbientSound'
88
+ | 'Combatant'
89
+ | 'Drawing'
90
+ | 'MeasuredTemplate'
91
+ | 'Note'
92
+ | 'Tile'
93
+ | 'Token'
94
+ | 'Wall';
69
95
 
70
96
  export type PlaceableDocumentType =
71
97
  | 'AmbientLight'
@@ -77,17 +103,9 @@ export type PlaceableDocumentType =
77
103
  | 'Token'
78
104
  | 'Wall';
79
105
 
80
- export type ConfiguredDocumentClassForName<Name extends DocumentType> = 'documentClass' extends keyof CONFIG[Name]
81
- ? CONFIG[Name]['documentClass']
82
- : never;
83
-
84
- export type ObjectType = keyof {
85
- [Key in keyof CONFIG as 'objectClass' extends keyof CONFIG[Key] ? Key : never]: unknown;
86
- };
106
+ export type ConfiguredDocumentClassForName<Name extends DocumentType> = CONFIG[Name]['documentClass'];
87
107
 
88
- export type ConfiguredObjectClassForName<Name extends ObjectType> = 'objectClass' extends keyof CONFIG[Name]
89
- ? CONFIG[Name]['objectClass']
90
- : never;
108
+ export type ConfiguredObjectClassForName<Name extends PlaceableDocumentType> = CONFIG[Name]['objectClass'];
91
109
 
92
110
  export type ConfiguredData<Name extends string> = Name extends keyof DataConfig ? DataConfig[Name] : {};
93
111