@league-of-foundry-developers/foundry-vtt-types 0.8.9-5 → 0.8.9-9

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 (64) hide show
  1. package/README.md +41 -13
  2. package/index-lenient.d.ts +10 -0
  3. package/package.json +10 -1
  4. package/src/foundry/common/abstract/backend.mjs.d.ts +14 -15
  5. package/src/foundry/common/abstract/document.mjs.d.ts +6 -2
  6. package/src/foundry/common/data/data.mjs/drawingData.d.ts +8 -3
  7. package/src/foundry/common/types.mjs.d.ts +5 -0
  8. package/src/foundry/foundry.js/application.d.ts +2 -5
  9. package/src/foundry/foundry.js/applications/cameraViews.d.ts +36 -31
  10. package/src/foundry/foundry.js/applications/compendium.d.ts +5 -2
  11. package/src/foundry/foundry.js/applications/filePicker.d.ts +115 -115
  12. package/src/foundry/foundry.js/applications/formApplication.d.ts +1 -1
  13. package/src/foundry/foundry.js/applications/formApplications/combatTrackerConfig.d.ts +20 -27
  14. package/src/foundry/foundry.js/applications/formApplications/defaultTokenConfig.d.ts +66 -0
  15. package/src/foundry/foundry.js/applications/formApplications/documentSheets/activeEffectConfig.d.ts +2 -2
  16. package/src/foundry/foundry.js/applications/formApplications/documentSheets/actorSheet.d.ts +5 -2
  17. package/src/foundry/foundry.js/applications/formApplications/{folderConfig.d.ts → documentSheets/folderConfig.d.ts} +2 -2
  18. package/src/foundry/foundry.js/applications/formApplications/documentSheets/index.d.ts +3 -0
  19. package/src/foundry/foundry.js/applications/formApplications/documentSheets/measuredTemplateConfig.d.ts +60 -0
  20. package/src/foundry/foundry.js/applications/formApplications/documentSheets/noteConfig.d.ts +72 -0
  21. package/src/foundry/foundry.js/applications/formApplications/documentSheets/rollTableConfig.d.ts +190 -148
  22. package/src/foundry/foundry.js/applications/formApplications/documentSheets/sceneConfig.d.ts +133 -110
  23. package/src/foundry/foundry.js/applications/formApplications/drawingConfig.d.ts +93 -95
  24. package/src/foundry/foundry.js/applications/formApplications/entitySheetConfig.d.ts +163 -147
  25. package/src/foundry/foundry.js/applications/formApplications/index.d.ts +1 -3
  26. package/src/foundry/foundry.js/applications/formApplications/moduleManagement.d.ts +41 -23
  27. package/src/foundry/foundry.js/applications/formApplications/settingsConfig.d.ts +95 -86
  28. package/src/foundry/foundry.js/applications/formApplications/tokenConfig.d.ts +146 -158
  29. package/src/foundry/foundry.js/applications/formApplications/wallConfig.d.ts +60 -70
  30. package/src/foundry/foundry.js/applications/formApplications/worldConfig.d.ts +25 -17
  31. package/src/foundry/foundry.js/applications/hotbar.d.ts +5 -4
  32. package/src/foundry/foundry.js/applications/sceneControls.d.ts +13 -3
  33. package/src/foundry/foundry.js/applications/sceneNavigation.d.ts +90 -71
  34. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/actorDirectory.d.ts +13 -56
  35. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/itemDirectory.d.ts +7 -30
  36. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/journalDirectory.d.ts +14 -34
  37. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/macroDirectory.d.ts +6 -52
  38. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/sceneDirectory.d.ts +6 -23
  39. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectory.d.ts +2 -4
  40. package/src/foundry/foundry.js/cameraPopoutAppWrapper.d.ts +12 -7
  41. package/src/foundry/foundry.js/canvas.d.ts +2 -1
  42. package/src/foundry/foundry.js/clientDatabaseBackend.d.ts +210 -0
  43. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/tokenDocument.d.ts +1 -1
  44. package/src/foundry/foundry.js/clientDocuments/index.d.ts +1 -0
  45. package/src/foundry/foundry.js/clientDocuments/prototypeToken.d.ts +15 -0
  46. package/src/foundry/foundry.js/clientSettings.d.ts +14 -1
  47. package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +44 -11
  48. package/src/foundry/foundry.js/config.d.ts +84 -70
  49. package/src/foundry/foundry.js/dragDrop.d.ts +17 -14
  50. package/src/foundry/foundry.js/globalVariables.d.ts +7 -4
  51. package/src/foundry/foundry.js/mouseInteractionManager.d.ts +78 -34
  52. package/src/foundry/foundry.js/pixi/containers/canvasLayer.d.ts +2 -1
  53. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayer.d.ts +10 -19
  54. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/mapLayers/backgroundLayer.d.ts +6 -2
  55. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/mapLayers/foregroundLayer.d.ts +2 -2
  56. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/wallsLayer.d.ts +1 -1
  57. package/src/foundry/foundry.js/pixi/containers/placeableObject.d.ts +4 -1
  58. package/src/foundry/foundry.js/pixi/containers/placeableObjects/wall.d.ts +1 -1
  59. package/src/foundry/foundry.js/pixi/containers/ruler.d.ts +11 -7
  60. package/src/foundry/foundry.js/pointSource.d.ts +173 -85
  61. package/src/foundry/foundry.js/textEditor.d.ts +39 -8
  62. package/src/foundry/index.d.ts +1 -0
  63. package/src/foundry/foundry.js/applications/formApplications/measuredTemplateConfig.d.ts +0 -61
  64. package/src/foundry/foundry.js/applications/formApplications/noteConfig.d.ts +0 -77
