@league-of-foundry-developers/foundry-vtt-types 0.8.9-9 → 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 (178) hide show
  1. package/README.md +44 -27
  2. package/index.d.ts +2 -2
  3. package/package.json +34 -15
  4. package/src/foundry/common/abstract/document.mjs.d.ts +24 -10
  5. package/src/foundry/common/config.mjs/index.d.ts +1 -0
  6. package/src/foundry/common/config.mjs/releaseData.d.ts +98 -0
  7. package/src/foundry/common/constants.mjs.d.ts +402 -213
  8. package/src/foundry/common/data/data.mjs/activeEffectData.d.ts +36 -29
  9. package/src/foundry/common/data/data.mjs/actorData.d.ts +32 -21
  10. package/src/foundry/common/data/data.mjs/adventureData.d.ts +165 -0
  11. package/src/foundry/common/data/data.mjs/ambientLightData.d.ts +45 -124
  12. package/src/foundry/common/data/data.mjs/ambientSoundData.d.ts +49 -77
  13. package/src/foundry/common/data/data.mjs/animationData.d.ts +17 -9
  14. package/src/foundry/common/data/data.mjs/cardData.d.ts +265 -0
  15. package/src/foundry/common/data/data.mjs/cardFaceData.d.ts +66 -0
  16. package/src/foundry/common/data/data.mjs/cardsData.d.ts +238 -0
  17. package/src/foundry/common/data/data.mjs/chatMessageData.d.ts +51 -39
  18. package/src/foundry/common/data/data.mjs/chatSpeakerData.d.ts +18 -11
  19. package/src/foundry/common/data/data.mjs/combatData.d.ts +51 -25
  20. package/src/foundry/common/data/data.mjs/combatantData.d.ts +48 -30
  21. package/src/foundry/common/data/data.mjs/darknessActivation.d.ts +8 -7
  22. package/src/foundry/common/data/data.mjs/drawingData.d.ts +68 -67
  23. package/src/foundry/common/data/data.mjs/effectChangeData.d.ts +21 -25
  24. package/src/foundry/common/data/data.mjs/effectDurationData.d.ts +24 -23
  25. package/src/foundry/common/data/data.mjs/fogExplorationData.d.ts +23 -16
  26. package/src/foundry/common/data/data.mjs/folderData.d.ts +28 -25
  27. package/src/foundry/common/data/data.mjs/index.d.ts +5 -0
  28. package/src/foundry/common/data/data.mjs/itemData.d.ts +26 -18
  29. package/src/foundry/common/data/data.mjs/journalEntryData.d.ts +21 -20
  30. package/src/foundry/common/data/data.mjs/lightData.d.ts +228 -0
  31. package/src/foundry/common/data/data.mjs/macroData.d.ts +52 -35
  32. package/src/foundry/common/data/data.mjs/measuredTemplateData.d.ts +41 -38
  33. package/src/foundry/common/data/data.mjs/noteData.d.ts +47 -37
  34. package/src/foundry/common/data/data.mjs/playlistData.d.ts +55 -26
  35. package/src/foundry/common/data/data.mjs/playlistSoundData.d.ts +32 -16
  36. package/src/foundry/common/data/data.mjs/prototypeTokenData.d.ts +7 -11
  37. package/src/foundry/common/data/data.mjs/rollTableData.d.ts +30 -24
  38. package/src/foundry/common/data/data.mjs/sceneData.d.ts +132 -111
  39. package/src/foundry/common/data/data.mjs/settingData.d.ts +11 -8
  40. package/src/foundry/common/data/data.mjs/tableResultData.d.ts +30 -26
  41. package/src/foundry/common/data/data.mjs/tileData.d.ts +43 -36
  42. package/src/foundry/common/data/data.mjs/tileOcclusion.d.ts +10 -9
  43. package/src/foundry/common/data/data.mjs/tokenBarData.d.ts +6 -3
  44. package/src/foundry/common/data/data.mjs/tokenData.d.ts +105 -157
  45. package/src/foundry/common/data/data.mjs/userData.d.ts +111 -33
  46. package/src/foundry/common/data/data.mjs/videoData.d.ts +9 -8
  47. package/src/foundry/common/data/data.mjs/wallData.d.ts +67 -39
  48. package/src/foundry/common/data/fields.mjs.d.ts +180 -83
  49. package/src/foundry/common/documents.mjs/baseActiveEffect.d.ts +9 -3
  50. package/src/foundry/common/documents.mjs/baseActor.d.ts +17 -45
  51. package/src/foundry/common/documents.mjs/baseAdventure.d.ts +38 -0
  52. package/src/foundry/common/documents.mjs/baseAmbientLight.d.ts +3 -0
  53. package/src/foundry/common/documents.mjs/baseAmbientSound.d.ts +3 -1
  54. package/src/foundry/common/documents.mjs/baseCard.d.ts +62 -0
  55. package/src/foundry/common/documents.mjs/baseCards.d.ts +39 -0
  56. package/src/foundry/common/documents.mjs/baseChatMessage.d.ts +3 -0
  57. package/src/foundry/common/documents.mjs/baseCombat.d.ts +5 -2
  58. package/src/foundry/common/documents.mjs/baseCombatant.d.ts +10 -1
  59. package/src/foundry/common/documents.mjs/baseDrawing.d.ts +11 -1
  60. package/src/foundry/common/documents.mjs/baseFogExploration.d.ts +4 -3
  61. package/src/foundry/common/documents.mjs/baseFolder.d.ts +10 -1
  62. package/src/foundry/common/documents.mjs/baseItem.d.ts +11 -29
  63. package/src/foundry/common/documents.mjs/baseJournalEntry.d.ts +3 -0
  64. package/src/foundry/common/documents.mjs/baseMacro.d.ts +16 -14
  65. package/src/foundry/common/documents.mjs/baseMeasuredTemplate.d.ts +4 -1
  66. package/src/foundry/common/documents.mjs/baseNote.d.ts +2 -2
  67. package/src/foundry/common/documents.mjs/basePlaylist.d.ts +1 -0
  68. package/src/foundry/common/documents.mjs/basePlaylistSound.d.ts +2 -1
  69. package/src/foundry/common/documents.mjs/baseRollTable.d.ts +3 -0
  70. package/src/foundry/common/documents.mjs/baseScene.d.ts +1 -0
  71. package/src/foundry/common/documents.mjs/baseSetting.d.ts +1 -0
  72. package/src/foundry/common/documents.mjs/baseTableResult.d.ts +10 -3
  73. package/src/foundry/common/documents.mjs/baseTile.d.ts +1 -0
  74. package/src/foundry/common/documents.mjs/baseToken.d.ts +3 -0
  75. package/src/foundry/common/documents.mjs/baseUser.d.ts +7 -1
  76. package/src/foundry/common/documents.mjs/baseWall.d.ts +7 -10
  77. package/src/foundry/common/documents.mjs/index.d.ts +3 -0
  78. package/src/foundry/common/module.mjs.d.ts +3 -0
  79. package/src/foundry/common/packages.mjs/moduleData.d.ts +12 -9
  80. package/src/foundry/common/packages.mjs/packageAuthorData.d.ts +24 -24
  81. package/src/foundry/common/packages.mjs/packageCompendiumData.d.ts +27 -21
  82. package/src/foundry/common/packages.mjs/packageData.d.ts +108 -82
  83. package/src/foundry/common/packages.mjs/packageDependencyData.d.ts +18 -11
  84. package/src/foundry/common/packages.mjs/packageLanguageData.d.ts +16 -15
  85. package/src/foundry/common/packages.mjs/systemData.d.ts +21 -20
  86. package/src/foundry/common/packages.mjs/tagPackageAvailability.d.ts +3 -3
  87. package/src/foundry/common/packages.mjs/worldData.d.ts +29 -18
  88. package/src/foundry/common/types.mjs.d.ts +95 -0
  89. package/src/foundry/common/utils/helpers.mjs.d.ts +27 -2
  90. package/src/foundry/common/utils/primitives.mjs.d.ts +99 -16
  91. package/src/foundry/foundry.js/application.d.ts +2 -2
  92. package/src/foundry/foundry.js/applications/filePicker.d.ts +1 -1
  93. package/src/foundry/foundry.js/applications/formApplication.d.ts +1 -1
  94. package/src/foundry/foundry.js/applications/formApplications/documentSheet.d.ts +1 -1
  95. package/src/foundry/foundry.js/applications/formApplications/documentSheets/activeEffectConfig.d.ts +1 -1
  96. package/src/foundry/foundry.js/applications/formApplications/documentSheets/actorSheet.d.ts +1 -1
  97. package/src/foundry/foundry.js/applications/formApplications/documentSheets/ambientLightConfig.d.ts +104 -0
  98. package/src/foundry/foundry.js/applications/formApplications/documentSheets/ambientSoundConfig.d.ts +1 -1
  99. package/src/foundry/foundry.js/applications/formApplications/documentSheets/folderConfig.d.ts +1 -1
  100. package/src/foundry/foundry.js/applications/formApplications/documentSheets/index.d.ts +1 -0
  101. package/src/foundry/foundry.js/applications/formApplications/documentSheets/lightConfig.d.ts +5 -79
  102. package/src/foundry/foundry.js/applications/formApplications/documentSheets/measuredTemplateConfig.d.ts +1 -1
  103. package/src/foundry/foundry.js/applications/formApplications/documentSheets/noteConfig.d.ts +2 -2
  104. package/src/foundry/foundry.js/applications/formApplications/documentSheets/permissionControl.d.ts +5 -5
  105. package/src/foundry/foundry.js/applications/formApplications/documentSheets/playlistConfig.d.ts +1 -1
  106. package/src/foundry/foundry.js/applications/formApplications/documentSheets/rollTableConfig.d.ts +5 -8
  107. package/src/foundry/foundry.js/applications/formApplications/documentSheets/sceneConfig.d.ts +3 -3
  108. package/src/foundry/foundry.js/applications/formApplications/documentSheets/tileConfig.d.ts +1 -1
  109. package/src/foundry/foundry.js/applications/formApplications/drawingConfig.d.ts +1 -1
  110. package/src/foundry/foundry.js/applications/formApplications/gridConfig.d.ts +1 -1
  111. package/src/foundry/foundry.js/applications/formApplications/imagePopout.d.ts +1 -1
  112. package/src/foundry/foundry.js/applications/formApplications/index.d.ts +1 -0
  113. package/src/foundry/foundry.js/applications/formApplications/keybindingsConfig.d.ts +257 -0
  114. package/src/foundry/foundry.js/applications/formApplications/tokenConfig.d.ts +8 -9
  115. package/src/foundry/foundry.js/applications/formApplications/wallConfig.d.ts +6 -6
  116. package/src/foundry/foundry.js/applications/sidebarTab.d.ts +1 -1
  117. package/src/foundry/foundry.js/applications/sidebarTabs/chatLog.d.ts +7 -6
  118. package/src/foundry/foundry.js/applications/sidebarTabs/compendiumDirectory.d.ts +2 -2
  119. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/cardsDirectory.d.ts +7 -0
  120. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/index.d.ts +1 -0
  121. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/playlistDirectory.d.ts +2 -2
  122. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectory.d.ts +2 -2
  123. package/src/foundry/foundry.js/avSettings.d.ts +7 -7
  124. package/src/foundry/foundry.js/canvas.d.ts +148 -46
  125. package/src/foundry/foundry.js/canvasAnimation.d.ts +1 -1
  126. package/src/foundry/foundry.js/canvasDocumentMixin.d.ts +7 -0
  127. package/src/foundry/foundry.js/clientDocumentMixin.d.ts +45 -91
  128. package/src/foundry/foundry.js/clientDocuments/activeEffect.d.ts +3 -2
  129. package/src/foundry/foundry.js/clientDocuments/actor.d.ts +3 -7
  130. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/ambientSoundDocument.d.ts +1 -6
  131. package/src/foundry/foundry.js/clientDocuments/card.d.ts +133 -0
  132. package/src/foundry/foundry.js/clientDocuments/cards.d.ts +384 -0
  133. package/src/foundry/foundry.js/clientDocuments/chatMessage.d.ts +11 -10
  134. package/src/foundry/foundry.js/clientDocuments/combat.d.ts +4 -8
  135. package/src/foundry/foundry.js/clientDocuments/combatant.d.ts +1 -1
  136. package/src/foundry/foundry.js/clientDocuments/folder.d.ts +4 -6
  137. package/src/foundry/foundry.js/clientDocuments/index.d.ts +2 -0
  138. package/src/foundry/foundry.js/clientDocuments/item.d.ts +3 -4
  139. package/src/foundry/foundry.js/clientDocuments/playlist.d.ts +4 -3
  140. package/src/foundry/foundry.js/clientDocuments/rollTable.d.ts +1 -1
  141. package/src/foundry/foundry.js/clientDocuments/scene.d.ts +30 -23
  142. package/src/foundry/foundry.js/clientKeybindings.d.ts +299 -0
  143. package/src/foundry/foundry.js/clientSettings.d.ts +11 -9
  144. package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +1 -1
  145. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/cardStacks.d.ts +9 -0
  146. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/index.d.ts +1 -0
  147. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/playlists.d.ts +3 -2
  148. package/src/foundry/foundry.js/config.d.ts +465 -887
  149. package/src/foundry/foundry.js/game.d.ts +86 -11
  150. package/src/foundry/foundry.js/gamepadManager.d.ts +41 -0
  151. package/src/foundry/foundry.js/handlebarsHelpers.d.ts +4 -4
  152. package/src/foundry/foundry.js/hooks.d.ts +57 -0
  153. package/src/foundry/foundry.js/keyboardManager.d.ts +165 -213
  154. package/src/foundry/foundry.js/mouseManager.d.ts +18 -0
  155. package/src/foundry/foundry.js/newUserExperience.d.ts +34 -0
  156. package/src/foundry/foundry.js/pixi/containers/cachedContainer.d.ts +8 -0
  157. package/src/foundry/foundry.js/pixi/containers/cachedContainers/index.d.ts +1 -0
  158. package/src/foundry/foundry.js/pixi/containers/cachedContainers/primaryCanvasGroup.d.ts +42 -0
  159. package/src/foundry/foundry.js/pixi/containers/canvasLayers/gridLayer.d.ts +2 -2
  160. package/src/foundry/foundry.js/pixi/containers/canvasLayers/index.d.ts +1 -1
  161. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/wallsLayer.d.ts +3 -3
  162. package/src/foundry/foundry.js/pixi/containers/canvasLayers/{effectsLayer.d.ts → weatherLayer.d.ts} +7 -7
  163. package/src/foundry/foundry.js/pixi/containers/effectsCanvasGroup.d.ts +29 -0
  164. package/src/foundry/foundry.js/pixi/containers/index.d.ts +3 -0
  165. package/src/foundry/foundry.js/pixi/containers/interfaceCanvasGroup.d.ts +27 -0
  166. package/src/foundry/foundry.js/pixi/containers/placeableObjects/token.d.ts +1 -1
  167. package/src/foundry/foundry.js/pointSource.d.ts +2 -2
  168. package/src/foundry/foundry.js/roll.d.ts +25 -36
  169. package/src/foundry/foundry.js/rollTerm.d.ts +7 -4
  170. package/src/foundry/foundry.js/rollTerms/diceTerm.d.ts +4 -22
  171. package/src/foundry/foundry.js/rollTerms/mathTerm.d.ts +3 -0
  172. package/src/foundry/foundry.js/rollTerms/parentheticalTerm.d.ts +3 -0
  173. package/src/foundry/foundry.js/rollTerms/poolTerm.d.ts +3 -5
  174. package/src/foundry/foundry.js/rollTerms/stringTerm.d.ts +4 -1
  175. package/src/foundry/foundry.js/searchFilter.d.ts +1 -1
  176. package/src/foundry/foundry.js/textEditor.d.ts +1 -1
  177. package/src/foundry/index.d.ts +4 -0
  178. package/src/types/utils.d.ts +11 -3
