@league-of-foundry-developers/foundry-vtt-types 0.8.9-4 → 0.8.9-8
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 +41 -13
- package/index-lenient.d.ts +10 -0
- package/package.json +10 -1
- package/src/foundry/common/abstract/backend.mjs.d.ts +14 -15
- package/src/foundry/common/abstract/document.mjs.d.ts +6 -2
- package/src/foundry/common/data/data.mjs/drawingData.d.ts +8 -3
- package/src/foundry/common/data/data.mjs/index.d.ts +2 -0
- package/src/foundry/common/data/data.mjs/playlistData.d.ts +171 -0
- package/src/foundry/common/data/data.mjs/playlistSoundData.d.ts +143 -0
- package/src/foundry/common/data/fields.mjs.d.ts +2 -2
- package/src/foundry/common/documents.mjs/basePlaylist.d.ts +11 -1
- package/src/foundry/common/documents.mjs/basePlaylistSound.d.ts +21 -2
- package/src/foundry/common/types.mjs.d.ts +5 -0
- package/src/foundry/foundry.js/application.d.ts +2 -5
- package/src/foundry/foundry.js/applications/cameraViews.d.ts +36 -31
- package/src/foundry/foundry.js/applications/compendium.d.ts +5 -2
- package/src/foundry/foundry.js/applications/filePicker.d.ts +114 -114
- package/src/foundry/foundry.js/applications/formApplication.d.ts +3 -11
- package/src/foundry/foundry.js/applications/formApplications/combatTrackerConfig.d.ts +20 -27
- package/src/foundry/foundry.js/applications/formApplications/defaultTokenConfig.d.ts +66 -0
- package/src/foundry/foundry.js/applications/formApplications/documentSheet.d.ts +1 -1
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/activeEffectConfig.d.ts +2 -2
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/actorSheet.d.ts +5 -2
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/ambientSoundConfig.d.ts +57 -0
- package/src/foundry/foundry.js/applications/formApplications/{folderConfig.d.ts → documentSheets/folderConfig.d.ts} +2 -2
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/index.d.ts +7 -0
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/lightConfig.d.ts +84 -0
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/measuredTemplateConfig.d.ts +60 -0
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/noteConfig.d.ts +72 -0
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/permissionControl.d.ts +54 -60
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/playlistConfig.d.ts +41 -28
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/playlistSoundConfig.d.ts +75 -0
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/rollTableConfig.d.ts +190 -148
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/sceneConfig.d.ts +133 -110
- package/src/foundry/foundry.js/applications/formApplications/documentSheets/tileConfig.d.ts +66 -0
- package/src/foundry/foundry.js/applications/formApplications/drawingConfig.d.ts +93 -95
- package/src/foundry/foundry.js/applications/formApplications/entitySheetConfig.d.ts +163 -147
- package/src/foundry/foundry.js/applications/formApplications/index.d.ts +1 -7
- package/src/foundry/foundry.js/applications/formApplications/moduleManagement.d.ts +41 -23
- package/src/foundry/foundry.js/applications/formApplications/settingsConfig.d.ts +95 -86
- package/src/foundry/foundry.js/applications/formApplications/tokenConfig.d.ts +146 -158
- package/src/foundry/foundry.js/applications/formApplications/wallConfig.d.ts +60 -70
- package/src/foundry/foundry.js/applications/formApplications/worldConfig.d.ts +25 -17
- package/src/foundry/foundry.js/applications/headsUpDisplay.d.ts +11 -5
- package/src/foundry/foundry.js/applications/hotbar.d.ts +5 -4
- package/src/foundry/foundry.js/applications/sceneControls.d.ts +13 -3
- package/src/foundry/foundry.js/applications/sceneNavigation.d.ts +90 -71
- package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/actorDirectory.d.ts +13 -56
- package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/itemDirectory.d.ts +7 -30
- package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/journalDirectory.d.ts +14 -34
- package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/macroDirectory.d.ts +6 -52
- package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/playlistDirectory.d.ts +249 -139
- package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/sceneDirectory.d.ts +6 -23
- package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectory.d.ts +3 -5
- package/src/foundry/foundry.js/cameraPopoutAppWrapper.d.ts +12 -7
- package/src/foundry/foundry.js/canvas.d.ts +2 -1
- package/src/foundry/foundry.js/clientDatabaseBackend.d.ts +210 -0
- package/src/foundry/foundry.js/clientDocumentMixin.d.ts +1 -1
- package/src/foundry/foundry.js/clientDocuments/canvasDocuments/index.d.ts +8 -0
- package/src/foundry/foundry.js/clientDocuments/canvasDocuments/tokenDocument.d.ts +1 -1
- package/src/foundry/foundry.js/clientDocuments/index.d.ts +19 -0
- package/src/foundry/foundry.js/clientDocuments/playlist.d.ts +195 -6
- package/src/foundry/foundry.js/clientDocuments/playlistSound.d.ts +113 -0
- package/src/foundry/foundry.js/clientDocuments/prototypeToken.d.ts +15 -0
- package/src/foundry/foundry.js/clientSettings.d.ts +14 -1
- package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +44 -8
- package/src/foundry/foundry.js/config.d.ts +85 -71
- package/src/foundry/foundry.js/dragDrop.d.ts +17 -14
- package/src/foundry/foundry.js/globalVariables.d.ts +7 -4
- package/src/foundry/foundry.js/mouseInteractionManager.d.ts +78 -34
- package/src/foundry/foundry.js/pixi/containers/canvasLayer.d.ts +2 -1
- package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayer.d.ts +10 -19
- package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/mapLayers/backgroundLayer.d.ts +6 -2
- package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/mapLayers/foregroundLayer.d.ts +2 -2
- package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/wallsLayer.d.ts +1 -1
- package/src/foundry/foundry.js/pixi/containers/doorControl.d.ts +53 -35
- package/src/foundry/foundry.js/pixi/containers/placeableObject.d.ts +6 -2
- package/src/foundry/foundry.js/pixi/containers/placeableObjects/ambientLight.d.ts +38 -40
- package/src/foundry/foundry.js/pixi/containers/placeableObjects/ambientSound.d.ts +56 -56
- package/src/foundry/foundry.js/pixi/containers/placeableObjects/note.d.ts +9 -50
- package/src/foundry/foundry.js/pixi/containers/placeableObjects/tile.d.ts +166 -47
- package/src/foundry/foundry.js/pixi/containers/placeableObjects/wall.d.ts +1 -1
- package/src/foundry/foundry.js/pixi/containers/ruler.d.ts +11 -7
- package/src/foundry/foundry.js/pixi/graphics/gridHighlight.d.ts +4 -9
- package/src/foundry/foundry.js/pointSource.d.ts +173 -85
- package/src/foundry/foundry.js/textEditor.d.ts +39 -8
- package/src/foundry/index.d.ts +2 -25
- package/src/foundry/foundry.js/applications/formApplications/ambientSoundConfig.d.ts +0 -68
- package/src/foundry/foundry.js/applications/formApplications/lightConfig.d.ts +0 -98
- package/src/foundry/foundry.js/applications/formApplications/measuredTemplateConfig.d.ts +0 -61
- package/src/foundry/foundry.js/applications/formApplications/noteConfig.d.ts +0 -77
- package/src/foundry/foundry.js/applications/formApplications/playlistSoundConfig.d.ts +0 -70
- package/src/foundry/foundry.js/applications/formApplications/tileConfig.d.ts +0 -73
@@ -1,5 +1,4 @@
|
|
1
1
|
import { ConfiguredDocumentClassForName, ConstructorDataType } from '../../../../types/helperTypes';
|
2
|
-
import { IdQuery } from '../../../common/abstract/backend.mjs';
|
3
2
|
import { DocumentModificationOptions } from '../../../common/abstract/document.mjs';
|
4
3
|
|
5
4
|
declare global {
|
@@ -25,6 +24,12 @@ declare global {
|
|
25
24
|
/** A debounced function which will clear the contents of the Compendium pack if it is not accessed frequently. */
|
26
25
|
_flush: () => void;
|
27
26
|
|
27
|
+
/**
|
28
|
+
* Has this Compendium pack been fully indexed?
|
29
|
+
* @defaultValue `false`
|
30
|
+
*/
|
31
|
+
indexed: boolean;
|
32
|
+
|
28
33
|
/**
|
29
34
|
* The amount of time that Document instances within this CompendiumCollection are held in memory.
|
30
35
|
* Accessing the contents of the Compendium pack extends the duration of this lifetime.
|
@@ -37,6 +42,32 @@ declare global {
|
|
37
42
|
*/
|
38
43
|
static CONFIG_SETTING: 'compendiumConfiguration';
|
39
44
|
|
45
|
+
/**
|
46
|
+
* The default index fields which should be retrieved for each Compendium document type
|
47
|
+
*/
|
48
|
+
static INDEX_FIELDS: {
|
49
|
+
/** @defaultValue `["name", "img", "type"]` */
|
50
|
+
Actor: (keyof foundry.data.ActorData['_source'])[];
|
51
|
+
|
52
|
+
/** @defaultValue `["name", "img", "type"]` */
|
53
|
+
Item: (keyof foundry.data.ItemData['_source'])[];
|
54
|
+
|
55
|
+
/** @defaultValue `["name", "thumb"]` */
|
56
|
+
Scene: (keyof foundry.data.SceneData['_source'])[];
|
57
|
+
|
58
|
+
/** @defaultValue `["name", "img"]` */
|
59
|
+
JournalEntry: (keyof foundry.data.JournalEntryData['_source'])[];
|
60
|
+
|
61
|
+
/** @defaultValue `["name", "img"]` */
|
62
|
+
Macro: (keyof foundry.data.MacroData['_source'])[];
|
63
|
+
|
64
|
+
/** @defaultValue `["name", "img"]` */
|
65
|
+
RollTable: (keyof foundry.data.RollTableData['_source'])[];
|
66
|
+
|
67
|
+
/** @defaultValue `["name"]` */
|
68
|
+
Playlist: (keyof foundry.data.PlaylistData['_source'])[];
|
69
|
+
};
|
70
|
+
|
40
71
|
/** The canonical Compendium name - comprised of the originating package and the pack name */
|
41
72
|
get collection(): string;
|
42
73
|
|
@@ -64,8 +95,11 @@ declare global {
|
|
64
95
|
|
65
96
|
delete: (id: string) => boolean;
|
66
97
|
|
67
|
-
/**
|
68
|
-
|
98
|
+
/**
|
99
|
+
* Load the Compendium index and cache it as the keys and values of the Collection.
|
100
|
+
* @param options - Options which customize how the index is created
|
101
|
+
*/
|
102
|
+
getIndex(options?: CompendiumCollection.GetIndexOptions<T>): Promise<this['index']>;
|
69
103
|
|
70
104
|
/**
|
71
105
|
* Get a single Document from this Compendium by ID.
|
@@ -81,7 +115,7 @@ declare global {
|
|
81
115
|
* default: `{}`
|
82
116
|
* @returns The retrieved Document instances
|
83
117
|
*/
|
84
|
-
getDocuments(query?:
|
118
|
+
getDocuments(query?: Record<string, unknown>): Promise<StoredDocument<DocumentInstanceForCompendiumMetadata<T>>[]>;
|
85
119
|
|
86
120
|
/**
|
87
121
|
* Import a Document into this Compendium Collection.
|
@@ -236,6 +270,11 @@ declare global {
|
|
236
270
|
package: string;
|
237
271
|
system?: string;
|
238
272
|
}
|
273
|
+
|
274
|
+
interface GetIndexOptions<T extends CompendiumCollection.Metadata> {
|
275
|
+
/** An array of fields to return as part of the index */
|
276
|
+
fields?: (keyof DocumentInstanceForCompendiumMetadata<T>['data']['_source'])[];
|
277
|
+
}
|
239
278
|
}
|
240
279
|
}
|
241
280
|
|
@@ -266,8 +305,5 @@ type DocumentInstanceForCompendiumMetadata<T extends CompendiumCollection.Metada
|
|
266
305
|
>;
|
267
306
|
|
268
307
|
type IndexTypeForMetadata<T extends CompendiumCollection.Metadata> = foundry.utils.Collection<
|
269
|
-
|
270
|
-
StoredDocument<DocumentInstanceForCompendiumMetadata<T>>['data'],
|
271
|
-
'_id' | 'name' | 'img' | ('type' extends keyof DocumentInstanceForCompendiumMetadata<T>['data'] ? 'type' : never)
|
272
|
-
>
|
308
|
+
{ _id: string } & Partial<DocumentInstanceForCompendiumMetadata<T>['data']['_source']>
|
273
309
|
>;
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { DocumentConstructor, PlaceableObjectConstructor } from '../../types/helperTypes';
|
2
|
-
import DatabaseBackend from '../common/abstract/backend.mjs';
|
3
2
|
|
4
3
|
type ConfiguredDocumentClassOrDefault<Fallback extends DocumentConstructor> =
|
5
4
|
Fallback['metadata']['name'] extends keyof DocumentClassConfig
|
@@ -230,7 +229,7 @@ declare global {
|
|
230
229
|
* Configure the DatabaseBackend used to perform Document operations
|
231
230
|
* @defaultValue `new ClientDatabaseBackend()`
|
232
231
|
*/
|
233
|
-
DatabaseBackend:
|
232
|
+
DatabaseBackend: ClientDatabaseBackend;
|
234
233
|
|
235
234
|
/**
|
236
235
|
* Configuration for the Actor document
|
@@ -249,7 +248,7 @@ declare global {
|
|
249
248
|
/**
|
250
249
|
* @defaultValue `{}`
|
251
250
|
*/
|
252
|
-
sheetClasses:
|
251
|
+
sheetClasses: CONFIG.SheetClasses;
|
253
252
|
|
254
253
|
/**
|
255
254
|
* @defaultValue `'fas fa-user'`
|
@@ -444,7 +443,7 @@ declare global {
|
|
444
443
|
/**
|
445
444
|
* @defaultValue `{}`
|
446
445
|
*/
|
447
|
-
sheetClasses:
|
446
|
+
sheetClasses: CONFIG.SheetClasses;
|
448
447
|
|
449
448
|
/**
|
450
449
|
* @defaultValue `'fas fa-suitcase'`
|
@@ -824,72 +823,7 @@ declare global {
|
|
824
823
|
*/
|
825
824
|
unexploredColor: number;
|
826
825
|
|
827
|
-
layers:
|
828
|
-
/**
|
829
|
-
* @defaultValue `BackgroundLayer`
|
830
|
-
*/
|
831
|
-
background: ConstructorOf<BackgroundLayer>;
|
832
|
-
|
833
|
-
/**
|
834
|
-
* @defaultValue `DrawingsLayer`
|
835
|
-
*/
|
836
|
-
drawings: ConstructorOf<DrawingsLayer>;
|
837
|
-
|
838
|
-
/**
|
839
|
-
* @defaultValue `GridLayer`
|
840
|
-
*/
|
841
|
-
grid: ConstructorOf<GridLayer>;
|
842
|
-
|
843
|
-
/**
|
844
|
-
* @defaultValue `WallsLayer`
|
845
|
-
*/
|
846
|
-
walls: ConstructorOf<WallsLayer>;
|
847
|
-
|
848
|
-
/**
|
849
|
-
* @defaultValue `TemplateLayer`
|
850
|
-
*/
|
851
|
-
templates: ConstructorOf<TemplateLayer>;
|
852
|
-
|
853
|
-
/**
|
854
|
-
* @defaultValue `NotesLayer`
|
855
|
-
*/
|
856
|
-
notes: ConstructorOf<NotesLayer>;
|
857
|
-
|
858
|
-
/**
|
859
|
-
* @defaultValue `TokenLayer`
|
860
|
-
*/
|
861
|
-
tokens: ConstructorOf<TokenLayer>;
|
862
|
-
|
863
|
-
/**
|
864
|
-
* @defaultValue `ForegroundLayer`
|
865
|
-
*/
|
866
|
-
foreground: ConstructorOf<ForegroundLayer>;
|
867
|
-
|
868
|
-
/**
|
869
|
-
* @defaultValue `SoundsLayer`
|
870
|
-
*/
|
871
|
-
sounds: ConstructorOf<SoundsLayer>;
|
872
|
-
|
873
|
-
/**
|
874
|
-
* @defaultValue `LightingLayer`
|
875
|
-
*/
|
876
|
-
lighting: ConstructorOf<LightingLayer>;
|
877
|
-
|
878
|
-
/**
|
879
|
-
* @defaultValue `SightLayer`
|
880
|
-
*/
|
881
|
-
sight: ConstructorOf<SightLayer>;
|
882
|
-
|
883
|
-
/**
|
884
|
-
* @defaultValue `EffectsLayer`
|
885
|
-
*/
|
886
|
-
effects: ConstructorOf<EffectsLayer>;
|
887
|
-
|
888
|
-
/**
|
889
|
-
* @defaultValue `ControlsLayer`
|
890
|
-
*/
|
891
|
-
controls: ConstructorOf<ControlsLayer>;
|
892
|
-
};
|
826
|
+
layers: CONFIG.Canvas.Layers;
|
893
827
|
|
894
828
|
lightLevels: {
|
895
829
|
/**
|
@@ -1572,7 +1506,7 @@ declare global {
|
|
1572
1506
|
/**
|
1573
1507
|
* @defaultValue `PlaylistSound`
|
1574
1508
|
*/
|
1575
|
-
documentClass: ConfiguredDocumentClassOrDefault<typeof
|
1509
|
+
documentClass: ConfiguredDocumentClassOrDefault<typeof PlaylistSound>;
|
1576
1510
|
|
1577
1511
|
/**
|
1578
1512
|
* @defaultValue `PlaylistSoundConfig`
|
@@ -1977,6 +1911,86 @@ declare global {
|
|
1977
1911
|
*/
|
1978
1912
|
webrtc: ConstructorOf<CameraViews>;
|
1979
1913
|
}
|
1914
|
+
|
1915
|
+
namespace Canvas {
|
1916
|
+
interface Layers {
|
1917
|
+
/**
|
1918
|
+
* @defaultValue `BackgroundLayer`
|
1919
|
+
*/
|
1920
|
+
background: ConstructorOf<BackgroundLayer>;
|
1921
|
+
|
1922
|
+
/**
|
1923
|
+
* @defaultValue `DrawingsLayer`
|
1924
|
+
*/
|
1925
|
+
drawings: ConstructorOf<DrawingsLayer>;
|
1926
|
+
|
1927
|
+
/**
|
1928
|
+
* @defaultValue `GridLayer`
|
1929
|
+
*/
|
1930
|
+
grid: ConstructorOf<GridLayer>;
|
1931
|
+
|
1932
|
+
/**
|
1933
|
+
* @defaultValue `WallsLayer`
|
1934
|
+
*/
|
1935
|
+
walls: ConstructorOf<WallsLayer>;
|
1936
|
+
|
1937
|
+
/**
|
1938
|
+
* @defaultValue `TemplateLayer`
|
1939
|
+
*/
|
1940
|
+
templates: ConstructorOf<TemplateLayer>;
|
1941
|
+
|
1942
|
+
/**
|
1943
|
+
* @defaultValue `NotesLayer`
|
1944
|
+
*/
|
1945
|
+
notes: ConstructorOf<NotesLayer>;
|
1946
|
+
|
1947
|
+
/**
|
1948
|
+
* @defaultValue `TokenLayer`
|
1949
|
+
*/
|
1950
|
+
tokens: ConstructorOf<TokenLayer>;
|
1951
|
+
|
1952
|
+
/**
|
1953
|
+
* @defaultValue `ForegroundLayer`
|
1954
|
+
*/
|
1955
|
+
foreground: ConstructorOf<ForegroundLayer>;
|
1956
|
+
|
1957
|
+
/**
|
1958
|
+
* @defaultValue `SoundsLayer`
|
1959
|
+
*/
|
1960
|
+
sounds: ConstructorOf<SoundsLayer>;
|
1961
|
+
|
1962
|
+
/**
|
1963
|
+
* @defaultValue `LightingLayer`
|
1964
|
+
*/
|
1965
|
+
lighting: ConstructorOf<LightingLayer>;
|
1966
|
+
|
1967
|
+
/**
|
1968
|
+
* @defaultValue `SightLayer`
|
1969
|
+
*/
|
1970
|
+
sight: ConstructorOf<SightLayer>;
|
1971
|
+
|
1972
|
+
/**
|
1973
|
+
* @defaultValue `EffectsLayer`
|
1974
|
+
*/
|
1975
|
+
effects: ConstructorOf<EffectsLayer>;
|
1976
|
+
|
1977
|
+
/**
|
1978
|
+
* @defaultValue `ControlsLayer`
|
1979
|
+
*/
|
1980
|
+
controls: ConstructorOf<ControlsLayer>;
|
1981
|
+
|
1982
|
+
[key: string]: ConstructorOf<CanvasLayer>;
|
1983
|
+
}
|
1984
|
+
}
|
1985
|
+
|
1986
|
+
interface SheetClass {
|
1987
|
+
id: string;
|
1988
|
+
cls: ConstructorOf<FormApplication>;
|
1989
|
+
label: string;
|
1990
|
+
default: boolean;
|
1991
|
+
}
|
1992
|
+
|
1993
|
+
type SheetClasses = Record<string, Record<string, SheetClass>>;
|
1980
1994
|
}
|
1981
1995
|
|
1982
1996
|
const CONFIG: CONFIG;
|
@@ -8,7 +8,7 @@
|
|
8
8
|
* const dragDrop = new DragDrop({
|
9
9
|
* dragSelector: ".item",
|
10
10
|
* dropSelector: ".items",
|
11
|
-
* permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) }
|
11
|
+
* permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) },
|
12
12
|
* callbacks: { dragstart: this._onDragStart.bind(this), drop: this._onDragDrop.bind(this) }
|
13
13
|
* });
|
14
14
|
* dragDrop.bind(html);
|
@@ -17,9 +17,9 @@
|
|
17
17
|
declare class DragDrop {
|
18
18
|
/**
|
19
19
|
* @param dragSelector - The CSS selector used to target draggable elements.
|
20
|
-
* (default: `
|
20
|
+
* (default: `undefined`)
|
21
21
|
* @param dropSelector - The CSS selector used to target viable drop targets.
|
22
|
-
* (default: `
|
22
|
+
* (default: `undefined`)
|
23
23
|
* @param permissions - An object of permission test functions for each action
|
24
24
|
* (default: `{}`)
|
25
25
|
* @param callbacks - An object of callback functions for each action
|
@@ -29,27 +29,27 @@ declare class DragDrop {
|
|
29
29
|
|
30
30
|
/**
|
31
31
|
* The HTML selector which identifies draggable elements
|
32
|
-
* @defaultValue `
|
32
|
+
* @defaultValue `undefined`
|
33
33
|
*/
|
34
|
-
dragSelector: string |
|
34
|
+
dragSelector: string | undefined;
|
35
35
|
|
36
36
|
/**
|
37
37
|
* The HTML selector which identifies drop targets
|
38
|
-
* @defaultValue `
|
38
|
+
* @defaultValue `undefined`
|
39
39
|
*/
|
40
|
-
dropSelector: string |
|
40
|
+
dropSelector: string | undefined;
|
41
41
|
|
42
42
|
/**
|
43
43
|
* A set of permission checking functions for each action of the Drag and Drop workflow
|
44
44
|
* @defaultValue `{}`
|
45
45
|
*/
|
46
|
-
permissions: Partial<Record<
|
46
|
+
permissions: Partial<Record<DragDrop.Action, (selector: string | undefined) => boolean>>;
|
47
47
|
|
48
48
|
/**
|
49
49
|
* A set of callback functions for each action of the Drag and Drop workflow
|
50
50
|
* @defaultValue `{}`
|
51
51
|
*/
|
52
|
-
callbacks: Partial<Record<
|
52
|
+
callbacks: Partial<Record<DragDrop.Action, (event: DragEvent) => void>>;
|
53
53
|
|
54
54
|
/**
|
55
55
|
* Bind the DragDrop controller to an HTML application
|
@@ -62,7 +62,7 @@ declare class DragDrop {
|
|
62
62
|
* @param event - The drag event being handled
|
63
63
|
* @param action - The action being attempted
|
64
64
|
*/
|
65
|
-
callback(event: DragEvent, action:
|
65
|
+
callback(event: DragEvent, action: DragDrop.Action): void;
|
66
66
|
|
67
67
|
/**
|
68
68
|
* Test whether the current user has permission to perform a step of the workflow
|
@@ -70,40 +70,41 @@ declare class DragDrop {
|
|
70
70
|
* @param selector - The selector being targeted
|
71
71
|
* @returns Can the action be performed?
|
72
72
|
*/
|
73
|
-
can(action:
|
73
|
+
can(action: DragDrop.Action, selector: string | undefined): boolean;
|
74
74
|
|
75
75
|
/**
|
76
76
|
* Handle the start of a drag workflow
|
77
77
|
* @param event - The drag event being handled
|
78
|
+
* @internal
|
78
79
|
*/
|
79
80
|
protected _handleDragStart(event: DragEvent): void;
|
80
81
|
|
81
82
|
/**
|
82
83
|
* Handle a dragged element over a droppable target
|
83
84
|
* @param event - The drag event being handled
|
85
|
+
* @internal
|
84
86
|
*/
|
85
87
|
protected _handleDragOver(event: DragEvent): false;
|
86
88
|
|
87
89
|
/**
|
88
90
|
* Handle a dragged element dropped on a droppable target
|
89
91
|
* @param event - The drag event being handled
|
92
|
+
* @internal
|
90
93
|
*/
|
91
94
|
protected _handleDrop(event: DragEvent): unknown;
|
92
95
|
|
93
|
-
static createDragImage(img: HTMLImageElement, width: number, height: number): HTMLDivElement
|
96
|
+
static createDragImage(img: HTMLImageElement, width: number, height: number): HTMLDivElement;
|
94
97
|
}
|
95
98
|
|
96
99
|
declare namespace DragDrop {
|
97
100
|
interface Options {
|
98
101
|
/**
|
99
102
|
* The CSS selector used to target draggable elements.
|
100
|
-
* @defaultValue `null`
|
101
103
|
*/
|
102
104
|
dragSelector?: DragDrop['dragSelector'];
|
103
105
|
|
104
106
|
/**
|
105
107
|
* The CSS selector used to target viable drop targets.
|
106
|
-
* @defaultValue `null`
|
107
108
|
*/
|
108
109
|
dropSelector?: DragDrop['dropSelector'];
|
109
110
|
|
@@ -119,4 +120,6 @@ declare namespace DragDrop {
|
|
119
120
|
*/
|
120
121
|
callbacks?: DragDrop['callbacks'];
|
121
122
|
}
|
123
|
+
|
124
|
+
type Action = 'dragstart' | 'dragover' | 'drop';
|
122
125
|
}
|
@@ -15,6 +15,7 @@ declare global {
|
|
15
15
|
* The currently supported variables are:
|
16
16
|
* - {@link game}
|
17
17
|
* - {@link socket}
|
18
|
+
* - {@link ui}
|
18
19
|
* - {@link canvas}
|
19
20
|
*
|
20
21
|
* @example
|
@@ -64,9 +65,7 @@ declare global {
|
|
64
65
|
* @defaultValue `{}`
|
65
66
|
*/
|
66
67
|
windows: Record<number, Application>;
|
67
|
-
} &
|
68
|
-
[Key in keyof CONFIG['ui']]?: InstanceType<CONFIG['ui'][Key]>;
|
69
|
-
};
|
68
|
+
} & ('ui' extends keyof LenientGlobalVariableTypes ? UiApplications : Partial<UiApplications>);
|
70
69
|
|
71
70
|
/** The client-side console is the default logger */
|
72
71
|
let logger: typeof console;
|
@@ -115,7 +114,7 @@ declare global {
|
|
115
114
|
let _token: InstanceType<CONFIG['Token']['objectClass']> | null;
|
116
115
|
|
117
116
|
/*
|
118
|
-
* Global
|
117
|
+
* Global Variables
|
119
118
|
* The following variables are declared directly in foundry's HTML file (or more concretely, in `main.hbs`)
|
120
119
|
*/
|
121
120
|
|
@@ -128,4 +127,8 @@ declare global {
|
|
128
127
|
| null;
|
129
128
|
}
|
130
129
|
|
130
|
+
type UiApplications = {
|
131
|
+
[Key in keyof CONFIG['ui']]: InstanceType<CONFIG['ui'][Key]>;
|
132
|
+
};
|
133
|
+
|
131
134
|
export {};
|