@@ -0,0 +1,210 @@
1
+ import type { ConfiguredDocumentClassForName } from '../../types/helperTypes';
2
+ import type { Request } from '../common/abstract/backend.mjs';
3
+ import type Document from '../common/abstract/document.mjs';
4
+
5
+ declare global {
6
+ /**
7
+ * The client-side database backend implementation which handles Document modification operations.
8
+ */
9
+ class ClientDatabaseBackend extends foundry.abstract.DatabaseBackend {
10
+ /**
11
+ * Activate the Socket event listeners used to receive responses from events which modify database documents
12
+ * @param socket - The active game socket
13
+ */
14
+ activateSocketListeners(socket: io.Socket): void;
15
+
16
+ /** @override */
17
+ protected _getDocuments<T extends Document<any, any>>(
18
+ documentClass: ConstructorOf<T>,
19
+ request: Request,
20
+ user: InstanceType<ConfiguredDocumentClassForName<'User'>>
21
+ ): Promise<T[]>;
22
+
23
+ /**
24
+ * @override
25
+ * @remarks
26
+ * Get operations for embedded Documents are currently un-supported.
27
+ * The returned promise always rejects.
28
+ */
29
+ protected _getEmbeddedDocuments<T extends Document<any, any>>(
30
+ documentClass: ConstructorOf<T>,
31
+ parent: T extends Document<any, infer U> ? U : never,
32
+ request: Request,
33
+ user: InstanceType<ConfiguredDocumentClassForName<'User'>>
34
+ ): Promise<never>;
35
+
36
+ /** @override */
37
+ protected _createDocuments<T extends Document<any, any>>(
38
+ documentClass: ConstructorOf<T>,
39
+ request: Request,
40
+ user: InstanceType<ConfiguredDocumentClassForName<'User'>>
41
+ ): Promise<T[]>;
42
+
43
+ /** @override */
44
+ protected _createEmbeddedDocuments<T extends Document<any, any>>(
45
+ documentClass: ConstructorOf<T>,
46
+ parent: T extends Document<any, infer U> ? U : never,
47
+ request: Request,
48
+ user: InstanceType<ConfiguredDocumentClassForName<'User'>>
49
+ ): Promise<T[]>;
50
+
51
+ /**
52
+ * Perform a standardized pre-creation workflow for all Document types. For internal use only.
53
+ * @internal
54
+ */
55
+ protected _preCreateDocumentArray<T extends Document<any, any>>(
56
+ documentClass: ConstructorOf<T>,
57
+ {
58
+ data,
59
+ options,
60
+ pack,
61
+ parent,
62
+ user
63
+ }: Pick<Request, 'data' | 'pack' | 'parent' | 'options'> & {
64
+ user: InstanceType<ConfiguredDocumentClassForName<'User'>>;
65
+ }
66
+ ): Promise<T[]>;
67
+
68
+ /**
69
+ * Handle a SocketResponse from the server when one or multiple documents were created
70
+ * @param response - The provided Socket response
71
+ * @returns An Array of created Document instances
72
+ */
73
+ protected _handleCreateDocuments(response: SocketResponse): foundry.abstract.Document<any, any>[];
74
+
75
+ /**
76
+ * Handle a SocketResponse from the server when one or multiple documents were created
77
+ * @param response - The provided Socket response
78
+ * @returns An Array of created Document instances
79
+ */
80
+ protected _handleCreateEmbeddedDocuments(response: SocketResponse): foundry.abstract.Document<any, any>[];
81
+
82
+ /**
83
+ * Perform a standardized post-creation workflow for all Document types. For internal use only.
84
+ * @returns An array of callback operations to perform once every Document is created
85
+ * @internal
86
+ */
87
+ protected _postCreateDocumentCallbacks(
88
+ type: string,
89
+ collection: Collection<foundry.abstract.Document<any, any>>,
90
+ result: object[],
91
+ { options, userId, parent, pack }: Pick<Request, 'options' | 'parent' | 'pack'> & { userId?: string }
92
+ ): (() => void)[];
93
+
94
+ /** @override */
95
+ protected _updateDocuments<T extends Document<any, any>>(
96
+ documentClass: ConstructorOf<T>,
97
+ request: Request,
98
+ user: InstanceType<ConfiguredDocumentClassForName<'User'>>
99
+ ): Promise<T[]>;
100
+
101
+ /** @override */
102
+ protected _updateEmbeddedDocuments<T extends Document<any, any>>(
103
+ documentClass: ConstructorOf<T>,
104
+ parent: T extends Document<any, infer U> ? U : never,
105
+ request: Request,
106
+ user: InstanceType<ConfiguredDocumentClassForName<'User'>>
107
+ ): Promise<T[]>;
108
+
109
+ /**
110
+ * Perform a standardized pre-update workflow for all Document types. For internal use only.
111
+ * @internal
112
+ */
113
+ protected _preUpdateDocumentArray<T extends Document<any, any>>(
114
+ collection: Collection<T>,
115
+ {
116
+ updates,
117
+ options,
118
+ user
119
+ }: Pick<Request, 'updates' | 'options'> & {
120
+ user: InstanceType<ConfiguredDocumentClassForName<'User'>>;
121
+ }
122
+ ): Promise<T[]>;
123
+
124
+ /**
125
+ * Handle a SocketResponse from the server when one or multiple documents were updated
126
+ * @param response - The provided Socket response
127
+ * @returns An Array of updated Document instances
128
+ */
129
+ protected _handleUpdateDocuments(response: SocketResponse): foundry.abstract.Document<any, any>[];
130
+
131
+ /**
132
+ * Handle a SocketResponse from the server when embedded Documents are updated in a parent Document.
133
+ * @param response - The provided Socket response
134
+ * @returns An Array of updated Document instances
135
+ */
136
+ protected _handleUpdateEmbeddedDocuments(response: SocketResponse): foundry.abstract.Document<any, any>[];
137
+
138
+ /**
139
+ * Perform a standardized post-update workflow for all Document types. For internal use only.
140
+ * @returns An array of callback operations to perform after every Document is updated
141
+ * @internal
142
+ */
143
+ protected _postUpdateDocumentCallbacks(
144
+ collection: Collection<foundry.abstract.Document<any, any>>,
145
+ result: object[],
146
+ { options, userId }: Pick<Request, 'options'> & { userId?: string }
147
+ ): () => void;
148
+
149
+ /** @override */
150
+ protected _deleteDocuments<T extends Document<any, any>>(
151
+ documentClass: ConstructorOf<T>,
152
+ request: Request,
153
+ user: InstanceType<ConfiguredDocumentClassForName<'User'>>
154
+ ): Promise<T[]>;
155
+
156
+ /** @override */
157
+ protected _deleteEmbeddedDocuments<T extends Document<any, any>>(
158
+ documentClass: ConstructorOf<T>,
159
+ parent: T extends Document<any, infer U> ? U : never,
160
+ request: Request,
161
+ user: InstanceType<ConfiguredDocumentClassForName<'User'>>
162
+ ): Promise<T[]>;
163
+
164
+ /**
165
+ * Perform a standardized pre-delete workflow for all Document types. For internal use only.
166
+ * @internal
167
+ */
168
+ protected _preDeleteDocumentArray<T extends Document<any, any>>(
169
+ collection: Collection<T>,
170
+ {
171
+ ids,
172
+ options,
173
+ user
174
+ }: Pick<Request, 'ids' | 'options'> & { user: InstanceType<ConfiguredDocumentClassForName<'User'>> }
175
+ ): Promise<T[]>;
176
+
177
+ /**
178
+ * Handle a SocketResponse from the server where Documents are deleted.
179
+ * @param response - The provided Socket response
180
+ * @returns An Array of deleted Document instances
181
+ */
182
+ protected _handleDeleteDocuments(response: SocketResponse): foundry.abstract.Document<any, any>[];
183
+
184
+ /**
185
+ * Handle a SocketResponse from the server when embedded Documents are deleted from a parent Document.
186
+ * @param response - The provided Socket response
187
+ * @returns An Array of deleted Document instances
188
+ */
189
+ protected _handleDeleteEmbeddedDocuments(response: SocketResponse): foundry.abstract.Document<any, any>[];
190
+
191
+ /**
192
+ * Perform a standardized post-deletion workflow for all Document types. For internal use only.
193
+ * @returns An array of callback operations to perform after every Document is deleted
194
+ * @internal
195
+ */
196
+ protected _postDeleteDocumentCallbacks(
197
+ collection: Collection<foundry.abstract.Document<any, any>>,
198
+ result: object[],
199
+ { options, userId }: Pick<Request, 'options'> & { userId?: string }
200
+ ): (() => void)[];
201
+
202
+ /** @override */
203
+ getFlagScopes(): string[];
204
+
205
+ /** @override */
206
+ getCompendiumScopes(): string[];
207
+ }
208
+ }
209
+
210
+ export {};
@@ -204,7 +204,7 @@ declare global {
204
204
  /**
205
205
  * Inspect the Actor data model and identify the set of attributes which could be used for a Token Bar
206
206
  */
207
- static getTrackedAttributeChoices(attributes?: TrackedAttributes): Partial<Record<string, string[]>>;
207
+ static getTrackedAttributeChoices(attributes?: TrackedAttributes): Record<string, string[]>;
208
208
  }