@@ -6,9 +6,4 @@
6
6
  * @see {@link documents.Scene} The Scene document type which contains AmbientSound embedded documents
7
7
  * @see {@link applications.AmbientSoundConfig} The AmbientSound configuration application
8
8
  */
9
- declare class AmbientSoundDocument extends CanvasDocumentMixin(foundry.documents.BaseAmbientSound) {
10
- /**
11
- * A convenience accessor for the sound type
12
- */
13
- get type(): foundry.data.AmbientSoundData['type'];
14
- }
9
+ declare class AmbientSoundDocument extends CanvasDocumentMixin(foundry.documents.BaseAmbientSound) {}
@@ -0,0 +1,133 @@
1
+ import type { ConfiguredDocumentClassForName, ConstructorDataType } from '../../../types/helperTypes';
2
+
3
+ declare global {
4
+ /**
5
+ * The client-side Card document which extends the common BaseCard model.
6
+ * Each Card document contains CardData which defines its data schema.
7
+ *
8
+ * @see {@link data.CardData} The Card data schema
9
+ * @see {@link documents.Cards} The Cards document type which contains Card embedded documents
10
+ */
11
+ class Card extends ClientDocumentMixin(foundry.documents.BaseCard) {
12
+ /**
13
+ * The card back.
14
+ * This reference is cached and lazily evaluated to retrieve an image and name from the source deck.
15
+ */
16
+ get back(): foundry.data.CardFaceData;
17
+
18
+ /**
19
+ * @defaultValue `undefined`
20
+ * @internal
21
+ */
22
+ protected _back?: foundry.data.CardFaceData | undefined;
23
+
24
+ /**
25
+ * The current card face
26
+ */
27
+ get face(): foundry.data.CardFaceData | null;
28
+
29
+ /**
30
+ * The image used to depict the back of this card
31
+ */
32
+ get backImg(): string;
33
+
34
+ /**
35
+ * The image of the currently displayed card face or back
36
+ */
37
+ get img(): string;
38
+
39
+ /**
40
+ * The name of the current card face, or the name of the card itself
41
+ */
42
+ get name(): string;
43
+
44
+ /**
45
+ * A reference to the source Cards document which defines this Card.
46
+ */
47
+ get source(): InstanceType<ConfiguredDocumentClassForName<'Cards'>> | undefined | null;
48
+
49
+ /**
50
+ * A convenience property for whether or not the Card is within its source Cards stack.
51
+ */
52
+ get isHome(): boolean;
53
+
54
+ /**
55
+ * Whether or not to display the face of this card?
56
+ */
57
+ get showFace(): boolean;
58
+
59
+ /**
60
+ * Does this Card have a next face available to flip to?
61
+ */
62
+ get hasNextFace(): boolean;
63
+
64
+ /**
65
+ * Does this Card have a previous face available to flip to?
66
+ */
67
+ get hasPreviousFace(): boolean;
68
+
69
+ /** @override */
70
+ prepareDerivedData(): void;
71
+
72
+ /**
73
+ * Flip this card to some other face. A specific face may be requested, otherwise:
74
+ * If the card currently displays a face the card is flipped to the back.
75
+ * If the card currently displays the back it is flipped to the first face.
76
+ * @param face - A specific face to flip the card to
77
+ * @returns A reference to this card after the flip operation is complete
78
+ */
79
+ flip(face?: number | null | undefined): Promise<InstanceType<ConfiguredDocumentClassForName<'Card'>> | undefined>;
80
+
81
+ /**
82
+ * Pass this Card to some other Cards document.
83
+ * @param to - A new Cards document this card should be passed to
84
+ * @param options - (default: `{}`)
85
+ * @returns A reference to this card after the it has been passed to another parent document
86
+ */
87
+ pass(
88
+ to: InstanceType<ConfiguredDocumentClassForName<'Cards'>>,
89
+ options?: Cards.PassOptions | undefined
90
+ ): Promise<InstanceType<ConfiguredDocumentClassForName<'Card'>> | undefined>;
91
+
92
+ /**
93
+ * Play a specific card to some other Cards document.
94
+ * This method is currently a more semantic alias for Card#pass.
95
+ * @see Card#pass
96
+ */
97
+ play(
98
+ to: InstanceType<ConfiguredDocumentClassForName<'Cards'>>,
99
+ options?: Cards.PassOptions | undefined
100
+ ): Promise<InstanceType<ConfiguredDocumentClassForName<'Card'>> | undefined>;
101
+
102
+ /**
103
+ * Discard a specific card to some other Cards document.
104
+ * This method is currently a more semantic alias for Card#pass.
105
+ * @see Card#pass
106
+ */
107
+ discard(
108
+ to: InstanceType<ConfiguredDocumentClassForName<'Cards'>>,
109
+ options?: Cards.PassOptions | undefined
110
+ ): Promise<InstanceType<ConfiguredDocumentClassForName<'Card'>> | undefined>;
111
+
112
+ /**
113
+ * Reset this Card to its original Cards parent.
114
+ * @param options - Options which modify the reset operation
115
+ * (default: `{}`)
116
+ * @returns A reference to the reset card belonging to its original parent
117
+ */
118
+ reset(options?: Cards.ResetOptions | undefined): Promise<InstanceType<ConfiguredDocumentClassForName<'Card'>>>;
119
+
120
+ /**
121
+ * Create a chat message which displays this Card.
122
+ * @param messageData - Additional data which becomes part of the created ChatMessageData
123
+ * (default: `{}`)
124
+ * @param options - Options which modify the message creation operation
125
+ * (default: `{}`)
126
+ * @returns The created chat message
127
+ */
128
+ toMessage(
129
+ messageData?: ConstructorDataType<foundry.data.ChatMessageData> | undefined,
130
+ options?: DocumentModificationContext | undefined
131
+ ): Promise<InstanceType<ConfiguredDocumentClassForName<'ChatMessage'>> | undefined>;
132
+ }
133
+ }
@@ -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';
@@ -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
  }