@league-of-foundry-developers/foundry-vtt-types 0.8.9-7 → 9.238.1

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 (207) 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 +68 -67
  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/sceneNavigation.d.ts +90 -71
  128. package/src/foundry/foundry.js/applications/sidebarTab.d.ts +1 -1
  129. package/src/foundry/foundry.js/applications/sidebarTabs/chatLog.d.ts +7 -6
  130. package/src/foundry/foundry.js/applications/sidebarTabs/compendiumDirectory.d.ts +2 -2
  131. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/actorDirectory.d.ts +13 -56
  132. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/cardsDirectory.d.ts +7 -0
  133. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/index.d.ts +1 -0
  134. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/itemDirectory.d.ts +7 -30
  135. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/journalDirectory.d.ts +14 -34
  136. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/macroDirectory.d.ts +6 -52
  137. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/playlistDirectory.d.ts +2 -2
  138. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/sceneDirectory.d.ts +6 -23
  139. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectory.d.ts +4 -6
  140. package/src/foundry/foundry.js/avSettings.d.ts +7 -7
  141. package/src/foundry/foundry.js/cameraPopoutAppWrapper.d.ts +12 -7
  142. package/src/foundry/foundry.js/canvas.d.ts +150 -47
  143. package/src/foundry/foundry.js/canvasAnimation.d.ts +1 -1
  144. package/src/foundry/foundry.js/canvasDocumentMixin.d.ts +7 -0
  145. package/src/foundry/foundry.js/clientDatabaseBackend.d.ts +210 -0
  146. package/src/foundry/foundry.js/clientDocumentMixin.d.ts +45 -91
  147. package/src/foundry/foundry.js/clientDocuments/activeEffect.d.ts +3 -2
  148. package/src/foundry/foundry.js/clientDocuments/actor.d.ts +3 -7
  149. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/ambientSoundDocument.d.ts +1 -6
  150. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/tokenDocument.d.ts +1 -1
  151. package/src/foundry/foundry.js/clientDocuments/card.d.ts +133 -0
  152. package/src/foundry/foundry.js/clientDocuments/cards.d.ts +384 -0
  153. package/src/foundry/foundry.js/clientDocuments/chatMessage.d.ts +11 -10
  154. package/src/foundry/foundry.js/clientDocuments/combat.d.ts +4 -8
  155. package/src/foundry/foundry.js/clientDocuments/combatant.d.ts +1 -1
  156. package/src/foundry/foundry.js/clientDocuments/folder.d.ts +4 -6
  157. package/src/foundry/foundry.js/clientDocuments/index.d.ts +3 -0
  158. package/src/foundry/foundry.js/clientDocuments/item.d.ts +3 -4
  159. package/src/foundry/foundry.js/clientDocuments/playlist.d.ts +4 -3
  160. package/src/foundry/foundry.js/clientDocuments/prototypeToken.d.ts +15 -0
  161. package/src/foundry/foundry.js/clientDocuments/rollTable.d.ts +1 -1
  162. package/src/foundry/foundry.js/clientDocuments/scene.d.ts +30 -23
  163. package/src/foundry/foundry.js/clientKeybindings.d.ts +299 -0
  164. package/src/foundry/foundry.js/clientSettings.d.ts +21 -6
  165. package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +45 -12
  166. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/cardStacks.d.ts +9 -0
  167. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/index.d.ts +1 -0
  168. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/playlists.d.ts +3 -2
  169. package/src/foundry/foundry.js/config.d.ts +467 -881
  170. package/src/foundry/foundry.js/dragDrop.d.ts +17 -14
  171. package/src/foundry/foundry.js/game.d.ts +171 -50
  172. package/src/foundry/foundry.js/gamepadManager.d.ts +41 -0
  173. package/src/foundry/foundry.js/globalVariables.d.ts +7 -4
  174. package/src/foundry/foundry.js/handlebarsHelpers.d.ts +4 -4
  175. package/src/foundry/foundry.js/hooks.d.ts +57 -0
  176. package/src/foundry/foundry.js/keyboardManager.d.ts +165 -213
  177. package/src/foundry/foundry.js/mouseInteractionManager.d.ts +78 -34
  178. package/src/foundry/foundry.js/mouseManager.d.ts +18 -0
  179. package/src/foundry/foundry.js/newUserExperience.d.ts +34 -0
  180. package/src/foundry/foundry.js/pixi/containers/cachedContainer.d.ts +8 -0
  181. package/src/foundry/foundry.js/pixi/containers/cachedContainers/index.d.ts +1 -0
  182. package/src/foundry/foundry.js/pixi/containers/cachedContainers/primaryCanvasGroup.d.ts +42 -0
  183. package/src/foundry/foundry.js/pixi/containers/canvasLayers/gridLayer.d.ts +2 -2
  184. package/src/foundry/foundry.js/pixi/containers/canvasLayers/index.d.ts +1 -1
  185. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayer.d.ts +5 -17
  186. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/wallsLayer.d.ts +4 -4
  187. package/src/foundry/foundry.js/pixi/containers/canvasLayers/{effectsLayer.d.ts → weatherLayer.d.ts} +7 -7
  188. package/src/foundry/foundry.js/pixi/containers/effectsCanvasGroup.d.ts +29 -0
  189. package/src/foundry/foundry.js/pixi/containers/index.d.ts +3 -0
  190. package/src/foundry/foundry.js/pixi/containers/interfaceCanvasGroup.d.ts +27 -0
  191. package/src/foundry/foundry.js/pixi/containers/placeableObject.d.ts +4 -1
  192. package/src/foundry/foundry.js/pixi/containers/placeableObjects/token.d.ts +1 -1
  193. package/src/foundry/foundry.js/pixi/containers/placeableObjects/wall.d.ts +1 -1
  194. package/src/foundry/foundry.js/pointSource.d.ts +174 -86
  195. package/src/foundry/foundry.js/roll.d.ts +25 -36
  196. package/src/foundry/foundry.js/rollTerm.d.ts +7 -4
  197. package/src/foundry/foundry.js/rollTerms/diceTerm.d.ts +4 -22
  198. package/src/foundry/foundry.js/rollTerms/mathTerm.d.ts +3 -0
  199. package/src/foundry/foundry.js/rollTerms/parentheticalTerm.d.ts +3 -0
  200. package/src/foundry/foundry.js/rollTerms/poolTerm.d.ts +3 -5
  201. package/src/foundry/foundry.js/rollTerms/stringTerm.d.ts +4 -1
  202. package/src/foundry/foundry.js/searchFilter.d.ts +1 -1
  203. package/src/foundry/foundry.js/textEditor.d.ts +40 -9
  204. package/src/foundry/index.d.ts +5 -0
  205. package/src/types/utils.d.ts +11 -3
  206. package/src/foundry/foundry.js/applications/formApplications/measuredTemplateConfig.d.ts +0 -61
  207. package/src/foundry/foundry.js/applications/formApplications/noteConfig.d.ts +0 -77