209
209
  }
210
210
 
@@ -11,6 +11,7 @@ import './journalEntry';
11
11
  import './macro';
12
12
  import './playlist';
13
13
  import './playlistSound';
14
+ import './prototypeToken';
14
15
  import './rollTable';
15
16
  import './scene';
16
17
  import './setting';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * An extended Document definition used specifically
3
+ * This ensures that the PrototypeTokenData schema is used instead of the standard TokenData.
4
+ * This exists specifically for prototype Token configuration in the TokenConfig app and should not be used otherwise.
5
+ * @internal
6
+ * @remarks The types for this are incorrect, in particular everything related to the data should use
7
+ * {@link foundry.data.PrototypeTokenData} instead of {@link foundry.data.TokenData}. However, with the current approach
8
+ * to type documents, we don't see a way to do this. This class is just added for reference. As the documentation above
9
+ * says, don't use it (there really shouldn't be a need to do so).
10
+ */
11
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
12
+ // @ts-ignore
13
+ declare class PrototypeTokenDocument extends TokenDocument {
14
+ static get schema(): typeof foundry.data.PrototypeTokenData;
15
+ }
@@ -219,7 +219,7 @@ declare namespace ClientSettings {
219
219
  }
220
220
 
221
221
  interface Values {
222
- 'core.combatTrackerConfig': { resource: string; skipDefeated: boolean };
222
+ 'core.combatTrackerConfig': { resource: string; skipDefeated: boolean } | {};
223
223
  'core.compendiumConfiguration': Partial<Record<string, CompendiumCollection.Configuration>>;
224
224
  'core.rollMode': foundry.CONST.DiceRollMode;
225
225
  'core.animateRollTable': boolean;
@@ -229,6 +229,19 @@ declare namespace ClientSettings {
229
229
  'core.globalPlaylistVolume': number;
230
230
  'core.globalAmbientVolume': number;
231
231
  'core.globalInterfaceVolume': number;
232
+ 'core.moduleConfiguration': Record<string, boolean>;
233
+ 'core.chatBubbles': boolean;
234
+ 'core.chatBubblesPan': boolean;
235
+ 'core.coneTemplateType': 'round' | 'flat';
236
+ 'core.language': string;
237
+ 'core.leftClickRelease': boolean;
238
+ 'core.lightAnimation': boolean;
239
+ 'core.maxFPS': number;
240
+ 'core.mipmap': boolean;
241
+ 'core.noCanvas': boolean;
242
+ 'core.softShadows': boolean;
243
+ 'core.tokenDragPreview': boolean;
244
+ 'core.visionAnimation': boolean;
232
245
  [key: string]: unknown;
233
246
  }
234
247
  }
