@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250824190511 → 13.346.0-beta.20250825020008

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 (37) hide show
  1. package/package.json +1 -1
  2. package/src/configuration/configuration.d.mts +4 -6
  3. package/src/configuration/globals.d.mts +1 -1
  4. package/src/foundry/client/_types.d.mts +2 -2
  5. package/src/foundry/client/applications/ui/scene-controls.d.mts +52 -2
  6. package/src/foundry/client/audio/_types.d.mts +11 -0
  7. package/src/foundry/client/audio/biquad.d.mts +7 -9
  8. package/src/foundry/client/audio/cache.d.mts +3 -2
  9. package/src/foundry/client/audio/convolver.d.mts +2 -6
  10. package/src/foundry/client/audio/helper.d.mts +263 -87
  11. package/src/foundry/client/audio/sound.d.mts +172 -70
  12. package/src/foundry/client/audio/timeout.d.mts +9 -3
  13. package/src/foundry/client/canvas/containers/elements/door-mesh.d.mts +3 -2
  14. package/src/foundry/client/canvas/interaction/render-flags.d.mts +11 -8
  15. package/src/foundry/client/canvas/perception/vision-mode.d.mts +10 -65
  16. package/src/foundry/client/canvas/primary/primary-graphics.d.mts +1 -8
  17. package/src/foundry/client/canvas/rendering/filters/_module.d.mts +1 -0
  18. package/src/foundry/client/canvas/rendering/shaders/base-shader.d.mts +7 -0
  19. package/src/foundry/client/client.d.mts +24 -0
  20. package/src/foundry/client/data/_module.d.mts +4 -2
  21. package/src/foundry/client/data/_types.d.mts +11 -0
  22. package/src/foundry/client/data/fields.d.mts +72 -0
  23. package/src/foundry/client/documents/abstract/canvas-document.d.mts +1 -1
  24. package/src/foundry/client/documents/abstract/client-document.d.mts +31 -6
  25. package/src/foundry/client/documents/actor.d.mts +3 -2
  26. package/src/foundry/client/documents/collections/compendium-collection.d.mts +111 -50
  27. package/src/foundry/client/documents/token.d.mts +6 -0
  28. package/src/foundry/client/helpers/localization.d.mts +2 -37
  29. package/src/foundry/client/packages/system.d.mts +5 -5
  30. package/src/foundry/client/utils/_module.d.mts +6 -5
  31. package/src/foundry/common/abstract/data.d.mts +87 -3
  32. package/src/foundry/common/abstract/embedded-collection.d.mts +5 -4
  33. package/src/foundry/common/abstract/type-data.d.mts +53 -11
  34. package/src/foundry/common/data/fields.d.mts +15 -1
  35. package/src/foundry/common/packages/_module.d.mts +2 -2
  36. package/src/foundry/common/packages/base-package.d.mts +12 -3
  37. package/src/foundry/common/packages/sub-types.d.mts +6 -3
@@ -1,13 +1,16 @@
1
- import type { Brand, InexactPartial, MaybePromise, NullishProps, Identity } from "#utils";
1
+ import type { Brand, InexactPartial, MaybePromise, Identity, IntentionalPartial } from "#utils";
2
2
  import type EventEmitterMixin from "#common/utils/event-emitter.d.mts";
3
3
  import type { AmbientSound } from "#client/canvas/placeables/_module.d.mts";
4
+ import type { Canvas } from "#client/canvas/_module.d.mts";
5
+ import type { PointSoundSource } from "#client/canvas/sources/_module.d.mts";
6
+ import type { AudioTimeout } from "./_module.d.mts";
4
7
 
