@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.
Files changed (93) hide show
  1. package/README.md +41 -13
  2. package/index-lenient.d.ts +10 -0
  3. package/package.json +10 -1
  4. package/src/foundry/common/abstract/backend.mjs.d.ts +14 -15
  5. package/src/foundry/common/abstract/document.mjs.d.ts +6 -2
  6. package/src/foundry/common/data/data.mjs/drawingData.d.ts +8 -3
  7. package/src/foundry/common/data/data.mjs/index.d.ts +2 -0
  8. package/src/foundry/common/data/data.mjs/playlistData.d.ts +171 -0
  9. package/src/foundry/common/data/data.mjs/playlistSoundData.d.ts +143 -0
  10. package/src/foundry/common/data/fields.mjs.d.ts +2 -2
  11. package/src/foundry/common/documents.mjs/basePlaylist.d.ts +11 -1
  12. package/src/foundry/common/documents.mjs/basePlaylistSound.d.ts +21 -2
  13. package/src/foundry/common/types.mjs.d.ts +5 -0
  14. package/src/foundry/foundry.js/application.d.ts +2 -5
  15. package/src/foundry/foundry.js/applications/cameraViews.d.ts +36 -31
  16. package/src/foundry/foundry.js/applications/compendium.d.ts +5 -2
  17. package/src/foundry/foundry.js/applications/filePicker.d.ts +114 -114
  18. package/src/foundry/foundry.js/applications/formApplication.d.ts +3 -11
  19. package/src/foundry/foundry.js/applications/formApplications/combatTrackerConfig.d.ts +20 -27
  20. package/src/foundry/foundry.js/applications/formApplications/defaultTokenConfig.d.ts +66 -0
  21. package/src/foundry/foundry.js/applications/formApplications/documentSheet.d.ts +1 -1
  22. package/src/foundry/foundry.js/applications/formApplications/documentSheets/activeEffectConfig.d.ts +2 -2
  23. package/src/foundry/foundry.js/applications/formApplications/documentSheets/actorSheet.d.ts +5 -2
  24. package/src/foundry/foundry.js/applications/formApplications/documentSheets/ambientSoundConfig.d.ts +57 -0
  25. package/src/foundry/foundry.js/applications/formApplications/{folderConfig.d.ts → documentSheets/folderConfig.d.ts} +2 -2
  26. package/src/foundry/foundry.js/applications/formApplications/documentSheets/index.d.ts +7 -0
  27. package/src/foundry/foundry.js/applications/formApplications/documentSheets/lightConfig.d.ts +84 -0
  28. package/src/foundry/foundry.js/applications/formApplications/documentSheets/measuredTemplateConfig.d.ts +60 -0
  29. package/src/foundry/foundry.js/applications/formApplications/documentSheets/noteConfig.d.ts +72 -0
  30. package/src/foundry/foundry.js/applications/formApplications/documentSheets/permissionControl.d.ts +54 -60
  31. package/src/foundry/foundry.js/applications/formApplications/documentSheets/playlistConfig.d.ts +41 -28
  32. package/src/foundry/foundry.js/applications/formApplications/documentSheets/playlistSoundConfig.d.ts +75 -0
  33. package/src/foundry/foundry.js/applications/formApplications/documentSheets/rollTableConfig.d.ts +190 -148
  34. package/src/foundry/foundry.js/applications/formApplications/documentSheets/sceneConfig.d.ts +133 -110
  35. package/src/foundry/foundry.js/applications/formApplications/documentSheets/tileConfig.d.ts +66 -0
  36. package/src/foundry/foundry.js/applications/formApplications/drawingConfig.d.ts +93 -95
  37. package/src/foundry/foundry.js/applications/formApplications/entitySheetConfig.d.ts +163 -147
  38. package/src/foundry/foundry.js/applications/formApplications/index.d.ts +1 -7
  39. package/src/foundry/foundry.js/applications/formApplications/moduleManagement.d.ts +41 -23
  40. package/src/foundry/foundry.js/applications/formApplications/settingsConfig.d.ts +95 -86
  41. package/src/foundry/foundry.js/applications/formApplications/tokenConfig.d.ts +146 -158
  42. package/src/foundry/foundry.js/applications/formApplications/wallConfig.d.ts +60 -70
  43. package/src/foundry/foundry.js/applications/formApplications/worldConfig.d.ts +25 -17
  44. package/src/foundry/foundry.js/applications/headsUpDisplay.d.ts +11 -5
  45. package/src/foundry/foundry.js/applications/hotbar.d.ts +5 -4
  46. package/src/foundry/foundry.js/applications/sceneControls.d.ts +13 -3
  47. package/src/foundry/foundry.js/applications/sceneNavigation.d.ts +90 -71
  48. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/actorDirectory.d.ts +13 -56
  49. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/itemDirectory.d.ts +7 -30
  50. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/journalDirectory.d.ts +14 -34
  51. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/macroDirectory.d.ts +6 -52
  52. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/playlistDirectory.d.ts +249 -139
  53. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/sceneDirectory.d.ts +6 -23
  54. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectory.d.ts +3 -5
  55. package/src/foundry/foundry.js/cameraPopoutAppWrapper.d.ts +12 -7
  56. package/src/foundry/foundry.js/canvas.d.ts +2 -1
  57. package/src/foundry/foundry.js/clientDatabaseBackend.d.ts +210 -0
  58. package/src/foundry/foundry.js/clientDocumentMixin.d.ts +1 -1
  59. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/index.d.ts +8 -0
  60. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/tokenDocument.d.ts +1 -1
  61. package/src/foundry/foundry.js/clientDocuments/index.d.ts +19 -0
  62. package/src/foundry/foundry.js/clientDocuments/playlist.d.ts +195 -6
  63. package/src/foundry/foundry.js/clientDocuments/playlistSound.d.ts +113 -0
  64. package/src/foundry/foundry.js/clientDocuments/prototypeToken.d.ts +15 -0
  65. package/src/foundry/foundry.js/clientSettings.d.ts +14 -1
  66. package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +44 -8
  67. package/src/foundry/foundry.js/config.d.ts +85 -71
  68. package/src/foundry/foundry.js/dragDrop.d.ts +17 -14
  69. package/src/foundry/foundry.js/globalVariables.d.ts +7 -4
  70. package/src/foundry/foundry.js/mouseInteractionManager.d.ts +78 -34
  71. package/src/foundry/foundry.js/pixi/containers/canvasLayer.d.ts +2 -1
  72. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayer.d.ts +10 -19
  73. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/mapLayers/backgroundLayer.d.ts +6 -2
  74. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/mapLayers/foregroundLayer.d.ts +2 -2
  75. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/wallsLayer.d.ts +1 -1
  76. package/src/foundry/foundry.js/pixi/containers/doorControl.d.ts +53 -35
  77. package/src/foundry/foundry.js/pixi/containers/placeableObject.d.ts +6 -2
  78. package/src/foundry/foundry.js/pixi/containers/placeableObjects/ambientLight.d.ts +38 -40
  79. package/src/foundry/foundry.js/pixi/containers/placeableObjects/ambientSound.d.ts +56 -56
  80. package/src/foundry/foundry.js/pixi/containers/placeableObjects/note.d.ts +9 -50
  81. package/src/foundry/foundry.js/pixi/containers/placeableObjects/tile.d.ts +166 -47
  82. package/src/foundry/foundry.js/pixi/containers/placeableObjects/wall.d.ts +1 -1
  83. package/src/foundry/foundry.js/pixi/containers/ruler.d.ts +11 -7
  84. package/src/foundry/foundry.js/pixi/graphics/gridHighlight.d.ts +4 -9
  85. package/src/foundry/foundry.js/pointSource.d.ts +173 -85
  86. package/src/foundry/foundry.js/textEditor.d.ts +39 -8
  87. package/src/foundry/index.d.ts +2 -25
  88. package/src/foundry/foundry.js/applications/formApplications/ambientSoundConfig.d.ts +0 -68
  89. package/src/foundry/foundry.js/applications/formApplications/lightConfig.d.ts +0 -98
  90. package/src/foundry/foundry.js/applications/formApplications/measuredTemplateConfig.d.ts +0 -61
  91. package/src/foundry/foundry.js/applications/formApplications/noteConfig.d.ts +0 -77
  92. package/src/foundry/foundry.js/applications/formApplications/playlistSoundConfig.d.ts +0 -70
  93. package/src/foundry/foundry.js/applications/formApplications/tileConfig.d.ts +0 -73