@@ -1,5 +1,4 @@
1
1
  import { ConfiguredDocumentClassForName, ConstructorDataType } from '../../../../types/helperTypes';
2
- import { IdQuery } from '../../../common/abstract/backend.mjs';
3
2
  import { DocumentModificationOptions } from '../../../common/abstract/document.mjs';
4
3
 
5
4
  declare global {
@@ -25,6 +24,12 @@ declare global {
25
24
  /** A debounced function which will clear the contents of the Compendium pack if it is not accessed frequently. */
26
25
  _flush: () => void;
27
26
 
27
+ /**
28
+ * Has this Compendium pack been fully indexed?
29
+ * @defaultValue `false`
30
+ */
31
+ indexed: boolean;
32
+
28
33
  /**
29
34
  * The amount of time that Document instances within this CompendiumCollection are held in memory.
30
35
  * Accessing the contents of the Compendium pack extends the duration of this lifetime.
@@ -37,6 +42,32 @@ declare global {
37
42
  */
38
43
  static CONFIG_SETTING: 'compendiumConfiguration';
39
44
 
45
+ /**
46
+ * The default index fields which should be retrieved for each Compendium document type
47
+ */
48
+ static INDEX_FIELDS: {
49
+ /** @defaultValue `["name", "img", "type"]` */
50
+ Actor: (keyof foundry.data.ActorData['_source'])[];
51
+
52
+ /** @defaultValue `["name", "img", "type"]` */
53
+ Item: (keyof foundry.data.ItemData['_source'])[];
54
+
55
+ /** @defaultValue `["name", "thumb"]` */
56
+ Scene: (keyof foundry.data.SceneData['_source'])[];
57
+
58
+ /** @defaultValue `["name", "img"]` */
59
+ JournalEntry: (keyof foundry.data.JournalEntryData['_source'])[];
60
+
61
+ /** @defaultValue `["name", "img"]` */
62
+ Macro: (keyof foundry.data.MacroData['_source'])[];
63
+
64
+ /** @defaultValue `["name", "img"]` */
65
+ RollTable: (keyof foundry.data.RollTableData['_source'])[];
66
+
67
+ /** @defaultValue `["name"]` */
68
+ Playlist: (keyof foundry.data.PlaylistData['_source'])[];
69
+ };
70
+
40
71
  /** The canonical Compendium name - comprised of the originating package and the pack name */
41
72
  get collection(): string;
42
73
 
@@ -64,8 +95,11 @@ declare global {
64
95
 
65
96
  delete: (id: string) => boolean;
66
97
 
67
- /** Load the Compendium index and cache it as the keys and values of the Collection. */
68
- getIndex(): Promise<this['index']>;
98
+ /**
99
+ * Load the Compendium index and cache it as the keys and values of the Collection.
100
+ * @param options - Options which customize how the index is created
101
+ */
102
+ getIndex(options?: CompendiumCollection.GetIndexOptions<T>): Promise<this['index']>;
69
103
 
70
104
  /**
71
105
  * Get a single Document from this Compendium by ID.
@@ -81,7 +115,7 @@ declare global {
81
115
  * default: `{}`
82
116
  * @returns The retrieved Document instances
83
117
  */
84
- getDocuments(query?: IdQuery): Promise<StoredDocument<DocumentInstanceForCompendiumMetadata<T>>[]>;
118
+ getDocuments(query?: Record<string, unknown>): Promise<StoredDocument<DocumentInstanceForCompendiumMetadata<T>>[]>;
85
119
 
86
120
  /**
87
121
  * Import a Document into this Compendium Collection.
@@ -236,6 +270,11 @@ declare global {
236
270
  package: string;
237
271
  system?: string;
238
272
  }
273
+
274
+ interface GetIndexOptions<T extends CompendiumCollection.Metadata> {
275
+ /** An array of fields to return as part of the index */
276
+ fields?: (keyof DocumentInstanceForCompendiumMetadata<T>['data']['_source'])[];
277
+ }
239
278
  }
240
279
  }