@@ -0,0 +1,384 @@
1
+ import type {
2
+ ConfiguredDocumentClass,
3
+ ConfiguredDocumentClassForName,
4
+ ConstructorDataType,
5
+ DocumentConstructor
6
+ } from '../../../types/helperTypes';
7
+ import type { DocumentModificationOptions } from '../../common/abstract/document.mjs';
8
+
9
+ declare global {
10
+ /**
11
+ * The client-side Cards document which extends the common BaseCards model.
12
+ * Each Cards document contains CardsData which defines its data schema.
13
+ *
14
+ * @see {@link data.CardsData} The Cards data schema
15
+ * @see {@link CardStacks} The world-level collection of Cards documents
16
+ */
17
+ class Cards extends ClientDocumentMixin(foundry.documents.BaseCards) {
18
+ /**
19
+ * Provide a thumbnail image path used to represent this document.
20
+ */
21
+ get thumbnail(): string | null;
22
+
23
+ /**
24
+ * The Card documents within this stack which are able to be drawn.
25
+ */
26
+ get availableCards(): InstanceType<ConfiguredDocumentClassForName<'Card'>>[];
27
+
28
+ /**
29
+ * The Card documents which belong to this stack but have already been drawn.
30
+ */
31
+ get drawnCards(): InstanceType<ConfiguredDocumentClassForName<'Card'>>[];
32
+
33
+ /** @override */
34
+ static createDocuments(
35
+ data: Array<
36
+ | ConstructorDataType<foundry.data.CardsData>
37
+ | (ConstructorDataType<foundry.data.CardsData> & Record<string, unknown>)
38
+ >,
39
+ context: DocumentModificationContext & { temporary: false }
40
+ ): Promise<StoredDocument<InstanceType<ConfiguredDocumentClassForName<'Cards'>>>[]>;
41
+ static createDocuments(
42
+ data: Array<
43
+ | ConstructorDataType<foundry.data.CardsData>
44
+ | (ConstructorDataType<foundry.data.CardsData> & Record<string, unknown>)
45
+ >,
46
+ context: DocumentModificationContext & { temporary: boolean }
47
+ ): Promise<InstanceType<ConfiguredDocumentClassForName<'Cards'>>[]>;
48
+ static createDocuments(
49
+ data: Array<
50
+ | ConstructorDataType<foundry.data.CardsData>
51
+ | (ConstructorDataType<foundry.data.CardsData> & Record<string, unknown>)
52
+ >,
53
+ context?: DocumentModificationContext
54
+ ): Promise<StoredDocument<InstanceType<ConfiguredDocumentClassForName<'Cards'>>>[]>;
55
+
56
+ /**
57
+ * Deal one or more cards from this Cards document to each of a provided array of Cards destinations.
58
+ * Cards are allocated from the top of the deck in cyclical order until the required number of Cards have been dealt.
59
+ * @param to - An array of other Cards documents to which cards are dealt
60
+ * @param number - The number of cards to deal to each other document
61
+ * (default: `1`)
62
+ * @param options - (default: `{}`)
63
+ * @returns This Cards document after the deal operation has completed
64
+ */
65
+ deal(
66
+ to: InstanceType<ConfiguredDocumentClassForName<'Cards'>>[],
67
+ number?: number | undefined,
68
+ options?: Cards.DealOptions | undefined
69
+ ): Promise<InstanceType<ConfiguredDocumentClassForName<'Cards'>>>;
70
+
71
+ /**
72
+ * Pass an array of specific Card documents from this document to some other Cards stack.
73
+ * @param to - Some other Cards document that is the destination for the pass operation
74
+ * @param ids - The embedded Card ids which should be passed
75
+ * @param options - (default: `{}`)
76
+ * @returns An array of the Card embedded documents created within the destination stack
77
+ */
78
+ pass(
79
+ to: InstanceType<ConfiguredDocumentClassForName<'Cards'>>,
80
+ ids: string[],
81
+ options?: Cards.PassOptions | undefined
82
+ ): Promise<InstanceType<ConfiguredDocumentClassForName<'Card'>>[]>;
83
+
84
+ /**
85
+ * Draw one or more cards from some other Cards document.
86
+ * @param from - Some other Cards document from which to draw
87
+ * @param number - The number of cards to draw
88
+ * (default: `1`)
89
+ * @param options - (default: `{}`)
90
+ * @returns An array of the Card documents which were drawn
91
+ */
92
+ draw(
93
+ from: InstanceType<ConfiguredDocumentClassForName<'Cards'>>,
94
+ number?: number | undefined,
95
+ options?: Cards.DrawOptions | undefined
96
+ ): Promise<InstanceType<ConfiguredDocumentClassForName<'Card'>>[]>;
97
+
98
+ /**
99
+ * Shuffle this Cards stack, randomizing the sort order of all the cards it contains.
100
+ * @param options - (default: `{}`)
101
+ * @returns The Cards document after the shuffle operation has completed
102
+ * @remarks The returns documentaion is incorrect (https://gitlab.com/foundrynet/foundryvtt/-/issues/6367).
103
+ */
104
+ shuffle(
105
+ options?: Cards.ShuffleOptions | undefined
106
+ ): Promise<InstanceType<ConfiguredDocumentClassForName<'Card'>>[]>;
107
+
108
+ /**
109
+ * Reset the Cards stack, retrieving all original cards from other stacks where they may have been drawn if this is a
110
+ * deck, otherwise returning all the cards in this stack to the decks where they originated.
111
+ * @param options - Options which modify the reset operation
112
+ * (default: `{}`)
113
+ * @returns The Cards document after the reset operation has completed
114
+ * @remarks The returns documentaion is incorrect (https://gitlab.com/foundrynet/foundryvtt/-/issues/6367).
115
+ */
116
+ reset(
117
+ options?: Cards.ResetOptions | undefined
118
+ ): Promise<
119
+ InstanceType<ConfiguredDocumentClassForName<'Card'>>[] | InstanceType<ConfiguredDocumentClassForName<'Cards'>>
120
+ >;
121
+
122
+ /**
123
+ * Perform a reset operation for a deck, retrieving all original cards from other stacks where they may have been
124
+ * drawn.
125
+ * @param options - Options which modify the reset operation.
126
+ * (default: `{}`)
127
+ * @returns The Cards document after the reset operation has completed.
128
+ * @internal
129
+ * @remarks The returns documentaion is incorrect (https://gitlab.com/foundrynet/foundryvtt/-/issues/6367).
130
+ */
131
+ protected _resetDeck(
132
+ options?: Cards.ResetOptions | undefined
133
+ ): Promise<InstanceType<ConfiguredDocumentClassForName<'Card'>>[]>;
134
+
135
+ /**
136
+ * Return all cards in this stack to their original decks.
137
+ * @param options - Options which modify the return operation.
138
+ * (default: `{}`)
139
+ * @returns The Cards document after the return operation has completed.
140
+ * @internal
141
+ */
142
+ protected _resetStack(
143
+ options?: Cards.ResetOptions | undefined
144
+ ): Promise<InstanceType<ConfiguredDocumentClassForName<'Cards'>>>;
145
+
146
+ /**
147
+ * A sorting function that is used to determine the standard order of Card documents within an un-shuffled stack.
148
+ * @param a - The card being sorted
149
+ * @param b - Another card being sorted against
150
+ */
151
+ protected sortStandard(a: foundry.data.CardData, b: foundry.data.CardData): number;
152
+
153
+ /**
154
+ * A sorting function that is used to determine the order of Card documents within a shuffled stack.
155
+ * @param a - The card being sorted
156
+ * @param b - Another card being sorted against
157
+ */
158
+ protected sortShuffled(a: foundry.data.CardData, b: foundry.data.CardData): number;
159
+
160
+ /**
161
+ * An internal helper method for drawing a certain number of Card documents from this Cards stack.
162
+ * @param number - The number of cards to draw
163
+ * @param how - A draw mode from CONST.CARD_DRAW_MODES
164
+ * @returns An array of drawn Card documents
165
+ */
166
+ protected _drawCards(
167
+ number: number,
168
+ how: foundry.CONST.CARD_DRAW_MODES
169
+ ): InstanceType<ConfiguredDocumentClassForName<'Card'>>[];
170
+
171
+ /**
172
+ * Create a ChatMessage which provides a notification of the cards operation which was just performed.
173
+ * Visibility of the resulting message is linked to the default roll mode selected in the chat log dropdown.
174
+ * @param source - The source Cards document from which the action originated
175
+ * @param action - The localization key which formats the chat message notification
176
+ * @param context - Data passed to the i18n.format method for the localization key
177
+ * @returns A created ChatMessage document
178
+ * @internal
179
+ */
180
+ protected _postChatNotification(
181
+ source: InstanceType<ConfiguredDocumentClassForName<'Cards'>>,
182
+ action: string,
183
+ context: Record<string, unknown>
184
+ ): Promise<InstanceType<ConfiguredDocumentClassForName<'ChatMessage'>> | undefined>;
185
+
186
+ /** @override */
187
+ protected _onUpdate(
188
+ data: DeepPartial<foundry.data.CardsData>,
189
+ options: DocumentModificationOptions,
190
+ userId: string
191
+ ): void;
192
+
193
+ // TODO: It's a bit weird that we have to do it in this generic way but otherwise there is an error overriding this. Investigate later.
194
+ /** @override */
195
+ static deleteDocuments<T extends DocumentConstructor>(
196
+ this: T,
197
+ ids?: string[] | undefined,
198
+ context?: DocumentModificationContext | undefined
199
+ ): Promise<InstanceType<ConfiguredDocumentClass<T>>[]>;
200
+
201
+ /**
202
+ * Display a dialog which prompts the user to deal cards to some number of hand-type Cards documents.
203
+ * @see {@link Cards#deal}
204
+ */
205
+ dealDialog(): Promise<InstanceType<ConfiguredDocumentClassForName<'Cards'>> | null>;
206
+
207
+ /**
208
+ * Display a dialog which prompts the user to draw cards from some other deck-type Cards documents.
209
+ * @see {@link Cards#draw}
210
+ */
211
+ drawDialog(): Promise<InstanceType<ConfiguredDocumentClassForName<'Card'>>[] | null>;
212
+
213
+ /**
214
+ * Display a dialog which prompts the user to pass cards from this document to some other other Cards document.
215
+ * @see {@link Cards#deal}
216
+ */
217
+ passDialog(): Promise<InstanceType<ConfiguredDocumentClassForName<'Cards'>> | null>;
218
+
219
+ /**
220
+ * Display a dialog which prompts the user to play a specific Card to some other Cards document
221
+ * @see {@link Cards#pass}
222
+ * @param card - The specific card being played as part of this dialog
223
+ * @remarks returns documentation is incorrect.
224
+ */
225
+ playDialog(
226
+ card: InstanceType<ConfiguredDocumentClassForName<'Card'>>
227
+ ): Promise<
228
+ | InstanceType<ConfiguredDocumentClassForName<'Card'>>[]
229
+ | InstanceType<ConfiguredDocumentClassForName<'Cards'>>
230
+ | null
231
+ >;
232
+
233
+ /**
234
+ * Display a confirmation dialog for whether or not the user wishes to reset a Cards stack
235
+ * @see {@link Cards#reset}
236
+ */
237
+ resetDialog(): Promise<InstanceType<ConfiguredDocumentClassForName<'Cards'>> | false | null>;
238
+
239
+ /** @override */
240
+ deleteDialog(options?: Partial<Dialog.Options> | undefined): Promise<this | false | null | undefined>;
241
+
242
+ // TODO: It's a bit weird that we have to do it in this generic way but otherwise there is an error overriding this. Investigate later.
243
+ /** @override */
244
+ static createDialog<T extends DocumentConstructor>(
245
+ this: T,
246
+ data?:
247
+ | DeepPartial<
248
+ | ConstructorDataType<foundry.data.CardsData>
249
+ | (ConstructorDataType<foundry.data.CardsData> & Record<string, unknown>)
250
+ >
251
+ | undefined,
252
+ context?: (Pick<DocumentModificationContext, 'parent' | 'pack'> & Partial<Dialog.Options>) | undefined
253
+ ): Promise<InstanceType<ConfiguredDocumentClass<T>> | null | undefined>;
254
+ }
255
+
256
+ namespace Cards {
257
+ interface BaseOperationOptions {
258
+ /**
259
+ * Create a ChatMessage which notifies that this action has occurred
260
+ * @defaultValue `true`
261
+ */
262
+ chatNotification?: boolean | undefined;
263
+ }
264
+
265
+ interface DealOptions extends BaseOperationOptions {
266
+ /**
267
+ * How to draw, a value from CONST.CARD_DRAW_MODES
268
+ * @defaultValue `foundry.CONST.CARD_DRAW_MODES.FIRST`
269
+ */
270
+ how?: foundry.CONST.CARD_DRAW_MODES | undefined;
271
+
272
+ /**
273
+ * Modifications to make to each Card as part of the deal operation,
274
+ * for example the displayed face
275
+ * @defaultValue `{}`
276
+ */
277
+ updateData?: DeepPartial<ConstructorDataType<foundry.data.CardData>> | undefined;
278
+
279
+ /**
280
+ * The name of the action being performed, used as part of the dispatched Hook event
281
+ * @defaultValue `'deal'`
282
+ */
283
+ action?: string | undefined;
284
+ }
285
+
286
+ /** Additional context which describes the operation */
287
+ interface DealContext {
288
+ /** The action name being performed, i.e. "deal", "pass" */
289
+ action: string;
290
+
291
+ /** An array of Card creation operations to be performed in each destination Cards document */
292
+ toCreate: ConstructorDataType<foundry.data.CardData>[][];
293
+
294
+ /** Card update operations to be performed in the origin Cards document */
295
+ fromUpdate: DeepPartial<ConstructorDataType<foundry.data.CardData>>[];
296
+
297
+ /** Card deletion operations to be performed in the origin Cards document */
298
+ fromDelete: string[];
299
+ }
300
+
301
+ interface PassOptions extends BaseOperationOptions {
302
+ /**
303
+ * Modifications to make to each Card as part of the pass operation,
304
+ * for example the displayed face
305
+ * @defaultValue `{}`
306
+ */
307
+ updateData?: DeepPartial<ConstructorDataType<foundry.data.CardData>> | undefined;
308
+
309
+ /**
310
+ * The name of the action being performed, used as part of the dispatched Hook event
311
+ * @defaultValue `'pass'`
312
+ */
313
+ action?: string | undefined;
314
+ }
315
+
316
+ /** Additional context which describes the operation */
317
+ interface PassContext {
318
+ /** The action name being performed, i.e. "pass", "play", "discard", "draw" */
319
+ action: string;
320
+
321
+ /** Card creation operations to be performed in the destination Cards document */
322
+ toCreate: ConstructorDataType<foundry.data.CardData>[];
323
+
324
+ /** Card update operations to be performed in the destination Cards document */
325
+ toUpdate: DeepPartial<ConstructorDataType<foundry.data.CardData>>[];
326
+
327
+ /** Card update operations to be performed in the origin Cards document */
328
+ fromUpdate: DeepPartial<ConstructorDataType<foundry.data.CardData>>[];
329
+
330
+ /** Card deletion operations to be performed in the origin Cards document */
331
+ fromDelete: string[];
332
+ }
333
+
334
+ interface DrawOptions extends PassOptions {
335
+ /**
336
+ * How to draw, a value from CONST.CARD_DRAW_MODES
337
+ * @defaultValue `foundry.CONST.CARD_DRAW_MODES.FIRST`
338
+ */
339
+ how?: foundry.CONST.CARD_DRAW_MODES | undefined;
340
+
341
+ /**
342
+ * Modifications to make to each Card as part of the draw operation,
343
+ * for example the displayed face
344
+ * @defaultValue `{}`
345
+ */
346
+ updateData?: DeepPartial<ConstructorDataType<foundry.data.CardData>> | undefined;
347
+ }
348
+
349
+ interface ShuffleOptions extends BaseOperationOptions {
350
+ /**
351
+ * Modifications to make to each Card as part of the shuffle operation,
352
+ * for example the displayed face
353
+ * @defaultValue `{}`
354
+ * @remarks This is not actually used by {@link Cards.shuffle}.
355
+ */
356
+ updateData?: DeepPartial<ConstructorDataType<foundry.data.CardData>> | undefined;
357
+ }
358
+
359
+ /** Options which modify the reset operation */
360
+ interface ResetOptions extends BaseOperationOptions {
361
+ /**
362
+ * Modifications to make to each Card as part of the reset operation,
363
+ * for example the displayed face
364
+ * @defaultValue `{}`
365
+ */
366
+ updateData?: DeepPartial<ConstructorDataType<foundry.data.CardData>> | undefined;
367
+ }
368
+
369
+ /** Additional context which describes the operation. */
370
+ interface ReturnContext {
371
+ /**
372
+ * A mapping of Card deck IDs to the update operations that
373
+ * will be performed on them.
374
+ */
375
+ toUpdate: Record<string, DeepPartial<ConstructorDataType<foundry.data.CardData>>[]>;
376
+
377
+ /**
378
+ * Card deletion operations to be performed on the origin Cards
379
+ * document.
380
+ */
381
+ fromDelete: string[];
382
+ }
383
+ }
384
+ }
@@ -1,5 +1,6 @@
1
- import { ConfiguredDocumentClass, ConstructorDataType } from '../../../types/helperTypes';
1
+ import { ConfiguredDocumentClass } from '../../../types/helperTypes';
2
2
  import { DocumentModificationOptions } from '../../common/abstract/document.mjs';
