@league-of-foundry-developers/foundry-vtt-types 0.8.9-7 → 0.8.9-8

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 (57) hide show
  1. package/index-lenient.d.ts +10 -0
  2. package/package.json +10 -1
  3. package/src/foundry/common/abstract/backend.mjs.d.ts +14 -15
  4. package/src/foundry/common/abstract/document.mjs.d.ts +6 -2
  5. package/src/foundry/common/types.mjs.d.ts +5 -0
  6. package/src/foundry/foundry.js/application.d.ts +2 -5
  7. package/src/foundry/foundry.js/applications/cameraViews.d.ts +36 -31
  8. package/src/foundry/foundry.js/applications/compendium.d.ts +5 -2
  9. package/src/foundry/foundry.js/applications/filePicker.d.ts +115 -115
  10. package/src/foundry/foundry.js/applications/formApplication.d.ts +1 -1
  11. package/src/foundry/foundry.js/applications/formApplications/combatTrackerConfig.d.ts +20 -27
  12. package/src/foundry/foundry.js/applications/formApplications/defaultTokenConfig.d.ts +66 -0
  13. package/src/foundry/foundry.js/applications/formApplications/documentSheets/activeEffectConfig.d.ts +2 -2
  14. package/src/foundry/foundry.js/applications/formApplications/documentSheets/actorSheet.d.ts +5 -2
  15. package/src/foundry/foundry.js/applications/formApplications/{folderConfig.d.ts → documentSheets/folderConfig.d.ts} +2 -2
  16. package/src/foundry/foundry.js/applications/formApplications/documentSheets/index.d.ts +3 -0
  17. package/src/foundry/foundry.js/applications/formApplications/documentSheets/measuredTemplateConfig.d.ts +60 -0
  18. package/src/foundry/foundry.js/applications/formApplications/documentSheets/noteConfig.d.ts +72 -0
  19. package/src/foundry/foundry.js/applications/formApplications/documentSheets/rollTableConfig.d.ts +190 -148
  20. package/src/foundry/foundry.js/applications/formApplications/documentSheets/sceneConfig.d.ts +133 -110
  21. package/src/foundry/foundry.js/applications/formApplications/drawingConfig.d.ts +93 -95
  22. package/src/foundry/foundry.js/applications/formApplications/entitySheetConfig.d.ts +163 -147
  23. package/src/foundry/foundry.js/applications/formApplications/index.d.ts +1 -3
  24. package/src/foundry/foundry.js/applications/formApplications/moduleManagement.d.ts +41 -23
  25. package/src/foundry/foundry.js/applications/formApplications/settingsConfig.d.ts +95 -86
  26. package/src/foundry/foundry.js/applications/formApplications/tokenConfig.d.ts +146 -158
  27. package/src/foundry/foundry.js/applications/formApplications/wallConfig.d.ts +60 -70
  28. package/src/foundry/foundry.js/applications/formApplications/worldConfig.d.ts +25 -17
  29. package/src/foundry/foundry.js/applications/hotbar.d.ts +5 -4
  30. package/src/foundry/foundry.js/applications/sceneNavigation.d.ts +90 -71
  31. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/actorDirectory.d.ts +13 -56
  32. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/itemDirectory.d.ts +7 -30
  33. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/journalDirectory.d.ts +14 -34
  34. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/macroDirectory.d.ts +6 -52
  35. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/sceneDirectory.d.ts +6 -23
  36. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectory.d.ts +2 -4
  37. package/src/foundry/foundry.js/cameraPopoutAppWrapper.d.ts +12 -7
  38. package/src/foundry/foundry.js/canvas.d.ts +2 -1
  39. package/src/foundry/foundry.js/clientDatabaseBackend.d.ts +210 -0
  40. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/tokenDocument.d.ts +1 -1
  41. package/src/foundry/foundry.js/clientDocuments/index.d.ts +1 -0
  42. package/src/foundry/foundry.js/clientDocuments/prototypeToken.d.ts +15 -0
  43. package/src/foundry/foundry.js/clientSettings.d.ts +14 -1
  44. package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +44 -11
  45. package/src/foundry/foundry.js/config.d.ts +12 -4
  46. package/src/foundry/foundry.js/dragDrop.d.ts +17 -14
  47. package/src/foundry/foundry.js/globalVariables.d.ts +7 -4
  48. package/src/foundry/foundry.js/mouseInteractionManager.d.ts +78 -34
  49. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayer.d.ts +5 -17
  50. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/wallsLayer.d.ts +1 -1
  51. package/src/foundry/foundry.js/pixi/containers/placeableObject.d.ts +4 -1
  52. package/src/foundry/foundry.js/pixi/containers/placeableObjects/wall.d.ts +1 -1
  53. package/src/foundry/foundry.js/pointSource.d.ts +173 -85
  54. package/src/foundry/foundry.js/textEditor.d.ts +39 -8
  55. package/src/foundry/index.d.ts +1 -0
  56. package/src/foundry/foundry.js/applications/formApplications/measuredTemplateConfig.d.ts +0 -61
  57. package/src/foundry/foundry.js/applications/formApplications/noteConfig.d.ts +0 -77