241
280
 
@@ -266,11 +305,5 @@ type DocumentInstanceForCompendiumMetadata<T extends CompendiumCollection.Metada
266
305
  >;
267
306
 
268
307
  type IndexTypeForMetadata<T extends CompendiumCollection.Metadata> = foundry.utils.Collection<
269
- Pick<
270
- StoredDocument<DocumentInstanceForCompendiumMetadata<T>>['data'],
271
- | '_id'
272
- | 'name'
273
- | ('img' extends keyof StoredDocument<DocumentInstanceForCompendiumMetadata<T>>['data'] ? 'img' : never)
274
- | ('type' extends keyof StoredDocument<DocumentInstanceForCompendiumMetadata<T>>['data'] ? 'type' : never)
275
- >
308
+ { _id: string } & Partial<DocumentInstanceForCompendiumMetadata<T>['data']['_source']>
276
309
  >;
@@ -1,5 +1,4 @@
1
1
  import { DocumentConstructor, PlaceableObjectConstructor } from '../../types/helperTypes';
2
- import DatabaseBackend from '../common/abstract/backend.mjs';
3
2
 
4
3
  type ConfiguredDocumentClassOrDefault<Fallback extends DocumentConstructor> =
5
4
  Fallback['metadata']['name'] extends keyof DocumentClassConfig