3
+ import type { ChatMessageDataConstructorData } from '../../common/data/data.mjs/chatMessageData.js';
3
4
 
4
5
  declare global {
5
6
  /**
@@ -72,15 +73,15 @@ declare global {
72
73
  * @returns The modified ChatMessage data with rollMode preferences applied
73
74
  */
74
75
  static applyRollMode(
75
- chatData: ConstructorDataType<foundry.data.ChatMessageData>,
76
- rollMode: foundry.CONST.DiceRollMode
77
- ): ConstructorDataType<foundry.data.ChatMessageData>;
76
+ chatData: ChatMessageDataConstructorData,
77
+ rollMode: foundry.CONST.DICE_ROLL_MODES
78
+ ): ChatMessageDataConstructorData;
78
79
 
79
80
  /**
80
81
  * Update the data of a ChatMessage instance to apply a requested rollMode
81
82
  * @param rollMode - The rollMode preference to apply to this message data
82
83
  */
83
- applyRollMode(rollMode: foundry.CONST.DiceRollMode): void;
84
+ applyRollMode(rollMode: foundry.CONST.DICE_ROLL_MODES): void;
84
85
 
85
86
  /**
86
87
  * Attempt to determine who is the speaking character (and token) for a certain Chat Message
@@ -99,10 +100,10 @@ declare global {
99
100
  token,
100
101
  alias
101
102
  }?: {
102
- scene?: InstanceType<ConfiguredDocumentClass<typeof Scene>>;
103
- actor?: InstanceType<ConfiguredDocumentClass<typeof Actor>>;
104
- token?: InstanceType<ConfiguredDocumentClass<typeof TokenDocument>>;
105
- alias?: string;
103
+ scene?: InstanceType<ConfiguredDocumentClass<typeof Scene>> | undefined;
104
+ actor?: InstanceType<ConfiguredDocumentClass<typeof Actor>> | undefined;
105
+ token?: InstanceType<ConfiguredDocumentClass<typeof TokenDocument>> | undefined;
106
+ alias?: string | undefined;
106
107
  }): foundry.data.ChatMessageData['speaker']['_source'];
107
108
 
108
109
  /**
@@ -197,7 +198,7 @@ declare global {
197
198
 
198
199
  /** @override */