@@ -0,0 +1,10 @@
1
+ import './index';
2
+
3
+ declare global {
4
+ interface LenientGlobalVariableTypes {
5
+ canvas: never;
6
+ game: never;
7
+ socket: never;
8
+ ui: never;
9
+ }
10
+ }
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@league-of-foundry-developers/foundry-vtt-types",
3
- "version": "0.8.9-7",
3
+ "version": "0.8.9-8",
4
4
  "description": "TypeScript type definitions for Foundry VTT",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./index.d.ts"
8
+ },
9
+ "./lenient": {
10
+ "types": "./index-lenient.d.ts"
11
+ }
12
+ },
5
13
  "scripts": {
6
14
  "lint": "./node_modules/typescript/bin/tsc && eslint --ext .d.ts,.test-d.ts .",
7
15
  "lint:fix": "eslint --fix --ext .d.ts,.test-d.ts .",
@@ -60,6 +68,7 @@
60
68
  },
61
69
  "files": [
62
70
  "index.d.ts",
71
+ "index-lenient.d.ts",
63
72
  "src"
64
73
  ],
65
74
  "publishConfig": {
@@ -27,22 +27,28 @@ declare abstract class DatabaseBackend {
27
27
 
28
28
  /**
29
29
  * Get primary Document instances
30
+ * @remarks
31
+ * foundry actually declares this function to take parameters `documentClass`, `query`, `options`, and `user` but
32
+ * that's not how it is called and also not how the subclasses implement it.
33
+ * See https://gitlab.com/foundrynet/foundryvtt/-/issues/6177
30
34
  */
31
35
  protected abstract _getDocuments<T extends Document<any, any>>(
32
36
  documentClass: ConstructorOf<T>,
33
- query: Request,
34
- options: RequestOptions,
37
+ request: Request,
35
38
  user: BaseUser
36
39
  ): Promise<T[]>;
37
40
 
38
41
  /**
39
42
  * Get embedded Document instances
43
+ * @remarks
44
+ * foundry actually declares this function to take parameters `documentClass`, `parent`, `query`, `options`, and
45
+ * `user` but that's not how it is called and also not how the subclasses implement it.
46
+ * See https://gitlab.com/foundrynet/foundryvtt/-/issues/6177
40
47
  */
41
48
  protected abstract _getEmbeddedDocuments<T extends Document<any, any>>(
42
49
  documentClass: ConstructorOf<T>,
43
50
  parent: T extends Document<any, infer U> ? U : never,
44
- query: Request,
45
- options: RequestOptions,
51
+ request: Request,
46
52
  user: BaseUser
47
53
  ): Promise<T[]>;
48
54
 
@@ -198,7 +204,8 @@ declare abstract class DatabaseBackend {
198
204
  * @param action - The action performed
199
205
  * @param type - The document type
200
206
  * @param documents - The documents modified
201
- * @param info - The logging level
207
+ * @param level - The logging level
208
+ * (default: `'info'`)
202
209
  * @param parent - A parent document
203
210
  * @param pack - A compendium pack within which the operation occurred
204
211
  */
@@ -225,24 +232,16 @@ declare abstract class DatabaseBackend {
225
232
  protected _logContext({ parent, pack }?: { parent?: Document<any, any>; pack?: string }): string;
226
233
  }
227
234
 
228
- interface Request {
235
+ export interface Request {
229
236
  data?: AnyDocumentData[];
230
237
  updates?: AnyDocumentData[];
231
238
  ids?: string[];
232
239
  parent?: Document<any, any>;
233
- query?: object | IdQuery | SceneIdUserQuery;
240
+ query?: Record<string, unknown>;
234
241
  options?: RequestOptions;
235
242
  pack?: string;
236
243
  }
237
244
 
238
- export interface IdQuery {
239
- _id: string;
240
- }
241
- export interface SceneIdUserQuery {
242
- sceneId: string;
243
- user: string;
244
- }
245
-
246
245
  export interface RequestOptions {
247
246
  index?: boolean;
248
247
  broadcast?: boolean;
@@ -1,5 +1,4 @@
1
1
  import { BaseUser } from '../documents.mjs';
2
- import DatabaseBackend from './backend.mjs';
3
2
  import { AnyDocumentData } from './data.mjs';
4
3
  import {
5
4
  ConfiguredDocumentClass,
@@ -82,7 +81,7 @@ declare abstract class Document<
82
81
  /**
83
82
  * The database backend used to execute operations and handle results
84
83
  */
85
- static get database(): DatabaseBackend; // TODO: Reference type defined in CONFIG
84
+ static get database(): CONFIG['DatabaseBackend'];
86
85
 
87
86
  /**
88
87
  * Return a reference to the implemented subclass of this base document type.
@@ -703,6 +702,11 @@ export interface DocumentModificationOptions {
703
702
  */
704
703
  index?: boolean;
705
704
 
705
+ /**
706
+ * An array of fields to retrieve when indexing the collection
707
+ */
708
+ indexFields?: string[];
709
+
706
710
  /**
707
711
  * When performing a creation operation, keep the provided _id instead of clearing it.
708
712
  * @defaultValue `false`
@@ -84,4 +84,9 @@ interface SocketResponse {
84
84
  * Data returned as a result of the request
85
85
  */
86
86
  data?: RequestData;
87
+
88
+ /**
89
+ * An Array of created data objects
90
+ */
91
+ result?: object[];
87
92
  }
@@ -312,12 +312,9 @@ declare abstract class Application<Options extends Application.Options = Applica
312
312
  * Callback actions which occur when a dragged element is dropped on a target.
313
313
  * @param event - The originating DragEvent
314
314
  * (unused)
315
- * @remarks
316
- * The implementation in {@link Application} actually returns `void` but it is
317
- * typed as `unknown` to allow deriving methods to return whatever they want.
318
- * The returned value is not meant to be used.
315
+ * @internal
319
316
  */
320
- protected _onDrop(event: DragEvent): unknown;
317
+ protected _onDrop(event: DragEvent): void;
321
318
 
322
319
  /**
323
320
  * Bring the application to the top of the rendering stack
@@ -1,30 +1,24 @@
1
- // TODO: Remove when updating this class!!!
2
- // eslint-disable-next-line
3
- // @ts-nocheck
4
-
5
1
  /**
6
2
  * The Camera UI View that displays all the camera feeds as individual video elements.
7
- * @typeParam P - the type of the options object
3
+ * @typeParam Options - the type of the options object
4
+ * @typeParam Data - The data structure used to render the handlebars template.
8
5
  */
9
- declare class CameraViews<P extends Application.Options = Application.Options> extends Application<P> {
10
- /**
11
- * @param webrtc - The WebRTC Implementation to display
12
- * (unused)
13
- */
14
- constructor(webrtc?: any, options?: Partial<P>);
15
-
6
+ declare class CameraViews<
7
+ Options extends Application.Options = Application.Options,
8
+ Data extends object = CameraViews.Data
9
+ > extends Application<Options> {
16
10
  /**
17
11
  * @override
18
12
  * @defaultValue
19
13
  * ```typescript
20
- * mergeObject(super.defaultOptions, {
14
+ * return foundry.utils.mergeObject(super.defaultOptions, {
21
15
  * id: "camera-views",
22
16
  * template: "templates/hud/camera-views.html",
23
- * popOut: false
24
- * });
17
+ * popOut: false,
18
+ * })
25
19
  * ```
26
20
  */
27
- static get defaultOptions(): typeof Application['defaultOptions'];
21
+ static get defaultOptions(): Application.Options;
28
22
 
29
23
  /**
30
24
  * A reference to the master AV orchestrator instance
@@ -56,26 +50,29 @@ declare class CameraViews<P extends Application.Options = Application.Options> e
56
50
  * Extend the render logic to first check whether a render is necessary based on the context
57
51
  * If a specific context was provided, make sure an update to the navigation is necessary before rendering
58
52
  */
59
- render(force?: boolean, context?: Application.RenderOptions<P>): Application['render'];
53
+ render(force?: boolean, context?: Application.RenderOptions<Options>): this | void;
60
54
 
61
55
  /** @override */
62
- protected _render(force?: boolean, options?: Application.RenderOptions<P>): Promise<void>;
56
+ protected _render(force?: boolean, options?: Application.RenderOptions<Options>): Promise<void>;
63
57
 
64
58
  /**
65
59
  * @param options - (unused)
66
60
  * @override
67
61
  */
68
- getData(options?: Partial<P>): CameraViews.Data;
62
+ getData(options?: Partial<Options>): Data | Promise<Data>;
69
63
 
70
- maxZ: number;
64
+ /** @defaultValue `undefined` */
65
+ maxZ?: number;
71
66
 
72
67
  /**
73
68
  * Prepare rendering data for a single user
69
+ * @internal
74
70
  */
75
71
  protected _getDataForUser(userId: string, settings: AVSettings.UserSettings): CameraViews.Data.User | null;
76
72
 
77
73
  /**
78
74
  * A custom sorting function that orders/arranges the user display frames
75
+ * @internal
79
76
  */
80
77
  protected static _sortUsers(a: CameraViews.Data.User, b: CameraViews.Data.User): number;
81
78
 
@@ -85,30 +82,35 @@ declare class CameraViews<P extends Application.Options = Application.Options> e
85
82
  /**
86
83
  * On hover in a camera container, show/hide the controls.
87
84
  * @param event - The original mouseover or mouseout hover event
85
+ * @internal
88
86
  */
89
87
  protected _onCameraViewHover(event: JQuery.MouseEnterEvent | JQuery.MouseLeaveEvent): void;
90
88
 
91
89
  /**
92
90
  * On clicking on a toggle, disable/enable the audio or video stream.
93
91
  * @param event - The originating click event
92
+ * @internal
94
93
  */
95
94
  protected _onClickControl(event: JQuery.ClickEvent): Promise<void>;
96
95
 
97
96
  /**
98
97
  * Change volume control for a stream
99
98
  * @param event - The originating change event from interaction with the range input
99
+ * @internal
100
100
  */
101
101
  protected _onVolumeChange(event: JQuery.ChangeEvent): void;
102
102
 
103
103
  /**
104
104
  * Dynamically refresh the state of a single camera view
105
105
  * @param view - The view container div
106
+ * @internal
106
107
  */
107
108
  protected _refreshView(view: HTMLElement): void;
108
109
 
109
110
  /**
110
111
  * Render changes needed to the PlayerList ui.
111
112
  * Show/Hide players depending on option.
113
+ * @internal
112
114
  */
113
115
  protected _setPlayerListVisibility(): void;
114
116
 
@@ -119,8 +121,9 @@ declare class CameraViews<P extends Application.Options = Application.Options> e
119
121
  * @param action - The named av-control button action
120
122
  * @param state - The CURRENT action state.
121
123
  * @returns The icon that represents the NEXT action state.
124
+ * @internal
122
125
  */
123
- protected _getToggleIcon(action: string, state?: boolean): null;
126
+ protected _getToggleIcon(action: string, state: boolean): string | null;
124
127
 
125
128
  /**
126
129
  * Get the text title that should be used for various action buttons with different toggled states.
@@ -129,6 +132,7 @@ declare class CameraViews<P extends Application.Options = Application.Options> e
129
132
  * @param action - The named av-control button action
130
133
  * @param state - The CURRENT action state.
131
134
  * @returns The icon that represents the NEXT action state.
135
+ * @internal
132
136
  */
133
137
  protected _getToggleTooltip(action: string, state: boolean): string;
134
138
 
@@ -142,6 +146,7 @@ declare class CameraViews<P extends Application.Options = Application.Options> e
142
146
  * @param show - Whether to show or hide the controls
143
147
  * @param selector - Override selector to specify which controls to show or hide
144
148
  * (default: `'.control-bar'`)
149
+ * @internal
145
150
  */
146
151
  protected _toggleControlVisibility(container: HTMLElement, show: boolean, selector?: string): void;
147
152
  }
@@ -149,24 +154,24 @@ declare class CameraViews<P extends Application.Options = Application.Options> e
149
154
  declare namespace CameraViews {
150
155
  interface Data {
151
156
  self: Game['user'];
152
- users: CameraViews.Data.User[];
157
+ users: Data.User[];
153
158
  dockClass: string;
154
159
  muteAll: boolean;
155
160
  }
156
161
 
157
162
  namespace Data {
158
163
  interface User {
159
- user: globalThis.User;
160
- id: globalThis.User['id'];
161
- local: globalThis.User['isSelf'];
162
- name: globalThis.User['name'];
163
- color: globalThis.User['data']['color'];
164
- colorAlpha: ReturnType<typeof foundry.utils.hexToRGBAString>;
164
+ user: StoredDocument<globalThis.User>;
165
+ id: StoredDocument<globalThis.User>['id'];
166
+ local: StoredDocument<globalThis.User>['isSelf'];
167
+ name: StoredDocument<globalThis.User>['name'];
168
+ color: StoredDocument<globalThis.User>['data']['color'];
169
+ colorAlpha: `rgba(${number}, ${number}, ${number})`;
165
170
  charname: string;
166
- avatar: globalThis.User['avatar'];
171
+ avatar: StoredDocument<globalThis.User>['avatar'];
167
172
  settings: AVSettings.UserSettings;
168
- volume: ReturnType<typeof AudioHelper['volumeToInput']>;
169
- cameraViewClass: ReturnType<Array<string>['filterJoin']>;
173
+ volume: number;
174
+ cameraViewClass: string;
170
175
  }
171
176
  }
172
177
  }
@@ -67,8 +67,11 @@ declare class Compendium<
67
67
  /** @override */
68
68
  protected _onDragStart(event: DragEvent): void;
69
69
 
70
- /** @override */
71
- protected _onDrop(event: DragEvent): ReturnType<this['collection']['importDocument']> | false;
70
+ /**
71
+ * @override
72
+ * @internal
73
+ */
74
+ protected _onDrop(event: DragEvent): void;
72
75
 
73
76
  /**
74
77
  * Render the ContextMenu which applies to each compendium Document