@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
@@ -1,16 +1,17 @@
1
- import * as CONST from '../constants.mjs';
1
+ import { DOCUMENT_PERMISSION_LEVELS } from '../constants.mjs';
2
2
  import { hasImageExtension, isColorString, isJSON } from './validators.mjs';
3
3
  import { Document } from '../abstract/module.mjs';
4
4
  import { FieldReturnType } from '../../../types/helperTypes';
5
5
 
6
6
  /**
7
7
  * A required boolean field which may be used in a Document.
8
- * @remarks
8
+ */
9
+ export const BOOLEAN_FIELD: BooleanField;
10
+ /**
9
11
  * Property type: `boolean`
10
- * Constructor type: `boolean | undefined | null`
12
+ * Constructor type: `boolean | null | undefined`
11
13
  * Default: `false`
12
14
  */
13
- export declare const BOOLEAN_FIELD: BooleanField;
14
15
  interface BooleanField extends DocumentField<boolean> {
15
16
  type: typeof Boolean;
16
17
  required: true;
@@ -19,11 +20,12 @@ interface BooleanField extends DocumentField<boolean> {
19
20
 
20
21
  /**
21
22
  * A standard string color field which may be used in a Document.
22
- * @remarks
23
- * Property type: `string | undefined | null`
24
- * Constructor type: `string | undefined | null`
25
23
  */
26
- export declare const COLOR_FIELD: ColorField;
24
+ export const COLOR_FIELD: ColorField;
25
+ /**
26
+ * Property type: `string | null | undefined`
27
+ * Constructor type: `string | null | undefined`
28
+ */
27
29
  interface ColorField extends DocumentField<string> {
28
30
  type: typeof String;
29
31
  required: false;
@@ -34,11 +36,12 @@ interface ColorField extends DocumentField<string> {
34
36
 
35
37
  /**
36
38
  * A standard string field for an image file path which may be used in a Document.
37
- * @remarks
38
- * Property type: `string | undefined | null`
39
- * Constructor type: `string | undefined | null`
40
39
  */
41
- export declare const IMAGE_FIELD: ImageField;
40
+ export const IMAGE_FIELD: ImageField;
41
+ /**
42
+ * Property type: `string | null | undefined`
43
+ * Constructor type: `string | null | undefined`
44
+ */
42
45
  interface ImageField extends DocumentField<string> {
43
46
  type: typeof String;
44
47
  required: false;
@@ -49,11 +52,12 @@ interface ImageField extends DocumentField<string> {
49
52
 
50
53
  /**
51
54
  * A standard string field for a video or image file path may be used in a Document.
52
- * @remarks
53
- * Property type: `string | undefined | null`
54
- * Constructor type: `string | undefined | null`
55
55
  */
56
- export declare const VIDEO_FIELD: VideoField;
56
+ export const VIDEO_FIELD: VideoField;
57
+ /**
58
+ * Property type: `string | null | undefined`
59
+ * Constructor type: `string | null | undefined`
60
+ */
57
61
  interface VideoField extends DocumentField<string> {
58
62
  type: typeof String;
59
63
  required: false;
@@ -64,11 +68,12 @@ interface VideoField extends DocumentField<string> {
64
68
 
65
69
  /**
66
70
  * A standard string field for an audio file path which may be used in a Document.
67
- * @remarks
68
- * Property type: `string | undefined | null`
69
- * Constructor type: `string | undefined | null`
70
71
  */
71
- export declare const AUDIO_FIELD: AudioField;
72
+ export const AUDIO_FIELD: AudioField;
73
+ /**
74
+ * Property type: `string | null | undefined`
75
+ * Constructor type: `string | null | undefined`
76
+ */
72
77
  interface AudioField extends DocumentField<string> {
73
78
  type: typeof String;
74
79
  required: false;
@@ -79,11 +84,12 @@ interface AudioField extends DocumentField<string> {
79
84
 
80
85
  /**
81
86
  * A standard integer field which may be used in a Document.
82
- * @remarks
87
+ */
88
+ export const INTEGER_FIELD: IntegerField;
89
+ /**
83
90
  * Property type: `number | undefined`
84
- * Constructor type: `number | undefined | null`
91
+ * Constructor type: `number | null | undefined`
85
92
  */
86
- export declare const INTEGER_FIELD: IntegerField;
87
93
  interface IntegerField extends DocumentField<number> {
88
94
  type: typeof Number;
89
95
  required: false;
@@ -93,12 +99,13 @@ interface IntegerField extends DocumentField<number> {
93
99
 
94
100
  /**
95
101
  * A string field which contains serialized JSON data that may be used in a Document.
96
- * @remarks
102
+ */
103
+ export const JSON_FIELD: JsonField;
104
+ /**
97
105
  * Property type: `string | undefined`
98
- * Constructor type: `string | object | undefined | null`
106
+ * Constructor type: `string | object | null | undefined`
99
107
  */
100
- export declare const JSON_FIELD: JSONField;
101
- interface JSONField extends DocumentField<string> {
108
+ interface JsonField extends DocumentField<string> {
102
109
  type: typeof String;
103
110
  required: false;
104
111
  clean: (s: unknown) => string;
@@ -108,11 +115,12 @@ interface JSONField extends DocumentField<string> {
108
115
 
109
116
  /**
110
117
  * A non-negative integer field which may be used in a Document.
111
- * @remarks
118
+ */
119
+ export const NONNEGATIVE_INTEGER_FIELD: NonnegativeIntegerField;
120
+ /**
112
121
  * Property type: `number | undefined`
113
- * Constructor type: `number | undefined | null`
122
+ * Constructor type: `number | null | undefined`
114
123
  */
115
- export declare const NONNEGATIVE_INTEGER_FIELD: NonnegativeIntegerField;
116
124
  interface NonnegativeIntegerField extends DocumentField<number> {
117
125
  type: typeof Number;
118
126
  required: false;
@@ -124,11 +132,12 @@ interface NonnegativeIntegerField extends DocumentField<number> {
124
132
  * A non-negative integer field which may be used in a Document.
125
133
  *
126
134
  * @remarks The validation actually checks for `> 0`, the JSDoc is incorrect in foundry.
127
- * @remarks
135
+ */
136
+ export const POSITIVE_INTEGER_FIELD: PositiveIntegerField;
137
+ /**
128
138
  * Property type: `number | undefined`
129
- * Constructor type: `number | undefined | null`
139
+ * Constructor type: `number | null | undefined`
130
140
  */
131
- export declare const POSITIVE_INTEGER_FIELD: PositiveIntegerField;
132
141
  interface PositiveIntegerField extends DocumentField<number> {
133
142
  type: typeof Number;
134
143
  required: false;
@@ -138,25 +147,27 @@ interface PositiveIntegerField extends DocumentField<number> {
138
147
 
139
148
  /**
140
149
  * A template for a required inner-object field which may be used in a Document.
141
- * @remarks
150
+ */
151
+ export const OBJECT_FIELD: ObjectField;
152
+ /**
142
153
  * Property type: `object`
143
- * Constructor type: `object | undefined | null`
154
+ * Constructor type: `object | null | undefined`
144
155
  * Default `{}`
145
156
  */
146
- export declare const OBJECT_FIELD: ObjectField;
147
157
  interface ObjectField extends DocumentField<object> {
148
158
  type: typeof Object;
149
- default: {};
159
+ default: Record<string, never>;
150
160
  required: true;
151
161
  }
152
162
 
153
163
  /**
154
164
  * An optional string field which may be included by a Document.
155
- * @remarks
165
+ */
166
+ export const STRING_FIELD: StringField;
167
+ /**
156
168
  * Property type: `string | undefined`
157
- * Constructor type: `string | undefined | null`
169
+ * Constructor type: `string | null | undefined`
158
170
  */
159
- export declare const STRING_FIELD: StringField;
160
171
  interface StringField extends DocumentField<string> {
161
172
  type: typeof String;
162
173
  required: false;
@@ -165,11 +176,12 @@ interface StringField extends DocumentField<string> {
165
176
 
166
177
  /**
167
178
  * An optional numeric field which may be included in a Document.
168
- * @remarks
169
- * Property type: `number | undefined | null`
170
- * Constructor type: `number | undefined | null`
171
179
  */
172
- export declare const NUMERIC_FIELD: NumericField;
180
+ export const NUMERIC_FIELD: NumericField;
181
+ /**
182
+ * Property type: `number | null | undefined`
183
+ * Constructor type: `number | null | undefined`
184
+ */
173
185
  interface NumericField extends DocumentField<number> {
174
186
  type: typeof Number;
175
187
  required: false;
@@ -178,12 +190,13 @@ interface NumericField extends DocumentField<number> {
178
190
 
179
191
  /**
180
192
  * A required numeric field which may be included in a Document and may not be null.
181
- * @remarks
193
+ */
194
+ export const REQUIRED_NUMBER: RequiredNumber;
195
+ /**
182
196
  * Property type: `number`
183
- * Constructor type: `number | undefined | null`
197
+ * Constructor type: `number | null | undefined`
184
198
  * Default: `0`
185
199
  */
186
- export declare const REQUIRED_NUMBER: RequiredNumber;
187
200
  interface RequiredNumber extends DocumentField<number> {
188
201
  type: typeof Number;
189
202
  required: true;
@@ -191,13 +204,32 @@ interface RequiredNumber extends DocumentField<number> {
191
204
  default: 0;
192
205
  }
193
206
 
207
+ /**
208
+ * A field used to designate a non-negative number
209
+ */
210
+ export const NONNEGATIVE_NUMBER_FIELD: NonnegativeNumberField;
211
+ /**
212
+ * Property type: `number`
213
+ * Constructor type: `number | null | undefined`
214
+ * Default: `0`
215
+ */
216
+ interface NonnegativeNumberField extends DocumentField<number> {
217
+ type: typeof Number;
218
+ required: true;
219
+ nullable: false;
220
+ default: 0;
221
+ validate: (n: unknown) => boolean;
222
+ validationError: '{name} {field} "{value}" must be a non-negative number';
223
+ }
224
+
194
225
  /**
195
226
  * A required numeric field which must be a positive finite value that may be included in a Document.
196
- * @remarks
227
+ */
228
+ export const REQUIRED_POSITIVE_NUMBER: RequiredPositiveNumber;
229
+ /**
197
230
  * Property type: `number`
198
231
  * Constructor type: `number`
199
232
  */
200
- export declare const REQUIRED_POSITIVE_NUMBER: RequiredPositiveNumber;
201
233
  interface RequiredPositiveNumber extends DocumentField<number> {
202
234
  type: typeof Number;
203
235
  required: true;
@@ -208,12 +240,13 @@ interface RequiredPositiveNumber extends DocumentField<number> {
208
240
 
209
241
  /**
210
242
  * A required numeric field which represents an angle of rotation in degrees between 0 and 360.
211
- * @remarks
243
+ */
244
+ export const ANGLE_FIELD: AngleField;
245
+ /**
212
246
  * Property type: `number`
213
- * Constructor type: `number | undefined | null`
247
+ * Constructor type: `number | null | undefined`
214
248
  * Default: `360`
215
249
  */
216
- export declare const ANGLE_FIELD: AngleField;
217
250
  interface AngleField extends DocumentField<number> {
218
251
  type: typeof Number;
219
252
  required: true;
@@ -226,12 +259,13 @@ interface AngleField extends DocumentField<number> {
226
259
 
227
260
  /**
228
261
  * A required numeric field which represents a uniform number between 0 and 1.
229
- * @remarks
262
+ */
263
+ export const ALPHA_FIELD: AlphaField;
264
+ /**
230
265
  * Property type: `number`
231
- * Constructor type: `number | undefined | null`
266
+ * Constructor type: `number | null | undefined`
232
267
  * Default: `1`
233
268
  */
234
- export declare const ALPHA_FIELD: AlphaField;
235
269
  interface AlphaField extends DocumentField<number> {
236
270
  type: typeof Number;
237
271
  required: true;
@@ -243,11 +277,12 @@ interface AlphaField extends DocumentField<number> {
243
277
 
244
278
  /**
245
279
  * A string field which requires a non-blank value and may not be null.
246
- * @remarks
280
+ */
281
+ export const REQUIRED_STRING: RequiredString;
282
+ /**
247
283
  * Property type: `string`
248
284
  * Constructor type: `string`
249
285
  */
250
- export declare const REQUIRED_STRING: RequiredString;
251
286
  interface RequiredString extends DocumentField<string> {
252
287
  type: typeof String;
253
288
  required: true;
@@ -257,12 +292,13 @@ interface RequiredString extends DocumentField<string> {
257
292
 
258
293
  /**
259
294
  * A string field which is required, but may be left blank as an empty string.
260
- * @remarks
295
+ */
296
+ export const BLANK_STRING: BlankString;
297
+ /**
261
298
  * Property type: `string`
262
- * Constructor type: `string | undefined | null`
263
- * Default: `''`
299
+ * Constructor type: `string | null | undefined`
300
+ * Default: `""`
264
301
  */
265
- export declare const BLANK_STRING: BlankString;
266
302
  interface BlankString extends DocumentField<string> {
267
303
  type: typeof String;
268
304
  required: true;
@@ -273,12 +309,13 @@ interface BlankString extends DocumentField<string> {
273
309
 
274
310
  /**
275
311
  * A field used for integer sorting of a Document relative to its siblings
276
- * @remarks
312
+ */
313
+ export const INTEGER_SORT_FIELD: IntegerSortField;
314
+ /**
277
315
  * Property type: `number`
278
- * Constructor type: `number | undefined | null`
316
+ * Constructor type: `number | null | undefined`
279
317
  * Default: `0`
280
318
  */
281
- export declare const INTEGER_SORT_FIELD: IntegerSortField;
282
319
  interface IntegerSortField extends DocumentField<number> {
283
320
  type: typeof Number;
284
321
  required: true;
@@ -289,12 +326,13 @@ interface IntegerSortField extends DocumentField<number> {
289
326
 
290
327
  /**
291
328
  * A numeric timestamp field which may be used in a Document.
292
- * @remarks
329
+ */
330
+ export const TIMESTAMP_FIELD: TimestampField;
331
+ /**
293
332
  * Property type: `number | undefined`
294
- * Constructor type: `number | undefined | null`
295
- * Default: `Date.now`
333
+ * Constructor type: `number | null | undefined`
334
+ * Default: `Date.now()`
296
335
  */
297
- export declare const TIMESTAMP_FIELD: TimestampField;
298
336
  interface TimestampField extends DocumentField<number> {
299
337
  type: typeof Number;
300
338
  required: false;
@@ -311,12 +349,13 @@ declare function _validateId(id: string | null): boolean;
311
349
 
312
350
  /**
313
351
  * The standard identifier for a Document.
314
- * @remarks
352
+ */
353
+ export const DOCUMENT_ID: DocumentId;
354
+ /**
315
355
  * Property type: `string | null`
316
- * Constructor type: `string | undefined | null`
356
+ * Constructor type: `string | null | undefined`
317
357
  * Default: `null`
318
358
  */
319
- export declare const DOCUMENT_ID: DocumentId;
320
359
  interface DocumentId extends DocumentField<string | null> {
321
360
  type: typeof String;
322
361
  required: true;
@@ -328,17 +367,18 @@ interface DocumentId extends DocumentField<string | null> {
328
367
 
329
368
  /**
330
369
  * The standard permissions object which may be included by a Document.
331
- * @remarks
332
- * Property type: `Partial<Record<string, foundry.CONST.EntityPermission>>`
333
- * Constructor type: `Partial<Record<string, foundry.CONST.EntityPermission>> | undefined | null`
334
- * Default: `{ default: CONST.ENTITY_PERMISSIONS.NONE }`
335
370
  */
336
- export declare const DOCUMENT_PERMISSIONS: DocumentPermissions;
337
- interface DocumentPermissions extends DocumentField<Partial<Record<string, foundry.CONST.EntityPermission>>> {
371
+ export const DOCUMENT_PERMISSIONS: DocumentPermissions;
372
+ /**
373
+ * Property type: `Partial<Record<string, DOCUMENT_PERMISSION_LEVELS>>`
374
+ * Constructor type: `Partial<Record<string, DOCUMENT_PERMISSION_LEVELS>> | null | undefined`
375
+ * Default: `{ default: DOCUMENT_PERMISSION_LEVELS.NONE }`
376
+ */
377
+ interface DocumentPermissions extends DocumentField<Partial<Record<string, DOCUMENT_PERMISSION_LEVELS>>> {
338
378
  type: typeof Object;
339
379
  required: true;
340
380
  nullable: false;
341
- default: { default: typeof CONST.ENTITY_PERMISSIONS.NONE };
381
+ default: { default: typeof DOCUMENT_PERMISSION_LEVELS.NONE };
342
382
  validate: typeof _validatePermissions;
343
383
  validationError: '{name} {field} "{value}" is not a mapping of user IDs and document permission levels';
344
384
  }
@@ -362,9 +402,22 @@ interface ForeignDocumentFieldOptions {
362
402
  /**
363
403
  * Create a foreign key field which references a primary Document id
364
404
  */
365
- export declare function foreignDocumentField<T extends ForeignDocumentFieldOptions>(
366
- options: T
367
- ): ForeignDocumentField<T>;
405
+ export function foreignDocumentField<T extends ForeignDocumentFieldOptions>(options: T): ForeignDocumentField<T>;
406
+ /**
407
+ * Default config:
408
+ * ```
409
+ * {
410
+ * type: String,
411
+ * required: false,
412
+ * nullable: true,
413
+ * default: null
414
+ * }
415
+ * ```
416
+ * With default config:
417
+ * Property type: `string | null`
418
+ * Constructor type: `ForeignDocument | string | null | undefined`
419
+ * Default: `null`
420
+ */
368
421
  interface ForeignDocumentField<T extends ForeignDocumentFieldOptions> extends DocumentField<string | null> {
369
422
  type: typeof String;
370
423
  required: T extends {
@@ -402,13 +455,30 @@ interface EmbeddedCollectionFieldOptions {
402
455
  * @param options - Additional field options
403
456
  * (default: `{}`)
404
457
  */
405
- export declare function embeddedCollectionField<
458
+ export function embeddedCollectionField<
406
459
  ConcreteDocumentConstructor extends { readonly documentName: string } & ConstructorOf<Document<any, any>>,
407
460
  Options extends EmbeddedCollectionFieldOptions
408
461
  >(
409
462
  document: ConcreteDocumentConstructor,
410
463
  options?: Options
411
464
  ): EmbeddedCollectionField<ConcreteDocumentConstructor, Options>;
465
+ /**
466
+ * Default config:
467
+ * ```
468
+ * {
469
+ * type: {
470
+ * [documentName]: DocumentConstructor
471
+ * },
472
+ * required: true,
473
+ * default: [],
474
+ * isCollection: true
475
+ * }
476
+ * ```
477
+ * With default config:
478
+ * Property type: `EmbeddedCollection<DocumentConstructor, ParentDocumentData>`
479
+ * Constructor type: `DocumentConstructorData[] | null | undefined`
480
+ * Default: `new EmbeddedCollection(DocumentData, [], DocumentConstructor)`
481
+ */
412
482
  // TODO: Improve
413
483
  interface EmbeddedCollectionField<
414
484
  ConcreteDocumentConstructor extends ConstructorOf<Document<any, any>>,
@@ -420,10 +490,37 @@ interface EmbeddedCollectionField<
420
490
  isCollection: true;
421
491
  }
422
492
 
493
+ /**
494
+ * A special field which contains a data object defined from the game System model.
495
+ * @param document - The Document class definition
496
+ */
497
+ export function systemDataField<
498
+ DocumentSpecifier extends { readonly documentName: keyof Game.SystemData<any>['model'] }
499
+ >(document: DocumentSpecifier): SystemDataField;
500
+ /**
501
+ * Default config:
502
+ * ```
503
+ * {
504
+ * type: Object,
505
+ * required: true,
506
+ * default: object // template object of object type from template.json
507
+ * }
508
+ * ```
509
+ * Property type: `object`
510
+ * Constructor type: `object | null | undefined`
511
+ * Default: `{}`
512
+ */
513
+ // TODO: Improve
514
+ interface SystemDataField extends DocumentField<any> {
515
+ type: typeof Object;
516
+ default: (data: { type?: string }) => Record<string, Record<string, unknown>>;
517
+ required: true;
518
+ }
519
+
423
520
  /**
424
521
  * Return a document field which is a modification of a static field type
425
522
  */
426
- export declare function field<T extends DocumentField<any>, U extends Partial<DocumentField<any>>>(
523
+ export function field<T extends DocumentField<any>, U extends Partial<DocumentField<any>>>(
427
524
  field: T,
428
525
  options?: U
429
526
  ): FieldReturnType<T, U>;
@@ -1,7 +1,8 @@
1
+ import { ConfiguredDocumentClass } from '../../../types/helperTypes';
1
2
  import { DocumentMetadata, DocumentModificationOptions } from '../abstract/document.mjs';
2
- import { ConfiguredDocumentClass, ConstructorDataType } from '../../../types/helperTypes';
3
3
  import { Document } from '../abstract/module.mjs';
4
4
  import * as data from '../data/data.mjs';
5
+ import type { ActiveEffectDataConstructorData } from '../data/data.mjs/activeEffectData.js';
5
6
  import { BaseActor } from './baseActor';
6
7
  import { BaseItem } from './baseItem';
7
8
  import { BaseUser } from './baseUser';
@@ -13,27 +14,32 @@ export declare class BaseActiveEffect extends Document<
13
14
  data.ActiveEffectData,
14
15
  InstanceType<ConfiguredDocumentClass<typeof BaseActor>> | InstanceType<ConfiguredDocumentClass<typeof BaseItem>>
15
16
  > {
17
+ /** @override */
16
18
  static get schema(): ConstructorOf<data.ActiveEffectData>;
17
19
 
20
+ /** @override */
18
21
  static get metadata(): Merge<
19
22
  DocumentMetadata,
20
23
  {
21
24
  name: 'ActiveEffect';
22
25
  collection: 'effects';
23
26
  label: 'DOCUMENT.ActiveEffect';
27
+ labelPlural: 'DOCUMENT.ActiveEffects';
24
28
  isEmbedded: true;
25
29
  }
26
30
  >;
27
31
 
32
+ /** @override */
28
33
  protected _preCreate(
29
- data: ConstructorDataType<data.ActiveEffectData>,
34
+ data: ActiveEffectDataConstructorData,
30
35
  options: DocumentModificationOptions,
31
36
  user: BaseUser
32
37
  ): Promise<void>;
33
38
 
39
+ /** @override */
34
40
  testUserPermission(
35
41
  user: BaseUser,
36
- permission: keyof typeof foundry.CONST.ENTITY_PERMISSIONS | foundry.CONST.EntityPermission,
42
+ permission: keyof typeof foundry.CONST.ENTITY_PERMISSIONS | foundry.CONST.DOCUMENT_PERMISSION_LEVELS,
37
43
  { exact }: { exact?: boolean }
38
44
  ): boolean;
39
45
  }
@@ -1,24 +1,31 @@
1
+ import { ConfiguredDocumentClass } from '../../../types/helperTypes';
1
2
  import { DocumentMetadata, DocumentModificationOptions } from '../abstract/document.mjs';
2
3
  import { Document } from '../abstract/module.mjs';
4
+ import * as data from '../data/data.mjs';
5
+ import type { ActorDataConstructorData } from '../data/data.mjs/actorData.js';
3
6
  import { BaseActiveEffect } from './baseActiveEffect';
4
7
  import { BaseItem } from './baseItem';
5
- import * as data from '../data/data.mjs';
8
+ import { BaseToken } from './baseToken';
6
9
  import { BaseUser } from './baseUser';
7
- import { ConstructorDataType } from '../../../types/helperTypes';
8
10
 
9
- //TODO Add Token as parent class once it is available
10
11
  /**
11
12
  * The base Actor model definition which defines common behavior of an Actor document between both client and server.
12
13
  */
13
- export declare class BaseActor extends Document<data.ActorData, Document<any, any>> {
14
+ export declare class BaseActor extends Document<
15
+ data.ActorData,
16
+ InstanceType<ConfiguredDocumentClass<typeof BaseToken>>
17
+ > {
18
+ /** @override */
14
19
  static get schema(): typeof data.ActorData;
15
20
 
21
+ /** @override */
16
22
  static get metadata(): Merge<
17
23
  DocumentMetadata,
18
24
  {
19
25
  name: 'Actor';
20
26
  collection: 'actors';
21
27
  label: 'DOCUMENT.Actor';
28
+ labelPlural: 'DOCUMENT.Actors';
22
29
  embedded: {
23
30
  ActiveEffect: typeof BaseActiveEffect;
24
31
  Item: typeof BaseItem;
@@ -42,56 +49,21 @@ export declare class BaseActor extends Document<data.ActorData, Document<any, an
42
49
  get items(): this['data']['items'];
43
50
 
44
51
  /**
45
- * Migrate the system data object to conform to data model defined by the current system version.
46
- * @see mergeObject
47
- * @param options - Options which customize how the system data is migrated.
48
- * @returns The migrated system data object, not yet saved to the database
52
+ * The sub-type of Actor.
49
53
  */
50
- migrateSystemData(options?: MigrateSystemDataOptions): object;
54
+ get type(): data.ActorData['type'];
51
55
 
52
- /**
53
- * Perform preliminary operations before a Document of this type is created.
54
- * Pre-creation operations only occur for the client which requested the operation.
55
- * @param data - The initial data used to create the document
56
- * @param options - Additional options which modify the creation request
57
- * @param user - The User requesting the document creation
58
- */
56
+ /** @override */
59
57
  protected _preCreate(
60
- data: ConstructorDataType<data.ActorData>,
58
+ data: ActorDataConstructorData,
61
59
  options: DocumentModificationOptions,
62
60
  user: BaseUser
63
61
  ): Promise<void>;
64
62
 
65
- /**
66
- * Perform preliminary operations before a Document of this type is updated.
67
- * Pre-update operations only occur for the client which requested the operation.
68
- * @param changed - The differential data that is changed relative to the documents prior values
69
- * @param options - Additional options which modify the update request
70
- * @param user - The User requesting the document update
71
- */
63
+ /** @override */
72
64
  protected _preUpdate(
73
- changed: DeepPartial<ConstructorDataType<data.ActorData>>,
65
+ changed: DeepPartial<ActorDataConstructorData>,
74
66
  options: DocumentModificationOptions,
75
67
  user: BaseUser
76
68
  ): Promise<void>;
77
69
  }
78
-
79
- interface MigrateSystemDataOptions {
80
- /**
81
- * Retain keys which exist in the current data, but not the model
82
- * @defaultValue `false`
83
- */
84
- insertKeys?: boolean;
85
-
86
- /**
87
- * Retain inner-object values which exist in the current data, but not the model
88
- * @defaultValue `true`
89
- */
90
- insertValues?: boolean;
91
-
92
- /**
93
- * Require that data types match the model exactly to be retained
94
- * @defaultValue `false`
95
- */
96
- enforceTypes?: boolean;
97
- }
@@ -0,0 +1,38 @@
1
+ import { DocumentMetadata } from '../abstract/document.mjs';
2
+ import { Document } from '../abstract/module.mjs';
3
+ import * as data from '../data/data.mjs';
4
+
5
+ /**
6
+ * The base Adventure model definition which defines common behavior of an Adventure document between both client and server.
7
+ *
8
+ * WARNING: This document is an early prototype which will be fully implemented in V10.
9
+ * Until then it is for internal use only. Use this at your own risk.
10
+ * @internal
11
+ */
12
+ export class BaseAdventure extends Document<data.AdventureData> {
13
+ /** @override */
14
+ static get schema(): typeof data.AdventureData;
15
+
16
+ /** @override */
17
+ static get metadata(): Merge<
18
+ DocumentMetadata,
19
+ {
20
+ name: 'Adventure';
21
+ collection: 'adventures';
22
+ label: 'DOCUMENT.Adventure';
23
+ labelPlural: 'DOCUMENT.Adventures';
24
+ isPrimary: false;
25
+ isEmbedded: false;
26
+ }
27
+ >;
28
+
29
+ /**
30
+ * A convenient reference to the file path of the Adventure's profile image.
31
+ */
32
+ get img(): string | null | undefined;
33
+
34
+ /**
35
+ * Provide a thumbnail image path used to represent the Adventure document.
36
+ */
37
+ get thumbnail(): string | null | undefined;
38
+ }
@@ -11,14 +11,17 @@ export declare class BaseAmbientLight extends Document<
11
11
  data.AmbientLightData,
12
12
  InstanceType<ConfiguredDocumentClass<typeof BaseScene>>
13
13
  > {
14
+ /** @override */
14
15
  static get schema(): typeof data.AmbientLightData;
15
16
 
17
+ /** @override */
16
18
  static get metadata(): Merge<
17
19
  DocumentMetadata,
18
20
  {
19
21
  name: 'AmbientLight';
20
22
  collection: 'lights';
21
23
  label: 'DOCUMENT.AmbientLight';
24
+ labelPlural: 'DOCUMENT.AmbientLights';
22
25
  isEmbedded: true;
23
26
  }
24
27
  >;