@@ -230,7 +229,7 @@ declare global {
230
229
  * Configure the DatabaseBackend used to perform Document operations
231
230
  * @defaultValue `new ClientDatabaseBackend()`
232
231
  */
233
- DatabaseBackend: DatabaseBackend; // TODO: ClientDatabaseBackend
232
+ DatabaseBackend: ClientDatabaseBackend;
234
233
 
235
234
  /**
236
235
  * Configuration for the Actor document
@@ -249,7 +248,7 @@ declare global {
249
248
  /**
250
249
  * @defaultValue `{}`
251
250
  */
252
- sheetClasses: EntitySheetConfig.SheetClasses;
251
+ sheetClasses: CONFIG.SheetClasses;
253
252
 
254
253
  /**
255
254
  * @defaultValue `'fas fa-user'`
@@ -444,7 +443,7 @@ declare global {
444
443
  /**
445
444
  * @defaultValue `{}`
446
445
  */
447
- sheetClasses: EntitySheetConfig.SheetClasses;
446
+ sheetClasses: CONFIG.SheetClasses;
448
447
 
449
448
  /**
450
449
  * @defaultValue `'fas fa-suitcase'`
@@ -824,72 +823,7 @@ declare global {
824
823
  */
825
824
  unexploredColor: number;
826
825
 
827
- layers: {
828
- /**
829
- * @defaultValue `BackgroundLayer`
830
- */
831
- background: ConstructorOf<BackgroundLayer>;
832
-
833
- /**
834
- * @defaultValue `DrawingsLayer`
835
- */
836
- drawings: ConstructorOf<DrawingsLayer>;
837
-
838
- /**
839
- * @defaultValue `GridLayer`
840
- */
841
- grid: ConstructorOf<GridLayer>;
842
-
843
- /**
844
- * @defaultValue `WallsLayer`
845
- */
846
- walls: ConstructorOf<WallsLayer>;
847
-
848
- /**
849
- * @defaultValue `TemplateLayer`
850
- */
851
- templates: ConstructorOf<TemplateLayer>;
852
-
853
- /**
854
- * @defaultValue `NotesLayer`
855
- */
856
- notes: ConstructorOf<NotesLayer>;
857
-
858
- /**
859
- * @defaultValue `TokenLayer`
860
- */
861
- tokens: ConstructorOf<TokenLayer>;
862
-
863
- /**
864
- * @defaultValue `ForegroundLayer`
865
- */
866
- foreground: ConstructorOf<ForegroundLayer>;
867
-
868
- /**
869
- * @defaultValue `SoundsLayer`
870
- */
871
- sounds: ConstructorOf<SoundsLayer>;
872
-
873
- /**
874
- * @defaultValue `LightingLayer`
875
- */
876
- lighting: ConstructorOf<LightingLayer>;
877
-
878
- /**
879
- * @defaultValue `SightLayer`
880
- */
881
- sight: ConstructorOf<SightLayer>;
882
-
883
- /**
884
- * @defaultValue `EffectsLayer`
885
- */
886
- effects: ConstructorOf<EffectsLayer>;
887
-
888
- /**
889
- * @defaultValue `ControlsLayer`
890
- */
891
- controls: ConstructorOf<ControlsLayer>;
892
- };
826
+ layers: CONFIG.Canvas.Layers;
893
827
 
894
828
  lightLevels: {
895
829
  /**
@@ -1977,6 +1911,86 @@ declare global {
1977
1911
  */
1978
1912
  webrtc: ConstructorOf<CameraViews>;
1979
1913
  }
1914
+
1915
+ namespace Canvas {
1916
+ interface Layers {
1917
+ /**
1918
+ * @defaultValue `BackgroundLayer`
1919
+ */
1920
+ background: ConstructorOf<BackgroundLayer>;
1921
+
1922
+ /**
1923
+ * @defaultValue `DrawingsLayer`
1924
+ */
1925
+ drawings: ConstructorOf<DrawingsLayer>;
1926
+
1927
+ /**
1928
+ * @defaultValue `GridLayer`
1929
+ */
1930
+ grid: ConstructorOf<GridLayer>;
1931
+
1932
+ /**
1933
+ * @defaultValue `WallsLayer`
1934
+ */
1935
+ walls: ConstructorOf<WallsLayer>;
1936
+
1937
+ /**
1938
+ * @defaultValue `TemplateLayer`
1939
+ */
1940
+ templates: ConstructorOf<TemplateLayer>;
1941
+
1942
+ /**
1943
+ * @defaultValue `NotesLayer`
1944
+ */
1945
+ notes: ConstructorOf<NotesLayer>;
1946
+
1947
+ /**
1948
+ * @defaultValue `TokenLayer`
1949
+ */
1950
+ tokens: ConstructorOf<TokenLayer>;
1951
+
1952
+ /**
1953
+ * @defaultValue `ForegroundLayer`
1954
+ */
1955
+ foreground: ConstructorOf<ForegroundLayer>;
1956
+
1957
+ /**
1958
+ * @defaultValue `SoundsLayer`
1959
+ */
1960
+ sounds: ConstructorOf<SoundsLayer>;
1961
+
1962
+ /**
1963
+ * @defaultValue `LightingLayer`
1964
+ */
1965
+ lighting: ConstructorOf<LightingLayer>;
1966
+
1967
+ /**
1968
+ * @defaultValue `SightLayer`
1969
+ */
1970
+ sight: ConstructorOf<SightLayer>;
1971
+
1972
+ /**
1973
+ * @defaultValue `EffectsLayer`
1974
+ */
1975
+ effects: ConstructorOf<EffectsLayer>;
1976
+
1977
+ /**
1978
+ * @defaultValue `ControlsLayer`
1979
+ */
1980
+ controls: ConstructorOf<ControlsLayer>;
1981
+
1982
+ [key: string]: ConstructorOf<CanvasLayer>;
1983
+ }
1984
+ }
1985
+
1986
+ interface SheetClass {
1987
+ id: string;
1988
+ cls: ConstructorOf<FormApplication>;
1989
+ label: string;
1990
+ default: boolean;
1991
+ }
1992
+
1993
+ type SheetClasses = Record<string, Record<string, SheetClass>>;
1980
1994
  }