199
200
  _preCreate(
200
- data: ConstructorDataType<foundry.data.ChatMessageData>,
201
+ data: ChatMessageDataConstructorData,
201
202
  options: DocumentModificationOptions,
202
203
  user: foundry.documents.BaseUser
203
204
  ): Promise<void>;
@@ -1,6 +1,7 @@
1
- import { ConfiguredDocumentClass, ConstructorDataType, PropertiesToSource } from '../../../types/helperTypes';
1
+ import { ConfiguredDocumentClass, PropertiesToSource } from '../../../types/helperTypes';
2
2
  import { DocumentModificationOptions } from '../../common/abstract/document.mjs';
3
3
  import { CombatantDataProperties } from '../../common/data/data.mjs/combatantData';
4
+ import type { CombatDataConstructorData } from '../../common/data/data.mjs/combatData.js';
4
5
 
5
6
  declare global {
6
7
  /**
@@ -183,18 +184,13 @@ declare global {
183
184
 
184
185
  /** @deprecated since 0.8.0 */
185
186
  createCombatant(
186
- data:
187
- | ConstructorDataType<foundry.data.CombatData>
188
- | (ConstructorDataType<foundry.data.CombatData> & Record<string, unknown>),
187
+ data: CombatDataConstructorData | (CombatDataConstructorData & Record<string, unknown>),
189
188
  options?: DocumentModificationContext
190
189
  ): this['createEmbeddedDocuments'];
191
190
 
192
191
  /** @deprecated since 0.8.0 */
193
192
  updateCombatant(
194
- data: DeepPartial<
195
- | ConstructorDataType<foundry.data.CombatData>
196
- | (ConstructorDataType<foundry.data.CombatData> & Record<string, unknown>)
197
- >,
193
+ data: DeepPartial<CombatDataConstructorData | (CombatDataConstructorData & Record<string, unknown>)>,
198
194
  options?: DocumentModificationContext
199
195
  ): NonNullable<ReturnType<this['combatants']['get']>>['update'];
200
196
 
@@ -75,7 +75,7 @@ declare global {
75
75
  /** @override */
76
76
  testUserPermission(
77
77
  user: BaseUser,
78
- permission: keyof typeof foundry.CONST.ENTITY_PERMISSIONS | foundry.CONST.EntityPermission,
78
+ permission: keyof typeof foundry.CONST.DOCUMENT_PERMISSION_LEVELS | foundry.CONST.DOCUMENT_PERMISSION_LEVELS,
79
79
  { exact }?: { exact?: boolean }
80
80
  ): boolean;
81
81
 
@@ -1,5 +1,6 @@
1
+ import { ConfiguredDocumentClass } from '../../../types/helperTypes';
1
2
  import { DocumentModificationOptions } from '../../common/abstract/document.mjs';
2
- import { ConfiguredDocumentClass, ConstructorDataType } from '../../../types/helperTypes';
3
+ import type { FolderDataConstructorData } from '../../common/data/data.mjs/folderData.js';
3
4
 
4
5
  declare global {
5
6
  /**
@@ -69,11 +70,8 @@ declare global {
69
70
  * Document is returned.
70
71
  */
71
72
  static createDialog(
72
- data?: DeepPartial<
73
- | ConstructorDataType<foundry.data.FolderData>
74
- | (ConstructorDataType<foundry.data.FolderData> & Record<string, unknown>)
75
- >,
76
- options?: Dialog.Options
73
+ data?: DeepPartial<FolderDataConstructorData | (FolderDataConstructorData & Record<string, unknown>)> | undefined,
74
+ options?: Dialog.Options | undefined
77
75
  ): any;
78
76
 
79
77
  /**
@@ -1,6 +1,8 @@
1
1
  import './activeEffect';
2
2
  import './actor';
3
3
  import './canvasDocuments';
4
+ import './card';
5
+ import './cards';
4
6
  import './chatMessage';
5
7
  import './combat';
6
8
  import './combatant';
@@ -11,6 +13,7 @@ import './journalEntry';
11
13
  import './macro';
12
14
  import './playlist';
13
15
  import './playlistSound';
16
+ import './prototypeToken';
14
17
  import './rollTable';
15
18
  import './scene';
16
19
  import './setting';
@@ -1,4 +1,5 @@
1
- import { ConfiguredDocumentClass, ConstructorDataType } from '../../../types/helperTypes';
1
+ import { ConfiguredDocumentClass } from '../../../types/helperTypes';
2
+ import type { ItemDataConstructorData } from '../../common/data/data.mjs/itemData.js';
2
3
 
3
4
  declare global {
4
5
  /**
@@ -69,9 +70,7 @@ declare global {
69
70
  * @deprecated since 0.8.1
70
71
  */
71
72
  static createOwned(
72
- itemData:
73
- | ConstructorDataType<foundry.data.ItemData>
74
- | (ConstructorDataType<foundry.data.ItemData> & Record<string, unknown>),
73
+ itemData: ItemDataConstructorData | (ItemDataConstructorData & Record<string, unknown>),
75
74
  actor: InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseActor>>
76
75
  ): InstanceType<ConfiguredDocumentClass<typeof foundry.documents.BaseItem>>;
77
76
  }
@@ -1,5 +1,6 @@
1
- import type { ConfiguredDocumentClass, ConstructorDataType } from '../../../types/helperTypes';
1
+ import type { ConfiguredDocumentClass } from '../../../types/helperTypes';
2
2
  import type { DocumentModificationOptions } from '../../common/abstract/document.mjs';
3
+ import type { PlaylistDataConstructorData } from '../../common/data/data.mjs/playlistData.js';
3
4
 
4
5
  declare global {
5
6
  /**
@@ -38,7 +39,7 @@ declare global {
38
39
  /**
39
40
  * The playback mode for the Playlist instance
40
41
  */
41
- get mode(): foundry.CONST.PlaylistMode;
42
+ get mode(): foundry.CONST.PLAYLIST_MODES;
42
43
 
43
44
  /**
44
45
  * The order in which sounds within this playlist will be played (if sequential or shuffled)
@@ -128,7 +129,7 @@ declare global {
128
129
 
129
130
  /** @override */
130
131
  protected _preUpdate(
131
- changed: DeepPartial<ConstructorDataType<foundry.data.PlaylistData>>,
132
+ changed: DeepPartial<PlaylistDataConstructorData>,
132
133
  options: DocumentModificationOptions,
133
134
  user: foundry.documents.BaseUser
134
135
  ): Promise<void>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * An extended Document definition used specifically
3
+ * This ensures that the PrototypeTokenData schema is used instead of the standard TokenData.
4
+ * This exists specifically for prototype Token configuration in the TokenConfig app and should not be used otherwise.
5
+ * @internal
6
+ * @remarks The types for this are incorrect, in particular everything related to the data should use
7
+ * {@link foundry.data.PrototypeTokenData} instead of {@link foundry.data.TokenData}. However, with the current approach
8
+ * to type documents, we don't see a way to do this. This class is just added for reference. As the documentation above
9
+ * says, don't use it (there really shouldn't be a need to do so).
10
+ */
11
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
12
+ // @ts-ignore
13
+ declare class PrototypeTokenDocument extends TokenDocument {
14
+ static get schema(): typeof foundry.data.PrototypeTokenData;
15
+ }
@@ -158,7 +158,7 @@ declare global {
158
158
  /**
159
159
  * The chat roll mode to use when displaying the result
160
160
  */
161
- rollMode: foundry.CONST.DiceRollMode;
161
+ rollMode: foundry.CONST.DICE_ROLL_MODES;
162
162
  }
163
163
 
164
164
  /**