@league-of-foundry-developers/foundry-vtt-types 0.8.9-6 → 9.238.0

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 (211) hide show
  1. package/README.md +44 -27
  2. package/index-lenient.d.ts +10 -0
  3. package/index.d.ts +2 -2
  4. package/package.json +43 -15
  5. package/src/foundry/common/abstract/backend.mjs.d.ts +14 -15
  6. package/src/foundry/common/abstract/document.mjs.d.ts +30 -12
  7. package/src/foundry/common/config.mjs/index.d.ts +1 -0
  8. package/src/foundry/common/config.mjs/releaseData.d.ts +98 -0
  9. package/src/foundry/common/constants.mjs.d.ts +402 -213
  10. package/src/foundry/common/data/data.mjs/activeEffectData.d.ts +36 -29
  11. package/src/foundry/common/data/data.mjs/actorData.d.ts +32 -21
  12. package/src/foundry/common/data/data.mjs/adventureData.d.ts +165 -0
  13. package/src/foundry/common/data/data.mjs/ambientLightData.d.ts +45 -124
  14. package/src/foundry/common/data/data.mjs/ambientSoundData.d.ts +49 -77
  15. package/src/foundry/common/data/data.mjs/animationData.d.ts +17 -9
  16. package/src/foundry/common/data/data.mjs/cardData.d.ts +265 -0
  17. package/src/foundry/common/data/data.mjs/cardFaceData.d.ts +66 -0
  18. package/src/foundry/common/data/data.mjs/cardsData.d.ts +238 -0
  19. package/src/foundry/common/data/data.mjs/chatMessageData.d.ts +51 -39
  20. package/src/foundry/common/data/data.mjs/chatSpeakerData.d.ts +18 -11
  21. package/src/foundry/common/data/data.mjs/combatData.d.ts +51 -25
  22. package/src/foundry/common/data/data.mjs/combatantData.d.ts +48 -30
  23. package/src/foundry/common/data/data.mjs/darknessActivation.d.ts +8 -7
  24. package/src/foundry/common/data/data.mjs/drawingData.d.ts +72 -66
  25. package/src/foundry/common/data/data.mjs/effectChangeData.d.ts +21 -25
  26. package/src/foundry/common/data/data.mjs/effectDurationData.d.ts +24 -23
  27. package/src/foundry/common/data/data.mjs/fogExplorationData.d.ts +23 -16
  28. package/src/foundry/common/data/data.mjs/folderData.d.ts +28 -25
  29. package/src/foundry/common/data/data.mjs/index.d.ts +5 -0
  30. package/src/foundry/common/data/data.mjs/itemData.d.ts +26 -18
  31. package/src/foundry/common/data/data.mjs/journalEntryData.d.ts +21 -20
  32. package/src/foundry/common/data/data.mjs/lightData.d.ts +228 -0
  33. package/src/foundry/common/data/data.mjs/macroData.d.ts +52 -35
  34. package/src/foundry/common/data/data.mjs/measuredTemplateData.d.ts +41 -38
  35. package/src/foundry/common/data/data.mjs/noteData.d.ts +47 -37
  36. package/src/foundry/common/data/data.mjs/playlistData.d.ts +55 -26
  37. package/src/foundry/common/data/data.mjs/playlistSoundData.d.ts +32 -16
  38. package/src/foundry/common/data/data.mjs/prototypeTokenData.d.ts +7 -11
  39. package/src/foundry/common/data/data.mjs/rollTableData.d.ts +30 -24
  40. package/src/foundry/common/data/data.mjs/sceneData.d.ts +132 -111
  41. package/src/foundry/common/data/data.mjs/settingData.d.ts +11 -8
  42. package/src/foundry/common/data/data.mjs/tableResultData.d.ts +30 -26
  43. package/src/foundry/common/data/data.mjs/tileData.d.ts +43 -36
  44. package/src/foundry/common/data/data.mjs/tileOcclusion.d.ts +10 -9
  45. package/src/foundry/common/data/data.mjs/tokenBarData.d.ts +6 -3
  46. package/src/foundry/common/data/data.mjs/tokenData.d.ts +105 -157
  47. package/src/foundry/common/data/data.mjs/userData.d.ts +111 -33
  48. package/src/foundry/common/data/data.mjs/videoData.d.ts +9 -8
  49. package/src/foundry/common/data/data.mjs/wallData.d.ts +67 -39
  50. package/src/foundry/common/data/fields.mjs.d.ts +180 -83
  51. package/src/foundry/common/documents.mjs/baseActiveEffect.d.ts +9 -3
  52. package/src/foundry/common/documents.mjs/baseActor.d.ts +17 -45
  53. package/src/foundry/common/documents.mjs/baseAdventure.d.ts +38 -0
  54. package/src/foundry/common/documents.mjs/baseAmbientLight.d.ts +3 -0
  55. package/src/foundry/common/documents.mjs/baseAmbientSound.d.ts +3 -1
  56. package/src/foundry/common/documents.mjs/baseCard.d.ts +62 -0
  57. package/src/foundry/common/documents.mjs/baseCards.d.ts +39 -0
  58. package/src/foundry/common/documents.mjs/baseChatMessage.d.ts +3 -0
  59. package/src/foundry/common/documents.mjs/baseCombat.d.ts +5 -2
  60. package/src/foundry/common/documents.mjs/baseCombatant.d.ts +10 -1
  61. package/src/foundry/common/documents.mjs/baseDrawing.d.ts +11 -1
  62. package/src/foundry/common/documents.mjs/baseFogExploration.d.ts +4 -3
  63. package/src/foundry/common/documents.mjs/baseFolder.d.ts +10 -1
  64. package/src/foundry/common/documents.mjs/baseItem.d.ts +11 -29
  65. package/src/foundry/common/documents.mjs/baseJournalEntry.d.ts +3 -0
  66. package/src/foundry/common/documents.mjs/baseMacro.d.ts +16 -14
  67. package/src/foundry/common/documents.mjs/baseMeasuredTemplate.d.ts +4 -1
  68. package/src/foundry/common/documents.mjs/baseNote.d.ts +2 -2
  69. package/src/foundry/common/documents.mjs/basePlaylist.d.ts +1 -0
  70. package/src/foundry/common/documents.mjs/basePlaylistSound.d.ts +2 -1
  71. package/src/foundry/common/documents.mjs/baseRollTable.d.ts +3 -0
  72. package/src/foundry/common/documents.mjs/baseScene.d.ts +1 -0
  73. package/src/foundry/common/documents.mjs/baseSetting.d.ts +1 -0
  74. package/src/foundry/common/documents.mjs/baseTableResult.d.ts +10 -3
  75. package/src/foundry/common/documents.mjs/baseTile.d.ts +1 -0
  76. package/src/foundry/common/documents.mjs/baseToken.d.ts +3 -0
  77. package/src/foundry/common/documents.mjs/baseUser.d.ts +7 -1
  78. package/src/foundry/common/documents.mjs/baseWall.d.ts +7 -10
  79. package/src/foundry/common/documents.mjs/index.d.ts +3 -0
  80. package/src/foundry/common/module.mjs.d.ts +3 -0
  81. package/src/foundry/common/packages.mjs/moduleData.d.ts +12 -9
  82. package/src/foundry/common/packages.mjs/packageAuthorData.d.ts +24 -24
  83. package/src/foundry/common/packages.mjs/packageCompendiumData.d.ts +27 -21
  84. package/src/foundry/common/packages.mjs/packageData.d.ts +108 -82
  85. package/src/foundry/common/packages.mjs/packageDependencyData.d.ts +18 -11
  86. package/src/foundry/common/packages.mjs/packageLanguageData.d.ts +16 -15
  87. package/src/foundry/common/packages.mjs/systemData.d.ts +21 -20
  88. package/src/foundry/common/packages.mjs/tagPackageAvailability.d.ts +3 -3
  89. package/src/foundry/common/packages.mjs/worldData.d.ts +29 -18
  90. package/src/foundry/common/types.mjs.d.ts +100 -0
  91. package/src/foundry/common/utils/helpers.mjs.d.ts +27 -2
  92. package/src/foundry/common/utils/primitives.mjs.d.ts +99 -16
  93. package/src/foundry/foundry.js/application.d.ts +4 -7
  94. package/src/foundry/foundry.js/applications/cameraViews.d.ts +36 -31
  95. package/src/foundry/foundry.js/applications/compendium.d.ts +5 -2
  96. package/src/foundry/foundry.js/applications/filePicker.d.ts +116 -116
  97. package/src/foundry/foundry.js/applications/formApplication.d.ts +2 -2
  98. package/src/foundry/foundry.js/applications/formApplications/combatTrackerConfig.d.ts +20 -27
  99. package/src/foundry/foundry.js/applications/formApplications/defaultTokenConfig.d.ts +66 -0
  100. package/src/foundry/foundry.js/applications/formApplications/documentSheet.d.ts +1 -1
  101. package/src/foundry/foundry.js/applications/formApplications/documentSheets/activeEffectConfig.d.ts +2 -2
  102. package/src/foundry/foundry.js/applications/formApplications/documentSheets/actorSheet.d.ts +6 -3
  103. package/src/foundry/foundry.js/applications/formApplications/documentSheets/ambientLightConfig.d.ts +104 -0
  104. package/src/foundry/foundry.js/applications/formApplications/documentSheets/ambientSoundConfig.d.ts +1 -1
  105. package/src/foundry/foundry.js/applications/formApplications/{folderConfig.d.ts → documentSheets/folderConfig.d.ts} +3 -3
  106. package/src/foundry/foundry.js/applications/formApplications/documentSheets/index.d.ts +4 -0
  107. package/src/foundry/foundry.js/applications/formApplications/documentSheets/lightConfig.d.ts +5 -79
  108. package/src/foundry/foundry.js/applications/formApplications/documentSheets/measuredTemplateConfig.d.ts +60 -0
  109. package/src/foundry/foundry.js/applications/formApplications/documentSheets/noteConfig.d.ts +72 -0
  110. package/src/foundry/foundry.js/applications/formApplications/documentSheets/permissionControl.d.ts +5 -5
  111. package/src/foundry/foundry.js/applications/formApplications/documentSheets/playlistConfig.d.ts +1 -1
  112. package/src/foundry/foundry.js/applications/formApplications/documentSheets/rollTableConfig.d.ts +187 -148
  113. package/src/foundry/foundry.js/applications/formApplications/documentSheets/sceneConfig.d.ts +133 -110
  114. package/src/foundry/foundry.js/applications/formApplications/documentSheets/tileConfig.d.ts +1 -1
  115. package/src/foundry/foundry.js/applications/formApplications/drawingConfig.d.ts +93 -95
  116. package/src/foundry/foundry.js/applications/formApplications/entitySheetConfig.d.ts +163 -147
  117. package/src/foundry/foundry.js/applications/formApplications/gridConfig.d.ts +1 -1
  118. package/src/foundry/foundry.js/applications/formApplications/imagePopout.d.ts +1 -1
  119. package/src/foundry/foundry.js/applications/formApplications/index.d.ts +2 -3
  120. package/src/foundry/foundry.js/applications/formApplications/keybindingsConfig.d.ts +257 -0
  121. package/src/foundry/foundry.js/applications/formApplications/moduleManagement.d.ts +41 -23
  122. package/src/foundry/foundry.js/applications/formApplications/settingsConfig.d.ts +95 -86
  123. package/src/foundry/foundry.js/applications/formApplications/tokenConfig.d.ts +142 -155
  124. package/src/foundry/foundry.js/applications/formApplications/wallConfig.d.ts +60 -70
  125. package/src/foundry/foundry.js/applications/formApplications/worldConfig.d.ts +25 -17
  126. package/src/foundry/foundry.js/applications/hotbar.d.ts +5 -4
  127. package/src/foundry/foundry.js/applications/sceneControls.d.ts +13 -3
  128. package/src/foundry/foundry.js/applications/sceneNavigation.d.ts +90 -71
  129. package/src/foundry/foundry.js/applications/sidebarTab.d.ts +1 -1
  130. package/src/foundry/foundry.js/applications/sidebarTabs/chatLog.d.ts +7 -6
  131. package/src/foundry/foundry.js/applications/sidebarTabs/compendiumDirectory.d.ts +2 -2
  132. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/actorDirectory.d.ts +13 -56
  133. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/cardsDirectory.d.ts +7 -0
  134. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/index.d.ts +1 -0
  135. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/itemDirectory.d.ts +7 -30
  136. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/journalDirectory.d.ts +14 -34
  137. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/macroDirectory.d.ts +6 -52
  138. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/playlistDirectory.d.ts +2 -2
  139. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/sceneDirectory.d.ts +6 -23
  140. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectory.d.ts +4 -6
  141. package/src/foundry/foundry.js/avSettings.d.ts +7 -7
  142. package/src/foundry/foundry.js/cameraPopoutAppWrapper.d.ts +12 -7
  143. package/src/foundry/foundry.js/canvas.d.ts +150 -47
  144. package/src/foundry/foundry.js/canvasAnimation.d.ts +1 -1
  145. package/src/foundry/foundry.js/canvasDocumentMixin.d.ts +7 -0
  146. package/src/foundry/foundry.js/clientDatabaseBackend.d.ts +210 -0
  147. package/src/foundry/foundry.js/clientDocumentMixin.d.ts +45 -91
  148. package/src/foundry/foundry.js/clientDocuments/activeEffect.d.ts +3 -2
  149. package/src/foundry/foundry.js/clientDocuments/actor.d.ts +3 -7
  150. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/ambientSoundDocument.d.ts +1 -6
  151. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/tokenDocument.d.ts +1 -1
  152. package/src/foundry/foundry.js/clientDocuments/card.d.ts +133 -0
  153. package/src/foundry/foundry.js/clientDocuments/cards.d.ts +384 -0
  154. package/src/foundry/foundry.js/clientDocuments/chatMessage.d.ts +11 -10
  155. package/src/foundry/foundry.js/clientDocuments/combat.d.ts +4 -8
  156. package/src/foundry/foundry.js/clientDocuments/combatant.d.ts +1 -1
  157. package/src/foundry/foundry.js/clientDocuments/folder.d.ts +4 -6
  158. package/src/foundry/foundry.js/clientDocuments/index.d.ts +3 -0
  159. package/src/foundry/foundry.js/clientDocuments/item.d.ts +3 -4
  160. package/src/foundry/foundry.js/clientDocuments/playlist.d.ts +4 -3
  161. package/src/foundry/foundry.js/clientDocuments/prototypeToken.d.ts +15 -0
  162. package/src/foundry/foundry.js/clientDocuments/rollTable.d.ts +1 -1
  163. package/src/foundry/foundry.js/clientDocuments/scene.d.ts +30 -23
  164. package/src/foundry/foundry.js/clientKeybindings.d.ts +299 -0
  165. package/src/foundry/foundry.js/clientSettings.d.ts +21 -6
  166. package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +45 -12
  167. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/cardStacks.d.ts +9 -0
  168. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/index.d.ts +1 -0
  169. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/playlists.d.ts +3 -2
  170. package/src/foundry/foundry.js/config.d.ts +494 -902
  171. package/src/foundry/foundry.js/dragDrop.d.ts +17 -14
  172. package/src/foundry/foundry.js/game.d.ts +86 -11
  173. package/src/foundry/foundry.js/gamepadManager.d.ts +41 -0
  174. package/src/foundry/foundry.js/globalVariables.d.ts +7 -4
  175. package/src/foundry/foundry.js/handlebarsHelpers.d.ts +4 -4
  176. package/src/foundry/foundry.js/hooks.d.ts +57 -0
  177. package/src/foundry/foundry.js/keyboardManager.d.ts +165 -213
  178. package/src/foundry/foundry.js/mouseInteractionManager.d.ts +78 -34
  179. package/src/foundry/foundry.js/mouseManager.d.ts +18 -0
  180. package/src/foundry/foundry.js/newUserExperience.d.ts +34 -0
  181. package/src/foundry/foundry.js/pixi/containers/cachedContainer.d.ts +8 -0
  182. package/src/foundry/foundry.js/pixi/containers/cachedContainers/index.d.ts +1 -0
  183. package/src/foundry/foundry.js/pixi/containers/cachedContainers/primaryCanvasGroup.d.ts +42 -0
  184. package/src/foundry/foundry.js/pixi/containers/canvasLayer.d.ts +2 -1
  185. package/src/foundry/foundry.js/pixi/containers/canvasLayers/gridLayer.d.ts +2 -2
  186. package/src/foundry/foundry.js/pixi/containers/canvasLayers/index.d.ts +1 -1
  187. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayer.d.ts +10 -19
  188. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/mapLayers/backgroundLayer.d.ts +6 -2
  189. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/mapLayers/foregroundLayer.d.ts +2 -2
  190. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/wallsLayer.d.ts +4 -4
  191. package/src/foundry/foundry.js/pixi/containers/canvasLayers/{effectsLayer.d.ts → weatherLayer.d.ts} +7 -7
  192. package/src/foundry/foundry.js/pixi/containers/effectsCanvasGroup.d.ts +29 -0
  193. package/src/foundry/foundry.js/pixi/containers/index.d.ts +3 -0
  194. package/src/foundry/foundry.js/pixi/containers/interfaceCanvasGroup.d.ts +27 -0
  195. package/src/foundry/foundry.js/pixi/containers/placeableObject.d.ts +4 -1
  196. package/src/foundry/foundry.js/pixi/containers/placeableObjects/token.d.ts +1 -1
  197. package/src/foundry/foundry.js/pixi/containers/placeableObjects/wall.d.ts +1 -1
  198. package/src/foundry/foundry.js/pointSource.d.ts +174 -86
  199. package/src/foundry/foundry.js/roll.d.ts +25 -36
  200. package/src/foundry/foundry.js/rollTerm.d.ts +7 -4
  201. package/src/foundry/foundry.js/rollTerms/diceTerm.d.ts +4 -22
  202. package/src/foundry/foundry.js/rollTerms/mathTerm.d.ts +3 -0
  203. package/src/foundry/foundry.js/rollTerms/parentheticalTerm.d.ts +3 -0
  204. package/src/foundry/foundry.js/rollTerms/poolTerm.d.ts +3 -5
  205. package/src/foundry/foundry.js/rollTerms/stringTerm.d.ts +4 -1
  206. package/src/foundry/foundry.js/searchFilter.d.ts +1 -1
  207. package/src/foundry/foundry.js/textEditor.d.ts +40 -9
  208. package/src/foundry/index.d.ts +5 -0
  209. package/src/types/utils.d.ts +11 -3
  210. package/src/foundry/foundry.js/applications/formApplications/measuredTemplateConfig.d.ts +0 -61
  211. package/src/foundry/foundry.js/applications/formApplications/noteConfig.d.ts +0 -77
