@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.
- package/package.json +1 -1
- package/src/configuration/configuration.d.mts +4 -6
- package/src/configuration/globals.d.mts +1 -1
- package/src/foundry/client/_types.d.mts +2 -2
- package/src/foundry/client/applications/ui/scene-controls.d.mts +52 -2
- package/src/foundry/client/audio/_types.d.mts +11 -0
- package/src/foundry/client/audio/biquad.d.mts +7 -9
- package/src/foundry/client/audio/cache.d.mts +3 -2
- package/src/foundry/client/audio/convolver.d.mts +2 -6
- package/src/foundry/client/audio/helper.d.mts +263 -87
- package/src/foundry/client/audio/sound.d.mts +172 -70
- package/src/foundry/client/audio/timeout.d.mts +9 -3
- package/src/foundry/client/canvas/containers/elements/door-mesh.d.mts +3 -2
- package/src/foundry/client/canvas/interaction/render-flags.d.mts +11 -8
- package/src/foundry/client/canvas/perception/vision-mode.d.mts +10 -65
- package/src/foundry/client/canvas/primary/primary-graphics.d.mts +1 -8
- package/src/foundry/client/canvas/rendering/filters/_module.d.mts +1 -0
- package/src/foundry/client/canvas/rendering/shaders/base-shader.d.mts +7 -0
- package/src/foundry/client/client.d.mts +24 -0
- package/src/foundry/client/data/_module.d.mts +4 -2
- package/src/foundry/client/data/_types.d.mts +11 -0
- package/src/foundry/client/data/fields.d.mts +72 -0
- package/src/foundry/client/documents/abstract/canvas-document.d.mts +1 -1
- package/src/foundry/client/documents/abstract/client-document.d.mts +31 -6
- package/src/foundry/client/documents/actor.d.mts +3 -2
- package/src/foundry/client/documents/collections/compendium-collection.d.mts +111 -50
- package/src/foundry/client/documents/token.d.mts +6 -0
- package/src/foundry/client/helpers/localization.d.mts +2 -37
- package/src/foundry/client/packages/system.d.mts +5 -5
- package/src/foundry/client/utils/_module.d.mts +6 -5
- package/src/foundry/common/abstract/data.d.mts +87 -3
- package/src/foundry/common/abstract/embedded-collection.d.mts +5 -4
- package/src/foundry/common/abstract/type-data.d.mts +53 -11
- package/src/foundry/common/data/fields.d.mts +15 -1
- package/src/foundry/common/packages/_module.d.mts +2 -2
- package/src/foundry/common/packages/base-package.d.mts +12 -3
- package/src/foundry/common/packages/sub-types.d.mts +6 -3
@@ -11,6 +11,13 @@ declare abstract class AbstractBaseShader extends BaseShaderMixin(PIXI.Shader) {
|
|
11
11
|
*/
|
12
12
|
constructor(program: PIXI.Program, uniforms?: AbstractBaseShader.Uniforms);
|
13
13
|
|
14
|
+
/**
|
15
|
+
* Identify this class to be compatible with ShaderField
|
16
|
+
* @internal
|
17
|
+
* @remarks This is `defineProperty`'d on the class after its definition, with `writable: false, enumerable: false, configurable: false`
|
18
|
+
*/
|
19
|
+
protected static readonly _isShaderFieldCompatible: true;
|
20
|
+
|
14
21
|
/**
|
15
22
|
* The raw vertex shader used by this class.
|
16
23
|
* A subclass of AbstractBaseShader must implement the vertexShader static field.
|
@@ -1124,6 +1124,12 @@ declare global {
|
|
1124
1124
|
*/
|
1125
1125
|
export import CanvasVisionMask = foundry.canvas.layers.CanvasVisionMask;
|
1126
1126
|
|
1127
|
+
/**
|
1128
|
+
* @deprecated "You are accessing the global {@linkcode DarknessLevelContainer} which is now namespaced under {@linkcode foundry.canvas.layers.DarknessLevelContainer}"
|
1129
|
+
* (since v13 will be removed in v15)
|
1130
|
+
*/
|
1131
|
+
export import DarknessLevelContainer = foundry.canvas.layers.DarknessLevelContainer;
|
1132
|
+
|
1127
1133
|
/**
|
1128
1134
|
* @deprecated "You are accessing the global {@linkcode DrawingsLayer} which is now namespaced under {@linkcode foundry.canvas.layers.DrawingsLayer}"
|
1129
1135
|
* (since v13 will be removed in v15)
|
@@ -1256,6 +1262,12 @@ declare global {
|
|
1256
1262
|
*/
|
1257
1263
|
export import UnboundTransform = foundry.canvas.geometry.UnboundTransform;
|
1258
1264
|
|
1265
|
+
/**
|
1266
|
+
* @deprecated "You are accessing the global {@linkcode ObservableTransform} which is now namespaced under {@linkcode foundry.canvas.geometry.ObservableTransform}"
|
1267
|
+
* (since v13 will be removed in v15)
|
1268
|
+
*/
|
1269
|
+
export import ObservableTransform = foundry.canvas.geometry.ObservableTransform;
|
1270
|
+
|
1259
1271
|
/**
|
1260
1272
|
* @deprecated "You are accessing the global {@linkcode LimitedAnglePolygon} which is now namespaced under {@linkcode foundry.canvas.geometry.LimitedAnglePolygon}"
|
1261
1273
|
* (since v13 will be removed in v15)
|
@@ -1592,6 +1604,18 @@ declare global {
|
|
1592
1604
|
*/
|
1593
1605
|
export import VoidFilter = foundry.canvas.rendering.filters.VoidFilter;
|
1594
1606
|
|
1607
|
+
/**
|
1608
|
+
* @deprecated "You are accessing the global {@linkcode AlphaBlurFilter} which is now namespaced under {@linkcode foundry.canvas.rendering.filters.AlphaBlurFilter}"
|
1609
|
+
* (since v13 will be removed in v15)
|
1610
|
+
*/
|
1611
|
+
export import AlphaBlurFilter = foundry.canvas.rendering.filters.AlphaBlurFilter;
|
1612
|
+
|
1613
|
+
/**
|
1614
|
+
* @deprecated "You are accessing the global {@linkcode AlphaBlurFilterPass} which is now namespaced under {@linkcode foundry.canvas.rendering.filters.AlphaBlurFilterPass}"
|
1615
|
+
* (since v13 will be removed in v15)
|
1616
|
+
*/
|
1617
|
+
export import AlphaBlurFilterPass = foundry.canvas.rendering.filters.AlphaBlurFilterPass;
|
1618
|
+
|
1595
1619
|
/**
|
1596
1620
|
* @deprecated "You are accessing the global {@linkcode WeatherOcclusionMaskFilter} which is now namespaced under {@linkcode foundry.canvas.rendering.filters.WeatherOcclusionMaskFilter}"
|
1597
1621
|
* (since v13 will be removed in v15)
|
@@ -3,11 +3,13 @@
|
|
3
3
|
// While `.mts` could work, to avoid `import-x/no-unresolved` from erroring `.mjs` is used.
|
4
4
|
/* eslint-disable import-x/extensions */
|
5
5
|
|
6
|
-
|
6
|
+
export * as types from "./_types.mjs";
|
7
7
|
export * from "#common/data/_module.mjs";
|
8
8
|
export * as regionBehaviors from "./region-behaviors/_module.mjs";
|
9
9
|
export * as regionShapes from "./region-shapes/_module.mjs";
|
10
|
+
export * as fields from "./fields.mjs";
|
10
11
|
export * from "./terrain-data.mjs";
|
11
12
|
export { default as CombatConfiguration } from "./combat-config.mjs";
|
12
13
|
export { default as ClientDatabaseBackend } from "./client-backend.mjs";
|
13
|
-
export { default as CalendarData
|
14
|
+
export { default as CalendarData } from "./calendar.mjs";
|
15
|
+
export * from "./calendar.mjs";
|
@@ -8,3 +8,14 @@
|
|
8
8
|
import type CombatConfiguration from "./combat-config.d.mts";
|
9
9
|
|
10
10
|
type CombatConfigurationData = CombatConfiguration.Data;
|
11
|
+
type CalendarConfig = unknown;
|
12
|
+
type CalendarConfigYears = unknown;
|
13
|
+
type CalendarConfigLeapYear = unknown;
|
14
|
+
type CalendarConfigMonths = unknown;
|
15
|
+
type CalendarConfigMonth = unknown;
|
16
|
+
type CalendarConfigDays = unknown;
|
17
|
+
type CalendarConfigDay = unknown;
|
18
|
+
type CalendarConfigSeasons = unknown;
|
19
|
+
type CalendarConfigSeason = unknown;
|
20
|
+
type TimeComponents = unknown;
|
21
|
+
type TimeFormatter = unknown;
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import type { SimpleMerge } from "#utils";
|
2
|
+
import type { fields } from "#common/data/_module.d.mts";
|
3
|
+
import type { AbstractBaseShader } from "#client/canvas/rendering/shaders/_module.d.mts";
|
4
|
+
|
5
|
+
declare class ShaderField<
|
6
|
+
const Options extends ShaderField.Options = ShaderField.DefaultOptions,
|
7
|
+
const AssignmentType = ShaderField.AssignmentType<Options>,
|
8
|
+
const InitializedType = ShaderField.InitializedType<Options>,
|
9
|
+
const PersistedType extends typeof AbstractBaseShader | null | undefined = ShaderField.InitializedType<Options>,
|
10
|
+
> extends fields.DataField<Options, AssignmentType, InitializedType, PersistedType> {
|
11
|
+
/**
|
12
|
+
* @defaultValue
|
13
|
+
* ```typescript
|
14
|
+
* const defaults = super._defaults;
|
15
|
+
* defaults.nullable = true;
|
16
|
+
* defaults.initial = undefined;
|
17
|
+
* return defaults;
|
18
|
+
* ```
|
19
|
+
*/
|
20
|
+
static override get _defaults(): ShaderField.DefaultOptions;
|
21
|
+
|
22
|
+
/**
|
23
|
+
* @remarks
|
24
|
+
* @throws If the value provided is not an {@linkcode AbstractBaseShader} subclass.
|
25
|
+
*/
|
26
|
+
override _cast(value: unknown): AssignmentType; // typeof AbstractBaseShader;
|
27
|
+
}
|
28
|
+
|
29
|
+
declare namespace ShaderField {
|
30
|
+
type Options = fields.DataField.Options<typeof AbstractBaseShader>;
|
31
|
+
|
32
|
+
type DefaultOptions = SimpleMerge<
|
33
|
+
fields.DataField.DefaultOptions,
|
34
|
+
{
|
35
|
+
nullable: true;
|
36
|
+
initial: undefined;
|
37
|
+
}
|
38
|
+
>;
|
39
|
+
|
40
|
+
/**
|
41
|
+
* A helper type for the given options type merged into the default options of the BooleanField class.
|
42
|
+
* @template Opts - the options that override the default options
|
43
|
+
*/
|
44
|
+
type MergedOptions<Opts extends Options> = SimpleMerge<DefaultOptions, Opts>;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* A shorthand for the assignment type of a BooleanField class.
|
48
|
+
* @template Opts - the options that override the default options
|
49
|
+
*/
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
51
|
+
type AssignmentType<Opts extends Options> = fields.DataField.DerivedAssignmentType<
|
52
|
+
typeof AbstractBaseShader,
|
53
|
+
MergedOptions<Opts>
|
54
|
+
>;
|
55
|
+
|
56
|
+
/**
|
57
|
+
* A shorthand for the initialized type of a BooleanField class.
|
58
|
+
* @template Opts - the options that override the default options
|
59
|
+
*/
|
60
|
+
type InitializedType<Opts extends Options> = fields.DataField.DerivedInitializedType<
|
61
|
+
typeof AbstractBaseShader,
|
62
|
+
MergedOptions<Opts>
|
63
|
+
>;
|
64
|
+
}
|
65
|
+
|
66
|
+
export { ShaderField };
|
67
|
+
|
68
|
+
/**
|
69
|
+
* @remarks The `export * as fields` in `./_module.mjs` overwrites the re-export of `common/data/_module.mjs`'s `fields`,
|
70
|
+
* so the common fields are also re-exported here. This matches how Foundry's exports are handled.
|
71
|
+
*/
|
72
|
+
export * from "#common/data/fields.mjs";
|
@@ -53,7 +53,7 @@ declare function CanvasDocumentMixin<BaseClass extends CanvasDocumentMixin.BaseC
|
|
53
53
|
): CanvasDocumentMixin.Mix<BaseClass>;
|
54
54
|
|
55
55
|
declare namespace CanvasDocumentMixin {
|
56
|
-
interface AnyMixedConstructor extends ReturnType<typeof foundry.documents.abstract.
|
56
|
+
interface AnyMixedConstructor extends ReturnType<typeof foundry.documents.abstract.CanvasDocumentMixin<BaseClass>> {}
|
57
57
|
interface AnyMixed extends FixedInstanceType<AnyMixedConstructor> {}
|
58
58
|
|
59
59
|
type Mix<BaseClass extends CanvasDocumentMixin.BaseClass> = Mixin<
|
@@ -15,7 +15,7 @@ import type ApplicationV2 from "#client/applications/api/application.d.mts";
|
|
15
15
|
import type TextEditor from "#client/applications/ux/text-editor.mjs";
|
16
16
|
|
17
17
|
declare class InternalClientDocument<DocumentName extends Document.Type> {
|
18
|
-
/** @privateRemarks All mixin
|
18
|
+
/** @privateRemarks All mixin classes should accept anything for its constructor. */
|
19
19
|
constructor(...args: any[]);
|
20
20
|
|
21
21
|
/**
|
@@ -117,15 +117,35 @@ declare class InternalClientDocument<DocumentName extends Document.Type> {
|
|
117
117
|
protected _safePrepareData(): void;
|
118
118
|
|
119
119
|
/**
|
120
|
-
* Prepare data for the Document. This method
|
121
|
-
*
|
122
|
-
* The work done by this method should be idempotent
|
123
|
-
* than once.
|
120
|
+
* Prepare data for the Document. This method provides an opportunity for Document classes to define special data
|
121
|
+
* preparation logic to compute values that don't need to be stored in the database, such as a "bloodied" hp value
|
122
|
+
* or the total carrying weight of items. The work done by this method should be idempotent per initialization.
|
123
|
+
* There are situations in which prepareData may be called more than once.
|
124
|
+
*
|
125
|
+
* By default, foundry calls the following methods in order whenever the document is created or updated.
|
126
|
+
* 1. {@linkcode foundry.abstract.DataModel.reset | reset} (Inherited from DataModel)
|
127
|
+
* 2. {@linkcode _initialize} (Inherited from DataModel)
|
128
|
+
* 3. {@linkcode prepareData}
|
129
|
+
* 4. {@linkcode foundry.abstract.TypeDataModel.prepareBaseData | TypeDataModel#prepareBaseData}
|
130
|
+
* 5. {@linkcode prepareBaseData}
|
131
|
+
* 6. {@linkcode prepareEmbeddedDocuments}
|
132
|
+
* 7. {@linkcode foundry.abstract.TypeDataModel.prepareDerivedData | TypeDataModel#prepareBaseData}
|
133
|
+
* 8. {@linkcode prepareDerivedData}
|
134
|
+
*
|
135
|
+
* Do NOT invoke database operations like {@linkcode Document.update | update} or {@linkcode Document.setFlag | setFlag} within data prep, as that can cause an
|
136
|
+
* infinite loop by re-triggering the data initialization process.
|
137
|
+
*
|
138
|
+
* If possible you should extend {@linkcode prepareBaseData} and {@linkcode prepareDerivedData} instead of this function
|
139
|
+
* directly, but some systems with more complicated calculations may want to override this function to add extra
|
140
|
+
* steps, such as to calculate certain item values after actor data prep.
|
124
141
|
*/
|
125
142
|
prepareData(): void;
|
126
143
|
|
127
144
|
/**
|
128
145
|
* Prepare data related to this Document itself, before any embedded Documents or derived data is computed.
|
146
|
+
*
|
147
|
+
* If possible when modifying the `system` object you should use {@linkcode foundry.abstract.TypeDataModel.prepareBaseData | TypeDataModel#prepareBaseData} on
|
148
|
+
* your data models instead of this method directly on the document.
|
129
149
|
*/
|
130
150
|
prepareBaseData(): void;
|
131
151
|
|
@@ -497,11 +517,16 @@ declare const _ClientDocument: _ClientDocumentType;
|
|
497
517
|
// FIXME(LukeAbby): Unlike most mixins, `ClientDocumentMixin` actually requires a specific constructor, the same as `Document`.
|
498
518
|
// This means that `BaseClass extends Document.Internal.Constructor` is actually too permissive.
|
499
519
|
// However this easily leads to circularities.
|
500
|
-
declare function ClientDocumentMixin<BaseClass extends
|
520
|
+
declare function ClientDocumentMixin<BaseClass extends ClientDocumentMixin.BaseClass>(
|
501
521
|
Base: BaseClass,
|
502
522
|
): ClientDocumentMixin.Mix<BaseClass>;
|
503
523
|
|
504
524
|
declare namespace ClientDocumentMixin {
|
525
|
+
interface AnyMixedConstructor extends ReturnType<typeof foundry.documents.abstract.ClientDocumentMixin<BaseClass>> {}
|
526
|
+
interface AnyMixed extends FixedInstanceType<AnyMixedConstructor> {}
|
527
|
+
|
528
|
+
type BaseClass = Document.Internal.Constructor;
|
529
|
+
|
505
530
|
type Mix<BaseClass extends Document.Internal.Constructor> = Mixin<
|
506
531
|
typeof InternalClientDocument<Document.NameFor<BaseClass>>,
|
507
532
|
BaseClass
|
@@ -696,8 +696,9 @@ declare class Actor<out SubType extends Actor.SubType = Actor.SubType> extends f
|
|
696
696
|
protected override _configure(options?: Document.ConfigureOptions): void;
|
697
697
|
|
698
698
|
/**
|
699
|
-
* Maintain a list of Token Documents that represent this Actor, stored by Scene.
|
700
|
-
*
|
699
|
+
* Maintain a list of Token Documents that represent this Actor, stored by Scene. This list may include unpersisted
|
700
|
+
* Token Documents (along with possibly unpersisted parent Scenes), including those with a null `_id`.
|
701
|
+
* @remarks `defineProperty`'d at construction with no options specified
|
701
702
|
*/
|
702
703
|
protected _dependentTokens?: foundry.utils.IterableWeakMap<
|
703
704
|
Scene.Implementation,
|
@@ -1,15 +1,17 @@
|
|
1
1
|
import type { DeepPartial, EmptyObject, InexactPartial, PrettifyType, SimpleMerge, UnionToIntersection } from "#utils";
|
2
|
+
import type { fields } from "#client/data/_module.d.mts";
|
2
3
|
import type Document from "#common/abstract/document.d.mts";
|
3
|
-
|
4
|
-
import
|
5
|
-
import Game
|
6
|
-
import type
|
4
|
+
import type { ApplicationV2, DialogV2 } from "#client/applications/api/_module.d.mts";
|
5
|
+
import type { Application } from "#client/appv1/api/_module.d.mts";
|
6
|
+
import type { Game } from "#client/_module.d.mts";
|
7
|
+
import type { SocketInterface } from "#client/helpers/_module.d.mts";
|
8
|
+
import type { BasePackage } from "#common/packages/_module.d.mts";
|
7
9
|
|
8
10
|
/**
|
9
11
|
* A collection of Document objects contained within a specific compendium pack.
|
10
12
|
* Each Compendium pack has its own associated instance of the CompendiumCollection class which contains its contents.
|
11
13
|
*
|
12
|
-
* @see {@
|
14
|
+
* @see {@linkcode Game.packs | Game#packs}
|
13
15
|
*/
|
14
16
|
declare class CompendiumCollection<
|
15
17
|
Type extends CompendiumCollection.DocumentName,
|
@@ -38,6 +40,11 @@ declare class CompendiumCollection<
|
|
38
40
|
*/
|
39
41
|
static CONFIG_SETTING: "compendiumConfiguration";
|
40
42
|
|
43
|
+
/**
|
44
|
+
* The DataField definition for the configuration Setting
|
45
|
+
*/
|
46
|
+
static CONFIG_FIELD: CompendiumCollection.SettingField;
|
47
|
+
|
41
48
|
/** The canonical Compendium name - comprised of the originating package and the pack name */
|
42
49
|
get collection(): this["metadata"]["id"];
|
43
50
|
|
@@ -48,9 +55,7 @@ declare class CompendiumCollection<
|
|
48
55
|
* A reference to the Application class which provides an interface to interact with this compendium content.
|
49
56
|
* @defaultValue `Compendium`
|
50
57
|
*/
|
51
|
-
applicationClass:
|
52
|
-
| foundry.appv1.api.Application.AnyConstructor
|
53
|
-
| foundry.applications.api.ApplicationV2.AnyConstructor;
|
58
|
+
applicationClass: Application.AnyConstructor | ApplicationV2.AnyConstructor;
|
54
59
|
|
55
60
|
/**
|
56
61
|
* A subsidiary collection which contains the folders within the pack
|
@@ -59,7 +64,7 @@ declare class CompendiumCollection<
|
|
59
64
|
|
60
65
|
/**
|
61
66
|
* @remarks 1 less than in-world
|
62
|
-
* @defaultValue
|
67
|
+
* @defaultValue {@linkcode CONST.FOLDER_MAX_DEPTH}`- 1`
|
63
68
|
*/
|
64
69
|
get maxFolderDepth(): number;
|
65
70
|
|
@@ -83,7 +88,7 @@ declare class CompendiumCollection<
|
|
83
88
|
// Note(LukeAbby): The override for `_getVisibleTreeContents` become unreasonably long and don't add any changes and so has been omitted.
|
84
89
|
|
85
90
|
/** Access the compendium configuration data for this pack */
|
86
|
-
get config(): CompendiumCollection.
|
91
|
+
get config(): CompendiumCollection.StoredConfiguration | EmptyObject;
|
87
92
|
|
88
93
|
get documentName(): Type;
|
89
94
|
|
@@ -93,7 +98,7 @@ declare class CompendiumCollection<
|
|
93
98
|
/**
|
94
99
|
* The visibility configuration of this compendium pack.
|
95
100
|
*/
|
96
|
-
get ownership():
|
101
|
+
get ownership(): BasePackage.OwnershipRecord;
|
97
102
|
|
98
103
|
/** Is this Compendium pack visible to the current game User? */
|
99
104
|
get visible(): boolean;
|
@@ -139,21 +144,23 @@ declare class CompendiumCollection<
|
|
139
144
|
|
140
145
|
/**
|
141
146
|
* Load multiple documents from the Compendium pack using a provided query object.
|
142
|
-
* @param query - A database query used to retrieve documents from the underlying database
|
143
|
-
* default: `{}`
|
147
|
+
* @param query - A database query used to retrieve documents from the underlying database (default: `{}`)
|
144
148
|
* @returns The retrieved Document instances
|
145
149
|
*
|
146
|
-
* @example
|
150
|
+
* @example
|
151
|
+
* Get Documents that match the given value only.
|
147
152
|
* ```js
|
148
153
|
* await pack.getDocuments({ type: "weapon" });
|
149
154
|
* ```
|
150
155
|
*
|
151
|
-
* @example
|
156
|
+
* @example
|
157
|
+
* Get several Documents by their IDs.
|
152
158
|
* ```js
|
153
159
|
* await pack.getDocuments({ _id__in: arrayOfIds });
|
154
160
|
* ```
|
155
161
|
*
|
156
|
-
* @example
|
162
|
+
* @example
|
163
|
+
* Get Documents by their sub-types.
|
157
164
|
* ```js
|
158
165
|
* await pack.getDocuments({ type__in: ["weapon", "armor"] });
|
159
166
|
* ```
|
@@ -163,15 +170,14 @@ declare class CompendiumCollection<
|
|
163
170
|
/**
|
164
171
|
* Get the ownership level that a User has for this Compendium pack.
|
165
172
|
* @param user - The user being tested (default: `game.user`)
|
166
|
-
* @returns The ownership level in {@
|
173
|
+
* @returns The ownership level in {@linkcode CONST.DOCUMENT_OWNERSHIP_LEVELS}
|
167
174
|
*/
|
168
|
-
// user: not null (parameter default only)
|
169
175
|
getUserLevel(user?: User.Implementation): CONST.DOCUMENT_OWNERSHIP_LEVELS;
|
170
176
|
|
171
177
|
/**
|
172
178
|
* Test whether a certain User has a requested permission level (or greater) over the Compendium pack
|
173
179
|
* @param user - The User being tested
|
174
|
-
* @param permission - The permission level from DOCUMENT_OWNERSHIP_LEVELS to test
|
180
|
+
* @param permission - The permission level from {@linkcode CONST.DOCUMENT_OWNERSHIP_LEVELS} to test
|
175
181
|
* @param options - Additional options involved in the permission test
|
176
182
|
* @returns Does the user have this permission level over the Compendium pack?
|
177
183
|
*/
|
@@ -184,8 +190,7 @@ declare class CompendiumCollection<
|
|
184
190
|
/**
|
185
191
|
* Import a Document into this Compendium Collection.
|
186
192
|
* @param document - The existing Document you wish to import
|
187
|
-
* @param options - Additional options which modify how the data is imported. See {@
|
188
|
-
* (default: `{}`)
|
193
|
+
* @param options - Additional options which modify how the data is imported. See {@linkcode foundry.documents.abstract.ClientDocumentMixin.AnyMixed.toCompendium | ClientDocument#toCompendium} (default: `{}`)
|
189
194
|
* @returns The imported Document instance
|
190
195
|
*/
|
191
196
|
importDocument(
|
@@ -209,32 +214,29 @@ declare class CompendiumCollection<
|
|
209
214
|
|
210
215
|
/**
|
211
216
|
* Fully import the contents of a Compendium pack into a World folder.
|
212
|
-
* @param options - Options which modify the import operation. Additional options are forwarded to {@
|
217
|
+
* @param options - Options which modify the import operation. Additional options are forwarded to {@linkcode WorldCollection.fromCompendium | WorldCollection#fromCompendium} and {@linkcode Document.createDocuments} (default: `{}`)
|
213
218
|
* @returns The imported Documents, now existing within the World
|
214
219
|
*/
|
215
220
|
importAll(options?: CompendiumCollection.ImportAllOptions<Type>): Promise<Document.StoredForName<Type>[]>;
|
216
221
|
|
217
222
|
/**
|
218
223
|
* Provide a dialog form that prompts the user to import the full contents of a Compendium pack into the World.
|
219
|
-
* @param options - Additional options passed to the DialogV2.confirm method
|
220
|
-
*
|
221
|
-
*
|
222
|
-
* Documents if the "yes" button was pressed, false if the "no" button was pressed, or
|
223
|
-
* null if the dialog was closed without making a choice.
|
224
|
+
* @param options - Additional options passed to the DialogV2.confirm method (default: `{}`)
|
225
|
+
* @returns A promise which resolves in the following ways: an array of imported Documents if the "yes" button was pressed,
|
226
|
+
* false if the "no" button was pressed, or null if the dialog was closed without making a choice.
|
224
227
|
*/
|
225
|
-
importDialog(
|
226
|
-
options?: foundry.applications.api.DialogV2.ConfirmConfig,
|
227
|
-
): Promise<Document.StoredForName<Type>[] | null | false>;
|
228
|
+
importDialog(options?: DialogV2.ConfirmConfig): Promise<Document.StoredForName<Type>[] | null | false>;
|
228
229
|
|
229
230
|
/**
|
230
231
|
* Add a Document to the index, capturing it's relevant index attributes
|
231
|
-
* @param document -The document to index
|
232
|
+
* @param document - The document to index
|
232
233
|
*/
|
233
234
|
indexDocument(document: Document.StoredForName<Type>): void;
|
234
235
|
|
235
236
|
/**
|
236
237
|
* Prompt the gamemaster with a dialog to configure ownership of this Compendium pack.
|
237
238
|
* @returns The configured ownership for the pack
|
239
|
+
* @remarks As of 13.347, any choices made here will not be saved (see {@link https://github.com/foundryvtt/foundryvtt/issues/13283}).
|
238
240
|
*/
|
239
241
|
configureOwnershipDialog(): Promise<foundry.packages.BasePackage.OwnershipRecord>;
|
240
242
|
|
@@ -248,8 +250,7 @@ declare class CompendiumCollection<
|
|
248
250
|
/**
|
249
251
|
* Create a new Compendium Collection using provided metadata.
|
250
252
|
* @param metadata - The compendium metadata used to create the new pack
|
251
|
-
* @param options
|
252
|
-
* (default: `{}`)
|
253
|
+
* @param options - Additional options which modify the Compendium creation request (default: `{}`)
|
253
254
|
*/
|
254
255
|
static createCompendium<T extends CompendiumCollection.DocumentName>(
|
255
256
|
this: abstract new (...args: never) => CompendiumCollection<NoInfer<T>>,
|
@@ -266,13 +267,13 @@ declare class CompendiumCollection<
|
|
266
267
|
|
267
268
|
/**
|
268
269
|
* Assign configuration metadata settings to the compendium pack
|
269
|
-
* @param configuration - The object of compendium settings to define
|
270
|
-
* (default: `{}`)
|
270
|
+
* @param configuration - The object of compendium settings to define (default: `{}`)
|
271
271
|
* @returns A Promise which resolves once the setting is updated
|
272
272
|
*/
|
273
|
-
configure(
|
274
|
-
|
275
|
-
|
273
|
+
configure(configuration?: CompendiumCollection.Configuration): Promise<void>;
|
274
|
+
|
275
|
+
/** @deprecated The `ownership` key is currently non-functional, see {@link https://github.com/foundryvtt/foundryvtt/issues/13283} */
|
276
|
+
configure(configuration: CompendiumCollection.ConfigurationBroken): Promise<void>;
|
276
277
|
|
277
278
|
/**
|
278
279
|
* Delete an existing world-level Compendium Collection.
|
@@ -291,7 +292,7 @@ declare class CompendiumCollection<
|
|
291
292
|
* This operation re-saves all documents within the compendium pack to disk, applying the current data model.
|
292
293
|
* If the document type has system data, the latest system data template will also be applied to all documents.
|
293
294
|
*/
|
294
|
-
migrate(): Promise<this>;
|
295
|
+
migrate(options?: CompendiumCollection.MigrateOptions): Promise<this>;
|
295
296
|
|
296
297
|
// Note(LukeAbby): The override for `updateAll` and `_onModifyContents` become unreasonably long and don't add any changes and so has been omitted.
|
297
298
|
|
@@ -299,20 +300,71 @@ declare class CompendiumCollection<
|
|
299
300
|
|
300
301
|
/**
|
301
302
|
* Handle changes to the world compendium configuration setting.
|
303
|
+
* @remarks As the setting's {@linkcode foundry.helpers.ClientSettings.SettingConfig.onChange | onChange} function, this gets passed the new value after
|
304
|
+
* it's been cleaned and validated by the field in `ClientSettings##cleanJSON`
|
302
305
|
*/
|
303
|
-
protected static _onConfigure(config: CompendiumCollection.
|
306
|
+
protected static _onConfigure(config: CompendiumCollection.StoredConfiguration): void;
|
307
|
+
|
308
|
+
#CompendiumCollection: true;
|
304
309
|
}
|
305
310
|
|
306
311
|
declare namespace CompendiumCollection {
|
307
312
|
interface Any extends CompendiumCollection<DocumentName> {}
|
308
313
|
|
309
|
-
type DocumentName =
|
314
|
+
type DocumentName = CONST.COMPENDIUM_DOCUMENT_TYPES;
|
310
315
|
|
311
|
-
interface
|
312
|
-
|
313
|
-
|
316
|
+
interface ConfigSettingElementSchema extends fields.DataSchema {
|
317
|
+
/**
|
318
|
+
* @defaultValue `undefined`
|
319
|
+
* @remarks The `id` of the folder this is in in the {@linkcode foundry.applications.sidebar.apps.Compendium | Compendium directory}.
|
320
|
+
* `undefined` and `null` should behave
|
321
|
+
*/
|
322
|
+
folder: fields.StringField<{
|
323
|
+
required: false;
|
324
|
+
blank: false;
|
325
|
+
nullable: true;
|
326
|
+
validate: (value: unknown) => boolean;
|
327
|
+
}>;
|
328
|
+
|
329
|
+
/** @remarks Integer sort value, for if this pack is either not in a folder, or is in one set to manual sort */
|
330
|
+
sort: fields.NumberField<{
|
331
|
+
required: false;
|
332
|
+
nullable: false;
|
333
|
+
integer: true;
|
334
|
+
min: 0;
|
335
|
+
initial: undefined;
|
336
|
+
}>;
|
337
|
+
|
338
|
+
/** @remarks Is the compendium edit lock engaged? */
|
339
|
+
locked: fields.BooleanField<{ required: false; initial: undefined }>;
|
340
|
+
|
341
|
+
// Presumably the resolution to https://github.com/foundryvtt/foundryvtt/issues/13283 will be a CompendiumOwnershipField here
|
314
342
|
}
|
315
343
|
|
344
|
+
interface StoredConfiguration extends fields.SchemaField.InitializedData<ConfigSettingElementSchema> {}
|
345
|
+
|
346
|
+
/** @remarks The partial'd interface for passing to {@linkcode CompendiumCollection.configure}, if you want the stored interface see {@linkcode CompendiumCollection.StoredConfiguration} */
|
347
|
+
interface Configuration extends InexactPartial<StoredConfiguration> {}
|
348
|
+
|
349
|
+
/** @internal */
|
350
|
+
type _Ownership = InexactPartial<{
|
351
|
+
/**
|
352
|
+
* @deprecated As of 13.347, an implementation change has rendered this key (presumably temporarily) non-functional
|
353
|
+
* (see {@link https://github.com/foundryvtt/foundryvtt/issues/13283}).
|
354
|
+
*/
|
355
|
+
ownership: foundry.packages.BasePackage.OwnershipRecord;
|
356
|
+
}>;
|
357
|
+
|
358
|
+
/** @privateRemarks See {@linkcode _Ownership.ownership} */
|
359
|
+
interface ConfigurationBroken extends Configuration, _Ownership {}
|
360
|
+
|
361
|
+
type SettingFieldElement = fields.SchemaField<ConfigSettingElementSchema>;
|
362
|
+
|
363
|
+
type SettingField = fields.TypedObjectField<SettingFieldElement>;
|
364
|
+
|
365
|
+
interface SettingData
|
366
|
+
extends fields.TypedObjectField.InitializedType<SettingFieldElement, fields.TypedObjectField.DefaultOptions> {}
|
367
|
+
|
316
368
|
// The type that's passed to `createCompendium`.
|
317
369
|
interface CreateCompendiumMetadata<Type extends DocumentName> {
|
318
370
|
type: Type;
|
@@ -442,13 +494,22 @@ declare namespace CompendiumCollection {
|
|
442
494
|
label?: string | undefined;
|
443
495
|
}
|
444
496
|
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
497
|
+
/** @deprecated Use {@linkcode CompendiumCollection.StoredConfiguration} instead. */
|
498
|
+
type WorldCompendiumPackConfiguration = CompendiumCollection.StoredConfiguration;
|
499
|
+
|
500
|
+
/** @deprecated Use {@linkcode CompendiumCollection.SettingData} instead. */
|
501
|
+
type WorldCompendiumConfiguration = CompendiumCollection.SettingData;
|
502
|
+
|
503
|
+
/** @internal */
|
504
|
+
type _MigrateOptions = InexactPartial<{
|
505
|
+
/**
|
506
|
+
* Display notifications
|
507
|
+
* @defaultValue `true`
|
508
|
+
*/
|
509
|
+
notify: boolean;
|
510
|
+
}>;
|
450
511
|
|
451
|
-
interface
|
512
|
+
interface MigrateOptions extends _MigrateOptions {}
|
452
513
|
|
453
514
|
// Note(LukeAbby): One neat possibility for this type would be making something like `type: "foo"`,
|
454
515
|
// `type__ne: "foo"`, and `type__in: ["foo", "bar"]` all narrow `system`.
|
@@ -1650,6 +1650,12 @@ declare class TokenDocument extends BaseToken.Internal.CanvasDocument {
|
|
1650
1650
|
*/
|
1651
1651
|
stopMovement(): boolean;
|
1652
1652
|
|
1653
|
+
/**
|
1654
|
+
* This function is called on Token documents that are still being moved by a User that just disconnected.
|
1655
|
+
* @internal
|
1656
|
+
*/
|
1657
|
+
_stopMovementOnDisconnect(): void;
|
1658
|
+
|
1653
1659
|
/**
|
1654
1660
|
* Pause the movement of this Token document. The movement can be resumed after being paused.
|
1655
1661
|
* Only the User that initiated the movement can pause it.
|
@@ -46,43 +46,8 @@ declare class Localization {
|
|
46
46
|
* @param model - The DataModel class to localize
|
47
47
|
* @param options - Options which configure how localization is performed
|
48
48
|
*
|
49
|
-
* @example
|
50
|
-
*
|
51
|
-
* ```js
|
52
|
-
* class MyDataModel extends foundry.abstract.DataModel {
|
53
|
-
* static defineSchema() {
|
54
|
-
* return {
|
55
|
-
* foo: new foundry.data.fields.StringField(),
|
56
|
-
* bar: new foundry.data.fields.NumberField()
|
57
|
-
* };
|
58
|
-
* }
|
59
|
-
* static LOCALIZATION_PREFIXES = ["MYMODULE.MYDATAMODEL"];
|
60
|
-
* }
|
61
|
-
*
|
62
|
-
* Hooks.on("i18nInit", () => {
|
63
|
-
* Localization.localizeDataModel(MyDataModel);
|
64
|
-
* });
|
65
|
-
* ```
|
66
|
-
*
|
67
|
-
* JSON localization file
|
68
|
-
* ```json
|
69
|
-
* {
|
70
|
-
* "MYMODULE": {
|
71
|
-
* "MYDATAMODEL": {
|
72
|
-
* "FIELDS" : {
|
73
|
-
* "foo": {
|
74
|
-
* "label": "Foo",
|
75
|
-
* "hint": "Instructions for foo"
|
76
|
-
* },
|
77
|
-
* "bar": {
|
78
|
-
* "label": "Bar",
|
79
|
-
* "hint": "Instructions for bar"
|
80
|
-
* }
|
81
|
-
* }
|
82
|
-
* }
|
83
|
-
* }
|
84
|
-
* }
|
85
|
-
* ```
|
49
|
+
* @see {@linkcode foundry.abstract.DataModel.LOCALIZATION_PREFIXES} for an example of the class definition and
|
50
|
+
* localization file structure.
|
86
51
|
*/
|
87
52
|
static localizeDataModel(
|
88
53
|
model: foundry.abstract.DataModel.AnyConstructor,
|
@@ -94,17 +94,17 @@ declare namespace System {
|
|
94
94
|
initiative: fields.StringField;
|
95
95
|
|
96
96
|
/**
|
97
|
-
* The default grid settings to use for Scenes in this system
|
97
|
+
* The default grid settings to use for Scenes in this system.
|
98
98
|
*/
|
99
99
|
grid: fields.SchemaField<{
|
100
|
-
/** A default grid type to use for Scenes in this system */
|
100
|
+
/** A default grid type to use for Scenes in this system. */
|
101
101
|
type: fields.NumberField<{
|
102
102
|
required: true;
|
103
103
|
choices: typeof foundry.CONST.GRID_TYPES;
|
104
104
|
initial: typeof foundry.CONST.GRID_TYPES.SQUARE;
|
105
105
|
}>;
|
106
106
|
|
107
|
-
/** A default distance measurement to use for Scenes in this system */
|
107
|
+
/** A default distance measurement to use for Scenes in this system. */
|
108
108
|
distance: fields.NumberField<{
|
109
109
|
required: true;
|
110
110
|
nullable: false;
|
@@ -112,12 +112,12 @@ declare namespace System {
|
|
112
112
|
initial: 1;
|
113
113
|
}>;
|
114
114
|
|
115
|
-
/** A default unit of measure to use for distance measurement in this system */
|
115
|
+
/** A default unit of measure to use for distance measurement in this system. */
|
116
116
|
units: fields.StringField<{
|
117
117
|
required: true;
|
118
118
|
}>;
|
119
119
|
|
120
|
-
/** The default rule used by this system for diagonal measurement on square grids */
|
120
|
+
/** The default rule used by this system for diagonal measurement on square grids. */
|
121
121
|
diagonals: fields.NumberField<{
|
122
122
|
required: true;
|
123
123
|
choices: typeof foundry.CONST.GRID_DIAGONALS;
|