@@ -1,30 +1,24 @@
1
- import type { ConfiguredDocumentClass } from '../../../../../types/helperTypes';
1
+ import type { ConfiguredDocumentClassForName } from '../../../../../types/helperTypes';
2
+ import { DocumentModificationOptions } from '../../../../common/abstract/document.mjs';
2
3
 
3
4
  declare global {
4
5
  /**
5
6
  * An AmbientLight is an implementation of PlaceableObject which represents a dynamic light source within the Scene.
6
- *
7
- * @example
8
- * ```typescript
9
- * AmbientLight.create<AmbientLight>({
10
- * t: "l",
11
- * x: 1000,
12
- * y: 1000,
13
- * rotation: 0,
14
- * dim: 30,
15
- * bright: 15,
16
- * angle: 360,
17
- * tintColor: "#FF0000",
18
- * tintAlpha: 0.05
19
- * });
20
- * ```
21
7
  */
22
- class AmbientLight extends PlaceableObject<InstanceType<ConfiguredDocumentClass<typeof AmbientLightDocument>>> {
8
+ class AmbientLight extends PlaceableObject<InstanceType<ConfiguredDocumentClassForName<'AmbientLight'>>> {
9
+ constructor(document: InstanceType<ConfiguredDocumentClassForName<'AmbientLight'>>);
10
+
23
11
  /**
24
12
  * A reference to the PointSource object which defines this light source area of effect
25
13
  */
26
14
  source: PointSource;
27
15
 
16
+ /**
17
+ * A reference to the ControlIcon used to configure this light
18
+ * @defaultValue `undefined`
19
+ */
20
+ controlIcon: ControlIcon | undefined;
21
+
28
22
  /** @override */
29
23
  static embeddedName: 'AmbientLight';
30
24
 
@@ -36,6 +30,11 @@ declare global {
36
30
  */
37
31
  get global(): boolean;
38
32
 
33
+ /**
34
+ * The maximum radius in pixels of the light field
35
+ */
36
+ get radius(): number;
37
+
39
38
  /**
40
39
  * Get the pixel radius of dim light emitted by this light source
41
40
  */
@@ -56,12 +55,18 @@ declare global {
56
55
 
57
56
  /**
58
57
  * Draw the ControlIcon for the AmbientLight
58
+ * @internal
59
59
  */
60
60
  protected _drawControlIcon(): ControlIcon;
61
61
 
62
62
  /** @override */
63
63
  refresh(): this;
64
64
 
65
+ /**
66
+ * Refresh the display of the ControlIcon for this AmbientLight source
67
+ */
68
+ refreshControl(): void;
69
+
65
70
  /**
66
71
  * The named identified for the source object associated with this light
67
72
  */
@@ -70,24 +75,34 @@ declare global {
70
75
  /**
71
76
  * Update the source object associated with this light
72
77
  * @param defer - Defer refreshing the LightingLayer to manually call that refresh later.
78
+ * (default: `false`)
73
79
  * @param deleted - Indicate that this light source has been deleted.
80
+ * (default: `false`)
74
81
  */
75
- updateSource({ defer, deleted }?: { defer: boolean; deleted: boolean }): boolean | null | void;
82
+ updateSource({ defer, deleted }?: { defer?: boolean; deleted?: boolean }): null | void;
76
83
 
77
84
  /** @override */
78
- protected _onCreate(): void;
85
+ protected _onCreate(
86
+ data: foundry.data.AmbientLightData['_source'],
87
+ options: DocumentModificationOptions,
88
+ userId: string
89
+ ): void;
79
90
 
80
91
  /** @override */
81
- protected _onUpdate(data: AmbientLight.Data): void;
92
+ protected _onUpdate(
93
+ changed: DeepPartial<foundry.data.AmbientLightData['_source']>,
94
+ options?: DocumentModificationOptions,
95
+ userId?: string
96
+ ): void;
82
97
 
83
98
  /** @override */
84
- protected _onDelete(): void;
99
+ protected _onDelete(options: DocumentModificationOptions, userId: string): void;
85
100
 
86
101
  /** @override */
87
- protected _canHUD(user: User, event?: any): boolean;
102
+ protected _canHUD(user: InstanceType<ConfiguredDocumentClassForName<'User'>>, event?: any): boolean;
88
103
 
89
104
  /** @override */
90
- protected _canConfigure(user: User, event?: any): boolean;
105
+ protected _canConfigure(user: InstanceType<ConfiguredDocumentClassForName<'User'>>, event?: any): boolean;
91
106
 
92
107
  /** @override */
93
108
  protected _onClickRight(event: PIXI.InteractionEvent): Promise<this>;
@@ -101,21 +116,4 @@ declare global {
101
116
  /** @override */
102
117
  protected _onDragLeftCancel(event: MouseEvent): void;
103
118
  }
104
-
105
- namespace AmbientLight {
106
- interface Data {
107
- angle: number;
108
- bright: number;
109
- darknessThreshold: number;
110
- dim: number;
111
- hidden: boolean;
112
- lightAnimation: { speed: number; intensity: number; type?: keyof typeof CONFIG['Canvas']['lightAnimations'] };
113
- locked: boolean;
114
- rotation: number;
115
- t: foundry.CONST.SourceType;
116
- tintAlpha: number;
117
- x: number;
118
- y: number;
119
- }
120
- }
121
119
  }
@@ -1,47 +1,31 @@
1
- import type { ConfiguredDocumentClass } from '../../../../../types/helperTypes';
1
+ import type { ConfiguredDocumentClassForName } from '../../../../../types/helperTypes';
2
+ import type { DocumentModificationOptions } from '../../../../common/abstract/document.mjs';
2
3
 
3
4
  declare global {
4
5
  /**
5
6
  * An AmbientSound is an implementation of PlaceableObject which represents a dynamic audio source within the Scene.
6
- *
7
- * @example
8
- * ```typescript
9
- * AmbientSound.create({
10
- * t: "l",
11
- * x: 1000,
12
- * y: 1000,
13
- * radius: 60,
14
- * easing: true,
15
- * path: "sounds/audio-file.mp3",
16
- * repeat: true,
17
- * volume: 0.4
18
- * });
19
- * ```
20
7
  */
21
- class AmbientSound extends PlaceableObject<InstanceType<ConfiguredDocumentClass<typeof AmbientSoundDocument>>> {
22
- /**
23
- * The Howl instance used to play this AmbientSound effect
24
- */
25
- howl: any;
8
+ class AmbientSound extends PlaceableObject<InstanceType<ConfiguredDocumentClassForName<'AmbientSound'>>> {
9
+ constructor(document: InstanceType<ConfiguredDocumentClassForName<'AmbientSound'>>);
26
10
 
27
11
  /**
28
- * The Howl sound ID of the playing instance of this sound
12
+ * The Sound which manages playback for this AmbientSound effect
29
13
  */
30
- howlId?: number;
14
+ sound: Sound | null;
15
+
16
+ /** @override */
17
+ static embeddedName: 'AmbientSound';
31
18
 
32
19
  /**
33
- * Create an audio helper instance to use for the Ambient Sound
20
+ * Create a Sound used to play this AmbientSound object
21
+ * @internal
34
22
  */
35
- protected _createHowl(): any;
36
-
37
- /** @override */
38
- static get embeddedName(): 'AmbientSound';
23
+ protected _createSound(): Sound | null;
39
24
 
40
25
  /**
41
- * @remarks
42
- * Not implemented for AmbientSound
26
+ * Is this ambient sound is currently audible based on its hidden state and the darkness level of the Scene?
43
27
  */
44
- get bounds(): never;
28
+ get isAudible(): boolean;
45
29
 
46
30
  /**
47
31
  * A convenience accessor for the sound type
@@ -57,63 +41,79 @@ declare global {
57
41
  * Toggle playback of the sound depending on whether or not it is audible
58
42
  * @param isAudible - Is the sound audible?
59
43
  * @param volume - The target playback volume
60
- * @param fade - Whether to fade the volume from its previous level
44
+ * @param options - Additional options which affect sound synchronization
61
45
  */
62
- play(isAudible: boolean, volume?: number, { fade }?: { fade?: boolean }): void | number;
46
+ sync(isAudible: boolean, volume: number, options?: Partial<AmbientSound.SyncOptions>): void;
63
47
 
64
- /**
65
- * @override
66
- * @remarks
67
- * Returns void
68
- */
69
- clear(): any;
48
+ /** @override */
49
+ clear(): this;
70
50
 
71
51
  /** @override */
72
52
  draw(): Promise<this>;
73
53
 
74
54
  /**
75
55
  * Draw the graphical preview of the audio source area of effect
56
+ * @internal
76
57
  */
77
- protected drawField(): PIXI.Container;
58
+ drawField(): PIXI.Container;
78
59
 
79
60
  /**
80
61
  * Draw the ControlIcon for the AmbientLight
62
+ * @internal
81
63
  */
82
64
  protected _drawControlIcon(): ControlIcon;
83
65
 
84
66
  /** @override */
85
67
  refresh(): this;
86
68
 
69
+ /**
70
+ * Refresh the display of the ControlIcon for this AmbientSound source
71
+ */
72
+ refreshControl(): void;
73
+
87
74
  /**
88
75
  * Compute the field-of-vision for an object, determining its effective line-of-sight and field-of-vision polygons
89
76
  * @returns An object containing the rays, LOS polygon, and FOV polygon for the light
90
77
  */
91
- computeFOV(): {
92
- fov: PIXI.Polygon | null;
93
- los: PIXI.Polygon | null;
94
- rays: Array<Ray> | null;
95
- };
78
+ updateSource(): { rays: null; los: null; fov: PIXI.Circle } | ReturnType<WallsLayer['computePolygon']>;
79
+
80
+ /** @override */
81
+ protected _onCreate(
82
+ data: foundry.data.AmbientSoundData['_source'],
83
+ options: DocumentModificationOptions,
84
+ userId: string
85
+ ): void;
86
+
87
+ /** @override */
88
+ protected _onUpdate(
89
+ changed: DeepPartial<foundry.data.AmbientSoundData['_source']>,
90
+ options?: DocumentModificationOptions,
91
+ userId?: string
92
+ ): void;
93
+
94
+ /** @override */
95
+ protected _onDelete(...args: Parameters<PlaceableObject['_onDelete']>): void;
96
+
97
+ /** @override */
98
+ protected _canHUD(user: InstanceType<ConfiguredDocumentClassForName<'User'>>, event?: any): boolean;
96
99
 
97
100
  /** @override */
98
- protected _onCreate(): void;
101
+ protected _canConfigure(user: InstanceType<ConfiguredDocumentClassForName<'User'>>, event?: any): boolean;
99
102
 
100
103
  /** @override */
101
- protected _onUpdate(data: AmbientSound.Data): void;
104
+ protected _onClickRight(event: PIXI.InteractionEvent): void;
102
105
 
103
106
  /** @override */
104
- protected _onDelete(): void;
107
+ protected _onDragLeftMove(event: PIXI.InteractionEvent): void;
105
108
  }
106
109
 
107
110
  namespace AmbientSound {
108
- interface Data {
109
- easing: boolean;
110
- path: string;
111
- radius: number;
112
- repeat: boolean;
113
- type: 'l' | 'g';
114
- volume: number;
115
- x: number;
116
- y: number;
111
+ interface SyncOptions {
112
+ /**
113
+ * A duration in milliseconds to fade volume transition
114
+ * @defaultValue `250`
115
+ */
116
+ fade: number;
117
117
  }
118
118
  }
119
119
  }
@@ -1,44 +1,22 @@
1
- import type { ConfiguredDocumentClass } from '../../../../../types/helperTypes';
1
+ import type { ConfiguredDocumentClass, ConfiguredDocumentClassForName } from '../../../../../types/helperTypes';
2
+ import { HoverInOptions } from '../placeableObject';
2
3
 
3
4
  declare global {
4
5
  /**
5
6
  * A Note is an implementation of PlaceableObject which represents an annotated location within the Scene.
6
7
  * Each Note links to a JournalEntry entity and represents it's location on the map.
7
- *
8
- * @example
9
- * ```typescript
10
- * Note.create<Note>({
11
- * entryId: journalEntry.id,
12
- * x: 1000,
13
- * y: 1000,
14
- * icon: "icons/my-journal-icon.svg",
15
- * iconSize: 40,
16
- * iconTint: "#00FF000",
17
- * text: "A custom label",
18
- * fontSize: 48,
19
- * textAnchor: CONST.TEXT_ANCHOR_POINTS.CENTER,
20
- * textColor: "#00FFFF"
21
- * });
22
- * ```
23
8
  */
24
9
  class Note extends PlaceableObject<InstanceType<ConfiguredDocumentClass<typeof NoteDocument>>> {
25
- /**
26
- * The associated JournalEntry which is described by this note
27
- */
28
- entry: JournalEntry;
29
-
30
10
  /** @override */
31
11
  static get embeddedName(): 'Note';
32
12
 
33
13
  /**
34
- * @remarks
35
- * Not implemented for Note
14
+ * The associated JournalEntry which is described by this note
36
15
  */
37
- get bounds(): never;
16
+ get entry(): InstanceType<ConfiguredDocumentClassForName<'JournalEntry'>>;
38
17
 
39
18
  /**
40
- * Return the text label which describes the Note
41
- * Use a manually specified label with a fallback to the JournalEntry name
19
+ * The text label used to annotate this Note
42
20
  */
43
21
  get text(): string;
44
22
 
@@ -69,19 +47,16 @@ declare global {
69
47
  refresh(): this;
70
48
 
71
49
  /** @override */
72
- protected _onUpdate(data: Note.Data): Promise<this>;
50
+ protected _onUpdate(changed: DeepPartial<foundry.data.NoteData['_source']>): void;
73
51
 
74
52
  /** @override */
75
- protected _canHover(user: User): true;
53
+ protected _canHover(user: InstanceType<ConfiguredDocumentClassForName<'User'>>): true;
76
54
 
77
55
  /** @override */
78
- protected _canView(user: User): boolean;
56
+ protected _canView(user: InstanceType<ConfiguredDocumentClassForName<'User'>>): boolean;
79
57
 
80
58
  /** @override */
81
- protected _onHoverIn(
82
- event: PIXI.InteractionEvent,
83
- options?: Parameters<PlaceableObject<InstanceType<ConfiguredDocumentClass<typeof NoteDocument>>>['_onHoverIn']>[1]
84
- ): false | void;
59
+ protected _onHoverIn(event: PIXI.InteractionEvent, options?: HoverInOptions): false | void;
85
60
 
86
61
  /** @override */
87
62
  protected _onHoverOut(event: PIXI.InteractionEvent): false | void;
@@ -90,19 +65,3 @@ declare global {
90
65
  protected _onClickLeft2(event: PIXI.InteractionEvent): void;
91
66
  }
92
67
  }
93
-
94
- declare namespace Note {
95
- interface Data {
96
- entryId: string;
97
- fontFamily: string;
98
- fontSize: number;
99
- icon: string;
100
- iconSize: number;
101
- iconTint: string;
102
- text: string;
103
- textAnchor: foundry.CONST.TextAnchorPoint;
104
- textColor: string;
105
- x: number;
106
- y: number;
107
- }
108
- }
@@ -1,27 +1,14 @@
1
- import type { ConfiguredDocumentClass } from '../../../../../types/helperTypes';
1
+ import type { ConfiguredDocumentClass, ConfiguredObjectClassForName } from '../../../../../types/helperTypes';
2
+ import { DocumentModificationOptions } from '../../../../common/abstract/document.mjs';
3
+ import type { TileDataConstructorData } from '../../../../common/data/data.mjs/tileData';
2
4
 
3
5
  declare global {
4
6
  /**
5
7
  * A Tile is an implementation of PlaceableObject which represents a static piece of artwork or prop within the Scene.
6
- * Tiles are drawn above the {@link BackgroundLayer} but below the {@link TokenLayer}.
8
+ * Tiles are drawn inside a {@link BackgroundLayer} container.
7
9
  *
8
- * @example
9
- * ```typescript
10
- * Tile.create<Tile>({
11
- * img: "path/to/tile-artwork.png",
12
- * width: 300,
13
- * height: 300,
14
- * scale: 1,
15
- * x: 1000,
16
- * y: 1000,
17
- * z: 370,
18
- * rotation: 45,
19
- * hidden: false,
20
- * locked: true
21
- * });
22
- * ```
23
- *
24
- * @see {@link TilesLayer}
10
+ * @see {@link TileDocument}
11
+ * @see {@link BackgroundLayer}
25
12
  * @see {@link TileSheet}
26
13
  * @see {@link TileHUD}
27
14
  */
@@ -33,38 +20,73 @@ declare global {
33
20
 
34
21
  /**
35
22
  * The Tile border frame
23
+ * @defaultValue `undefined`
36
24
  */
37
- frame: PIXI.Container | null;
25
+ frame: PIXI.Container | undefined;
38
26
 
39
27
  /**
40
- * The Tile image container
28
+ * The primary tile image texture
29
+ * @defaultValue `undefined`
41
30
  */
42
- tile: PIXI.Container | null;
31
+ texture: PIXI.Texture | undefined;
43
32
 
44
33
  /**
45
- * The primary tile image texture
34
+ * The Tile image sprite
35
+ * @defaultValue `undefined`
46
36
  */
47
- texture: PIXI.Texture | null;
37
+ tile: PIXI.Sprite | undefined;
48
38
 
49
- /** @override */
50
- static get embeddedName(): 'Tile';
39
+ /**
40
+ * A Tile background which is displayed if no valid image texture is present
41
+ * @defaultValue `undefined`
42
+ */
43
+ bg: PIXI.Graphics | undefined;
51
44
 
52
45
  /**
53
- * Apply initial sanitizations to the provided input data to ensure that a Tile has valid required attributes.
46
+ * A cached mapping of non-transparent pixels
47
+ * @defaultValue `undefined`
48
+ * @internal
54
49
  */
55
- protected _cleanData(): void;
50
+ protected _alphaMap:
51
+ | {
52
+ minX: number;
53
+ minY: number;
54
+ maxX: number;
55
+ maxY: number;
56
+ pixels: Uint8Array | undefined;
57
+ texture: PIXI.RenderTexture | undefined;
58
+ }
59
+ | undefined;
56
60
 
57
61
  /**
58
- * @remarks
59
- * Not implemented by Tile
62
+ * A flag which tracks whether the overhead tile is currently in an occluded state
63
+ * @defaultValue `false`
60
64
  */
61
- get bounds(): never;
65
+ occluded: boolean;
66
+
67
+ /** @override */
68
+ static embeddedName: 'Tile';
62
69
 
63
70
  /**
64
71
  * Get the native aspect ratio of the base texture for the Tile sprite
65
72
  */
66
73
  get aspectRatio(): number;
67
74
 
75
+ /**
76
+ * The HTML source element for the primary Tile texture
77
+ */
78
+ get sourceElement(): HTMLImageElement | HTMLVideoElement | undefined;
79
+
80
+ /**
81
+ * Does this Tile depict an animated video texture?
82
+ */
83
+ get isVideo(): boolean;
84
+
85
+ /**
86
+ * Is this tile a roof
87
+ */
88
+ get isRoof(): boolean;
89
+
68
90
  /** @override */
69
91
  draw(): Promise<this>;
70
92
 
@@ -73,26 +95,98 @@ declare global {
73
95
 
74
96
  /**
75
97
  * Refresh the display of the Tile border
98
+ * @internal
76
99
  */
77
100
  protected _refreshBorder(b: Rectangle): void;
78
101
 
79
102
  /**
80
103
  * Refresh the display of the Tile resizing handle
104
+ * @internal
81
105
  */
82
106
  protected _refreshHandle(b: Rectangle): void;
83
107
 
108
+ /**
109
+ * Play video for this Tile (if applicable).
110
+ * @param playing - Should the Tile video be playing?
111
+ * @param options - Additional options for modifying video playback
112
+ * (default: `{}`)
113
+ */
114
+ play(playing: boolean, options?: Partial<Tile.PlayOptions>): void;
115
+
116
+ /**
117
+ * Update the occlusion rendering for this overhead Tile for a given controlled Token.
118
+ * @param tokens - The set of currently controlled Token objects
119
+ */
120
+ updateOcclusion(tokens: Array<InstanceType<ConfiguredObjectClassForName<'Token'>>>): void;
121
+
122
+ /**
123
+ * Test whether a specific Token occludes this overhead tile.
124
+ * Occlusion is tested against 9 points, the center, the four corners-, and the four cardinal directions
125
+ * @param token - The Token to test
126
+ * @param options - Additional options that affect testing
127
+ * @returns Is the Token occluded by the Tile?
128
+ */
129
+ testOcclusion(
130
+ token: InstanceType<ConfiguredObjectClassForName<'Token'>>,
131
+ options?: Partial<Tile.OcclusionOptions>
132
+ ): boolean;
133
+
134
+ /**
135
+ * Test whether the Tile pixel data contains a specific point in canvas space
136
+ */
137
+ containsPixel(x: number, y: number): boolean;
138
+
139
+ /**
140
+ * Draw a sprite for the Roof which can be deducted from the fog exploration container
141
+ */
142
+ getRoofSprite(): PIXI.Sprite | undefined;
143
+
144
+ /**
145
+ * Swap a Tile from the background to the foreground - or vice versa
146
+ * TODO: Refactor to private _onSwapLayer
147
+ */
148
+ swapLayer(): void;
149
+
150
+ /**
151
+ * Created a cached mapping of pixel alpha for this Tile.
152
+ * Cache the bounding box of non-transparent pixels for the un-rotated shape.
153
+ * Store an array of booleans for whether each pixel has a non-transparent value.
154
+ * @param options - Options which customize the return value
155
+ * @internal
156
+ */
157
+ protected _createAlphaMap(options: Partial<Tile.AlphaMapOptions>): Exclude<Tile['_alphaMap'], undefined>;
158
+
159
+ /**
160
+ * Compute the alpha-based bounding box for the tile, including an angle of rotation.
161
+ * @internal
162
+ */
163
+ protected _getAlphaBounds(): NormalizedRectangle;
164
+
165
+ /**
166
+ * Create the filter instance used to reverse-mask overhead tiles using radial or vision-based occlusion.
167
+ * @internal
168
+ */
169
+ protected _createOcclusionFilter(): AbstractBaseMaskFilter;
170
+
84
171
  /** @override */
85
- activateListeners(): void;
172
+ protected _onUpdate(
173
+ changed: DeepPartial<foundry.data.TileData['_source']>,
174
+ options?: DocumentModificationOptions,
175
+ userId?: string
176
+ ): Promise<this> | void;
86
177
 
87
178
  /** @override */
88
- protected _onUpdate(data: Tile.Data): void;
179
+ protected _onDelete(options: DocumentModificationOptions, userId: string): void;
89
180
 
90
181
  /** @override */
91
- protected _canHUD(user?: User, event?: any): boolean;
182
+ activateListeners(): void;
92
183
 
93
184
  /** @override */
94
185
  protected _canConfigure(user: User, event?: any): boolean;
95
186
 
187
+ /** @override */
188
+ protected _onClickLeft2(event: PIXI.InteractionEvent): void;
189
+
96
190
  /** @override */
97
191
  protected _onDragLeftStart(event: PIXI.InteractionEvent): void;
98
192
 
@@ -125,6 +219,7 @@ declare global {
125
219
 
126
220
  /**
127
221
  * Handle the beginning of a drag event on a resize handle
222
+ * @param event - The mousedown event
128
223
  */
129
224
  protected _onHandleDragStart(event: PIXI.InteractionEvent): void;
130
225
 
@@ -140,29 +235,53 @@ declare global {
140
235
  */
141
236
  protected _onHandleDragDrop(event: PIXI.InteractionEvent): Promise<this>;
142
237
 
238
+ /**
239
+ * Get resized Tile dimensions
240
+ * @internal
241
+ */
242
+ protected _getResizedDimensions(event: MouseEvent, origin: Point, destination: Point): NormalizedRectangle;
243
+
143
244
  /**
144
245
  * Handle cancellation of a drag event for one of the resizing handles
145
246
  */
146
- protected _onHandleDragCancel(event: PIXI.InteractionEvent): void;
247
+ protected _onHandleDragCancel(): void;
147
248
 
148
249
  /**
149
250
  * Create a preview tile with a background texture instead of an image
150
251
  */
151
- static createPreview(data: Tile.Data): Tile;
252
+ static createPreview(data: TileDataConstructorData): Tile;
152
253
  }
153
254
 
154
255
  namespace Tile {
155
- interface Data {
156
- height: number;
157
- hidden: boolean;
158
- img: string;
159
- locked: boolean;
160
- rotation: number;
161
- scale: number;
162
- width: number;
163
- x: number;
164
- y: number;
165
- z: number;
256
+ interface PlayOptions {
257
+ /** Should the video loop? */
258
+ loop: boolean;
259
+ /** A specific timestamp between 0 and the video duration to begin playback */
260
+ offset: number;
261
+ /** Desired volume level of the video's audio channel (if any) */
262
+ volume: number;
263
+ }
264
+
265
+ interface OcclusionOptions {
266
+ /**
267
+ * Test corners of the hit-box in addition to the token center?
268
+ * @defaultValue `true`
269
+ */
270
+ corners: boolean;
271
+ }
272
+
273
+ interface AlphaMapOptions {
274
+ /**
275
+ * Keep the Uint8Array of pixel alphas?
276
+ * @defaultValue `false`
277
+ */
278
+ keepPixels: boolean;
279
+
280
+ /**
281
+ * Keep the pure white RenderTexture?
282
+ * @defaultValue `false`
283
+ */
284
+ keepTexture: boolean;
166
285
  }
167
286
  }
168
287
  }