@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,33 +1,33 @@
1
+ import {
2
+ ConfiguredDocumentClass,
3
+ ConfiguredFlags,
4
+ FieldReturnType,
5
+ PropertiesToSource
6
+ } from '../../../../types/helperTypes';
1
7
  import DocumentData from '../../abstract/data.mjs';
2
- import { ConfiguredFlags, FieldReturnType, PropertiesToSource } from '../../../../types/helperTypes';
3
- import { CONST, documents } from '../../module.mjs';
8
+ import { documents } from '../../module.mjs';
4
9
  import * as fields from '../fields.mjs';
5
- import { AnimationData, AnimationDataConstructorData } from './animationData';
6
- import { TokenBarData, TokenBarDataConstructorData } from './tokenBarData';
7
10
  import { ActorDataSource } from './actorData.js';
11
+ import { LightData, LightDataConstructorData } from './lightData';
12
+ import { TokenBarData, TokenBarDataConstructorData } from './tokenBarData';
8
13
 
9
- interface VisionFieldOptions {
10
- validate: (d: number) => boolean;
11
- validationError: 'Invalid {name} {field} distance which must be a number with absolute value less than 1000';
12
- }
13
-
14
- export interface TokenDataSchema extends DocumentSchema {
15
- _id: typeof fields.DOCUMENT_ID;
16
- name: typeof fields.STRING_FIELD;
17
- displayName: DocumentField<CONST.TokenDisplayMode> & {
14
+ interface TokenDataSchema extends DocumentSchema {
15
+ _id: fields.DocumentId;
16
+ name: fields.StringField;
17
+ displayName: DocumentField<foundry.CONST.TOKEN_DISPLAY_MODES> & {
18
18
  type: typeof Number;
19
19
  required: true;
20
- default: typeof CONST.TOKEN_DISPLAY_MODES.NONE;
20
+ default: typeof foundry.CONST.TOKEN_DISPLAY_MODES.NONE;
21
21
  validate: (m: any) => boolean;
22
22
  validationError: 'Invalid {name} {field} which must be a value in CONST.TOKEN_DISPLAY_MODES';
23
23
  };
24
24
  actorId: fields.ForeignDocumentField<{ type: documents.BaseActor; required: true }>;
25
- actorLink: typeof fields.BOOLEAN_FIELD;
26
- actorData: typeof fields.OBJECT_FIELD;
27
- img: FieldReturnType<typeof fields.VIDEO_FIELD, { default: () => string }>;
28
- tint: typeof fields.COLOR_FIELD;
29
- width: FieldReturnType<typeof fields.REQUIRED_POSITIVE_NUMBER, { default: number }>;
30
- height: FieldReturnType<typeof fields.REQUIRED_POSITIVE_NUMBER, { default: number }>;
25
+ actorLink: fields.BooleanField;
26
+ actorData: fields.ObjectField;
27
+ img: FieldReturnType<fields.VideoField, { default: () => typeof TokenData.DEFAULT_ICON }>;
28
+ tint: fields.ColorField;
29
+ width: FieldReturnType<fields.RequiredPositiveNumber, { default: 1 }>;
30
+ height: FieldReturnType<fields.RequiredPositiveNumber, { default: 1 }>;
31
31
  scale: DocumentField<number> & {
32
32
  type: typeof Number;
33
33
  required: true;
@@ -35,50 +35,45 @@ export interface TokenDataSchema extends DocumentSchema {
35
35
  validate: (s: unknown) => boolean;
36
36
  validationError: 'Invalid {name} {field} which must be a number between 0.25 and 10';
37
37
  };
38
- mirrorX: typeof fields.BOOLEAN_FIELD;
39
- mirrorY: typeof fields.BOOLEAN_FIELD;
40
- x: typeof fields.REQUIRED_NUMBER;
41
- y: typeof fields.REQUIRED_NUMBER;
42
- elevation: typeof fields.REQUIRED_NUMBER;
43
- lockRotation: typeof fields.BOOLEAN_FIELD;
44
- rotation: FieldReturnType<typeof fields.ANGLE_FIELD, { default: number }>;
38
+ mirrorX: fields.BooleanField;
39
+ mirrorY: fields.BooleanField;
40
+ x: fields.RequiredNumber;
41
+ y: fields.RequiredNumber;
42
+ elevation: fields.RequiredNumber;
43
+ lockRotation: fields.BooleanField;
44
+ rotation: FieldReturnType<fields.AngleField, { default: 0 }>;
45
45
  effects: DocumentField<string[]> & {
46
- type: typeof String[];
46
+ type: [typeof String];
47
47
  required: true;
48
48
  default: string[];
49
49
  };
50
- overlayEffect: typeof fields.STRING_FIELD;
51
- alpha: typeof fields.ALPHA_FIELD;
52
- hidden: typeof fields.BOOLEAN_FIELD;
50
+ overlayEffect: fields.StringField;
51
+ alpha: fields.AlphaField;
52
+ hidden: fields.BooleanField;
53
53
  vision: DocumentField<boolean> & {
54
54
  type: typeof Boolean;
55
55
  required: true;
56
56
  default: (data: { readonly dimSight?: number; readonly brightSight?: number }) => boolean;
57
57
  };
58
- dimSight: FieldReturnType<typeof fields.REQUIRED_NUMBER, VisionFieldOptions>;
59
- brightSight: FieldReturnType<typeof fields.REQUIRED_NUMBER, VisionFieldOptions>;
60
- dimLight: FieldReturnType<typeof fields.REQUIRED_NUMBER, VisionFieldOptions>;
61
- brightLight: FieldReturnType<typeof fields.REQUIRED_NUMBER, VisionFieldOptions>;
62
- sightAngle: typeof fields.ANGLE_FIELD;
63
- lightAngle: typeof fields.ANGLE_FIELD;
64
- lightColor: typeof fields.COLOR_FIELD;
65
- lightAlpha: FieldReturnType<typeof fields.ALPHA_FIELD, { default: 0.25 }>;
66
- lightAnimation: DocumentField<AnimationData> & {
67
- type: typeof AnimationData;
58
+ dimSight: fields.NonnegativeNumberField;
59
+ brightSight: fields.NonnegativeNumberField;
60
+ sightAngle: fields.AngleField;
61
+ light: DocumentField<LightData> & {
62
+ type: typeof LightData;
68
63
  required: true;
69
- default: {};
64
+ default: Record<string, never>;
70
65
  };
71
- disposition: DocumentField<CONST.TokenDisposition> & {
66
+ disposition: DocumentField<foundry.CONST.TOKEN_DISPOSITIONS> & {
72
67
  type: typeof Number;
73
68
  required: true;
74
- default: typeof CONST.TOKEN_DISPOSITIONS.HOSTILE;
69
+ default: typeof foundry.CONST.TOKEN_DISPOSITIONS.HOSTILE;
75
70
  validate: (n: any) => boolean;
76
71
  validationError: 'Invalid {name} {field} which must be a value in CONST.TOKEN_DISPOSITIONS';
77
72
  };
78
- displayBars: DocumentField<CONST.TokenDisplayMode> & {
73
+ displayBars: DocumentField<foundry.CONST.TOKEN_DISPLAY_MODES> & {
79
74
  type: typeof Number;
80
75
  required: true;
81
- default: typeof CONST.TOKEN_DISPLAY_MODES.NONE;
76
+ default: typeof foundry.CONST.TOKEN_DISPLAY_MODES.NONE;
82
77
  validate: (m: any) => boolean;
83
78
  validationError: 'Invalid {name} {field} which must be a value in CONST.TOKEN_DISPLAY_MODES';
84
79
  };
@@ -92,10 +87,10 @@ export interface TokenDataSchema extends DocumentSchema {
92
87
  required: true;
93
88
  default: () => { attribute: Game['system']['data']['secondaryTokenAttribute'] | null };
94
89
  };
95
- flags: typeof fields.OBJECT_FIELD;
90
+ flags: fields.ObjectField;
96
91
  }
97
92
 
98
- export interface TokenDataProperties {
93
+ interface TokenDataProperties {
99
94
  /**
100
95
  * The Token _id which uniquely identifies it within its parent Scene
101
96
  * @defaultValue `null`
@@ -105,13 +100,13 @@ export interface TokenDataProperties {
105
100
  /**
106
101
  * The name used to describe the Token
107
102
  */
108
- name?: string;
103
+ name: string | undefined;
109
104
 
110
105
  /**
111
106
  * The display mode of the Token nameplate, from CONST.TOKEN_DISPLAY_MODES
112
107
  * @defaultValue `CONST.TOKEN_DISPLAY_MODES.NONE`
113
108
  */
114
- displayName: CONST.TokenDisplayMode;
109
+ displayName: foundry.CONST.TOKEN_DISPLAY_MODES;
115
110
 
116
111
  /**
117
112
  * The _id of an Actor document which this Token represents
@@ -133,14 +128,14 @@ export interface TokenDataProperties {
133
128
 
134
129
  /**
135
130
  * A file path to an image or video file used to depict the Token
136
- * @defaultValue `this.DEFAULT_ICON`
131
+ * @defaultValue `TokenData.DEFAULT_ICON`
137
132
  */
138
133
  img: string | null;
139
134
 
140
135
  /**
141
136
  * An optional color tint applied to the Token image
142
137
  */
143
- tint?: string | null;
138
+ tint: string | null | undefined;
144
139
 
145
140
  /**
146
141
  * The width of the Token in grid units
@@ -211,7 +206,7 @@ export interface TokenDataProperties {
211
206
  /**
212
207
  * A single icon path which is displayed as an overlay on the Token
213
208
  */
214
- overlayEffect?: string;
209
+ overlayEffect: string | undefined;
215
210
 
216
211
  /**
217
212
  * The opacity of the token image
@@ -243,18 +238,6 @@ export interface TokenDataProperties {
243
238
  */
244
239
  brightSight: number;
245
240
 
246
- /**
247
- * How far in distance units this Token emits dim light
248
- * @defaultValue `0`
249
- */
250
- dimLight: number;
251
-
252
- /**
253
- * How far in distance units this Token emits bright light
254
- * @defaultValue `0`
255
- */
256
- brightLight: number;
257
-
258
241
  /**
259
242
  * The angle at which this Token is able to see, if it has vision
260
243
  * @defaultValue `360`
@@ -262,49 +245,32 @@ export interface TokenDataProperties {
262
245
  sightAngle: number;
263
246
 
264
247
  /**
265
- * The angle at which this Token is able to emit light
266
- * @defaultValue `360`
267
- */
268
- lightAngle: number;
269
-
270
- /**
271
- * The color of the token's emitted light as an HTML hexadecimal color string
272
- */
273
- lightColor: string | undefined | null;
274
-
275
- /**
276
- * The intensity of any light emitted by the token
277
- * @defaultValue `0.25`
278
- */
279
- lightAlpha: number;
280
-
281
- /**
282
- * A data object which configures token light animation settings
283
- * @defaultValue `{}`
248
+ * Configuration of the light source that this Token emits, if any
249
+ * @defaultValue `new LightData({})`
284
250
  */
285
- lightAnimation: AnimationData;
251
+ light: LightData;
286
252
 
287
253
  /**
288
254
  * A displayed Token disposition from CONST.TOKEN_DISPOSITIONS
289
255
  * @defaultValue `CONST.TOKEN_DISPOSITIONS.HOSTILE`
290
256
  */
291
- disposition: CONST.TokenDisposition;
257
+ disposition: foundry.CONST.TOKEN_DISPOSITIONS;
292
258
 
293
259
  /**
294
260
  * The display mode of Token resource bars, from CONST.TOKEN_DISPLAY_MODES
295
261
  * @defaultValue `CONST.TOKEN_DISPLAY_MODES.NONE`
296
262
  */
297
- displayBars: CONST.TokenDisplayMode;
263
+ displayBars: foundry.CONST.TOKEN_DISPLAY_MODES;
298
264
 
299
265
  /**
300
266
  * The configuration of the Token's primary resource bar
301
- * @defaultValue `{ attribute: game?.system.data.primaryTokenAttribute || null }`
267
+ * @defaultValue `new TokenBarData({ attribute: game?.system.data.primaryTokenAttribute || null })`
302
268
  */
303
269
  bar1: TokenBarData;
304
270
 
305
271
  /**
306
272
  * The configuration of the Token's secondary resource bar
307
- * @defaultValue `{ attribute: game?.system.data.secondaryTokenAttribute || null }`
273
+ * @defaultValue `new TokenBarData({ attribute: game?.system.data.secondaryTokenAttribute || null })`
308
274
  */
309
275
  bar2: TokenBarData;
310
276
 
@@ -315,29 +281,29 @@ export interface TokenDataProperties {
315
281
  flags: ConfiguredFlags<'Token'>;
316
282
  }
317
283
 
318
- export interface TokenDataConstructorData {
284
+ interface TokenDataConstructorData {
319
285
  /**
320
286
  * The Token _id which uniquely identifies it within its parent Scene
321
287
  * @defaultValue `null`
322
288
  */
323
- _id?: string | null;
289
+ _id?: string | null | undefined;
324
290
 
325
291
  /**
326
292
  * The name used to describe the Token
327
293
  */
328
- name?: string | null;
294
+ name?: string | null | undefined;
329
295
 
330
296
  /**
331
297
  * The display mode of the Token nameplate, from CONST.TOKEN_DISPLAY_MODES
332
298
  * @defaultValue `CONST.TOKEN_DISPLAY_MODES.NONE`
333
299
  */
334
- displayName?: CONST.TokenDisplayMode | null;
300
+ displayName?: foundry.CONST.TOKEN_DISPLAY_MODES | null | undefined;
335
301
 
336
302
  /**
337
303
  * The _id of an Actor document which this Token represents
338
304
  * @defaultValue `null`
339
305
  */
340
- actorId?: string | null;
306
+ actorId?: InstanceType<ConfiguredDocumentClass<typeof documents.BaseActor>> | string | null | undefined;
341
307
 
342
308
  /**
343
309
  * Does this Token uniquely represent a singular Actor, or is it one of many?
@@ -349,190 +315,161 @@ export interface TokenDataConstructorData {
349
315
  * Token-level data which overrides the base data of the associated Actor
350
316
  * @defaultValue `{}`
351
317
  */
352
- actorData?: Partial<ActorDataSource> | null;
318
+ actorData?: Partial<ActorDataSource> | null | undefined;
353
319
 
354
320
  /**
355
321
  * A file path to an image or video file used to depict the Token
356
- * @defaultValue `this.DEFAULT_ICON`
322
+ * @defaultValue `TokenData.DEFAULT_ICON`
357
323
  */
358
- img?: string | null;
324
+ img?: string | null | undefined;
359
325
 
360
326
  /**
361
327
  * An optional color tint applied to the Token image
362
328
  */
363
- tint?: string | null;
329
+ tint?: string | null | undefined;
364
330
 
365
331
  /**
366
332
  * The width of the Token in grid units
367
333
  * @defaultValue `1`
368
334
  */
369
- width?: number | null;
335
+ width?: number | null | undefined;
370
336
 
371
337
  /**
372
338
  * The height of the Token in grid units
373
339
  * @defaultValue `1`
374
340
  */
375
- height?: number | null;
341
+ height?: number | null | undefined;
376
342
 
377
343
  /**
378
344
  * A scale factor applied to the Token image, between 0.25 and 3
379
345
  * @defaultValue `1`
380
346
  */
381
- scale?: number | null;
347
+ scale?: number | null | undefined;
382
348
 
383
349
  /**
384
350
  * Flip the Token image horizontally?
385
351
  * @defaultValue `false`
386
352
  */
387
- mirrorX?: boolean | null;
353
+ mirrorX?: boolean | null | undefined;
388
354
 
389
355
  /**
390
356
  * Flip the Token image vertically?
391
357
  * @defaultValue `false`
392
358
  */
393
- mirrorY?: boolean | null;
359
+ mirrorY?: boolean | null | undefined;
394
360
 
395
361
  /**
396
362
  * The x-coordinate of the top-left corner of the Token
397
363
  * @defaultValue `0`
398
364
  */
399
- x?: number | null;
365
+ x?: number | null | undefined;
400
366
 
401
367
  /**
402
368
  * The y-coordinate of the top-left corner of the Token
403
369
  * @defaultValue `0`
404
370
  */
405
- y?: number | null;
371
+ y?: number | null | undefined;
406
372
 
407
373
  /**
408
374
  * The vertical elevation of the Token, in distance units
409
375
  * @defaultValue `0`
410
376
  */
411
- elevation?: number | null;
377
+ elevation?: number | null | undefined;
412
378
 
413
379
  /**
414
380
  * Prevent the Token image from visually rotating?
415
381
  * @defaultValue `false`
416
382
  */
417
- lockRotation?: boolean | null;
383
+ lockRotation?: boolean | null | undefined;
418
384
 
419
385
  /**
420
386
  * The rotation of the Token in degrees, from 0 to 360. A value of 0 represents a southward-facing Token.
421
387
  * @defaultValue `0`
422
388
  */
423
- rotation?: number | null;
389
+ rotation?: number | null | undefined;
424
390
 
425
391
  /**
426
392
  * An array of effect icon paths which are displayed on the Token
427
393
  * @defaultValue `[]`
428
394
  */
429
- effects?: string[] | null;
395
+ effects?: string[] | null | undefined;
430
396
 
431
397
  /**
432
398
  * A single icon path which is displayed as an overlay on the Token
433
399
  */
434
- overlayEffect?: string | null;
400
+ overlayEffect?: string | null | undefined;
435
401
 
436
402
  /**
437
403
  * The opacity of the token image
438
404
  * @defaultValue `1`
439
405
  */
440
- alpha?: number | null;
406
+ alpha?: number | null | undefined;
441
407
 
442
408
  /**
443
409
  * Is the Token currently hidden from player view?
444
410
  * @defaultValue `false`
445
411
  */
446
- hidden?: boolean | null;
412
+ hidden?: boolean | null | undefined;
447
413
 
448
414
  /**
449
415
  * Is this Token a source of vision?
450
416
  * @defaultValue Whether dimSight or brightSight have a value greater 0.
451
417
  */
452
- vision?: boolean | null;
418
+ vision?: boolean | null | undefined;
453
419
 
454
420
  /**
455
421
  * How far in distance units the Token can naturally see as if in dim light
456
422
  * @defaultValue `0`
457
423
  */
458
- dimSight?: number | null;
424
+ dimSight?: number | null | undefined;
459
425
 
460
426
  /**
461
427
  * How far in distance units the Token can naturally see as if in bright light
462
428
  * @defaultValue `0`
463
429
  */
464
- brightSight?: number | null;
465
-
466
- /**
467
- * How far in distance units this Token emits dim light
468
- * @defaultValue `0`
469
- */
470
- dimLight?: number | null;
471
-
472
- /**
473
- * How far in distance units this Token emits bright light
474
- * @defaultValue `0`
475
- */
476
- brightLight?: number | null;
430
+ brightSight?: number | null | undefined;
477
431
 
478
432
  /**
479
433
  * The angle at which this Token is able to see, if it has vision
480
434
  * @defaultValue `360`
481
435
  */
482
- sightAngle?: number | null;
483
-
484
- /**
485
- * The angle at which this Token is able to emit light
486
- * @defaultValue `360`
487
- */
488
- lightAngle?: number | null;
436
+ sightAngle?: number | null | undefined;
489
437
 
490
438
  /**
491
- * The color of the token's emitted light as an HTML hexadecimal color string
439
+ * Configuration of the light source that this Token emits, if any
440
+ * @defaultValue `new LightData({})`
492
441
  */
493
- lightColor?: string | null;
494
-
495
- /**
496
- * The intensity of any light emitted by the token
497
- * @defaultValue `0.25`
498
- */
499
- lightAlpha?: number | null;
500
-
501
- /**
502
- * A data object which configures token light animation settings
503
- * @defaultValue `{}`
504
- */
505
- lightAnimation?: AnimationDataConstructorData | null;
442
+ light?: LightDataConstructorData | null | undefined;
506
443
 
507
444
  /**
508
445
  * A displayed Token disposition from CONST.TOKEN_DISPOSITIONS
509
446
  * @defaultValue `CONST.TOKEN_DISPOSITIONS.HOSTILE`
510
447
  */
511
- disposition?: CONST.TokenDisposition | null;
448
+ disposition?: foundry.CONST.TOKEN_DISPOSITIONS | null | undefined;
512
449
 
513
450
  /**
514
451
  * The display mode of Token resource bars, from CONST.TOKEN_DISPLAY_MODES
515
452
  * @defaultValue `CONST.TOKEN_DISPLAY_MODES.NONE`
516
453
  */
517
- displayBars?: CONST.TokenDisplayMode | null;
454
+ displayBars?: foundry.CONST.TOKEN_DISPLAY_MODES | null | undefined;
518
455
 
519
456
  /**
520
457
  * The configuration of the Token's primary resource bar
521
- * @defaultValue `{ attribute: game?.system.data.primaryTokenAttribute || null }`
458
+ * @defaultValue `new TokenBarData({ attribute: game?.system.data.primaryTokenAttribute || null })`
522
459
  */
523
- bar1?: TokenBarDataConstructorData | null;
460
+ bar1?: TokenBarDataConstructorData | null | undefined;
524
461
 
525
462
  /**
526
463
  * The configuration of the Token's secondary resource bar
527
- * @defaultValue `{ attribute: game?.system.data.secondaryTokenAttribute || null }`
464
+ * @defaultValue `new TokenBarData({ attribute: game?.system.data.secondaryTokenAttribute || null })`
528
465
  */
529
- bar2?: TokenBarDataConstructorData | null;
466
+ bar2?: TokenBarDataConstructorData | null | undefined;
530
467
 
531
468
  /**
532
469
  * An object of optional key/value flags
533
470
  * @defaultValue `{}`
534
471
  */
535
- flags?: ConfiguredFlags<'Token'> | null;
472
+ flags?: ConfiguredFlags<'Token'> | null | undefined;
536
473
  }
537
474
 
538
475
  /**
@@ -545,14 +482,25 @@ export class TokenData extends DocumentData<
545
482
  TokenDataConstructorData,
546
483
  documents.BaseToken
547
484
  > {
485
+ /** @override */
548
486
  static defineSchema(): TokenDataSchema;
549
487
 
550
488
  /**
551
- * The default icon used for newly created Item documents
489
+ * The default icon used for newly created Token documents
552
490
  * @defaultValue `CONST.DEFAULT_TOKEN`
553
491
  */
554
492
  static DEFAULT_ICON: string;
493
+
494
+ /**
495
+ * Migrate TokenData attributes to the new inner LightData structure.
496
+ * This can be safely removed after several major versions have passed. Maybe V12?
497
+ * @override
498
+ */
499
+ _initializeSource(data: TokenDataConstructorData): PropertiesToSource<TokenDataProperties>;
500
+
501
+ /** @override */
502
+ protected _initialize(): void;
555
503
  }
556
504
 
557
505
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
558
- export declare interface TokenData extends TokenDataProperties {}
506
+ export interface TokenData extends TokenDataProperties {}