package/README.md CHANGED
@@ -2,47 +2,64 @@
2
2
 
3
3
  <div align=center>
4
4
 
5
+ <img align=center src="./media/img/league-logo-ts.svg" alt="League Logo TS" width="150"/>
6
+
5
7
  TypeScript type definitions for [Foundry Virtual Tabletop](https://foundryvtt.com/) (unofficial)
6
8
 
7
9
  [![League Discord Server](https://img.shields.io/discord/732325252788387980?label=League%20of%20Extraordinary%20Foundry%20VTT%20Developers)](https://discord.gg/52DNPzqm2Z)
8
- ![GitHub 0.7.x issues by-label](https://img.shields.io/github/issues-raw/League-of-Foundry-Developers/foundry-vtt-types/foundry%200.7.x?color=%23fe631d)
9
- ![GitHub closed 0.7.x issues by-label](https://img.shields.io/github/issues-closed-raw/League-of-Foundry-Developers/foundry-vtt-types/foundry%200.7.x?color=%23fe631d)
10
- ![GitHub 0.8.x issues by-label](https://img.shields.io/github/issues-raw/League-of-Foundry-Developers/foundry-vtt-types/foundry%200.8.x?color=%23fe631d)
11
- ![GitHub closed 0.8.x issues by-label](https://img.shields.io/github/issues-closed-raw/League-of-Foundry-Developers/foundry-vtt-types/foundry%200.8.x?color=%23fe631d)
10
+ ![GitHub V9 issues by-label](https://img.shields.io/github/issues-raw/League-of-Foundry-Developers/foundry-vtt-types/foundry%20V9?color=%23fe631d)
11
+ ![GitHub closed V9 issues by-label](https://img.shields.io/github/issues-closed-raw/League-of-Foundry-Developers/foundry-vtt-types/foundry%20V9?color=%23fe631d)
12
12
  [![npm (tag)](https://img.shields.io/npm/v/@league-of-foundry-developers/foundry-vtt-types/latest)](https://www.npmjs.com/package/@league-of-foundry-developers/foundry-vtt-types)
13
13
 
14
14
  </div>
15
15
 
16
16
  ## Supported Foundry VTT versions
17
17
 
18
- We aim to support the latest patch release of minor versions of Foundry VTT, starting with 0.7.
18
+ We aim to support the latest release of each Foundry VTT version (0.7, 0.8, 9, etc.), starting with 0.7.
19
+
20
+ At the moment, both version 0.7 and 0.8 are supported. Work on support for version 9 is in progress.
19
21
 
20
- At the moment, the latest 0.7.x and 0.8.x versions are supported. However, note that work on 0.8.x has not been
21
- completed yet, so there are still quite a few things which are either missing or typed incorrectly. Take a look at
22
- [0.8.x issues](https://github.com/League-of-Foundry-Developers/foundry-vtt-types/issues?q=is%3Aopen+is%3Aissue+label%3A%22foundry+0.8.x%22)
23
- to see what still needs to be done.
24
22
 
25
23
  ## Installation
26
24
 
27
- You can install foundry-vtt-types from the [npm registry](https://npmjs.org/). We provide distribution tags for the
28
- different supported Foundry VTT versions that have the form `fvtt-<foundry-version>`. For example, the distribution tag
29
- for Foundry VTT 0.8.8 is `fvtt-0.8.8`.
25
+ You can install foundry-vtt-types from the [npm registry](https://npmjs.org/).
30
26
 
31
- In order to install the desired version, run
27
+ In order to install the latest version, run
32
28
 
33
29
  ```sh
34
- npm install --save-dev @league-of-foundry-developers/foundry-vtt-types@fvtt-<foundry-version>
30
+ npm install --save-dev @league-of-foundry-developers/foundry-vtt-types
35
31
  ```
36
32
 
37
- For example, to install the type definitions for Foundry VTT 0.8.8 run
33
+ In order to install a specific version run
38
34
 
39
35
  ```sh
40
- npm install --save-dev @league-of-foundry-developers/foundry-vtt-types@fvtt-0.8.8
36
+ npm install --save-dev @league-of-foundry-developers/foundry-vtt-types@<version>
37
+ ```
38
+
39
+ For example, to install version `0.8.9-9`, run
40
+
41
+ ```sh
42
+ npm install --save-dev @league-of-foundry-developers/foundry-vtt-types@0.8.9-9
41
43
  ```
42
44
 
43
45
  You can then update foundry-vtt-types using the regular update mechanism for npm
44
46
  (see [npm update](https://docs.npmjs.com/cli/v7/commands/npm-update)).
45
47
 
48
+ ## Versioning scheme
49
+
50
+ The versions of the foundry-vtt-types correspond to the releases of Foundry VTT. The versioning scheme of Foundry VTT
51
+ changed with version 9, so the versioning scheme for the foundry-vtt-types also changes with that version:
52
+ * For Foundry VTT version 0.7 and 0.8, the versioning scheme is
53
+ ```
54
+ 0.<foundy-minor-version>.<foundry-patch-version>-<increment>
55
+ ```
56
+ * For Foundry VTT version 9 and onwards, the versioning scheme is
57
+ ```
58
+ <foundry-version>.<foundry-build>.<increment>
59
+ ```
60
+ In both cases, `increment` is a number that increases with every individual release of the foundry-vtt-types for that
61
+ Foundry VTT release.
62
+
46
63
  ## Usage
47
64
 
48
65
  Add foundry-vtt-types to your types section in your `tsconfig.json`:
@@ -62,13 +79,13 @@ This will make the type definitions available globally in your project.
62
79
  Make sure you are using `"moduleResolution": "node"`, too. It is required for some dependencies to be resolved
63
80
  correctly.
64
81
 
65
- Also make sure to set `"strictNullChecks": true` because otherwise, some of the conditional types used in the type
66
- definitions resolve incorrectly and you will see a lot of errors.
82
+ Also make sure to set `"strictNullChecks": true` because otherwise, some conditional types used in the type definitions
83
+ resolve incorrectly, and you will see a lot of errors. Alternatively, you can just set `"strict": true`, which
84
+ implicitly sets `strictNullChecks`. This is actually what we **recommend**, but it's not required.
67
85
 
68
86
  You can find some information about how to actually work with the type definitions in the
69
- [Wiki](https://github.com/League-of-Foundry-Developers/foundry-vtt-types/wiki). If you are working with Foundry VTT
70
- 0.8.x, a good starting point is
71
- [[0.8.x] FAQ](https://github.com/League-of-Foundry-Developers/foundry-vtt-types/wiki/%5B0.8.x%5D-FAQ).
87
+ [Wiki](https://github.com/League-of-Foundry-Developers/foundry-vtt-types/wiki). A good starting point is
88
+ the [FAQ](https://github.com/League-of-Foundry-Developers/foundry-vtt-types/wiki/FAQ).
72
89
 
73
90
  ## Acknowledgments
74
91
 
@@ -80,10 +97,10 @@ by [@NickEastNL](https://gitlab.com/NvanOosten)
80
97
  Contributions are very welcome in order to decrease the individual workload. Filing issues for wrong / missing types is
81
98
  also a great way to help us improve the type definitions.
82
99
 
83
- There are individual branches for the different supported Foundry VTT versions that are being worked on. They are named
84
- according to the minor version of the Foundry VTT version, e.g. the branch for Foundry VTT 0.8 is called
85
- `foundry-0.8.x`. All work to improve the type definitions for a specific version needs to be done through Pull Requests
86
- to the corresponding branch.
100
+ Development on the current version of Foundry VTT is done on the `main` branch. Additionally, we keep branches for the
101
+ older version of Foundry VTT that we still support. These branches are named according to the Foundry VTT version they
102
+ correspond to. For example, the branch for Foundry VTT 0.8 is called `foundry-0.8.x`. All work to improve the type
103
+ definitions needs to be done through Pull Requests to the relevant branch.
87
104
 
88
105
  Please read [CONTRIBUTING.md](CONTRIBUTING.md) for more details on how to contribute.
89
106
 
@@ -92,7 +109,7 @@ If you have any specific questions, feel free to contact us in the
92
109
 
93
110
  ## Type-Checking, Linting, Testing
94
111
 
95
- When contributing, make sure sure that the type checks pass, the linter is green and the tests are green. We _do_ have
112
+ When contributing, make sure that the type checks pass, the linter is green and the tests are green. We _do_ have
96
113
  checks in the CI but running this locally also helps you while developing and saves you time as you don't have to wait
97
114
  for the CI.
98
115
 
@@ -114,7 +131,7 @@ To create a release, you have to create a new release commit, tag it and create
114
131
  handle the rest.
115
132
 
116
133
  ```
117
- npm version prerelease
134
+ npm version <release-type>
118
135
  git push --follow-tags
119
136
  ```
120
137
 
@@ -0,0 +1,10 @@
1
+ import './index';
2
+
3
+ declare global {
4
+ interface LenientGlobalVariableTypes {
5
+ canvas: never;
6
+ game: never;
7
+ socket: never;
8
+ ui: never;
9
+ }
10
+ }
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import 'jquery';
2
- import 'handlebars';
3
1
  import 'pixi.js';
4
2
  import './src';
3
+ import 'handlebars';
4
+ import 'jquery';
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@league-of-foundry-developers/foundry-vtt-types",
3
- "version": "0.8.9-6",
3
+ "version": "9.238.0",
4
4
  "description": "TypeScript type definitions for Foundry VTT",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./index.d.ts"
8
+ },
9
+ "./lenient": {
10
+ "types": "./index-lenient.d.ts"
11
+ }
12
+ },
5
13
  "scripts": {
6
14
  "lint": "./node_modules/typescript/bin/tsc && eslint --ext .d.ts,.test-d.ts .",
7
15
  "lint:fix": "eslint --fix --ext .d.ts,.test-d.ts .",
@@ -15,7 +23,26 @@
15
23
  "type": "git",
16
24
  "url": "https://github.com/League-of-Foundry-Developers/foundry-vtt-types"
17
25
  },
18
- "author": "Kai Moschcau",
26
+ "contributors": [
27
+ {
28
+ "name": "Kai Moschcau"
29
+ },
30
+ {
31
+ "name": "Johannes Loher"
32
+ },
33
+ {
34
+ "name": "Oskar Pfeifer-Bley"
35
+ },
36
+ {
37
+ "name": "FloRad"
38
+ },
39
+ {
40
+ "name": "NickEastNL"
41
+ },
42
+ {
43
+ "name": "BoltsJ"
44
+ }
45
+ ],
19
46
  "license": "MIT",
20
47
  "bugs": {
21
48
  "url": "https://github.com/League-of-Foundry-Developers/foundry-vtt-types/issues"
@@ -28,26 +55,26 @@
28
55
  "typscript"
29
56
  ],
30
57
  "dependencies": {
31
- "@types/jquery": "~3.5.6",
58
+ "@types/jquery": "~3.5.9",
32
59
  "@types/simple-peer": "~9.11.1",
33
60
  "handlebars": "4.7.7",
34
61
  "pixi-particles": "4.3.1",
35
- "pixi.js": "5.3.4",
36
- "socket.io-client": "4.1.2",
37
- "tinymce": "5.8.1"
62
+ "pixi.js": "5.3.11",
63
+ "socket.io-client": "4.3.2",
64
+ "tinymce": "5.10.1"
38
65
  },
39
66
  "devDependencies": {
40
- "@typescript-eslint/eslint-plugin": "^4.28.3",
41
- "@typescript-eslint/parser": "^4.28.3",
42
- "eslint": "^7.30.0",
67
+ "@typescript-eslint/eslint-plugin": "^5.5.0",
68
+ "@typescript-eslint/parser": "^5.5.0",
69
+ "eslint": "^8.4.0",
43
70
  "eslint-config-prettier": "^8.3.0",
44
71
  "eslint-plugin-prettier": "^4.0.0",
45
72
  "eslint-plugin-tsdoc": "^0.2.14",
46
- "husky": "^7.0.1",
47
- "lint-staged": "^11.0.1",
48
- "prettier": "^2.3.2",
49
- "tsd": "^0.17.0",
50
- "typescript": "^4.4.3"
73
+ "husky": "^7.0.4",
74
+ "lint-staged": "^12.1.2",
75
+ "prettier": "^2.5.1",
76
+ "tsd": "~0.18.0",
77
+ "typescript": "~4.5.3"
51
78
  },
52
79
  "husky": {
53
80
  "hooks": {
@@ -56,10 +83,11 @@
56
83
  },
57
84
  "lint-staged": {
58
85
  "*.(d.ts|test-d.ts)": "eslint --fix",
59
- "*.(js|json)": "prettier --write"
86
+ "*.(js|json|yml)": "prettier --write"
60
87
  },
61
88
  "files": [
62
89
  "index.d.ts",
90
+ "index-lenient.d.ts",
63
91
  "src"
64
92
  ],
65
93
  "publishConfig": {
@@ -27,22 +27,28 @@ declare abstract class DatabaseBackend {
27
27
 
28
28
  /**
29
29
  * Get primary Document instances
30
+ * @remarks
31
+ * foundry actually declares this function to take parameters `documentClass`, `query`, `options`, and `user` but
32
+ * that's not how it is called and also not how the subclasses implement it.
33
+ * See https://gitlab.com/foundrynet/foundryvtt/-/issues/6177
30
34
  */
31
35
  protected abstract _getDocuments<T extends Document<any, any>>(
32
36
  documentClass: ConstructorOf<T>,
33
- query: Request,
34
- options: RequestOptions,
37
+ request: Request,
35
38
  user: BaseUser
36
39
  ): Promise<T[]>;
37
40
 
38
41
  /**
39
42
  * Get embedded Document instances
43
+ * @remarks
44
+ * foundry actually declares this function to take parameters `documentClass`, `parent`, `query`, `options`, and
45
+ * `user` but that's not how it is called and also not how the subclasses implement it.
46
+ * See https://gitlab.com/foundrynet/foundryvtt/-/issues/6177
40
47
  */
41
48
  protected abstract _getEmbeddedDocuments<T extends Document<any, any>>(
42
49
  documentClass: ConstructorOf<T>,
43
50
  parent: T extends Document<any, infer U> ? U : never,
44
- query: Request,
45
- options: RequestOptions,
51
+ request: Request,
46
52
  user: BaseUser
47
53
  ): Promise<T[]>;
48
54
 
@@ -198,7 +204,8 @@ declare abstract class DatabaseBackend {
198
204
  * @param action - The action performed
199
205
  * @param type - The document type
200
206
  * @param documents - The documents modified
201
- * @param info - The logging level
207
+ * @param level - The logging level
208
+ * (default: `'info'`)
202
209
  * @param parent - A parent document
203
210
  * @param pack - A compendium pack within which the operation occurred
204
211
  */
@@ -225,24 +232,16 @@ declare abstract class DatabaseBackend {
225
232
  protected _logContext({ parent, pack }?: { parent?: Document<any, any>; pack?: string }): string;
226
233
  }
227
234
 
228
- interface Request {
235
+ export interface Request {
229
236
  data?: AnyDocumentData[];
230
237
  updates?: AnyDocumentData[];
231
238
  ids?: string[];
232
239
  parent?: Document<any, any>;
233
- query?: object | IdQuery | SceneIdUserQuery;
240
+ query?: Record<string, unknown>;
234
241
  options?: RequestOptions;
235
242
  pack?: string;
236
243
  }
237
244
 
238
- export interface IdQuery {
239
- _id: string;
240
- }
241
- export interface SceneIdUserQuery {
242
- sceneId: string;
243
- user: string;
244
- }
245
-
246
245
  export interface RequestOptions {
247
246
  index?: boolean;
248
247
  broadcast?: boolean;
@@ -1,5 +1,4 @@
1
1
  import { BaseUser } from '../documents.mjs';
2
- import DatabaseBackend from './backend.mjs';
3
2
  import { AnyDocumentData } from './data.mjs';
4
3
  import {
5
4
  ConfiguredDocumentClass,
@@ -82,7 +81,7 @@ declare abstract class Document<
82
81
  /**
83
82
  * The database backend used to execute operations and handle results
84
83
  */
85
- static get database(): DatabaseBackend; // TODO: Reference type defined in CONFIG
84
+ static get database(): CONFIG['DatabaseBackend'];
86
85
 
87
86
  /**
88
87
  * Return a reference to the implemented subclass of this base document type.
@@ -125,7 +124,7 @@ declare abstract class Document<
125
124
  get name(): string | null;
126
125
 
127
126
  /**
128
- * Test whether a given User has a sufficient role in order to create Documents of this type.
127
+ * Test whether a given User has a sufficient role in order to create Documents of this type in general.
129
128
  * @param user - The User being tested
130
129
  * @returns Does the User have a sufficient role to create?
131
130
  */
@@ -138,35 +137,35 @@ declare abstract class Document<
138
137
  * (default: `{}`)
139
138
  * @param save - Save the clone to the World database?
140
139
  * (default: `false`)
141
- * @param keepId - Keep the original Document ID? Otherwise the ID will become undefined
142
- * (default: `false`)
140
+ * @param context - Additional context options passed to the create method
141
+ * (default: `{}`)
143
142
  * @returns The cloned Document instance
144
143
  */
145
144
  clone(
146
145
  data?: DeepPartial<
147
146
  ConstructorDataType<ConcreteDocumentData> | (ConstructorDataType<ConcreteDocumentData> & Record<string, unknown>)
148
147
  >,
149
- { save, keepId }?: { save?: boolean; keepId?: boolean }
148
+ { save, ...context }?: { save: boolean } & DocumentModificationContext
150
149
  ): TemporaryDocument<this> | Promise<TemporaryDocument<this> | undefined>;
151
150
 
152
151
  /**
153
- * Get the permission level that a specific User has over this Document, a value in CONST.ENTITY_PERMISSIONS.
152
+ * Get the permission level that a specific User has over this Document, a value in CONST.DOCUMENT_PERMISSION_LEVELS.
154
153
  * @param user - The User being tested
155
- * @returns A numeric permission level from CONST.ENTITY_PERMISSIONS or null
154
+ * @returns A numeric permission level from CONST.DOCUMENT_PERMISSION_LEVELS or null
156
155
  */
157
- getUserLevel(user: BaseUser): foundry.CONST.EntityPermission | null;
156
+ getUserLevel(user: BaseUser): foundry.CONST.DOCUMENT_PERMISSION_LEVELS | null;
158
157
 
159
158
  /**
160
159
  * Test whether a certain User has a requested permission level (or greater) over the Document
161
160
  * @param user - The User being tested
162
- * @param permission - The permission level from ENTITY_PERMISSIONS to test
161
+ * @param permission - The permission level from DOCUMENT_PERMISSION_LEVELS to test
163
162
  * @param exact - Require the exact permission level requested?
164
163
  * (default: `false`)
165
164
  * @returns Does the user have this permission level over the Document?
166
165
  */
167
166
  testUserPermission(
168
167
  user: BaseUser,
169
- permission: keyof typeof foundry.CONST.ENTITY_PERMISSIONS | foundry.CONST.EntityPermission,
168
+ permission: keyof typeof foundry.CONST.DOCUMENT_PERMISSION_LEVELS | foundry.CONST.DOCUMENT_PERMISSION_LEVELS,
170
169
  { exact }?: { exact?: boolean }
171
170
  ): boolean;
172
171
 
@@ -688,6 +687,13 @@ declare abstract class Document<
688
687
  toJSON(): this['id'] extends string
689
688
  ? ReturnType<ConcreteDocumentData['toJSON']> & { _id: string }
690
689
  : ReturnType<ConcreteDocumentData['toJSON']>;
690
+
691
+ /**
692
+ * For Documents which include game system data, migrate the system data object to conform to its latest data model.
693
+ * The data model is defined by the template.json specification included by the game system.
694
+ * @returns The migrated system data object
695
+ */
696
+ migrateSystemData(): object;
691
697
  }
692
698
 
693
699
  export interface DocumentModificationOptions {
@@ -703,12 +709,23 @@ export interface DocumentModificationOptions {
703
709
  */
704
710
  index?: boolean;
705
711
 
712
+ /**
713
+ * An array of fields to retrieve when indexing the collection
714
+ */
715
+ indexFields?: string[];
716
+
706
717
  /**
707
718
  * When performing a creation operation, keep the provided _id instead of clearing it.
708
719
  * @defaultValue `false`
709
720
  */
710
721
  keepId?: boolean;
711
722
 
723
+ /**
724
+ * When performing a creation operation, keep existing _id values of documents embedded within the one being created instead of generating new ones.
725
+ * @defaultValue `true`
726
+ */
727
+ keepEmbeddedIds?: boolean;
728
+
712
729
  /**
713
730
  * Create a temporary document which is not saved to the database. Only used during creation.
714
731
  * @defaultValue `false`
@@ -780,7 +797,8 @@ export interface Metadata<ConcreteDocument extends Document<any, any>> {
780
797
  name: DocumentType;
781
798
  collection: string;
782
799
  label: string;
783
- types: string[] | Record<string, unknown>; // TODO: Record<string, unknown> is only there because In BaseTableResult this is set to CONST.TABLE_RESULT_TYPES, check if this is a bug in foundry
800
+ labelPlural: string; // This is not set for the Document class but every class that implements Document actually provides it.
801
+ types: readonly string[];
784
802
  embedded: Record<string, ConstructorOf<Document<any, any>>>;
785
803
  hasSystemData: boolean;
786
804
  permissions: {
@@ -0,0 +1 @@
1
+ export { ReleaseData } from './releaseData';
@@ -0,0 +1,98 @@
1
+ import { PropertiesToSource } from '../../../types/helperTypes';
2
+ import { DocumentData } from '../abstract/module.mjs';
3
+ import * as fields from '../data/fields.mjs';
4
+
5
+ export interface ReleaseDataSchema extends DocumentSchema {
6
+ generation: typeof fields.REQUIRED_NUMBER;
7
+ channel: typeof fields.REQUIRED_STRING;
8
+ suffix: typeof fields.STRING_FIELD;
9
+ build: typeof fields.REQUIRED_NUMBER;
10
+ time: typeof fields.TIMESTAMP_FIELD;
11
+ node_version: typeof fields.POSITIVE_INTEGER_FIELD;
12
+ notes: typeof fields.BLANK_STRING;
13
+ download: typeof fields.BLANK_STRING;
14
+ }
15
+
16
+ export interface ReleaseDataProperties {
17
+ /** The major generation of the Release */
18
+ generation: number;
19
+
20
+ /** The channel the Release belongs to, such as "stable" */
21
+ channel: string;
22
+
23
+ /** An optional appended string display for the Release */
24
+ suffix: string | undefined;
25
+
26
+ /** The internal build number for the Release */
27
+ build: number;
28
+
29
+ /** When the Release was released */
30
+ time: number | undefined;
31
+
32
+ /** The minimum required Node.js major version */
33
+ node_version: number | undefined;
34
+
35
+ /** Release notes for the update version */
36
+ notes: string;
37
+
38
+ /** A temporary download URL where this version may be obtained */
39
+ download: string;
40
+ }
41
+
42
+ export interface ReleaseDataConstructorData {
43
+ /** The major generation of the Release */
44
+ generation?: number | undefined | null;
45
+
46
+ /** The channel the Release belongs to, such as "stable" */
47
+ channel: string;
48
+
49
+ /** An optional appended string display for the Release */
50
+ suffix?: string | undefined | null;
51
+
52
+ /** The internal build number for the Release */
53
+ build?: number | undefined | null;
54
+
55
+ /** When the Release was released */
56
+ time?: number | undefined | null;
57
+
58
+ /** The minimum required Node.js major version */
59
+ node_version?: number | undefined | null;
60
+
61
+ /** Release notes for the update version */
62
+ notes?: string | undefined | null;
63
+
64
+ /** A temporary download URL where this version may be obtained */
65
+ download?: string | undefined | null;
66
+ }
67
+
68
+ /** A data object which represents the details of this Release of Foundry VTT */
69
+ export declare class ReleaseData<
70
+ Schema extends ReleaseDataSchema = ReleaseDataSchema,
71
+ Properties extends ReleaseDataProperties = ReleaseDataProperties,
72
+ ConstructorData extends ReleaseDataConstructorData = ReleaseDataConstructorData
73
+ > extends DocumentData<Schema, Properties, PropertiesToSource<ReleaseDataProperties>, ConstructorData> {
74
+ static defineSchema(): ReleaseDataSchema;
75
+
76
+ /** A formatted string for shortened display, such as "Version 9" */
77
+ get shortDisplay(): string;
78
+
79
+ /** A formatted string for general display, such as "V9 Prototype 1" */
80
+ get display(): string;
81
+
82
+ /** A formatted string for Version compatibility checking, such as "9.150" */
83
+ get version(): string;
84
+
85
+ /**
86
+ * Is this ReleaseData object newer than some other version?
87
+ * @param other - Some other version to compare against
88
+ * @returns Is this ReleaseData a newer version?
89
+ */
90
+ isNewer(other: string | ReleaseData): boolean;
91
+
92
+ /**
93
+ * Is this ReleaseData object a newer generation than some other version?
94
+ * @param other - Some other version to compare against
95
+ * @returns Is this ReleaseData a newer generation?
96
+ */
97
+ isGenerationalChange(other: string | ReleaseData): boolean;
98
+ }