@league-of-foundry-developers/foundry-vtt-types 9.249.4 → 9.255.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/foundry/common/constants.mjs.d.ts +1 -0
- package/src/foundry/common/documents.mjs/baseMacro.d.ts +0 -3
- package/src/foundry/common/documents.mjs/baseMeasuredTemplate.d.ts +8 -1
- package/src/foundry/common/packages.mjs/packageCompendiumData.d.ts +7 -1
- package/src/foundry/common/utils/helpers.mjs.d.ts +0 -1
- package/src/foundry/common/utils/primitives.mjs.d.ts +2 -2
- package/src/foundry/foundry.js/applications/notifications.d.ts +2 -5
- package/src/foundry/foundry.js/canvas.d.ts +0 -8
- package/src/foundry/foundry.js/clientDatabaseBackend.d.ts +6 -0
- package/src/foundry/foundry.js/clientDocuments/cards.d.ts +2 -1
- package/src/foundry/foundry.js/clientSettings.d.ts +250 -229
- package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +3 -1
- package/src/foundry/foundry.js/config.d.ts +3 -0
- package/src/foundry/foundry.js/game.d.ts +1 -1
- package/src/foundry/foundry.js/pixi/polygons/pointSourcePolygon.d.ts +4 -2
- package/src/foundry/foundry.js/pixi/polygons/pointSourcePolygons/clockwiseSweepPolygon.d.ts +31 -17
- package/src/foundry/foundry.js/rollTerms/diceTerms/die.d.ts +0 -5
- package/src/foundry/foundry.js/rollTerms/diceTerms/fateDie.d.ts +21 -1
- package/src/foundry/foundry.js/videoHelper.d.ts +0 -7
- package/src/types/helperTypes.d.ts +6 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@league-of-foundry-developers/foundry-vtt-types",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.255.0",
|
4
4
|
"description": "TypeScript type definitions for Foundry VTT",
|
5
5
|
"exports": {
|
6
6
|
".": {
|
@@ -74,7 +74,7 @@
|
|
74
74
|
"lint-staged": "^12.1.2",
|
75
75
|
"prettier": "^2.5.1",
|
76
76
|
"tsd": "^0.19.1",
|
77
|
-
"typescript": "~4.
|
77
|
+
"typescript": "~4.6.2"
|
78
78
|
},
|
79
79
|
"husky": {
|
80
80
|
"hooks": {
|
@@ -16,9 +16,6 @@ type MacroMetadata = Merge<
|
|
16
16
|
types: [typeof CONST.MACRO_TYPES.SCRIPT, typeof CONST.MACRO_TYPES.CHAT];
|
17
17
|
permissions: {
|
18
18
|
create: 'PLAYER';
|
19
|
-
// TODO: fix when fixed by foundry (https://gitlab.com/foundrynet/foundryvtt/-/issues/6694)
|
20
|
-
// update: undefined;
|
21
|
-
// delete: undefined;
|
22
19
|
};
|
23
20
|
}
|
24
21
|
>;
|
@@ -15,7 +15,7 @@ type MeasuredTemplateMetadata = Merge<
|
|
15
15
|
labelPlural: 'DOCUMENT.MeasuredTemplates';
|
16
16
|
isEmbedded: true;
|
17
17
|
permissions: {
|
18
|
-
create:
|
18
|
+
create: (user: BaseUser, doc: BaseMeasuredTemplate) => boolean;
|
19
19
|
update: (
|
20
20
|
user: BaseUser,
|
21
21
|
doc: BaseMeasuredTemplate,
|
@@ -51,6 +51,13 @@ export declare class BaseMeasuredTemplate extends Document<
|
|
51
51
|
{ exact }?: { exact?: boolean }
|
52
52
|
): boolean;
|
53
53
|
|
54
|
+
/**
|
55
|
+
* Is a user able to create a new MeasuredTemplate?
|
56
|
+
* @param user - The user attempting the creation operation.
|
57
|
+
* @param doc - The MeasuredTemplate being created.
|
58
|
+
*/
|
59
|
+
protected static _canCreate(user: BaseUser, doc: BaseMeasuredTemplate): boolean;
|
60
|
+
|
54
61
|
/**
|
55
62
|
* Is a user able to modify an existing MeasuredTemplate?
|
56
63
|
*/
|
@@ -3,7 +3,13 @@ import { DocumentData } from '../abstract/module.mjs';
|
|
3
3
|
import * as fields from '../data/fields.mjs';
|
4
4
|
|
5
5
|
interface PackageCompendiumDataSchema extends DocumentSchema {
|
6
|
-
name:
|
6
|
+
name: FieldReturnType<
|
7
|
+
fields.RequiredString,
|
8
|
+
{
|
9
|
+
validate: (v: string) => boolean;
|
10
|
+
validationError: "Invalid compendium name '{value}'. Compendium names cannot contain dots.";
|
11
|
+
}
|
12
|
+
>;
|
7
13
|
label: fields.RequiredString;
|
8
14
|
path: fields.RequiredString;
|
9
15
|
private: FieldReturnType<fields.BooleanField, { default: false }>;
|
@@ -441,7 +441,6 @@ export declare function setProperty(object: object, key: string, value: any): bo
|
|
441
441
|
|
442
442
|
/**
|
443
443
|
* Express a timestamp as a relative string
|
444
|
-
* TODO - figure out a way to localize this
|
445
444
|
* @param timeStamp - A timestamp string or Date object to be formatted as a relative time
|
446
445
|
* @returns A string expression for the relative time
|
447
446
|
*/
|
@@ -201,10 +201,10 @@ interface NumberConstructor {
|
|
201
201
|
|
202
202
|
/**
|
203
203
|
* Attempt to create a number from a user-provided string.
|
204
|
-
* @param
|
204
|
+
* @param n - The value to convert; typically a string, but may already be a number.
|
205
205
|
* @returns The number that the string represents, or NaN if no number could be determined.
|
206
206
|
*/
|
207
|
-
fromString(str: string): number;
|
207
|
+
fromString(str: string | number): number;
|
208
208
|
}
|
209
209
|
|
210
210
|
interface ArrayConstructor {
|
@@ -46,11 +46,8 @@ declare class Notifications<Options extends ApplicationOptions = ApplicationOpti
|
|
46
46
|
*/
|
47
47
|
initialize(): void;
|
48
48
|
|
49
|
-
/**
|
50
|
-
|
51
|
-
* @remarks This return a `JQuery`, which is incompatible with the expected `Promise<JQuery>` (see https://gitlab.com/foundrynet/foundryvtt/-/issues/6554).
|
52
|
-
*/
|
53
|
-
protected _renderInner(data: object): any;
|
49
|
+
/** @override */
|
50
|
+
protected _renderInner(data: object): Promise<JQuery>;
|
54
51
|
|
55
52
|
/** @override */
|
56
53
|
protected _render(force?: boolean, options?: Application.RenderOptions<Options>): Promise<void>;
|
@@ -124,9 +124,6 @@ declare global {
|
|
124
124
|
/** @defaultValue `[]` */
|
125
125
|
values: number[];
|
126
126
|
|
127
|
-
/** @defaultValue `0` */
|
128
|
-
last: number;
|
129
|
-
|
130
127
|
/** @defaultValue `0` */
|
131
128
|
average: number;
|
132
129
|
|
@@ -135,9 +132,6 @@ declare global {
|
|
135
132
|
|
136
133
|
/** @defaultValue `document.getElementById("fps")` */
|
137
134
|
element: HTMLElement;
|
138
|
-
|
139
|
-
/** @defaultValue `undefined` */
|
140
|
-
fn: TickerCallback<void> | undefined;
|
141
135
|
};
|
142
136
|
|
143
137
|
/**
|
@@ -541,8 +535,6 @@ declare global {
|
|
541
535
|
}
|
542
536
|
}
|
543
537
|
|
544
|
-
type TickerCallback<T> = (this: T, dt: number) => any;
|
545
|
-
|
546
538
|
interface PerformanceSettings {
|
547
539
|
mode: foundry.CONST.CANVAS_PERFORMANCE_MODES;
|
548
540
|
blur: {
|
@@ -69,6 +69,7 @@ declare global {
|
|
69
69
|
* Handle a SocketResponse from the server when one or multiple documents were created
|
70
70
|
* @param response - The provided Socket response
|
71
71
|
* @returns An Array of created Document instances
|
72
|
+
* @internal
|
72
73
|
*/
|
73
74
|
protected _handleCreateDocuments(response: SocketResponse): foundry.abstract.Document<any, any>[];
|
74
75
|
|
@@ -76,6 +77,7 @@ declare global {
|
|
76
77
|
* Handle a SocketResponse from the server when one or multiple documents were created
|
77
78
|
* @param response - The provided Socket response
|
78
79
|
* @returns An Array of created Document instances
|
80
|
+
* @internal
|
79
81
|
*/
|
80
82
|
protected _handleCreateEmbeddedDocuments(response: SocketResponse): foundry.abstract.Document<any, any>[];
|
81
83
|
|
@@ -125,6 +127,7 @@ declare global {
|
|
125
127
|
* Handle a SocketResponse from the server when one or multiple documents were updated
|
126
128
|
* @param response - The provided Socket response
|
127
129
|
* @returns An Array of updated Document instances
|
130
|
+
* @internal
|
128
131
|
*/
|
129
132
|
protected _handleUpdateDocuments(response: SocketResponse): foundry.abstract.Document<any, any>[];
|
130
133
|
|
@@ -132,6 +135,7 @@ declare global {
|
|
132
135
|
* Handle a SocketResponse from the server when embedded Documents are updated in a parent Document.
|
133
136
|
* @param response - The provided Socket response
|
134
137
|
* @returns An Array of updated Document instances
|
138
|
+
* @internal
|
135
139
|
*/
|
136
140
|
protected _handleUpdateEmbeddedDocuments(response: SocketResponse): foundry.abstract.Document<any, any>[];
|
137
141
|
|
@@ -178,6 +182,7 @@ declare global {
|
|
178
182
|
* Handle a SocketResponse from the server where Documents are deleted.
|
179
183
|
* @param response - The provided Socket response
|
180
184
|
* @returns An Array of deleted Document instances
|
185
|
+
* @internal
|
181
186
|
*/
|
182
187
|
protected _handleDeleteDocuments(response: SocketResponse): foundry.abstract.Document<any, any>[];
|
183
188
|
|
@@ -185,6 +190,7 @@ declare global {
|
|
185
190
|
* Handle a SocketResponse from the server when embedded Documents are deleted from a parent Document.
|
186
191
|
* @param response - The provided Socket response
|
187
192
|
* @returns An Array of deleted Document instances
|
193
|
+
* @internal
|
188
194
|
*/
|
189
195
|
protected _handleDeleteEmbeddedDocuments(response: SocketResponse): foundry.abstract.Document<any, any>[];
|
190
196
|
|
@@ -72,7 +72,8 @@ declare global {
|
|
72
72
|
* Pass an array of specific Card documents from this document to some other Cards stack.
|
73
73
|
* @param to - Some other Cards document that is the destination for the pass operation
|
74
74
|
* @param ids - The embedded Card ids which should be passed
|
75
|
-
* @param options -
|
75
|
+
* @param options - Additional options which modify the pass operation
|
76
|
+
* (default: `{}`)
|
76
77
|
* @returns An array of the Card embedded documents created within the destination stack
|
77
78
|
*/
|
78
79
|
pass(
|
@@ -1,249 +1,270 @@
|
|
1
|
-
|
2
|
-
* A class responsible for managing defined game settings or settings menus.
|
3
|
-
* Each setting is a string key/value pair belonging to a certain package and a certain store scope.
|
4
|
-
*
|
5
|
-
* When Foundry Virtual Tabletop is initialized, a singleton instance of this class is constructed within the global
|
6
|
-
* Game object as as game.settings.
|
7
|
-
*
|
8
|
-
* @see {@link Game#settings}
|
9
|
-
* @see {@link Settings}
|
10
|
-
* @see {@link SettingsConfig}
|
11
|
-
*/
|
12
|
-
declare class ClientSettings {
|
13
|
-
constructor(worldSettings?: Setting['data']['_source'][]);
|
1
|
+
import type { DocumentSubTypes, DocumentType } from '../../types/helperTypes';
|
14
2
|
|
15
|
-
|
16
|
-
* A object of registered game settings for this scope
|
17
|
-
*/
|
18
|
-
settings: Map<string, ClientSettings.CompleteSetting>;
|
3
|
+
import type { TokenDataSource } from '../common/data/data.mjs/tokenData';
|
19
4
|
|
5
|
+
declare global {
|
20
6
|
/**
|
21
|
-
*
|
7
|
+
* A class responsible for managing defined game settings or settings menus.
|
8
|
+
* Each setting is a string key/value pair belonging to a certain package and a certain store scope.
|
9
|
+
*
|
10
|
+
* When Foundry Virtual Tabletop is initialized, a singleton instance of this class is constructed within the global
|
11
|
+
* Game object as as game.settings.
|
12
|
+
*
|
13
|
+
* @see {@link Game#settings}
|
14
|
+
* @see {@link Settings}
|
15
|
+
* @see {@link SettingsConfig}
|
22
16
|
*/
|
23
|
-
|
17
|
+
class ClientSettings {
|
18
|
+
constructor(worldSettings?: Setting['data']['_source'][]);
|
24
19
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
*/
|
30
|
-
storage: Map<string, Storage | WorldSettings>;
|
20
|
+
/**
|
21
|
+
* A object of registered game settings for this scope
|
22
|
+
*/
|
23
|
+
settings: Map<string, ClientSettings.CompleteSetting>;
|
31
24
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
25
|
+
/**
|
26
|
+
* Registered settings menus which trigger secondary applications
|
27
|
+
*/
|
28
|
+
menus: Map<string, ClientSettings.CompleteMenuSetting>;
|
36
29
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
30
|
+
/**
|
31
|
+
* The storage interfaces used for persisting settings
|
32
|
+
* Each storage interface shares the same API as window.localStorage
|
33
|
+
* @remarks This is a lie, it doesn't actually have the same interface...
|
34
|
+
*/
|
35
|
+
storage: Map<string, Storage | WorldSettings>;
|
41
36
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
* @param key - The key name for the setting under the namespace module
|
47
|
-
* @param data - Configuration for setting data
|
48
|
-
* @typeParam M - The module name to register the setting for
|
49
|
-
* @typeParam K - The key to register the setting for
|
50
|
-
* @typeParam T - The type of the setting value
|
51
|
-
*
|
52
|
-
* @example
|
53
|
-
* ```typescript
|
54
|
-
* // Register a client setting
|
55
|
-
* game.settings.register("myModule", "myClientSetting", {
|
56
|
-
* name: "Register a Module Setting with Choices",
|
57
|
-
* hint: "A description of the registered setting and its behavior.",
|
58
|
-
* scope: "client", // This specifies a client-stored setting
|
59
|
-
* config: true, // This specifies that the setting appears in the configuration view
|
60
|
-
* type: String,
|
61
|
-
* choices: { // If choices are defined, the resulting setting will be a select menu
|
62
|
-
* "a": "Option A",
|
63
|
-
* "b": "Option B"
|
64
|
-
* },
|
65
|
-
* default: "a", // The default value for the setting
|
66
|
-
* onChange: value => { // A callback function which triggers when the setting is changed
|
67
|
-
* console.log(value)
|
68
|
-
* }
|
69
|
-
* });
|
70
|
-
* ```
|
71
|
-
*
|
72
|
-
* @example
|
73
|
-
* ```typescript
|
74
|
-
* // Register a world setting
|
75
|
-
* game.settings.register("myModule", "myWorldSetting", {
|
76
|
-
* name: "Register a Module Setting with a Range slider",
|
77
|
-
* hint: "A description of the registered setting and its behavior.",
|
78
|
-
* scope: "world", // This specifies a world-level setting
|
79
|
-
* config: true, // This specifies that the setting appears in the configuration view
|
80
|
-
* type: Number,
|
81
|
-
* range: { // If range is specified, the resulting setting will be a range slider
|
82
|
-
* min: 0,
|
83
|
-
* max: 100,
|
84
|
-
* step: 10
|
85
|
-
* }
|
86
|
-
* default: 50, // The default value for the setting
|
87
|
-
* onChange: value => { // A callback function which triggers when the setting is changed
|
88
|
-
* console.log(value)
|
89
|
-
* }
|
90
|
-
* });
|
91
|
-
* ```
|
92
|
-
*/
|
93
|
-
register<M extends string, K extends string, T>(
|
94
|
-
module: M,
|
95
|
-
key: K,
|
96
|
-
data: ClientSettings.Values[`${M}.${K}`] extends boolean | number | bigint | string | symbol | object
|
97
|
-
? ClientSettings.PartialSetting<ClientSettings.Values[`${M}.${K}`]>
|
98
|
-
: ClientSettings.PartialSetting<T>
|
99
|
-
): void;
|
37
|
+
/**
|
38
|
+
* The types of settings which should be constructed as a primitive type
|
39
|
+
*/
|
40
|
+
protected static PRIMITIVE_TYPES: [typeof String, typeof Number, typeof Boolean, typeof Array];
|
100
41
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
* @param key - The key name for the setting under the namespace module
|
106
|
-
* @param data - Configuration for setting data
|
107
|
-
* @typeParam M - The module name to register the menu setting for
|
108
|
-
* @typeParam K - The key to register the menu setting for
|
109
|
-
*
|
110
|
-
* @example
|
111
|
-
* ```typescript
|
112
|
-
* // Define a settings submenu which handles advanced configuration needs
|
113
|
-
* game.settings.registerMenu("myModule", "mySettingsMenu", {
|
114
|
-
* name: "My Settings Submenu",
|
115
|
-
* label: "Settings Menu Label", // The text label used in the button
|
116
|
-
* hint: "A description of what will occur in the submenu dialog.",
|
117
|
-
* icon: "fas fa-bars", // A Font Awesome icon used in the submenu button
|
118
|
-
* type: MySubmenuApplicationClass, // A FormApplication subclass which should be created
|
119
|
-
* restricted: true // Restrict this submenu to gamemaster only?
|
120
|
-
* });
|
121
|
-
* ```
|
122
|
-
*/
|
123
|
-
registerMenu<M extends string, K extends string>(
|
124
|
-
module: M,
|
125
|
-
key: K,
|
126
|
-
data: ClientSettings.RegisteredMenuSettings[`${M}.${K}`]
|
127
|
-
): void;
|
42
|
+
/**
|
43
|
+
* Return a singleton instance of the Game Settings Configuration app
|
44
|
+
*/
|
45
|
+
get sheet(): SettingsConfig;
|
128
46
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
47
|
+
/**
|
48
|
+
* Register a new game setting under this setting scope
|
49
|
+
*
|
50
|
+
* @param module - The namespace under which the setting is registered
|
51
|
+
* @param key - The key name for the setting under the namespace module
|
52
|
+
* @param data - Configuration for setting data
|
53
|
+
* @typeParam M - The module name to register the setting for
|
54
|
+
* @typeParam K - The key to register the setting for
|
55
|
+
* @typeParam T - The type of the setting value
|
56
|
+
*
|
57
|
+
* @example
|
58
|
+
* ```typescript
|
59
|
+
* // Register a client setting
|
60
|
+
* game.settings.register("myModule", "myClientSetting", {
|
61
|
+
* name: "Register a Module Setting with Choices",
|
62
|
+
* hint: "A description of the registered setting and its behavior.",
|
63
|
+
* scope: "client", // This specifies a client-stored setting
|
64
|
+
* config: true, // This specifies that the setting appears in the configuration view
|
65
|
+
* type: String,
|
66
|
+
* choices: { // If choices are defined, the resulting setting will be a select menu
|
67
|
+
* "a": "Option A",
|
68
|
+
* "b": "Option B"
|
69
|
+
* },
|
70
|
+
* default: "a", // The default value for the setting
|
71
|
+
* onChange: value => { // A callback function which triggers when the setting is changed
|
72
|
+
* console.log(value)
|
73
|
+
* }
|
74
|
+
* });
|
75
|
+
* ```
|
76
|
+
*
|
77
|
+
* @example
|
78
|
+
* ```typescript
|
79
|
+
* // Register a world setting
|
80
|
+
* game.settings.register("myModule", "myWorldSetting", {
|
81
|
+
* name: "Register a Module Setting with a Range slider",
|
82
|
+
* hint: "A description of the registered setting and its behavior.",
|
83
|
+
* scope: "world", // This specifies a world-level setting
|
84
|
+
* config: true, // This specifies that the setting appears in the configuration view
|
85
|
+
* type: Number,
|
86
|
+
* range: { // If range is specified, the resulting setting will be a range slider
|
87
|
+
* min: 0,
|
88
|
+
* max: 100,
|
89
|
+
* step: 10
|
90
|
+
* }
|
91
|
+
* default: 50, // The default value for the setting
|
92
|
+
* onChange: value => { // A callback function which triggers when the setting is changed
|
93
|
+
* console.log(value)
|
94
|
+
* }
|
95
|
+
* });
|
96
|
+
* ```
|
97
|
+
*/
|
98
|
+
register<M extends string, K extends string, T>(
|
99
|
+
module: M,
|
100
|
+
key: K,
|
101
|
+
data: ClientSettings.Values[`${M}.${K}`] extends boolean | number | bigint | string | symbol | object
|
102
|
+
? ClientSettings.PartialSetting<ClientSettings.Values[`${M}.${K}`]>
|
103
|
+
: ClientSettings.PartialSetting<T>
|
104
|
+
): void;
|
144
105
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
106
|
+
/**
|
107
|
+
* Register a new sub-settings menu
|
108
|
+
*
|
109
|
+
* @param module - The namespace under which the menu is registered
|
110
|
+
* @param key - The key name for the setting under the namespace module
|
111
|
+
* @param data - Configuration for setting data
|
112
|
+
* @typeParam M - The module name to register the menu setting for
|
113
|
+
* @typeParam K - The key to register the menu setting for
|
114
|
+
*
|
115
|
+
* @example
|
116
|
+
* ```typescript
|
117
|
+
* // Define a settings submenu which handles advanced configuration needs
|
118
|
+
* game.settings.registerMenu("myModule", "mySettingsMenu", {
|
119
|
+
* name: "My Settings Submenu",
|
120
|
+
* label: "Settings Menu Label", // The text label used in the button
|
121
|
+
* hint: "A description of what will occur in the submenu dialog.",
|
122
|
+
* icon: "fas fa-bars", // A Font Awesome icon used in the submenu button
|
123
|
+
* type: MySubmenuApplicationClass, // A FormApplication subclass which should be created
|
124
|
+
* restricted: true // Restrict this submenu to gamemaster only?
|
125
|
+
* });
|
126
|
+
* ```
|
127
|
+
*/
|
128
|
+
registerMenu<M extends string, K extends string>(
|
129
|
+
module: M,
|
130
|
+
key: K,
|
131
|
+
data: ClientSettings.RegisteredMenuSettings[`${M}.${K}`]
|
132
|
+
): void;
|
167
133
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
134
|
+
/**
|
135
|
+
* Get the value of a game setting for a certain module and setting key
|
136
|
+
*
|
137
|
+
* @param module - The module namespace under which the setting is registered
|
138
|
+
* @param key - The setting key to retrieve
|
139
|
+
* @typeParam M - The module name to register the get for
|
140
|
+
* @typeParam K - The key to get the setting for
|
141
|
+
*
|
142
|
+
* @example
|
143
|
+
* ```typescript
|
144
|
+
* // Retrieve the current setting value
|
145
|
+
* game.settings.get("myModule", "myClientSetting");
|
146
|
+
* ```
|
147
|
+
*/
|
148
|
+
get<M extends string, K extends string>(module: M, key: K): ClientSettings.Values[`${M}.${K}`];
|
173
149
|
|
174
|
-
|
175
|
-
|
176
|
-
|
150
|
+
/**
|
151
|
+
* Set the value of a game setting for a certain module and setting key
|
152
|
+
*
|
153
|
+
* @param module - The module namespace under which the setting is registered
|
154
|
+
* @param key - The setting key to retrieve
|
155
|
+
* @param value - The data to assign to the setting key
|
156
|
+
* @typeParam M - The module name to register the get for
|
157
|
+
* @typeParam K - The key to get the setting for
|
158
|
+
* @typeParam V - The value type to get the value for
|
159
|
+
*
|
160
|
+
* @example
|
161
|
+
* ```typescript
|
162
|
+
* // Update the current value of a setting
|
163
|
+
* game.settings.set("myModule", "myClientSetting", "b");
|
164
|
+
* ```
|
165
|
+
*/
|
166
|
+
set<M extends string, K extends string, V extends ClientSettings.Values[`${M}.${K}`]>(
|
167
|
+
module: M,
|
168
|
+
key: K,
|
169
|
+
value: V
|
170
|
+
): Promise<V>;
|
177
171
|
}
|
178
172
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
name?: string;
|
185
|
-
onChange?: (value: T) => void;
|
186
|
-
range?: T extends number
|
187
|
-
? {
|
188
|
-
max: number;
|
189
|
-
min: number;
|
190
|
-
step: number;
|
191
|
-
}
|
192
|
-
: undefined;
|
193
|
-
filePicker?: T extends string ? true | 'audio' | 'image' | 'video' | 'imagevideo' | 'folder' : undefined;
|
194
|
-
scope: string;
|
195
|
-
type?: T extends boolean
|
196
|
-
? typeof Boolean
|
197
|
-
: T extends number
|
198
|
-
? typeof Number
|
199
|
-
: T extends bigint
|
200
|
-
? typeof BigInt
|
201
|
-
: T extends string
|
202
|
-
? typeof String
|
203
|
-
: T extends symbol
|
204
|
-
? typeof Symbol
|
205
|
-
: ConstructorOf<T>;
|
206
|
-
}
|
173
|
+
namespace ClientSettings {
|
174
|
+
interface CompleteSetting<T = unknown> extends PartialSetting<T> {
|
175
|
+
key: string;
|
176
|
+
module: string;
|
177
|
+
}
|
207
178
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
name?: string;
|
213
|
-
restricted: boolean;
|
214
|
-
type: ConstructorOf<FormApplication<FormApplicationOptions, object, undefined>>;
|
215
|
-
}
|
179
|
+
interface CompleteMenuSetting extends PartialMenuSetting {
|
180
|
+
key: string;
|
181
|
+
module: string;
|
182
|
+
}
|
216
183
|
|
217
|
-
|
218
|
-
|
219
|
-
|
184
|
+
interface PartialSetting<T = unknown> {
|
185
|
+
choices?: Record<string, string>;
|
186
|
+
config?: boolean;
|
187
|
+
default?: T;
|
188
|
+
hint?: string;
|
189
|
+
name?: string;
|
190
|
+
onChange?: (value: T) => void;
|
191
|
+
range?: T extends number
|
192
|
+
? {
|
193
|
+
max: number;
|
194
|
+
min: number;
|
195
|
+
step: number;
|
196
|
+
}
|
197
|
+
: undefined;
|
198
|
+
filePicker?: T extends string ? true | 'audio' | 'image' | 'video' | 'imagevideo' | 'folder' : undefined;
|
199
|
+
scope: string;
|
200
|
+
type?: T extends boolean
|
201
|
+
? typeof Boolean
|
202
|
+
: T extends number
|
203
|
+
? typeof Number
|
204
|
+
: T extends bigint
|
205
|
+
? typeof BigInt
|
206
|
+
: T extends string
|
207
|
+
? typeof String
|
208
|
+
: T extends symbol
|
209
|
+
? typeof Symbol
|
210
|
+
: ConstructorOf<T>;
|
211
|
+
}
|
212
|
+
|
213
|
+
interface PartialMenuSetting {
|
214
|
+
hint?: string;
|
215
|
+
icon?: string;
|
216
|
+
label?: string;
|
217
|
+
name?: string;
|
218
|
+
restricted: boolean;
|
219
|
+
type: ConstructorOf<FormApplication<FormApplicationOptions, object, undefined>>;
|
220
|
+
}
|
221
|
+
|
222
|
+
interface RegisteredMenuSettings {
|
223
|
+
[key: string]: PartialMenuSetting;
|
224
|
+
}
|
220
225
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
226
|
+
interface Values {
|
227
|
+
'core.animateRollTable': boolean;
|
228
|
+
'core.chatBubbles': boolean;
|
229
|
+
'core.chatBubblesPan': boolean;
|
230
|
+
'core.combatTrackerConfig': { resource: string; skipDefeated: boolean } | {};
|
231
|
+
'core.compendiumConfiguration': Partial<Record<string, CompendiumCollection.Configuration>>;
|
232
|
+
'core.coneTemplateType': 'round' | 'flat';
|
233
|
+
'core.defaultDrawingConfig': foundry.data.DrawingData['_source'] | {};
|
234
|
+
'core.defaultToken': DeepPartial<TokenDataSource>;
|
235
|
+
'core.disableResolutionScaling': boolean;
|
236
|
+
'core.fontSize': number;
|
237
|
+
'core.fpsMeter': boolean;
|
238
|
+
'core.globalAmbientVolume': number;
|
239
|
+
'core.globalInterfaceVolume': number;
|
240
|
+
'core.globalPlaylistVolume': number;
|
241
|
+
'core.keybindings': Record<string, KeybindingActionBinding[]>;
|
242
|
+
'core.language': string;
|
243
|
+
'core.leftClickRelease': boolean;
|
244
|
+
'core.lightAnimation': boolean;
|
245
|
+
'core.maxFPS': number;
|
246
|
+
'core.mipmap': boolean;
|
247
|
+
'core.moduleConfiguration': Record<string, boolean>;
|
248
|
+
'core.noCanvas': boolean;
|
249
|
+
'core.notesDisplayToggle': boolean;
|
250
|
+
'core.nue.shownTips': boolean;
|
251
|
+
'core.performanceMode': boolean;
|
252
|
+
'core.permissions': Game.Permissions;
|
253
|
+
'core.playlist.playingLocation': 'top' | 'bottom';
|
254
|
+
'core.rollMode': keyof CONFIG.Dice.RollModes;
|
255
|
+
'core.rtcClientSettings': typeof AVSettings.DEFAULT_CLIENT_SETTINGS;
|
256
|
+
'core.rtcWorldSettings': typeof AVSettings.DEFAULT_WORLD_SETTINGS;
|
257
|
+
'core.scrollingStatusText': boolean;
|
258
|
+
'core.sheetClasses': {
|
259
|
+
[Key in DocumentType as DocumentSubTypes<Key> extends string ? Key : never]?: Record<
|
260
|
+
DocumentSubTypes<Key> & string,
|
261
|
+
string
|
262
|
+
>;
|
263
|
+
};
|
264
|
+
'core.time': number;
|
265
|
+
'core.tokenDragPreview': boolean;
|
266
|
+
'core.visionAnimation': boolean;
|
267
|
+
[key: string]: unknown;
|
268
|
+
}
|
248
269
|
}
|
249
270
|
}
|
@@ -164,7 +164,9 @@ declare global {
|
|
164
164
|
* Provide a dialog form that prompts the user to import the full contents of a Compendium pack into the World.
|
165
165
|
* @param options - Additional options passed to the Dialog.confirm method
|
166
166
|
* (default: `{}`)
|
167
|
-
* @returns A
|
167
|
+
* @returns A promise which resolves in the following ways: an array of imported
|
168
|
+
* Documents if the "yes" button was pressed, false if the "no" button was pressed, or
|
169
|
+
* null if the dialog was closed without making a choice.
|
168
170
|
*/
|
169
171
|
importDialog(
|
170
172
|
options?: Dialog.Options | undefined
|
@@ -42,8 +42,9 @@ declare abstract class PointSourcePolygon extends PIXI.Polygon {
|
|
42
42
|
/**
|
43
43
|
* A cached array of SightRay objects used to compute the polygon.
|
44
44
|
* @defaultValue `[]`
|
45
|
+
* @remarks This is documented as `SightRay[]` but that's only correct for the {@link RadialSweepPolygon}
|
45
46
|
*/
|
46
|
-
rays:
|
47
|
+
rays: Ray[];
|
47
48
|
|
48
49
|
/**
|
49
50
|
* Compute the rectangular bounds for the Polygon.
|
@@ -66,11 +67,12 @@ declare abstract class PointSourcePolygon extends PIXI.Polygon {
|
|
66
67
|
* Compute the polygon given a point origin and radius
|
67
68
|
* @param origin - The origin source point
|
68
69
|
* @param config - Configuration options which customize the polygon computation
|
70
|
+
* (default: `{}`)
|
69
71
|
* @returns The computed polygon instance
|
70
72
|
*/
|
71
73
|
static create(
|
72
74
|
origin: Point,
|
73
|
-
config
|
75
|
+
config?: Parameters<PointSourcePolygon['initialize']>[1] | undefined
|
74
76
|
): ReturnType<PointSourcePolygon['compute']>;
|
75
77
|
|
76
78
|
/**
|
@@ -37,13 +37,13 @@ declare global {
|
|
37
37
|
* The minimum ray of emission
|
38
38
|
* @defaultValue `Ray.fromAngle(origin.x, origin.y, config.aMin, config.radius)`
|
39
39
|
*/
|
40
|
-
rMin?:
|
40
|
+
rMin?: PolygonRay;
|
41
41
|
|
42
42
|
/**
|
43
43
|
* The maximum ray of emission
|
44
44
|
* @defaultValue `config.hasLimitedAngle && Ray.fromAngle(origin.x, origin.y, config.aMax, config.radius)`
|
45
45
|
*/
|
46
|
-
rMax?:
|
46
|
+
rMax?: PolygonRay;
|
47
47
|
|
48
48
|
/**
|
49
49
|
* Does this polygon have a limited radius?
|
@@ -70,6 +70,10 @@ declare global {
|
|
70
70
|
radiusE?: number;
|
71
71
|
}
|
72
72
|
|
73
|
+
interface PolygonRay extends Ray {
|
74
|
+
result: CollisionResult;
|
75
|
+
}
|
76
|
+
|
73
77
|
/**
|
74
78
|
* A PointSourcePolygon implementation that uses CCW (counter-clockwise) geometry orientation.
|
75
79
|
* Sweep around the origin, accumulating collision points based on the set of active walls.
|
@@ -97,7 +101,7 @@ declare global {
|
|
97
101
|
/**
|
98
102
|
* A collection of rays which are fired at vertices
|
99
103
|
*/
|
100
|
-
rays:
|
104
|
+
rays: PolygonRay[];
|
101
105
|
|
102
106
|
static benchmark(
|
103
107
|
iterations: number,
|
@@ -125,7 +129,7 @@ declare global {
|
|
125
129
|
* @returns The ray with rounded vertices
|
126
130
|
* @internal
|
127
131
|
*/
|
128
|
-
protected _roundRayVertices(ray:
|
132
|
+
protected _roundRayVertices(ray: PolygonRay): PolygonRay;
|
129
133
|
|
130
134
|
/**
|
131
135
|
* Translate walls and other obstacles into edges which limit visibility
|
@@ -194,7 +198,7 @@ declare global {
|
|
194
198
|
* @internal
|
195
199
|
*/
|
196
200
|
protected _isVertexBehindActiveEdges(
|
197
|
-
ray:
|
201
|
+
ray: PolygonRay,
|
198
202
|
vertex: PolygonVertex,
|
199
203
|
activeEdges: EdgeSet
|
200
204
|
): { isBehind: boolean; wasLimited: boolean };
|
@@ -207,7 +211,12 @@ declare global {
|
|
207
211
|
* @param activeEdges - The set of active edges
|
208
212
|
* @internal
|
209
213
|
*/
|
210
|
-
protected _determineRayResult(
|
214
|
+
protected _determineRayResult(
|
215
|
+
ray: PolygonRay,
|
216
|
+
vertex: PolygonVertex,
|
217
|
+
result: CollisionResult,
|
218
|
+
activeEdges: EdgeSet
|
219
|
+
): void;
|
211
220
|
|
212
221
|
/**
|
213
222
|
* Jump to a new closest active edge.
|
@@ -223,7 +232,7 @@ declare global {
|
|
223
232
|
* (default: `true`)
|
224
233
|
*/
|
225
234
|
protected _beginNewEdge(
|
226
|
-
ray:
|
235
|
+
ray: PolygonRay,
|
227
236
|
result: CollisionResult,
|
228
237
|
activeEdges: EdgeSet,
|
229
238
|
isBinding: boolean,
|
@@ -241,7 +250,12 @@ declare global {
|
|
241
250
|
* @param activeEdges - The set of currently active edges
|
242
251
|
* @param isBinding - Is the target vertex a binding collision point?
|
243
252
|
*/
|
244
|
-
protected _completeCurrentEdge(
|
253
|
+
protected _completeCurrentEdge(
|
254
|
+
ray: PolygonRay,
|
255
|
+
result: CollisionResult,
|
256
|
+
activeEdges: EdgeSet,
|
257
|
+
isBinding: boolean
|
258
|
+
): void;
|
245
259
|
|
246
260
|
/**
|
247
261
|
* Augment a CollisionResult with an additional secondary collision.
|
@@ -251,7 +265,7 @@ declare global {
|
|
251
265
|
* @param edges - The subset of active edges which are candidates for collision
|
252
266
|
* @internal
|
253
267
|
*/
|
254
|
-
protected _getSecondaryCollisions(ray:
|
268
|
+
protected _getSecondaryCollisions(ray: PolygonRay, result: CollisionResult, edges: EdgeSet): PolygonVertex[];
|
255
269
|
|
256
270
|
/**
|
257
271
|
* Identify collision points for a required terminal ray.
|
@@ -261,7 +275,7 @@ declare global {
|
|
261
275
|
* @param result - The pending collision result
|
262
276
|
* @param activeEdges - The set of currently active edges
|
263
277
|
*/
|
264
|
-
protected _findRequiredCollision(ray:
|
278
|
+
protected _findRequiredCollision(ray: PolygonRay, result: CollisionResult, activeEdges: EdgeSet): void;
|
265
279
|
|
266
280
|
/**
|
267
281
|
* Identify the collision points between an emitted Ray and a set of active edges.
|
@@ -271,7 +285,7 @@ declare global {
|
|
271
285
|
* @internal
|
272
286
|
*/
|
273
287
|
protected _getRayCollisions(
|
274
|
-
ray:
|
288
|
+
ray: PolygonRay,
|
275
289
|
activeEdges: EdgeSet,
|
276
290
|
{
|
277
291
|
minimumDistance
|
@@ -304,7 +318,7 @@ declare global {
|
|
304
318
|
* @param r1 - The next ray that collides with some vertex
|
305
319
|
* @internal
|
306
320
|
*/
|
307
|
-
protected _getPaddingPoints(r0:
|
321
|
+
protected _getPaddingPoints(r0: PolygonRay, r1: PolygonRay): Point[];
|
308
322
|
|
309
323
|
/**
|
310
324
|
* Test whether a wall should be included in the computed polygon for a given origin and type
|
@@ -328,7 +342,7 @@ declare global {
|
|
328
342
|
* @param angle - The angle being tested, in degrees
|
329
343
|
* @returns Is the vertex between the two rays?
|
330
344
|
*/
|
331
|
-
static pointBetweenRays(vertex: PolygonVertex, rMin:
|
345
|
+
static pointBetweenRays(vertex: PolygonVertex, rMin: PolygonRay, rMax: PolygonRay, angle: number): boolean;
|
332
346
|
|
333
347
|
/** @override */
|
334
348
|
visualize(): void;
|
@@ -342,7 +356,7 @@ declare global {
|
|
342
356
|
* The closest collision, if mode is "closest"
|
343
357
|
*/
|
344
358
|
static getRayCollisions<Mode extends 'any' | 'closest' | 'all'>(
|
345
|
-
ray:
|
359
|
+
ray: PolygonRay,
|
346
360
|
options?: {
|
347
361
|
/**
|
348
362
|
* Which collision type to check, a value in CONST.WALL_RESTRICTION_TYPES
|
@@ -368,7 +382,7 @@ declare global {
|
|
368
382
|
* Visualize the polygon, displaying its computed area, rays, and collision points
|
369
383
|
* @internal
|
370
384
|
*/
|
371
|
-
protected static _visualizeCollision(ray:
|
385
|
+
protected static _visualizeCollision(ray: PolygonRay, edges: EdgeSet, collisions: PolygonVertex[]): void;
|
372
386
|
}
|
373
387
|
|
374
388
|
namespace ClockwiseSweepPolygon {
|
@@ -385,12 +399,12 @@ declare global {
|
|
385
399
|
rotation: number;
|
386
400
|
hasLimitedAngle: boolean;
|
387
401
|
density: number;
|
388
|
-
rMin:
|
402
|
+
rMin: PolygonRay;
|
389
403
|
}
|
390
404
|
|
391
405
|
interface LimitedAngleConfig extends InitializedConfig {
|
392
406
|
hasLimitedAngle: true;
|
393
|
-
rMax:
|
407
|
+
rMax: PolygonRay;
|
394
408
|
}
|
395
409
|
}
|
396
410
|
}
|
@@ -207,11 +207,6 @@ declare class Die extends DiceTerm {
|
|
207
207
|
}
|
208
208
|
|
209
209
|
declare namespace Die {
|
210
|
-
interface Data extends Partial<TermData> {
|
211
|
-
class: 'Die';
|
212
|
-
results: DiceTerm.Result[];
|
213
|
-
}
|
214
|
-
|
215
210
|
interface TermData extends DiceTerm.TermData {
|
216
211
|
modifiers: Array<keyof typeof Die['MODIFIERS']>;
|
217
212
|
}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
* Mathematically behaves like 1d3-2
|
4
4
|
*/
|
5
5
|
declare class FateDie extends DiceTerm {
|
6
|
-
constructor(termData?: Partial<
|
6
|
+
constructor(termData?: Partial<FateDie.TermData>);
|
7
7
|
|
8
8
|
faces: 3;
|
9
9
|
|
@@ -12,6 +12,9 @@ declare class FateDie extends DiceTerm {
|
|
12
12
|
*/
|
13
13
|
static DENOMINATION: string;
|
14
14
|
|
15
|
+
/** @override */
|
16
|
+
static MODIFIERS: FateDie.Modifiers;
|
17
|
+
|
15
18
|
/**
|
16
19
|
* @override
|
17
20
|
*/
|
@@ -22,3 +25,20 @@ declare class FateDie extends DiceTerm {
|
|
22
25
|
*/
|
23
26
|
getResultLabel(result: DiceTerm.Result): string;
|
24
27
|
}
|
28
|
+
|
29
|
+
declare namespace FateDie {
|
30
|
+
interface TermData extends DiceTerm.TermData {
|
31
|
+
modifiers: Array<keyof typeof FateDie['MODIFIERS']>;
|
32
|
+
}
|
33
|
+
|
34
|
+
interface Modifiers {
|
35
|
+
r: Die['reroll'];
|
36
|
+
rr: Die['rerollRecursive'];
|
37
|
+
k: Die['keep'];
|
38
|
+
kh: Die['keep'];
|
39
|
+
kl: Die['keep'];
|
40
|
+
d: Die['drop'];
|
41
|
+
dh: Die['drop'];
|
42
|
+
dl: Die['drop'];
|
43
|
+
}
|
44
|
+
}
|
@@ -5,13 +5,6 @@
|
|
5
5
|
declare class VideoHelper {
|
6
6
|
constructor();
|
7
7
|
|
8
|
-
/**
|
9
|
-
* A collection of HTML5 video objects which are currently active within the FVTT page
|
10
|
-
* @defaultValue `[]`
|
11
|
-
* @remarks This seems to be unused.
|
12
|
-
*/
|
13
|
-
videos: HTMLVideoElement[];
|
14
|
-
|
15
8
|
/**
|
16
9
|
* A user gesture must be registered before video playback can begin.
|
17
10
|
* This Set records the video elements which await such a gesture.
|
@@ -103,6 +103,12 @@ export type PlaceableDocumentType =
|
|
103
103
|
| 'Token'
|
104
104
|
| 'Wall';
|
105
105
|
|
106
|
+
export type DocumentSubTypes<T extends DocumentType> = 'type' extends keyof InstanceType<
|
107
|
+
ConfiguredDocumentClassForName<T>
|
108
|
+
>['data']
|
109
|
+
? InstanceType<ConfiguredDocumentClassForName<T>>['data']['type']
|
110
|
+
: typeof foundry.CONST.BASE_DOCUMENT_TYPE;
|
111
|
+
|
106
112
|
export type ConfiguredDocumentClassForName<Name extends DocumentType> = CONFIG[Name]['documentClass'];
|
107
113
|
|
108
114
|
export type ConfiguredObjectClassForName<Name extends PlaceableDocumentType> = CONFIG[Name]['objectClass'];
|