5
8
  declare namespace Sound {
6
9
  interface Any extends AnySound {}
7
10
  interface AnyConstructor extends Identity<typeof AnySound> {}
8
11
 
9
12
  /** @internal */
10
- type _ConstructorOptions = NullishProps<{
13
+ type _ConstructorOptions = InexactPartial<{
11
14
  /**
12
15
  * Force use of an AudioBufferSourceNode even if the audio duration is long
13
16
  * @defaultValue `false`
@@ -38,21 +41,19 @@ declare namespace Sound {
38
41
  }
39
42
 
40
43
  /** @internal */
41
- type _LoadOptions = NullishProps<{
44
+ type _LoadOptions = InexactPartial<{
42
45
  /**
43
46
  * Automatically begin playback of the sound once loaded
44
47
  * @defaultValue `false`
45
48
  */
46
49
  autoplay: boolean;
47
- }> &
48
- InexactPartial<{
49
- /**
50
- * Playback options passed to Sound#play, if autoplay
51
- * @defaultValue `{}`
52
- * @remarks Can't be `null` as it only has a parameter default
53
- */
54
- autoplayOptions: Sound.PlaybackOptions;
55
- }>;
50
+
51
+ /**
52
+ * Playback options passed to Sound#play, if autoplay
53
+ * @defaultValue `{}`
54
+ */
55
+ autoplayOptions: Sound.PlaybackOptions;
56
+ }>;
56
57
 
57
58
  interface LoadOptions extends _LoadOptions {}
58
59
 
@@ -60,10 +61,9 @@ declare namespace Sound {
60
61
  * Since `Sound##playback` isn't exposed, this interface can *just* be accurate to what's allowable to pass
61
62
  * to {@link Sound.play | `Sound#play`} or {@link Sound.stop | `#stop`}, which in reality is what's allowed
62
63
  * by `Sound##configurePlayback`
63
- *
64
64
  * @internal
65
65
  */
66
- type _PlaybackOptions = NullishProps<{
66
+ type _PlaybackOptions = InexactPartial<{
67
67
  /**
68
68
  * A delay in seconds by which to delay playback
69
69
  * @defaultValue `0`
@@ -87,49 +87,54 @@ declare namespace Sound {
87
87
  /**
88
88
  * Should sound playback loop?
89
89
  * @defaultValue `false`
90
- * @remarks The above default is true for initial calls, but the actual default
91
- * value, if this is passed nullish or omitted, is whatever the current value is
90
+ * @remarks The above default is true for initial calls, but the actual default value, if this is passed nullish or omitted, is whatever the current value in `this##playback`
91
+ * is, unless this is part of a {@linkcode foundry.canvas.layers.SoundsLayer.playAtPosition | SoundsLayer#playAtPosition} call, as that method always creates a new sound with
92
+ * no playback history
92
93
  */
93
94
  loop: boolean;
94
95
 
95
96
  /**
96
97
  * Seconds of the AudioBuffer when looped playback should start. Only works for AudioBufferSourceNode.
97
98
  * @defaultValue `0`
98
- * @remarks The above default is true for initial calls, but the actual default
99
- * value, if this is passed nullish or omitted, is whatever the current value is
99
+ * @remarks The above default is true for initial calls, but the actual default value, if this is passed nullish or omitted, is whatever the current value in `this##playback`
100
+ * is, unless this is part of a {@linkcode foundry.canvas.layers.SoundsLayer.playAtPosition | SoundsLayer#playAtPosition} call, as that method always creates a new sound with
101
+ * no playback history
100
102
  */
101
103
  loopStart: number;
102
104
 
103
105
  /**
104
106
  * Seconds of the Audio buffer when looped playback should restart. Only works for AudioBufferSourceNode.
105
107
  * @defaultValue `undefined`
106
- * @remarks The above default is true for initial calls, but the actual default
107
- * value, if this is passed nullish or omitted, is whatever the current value is
108
+ * @remarks The above default is true for initial calls, but the actual default value, if this is passed nullish or omitted, is whatever the current value in `this##playback`
109
+ * is, unless this is part of a {@linkcode foundry.canvas.layers.SoundsLayer.playAtPosition | SoundsLayer#playAtPosition} call, as that method always creates a new sound with
110
+ * no playback history
108
111
  */
109
112
  loopEnd: number;
110
113
 
111
114
  /**
112
115
  * An offset in seconds at which to start playback
113
116
  * @defaultValue `0`
114
- * @remarks The above default is true for initial calls, but the actual default
115
- * value, if this is passed nullish or omitted, is whatever the current value of
116
- * `loopStart` is
117
+ * @remarks The above default is true for initial calls, but the actual default value, if this is passed nullish or omitted, is whatever the current value of `loopStart` in
118
+ * `this##playback` is, unless this is part of a {@linkcode foundry.canvas.layers.SoundsLayer.playAtPosition | SoundsLayer#playAtPosition} call, as that method always creates
119
+ * a new sound with no playback history
117
120
  */
118
121
  offset: number;
119
122
 
120
123
  /**
121
124
  * A callback function attached to the source node
122
125
  * @defaultValue `null`
123
- * @remarks The above default is true for initial calls, but the actual default
124
- * value, if this is passed nullish or omitted, is whatever the current value is
126
+ * @remarks The above default is true for initial calls, but the actual default value, if this is passed nullish or omitted, is whatever the current value in `this##playback`
127
+ * is, unless this is part of a {@linkcode foundry.canvas.layers.SoundsLayer.playAtPosition | SoundsLayer#playAtPosition} call, as that method always creates a new sound with
128
+ * no playback history
125
129
  */
126
130
  onended: ScheduleCallback | null;
127
131
 
128
132
  /**
129
133
  * The volume at which to play the sound
130
134
  * @defaultValue `1.0`
131
- * @remarks The above default is true for initial calls, but the actual default
132
- * value, if this is passed nullish or omitted, is whatever the current value is
135
+ * @remarks The above default is true for initial calls, but the actual default value, if this is passed nullish or omitted, is whatever the current value in `this##playback`
136
+ * is, unless this is part of a {@linkcode foundry.canvas.layers.SoundsLayer.playAtPosition | SoundsLayer#playAtPosition} call, as that method always creates a new sound with
137
+ * no playback history
133
138
  */
134
139
  volume: number;
135
140
  }>;
@@ -137,29 +142,78 @@ declare namespace Sound {
137
142
  /** @remarks Default values here are what `Sound##configurePlayback` would use if passed an empty object with no prior calls */
138
143
  interface PlaybackOptions extends _PlaybackOptions {}
139
144
 
145
+ /** @remarks `volume` is always overwritten in {@linkcode Sound.playAtPosition | Sound#playAtPosition} */
146
+ interface PlaybackOptionsPositional extends Omit<PlaybackOptions, "volume"> {}
147
+
148
+ /** @remarks The keys omitted are generated from other data passed to {@linkcode Sound.playAtPosition | Sound#playAtPosition} */
149
+ interface PartialSourceData
150
+ extends IntentionalPartial<Omit<PointSoundSource.SourceData, "x" | "y" | "elevation" | "radius" | "walls">> {}
151
+
152
+ /** @internal */
153
+ type _PlayAtPositionOptions = InexactPartial<{
154
+ /**
155
+ * The maximum volume at which the effect should be played
156
+ * @defaultValue `1.0`
157
+ */
158
+ volume: number;
159
+
160
+ /**
161
+ * Should volume be attenuated by distance?
162
+ * @defaultValue `true`
163
+ */
164
+ easing: boolean;
165
+
166
+ /**
167
+ * Should the sound be constrained by walls?
168
+ * @defaultValue `true`
169
+ */
170
+ walls: boolean;
171
+
172
+ /**
173
+ * Should the sound always be played for GM users regardless of actively controlled tokens?
174
+ * @defaultValue `true`
175
+ */
176
+ gmAlways: boolean;
177
+
178
+ /** A base sound effect to apply to playback */
179
+ baseEffect: AmbientSoundDocument.Effect;
180
+
181
+ /** A muffled sound effect to apply to playback, a sound may only be muffled if it is not constrained by walls */
182
+ muffledEffect: AmbientSoundDocument.Effect;
183
+
184
+ /**
185
+ * Additional data passed to the SoundSource constructor
186
+ */
187
+ sourceData: Sound.PartialSourceData;
188
+
189
+ /**
190
+ * Additional options passed to {@linkcode Sound.play | Sound#play}
191
+ */
192
+ playbackOptions: Sound.PlaybackOptionsPositional;
193
+ }>;
194
+
195
+ interface PlayAtPositionOptions extends _PlayAtPositionOptions {}
196
+
140
197
  /** @internal */
141
198
  type _FadeOptions = InexactPartial<{
142
199
  /**
143
200
  * The duration of the fade effect in milliseconds
144
201
  * @defaultValue `1000`
145
- * @remarks Can't be `null` as it only has a parameter default
146
202
  */
147
203
  duration: number;
148
204
 
149
205
  /**
150
206
  * The type of fade easing, "linear" or "exponential"
151
207
  * @defaultValue `"linear"`
152
- * @remarks Can't be `null` as it only has a parameter default
153
208
  */
154
209
  type: "linear" | "exponential";
155
- }> &
156
- NullishProps<{
157
- /**
158
- * A volume level to start from, the current volume by default
159
- * @defaultValue `this.gain.value`
160
- */
161
- from: number;
162
- }>;
210
+
211
+ /**
212
+ * A volume level to start from, the current volume by default
213
+ * @defaultValue `this.gain.value`
214
+ */
215
+ from: number;
216
+ }>;
163
217
 
164
218
  interface FadeOptions extends _FadeOptions {}
165
219
 
@@ -177,7 +231,6 @@ declare class Sound extends EventEmitterMixin() {
177
231
  * @param src - The audio source path, either a relative path or a remote URL
178
232
  * @param options - Additional options which configure the Sound
179
233
  */
180
- // options: not null (destructured)
181
234
  constructor(src: string, options?: Sound.ConstructorOptions);
182
235
 
183
236
  /**
@@ -241,7 +294,7 @@ declare class Sound extends EventEmitterMixin() {
241
294
 
242
295
  /**
243
296
  * The life-cycle state of the sound.
244
- * @defaultValue `Sound.STATES.NONE`
297
+ * @defaultValue {@linkcode Sound.STATES.NONE}
245
298
  */
246
299
  protected _state: Sound.STATES;
247
300
 
@@ -268,7 +321,7 @@ declare class Sound extends EventEmitterMixin() {
268
321
 
269
322
  /**
270
323
  * A convenience reference to the GainNode gain audio parameter.
271
- * @remarks `undefined` if {@link Sound.gainNode | `Sound#gainNode`} is.
324
+ * @remarks `undefined` if {@linkcode Sound.gainNode | Sound#gainNode} is.
272
325
  */
273
326
  get gain(): AudioParam | undefined;
274
327
 
@@ -325,11 +378,8 @@ declare class Sound extends EventEmitterMixin() {
325
378
  /**
326
379
  * An internal reference to some object which is managing this Sound instance.
327
380
  * @defaultValue `null`
328
- * @remarks Foundry marked `@internal`
329
- *
330
- * Only ever set *or* read externally by core, so not protected
331
- *
332
- * @privateRemarks Foundry types this as `Object|null` but the only place in Core this gets set is in `AmbientSound`, to `this`
381
+ * @internal
382
+ * @remarks Only ever set *or* read externally by core, so not protected
333
383
  */
334
384
  _manager: AmbientSound.Implementation | null;
335
385
 
@@ -338,14 +388,12 @@ declare class Sound extends EventEmitterMixin() {
338
388
  * @param options - Additional options which affect resource loading
339
389
  * @returns A Promise which resolves to the Sound once it is loaded
340
390
  */
341
- // options: not null (destructured)
342
391
  load(options?: Sound.LoadOptions): Promise<this>;
343
392
 
344
393
  /**
345
394
  * An inner method which handles loading so that it can be de-duplicated under a single shared Promise resolution.
346
395
  * This method is factored out to allow for subclasses to override loading behavior.
347
396
  * @returns A Promise which resolves once the sound is loaded
348
- * @throws An error if loading failed for any reason
349
397
  */
350
398
  protected _load(): Promise<void>;
351
399
 
@@ -359,11 +407,60 @@ declare class Sound extends EventEmitterMixin() {
359
407
  play(options?: Sound.PlaybackOptions): Promise<this>;
360
408
 
361
409
  /**
362
- * @deprecated since v12, until v14
363
- * @remarks "`Sound#play` now takes an object of playback options instead of positional arguments."
410
+ * @deprecated "`Sound#play` now takes an object of playback options instead of positional arguments." (since v12, until v14)
364
411
  */
365
412
  play(offset: number, onended?: Sound.ScheduleCallback | null): Promise<this>;
366
413
 
414
+ /**
415
+ * Play a one-shot Sound originating from a predefined point on the canvas.
416
+ * The sound plays locally for the current client only.
417
+ * To play a sound for all connected clients use {@linkcode foundry.canvas.layers.SoundsLayer.emitAtPosition | SoundsLayer#emitAtPosition}.
418
+ * A helper which does not depend on a pre-existing Sound instance is available at
419
+ * {@linkcode foundry.canvas.layers.SoundsLayer.playAtPosition | SoundsLayer#playAtPosition}.
420
+ *
421
+ * @param origin - The canvas coordinates from which the sound originates
422
+ * @param radius - The radius of effect in distance units
423
+ * @param options - Additional options which configure playback
424
+ * @returns A Promise which resolves to the played Sound, or null
425
+ *
426
+ * Play the sound of a trap springing
427
+ * @example
428
+ * ```js
429
+ * const sound = new Sound("modules/my-module/sounds/spring-trap.ogg", {context: game.audio.environment});
430
+ * await sound.load();
431
+ * const origin = {x: 5200, y: 3700}; // The origin point for the sound
432
+ * const radius = 30; // Audible in a 30-foot radius
433
+ * await sound.playAtPosition(origin, radius);
434
+ * ```
435
+ *
436
+ * A Token casts a spell
437
+ * @example
438
+ * ```js
439
+ * const sound = new Sound("modules/my-module/sounds/spells-sprite.ogg", {context: game.audio.environment});
440
+ * const origin = token.center; // The origin point for the sound
441
+ * const radius = 60; // Audible in a 60-foot radius
442
+ * await sound.playAtPosition(origin, radius, {
443
+ * walls: false, // Not constrained by walls with a lowpass muffled effect
444
+ * muffledEffect: {type: "lowpass", intensity: 6},
445
+ * sourceData: {
446
+ * angle: 120, // Sound emitted at a limited angle
447
+ * rotation: 270 // Configure the direction of sound emission
448
+ * }
449
+ * playbackOptions: {
450
+ * loopStart: 12, // Audio sprite timing
451
+ * loopEnd: 16,
452
+ * fade: 300, // Fade-in 300ms
453
+ * onended: () => console.log("Do something after the spell sound has played")
454
+ * }
455
+ * });
456
+ * ```
457
+ */
458
+ playAtPosition(
459
+ origin: Canvas.PossiblyElevatedPoint,
460
+ radius: number,
461
+ options?: Sound.PlayAtPositionOptions,
462
+ ): Promise<this | null>;
463
+
367
464
  /**
368
465
  * Begin playback for the configured pipeline and playback options.
369
466
  * This method is factored out so that subclass implementations of Sound can implement alternative behavior.
@@ -372,9 +469,10 @@ declare class Sound extends EventEmitterMixin() {
372
469
 
373
470
  /**
374
471
  * Pause playback of the Sound.
375
- * For AudioBufferSourceNode this stops playback after recording the current time.
376
- * Calling Sound#play will resume playback from the pausedTime unless some other offset is passed.
377
- * For a MediaElementAudioSourceNode this simply calls the HTMLAudioElement#pause method directly.
472
+ * For {@linkcode AudioBufferSourceNode} this stops playback after recording the current time.
473
+ * Calling {@linkcode Sound.play | Sound#play} will resume playback from the {@linkcode Sound.pauseTime | #pausedTime} unless some other offset is passed.
474
+ * For a {@linkcode MediaElementAudioSourceNode} this simply calls the {@linkcode HTMLAudioElement.pause | HTMLAudioElement#pause} method directly.
475
+ * @remarks
378
476
  * @throws If called while the Sound isn't playing
379
477
  */
380
478
  pause(): void;
@@ -392,7 +490,6 @@ declare class Sound extends EventEmitterMixin() {
392
490
  * @param options - Options which configure the stopping of sound playback
393
491
  * @returns A Promise which resolves once playback is fully stopped (including fade)
394
492
  */
395
- // options: not null (parameter default only, destructured where forwarded)
396
493
  stop(options?: Sound.PlaybackOptions): Promise<this>;
397
494
 
398
495
  /**
@@ -407,7 +504,6 @@ declare class Sound extends EventEmitterMixin() {
407
504
  * @param options - Additional options that configure the fade operation
408
505
  * @returns A Promise that resolves after the requested fade duration
409
506
  */
410
- // options: not null (destructured)
411
507
  fade(volume: number, options?: Sound.FadeOptions): Promise<void>;
412
508
 
413
509
  /**
@@ -432,6 +528,18 @@ declare class Sound extends EventEmitterMixin() {
432
528
  */
433
529
  schedule<R extends Sound.ScheduleCallback>(fn: R, playbackTime: number): Promise<Awaited<ReturnType<R>>>;
434
530
 
531
+ /**
532
+ * Cancel one scheduled event created with {@linkcode Sound.schedule | Sound#schedule}.
533
+ * You may pass either the {@linkcode AudioTimeout} returned internally or the Promise returned by `Sound#schedule`.
534
+ * @param handle - The handle to cancel.
535
+ */
536
+ unschedule(handle: AudioTimeout | { timeout: AudioTimeout }): void;
537
+
538
+ /**
539
+ * Cancel all events that are still scheduled for this sound.
540
+ */
541
+ unscheduleAll(): void;
542
+
435
543
  /**
436
544
  * Update the array of effects applied to a Sound instance.
437
545
  * Optionally a new array of effects can be assigned. If no effects are passed, the current effects are re-applied.
@@ -458,48 +566,42 @@ declare class Sound extends EventEmitterMixin() {
458
566
  protected _disconnectPipeline(): void;
459
567
 
460
568
  /**
461
- * @deprecated since v12, will be removed in v14
462
- * @remarks "`AudioContainer.LOAD_STATES` is deprecated in favor of {@linkcode Sound.STATES}"
569
+ * @deprecated "`AudioContainer.LOAD_STATES` is deprecated in favor of {@linkcode Sound.STATES}" (since v12, until v14)
463
570
  */
464
571
  static get LOAD_STATES(): Sound.States;
465
572
 
466
573
  /**
467
- * @deprecated since v12, will be removed in v14
468
- * @remarks "`AudioContainer#loadState` is deprecated in favor of {@link Sound._state | `Sound#_state`}"
574
+ * @deprecated "`AudioContainer#loadState` is deprecated in favor of {@linkcode Sound._state | Sound#_state}" (since v12, until v14)
469
575
  */
470
576
  get loadState(): Sound.STATES;
471
577
 
472
578
  /**
473
- * @deprecated since v12, will be removed in v14
474
- * @remarks "`Sound#container` is deprecated without replacement because the `Sound` and `AudioContainer` classes are now merged"
579
+ * @deprecated "`Sound#container` is deprecated without replacement because the `Sound` and `AudioContainer` classes are now merged" (since v12, until v14)
475
580
  */
476
581
  get container(): this;
477
582
 
478
583
  /**
479
- * @deprecated since v12, will be removed in v14
480
- * @remarks "`Sound#node` is renamed {@link Sound.sourceNode | `Sound#sourceNode`}"
584
+ * @deprecated "`Sound#node` is renamed {@linkcode Sound.sourceNode | Sound#sourceNode}" (since v12, until v14)
481
585
  */
482
586
  get node(): this["sourceNode"];
483
587
 
484
588
  /**
485
- * @deprecated since v12, will be removed in v14
486
- * @remarks "`Sound#on` is deprecated in favor of {@link Sound.addEventListener | `Sound#addEventListener`}"
589
+ * @deprecated "`Sound#on` is deprecated in favor of {@linkcode Sound.addEventListener | Sound#addEventListener}" (since v12, until v14)
487
590
  */
488
591
  on(eventName: string, fn: EventEmitterMixin.EventListener, options?: EventEmitterMixin.AddListenerOptions): void;
489
592
 
490
593
  /**
491
- * @deprecated since v12, will be removed in v14
492
- * @remarks "`Sound#off` is deprecated in favor of {@link Sound.removeEventListener | `Sound#removeEventListener`}"
594
+ * @deprecated "`Sound#off` is deprecated in favor of {@linkcode Sound.removeEventListener | Sound#removeEventListener}" (since v12, until v14)
493
595
  */
494
596
  off(eventName: string, fn: EventEmitterMixin.EventListener): void;
495
597
 
496
598
  /**
497
- * @deprecated since v12, will be removed in v14
498
- * @remarks "`Sound#emit` is deprecated in favor of {@link Sound.dispatchEvent | `Sound#dispatchEvent`}"
499
- *
500
- * This method still takes a string, then creates an `Event` with it and passes that along to `dispatchEvent`
599
+ * @deprecated "`Sound#emit` is deprecated in favor of {@linkcode Sound.dispatchEvent | Sound#dispatchEvent}" (since v12, until v14)
600
+ * @remarks This method still takes a string, then creates an `Event` with it and passes that along to `dispatchEvent`
501
601
  */
502
602
  emit(eventName: string): void;
603
+
604
+ #Sound: true;
503
605
  }
504
606
 
505
607
  export default Sound;
@@ -1,4 +1,4 @@
1
- import type { Identity, NullishProps } from "#utils";
1
+ import type { Identity, InexactPartial } from "#utils";
2
2
 
3
3
  /**
4
4
  * A special error class used for cancellation.
@@ -56,6 +56,11 @@ declare class AudioTimeout<CallbackReturn = undefined> {
56
56
  */
57
57
  complete: Promise<CallbackReturn> | undefined;
58
58
 
59
+ /**
60
+ * Is this audio timeout cancelled?
61
+ */
62
+ get cancelled(): boolean;
63
+
59
64
  /**
60
65
  * Cancel an AudioTimeout by ending it early, rejecting its completion promise, and skipping any callback function.
61
66
  */
@@ -72,11 +77,12 @@ declare class AudioTimeout<CallbackReturn = undefined> {
72
77
  * @param options - Additional options which modify timeout behavior
73
78
  * @returns A promise which resolves as a returned value of the callback or void
74
79
  */
75
- // options: not null (destructured where forwarded)
76
80
  static wait<CallbackReturn = undefined>(
77
81
  delayMS: number,
78
82
  options?: AudioTimeout.ConstructorOptions<CallbackReturn>,
79
83
  ): Promise<CallbackReturn>;
84
+
85
+ #AudioTimeout: true;
80
86
  }
81
87
 
82
88
  declare namespace AudioTimeout {
@@ -84,7 +90,7 @@ declare namespace AudioTimeout {
84
90
  interface AnyConstructor extends Identity<typeof AnyAudioTimeout> {}
85
91
 
86
92
  /** @internal */
87
- type _ConstructorOptions<Return = undefined> = NullishProps<{
93
+ type _ConstructorOptions<Return = undefined> = InexactPartial<{
88
94
  /** @defaultValue `game.audio.music` */
89
95
  context: AudioContext;
90
96
 
@@ -173,8 +173,8 @@ declare namespace DoorMesh {
173
173
  * @remarks
174
174
  * - For `swing` and `swivel` it's a linear scale from 0 (no movement) to 2 (180 degrees)
175
175
  * - For `slide` it's door-lengths shifted
176
- * - For `ascend` and `descend` it affects how much the texture grows/shrinks. For `ascend` there's also code in place that implies it should
177
- * affect the texture `alpha` (down to a minimum of `0.6` at strength `2.0`), but it's non-functional as of 13.346: {@link https://github.com/foundryvtt/foundryvtt/issues/13157}
176
+ * - For `ascend` and `descend` it affects how much the texture grows/shrinks, and for `ascend`
177
+ * it also affects the texture `alpha` (down to a minimum of `0.5` at strength `2.0`)
178
178
  */
179
179
  strength: number;
180
180
 
@@ -218,6 +218,7 @@ declare namespace DoorMesh {
218
218
  scaleX: number;
219
219
  scaleY: number;
220
220
  tint: number;
221
+ alpha: number;
221
222
  }
222
223
  }
223
224
 
@@ -94,8 +94,14 @@ declare class RenderFlags<Flags extends RenderFlags.ValidateFlags<Flags>> extend
94
94
  /** @remarks `defineProperty`'d at construction with `enumerable: false, writable: false` and the value frozen. */
95
95
  readonly flags: Readonly<Flags>;
96
96
 
97
- /** @remarks `defineProperty`'d at construction with `enumerable: false, writable: false` */
98
- readonly object: RenderFlagObject;
97
+ /**
98
+ * @remarks `defineProperty`'d at construction with `enumerable: false, writable: false`
99
+ *
100
+ * `| undefined` because Foundry marks both the constructor's `config` parameter and its {@linkcode RenderFlags.Config.object | object}
101
+ * property as optional, but in core usage the only place this is called is in the {@linkcode RenderFlagsObject} constructor, where it's
102
+ * passed `object: this`
103
+ */
104
+ readonly object: RenderFlagObject | undefined;
99
105
 
100
106
  /**
101
107
  * The update priority when these render flags are applied.
@@ -134,13 +140,10 @@ declare namespace RenderFlags {
134
140
 
135
141
  /**
136
142
  * The ticker priority at which these render flags are handled
137
- * @defaultValue {@linkcode PIXI.UPDATE_PRIORITY.OBJECTS}
138
- * @remarks The default value does *not* match the type as of 13.346, this is a core bug: {@link https://github.com/foundryvtt/foundryvtt/issues/13171}.
139
- * Due to this the property has been marked required here, it can go back to optional if the default is fixed.
140
- *
141
- * See {@linkcode RenderFlags.priority | RenderFlags#priority}
143
+ * @defaultValue "OBJECTS"
144
+ * @remarks See {@linkcode RenderFlags.priority | RenderFlags#priority}
142
145
  */
143
- priority: Priority;
146
+ priority?: Priority | undefined;
144
147
  }
145
148
 
146
149
  /**
@@ -1,69 +1,8 @@
1
- import type { AnyObject, Brand, ConcreteKeys, Identity, InterfaceToObject, SimpleMerge } from "#utils";
1
+ import type { AnyObject, Brand, ConcreteKeys, Identity, InterfaceToObject } from "#utils";
2
2
  import type { fields } from "#common/data/_module.d.mts";
3
- import type { AbstractBaseShader } from "#client/canvas/rendering/shaders/_module.d.mts";
4
3
  import type { DataModel } from "#common/abstract/_module.d.mts";
5
4
  import type { PointVisionSource } from "#client/canvas/sources/_module.d.mts";
6
-
7
- declare class ShaderField<
8
- const Options extends ShaderField.Options = ShaderField.DefaultOptions,
9
- const AssignmentType = ShaderField.AssignmentType<Options>,
10
- const InitializedType = ShaderField.InitializedType<Options>,
11
- const PersistedType extends typeof AbstractBaseShader | null | undefined = ShaderField.InitializedType<Options>,
12
- > extends fields.DataField<Options, AssignmentType, InitializedType, PersistedType> {
13
- /**
14
- * @defaultValue
15
- * ```typescript
16
- * const defaults = super._defaults;
17
- * defaults.nullable = true;
18
- * defaults.initial = undefined;
19
- * return defaults;
20
- * ```
21
- */
22
- static override get _defaults(): ShaderField.DefaultOptions;
23
-
24
- /**
25
- * @remarks
26
- * @throws If the value provided is not an {@linkcode AbstractBaseShader} subclass.
27
- */
28
- override _cast(value: unknown): AssignmentType; // typeof AbstractBaseShader;
29
- }
30
-
31
- declare namespace ShaderField {
32
- type Options = fields.DataField.Options<typeof AbstractBaseShader>;
33
-
34
- type DefaultOptions = SimpleMerge<
35
- fields.DataField.DefaultOptions,
36
- {
37
- nullable: true;
38
- initial: undefined;
39
- }
40
- >;
41
-
42
- /**
43
- * A helper type for the given options type merged into the default options of the BooleanField class.
44
- * @template Opts - the options that override the default options
45
- */
46
- type MergedOptions<Opts extends Options> = SimpleMerge<DefaultOptions, Opts>;
47
-
48
- /**
49
- * A shorthand for the assignment type of a BooleanField class.
50
- * @template Opts - the options that override the default options
51
- */
52
- // eslint-disable-next-line @typescript-eslint/no-deprecated
53
- type AssignmentType<Opts extends Options> = fields.DataField.DerivedAssignmentType<
54
- typeof AbstractBaseShader,
55
- MergedOptions<Opts>
56
- >;
57
-
58
- /**
59
- * A shorthand for the initialized type of a BooleanField class.
60
- * @template Opts - the options that override the default options
61
- */
62
- type InitializedType<Opts extends Options> = fields.DataField.DerivedInitializedType<
63
- typeof AbstractBaseShader,
64
- MergedOptions<Opts>
65
- >;
66
- }
5
+ import type { fields as clientFields } from "#client/data/_module.d.mts";
67
6
 
68
7
  /**
69
8
  * A Vision Mode which can be selected for use by a Token.
@@ -161,7 +100,7 @@ declare namespace VisionMode {
161
100
  }
162
101
 
163
102
  interface ShaderSchema extends fields.DataSchema {
164
- shader: ShaderField;
103
+ shader: clientFields.ShaderField;
165
104
  uniforms: fields.ObjectField;
166
105
  }
167
106
 
@@ -204,7 +143,7 @@ declare namespace VisionMode {
204
143
  label: fields.StringField<{ blank: false }>;
205
144
  tokenConfig: fields.BooleanField<{ initial: true }>;
206
145
  canvas: fields.SchemaField<{
207
- shader: ShaderField;
146
+ shader: clientFields.ShaderField;
208
147
  uniforms: fields.ObjectField;
209
148
  }>;
210
149
  lighting: fields.SchemaField<LightingSchema>;
@@ -253,6 +192,12 @@ declare namespace VisionMode {
253
192
  interface SourceData extends fields.SchemaField.SourceData<Schema> {}
254
193
  }
255
194
 
195
+ /**
196
+ * @deprecated "Kept here for full compatibility" (since v13, until v14)
197
+ * @remarks Access via {@linkcode foundry.data.fields.ShaderField} instead
198
+ */
199
+ declare const ShaderField: clientFields.ShaderField;
200
+
256
201
  export { VisionMode as default, ShaderField };
257
202
 
258
203
  declare class AnyVisionMode extends VisionMode {
@@ -8,12 +8,8 @@ import type { PlaceableObject } from "#client/canvas/placeables/_module.d.mts";
8
8
  declare class PrimaryGraphics extends PrimaryCanvasObjectMixin(PIXI.smooth.SmoothGraphics) {
9
9
  /**
10
10
  * @param options - A config object
11
- * @remarks Passing a {@linkcode PIXI.smooth.SmoothGraphicsGeometry} instead of an `options` should be supported here,
12
- * but has been disabled due to a core bug: {@link https://github.com/foundryvtt/foundryvtt/issues/13170}
13
- *
14
- * If you need to pass a specific geometry instead of using a default `new SmoothGraphicsGeometry`, pass it as `options.geometry`.
15
11
  */
16
- constructor(options?: PrimaryGraphics.ConstructorOptions);
12
+ constructor(options?: PrimaryGraphics.ConstructorOptions | PIXI.smooth.SmoothGraphicsGeometry);
17
13
 
18
14
  protected override _calculateCanvasBounds(): void;
19
15
 
@@ -34,9 +30,6 @@ declare namespace PrimaryGraphics {
34
30
  * A geometry passed to the graphics.
35
31
  * @defaultValue {@linkcode PIXI.smooth.SmoothGraphicsGeometry | new PIXI.smooth.SmoothGraphicsGeometry()}
36
32
  * @remarks Default applied in the {@linkcode PIXI.smooth.SmoothGraphics} constructor.
37
- *
38
- * @privateRemarks Foundry types this incorrectly because they didn't update it when they switched base classes:
39
- * {@link https://github.com/foundryvtt/foundryvtt/issues/13170}
40
33
  */
41
34
  geometry: PIXI.smooth.SmoothGraphicsGeometry;
42
35
 
@@ -21,3 +21,4 @@ export { default as VisibilityFilter } from "./visibility.mjs";
21
21
  export { default as VisionMaskFilter } from "./vision-mask-filter.mjs";
22
22
  export { default as VoidFilter } from "./void.mjs";
23
23
  export { default as WeatherOcclusionMaskFilter } from "./weather-occlusion-mask.mjs";
24
+ export { default as AlphaBlurFilter, AlphaBlurFilterPass } from "./blur.mjs";