1981
1995
 
1982
1996
  const CONFIG: CONFIG;
@@ -8,7 +8,7 @@
8
8
  * const dragDrop = new DragDrop({
9
9
  * dragSelector: ".item",
10
10
  * dropSelector: ".items",
11
- * permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) }
11
+ * permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) },
12
12
  * callbacks: { dragstart: this._onDragStart.bind(this), drop: this._onDragDrop.bind(this) }
13
13
  * });
14
14
  * dragDrop.bind(html);
@@ -17,9 +17,9 @@
17
17
  declare class DragDrop {
18
18
  /**
19
19
  * @param dragSelector - The CSS selector used to target draggable elements.
20
- * (default: `null`)
20
+ * (default: `undefined`)
21
21
  * @param dropSelector - The CSS selector used to target viable drop targets.
22
- * (default: `null`)
22
+ * (default: `undefined`)
23
23
  * @param permissions - An object of permission test functions for each action
24
24
  * (default: `{}`)
25
25
  * @param callbacks - An object of callback functions for each action
@@ -29,27 +29,27 @@ declare class DragDrop {
29
29
 
30
30
  /**
31
31
  * The HTML selector which identifies draggable elements
32
- * @defaultValue `null`
32
+ * @defaultValue `undefined`
33
33
  */
34
- dragSelector: string | null;
34
+ dragSelector: string | null | undefined;
35
35
 
36
36
  /**
37
37
  * The HTML selector which identifies drop targets
38
- * @defaultValue `null`
38
+ * @defaultValue `undefined`
39
39
  */
40
- dropSelector: string | null;
40
+ dropSelector: string | null | undefined;
41
41
 
42
42
  /**
43
43
  * A set of permission checking functions for each action of the Drag and Drop workflow
44
44
  * @defaultValue `{}`
45
45
  */
46
- permissions: Partial<Record<string, (selector: string | null) => boolean>>;
46
+ permissions: Partial<Record<DragDrop.Action, (selector: string | undefined) => boolean>>;
47
47
 
48
48
  /**
49
49
  * A set of callback functions for each action of the Drag and Drop workflow
50
50
  * @defaultValue `{}`
51
51
  */
52
- callbacks: Partial<Record<string, (event: DragEvent) => unknown>>;
52
+ callbacks: Partial<Record<DragDrop.Action, (event: DragEvent) => void>>;
53
53
 
54
54
  /**
55
55
  * Bind the DragDrop controller to an HTML application
@@ -62,7 +62,7 @@ declare class DragDrop {
62
62
  * @param event - The drag event being handled
63
63
  * @param action - The action being attempted
64
64
  */
65
- callback(event: DragEvent, action: string): unknown;
65
+ callback(event: DragEvent, action: DragDrop.Action): void;
66
66
 
67
67
  /**
68
68
  * Test whether the current user has permission to perform a step of the workflow
@@ -70,40 +70,41 @@ declare class DragDrop {
70
70
  * @param selector - The selector being targeted
71
71
  * @returns Can the action be performed?
72
72
  */
73
- can(action: string, selector: string | null): boolean;
73
+ can(action: DragDrop.Action, selector: string | undefined): boolean;
74
74
 
75
75
  /**
76
76
  * Handle the start of a drag workflow
77
77
  * @param event - The drag event being handled
78
+ * @internal
78
79
  */
79
80
  protected _handleDragStart(event: DragEvent): void;
80
81
 
81
82
  /**
82
83
  * Handle a dragged element over a droppable target
83
84
  * @param event - The drag event being handled
85
+ * @internal
84
86
  */
85
87
  protected _handleDragOver(event: DragEvent): false;
86
88
 
87
89
  /**
88
90
  * Handle a dragged element dropped on a droppable target
89
91
  * @param event - The drag event being handled
92
+ * @internal
90
93
  */
91
94
  protected _handleDrop(event: DragEvent): unknown;
92
95
 
93
- static createDragImage(img: HTMLImageElement, width: number, height: number): HTMLDivElement | HTMLElement;
96
+ static createDragImage(img: HTMLImageElement, width: number, height: number): HTMLDivElement;
94
97
  }
95
98
 
96
99
  declare namespace DragDrop {
97
100
  interface Options {
98
101
  /**
99
102
  * The CSS selector used to target draggable elements.
100
- * @defaultValue `null`
101
103
  */
102
104
  dragSelector?: DragDrop['dragSelector'];
103
105
 
104
106
  /**
105
107
  * The CSS selector used to target viable drop targets.
106
- * @defaultValue `null`
107
108
  */
108
109
  dropSelector?: DragDrop['dropSelector'];
109
110
 
@@ -119,4 +120,6 @@ declare namespace DragDrop {
119
120
  */
120
121
  callbacks?: DragDrop['callbacks'];
121
122
  }
123
+
124
+ type Action = 'dragstart' | 'dragover' | 'drop';
122
125
  }