@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
@@ -1,154 +1,170 @@
1
- // TODO: Remove when updating this class!!!
2
- // eslint-disable-next-line
3
- // @ts-nocheck
4
-
5
- /**
6
- * Entity Sheet Configuration Application
7
- * @typeParam P - the type of the options object
8
- * @typeParam E - the type of the Entity, this sheet is used to configure
9
- */
10
- declare class EntitySheetConfig<
11
- P extends FormApplication.Options = FormApplication.Options,
12
- E extends Entity = Entity
13
- > extends FormApplication<P, EntitySheetConfig.Data, E> {
14
- /**
15
- * @param entity - The Entity object for which the sheet is being configured
16
- * @param options - Additional Application options
17
- */
18
- constructor(entity: E, options?: Partial<P>);
19
-
20
- /**
21
- * @defaultValue
22
- * ```typescript
23
- * const options = super.defaultOptions;
24
- * options.id = "sheet-config";
25
- * options.template = "templates/sheets/sheet-config.html";
26
- * options.width = 400;
27
- * ```
28
- */
29
- static get defaultOptions(): typeof FormApplication['defaultOptions'];
30
-
31
- /**
32
- * Add the Entity name into the window title
33
- */
34
- get title(): string;
35
-
36
- /**
37
- * Construct and return the data object used to render the HTML template for this form application.
38
- * @param options - (unused)
39
- */
40
- getData(options?: Partial<P>): EntitySheetConfig.Data<E>;
41
-
42
- /**
43
- * This method is called upon form submission after form data is validated
44
- * @param event - The initial triggering submission event
45
- * @param formData - The object of validated form data with which to update the object
46
- */
47
- protected _updateObject(event: Event, formData: EntitySheetConfig.FormData): Promise<void>;
1
+ import type { DocumentConstructor } from '../../../../types/helperTypes';
48
2
 
3
+ declare global {
49
4
  /**
50
- * Initialize the configured Sheet preferences for Entities which support dynamic Sheet assignment
51
- * Create the configuration structure for supported entities
52
- * Process any pending sheet registrations
53
- * Update the default values from settings data
5
+ * Entity Sheet Configuration Application
6
+ * @typeParam Options - The type of the options object
7
+ * @typeParam Data - The data structure used to render the handlebars template.
8
+ * @typeParam ConcreteDocument - The type of the Document which is being managed
54
9
  */
55
- static initializeSheets(): void;
56
-
57
- /**
58
- * Register a sheet class as a candidate which can be used to display entities of a given type
59
- * @param entityClass - The Entity for which to register a new Sheet option
60
- * @param scope - Provide a unique namespace scope for this sheet
61
- * @param sheetClass - A defined Application class used to render the sheet
62
- * @param label - A human readable label for the sheet name, which will be localized
63
- * @param types - An array of entity types for which this sheet should be used
64
- * (default: `[]`)
65
- * @param makeDefault - Whether to make this sheet the default for provided types
66
- * (default: `false`)
67
- */
68
- static registerSheet(
69
- entityClass: ConstructorOf<Entity>,
70
- scope: string,
71
- sheetClass: ConstructorOf<FormApplication>,
72
- { label, types, makeDefault }?: { label?: string; types?: string[]; makeDefault?: boolean }
73
- ): void;
74
-
75
- protected static _registerSheet({
76
- entityClass,
77
- id,
78
- label,
79
- sheetClass,
80
- types,
81
- makeDefault
82
- }: Exclude<EntitySheetConfig.Config, 'action'>): void;
83
-
84
- /**
85
- * Unregister a sheet class, removing it from the list of available Applications to use for an Entity type
86
- * @param entityClass - The Entity for which to register a new Sheet option
87
- * @param scope - Provide a unique namespace scope for this sheet
88
- * @param sheetClass - A defined Application class used to render the sheet
89
- * @param types - An Array of types for which this sheet should be removed
90
- */
91
- static unregisterSheet(
92
- entityClass: ConstructorOf<Entity>,
93
- scope: string,
94
- sheetClass: ConstructorOf<FormApplication>,
95
- { types }?: { types?: string[] }
96
- ): void;
97
-
98
- protected static _unregisterSheet({
99
- entityClass,
100
- id,
101
- types
102
- }: Pick<EntitySheetConfig.Config, 'entityClass' | 'id' | 'types'>): void;
103
-
104
- /**
105
- * @typeParam T - the string array, passed as the types parameter
106
- */
107
- protected static _getEntityTypes<T extends string[]>(entityClass: any, types: T): T;
108
- protected static _getEntityTypes(entityClass: ConstructorOf<Entity>): string[];
109
-
110
- /**
111
- * Update the currently default Sheets using a new core world setting
112
- */
113
- protected static _updateDefaultSheets(setting?: Record<'Actor' | 'Item', Record<string, string>>): void;
114
-
115
- protected _pending: EntitySheetConfig.Config[];
116
- }
117
-
118
- declare namespace EntitySheetConfig {
119
- interface Config {
120
- action: 'register' | 'unregister';
121
- entityClass: ConstructorOf<Entity>;
122
- id: string;
123
- label: string;
124
- sheetClass: ConstructorOf<FormApplication>;
125
- types: string[];
126
- makeDefault: boolean;
127
- }
128
-
129
- /**
130
- * @typeParam P - the type of the options object
131
- * @typeParam E - the type of the entity
132
- */
133
- interface Data<E extends Entity = Entity, P extends FormApplication.Options = FormApplication.Options> {
134
- entityName: EntitySheetConfig<P, E>['object']['entity'];
135
- isGM: User['isGM'];
136
- object: foundry.utils.Duplicated<EntitySheetConfig<P, E>['object']['data']>;
137
- options: EntitySheetConfig<P, E>['options'];
138
- sheetClass: ReturnType<E['getFlag']> | '';
139
- sheetClasses: Record<SheetClass['id'], SheetClass['label']>;
140
- defaultClass: SheetClass['id'] | null;
141
- blankLabel: ReturnType<Localization['localize']>;
10
+ class EntitySheetConfig<
11
+ Options extends FormApplication.Options = FormApplication.Options,
12
+ Data extends object = EntitySheetConfig.Data<foundry.abstract.Document<any, any>, Options>,
13
+ ConcreteDocument extends foundry.abstract.Document<any, any> = Data extends EntitySheetConfig.Data<infer T>
14
+ ? T
15
+ : foundry.abstract.Document<any, any>
16
+ > extends FormApplication<Options, Data, ConcreteDocument> {
17
+ /**
18
+ * @defaultValue
19
+ * ```typescript
20
+ * foundry.utils.mergeObject(super.defaultOptions, {
21
+ * id: "sheet-config",
22
+ * template: "templates/sheets/sheet-config.html",
23
+ * width: 400,
24
+ * })
25
+ * ```
26
+ */
27
+ static get defaultOptions(): FormApplication.Options;
28
+
29
+ /**
30
+ * An array of pending sheet assignments which are submitted before other elements of the framework are ready.
31
+ * @internal
32
+ */
33
+ static _pending: Array<EntitySheetConfig.SheetAssignment>;
34
+
35
+ /** @override */
36
+ get title(): string;
37
+
38
+ /** @override */
39
+ getData(options?: Partial<Options>): Data | Promise<Data>;
40
+
41
+ /** @override */
42
+ protected _updateObject(event: Event, formData: EntitySheetConfig.FormData): Promise<void>;
43
+
44
+ /**
45
+ * Initialize the configured Sheet preferences for Entities which support dynamic Sheet assignment
46
+ * Create the configuration structure for supported entities
47
+ * Process any pending sheet registrations
48
+ * Update the default values from settings data
49
+ */
50
+ static initializeSheets(): void;
51
+
52
+ /**
53
+ * @internal
54
+ */
55
+ protected static _getDocumentTypes(cls: DocumentConstructor, types?: string[]): string[];
56
+
57
+ /**
58
+ * Register a sheet class as a candidate which can be used to display entities of a given type
59
+ * @param documentClass - The Document class for which to register a new Sheet option
60
+ * @param scope - Provide a unique namespace scope for this sheet
61
+ * @param sheetClass - A defined Application class used to render the sheet
62
+ * @param options - Additional options used for sheet registration
63
+ */
64
+ static registerSheet(
65
+ documentClass: DocumentConstructor,
66
+ scope: string,
67
+ sheetClass: ConstructorOf<Application>,
68
+ { label, types, makeDefault }?: EntitySheetConfig.RegisterSheetOptions
69
+ ): void;
70
+
71
+ /**
72
+ * Perform the sheet registration
73
+ * @internal
74
+ */
75
+ protected static _registerSheet({
76
+ documentClass,
77
+ id,
78
+ label,
79
+ sheetClass,
80
+ types,
81
+ makeDefault
82
+ }: Omit<EntitySheetConfig.SheetRegistration, 'action'>): void;
83
+
84
+ /**
85
+ * Unregister a sheet class, removing it from the list of available Applications to use for a Document type
86
+ * @param documentClass - The Document class for which to register a new Sheet option
87
+ * @param scope - Provide a unique namespace scope for this sheet
88
+ * @param sheetClass - A defined Application class used to render the sheet
89
+ * @param types - An Array of types for which this sheet should be removed
90
+ */
91
+ static unregisterSheet(
92
+ documentClass: DocumentConstructor,
93
+ scope: string,
94
+ sheetClass: ConstructorOf<Application>,
95
+ { types }?: { types?: string[] }
96
+ ): void;
97
+
98
+ /**
99
+ * Perform the sheet de-registration
100
+ * @internal
101
+ */
102
+ protected static _unregisterSheet({
103
+ documentClass,
104
+ id,
105
+ types
106
+ }: Omit<EntitySheetConfig.SheetUnregistration, 'action'>): void;
107
+
108
+ /**
109
+ * Update the currently default Sheets using a new core world setting
110
+ */
111
+ static updateDefaultSheets(setting?: Record<'Actor' | 'Item', Record<string, string>>): void;
142
112
  }
143
113
 
144
- type FormData = Pick<Data, 'defaultClass' | 'sheetClass'>;
145
-
146
- interface SheetClass {
147
- id: string | number;
148
- cls?: ConstructorOf<FormApplication>;
149
- label: string;
150
- default: boolean;
114
+ namespace EntitySheetConfig {
115
+ type SheetRegistration = {
116
+ action: 'register';
117
+ documentClass: DocumentConstructor;
118
+ id: string;
119
+ label: string;
120
+ sheetClass: ConstructorOf<Application>;
121
+ types: string[];
122
+ makeDefault: boolean;
123
+ };
124
+
125
+ type SheetUnregistration = {
126
+ action: 'unregister';
127
+ documentClass: DocumentConstructor;
128
+ id: string;
129
+ types: string[];
130
+ };
131
+
132
+ type SheetAssignment = SheetRegistration | SheetUnregistration;
133
+
134
+ /**
135
+ * @typeParam ConcreteDocument - The type of the Document which is being managed
136
+ * @typeParam Options - The type of the options object
137
+ */
138
+ interface Data<
139
+ ConcreteDocument extends foundry.abstract.Document<any, any>,
140
+ Options extends FormApplication.Options = FormApplication.Options
141
+ > {
142
+ isGM: boolean;
143
+ object: foundry.utils.Duplicated<ConcreteDocument['data']>;
144
+ options: Options;
145
+ sheetClass: string;
146
+ sheetClasses: Record<string, string>;
147
+ defaultClass: string;
148
+ blankLabel: string;
149
+ }
150
+
151
+ interface FormData {
152
+ defaultClass: string;
153
+ sheetClass: string;
154
+ }
155
+
156
+ interface RegisterSheetOptions {
157
+ /** A human readable label for the sheet name, which will be localized */
158
+ label?: string;
159
+
160
+ /** An array of entity types for which this sheet should be used */
161
+ types?: string[];
162
+
163
+ /**
164
+ * Whether to make this sheet the default for provided types
165
+ * @defaultValue `false`
166
+ */
167
+ makeDefault?: boolean;
168
+ }
151
169
  }
152
-
153
- type SheetClasses = Record<string, Record<string, SheetClass>>;
154
170
  }
@@ -1,15 +1,13 @@
1
1
  import './avConfig';
2
2
  import './combatTrackerConfig';
3
+ import './defaultTokenConfig';
3
4
  import './documentSheet';
4
5
  import './documentSheets';
5
6
  import './drawingConfig';
6
7
  import './entitySheetConfig';
7
- import './folderConfig';
8
8
  import './gridConfig';
9
9
  import './imagePopout';
10
- import './measuredTemplateConfig';
11
10
  import './moduleManagement';
12
- import './noteConfig';
13
11
  import './permissionConfig';
14
12
  import './settingsConfig';
15
13
  import './tokenConfig';
@@ -1,27 +1,37 @@
1
- // TODO: Remove when updating this class!!!
2
- // eslint-disable-next-line
3
- // @ts-nocheck
4
-
5
1
  /**
6
2
  * The Module Management Application.
7
3
  * This application provides a view of which modules are available to be used and allows for configuration of the
8
4
  * set of modules which are active within the World.
5
+ * @typeParam Options - The type of the options object
6
+ * @typeParam Data - The data structure used to render the handlebars template.
9
7
  */
10
- declare class ModuleManagement extends FormApplication<FormApplication.Options, ModuleManagement.Data, any> {
8
+
9
+ declare class ModuleManagement<
10
+ Options extends FormApplication.Options = FormApplication.Options,
11
+ Data extends object = ModuleManagement.Data
12
+ > extends FormApplication<Options, Data, undefined> {
11
13
  /**
12
14
  * @defaultValue `'all'`
15
+ * @internal
13
16
  */
14
17
  protected _filter: ModuleManagement.FilterName;
15
18
 
16
19
  /**
17
20
  * @defaultValue `false`
21
+ * @internal
18
22
  */
19
23
  protected _expanded: boolean;
20
24
 
21
25
  /**
22
26
  * @defaultValue `{}`
27
+ * @internal
23
28
  */
24
- protected _checked: Partial<Record<string, boolean>>;
29
+ protected _checked: Record<string, boolean>;
30
+
31
+ /**
32
+ * The named game setting which persists module configuration.
33
+ */
34
+ static CONFIG_SETTING: 'moduleConfiguration';
25
35
 
26
36
  /**
27
37
  * @override
@@ -40,57 +50,63 @@ declare class ModuleManagement extends FormApplication<FormApplication.Options,
40
50
  * });
41
51
  * ```
42
52
  */
43
- static get defaultOptions(): typeof FormApplication['defaultOptions'];
53
+ static get defaultOptions(): FormApplication.Options;
44
54
 
45
55
  /** @override */
46
56
  get isEditable(): boolean;
47
57
 
48
58
  /** @override */
49
- getData(options?: Partial<FormApplication.Options>): ModuleManagement.Data;
59
+ getData(options?: Partial<Options>): Data | Promise<Data>;
50
60
 
51
61
  /** @override */
52
62
  activateListeners(html: JQuery): void;
53
63
 
54
64
  /**
55
- * @param event - (unused)
56
65
  * @override
66
+ * @param event - (unused)
57
67
  */
58
- // TODO: type return value when the class' config setting is typed
59
- protected _updateObject(event: Event, formData: ModuleManagement.FormData): Promise<unknown>;
68
+ protected _updateObject(event: Event, formData: ModuleManagement.FormData): Promise<Record<string, boolean>>;
69
+
70
+ /**
71
+ * Restores the Form UI to the internal checked state
72
+ * @internal
73
+ */
74
+ protected _restoreCheckboxState(): void;
60
75
 
61
76
  /**
62
77
  * Handle changes to a module checkbox to prompt for whether or not to enable dependencies
78
+ * @internal
63
79
  */
64
- protected _onChangeCheckbox(event: JQuery.ChangeEvent): void;
80
+ protected _onChangeCheckbox(event: JQuery.ChangeEvent): unknown;
65
81
 
66
82
  /**
67
83
  * Handle a button-click to deactivate all modules
84
+ * @internal
68
85
  */
69
86
  protected _onDeactivateAll(event: JQuery.ClickEvent): void;
70
87
 
71
88
  /**
72
89
  * Handle expanding or collapsing the display of descriptive elements
90
+ * @internal
73
91
  */
74
92
  protected _onExpandCollapse(event: JQuery.ClickEvent): void;
75
93
 
76
94
  /**
77
95
  * Handle a button-click to deactivate all modules
96
+ * @internal
78
97
  */
79
98
  protected _onFilterList(event: JQuery.ClickEvent): void;
80
99
 
81
100
  /** @override */
82
101
  protected _onSearchFilter(event: KeyboardEvent, query: string, rgx: RegExp, html: HTMLElement): void;
83
-
84
- static readonly CONFIG_SETTING: 'moduleConfiguration';
85
102
  }
86
103
 
87
104
  declare namespace ModuleManagement {
88
105
  interface Data {
89
- editable: ModuleManagement['isEditable'];
106
+ editable: boolean;
90
107
  filters: [Data.Filter<'all'>, Data.Filter<'active'>, Data.Filter<'inactive'>];
91
108
  modules: Data.Module[];
92
- query: undefined; // TODO: this seems to reference an undefined value (`this._query`)
93
- expanded: ModuleManagement['_expanded'];
109
+ expanded: boolean;
94
110
  }
95
111
 
96
112
  namespace Data {
@@ -101,23 +117,25 @@ declare namespace ModuleManagement {
101
117
  count: number;
102
118
  }
103
119
 
104
- interface Module extends foundry.utils.Duplicated<Game.Module> {
120
+ type Module = foundry.packages.ModuleData['_source'] & {
105
121
  active: boolean;
122
+ availability: number;
123
+ data: foundry.packages.ModuleData;
106
124
  css: ' active' | '';
107
125
  hasPacks: boolean;
108
126
  hasScripts: boolean;
109
127
  hasStyles: boolean;
110
128
  systemOnly: boolean;
111
129
  systemTag: Game['system']['id'];
112
- incompatible: any; // TODO
113
- unavailable: any; // TODO
114
130
  dependencies: string[] | null;
115
- }
131
+ unavailable?: string;
132
+ incompatible?: string;
133
+ };
116
134
  }
117
135
 
118
136
  type FilterName = 'all' | 'active' | 'inactive';
119
137
 
120
- interface FormData {
138
+ type FormData = Record<string, boolean> & {
121
139
  search: string;
122
- }
140
+ };
123
141
  }