@league-of-foundry-developers/foundry-vtt-types 9.268.2 → 9.280.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@league-of-foundry-developers/foundry-vtt-types",
3
- "version": "9.268.2",
3
+ "version": "9.280.0",
4
4
  "description": "TypeScript type definitions for Foundry VTT",
5
5
  "exports": {
6
6
  ".": {
@@ -76,7 +76,7 @@
76
76
  "lint-staged": "^12.1.2",
77
77
  "prettier": "^2.5.1",
78
78
  "tsd": "^0.20.0",
79
- "typescript": "~4.6.2"
79
+ "typescript": "~4.7.2"
80
80
  },
81
81
  "husky": {
82
82
  "hooks": {
@@ -59,8 +59,11 @@ declare global {
59
59
 
60
60
  /**
61
61
  * A simple window application which shows the built documentation pages within an iframe
62
+ * @typeParam Options - the type of the options object
62
63
  */
63
- class FrameViewer extends Application {
64
+ class FrameViewer<Options extends ApplicationOptions = ApplicationOptions> extends Application<Options> {
65
+ constructor(url: string, options?: Partial<Options>);
66
+
64
67
  url: string;
65
68
 
66
69
  /**
@@ -78,7 +81,7 @@ declare global {
78
81
  */
79
82
  static override get defaultOptions(): typeof Application['defaultOptions'];
80
83
 
81
- override getData(options?: Partial<ApplicationOptions>): Promise<{ src: string }>;
84
+ override getData(options?: Partial<Options>): Promise<{ src: string }>;
82
85
 
83
86
  override close(options?: Application.CloseOptions): ReturnType<Application['close']>;
84
87
  }
@@ -221,7 +221,7 @@ declare namespace AVSettings {
221
221
  type ClientSettings = typeof AVSettings.DEFAULT_CLIENT_SETTINGS;
222
222
  type WorldSettings = typeof AVSettings.DEFAULT_WORLD_SETTINGS;
223
223
  type StoredUserSettings = typeof AVSettings.DEFAULT_USER_SETTINGS;
224
- type UserSettings = StoredUserSettings & { canBroadCastAudio: boolean; canBroadcastVideo: boolean };
224
+ type UserSettings = StoredUserSettings & { canBroadcastAudio: boolean; canBroadcastVideo: boolean };
225
225
  type Settings = { client: ClientSettings; world: WorldSettings };
226
226
  interface DefaultVoiceModes {
227
227
  ALWAYS: 'always';
@@ -1,4 +1,5 @@
1
1
  import { DocumentConstructor, PlaceableObjectConstructor } from '../../types/helperTypes';
2
+ import type { StatusEffect } from './data/documents/token';
2
3
 
3
4
  declare global {
4
5
  /**
@@ -93,31 +94,24 @@ declare global {
93
94
  /** @defaultValue `"fas fa-id-badge"` */
94
95
  sidebarIcon: string;
95
96
 
96
- presets: {
97
- /**
98
- * @defaultValue
99
- * ```javascript
100
- * {
101
- * type: "deck",
102
- * label: "CARDS.DeckPresetPokerDark",
103
- * src: "cards/poker-deck-dark.json"
104
- * }
105
- * ```
106
- */
107
- pokerDark: CONFIG.Cards.Preset;
108
-
109
- /**
110
- * @defaultValue
111
- * ```javascript
112
- * {
113
- * type: "deck",
114
- * label: "CARDS.DeckPresetPokerLight",
115
- * src: "cards/poker-deck-light.json"
116
- * }
117
- * ```
118
- */
119
- pokerLight: CONFIG.Cards.Preset;
120
- } & Record<string, CONFIG.Cards.Preset>;
97
+ /**
98
+ * @defaultValue
99
+ * ```typescript
100
+ * {
101
+ * pokerDark: {
102
+ * type: "deck",
103
+ * label: "CARDS.DeckPresetPokerDark",
104
+ * src: "cards/poker-deck-dark.json"
105
+ * },
106
+ * pokerLight: {
107
+ * type: "deck",
108
+ * label: "CARDS.DeckPresetPokerLight",
109
+ * src: "cards/poker-deck-light.json"
110
+ * }
111
+ * }
112
+ * ```
113
+ */
114
+ presets: Record<string, CONFIG.Cards.Preset>;
121
115
  };
122
116
 
123
117
  /**
@@ -998,7 +992,7 @@ declare global {
998
992
  * ]
999
993
  * ```
1000
994
  */
1001
- statusEffects: { id: string; label: string; icon: string }[];
995
+ statusEffects: StatusEffect[];
1002
996
 
1003
997
  /**
1004
998
  * A mapping of core audio effects used which can be replaced by systems or mods
@@ -1,8 +1,7 @@
1
1
  import { ConfiguredDocumentClass } from '../../../../types/helperTypes';
2
2
  import { DocumentModificationOptions } from '../../../common/abstract/document.mjs.js';
3
- import * as data from '../../../common/data/data.mjs/index.js';
4
-
5
3
  import type { ActiveEffectDataConstructorData } from '../../../common/data/data.mjs/activeEffectData';
4
+ import * as data from '../../../common/data/data.mjs/index.js';
6
5
  import type { PrototypeTokenDataConstructorData } from '../../../common/data/data.mjs/prototypeTokenData';
7
6
 
8
7
  declare global {
@@ -97,10 +96,7 @@ declare global {
97
96
  * (default: `{}`)
98
97
  * @returns Whether the Active Effect is now on or off
99
98
  */
100
- toggleActiveEffect(
101
- effectData: ActiveEffectDataConstructorData & { id: string; label: string; icon: string },
102
- options?: ToggleActiveEffectOptions | undefined
103
- ): Promise<boolean>;
99
+ toggleActiveEffect(effectData: StatusEffect, options?: ToggleActiveEffectOptions | undefined): Promise<boolean>;
104
100
 
105
101
  /**
106
102
  * Redirect updates to a synthetic Token Actor to instead update the tokenData override object.
@@ -281,3 +277,5 @@ interface ToggleActiveEffectOptions {
281
277
  /** Force a certain active state for the effect. */
282
278
  active?: boolean | undefined;
283
279
  }
280
+
281
+ export type StatusEffect = ActiveEffectDataConstructorData & { id: string };
@@ -2,14 +2,9 @@ import type { ConfiguredDocumentClassForName } from '../../../../types/helperTyp
2
2
 
3
3
  declare global {
4
4
  /**
5
- * A Loader class which helps with loading video and image textures
5
+ * A Loader class which helps with loading video and image textures.
6
6
  */
7
7
  class TextureLoader {
8
- /**
9
- * The cached mapping of textures
10
- */
11
- cache: Map<string, { tex: PIXI.BaseTexture; time: number }>;
12
-
13
8
  /**
14
9
  * The duration in milliseconds for which a texture will remain cached
15
10
  * @defaultValue `1000 * 60 * 15`
@@ -43,51 +38,26 @@ declare global {
43
38
  loadTexture(src: string): Promise<PIXI.BaseTexture>;
44
39
 
45
40
  /**
46
- * Log texture loading progress in the console and in the Scene loading bar
47
- * @internal
41
+ * Load an image texture from a provided source url.
42
+ * @param src - The source image URL
43
+ * @returns The loaded BaseTexture
48
44
  */
49
- protected _onProgress(src: string, progress: TextureLoader.Progress): void;
50
-
51
- /**
52
- * Log failed texture loading
53
- * @internal
54
- */
55
- protected _onError(src: string, progress: TextureLoader.Progress, error: Error): void;
45
+ loadImageTexture(src: string): Promise<PIXI.BaseTexture>;
56
46
 
57
47
  /**
58
- * Load an image texture from a provided source url
48
+ * @param src - The source video URL
49
+ * @returns The loaded BaseTexture
59
50
  */
60
- loadImageTexture(src: string): Promise<PIXI.BaseTexture>;
51
+ loadVideoTexture(src: string): Promise<PIXI.BaseTexture>;
61
52
 
62
53
  /**
63
54
  * Use the Fetch API to retrieve a resource and return a Blob instance for it.
55
+ * @param src -
64
56
  * @param options - Options to configure the loading behaviour.
65
57
  * (default: `{}`)
66
- * @internal
67
- */
68
- protected _fetchResource(
69
- src: string,
70
- options?: {
71
- /**
72
- * Append a cache-busting query parameter to the request.
73
- * @defaultValue `false`
74
- */
75
- bustCache?: boolean | undefined;
76
- }
77
- ): Promise<Blob>;
78
-
79
- /**
80
- * Return a URL with a cache-busting query parameter appended.
81
- * @param src - The source URL being attempted
82
- * @returns The new URL, or false on a failure.
83
- * @internal
58
+ * @returns A Blob containing the loaded data
84
59
  */
85
- protected _getCacheBustURL(src: string): string | false;
86
-
87
- /**
88
- * Load a video texture from a provided source url
89
- */
90
- loadVideoTexture(src: string): Promise<PIXI.BaseTexture>;
60
+ static fetchResource(src: string, options?: TextureLoader.FetchResourceOptions): Promise<Blob>;
91
61
 
92
62
  /**
93
63
  * Add an image url to the texture cache
@@ -107,6 +77,13 @@ declare global {
107
77
  */
108
78
  expireCache(): void;
109
79
 
80
+ /**
81
+ * Return a URL with a cache-busting query parameter appended.
82
+ * @param src - The source URL being attempted
83
+ * @returns The new URL, or false on a failure.
84
+ */
85
+ static getCacheBustURL(src: string): string | false;
86
+
110
87
  /**
111
88
  * A global reference to the singleton texture loader
112
89
  */
@@ -142,6 +119,14 @@ declare global {
142
119
  total: number;
143
120
  pct: number;
144
121
  }
122
+
123
+ interface FetchResourceOptions {
124
+ /**
125
+ * Append a cache-busting query parameter to the request.
126
+ * @defaultValue `false`
127
+ */
128
+ bustCache?: boolean;
129
+ }
145
130
  }
146
131
 
147
132
  /**
@@ -160,11 +145,12 @@ declare global {
160
145
  * Load a single texture and return a Promise which resolves once the texture is ready to use
161
146
  * @param src - The requested texture source
162
147
  * @param options - Additional options which modify texture loading
148
+ * @returns The loaded Texture, or null if loading failed with no fallback
163
149
  */
164
150
  function loadTexture(
165
151
  src: string,
166
152
  options?: {
167
- /** A fallback texture to use if the requested source is unavailable or invalid */
153
+ /** A fallback texture URL to use if the requested source is unavailable */
168
154
  fallback?: string | undefined;
169
155
  }
170
156
  ): Promise<PIXI.Texture | null>;
@@ -187,7 +187,7 @@ declare namespace Dialog {
187
187
  /**
188
188
  * The name of the default button which should be triggered on Enter
189
189
  */
190
- default: string;
190
+ default?: string | undefined;
191
191
  }
192
192
  }
193
193
 
@@ -1,5 +1,4 @@
1
- import DocumentData from '../foundry/common/abstract/data.mjs';
2
- import { AnyDocumentData } from '../foundry/common/abstract/data.mjs';
1
+ import DocumentData, { AnyDocumentData } from '../foundry/common/abstract/data.mjs';
3
2
  import Document from '../foundry/common/abstract/document.mjs';
4
3
  import EmbeddedCollection from '../foundry/common/abstract/embedded-collection.mjs';
5
4
 
@@ -125,7 +125,7 @@ type Merge<T, U> = T extends object
125
125
  */
126
126
  type PromisedType<T> = T extends Promise<infer TResult> ? TResult : T;
127
127
 
128
- type StoredDocument<D extends foundry.abstract.Document<any, any>> = D & {
128
+ type StoredDocument<D extends { data: { _source: unknown } }> = D & {
129
129
  id: string;
130
130
  data: D['data'] & {
131
131
  _id: string;