@league-of-foundry-developers/foundry-vtt-types 13.345.1 → 13.346.0-beta.20250704113344
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/README.md +4 -32
- package/package.json +1 -1
- package/src/foundry/client/applications/dice/roll-resolver.d.mts +41 -11
- package/src/foundry/client/applications/ux/context-menu.d.mts +1 -1
- package/src/foundry/client/documents/active-effect.d.mts +1 -3
- package/src/foundry/client/documents/card.d.mts +24 -6
- package/src/foundry/client/documents/macro.d.mts +1 -0
- package/src/foundry/common/data/data.d.mts +3 -1
- package/src/foundry/common/data/fields.d.mts +20 -6
- package/src/foundry/common/documents/drawing.d.mts +2 -0
- package/src/foundry/common/documents/fog-exploration.d.mts +1 -1
package/README.md
CHANGED
@@ -23,7 +23,7 @@ AI cannot be provided the source of Foundry VTT Types. This is because Foundry V
|
|
23
23
|
|
24
24
|
## V13 Installation
|
25
25
|
|
26
|
-
Currently v13 is still in beta. There are known bugs, issues in the ergonomics, and
|
26
|
+
Currently v13 is still in beta. There are known bugs, issues in the ergonomics, and unfinished work in the current implementation. To get a direct line of communication about the current status of development as well as to help us understand what areas need to be prioritized first, join the [League of Extraordinary FoundryVTT Developers Discord](https://discord.gg/73HTMuK7dT) or file an issue.
|
27
27
|
|
28
28
|
The recommended way to install for v13 is this command:
|
29
29
|
|
@@ -31,15 +31,15 @@ The recommended way to install for v13 is this command:
|
|
31
31
|
npm add -D fvtt-types@github:League-of-Foundry-Developers/foundry-vtt-types#main
|
32
32
|
```
|
33
33
|
|
34
|
-
|
34
|
+
The command for other package managers is similar, for example with yarn you'll need to use the command `yarn add --dev fvtt-types@github:League-of-Foundry-Developers/foundry-vtt-types#main`.
|
35
35
|
|
36
|
-
This will add the current commit on `main` as a dependency.
|
36
|
+
This will add the current commit on `main` as a dependency. Every popular package manager has a lockfile which will store the commit you initially installed this command and so updates to your dependency will not happen automatically or even after a fresh install. To update you will need to be rerun the prior command periodically to update as improvements are added frequently.
|
37
37
|
|
38
38
|
## Installation
|
39
39
|
|
40
40
|
You can install historical versions of foundry-vtt-types from the [npm registry](https://npmjs.org/).
|
41
41
|
|
42
|
-
In order to install the latest stable version
|
42
|
+
In order to install the latest stable version, run
|
43
43
|
|
44
44
|
```sh
|
45
45
|
npm add --save-dev fvtt-types@npm:@league-of-foundry-developers/foundry-vtt-types
|
@@ -126,34 +126,6 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for more details on how to contri
|
|
126
126
|
If you have any specific questions, feel free to contact us in the
|
127
127
|
[League of Extraordinary Foundry Developers Discord](https://discord.gg/52DNPzqm2Z).
|
128
128
|
|
129
|
-
## Type-Checking, Linting, Testing
|
130
|
-
|
131
|
-
When contributing, make sure that the type checks pass, the linter is green and the tests are green. We _do_ have
|
132
|
-
checks in the CI but running this locally also helps you while developing and saves you time as you don't have to wait
|
133
|
-
for the CI.
|
134
|
-
|
135
|
-
You can run type checking and linting with the following command:
|
136
|
-
|
137
|
-
```shell
|
138
|
-
npm run lint
|
139
|
-
```
|
140
|
-
|
141
|
-
You can run the tests with
|
142
|
-
|
143
|
-
```shell
|
144
|
-
npm run test
|
145
|
-
```
|
146
|
-
|
147
|
-
## Creating a release
|
148
|
-
|
149
|
-
To create a release, you have to create a new release commit, tag it and create a GitHub release from that. The CI will
|
150
|
-
handle the rest.
|
151
|
-
|
152
|
-
```shell
|
153
|
-
npm version <release-type>
|
154
|
-
git push --follow-tags
|
155
|
-
```
|
156
|
-
|
157
129
|
## License
|
158
130
|
|
159
131
|
This project is licensed under the MIT license. You can find a copy at [LICENSE](LICENSE).
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
3
3
|
"name": "@league-of-foundry-developers/foundry-vtt-types",
|
4
|
-
"version": "13.
|
4
|
+
"version": "13.346.0-beta.20250704113344",
|
5
5
|
"description": "TypeScript type definitions for Foundry VTT",
|
6
6
|
"type": "module",
|
7
7
|
"types": "./src/index.d.mts",
|
@@ -1,7 +1,9 @@
|
|
1
|
-
import type { DeepPartial,
|
1
|
+
import type { DeepPartial, Identity } from "#utils";
|
2
2
|
import type ApplicationV2 from "../api/application.d.mts";
|
3
3
|
import type HandlebarsApplicationMixin from "../api/handlebars-application.d.mts";
|
4
4
|
|
5
|
+
import DiceTerm = foundry.dice.terms.DiceTerm;
|
6
|
+
|
5
7
|
declare module "#configuration" {
|
6
8
|
namespace Hooks {
|
7
9
|
interface ApplicationV2Config {
|
@@ -14,7 +16,7 @@ declare module "#configuration" {
|
|
14
16
|
* An application responsible for handling unfulfilled dice terms in a roll.
|
15
17
|
*/
|
16
18
|
declare class RollResolver<
|
17
|
-
RenderContext extends RollResolver.RenderContext =
|
19
|
+
RenderContext extends RollResolver.RenderContext = RollResolver.RenderContext,
|
18
20
|
Configuration extends RollResolver.Configuration = RollResolver.Configuration,
|
19
21
|
RenderOptions extends RollResolver.RenderOptions = RollResolver.RenderOptions,
|
20
22
|
> extends HandlebarsApplicationMixin(ApplicationV2)<RenderContext, Configuration, RenderOptions> {
|
@@ -58,13 +60,7 @@ declare class RollResolver<
|
|
58
60
|
resolveResult(
|
59
61
|
term: foundry.dice.terms.DiceTerm,
|
60
62
|
method: string,
|
61
|
-
options?:
|
62
|
-
/** @defaultValue `false` */
|
63
|
-
reroll: boolean;
|
64
|
-
|
65
|
-
/** @defaultValue `false` */
|
66
|
-
explode: boolean;
|
67
|
-
}>,
|
63
|
+
options?: RollResolver.ResolveResultOptions,
|
68
64
|
): Promise<number | void>;
|
69
65
|
|
70
66
|
/**
|
@@ -102,16 +98,50 @@ declare namespace RollResolver {
|
|
102
98
|
interface Any extends AnyRollResolver {}
|
103
99
|
interface AnyConstructor extends Identity<typeof AnyRollResolver> {}
|
104
100
|
|
105
|
-
interface RenderContext
|
101
|
+
interface RenderContext {
|
102
|
+
formula: string;
|
103
|
+
groups: Record<string, Group>;
|
104
|
+
}
|
105
|
+
|
106
106
|
interface Configuration extends HandlebarsApplicationMixin.Configuration, ApplicationV2.Configuration {}
|
107
107
|
interface RenderOptions extends HandlebarsApplicationMixin.RenderOptions, ApplicationV2.RenderOptions {}
|
108
108
|
|
109
|
+
interface Group {
|
110
|
+
results: Result[];
|
111
|
+
label: string;
|
112
|
+
icon: string;
|
113
|
+
tooltip: string;
|
114
|
+
}
|
115
|
+
|
116
|
+
interface Result {
|
117
|
+
denomination: DiceTerm.Any;
|
118
|
+
faces: DiceTerm.Any;
|
119
|
+
id: string;
|
120
|
+
method: string;
|
121
|
+
icon: string;
|
122
|
+
exploded: boolean | undefined;
|
123
|
+
rerolled: boolean | undefined;
|
124
|
+
isNew: boolean | undefined;
|
125
|
+
// Note(LukeAbby): The logic here is a bit suspicious.
|
126
|
+
value: string | number;
|
127
|
+
readonly: boolean;
|
128
|
+
disabled: boolean;
|
129
|
+
}
|
130
|
+
|
109
131
|
interface DiceTermFulfillmentDescriptor {
|
110
132
|
id: string;
|
111
|
-
term:
|
133
|
+
term: DiceTerm;
|
112
134
|
method: string;
|
113
135
|
isNew?: boolean | undefined;
|
114
136
|
}
|
137
|
+
|
138
|
+
interface ResolveResultOptions {
|
139
|
+
/** @defaultValue `false` */
|
140
|
+
reroll?: boolean | undefined;
|
141
|
+
|
142
|
+
/** @defaultValue `false` */
|
143
|
+
explode?: boolean | undefined;
|
144
|
+
}
|
115
145
|
}
|
116
146
|
|
117
147
|
declare abstract class AnyRollResolver extends RollResolver<
|
@@ -48,7 +48,7 @@ declare class ContextMenu<UsesJQuery extends boolean = true> {
|
|
48
48
|
html: HTMLElement | JQuery,
|
49
49
|
selector: string,
|
50
50
|
menuItems: ContextMenu.Entry<ContextMenu.JQueryOrHTML<UsesJQuery>>[],
|
51
|
-
options
|
51
|
+
options?: Omit<ContextMenu.CreateOptions<boolean>, "jQuery"> & { jQuery?: boolean | undefined },
|
52
52
|
): ContextMenu<Coalesce<UsesJQuery, true>>;
|
53
53
|
|
54
54
|
/**
|
@@ -625,14 +625,12 @@ declare namespace ActiveEffect {
|
|
625
625
|
/**
|
626
626
|
* The modification mode with which the change is applied
|
627
627
|
* @defaultValue `CONST.ACTIVE_EFFECT_MODES.ADD`
|
628
|
-
* @privateRemarks `undefined` is not actually a possible value, included here due to fvtt-types handling of `initial` values
|
629
628
|
*/
|
630
|
-
mode: CONST.ACTIVE_EFFECT_MODES
|
629
|
+
mode: CONST.ACTIVE_EFFECT_MODES;
|
631
630
|
|
632
631
|
/**
|
633
632
|
* The priority level with which this change is applied
|
634
633
|
* @defaultValue `null`
|
635
|
-
* @privateRemarks `undefined` is not actually a possible value, included here due to fvtt-types handling of `initial` values
|
636
634
|
*/
|
637
635
|
priority: number | null | undefined;
|
638
636
|
}
|
@@ -508,19 +508,37 @@ declare namespace Card {
|
|
508
508
|
interface CreateDialogOptions extends Document.CreateDialogOptions<Name> {}
|
509
509
|
|
510
510
|
/**
|
511
|
-
* @remarks {@link Card.pass | `Card#pass`} calls {@link Cards.pass | `this.parent.pass`} with `action: "pass"` provided
|
511
|
+
* @remarks {@link Card.pass | `Card#pass`} calls {@link Cards.pass | `this.parent.pass`} with `action: "pass"` provided by default.
|
512
512
|
*/
|
513
|
-
interface PassOptions extends
|
513
|
+
interface PassOptions extends Cards.PassOptions {
|
514
|
+
/**
|
515
|
+
* @deprecated While passing `action` is technically valid, it's unclear why this would ever be done.
|
516
|
+
* If you need to do this call `this.parent.pass` directly.
|
517
|
+
*/
|
518
|
+
action?: never;
|
519
|
+
}
|
514
520
|
|
515
521
|
/**
|
516
|
-
* @remarks {@link Card.play | `Card#play`} calls {@link Cards.pass | `this.parent.pass`} with `action: "play"` provided
|
522
|
+
* @remarks {@link Card.play | `Card#play`} calls {@link Cards.pass | `this.parent.pass`} with `action: "play"` provided by default.
|
517
523
|
*/
|
518
|
-
interface PlayOptions extends PassOptions {
|
524
|
+
interface PlayOptions extends Cards.PassOptions {
|
525
|
+
/**
|
526
|
+
* @deprecated While passing `action` is technically valid, it's unclear why this would ever be done.
|
527
|
+
* If you need to do this call `this.parent.pass` directly.
|
528
|
+
*/
|
529
|
+
action?: never;
|
530
|
+
}
|
519
531
|
|
520
532
|
/**
|
521
|
-
* @remarks {@link Card.discard | `Card#discard`} calls {@link Cards.pass | `this.parent.pass`} with `action: "discard"` provided
|
533
|
+
* @remarks {@link Card.discard | `Card#discard`} calls {@link Cards.pass | `this.parent.pass`} with `action: "discard"` provided by default.
|
522
534
|
*/
|
523
|
-
interface DiscardOptions extends PassOptions {
|
535
|
+
interface DiscardOptions extends Cards.PassOptions {
|
536
|
+
/**
|
537
|
+
* @deprecated While passing `action` is technically valid, it's unclear why this would ever be done.
|
538
|
+
* If you need to do this call `this.parent.pass` directly.
|
539
|
+
*/
|
540
|
+
action?: never;
|
541
|
+
}
|
524
542
|
|
525
543
|
/**
|
526
544
|
* The arguments to construct the document.
|
@@ -502,6 +502,7 @@ declare namespace Macro {
|
|
502
502
|
// just to return `undefined`.
|
503
503
|
type ExecuteReturn<SubType extends Macro.SubType> =
|
504
504
|
| (SubType extends "chat" ? Promise<ChatMessage.Implementation | undefined | void> : never)
|
505
|
+
// Note(LukeAbby): As of 13.346 this `| void` is only possible if there's a syntax error in the function.
|
505
506
|
| (SubType extends "script" ? Promise<unknown> | void : never);
|
506
507
|
|
507
508
|
/**
|
@@ -452,7 +452,9 @@ declare namespace TextureData {
|
|
452
452
|
/** The parameter defaults for `srcOptions` in the {@link TextureData} constructor */
|
453
453
|
interface DefaultOptions {
|
454
454
|
categories: ["IMAGE", "VIDEO"];
|
455
|
-
|
455
|
+
// Avoid using `EmptyObject` as that creates a broken index signature.
|
456
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
457
|
+
initial: {};
|
456
458
|
wildcard: false;
|
457
459
|
label: "";
|
458
460
|
}
|
@@ -658,7 +658,7 @@ declare namespace DataField {
|
|
658
658
|
: // when not required, undefined can safely be passed
|
659
659
|
undefined)
|
660
660
|
| ("initial" extends keyof Options
|
661
|
-
? _Has<Options["initial"], null | undefined> extends true
|
661
|
+
? _Has<Options["initial"], null | undefined | ((...args: never) => null | undefined)> extends true
|
662
662
|
? never
|
663
663
|
: null | undefined // when initial is not `undefined` then `null | undefined` are valid.
|
664
664
|
: never);
|
@@ -673,8 +673,19 @@ declare namespace DataField {
|
|
673
673
|
*/
|
674
674
|
type DerivedInitializedType<BaseInitializedType, Options extends DataField.Options.Any> =
|
675
675
|
| Exclude<BaseInitializedType, null | undefined>
|
676
|
-
|
|
677
|
-
| (Options["
|
676
|
+
| _DerivedUndefined<GetKey<Options, "initial", undefined>, GetKey<Options, "required", undefined>>
|
677
|
+
| (Options["nullable"] extends true ? null : never);
|
678
|
+
|
679
|
+
/** @internal */
|
680
|
+
type _DerivedUndefined<Initial, Required extends boolean | undefined> = Required extends true
|
681
|
+
? never // If `required: true` then `undefined` is not possible.
|
682
|
+
: Initial extends undefined
|
683
|
+
? undefined // If `required: false` and `initial: undefined` then it passes through.
|
684
|
+
: Initial extends (...args: never) => infer Result
|
685
|
+
? Result extends undefined
|
686
|
+
? undefined // Passes through `undefined` if the function returns `undefined`. Should this match the case of `() => unknown`?
|
687
|
+
: never
|
688
|
+
: never;
|
678
689
|
|
679
690
|
/**
|
680
691
|
* A shorthand for the assignment type of a DataField class.
|
@@ -1828,7 +1839,10 @@ declare namespace StringField {
|
|
1828
1839
|
* A helper type for the given options type merged into the default options of the StringField class.
|
1829
1840
|
* @template Options - the options that override the default options
|
1830
1841
|
*/
|
1831
|
-
type MergedOptions<Options extends StringField.Options<unknown>> = SimpleMerge<
|
1842
|
+
type MergedOptions<Options extends StringField.Options<unknown>> = SimpleMerge<DefaultOptions, Options>;
|
1843
|
+
|
1844
|
+
/** @internal */
|
1845
|
+
type _EffectiveOptions<Options extends StringField.Options<unknown>> = SimpleMerge<
|
1832
1846
|
_OptionsForInitial<_OptionsForChoices<Options["choices"]>>,
|
1833
1847
|
Options
|
1834
1848
|
>;
|
@@ -1877,7 +1891,7 @@ declare namespace StringField {
|
|
1877
1891
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
1878
1892
|
type AssignmentType<Options extends StringField.Options<unknown>> = DataField.DerivedAssignmentType<
|
1879
1893
|
ValidChoice<Options>,
|
1880
|
-
|
1894
|
+
_EffectiveOptions<Options>
|
1881
1895
|
>;
|
1882
1896
|
|
1883
1897
|
/**
|
@@ -1887,7 +1901,7 @@ declare namespace StringField {
|
|
1887
1901
|
type InitializedType<Options extends StringField.Options<unknown>> = DataField.DerivedInitializedType<
|
1888
1902
|
// TODO(LukeAbby): This is a workaround for how `ValidChoice` is defined ignorant of the `StringField`/`NumberField` divide.
|
1889
1903
|
ValidChoice<Options> & (string | null | undefined),
|
1890
|
-
|
1904
|
+
_EffectiveOptions<Options>
|
1891
1905
|
>;
|
1892
1906
|
|
1893
1907
|
type BaseChoices =
|
@@ -24,6 +24,8 @@ declare abstract class BaseDrawing extends Document<"Drawing", BaseDrawing.Schem
|
|
24
24
|
* You should use {@link DrawingDocument.implementation | `new DrawingDocument.implementation(...)`} instead which will give you
|
25
25
|
* a system specific implementation of `DrawingDocument`.
|
26
26
|
*/
|
27
|
+
// Note(LukeAbby): Required because while `DrawingDocument` has no directly required schema
|
28
|
+
// properties the `validateJoint` method will fail.
|
27
29
|
constructor(data: DrawingDocument.CreateData, context?: DrawingDocument.ConstructionContext);
|
28
30
|
|
29
31
|
/**
|
@@ -23,7 +23,7 @@ declare abstract class BaseFogExploration extends Document<"FogExploration", Bas
|
|
23
23
|
* You should use {@link FogExploration.implementation | `new FogExploration.implementation(...)`} instead which will give you
|
24
24
|
* a system specific implementation of `FogExploration`.
|
25
25
|
*/
|
26
|
-
constructor(data
|
26
|
+
constructor(data?: FogExploration.CreateData, context?: FogExploration.ConstructionContext);
|
27
27
|
|
28
28
|
/**
|
29
29
|
* @defaultValue
|